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