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