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