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