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