Better read NTP LSW from the right spot
[obnox/wireshark/wip.git] / configure.in
1 # $Id$
2 #
3 AC_INIT(cfile.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.14)
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(POD2HTML, pod2html)
34 if test "x$POD2HTML" = x
35 then
36         #
37         # The alternative is not to build the HTML man pages....
38         #
39         AC_MSG_ERROR(I couldn't find pod2html; make sure it's installed and in your path)
40 fi
41 AC_PATH_PROG(HTML_VIEWER, htmlview)
42 if test "x$HTML_VIEWER" = x
43 then
44         AC_DEFINE_UNQUOTED(HTML_VIEWER, "mozilla", [HTML viewer, e.g. mozilla])
45 else
46         AC_DEFINE_UNQUOTED(HTML_VIEWER, "htmlview", [HTML viewer, e.g. mozilla])
47 fi
48
49 AC_PATH_PROG(LEX, flex)
50 AC_PATH_PROG(PYTHON, python)
51
52 AC_SUBST(PERL)
53 AC_SUBST(POD2MAN)
54 AC_SUBST(POD2HTML)
55 AC_SUBST(LEX)
56 AC_SUBST(FLEX_PATH)
57 AC_SUBST(PYTHON)
58 AC_SUBST(XSLTPROC)
59 AC_SUBST(XMLLINT)
60
61 # Check for doxygen
62 AC_PATH_PROG(DOXYGEN, doxygen)
63 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, "yes", "no")
64 AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
65
66 # gnu tls
67 AM_PATH_LIBGNUTLS(1.0.0, 
68         [
69                 echo "gnuTLS found, enabling ssl decryption"
70                 AC_DEFINE(HAVE_LIBGNUTLS, 1, [Define to use gnutls library])
71                 tls_message="yes"
72         ]
73         , [
74                 if test x$libgnutls_config_prefix != x ; then
75                         AC_MSG_ERROR([[gnuTLS not found; install gnuTLS-devel package for your system]])
76                 else
77                         echo echo "gnuTLS not found, disabling ssl decryption"
78                         tls_message="no"
79                 fi
80         ]
81 )        
82         
83
84 # Check for xsltproc
85 AC_PATH_PROG(XSLTPROC, xsltproc)
86 AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, "yes", "no")
87 AM_CONDITIONAL(HAVE_XSLTPROC, test x$HAVE_XSLTPROC = xyes)
88
89 # Check for xmllint
90 AC_PATH_PROG(XMLLINT, xmllint)
91 AC_CHECK_PROG(HAVE_XMLLINT, xmllint, "yes", "no")
92 AM_CONDITIONAL(HAVE_XMLLINT, test x$HAVE_XMLLINT = xyes)
93
94 # Check for fop (translate .fo to e.g. pdf)
95 AC_PATH_PROG(FOP, fop)
96 AC_CHECK_PROG(HAVE_FOP, fop, "yes", "no")
97 AM_CONDITIONAL(HAVE_FOP, test x$HAVE_FOP = xyes)
98
99 # Check for hhc (html help compiler)
100 AC_PATH_PROG(HHC, hhc.exe)
101 AC_CHECK_PROG(HAVE_HHC, hhc.exe, "yes", "no")
102 AM_CONDITIONAL(HAVE_HHC, test x$HAVE_HHC = xyes)
103
104 # Check for packaging utilities
105 # For now, we check to see if the various packaging utilites are in our
106 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
107 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
108 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
109 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
110
111 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
112      -a x$HAVE_PKGTRANS = xyes ; then
113   HAVE_SVR4_PACKAGING=yes
114 else
115   HAVE_SVR4_PACKAGING=no
116 fi
117 AC_SUBST(HAVE_SVR4_PACKAGING)
118
119 AC_ETHEREAL_RPM_CHECK
120 AC_SUBST(HAVE_RPM)
121
122 #
123 # If we're running gcc, add '-Wall -W' to CFLAGS, and add
124 # '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
125 # flag unused function arguments and not get warnings about them.
126 # If "--with-extra-gcc-checks" was specified, add "-Wcast-qual
127 # -Wcast-align" as well.  (Add more checks here in the future?)
128 #
129 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
130 # argument will compile with non-GCC compilers.
131 #
132 AC_ARG_WITH(extra-gcc-checks,
133 [  --with-extra-gcc-checks Do additional -W checks in GCC.  [default=no]],
134 [
135         if test $withval != no
136         then
137                 ethereal_extra_gcc_flags=" -Wcast-qual -Wcast-align -Wbad-function-cast -pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings"
138         fi
139 ],)
140 AC_MSG_CHECKING(to see if we can add '-Wall -W $ethereal_extra_gcc_flags' to CFLAGS)
141 if test x$GCC != x ; then
142   CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -Wpointer-arith -W $ethereal_extra_gcc_flags $CFLAGS"
143   AC_MSG_RESULT(yes)
144 else
145   CFLAGS="-D_U_=\"\" $CFLAGS"
146   AC_MSG_RESULT(no)
147 fi
148
149 #
150 # Add any platform-specific compiler flags needed.
151 #
152 AC_MSG_CHECKING(for platform-specific compiler flags)
153 if test "x$GCC" = x
154 then
155         #
156         # Not GCC - assume it's the vendor's compiler.
157         #
158         case "$host_os" in
159         hpux*)
160                 #
161                 # HP's ANSI C compiler; flags suggested by Jost Martin.
162                 # "-Ae" for ANSI C plus extensions such as "long long".
163                 # "+O2", for optimization.  XXX - works with "-g"?
164                 #
165                 CFLAGS="-Ae +O2 $CFLAGS"
166                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
167                 ;;
168         darwin*)
169                 #
170                 # It may be called "cc", but it's really a GCC derivative
171                 # with a problematic special precompiler and precompiled
172                 # headers; turn off the special precompiler, as some
173                 # apparently-legal code won't compile with its precompiled
174                 # headers.
175                 #
176                 CFLAGS="-no-cpp-precomp $CFLAGS"
177                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
178                 ;;
179         *)
180                 AC_MSG_RESULT(none needed)
181                 ;;
182         esac
183 else
184         case "$host_os" in
185         solaris*)
186                 # the X11 headers don't automatically include prototype info
187                 # and a lot don't include the return type
188                 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
189                 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
190                 ;;
191         darwin*)
192                 #
193                 # See comments above about Apple's lovely C compiler.
194                 #
195                 CFLAGS="-no-cpp-precomp $CFLAGS"
196                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
197                 ;;
198         cygwin*)
199                 #
200                 # Shared libraries in cygwin/Win32 must never contain
201                 # undefined symbols.
202                 #
203                 LDFLAGS="$LDFLAGS -no-undefined"
204                 AC_MSG_RESULT(CygWin GCC - added -no-undefined to LDFLAGS)
205                 ;;
206         *)
207                 AC_MSG_RESULT(none needed)
208                 ;;
209         esac
210 fi
211
212 #
213 # On OS X, if we find the headers for Core Foundation and Launch Services,
214 # add -framework options to link with Application Services (of which
215 # Launch Services is a subframework) and Core Foundation (required by
216 # the Launch Services APIs), so we can use that to launch a Web browser
217 # from the Help menu.
218 #
219 # (Do those headers exist on pure Darwin?  If so, does the CoreFoundation
220 # *and* Launch Services code exist there, or are those headers just stubs?
221 # If the frameworks aren't present on Darwin, how *should* we check for
222 # their existence?)
223 #
224 case "$host_os" in
225
226 darwin*)
227         AC_MSG_CHECKING(whether we can build with Core Foundation and Launch Services)
228         ac_save_LIBS="$LIBS"
229         ac_frameworks="-framework ApplicationServices -framework CoreFoundation"
230         LIBS="$LIBS $ac_frameworks"
231         AC_TRY_LINK(
232            [
233 #       include <CoreFoundation/CFBase.h>
234 #       include <CoreFoundation/CFString.h>
235 #       include <CoreFoundation/CFURL.h>
236 #       include <ApplicationServices/ApplicationServices.h>
237            ],
238            [
239         CFStringRef url_CFString;
240         CFURLRef url_CFURL;
241         OSStatus status;
242
243         url_CFString = CFStringCreateWithCString(NULL, "", kCFStringEncodingASCII);
244         url_CFURL = CFURLCreateWithString(NULL, url_CFString, NULL);
245         status = LSOpenCFURLRef(url_CFURL, NULL);
246            ],
247            ac_cv_can_use_cf_and_ls=yes,
248            ac_cv_can_use_cf_and_ls=no,
249            [echo $ac_n "cross compiling; assumed OK... $ac_c"])
250         if test "$ac_cv_can_use_cf_and_ls" = yes ; then
251                 AC_DEFINE(HAVE_OS_X_FRAMEWORKS, 1, [Define to 1 if you have OS X frameworks])
252                 FRAMEWORKS="$ac_frameworks"
253                 AC_MSG_RESULT(yes)
254         else
255                 AC_MSG_RESULT(no)
256         fi
257         LIBS="$ac_save_LIBS"
258         ;;
259 esac
260 AC_SUBST(FRAMEWORKS)
261
262 dnl Look in /usr/local for header files and libraries ?
263 dnl XXX FIXME don't include /usr/local if it is already in the system
264 dnl search path as this causes gcc 3.2 on Linux to complain about a change
265 dnl of the system search order for includes
266 AC_ARG_ENABLE(usr-local,
267 [  --enable-usr-local      look for headers and libs in /usr/local tree.  [default=yes]],ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
268
269 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
270 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
271         AC_MSG_RESULT(yes)
272         #
273         # Arrange that we search for header files in the source directory
274         # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
275         # as various packages we use ("libpcap", "zlib", an SNMP library)
276         # may have been installed under "/usr/local/include".
277         #
278         CFLAGS="$CFLAGS -I/usr/local/include"
279         CPPFLAGS="$CPPFLAGS -I/usr/local/include"
280
281         #
282         # Arrange that we search for libraries in "/usr/local/lib".
283         #
284         AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
285 else
286         AC_MSG_RESULT(no)
287 fi
288
289 #
290 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
291 # link directory.
292 #
293 case "$host_os" in
294   solaris*)
295     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
296     if test x$LD_LIBRARY_PATH != x ; then
297       LIBS="$LIBS -R$LD_LIBRARY_PATH"
298       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
299     else
300       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
301     fi
302   ;;
303 esac
304
305 #
306 # Check for versions of "sed" inadequate to handle, in libtool, a list
307 # of object files as large as the list in Ethereal.
308 #
309 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
310 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
311 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
312 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
313 # is the only "sed" that comes with Solaris that can handle Ethereal.
314 #
315 # Add any checks here that are necessary for other OSes.
316 #
317 AC_ETHEREAL_GNU_SED_CHECK
318 if test "$HAVE_GNU_SED" = no ; then
319         case "$host_os" in
320         solaris*)
321                 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
322                 case `which sed` in
323                         /bin/sed|/usr/bin/sed|/usr/ucb/sed)
324                         AC_MSG_RESULT(yes)              
325                         AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
326                         ;;
327
328                         *)
329                         AC_MSG_RESULT(no)
330                         ;;
331                 esac
332                 ;;
333
334         *)
335                 :
336                 ;;
337         esac
338 fi
339
340 # Enable/disable tethereal
341
342 AC_ARG_ENABLE(ethereal,
343 [  --enable-ethereal       build GTK+-based ethereal.  [default=yes]],enable_ethereal=$enableval,enable_ethereal=yes)
344
345 AC_ARG_ENABLE(gtk2,
346 [  --disable-gtk2          build Glib1/Gtk1+-based (t)ethereal.  [default=no]],enable_gtk2=$enableval,enable_gtk2=yes)
347 AM_CONDITIONAL(USE_GTK2, test x$enable_gtk2 = xyes)
348
349 AC_ARG_ENABLE(threads,
350 [  --enable-threads        use threads in ethereal.  [default=no]],enable_threads=$enableval,enable_threads=no)
351 AM_CONDITIONAL(USE_THREADS, test x$enable_threads = xyes)
352
353 AC_ARG_ENABLE(profile-build,
354 [  --enable-profile-build  build profile-ready binaries.  [default=no]],enable_profile_build=$enableval,enable_profile_build=no)
355 AM_CONDITIONAL(USE_PROFILE_BUILD, test x$enable_profile_build = xyes)
356 AC_MSG_CHECKING(if profile builds must be generated)
357 if test "x$enable_profile_build" = "xyes" ; then
358         if test -n "$GCC" ; then
359                 AC_MSG_RESULT(yes)
360                 CFLAGS=" -pg $CFLAGS"
361         else
362                 AC_MSG_RESULT(no)
363                 echo "Building profile binaries currently only supported for GCC."
364         fi
365 else
366         AC_MSG_RESULT(no)
367 fi
368
369 # Create DATAFILE_DIR #define for config.h
370 datafiledir=$datadir/ethereal
371 datafiledir=`(
372     test "x$prefix" = xNONE && prefix=$ac_default_prefix
373     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
374     eval echo "$datafiledir"
375 )`
376 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$datafiledir", [Directory for data])
377
378 # GTK checks
379 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
380 # programs to be built with GTK+.
381 #
382 if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
383         GTK_OK=two
384         AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
385 elif test "x$enable_gtk2" != "xyes" -a "x$enable_ethereal" = "xyes" ; then
386         GTK_OK=one
387         AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
388 else
389         GTK_OK=no
390 fi
391
392 # GLib checks
393 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
394 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
395 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
396 # set when generating the Makefile, so we can make programs that require
397 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
398 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
399 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
400 # programs to be built with GLib.
401 #
402 if test "$GTK_OK" = "no" ; then
403         enable_ethereal="no"
404         ethereal_bin=""
405         ethereal_man=""
406         # Honor GLIB_CFLAGS
407         if test "x$enable_gtk2" = "xyes" ; then
408                 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib2 distribution not found.), gmodule)
409         else
410                 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
411         fi
412 else
413         ethereal_bin="ethereal\$(EXEEXT)"
414         ethereal_man="ethereal.1"
415         ethereal_SUBDIRS="gtk"
416         # Honor GLIB_CFLAGS
417         if test "$GTK_OK" = "two" ; then
418                 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
419         else
420                 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
421         fi
422 fi
423
424 #
425 # Check whether GLib modules are supported, to determine whether we
426 # can support plugins.
427 #
428 AC_MSG_CHECKING(whether GLib supports loadable modules)
429 ac_save_CFLAGS="$CFLAGS"
430 ac_save_LIBS="$LIBS"
431 CFLAGS="$CFLAGS $GLIB_CFLAGS"
432 LIBS="$GLIB_LIBS $LIBS"
433 AC_TRY_RUN([
434 #include <glib.h>
435 #include <gmodule.h>
436 #include <stdio.h>
437 #include <stdlib.h>
438
439 int 
440 main ()
441 {
442   if (g_module_supported())
443     return 0;   /* success */
444   else
445     return 1;   /* failure */
446 }
447 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
448    [echo $ac_n "cross compiling; assumed OK... $ac_c"
449     ac_cv_glib_supports_modules=yes])
450 CFLAGS="$ac_save_CFLAGS"
451 LIBS="$ac_save_LIBS"
452 if test "$ac_cv_glib_supports_modules" = yes ; then
453   AC_MSG_RESULT(yes)
454   have_plugins=yes
455 else
456   AC_MSG_RESULT(no)
457   have_plugins=no
458 fi
459
460 #
461 # We can't just check for <inttypes.h> - some systems have one that
462 # doesn't define all the PRI[doxu]64 macros.
463 #
464 AC_CHECK_HEADERS(inttypes.h,
465   [
466     #
467     # OK, we have inttypes.h, but does it define those macros?
468     #
469     AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
470     AC_COMPILE_IFELSE(
471       [
472         AC_LANG_SOURCE(
473           [[
474             #include <inttypes.h>
475             #include <glib.h>
476             #include <stdio.h>
477             #include <sys/types.h>
478
479             main()
480             {
481               printf("%" PRId64 "\n", (gint64)1);
482               printf("%" PRIo64 "\n", (guint64)1);
483               printf("%" PRIx64 "\n", (guint64)1);
484               printf("%" PRIX64 "\n", (guint64)1);
485               printf("%" PRIu64 "\n", (guint64)1);
486             }
487           ]])
488       ],
489       [
490         AC_MSG_RESULT(yes)
491         ac_ethereal_inttypes_h_defines_formats=yes
492       ],
493       [
494         AC_MSG_RESULT(no)
495         ac_ethereal_inttypes_h_defines_formats=no
496       ])
497   ],
498   [
499     #
500     # We don't have inttypes.h, so it obviously can't define those
501     # macros.
502     #
503     ac_ethereal_inttypes_h_defines_formats=no
504   ])
505 if test "$ac_ethereal_inttypes_h_defines_formats" = yes; then
506   AC_DEFINE(INTTYPES_H_DEFINES_FORMATS,,[Define if <inttypes.h> defines PRI[doxu]64 macros])
507 else
508   AC_ETHEREAL_CHECK_64BIT_FORMAT(ll,
509     [
510       AC_ETHEREAL_CHECK_64BIT_FORMAT(L,
511         [
512           AC_ETHEREAL_CHECK_64BIT_FORMAT(q,
513             [
514               AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
515             ])
516         ])
517     ])
518 fi
519
520 AC_SUBST(ethereal_bin)
521 AC_SUBST(ethereal_man)
522
523 rdps_bin="rdps\$(EXEEXT)"
524 AC_SUBST(rdps_bin)
525
526
527 # Enable/disable tethereal
528
529 AC_ARG_ENABLE(tethereal,
530 [  --enable-tethereal      build tethereal.  [default=yes]],tethereal=$enableval,enable_tethereal=yes)
531
532 if test "x$enable_tethereal" = "xyes" ; then
533         tethereal_bin="tethereal\$(EXEEXT)"
534         tethereal_man="tethereal.1"
535         etherealfilter_man="ethereal-filter.4"
536 else
537         tethereal_bin=""
538         tethereal_man=""
539 fi
540 AC_SUBST(tethereal_bin)
541 AC_SUBST(tethereal_man)
542 AC_SUBST(etherealfilter_man)
543
544
545
546 # Enable/disable editcap
547
548 AC_ARG_ENABLE(editcap,
549 [  --enable-editcap        build editcap.  [default=yes]],enable_editcap=$enableval,enable_editcap=yes)
550
551 if test "x$enable_editcap" = "xyes" ; then
552         editcap_bin="editcap\$(EXEEXT)"
553         editcap_man="editcap.1"
554 else
555         editcap_bin=""
556         editcap_man=""
557 fi
558 AC_SUBST(editcap_bin)
559 AC_SUBST(editcap_man)
560
561
562 # Enable/disable dumpcap
563
564 AC_ARG_ENABLE(dumpcap,
565 [  --enable-dumpcap        build dumpcap.  [default=yes]],enable_dumpcap=$enableval,enable_dumpcap=yes)
566
567 if test "x$enable_dumpcap" = "xyes" ; then
568         dumpcap_bin="dumpcap\$(EXEEXT)"
569         dumpcap_man="dumpcap.1"
570 else
571         dumpcap_bin=""
572         dumpcap_man=""
573 fi
574 AC_SUBST(dumpcap_bin)
575 AC_SUBST(dumpcap_man)
576
577
578 # Enable/disable capinfos
579
580 AC_ARG_ENABLE(capinfos,
581 [  --enable-capinfos       build capinfos.  [default=yes]],enable_capinfos=$enableval,enable_capinfos=yes)
582
583 if test "x$enable_capinfos" = "xyes" ; then
584         capinfos_bin="capinfos\$(EXEEXT)"
585         capinfos_man="capinfos.1"
586 else
587         capinfos_bin=""
588         capinfos_man=""
589 fi
590 AC_SUBST(capinfos_bin)
591 AC_SUBST(capinfos_man)
592
593
594 # Enable/disable mergecap
595
596 AC_ARG_ENABLE(mergecap,
597 [  --enable-mergecap       build mergecap.  [default=yes]],enable_mergecap=$enableval,enable_mergecap=yes)
598
599 if test "x$enable_mergecap" = "xyes" ; then
600         mergecap_bin="mergecap\$(EXEEXT)"
601         mergecap_man="mergecap.1"
602 else
603         mergecap_bin=""
604         mergecap_man=""
605 fi
606 AC_SUBST(mergecap_bin)
607 AC_SUBST(mergecap_man)
608
609
610 # Enable/disable text2pcap
611
612 AC_ARG_ENABLE(text2pcap,
613 [  --enable-text2pcap      build text2pcap.  [default=yes]],text2pcap=$enableval,enable_text2pcap=yes)
614
615 if test "x$enable_text2pcap" = "xyes" ; then
616         text2pcap_bin="text2pcap\$(EXEEXT)"
617         text2pcap_man="text2pcap.1"
618 else
619         text2pcap_bin=""
620         text2pcap_man=""
621 fi
622 AC_SUBST(text2pcap_bin)
623 AC_SUBST(text2pcap_man)
624
625 # Enable/disable idl2eth
626
627 AC_ARG_ENABLE(idl2eth,
628 [  --enable-idl2eth        build idl2eth.  [default=yes]],enable_idl2eth=$enableval,enable_idl2eth=yes)
629
630 if test "x$enable_idl2eth" = "xyes" ; then
631         idl2eth_bin="idl2eth"
632         idl2eth_man="idl2eth.1"
633 else
634         idl2eth_bin=""
635         idl2eth_man=""
636 fi
637 AC_SUBST(idl2eth_bin)
638 AC_SUBST(idl2eth_man)
639
640
641 # Enable/disable dftest
642
643 AC_ARG_ENABLE(dftest,
644 [  --enable-dftest         build dftest.  [default=yes]],enable_dftest=$enableval,enable_dftest=yes)
645
646 if test "x$enable_dftest" = "xyes" ; then
647         dftest_bin="dftest\$(EXEEXT)"
648 else
649         dftest_bin=""
650 fi
651 AC_SUBST(dftest_bin)
652
653
654 # Enable/disable randpkt
655
656 AC_ARG_ENABLE(randpkt,
657 [  --enable-randpkt        build randpkt.  [default=yes]],enable_randpkt=$enableval,enable_randpkt=yes)
658
659 if test "x$enable_randpkt" = "xyes" ; then
660         randpkt_bin="randpkt\$(EXEEXT)"
661 else
662         randpkt_bin=""
663 fi
664 AC_SUBST(randpkt_bin)
665
666
667 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
668 dnl "gethostbyname()".
669 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
670
671 dnl Checks for "connect()", used as a proxy for "socket()" - and
672 dnl "-lsocket", if we need it to get "connect()".
673 AC_ETHEREAL_SOCKET_LIB_CHECK
674
675 dnl pcap check
676 AC_MSG_CHECKING(whether to use libpcap for packet capture)
677
678 AC_ARG_WITH(pcap,
679 [  --with-pcap[[=DIR]]       use libpcap for packet capturing.  [[default=yes]]],
680 [
681         if test $withval = no
682         then
683                 want_pcap=no
684         elif test $withval = yes
685         then
686                 want_pcap=yes
687         else
688                 want_pcap=yes
689                 pcap_dir=$withval
690         fi
691 ],[
692         want_pcap=yes
693         pcap_dir=
694 ])
695 if test "x$want_pcap" = "xno" ; then
696         AC_MSG_RESULT(no)
697 else
698         AC_MSG_RESULT(yes)
699         AC_ETHEREAL_PCAP_CHECK
700 fi
701
702 dnl zlib check
703 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
704
705 AC_ARG_WITH(zlib,
706 [  --with-zlib[[=DIR]]       use zlib (located in directory DIR, if supplied) to read compressed data.  [[default=yes, if available]]],
707 [
708         if test $withval = no
709         then
710                 want_zlib=no
711         elif test $withval = yes
712         then
713                 want_zlib=yes
714         else
715                 want_zlib=yes
716                 zlib_dir=$withval
717         fi
718 ],[
719         #
720         # Use zlib if it's present, otherwise don't.
721         #
722         want_zlib=ifavailable
723         zlib_dir=
724 ])
725 if test "x$want_zlib" = "xno" ; then
726         AC_MSG_RESULT(no)
727 else
728         AC_MSG_RESULT(yes)
729         AC_ETHEREAL_ZLIB_CHECK
730         if test "x$want_zlib" = "xno" ; then
731                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
732         fi
733 fi
734
735
736 dnl pcre check
737 AC_MSG_CHECKING(whether to use libpcre for regular expressions in dfilters)
738
739 AC_ARG_WITH(pcre,
740 [  --with-pcre[[=DIR]]       use libpcre (located in directory DIR, if supplied) to use in dfilter regular expressions.  [[default=yes, if available]]],
741 [
742         if test $withval = no
743         then
744                 want_pcre=no
745         elif test $withval = yes
746         then
747                 want_pcre=yes
748         else
749                 want_pcre=yes
750                 pcre_dir=$withval
751         fi
752 ],[
753         #
754         # Use libpcre if it's present, otherwise don't.
755         #
756         want_pcre=ifavailable
757         pcre_dir=
758 ])
759 if test "x$want_pcre" = "xno" ; then
760         AC_MSG_RESULT(no)
761 else
762         AC_MSG_RESULT(yes)
763         AC_ETHEREAL_LIBPCRE_CHECK
764         if test "x$want_pcre" = "xno" ; then
765                 AC_MSG_RESULT(libpcre not found - disabling support for perl compatible regular expressions in dfilters)
766         fi
767 fi
768
769
770 dnl lua check
771 AC_MSG_CHECKING(whether to use liblua for the lua scripting plugin)
772
773 AC_ARG_WITH(lua,
774 [  --with-lua[[=DIR]]        use liblua (located in directory DIR, if supplied) for the lua scripting plugin.  [[default=no]]],
775 [
776         if test $withval = no
777         then
778                 want_lua=no
779         elif test $withval = yes
780         then
781                 want_lua=yes
782         else
783                 want_lua=yes
784                 lua_dir=$withval
785         fi
786 ],[
787         #
788         # Don't use liblua by default (it isn't ready yet)
789         #
790         want_lua=no
791         lua_dir=
792 ])
793 if test "x$want_lua" = "xno" ; then
794         AC_MSG_RESULT(no)
795 else
796         AC_MSG_RESULT(yes)
797         AC_ETHEREAL_LIBLUA_CHECK
798         if test "x$want_lua" = "xno" ; then
799                 AC_MSG_RESULT(liblua not found - disabling support for the lua scripting plugin)
800         fi
801 fi
802 AM_CONDITIONAL(HAVE_LIBLUA, test x$want_lua = xyes)
803
804
805 dnl ipv6 check
806 AC_ARG_ENABLE(ipv6,
807 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],enable_ipv6=$enableval,enable_ipv6=yes)
808
809 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
810 if test "x$enable_ipv6" = "xno" ; then
811         AC_MSG_RESULT(no)
812 else
813         AC_MSG_RESULT(yes)
814         AC_ETHEREAL_IPV6_STACK
815 fi
816
817
818 dnl Check if ethereal should be installed setuid
819 AC_ARG_ENABLE(setuid-install,
820 [  --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],enable_setuid_install=$enableval,enable_setuid_install=no)
821
822 AC_MSG_CHECKING(whether to install ethereal setuid)
823 if test "x$enable_setuid_install" = "xno" ; then
824         AC_MSG_RESULT(no)
825 else
826         if test "x$enable_dumpcap" = "xno" ; then
827                 AC_MSG_ERROR(Setuid install works only with --enable-dumpcap, but dumpcap disabled)
828         else
829                 AC_MSG_RESULT(yes)
830         fi
831 fi
832
833 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
834
835 dnl Checks for header files.
836 AC_HEADER_STDC
837 AC_CHECK_HEADERS(direct.h dirent.h fcntl.h netdb.h stdarg.h stddef.h unistd.h)
838 AC_CHECK_HEADERS(sys/ioctl.h sys/param.h sys/socket.h sys/sockio.h sys/stat.h sys/time.h sys/types.h sys/utsname.h sys/wait.h)
839 AC_CHECK_HEADERS(netinet/in.h)
840 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
841 AC_CHECK_HEADERS(iconv.h)
842
843 dnl SSL Check
844 SSL_LIBS=''
845 AC_MSG_CHECKING(whether to use SSL library)
846
847 AC_ARG_WITH(ssl,
848 [  --with-ssl[[=DIR]]        use SSL crypto library (located in directory DIR, if supplied).   [[default=no]]],
849 [
850 if test "x$withval" = "xno";  then
851         want_ssl=no
852 elif test "x$withval" = "xyes"; then
853         want_ssl=yes
854 elif test -d "$withval"; then
855         want_ssl=yes
856         AC_ETHEREAL_ADD_DASH_L(LDFLAGS, ${withval}/lib)
857 fi
858 ],[
859         want_ssl=no
860 ])
861 if test "x$want_ssl" = "xyes"; then
862         AC_MSG_RESULT(yes)
863         AC_CHECK_LIB(crypto,EVP_md5,
864             [
865                 SSL_LIBS=-lcrypto
866             ],
867             [
868                 AC_MSG_ERROR([SSL crypto library was requested, but is not available])
869             ])
870 else
871         AC_MSG_RESULT(no)
872 fi
873 AC_SUBST(SSL_LIBS)
874
875 dnl UCD SNMP/Net-SNMP Check
876 SNMP_LIBS=''
877
878 AC_ARG_WITH(net-snmp,
879 [  --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, if supplied)  [[default=yes, if available]]],
880 [
881         if test $withval = no
882         then
883                 want_netsnmp=no
884         elif test $withval = yes
885         then
886                 want_netsnmp=yes
887         else
888                 want_netsnmp=yes
889                 netsnmpconfig="$withval"
890         fi
891 ],[
892         #
893         # Set "want_netsnmp" to "ifavailable" to make the default "use it
894         # if you find it, otherwise don't".
895         #
896         want_netsnmp=ifavailable
897 ])
898
899 AC_ARG_WITH(ucd-snmp,
900 [  --with-ucd-snmp[[=DIR]]   use UCD SNMP client library (located in directory DIR, if supplied).  [[default=yes, if available]]],
901 [
902         if test $withval = no
903         then
904                 want_ucdsnmp=no
905         elif test $withval = yes
906         then
907                 want_ucdsnmp=yes
908         else
909                 want_ucdsnmp=yes
910                 ucdsnmp_dir=$withval
911         fi
912 ],[
913         #
914         # Set "want_ucdsnmp" to "ifavailable" to make the default "use it
915         # if you find it, otherwise don't".
916         #
917         want_ucdsnmp=ifavailable
918         ucdsnmp_dir=
919 ])
920
921 #
922 # Try Net-SNMP first.
923 #
924 AC_MSG_CHECKING(whether to use Net-SNMP library)
925 if test "x$want_netsnmp" = "xno" ; then
926         AC_MSG_RESULT(no)
927 else
928         if test "x$want_netsnmp" = "xifavailable" ; then
929                 AC_MSG_RESULT([yes, if available])
930         else
931                 AC_MSG_RESULT(yes)
932         fi
933         AC_ETHEREAL_NETSNMP_CHECK
934 fi
935
936 #
937 # If that didn't find Net-SNMP, try UCD SNMP.
938 #
939 if test "x$have_net_snmp" != "xyes" ; then
940         AC_MSG_CHECKING(whether to use UCD SNMP library)
941         if test "x$want_ucdsnmp" = "xno" ; then
942                 AC_MSG_RESULT(no)
943         else
944                 if test "x$want_ucdsnmp" = "xifavailable" ; then
945                         AC_MSG_RESULT([yes, if available])
946                 else
947                         AC_MSG_RESULT(yes)
948                 fi
949                 AC_ETHEREAL_UCDSNMP_CHECK
950         fi
951 fi
952
953 if test "x$have_net_snmp" = "xyes" || test "x$have_ucd_snmp" = "xyes"; then
954         AC_DEFINE(HAVE_SOME_SNMP, 1, [Define to 1 if some SNMP support is to be used])
955 fi
956
957 AC_SUBST(SNMP_LIBS)
958
959
960 dnl kerberos check
961 AC_MSG_CHECKING(whether to use kerberos)
962
963 AC_ARG_WITH(krb5,
964 [  --with-krb5[[=DIR]]       use kerberos (located in directory DIR, if supplied) to use in kerberos dissection  [[default=yes]]],
965 [
966         if test $withval = no
967         then
968                 want_krb5=no
969         elif test $withval = yes
970         then
971                 want_krb5=yes
972         else
973                 want_krb5=yes
974                 krb5_dir=$withval
975         fi
976 ],[
977         #
978         # Use kerberos if specified, otherwise don't.
979         #
980         want_krb5=ifavailable
981         krb5_dir=
982 ])
983 if test "x$want_krb5" = "xno" ; then
984         AC_MSG_RESULT(no)
985 else
986         AC_MSG_RESULT(yes)
987         AC_ETHEREAL_KRB5_CHECK
988 fi
989
990
991 dnl ADNS Check
992 ADNS_LIBS=''
993 AC_MSG_CHECKING(whether to use the GNU ADNS library if available)
994
995 AC_ARG_WITH(adns,
996 [  --with-adns[[=DIR]]       use GNU ADNS (located in directory DIR, if supplied).   [[default=yes, if present]]],
997 [
998 if   test "x$withval" = "xno";  then
999         want_adns=no
1000 elif test "x$withval" = "xyes"; then
1001         want_adns=yes
1002 elif test -d "$withval"; then
1003         want_adns=yes
1004         AC_ETHEREAL_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1005 fi
1006 ])
1007 if test "x$with_adns" = "xno" ; then
1008         AC_MSG_RESULT(no)
1009 else
1010         AC_MSG_RESULT(yes)
1011         AC_ETHEREAL_ADNS_CHECK
1012 fi
1013 AC_SUBST(ADNS_LIBS)
1014
1015 #
1016 # Define ETH_VAR_IMPORT appropriately for declarations of external
1017 # variables exported from dynamically-linked libraries.
1018 #
1019 AC_DEFINE(ETH_VAR_IMPORT, extern, [Define as the string to precede external variable declarations in dynamically-linked libraries])
1020
1021 dnl Checks for typedefs, structures, and compiler characteristics.
1022 # AC_C_CONST
1023
1024 # We need to know whether "struct sockaddr" has an "sa_len" member
1025 # for get_interface_list().
1026
1027 AC_ETHEREAL_STRUCT_SA_LEN
1028
1029 # We must know our byte order
1030 AC_C_BIGENDIAN
1031
1032 # Checks whether "-traditional" is needed when using "ioctl".
1033 # XXX - do we need this?
1034 AC_PROG_GCC_TRADITIONAL
1035
1036 GETOPT_C=""
1037 GETOPT_O=""
1038 AC_CHECK_FUNC(getopt, GETOPT_O="",
1039   [GETOPT_O="getopt.o"
1040    AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h needs to be included])
1041 ])
1042 if test "$ac_cv_func_getopt" = no ; then
1043   GETOPT_C="getopt.c"
1044   GETOPT_O="getopt.o"
1045 fi
1046 AC_SUBST(GETOPT_C)
1047 AC_SUBST(GETOPT_O)
1048
1049 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
1050 # then this won't work.
1051 SNPRINTF_C=""
1052 SNPRINTF_O=""
1053 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
1054   [SNPRINTF_O="snprintf.o"
1055    AC_DEFINE(NEED_SNPRINTF_H, 1, [Define if sprintf.h needs to be included])
1056 ])
1057 if test "$ac_cv_func_snprintf" = no ; then
1058   SNPRINTF_C="snprintf.c"
1059   SNPRINTF_O="snprintf.o"
1060 fi
1061 AC_SUBST(SNPRINTF_C)
1062 AC_SUBST(SNPRINTF_O)
1063
1064 AC_CHECK_FUNC(strerror, STRERROR_O="",
1065   [STRERROR_O="strerror.o"
1066    AC_DEFINE(NEED_STRERROR_H, 1, [Define if strerror.h needs to be included])
1067 ])
1068 if test "$ac_cv_func_strerror" = no ; then
1069   STRERROR_C="strerror.c"
1070   STRERROR_O="strerror.o"
1071 fi
1072 AC_SUBST(STRERROR_C)
1073 AC_SUBST(STRERROR_O)
1074
1075 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
1076   STRCASECMP_O="strcasecmp.o")
1077 if test "$ac_cv_func_strcasecmp" = no ; then
1078   STRCASECMP_C="strcasecmp.c"
1079   STRCASECMP_O="strcasecmp.o"
1080 fi
1081 AC_SUBST(STRCASECMP_C)
1082 AC_SUBST(STRCASECMP_O)
1083
1084 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
1085   STRNCASECMP_O="strncasecmp.o")
1086 if test "$ac_cv_func_strncasecmp" = no ; then
1087   STRNCASECMP_C="strncasecmp.c"
1088   STRNCASECMP_O="strncasecmp.o"
1089 fi
1090 AC_SUBST(STRNCASECMP_C)
1091 AC_SUBST(STRNCASECMP_O)
1092
1093 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
1094   MKSTEMP_O="mkstemp.o")
1095 if test "$ac_cv_func_mkstemp" = no ; then
1096   MKSTEMP_C="mkstemp.c"
1097   MKSTEMP_O="mkstemp.o"
1098 fi
1099 AC_SUBST(MKSTEMP_C)
1100 AC_SUBST(MKSTEMP_O)
1101
1102 ac_save_LIBS="$LIBS"
1103 LIBS="$GLIB_LIBS $LIBS"
1104 G_ASCII_STRTOULL_C=""
1105 G_ASCII_STRTOULL_O=""
1106 G_ASCII_STRTOULL_LO=""
1107 AC_CHECK_FUNC(g_ascii_strtoull,
1108   [G_ASCII_STRTOULL_O=""
1109    G_ASCII_STRTOULL_LO=""],
1110   [G_ASCII_STRTOULL_O="g_ascii_strtoull.o"
1111    G_ASCII_STRTOULL_LO="g_ascii_strtoull.lo"
1112    AC_DEFINE(NEED_G_ASCII_STRTOULL_H, 1, [Define if g_ascii_strtoull.h needs to be included])
1113 ])
1114 LIBS="$ac_save_LIBS"
1115 if test "$ac_cv_func_g_ascii_strtoull" = no ; then
1116   G_ASCII_STRTOULL_C="g_ascii_strtoull.c"
1117   G_ASCII_STRTOULL_O="g_ascii_strtoull.o"
1118   G_ASCII_STRTOULL_LO="g_ascii_strtoull.lo"
1119 fi
1120 AC_SUBST(G_ASCII_STRTOULL_C)
1121 AC_SUBST(G_ASCII_STRTOULL_O)
1122 AC_SUBST(G_ASCII_STRTOULL_LO)
1123
1124 AC_CHECK_FUNC(inet_aton,
1125   [INET_ATON_O=""
1126    INET_ATON_LO=""],
1127   [INET_ATON_O="inet_aton.o"
1128    INET_ATON_LO="inet_aton.lo"
1129 ])
1130 if test "$ac_cv_func_inet_aton" = no ; then
1131   INET_ATON_C="inet_aton.c"
1132   INET_ATON_O="inet_aton.o"
1133   INET_ATON_LO="inet_aton.lo"
1134   AC_DEFINE(NEED_INET_ATON_H, 1, [Define if inet/aton.h needs to be included])
1135 fi
1136 AC_SUBST(INET_ATON_C)
1137 AC_SUBST(INET_ATON_O)
1138 AC_SUBST(INET_ATON_LO)
1139
1140 AC_SEARCH_LIBS(inet_pton, [socket nsl], [
1141   dnl check for pre-BIND82 inet_pton() bug.
1142   AC_MSG_CHECKING(for broken inet_pton)
1143   AC_TRY_RUN([#include <sys/types.h>
1144 #include <sys/socket.h>
1145 #include <netinet/in.h>
1146 #include <arpa/inet.h>
1147 int main()
1148 {
1149 #ifdef AF_INET6
1150   char buf[16];
1151   /* this should return 0 (error) */
1152   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
1153 #else
1154   return 1;
1155 #endif
1156 }], [AC_MSG_RESULT(ok);
1157 have_inet_pton=yes], [AC_MSG_RESULT(broken);
1158 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
1159 have_inet_pton=no])],
1160 have_inet_pton=no)
1161 if test "$have_inet_pton" = no; then
1162   INET_PTON_C="inet_pton.c"
1163   INET_PTON_O="inet_pton.o"
1164   INET_PTON_LO="inet_pton.lo"
1165 else
1166   INET_PTON_C=""
1167   INET_PTON_O=""
1168   INET_PTON_LO=""
1169 fi
1170 AC_SUBST(INET_PTON_C)
1171 AC_SUBST(INET_PTON_O)
1172 AC_SUBST(INET_PTON_LO)
1173
1174 AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
1175   AC_MSG_CHECKING([for inet_ntop prototype])
1176   AC_TRY_COMPILE([#include <stdio.h>
1177 #include <sys/types.h>
1178 #include <sys/socket.h>
1179 #include <netinet/in.h>
1180 #include <arpa/inet.h>
1181
1182 extern const char *inet_ntop(int, const void *, char *, size_t);],, [
1183     AC_MSG_RESULT(yes)
1184     AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
1185     [Define if inet_ntop() prototype exists])], [
1186     AC_TRY_COMPILE([#include <stdio.h>
1187 #include <sys/types.h>
1188 #include <sys/socket.h>
1189 #include <netinet/in.h>
1190 #include <arpa/inet.h>
1191
1192 extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
1193       AC_MSG_RESULT(yes)
1194       AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
1195       [Define if inet_ntop() prototype exists])], [
1196       AC_MSG_RESULT(no)])])
1197   INET_NTOP_O=""
1198   INET_NTOP_LO=""], [
1199   INET_NTOP_C="inet_ntop.c"
1200   INET_NTOP_O="inet_ntop.o"
1201   INET_NTOP_LO="inet_ntop.lo"
1202   AC_DEFINE(NEED_INET_V6DEFS_H, 1,
1203   [Define if inet/v6defs.h needs to be included])])
1204 AC_SUBST(INET_NTOP_C)
1205 AC_SUBST(INET_NTOP_O)
1206 AC_SUBST(INET_NTOP_LO)
1207
1208 AC_CHECK_FUNC(strptime, STRPTIME_O="",
1209   [STRPTIME_O="strptime.o"
1210    AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
1211 ])
1212 if test "$ac_cv_func_strptime" = no ; then
1213   STRPTIME_C="strptime.c"
1214   STRPTIME_O="strptime.o"
1215 fi
1216 AC_SUBST(STRPTIME_C)
1217 AC_SUBST(STRPTIME_O)
1218
1219 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
1220 AC_CHECK_FUNCS(issetugid)
1221 AC_CHECK_FUNCS(mmap mprotect sysconf)
1222
1223 dnl blank for now, but will be used in future
1224 AC_SUBST(ethereal_SUBDIRS)
1225
1226 dnl
1227 dnl check whether plugins should be enabled and, if they should be,
1228 dnl check for plugins directory - stolen from Amanda's configure.in
1229 dnl
1230 plugindir="$libdir/ethereal/plugins/$VERSION"
1231 AC_ARG_WITH(plugins,
1232 [  --with-plugins[[=DIR]]    support plugins (installed in DIR, if supplied).],
1233 [
1234   case "$withval" in
1235   "" | y | ye | yes )
1236     if test x$have_plugins = xno
1237     then
1238       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
1239     fi
1240     ;;
1241   n | no)
1242     have_plugins=no
1243     ;;
1244   *)
1245     if test x$have_plugins = xno
1246     then
1247       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
1248     fi
1249     plugindir="$withval"
1250     ;;
1251   esac
1252 ])
1253
1254 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
1255 if test x$have_plugins = xyes
1256 then
1257   AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
1258   plugindir=`(
1259     test "x$prefix" = xNONE && prefix=$ac_default_prefix
1260     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1261     eval echo "$plugindir"
1262   )`
1263   AC_DEFINE_UNQUOTED(PLUGIN_DIR, "$plugindir", [Plugin installation directory])
1264 else
1265   AC_DEFINE(PLUGIN_DIR, NULL, [Plugin installation directory])
1266 fi
1267 AC_SUBST(plugindir)
1268
1269 #
1270 # The plugin dissectors reside in ./plugins/PROTO/
1271 #
1272 PLUGIN_LIBS="-L../../epan -lethereal $GLIB_LIBS"
1273 AC_SUBST(PLUGIN_LIBS)
1274
1275 dnl libtool defs
1276 #
1277 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
1278 # (autoconf?  automake?  libtool?) - with the newer version(s), it's
1279 # just an alias for AC_PROG_LIBTOOL, which is called earlier.
1280 #
1281 # With older version(s) of those tool(s), however, it's not just an
1282 # alias, and the configure scripts don't work without it.
1283 #
1284 AM_PROG_LIBTOOL
1285 AC_SUBST(LIBTOOL_DEPS)
1286
1287 AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes)
1288 if test x$enable_static = xyes -a x$have_plugins = xyes
1289 then
1290   AC_DEFINE(ENABLE_STATIC, 1, [Link plugins statically into Ethereal])
1291 fi
1292 AC_SUBST(ENABLE_STATIC)
1293
1294 dnl Save the cacheable configure results to config.cache before recursing
1295 AC_CACHE_SAVE
1296
1297 AM_CONFIG_HEADER(config.h)
1298 AC_CONFIG_SUBDIRS(wiretap)
1299 AC_OUTPUT(
1300   Makefile
1301   doxygen.cfg
1302   doc/Makefile
1303   epan/Makefile
1304   epan/doxygen.cfg
1305   epan/dfilter/Makefile
1306   epan/dissectors/Makefile
1307   epan/ftypes/Makefile
1308   gtk/Makefile
1309   gtk/doxygen.cfg
1310   help/Makefile
1311   packaging/Makefile
1312   packaging/nsis/Makefile
1313   packaging/rpm/Makefile
1314   packaging/rpm/SPECS/Makefile
1315   packaging/rpm/SPECS/ethereal.spec
1316   packaging/svr4/Makefile
1317   packaging/svr4/checkinstall
1318   packaging/svr4/pkginfo
1319   plugins/Makefile
1320   plugins/acn/Makefile
1321   plugins/agentx/Makefile
1322   plugins/artnet/Makefile
1323   plugins/asn1/Makefile
1324   plugins/ciscosm/Makefile
1325   plugins/docsis/Makefile
1326   plugins/enttec/Makefile
1327   plugins/giop/Makefile
1328   plugins/gryphon/Makefile
1329   plugins/h223/Makefile
1330   plugins/irda/Makefile
1331   plugins/lua/Makefile
1332   plugins/lwres/Makefile
1333   plugins/mate/Makefile
1334   plugins/megaco/Makefile
1335   plugins/mgcp/Makefile
1336   plugins/opsi/Makefile
1337   plugins/pcli/Makefile
1338   plugins/profinet/Makefile
1339   plugins/rdm/Makefile
1340   plugins/rlm/Makefile
1341   plugins/rtnet/Makefile
1342   plugins/rudp/Makefile
1343   plugins/stats_tree/Makefile
1344   plugins/v5ua/Makefile
1345   tools/Makefile
1346   tools/lemon/Makefile
1347   ,)
1348
1349
1350 # Pretty messages
1351
1352 if test "x$enable_setuid_install" = "xyes" ; then
1353         setuid_message="yes (DANGEROUS!!!)"
1354 else
1355         setuid_message="no"
1356 fi
1357
1358 if test "x$want_zlib" = "xno" ; then
1359         zlib_message="no"
1360 else
1361         zlib_message="yes"
1362 fi
1363
1364 if test "x$want_pcre" = "xno" ; then
1365         pcre_message="no"
1366 else
1367         pcre_message="yes"
1368 fi
1369
1370 if test "x$want_lua" = "xyes" -a "x$have_plugins" = "xyes" ; then
1371         lua_message="yes"
1372 else
1373         lua_message="no"
1374 fi
1375
1376 if test "x$want_ssl" = "xno" ; then
1377         ssl_message="no"
1378 else
1379         ssl_message="yes"
1380 fi
1381
1382 if test "x$want_krb5" = "xno" ; then
1383         krb5_message="no"
1384 else
1385         krb5_message="yes ($ac_krb5_version)"
1386 fi
1387
1388 if test "x$have_good_adns" = "xyes" ; then
1389         adns_message="yes"
1390 else
1391         adns_message="no"
1392 fi
1393
1394 if test "x$have_net_snmp" = "xyes" ; then
1395         snmp_libs_message="yes (net-snmp)"
1396 elif test "x$have_ucdsnmp" = "xyes" ; then
1397         snmp_libs_message="yes (ucd-snmp)"
1398 else
1399         snmp_libs_message="no"
1400 fi
1401
1402 echo ""
1403 echo "The Ethereal package has been configured with the following options."
1404 echo "                    Build ethereal : $enable_ethereal"
1405 echo "                   Build tethereal : $enable_tethereal"
1406 echo "                    Build capinfos : $enable_capinfos"
1407 echo "                     Build editcap : $enable_editcap"
1408 echo "                     Build dumpcap : $enable_dumpcap"
1409 echo "                    Build mergecap : $enable_mergecap"
1410 echo "                   Build text2pcap : $enable_text2pcap"
1411 echo "                     Build idl2eth : $enable_idl2eth"
1412 echo "                     Build randpkt : $enable_randpkt"
1413 echo "                      Build dftest : $enable_dftest"
1414 echo ""
1415 echo "                    Install setuid : $setuid_message"
1416 echo "                       Use plugins : $have_plugins"
1417 echo "                  Build lua plugin : $lua_message"
1418 echo "               Use GTK+ v2 library : $enable_gtk2"
1419 if test "x$enable_gtk2" = "xyes" ; then
1420 echo "                       Use threads : $enable_threads"
1421 echo "            Build profile binaries : $enable_profile_build"
1422 fi
1423 echo "                  Use pcap library : $want_pcap"
1424 echo "                  Use zlib library : $zlib_message"
1425 echo "                  Use pcre library : $pcre_message"
1426 echo "              Use kerberos library : $krb5_message"
1427 echo "              Use GNU ADNS library : $adns_message"
1428 echo "            Use SSL crypto library : $ssl_message"
1429 echo "          Use IPv6 name resolution : $enable_ipv6"
1430 echo "     Use UCD SNMP/Net-SNMP library : $snmp_libs_message"
1431 echo "                Use gnutls library : $tls_message"