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