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