| 1 | dnl -*-autoconf-*- |
| 2 | dnl |
| 3 | dnl Configuration script for TrIPE |
| 4 | dnl |
| 5 | dnl (c) 2001 Straylight/Edgeware |
| 6 | dnl |
| 7 | |
| 8 | dnl----- Licensing notice --------------------------------------------------- |
| 9 | dnl |
| 10 | dnl This file is part of Trivial IP Encryption (TrIPE). |
| 11 | dnl |
| 12 | dnl TrIPE is free software: you can redistribute it and/or modify it under |
| 13 | dnl the terms of the GNU General Public License as published by the Free |
| 14 | dnl Software Foundation; either version 3 of the License, or (at your |
| 15 | dnl option) any later version. |
| 16 | dnl |
| 17 | dnl TrIPE is distributed in the hope that it will be useful, but WITHOUT |
| 18 | dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 19 | dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 20 | dnl for more details. |
| 21 | dnl |
| 22 | dnl You should have received a copy of the GNU General Public License |
| 23 | dnl along with TrIPE. If not, see <https://www.gnu.org/licenses/>. |
| 24 | |
| 25 | dnl-------------------------------------------------------------------------- |
| 26 | dnl Initialization. |
| 27 | |
| 28 | mdw_AUTO_VERSION |
| 29 | AC_INIT([tripe], AUTO_VERSION, [mdw@distorted.org.uk]) |
| 30 | AC_CONFIG_SRCDIR([server/tripe.h]) |
| 31 | AC_CONFIG_AUX_DIR([config]) |
| 32 | AM_INIT_AUTOMAKE([foreign]) |
| 33 | mdw_SILENT_RULES |
| 34 | |
| 35 | AC_PROG_CC |
| 36 | AM_PROG_CC_C_O |
| 37 | AX_CFLAGS_WARN_ALL |
| 38 | AX_TYPE_SOCKLEN_T |
| 39 | AC_CANONICAL_HOST |
| 40 | AC_PROG_RANLIB |
| 41 | |
| 42 | AC_CHECK_PROGS([AUTOM4TE], [autom4te]) |
| 43 | |
| 44 | mdw_ORIG_CFLAGS=$CFLAGS |
| 45 | mdw_ORIG_CPPFLAGS=$CPPFLAGS |
| 46 | AC_SUBST(AM_CFLAGS) |
| 47 | AC_SUBST(AM_CPPFLAGS) |
| 48 | |
| 49 | dnl-------------------------------------------------------------------------- |
| 50 | dnl C programming environment. |
| 51 | |
| 52 | AC_CHECK_HEADERS([stdarg.h]) |
| 53 | |
| 54 | AC_SEARCH_LIBS([socket], [socket]) |
| 55 | |
| 56 | case "$host_os" in |
| 57 | linux) |
| 58 | AC_ARG_WITH([linux-includes], |
| 59 | AS_HELP_STRING( |
| 60 | [--with-linux-includes=DIR], |
| 61 | [Linux kernel includes]), |
| 62 | [AM_CPPFLAGS="AM_CPPFLAGS -I$withval"], [:]) |
| 63 | ;; |
| 64 | esac |
| 65 | |
| 66 | AC_CHECK_FUNCS([getifaddrs]) |
| 67 | |
| 68 | AC_ARG_WITH([adns], |
| 69 | AS_HELP_STRING([--with-adns], |
| 70 | [use ADNS library for background name resolution]), |
| 71 | [want_adns=$withval], |
| 72 | [want_adns=auto]) |
| 73 | case $want_adns in |
| 74 | no) ;; |
| 75 | *) AC_CHECK_LIB([adns], [adns_submit], [have_adns=yes], [have_adns=no]) ;; |
| 76 | esac |
| 77 | AC_SUBST([ADNS_LIBS]) |
| 78 | case $want_adns,$have_adns in |
| 79 | yes,no) |
| 80 | AC_MSG_ERROR([ADNS library not found but explicitly requested]) |
| 81 | ;; |
| 82 | yes,yes | auto,yes) |
| 83 | ADNS_LIBS="-ladns" |
| 84 | AC_DEFINE([HAVE_LIBADNS], [1], |
| 85 | [Define if the GNU adns library is available.]) |
| 86 | ;; |
| 87 | esac |
| 88 | |
| 89 | PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1]) |
| 90 | PKG_CHECK_MODULES([catacomb], [catacomb >= 2.4.2-70]) |
| 91 | |
| 92 | AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS" |
| 93 | |
| 94 | dnl-------------------------------------------------------------------------- |
| 95 | dnl Directories to install things into. |
| 96 | |
| 97 | dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP]) |
| 98 | AC_DEFUN([TRIPE_DEFINE_PATH], [ |
| 99 | AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]), |
| 100 | [$1=$withval], [$1=$4]) |
| 101 | AC_SUBST([$1]) |
| 102 | m4_if([$5], [], [], [ |
| 103 | mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])]) |
| 104 | ]) |
| 105 | ]) |
| 106 | |
| 107 | dnl Actual options. |
| 108 | TRIPE_DEFINE_PATH( |
| 109 | [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]], |
| 110 | ['${localstatedir}/tripe'], |
| 111 | [CONFIGDIR], [Look for keys and other configuration here.]) |
| 112 | |
| 113 | TRIPE_DEFINE_PATH( |
| 114 | [socketdir], [DIR], [admin socket [[.]]], [.], |
| 115 | [SOCKETDIR], [Create or look for administration socket here.]) |
| 116 | |
| 117 | TRIPE_DEFINE_PATH( |
| 118 | [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid]) |
| 119 | |
| 120 | TRIPE_DEFINE_PATH( |
| 121 | [initconfig], [FILE], |
| 122 | [configuration for init script [[SYSCONFDIR/tripe.conf]]], |
| 123 | ['${sysconfdir}/tripe.conf']) |
| 124 | |
| 125 | TRIPE_DEFINE_PATH( |
| 126 | [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log]) |
| 127 | |
| 128 | dnl-------------------------------------------------------------------------- |
| 129 | dnl Privilege-separation helper. |
| 130 | |
| 131 | mdw_DEFINE_PATHS([ |
| 132 | AC_DEFINE_UNQUOTED([PRIVSEP_HELPER], |
| 133 | ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"], |
| 134 | [Pathname of privilege-separation helper.]) |
| 135 | ]) |
| 136 | |
| 137 | dnl-------------------------------------------------------------------------- |
| 138 | dnl Other options. |
| 139 | |
| 140 | AC_ARG_WITH([tracing], |
| 141 | AS_HELP_STRING( |
| 142 | [--without-tracing], |
| 143 | [compile out tracing support (not recommended)]), |
| 144 | [test "$withval" = no && |
| 145 | AC_DEFINE([NTRACE], [1], [Disable all tracing.])], |
| 146 | [:]) |
| 147 | |
| 148 | dnl-------------------------------------------------------------------------- |
| 149 | dnl Tunnel devices. |
| 150 | |
| 151 | dnl Provide the user with a choice. |
| 152 | AC_ARG_WITH([tunnel], |
| 153 | AS_HELP_STRING( |
| 154 | [--with-tunnel=KIND], |
| 155 | [kinds of tunnel device to use (linux, unet, bsd, slip)]), |
| 156 | [tun=$withval], [tun=auto]) |
| 157 | |
| 158 | dnl If he doesn't choose, pick something sensible. |
| 159 | if test "$tun" = auto; then |
| 160 | AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [ |
| 161 | mdw_cv_tunnel="" |
| 162 | case $host_os in |
| 163 | linux*) |
| 164 | case `uname -r` in |
| 165 | [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*]) |
| 166 | mdw_cv_tunnel=linux |
| 167 | ;; |
| 168 | *) |
| 169 | mdw_cv_tunnel=unet |
| 170 | ;; |
| 171 | esac |
| 172 | ;; |
| 173 | *bsd*) |
| 174 | mdw_cv_tunnel=bsd |
| 175 | ;; |
| 176 | esac |
| 177 | mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip |
| 178 | ]) |
| 179 | tun=$mdw_cv_tunnel |
| 180 | fi |
| 181 | |
| 182 | tunnels="" |
| 183 | for i in $tun; do |
| 184 | case $i in |
| 185 | linux) AC_DEFINE([TUN_LINUX], [1], |
| 186 | [Install the Linux TUN/TAP driver.]) ;; |
| 187 | bsd) AC_DEFINE([TUN_BSD], [1], |
| 188 | [Install the BSD tunnel driver.]) ;; |
| 189 | unet) AC_DEFINE([TUN_UNET], [1], |
| 190 | [Install the obsolete Linux Usernet driver.]) ;; |
| 191 | slip) ;; |
| 192 | *) AC_MSG_ERROR([Unknown tunnel type]) ;; |
| 193 | esac |
| 194 | tunnels="$tunnels&tun_$i, " |
| 195 | done |
| 196 | AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0], |
| 197 | [List of tunnel drivers to install.]) |
| 198 | |
| 199 | dnl-------------------------------------------------------------------------- |
| 200 | dnl Python. |
| 201 | |
| 202 | dnl Find out whether Python exists at all. |
| 203 | AM_PATH_PYTHON([2.4], [python=yes], [python=no]) |
| 204 | AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes]) |
| 205 | |
| 206 | dnl Find out whether we can use the various external modules. |
| 207 | if test $python = yes; then |
| 208 | AC_PYTHON_MODULE([pygtk]) |
| 209 | AC_PYTHON_MODULE([cdb]) |
| 210 | AC_PYTHON_MODULE([mLib]) |
| 211 | AC_PYTHON_MODULE([catacomb]) |
| 212 | fi |
| 213 | AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes]) |
| 214 | AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes]) |
| 215 | AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes]) |
| 216 | AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes]) |
| 217 | |
| 218 | dnl-------------------------------------------------------------------------- |
| 219 | dnl Wireshark. |
| 220 | |
| 221 | dnl Get the user to help. |
| 222 | wireshark_plugindir=unknown |
| 223 | AC_ARG_WITH([wireshark], |
| 224 | AS_HELP_STRING( |
| 225 | [--with-wireshark], |
| 226 | [build and install Wireshark plugin]), |
| 227 | [case "$withval" in |
| 228 | no) wantshark=no mustshark=no ;; |
| 229 | yes) wantshark=yes mustshark=yes ;; |
| 230 | *) wantshark=yes mustshark=yes |
| 231 | wireshark_plugindir=$withval ;; |
| 232 | esac], |
| 233 | [wantshark=yes mustshark=no]) |
| 234 | |
| 235 | case "$wantshark,$wireshark_plugindir" in |
| 236 | yes,unknown) |
| 237 | AC_CACHE_CHECK([where to put Wireshark plugins], |
| 238 | [mdw_cv_wireshark_plugin_dir], [ |
| 239 | mdw_cv_wireshark_plugin_dir=$( |
| 240 | $PKG_CONFIG --variable=plugindir "wireshark >= 1.12.1") |
| 241 | dnl It seems that the Debian package has a habit of bungling the |
| 242 | dnl plugin path (#779788, #857729, ...). |
| 243 | case "$mdw_cv_wireshark_plugin_dir" in |
| 244 | /usr//usr/*) |
| 245 | mdw_cv_wireshark_plugin_dir=${mdw_cv_wireshark_plugin_dir#/usr/} |
| 246 | ;; |
| 247 | esac]) |
| 248 | case "$mdw_cv_wireshark_plugin_dir" in |
| 249 | /*) |
| 250 | if test ! -d "$mdw_cv_wireshark_plugin_dir"; then |
| 251 | AC_MSG_WARN([alleged Wireshark plugin directory $mdw_cv_wireshark_plugin_dir doesn't exist]) |
| 252 | haveshark=no |
| 253 | else |
| 254 | wireshark_plugindir=$mdw_cv_wireshark_plugin_dir |
| 255 | haveshark=yes |
| 256 | fi |
| 257 | ;; |
| 258 | *) |
| 259 | AC_MSG_WARN([failed to read Wireshark plugin directory]) |
| 260 | haveshark=no |
| 261 | ;; |
| 262 | esac |
| 263 | ;; |
| 264 | no,*) |
| 265 | haveshark=no |
| 266 | ;; |
| 267 | esac |
| 268 | |
| 269 | case "$haveshark,$needshark" in |
| 270 | no,yes) |
| 271 | AC_MSG_ERROR([failed to configure Wireshark plugin]) |
| 272 | ;; |
| 273 | yes,*) |
| 274 | AC_SUBST(wireshark_plugindir) |
| 275 | ;; |
| 276 | esac |
| 277 | |
| 278 | AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes]) |
| 279 | |
| 280 | dnl-------------------------------------------------------------------------- |
| 281 | dnl Produce output. |
| 282 | |
| 283 | CFLAGS=$mdw_ORIG_CFLAGS |
| 284 | CPPFLAGS=$mdw_ORIG_CPPFLAGS |
| 285 | |
| 286 | AC_CONFIG_HEADER([config/config.h]) |
| 287 | AC_CONFIG_TESTDIR([t]) |
| 288 | |
| 289 | AC_CONFIG_FILES( |
| 290 | [Makefile] |
| 291 | [common/Makefile] |
| 292 | [uslip/Makefile] |
| 293 | [pathmtu/Makefile] |
| 294 | [client/Makefile] |
| 295 | [priv/Makefile] |
| 296 | [server/Makefile] |
| 297 | [proxy/Makefile] |
| 298 | [pkstream/Makefile] |
| 299 | [wireshark/Makefile] |
| 300 | [init/Makefile] |
| 301 | [py/Makefile] |
| 302 | [peerdb/Makefile] |
| 303 | [keys/Makefile] |
| 304 | [svc/Makefile] |
| 305 | [mon/Makefile] |
| 306 | [contrib/Makefile] |
| 307 | [t/Makefile t/atlocal]) |
| 308 | AC_OUTPUT |
| 309 | |
| 310 | dnl----- That's all, folks -------------------------------------------------- |