chiark / gitweb /
General overhaul of tunnelling: allow multiple tunnel drivers in one daemon,
[tripe] / configure.in
index c6d702e72207b0f40ee9bac8882afaeb6b93b260..d0c2dbd71ffdb0816c20ba9c4382d7b33b56c021 100644 (file)
@@ -84,14 +84,15 @@ AC_ARG_WITH([ethereal],
 esac],
 [ethereal=true requireethereal=false])
 
 esac],
 [ethereal=true requireethereal=false])
 
-tun=guess
+tun=auto
 AC_ARG_WITH([tunnel],
 AC_ARG_WITH([tunnel],
-[  --with-tunnel=KIND      kind of tunnel device to use
+[  --with-tunnel=KIND      kinds of tunnel device to use
                             (linux, unet, bsd, slip)],
 [tun=$withval])
 
                             (linux, unet, bsd, slip)],
 [tun=$withval])
 
-if test "$tun" = guess; then
-  AC_CACHE_CHECK([tunnel device to use], [mdw_cv_tunnel], [
+if test "$tun" = auto; then
+  AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
+    mdw_cv_tunnel=""
     case $host_os in
       linux*)
        case `uname -r` in
     case $host_os in
       linux*)
        case `uname -r` in
@@ -108,21 +109,29 @@ changequote([,])dnl
       *bsd*)
        mdw_cv_tunnel=bsd
        ;;
       *bsd*)
        mdw_cv_tunnel=bsd
        ;;
-      *)
-        mdw_cv_tunnel=slip
-       ;;
     esac
     esac
+    mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
   ])
   tun=$mdw_cv_tunnel
 fi
 
   ])
   tun=$mdw_cv_tunnel
 fi
 
-case $tun in
-  linux | unet | bsd | slip) ;;
-  *) AC_MSG_ERROR([Unknown tunnel type]) ;;
-esac
-AC_DEFINE_UNQUOTED([TUN_TYPE], [TUN_`echo $tun | tr a-z A-Z`],
-  [Set to the tunnel driver for your OS.  See TUN_* in tripe.h.])
+tunnels=""
+for i in $tun; do
+  case $i in
+    linux) AC_DEFINE([TUN_LINUX], [1],
+                    [Install the Linux TUN/TAP driver.]) ;;
+    bsd) AC_DEFINE([TUN_BSD], [1],
+                  [Install the BSD tunnel driver.]) ;;
+    unet) AC_DEFINE([TUN_UNET], [1],
+                    [Install the obsolete Linux Usernet driver.]) ;;
+    slip) ;;
+    *) AC_MSG_ERROR([Unknown tunnel type]) ;;
+  esac
+  tunnels="$tunnels&tun_$i, "
+done
 AC_SUBST(tun)
 AC_SUBST(tun)
+AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0], 
+  [List of tunnel drivers to install.])
 
 mdw_MLIB(2.0.0)
 mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
 
 mdw_MLIB(2.0.0)
 mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])