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