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