Add automake support for Qt - use --with-qt as a configure script
[metze/wireshark/wip.git] / configure.in
1 # $Id$
2 #
3 AC_PREREQ(2.60)
4
5 AC_INIT(wireshark, 1.7.1)
6
7 dnl Check for CPU / vendor / OS
8 dnl The user is encouraged to use either `AC_CANONICAL_BUILD', or
9 dnl `AC_CANONICAL_HOST', or `AC_CANONICAL_TARGET', depending on the
10 dnl needs.  Using `AC_CANONICAL_TARGET' is enough to run the two other
11 dnl macros.
12 dnl
13 dnl As nothing in the Wireshark is itself a build tool (we are not,
14 dnl for example, a compiler that generates machine code), we probably
15 dnl don't need AC_CANONICAL_TARGET, so, in theory, we should be able
16 dnl to use AC_CANONICAL_BUILD and AC_CANONICAL_HOST - or perhaps just
17 dnl AC_CANONICAL_HOST - instead.  Note that we do have tools, such as
18 dnl lemon, that need to be built for the build machine, not for the
19 dnl host machine, so we might need both.
20 dnl
21 dnl This has to be done *after* AC_INIT, otherwise autogen.sh fails.
22
23 dnl AC_CANONICAL_BUILD
24 dnl AC_CANONICAL_HOST
25 AC_CANONICAL_TARGET
26
27 AM_INIT_AUTOMAKE([1.9 tar-ustar dist-bzip2 no-dist-gzip])
28
29 AM_DISABLE_STATIC
30
31 dnl Checks for programs.
32 AC_PROG_CC
33 AM_PROG_CC_C_O
34 AC_PROG_CXX
35 AC_PROG_CPP
36 dnl Work around libtool bug (fixed in the version 1.5a?)
37 AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
38 AC_LIBTOOL_DLOPEN
39 AC_PROG_LIBTOOL
40 AC_PATH_PROG(PERL, perl)
41 #
42 # XXX - should autogen.sh check for YACC/Bison and Flex?  A user building
43 # from a distribution tarball shouldn't have to have YACC/Bison or Flex,
44 # as the tarball should contain the results of running YACC/Bison on .y
45 # files and running Flex on .l files, but a user building from SVN
46 # will have to run YACC/Bison and Flex to process those files.
47 #
48 # On the other hand, what about users who use a distribution tarball to
49 # do development?  They *shouldn't* - that's what the SVN repository is
50 # for - but they might.  They'd get errors if they modify a .y or .l
51 # file and try to do a build - but the error should tell them that they
52 # need to get YACC/Bison and/or Flex.
53 #
54 # Then again, getting them shouldn't be too big of a burden.
55 #
56 # XXX - is the same true of pod2man and pod2html, or are they needed
57 # even when building from a distribution tarball?
58 #
59 #
60 AC_PROG_YACC
61 AC_PATH_PROG(YACCDUMMY, $YACC)
62 if test "x$YACCDUMMY" = x
63 then
64         AC_MSG_ERROR(I couldn't find yacc (or bison or ...); make sure it's installed and in your path)
65 fi
66 AM_PROG_LEX
67 AC_PATH_PROG(LEX, flex)
68 if test "x$LEX" = x
69 then
70         AC_MSG_ERROR(I couldn't find flex; make sure it's installed and in your path)
71 fi
72 AC_PATH_PROG(POD2MAN, pod2man)
73 if test "x$POD2MAN" = x
74 then
75         #
76         # The alternative is not to build the man pages....
77         #
78         AC_MSG_ERROR(I couldn't find pod2man; make sure it's installed and in your path)
79 fi
80 AC_PATH_PROG(POD2HTML, pod2html)
81 if test "x$POD2HTML" = x
82 then
83         #
84         # The alternative is not to build the HTML man pages....
85         #
86         AC_MSG_ERROR(I couldn't find pod2html; make sure it's installed and in your path)
87 fi
88
89 #
90 # XXX - this looks for various HTML viewers on the host, not the target;
91 # we really want to know what's available on the target, for cross-builds.
92 # That would probably require us to, at run time, look for xdg-open and,
93 # if we don't find it, look for mozilla, htmlview, etc.
94 #
95 AC_PATH_PROG(HTML_VIEWER, xdg-open)
96 if test "x$HTML_VIEWER" != x
97 then
98         #
99         # XXX - the HTML_VIEWER shell variable is the full path of xdg-open.
100         # Define some variable to be that, so we just run that?
101         #
102         AC_DEFINE(HAVE_XDG_OPEN, 1, [Define if we have xdg-open])
103
104         #
105         # XXX - we have to define HTML_VIEWER for the prefs.c code that
106         # sets the default value of the Web browser preference, even
107         # though that preference won't be offered.
108         #
109         AC_DEFINE_UNQUOTED(HTML_VIEWER, "xdg-open", [HTML viewer, e.g. mozilla])
110 else
111         AC_PATH_PROG(HTML_VIEWER, htmlview)
112         if test "x$HTML_VIEWER" = x
113         then
114                 AC_DEFINE_UNQUOTED(HTML_VIEWER, "mozilla", [HTML viewer, e.g. mozilla])
115         else
116                 AC_DEFINE_UNQUOTED(HTML_VIEWER, "htmlview", [HTML viewer, e.g. mozilla])
117         fi
118 fi
119
120 AC_PATH_PROG(PYTHON, python)
121
122 AC_SUBST(PERL)
123 AC_SUBST(LEX)
124 AC_SUBST(POD2MAN)
125 AC_SUBST(POD2HTML)
126 AC_SUBST(PYTHON)
127 AC_SUBST(XSLTPROC)
128 AC_SUBST(XMLLINT)
129
130 #
131 # Set "ac_supports_gcc_flags" if the compiler is known to support GCC-style
132 # flags such as -pedantic, -W warning flags and -f feature flags.  Currently,
133 # we assume GCC and clang do; other compilers should be added here.
134 #
135 # This is done to avoid getting tripped up by compilers that support
136 # those flags but give them a different meaning.
137 #
138 if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
139         ac_supports_gcc_flags=yes
140 fi
141
142 #
143 # Set "ac_supports_W_linker_passthrough" if the compiler is known to
144 # support "-Wl,{options}" to pass options through to the linker.
145 # Currently, we assume GCC, xlc, and clang do; other compilers should
146 # be added here.
147 #
148 if test "x$GCC" = "xyes" -o "x$CC" = "xxlc" -o "x$CC" = "xclang" ; then
149         ac_supports_W_linker_passthrough=yes
150 fi
151
152 #
153 # Set "ac_supports_attribute_unused" if the compiler is known to
154 # support "__attribute__(unused)".
155 # Currently, we assume GCC and clang do; other compilers should
156 # be added here.
157 #
158 # XXX - do this with a compiler test?
159 #
160 if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
161         ac_supports_W_linker_passthrough=yes
162 fi
163
164 if test "x$CC_FOR_BUILD" = x
165 then
166        CC_FOR_BUILD=$CC
167 fi
168 AC_SUBST(CC_FOR_BUILD)
169
170 # Check for doxygen
171 AC_PATH_PROG(DOXYGEN, doxygen)
172 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, "yes", "no")
173 AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
174
175 #
176 # Try to arrange for large file support.
177 #
178 AC_SYS_LARGEFILE
179
180 # GnuTLS
181 tls_message="no"
182 AC_ARG_WITH([gnutls],
183   AC_HELP_STRING( [--with-gnutls=@<:@yes/no@:>@],
184                   [use GnuTLS library @<:@default=yes@:>@]),
185   with_gnutls="$withval", with_gnutls="yes")
186 if test "x$with_gnutls" = "xyes"; then
187   PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0],
188         [
189                 echo "GnuTLS found, enabling SSL decryption"
190                 AC_DEFINE(HAVE_LIBGNUTLS, 1, [Define to use GnuTLS library])
191                 tls_message="yes"
192         ]
193         , [
194                 echo "GnuTLS not found, disabling SSL decryption"
195                 tls_message="no"
196         ]
197   )
198 fi
199
200 # libgrypt
201 gcrypt_message="no"
202 AC_ARG_WITH([gcrypt],
203   AC_HELP_STRING( [--with-gcrypt=@<:@yes/no@:>@],
204                   [use gcrypt library @<:@default=yes@:>@]),
205   with_gcrypt="$withval", with_gcrypt="yes")
206 if test "x$with_gcrypt" = "xyes"; then
207   AM_PATH_LIBGCRYPT(1.1.92,
208         [
209                 echo "libgcrypt found, enabling ipsec decryption"
210                 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt])
211                 gcrypt_message="yes"
212         ]
213         , [
214                 if test x$libgcrypt_config_prefix != x ; then
215                         AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]])
216                 else
217                         echo "libgcrypt not found, disabling ipsec decryption"
218                         gcrypt_message="no"
219                 fi
220         ]
221   )
222 fi
223
224 AC_ARG_WITH([qt],
225   AC_HELP_STRING( [--with-qt=@<:@yes/no@:>@],
226                   [use Qt instead of GTK+ @<:@default=no@:>@]),
227   with_qt="$withval", with_qt="no")
228
229 AC_ARG_WITH([gtk3],
230   AC_HELP_STRING( [--with-gtk3=@<:@yes/no@:>@],
231                   [use GTK+ 3.0 instead of 2.0 @<:@default=no@:>@]),
232   with_gtk3="$withval", with_gtk3="no")
233
234 # libsmi
235 # FIXME: currently the path argument to with-libsmi is being ignored
236 AX_LIBSMI
237
238 # Check for xsltproc
239 AC_PATH_PROG(XSLTPROC, xsltproc)
240 AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, "yes", "no")
241 AM_CONDITIONAL(HAVE_XSLTPROC, test x$HAVE_XSLTPROC = xyes)
242
243 # Check for xmllint
244 AC_PATH_PROG(XMLLINT, xmllint)
245 AC_CHECK_PROG(HAVE_XMLLINT, xmllint, "yes", "no")
246 AM_CONDITIONAL(HAVE_XMLLINT, test x$HAVE_XMLLINT = xyes)
247
248 # Check for fop (translate .fo to e.g. pdf)
249 AC_PATH_PROG(FOP, fop)
250 AC_CHECK_PROG(HAVE_FOP, fop, "yes", "no")
251 AM_CONDITIONAL(HAVE_FOP, test x$HAVE_FOP = xyes)
252
253 #
254 # Look for something to convert HTML to text (for docbook/)
255 #
256 AC_PATH_PROG(ELINKS, elinks)
257 AC_CHECK_PROG(HAVE_ELINKS, elinks, "yes", "no")
258 AM_CONDITIONAL(HAVE_ELINKS, test x$HAVE_ELINKS = xyes)
259
260 ## links: Fails as used in docbook/Makefile.am
261 ## (Rather than fixing things we'll just disable the use of links).
262 ##AC_PATH_PROG(LINKS, links)
263 ##AC_CHECK_PROG(HAVE_LINKS, links, "yes", "no")
264 ##AM_CONDITIONAL(HAVE_LINKS, test x$HAVE_LINKS = xyes)
265
266 AC_PATH_PROG(LYNX, lynx)
267 AC_CHECK_PROG(HAVE_LYNX, lynx, "yes", "no")
268 AM_CONDITIONAL(HAVE_LYNX, test x$HAVE_LYNX = xyes)
269
270
271 # Check for hhc (html help compiler)
272 AC_PATH_PROG(HHC, hhc.exe)
273 AC_CHECK_PROG(HAVE_HHC, hhc.exe, "yes", "no")
274 AM_CONDITIONAL(HAVE_HHC, test x$HAVE_HHC = xyes)
275
276 # Check for packaging utilities
277 # For now, we check to see if the various packaging utilites are in our
278 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
279
280 # SVR4/Solaris
281 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
282 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
283 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
284
285 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
286      -a x$HAVE_PKGTRANS = xyes ; then
287   HAVE_SVR4_PACKAGING=yes
288 else
289   HAVE_SVR4_PACKAGING=no
290 fi
291 AC_SUBST(HAVE_SVR4_PACKAGING)
292
293 # RPM
294 AC_WIRESHARK_RPM_CHECK
295 AC_SUBST(HAVE_RPM)
296
297 # Debian
298 AC_CHECK_PROG(HAVE_DPKG_BUILDPACKAGE, dpkg-buildpackage, "yes", "no")
299
300 # Mac OS X
301 AC_CHECK_PROG(HAVE_XCODEBUILD, xcodebuild, "yes", "no")
302 AC_CHECK_PROG(HAVE_HDIUTIL, hdiutil, "yes", "no")
303 AC_CHECK_PROG(HAVE_BLESS, bless, "yes", "no")
304
305 if test x$HAVE_XCODEBUILD = xyes -a x$HAVE_HDIUTIL = xyes \
306      -a x$HAVE_BLESS = xyes ; then
307   HAVE_OSX_PACKAGING=yes
308 else
309   HAVE_OSX_PACKAGING=no
310 fi
311 AC_SUBST(HAVE_OSX_PACKAGING)
312
313 #
314 # Try to add some additional gcc checks to CFLAGS
315 #
316 AC_ARG_ENABLE(extra-gcc-checks,
317   AC_HELP_STRING( [--enable-extra-gcc-checks],
318                   [do additional -W checks in GCC @<:@default=no@:>@]),
319 [
320         wireshark_extra_gcc_flags=$enableval
321         if test $enableval != no
322         then
323                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-pedantic)
324                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Woverflow)
325                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wlogical-op)
326                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-overlength-strings)
327 #               AC_WIRESHARK_GCC_CFLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4)
328 #               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunreachable-code)
329 #               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunsafe-loop-optimizations)
330                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-long-long)
331                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast, C)
332                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-qual)
333                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Waddress)
334                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds)
335                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wattributes)
336                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdiv-by-zero)
337                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wignored-qualifiers)
338                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpragmas)
339                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wredundant-decls)
340                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wvla)
341                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wc++-compat, C)
342                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wjump-misses-init, C)
343                 #
344                 # epan/dissectors/packet-ncp2222.inc blocks this one
345                 # for now.
346                 #
347                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings)
348                 #
349                 # GLib blocks this for now.
350                 #
351                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes)
352                 #
353                 # All the registration functions block these for now.
354                 #
355                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-prototypes)
356                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations)
357                 #
358                 # epan/dissectors/packet-afs.c blocks this one for now.
359                 #
360                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshadow)
361                 #
362                 # More cleanup needed for this on LP64.
363                 #
364                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshorten-64-to-32)
365         fi
366 ],)
367 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wall -W) # -W is now known as -Wextra
368 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wextra) # -W is now known as -Wextra
369 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdeclaration-after-statement, C)
370 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wendif-labels)
371 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpointer-arith)
372 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-pointer-sign, C)
373 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds)
374 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
375 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wformat-security)
376 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wold-style-definition, C)
377 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-error=unused-but-set-variable)    ##  for now
378 #
379 # Use the faster pre gcc 4.5 floating point precision if available;
380 # clang doesn't error out on -f options that it doesn't know about,
381 # it just warns and ignores them, so this check doesn't cause us
382 # to omit -fexcess-precision=fast, which produces a pile of
383 # annoying warnings.
384 #
385 if test "x$CC" != "xclang" ; then
386   AC_WIRESHARK_GCC_CFLAGS_CHECK(-fexcess-precision=fast)
387 fi
388
389 AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--as-needed])
390 ###AC_WIRESHARK_LDFLAGS_CHECK([-Wl,-M])
391 ###AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--cref])
392 # AC_WIRESHARK_LDFLAGS_CHECK([-flto])
393 # AC_WIRESHARK_LDFLAGS_CHECK([-fwhopr])
394 # AC_WIRESHARK_LDFLAGS_CHECK([-fwhole-program])
395
396 #
397 # If we're running GCC or clang, add '-D_U_="__attribute__((unused))"' to
398 # CPPFLAGS as well, so we can use _U_ to flag unused function arguments and
399 # not get warnings about them. Otherwise, add '-D_U_=""', so that _U_ used
400 # to flag an unused function argument will compile with non-GCC, non-clang
401 # compilers.
402 #
403 # XXX - other compilers?
404 #
405 if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
406   CPPFLAGS="-D_U_=\"__attribute__((unused))\" $CPPFLAGS"
407 else
408   CPPFLAGS="-D_U_=\"\" $CPPFLAGS"
409 fi
410
411 # If we're running GCC or CLang, always use FORTIFY_SOURCE=2
412 # See: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
413 # Note: FORTIFY_SOURCE is only effective for gcc -O2 (and -O1 ?)
414 if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
415   CPPFLAGS="-D_FORTIFY_SOURCE=2 $CPPFLAGS"
416 fi
417
418 #
419 # If the compiler supports GCC-style flags, enable a barrier "stop on
420 # warning".
421 # This barrier is set for a very large part of the code. However, it is
422 # typically not set for "generated" code  (flex, ans2wrs, idl2wrs, ...)
423 #
424 warnings_as_errors_default="yes"
425 AC_MSG_CHECKING(whether we should treat compiler warnings as errors)
426 AC_ARG_ENABLE(warnings-as-errors,
427   AC_HELP_STRING( [--enable-warnings-as-errors],
428                   [treat warnings as errors (only for GCC or clang) @<:@default=yes@:>@]),
429 [
430   if test "x$ac_supports_gcc_flags" = "xyes" -a "x$enableval" = "xyes" -a "x$wireshark_extra_gcc_flags" != "xyes"; then
431     with_warnings_as_errors="yes"
432     AC_MSG_RESULT(yes)
433   else
434     with_warnings_as_errors="no"
435     AC_MSG_RESULT(no)
436   fi
437 ],
438   if test "x$ac_supports_gcc_flags" = "xyes" -a "x$wireshark_extra_gcc_flags" = "x" -a "x$warnings_as_errors_default" = "xyes"; then
439     with_warnings_as_errors="yes"
440     AC_MSG_RESULT(yes)
441   else
442     with_warnings_as_errors="no"
443     AC_MSG_RESULT(no)
444   fi
445 )
446 AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$with_warnings_as_errors" = "xyes")
447
448 #
449 # Add any platform-specific compiler flags needed.
450 #
451 AC_MSG_CHECKING(for platform-specific compiler flags)
452 if test "x$GCC" = "xyes" ; then
453         #
454         # GCC - do any platform-specific tweaking necessary.
455         #
456         case "$host_os" in
457         solaris*)
458                 # the X11 headers don't automatically include prototype info
459                 # and a lot don't include the return type
460                 CPPFLAGS="$CPPFLAGS -DFUNCPROTO=15"
461                 CFLAGS="$CFLAGS -Wno-return-type"
462                 CXXFLAGS="$CXXFLAGS -Wno-return-type"
463                 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
464                 ;;
465         darwin*)
466                 #
467                 # See comments above about Apple's lovely C compiler.
468                 #
469                 # NOTE: to AC_PROG_CC, "GCC" means "any compiler that
470                 # defines __GNUC__"; clang defines __GNUC__, so that
471                 # means we think clang is GCC.
472                 #
473                 # clang whines about -no-cpp-precomp being unused
474                 # so we check whether this is really clang, and
475                 # only add -no-cpp-precomp if it's not.
476                 #
477                 if test "x$CC" != "xclang" ; then
478                         CFLAGS="-no-cpp-precomp $CFLAGS"
479                         AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
480                 else
481                         #
482                         # Clang, clang, clang went the trolley....
483                         #
484                         AC_MSG_RESULT(none needed)
485                 fi
486                 ;;
487         *)
488                 AC_MSG_RESULT(none needed)
489                 ;;
490         esac
491 else
492         #
493         # Not GCC - assume it's the vendor's compiler.
494         #
495         case "$host_os" in
496         hpux*)
497                 #
498                 # HP's ANSI C compiler; flags suggested by Jost Martin.
499                 # "-Ae" for ANSI C plus extensions such as "long long".
500                 # "+O2", for optimization.  XXX - works with "-g"?
501                 #
502                 # HP's ANSI C++ compiler doesn't support "-Ae", but
503                 # does support "+O2", at least according to the
504                 # documentation I can find online.
505                 #
506                 CFLAGS="-Ae +O2 $CFLAGS"
507                 CXXFLAGS="+O2 $CFLAGS"
508                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
509                 ;;
510         darwin*)
511                 #
512                 # It may be called "cc", but it's really a GCC derivative
513                 # with a problematic special precompiler and precompiled
514                 # headers; turn off the special precompiler, as some
515                 # apparently-legal code won't compile with its precompiled
516                 # headers.
517                 #
518                 # On the other hand, if it's called "clang", it's not a
519                 # GCC derivative, and it whines if you pass it
520                 # -no-cpp-precomp.
521                 #
522                 # XXX - is there any version of autoconf we support
523                 # where it uses another way to decide if the compiler
524                 # is GCC or not?
525                 #
526                 if test "x$CC" != "xclang" ; then
527                         CFLAGS="-no-cpp-precomp $CFLAGS"
528                         AC_MSG_RESULT(Apple CC - added -no-cpp-precomp)
529                 else
530                         #
531                         # Clang, clang, clang went the trolley....
532                         #
533                         AC_MSG_RESULT(none needed)
534                 fi
535                 ;;
536         *)
537                 AC_MSG_RESULT(none needed)
538                 ;;
539         esac
540 fi
541
542 #
543 # Add any platform-specific linker flags needed.
544 #
545 AC_MSG_CHECKING(for platform-specific linker flags)
546 case "$host_os" in
547 darwin*)
548         #
549         # Add -Wl,-single_module to the LDFLAGS used with shared
550         # libraries, to fix some error that show up in some cases;
551         # some Apple documentation recommends it for most shared
552         # libraries.
553         #
554         LDFLAGS_SHAREDLIB="-Wl,-single_module"
555         #
556         # Add -Wl,-search_paths_first to make sure that if we search
557         # directories A and B, in that order, for a given library, a
558         # non-shared version in directory A, rather than a shared
559         # version in directory B, is chosen (so we can use
560         # --with-pcap=/usr/local to force all programs to be linked
561         # with a static version installed in /usr/local/lib rather than
562         # the system version in /usr/lib).
563         #
564         LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
565         AC_MSG_RESULT([Apple linker - added -Wl,-single_module and -Wl,-search_paths_first])
566         ;;
567 cygwin*)
568         #
569         # Shared libraries in cygwin/Win32 must never contain
570         # undefined symbols.
571         #
572         LDFLAGS="$LDFLAGS -no-undefined"
573         AC_MSG_RESULT(CygWin GNU ld - added -no-undefined)
574         ;;
575 *)
576         AC_MSG_RESULT(none needed)
577         ;;
578 esac
579 AC_SUBST(LDFLAGS_SHAREDLIB)
580
581 # Control silent compiling
582 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
583
584 #
585 # On OS X, if we find the headers for Core Foundation, Launch Services,
586 # and Core Services, add -framework options to link with Application
587 # Services (of which Launch Services is a subframework), Core Foundation
588 # (required by the Launch Services APIs), and Core Services, so we can
589 # use them to launch a Web browser from the Help menu and to use
590 # Gestalt() to get the Mac OS X version number.
591 #
592 case "$host_os" in
593
594 darwin*)
595         AC_MSG_CHECKING([whether we can build with Core Foundation, Launch Services, and Core Services])
596         ac_save_LIBS="$LIBS"
597         ac_coreservices_frameworks="-framework CoreServices"
598         ac_launchservices_frameworks="-framework ApplicationServices -framework CoreFoundation $ac_coreservices_frameworks"
599         LIBS="$LIBS $ac_launchservices_frameworks $ac_coreservices_frameworks"
600         AC_TRY_LINK(
601            [
602 #       include <CoreFoundation/CFBase.h>
603 #       include <CoreFoundation/CFString.h>
604 #       include <CoreFoundation/CFURL.h>
605 #       include <ApplicationServices/ApplicationServices.h>
606 #       include <CoreServices/CoreServices.h>
607            ],
608            [
609         CFStringRef url_CFString;
610         CFURLRef url_CFURL;
611         OSStatus status;
612         long os_version;
613
614         url_CFString = CFStringCreateWithCString(NULL, "", kCFStringEncodingASCII);
615         url_CFURL = CFURLCreateWithString(NULL, url_CFString, NULL);
616         status = LSOpenCFURLRef(url_CFURL, NULL);
617
618         Gestalt(gestaltSystemVersion, &os_version);
619            ],
620            ac_cv_can_use_osx_frameworks=yes,
621            ac_cv_can_use_osx_frameworks=no,
622            [echo $ac_n "cross compiling; assumed OK... $ac_c"])
623         if test "$ac_cv_can_use_osx_frameworks" = yes ; then
624                 AC_DEFINE(HAVE_OS_X_FRAMEWORKS, 1, [Define to 1 if you have OS X frameworks])
625                 CORESERVICES_FRAMEWORKS="$ac_coreservices_frameworks"
626                 LAUNCHSERVICES_FRAMEWORKS="$ac_launchservices_frameworks"
627                 AC_MSG_RESULT(yes)
628         else
629                 AC_MSG_RESULT(no)
630         fi
631         LIBS="$ac_save_LIBS"
632         ;;
633 esac
634 AC_SUBST(CORESERVICES_FRAMEWORKS)
635 AC_SUBST(LAUNCHSERVICES_FRAMEWORKS)
636
637 #
638 # If using $prefix we add "$prefix/include" to the include search path
639 # and "$prefix/lib" to the library search path.
640 #
641 if test "x$prefix" != "x" ; then
642         AC_MSG_CHECKING(whether to use $prefix for headers and libraries)
643         if test -d $prefix/include ; then
644                 AC_MSG_RESULT(yes)
645                 #
646                 # Arrange that we search for header files in "$prefix/include", as
647                 # various packages we use may have been installed under "$prefix/include".
648                 #
649                 CPPFLAGS="$CPPFLAGS -I$prefix/include"
650
651                 #
652                 # Arrange that we search for libraries in "$prefix/lib".
653                 #
654                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, $prefix/lib)
655         else
656                 AC_MSG_RESULT(no)
657         fi
658 fi
659
660 dnl Look in /usr/local for header files and libraries ?
661 dnl XXX FIXME don't include /usr/local if it is already in the system
662 dnl search path as this causes gcc 3.2 on Linux to complain about a change
663 dnl of the system search order for includes
664 AC_ARG_ENABLE(usr-local,
665   AC_HELP_STRING( [--enable-usr-local],
666                   [look for headers and libs in /usr/local tree @<:@default=yes@:>@]),
667     ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
668
669 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
670 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
671         if test -d "/usr/local"; then
672                 AC_MSG_RESULT(yes)
673                 #
674                 # Arrange that we search for header files in the source directory
675                 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
676                 # as various packages we use ("libpcap", "zlib", "adns")
677                 # may have been installed under "/usr/local/include".
678                 #
679                 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
680
681                 #
682                 # Arrange that we search for libraries in "/usr/local/lib".
683                 #
684                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, /usr/local/lib)
685         else
686                 AC_MSG_RESULT(no)
687         fi
688 else
689         AC_MSG_RESULT(no)
690 fi
691
692 #
693 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
694 # link directory.
695 #
696 case "$host_os" in
697   solaris*)
698     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
699     if test x$LD_LIBRARY_PATH != x ; then
700       LIBS="$LIBS -R$LD_LIBRARY_PATH"
701       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
702     else
703       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
704     fi
705   ;;
706 esac
707
708 #
709 # Check for versions of "sed" inadequate to handle, in libtool, a list
710 # of object files as large as the list in Wireshark.
711 #
712 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
713 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
714 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
715 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
716 # is the only "sed" that comes with Solaris that can handle Wireshark.
717 #
718 # Add any checks here that are necessary for other OSes.
719 #
720 AC_WIRESHARK_GNU_SED_CHECK
721 if test "$HAVE_GNU_SED" = no ; then
722         case "$host_os" in
723         solaris*)
724                 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
725                 case `which sed` in
726                         /bin/sed|/usr/bin/sed|/usr/ucb/sed)
727                         AC_MSG_RESULT(yes)
728                         AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
729                         ;;
730
731                         *)
732                         AC_MSG_RESULT(no)
733                         ;;
734                 esac
735                 ;;
736
737         *)
738                 :
739                 ;;
740         esac
741 fi
742
743 # Enable/disable wireshark
744
745 AC_ARG_ENABLE(wireshark,
746   AC_HELP_STRING( [--enable-wireshark],
747                   [build GTK+-based Wireshark @<:@default=yes, if GTK+ available@:>@]),
748     enable_wireshark=$enableval,enable_wireshark=yes)
749
750 AC_ARG_ENABLE(packet-editor,
751   AC_HELP_STRING( [--enable-packet-editor],
752                   [add support for packet editor in Wireshark @<:@default=no@:>@]),
753     enable_packet_editor=$enableval,enable_packet_editor=no)
754 if test x$enable_packet_editor = xyes; then
755         AC_DEFINE(WANT_PACKET_EDITOR, 1, [Support for packet editor])
756 fi
757
758 AC_ARG_ENABLE(profile-build,
759   AC_HELP_STRING( [--enable-profile-build],
760                   [build profile-ready binaries @<:@default=no@:>@]),
761     enable_profile_build=$enableval,enable_profile_build=no)
762 AM_CONDITIONAL(USE_PROFILE_BUILD, test x$enable_profile_build = xyes)
763 AC_MSG_CHECKING(if profile builds must be generated)
764 if test "x$enable_profile_build" = "xyes" ; then
765         if test "x$GCC" = "xyes" -o "x$CLANG" = "xyes" ; then
766                 AC_MSG_RESULT(yes)
767                 CFLAGS=" -pg $CFLAGS"
768                 CXXFLAGS=" -pg $CXXFLAGS"
769         else
770                 AC_MSG_RESULT(no)
771                 echo "Building profile binaries currently only supported for GCC and clang."
772         fi
773 else
774         AC_MSG_RESULT(no)
775 fi
776
777 # Create DATAFILE_DIR #define for config.h
778 datafiledir=$datadir/wireshark
779 datafiledir=`(
780     test "x$prefix" = xNONE && prefix=$ac_default_prefix
781     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
782     # Ugly hack, but I don't see how this problem can be solved
783     # properly that DATAFILE_DIR had a value starting with
784     # "${prefix}/" instead of e.g. "/usr/local/"
785     eval eval echo "$datafiledir"
786 )`
787 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$datafiledir", [Directory for data])
788
789 # Create DOC_DIR #define for config.h
790 docdir=`(
791     test "x$prefix" = xNONE && prefix=$ac_default_prefix
792     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
793     # Ugly hack, but I don't see how this problem can be solved
794     # properly that DOC_DIR had a value starting with
795     # "${prefix}/" instead of e.g. "/usr/local/"
796     eval eval echo "$docdir"
797 )`
798 AC_DEFINE_UNQUOTED(DOC_DIR, "$docdir", [Directory for docs])
799
800 # GTK+ and Qt checks; we require GTK+ 2.12 or later, and, for now,
801 # don't require any particular version of Qt (except perhaps by
802 # implication, as older versions might not support pkgconfig).
803 #
804 # We only do those if we're going to be building Wireshark;
805 # otherwise, we don't have any GUI to build, so we don't use
806 # GTK+ or Qt.
807 #
808 # We don't add $GTK_LIBS or $Qt_LIBS to LIBS, because we don't want to
809 # force all programs to be built with GTK+ or Qt.
810 #
811 if test "x$enable_wireshark" = "xyes"; then
812         if test "x$with_qt" = "xyes"; then
813                 PKG_CHECK_MODULES([Qt], [QtCore QtGui],
814                 [
815                         CFLAGS="$CFLAGS $Qt_CFLAGS"
816                         CXXFLAGS="$CXXFLAGS $Qt_CFLAGS"
817                         #
818                         # XXX - greasy hack to make ui/gtk/recent.c
819                         # compile.
820                         #
821                         CPPFLAGS="-DQT_GUI_LIB $CPPFLAGS"
822                         UI_LIBS='$(wireshark_QT_UI_LIBS)'
823                         have_qt=yes
824                 ],
825                 [
826                         AC_MSG_ERROR([Qt is not available])
827                 ])
828
829                 #
830                 # We don't know whether we have GTK+, but we
831                 # won't be using it, so it's as if we don't
832                 # have it.
833                 #
834                 have_gtk=no
835         else
836                 #
837                 # Not Qt - either GTK+ 3.x or 2.x.
838                 #
839                 if test "x$with_gtk3" = "xyes"; then
840                         AM_PATH_GTK_3_0(3.0.0,
841                         [
842                                 CFLAGS="$CFLAGS $GTK_CFLAGS"
843                                 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
844                                 have_gtk=yes
845                                 UI_LIBS='$(wireshark_GTK_UI_LIBS)'
846                                 AC_DEFINE(HAVE_GTK, 1,
847                                     [Define to 1 if compiling with GTK])
848                         ], have_gtk=no)
849
850                 else
851                         AM_PATH_GTK_2_0(2.12.0,
852                         [
853                                 CFLAGS="$CFLAGS $GTK_CFLAGS"
854                                 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
855                                 have_gtk=yes
856                                 UI_LIBS='$(wireshark_GTK_UI_LIBS)'
857                                 AC_DEFINE(HAVE_GTK, 1,
858                                     [Define to 1 if compiling with GTK])
859                         ], have_gtk=no)
860                 fi
861         fi
862 else
863         have_qt=no
864         have_gtk=no
865 fi
866 AC_SUBST(UI_LIBS)
867
868 # GLib checks; we require GLib 2.14 or later, and require gmodule
869 # support, as we need that for dynamically loading plugins.
870 # If we found GTK+, this doesn't add GLIB_CFLAGS to CFLAGS, because
871 # AM_PATH_GTK will add GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a
872 # superset of GLIB_CFLAGS.  If we didn't find GTK+, it does add
873 # GLIB_CFLAGS to CFLAGS.
874 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
875 # set when generating the Makefile, so we can make programs that require
876 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
877 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
878 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
879 # programs to be built with GLib.
880 #
881 if test "$have_gtk" = "no" ; then
882         #
883         # We don't have GTK+.
884         #
885         if test "$have_qt" = "yes" ; then
886                 #
887                 # However, we do have Qt, and thus will be building
888                 # Wireshark (if the user had explicitly disabled
889                 # Wireshark, we wouldn't have looked for Qt, so we
890                 # wouldn't think we had it, and thus wouldn't be here).
891                 #
892                 wireshark_bin="wireshark\$(EXEEXT)"
893                 wireshark_man="wireshark.1"
894                 wireshark_SUBDIRS="codecs ui/qt"
895         else
896                 #
897                 # We don't have Qt, either, which means we have no UI
898                 # toolkit.
899                 #
900                 # If they didn't explicitly say "--disable-wireshark",
901                 # fail (so that, unless they explicitly indicated that
902                 # they don't want Wireshark, we stop so they know they
903                 # won't be getting Wireshark unless they fix the GTK+/Qt
904                 # problem).
905                 #
906                 if test "x$enable_wireshark" = "xyes"; then
907                         if test "x$with_gtk3" = "xyes"; then
908                                 AC_MSG_ERROR([GTK+ 3.0 or later isn't available, so Wireshark can't be compiled])
909                         else
910                                 AC_MSG_ERROR([Neither Qt nor GTK+ 2.12 or later are available, so Wireshark can't be compiled])
911                         fi
912                 fi
913                 wireshark_bin=""
914                 wireshark_man=""
915         fi
916         # Use GLIB_CFLAGS
917         AM_PATH_GLIB_2_0(2.14.0,
918         [
919                 CFLAGS="$CFLAGS $GLIB_CFLAGS"
920                 CXXFLAGS="$CXXFLAGS $GLIB_CFLAGS"
921         ], AC_MSG_ERROR(GLib 2.14 or later distribution not found.), gthread gmodule)
922 else
923         #
924         # We have GTK+, and thus will be building Wireshark (if the user
925         # had explicitly disabled Wireshark, we wouldn't have looked for
926         # GTK+, so we wouldn't think we had it, and thus wouldn't be here).
927         #
928         wireshark_bin="wireshark\$(EXEEXT)"
929         wireshark_man="wireshark.1"
930         wireshark_SUBDIRS="codecs ui/gtk"
931         # Don't use GLIB_CFLAGS
932         AM_PATH_GLIB_2_0(2.14.0, , AC_MSG_ERROR(GLib 2.14 or later distribution not found.), gthread gmodule)
933
934         CPPFLAGS="-DGTK_DISABLE_SINGLE_INCLUDES $CPPFLAGS"
935         ## Define GTK_DISABLE_DEPRECATED only if GTK lt 3.2
936         ## GTK 3.2 deprecates GtkVBox & GtkHBox which are currently used extensively by Wireshark.
937         if test $gtk_config_major_version -eq 2 -o $gtk_config_minor_version -lt 2; then
938                 CPPFLAGS="-DGTK_DISABLE_DEPRECATED $CPPFLAGS"
939         fi
940         # CPPFLAGS="-DGDK_DISABLE_DEPRECATED $CPPFLAGS"
941         if test $gtk_config_major_version -eq 2 -a $gtk_config_minor_version -ge 20; then
942                 # Enable GSEAL when building with GTK > 2.20 and < 3.0
943                 # (Versions prior to 2.22 lacked some necessary accessors.)
944                 CPPFLAGS="-DGSEAL_ENABLE $CPPFLAGS"
945         fi
946 fi
947
948 # Error out if a glib header other than a "top level" header
949 #  (glib.h, glib-object.h, gio.h) or certain other headers( e.g.,gmodule.h)
950 #  is used.
951 CPPFLAGS="-DG_DISABLE_SINGLE_INCLUDES $CPPFLAGS"
952
953 # Error out on the usage of deprecated glib functions
954 CPPFLAGS="-DG_DISABLE_DEPRECATED $CPPFLAGS"
955
956 #
957 # Check whether GLib modules are supported, to determine whether we
958 # can support plugins.
959 #
960 AC_MSG_CHECKING(whether GLib supports loadable modules)
961 ac_save_CFLAGS="$CFLAGS"
962 ac_save_LIBS="$LIBS"
963 CFLAGS="$CFLAGS $GLIB_CFLAGS"
964 LIBS="$GLIB_LIBS $LIBS"
965 AC_TRY_RUN([
966 #include <glib.h>
967 #include <gmodule.h>
968 #include <stdio.h>
969 #include <stdlib.h>
970
971 int
972 main ()
973 {
974   if (g_module_supported())
975     return 0;   /* success */
976   else
977     return 1;   /* failure */
978 }
979 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
980    [echo $ac_n "cross compiling; assumed OK... $ac_c"
981     ac_cv_glib_supports_modules=yes])
982 CFLAGS="$ac_save_CFLAGS"
983 LIBS="$ac_save_LIBS"
984 if test "$ac_cv_glib_supports_modules" = yes ; then
985   AC_MSG_RESULT(yes)
986   have_plugins=yes
987 else
988   AC_MSG_RESULT(no)
989   have_plugins=no
990 fi
991
992 #
993 # If we have <dlfcn.h>, check whether we can use dladdr to find a
994 # filename (hopefully, a full pathname, but no guarantees) for
995 # the executable.
996 #
997 if test "$ac_cv_header_dlfcn_h" = "yes"
998 then
999         AC_MSG_CHECKING(whether dladdr can be used to find the pathname of an executable)
1000         ac_save_CFLAGS="$CFLAGS"
1001         ac_save_LIBS="$LIBS"
1002         CFLAGS="$CFLAGS $GLIB_CFLAGS"
1003         LIBS="$GLIB_LIBS $LIBS"
1004         AC_TRY_RUN([
1005 #define _GNU_SOURCE     /* required on Linux, sigh */
1006 #include <dlfcn.h>
1007
1008 int
1009 main(void)
1010 {
1011         Dl_info info;
1012
1013         if (!dladdr((void *)main, &info))
1014                 return 1;       /* failure */
1015         return 0;               /* assume success */
1016 }
1017 ], ac_cv_dladdr_finds_executable_path=yes, ac_cv_dladdr_finds_executable_path=no,
1018    [echo $ac_n "cross compiling; assumed OK... $ac_c"
1019     ac_cv_dladdr_finds_executable_path=yes])
1020         CFLAGS="$ac_save_CFLAGS"
1021         LIBS="$ac_save_LIBS"
1022         if test x$ac_cv_dladdr_finds_executable_path = xyes
1023         then
1024                 AC_DEFINE(DLADDR_FINDS_EXECUTABLE_PATH, 1, [Define if dladdr can be used to find the path of the executable])
1025         fi
1026         AC_MSG_RESULT($ac_cv_dladdr_finds_executable_path)
1027 fi
1028
1029 if test "x$have_gtk" = "xyes"
1030 then
1031     #
1032     # We have GTK+; do we want the OS X integration functions and,
1033     # if so, do we have them and, if so, which versions do we have,
1034     # the old Carbon-based ones or the new Cocoa-based ones?
1035     #
1036     AC_MSG_CHECKING(whether to use OS X integration functions)
1037
1038     AC_ARG_WITH(osx-integration,
1039       AC_HELP_STRING( [--with-osx-integration],
1040                       [use OS X integration functions @<:@default=yes, if available@:>@]),
1041     [
1042         if test $withval = no
1043         then
1044             want_osx_integration=no
1045         else
1046             want_osx_integration=yes
1047         fi
1048     ],[
1049         want_osx_integration=yes
1050     ])
1051     if test "x$want_osx_integration" = "xno"; then
1052         AC_MSG_RESULT(no)
1053     else
1054         AC_MSG_RESULT(yes)
1055         AC_WIRESHARK_OSX_INTEGRATION_CHECK
1056     fi
1057 fi
1058
1059 AC_SUBST(wireshark_bin)
1060 AC_SUBST(wireshark_man)
1061
1062
1063 # Enable/disable tshark
1064
1065 AC_ARG_ENABLE(tshark,
1066   AC_HELP_STRING( [--enable-tshark],
1067                   [build TShark @<:@default=yes@:>@]),
1068     tshark=$enableval,enable_tshark=yes)
1069
1070 if test "x$enable_tshark" = "xyes" ; then
1071         tshark_bin="tshark\$(EXEEXT)"
1072         tshark_man="tshark.1"
1073         wiresharkfilter_man="wireshark-filter.4"
1074 else
1075         tshark_bin=""
1076         tshark_man=""
1077 fi
1078 AC_SUBST(tshark_bin)
1079 AC_SUBST(tshark_man)
1080 AC_SUBST(wiresharkfilter_man)
1081
1082
1083
1084 # Enable/disable editcap
1085
1086 AC_ARG_ENABLE(editcap,
1087   AC_HELP_STRING( [--enable-editcap],
1088                   [build editcap @<:@default=yes@:>@]),
1089     enable_editcap=$enableval,enable_editcap=yes)
1090
1091 if test "x$enable_editcap" = "xyes" ; then
1092         editcap_bin="editcap\$(EXEEXT)"
1093         editcap_man="editcap.1"
1094 else
1095         editcap_bin=""
1096         editcap_man=""
1097 fi
1098 AC_SUBST(editcap_bin)
1099 AC_SUBST(editcap_man)
1100
1101 # Enabling/disabling of dumpcap is done later (after we know if we have PCAP
1102 # or not)
1103
1104 # Enable/disable capinfos
1105
1106 AC_ARG_ENABLE(capinfos,
1107   AC_HELP_STRING( [--enable-capinfos],
1108                   [build capinfos @<:@default=yes@:>@]),
1109     enable_capinfos=$enableval,enable_capinfos=yes)
1110
1111 if test "x$enable_capinfos" = "xyes" ; then
1112         capinfos_bin="capinfos\$(EXEEXT)"
1113         capinfos_man="capinfos.1"
1114 else
1115         capinfos_bin=""
1116         capinfos_man=""
1117 fi
1118 AC_SUBST(capinfos_bin)
1119 AC_SUBST(capinfos_man)
1120
1121
1122 # Enable/disable mergecap
1123
1124 AC_ARG_ENABLE(mergecap,
1125   AC_HELP_STRING( [--enable-mergecap],
1126                   [build mergecap @<:@default=yes@:>@]),
1127     enable_mergecap=$enableval,enable_mergecap=yes)
1128
1129 if test "x$enable_mergecap" = "xyes" ; then
1130         mergecap_bin="mergecap\$(EXEEXT)"
1131         mergecap_man="mergecap.1"
1132 else
1133         mergecap_bin=""
1134         mergecap_man=""
1135 fi
1136 AC_SUBST(mergecap_bin)
1137 AC_SUBST(mergecap_man)
1138
1139
1140 # Enable/disable text2pcap
1141
1142 AC_ARG_ENABLE(text2pcap,
1143   AC_HELP_STRING( [--enable-text2pcap],
1144                   [build text2pcap @<:@default=yes@:>@]),
1145     text2pcap=$enableval,enable_text2pcap=yes)
1146
1147 if test "x$enable_text2pcap" = "xyes" ; then
1148         text2pcap_bin="text2pcap\$(EXEEXT)"
1149         text2pcap_man="text2pcap.1"
1150 else
1151         text2pcap_bin=""
1152         text2pcap_man=""
1153 fi
1154 AC_SUBST(text2pcap_bin)
1155 AC_SUBST(text2pcap_man)
1156
1157
1158 # Enable/disable dftest
1159
1160 AC_ARG_ENABLE(dftest,
1161   AC_HELP_STRING( [--enable-dftest],
1162                   [build dftest @<:@default=yes@:>@]),
1163     enable_dftest=$enableval,enable_dftest=yes)
1164
1165 if test "x$enable_dftest" = "xyes" ; then
1166         dftest_bin="dftest\$(EXEEXT)"
1167         dftest_man="dftest.1"
1168 else
1169         dftest_bin=""
1170         dftest_man=""
1171 fi
1172 AC_SUBST(dftest_bin)
1173 AC_SUBST(dftest_man)
1174
1175
1176 # Enable/disable randpkt
1177
1178 AC_ARG_ENABLE(randpkt,
1179   AC_HELP_STRING( [--enable-randpkt],
1180                   [build randpkt @<:@default=yes@:>@]),
1181     enable_randpkt=$enableval,enable_randpkt=yes)
1182
1183 if test "x$enable_randpkt" = "xyes" ; then
1184         randpkt_bin="randpkt\$(EXEEXT)"
1185         randpkt_man="randpkt.1"
1186 else
1187         randpkt_bin=""
1188         randpkt_man=""
1189 fi
1190 AC_SUBST(randpkt_bin)
1191 AC_SUBST(randpkt_man)
1192
1193
1194
1195 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
1196 dnl "gethostbyname()".
1197 AC_WIRESHARK_GETHOSTBY_LIB_CHECK
1198
1199 dnl Checks for "connect()", used as a proxy for "socket()" - and
1200 dnl "-lsocket", if we need it to get "connect()".
1201 AC_WIRESHARK_SOCKET_LIB_CHECK
1202
1203 dnl pcap check
1204 AC_MSG_CHECKING(whether to use libpcap for packet capture)
1205
1206 AC_ARG_WITH(pcap,
1207   AC_HELP_STRING( [--with-pcap@<:@=DIR@:>@],
1208                   [use libpcap for packet capturing @<:@default=yes@:>@]),
1209 [
1210         if test $withval = no
1211         then
1212                 want_pcap=no
1213         elif test $withval = yes
1214         then
1215                 want_pcap=yes
1216         else
1217                 want_pcap=yes
1218                 pcap_dir=$withval
1219         fi
1220 ],[
1221         want_pcap=yes
1222         pcap_dir=
1223 ])
1224 if test "x$want_pcap" = "xno" ; then
1225         AC_MSG_RESULT(no)
1226 else
1227         AC_MSG_RESULT(yes)
1228         AC_WIRESHARK_PCAP_CHECK
1229 fi
1230
1231 # Enable/disable dumpcap
1232
1233 dnl dumpcap check
1234 AC_MSG_CHECKING(whether to build dumpcap)
1235
1236 AC_ARG_ENABLE(dumpcap,
1237   AC_HELP_STRING( [--enable-dumpcap],
1238                   [build dumpcap @<:@default=yes@:>@]),
1239     enable_dumpcap=$enableval,enable_dumpcap=yes)
1240
1241 if test "x$enable_dumpcap" = "xyes" ; then
1242         if test "x$want_pcap" = "xno" ; then
1243                 enable_dumpcap=no
1244                 AC_MSG_RESULT(pcap not available - disabling dumpcap)
1245         else
1246                 AC_MSG_RESULT(yes)
1247         fi
1248 else
1249         AC_MSG_RESULT(no)
1250 fi
1251
1252 if test "x$enable_dumpcap" = "xyes" ; then
1253         dumpcap_bin="dumpcap\$(EXEEXT)"
1254         dumpcap_man="dumpcap.1"
1255 else
1256         dumpcap_bin=""
1257         dumpcap_man=""
1258 fi
1259 AC_SUBST(dumpcap_bin)
1260 AC_SUBST(dumpcap_man)
1261
1262 # Enable/disable rawshark
1263
1264 dnl rawshark check
1265 AC_MSG_CHECKING(whether to build rawshark)
1266
1267 AC_ARG_ENABLE(rawshark,
1268   AC_HELP_STRING( [--enable-rawshark],
1269                   [build rawshark @<:@default=yes@:>@]),
1270     rawshark=$enableval,enable_rawshark=yes)
1271
1272 if test "x$enable_rawshark" = "xyes" ; then
1273         if test "x$want_pcap" = "xno" ; then
1274                 enable_rawshark=no
1275                 AC_MSG_RESULT(pcap not available - disabling rawshark)
1276         else
1277                 AC_MSG_RESULT(yes)
1278         fi
1279 else
1280         AC_MSG_RESULT(no)
1281 fi
1282
1283 if test "x$enable_rawshark" = "xyes" ; then
1284         rawshark_bin="rawshark\$(EXEEXT)"
1285         rawshark_man="rawshark.1"
1286 else
1287         rawshark_bin=""
1288         rawshark_man=""
1289 fi
1290 AC_SUBST(rawshark_bin)
1291 AC_SUBST(rawshark_man)
1292
1293 dnl Use pcap-ng by default
1294 AC_ARG_ENABLE(pcap-ng-default,
1295   AC_HELP_STRING( [--enable-pcap-ng-default],
1296                   [use the pcap-ng file format by default instead of pcap @<:@default=yes@:>@]),
1297     enable_pcap_ng_default=$enableval,enable_pcap_ng_default=yes)
1298 if test x$enable_pcap_ng_default = xyes; then
1299         AC_DEFINE(PCAP_NG_DEFAULT, 1, [Support for pcap-ng])
1300 fi
1301
1302 dnl pcap remote check
1303 AC_MSG_CHECKING(whether to use libpcap remote capturing feature)
1304
1305 AC_ARG_WITH(pcap-remote,
1306     AC_HELP_STRING([--with-pcap-remote],
1307                    [use libpcap remote capturing (requires libpcap)]),
1308 [
1309     if test $withval = no
1310     then
1311         want_pcap_remote=no
1312     else
1313         want_pcap_remote=yes
1314     fi
1315 ],[
1316     want_pcap_remote=no
1317 ])
1318 if test "x$want_pcap_remote" = "xno" -o "x$want_pcap" = "xno" ; then
1319     AC_MSG_RESULT(no)
1320 else
1321     AC_MSG_RESULT(yes)
1322     AC_WIRESHARK_PCAP_REMOTE_CHECK
1323 fi
1324
1325 dnl zlib check
1326 AC_MSG_CHECKING(whether to use zlib for gzip compression and decompression)
1327
1328 AC_ARG_WITH(zlib,
1329   AC_HELP_STRING([--with-zlib@<:@=DIR@:>@],
1330                  [use zlib (located in directory DIR, if supplied) for gzip compression and decompression @<:@default=yes, if available@:>@]),
1331 [
1332         if test "x$withval" = "xno"
1333         then
1334                 want_zlib=no
1335         elif test "x$withval" = "xyes"
1336         then
1337                 want_zlib=yes
1338         else
1339                 want_zlib=yes
1340                 zlib_dir="$withval"
1341         fi
1342 ],[
1343         #
1344         # Use zlib if it's present, otherwise don't.
1345         #
1346         want_zlib=ifavailable
1347         zlib_dir=
1348 ])
1349 if test "x$want_zlib" = "xno" ; then
1350         AC_MSG_RESULT(no)
1351 else
1352         AC_MSG_RESULT(yes)
1353         AC_WIRESHARK_ZLIB_CHECK
1354         if test "x$want_zlib" = "xno" ; then
1355                 AC_MSG_RESULT(zlib not found - disabling gzip compression and decompression)
1356         else
1357                 if test "x$ac_cv_func_inflatePrime" = "xno" ; then
1358                         AC_MSG_RESULT(inflatePrime not found in zlib - disabling gzipped capture file support)
1359                 fi
1360         fi
1361 fi
1362
1363 dnl Lua check
1364 AC_MSG_CHECKING(whether to use liblua for the Lua scripting plugin)
1365
1366 AC_ARG_WITH(lua,
1367   AC_HELP_STRING( [--with-lua@<:@=DIR@:>@],
1368                   [use liblua (located in directory DIR, if supplied) for the Lua scripting plugin @<:@default=yes, if available@:>@]),
1369 [
1370         if test $withval = no
1371         then
1372                 want_lua=no
1373         elif test $withval = yes
1374         then
1375                 want_lua=yes
1376         else
1377                 want_lua=yes
1378                 lua_dir=$withval
1379         fi
1380 ],[
1381         #
1382         # Use liblua by default
1383         #
1384         want_lua=ifavailable
1385         lua_dir=
1386 ])
1387 if test "x$want_lua" = "xno" ; then
1388         AC_MSG_RESULT(no)
1389 else
1390         AC_MSG_RESULT(yes)
1391         AC_WIRESHARK_LIBLUA_CHECK
1392         if test "x$want_lua" = "xno" ; then
1393                 AC_MSG_RESULT(liblua not found - disabling support for the lua scripting plugin)
1394         fi
1395 fi
1396 AM_CONDITIONAL(HAVE_LIBLUA, test x$want_lua = xyes)
1397
1398
1399 dnl portaudio check
1400 AC_MSG_CHECKING(whether to use libportaudio for the rtp_player)
1401
1402 AC_ARG_WITH(portaudio,
1403   AC_HELP_STRING( [--with-portaudio@<:@=DIR@:>@],
1404                   [use libportaudio (located in directory DIR, if supplied) for the rtp_player @<:@default=yes, if available@:>@]),
1405 [
1406         if test $withval = no
1407         then
1408                 want_portaudio=no
1409         elif test $withval = yes
1410         then
1411                 want_portaudio=yes
1412         else
1413                 want_portaudio=yes
1414                 portaudio_dir=$withval
1415         fi
1416 ],[
1417         #
1418         # Use libportaudio by default
1419         #
1420         want_portaudio=ifavailable
1421         portaudio_dir=
1422 ])
1423 if test "x$want_portaudio" = "xno" ; then
1424         AC_MSG_RESULT(no)
1425 else
1426         AC_MSG_RESULT(yes)
1427         AC_WIRESHARK_LIBPORTAUDIO_CHECK
1428         if test "x$want_portaudio" = "xno" ; then
1429                 AC_MSG_RESULT(libportaudio not found - disabling support for the rtp_player)
1430         fi
1431 fi
1432 AM_CONDITIONAL(HAVE_LIBPORTAUDIO, test x$want_portaudio = xyes)
1433
1434
1435 dnl ipv6 check
1436 AC_ARG_ENABLE(ipv6,
1437   AC_HELP_STRING( [--enable-ipv6],
1438                   [use IPv6 name resolution, if available @<:@default=yes@:>@]),
1439     enable_ipv6=$enableval,enable_ipv6=yes)
1440
1441 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
1442 if test "x$enable_ipv6" = "xno" ; then
1443         AC_MSG_RESULT(no)
1444 else
1445         AC_MSG_RESULT(yes)
1446         AC_WIRESHARK_IPV6_STACK
1447 fi
1448
1449
1450 dnl Check if dumpcap should be installed with filesystem capabilities
1451 AC_PATH_PROG(SETCAP, setcap)
1452 AC_ARG_ENABLE(setcap-install,
1453   AC_HELP_STRING( [--enable-setcap-install],
1454                   [install dumpcap with cap_net_admin and cap_net_raw @<:@default=no@:>@]),
1455     enable_setcap_install=$enableval,enable_setcap_install=no)
1456
1457 AC_MSG_CHECKING(whether to install dumpcap with cap_net_admin and cap_net_raw capabilities)
1458 if test "x$enable_setcap_install" = "xno" ; then
1459         AC_MSG_RESULT(no)
1460 else
1461         if test "x$SETCAP" = "x" ; then
1462                 AC_MSG_RESULT(no. Setcap not found)
1463         elif test "x$enable_dumpcap" = "xno" ; then
1464                 AC_MSG_ERROR(Setcap install works only with dumpcap but dumpcap is disabled)
1465         else
1466                 AC_MSG_RESULT(yes)
1467         fi
1468 fi
1469
1470 AM_CONDITIONAL(SETCAP_INSTALL, test x$enable_setcap_install = xyes)
1471
1472 dnl Check if dumpcap should be installed setuid
1473 AC_ARG_ENABLE(setuid-install,
1474   AC_HELP_STRING( [--enable-setuid-install],
1475                   [install dumpcap as setuid @<:@default=no@:>@]),
1476     enable_setuid_install=$enableval,enable_setuid_install=no)
1477
1478 AC_MSG_CHECKING(whether to install dumpcap setuid)
1479 if test "x$enable_setuid_install" = "xno" ; then
1480         AC_MSG_RESULT(no)
1481 else
1482         if test "x$enable_setcap_install" = "xyes" ; then
1483                 enable_setuid_install=no
1484                 AC_MSG_RESULT(no; using setcap instead)
1485         elif test "x$enable_dumpcap" = "xno" ; then
1486                 AC_MSG_ERROR(Setuid install works only with dumpcap but dumpcap is disabled)
1487         else
1488                 AC_MSG_RESULT(yes)
1489         fi
1490 fi
1491
1492 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
1493 AC_CHECK_FUNCS(setresuid setresgid)
1494
1495 dnl ...but our Network Operations group is named "no"!
1496 DUMPCAP_GROUP=''
1497 AC_ARG_WITH(dumpcap-group,
1498   AC_HELP_STRING( [--with-dumpcap-group=GROUP],
1499                   [restrict dumpcap to GROUP]),
1500 [
1501   if test "x$withval" = "xyes"; then
1502       AC_MSG_ERROR([No dumpcap group specified.])
1503   elif test "x$withval" != "xno"; then
1504       if test "x$enable_dumpcap" = "xno" ; then
1505           AC_MSG_ERROR(dumpcap group install works only with dumpcap but dumpcap is disabled)
1506       fi
1507       AC_MSG_RESULT($withval)
1508       DUMPCAP_GROUP="$withval"
1509   fi
1510 ])
1511 AC_SUBST(DUMPCAP_GROUP)
1512 AM_CONDITIONAL(HAVE_DUMPCAP_GROUP, test x$DUMPCAP_GROUP != x)
1513
1514 dnl libcap (not libpcap) check
1515 LIBCAP_LIBS=''
1516 AC_MSG_CHECKING(whether to use the libcap capabilities library)
1517
1518 AC_ARG_WITH(libcap,
1519   AC_HELP_STRING( [--with-libcap@<:@=DIR@:>@],
1520                   [use libcap (located in directory DIR, if supplied) for POSIX.1e capabilities management @<:@default=yes, if present@:>@]),
1521 [
1522 if   test "x$withval" = "xno";  then
1523         want_libcap=no
1524 elif test "x$withval" = "xyes"; then
1525         want_libcap=yes
1526 elif test -d "$withval"; then
1527         want_libcap=yes
1528         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1529 fi
1530 ])
1531 if test "x$with_libcap" = "xno" ; then
1532         AC_MSG_RESULT(no)
1533 else
1534         AC_MSG_RESULT(yes)
1535         AC_WIRESHARK_LIBCAP_CHECK
1536 fi
1537 AC_SUBST(LIBCAP_LIBS)
1538
1539 dnl Checks for header files.
1540 AC_CHECK_HEADERS(direct.h dirent.h fcntl.h grp.h inttypes.h netdb.h pwd.h stdarg.h stddef.h unistd.h)
1541 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)
1542 AC_CHECK_HEADERS(netinet/in.h)
1543 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
1544
1545 dnl SSL Check
1546 SSL_LIBS=''
1547 AC_MSG_CHECKING(whether to use SSL library)
1548
1549 AC_ARG_WITH(ssl,
1550   AC_HELP_STRING( [--with-ssl@<:@=DIR@:>@],
1551                   [use SSL crypto library (located in directory DIR, if supplied) @<:@default=no@:>@]),
1552 [
1553 if test "x$withval" = "xno";  then
1554         want_ssl=no
1555 elif test "x$withval" = "xyes"; then
1556         want_ssl=yes
1557 elif test -d "$withval"; then
1558         want_ssl=yes
1559         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1560 fi
1561 ],[
1562         want_ssl=no
1563 ])
1564 if test "x$want_ssl" = "xyes"; then
1565         AC_MSG_RESULT(yes)
1566         AC_CHECK_LIB(crypto,EVP_md5,
1567             [
1568                 SSL_LIBS=-lcrypto
1569             ],
1570             [
1571                 AC_MSG_ERROR([SSL crypto library was requested, but is not available])
1572             ])
1573 else
1574         AC_MSG_RESULT(no)
1575 fi
1576 AC_SUBST(SSL_LIBS)
1577
1578 dnl kerberos check
1579 AC_MSG_CHECKING(whether to use Kerberos library)
1580
1581 AC_ARG_WITH(krb5,
1582   AC_HELP_STRING( [--with-krb5@<:@=DIR@:>@],
1583                   [use Kerberos library (located in directory DIR, if supplied) to use in Kerberos dissection @<:@default=yes@:>@]),
1584 [
1585         if test $withval = no
1586         then
1587                 want_krb5=no
1588         elif test $withval = yes
1589         then
1590                 want_krb5=yes
1591         else
1592                 want_krb5=yes
1593                 krb5_dir=$withval
1594         fi
1595 ],[
1596         #
1597         # Use Kerberos library if available, otherwise don't.
1598         #
1599         want_krb5=ifavailable
1600         krb5_dir=
1601 ])
1602 if test "x$want_krb5" = "xno" ; then
1603         AC_MSG_RESULT(no)
1604 else
1605         AC_MSG_RESULT(yes)
1606         AC_WIRESHARK_KRB5_CHECK
1607 fi
1608
1609
1610 dnl c-ares Check
1611 C_ARES_LIBS=''
1612 AC_MSG_CHECKING(whether to use the c-ares library if available)
1613
1614 AC_ARG_WITH(c-ares,
1615   AC_HELP_STRING( [--with-c-ares@<:@=DIR@:>@],
1616                   [use c-ares (located in directory DIR, if supplied) - supersedes --with-adns @<:@default=yes, if present@:>@]),
1617 [
1618 if   test "x$withval" = "xno";  then
1619         want_c_ares=no
1620 elif test "x$withval" = "xyes"; then
1621         want_c_ares=yes
1622 elif test -d "$withval"; then
1623         want_c_ares=yes
1624         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1625 fi
1626 ])
1627 if test "x$want_c_ares" = "xno" ; then
1628         AC_MSG_RESULT(no)
1629 else
1630         AC_MSG_RESULT(yes)
1631         AC_WIRESHARK_C_ARES_CHECK
1632 fi
1633 AC_SUBST(C_ARES_LIBS)
1634
1635 dnl ADNS Check
1636 ADNS_LIBS=''
1637 AC_MSG_CHECKING(whether to use the GNU ADNS library if available)
1638
1639 AC_ARG_WITH(adns,
1640   AC_HELP_STRING( [--with-adns@<:@=DIR@:>@],
1641                   [use GNU ADNS (located in directory DIR, if supplied) @<:@default=yes, if present@:>@]),
1642 [
1643 if   test "x$withval" = "xno";  then
1644         want_adns=no
1645 elif test "x$withval" = "xyes"; then
1646         want_adns=yes
1647 elif test -d "$withval"; then
1648         want_adns=yes
1649         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1650 fi
1651 ])
1652 if test "x$want_adns" = "xno" -o "x$have_good_c_ares" = "xyes" ; then
1653         AC_MSG_RESULT(no)
1654 else
1655         AC_MSG_RESULT(yes)
1656         AC_WIRESHARK_ADNS_CHECK
1657 fi
1658 AC_SUBST(ADNS_LIBS)
1659
1660 dnl GEOIP Check
1661 GEOIP_LIBS=''
1662 AC_MSG_CHECKING(whether to use the GeoIP IP address mapping library if available)
1663
1664 AC_ARG_WITH(geoip,
1665   AC_HELP_STRING( [--with-geoip@<:@=DIR@:>@],
1666                   [use GeoIP (located in directory DIR, if supplied) @<:@default=yes, if present@:>@]),
1667 [
1668 if   test "x$withval" = "xno";  then
1669         want_geoip=no
1670 elif test "x$withval" = "xyes"; then
1671         want_geoip=yes
1672 elif test -d "$withval"; then
1673         want_geoip=yes
1674         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1675 fi
1676 ])
1677 if test "x$want_geoip" = "xno"; then
1678         AC_MSG_RESULT(no)
1679 else
1680         AC_MSG_RESULT(yes)
1681         AC_WIRESHARK_GEOIP_CHECK
1682 fi
1683 AC_SUBST(GEOIP_LIBS)
1684
1685 dnl Python devel Check
1686 AC_MSG_CHECKING(whether to use the Python interpreter for scripting)
1687
1688 AC_ARG_WITH(python,
1689     AC_HELP_STRING( [--with-python@<:@=DIR@:>@],
1690                     [use Python interpreter (installed in DIR, if supplied) @<:@default=no@:>@ (EXPERIMENTAL)]),
1691 [
1692         pythondir='${libdir}/wireshark/python/${VERSION}'
1693         if test "x$withval" = "xno"
1694         then
1695                 want_python=no
1696         elif test "x$withval" = "xyes"
1697         then
1698                 want_python=yes
1699         else
1700                 want_python=yes
1701                 pythondir="$withval"
1702         fi
1703 ],[
1704         # By default (user didn't explicitly enable Python), don't enable
1705         # Python support.
1706         #
1707         want_python=no
1708         #pythondir='${libdir}/wireshark/python/${VERSION}'
1709 ])
1710 if test "x$want_python" = "xno" ; then
1711         AC_MSG_RESULT(no)
1712 else
1713         AC_MSG_RESULT(yes)
1714         AC_WIRESHARK_PYTHON_CHECK
1715 fi
1716 AM_CONDITIONAL(HAVE_LIBPY, test x$want_python != xno)
1717 AC_SUBST(pythondir)
1718
1719 #
1720 # Define WS_VAR_IMPORT appropriately for declarations of external
1721 # variables exported from dynamically-linked libraries.
1722 #
1723 AC_DEFINE(WS_VAR_IMPORT, extern, [Define as the string to precede external variable declarations in dynamically-linked libraries])
1724
1725 #
1726 # Define WS_MSVC_NORETURN appropriately for declarations of routines that
1727 # never return (just like Charlie on the MTA).
1728 #
1729 # Note that MSVC++ expects __declspec(noreturn) to precede the function
1730 # name and GCC, as far as I know, expects __attribute__((noreturn)) to
1731 # follow the function name, so we need two different flavors of
1732 # noreturn tag.
1733 #
1734 AC_DEFINE(WS_MSVC_NORETURN,, [Define as the string to precede declarations of routines that never return])
1735
1736 AC_ARG_ENABLE(airpcap,
1737   AC_HELP_STRING( [--enable-airpcap],
1738                   [use AirPcap in Wireshark @<:@default=no@:>@]),
1739   enable_airpcap=$enableval
1740   if test x$enable_airpcap != xno; then
1741         AC_DEFINE(HAVE_AIRPCAP, 1, [Enable AirPcap])
1742   fi
1743 )
1744
1745 dnl Checks for typedefs, structures, and compiler characteristics.
1746 # AC_C_CONST
1747
1748 # Check how we can get the time zone abbreviation
1749 AC_WIRESHARK_TIMEZONE_ABBREV
1750
1751 # We need to know whether "struct sockaddr" has an "sa_len" member
1752 # for get_interface_list().
1753
1754 AC_WIRESHARK_STRUCT_SA_LEN
1755
1756 # We must know our byte order
1757 AC_C_BIGENDIAN
1758
1759 # Checks whether "-traditional" is needed when using "ioctl".
1760 # XXX - do we need this?
1761 AC_PROG_GCC_TRADITIONAL
1762
1763 GETOPT_LO=""
1764 AC_CHECK_FUNC(getopt,
1765   [GETOPT_LO=""
1766    AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
1767   ],
1768   GETOPT_LO="wsgetopt.lo"
1769 )
1770 if test "$ac_cv_func_getopt" = no ; then
1771   GETOPT_LO="wsgetopt.lo"
1772 fi
1773 AM_CONDITIONAL(NEED_GETOPT_LO, test "x$ac_cv_func_getopt" = "xno")
1774 AC_SUBST(GETOPT_LO)
1775
1776 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="",
1777   STRNCASECMP_LO="strncasecmp.lo")
1778 if test "$ac_cv_func_strncasecmp" = no ; then
1779   STRNCASECMP_LO="strncasecmp.lo"
1780 fi
1781 AM_CONDITIONAL(NEED_STRNCASECMP_LO, test "x$ac_cv_func_strncasecmp" = "xno")
1782 AC_SUBST(STRNCASECMP_LO)
1783
1784 AC_CHECK_FUNCS(mkstemp mkdtemp)
1785
1786 AC_SEARCH_LIBS(inet_aton, [socket nsl], have_inet_aton=yes,
1787     have_inet_aton=no)
1788 if test "$have_inet_aton" = no; then
1789   INET_ATON_LO="inet_aton.lo"
1790   AC_DEFINE(NEED_INET_ATON_H, 1, [Define if inet/aton.h needs to be included])
1791 else
1792   INET_ATON_LO=""
1793 fi
1794 AM_CONDITIONAL(NEED_INET_ATON_LO, test "x$have_inet_aton" = "xno")
1795 AC_SUBST(INET_ATON_LO)
1796
1797 AC_SEARCH_LIBS(inet_pton, [socket nsl], [
1798   dnl check for pre-BIND82 inet_pton() bug.
1799   AC_MSG_CHECKING(for broken inet_pton)
1800   AC_TRY_RUN([#include <sys/types.h>
1801 #include <sys/socket.h>
1802 #include <netinet/in.h>
1803 #include <arpa/inet.h>
1804 int main()
1805 {
1806 #ifdef AF_INET6
1807   char buf[16];
1808   /* this should return 0 (error) */
1809   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
1810 #else
1811   return 1;
1812 #endif
1813 }], [AC_MSG_RESULT(ok);
1814 have_inet_pton=yes], [AC_MSG_RESULT(broken);
1815 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
1816 have_inet_pton=no])],
1817 have_inet_pton=no)
1818 if test "$have_inet_pton" = no; then
1819   INET_PTON_LO="inet_pton.lo"
1820 else
1821   INET_PTON_LO=""
1822 fi
1823 AM_CONDITIONAL(NEED_INET_PTON_LO, test "x$have_inet_pton" = "xno")
1824 AC_SUBST(INET_PTON_LO)
1825
1826 AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
1827   AC_MSG_CHECKING([for inet_ntop prototype])
1828   AC_TRY_COMPILE([#include <stdio.h>
1829 #include <sys/types.h>
1830 #include <sys/socket.h>
1831 #include <netinet/in.h>
1832 #include <arpa/inet.h>
1833
1834 extern const char *inet_ntop(int, const void *, char *, size_t);],, [
1835     AC_MSG_RESULT(yes)
1836     AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
1837     [Define if inet_ntop() prototype exists])], [
1838     AC_TRY_COMPILE([#include <stdio.h>
1839 #include <sys/types.h>
1840 #include <sys/socket.h>
1841 #include <netinet/in.h>
1842 #include <arpa/inet.h>
1843
1844 extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
1845       AC_MSG_RESULT(yes)
1846       AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
1847       [Define if inet_ntop() prototype exists])], [
1848       AC_MSG_RESULT(no)])])
1849   INET_NTOP_LO=""], [
1850   INET_NTOP_LO="inet_ntop.lo"
1851   AC_DEFINE(NEED_INET_V6DEFS_H, 1,
1852   [Define if inet/v6defs.h needs to be included])])
1853 AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x")
1854 AC_SUBST(INET_NTOP_LO)
1855
1856 AC_CHECK_FUNC(strptime, STRPTIME_LO="",
1857   [STRPTIME_LO="strptime.lo"
1858    AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
1859 ])
1860 if test "$ac_cv_func_strptime" = no ; then
1861   STRPTIME_LO="strptime.lo"
1862 fi
1863 AC_SUBST(STRPTIME_C)
1864 AM_CONDITIONAL(NEED_STRPTIME_LO, test "x$ac_cv_func_strptime" = "no")
1865 AC_SUBST(STRPTIME_LO)
1866
1867 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
1868 AC_CHECK_FUNCS(issetugid)
1869 AC_CHECK_FUNCS(mmap mprotect sysconf)
1870 AC_CHECK_FUNCS(strtoll)
1871
1872 dnl blank for now, but will be used in future
1873 AC_SUBST(wireshark_SUBDIRS)
1874
1875 dnl
1876 dnl check whether plugins should be enabled and, if they should be,
1877 dnl check for plugins directory - stolen from Amanda's configure.in
1878 dnl
1879 dnl we don't wish to expand ${libdir} yet
1880 plugindir='${libdir}/wireshark/plugins/${VERSION}'
1881 AC_ARG_WITH(plugins,
1882   AC_HELP_STRING( [--with-plugins@<:@=DIR@:>@],
1883                   [support plugins (installed in DIR, if supplied) @<:@default=yes, if possible@:>@]),
1884 [
1885   if test "x$withval" = "xno"; then
1886     have_plugins=no
1887   elif test "x$have_plugins" = "xno"; then
1888       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
1889   elif test "x$withval" != "xyes"; then
1890       plugindir="$withval"
1891   fi
1892 ])
1893 AM_CONDITIONAL(HAVE_PLUGINS, test "x$have_plugins" = "xyes")
1894 if test x$have_plugins = xyes
1895 then
1896   AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
1897 fi
1898 AC_SUBST(plugindir)
1899 CPPFLAGS="$CPPFLAGS '-DPLUGIN_DIR=\"\$(plugindir)\"'"
1900
1901 #
1902 # The plugin dissectors reside in ./plugins/PROTO/
1903 #
1904 PLUGIN_LIBS=""
1905 AC_SUBST(PLUGIN_LIBS)
1906
1907 dnl libtool defs
1908 #
1909 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
1910 # (autoconf?  automake?  libtool?) - with the newer version(s), it's
1911 # just an alias for AC_PROG_LIBTOOL, which is called earlier.
1912 #
1913 # With older version(s) of those tool(s), however, it's not just an
1914 # alias, and the configure scripts don't work without it.
1915 #
1916 AM_PROG_LIBTOOL
1917 AC_SUBST(LIBTOOL_DEPS)
1918
1919 AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes)
1920 if test x$enable_static = xyes -a x$have_plugins = xyes
1921 then
1922   AC_DEFINE(ENABLE_STATIC, 1, [Link plugins statically into Wireshark])
1923 fi
1924 AC_SUBST(ENABLE_STATIC)
1925
1926 dnl Save the cacheable configure results to config.cache before recursing
1927 AC_CACHE_SAVE
1928
1929 sinclude(plugins/Custom.m4) dnl
1930 ifdef(_CUSTOM_AC_OUTPUT_,, define(_CUSTOM_AC_OUTPUT_, )) dnl
1931
1932 sinclude(asn1/Custom.m4) dnl
1933 ifdef(_CUSTOM_ASN1_AC_OUTPUT_,, define(_CUSTOM_ASN1_AC_OUTPUT_, )) dnl
1934
1935 AM_CONFIG_HEADER(config.h)
1936 AC_OUTPUT(
1937   Makefile
1938   doxygen.cfg
1939   asn1/Makefile
1940   _CUSTOM_ASN1_AC_OUTPUT_
1941   asn1/acp133/Makefile
1942   asn1/acse/Makefile
1943   asn1/ansi_map/Makefile
1944   asn1/ansi_tcap/Makefile
1945   asn1/c1222/Makefile
1946   asn1/camel/Makefile
1947   asn1/cdt/Makefile
1948   asn1/charging_ase/Makefile
1949   asn1/cmip/Makefile
1950   asn1/cmp/Makefile
1951   asn1/crmf/Makefile
1952   asn1/cms/Makefile
1953   asn1/credssp/Makefile
1954   asn1/dap/Makefile
1955   asn1/disp/Makefile
1956   asn1/dop/Makefile
1957   asn1/dsp/Makefile
1958   asn1/ess/Makefile
1959   asn1/ftam/Makefile
1960   asn1/gnm/Makefile
1961   asn1/goose/Makefile
1962   asn1/gprscdr/Makefile
1963   asn1/gsm_map/Makefile
1964   asn1/h225/Makefile
1965   asn1/h235/Makefile
1966   asn1/h245/Makefile
1967   asn1/h248/Makefile
1968   asn1/h282/Makefile
1969   asn1/h283/Makefile
1970   asn1/h323/Makefile
1971   asn1/h450/Makefile
1972   asn1/h450-ros/Makefile
1973   asn1/h460/Makefile
1974   asn1/h501/Makefile
1975   asn1/HI2Operations/Makefile
1976   asn1/hnbap/Makefile
1977   asn1/idmp/Makefile
1978   asn1/inap/Makefile
1979   asn1/kerberos/Makefile
1980   asn1/lcsap/Makefile
1981   asn1/ldap/Makefile
1982   asn1/logotypecertextn/Makefile
1983   asn1/lpp/Makefile
1984   asn1/lppa/Makefile
1985   asn1/lte-rrc/Makefile
1986   asn1/m3ap/Makefile
1987   asn1/mms/Makefile
1988   asn1/mpeg-audio/Makefile
1989   asn1/mpeg-pes/Makefile
1990   asn1/nbap/Makefile
1991   asn1/ns_cert_exts/Makefile
1992   asn1/ocsp/Makefile
1993   asn1/p1/Makefile
1994   asn1/p22/Makefile
1995   asn1/p7/Makefile
1996   asn1/p772/Makefile
1997   asn1/pcap/Makefile
1998   asn1/pkcs1/Makefile
1999   asn1/pkcs12/Makefile
2000   asn1/pkinit/Makefile
2001   asn1/pkixac/Makefile
2002   asn1/pkix1explicit/Makefile
2003   asn1/pkix1implicit/Makefile
2004   asn1/pkixproxy/Makefile
2005   asn1/pkixqualified/Makefile
2006   asn1/pkixtsp/Makefile
2007   asn1/pres/Makefile
2008   asn1/q932/Makefile
2009   asn1/q932-ros/Makefile
2010   asn1/qsig/Makefile
2011   asn1/ranap/Makefile
2012   asn1/rnsap/Makefile
2013   asn1/ros/Makefile
2014   asn1/rrc/Makefile
2015   asn1/rrlp/Makefile
2016   asn1/rtse/Makefile
2017   asn1/rua/Makefile
2018   asn1/s1ap/Makefile
2019   asn1/sabp/Makefile
2020   asn1/sbc-ap/Makefile
2021   asn1/smrse/Makefile
2022   asn1/snmp/Makefile
2023   asn1/spnego/Makefile
2024   asn1/sv/Makefile
2025   asn1/t124/Makefile
2026   asn1/t125/Makefile
2027   asn1/t38/Makefile
2028   asn1/tcap/Makefile
2029   asn1/tetra/Makefile
2030   asn1/ulp/Makefile
2031   asn1/wlancertextn/Makefile
2032   asn1/x2ap/Makefile
2033   asn1/x509af/Makefile
2034   asn1/x509ce/Makefile
2035   asn1/x509if/Makefile
2036   asn1/x509sat/Makefile
2037   asn1/x721/Makefile
2038   doc/Makefile
2039   docbook/Makefile
2040   epan/Makefile
2041   epan/crypt/Makefile
2042   epan/doxygen.cfg
2043   epan/dfilter/Makefile
2044   epan/dissectors/Makefile
2045   epan/dissectors/dcerpc/Makefile
2046   epan/dissectors/pidl/Makefile
2047   epan/ftypes/Makefile
2048   epan/wslua/Makefile
2049   epan/wspython/Makefile
2050   codecs/Makefile
2051   ui/Makefile
2052   ui/doxygen.cfg
2053   ui/gtk/Makefile
2054   ui/gtk/doxygen.cfg
2055   ui/cli/Makefile
2056   ui/qt/Makefile
2057   help/Makefile
2058   packaging/Makefile
2059   packaging/macosx/Info.plist
2060   packaging/macosx/Makefile
2061   packaging/nsis/Makefile
2062   packaging/rpm/Makefile
2063   packaging/rpm/SPECS/Makefile
2064   packaging/rpm/SPECS/wireshark.spec
2065   packaging/svr4/Makefile
2066   packaging/svr4/checkinstall
2067   packaging/svr4/pkginfo
2068   plugins/Makefile
2069   plugins/asn1/Makefile
2070   plugins/docsis/Makefile
2071   plugins/ethercat/Makefile
2072   plugins/giop/Makefile
2073   plugins/gryphon/Makefile
2074   plugins/irda/Makefile
2075   plugins/m2m/Makefile
2076   plugins/mate/Makefile
2077   plugins/opcua/Makefile
2078   plugins/profinet/Makefile
2079   plugins/stats_tree/Makefile
2080   plugins/unistim/Makefile
2081   plugins/wimax/Makefile
2082   plugins/wimaxasncp/Makefile
2083   tools/Makefile
2084   tools/lemon/Makefile
2085   wiretap/Makefile
2086   wsutil/Makefile
2087   _CUSTOM_AC_OUTPUT_
2088   ,)
2089 dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])
2090
2091
2092 # Pretty messages
2093
2094 if test "x$have_qt" = "xyes"; then
2095         gui_lib_message=" (with Qt)"
2096 else
2097         if test "x$have_gtk" = "xyes"; then
2098                 if test "x$with_gtk3" = "xyes"; then
2099                         gui_lib_message=" (with GTK+ 3"
2100                 else
2101                         gui_lib_message=" (with GTK+ 2"
2102                 fi
2103                 if test "x$have_ige_mac" = "xyes"; then
2104                         gui_lib_message="$gui_lib_message and Mac OS X integration)"
2105                 else
2106                         gui_lib_message="$gui_lib_message)"
2107                 fi
2108         fi
2109 fi
2110
2111 if test "x$enable_setcap_install" = "xyes" ; then
2112         setcap_message="yes"
2113 else
2114         setcap_message="no"
2115 fi
2116
2117 if test "x$enable_setuid_install" = "xyes" ; then
2118         setuid_message="yes"
2119 else
2120         setuid_message="no"
2121 fi
2122
2123 if test "x$DUMPCAP_GROUP" = "x" ; then
2124         dumpcap_group_message="(none)"
2125 else
2126         dumpcap_group_message="$DUMPCAP_GROUP"
2127 fi
2128
2129 if test "x$want_zlib" = "xno" ; then
2130         zlib_message="no"
2131 else
2132         zlib_message="yes"
2133 fi
2134
2135 if test "x$want_lua" = "xyes" ; then
2136         lua_message="yes"
2137 else
2138         lua_message="no"
2139 fi
2140
2141 if test "x$want_python" = "xno"; then
2142         python_message="no"
2143 else
2144         python_message="yes"
2145 fi
2146
2147 if test "x$want_portaudio" = "xyes" ; then
2148         portaudio_message="yes"
2149 else
2150         portaudio_message="no"
2151 fi
2152
2153 if test "x$want_ssl" = "xno" ; then
2154         ssl_message="no"
2155 else
2156         ssl_message="yes"
2157 fi
2158
2159 if test "x$want_krb5" = "xno" ; then
2160         krb5_message="no"
2161 else
2162         krb5_message="yes ($ac_krb5_version)"
2163 fi
2164
2165 if test "x$have_good_c_ares" = "xyes" ; then
2166         c_ares_message="yes"
2167 else
2168         c_ares_message="no"
2169 fi
2170
2171 if test "x$have_good_adns" = "xyes" ; then
2172         adns_message="yes"
2173 else
2174         if test "x$have_good_c_ares" = "xyes" ; then
2175                 adns_message="no (using c-ares instead)"
2176         else
2177                 adns_message="no"
2178         fi
2179 fi
2180
2181 if test "x$have_good_libcap" = "xyes" ; then
2182         libcap_message="yes"
2183 else
2184         libcap_message="no"
2185 fi
2186
2187 if test "x$have_good_geoip" = "xyes" ; then
2188         geoip_message="yes"
2189 else
2190         geoip_message="no"
2191 fi
2192
2193 echo ""
2194 echo "The Wireshark package has been configured with the following options."
2195 echo "                    Build wireshark : $enable_wireshark""$gui_lib_message"
2196 echo "                       Build tshark : $enable_tshark"
2197 echo "                     Build capinfos : $enable_capinfos"
2198 echo "                      Build editcap : $enable_editcap"
2199 echo "                      Build dumpcap : $enable_dumpcap"
2200 echo "                     Build mergecap : $enable_mergecap"
2201 echo "                    Build text2pcap : $enable_text2pcap"
2202 echo "                      Build randpkt : $enable_randpkt"
2203 echo "                       Build dftest : $enable_dftest"
2204 echo "                     Build rawshark : $enable_rawshark"
2205 echo ""
2206 echo "   Save files as pcap-ng by default : $enable_pcap_ng_default"
2207 echo "  Install dumpcap with capabilities : $setcap_message"
2208 echo "             Install dumpcap setuid : $setuid_message"
2209 echo "                  Use dumpcap group : $dumpcap_group_message"
2210 echo "                        Use plugins : $have_plugins"
2211 echo "                    Use Lua library : $lua_message"
2212 echo "                 Use Python binding : $python_message"
2213 echo "                   Build rtp_player : $portaudio_message"
2214 echo "             Build profile binaries : $enable_profile_build"
2215 echo "                   Use pcap library : $want_pcap"
2216 echo "                   Use zlib library : $zlib_message"
2217 echo "               Use kerberos library : $krb5_message"
2218 echo "                 Use c-ares library : $c_ares_message"
2219 echo "               Use GNU ADNS library : $adns_message"
2220 echo "                Use SMI MIB library : $libsmi_message"
2221 echo "             Use GNU crypto library : $gcrypt_message"
2222 echo "             Use SSL crypto library : $ssl_message"
2223 echo "           Use IPv6 name resolution : $enable_ipv6"
2224 echo "                 Use gnutls library : $tls_message"
2225 echo "     Use POSIX capabilities library : $libcap_message"
2226 echo "                  Use GeoIP library : $geoip_message"