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