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