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