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