Move version to 0.8.16.
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.114 2001/03/05 22:53:37 gram Exp $
2 dnl
3 dnl Process this file with autoconf 2.13 or later to produce a
4 dnl configure script; 2.12 doesn't generate a "configure" script that
5 dnl defines SHELL, and "Makefile.in" has
6 dnl
7 dnl     SHELL = @SHELL@
8 dnl
9 dnl which requires it to be defined - and there may be other problems
10 dnl with pre-2.13 "autoconf" as well.
11 dnl
12 AC_INIT(etypes.h)
13
14 AC_PREREQ(2.13)
15
16 AM_INIT_AUTOMAKE(ethereal, 0.8.16)
17
18 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
19
20 dnl Check for CPU / vendor / OS
21 AC_CANONICAL_HOST
22
23 dnl Checks for programs.
24 AC_PROG_CC
25 AC_PROG_CPP
26 AC_PROG_RANLIB
27 AC_PROG_YACC
28 AM_PROG_LEX
29 AC_PATH_PROG(PERL, perl)
30 AC_PATH_PROG(LEX, flex)
31 AC_PATH_PROG(PYTHON, python)
32
33 AC_SUBST(PERL)
34 AC_SUBST(LEX)
35 AC_SUBST(PYTHON)
36
37
38 # Check for packaging utilities
39 # For now, we check to see if the various packaging utilites are in our
40 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
41 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
42 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
43 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
44 AC_CHECK_PROG(HAVE_RPM, rpm, "yes", "no")
45
46 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
47      -a x$HAVE_PKGTRANS = xyes ; then
48   HAVE_SVR4_PACKAGING=yes
49 else
50   HAVE_SVR4_PACKAGING=no
51 fi
52 AC_SUBST(HAVE_SVR4_PACKAGING)
53
54 # Grr.  Rpm 2.x has a nifty "--showrc" flag that lists all of the current
55 # configuration values.  Version 3.x took the niftiness away by returning
56 # the values in their raw, unexpanded, macro-embedded form.  We can either
57 # try to expand the values we get from 3.x, or poke around for popular build
58 # directories.
59 HAVE_RPM_PACKAGING=no
60 if test x$HAVE_RPM = xyes ; then
61   AC_MSG_CHECKING(for rpm build directories)
62   RPM_SOURCESDIR=`rpm --showrc | grep "^sourcedir" | \
63     sed -e 's/.*: //' 2> /dev/null`
64   if test x$RPM_SPECDIR = x ; then
65     # Red Hat  : /usr/src/redhat
66     # Mandrake : /usr/scr/rpm
67     # SuSE     : /usr/src/packages
68     for TEST_DIR in /usr/src/redhat /usr/src/rpm /usr/src/packages ; do
69       if test -d $TEST_DIR/SPECS -a -d $TEST_DIR/SOURCES -a \
70               -d $TEST_DIR/RPMS -a -d $TEST_DIR/SRPMS -a \
71               -d $TEST_DIR/BUILD ; then
72         RPM_SOURCESDIR=$TEST_DIR/SOURCES
73       fi
74     done
75   fi
76   if test x$RPM_SOURCESDIR = x ; then
77     AC_MSG_RESULT(not found)
78     RPM_SOURCESDIR=""
79   else
80     AC_MSG_RESULT(found)
81     HAVE_RPM_PACKAGING=yes
82   fi
83 fi
84 AC_SUBST(HAVE_RPM_PACKAGING)
85
86
87 # If we're running gcc, add '-Wall' to CFLAGS.
88 AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
89 if test x$GCC != x ; then
90   CFLAGS="-Wall $CFLAGS"
91   AC_MSG_RESULT(yes)
92 else
93   AC_MSG_RESULT(no)
94 fi
95
96 #
97 # Add any platform-specific compiler flags needed.
98 #
99 AC_MSG_CHECKING(for platform-specific compiler flags)
100 if test "x$GCC" = x
101 then
102         #
103         # Not GCC - assume it's the vendor's compiler.
104         #
105         case "$host_os" in
106         hpux*)
107                 #
108                 # HP's ANSI C compiler; flags suggested by Jost Martin.
109                 # "-Ae" for ANSI C plus extensions such as "long long".
110                 # "+O2", for optimization.  XXX - works with "-g"?
111                 #
112                 CFLAGS="-Ae +O2 $CFLAGS"
113                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
114                 ;;
115         *)
116                 AC_MSG_RESULT(none needed)
117                 ;;
118         esac
119 else
120         AC_MSG_RESULT(none needed)
121 fi
122
123 #
124 # Arrange that we search for header files in the source directory
125 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
126 # as various packages we use ("libpcap", "zlib", an SNMP library)
127 # may have been installed under "/usr/local/include".
128 #
129 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
130 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
131
132 #
133 # Arrange that we search for libraries in "/usr/local/lib".
134 #
135 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
136
137 # Create DATAFILE_DIR #define for config.h
138 DATAFILE_DIR=$sysconfdir
139 DATAFILE_DIR=`(
140     test "x$prefix" = xNONE && prefix=$ac_default_prefix
141     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
142     eval echo "$DATAFILE_DIR"
143 )`
144 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
145 AC_SUBST(DATAFILE_DIR)
146
147 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
148 # link directory.
149 case "$host_os" in
150   solaris*)
151     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
152     if test x$LD_LIBRARY_PATH != x ; then
153       LIBS="$LIBS -R$LD_LIBRARY_PATH"
154       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
155     else
156       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
157     fi
158   ;;
159 esac
160
161
162 # Enable/disable tethereal
163
164 GTK_OK=yes
165
166 AC_ARG_ENABLE(ethereal,
167 [  --enable-ethereal       build GTK+-based ethereal.  [default=yes]],,enable_ethereal=yes)
168
169 # GTK checks
170 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
171 # programs to be built with GTK+.
172 #
173 if test "x$enable_ethereal" = "xyes" ; then
174         AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
175 fi
176
177 # GLib checks
178 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
179 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
180 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
181 # set when generating the Makefile, so we can make programs that require
182 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
183 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
184 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
185 # programs to be built with GLib.
186 #
187 if test "$GTK_OK" = "yes" -a "x$enable_ethereal" = "xyes" ; then
188         ethereal_bin="ethereal"
189         ethereal_man="ethereal.1"
190         ethereal_SUBDIRS="gtk"
191
192         # Ignore GLIB_CFLAGS
193         AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
194 else
195         enable_ethereal="no"
196         ethereal_bin=""
197         ethereal_man=""
198         # Honor GLIB_CFLAGS
199         AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
200 fi
201
202 AC_SUBST(ethereal_bin)
203 AC_SUBST(ethereal_man)
204
205
206
207 # Enable/disable tethereal
208
209 AC_ARG_ENABLE(tethereal,
210 [  --enable-tethereal      build tethereal.  [default=yes]],,enable_tethereal=yes)
211
212 if test "x$enable_tethereal" = "xyes" ; then
213         tethereal_bin="tethereal"
214         tethereal_man="tethereal.1"
215 else
216         tethereal_bin=""
217         tethereal_man=""
218 fi
219 AC_SUBST(tethereal_bin)
220 AC_SUBST(tethereal_man)
221
222
223
224 # Enable/disable editcap
225
226 AC_ARG_ENABLE(editcap,
227 [  --enable-editcap        build editcap.  [default=yes]],,enable_editcap=yes)
228
229 if test "x$enable_editcap" = "xyes" ; then
230         editcap_bin="editcap"
231         editcap_man="editcap.1"
232 else
233         editcap_bin=""
234         editcap_man=""
235 fi
236 AC_SUBST(editcap_bin)
237 AC_SUBST(editcap_man)
238
239
240 # Enable/disable dftest
241
242 AC_ARG_ENABLE(dftest,
243 [  --enable-dftest         build dftest.  [default=no]],,enable_dftest=no)
244
245 if test "x$enable_dftest" = "xyes" ; then
246         dftest_bin="dftest"
247 else
248         dftest_bin=""
249 fi
250 AC_SUBST(dftest_bin)
251
252
253 # Enable/disable randpkt
254
255 AC_ARG_ENABLE(randpkt,
256 [  --enable-randpkt         build randpkt.  [default=no]],,enable_randpkt=no)
257
258 if test "x$enable_randpkt" = "xyes" ; then
259         randpkt_bin="randpkt"
260 else
261         randpkt_bin=""
262 fi
263 AC_SUBST(randpkt_bin)
264
265
266 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
267 dnl "gethostbyname()".
268 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
269
270 dnl Checks for "connect()", used as a proxy for "socket()" - and
271 dnl "-lsocket", if we need it to get "connect()".
272 AC_ETHEREAL_SOCKET_LIB_CHECK
273
274 dnl pcap check
275 AC_ARG_ENABLE(pcap,
276 [  --enable-pcap           use libpcap for packet capturing.  [default=yes]],,enable_pcap=yes)
277
278 AC_MSG_CHECKING(whether to use libpcap for packet capture)
279 if test "x$enable_pcap" = "xno" ; then
280         AC_MSG_RESULT(no)
281 else
282         AC_MSG_RESULT(yes)
283         AC_ETHEREAL_PCAP_CHECK
284 fi
285
286 dnl zlib check
287 AC_ARG_ENABLE(zlib,
288 [  --enable-zlib           use zlib to read compressed data.  [default=yes]],,enable_zlib=yes)
289
290 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
291 if test "x$enable_zlib" = "xno" ; then
292         AC_MSG_RESULT(no)
293 else
294         AC_MSG_RESULT(yes)
295         AC_ETHEREAL_ZLIB_CHECK
296         if test "x$enable_zlib" = "xno" ; then
297                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
298         fi
299 fi
300
301
302 dnl ipv6 check
303 AC_ARG_ENABLE(ipv6,
304 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],,enable_ipv6=yes)
305
306 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
307 if test "x$enable_ipv6" = "xno" ; then
308         AC_MSG_RESULT(no)
309 else
310         AC_MSG_RESULT(yes)
311         AC_ETHEREAL_IPV6_STACK
312 fi
313
314
315 dnl Check if ethereal should be installed setuid
316 AC_ARG_ENABLE(setuid-install,
317 [  --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
318
319 AC_MSG_CHECKING(whether to install ethereal setuid)
320 if test "x$enable_setuid_install" = "xno" ; then
321         AC_MSG_RESULT(no)
322 else
323         AC_MSG_RESULT(yes)
324 fi
325
326 dnl Checks for header files.
327 AC_HEADER_STDC
328 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
329 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
330 AC_CHECK_HEADERS(sys/wait.h)
331 AC_CHECK_HEADERS(netinet/in.h)
332 AC_CHECK_HEADERS(stddef.h)
333 AC_CHECK_HEADERS(dlfcn.h)
334 AC_CHECK_HEADERS(arpa/inet.h)
335
336 #
337 # XXX - we should also somehow arrange to support dynamic linking on
338 # HP-UX, even though it hasn't yet, apparently, implemented the
339 # UNIX standard "dlopen()" interface atop its own interface.
340 #
341 if test "$ac_cv_header_dlfcn_h" = yes ; then
342   AC_DEFINE(HAVE_PLUGINS)
343 fi
344
345 dnl SSL Check
346 SSL_LIBS=''
347 AC_MSG_CHECKING(whether to use SSL library if available)
348 if test "x$enable_ssl" = "xno" ; then
349         AC_MSG_RESULT(no)
350 else
351         AC_MSG_RESULT(yes)
352         AC_ETHEREAL_SSL_CHECK
353         AC_MSG_CHECKING(SSL_LIBS=$SSL_LIBS)
354 fi
355 AC_SUBST(SSL_LIBS)
356
357 dnl SNMP Check
358 AC_ARG_ENABLE(snmp,
359 [  --enable-snmp           use SNMP library, if available.  [default=yes]],,enable_snmp=yes)
360
361 SNMP_LIBS=''
362 AC_MSG_CHECKING(whether to use SNMP library if available)
363 if test "x$enable_snmp" = "xno" ; then
364         AC_MSG_RESULT(no)
365 else
366         AC_MSG_RESULT(yes)
367         AC_ETHEREAL_UCDSNMP_CHECK
368         AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
369
370         #
371         # This may require "-lkstat" on Solaris, sigh.
372         #
373         AC_CHECK_LIB(snmp, sprint_objid,
374           SNMP_LIBS=-lsnmp,
375           [
376             #
377             # Throw away the cached "we didn't find it" answer.
378             #
379             unset ac_cv_lib_snmp_sprint_objid
380             AC_CHECK_LIB(snmp, sprint_objid,
381               [
382                 #
383                 # Throw away the cached "we found it" answer, so that if
384                 # we rerun "configure", we don't just blow off this check
385                 # and blithely assume that we don't need "-lkstat".
386                 #
387                 # XXX - autoconf really needs a way to test for a given
388                 # routine in a given library *and* to test whether additional
389                 # "-L"/"-R"/whatever flags are needed *before* the "-l"
390                 # flag for the library and to test whether additional libraries
391                 # are needed after the library *and* to cache all that
392                 # information.
393                 #
394                 unset ac_cv_lib_snmp_sprint_objid
395                 SNMP_LIBS="-lsnmp -lkstat"
396               ],,$SOCKET_LIBS $NSL_LIBS $SSL_LIBS -lkstat
397             )
398           ], $SOCKET_LIBS $NSL_LIBS $SSL_LIBS
399         )
400         
401 fi
402 AC_SUBST(SNMP_LIBS)
403
404 dnl Checks for typedefs, structures, and compiler characteristics.
405 # AC_C_CONST
406
407 # We need to know whether "struct sockaddr" has an "sa_len" member
408 # for get_interface_list().
409
410 AC_ETHEREAL_STRUCT_SA_LEN
411
412 # We must know our byte order
413 AC_C_BIGENDIAN
414
415 # Checks whether "-traditional" is needed when using "ioctl".
416 # XXX - do we need this?
417 AC_PROG_GCC_TRADITIONAL
418
419 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
420 # then this won't work.
421 SNPRINTF_C=""
422 SNPRINTF_O=""
423 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
424   SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
425 if test "$ac_cv_func_snprintf" = no ; then
426   SNPRINTF_C="snprintf.c"
427   SNPRINTF_O="snprintf.o"
428 fi
429 AC_SUBST(SNPRINTF_C)
430 AC_SUBST(SNPRINTF_O)
431
432 AC_CHECK_FUNC(strerror, STRERROR_O="",
433   STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
434 if test "$ac_cv_func_strerror" = no ; then
435   STRERROR_C="strerror.c"
436   STRERROR_O="strerror.o"
437 fi
438 AC_SUBST(STRERROR_C)
439 AC_SUBST(STRERROR_O)
440
441 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
442   STRCASECMP_O="strcasecmp.o")
443 if test "$ac_cv_func_strcasecmp" = no ; then
444   STRCASECMP_C="strcasecmp.c"
445   STRCASECMP_O="strcasecmp.o"
446 fi
447 AC_SUBST(STRCASECMP_C)
448 AC_SUBST(STRCASECMP_O)
449
450 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
451   STRNCASECMP_O="strncasecmp.o")
452 if test "$ac_cv_func_strncasecmp" = no ; then
453   STRNCASECMP_C="strncasecmp.c"
454   STRNCASECMP_O="strncasecmp.o"
455 fi
456 AC_SUBST(STRNCASECMP_C)
457 AC_SUBST(STRNCASECMP_O)
458
459 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
460   MKSTEMP_O="mkstemp.o")
461 if test "$ac_cv_func_mkstemp" = no ; then
462   MKSTEMP_C="mkstemp.c"
463   MKSTEMP_O="mkstemp.o"
464   AC_DEFINE(NEED_MKSTEMP)
465 fi
466 AC_SUBST(MKSTEMP_C)
467 AC_SUBST(MKSTEMP_O)
468
469 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
470
471 dnl blank for now, but will be used in future
472 AC_SUBST(ethereal_SUBDIRS)
473
474 dnl check for plugins directory - stolen from Amanda's configure.in
475 AC_ARG_WITH(plugindir,
476   [  --with-plugindir=DIR   install plugins in DIR],
477   [
478   case "$withval" in
479   "" | y | ye | yes | n | no)
480     AC_MSG_ERROR([*** You must supply an argument to the --with-plugindir option.])
481   ;;
482   *) PLUGIN_DIR="$withval"
483   esac
484   ],
485   : ${PLUGIN_DIR=$libdir/ethereal/plugins/0.8.16}
486 )
487
488 PLUGIN_DIR=`(
489   test "x$prefix" = xNONE && prefix=$ac_default_prefix
490   test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
491   eval echo "$PLUGIN_DIR"
492 )`
493 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
494 AC_SUBST(PLUGIN_DIR)
495
496 dnl libtool defs
497 AC_LIBTOOL_DLOPEN
498 AM_PROG_LIBTOOL
499 AC_SUBST(LIBTOOL_DEPS)
500
501 AM_CONFIG_HEADER(config.h)
502 AC_CONFIG_SUBDIRS(epan wiretap)
503 AC_OUTPUT(
504   Makefile
505   doc/Makefile
506   gtk/Makefile
507   packaging/Makefile
508   packaging/rpm/Makefile
509   packaging/rpm/ethereal.spec
510   packaging/svr4/Makefile
511   packaging/svr4/checkinstall
512   packaging/svr4/pkginfo
513   plugins/Makefile
514   plugins/gryphon/Makefile
515   plugins/mgcp/Makefile
516   tools/Makefile
517   tools/lemon/Makefile
518   ,)
519
520
521 # Pretty messages
522
523 if test "x$enable_setuid_install" = "xyes" ; then
524         setuid_message="yes (DANGEROUS!!!)"
525 else
526         setuid_message="no"
527 fi
528
529 if test "x$SNMP_LIBS" = "x" ; then
530         snmp_libs_message="no"
531 else
532         snmp_libs_message="yes"
533 fi
534
535
536
537 echo ""
538 echo "The Ethereal package has been configured with the following options."
539 echo "                    Build ethereal : $enable_ethereal"
540 echo "                   Build tethereal : $enable_tethereal"
541 echo "                     Build editcap : $enable_editcap"
542 echo "                     Build randpkt : $enable_randpkt"
543 echo "                      Build dftest : $enable_dftest"
544 echo ""
545 echo "                    Install setuid : $setuid_message"
546 echo "                  Use pcap library : $enable_pcap"
547 echo "                  Use zlib library : $enable_zlib"
548 echo "          Use IPv6 name resolution : $enable_ipv6"
549 echo "                  Use SNMP library : $snmp_libs_message"
550
551