chiark / gitweb /
configure.ac: Some random formatting tweaks.
[tripe] / configure.ac
index 5b5eaa2..d1eb4d2 100644 (file)
@@ -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,6 +31,7 @@ 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
@@ -40,6 +41,11 @@ 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.
 
@@ -50,18 +56,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.1.0])
+PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.4])
 
-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.
@@ -90,8 +95,9 @@ 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])
@@ -205,28 +211,32 @@ AC_ARG_WITH([wireshark],
            esac],
            [haveshark=yes needshark=no])
 
-dnl Try to find the Wireshark installation directory the hard way.
+dnl Try to find the Wireshark installation directory the hard way.  This is
+dnl remarkably annoying.  This is, unfortunately, very likely to guess wrong,
+dnl but there doesn't seem to be a better way.
 case "$haveshark,$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
-       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
+      mdw_cv_wireshark_plugin_dir=$(
+       for i in \
+         $libexecdir $libdir $exec_prefix/lib $prefix/lib \
+         /usr/local/lib /usr/lib
+       do
+         for j in \
+           wireshark/plugins/* wireshark/*/plugins \
+           */wireshark/plugins/* */wireshark/*/plugins
+         do
+           for k in $i/$j/*.so; do
+             if test -f "$k"; then
+               echo $(AS_DIRNAME(["$k"]))
+               exit
+             fi
+           done
+         done
+       done
+       echo "failed"
+      )
     ])
     case $mdw_cv_wireshark_plugin_dir in
       failed) haveshark=no ;;
@@ -236,7 +246,7 @@ esac
 
 dnl If we're still interested, find Glib.
 case "$haveshark" in
-  yes) AM_PATH_GLIB([1.2.0], [], haveshark=false, [gmodule]) ;;
+  yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
 esac
 
 dnl Find the include directory.  This would be much easier if they just
@@ -282,7 +292,7 @@ case "$haveshark,$needshark" in
     AC_MSG_ERROR([failed to configure Wireshark plugin])
     ;;
   yes,*)
-    WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
+    WIRESHARK_CFLAGS="$GLIB_CFLAGS $mdw_cv_wireshark_includes"
     AC_SUBST(WIRESHARK_CFLAGS)
     AC_SUBST(wireshark_plugindir)
     ;;
@@ -293,6 +303,9 @@ 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])
 
@@ -300,6 +313,7 @@ AC_CONFIG_FILES(
   [Makefile]
   [common/Makefile]
   [uslip/Makefile]
+  [pathmtu/Makefile]
   [client/Makefile]
   [priv/Makefile]
   [server/Makefile]
@@ -307,9 +321,13 @@ AC_CONFIG_FILES(
   [pkstream/Makefile]
   [wireshark/Makefile]
   [init/Makefile]
+  [py/Makefile]
+  [peerdb/Makefile]
   [keys/Makefile]
+  [svc/Makefile]
   [mon/Makefile]
+  [contrib/Makefile]
   [t/Makefile t/atlocal])
 AC_OUTPUT
 
-dnl ----- That's all, folks -------------------------------------------------
+dnl----- That's all, folks --------------------------------------------------