05c8d07c078320758a92ad1c8684d79d358c496f
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.225 2003/10/10 10:12:18 guy 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 dnl Check for CPU / vendor / OS
17 AC_CANONICAL_HOST
18 AC_CANONICAL_TARGET
19
20 AM_INIT_AUTOMAKE(ethereal, 0.9.15)
21
22 dnl Checks for programs.
23 AC_PROG_CC
24 AC_PROG_CPP
25 AM_DISABLE_STATIC
26 dnl Work around libtool bug (fixed in the version 1.5a?)
27 AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
28 AC_LIBTOOL_DLOPEN
29 AC_PROG_LIBTOOL
30 AC_PROG_YACC
31 AM_PROG_LEX
32 AC_PATH_PROG(PERL, perl)
33 AC_PATH_PROG(POD2MAN, pod2man)
34 AC_PATH_PROG(LEX, flex)
35 AC_PATH_PROG(PYTHON, python)
36
37 AC_SUBST(PERL)
38 AC_SUBST(LEX)
39 AC_SUBST(PYTHON)
40
41 # Check for packaging utilities
42 # For now, we check to see if the various packaging utilites are in our
43 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
44 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
45 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
46 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
47
48 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
49      -a x$HAVE_PKGTRANS = xyes ; then
50   HAVE_SVR4_PACKAGING=yes
51 else
52   HAVE_SVR4_PACKAGING=no
53 fi
54 AC_SUBST(HAVE_SVR4_PACKAGING)
55
56 AC_ETHEREAL_RPM_CHECK
57 AC_SUBST(HAVE_RPM)
58
59 #
60 # If we're running gcc, add '-Wall -W' to CFLAGS, and add
61 # '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
62 # flag unused function arguments and not get warnings about them.
63 # If "--with-extra-gcc-checks" was specified, add "-Wcast-qual
64 # -Wcast-align" as well.  (Add more checks here in the future?)
65 #
66 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
67 # argument will compile with non-GCC compilers.
68 #
69 AC_ARG_WITH(extra-gcc-checks,
70 [  --with-extra-gcc-checks do additional -W checks in GCC.  [default=no]],
71 [
72         if test $withval != no
73         then
74                 ethereal_extra_gcc_flags=" -Wcast-qual -Wcast-align"
75         fi
76 ],)
77 AC_MSG_CHECKING(to see if we can add '-Wall -W$ethereal_extra_gcc_flags' to CFLAGS)
78 if test x$GCC != x ; then
79   CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W$ethereal_extra_gcc_flags $CFLAGS"
80   AC_MSG_RESULT(yes)
81 else
82   CFLAGS="-D_U_=\"\" $CFLAGS"
83   AC_MSG_RESULT(no)
84 fi
85
86 #
87 # Add any platform-specific compiler flags needed.
88 #
89 AC_MSG_CHECKING(for platform-specific compiler flags)
90 if test "x$GCC" = x
91 then
92         #
93         # Not GCC - assume it's the vendor's compiler.
94         #
95         case "$host_os" in
96         hpux*)
97                 #
98                 # HP's ANSI C compiler; flags suggested by Jost Martin.
99                 # "-Ae" for ANSI C plus extensions such as "long long".
100                 # "+O2", for optimization.  XXX - works with "-g"?
101                 #
102                 CFLAGS="-Ae +O2 $CFLAGS"
103                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
104                 ;;
105         darwin*)
106                 #
107                 # It may be called "cc", but it's really a GCC derivative
108                 # with a problematic special precompiler and precompiled
109                 # headers; turn off the special precompiler, as some
110                 # apparently-legal code won't compile with its precompiled
111                 # headers.
112                 #
113                 CFLAGS="-no-cpp-precomp $CFLAGS"
114                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
115                 ;;
116         *)
117                 AC_MSG_RESULT(none needed)
118                 ;;
119         esac
120 else
121         case "$host_os" in
122         solaris*)
123                 # the X11 headers don't automatically include prototype info
124                 # and a lot don't include the return type
125                 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
126                 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
127                 ;;
128         darwin*)
129                 #
130                 # See comments above about Apple's lovely C compiler.
131                 #
132                 CFLAGS="-no-cpp-precomp $CFLAGS"
133                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
134                 ;;
135         *)
136                 AC_MSG_RESULT(none needed)
137                 ;;
138         esac
139 fi
140
141 dnl Look in /usr/local for header files and libraries ?
142 dnl XXX FIXME don't include /usr/local if it is already in the system
143 dnl search path as this causes gcc 3.2 on Linux to complain about a change
144 dnl of the system search order for includes
145 AC_ARG_ENABLE(usr-local,
146 [  --enable-usr-local      look for headers and libs in /usr/local tree.  [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
147
148 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
149 if test "x$enable_usr_local" = "xyes" ; then
150         AC_MSG_RESULT(yes)
151         #
152         # Arrange that we search for header files in the source directory
153         # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
154         # as various packages we use ("libpcap", "zlib", an SNMP library)
155         # may have been installed under "/usr/local/include".
156         #
157         CFLAGS="$CFLAGS -I/usr/local/include"
158         CPPFLAGS="$CPPFLAGS -I/usr/local/include"
159
160         #
161         # Arrange that we search for libraries in "/usr/local/lib".
162         #
163         AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
164 else
165         AC_MSG_RESULT(no)
166 fi
167
168 #
169 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
170 # link directory.
171 #
172 case "$host_os" in
173   solaris*)
174     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
175     if test x$LD_LIBRARY_PATH != x ; then
176       LIBS="$LIBS -R$LD_LIBRARY_PATH"
177       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
178     else
179       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
180     fi
181   ;;
182 esac
183
184 #
185 # Check for versions of "sed" inadequate to handle, in libtool, a list
186 # of object files as large as the list in Ethereal.
187 #
188 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
189 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
190 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
191 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
192 # is the only "sed" that comes with Solaris that can handle Ethereal.
193 #
194 # Add any checks here that are necessary for other OSes.
195 #
196 AC_ETHEREAL_GNU_SED_CHECK
197 if test "$HAVE_GNU_SED" = no ; then
198         case "$host_os" in
199         solaris*)
200                 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
201                 case `which sed` in
202                         /bin/sed|/usr/bin/sed|/usr/ucb/sed)
203                         AC_MSG_RESULT(yes)              
204                         AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
205                         ;;
206
207                         *)
208                         AC_MSG_RESULT(no)
209                         ;;
210                 esac
211                 ;;
212
213         *)
214                 :
215                 ;;
216         esac
217 fi
218
219 # Enable/disable tethereal
220
221 AC_ARG_ENABLE(ethereal,
222 [  --enable-ethereal       build GTK+-based ethereal.  [default=yes]],enable_ethereal=$enableval,enable_ethereal=yes)
223
224 AC_ARG_ENABLE(gtk2,
225 [  --enable-gtk2           build Glib2/Gtk2+-based (t)ethereal.  [default=no]],enable_gtk2=$enableval,enable_gtk2=no)
226 AM_CONDITIONAL(USE_GTK2, test x$enable_gtk2 = xyes)
227
228 AC_ARG_ENABLE(threads,
229 [  --enable-threads        use threads in ethereal.  [default=no]],enable_threads=$enableval,enable_threads=no)
230 AM_CONDITIONAL(USE_THREADS, test x$enable_threads = xyes)
231
232 # GTK checks
233 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
234 # programs to be built with GTK+.
235 #
236 if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
237         GTK_OK=two
238         AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
239 elif test "x$enable_gtk2" != "xyes" -a "x$enable_ethereal" = "xyes" ; then
240         GTK_OK=one
241         AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
242 else
243         GTK_OK=no
244 fi
245
246 # GLib checks
247 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
248 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
249 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
250 # set when generating the Makefile, so we can make programs that require
251 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
252 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
253 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
254 # programs to be built with GLib.
255 #
256 if test "$GTK_OK" = "no" ; then
257         enable_ethereal="no"
258         ethereal_bin=""
259         ethereal_man=""
260         # Honor GLIB_CFLAGS
261         if test "x$enable_gtk2" = "xyes" ; then
262                 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
263         else
264                 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
265         fi
266 else
267         ethereal_bin="ethereal"
268         ethereal_man="ethereal.1"
269         ethereal_SUBDIRS="gtk"
270         # Honor GLIB_CFLAGS
271         if test "$GTK_OK" = "two" ; then
272                 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
273         else
274                 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
275         fi
276 fi
277
278 #
279 # Check whether GLib modules are supported, to determine whether we
280 # can support plugins.
281 #
282 AC_MSG_CHECKING(whether GLib supports loadable modules)
283 ac_save_CFLAGS="$CFLAGS"
284 ac_save_LIBS="$LIBS"
285 CFLAGS="$CFLAGS $GLIB_CFLAGS"
286 LIBS="$GLIB_LIBS $LIBS"
287 AC_TRY_RUN([
288 #include <glib.h>
289 #include <gmodule.h>
290 #include <stdio.h>
291 #include <stdlib.h>
292
293 int 
294 main ()
295 {
296   if (g_module_supported())
297     return 0;   /* success */
298   else
299     return 1;   /* failure */
300 }
301 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
302    [echo $ac_n "cross compiling; assumed OK... $ac_c"])
303 CFLAGS="$ac_save_CFLAGS"
304 LIBS="$ac_save_LIBS"
305 if test "$ac_cv_glib_supports_modules" = yes ; then
306   AC_MSG_RESULT(yes)
307   have_plugins=yes
308 else
309   AC_MSG_RESULT(no)
310   have_plugins=no
311 fi
312
313
314 AC_SUBST(ethereal_bin)
315 AC_SUBST(ethereal_man)
316
317
318
319 # Enable/disable tethereal
320
321 AC_ARG_ENABLE(tethereal,
322 [  --enable-tethereal      build tethereal.  [default=yes]],tethereal=$enableval,enable_tethereal=yes)
323
324 if test "x$enable_tethereal" = "xyes" ; then
325         tethereal_bin="tethereal"
326         tethereal_man="tethereal.1"
327         etherealfilter_man="ethereal-filter.4"
328 else
329         tethereal_bin=""
330         tethereal_man=""
331 fi
332 AC_SUBST(tethereal_bin)
333 AC_SUBST(tethereal_man)
334 AC_SUBST(etherealfilter_man)
335
336
337
338 # Enable/disable editcap
339
340 AC_ARG_ENABLE(editcap,
341 [  --enable-editcap        build editcap.  [default=yes]],enable_editcap=$enableval,enable_editcap=yes)
342
343 if test "x$enable_editcap" = "xyes" ; then
344         editcap_bin="editcap"
345         editcap_man="editcap.1"
346 else
347         editcap_bin=""
348         editcap_man=""
349 fi
350 AC_SUBST(editcap_bin)
351 AC_SUBST(editcap_man)
352
353
354 # Enable/disable mergecap
355
356 AC_ARG_ENABLE(mergecap,
357 [  --enable-mergecap       build mergecap.  [default=yes]],enable_mergecap=$enableval,enable_mergecap=yes)
358
359 if test "x$enable_mergecap" = "xyes" ; then
360         mergecap_bin="mergecap"
361         mergecap_man="mergecap.1"
362 else
363         mergecap_bin=""
364         mergecap_man=""
365 fi
366 AC_SUBST(mergecap_bin)
367 AC_SUBST(mergecap_man)
368
369
370 # Enable/disable text2pcap
371
372 AC_ARG_ENABLE(text2pcap,
373 [  --enable-text2pcap      build text2pcap.  [default=yes]],text2pcap=$enableval,enable_text2pcap=yes)
374
375 if test "x$enable_text2pcap" = "xyes" ; then
376         text2pcap_bin="text2pcap"
377         text2pcap_man="text2pcap.1"
378 else
379         text2pcap_bin=""
380         text2pcap_man=""
381 fi
382 AC_SUBST(text2pcap_bin)
383 AC_SUBST(text2pcap_man)
384
385 # Enable/disable idl2eth
386
387 AC_ARG_ENABLE(idl2eth,
388 [  --enable-idl2eth        build idl2eth.  [default=yes]],enable_idl2eth=$enableval,enable_idl2eth=yes)
389
390 if test "x$enable_idl2eth" = "xyes" ; then
391         idl2eth_bin="idl2eth"
392         idl2eth_man="idl2eth.1"
393 else
394         idl2eth_bin=""
395         idl2eth_man=""
396 fi
397 AC_SUBST(idl2eth_bin)
398 AC_SUBST(idl2eth_man)
399
400
401 # Enable/disable dftest
402
403 AC_ARG_ENABLE(dftest,
404 [  --enable-dftest         build dftest.  [default=no]],enable_dftest=$enableval,enable_dftest=no)
405
406 if test "x$enable_dftest" = "xyes" ; then
407         dftest_bin="dftest"
408 else
409         dftest_bin=""
410 fi
411 AC_SUBST(dftest_bin)
412
413
414 # Enable/disable randpkt
415
416 AC_ARG_ENABLE(randpkt,
417 [  --enable-randpkt        build randpkt.  [default=no]],enable_randpkt=$enableval,enable_randpkt=no)
418
419 if test "x$enable_randpkt" = "xyes" ; then
420         randpkt_bin="randpkt"
421 else
422         randpkt_bin=""
423 fi
424 AC_SUBST(randpkt_bin)
425
426
427 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
428 dnl "gethostbyname()".
429 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
430
431 dnl Checks for "connect()", used as a proxy for "socket()" - and
432 dnl "-lsocket", if we need it to get "connect()".
433 AC_ETHEREAL_SOCKET_LIB_CHECK
434
435 dnl pcap check
436 AC_MSG_CHECKING(whether to use libpcap for packet capture)
437
438 AC_ARG_WITH(pcap,
439 changequote(<<, >>)dnl
440 <<  --with-pcap[=DIR]       use libpcap for packet capturing.  [default=yes]>>,
441 changequote([, ])dnl
442 [
443         if test $withval = no
444         then
445                 want_pcap=no
446         elif test $withval = yes
447         then
448                 want_pcap=yes
449         else
450                 want_pcap=yes
451                 pcap_dir=$withval
452         fi
453 ],[
454         want_pcap=yes
455         pcap_dir=
456 ])
457 if test "x$want_pcap" = "xno" ; then
458         AC_MSG_RESULT(no)
459 else
460         AC_MSG_RESULT(yes)
461         AC_ETHEREAL_PCAP_CHECK
462 fi
463
464 dnl zlib check
465 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
466
467 AC_ARG_WITH(zlib,
468 changequote(<<, >>)dnl
469 <<  --with-zlib[=DIR]       use zlib (located in directory DIR, if supplied) to read compressed data.  [default=yes, if present]>>,
470 changequote([, ])dnl
471 [
472         if test $withval = no
473         then
474                 want_zlib=no
475         elif test $withval = yes
476         then
477                 want_zlib=yes
478         else
479                 want_zlib=yes
480                 zlib_dir=$withval
481         fi
482 ],[
483         #
484         # Use zlib if it's present, otherwise don't.
485         #
486         want_zlib=ifpresent
487         zlib_dir=
488 ])
489 if test "x$want_zlib" = "xno" ; then
490         AC_MSG_RESULT(no)
491 else
492         AC_MSG_RESULT(yes)
493         AC_ETHEREAL_ZLIB_CHECK
494         if test "x$want_zlib" = "xno" ; then
495                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
496         fi
497 fi
498
499
500 dnl ipv6 check
501 AC_ARG_ENABLE(ipv6,
502 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],enable_ipv6=$enableval,enable_ipv6=yes)
503
504 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
505 if test "x$enable_ipv6" = "xno" ; then
506         AC_MSG_RESULT(no)
507 else
508         AC_MSG_RESULT(yes)
509         AC_ETHEREAL_IPV6_STACK
510 fi
511
512
513 dnl Check if ethereal should be installed setuid
514 AC_ARG_ENABLE(setuid-install,
515 [  --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],enable_setuid_install=$enableval,enable_setuid_install=no)
516
517 AC_MSG_CHECKING(whether to install ethereal setuid)
518 if test "x$enable_setuid_install" = "xno" ; then
519         AC_MSG_RESULT(no)
520 else
521         AC_MSG_RESULT(yes)
522 fi
523
524 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
525
526 dnl Checks for header files.
527 AC_HEADER_STDC
528 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
529 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
530 AC_CHECK_HEADERS(sys/utsname.h sys/wait.h)
531 AC_CHECK_HEADERS(netinet/in.h)
532 AC_CHECK_HEADERS(stddef.h)
533 AC_CHECK_HEADERS(arpa/inet.h)
534 AC_CHECK_HEADERS(iconv.h)
535
536 dnl SSL Check
537 SSL_LIBS=''
538 AC_MSG_CHECKING(whether to use SSL library if available)
539 if test "x$enable_ssl" = "xno" ; then
540         AC_MSG_RESULT(no)
541 else
542         AC_MSG_RESULT(yes)
543         AC_ETHEREAL_SSL_CHECK
544 fi
545 AC_SUBST(SSL_LIBS)
546
547 dnl UCD SNMP/NET-SNMP Check
548 SNMP_LIBS=''
549
550 AC_ARG_WITH(net-snmp,
551 changequote(<<, >>)dnl
552 <<  --with-net-snmp=PATH    use NET-SNMP library, with PATH as the location of the net-snmp-config shell script that comes with the net-snmp package.>>,
553 changequote([, ])dnl
554 [netsnmpconfig=$withval]
555 )
556
557 AC_ARG_WITH(ucd-snmp,
558 changequote(<<, >>)dnl
559 <<  --with-ucd-snmp[=DIR]   use UCD SNMP client library (located in directory DIR, if supplied).  [default=yes, if present]>>,
560 changequote([, ])dnl
561 [
562         if test $withval = no
563         then
564                 want_ucdsnmp=no
565         elif test $withval = yes
566         then
567                 want_ucdsnmp=yes
568         else
569                 want_ucdsnmp=yes
570                 ucdsnmp_dir=$withval
571         fi
572 ],[
573         #
574         # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
575         # if you find it, otherwise don't".
576         #
577         want_ucdsnmp=ifpresent
578         ucdsnmp_dir=
579 ])
580
581 dnl try net-snmp first
582 AC_MSG_CHECKING(whether to use NET-SNMP library if available)
583 if test "x$netsnmpconfig" != "xno" ; then
584         AC_MSG_RESULT(yes)
585         dnl get the net-snmp-config binary
586         if test "x$netsnmpconfig" = "xyes" -o "x$netsnmpconfig" = "x" ; then
587                 dnl search for it
588                 AC_PATH_PROG(NETSNMPCONFIG,net-snmp-config)
589         else
590                 NETSNMPCONFIG=$netsnmpconfig
591                 if test ! -x $NETSNMPCONFIG ; then
592                         AC_MSG_ERROR(Invalid net-snmp-config: $NETSNMPCONFIG)
593                 fi
594         fi
595 else
596         AC_MSG_RESULT(no)
597 fi
598
599 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
600         dnl other choices for flags to use here: could also use
601         dnl --prefix or --exec-prefix if you don't want the full list.
602
603         AC_CHECK_HEADERS(net-snmp/net-snmp-config.h net-snmp/library/default_store.h)
604         if test "x$ac_cv_header_net_snmp_net_snmp_config_h" = "xyes" -a "x$ac_cv_header_net_snmp_library_default_store_h" = "xyes" ; then
605                 CFLAGS="$CFLAGS `net-snmp-config --cflags`"
606                 CPPFLAGS="$CPPLAGS `net-snmp-config --cflags`"
607                 SNMP_LIBS=`net-snmp-config --libs`
608                 AC_DEFINE(HAVE_NET_SNMP, 1, [Define to enable support for NET-SNMP])
609                 have_net_snmp="yes"
610         else
611                 # technically, we should retry ucd-snmp but it's
612                 # unlikely they have installed net-snmp-config and not
613                 # the net-snmp headers but do have the ucd-snmp
614                 # headers.  This would likely be a broken system to
615                 # try and use anyway.
616                 NETSNMPCONFIG="no"
617         fi      
618 else
619         AC_MSG_CHECKING(whether to use UCD SNMP library if available)
620         if test "x$want_ucdsnmp" = "xno" ; then
621                 AC_MSG_RESULT(no)
622         else
623                 AC_MSG_RESULT(yes)
624                 AC_ETHEREAL_UCDSNMP_CHECK
625         fi
626 fi
627
628 if test "x$have_net_snmp" = "xyes" || test "x$have_ucd_snmp" = "xyes"; then
629         AC_DEFINE(HAVE_SOME_SNMP, 1, [Define to if some SNMP support is to be used])
630 fi
631
632 AC_SUBST(SNMP_LIBS)
633
634 dnl ADNS Check
635 ADNS_LIBS=''
636 AC_MSG_CHECKING(whether to use the GNU ADNS library if available)
637 if test "x$with_adns" = "xno" ; then
638         AC_MSG_RESULT(no)
639 else
640         AC_MSG_RESULT(yes)
641         AC_ETHEREAL_ADNS_CHECK
642 fi
643 AC_SUBST(ADNS_LIBS)
644
645 dnl Checks for typedefs, structures, and compiler characteristics.
646 # AC_C_CONST
647
648 # We need to know whether "struct sockaddr" has an "sa_len" member
649 # for get_interface_list().
650
651 AC_ETHEREAL_STRUCT_SA_LEN
652
653 # We must know our byte order
654 AC_C_BIGENDIAN
655
656 # Checks whether "-traditional" is needed when using "ioctl".
657 # XXX - do we need this?
658 AC_PROG_GCC_TRADITIONAL
659
660 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
661 # then this won't work.
662 SNPRINTF_C=""
663 SNPRINTF_O=""
664 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
665   [SNPRINTF_O="snprintf.o"
666    AC_DEFINE(NEED_SNPRINTF_H, 1, [Define if sprintf.h needs to be included])
667 ])
668 if test "$ac_cv_func_snprintf" = no ; then
669   SNPRINTF_C="snprintf.c"
670   SNPRINTF_O="snprintf.o"
671 fi
672 AC_SUBST(SNPRINTF_C)
673 AC_SUBST(SNPRINTF_O)
674
675 AC_CHECK_FUNC(strerror, STRERROR_O="",
676   [STRERROR_O="strerror.o"
677    AC_DEFINE(NEED_STRERROR_H, 1, [Define if strerror.h needs to be included])
678 ])
679 if test "$ac_cv_func_strerror" = no ; then
680   STRERROR_C="strerror.c"
681   STRERROR_O="strerror.o"
682 fi
683 AC_SUBST(STRERROR_C)
684 AC_SUBST(STRERROR_O)
685
686 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
687   STRCASECMP_O="strcasecmp.o")
688 if test "$ac_cv_func_strcasecmp" = no ; then
689   STRCASECMP_C="strcasecmp.c"
690   STRCASECMP_O="strcasecmp.o"
691 fi
692 AC_SUBST(STRCASECMP_C)
693 AC_SUBST(STRCASECMP_O)
694
695 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
696   STRNCASECMP_O="strncasecmp.o")
697 if test "$ac_cv_func_strncasecmp" = no ; then
698   STRNCASECMP_C="strncasecmp.c"
699   STRNCASECMP_O="strncasecmp.o"
700 fi
701 AC_SUBST(STRNCASECMP_C)
702 AC_SUBST(STRNCASECMP_O)
703
704 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
705   MKSTEMP_O="mkstemp.o")
706 if test "$ac_cv_func_mkstemp" = no ; then
707   MKSTEMP_C="mkstemp.c"
708   MKSTEMP_O="mkstemp.o"
709 fi
710 AC_SUBST(MKSTEMP_C)
711 AC_SUBST(MKSTEMP_O)
712
713 AC_CHECK_FUNC(strptime, STRPTIME_O="",
714   [STRPTIME_O="strptime.o"
715    AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
716 ])
717 if test "$ac_cv_func_strptime" = no ; then
718   STRPTIME_C="strptime.c"
719   STRPTIME_O="strptime.o"
720 fi
721 AC_SUBST(STRPTIME_C)
722 AC_SUBST(STRPTIME_O)
723
724 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
725
726 dnl blank for now, but will be used in future
727 AC_SUBST(ethereal_SUBDIRS)
728
729 dnl
730 dnl check whether plugins should be enabled and, if they should be,
731 dnl check for plugins directory - stolen from Amanda's configure.in
732 dnl
733 plugindir="$libdir/ethereal/plugins/$VERSION"
734 AC_ARG_WITH(plugins,
735 changequote(<<, >>)dnl
736 <<  --with-plugins[=DIR]    support plugins (installed in DIR, if supplied).>>,
737 changequote([, ])dnl
738 [
739   case "$withval" in
740   "" | y | ye | yes )
741     if test x$have_plugins = xno
742     then
743       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
744     fi
745     ;;
746   n | no)
747     have_plugins=no
748     ;;
749   *)
750     if test x$have_plugins = xno
751     then
752       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
753     fi
754     plugindir="$withval"
755     ;;
756   esac
757 ])
758
759 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
760 if test x$have_plugins = xyes
761 then
762   AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
763   plugindir=`(
764     test "x$prefix" = xNONE && prefix=$ac_default_prefix
765     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
766     eval echo "$plugindir"
767   )`
768   AC_DEFINE_UNQUOTED(PLUGIN_DIR, "$plugindir", [Plugin installation directory])
769 else
770   AC_DEFINE(PLUGIN_DIR, NULL, [Plugin installation directory])
771 fi
772 AC_SUBST(plugindir)
773
774 dnl libtool defs
775 #
776 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
777 # (autoconf?  automake?  libtool?) - with the newer version(s), it's
778 # just an alias for AC_PROG_LIBTOOL, which is called earlier.
779 #
780 # With older version(s) of those tool(s), however, it's not just an
781 # alias, and the configure scripts don't work without it.
782 #
783 AM_PROG_LIBTOOL
784 AC_SUBST(LIBTOOL_DEPS)
785
786 AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes)
787 if test x$enable_static = xyes -a x$have_plugins = xyes
788 then
789   AC_DEFINE(ENABLE_STATIC, 1, [Link plugins statically into Ethereal])
790 fi
791 AC_SUBST(ENABLE_STATIC)
792
793 AM_CONFIG_HEADER(config.h)
794 AC_CONFIG_SUBDIRS(epan wiretap)
795 AC_OUTPUT(
796   Makefile
797   doc/Makefile
798   gtk/Makefile
799   packaging/Makefile
800   packaging/nsis/Makefile
801   packaging/rpm/Makefile
802   packaging/rpm/SPECS/Makefile
803   packaging/rpm/SPECS/ethereal.spec
804   packaging/svr4/Makefile
805   packaging/svr4/checkinstall
806   packaging/svr4/pkginfo
807   plugins/Makefile
808   plugins/artnet/Makefile
809   plugins/docsis/Makefile
810   plugins/giop/Makefile
811   plugins/gryphon/Makefile
812   plugins/lwres/Makefile
813   plugins/megaco/Makefile
814   plugins/mgcp/Makefile
815   plugins/pcli/Makefile
816   plugins/rtnet/Makefile
817   tools/Makefile
818   tools/lemon/Makefile
819   ,)
820
821
822 # Pretty messages
823
824 if test "x$enable_setuid_install" = "xyes" ; then
825         setuid_message="yes (DANGEROUS!!!)"
826 else
827         setuid_message="no"
828 fi
829
830 if test "x$want_zlib" = "xno" ; then
831         zlib_message="no"
832 else
833         zlib_message="yes"
834 fi
835
836 if test "x$have_good_adns" = "xyes" ; then
837         adns_message="yes"
838 else
839         adns_message="no"
840 fi
841
842 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
843         snmp_libs_message="yes (net-snmp)"
844 elif test "x$SNMP_LIBS" = "x" ; then
845         snmp_libs_message="no"
846 else
847         snmp_libs_message="yes (ucd-snmp)"
848 fi
849
850 echo ""
851 echo "The Ethereal package has been configured with the following options."
852 echo "                    Build ethereal : $enable_ethereal"
853 echo "                   Build tethereal : $enable_tethereal"
854 echo "                     Build editcap : $enable_editcap"
855 echo "                    Build mergecap : $enable_mergecap"
856 echo "                   Build text2pcap : $enable_text2pcap"
857 echo "                     Build idl2eth : $enable_idl2eth"
858 echo "                     Build randpkt : $enable_randpkt"
859 echo "                      Build dftest : $enable_dftest"
860 echo ""
861 echo "                    Install setuid : $setuid_message"
862 echo "                       Use plugins : $have_plugins"
863 echo "               Use GTK+ v2 library : $enable_gtk2"
864 if test "x$enable_gtk2" = "xyes" ; then
865 echo "                       Use threads : $enable_threads"
866 fi
867 echo "                  Use pcap library : $want_pcap"
868 echo "                  Use zlib library : $zlib_message"
869 echo "              Use GNU ADNS library : $adns_message"
870 echo "          Use IPv6 name resolution : $enable_ipv6"
871 echo "     Use UCD SNMP/NET-SNMP library : $snmp_libs_message"