X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/6b6ad6702f305891ced3b9a7cf3061c75eabda86..03e37cbca5023308bbe7da3f4e4e8a66890e51aa:/configure.ac diff --git a/configure.ac b/configure.ac index 1c67cb78..33ce67dd 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ dnl dnl (c) 2001 Straylight/Edgeware dnl -dnl ----- Licensing notice -------------------------------------------------- +dnl----- Licensing notice --------------------------------------------------- dnl dnl This file is part of Trivial IP Encryption (TrIPE). dnl @@ -31,13 +31,22 @@ AC_INIT([tripe], AUTO_VERSION, [mdw@distorted.org.uk]) AC_CONFIG_SRCDIR([server/tripe.h]) AC_CONFIG_AUX_DIR([config]) AM_INIT_AUTOMAKE([foreign]) +mdw_SILENT_RULES AC_PROG_CC AM_PROG_CC_C_O AX_CFLAGS_WARN_ALL +AX_TYPE_SOCKLEN_T AC_CANONICAL_HOST AM_PROG_LIBTOOL +AC_CHECK_PROGS([AUTOM4TE], [autom4te]) + +mdw_ORIG_CFLAGS=$CFLAGS +mdw_ORIG_CPPFLAGS=$CPPFLAGS +AC_SUBST(AM_CFLAGS) +AC_SUBST(AM_CPPFLAGS) + dnl-------------------------------------------------------------------------- dnl C programming environment. @@ -48,18 +57,17 @@ AC_SEARCH_LIBS([socket], [socket]) case "$host_os" in linux) AC_ARG_WITH([linux-includes], - AS_HELP_STRING( + AS_HELP_STRING( [--with-linux-includes=DIR], [Linux kernel includes]), - [CFLAGS="$CFLAGS -I$withval"], [:]) + [AM_CPPFLAGS="AM_CPPFLAGS -I$withval"], [:]) ;; esac -PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4]) -PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1]) +PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1]) +PKG_CHECK_MODULES([catacomb], [catacomb >= 2.2.2-38]) -CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS" -LIBS="$LIBS $mLib_LIBS" +AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS" dnl-------------------------------------------------------------------------- dnl Directories to install things into. @@ -88,12 +96,22 @@ TRIPE_DEFINE_PATH( [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid]) TRIPE_DEFINE_PATH( - [initconfig], [FILE], [configuration for init script [[/etc/tripe.conf]]], - [/etc/tripe.conf]) + [initconfig], [FILE], + [configuration for init script [[SYSCONFDIR/tripe.conf]]], + ['${sysconfdir}/tripe.conf']) TRIPE_DEFINE_PATH( [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log]) +dnl-------------------------------------------------------------------------- +dnl Privilege-separation helper. + +mdw_DEFINE_PATHS([ + AC_DEFINE_UNQUOTED([PRIVSEP_HELPER], + ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"], + [Pathname of privilege-separation helper.]) +]) + dnl-------------------------------------------------------------------------- dnl Other options. @@ -163,107 +181,67 @@ dnl Find out whether Python exists at all. AM_PATH_PYTHON([2.4], [python=yes], [python=no]) AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes]) -dnl Find out whether we can use Catacomb and GTK. +dnl Find out whether we can use the various external modules. if test $python = yes; then AC_PYTHON_MODULE([pygtk]) + AC_PYTHON_MODULE([cdb]) + AC_PYTHON_MODULE([mLib]) AC_PYTHON_MODULE([catacomb]) fi AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes]) +AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes]) +AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes]) AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes]) dnl-------------------------------------------------------------------------- dnl Wireshark. -dnl -dnl This is all distressingly ugly and complicated. Why they can't just -dnl provide a pkg-config dropping containing all the useful information about -dnl the installation I don't know. - -WIRESHARK_CFLAGS="" -: ${wireshark_plugindir=unknown} dnl Get the user to help. +wireshark_plugindir=unknown AC_ARG_WITH([wireshark], AS_HELP_STRING( - [--with-wireshark[=DIR]], + [--with-wireshark], [build and install Wireshark plugin]), [case "$withval" in - no) haveshark=no needshark=no ;; - yes) haveshark=yes needshark=yes ;; - *) haveshark=yes needshark=yes - wireshark_plugindir=$withval ;; + no) wantshark=no mustshark=no ;; + yes) wantshark=yes mustshark=yes ;; + *) wantshark=yes mustshark=yes + wireshark_plugindir=$withval ;; esac], - [haveshark=yes needshark=no]) + [wantshark=yes mustshark=no]) -dnl Try to find the Wireshark installation directory the hard way. -case "$haveshark,$wireshark_plugindir" in +case "$wantshark,$wireshark_plugindir" in yes,unknown) AC_CACHE_CHECK([where to put Wireshark plugins], [mdw_cv_wireshark_plugin_dir], [ - mdw_cv_wireshark_plugin_dir="failed" - wsprefix=none - for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do - if test -x "$i/bin/tshark"; then - wsprefix=$i - break + mdw_cv_wireshark_plugin_dir=$( + $PKG_CONFIG --variable=plugindir "wireshark >= 1.12.1") + dnl It seems that the Debian package has a habit of bungling the + dnl plugin path (#779788, #857729, ...). + case "$mdw_cv_wireshark_plugin_dir" in + /usr//usr/*) + mdw_cv_wireshark_plugin_dir=${mdw_cv_wireshark_plugin_dir#/usr/} + ;; + esac]) + case "$mdw_cv_wireshark_plugin_dir" in + /*) + if test ! -d "$mdw_cv_wireshark_plugin_dir"; then + AC_MSG_WARN([alleged Wireshark plugin directory $mdw_cv_wireshark_plugin_dir doesn't exist]) + haveshark=no + else + wireshark_plugindir=$mdw_cv_wireshark_plugin_dir + haveshark=yes fi - done - if test "$wsprefix" != none; then - wsbin=$wsprefix/bin/tshark - wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']` - dir=$wsprefix/lib/wireshark/plugins - test -d "$dir/$wsver" && dir="$dir/$wsver" - if test -d "$dir"; then - mdw_cv_wireshark_plugin_dir=$dir - fi - fi - ]) - case $mdw_cv_wireshark_plugin_dir in - failed) haveshark=no ;; - *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;; - esac -esac - -dnl If we're still interested, find Glib. -case "$haveshark" in - yes) AM_PATH_GLIB([1.2.0], [], haveshark=false, [gmodule]) ;; -esac - -dnl Find the include directory. This would be much easier if they just -dnl provided a pkg-config file. -case "$haveshark" in - yes) - bad=yes - mdw_CFLAGS=$CFLAGS - wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'` - AC_CACHE_CHECK([how to find the Wireshark headers], - [mdw_cv_wireshark_includes], [ - mdw_cv_wireshark_includes=failed - for i in \ - "" \ - "-I${wsprefix}/include/wireshark" \ - "-I${wsprefix}/include" \ - "-I${prefix}/include/wireshark" \ - "-I${prefix}/include" \ - "-I/usr/include/wireshark" \ - "-I/usr/local/include/wireshark" \ - "-I/usr/local/include"; do - CFLAGS="$GLIB_CFLAGS $i" - AC_TRY_COMPILE([ -#include -#include -#include -#include ], - [dissector_handle_t dh; dh = create_dissector_handle(0, 0);], - [bad=no; break]) - done - case "$bad" in - no) mdw_cv_wireshark_includes=$i ;; - esac - CFLAGS=$mdw_CFLAGS - ]) - case "$mdw_cv_wireshark_includes" in - failed) haveshark=no ;; + ;; + *) + AC_MSG_WARN([failed to read Wireshark plugin directory]) + haveshark=no + ;; esac + ;; + no,*) + haveshark=no + ;; esac case "$haveshark,$needshark" in @@ -271,8 +249,6 @@ case "$haveshark,$needshark" in AC_MSG_ERROR([failed to configure Wireshark plugin]) ;; yes,*) - WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes" - AC_SUBST(WIRESHARK_CFLAGS) AC_SUBST(wireshark_plugindir) ;; esac @@ -282,19 +258,31 @@ AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes]) dnl-------------------------------------------------------------------------- dnl Produce output. +CFLAGS=$mdw_ORIG_CFLAGS +CPPFLAGS=$mdw_ORIG_CPPFLAGS + AC_CONFIG_HEADER([config/config.h]) +AC_CONFIG_TESTDIR([t]) AC_CONFIG_FILES( [Makefile] [common/Makefile] + [uslip/Makefile] + [pathmtu/Makefile] [client/Makefile] + [priv/Makefile] [server/Makefile] [proxy/Makefile] [pkstream/Makefile] [wireshark/Makefile] [init/Makefile] + [py/Makefile] + [peerdb/Makefile] [keys/Makefile] - [mon/Makefile]) + [svc/Makefile] + [mon/Makefile] + [contrib/Makefile] + [t/Makefile t/atlocal]) AC_OUTPUT -dnl ----- That's all, folks ------------------------------------------------- +dnl----- That's all, folks --------------------------------------------------