Revert e65f581ffa86f6bfd566a9b66ca2c882f465727f, which
[metze/wireshark/wip.git] / configure.ac
1 #
2 # Autoconf script for Wireshark
3 #
4
5 #
6 # Define variables for the components of the Wireshark version number.
7 #
8 m4_define([version_major], [1])
9 m4_define([version_minor], [99])
10 m4_define([version_micro], [2])
11 m4_define([version_micro_extra], version_micro)
12 m4_append([version_micro_extra], [])
13
14 AC_INIT(wireshark, [version_major.version_minor.version_micro_extra], http://bugs.wireshark.org/, , http://www.wireshark.org/)
15 CONFIG_ARGS="$*"
16 AC_SUBST(CONFIG_ARGS)
17
18 # Minimum autoconf version we require.
19 AC_PREREQ(2.60)
20 # Variable expansion doesn't work in AC_PREREQ()
21 AC_MIN_VERSION=2.60
22 AC_SUBST(AC_MIN_VERSION)
23
24 dnl Make sure to keep ACLOCAL_AMFLAGS in Makefile.am and AC_CONFIG_MACRO_DIRS
25 dnl in configure.ac in sync, otherwise there will be an error running autogen.sh.
26 m4_ifdef([AC_CONFIG_MACRO_DIRS],AC_CONFIG_MACRO_DIRS([./aclocal-fallback]))
27
28 dnl Check for CPU / vendor / OS
29 dnl The user is encouraged to use either `AC_CANONICAL_BUILD', or
30 dnl `AC_CANONICAL_HOST', or `AC_CANONICAL_TARGET', depending on the
31 dnl needs.  Using `AC_CANONICAL_TARGET' is enough to run the two other
32 dnl macros.
33 dnl
34 dnl As nothing in the Wireshark is itself a build tool (we are not,
35 dnl for example, a compiler that generates machine code), we probably
36 dnl don't need AC_CANONICAL_TARGET, so, in theory, we should be able
37 dnl to use AC_CANONICAL_BUILD and AC_CANONICAL_HOST - or perhaps just
38 dnl AC_CANONICAL_HOST - instead.  Note that we do have tools, such as
39 dnl lemon, that need to be built for the build machine, not for the
40 dnl host machine, so we might need both.
41 dnl
42 dnl This has to be done *after* AC_INIT, otherwise autogen.sh fails.
43
44 dnl AC_CANONICAL_BUILD
45 dnl AC_CANONICAL_HOST
46 AC_CANONICAL_TARGET
47
48 AM_INIT_AUTOMAKE([1.9 tar-ustar dist-bzip2 no-dist-gzip])
49
50 # Make Wireshark's version available in config.h
51 AC_DEFINE(VERSION_MAJOR, version_major, [Wireshark's major version])
52 AC_DEFINE(VERSION_MINOR, version_minor, [Wireshark's minor version])
53 AC_DEFINE(VERSION_MICRO, version_micro, [Wireshark's micro version])
54
55 AM_DISABLE_STATIC
56
57 #
58 # Checks for programs used in the main build process.
59 #
60 AC_PROG_CC
61 AM_PROG_CC_C_O
62 AC_PROG_CXX
63 AC_PROG_CPP
64 AC_PROG_MKDIR_P
65
66 dnl Work around libtool bug (fixed in the version 1.5a?)
67 AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
68 AC_LIBTOOL_DLOPEN
69 AC_PROG_LIBTOOL
70 if test ! -z "$CXX"; then
71         #
72         # OK, we found something AC_LANG_CXX thinks is a C++ compiler,
73         # but is it one?
74         #
75         # Some UN*Xes have, by default, a case-insensitive file
76         # system, and AC_PROG_CXX looks for, among other things,
77         # "CC" as a C++ compiler, and, if you have a case-insensitive
78         # file system and a C compiler named "cc" (both true, by
79         # default, on OS X), AC_PROG_CXX may end up thinking it's
80         # the C++ compiler.
81         #
82         # So we check by feeding the purported C++ compiler a
83         # program using C++ features (iostream).
84         #
85         # We do this after AC_PROG_LIBTOOL; if we did so before, and
86         # cleared CXX if what we had isn't a C++ compiler, that'd
87         # get undone by AC_PROG_LIBTOOL for some reason.
88         #
89         AC_MSG_CHECKING(whether $CXX is a C++ compiler)
90         AC_LANG_PUSH([C++])
91         AC_LINK_IFELSE([AC_LANG_PROGRAM(
92         [
93 #include <iostream>
94         ],
95         [
96         std::cout << "Hello World! ";
97         return 0;
98         ])],
99                 [AC_MSG_RESULT(yes)],
100                 [
101                         AC_MSG_RESULT(no)
102                         CXX=""
103                 ])
104         AC_LANG_POP([C++])
105 fi
106 AC_PATH_PROG(PERL, perl)
107
108 # Check for Python.
109 AC_PATH_PROGS(PYTHON, python, python3)
110 if test ! -z "$PYTHON"; then
111         #
112         # OK, we found Python; is it Python 2.5 or later?
113         # Note: we don't use named components for sys.version_info to get
114         # the major version number, as named components for version_info
115         # were apparently introduced in Python 2.7.
116         #
117         AC_MSG_CHECKING([whether $PYTHON is Python 2.5 or later])
118         python_major_version=`$PYTHON -c 'import sys; print (sys.version_info[[0]])'`
119         python_minor_version=`$PYTHON -c 'import sys; print (sys.version_info[[1]])'`
120         if test "$python_major_version" -eq 2 -a "$python_minor_version" -lt 5 ; then
121                 AC_MSG_RESULT(no)
122                 AC_MSG_WARN([Building with Python $python_major_version.$python_minor_version may not work])
123         else
124                 AC_MSG_RESULT(yes)
125         fi
126 else
127         AC_MSG_ERROR(I couldn't find python; make sure it's installed and in your path)
128 fi
129
130 #
131 # XXX - should autogen.sh check for YACC/Bison and Flex?  A user building
132 # from a distribution tarball shouldn't have to have YACC/Bison or Flex,
133 # as the tarball should contain the results of running YACC/Bison on .y
134 # files and running Flex on .l files, but a user building from SVN
135 # will have to run YACC/Bison and Flex to process those files.
136 #
137 # On the other hand, what about users who use a distribution tarball to
138 # do development?  They *shouldn't* - that's what the SVN repository is
139 # for - but they might.  They'd get errors if they modify a .y or .l
140 # file and try to do a build - but the error should tell them that they
141 # need to get YACC/Bison and/or Flex.
142 #
143 # Then again, getting them shouldn't be too big of a burden.
144 #
145 # XXX - is the same true of pod2man and pod2html, or are they needed
146 # even when building from a distribution tarball?
147 #
148 #
149 AC_PROG_YACC
150 AC_PATH_PROG(YACCDUMMY, $YACC)
151 if test "x$YACCDUMMY" = x
152 then
153         AC_MSG_ERROR(I couldn't find yacc (or bison or ...); make sure it's installed and in your path)
154 fi
155 AM_PROG_LEX
156 AC_PATH_PROG(LEX, flex)
157 if test "x$LEX" = x
158 then
159         AC_MSG_ERROR(I couldn't find flex; make sure it's installed and in your path)
160 fi
161 AC_PATH_PROG(POD2MAN, pod2man)
162 if test "x$POD2MAN" = x
163 then
164         #
165         # The alternative is not to build the man pages....
166         #
167         AC_MSG_ERROR(I couldn't find pod2man; make sure it's installed and in your path)
168 fi
169 AC_PATH_PROG(POD2HTML, pod2html)
170 if test "x$POD2HTML" = x
171 then
172         #
173         # The alternative is not to build the HTML man pages....
174         #
175         AC_MSG_ERROR(I couldn't find pod2html; make sure it's installed and in your path)
176 fi
177
178 #
179 # Checks for programs used by Wireshark/TShark/etc.
180 #
181
182 #
183 # XXX - this looks for various HTML viewers on the host, not the target;
184 # we really want to know what's available on the target, for cross-builds.
185 # That would probably require us to, at run time, look for xdg-open and,
186 # if we don't find it, look for mozilla, htmlview, etc.
187 #
188 AC_PATH_PROG(HTML_VIEWER, xdg-open)
189 if test "x$HTML_VIEWER" != x
190 then
191         #
192         # XXX - the HTML_VIEWER shell variable is the full path of xdg-open.
193         # Define some variable to be that, so we just run that?
194         #
195         AC_DEFINE(HAVE_XDG_OPEN, 1, [Define if we have xdg-open])
196
197         #
198         # XXX - we have to define HTML_VIEWER for the prefs.c code that
199         # sets the default value of the Web browser preference, even
200         # though that preference won't be offered.
201         #
202         AC_DEFINE_UNQUOTED(HTML_VIEWER, "xdg-open", [HTML viewer, e.g. mozilla])
203 else
204         AC_PATH_PROG(HTML_VIEWER, htmlview)
205         if test "x$HTML_VIEWER" = x
206         then
207                 AC_DEFINE_UNQUOTED(HTML_VIEWER, "mozilla", [HTML viewer, e.g. mozilla])
208         else
209                 AC_DEFINE_UNQUOTED(HTML_VIEWER, "htmlview", [HTML viewer, e.g. mozilla])
210         fi
211 fi
212
213 #
214 # Set "ac_supports_gcc_flags" if the compiler is known to support GCC-style
215 # flags such as -pedantic, -W warning flags and -f feature flags.  Currently,
216 # we assume GCC and clang do; other compilers should be added here.
217 #
218 # This is done to avoid getting tripped up by compilers that support
219 # those flags but give them a different meaning.
220 #
221 if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
222         ac_supports_gcc_flags=yes
223 fi
224
225 if test "x$CC_FOR_BUILD" = x
226 then
227        CC_FOR_BUILD=$CC
228 fi
229 AC_SUBST(CC_FOR_BUILD)
230 AC_SUBST(CFLAGS_FOR_BUILD)
231
232 # Check for doxygen
233 AC_PATH_PROG(DOXYGEN, doxygen)
234 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, "yes", "no")
235 AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
236
237 #
238 # Check for pkg-config and set PKG_CONFIG accordingly.
239 #
240 # This is referenced via AC_REQUIRE([PKG_PROG_PKG_CONFIG] in some macros
241 # like PKG_CHECK_MODULES. If the first call to such a macro is under an
242 # "if" statement, it's safer to call PKG_PROG_PKG_CONFIG directly, see
243 # the comments in acolocal.m4
244 #
245 PKG_PROG_PKG_CONFIG
246 if test -z "$PKG_CONFIG"; then
247         AC_MSG_ERROR(I couldn't find pkg-config; make sure it's installed and in your path)
248 fi
249
250 AC_ARG_ENABLE(osx-deploy-target,
251   AC_HELP_STRING( [--enable-osx-deploy-target],
252     [choose an OS X deployment target @<:@default=major release on which you're building@:>@]),
253 [
254         #
255         # Is this OS X?
256         #
257         case "$host_os" in
258         darwin*)
259                 #
260                 # Yes.
261                 #
262                 # Let the user specify an OS X release to use as a
263                 # deplayment target; if they specify that we should
264                 # have a deployment target but don't specify the
265                 # deployment target, then, if we have SDKs available,
266                 # pick the OS version on which the build is being done.
267                 # This also causes the build to be done against an SDK
268                 # rather than against the headers and libraries in
269                 # /usr/include and /usr/lib.
270                 #
271                 # Check for an OS X deployment target early, so that
272                 # as many tests using the compiler are done using the
273                 # flags that we'll be using when building.
274                 #
275                 if test $enableval = no
276                 then
277                         #
278                         # The user explicitly said
279                         # --disable-osx-deploy-target, so don't build
280                         # against an SDK.
281                         #
282                         deploy_target=
283                 elif test $enableval = yes
284                 then
285                         #
286                         # The user said --enable-osx-deploy-target, but
287                         # didn't say what version to target; target the
288                         # major version number of the version of OS X on
289                         # which we're running.
290                         #
291                         # (We quote the command so that we can use
292                         # autoconf's M4 quoting characters, [ and ], in
293                         # the sed expression.)
294                         #
295                         [deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`]
296                 else
297                         deploy_target="$enableval"
298                 fi
299                 ;;
300
301         *)
302                 #
303                 # No.  Fail, because whatever the user intended for us to
304                 # do, we can't do it.
305                 #
306                 AC_MSG_ERROR([--enable-osx-deploy-target specified on an OS other than OS X])
307                 ;;
308         esac
309 ],[
310         #
311         # Is this OS X?
312         #
313         case "$host_os" in
314         darwin*)
315                 #
316                 # Yes.
317                 #
318                 # If we have SDKs available, default to targeting the major
319                 # version number of the version of OS X on which we're
320                 # running.
321                 #
322                 # (We quote the command so that we can use autoconf's
323                 # M4 quoting characters, [ and ], in the sed expression.)
324                 #
325                 for i in /Developer/SDKs \
326                     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
327                     /Library/Developer/CommandLineTools/SDKs
328                 do
329                         if test -d "$i"
330                         then
331                                 [deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`]
332                                 break
333                         fi
334                 done
335                 ;;
336
337         *)
338                 #
339                 # No.  There's nothing to do.
340                 #
341                 ;;
342         esac
343 ])
344
345 if test ! -z "$deploy_target"
346 then
347         AC_MSG_CHECKING([whether we can build for OS X $deploy_target])
348         case $deploy_target in
349
350         10.0|10.1|10.2)
351                 #
352                 # I'm not sure this would even work.
353                 #
354                 AC_MSG_RESULT(no)
355                 AC_ERROR([We don't support building for OS X $deploy_target])
356                 ;;
357
358         10.3)
359                 #
360                 # XXX - never tested.
361                 #
362                 AC_MSG_RESULT(yes)
363                 SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk"
364                 ;;
365
366         *)
367                 #
368                 # Look for the oldest SDK we can find that's
369                 # for an OS equal to or later than this one.
370                 #
371                 # XXX - for 10.4, do we need 10.4u?  We're
372                 # not currently doing fat builds (we'd need
373                 # fat versions of the support libraries for
374                 # that to be useful), but, if we do, we'd
375                 # need to use 10.4u.
376                 #
377
378                 #
379                 # Get the real version - strip off the "10.".
380                 # We'll worry about that if, as, and when there's ever
381                 # an OS XI.
382                 #
383                 deploy_real_version=`echo "$deploy_target" | sed -n 's/10\.\(.*\)/\1/p'`
384
385                 #
386                 # Search each directory that might contain SDKs.
387                 #
388                 sdkpath=""
389                 for sdksdir in /Developer/SDKs \
390                     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
391                     /Library/Developer/CommandLineTools/SDKs
392                 do
393                         #
394                         # Get a list of all the SDKs.
395                         #
396                         if ! test -d "$sdksdir"
397                         then
398                                 #
399                                 # There is no directory with that name.
400                                 # Move on to the next one in the list,
401                                 # if any.
402                                 #
403                                 continue
404                         fi
405
406                         #
407                         # Get a list of all the SDKs in that directory,
408                         # if any.
409                         #
410                         # We have to use @<:@ for [ and @:>@ for ] to
411                         # avoid m4 removing the square brackets.
412                         #
413                         sdklist=`(cd "$sdksdir"; ls -d MacOSX10.@<:@0-9@:>@*.sdk 2>/dev/null)`
414
415                         for sdk in $sdklist
416                         do
417                                 #
418                                 # Get the real version for this SDK.
419                                 #
420                                 sdk_real_version=`echo "$sdk" | sed -n 's/MacOSX10\.\(.*\)\.sdk/\1/p'`
421
422                                 #
423                                 # Is it for the deployment target or
424                                 # some later release?
425                                 #
426                                 if test "$sdk_real_version" -ge "$deploy_real_version"
427                                 then
428                                         #
429                                         # Yes, use it.
430                                         #
431                                         sdkpath="$sdksdir/$sdk"
432                                         break 2
433                                 fi
434                         done
435                 done
436                 if test -z "$sdkpath"
437                 then
438                         AC_MSG_RESULT(no)
439                         AC_MSG_ERROR([We couldn't find an SDK for OS X $deploy_target or later])
440                 fi
441                 SDKPATH="$sdkpath"
442                 AC_MSG_RESULT([yes, with the 10.$sdk_real_version SDK])
443                 ;;
444         esac
445
446         #
447         # Add a -mmacosx-version-min flag to force tests that
448         # use the compiler, as well as the build itself, not to,
449         # for example, use compiler or linker features not supported
450         # by the minimum targeted version of the OS.
451         #
452         # Add an -isysroot flag to use the SDK.
453         #
454         CFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CFLAGS"
455         CXXFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CXXFLAGS"
456         LDFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $LDFLAGS"
457
458         #
459         # Add a -sdkroot flag to use with osx-app.sh.
460         #
461         OSX_APP_FLAGS="-sdkroot $SDKPATH"
462
463         #
464         # XXX - do we need this to build the Wireshark wrapper?
465         # XXX - is this still necessary with the -mmacosx-version-min
466         # flag being set?
467         #
468         OSX_DEPLOY_TARGET="MACOSX_DEPLOYMENT_TARGET=$deploy_target"
469
470         #
471         # In the installer package XML file, give the deployment target
472         # as the minimum version.
473         #
474         OSX_MIN_VERSION="$deploy_target"
475
476         case $deploy_target in
477
478         10.4|10.5)
479                 #
480                 # Only 32-bit builds are supported.  10.5
481                 # (and 10.4?) had a bug that causes some BPF
482                 # functions not to work with 64-bit userland
483                 # code, so capturing won't work.
484                 #
485                 CFLAGS="-m32 $CFLAGS"
486                 CXXFLAGS="-m32 $CXXFLAGS"
487                 LDFLAGS="-m32 $LDFLAGS"
488                 ;;
489         esac
490 else
491         #
492         # Is this OS X?
493         #
494         case "$host_os" in
495         darwin*)
496                 #
497                 # Yes.
498                 #
499                 # In the installer package XML file, give the current OS
500                 # version, minor version and all, as the minimum version.
501                 # We can't guarantee that the resulting binary will work
502                 # on older OS versions, not even older minor versions
503                 # (original release or earlier software updates).
504                 #
505                 OSX_MIN_VERSION=`sw_vers -productVersion`
506                 ;;
507         esac
508 fi
509 AC_SUBST(OSX_MIN_VERSION)
510
511 #
512 # Try to arrange for large file support.
513 #
514 AC_SYS_LARGEFILE
515
516 #
517 # Look for math functions; use libm if necessary.
518 #
519 AC_SEARCH_LIBS(floor, m)
520 AC_SEARCH_LIBS(ceil, m)
521 AC_SEARCH_LIBS(exp, m)
522 AC_SEARCH_LIBS(log, m)
523 AC_SEARCH_LIBS(log10, m)
524 AC_SEARCH_LIBS(floorl, m,
525   [
526     FLOORL_LO=""
527     AC_DEFINE(HAVE_FLOORL, 1, [Define if you have the floorl function.])
528   ],
529   FLOORL_LO="floorl.lo")
530 AC_SUBST(FLOORL_LO)
531
532
533 #
534 # GUI toolkit options
535 #
536 AC_ARG_WITH([qt],
537   AC_HELP_STRING( [--with-qt=@<:@yes/no@:>@],
538                   [use Qt @<:@default=yes@:>@]),
539   with_qt="$withval", with_qt="unspecified")
540
541 AC_ARG_WITH([gtk2],
542   AC_HELP_STRING( [--with-gtk2=@<:@yes/no@:>@],
543                   [use GTK+ 2.0 @<:@default=no@:>@]),
544   with_gtk2="$withval", with_gtk2="unspecified")
545
546 AC_ARG_WITH([gtk3],
547   AC_HELP_STRING( [--with-gtk3=@<:@yes/no@:>@],
548                   [use GTK+ 3.0 instead of 2.0 @<:@default=yes@:>@]),
549   with_gtk3="$withval", with_gtk3="unspecified")
550
551 # GnuTLS
552 # Version 3.0 switched from LGPLv2.1+ to LGPLv3+, then switched back to
553 # LGPLv2.1+ in version 3.1.10.
554 # GnuTLS depends on GMP which switched from LGPLv2.1+ to LGPLv3+ in
555 # version 4.2.2, the switched to LGPLv3+ / GPLv2+ in version 6.0.0.
556
557 tls_message="no"
558 want_gnutls="if_available"
559 AC_ARG_WITH([gnutls],
560   AC_HELP_STRING( [--with-gnutls=@<:@yes/no@:>@],
561                   [use GnuTLS library @<:@default=yes, if available@:>@]),
562   [ with_gnutls="$withval"; want_gnutls="yes" ], with_gnutls="yes")
563
564 if test "x$with_gnutls" = "xyes"; then
565   have_license_compatible_gnutls="no"
566   PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.1.10 ],
567     [ have_license_compatible_gnutls="yes" ], [ echo "GnuTLS >= 3.1.10 not found " ]
568   )
569
570   if test "x$have_license_compatible_gnutls" != "xyes"; then
571     PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0 gnutls < 3],
572       [ have_license_compatible_gnutls="yes" ] , [ echo "GnuTLS >= 1.2.0, < 3.0 not found " ]
573     )
574   fi
575
576   if test "x$have_license_compatible_gnutls" = "xyes"; then
577     echo "GnuTLS found, enabling SSL decryption"
578     AC_DEFINE(HAVE_LIBGNUTLS, 1, [Define to use GnuTLS library])
579     tls_message="yes"
580   else
581     echo "GnuTLS with compatible license not found, disabling SSL decryption"
582     tls_message="no"
583
584     # Error out if the user explicitly requested gnutls
585     if test "x$want_gnutls" = "xyes"; then
586         AC_MSG_ERROR([GnuTLS crypto library was requested, but is not available])
587     fi
588   fi
589 fi
590
591 # libgrypt
592 gcrypt_message="no"
593 want_gcrypt="if_available"
594 AC_ARG_WITH([gcrypt],
595   AC_HELP_STRING( [--with-gcrypt=@<:@yes/no@:>@],
596                   [use gcrypt library @<:@default=yes, if available@:>@]),
597   [ with_gcrypt="$withval"; want_gcrypt="yes" ], with_gcrypt="yes")
598
599 if test "x$with_gcrypt" = "xyes"; then
600   AM_PATH_LIBGCRYPT(1.1.92,
601         [
602                 echo "libgcrypt found, enabling ipsec decryption"
603                 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt])
604                 gcrypt_message="yes"
605         ]
606         , [
607                 if test x$libgcrypt_config_prefix != x ; then
608                         AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]])
609                 else
610                         echo "libgcrypt not found, disabling ipsec decryption"
611                         gcrypt_message="no"
612                 fi
613
614                 # Error out if the user explicitly requested gcrypt
615                 if test "x$want_gcrypt" = "xyes"; then
616                     AC_MSG_ERROR([libgcrypt library was requested, but is not available])
617                 fi
618         ]
619   )
620 fi
621
622 AC_ARG_WITH(libnl,
623   AC_HELP_STRING([--with-libnl@<:@=VERSION@:>@],
624                  [use libnl (force version VERSION, if supplied) @<:@default: yes, if available@:>@]),
625 [
626         if test "x$withval" = "xno"
627         then
628                 want_libnl=no
629         elif test "x$withval" = "xyes"
630         then
631                 want_libnl=yes
632                 libnl_version=any
633         elif test "x$withval" = "x1"
634         then
635                 want_libnl=yes
636                 libnl_version=1
637         elif test "x$withval" = "x2"
638         then
639                 want_libnl=yes
640                 libnl_version=2
641         elif test "x$withval" = "x3"
642         then
643                 want_libnl=yes
644                 libnl_version=3
645         else
646                 AC_MSG_ERROR(["$withval" is not a valid argument to --with-libnl])
647         fi
648 ],[
649         #
650         # Use libnl if it's present, otherwise don't.
651         #
652         want_libnl=ifavailable
653         libnl_version=any
654 ])
655 #
656 # Libnl is Linux-specific.
657 #
658 libnl_message="no"
659 case "$host_os" in
660 linux*)
661         AC_MSG_CHECKING(whether to use libnl for various network interface purposes)
662
663         if test x$want_libnl = "xno"; then
664                 AC_MSG_RESULT(no)
665         else
666                 AC_MSG_RESULT(yes)
667                 #
668                 # Test for specific libnl versions only if no version
669                 # was specified by the user or if the version in question
670                 # was requested by the user.
671                 #
672                 if test x$libnl_version = "xany" -o x$libnl_version = "x3"; then
673                         PKG_CHECK_MODULES(LIBNL3, [libnl-route-3.0 >= 3.0 libnl-genl-3.0] >= 3.0, [have_libnl3=yes], [have_libnl3=no])
674                 fi
675                 if test x$libnl_version = "xany" -o x$libnl_version = "x2"; then
676                         PKG_CHECK_MODULES(LIBNL2, libnl-2.0 >= 2.0, [have_libnl2=yes], [have_libnl2=no])
677                 fi
678                 if test x$libnl_version = "xany" -o x$libnl_version = "x1"; then
679                         PKG_CHECK_MODULES(LIBNL1, libnl-1 >= 1.0, [have_libnl1=yes], [have_libnl1=no])
680                 fi
681                 if (test "${have_libnl3}" = "yes"); then
682                         CFLAGS="$CFLAGS $LIBNL3_CFLAGS"
683                         LIBS="$LIBS $LIBNL3_LIBS"
684                         AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
685                         AC_DEFINE(HAVE_LIBNL3, 1, [libnl version 3])
686                         libnl_message="yes (v3)"
687                         enable_airpcap=no
688                 elif (test "${have_libnl2}" = "yes"); then
689                         CFLAGS="$CFLAGS $LIBNL2_CFLAGS"
690                         LIBS="$LIBS $LIBNL2_LIBS"
691                         AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
692                         AC_DEFINE(HAVE_LIBNL2, 1, [libnl version 2])
693                         libnl_message="yes (v2)"
694                         enable_airpcap=no
695                 elif (test "${have_libnl1}" = "yes"); then
696                         CFLAGS="$CFLAGS $LIBNL1_CFLAGS"
697                         LIBS="$LIBS $LIBNL1_LIBS"
698                         AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
699                         AC_DEFINE(HAVE_LIBNL1, 1, [libnl version 1])
700                         libnl_message="yes (v1)"
701                         enable_airpcap=no
702                 else
703                         if test x$want_libnl = "xyes"; then
704                                 case "$libnl_version" in
705
706                                 any)
707                                         AC_MSG_ERROR("I couldn't find libnl even though you manually enabled it.")
708                                         ;;
709
710                                 *)
711                                         AC_MSG_ERROR("I couldn't find libnl version $libnl_version even though you manually enabled it.")
712                                         ;;
713                                 esac
714                         fi
715                 fi
716         fi
717
718         AC_MSG_CHECKING([if nl80211.h is new enough])
719           AC_TRY_COMPILE([#include <linux/nl80211.h>],
720             [int x = NL80211_FREQUENCY_ATTR_MAX_TX_POWER;
721                 x = NL80211_ATTR_SUPPORTED_IFTYPES;
722                 x = NL80211_ATTR_SUPPORTED_COMMANDS;
723                 x = NL80211_ATTR_WIPHY_FREQ;
724                 x = NL80211_CHAN_NO_HT;],
725             [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211, 1, [nl80211.h is new enough])],
726             [AC_MSG_RESULT(no)])
727
728         AC_MSG_CHECKING([for NL80211_SET_CHANNEL])
729           AC_TRY_COMPILE([#include <linux/nl80211.h>],
730             [enum nl80211_commands x = NL80211_CMD_SET_CHANNEL;],
731             [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_CMD_SET_CHANNEL, 1, [SET_CHANNEL is supported])],
732             [AC_MSG_RESULT(no)])
733
734         AC_MSG_CHECKING([for NL80211_SPLIT_WIPHY_DUMP])
735           AC_TRY_COMPILE([#include <linux/nl80211.h>],
736             [enum nl80211_protocol_features x = NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP;],
737             [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_SPLIT_WIPHY_DUMP, 1, [SPLIT_WIPHY_DUMP is supported])],
738             [AC_MSG_RESULT(no)])
739         ;;
740
741 *)
742         if test x$want_libnl != "xno" -a x$want_libnl != "xifavailable"; then
743                 AC_MSG_WARN([libnl is Linux-specific, ignoring --with-libnl])
744         fi
745 esac
746
747 # libsmi
748 # FIXME: currently the path argument to with-libsmi is being ignored
749 AX_LIBSMI
750
751 #
752 # Check for programs used when building DocBook documentation.
753 #
754
755 # Check for a2x (convert asciidoc to another format)
756 AC_PATH_PROG(A2X, a2x)
757 AC_CHECK_PROG(HAVE_A2X, a2x, "yes", "no")
758 AM_CONDITIONAL(HAVE_A2X, test x$HAVE_A2X = xyes)
759
760 # Want to control a tape drive? Use mt. Want to convert HTML to text?
761 # Uhhhhh... elinks? lynx? w3m? pandoc? html2text?
762 AC_PATH_PROG(ELINKS, elinks)
763 AC_CHECK_PROG(HAVE_ELINKS, elinks, "yes", "no")
764 AM_CONDITIONAL(HAVE_ELINKS, test x$HAVE_ELINKS = xyes)
765
766 # Check for fop (translate .fo to e.g. pdf)
767 AC_PATH_PROG(FOP, fop)
768 AC_CHECK_PROG(HAVE_FOP, fop, "yes", "no")
769 AM_CONDITIONAL(HAVE_FOP, test x$HAVE_FOP = xyes)
770
771 # Check for lynx (html -> text)
772 AC_PATH_PROG(LYNX, lynx)
773 AC_CHECK_PROG(HAVE_LYNX, lynx, "yes", "no")
774 AM_CONDITIONAL(HAVE_LYNX, test x$HAVE_LYNX = xyes)
775
776 # Check for w3m (html -> text)
777 AC_PATH_PROG(W3M, w3m)
778 AC_CHECK_PROG(HAVE_W3M, w3m, "yes", "no")
779 AM_CONDITIONAL(HAVE_W3M, test x$HAVE_W3M = xyes)
780
781 # Check for xmllint
782 AC_PATH_PROG(XMLLINT, xmllint)
783 AC_CHECK_PROG(HAVE_XMLLINT, xmllint, "yes", "no")
784 AM_CONDITIONAL(HAVE_XMLLINT, test x$HAVE_XMLLINT = xyes)
785
786 # Check for xsltproc
787 AC_PATH_PROG(XSLTPROC, xsltproc)
788 AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, "yes", "no")
789 AM_CONDITIONAL(HAVE_XSLTPROC, test x$HAVE_XSLTPROC = xyes)
790
791
792 # Check for packaging utilities
793 # For now, we check to see if the various packaging utilites are in our
794 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
795
796 #
797 # Source packages.
798 # (Lets you install the desktop files.)
799 #
800 AC_PATH_PROG(DESKTOP_FILE_INSTALL, desktop-file-install)
801
802 # SVR4/Solaris
803 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
804 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
805 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
806
807 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
808      -a x$HAVE_PKGTRANS = xyes ; then
809   HAVE_SVR4_PACKAGING=yes
810 else
811   HAVE_SVR4_PACKAGING=no
812 fi
813 AC_SUBST(HAVE_SVR4_PACKAGING)
814
815 # RPM
816 AC_WIRESHARK_RPM_CHECK
817 AC_SUBST(HAVE_RPM)
818
819 # Debian
820 AC_CHECK_PROG(HAVE_DPKG_BUILDPACKAGE, dpkg-buildpackage, "yes", "no")
821
822 # Mac OS X
823 AC_CHECK_PROG(HAVE_XCODEBUILD, xcodebuild, "yes", "no")
824 AC_CHECK_PROG(HAVE_HDIUTIL, hdiutil, "yes", "no")
825 AC_CHECK_PROG(HAVE_BLESS, bless, "yes", "no")
826
827 if test x$HAVE_XCODEBUILD = xyes -a x$HAVE_HDIUTIL = xyes \
828      -a x$HAVE_BLESS = xyes ; then
829   HAVE_OSX_PACKAGING=yes
830 else
831   HAVE_OSX_PACKAGING=no
832 fi
833 AC_SUBST(HAVE_OSX_PACKAGING)
834
835 #
836 # Use this as a proxy for "is this OS X" (just in case somebody actually
837 # built and installed Darwin as an OS, perhaps with some X11-based GUI,
838 # don't look for Darwin).
839 #
840 AC_CHECK_PROG(have_sw_vers, sw_vers, "yes", "no")
841 AM_CONDITIONAL(NOT_OS_X, test "x$have_sw_vers" = "xno")
842
843 #
844 # Some compilers have to be told to fail when passed an unknown -W flag;
845 # make sure we do that.
846 #
847 AC_WIRESHARK_CHECK_UNKNOWN_WARNING_OPTION_ERROR
848
849 #
850 # Some C++ compilers have to be told to fail when passed a -W flag that
851 # they don't think should apply to C++; make sure we do that.
852 #
853 AC_WIRESHARK_CHECK_NON_CXX_WARNING_OPTION_ERROR
854
855 #
856 # Try to add some additional checks to CFLAGS.
857 # These are not enabled by default, because the warnings they produce
858 # are very hard or impossible to eliminate.
859 #
860 AC_ARG_ENABLE(extra-compiler-warnings,
861   AC_HELP_STRING( [--enable-extra-compiler-warnings],
862                   [do additional compiler warnings @<:@default=no@:>@]),
863 [
864         wireshark_extra_flags=$enableval
865         if test $enableval != no
866         then
867                 #
868                 # The following are for C and C++
869                 #
870                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-pedantic)
871                 #
872                 # Various code blocks this one.
873                 #
874                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Woverflow)
875                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4)
876                 #
877                 # Due to various places where APIs we don't control
878                 # require us to cast away constness, we can probably
879                 # never enable this one with -Werror.
880                 #
881                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wcast-qual)
882                 #
883                 # Some generated ASN.1 dissectors block this one;
884                 # multiple function declarations for the same
885                 # function are being generated.
886                 #
887                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wredundant-decls)
888                 #
889                 # Some loops are safe, but it's hard to convince the
890                 # compiler of that.
891                 #
892                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunsafe-loop-optimizations)
893                 #
894                 # All the registration functions block these for now.
895                 #
896                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wmissing-prototypes)
897                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wmissing-declarations)
898                 #
899                 # A bunch of "that might not work on SPARC" code blocks
900                 # this one for now.
901                 #
902                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wcast-align)
903                 #
904                 # Works only with Clang
905                 #
906                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunreachable-code)
907                 #
908                 # Works only with Clang but generates a lot of warnings
909                 # (about glib library not using Doxygen)
910                 #
911                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdocumentation)
912
913                 #
914                 # The following are C only, not C++
915                 #
916                 # Due to various places where APIs we don't control
917                 # require us to cast away constness, we can probably
918                 # never enable this one with -Werror.
919                 #
920                 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wbad-function-cast, C)
921         fi
922 ],)
923
924 #
925 # The following are for C and C++
926 #
927 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wall -W) # -W is now known as -Wextra
928 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wextra) # -W is now known as -Wextra
929 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wendif-labels)
930 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpointer-arith)
931 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Warray-bounds)
932 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wformat-security)
933 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fwrapv)
934 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-strict-overflow)
935 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-delete-null-pointer-checks)
936 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wvla)
937 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Waddress)
938 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wattributes)
939 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdiv-by-zero)
940 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wignored-qualifiers)
941 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpragmas)
942 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-overlength-strings)
943 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wwrite-strings)
944 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-long-long)
945 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wheader-guard)
946 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunused-const-variable)
947 #
948 # The following are C only, not C++
949 #
950 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wc++-compat, C)
951 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdeclaration-after-statement, C)
952
953 #
954 # XXX - OK for C++?
955 #
956 # Make sure -Wshadow doesn't complain about variables in function and
957 # function pointer declarations shadowing other variables; if not, don't
958 # turn it on, as some versions of GCC (including the one in at least
959 # some Xcode versions that came with Mac OS X 10.5) complain about
960 # that.
961 #
962 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshadow, C,
963   [
964 extern int bar(int a);
965 extern int foo(int);
966
967 int
968 foo(int a)
969 {
970         int (*fptr)(int a) = bar;
971
972         return fptr(a) * 2;
973 }
974   ],
975   [warns about variables in function declarations shadowing other variables])
976
977 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-pointer-sign, C)
978 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wold-style-definition, C)
979 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wstrict-prototypes, C)
980
981 # Unfortunately some versions of gcc generate logical-op warnings when strchr()
982 # is given a constant string.
983 # gcc versions 4.3.2 and 4.4.5 are known to have the problem.
984 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wlogical-op, C,
985   [
986 #include <string.h>
987
988 int foo(const char *, int);
989 int bar(void);
990
991 int
992 foo(const char *sep, int c)
993 {
994         if (strchr (sep, c) != NULL)
995                 return 1;
996         else
997                 return 0;
998 }
999
1000 int
1001 bar(void)
1002 {
1003         return foo("<", 'a');
1004 }
1005   ],
1006   [generates warnings from strchr()])
1007
1008 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wjump-misses-init, C)
1009 # The Qt headers generate a ton of shortening errors on 64-bit systems
1010 # so only enable this for C for now.
1011 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshorten-64-to-32, C)
1012
1013 #
1014 # Use the faster pre gcc 4.5 floating point precision if available.
1015 #
1016 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fexcess-precision=fast)
1017
1018 #
1019 # Try to have the compiler default to hiding symbols, so that only
1020 # symbols explicitly exported with WS_DLL_PUBLIC will be visible
1021 # outside (shared) libraries; that way, more UN*X builds will catch
1022 # failures to export symbols, rather than having that fail only on
1023 # Windows.
1024 #
1025 CFLAGS_before_fvhidden="$CFLAGS"
1026 #
1027 # GCC and GCC-compatible compilers
1028 #
1029 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fvisibility=hidden)
1030 if test "x$CFLAGS" = "x$CFLAGS_before_fvhidden"
1031 then
1032         #
1033         # Sun^WOracle C.
1034         #
1035         AC_WIRESHARK_COMPILER_FLAGS_CHECK(-xldscope=hidden)
1036         if test "x$CFLAGS" = "x$CFLAGS_before_fvhidden"
1037         then
1038                 # TODO add other ways of hiding symbols
1039                 AC_MSG_WARN(Compiler will export all symbols from shared libraries)
1040         fi
1041 fi
1042
1043 AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--as-needed])
1044 ###AC_WIRESHARK_LDFLAGS_CHECK([-Wl,-M])
1045 ###AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--cref])
1046 # AC_WIRESHARK_LDFLAGS_CHECK([-flto])
1047 # AC_WIRESHARK_LDFLAGS_CHECK([-fwhopr])
1048 # AC_WIRESHARK_LDFLAGS_CHECK([-fwhole-program])
1049
1050 #
1051 # Put -fPIE in PIE_CFLAGS and -pie in PIE_LDFLAGS if we can use them,
1052 # so that we can build dumpcap PIE - it may run with elevated
1053 # privileges, and using PIE means the OS can run it at random locations
1054 # in the address space to make attacks more difficult.
1055 #
1056 CFLAGS_before_pie="$CFLAGS"
1057 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fPIE)
1058 if test "x$CFLAGS" != "x$CFLAGS_before_pie"
1059 then
1060         # Restore CFLAGS
1061         CFLAGS="$CFLAGS_before_pie"
1062
1063         LDFLAGS_before_pie="$LDFLAGS"
1064         AC_WIRESHARK_LDFLAGS_CHECK([-fPIE -pie])
1065         if test "x$LDFLAGS" != "x$LDFLAGS_before_pie"
1066         then
1067                 # We can use PIE
1068                 PIE_CFLAGS="-fPIE"
1069                 PIE_LDFLAGS="-pie"
1070
1071                 # Restore LDFLAGS
1072                 LDFLAGS="$LDFLAGS_before_pie"
1073         fi
1074
1075 fi
1076 AC_SUBST(PIE_CFLAGS)
1077 AC_SUBST(PIE_LDFLAGS)
1078
1079 CFLAGS_before_simd="$CFLAGS"
1080 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-msse4.2, C)
1081 if test "x$CFLAGS" != "x$CFLAGS_before_simd"
1082 then
1083         AC_MSG_CHECKING([whether there is nmmintrin.h header])
1084
1085         AC_TRY_COMPILE(
1086                 [#include <nmmintrin.h>],
1087                 [return 0;],
1088                 [
1089                         have_sse42=yes
1090                         AC_DEFINE(HAVE_SSE4_2, 1, [Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions])
1091                         CFLAGS_SSE42="-msse4.2"
1092                         AC_MSG_RESULT([yes])
1093                 ],
1094                 [
1095                         have_sse42=no
1096                         AC_MSG_RESULT([no])
1097                 ]
1098         )
1099
1100         # Restore CFLAGS
1101         CFLAGS="$CFLAGS_before_simd"
1102 else
1103         have_sse42=no
1104 fi
1105 dnl build libwsutil_sse42 only if there is SSE4.2
1106 AM_CONDITIONAL(SSE42_SUPPORTED, test "x$have_sse42" = "xyes")
1107 AC_SUBST(CFLAGS_SSE42)
1108
1109 #
1110 # If we're running GCC or clang define _U_ to be "__attribute__((unused))"
1111 # so we can use _U_ to flag unused function parameters and not get warnings
1112 # about them. Otherwise, define _U_ to be an empty string so that _U_ used
1113 # to flag an unused function parameters will compile with other compilers.
1114 #
1115 # XXX - similar hints for other compilers?
1116 #
1117 if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
1118   AC_DEFINE(_U_, __attribute__((unused)), [Hint to the compiler that a function parameters is not used])
1119 else
1120   AC_DEFINE(_U_, , [Hint to the compiler that a function parameters is not used])
1121 fi
1122
1123 # If we're running GCC or CLang, use FORTIFY_SOURCE=2
1124 #  (only if the GCC 'optimization level' > 0).
1125 #
1126 # See: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
1127 # See: http://sourceware.org/bugzilla/show_bug.cgi?id=13979
1128 #
1129 # Note: FORTIFY_SOURCE is only effective for gcc optimization level > 0 (-O1, etc)
1130 AC_WIRESHARK_GCC_FORTIFY_SOURCE_CHECK
1131
1132 #
1133 # If the compiler supports GCC-style flags, enable a barrier "stop on
1134 # warning".
1135 # This barrier is set for a very large part of the code. However, it is
1136 # typically not set for "generated" code  (flex, ans2wrs, idl2wrs, ...)
1137 #
1138 warnings_as_errors_default="yes"
1139 AC_MSG_CHECKING(whether we should treat compiler warnings as errors)
1140 AC_ARG_ENABLE(warnings-as-errors,
1141   AC_HELP_STRING( [--enable-warnings-as-errors],
1142                   [treat warnings as errors (only for GCC or clang) @<:@default=yes, unless extra compiler warnings are enabled@:>@]),
1143 [
1144   if test "x$ac_supports_gcc_flags" = "xyes" -a "x$enableval" = "xyes"; then
1145     with_warnings_as_errors="yes"
1146     AC_MSG_RESULT(yes)
1147   else
1148     with_warnings_as_errors="no"
1149     AC_MSG_RESULT(no)
1150   fi
1151 ],
1152 [
1153   if test "x$ac_supports_gcc_flags" = "xyes" -a "x$wireshark_extra_flags" = "x" -a "x$warnings_as_errors_default" = "xyes"; then
1154     with_warnings_as_errors="yes"
1155     AC_MSG_RESULT(yes)
1156   else
1157     with_warnings_as_errors="no"
1158     AC_MSG_RESULT(no)
1159   fi
1160 ]
1161 )
1162 AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$with_warnings_as_errors" = "xyes")
1163
1164 #
1165 # Add any platform-specific compiler flags needed.
1166 #
1167 AC_MSG_CHECKING(for platform-specific compiler flags)
1168 if test "x$GCC" = "xyes" ; then
1169         #
1170         # GCC - do any platform-specific tweaking necessary.
1171         #
1172         case "$host_os" in
1173         solaris*)
1174                 # the X11 headers don't automatically include prototype info
1175                 # and a lot don't include the return type
1176                 CPPFLAGS="$CPPFLAGS -DFUNCPROTO=15"
1177                 CFLAGS="$CFLAGS -Wno-return-type"
1178                 CXXFLAGS="$CXXFLAGS -Wno-return-type"
1179                 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
1180                 ;;
1181         *)
1182                 AC_MSG_RESULT(none needed)
1183                 ;;
1184         esac
1185 else
1186         #
1187         # Not GCC - assume it's the vendor's compiler.
1188         #
1189         case "$host_os" in
1190         hpux*)
1191                 #
1192                 # HP's ANSI C compiler; flags suggested by Jost Martin.
1193                 # "-Ae" for ANSI C plus extensions such as "long long".
1194                 # "+O2", for optimization.  XXX - works with "-g"?
1195                 #
1196                 # HP's ANSI C++ compiler doesn't support "-Ae", but
1197                 # does support "+O2", at least according to the
1198                 # documentation I can find online.
1199                 #
1200                 CFLAGS="-Ae +O2 $CFLAGS"
1201                 CFLAGS_FOR_BUILD="-Ae +O2 $CFLAGS"
1202                 CXXFLAGS="+O2 $CFLAGS"
1203                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
1204                 ;;
1205         *)
1206                 AC_MSG_RESULT(none needed)
1207                 ;;
1208         esac
1209 fi
1210
1211 #
1212 # Add any platform-specific linker flags needed.
1213 #
1214 AC_MSG_CHECKING(for platform-specific linker flags)
1215 case "$host_os" in
1216 darwin*)
1217         #
1218         # Add -Wl,-single_module to the LDFLAGS used with shared
1219         # libraries, to fix some error that show up in some cases;
1220         # some Apple documentation recommends it for most shared
1221         # libraries.
1222         #
1223         LDFLAGS_SHAREDLIB="-Wl,-single_module"
1224         #
1225         # Add -Wl,-headerpad_max_install_names to the LDFLAGS, as
1226         # code-signing issues is running out of padding space.
1227         #
1228         # Add -Wl,-search_paths_first to make sure that if we search
1229         # directories A and B, in that order, for a given library, a
1230         # non-shared version in directory A, rather than a shared
1231         # version in directory B, is chosen (so we can use
1232         # --with-pcap=/usr/local to force all programs to be linked
1233         # with a static version installed in /usr/local/lib rather than
1234         # the system version in /usr/lib).
1235         #
1236         # Also add -Wl,-rpath,@executable_path/../lib and
1237         # -Wl,-rpath,/usr/local/lib, so that, if we build an app
1238         # bundle, we can tweak all the executable images, shared
1239         # libraries, and plugins in the bundle to look for non-system
1240         # libraries in the rpath, rather than having a script tweak
1241         # DYLD_LIBRARY_PATH.
1242         #
1243         LDFLAGS="-Wl,-headerpad_max_install_names -Wl,-search_paths_first -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/usr/local/lib $LDFLAGS"
1244         AC_MSG_RESULT([Apple linker - added -Wl,-single_module to shared library linker flags and -Wl,-headerpad_max_install_names -Wl,-search_paths_first and rpaths to all linker flags])
1245         ;;
1246 cygwin*)
1247         #
1248         # Shared libraries in cygwin/Win32 must never contain
1249         # undefined symbols.
1250         #
1251         LDFLAGS="$LDFLAGS -no-undefined"
1252         AC_MSG_RESULT(CygWin GNU ld - added -no-undefined)
1253         ;;
1254 *)
1255         AC_MSG_RESULT(none needed)
1256         ;;
1257 esac
1258 AC_SUBST(LDFLAGS_SHAREDLIB)
1259
1260 # Enable silent builds by default
1261 # Verbose builds can be enabled with "./configure
1262 # --enable-silent-rules ..." or "make V=1 ..."
1263 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
1264   [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
1265
1266 #
1267 # On "Darwin", which we assume to mean "OS X" rather than "iOS" or
1268 # "just Darwin" (as we don't currently support iOS, and as I don't
1269 # think you can build and run "just Darwin" as an OS for PCs), we
1270 # arrange to build some programs with Application Services so they
1271 # can launch Web browsers and Finder windows, arrange to build some
1272 # programs with System Configuration so they can get "friendly names"
1273 # and other information about interfaces, and build any programs that
1274 # use either of those frameworks or that report version information
1275 # with Core Foundation as the frameworks in question use it and as we
1276 # get version information from plists and thus need Core Foundation
1277 # to process those plists.
1278 #
1279 case "$host_os" in
1280
1281 darwin*)
1282         AC_DEFINE(HAVE_OS_X_FRAMEWORKS, 1, [Define to 1 if you have OS X frameworks])
1283         APPLICATIONSERVICES_FRAMEWORKS="-framework ApplicationServices"
1284         SYSTEMCONFIGURATION_FRAMEWORKS="-framework SystemConfiguration"
1285         COREFOUNDATION_FRAMEWORKS="-framework CoreFoundation"
1286
1287         #
1288         # OK, so we have the OS X frameworks; do they include
1289         # CFPropertyListCreateWithStream, or do we have
1290         # to fall back on CFPropertyListCreateFromStream?
1291         # (They only differ in the error return, which we
1292         # don't care about.  And, no, we shouldn't just
1293         # use CFPropertyListCreateFromStream, because it's
1294         # deprecated in newer releases.)
1295         #
1296         ac_save_LIBS="$LIBS"
1297         LIBS="$LIBS $COREFOUNDATION_FRAMEWORKS"
1298         AC_CHECK_FUNCS(CFPropertyListCreateWithStream)
1299         LIBS="$ac_save_LIBS"
1300         ;;
1301 esac
1302 AC_SUBST(APPLICATIONSERVICES_FRAMEWORKS)
1303 AC_SUBST(SYSTEMCONFIGURATION_FRAMEWORKS)
1304 AC_SUBST(COREFOUNDATION_FRAMEWORKS)
1305
1306 #
1307 # On Solaris, check whether we have getexecname().
1308 #
1309 case "$host_os" in
1310 solaris*)
1311         AC_CHECK_FUNC(getexecname)
1312         ;;
1313 esac
1314
1315 dnl Look in /usr/local for header files and libraries ?
1316 dnl XXX FIXME don't include /usr/local if it is already in the system
1317 dnl search path as this causes gcc 3.2 on Linux to complain about a change
1318 dnl of the system search order for includes
1319 AC_ARG_ENABLE(usr-local,
1320   AC_HELP_STRING( [--enable-usr-local],
1321                   [look for headers and libs in /usr/local tree @<:@default=yes@:>@]),
1322     ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
1323
1324 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
1325 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1326         if test -d "/usr/local"; then
1327                 AC_MSG_RESULT(yes)
1328                 #
1329                 # Arrange that we search for header files in the source directory
1330                 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
1331                 # as various packages we use ("libpcap", "zlib", "adns")
1332                 # may have been installed under "/usr/local/include".
1333                 #
1334                 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1335
1336                 #
1337                 # Arrange that we search for libraries in "/usr/local/lib".
1338                 #
1339                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, /usr/local/lib)
1340         else
1341                 AC_MSG_RESULT(no)
1342         fi
1343 else
1344         AC_MSG_RESULT(no)
1345 fi
1346
1347 #
1348 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
1349 # link directory.
1350 #
1351 case "$host_os" in
1352   solaris*)
1353     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
1354     if test x$LD_LIBRARY_PATH != x ; then
1355       LIBS="$LIBS -R$LD_LIBRARY_PATH"
1356       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
1357     else
1358       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
1359     fi
1360   ;;
1361 esac
1362
1363 #
1364 # Check for versions of "sed" inadequate to handle, in libtool, a list
1365 # of object files as large as the list in Wireshark.
1366 #
1367 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
1368 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
1369 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
1370 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
1371 # is the only "sed" that comes with Solaris that can handle Wireshark.
1372 #
1373 # Add any checks here that are necessary for other OSes.
1374 #
1375 AC_PATH_PROG(SED, sed)
1376 if test "x$SED" = x
1377 then
1378         AC_MSG_ERROR(I couldn't find sed; make sure it's installed and in your path)
1379 fi
1380 AC_WIRESHARK_GNU_SED_CHECK
1381 if test "$HAVE_GNU_SED" = no ; then
1382         case "$host_os" in
1383         solaris*)
1384                 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
1385                 case `which sed` in
1386                         /bin/sed|/usr/bin/sed|/usr/ucb/sed)
1387                         AC_MSG_RESULT(yes)
1388                         AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
1389                         ;;
1390
1391                         *)
1392                         AC_MSG_RESULT(no)
1393                         ;;
1394                 esac
1395                 ;;
1396
1397         *)
1398                 :
1399                 ;;
1400         esac
1401 fi
1402
1403 # Enable/disable wireshark
1404 AC_ARG_ENABLE(wireshark,
1405   AC_HELP_STRING( [--enable-wireshark],
1406                   [build the Wireshark GUI (with Gtk+, Qt, or both) @<:@default=yes@:>@]),
1407     enable_wireshark=$enableval,enable_wireshark=yes)
1408 AM_CONDITIONAL(BUILDING_WIRESHARK, test x$enable_wireshark = xyes)
1409
1410 AC_ARG_ENABLE(packet-editor,
1411   AC_HELP_STRING( [--enable-packet-editor],
1412                   [add support for packet editor in Wireshark @<:@default=yes@:>@]),
1413     enable_packet_editor=$enableval,enable_packet_editor=yes)
1414 if test x$enable_packet_editor = xyes; then
1415         AC_DEFINE(WANT_PACKET_EDITOR, 1, [Support for packet editor])
1416 fi
1417
1418 AC_ARG_ENABLE(profile-build,
1419   AC_HELP_STRING( [--enable-profile-build],
1420                   [build profile-ready binaries @<:@default=no@:>@]),
1421     enable_profile_build=$enableval,enable_profile_build=no)
1422 AM_CONDITIONAL(USE_PROFILE_BUILD, test x$enable_profile_build = xyes)
1423 AC_MSG_CHECKING(if profile builds must be generated)
1424 if test "x$enable_profile_build" = "xyes" ; then
1425         if test "x$GCC" = "xyes" -o "x$CLANG" = "xyes" ; then
1426                 AC_MSG_RESULT(yes)
1427                 CFLAGS=" -pg $CFLAGS"
1428                 CXXFLAGS=" -pg $CXXFLAGS"
1429         else
1430                 AC_MSG_RESULT(no)
1431                 echo "Building profile binaries currently only supported for GCC and clang."
1432         fi
1433 else
1434         AC_MSG_RESULT(no)
1435 fi
1436
1437 # Create DATAFILE_DIR #define for config.h
1438 datafiledir=$datadir/wireshark
1439 datafiledir=`(
1440     test "x$prefix" = xNONE && prefix=$ac_default_prefix
1441     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1442     # Ugly hack, but I don't see how this problem can be solved
1443     # properly that DATAFILE_DIR had a value starting with
1444     # "${prefix}/" instead of e.g. "/usr/local/"
1445     eval eval echo "$datafiledir"
1446 )`
1447 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$datafiledir", [Directory for data])
1448
1449 # Create DOC_DIR #define for config.h
1450 docdir=`(
1451     test "x$prefix" = xNONE && prefix=$ac_default_prefix
1452     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1453     # Ugly hack, but I don't see how this problem can be solved
1454     # properly that DOC_DIR had a value starting with
1455     # "${prefix}/" instead of e.g. "/usr/local/"
1456     eval eval echo "$docdir"
1457 )`
1458 AC_DEFINE_UNQUOTED(DOC_DIR, "$docdir", [Directory for docs])
1459
1460 GTK2_MIN_VERSION=2.12.0
1461 AC_SUBST(GTK2_MIN_VERSION)
1462 GTK3_MIN_VERSION=3.0.0
1463 AC_SUBST(GTK3_MIN_VERSION)
1464 QT_MIN_VERSION=4.6.0
1465 AC_SUBST(QT_MIN_VERSION)
1466 # GTK+ and Qt checks; we require GTK+ $GTK2_MIN_VERSION or later or
1467 # GTK3_MIN_VERSION or later or Qt $QT_MIN_VERSION or later.
1468 #
1469 # We only do those if we're going to be building Wireshark;
1470 # otherwise, we don't have any GUI to build, so we don't use
1471 # GTK+ or Qt.
1472 #
1473 # We don't add $GTK_LIBS or $Qt_LIBS to LIBS, because we don't want to
1474 # force all programs to be built with GTK+ or Qt.
1475 #
1476 # Release dates for GTK+ versions:
1477 # http://en.wikipedia.org/wiki/GTK+#Releases
1478 # 2.12.0: 14 Sep 2007
1479 # 2.14.0: 04 Sep 2008
1480 # 2.16.0: 13 Mar 2009
1481 # 2.18.0: 23 Sep 2009
1482 # 2.20.0: 23 Mar 2010
1483 # 2.22.0: 23 Sep 2010
1484 # 2.24.0: 30 Jan 2011
1485 # 3.0.0:  10 Feb 2011
1486 # 3.2.0:  25 Sep 2011
1487 # 3.4.0:  26 Mar 2012
1488 # 3.6.0:  24 Sep 2012
1489 # 3.8.0:  25 Mar 2013
1490 # 3.10.0: 23 Sep 2013
1491 # 3.12.0: 25 Mar 2014
1492 #
1493 # Release dates for Qt versions:
1494 # http://en.wikipedia.org/wiki/List_of_Qt_releases
1495 # 4.6.0:  01 Dec 2009
1496 # 4.7.0:  21 Sep 2010
1497 # 4.8.0:  15 Dec 2011
1498 # 5.0.0:  19 Dec 2012
1499 # 5.1.0:  03 Jul 2013
1500 # 5.2.0:  12 Dec 2013
1501 # 5.3.0:  20 May 2014
1502
1503 have_qt=no
1504 have_gtk=no
1505 if test "x$enable_wireshark" = "xyes"; then
1506         if test "x$with_gtk2" = "xunspecified" -a \
1507                 "x$with_gtk3" = "xunspecified" -a \
1508                 "x$with_qt" = "xunspecified"; then
1509                 #
1510                 # No GUI toolkit was explicitly specified; pick Qt and GTK+ 3.
1511                 #
1512                 with_qt=yes
1513                 with_gtk3=yes
1514         fi
1515         if test "x$with_qt" = "xyes"; then
1516                 #
1517                 # Qt was specified; Make sure we have a C++ compiler.
1518                 #
1519                 if test -z "$CXX"; then
1520                         AC_MSG_ERROR(Need a working C++ compiler to build Wireshark with Qt)
1521                 fi
1522
1523                 #
1524                 # Now make sure we have Qt and, if so, add the flags
1525                 # for it to CFLAGS and CXXFLAGS.
1526                 #
1527                 AC_WIRESHARK_QT_CHECK($QT_MIN_VERSION,
1528                 [
1529                         CFLAGS="$CFLAGS $Qt_CFLAGS"
1530                         CXXFLAGS="$CXXFLAGS $Qt_CFLAGS"
1531                         have_qt=yes
1532                         GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-qt"
1533                 ],
1534                 [AC_MSG_ERROR([Qt is not available])])
1535
1536                 #
1537                 # XXX - greasy hack to make ui/gtk/recent.c
1538                 # compile.
1539                 #
1540                 CPPFLAGS="-DQT_GUI_LIB"
1541         fi
1542
1543         if test "x$with_gtk3" = "xyes"; then
1544                 #
1545                 # GTK+ 3 was specified; make sure they didn't also
1546                 # specify GTK+ 2, as we don't support building both
1547                 # GTK+ 2 and GTK+ 3 versions at the same time.
1548                 #
1549                 if test "x$with_gtk2" = "xyes"; then
1550                         AC_MSG_ERROR([Both GTK+ 2 and GTK+ 3 were specified; choose one but not both])
1551                 fi
1552
1553                 #
1554                 # Make sure we have GTK+ 3.
1555                 #
1556                 AM_PATH_GTK_3_0(3.0.0,
1557                 [
1558                         CFLAGS="$CFLAGS $GTK_CFLAGS"
1559                         CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
1560                         have_gtk=yes
1561                         GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-gtk3"
1562                 ],
1563                 [AC_MSG_ERROR([GTK+ 3 is not available])])
1564         elif test "x$with_gtk2" = "xyes"; then
1565                 #
1566                 # GTK+ 3 wasn't specified, and GTK+ 2 was specified;
1567                 # make sure we have GTK+ 2.
1568                 #
1569                 AM_PATH_GTK_2_0($GTK2_MIN_VERSION,
1570                 [
1571                         CFLAGS="$CFLAGS $GTK_CFLAGS"
1572                         CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
1573                         have_gtk=yes
1574                         GUI_CONFIGURE_FLAGS="$GUI_CONFIGURE_FLAGS --with-gtk2"
1575                 ],
1576                 [AC_MSG_ERROR([GTK+ 2 is not available])])
1577         fi
1578 fi
1579 AC_SUBST(GUI_CONFIGURE_FLAGS)
1580
1581 GLIB_MIN_VERSION=2.16.0
1582 AC_SUBST(GLIB_MIN_VERSION)
1583 # GLib checks; we require GLib $GLIB_MIN_VERSION or later, and require gmodule
1584 # support, as we need that for dynamically loading plugins.
1585 # If we found GTK+, this doesn't add GLIB_CFLAGS to CFLAGS, because
1586 # AM_PATH_GTK will add GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a
1587 # superset of GLIB_CFLAGS.  If we didn't find GTK+, it does add
1588 # GLIB_CFLAGS to CFLAGS.
1589 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
1590 # set when generating the Makefile, so we can make programs that require
1591 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
1592 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
1593 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
1594 # programs to be built with GLib.
1595 #
1596 # Release dates for GLib versions:
1597 # 2.14.0: 03 Aug 2007
1598 # 2.16.0: 10 Mar 2008
1599 # 2.18.0: 02 Sep 2008
1600 # 2.20.0: 13 Mar 2009
1601 # 2.22.0: 22 Sep 2009
1602 # 2.24.0: 28 Mar 2010
1603 # 2.26.0: 27 Sep 2010
1604 # 2.28.0: 08 Feb 2011
1605 # 2.30.0: 27 Sep 2011
1606 # 2.32.0: 24 Mar 2012
1607 # 2.34.0: 24 Sep 2012
1608 # 2.36.0: 25 Mar 2013
1609 # 2.38.0: 23 Sep 2013
1610 # 2.40.0: 24 Mar 2014
1611
1612 use_glib_cflags="true"
1613 if test "$have_gtk" = "yes" -a "$have_qt" = "yes" ; then
1614         # We have both GTK and Qt and thus will be building both wireshark
1615         # and wireshark-gtk.
1616
1617         wireshark_bin="wireshark\$(EXEEXT) wireshark-gtk\$(EXEEXT)"
1618         wireshark_man="wireshark.1"
1619         wireshark_SUBDIRS="codecs ui/qt ui/gtk"
1620 fi
1621 if test "$have_gtk" = "no" -a "$have_qt" = "yes" ; then
1622         # We don't have GTK+ but we have Qt.
1623
1624         wireshark_bin="wireshark\$(EXEEXT)"
1625         wireshark_man="wireshark.1"
1626         wireshark_SUBDIRS="codecs ui/qt"
1627 fi
1628 if test "$have_gtk" = "yes" -a "$have_qt" = "no" ; then
1629         # We have GTK+ but not Qt.
1630
1631         wireshark_bin="wireshark-gtk\$(EXEEXT)"
1632         wireshark_man="wireshark.1"
1633         wireshark_SUBDIRS="codecs ui/gtk"
1634         use_glib_cflags="false"
1635         OSX_APP_FLAGS="$OSX_APP_FLAGS -gtk"
1636         OSX_DMG_FLAGS="-gtk"
1637 fi
1638 if test "$have_gtk" = "no" -a "$have_qt" = "no" ; then
1639         # We have neither GTK+ nor Qt.
1640         #
1641         # If they didn't explicitly say "--disable-wireshark",
1642         # fail (so that, unless they explicitly indicated that
1643         # they don't want Wireshark, we stop so they know they
1644         # won't be getting Wireshark unless they fix the GTK+/Qt
1645         # problem).
1646         #
1647         if test "x$enable_wireshark" = "xyes"; then
1648                 if test "x$with_gtk3" = "xyes"; then
1649                         AC_MSG_ERROR([Neither Qt nor GTK+ $GTK3_MIN_VERSION or later are available, so Wireshark can't be compiled])
1650                 else
1651                         AC_MSG_ERROR([Neither Qt nor GTK+ $GTK2_MIN_VERSION or later are available, so Wireshark can't be compiled])
1652                 fi
1653         fi
1654         wireshark_bin=""
1655         wireshark_man=""
1656 fi
1657
1658 if test "$have_gtk" = "yes" ; then
1659         # If we have GTK then add flags for it.
1660
1661         CPPFLAGS="-DGDK_PIXBUF_DISABLE_DEPRECATED $CPPFLAGS"
1662         CPPFLAGS="-DGDK_DISABLE_DEPRECATED $CPPFLAGS"
1663         if test \( $gtk_config_major_version -eq 3 -a $gtk_config_minor_version -ge 10 \) ; then
1664                 ## Allow use of deprecated & disable deprecated warnings if Gtk >= 3.10;
1665                 ##  The deprecations in Gtk 3.10 will not be fixed ...
1666                 CPPFLAGS="-DGDK_DISABLE_DEPRECATION_WARNINGS $CPPFLAGS"
1667         else
1668                 CPPFLAGS="-DGTK_DISABLE_DEPRECATED $CPPFLAGS"
1669         fi
1670         CPPFLAGS="-DGTK_DISABLE_SINGLE_INCLUDES $CPPFLAGS"
1671         if test ! \( $gtk_config_major_version -eq 2 -a $gtk_config_minor_version -lt 20 \) ; then
1672                 # Enable GSEAL when building with GTK > 2.20
1673                 # (Versions prior to 2.22 lacked some necessary accessors.)
1674                 CPPFLAGS="-DGSEAL_ENABLE $CPPFLAGS"
1675         fi
1676 fi
1677
1678 # XXX - Is this really necessary?  When we build with both Gtk+ and Qt it works...
1679 if test "$use_glib_cflags" = "true"; then
1680         # Use GLIB_CFLAGS
1681         AM_PATH_GLIB_2_0($GLIB_MIN_VERSION,
1682         [
1683                 CFLAGS="$CFLAGS $GLIB_CFLAGS"
1684                 CXXFLAGS="$CXXFLAGS $GLIB_CFLAGS"
1685         ], AC_MSG_ERROR(GLib $GLIB_MIN_VERSION or later distribution not found.), gthread gmodule)
1686 else
1687         # Don't use GLIB_CFLAGS
1688         AM_PATH_GLIB_2_0($GLIB_MIN_VERSION, , AC_MSG_ERROR(GLib $GLIB_MIN_VERSION or later distribution not found.), gthread gmodule)
1689 fi
1690
1691 #
1692 # "make dist" requires that we have the Qt build tools.
1693 #
1694 # Annoyingly, at least on Fedora 16, uic and moc are named XXX-qt4
1695 # rather than just XXX, perhaps to allow Qt 3 and Qt 4 tools to be
1696 # installed; if they're still doing that in current Fedora releases,
1697 # perhaps there will also be XXX-qt5 when they pick up Qt 5.
1698 #
1699 AC_PATH_PROG(UIC, uic)
1700 if test "x$UIC" = x
1701 then
1702         AC_PATH_PROG(UIC, uic-qt4)
1703         if test "x$UIC" = x
1704         then
1705                 if test "x$with_qt" = "xyes"; then
1706                         #
1707                         # If you want to build with Qt, you'd better
1708                         # have uic.
1709                         #
1710                         AC_MSG_ERROR(I couldn't find uic or uic-qt4; make sure it's installed and in your path)
1711                 else
1712                         #
1713                         # We shouldn't fail here, as the user's not
1714                         # building with Qt, and we shouldn't force them
1715                         # to have Qt installed if they're not doing so.
1716                         # "make dist" will fail if they do that, but
1717                         # we don't know whether they'll be doing that,
1718                         # so this is the best we can do.
1719                         #
1720                         UIC=uic
1721                 fi
1722         fi
1723 fi
1724 AC_SUBST(UIC)
1725 AC_PATH_PROG(MOC, moc)
1726 if test "x$MOC" = x
1727 then
1728         AC_PATH_PROG(MOC, moc-qt4)
1729         if test "x$MOC" = x
1730         then
1731                 if test "x$with_qt" = "xyes"; then
1732                         #
1733                         # If you want to build with Qt, you'd better
1734                         # have moc.
1735                         #
1736                         AC_MSG_ERROR(I couldn't find moc or moc-qt4; make sure it's installed and in your path)
1737                 else
1738                         #
1739                         # We shouldn't fail here, as the user's not
1740                         # building with Qt, and we shouldn't force them
1741                         # to have Qt installed if they're not doing so.
1742                         # "make dist" will fail if they do that, but
1743                         # we don't know whether they'll be doing that,
1744                         # so this is the best we can do.
1745                         #
1746                         MIC=moc
1747                 fi
1748         fi
1749 fi
1750 AC_SUBST(MOC)
1751 AC_PATH_PROG(RCC, rcc)
1752 if test "x$RCC" = x
1753 then
1754         AC_PATH_PROG(RCC, rcc)
1755         if test "x$RCC" = x
1756         then
1757                 if test "x$with_qt" = "xyes"; then
1758                         #
1759                         # If you want to build with Qt, you'd better
1760                         # have moc.
1761                         #
1762                         AC_MSG_ERROR(I couldn't find rcc; make sure it's installed and in your path)
1763                 else
1764                         #
1765                         # We shouldn't fail here, as the user's not
1766                         # building with Qt, and we shouldn't force them
1767                         # to have Qt installed if they're not doing so.
1768                         # "make dist" will fail if they do that, but
1769                         # we don't know whether they'll be doing that,
1770                         # so this is the best we can do.
1771                         #
1772                         RCC=rcc
1773                 fi
1774         fi
1775 fi
1776 AC_SUBST(RCC)
1777
1778 # Error out if a glib header other than a "top level" header
1779 #  (glib.h, glib-object.h, gio.h) or certain other headers( e.g.,gmodule.h)
1780 #  is used.
1781 CPPFLAGS="-DG_DISABLE_SINGLE_INCLUDES $CPPFLAGS"
1782
1783 # Error out on the usage of deprecated glib functions
1784 CPPFLAGS="-DG_DISABLE_DEPRECATED $CPPFLAGS"
1785
1786 #
1787 # Check whether GLib modules are supported, to determine whether we
1788 # can support plugins.
1789 #
1790 AC_MSG_CHECKING(whether GLib supports loadable modules)
1791 ac_save_CFLAGS="$CFLAGS"
1792 ac_save_LIBS="$LIBS"
1793 CFLAGS="$CFLAGS $GLIB_CFLAGS"
1794 LIBS="$GLIB_LIBS $LIBS"
1795 AC_TRY_RUN([
1796 #include <glib.h>
1797 #include <gmodule.h>
1798 #include <stdio.h>
1799 #include <stdlib.h>
1800
1801 int
1802 main ()
1803 {
1804   if (g_module_supported())
1805     return 0;   /* success */
1806   else
1807     return 1;   /* failure */
1808 }
1809 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
1810    [echo $ac_n "cross compiling; assumed OK... $ac_c"
1811     ac_cv_glib_supports_modules=yes])
1812 CFLAGS="$ac_save_CFLAGS"
1813 LIBS="$ac_save_LIBS"
1814 if test "$ac_cv_glib_supports_modules" = yes ; then
1815   AC_MSG_RESULT(yes)
1816   have_plugins=yes
1817   plugins_dir="plugins"
1818 else
1819   AC_MSG_RESULT(no)
1820   have_plugins=no
1821   plugins_dir=""
1822 fi
1823 AC_SUBST(plugins_dir)
1824
1825 #
1826 # If we have <dlfcn.h>, check whether we have dladdr.
1827 #
1828 if test "$ac_cv_header_dlfcn_h" = "yes"
1829 then
1830         #
1831         # Use GLib compiler flags and linker flags; GLib's gmodule
1832         # stuff uses the dl APIs if available, so it might know
1833         # what flags are needed.
1834         #
1835         ac_save_CFLAGS="$CFLAGS"
1836         ac_save_LIBS="$LIBS"
1837         CFLAGS="$CFLAGS $GLIB_CFLAGS"
1838         LIBS="$GLIB_LIBS $LIBS"
1839         AC_CHECK_FUNCS(dladdr)
1840         if test x$ac_cv_func_dladdr = xno
1841         then
1842                 #
1843                 # OK, try it with -ldl, in case you need that to get
1844                 # dladdr().  For some reason, on Linux, that's not
1845                 # part of the GLib flags; perhaps GLib itself is
1846                 # linked with libdl, so that you can link with
1847                 # Glib and it'll pull libdl in itself.
1848                 #
1849                 LIBS="$LIBS -ldl"
1850                 AC_CHECK_FUNCS(dladdr)
1851         fi
1852         CFLAGS="$ac_save_CFLAGS"
1853         LIBS="$ac_save_LIBS"
1854 fi
1855
1856 #
1857 # Check whether GLib's printf supports thousands grouping. (This might
1858 # be different from the system's printf since GLib can optionally use
1859 # its own printf implementation.)
1860 #
1861 AC_MSG_CHECKING(whether GLib supports POSIX/XSI thousands grouping)
1862 ac_save_CFLAGS="$CFLAGS"
1863 ac_save_LIBS="$LIBS"
1864 CFLAGS="$CFLAGS $GLIB_CFLAGS"
1865 LIBS="$GLIB_LIBS $LIBS"
1866 AC_TRY_RUN([
1867 #include <glib.h>
1868 #include <locale.h>
1869 #include <stdio.h>
1870 #include <string.h>
1871
1872 int
1873 main ()
1874 {
1875   gchar *str;
1876   setlocale(LC_ALL, "en_US.UTF-8");
1877   str = g_strdup_printf("%'u", 123456);
1878   return (strcmp (str, "123,456") != 0);
1879 }
1880 ], ac_cv_glib_supports_printf_grouping=yes, ac_cv_glib_supports_printf_grouping=no,
1881    [echo $ac_n "cross compiling; playing it safe... $ac_c"
1882     ac_cv_glib_supports_printf_grouping=no])
1883 CFLAGS="$ac_save_CFLAGS"
1884 LIBS="$ac_save_LIBS"
1885 if test "$ac_cv_glib_supports_printf_grouping" = yes ; then
1886   AC_MSG_RESULT(yes)
1887   AC_DEFINE(HAVE_GLIB_PRINTF_GROUPING, 1, [Define if GLib's printf functions support thousands grouping.])
1888 else
1889   AC_MSG_RESULT(no)
1890 fi
1891
1892 if test "x$have_gtk" = "xyes"
1893 then
1894     #
1895     # We have GTK+; do we want the OS X integration functions and,
1896     # if so, do we have them and, if so, which versions do we have,
1897     # the old Carbon-based ones or the new Cocoa-based ones?
1898     #
1899     AC_MSG_CHECKING(whether to use OS X integration functions)
1900
1901     AC_ARG_WITH(osx-integration,
1902       AC_HELP_STRING( [--with-osx-integration],
1903                       [use OS X integration functions @<:@default=yes, if available@:>@]),
1904     [
1905         if test $withval = no
1906         then
1907             want_osx_integration=no
1908         else
1909             want_osx_integration=yes
1910         fi
1911     ],[
1912         want_osx_integration=yes
1913     ])
1914     if test "x$want_osx_integration" = "xno"; then
1915         AC_MSG_RESULT(no)
1916     else
1917         AC_MSG_RESULT(yes)
1918         AC_WIRESHARK_OSX_INTEGRATION_CHECK
1919     fi
1920 fi
1921
1922 AC_SUBST(wireshark_bin)
1923 AC_SUBST(wireshark_man)
1924 AM_CONDITIONAL(HAVE_Qt, test "$have_qt" = "yes")
1925 AM_CONDITIONAL(HAVE_GTK, test "$have_gtk" = "yes")
1926 AC_SUBST(OSX_APP_FLAGS)
1927 AC_SUBST(OSX_DMG_FLAGS)
1928
1929 # Enable/disable tshark
1930 AC_ARG_ENABLE(tshark,
1931   AC_HELP_STRING( [--enable-tshark],
1932                   [build tshark @<:@default=yes@:>@]),
1933     tshark=$enableval,enable_tshark=yes)
1934
1935 if test "x$enable_tshark" = "xyes" ; then
1936         tshark_bin="tshark\$(EXEEXT)"
1937         tshark_man="tshark.1"
1938         wiresharkfilter_man="wireshark-filter.4"
1939 else
1940         tshark_bin=""
1941         tshark_man=""
1942 fi
1943 AC_SUBST(tshark_bin)
1944 AC_SUBST(tshark_man)
1945
1946 # Enable/disable editcap
1947
1948 AC_ARG_ENABLE(editcap,
1949   AC_HELP_STRING( [--enable-editcap],
1950                   [build editcap @<:@default=yes@:>@]),
1951     enable_editcap=$enableval,enable_editcap=yes)
1952
1953 if test "x$enable_editcap" = "xyes" ; then
1954         editcap_bin="editcap\$(EXEEXT)"
1955         editcap_man="editcap.1"
1956 else
1957         editcap_bin=""
1958         editcap_man=""
1959 fi
1960 AC_SUBST(editcap_bin)
1961 AC_SUBST(editcap_man)
1962
1963
1964 # Enabling/disabling of dumpcap is done later (after we know if we have PCAP
1965 # or not)
1966
1967 # Enable/disable capinfos
1968
1969 AC_ARG_ENABLE(capinfos,
1970   AC_HELP_STRING( [--enable-capinfos],
1971                   [build capinfos @<:@default=yes@:>@]),
1972     enable_capinfos=$enableval,enable_capinfos=yes)
1973
1974 if test "x$enable_capinfos" = "xyes" ; then
1975         capinfos_bin="capinfos\$(EXEEXT)"
1976         capinfos_man="capinfos.1"
1977 else
1978         capinfos_bin=""
1979         capinfos_man=""
1980 fi
1981 AC_SUBST(capinfos_bin)
1982 AC_SUBST(capinfos_man)
1983
1984 # Enable/disable captype
1985
1986 AC_ARG_ENABLE(captype,
1987   AC_HELP_STRING( [--enable-captype],
1988                   [build captype @<:@default=yes@:>@]),
1989     enable_captype=$enableval,enable_captype=yes)
1990
1991 if test "x$enable_captype" = "xyes" ; then
1992         captype_bin="captype\$(EXEEXT)"
1993         captype_man="captype.1"
1994 else
1995         captype_bin=""
1996         captype_man=""
1997 fi
1998 AC_SUBST(captype_bin)
1999 AC_SUBST(captype_man)
2000
2001 # Enable/disable mergecap
2002
2003 AC_ARG_ENABLE(mergecap,
2004   AC_HELP_STRING( [--enable-mergecap],
2005                   [build mergecap @<:@default=yes@:>@]),
2006     enable_mergecap=$enableval,enable_mergecap=yes)
2007
2008 if test "x$enable_mergecap" = "xyes" ; then
2009         mergecap_bin="mergecap\$(EXEEXT)"
2010         mergecap_man="mergecap.1"
2011 else
2012         mergecap_bin=""
2013         mergecap_man=""
2014 fi
2015 AC_SUBST(mergecap_bin)
2016 AC_SUBST(mergecap_man)
2017
2018 # Enable/disable reordercap
2019
2020 AC_ARG_ENABLE(reordercap,
2021   AC_HELP_STRING( [--enable-reordercap],
2022                   [build reordercap @<:@default=yes@:>@]),
2023     enable_reordercap=$enableval,enable_reordercap=yes)
2024
2025 if test "x$enable_reordercap" = "xyes" ; then
2026         reordercap_bin="reordercap\$(EXEEXT)"
2027         reordercap_man="reordercap.1"
2028 else
2029         reordercap_bin=""
2030         reordercap_man=""
2031 fi
2032 AC_SUBST(reordercap_bin)
2033 AC_SUBST(reordercap_man)
2034
2035 # Enable/disable text2pcap
2036
2037 AC_ARG_ENABLE(text2pcap,
2038   AC_HELP_STRING( [--enable-text2pcap],
2039                   [build text2pcap @<:@default=yes@:>@]),
2040     text2pcap=$enableval,enable_text2pcap=yes)
2041
2042 if test "x$enable_text2pcap" = "xyes" ; then
2043         text2pcap_bin="text2pcap\$(EXEEXT)"
2044         text2pcap_man="text2pcap.1"
2045 else
2046         text2pcap_bin=""
2047         text2pcap_man=""
2048 fi
2049 AC_SUBST(text2pcap_bin)
2050 AC_SUBST(text2pcap_man)
2051
2052 # Enable/disable dftest
2053
2054 AC_ARG_ENABLE(dftest,
2055   AC_HELP_STRING( [--enable-dftest],
2056                   [build dftest @<:@default=yes@:>@]),
2057     enable_dftest=$enableval,enable_dftest=yes)
2058
2059 if test "x$enable_dftest" = "xyes" ; then
2060         dftest_bin="dftest\$(EXEEXT)"
2061         dftest_man="dftest.1"
2062 else
2063         dftest_bin=""
2064         dftest_man=""
2065 fi
2066 AC_SUBST(dftest_bin)
2067 AC_SUBST(dftest_man)
2068
2069 # Enable/disable randpkt
2070
2071 AC_ARG_ENABLE(randpkt,
2072   AC_HELP_STRING( [--enable-randpkt],
2073                   [build randpkt @<:@default=yes@:>@]),
2074     enable_randpkt=$enableval,enable_randpkt=yes)
2075
2076 if test "x$enable_randpkt" = "xyes" ; then
2077         randpkt_bin="randpkt\$(EXEEXT)"
2078         randpkt_man="randpkt.1"
2079 else
2080         randpkt_bin=""
2081         randpkt_man=""
2082 fi
2083 AC_SUBST(randpkt_bin)
2084 AC_SUBST(randpkt_man)
2085
2086 AC_SUBST(wiresharkfilter_man)
2087
2088 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
2089 dnl "gethostbyname()".
2090 AC_WIRESHARK_GETHOSTBY_LIB_CHECK
2091
2092 dnl Checks for "connect()", used as a proxy for "socket()" - and
2093 dnl "-lsocket", if we need it to get "connect()".
2094 AC_WIRESHARK_SOCKET_LIB_CHECK
2095
2096 dnl pcap check
2097 AC_MSG_CHECKING(whether to use libpcap for packet capture)
2098
2099 AC_ARG_WITH(pcap,
2100   AC_HELP_STRING( [--with-pcap@<:@=DIR@:>@],
2101                   [use libpcap for packet capturing @<:@default=yes@:>@]),
2102 [
2103         if test $withval = no
2104         then
2105                 want_pcap=no
2106         elif test $withval = yes
2107         then
2108                 want_pcap=yes
2109         else
2110                 want_pcap=yes
2111                 pcap_dir=$withval
2112         fi
2113 ],[
2114         want_pcap=yes
2115         pcap_dir=
2116 ])
2117 if test "x$want_pcap" = "xno" ; then
2118         AC_MSG_RESULT(no)
2119 else
2120         AC_MSG_RESULT(yes)
2121         AC_WIRESHARK_PCAP_CHECK
2122 fi
2123
2124
2125 dnl Check for airpcap
2126 AC_MSG_CHECKING(whether to include airpcap support)
2127 AC_ARG_ENABLE(airpcap,
2128   AC_HELP_STRING( [--enable-airpcap],
2129                   [use AirPcap in Wireshark @<:@default=yes@:>@]),
2130   enable_airpcap=$enableval, enable_airpcap=yes)
2131
2132 if test x$enable_airpcap = xyes; then
2133         if test "x$want_pcap" = "xno" ; then
2134                 enable_airpcap=no
2135                 AC_MSG_RESULT(pcap not available - disabling airpcap)
2136         else
2137                 AC_MSG_RESULT(yes)
2138                 AC_DEFINE(HAVE_AIRPCAP, 1, [Enable AirPcap])
2139         fi
2140 else
2141         AC_MSG_RESULT(no)
2142 fi
2143
2144
2145 dnl dumpcap check
2146 AC_MSG_CHECKING(whether to build dumpcap)
2147
2148 AC_ARG_ENABLE(dumpcap,
2149   AC_HELP_STRING( [--enable-dumpcap],
2150                   [build dumpcap @<:@default=yes@:>@]),
2151     enable_dumpcap=$enableval,enable_dumpcap=yes)
2152
2153 if test "x$enable_dumpcap" = "xyes" ; then
2154         if test "x$want_pcap" = "xno" ; then
2155                 enable_dumpcap=no
2156                 AC_MSG_RESULT(pcap not available - disabling dumpcap)
2157         else
2158                 AC_MSG_RESULT(yes)
2159         fi
2160 else
2161         AC_MSG_RESULT(no)
2162 fi
2163
2164 if test "x$enable_dumpcap" = "xyes" ; then
2165         dumpcap_bin="dumpcap\$(EXEEXT)"
2166         dumpcap_man="dumpcap.1"
2167 else
2168         dumpcap_bin=""
2169         dumpcap_man=""
2170 fi
2171 AC_SUBST(dumpcap_bin)
2172 AC_SUBST(dumpcap_man)
2173
2174 # Enable/disable rawshark
2175
2176 dnl rawshark check
2177 AC_MSG_CHECKING(whether to build rawshark)
2178
2179 AC_ARG_ENABLE(rawshark,
2180   AC_HELP_STRING( [--enable-rawshark],
2181                   [build rawshark @<:@default=yes@:>@]),
2182     rawshark=$enableval,enable_rawshark=yes)
2183
2184 if test "x$enable_rawshark" = "xyes" ; then
2185         if test "x$want_pcap" = "xno" ; then
2186                 enable_rawshark=no
2187                 AC_MSG_RESULT(pcap not available - disabling rawshark)
2188         else
2189                 AC_MSG_RESULT(yes)
2190         fi
2191 else
2192         AC_MSG_RESULT(no)
2193 fi
2194
2195 if test "x$enable_rawshark" = "xyes" ; then
2196         rawshark_bin="rawshark\$(EXEEXT)"
2197         rawshark_man="rawshark.1"
2198 else
2199         rawshark_bin=""
2200         rawshark_man=""
2201 fi
2202 AC_SUBST(rawshark_bin)
2203 AC_SUBST(rawshark_man)
2204
2205
2206 # Enable/disable echld
2207 AC_ARG_ENABLE(echld,
2208   AC_HELP_STRING( [--enable-echld],
2209                   [support echld (Experimental) @<:@default=no@:>@]),
2210     have_echld=$enableval,have_echld=no)
2211
2212 AM_CONDITIONAL(HAVE_ECHLD, test "x$have_echld" = "xyes")
2213 if test "x$have_echld" = "xyes"
2214 then
2215   AC_DEFINE(HAVE_ECHLD, 1, [Define if echld is enabled])
2216   echld_test_bin="echld_test\$(EXEEXT)"
2217   echld_dir="echld"
2218 else
2219   have_echld="no"
2220   echld_test_bin=""
2221   echld_dir=""
2222 fi
2223 AC_SUBST(echld_test_bin)
2224 AC_SUBST(echld_dir)
2225
2226 # Enable/disable tfshark
2227 AC_ARG_ENABLE(tfshark,
2228   AC_HELP_STRING( [--enable-tfshark],
2229                   [build tfshark (Experimental) @<:@default=no@:>@]),
2230     tfshark=$enableval,enable_tfshark=no)
2231
2232 if test "x$enable_tfshark" = "xyes" ; then
2233         tfshark_bin="tfshark\$(EXEEXT)"
2234         tfshark_man="tfshark.1"
2235         wiresharkfilter_man="wireshark-filter.4"
2236 else
2237         tfshark_bin=""
2238         tfshark_man=""
2239 fi
2240 AC_SUBST(tfshark_bin)
2241 AC_SUBST(tfshark_man)
2242
2243
2244 dnl Use pcap-ng by default
2245 AC_ARG_ENABLE(pcap-ng-default,
2246   AC_HELP_STRING( [--enable-pcap-ng-default],
2247                   [use the pcap-ng file format by default instead of pcap @<:@default=yes@:>@]),
2248     enable_pcap_ng_default=$enableval,enable_pcap_ng_default=yes)
2249 if test x$enable_pcap_ng_default = xyes; then
2250         AC_DEFINE(PCAP_NG_DEFAULT, 1, [Support for pcap-ng])
2251 fi
2252
2253 dnl pcap remote check
2254 AC_MSG_CHECKING(whether to use libpcap remote capturing feature)
2255
2256 AC_ARG_WITH(pcap-remote,
2257     AC_HELP_STRING([--with-pcap-remote],
2258                    [use libpcap remote capturing (requires libpcap)]),
2259 [
2260     if test $withval = no
2261     then
2262         want_pcap_remote=no
2263     else
2264         want_pcap_remote=yes
2265     fi
2266 ],[
2267     want_pcap_remote=no
2268 ])
2269 if test "x$want_pcap_remote" = "xno" -o "x$want_pcap" = "xno" ; then
2270     AC_MSG_RESULT(no)
2271 else
2272     AC_MSG_RESULT(yes)
2273     AC_WIRESHARK_PCAP_REMOTE_CHECK
2274 fi
2275
2276 dnl zlib check
2277 AC_MSG_CHECKING(whether to use zlib for gzip compression and decompression)
2278
2279 AC_ARG_WITH(zlib,
2280   AC_HELP_STRING([--with-zlib@<:@=DIR@:>@],
2281                  [use zlib (located in directory DIR, if supplied) for gzip compression and decompression @<:@default=yes, if available@:>@]),
2282 [
2283         if test "x$withval" = "xno"
2284         then
2285                 want_zlib=no
2286         elif test "x$withval" = "xyes"
2287         then
2288                 want_zlib=yes
2289         else
2290                 want_zlib=yes
2291                 zlib_dir="$withval"
2292         fi
2293 ],[
2294         #
2295         # Use zlib if it's present, otherwise don't.
2296         #
2297         want_zlib=ifavailable
2298         zlib_dir=
2299 ])
2300 if test "x$want_zlib" = "xno" ; then
2301         AC_MSG_RESULT(no)
2302 else
2303         AC_MSG_RESULT(yes)
2304         AC_WIRESHARK_ZLIB_CHECK
2305         if test "x$want_zlib" = "xno" ; then
2306                 AC_MSG_RESULT(zlib not found - disabling gzip compression and decompression)
2307         else
2308                 if test "x$ac_cv_func_inflatePrime" = "xno" ; then
2309                         AC_MSG_RESULT(inflatePrime not found in zlib - disabling gzipped capture file support)
2310                 fi
2311         fi
2312 fi
2313
2314 dnl Lua check
2315 AC_MSG_CHECKING(whether to use liblua for the Lua scripting plugin)
2316
2317 AC_ARG_WITH(lua,
2318   AC_HELP_STRING( [--with-lua@<:@=DIR@:>@],
2319                   [use liblua (located in directory DIR, if supplied) for the Lua scripting plugin @<:@default=yes, if available@:>@]),
2320 [
2321         if test $withval = no
2322         then
2323                 want_lua=no
2324         elif test $withval = yes
2325         then
2326                 want_lua=yes
2327         else
2328                 want_lua=yes
2329                 lua_dir=$withval
2330         fi
2331 ],[
2332         #
2333         # Use liblua by default
2334         #
2335         want_lua=ifavailable
2336         lua_dir=
2337 ])
2338 if test "x$want_lua" = "xno" ; then
2339         AC_MSG_RESULT(no)
2340 else
2341         AC_MSG_RESULT(yes)
2342         AC_WIRESHARK_LIBLUA_CHECK
2343         if test "x$want_lua" = "xno" ; then
2344                 AC_MSG_RESULT(liblua not found - disabling support for the lua scripting plugin)
2345         fi
2346 fi
2347 AM_CONDITIONAL(HAVE_LIBLUA, test x$want_lua = xyes)
2348
2349
2350 dnl portaudio check
2351 AC_MSG_CHECKING(whether to use libportaudio for the rtp_player)
2352
2353 AC_ARG_WITH(portaudio,
2354   AC_HELP_STRING( [--with-portaudio@<:@=DIR@:>@],
2355                   [use libportaudio (located in directory DIR, if supplied) for the rtp_player @<:@default=yes, if available@:>@]),
2356 [
2357         if test $withval = no
2358         then
2359                 want_portaudio=no
2360         elif test $withval = yes
2361         then
2362                 want_portaudio=yes
2363         else
2364                 want_portaudio=yes
2365                 portaudio_dir=$withval
2366         fi
2367 ],[
2368         #
2369         # Use libportaudio by default
2370         #
2371         want_portaudio=ifavailable
2372         portaudio_dir=
2373 ])
2374 if test "x$want_portaudio" = "xno" ; then
2375         AC_MSG_RESULT(no)
2376 else
2377         AC_MSG_RESULT(yes)
2378         AC_WIRESHARK_LIBPORTAUDIO_CHECK
2379         if test "x$want_portaudio" = "xno" ; then
2380                 AC_MSG_RESULT(libportaudio not found - disabling support for the rtp_player)
2381         fi
2382 fi
2383 AM_CONDITIONAL(HAVE_LIBPORTAUDIO, test x$want_portaudio = xyes)
2384
2385
2386 dnl ipv6 check
2387 AC_ARG_ENABLE(ipv6,
2388   AC_HELP_STRING( [--enable-ipv6],
2389                   [use IPv6 name resolution, if available @<:@default=yes@:>@]),
2390     enable_ipv6=$enableval,enable_ipv6=yes)
2391
2392 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
2393 if test "x$enable_ipv6" = "xno" ; then
2394         AC_MSG_RESULT(no)
2395 else
2396         AC_MSG_RESULT(yes)
2397         AC_WIRESHARK_IPV6_STACK
2398 fi
2399
2400
2401 dnl Check if dumpcap should be installed with filesystem capabilities
2402 AC_PATH_PROG(SETCAP, setcap)
2403 AC_ARG_ENABLE(setcap-install,
2404   AC_HELP_STRING( [--enable-setcap-install],
2405                   [install dumpcap with cap_net_admin and cap_net_raw @<:@default=no@:>@]),
2406     enable_setcap_install=$enableval,enable_setcap_install=no)
2407
2408 AC_MSG_CHECKING(whether to install dumpcap with cap_net_admin and cap_net_raw capabilities)
2409 if test "x$enable_setcap_install" = "xno" ; then
2410         AC_MSG_RESULT(no)
2411 else
2412         if test "x$SETCAP" = "x" ; then
2413                 AC_MSG_RESULT(setcap not found)
2414                 AC_MSG_ERROR([Setcap install was requested, but setcap was not found])
2415         elif test "x$enable_dumpcap" = "xno" ; then
2416                 AC_MSG_RESULT(dumpcap disabled)
2417                 AC_MSG_ERROR([Setcap install works only with dumpcap, but dumpcap is disabled])
2418         else
2419                 AC_MSG_RESULT(yes)
2420         fi
2421 fi
2422
2423 AM_CONDITIONAL(SETCAP_INSTALL, test x$enable_setcap_install = xyes)
2424
2425 dnl Check if dumpcap should be installed setuid
2426 AC_ARG_ENABLE(setuid-install,
2427   AC_HELP_STRING( [--enable-setuid-install],
2428                   [install dumpcap as setuid @<:@default=no@:>@]),
2429     enable_setuid_install=$enableval,enable_setuid_install=no)
2430
2431 AC_MSG_CHECKING(whether to install dumpcap setuid)
2432 if test "x$enable_setuid_install" = "xno" ; then
2433         AC_MSG_RESULT(no)
2434 else
2435         if test "x$enable_setcap_install" = "xyes" ; then
2436                 enable_setuid_install=no
2437                 AC_MSG_RESULT(setcap and setuid both selected)
2438                 AC_MSG_ERROR(You must choose one of setcap install and setuid install)
2439         elif test "x$enable_dumpcap" = "xno" ; then
2440                 AC_MSG_RESULT(dumpcap disabled)
2441                 AC_MSG_ERROR([Setuid install works only with dumpcap, but dumpcap is disabled])
2442         else
2443                 AC_MSG_RESULT(yes)
2444         fi
2445 fi
2446
2447 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
2448 AC_CHECK_FUNCS(setresuid setresgid)
2449
2450 dnl ...but our Network Operations group is named "no"!
2451 DUMPCAP_GROUP=''
2452 AC_ARG_WITH(dumpcap-group,
2453   AC_HELP_STRING( [--with-dumpcap-group=GROUP],
2454                   [restrict dumpcap to GROUP]),
2455 [
2456   if test "x$withval" = "xyes"; then
2457       AC_MSG_ERROR([No dumpcap group specified.])
2458   elif test "x$withval" != "xno"; then
2459       if test "x$enable_dumpcap" = "xno" ; then
2460           AC_MSG_ERROR(dumpcap group install works only with dumpcap but dumpcap is disabled)
2461       fi
2462       AC_MSG_RESULT($withval)
2463       DUMPCAP_GROUP="$withval"
2464   fi
2465 ])
2466 AC_SUBST(DUMPCAP_GROUP)
2467 AM_CONDITIONAL(HAVE_DUMPCAP_GROUP, test x$DUMPCAP_GROUP != x)
2468
2469 dnl libcap (not libpcap) check
2470 LIBCAP_LIBS=''
2471 AC_MSG_CHECKING(whether to use the libcap capabilities library)
2472
2473 AC_ARG_WITH(libcap,
2474   AC_HELP_STRING( [--with-libcap@<:@=DIR@:>@],
2475                   [use libcap (located in directory DIR, if supplied) for POSIX.1e capabilities management @<:@default=yes, if present@:>@]),
2476 [
2477 if   test "x$withval" = "xno";  then
2478         want_libcap=no
2479 elif test "x$withval" = "xyes"; then
2480         want_libcap=yes
2481 elif test -d "$withval"; then
2482         want_libcap=yes
2483         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
2484 fi
2485 ])
2486 if test "x$with_libcap" = "xno" ; then
2487         AC_MSG_RESULT(no)
2488 else
2489         AC_MSG_RESULT(yes)
2490         AC_WIRESHARK_LIBCAP_CHECK
2491 fi
2492 AC_SUBST(LIBCAP_LIBS)
2493
2494 dnl Checks for header files.
2495 dnl Some of these may not be needed: http://hacks.owlfolio.org/header-survey/
2496 AC_CHECK_HEADERS(direct.h dirent.h fcntl.h getopt.h grp.h inttypes.h netdb.h pwd.h stdarg.h stddef.h unistd.h)
2497 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)
2498 AC_CHECK_HEADERS(netinet/in.h)
2499 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
2500
2501 dnl SSL Check
2502 SSL_LIBS=''
2503 AC_MSG_CHECKING(whether to use SSL library)
2504
2505 AC_ARG_WITH(ssl,
2506   AC_HELP_STRING( [--with-ssl@<:@=DIR@:>@],
2507                   [use SSL crypto library (located in directory DIR, if supplied) @<:@default=no@:>@]),
2508 [
2509 if test "x$withval" = "xno";  then
2510         want_ssl=no
2511 elif test "x$withval" = "xyes"; then
2512         want_ssl=yes
2513 elif test -d "$withval"; then
2514         want_ssl=yes
2515         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
2516 fi
2517 ],[
2518         want_ssl=no
2519 ])
2520 if test "x$want_ssl" = "xyes"; then
2521         AC_MSG_RESULT(yes)
2522         AC_CHECK_LIB(crypto,EVP_md5,
2523             [
2524                 SSL_LIBS=-lcrypto
2525             ],
2526             [
2527                 AC_MSG_ERROR([SSL crypto library was requested, but is not available])
2528             ])
2529 else
2530         AC_MSG_RESULT(no)
2531 fi
2532 AC_SUBST(SSL_LIBS)
2533
2534 dnl kerberos check
2535 AC_MSG_CHECKING(whether to use Kerberos library)
2536
2537 AC_ARG_WITH(krb5,
2538   AC_HELP_STRING( [--with-krb5@<:@=DIR@:>@],
2539                   [use Kerberos library (located in directory DIR, if supplied) to use in Kerberos dissection @<:@default=yes@:>@]),
2540 [
2541         if test $withval = no
2542         then
2543                 want_krb5=no
2544         elif test $withval = yes
2545         then
2546                 want_krb5=yes
2547         else
2548                 want_krb5=yes
2549                 krb5_dir=$withval
2550         fi
2551 ],[
2552         #
2553         # Use Kerberos library if available, otherwise don't.
2554         #
2555         want_krb5=ifavailable
2556         krb5_dir=
2557 ])
2558 if test "x$want_krb5" = "xno" ; then
2559         AC_MSG_RESULT(no)
2560 else
2561         AC_MSG_RESULT(yes)
2562         AC_WIRESHARK_KRB5_CHECK
2563 fi
2564
2565
2566 dnl c-ares Check
2567 C_ARES_LIBS=''
2568 AC_MSG_CHECKING(whether to use the c-ares library if available)
2569
2570 AC_ARG_WITH(c-ares,
2571   AC_HELP_STRING( [--with-c-ares@<:@=DIR@:>@],
2572                   [use c-ares (located in directory DIR, if supplied) - supersedes --with-adns @<:@default=yes, if present@:>@]),
2573 [
2574 if   test "x$withval" = "xno";  then
2575         want_c_ares=no
2576 elif test "x$withval" = "xyes"; then
2577         want_c_ares=yes
2578 elif test -d "$withval"; then
2579         want_c_ares=yes
2580         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
2581 fi
2582 ])
2583 if test "x$want_c_ares" = "xno" ; then
2584         AC_MSG_RESULT(no)
2585 else
2586         AC_MSG_RESULT(yes)
2587         AC_WIRESHARK_C_ARES_CHECK
2588 fi
2589 AC_SUBST(C_ARES_LIBS)
2590
2591 dnl ADNS Check
2592 ADNS_LIBS=''
2593 AC_MSG_CHECKING(whether to use the GNU ADNS library if available)
2594
2595 AC_ARG_WITH(adns,
2596   AC_HELP_STRING( [--with-adns@<:@=DIR@:>@],
2597                   [use GNU ADNS (located in directory DIR, if supplied) @<:@default=yes, if present@:>@]),
2598 [
2599 if   test "x$withval" = "xno";  then
2600         want_adns=no
2601 elif test "x$withval" = "xyes"; then
2602         want_adns=yes
2603 elif test -d "$withval"; then
2604         want_adns=yes
2605         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
2606 fi
2607 ])
2608 if test "x$want_adns" = "xno" -o "x$have_good_c_ares" = "xyes" ; then
2609         AC_MSG_RESULT(no)
2610 else
2611         AC_MSG_RESULT(yes)
2612         AC_WIRESHARK_ADNS_CHECK
2613 fi
2614 AC_SUBST(ADNS_LIBS)
2615
2616 dnl GEOIP Check
2617 GEOIP_LIBS=''
2618 AC_MSG_CHECKING(whether to use the GeoIP IP address mapping library if available)
2619
2620 AC_ARG_WITH(geoip,
2621   AC_HELP_STRING( [--with-geoip@<:@=DIR@:>@],
2622                   [use GeoIP (located in directory DIR, if supplied) @<:@default=yes, if present@:>@]),
2623 [
2624 if   test "x$withval" = "xno";  then
2625         want_geoip=no
2626 elif test "x$withval" = "xyes"; then
2627         want_geoip=yes
2628 elif test -d "$withval"; then
2629         want_geoip=yes
2630         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
2631 fi
2632 ])
2633 if test "x$want_geoip" = "xno"; then
2634         AC_MSG_RESULT(no)
2635 else
2636         AC_MSG_RESULT(yes)
2637         AC_WIRESHARK_GEOIP_CHECK
2638 fi
2639 AC_SUBST(GEOIP_LIBS)
2640
2641 #
2642 # Define WS_MSVC_NORETURN appropriately for declarations of routines that
2643 # never return (just like Charlie on the MTA).
2644 #
2645 # Note that MSVC++ expects __declspec(noreturn) to precede the function
2646 # name and GCC, as far as I know, expects __attribute__((noreturn)) to
2647 # follow the function name, so we need two different flavors of
2648 # noreturn tag.
2649 #
2650 AC_DEFINE(WS_MSVC_NORETURN,, [Define as the string to precede declarations of routines that never return])
2651
2652 dnl Checks for typedefs, structures, and compiler characteristics.
2653 # AC_C_CONST
2654
2655 # Check how we can get the time zone abbreviation
2656 AC_WIRESHARK_TIMEZONE_ABBREV
2657
2658 # We need to know whether "struct stat" has an "st_flags" member
2659 # for file_user_immutable().
2660
2661 AC_WIRESHARK_STRUCT_ST_FLAGS
2662
2663 # We need to know whether "struct sockaddr" has an "sa_len" member
2664 # for get_interface_list().
2665
2666 AC_WIRESHARK_STRUCT_SA_LEN
2667
2668 # We must know our byte order
2669 AC_C_BIGENDIAN
2670
2671 # Checks whether "-traditional" is needed when using "ioctl".
2672 # XXX - do we need this?
2673 AC_PROG_GCC_TRADITIONAL
2674
2675 AC_CHECK_FUNC(getopt_long,
2676   [
2677     GETOPT_LO=""
2678     AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if you have the getopt_long function.])
2679
2680     #
2681     # Do we have optreset?
2682     #
2683     AC_MSG_CHECKING(whether optreset is defined)
2684     AC_TRY_LINK([],
2685       [
2686         extern int optreset;
2687
2688         return optreset;
2689       ],
2690       ac_cv_pcap_debug_defined=yes,
2691       ac_cv_pcap_debug_defined=no)
2692     if test "$ac_cv_pcap_debug_defined" = yes ; then
2693       AC_MSG_RESULT(yes)
2694       AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if you have the optreset variable])
2695     else
2696       AC_MSG_RESULT(no)
2697     fi
2698   ],
2699   GETOPT_LO="wsgetopt.lo")
2700 AC_SUBST(GETOPT_LO)
2701
2702 AC_CHECK_FUNCS(mkstemp mkdtemp)
2703
2704 AC_SEARCH_LIBS(inet_aton, [socket nsl],
2705   [
2706     INET_ATON_LO=""
2707     AC_DEFINE(HAVE_INET_ATON, 0, [Define to 1 if you have the inet_aton function.])
2708   ],
2709   INET_ATON_LO="inet_aton.lo")
2710 AC_SUBST(INET_ATON_LO)
2711
2712 AC_SEARCH_LIBS(inet_pton, [socket nsl], [
2713   dnl check for pre-BIND82 inet_pton() bug.
2714   AC_MSG_CHECKING(for broken inet_pton)
2715   AC_TRY_RUN([#include <sys/types.h>
2716 #include <sys/socket.h>
2717 #include <netinet/in.h>
2718 #include <arpa/inet.h>
2719 int main()
2720 {
2721 #ifdef AF_INET6
2722   char buf[16];
2723   /* this should return 0 (error) */
2724   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
2725 #else
2726   return 1;
2727 #endif
2728 }], [AC_MSG_RESULT(ok);
2729 have_inet_pton=yes], [AC_MSG_RESULT(broken);
2730 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
2731 have_inet_pton=no])],
2732 have_inet_pton=no)
2733 if test "$have_inet_pton" = no; then
2734   INET_PTON_LO="inet_pton.lo"
2735 else
2736   INET_PTON_LO=""
2737 fi
2738 AM_CONDITIONAL(NEED_INET_PTON_LO, test "x$have_inet_pton" = "xno")
2739 AC_SUBST(INET_PTON_LO)
2740
2741 AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
2742   AC_MSG_CHECKING([for inet_ntop prototype])
2743   AC_TRY_COMPILE([#include <stdio.h>
2744 #include <sys/types.h>
2745 #include <sys/socket.h>
2746 #include <netinet/in.h>
2747 #include <arpa/inet.h>
2748
2749 extern const char *inet_ntop(int, const void *, char *, size_t);],, [
2750     AC_MSG_RESULT(yes)
2751     AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
2752     [Define if inet_ntop() prototype exists])], [
2753     AC_TRY_COMPILE([#include <stdio.h>
2754 #include <sys/types.h>
2755 #include <sys/socket.h>
2756 #include <netinet/in.h>
2757 #include <arpa/inet.h>
2758
2759 extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
2760       AC_MSG_RESULT(yes)
2761       AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
2762       [Define if inet_ntop() prototype exists])], [
2763       AC_MSG_RESULT(no)])])
2764   INET_NTOP_LO=""], [
2765   INET_NTOP_LO="inet_ntop.lo"
2766   AC_DEFINE(NEED_INET_V6DEFS_H, 1,
2767   [Define if inet/v6defs.h needs to be included])])
2768 AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x")
2769 AC_SUBST(INET_NTOP_LO)
2770
2771 AC_CHECK_FUNC(strptime,
2772   [
2773     STRPTIME_LO=""
2774     AC_DEFINE(HAVE_STRPTIME, 1, [Define if you have the strptime function.])
2775   ],
2776   STRPTIME_LO="strptime.lo")
2777 AC_SUBST(STRPTIME_LO)
2778
2779 AC_CHECK_FUNC(popcount,
2780   [
2781     POPCOUNT_LO=""
2782     AC_DEFINE(HAVE_POPCOUNT, 1, [Define if you have the popcount function.])
2783   ],
2784   POPCOUNT_LO="popcount.lo")
2785 AC_SUBST(POPCOUNT_LO)
2786
2787 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
2788 AC_CHECK_FUNCS(issetugid)
2789 AC_CHECK_FUNCS(mmap mprotect sysconf)
2790
2791 dnl blank for now, but will be used in future
2792 AC_SUBST(wireshark_SUBDIRS)
2793
2794 # Check Bluetooth SBC codec for RTP Player
2795 # git://git.kernel.org/pub/scm/bluetooth/sbc.git
2796 PKG_CHECK_MODULES(SBC, sbc >= 1.0, [have_sbc=yes], [have_sbc=no])
2797 if (test "${have_sbc}" = "yes"); then
2798     AC_DEFINE(HAVE_SBC, 1, [Define to support playing SBC by standalone BlueZ SBC library])
2799     CFLAGS="$CFLAGS $(pkg-config sbc --cflags)"
2800     LIBS="$LIBS $(pkg-config sbc --libs)"
2801 fi
2802
2803 dnl
2804 dnl check whether plugins should be enabled and, if they should be,
2805 dnl check for plugins directory - stolen from Amanda's configure.ac
2806 dnl
2807 dnl we don't wish to expand ${libdir} yet
2808 plugindir='${libdir}/wireshark/plugins/${VERSION}'
2809 AC_ARG_WITH(plugins,
2810   AC_HELP_STRING( [--with-plugins@<:@=DIR@:>@],
2811                   [support plugins (installed in DIR, if supplied) @<:@default=yes, if possible@:>@]),
2812 [
2813   if test "x$withval" = "xno"; then
2814     have_plugins=no
2815   elif test "x$have_plugins" = "xno"; then
2816       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
2817   elif test "x$withval" != "xyes"; then
2818       plugindir="$withval"
2819   fi
2820 ])
2821 AM_CONDITIONAL(HAVE_PLUGINS, test "x$have_plugins" = "xyes")
2822 if test x$have_plugins = xyes
2823 then
2824   AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
2825 fi
2826 AC_SUBST(plugindir)
2827 CPPFLAGS="$CPPFLAGS '-DPLUGIN_INSTALL_DIR=\"\$(plugindir)\"'"
2828
2829 #
2830 # The plugin dissectors reside in ./plugins/PROTO/
2831 #
2832 PLUGIN_LIBS=""
2833 AC_SUBST(PLUGIN_LIBS)
2834
2835
2836 dnl Use extcap by default
2837 extcapdir='${datadir}/wireshark/extcap/'
2838 AC_ARG_WITH(extcap,
2839   AC_HELP_STRING( [--with-extcap@<:@=DIR@:>@],
2840                   [use extcap for external capture sources (installed in DIR, if supplied) @<:@default=yes, if possible@:>@]),
2841 [
2842   if test "x$withval" = "xno"; then
2843       have_extcap=no
2844   elif test "x$withval" = "xyes"; then
2845       have_extcap=yes
2846   elif test "x$withval" != "xyes"; then
2847       have_extcap=yes
2848       extcapdir ="$withval"
2849   fi
2850 ],[
2851     have_extcap=yes
2852 ])
2853 AM_CONDITIONAL(HAVE_EXTCAP, test "x$have_extcap" = "xyes")
2854 if test "x$have_extcap" = "xyes"
2855 then
2856   AC_DEFINE(HAVE_EXTCAP, 1, [Define if external capture sources should be enabled])
2857   AC_DEFINE_UNQUOTED(EXTCAP_DIR,"$extcapdir", [Directory for extcap plugins])
2858 fi
2859 AC_SUBST(extcapdir)
2860
2861 #
2862 # Check if (emem) memory allocations must be 8-byte aligned.
2863 # I haven't been able to write C code that reliably makes that determination
2864 # (different versions of GCC with or without optimization give different
2865 # results) so just assume everything except (32-bit) x86 needs 8-byte
2866 # alignment (64-bit platforms either require 8-byte alignment for pointers
2867 # and 64-bit integral data types or may get better performance from that;
2868 # 64-bit x86 will get 8-byte alignment from G_MEM_ALIGN anyway.  32-bit
2869 # platforms would only require it, or get better performance from it,
2870 # for 64-bit floating-point values.).
2871 #
2872 AC_MSG_CHECKING(whether we need memory allocations to be 8-byte aligned)
2873 case $host_cpu in
2874         i386|i486|i586|i686)
2875                 AC_MSG_RESULT(no)
2876                 ;;
2877         *)
2878                 AC_MSG_RESULT(yes)
2879                 AC_DEFINE(NEED_8_BYTE_ALIGNMENT, 1, [Define if we need memory allocations to be 8-byte aligned])
2880                 ;;
2881 esac
2882
2883 dnl libtool defs
2884 #
2885 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
2886 # (autoconf?  automake?  libtool?) - with the newer version(s), it's
2887 # just an alias for AC_PROG_LIBTOOL, which is called earlier.
2888 #
2889 # With older version(s) of those tool(s), however, it's not just an
2890 # alias, and the configure scripts don't work without it.
2891 #
2892 AM_PROG_LIBTOOL
2893 AC_SUBST(LIBTOOL_DEPS)
2894
2895 AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes)
2896 if test x$enable_static = xyes -a x$have_plugins = xyes
2897 then
2898   AC_DEFINE(ENABLE_STATIC, 1, [Link plugins statically into Wireshark])
2899 fi
2900 AC_SUBST(ENABLE_STATIC)
2901
2902 # Gather which GUI we're building for rpmbuild
2903 if test "x$have_gtk" = "xyes"; then
2904         if test "x$with_gtk3" = "xyes"; then
2905                 RPMBUILD_WITH_ARGS="--with gtk3 --without gtk2"
2906         else
2907                 RPMBUILD_WITH_ARGS="--without gtk3 --with gtk2"
2908         fi
2909 else
2910         RPMBUILD_WITH_ARGS="--without gtk2 --without gtk3"
2911 fi
2912 if test "x$have_qt" = "xyes" ; then
2913         RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --with qt"
2914 else
2915         RPMBUILD_WITH_ARGS="$RPMBUILD_WITH_ARGS --without qt"
2916 fi
2917 AC_SUBST(RPMBUILD_WITH_ARGS)
2918
2919 dnl Save the cacheable configure results to config.cache before recursing
2920 AC_CACHE_SAVE
2921
2922 sinclude(plugins/Custom.m4) dnl
2923 ifdef(_CUSTOM_AC_OUTPUT_,, define(_CUSTOM_AC_OUTPUT_, )) dnl
2924
2925 sinclude(asn1/Custom.m4) dnl
2926 ifdef(_CUSTOM_ASN1_AC_OUTPUT_,, define(_CUSTOM_ASN1_AC_OUTPUT_, )) dnl
2927
2928 AC_CONFIG_HEADERS(config.h)
2929 AC_OUTPUT(
2930   Makefile
2931   doxygen.cfg
2932   asn1/Makefile
2933   _CUSTOM_ASN1_AC_OUTPUT_
2934   asn1/acp133/Makefile
2935   asn1/acse/Makefile
2936   asn1/ansi_map/Makefile
2937   asn1/ansi_tcap/Makefile
2938   asn1/atn-cm/Makefile
2939   asn1/atn-cpdlc/Makefile
2940   asn1/atn-ulcs/Makefile
2941   asn1/c1222/Makefile
2942   asn1/camel/Makefile
2943   asn1/cdt/Makefile
2944   asn1/charging_ase/Makefile
2945   asn1/cmip/Makefile
2946   asn1/cmp/Makefile
2947   asn1/crmf/Makefile
2948   asn1/cms/Makefile
2949   asn1/credssp/Makefile
2950   asn1/dap/Makefile
2951   asn1/disp/Makefile
2952   asn1/dop/Makefile
2953   asn1/dsp/Makefile
2954   asn1/ess/Makefile
2955   asn1/ftam/Makefile
2956   asn1/goose/Makefile
2957   asn1/gprscdr/Makefile
2958   asn1/gsm_map/Makefile
2959   asn1/h225/Makefile
2960   asn1/h235/Makefile
2961   asn1/h245/Makefile
2962   asn1/h248/Makefile
2963   asn1/h282/Makefile
2964   asn1/h283/Makefile
2965   asn1/h323/Makefile
2966   asn1/h450/Makefile
2967   asn1/h450-ros/Makefile
2968   asn1/h460/Makefile
2969   asn1/h501/Makefile
2970   asn1/HI2Operations/Makefile
2971   asn1/hnbap/Makefile
2972   asn1/idmp/Makefile
2973   asn1/ilp/Makefile
2974   asn1/inap/Makefile
2975   asn1/isdn-sup/Makefile
2976   asn1/kerberos/Makefile
2977   asn1/lcsap/Makefile
2978   asn1/ldap/Makefile
2979   asn1/logotypecertextn/Makefile
2980   asn1/lpp/Makefile
2981   asn1/lppa/Makefile
2982   asn1/lppe/Makefile
2983   asn1/lte-rrc/Makefile
2984   asn1/m3ap/Makefile
2985   asn1/mms/Makefile
2986   asn1/mpeg-audio/Makefile
2987   asn1/mpeg-pes/Makefile
2988   asn1/nbap/Makefile
2989   asn1/ns_cert_exts/Makefile
2990   asn1/novell_pkis/Makefile
2991   asn1/ocsp/Makefile
2992   asn1/p1/Makefile
2993   asn1/p22/Makefile
2994   asn1/p7/Makefile
2995   asn1/p772/Makefile
2996   asn1/pcap/Makefile
2997   asn1/pkcs1/Makefile
2998   asn1/pkcs12/Makefile
2999   asn1/pkinit/Makefile
3000   asn1/pkixac/Makefile
3001   asn1/pkix1explicit/Makefile
3002   asn1/pkix1implicit/Makefile
3003   asn1/pkixproxy/Makefile
3004   asn1/pkixqualified/Makefile
3005   asn1/pkixtsp/Makefile
3006   asn1/pres/Makefile
3007   asn1/q932/Makefile
3008   asn1/q932-ros/Makefile
3009   asn1/qsig/Makefile
3010   asn1/ranap/Makefile
3011   asn1/rnsap/Makefile
3012   asn1/ros/Makefile
3013   asn1/rrc/Makefile
3014   asn1/rrlp/Makefile
3015   asn1/rtse/Makefile
3016   asn1/rua/Makefile
3017   asn1/s1ap/Makefile
3018   asn1/sabp/Makefile
3019   asn1/sbc-ap/Makefile
3020   asn1/smrse/Makefile
3021   asn1/snmp/Makefile
3022   asn1/spnego/Makefile
3023   asn1/sv/Makefile
3024   asn1/t124/Makefile
3025   asn1/t125/Makefile
3026   asn1/t38/Makefile
3027   asn1/tcap/Makefile
3028   asn1/tetra/Makefile
3029   asn1/ulp/Makefile
3030   asn1/wlancertextn/Makefile
3031   asn1/x2ap/Makefile
3032   asn1/x509af/Makefile
3033   asn1/x509ce/Makefile
3034   asn1/x509if/Makefile
3035   asn1/x509sat/Makefile
3036   asn1/x721/Makefile
3037   capchild/Makefile
3038   capchild/doxygen.cfg
3039   caputils/Makefile
3040   caputils/doxygen.cfg
3041   doc/Makefile
3042   docbook/Makefile
3043   epan/Makefile
3044   epan/compress/Makefile
3045   epan/crypt/Makefile
3046   epan/doxygen.cfg
3047   epan/dfilter/Makefile
3048   epan/dissectors/Makefile
3049   epan/dissectors/dcerpc/Makefile
3050   epan/dissectors/pidl/Makefile
3051   epan/ftypes/Makefile
3052   epan/nghttp2/Makefile
3053   epan/wmem/Makefile
3054   epan/wslua/Makefile
3055   codecs/Makefile
3056   ui/Makefile
3057   ui/doxygen.cfg
3058   ui/gtk/Makefile
3059   ui/gtk/doxygen.cfg
3060   ui/cli/Makefile
3061   ui/qt/Makefile
3062   ui/qt/doxygen.cfg
3063   help/Makefile
3064   packaging/Makefile
3065   packaging/macosx/Info.plist
3066   packaging/macosx/Makefile
3067   packaging/macosx/osx-dmg.sh
3068   packaging/macosx/Wireshark_package.pmdoc/index.xml
3069   packaging/nsis/Makefile
3070   packaging/rpm/Makefile
3071   packaging/rpm/SPECS/Makefile
3072   packaging/rpm/SPECS/wireshark.spec
3073   packaging/svr4/Makefile
3074   packaging/svr4/checkinstall
3075   packaging/svr4/pkginfo
3076   plugins/Makefile
3077   plugins/docsis/Makefile
3078   plugins/easy_codec/Makefile
3079   plugins/ethercat/Makefile
3080   plugins/gryphon/Makefile
3081   plugins/irda/Makefile
3082   plugins/m2m/Makefile
3083   plugins/mate/Makefile
3084   plugins/opcua/Makefile
3085   plugins/profinet/Makefile
3086   plugins/stats_tree/Makefile
3087   plugins/unistim/Makefile
3088   plugins/wimax/Makefile
3089   plugins/wimaxasncp/Makefile
3090   plugins/wimaxmacphy/Makefile
3091   tools/Makefile
3092   tools/lemon/Makefile
3093   wiretap/Makefile
3094   wsutil/Makefile
3095   echld/Makefile
3096   _CUSTOM_AC_OUTPUT_
3097   ,)
3098 dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])
3099
3100
3101 # Pretty messages
3102
3103 if test "x$have_gtk" = "xyes"; then
3104         if test "x$with_gtk3" = "xyes"; then
3105                 gtk_lib_message=" (with GTK+ 3"
3106         else
3107                 gtk_lib_message=" (with GTK+ 2"
3108         fi
3109         if test "x$have_ige_mac" = "xyes"; then
3110                 gtk_lib_message="$gtk_lib_message and Mac OS X integration)"
3111         else
3112                 gtk_lib_message="$gtk_lib_message)"
3113         fi
3114 fi
3115
3116 if test "x$have_qt" = "xyes" ; then
3117         enable_wireshark_qt="yes"
3118 else
3119         enable_wireshark_qt="no"
3120 fi
3121
3122 if test "x$enable_setcap_install" = "xyes" ; then
3123         setcap_message="yes"
3124 else
3125         setcap_message="no"
3126 fi
3127
3128 if test "x$enable_setuid_install" = "xyes" ; then
3129         setuid_message="yes"
3130 else
3131         setuid_message="no"
3132 fi
3133
3134 if test "x$DUMPCAP_GROUP" = "x" ; then
3135         dumpcap_group_message="(none)"
3136 else
3137         dumpcap_group_message="$DUMPCAP_GROUP"
3138 fi
3139
3140 if test "x$want_zlib" = "xno" ; then
3141         zlib_message="no"
3142 else
3143         zlib_message="yes"
3144 fi
3145
3146 if test "x$want_lua" = "xyes" ; then
3147         lua_message="yes"
3148 else
3149         lua_message="no"
3150 fi
3151
3152 if test "x$want_portaudio" = "xyes" ; then
3153         portaudio_message="yes"
3154 else
3155         portaudio_message="no"
3156 fi
3157
3158 if test "x$want_ssl" = "xno" ; then
3159         ssl_message="no"
3160 else
3161         ssl_message="yes"
3162 fi
3163
3164 if test "x$want_krb5" = "xno" ; then
3165         krb5_message="no"
3166 else
3167         krb5_message="yes ($ac_krb5_version)"
3168 fi
3169
3170 if test "x$have_good_c_ares" = "xyes" ; then
3171         c_ares_message="yes"
3172 else
3173         c_ares_message="no"
3174 fi
3175
3176 if test "x$have_good_adns" = "xyes" ; then
3177         adns_message="yes"
3178 else
3179         if test "x$have_good_c_ares" = "xyes" ; then
3180                 adns_message="no (using c-ares instead)"
3181         else
3182                 adns_message="no"
3183         fi
3184 fi
3185
3186 if test "x$have_good_libcap" = "xyes" ; then
3187         libcap_message="yes"
3188 else
3189         libcap_message="no"
3190 fi
3191
3192 if test "x$have_good_geoip" = "xyes" ; then
3193         geoip_message="yes"
3194 else
3195         geoip_message="no"
3196 fi
3197
3198 echo ""
3199 echo "The Wireshark package has been configured with the following options."
3200 echo "                    Build wireshark : $enable_wireshark_qt"
3201 echo "                Build wireshark-gtk : $have_gtk""$gtk_lib_message"
3202 echo "                       Build tshark : $enable_tshark"
3203 echo "                      Build tfshark : $enable_tfshark"
3204 echo "                     Build capinfos : $enable_capinfos"
3205 echo "                      Build captype : $enable_captype"
3206 echo "                      Build editcap : $enable_editcap"
3207 echo "                      Build dumpcap : $enable_dumpcap"
3208 echo "                     Build mergecap : $enable_mergecap"
3209 echo "                   Build reordercap : $enable_reordercap"
3210 echo "                    Build text2pcap : $enable_text2pcap"
3211 echo "                      Build randpkt : $enable_randpkt"
3212 echo "                       Build dftest : $enable_dftest"
3213 echo "                     Build rawshark : $enable_rawshark"
3214 echo "                        Build echld : $have_echld"
3215 echo ""
3216 echo "   Save files as pcap-ng by default : $enable_pcap_ng_default"
3217 echo "  Install dumpcap with capabilities : $setcap_message"
3218 echo "             Install dumpcap setuid : $setuid_message"
3219 echo "                  Use dumpcap group : $dumpcap_group_message"
3220 echo "                        Use plugins : $have_plugins"
3221 echo "       Use external capture sources : $have_extcap"
3222 echo "                    Use Lua library : $lua_message"
3223 echo "                   Build rtp_player : $portaudio_message"
3224 echo "             Build profile binaries : $enable_profile_build"
3225 echo "                   Use pcap library : $want_pcap"
3226 echo "                   Use zlib library : $zlib_message"
3227 echo "               Use kerberos library : $krb5_message"
3228 echo "                 Use c-ares library : $c_ares_message"
3229 echo "               Use GNU ADNS library : $adns_message"
3230 echo "                Use SMI MIB library : $libsmi_message"
3231 echo "             Use GNU crypto library : $gcrypt_message"
3232 echo "             Use SSL crypto library : $ssl_message"
3233 echo "           Use IPv6 name resolution : $enable_ipv6"
3234 echo "                 Use gnutls library : $tls_message"
3235 echo "     Use POSIX capabilities library : $libcap_message"
3236 echo "                  Use GeoIP library : $geoip_message"
3237 echo "                     Use nl library : $libnl_message"
3238 echo "              Use SBC codec library : $have_sbc"