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