If we have pcap_open, call it instead of pcap_open_live, otherwise we might
[obnox/wireshark/wip.git] / configure.in
1 # $Id$
2 #
3 AC_PREREQ(2.52)
4
5 dnl Check for CPU / vendor / OS
6 dnl The user is encouraged to use either `AC_CANONICAL_BUILD', or
7 dnl `AC_CANONICAL_HOST', or `AC_CANONICAL_TARGET', depending on the
8 dnl needs.  Using `AC_CANONICAL_TARGET' is enough to run the two other
9 dnl macros.
10
11 dnl AC_CANONICAL_HOST
12 dnl AC_CANONICAL_BUILD
13 dnl AC_CANONICAL_TARGET
14
15 AC_INIT(wireshark, 1.0.99)
16 AM_INIT_AUTOMAKE([1.9 tar-ustar])
17
18 AM_DISABLE_STATIC
19
20 dnl Checks for programs.
21 AC_PROG_CC
22 AC_PROG_CPP
23 dnl Work around libtool bug (fixed in the version 1.5a?)
24 AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
25 AC_LIBTOOL_DLOPEN
26 AC_PROG_LIBTOOL
27 AC_PATH_PROG(PERL, perl)
28 AC_PROG_YACC
29 AC_PATH_PROG(YACCDUMMY, $YACC)
30 if test "x$YACCDUMMY" = x
31 then
32         AC_MSG_ERROR(I couldn't find yacc (or bison or ...); make sure it's installed and in your path)
33 fi
34 AM_PROG_LEX
35 AC_PATH_PROG(LEXDUMMY, $LEX)
36 if test "x$LEXDUMMY" = x
37 then
38         AC_MSG_ERROR(I couldn't find (f)lex; make sure it's installed and in your path)
39 fi
40 AC_PATH_PROG(POD2MAN, pod2man)
41 if test "x$POD2MAN" = x
42 then
43         #
44         # The alternative is not to build the man pages....
45         #
46         AC_MSG_ERROR(I couldn't find pod2man; make sure it's installed and in your path)
47 fi
48 AC_PATH_PROG(POD2HTML, pod2html)
49 if test "x$POD2HTML" = x
50 then
51         #
52         # The alternative is not to build the HTML man pages....
53         #
54         AC_MSG_ERROR(I couldn't find pod2html; make sure it's installed and in your path)
55 fi
56 AC_PATH_PROG(HTML_VIEWER, xdg-open)
57 if test "x$HTML_VIEWER" = x
58 then
59         AC_PATH_PROG(HTML_VIEWER, htmlview)
60         if test "x$HTML_VIEWER" = x
61         then
62                 AC_DEFINE_UNQUOTED(HTML_VIEWER, "mozilla", [HTML viewer, e.g. mozilla])
63         else
64                 AC_DEFINE_UNQUOTED(HTML_VIEWER, "htmlview", [HTML viewer, e.g. mozilla])
65         fi
66 else
67         #
68         # XXX - define something to be the full path of xdg-open, so we
69         # just run that?
70         #
71         AC_DEFINE(HAVE_XDG_OPEN, 1, [Define if we have xdg-open])
72         AC_DEFINE_UNQUOTED(HTML_VIEWER, "xdg-open", [HTML viewer, e.g. mozilla])
73 fi
74
75 AC_PATH_PROG(LEX, flex)
76 AC_PATH_PROG(PYTHON, python)
77
78 AC_SUBST(PERL)
79 AC_SUBST(POD2MAN)
80 AC_SUBST(POD2HTML)
81 AC_SUBST(LEX)
82 AC_SUBST(FLEX_PATH)
83 AC_SUBST(PYTHON)
84 AC_SUBST(XSLTPROC)
85 AC_SUBST(XMLLINT)
86
87 if test "x$CC_FOR_BUILD" = x
88 then
89        CC_FOR_BUILD=$CC
90 fi
91 AC_SUBST(CC_FOR_BUILD)
92
93 # Check for doxygen
94 AC_PATH_PROG(DOXYGEN, doxygen)
95 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, "yes", "no")
96 AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
97
98 # gnu tls
99 tls_message="no"
100 AC_ARG_WITH([gnutls],
101   AC_HELP_STRING( [--with-gnutls=@<:@yes/no@:>@],
102                   [use gnutls library @<:@default=yes@:>@]),
103   with_gnutls="$withval", with_gnutls="yes")
104 if test "x$with_gnutls" = "xyes"; then
105   AM_PATH_LIBGNUTLS(1.2.0,
106         [
107                 echo "gnuTLS found, enabling ssl decryption"
108                 AC_DEFINE(HAVE_LIBGNUTLS, 1, [Define to use gnutls library])
109                 tls_message="yes"
110         ]
111         , [
112                 if test x$libgnutls_config_prefix != x ; then
113                         AC_MSG_ERROR([[gnuTLS not found; install gnuTLS-devel package for your system]])
114                 else
115                         echo echo "gnuTLS not found, disabling ssl decryption"
116                         tls_message="no"
117                 fi
118         ]
119   )
120 fi
121
122 # libgrypt
123 gcrypt_message="no"
124 AC_ARG_WITH([gcrypt],
125   AC_HELP_STRING( [--with-gcrypt=@<:@yes/no@:>@],
126                   [use gcrypt library @<:@default=yes@:>@]),
127   with_gcrypt="$withval", with_gcrypt="yes")
128 if test "x$with_gcrypt" = "xyes"; then
129   AM_PATH_LIBGCRYPT(1.1.42,
130         [
131                 echo "libgcrypt found, enabling ipsec decryption"
132                 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt])
133                 gcrypt_message="yes"
134         ]
135         , [
136                 if test x$libgcrypt_config_prefix != x ; then
137                         AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]])
138                 else
139                         echo "libgcrypt not found, disabling ipsec decryption"
140                         gcrypt_message="no"
141                 fi
142         ]
143   )
144 fi
145
146 # libsmi
147 # FIXME: currently the path argument to with-libsmi is being ignored
148 AX_LIBSMI
149
150 # Check for xsltproc
151 AC_PATH_PROG(XSLTPROC, xsltproc)
152 AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, "yes", "no")
153 AM_CONDITIONAL(HAVE_XSLTPROC, test x$HAVE_XSLTPROC = xyes)
154
155 # Check for xmllint
156 AC_PATH_PROG(XMLLINT, xmllint)
157 AC_CHECK_PROG(HAVE_XMLLINT, xmllint, "yes", "no")
158 AM_CONDITIONAL(HAVE_XMLLINT, test x$HAVE_XMLLINT = xyes)
159
160 # Check for fop (translate .fo to e.g. pdf)
161 AC_PATH_PROG(FOP, fop)
162 AC_CHECK_PROG(HAVE_FOP, fop, "yes", "no")
163 AM_CONDITIONAL(HAVE_FOP, test x$HAVE_FOP = xyes)
164
165 # Check for hhc (html help compiler)
166 AC_PATH_PROG(HHC, hhc.exe)
167 AC_CHECK_PROG(HAVE_HHC, hhc.exe, "yes", "no")
168 AM_CONDITIONAL(HAVE_HHC, test x$HAVE_HHC = xyes)
169
170 # Check for packaging utilities
171 # For now, we check to see if the various packaging utilites are in our
172 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
173
174 # SVR4/Solaris
175 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
176 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
177 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
178
179 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
180      -a x$HAVE_PKGTRANS = xyes ; then
181   HAVE_SVR4_PACKAGING=yes
182 else
183   HAVE_SVR4_PACKAGING=no
184 fi
185 AC_SUBST(HAVE_SVR4_PACKAGING)
186
187 # RPM
188 AC_WIRESHARK_RPM_CHECK
189 AC_SUBST(HAVE_RPM)
190
191 # Debian
192 AC_CHECK_PROG(HAVE_DPKG_BUILDPACKAGE, dpkg-buildpackage, "yes", "no")
193
194 # Mac OS X
195 AC_CHECK_PROG(HAVE_XCODEBUILD, xcodebuild, "yes", "no")
196 AC_CHECK_PROG(HAVE_HDIUTIL, hdiutil, "yes", "no")
197 AC_CHECK_PROG(HAVE_BLESS, bless, "yes", "no")
198
199 if test x$HAVE_XCODEBUILD = xyes -a x$HAVE_HDIUTIL = xyes \
200      -a x$HAVE_BLESS = xyes ; then
201   HAVE_OSX_PACKAGING=yes
202 else
203   HAVE_OSX_PACKAGING=no
204 fi
205 AC_SUBST(HAVE_OSX_PACKAGING)
206
207 #
208 # Try to add some additional gcc checks to CFLAGS
209 #
210 AC_ARG_ENABLE(extra-gcc-checks,
211   AC_HELP_STRING( [--enable-extra-gcc-checks],
212                   [Do additional -W checks in GCC.  @<:@default=no@:>@]),
213 [
214         wireshark_extra_gcc_flags=$enableval
215         if test $enableval != no
216         then
217                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-pedantic)
218                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Woverflow)
219                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-overlength-strings)
220 #               AC_WIRESHARK_GCC_CFLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4)
221 #               AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunreachable-code)
222                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-long-long)
223                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast)
224                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-qual)
225                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
226                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings)
227                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshorten-64-to-32)
228                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes)
229                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations)
230                 #Temporarily put cast-align here waiting eradication of 'cast
231                 #increases required alignment of target type' on the Solaris
232                 #slave.
233                 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
234         fi
235 ],)
236 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wall -W) /* -W is now known as -Wextra */
237 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdeclaration-after-statement)
238 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wendif-labels)
239 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpointer-arith)
240 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-pointer-sign)
241 AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds)
242
243 #
244 # If we're running gcc add '-D_U_="__attribute__((unused))"' to CFLAGS as well,
245 # so we can use _U_ to flag unused function arguments and not get warnings
246 # about them. Otherwise, add '-D_U_=""', so that _U_ used to flag an unused
247 # function argument will compile with non-GCC compilers.
248 #
249 if test "x$GCC" = "xyes" ; then
250   CFLAGS="-D_U_=\"__attribute__((unused))\" $CFLAGS"
251 else
252   CFLAGS="-D_U_=\"\" $CFLAGS"
253 fi
254
255 #
256 # If we're running gcc, will enable a barrier "stop on warning".
257 # This barrier is set for a very large part of the code. However, it is
258 # typically not set for "generated" code  (lex, ans2wrs, idl2wrs, ...)
259 #
260 warnings_as_errors_default="yes"
261 AC_MSG_CHECKING(whether we should treat compiler warnings as errors)
262 AC_ARG_ENABLE(warnings-as-errors,
263   AC_HELP_STRING( [--enable-warnings-as-errors],
264                   [Treat warnings as errors (only for gcc). @<:@default=yes@:>@]),
265 [
266   if test "x$GCC" = "xyes" -a "x$enableval" == "xyes" -a "x$wireshark_extra_gcc_flags" != "xyes"; then
267     with_warnings_as_errors="yes"
268     AC_MSG_RESULT(yes)
269   else
270     with_warnings_as_errors="no"
271     AC_MSG_RESULT(no)
272   fi
273 ],
274   if test "x$GCC" = "xyes" -a "x$wireshark_extra_gcc_flags" = "x" -a "x$warnings_as_errors_default" = "xyes"; then
275     with_warnings_as_errors="yes"
276     AC_MSG_RESULT(yes)
277   else
278     with_warnings_as_errors="no"
279     AC_MSG_RESULT(no)
280   fi
281 )
282 AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$with_warnings_as_errors" = "xyes")
283
284 #
285 # Add any platform-specific compiler flags needed.
286 #
287 AC_MSG_CHECKING(for platform-specific compiler flags)
288 if test "x$GCC" = "xyes" ; then
289         #
290         # GCC - do any platform-specific tweaking necessary.
291         #
292         case "$host_os" in
293         solaris*)
294                 # the X11 headers don't automatically include prototype info
295                 # and a lot don't include the return type
296                 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
297                 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
298                 ;;
299         darwin*)
300                 #
301                 # See comments above about Apple's lovely C compiler.
302                 #
303                 CFLAGS="-no-cpp-precomp $CFLAGS"
304                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
305                 ;;
306         *)
307                 AC_MSG_RESULT(none needed)
308                 ;;
309         esac
310 else
311         #
312         # Not GCC - assume it's the vendor's compiler.
313         #
314         case "$host_os" in
315         hpux*)
316                 #
317                 # HP's ANSI C compiler; flags suggested by Jost Martin.
318                 # "-Ae" for ANSI C plus extensions such as "long long".
319                 # "+O2", for optimization.  XXX - works with "-g"?
320                 #
321                 CFLAGS="-Ae +O2 $CFLAGS"
322                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
323                 ;;
324         darwin*)
325                 #
326                 # It may be called "cc", but it's really a GCC derivative
327                 # with a problematic special precompiler and precompiled
328                 # headers; turn off the special precompiler, as some
329                 # apparently-legal code won't compile with its precompiled
330                 # headers.
331                 #
332                 CFLAGS="-no-cpp-precomp $CFLAGS"
333                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
334                 ;;
335         *)
336                 AC_MSG_RESULT(none needed)
337                 ;;
338         esac
339 fi
340
341 #
342 # Add any platform-specific linker flags needed.
343 #
344 AC_MSG_CHECKING(for platform-specific linker flags)
345 case "$host_os" in
346 darwin*)
347         #
348         # Add -Wl,-single_module to the LDFLAGS used with shared
349         # libraries, to fix some error that show up in some cases;
350         # some Apple documentation recommends it for most shared
351         # libraries.
352         #
353         LDFLAGS_SHAREDLIB="-Wl,-single_module"
354         #
355         # Add -Wl,-search_paths_first to make sure that if we search
356         # directories A and B, in that order, for a given library, a
357         # non-shared version in directory A, rather than a shared
358         # version in directory B, is chosen (so we can use
359         # --with-pcap=/usr/local to force all programs to be linked
360         # with a static version installed in /usr/local/lib rather than
361         # the system version in /usr/lib).
362         #
363         LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
364         AC_MSG_RESULT([Apple linker - added -Wl,-single_module and -Wl,-search_paths_first])
365         ;;
366 cygwin*)
367         #
368         # Shared libraries in cygwin/Win32 must never contain
369         # undefined symbols.
370         #
371         LDFLAGS="$LDFLAGS -no-undefined"
372         AC_MSG_RESULT(CygWin GNU ld - added -no-undefined)
373         ;;
374 *)
375         AC_MSG_RESULT(none needed)
376         ;;
377 esac
378 AC_SUBST(LDFLAGS_SHAREDLIB)
379
380 #
381 # On OS X, if we find the headers for Core Foundation, Launch Services,
382 # and Core Services, add -framework options to link with Application
383 # Services (of which Launch Services is a subframework), Core Foundation
384 # (required by the Launch Services APIs), and Core Services, so we can
385 # use them to launch a Web browser from the Help menu and to use
386 # Gestalt() to get the Mac OS X version number.
387 #
388 case "$host_os" in
389
390 darwin*)
391         AC_MSG_CHECKING([whether we can build with Core Foundation, Launch Services, and Core Services])
392         ac_save_LIBS="$LIBS"
393         ac_frameworks="-framework ApplicationServices -framework CoreFoundation -framework CoreServices"
394         LIBS="$LIBS $ac_frameworks"
395         AC_TRY_LINK(
396            [
397 #       include <CoreFoundation/CFBase.h>
398 #       include <CoreFoundation/CFString.h>
399 #       include <CoreFoundation/CFURL.h>
400 #       include <ApplicationServices/ApplicationServices.h>
401 #       include <CoreServices/CoreServices.h>
402            ],
403            [
404         CFStringRef url_CFString;
405         CFURLRef url_CFURL;
406         OSStatus status;
407         long os_version;
408
409         url_CFString = CFStringCreateWithCString(NULL, "", kCFStringEncodingASCII);
410         url_CFURL = CFURLCreateWithString(NULL, url_CFString, NULL);
411         status = LSOpenCFURLRef(url_CFURL, NULL);
412
413         Gestalt(gestaltSystemVersion, &os_version);
414            ],
415            ac_cv_can_use_osx_frameworks=yes,
416            ac_cv_can_use_osx_frameworks=no,
417            [echo $ac_n "cross compiling; assumed OK... $ac_c"])
418         if test "$ac_cv_can_use_osx_frameworks" = yes ; then
419                 AC_DEFINE(HAVE_OS_X_FRAMEWORKS, 1, [Define to 1 if you have OS X frameworks])
420                 FRAMEWORKS="$ac_frameworks"
421                 AC_MSG_RESULT(yes)
422         else
423                 AC_MSG_RESULT(no)
424         fi
425         LIBS="$ac_save_LIBS"
426         ;;
427 esac
428 AC_SUBST(FRAMEWORKS)
429
430 dnl Look in /usr/local for header files and libraries ?
431 dnl XXX FIXME don't include /usr/local if it is already in the system
432 dnl search path as this causes gcc 3.2 on Linux to complain about a change
433 dnl of the system search order for includes
434 AC_ARG_ENABLE(usr-local,
435   AC_HELP_STRING( [--enable-usr-local],
436                   [look for headers and libs in /usr/local tree.  @<:@default=yes@:>@]),
437     ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
438
439 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
440 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
441         AC_MSG_RESULT(yes)
442         #
443         # Arrange that we search for header files in the source directory
444         # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
445         # as various packages we use ("libpcap", "zlib", "adns", "pcre")
446         # may have been installed under "/usr/local/include".
447         #
448         CFLAGS="$CFLAGS -I/usr/local/include"
449         CPPFLAGS="$CPPFLAGS -I/usr/local/include"
450
451         #
452         # Arrange that we search for libraries in "/usr/local/lib".
453         #
454         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, /usr/local/lib)
455 else
456         AC_MSG_RESULT(no)
457 fi
458
459 #
460 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
461 # link directory.
462 #
463 case "$host_os" in
464   solaris*)
465     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
466     if test x$LD_LIBRARY_PATH != x ; then
467       LIBS="$LIBS -R$LD_LIBRARY_PATH"
468       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
469     else
470       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
471     fi
472   ;;
473 esac
474
475 #
476 # Check for versions of "sed" inadequate to handle, in libtool, a list
477 # of object files as large as the list in Wireshark.
478 #
479 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
480 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
481 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
482 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
483 # is the only "sed" that comes with Solaris that can handle Wireshark.
484 #
485 # Add any checks here that are necessary for other OSes.
486 #
487 AC_WIRESHARK_GNU_SED_CHECK
488 if test "$HAVE_GNU_SED" = no ; then
489         case "$host_os" in
490         solaris*)
491                 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
492                 case `which sed` in
493                         /bin/sed|/usr/bin/sed|/usr/ucb/sed)
494                         AC_MSG_RESULT(yes)
495                         AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
496                         ;;
497
498                         *)
499                         AC_MSG_RESULT(no)
500                         ;;
501                 esac
502                 ;;
503
504         *)
505                 :
506                 ;;
507         esac
508 fi
509
510 # Enable/disable tshark
511
512 AC_ARG_ENABLE(wireshark,
513   AC_HELP_STRING( [--enable-wireshark],
514                   [build GTK+-based wireshark.  @<:@default=yes, if GTK+ available@:>@]),
515     enable_wireshark=$enableval,enable_wireshark=yes)
516
517 AC_ARG_ENABLE(threads,
518   AC_HELP_STRING( [--enable-threads],
519                   [use threads in wireshark.  @<:@default=no@:>@]),
520     enable_threads=$enableval,enable_threads=no)
521 AM_CONDITIONAL(USE_THREADS, test x$enable_threads = xyes)
522
523 AC_ARG_ENABLE(profile-build,
524   AC_HELP_STRING( [--enable-profile-build],
525                   [build profile-ready binaries.  @<:@default=no@:>@]),
526     enable_profile_build=$enableval,enable_profile_build=no)
527 AM_CONDITIONAL(USE_PROFILE_BUILD, test x$enable_profile_build = xyes)
528 AC_MSG_CHECKING(if profile builds must be generated)
529 if test "x$enable_profile_build" = "xyes" ; then
530         if test "x$GCC" = "xyes" ; then
531                 AC_MSG_RESULT(yes)
532                 CFLAGS=" -pg $CFLAGS"
533         else
534                 AC_MSG_RESULT(no)
535                 echo "Building profile binaries currently only supported for GCC."
536         fi
537 else
538         AC_MSG_RESULT(no)
539 fi
540
541 # Create DATAFILE_DIR #define for config.h
542 datafiledir=$datadir/wireshark
543 datafiledir=`(
544     test "x$prefix" = xNONE && prefix=$ac_default_prefix
545     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
546     # Ugly hack, but I don't see how this problem can be solved
547     # properly that DATAFILE_DIR had a value starting with
548     # "${prefix}/" instead of e.g. "/usr/local/"
549     eval eval echo "$datafiledir"
550 )`
551 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$datafiledir", [Directory for data])
552
553 # GTK checks; we require GTK+ 2.4 or later.
554 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
555 # programs to be built with GTK+.
556 #
557 if test "x$enable_wireshark" = "xyes"; then
558         AM_PATH_GTK_2_0(2.4.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
559 else
560         GTK_OK=no
561 fi
562
563 # GLib checks
564 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
565 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
566 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
567 # set when generating the Makefile, so we can make programs that require
568 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
569 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
570 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
571 # programs to be built with GLib.
572 #
573 if test "$GTK_OK" = "no" ; then
574         #
575         # We don't have GTK+.
576         # If they didn't explicitly say "--disable-wireshark", fail (so
577         # that, unless they explicitly indicated that they don't want
578         # Wireshark, we stop so they know they won't be getting
579         # Wireshark unless they fix the GTK+ problem).
580         #
581         if test "x$enable_wireshark" = "xyes"; then
582                 AC_MSG_ERROR([GTK+ 2.4 or later isn't available, so Wireshark can't be compiled])
583         fi
584         wireshark_bin=""
585         wireshark_man=""
586         # Honor GLIB_CFLAGS
587         AM_PATH_GLIB_2_0(2.4.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib 2.0 or later distribution not found.), gmodule)
588
589 else
590         wireshark_bin="wireshark\$(EXEEXT)"
591         wireshark_man="wireshark.1"
592         wireshark_SUBDIRS="codecs gtk"
593         # Honor GLIB_CFLAGS
594         AM_PATH_GLIB_2_0(2.4.0, , AC_MSG_ERROR(GLib 2.4 or later distribution not found.), gmodule)
595 fi
596
597 #
598 # Check whether GLib modules are supported, to determine whether we
599 # can support plugins.
600 #
601 AC_MSG_CHECKING(whether GLib supports loadable modules)
602 ac_save_CFLAGS="$CFLAGS"
603 ac_save_LIBS="$LIBS"
604 CFLAGS="$CFLAGS $GLIB_CFLAGS"
605 LIBS="$GLIB_LIBS $LIBS"
606 AC_TRY_RUN([
607 #include <glib.h>
608 #include <gmodule.h>
609 #include <stdio.h>
610 #include <stdlib.h>
611
612 int
613 main ()
614 {
615   if (g_module_supported())
616     return 0;   /* success */
617   else
618     return 1;   /* failure */
619 }
620 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
621    [echo $ac_n "cross compiling; assumed OK... $ac_c"
622     ac_cv_glib_supports_modules=yes])
623 CFLAGS="$ac_save_CFLAGS"
624 LIBS="$ac_save_LIBS"
625 if test "$ac_cv_glib_supports_modules" = yes ; then
626   AC_MSG_RESULT(yes)
627   have_plugins=yes
628 else
629   AC_MSG_RESULT(no)
630   have_plugins=no
631 fi
632
633 AC_SUBST(wireshark_bin)
634 AC_SUBST(wireshark_man)
635
636 rdps_bin="rdps\$(EXEEXT)"
637 AC_SUBST(rdps_bin)
638
639
640 # Enable/disable tshark
641
642 AC_ARG_ENABLE(tshark,
643   AC_HELP_STRING( [--enable-tshark],
644                   [build tshark.  @<:@default=yes@:>@]),
645     tshark=$enableval,enable_tshark=yes)
646
647 if test "x$enable_tshark" = "xyes" ; then
648         tshark_bin="tshark\$(EXEEXT)"
649         tshark_man="tshark.1"
650         wiresharkfilter_man="wireshark-filter.4"
651 else
652         tshark_bin=""
653         tshark_man=""
654 fi
655 AC_SUBST(tshark_bin)
656 AC_SUBST(tshark_man)
657 AC_SUBST(wiresharkfilter_man)
658
659
660
661 # Enable/disable editcap
662
663 AC_ARG_ENABLE(editcap,
664   AC_HELP_STRING( [--enable-editcap],
665                   [build editcap.  @<:@default=yes@:>@]),
666     enable_editcap=$enableval,enable_editcap=yes)
667
668 if test "x$enable_editcap" = "xyes" ; then
669         editcap_bin="editcap\$(EXEEXT)"
670         editcap_man="editcap.1"
671 else
672         editcap_bin=""
673         editcap_man=""
674 fi
675 AC_SUBST(editcap_bin)
676 AC_SUBST(editcap_man)
677
678 # Enabling/disabling of dumpcap is done later (after we know if we have PCAP
679 # or not)
680
681 # Enable/disable capinfos
682
683 AC_ARG_ENABLE(capinfos,
684   AC_HELP_STRING( [--enable-capinfos],
685                   [build capinfos.  @<:@default=yes@:>@]),
686     enable_capinfos=$enableval,enable_capinfos=yes)
687
688 if test "x$enable_capinfos" = "xyes" ; then
689         capinfos_bin="capinfos\$(EXEEXT)"
690         capinfos_man="capinfos.1"
691 else
692         capinfos_bin=""
693         capinfos_man=""
694 fi
695 AC_SUBST(capinfos_bin)
696 AC_SUBST(capinfos_man)
697
698
699 # Enable/disable mergecap
700
701 AC_ARG_ENABLE(mergecap,
702   AC_HELP_STRING( [--enable-mergecap],
703                   [build mergecap.  @<:@default=yes@:>@]),
704     enable_mergecap=$enableval,enable_mergecap=yes)
705
706 if test "x$enable_mergecap" = "xyes" ; then
707         mergecap_bin="mergecap\$(EXEEXT)"
708         mergecap_man="mergecap.1"
709 else
710         mergecap_bin=""
711         mergecap_man=""
712 fi
713 AC_SUBST(mergecap_bin)
714 AC_SUBST(mergecap_man)
715
716
717 # Enable/disable text2pcap
718
719 AC_ARG_ENABLE(text2pcap,
720   AC_HELP_STRING( [--enable-text2pcap],
721                   [build text2pcap.  @<:@default=yes@:>@]),
722     text2pcap=$enableval,enable_text2pcap=yes)
723
724 if test "x$enable_text2pcap" = "xyes" ; then
725         text2pcap_bin="text2pcap\$(EXEEXT)"
726         text2pcap_man="text2pcap.1"
727 else
728         text2pcap_bin=""
729         text2pcap_man=""
730 fi
731 AC_SUBST(text2pcap_bin)
732 AC_SUBST(text2pcap_man)
733
734 # Enable/disable idl2wrs
735
736 AC_ARG_ENABLE(idl2wrs,
737   AC_HELP_STRING( [--enable-idl2wrs],
738                   [build idl2wrs.  @<:@default=yes@:>@]),
739     enable_idl2wrs=$enableval,enable_idl2wrs=yes)
740
741 if test "x$enable_idl2wrs" = "xyes" ; then
742         idl2wrs_bin="idl2wrs"
743         idl2wrs_man="idl2wrs.1"
744 else
745         idl2wrs_bin=""
746         idl2wrs_man=""
747 fi
748 AC_SUBST(idl2wrs_bin)
749 AC_SUBST(idl2wrs_man)
750
751
752 # Enable/disable dftest
753
754 AC_ARG_ENABLE(dftest,
755   AC_HELP_STRING( [--enable-dftest],
756                   [build dftest.  @<:@default=yes@:>@]),
757     enable_dftest=$enableval,enable_dftest=yes)
758
759 if test "x$enable_dftest" = "xyes" ; then
760         dftest_bin="dftest\$(EXEEXT)"
761 else
762         dftest_bin=""
763 fi
764 AC_SUBST(dftest_bin)
765
766
767 # Enable/disable randpkt
768
769 AC_ARG_ENABLE(randpkt,
770   AC_HELP_STRING( [--enable-randpkt],
771                   [build randpkt.  @<:@default=yes@:>@]),
772     enable_randpkt=$enableval,enable_randpkt=yes)
773
774 if test "x$enable_randpkt" = "xyes" ; then
775         randpkt_bin="randpkt\$(EXEEXT)"
776 else
777         randpkt_bin=""
778 fi
779 AC_SUBST(randpkt_bin)
780
781
782
783 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
784 dnl "gethostbyname()".
785 AC_WIRESHARK_GETHOSTBY_LIB_CHECK
786
787 dnl Checks for "connect()", used as a proxy for "socket()" - and
788 dnl "-lsocket", if we need it to get "connect()".
789 AC_WIRESHARK_SOCKET_LIB_CHECK
790
791 dnl pcap check
792 AC_MSG_CHECKING(whether to use libpcap for packet capture)
793
794 AC_ARG_WITH(pcap,
795   AC_HELP_STRING( [--with-pcap@<:@=DIR@:>@],
796                   [use libpcap for packet capturing.  @<:@default=yes@:>@]),
797 [
798         if test $withval = no
799         then
800                 want_pcap=no
801         elif test $withval = yes
802         then
803                 want_pcap=yes
804         else
805                 want_pcap=yes
806                 pcap_dir=$withval
807         fi
808 ],[
809         want_pcap=yes
810         pcap_dir=
811 ])
812 if test "x$want_pcap" = "xno" ; then
813         AC_MSG_RESULT(no)
814 else
815         AC_MSG_RESULT(yes)
816         AC_WIRESHARK_PCAP_CHECK
817 fi
818
819 # Enable/disable dumpcap
820
821 dnl dumpcap check
822 AC_MSG_CHECKING(whether to build dumpcap)
823
824 AC_ARG_ENABLE(dumpcap,
825   AC_HELP_STRING( [--enable-dumpcap],
826                   [build dumpcap.  @<:@default=yes@:>@]),
827     enable_dumpcap=$enableval,enable_dumpcap=yes)
828
829 if test "x$enable_dumpcap" = "xyes" ; then
830         if test "x$want_pcap" = "xno" ; then
831                 enable_dumpcap=no
832                 AC_MSG_RESULT(pcap not available - disabling dumpcap)
833         else
834                 AC_MSG_RESULT(yes)
835         fi
836 else
837         AC_MSG_RESULT(no)
838 fi
839
840 if test "x$enable_dumpcap" = "xyes" ; then
841         dumpcap_bin="dumpcap\$(EXEEXT)"
842         dumpcap_man="dumpcap.1"
843 else
844         dumpcap_bin=""
845         dumpcap_man=""
846 fi
847 AC_SUBST(dumpcap_bin)
848 AC_SUBST(dumpcap_man)
849
850 # Enable/disable rawshark
851
852 dnl rawshark check
853 AC_MSG_CHECKING(whether to build rawshark)
854
855 AC_ARG_ENABLE(rawshark,
856   AC_HELP_STRING( [--enable-rawshark],
857                   [build rawshark.  @<:@default=yes@:>@]),
858     rawshark=$enableval,enable_rawshark=yes)
859
860 if test "x$enable_rawshark" = "xyes" ; then
861         if test "x$want_pcap" = "xno" ; then
862                 enable_rawshark=no
863                 AC_MSG_RESULT(pcap not available - disabling rawshark)
864         else
865                 AC_MSG_RESULT(yes)
866         fi
867 else
868         AC_MSG_RESULT(no)
869 fi
870
871 if test "x$enable_rawshark" = "xyes" ; then
872         rawshark_bin="rawshark\$(EXEEXT)"
873         rawshark_man="rawshark.1"
874 else
875         rawshark_bin=""
876         rawshark_man=""
877 fi
878 AC_SUBST(rawshark_bin)
879 AC_SUBST(rawshark_man)
880
881
882 dnl pcap remote check
883 AC_MSG_CHECKING(whether to use libpcap remote capturing feature)
884
885 AC_ARG_WITH(pcap-remote,
886 [  --with-pcap-remote        use libpcap remote capturing (requires libpcap)],
887 [
888     if test $withval = no
889     then
890         want_pcap_remote=no
891     else
892         want_pcap_remote=yes
893     fi
894 ],[
895     want_pcap_remote=no
896 ])
897 if test "x$want_pcap_remote" = "xno" -o "x$want_pcap" = "xno" ; then
898     AC_MSG_RESULT(no)
899 else
900     AC_MSG_RESULT(yes)
901     AC_WIRESHARK_PCAP_REMOTE_CHECK
902 fi
903
904 dnl zlib check
905 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
906
907 AC_ARG_WITH(zlib,
908   AC_HELP_STRING( [--with-zlib@<:@=DIR@:>@],
909                   [use zlib (located in directory DIR, if supplied) to read compressed data.  @<:@default=yes, if available@:>@]),
910 [
911         if test $withval = no
912         then
913                 want_zlib=no
914         elif test $withval = yes
915         then
916                 want_zlib=yes
917         else
918                 want_zlib=yes
919                 zlib_dir=$withval
920         fi
921 ],[
922         #
923         # Use zlib if it's present, otherwise don't.
924         #
925         want_zlib=ifavailable
926         zlib_dir=
927 ])
928 if test "x$want_zlib" = "xno" ; then
929         AC_MSG_RESULT(no)
930 else
931         AC_MSG_RESULT(yes)
932         AC_WIRESHARK_ZLIB_CHECK
933         if test "x$want_zlib" = "xno" ; then
934                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
935         fi
936 fi
937
938
939 dnl pcre check
940 AC_MSG_CHECKING(whether to use libpcre for regular expressions in dfilters)
941
942 AC_ARG_WITH(pcre,
943   AC_HELP_STRING( [--with-pcre@<:@=DIR@:>@],
944                   [use libpcre (located in directory DIR, if supplied) to use in dfilter regular expressions.  @<:@default=yes, if available@:>@]),
945 [
946         if test $withval = no
947         then
948                 want_pcre=no
949         elif test $withval = yes
950         then
951                 want_pcre=yes
952         else
953                 want_pcre=yes
954                 pcre_dir=$withval
955         fi
956 ],[
957         #
958         # Use libpcre if it's present, otherwise don't.
959         #
960         want_pcre=ifavailable
961         pcre_dir=
962 ])
963 if test "x$want_pcre" = "xno" ; then
964         AC_MSG_RESULT(no)
965 else
966         AC_MSG_RESULT(yes)
967         AC_WIRESHARK_LIBPCRE_CHECK
968         if test "x$want_pcre" = "xno" ; then
969                 AC_MSG_RESULT(libpcre not found - disabling support for perl compatible regular expressions in dfilters)
970         fi
971 fi
972
973
974 dnl lua check
975 AC_MSG_CHECKING(whether to use liblua for the lua scripting plugin)
976
977 AC_ARG_WITH(lua,
978   AC_HELP_STRING( [--with-lua@<:@=DIR@:>@],
979                   [use liblua (located in directory DIR, if supplied) for the lua scripting plugin.  @<:@default=no@:>@]),
980 [
981         if test $withval = no
982         then
983                 want_lua=no
984         elif test $withval = yes
985         then
986                 want_lua=yes
987         else
988                 want_lua=yes
989                 lua_dir=$withval
990         fi
991 ],[
992         #
993         # Don't use liblua by default (it isn't ready yet)
994         #
995         want_lua=no
996         lua_dir=
997 ])
998 if test "x$want_lua" = "xno" ; then
999         AC_MSG_RESULT(no)
1000 else
1001         AC_MSG_RESULT(yes)
1002         AC_WIRESHARK_LIBLUA_CHECK
1003         if test "x$want_lua" = "xno" ; then
1004                 AC_MSG_RESULT(liblua not found - disabling support for the lua scripting plugin)
1005         fi
1006 fi
1007 AM_CONDITIONAL(HAVE_LIBLUA, test x$want_lua = xyes)
1008
1009
1010 dnl portaudio check
1011 AC_MSG_CHECKING(whether to use libportaudio for the rtp_player)
1012
1013 AC_ARG_WITH(portaudio,
1014   AC_HELP_STRING( [--with-portaudio@<:@=DIR@:>@],
1015                   [use libportaudio (located in directory DIR, if supplied) for the rtp_player.  @<:@default=yes, if available@:>@]),
1016 [
1017         if test $withval = no
1018         then
1019                 want_portaudio=no
1020         elif test $withval = yes
1021         then
1022                 want_portaudio=yes
1023         else
1024                 want_portaudio=yes
1025                 portaudio_dir=$withval
1026         fi
1027 ],[
1028         #
1029         # Use libportaudio by default
1030         #
1031         want_portaudio=ifavailable
1032         portaudio_dir=
1033 ])
1034 if test "x$want_portaudio" = "xno" ; then
1035         AC_MSG_RESULT(no)
1036 else
1037         AC_MSG_RESULT(yes)
1038         AC_WIRESHARK_LIBPORTAUDIO_CHECK
1039         if test "x$want_portaudio" = "xno" ; then
1040                 AC_MSG_RESULT(libportaudio not found - disabling support for the rtp_player)
1041         fi
1042 fi
1043 AM_CONDITIONAL(HAVE_LIBPORTAUDIO, test x$want_portaudio = xyes)
1044
1045
1046 dnl ipv6 check
1047 AC_ARG_ENABLE(ipv6,
1048   AC_HELP_STRING( [--enable-ipv6],
1049                   [use ipv6 name resolution, if available.  @<:@default=yes@:>@]),
1050     enable_ipv6=$enableval,enable_ipv6=yes)
1051
1052 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
1053 if test "x$enable_ipv6" = "xno" ; then
1054         AC_MSG_RESULT(no)
1055 else
1056         AC_MSG_RESULT(yes)
1057         AC_WIRESHARK_IPV6_STACK
1058 fi
1059
1060
1061 dnl Check if dumpcap should be installed setuid
1062 AC_ARG_ENABLE(setuid-install,
1063   AC_HELP_STRING( [--enable-setuid-install],
1064                   [install dumpcap as setuid @<:@default=no@:>@]),
1065     enable_setuid_install=$enableval,enable_setuid_install=no)
1066
1067 AC_MSG_CHECKING(whether to install dumpcap setuid)
1068 if test "x$enable_setuid_install" = "xno" ; then
1069         AC_MSG_RESULT(no)
1070 else
1071         if test "x$enable_dumpcap" = "xno" ; then
1072                 AC_MSG_ERROR(Setuid install works only with dumpcap but dumpcap is disabled)
1073         else
1074                 AC_MSG_RESULT(yes)
1075         fi
1076 fi
1077
1078 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
1079 AC_CHECK_FUNCS(setresuid setresgid)
1080
1081 dnl libcap (not libpcap) check
1082 LIBCAP_LIBS=''
1083 AC_MSG_CHECKING(whether to use the libcap capabilities library)
1084
1085 AC_ARG_WITH(libcap,
1086   AC_HELP_STRING( [--with-libcap@<:@=DIR@:>@],
1087                   [use libcap (located in directory DIR, if supplied) for POSIX.1e capabilities management.   @<:@default=yes, if present@:>@]),
1088 [
1089 if   test "x$withval" = "xno";  then
1090         want_libcap=no
1091 elif test "x$withval" = "xyes"; then
1092         want_libcap=yes
1093 elif test -d "$withval"; then
1094         want_libcap=yes
1095         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1096 fi
1097 ])
1098 if test "x$with_libcap" = "xno" ; then
1099         AC_MSG_RESULT(no)
1100 else
1101         AC_MSG_RESULT(yes)
1102         AC_WIRESHARK_LIBCAP_CHECK
1103 fi
1104 AC_SUBST(LIBCAP_LIBS)
1105
1106 dnl Checks for header files.
1107 AC_CHECK_HEADERS(direct.h dirent.h fcntl.h grp.h inttypes.h netdb.h pwd.h stdarg.h stddef.h unistd.h)
1108 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)
1109 AC_CHECK_HEADERS(netinet/in.h)
1110 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
1111
1112 dnl iconv check
1113 AM_ICONV
1114
1115 dnl SSL Check
1116 SSL_LIBS=''
1117 AC_MSG_CHECKING(whether to use SSL library)
1118
1119 AC_ARG_WITH(ssl,
1120   AC_HELP_STRING( [--with-ssl@<:@=DIR@:>@],
1121                   [use SSL crypto library (located in directory DIR, if supplied).   @<:@default=no@:>@]),
1122 [
1123 if test "x$withval" = "xno";  then
1124         want_ssl=no
1125 elif test "x$withval" = "xyes"; then
1126         want_ssl=yes
1127 elif test -d "$withval"; then
1128         want_ssl=yes
1129         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1130 fi
1131 ],[
1132         want_ssl=no
1133 ])
1134 if test "x$want_ssl" = "xyes"; then
1135         AC_MSG_RESULT(yes)
1136         AC_CHECK_LIB(crypto,EVP_md5,
1137             [
1138                 SSL_LIBS=-lcrypto
1139             ],
1140             [
1141                 AC_MSG_ERROR([SSL crypto library was requested, but is not available])
1142             ])
1143 else
1144         AC_MSG_RESULT(no)
1145 fi
1146 AC_SUBST(SSL_LIBS)
1147
1148 dnl kerberos check
1149 AC_MSG_CHECKING(whether to use kerberos)
1150
1151 AC_ARG_WITH(krb5,
1152   AC_HELP_STRING( [--with-krb5@<:@=DIR@:>@],
1153                   [use kerberos (located in directory DIR, if supplied) to use in kerberos dissection  @<:@default=yes@:>@]),
1154 [
1155         if test $withval = no
1156         then
1157                 want_krb5=no
1158         elif test $withval = yes
1159         then
1160                 want_krb5=yes
1161         else
1162                 want_krb5=yes
1163                 krb5_dir=$withval
1164         fi
1165 ],[
1166         #
1167         # Use kerberos if specified, otherwise don't.
1168         #
1169         want_krb5=ifavailable
1170         krb5_dir=
1171 ])
1172 if test "x$want_krb5" = "xno" ; then
1173         AC_MSG_RESULT(no)
1174 else
1175         AC_MSG_RESULT(yes)
1176         AC_WIRESHARK_KRB5_CHECK
1177 fi
1178
1179
1180 dnl ADNS Check
1181 ADNS_LIBS=''
1182 AC_MSG_CHECKING(whether to use the GNU ADNS library if available)
1183
1184 AC_ARG_WITH(adns,
1185   AC_HELP_STRING( [--with-adns@<:@=DIR@:>@],
1186                   [use GNU ADNS (located in directory DIR, if supplied).   @<:@default=yes, if present@:>@]),
1187 [
1188 if   test "x$withval" = "xno";  then
1189         want_adns=no
1190 elif test "x$withval" = "xyes"; then
1191         want_adns=yes
1192 elif test -d "$withval"; then
1193         want_adns=yes
1194         AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1195 fi
1196 ])
1197 if test "x$with_adns" = "xno" ; then
1198         AC_MSG_RESULT(no)
1199 else
1200         AC_MSG_RESULT(yes)
1201         AC_WIRESHARK_ADNS_CHECK
1202 fi
1203 AC_SUBST(ADNS_LIBS)
1204
1205 #
1206 # Define WS_VAR_IMPORT appropriately for declarations of external
1207 # variables exported from dynamically-linked libraries.
1208 #
1209 AC_DEFINE(WS_VAR_IMPORT, extern, [Define as the string to precede external variable declarations in dynamically-linked libraries])
1210
1211 #
1212 # Define HAVE_AIRPDCAP
1213 # We'll want to remove this eventually.
1214 #
1215 AC_DEFINE(HAVE_AIRPDCAP, 1, [Enable AirPDcap (WPA/WPA2 decryption)])
1216
1217 dnl Checks for typedefs, structures, and compiler characteristics.
1218 # AC_C_CONST
1219
1220 # We need to know whether "struct sockaddr" has an "sa_len" member
1221 # for get_interface_list().
1222
1223 AC_WIRESHARK_STRUCT_SA_LEN
1224
1225 # We must know our byte order
1226 AC_C_BIGENDIAN
1227
1228 # Checks whether "-traditional" is needed when using "ioctl".
1229 # XXX - do we need this?
1230 AC_PROG_GCC_TRADITIONAL
1231
1232 GETOPT_C=""
1233 GETOPT_O=""
1234 AC_CHECK_FUNC(getopt, GETOPT_O="",
1235   [GETOPT_O="getopt.o"
1236    AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h needs to be included])
1237 ])
1238 if test "$ac_cv_func_getopt" = no ; then
1239   GETOPT_C="getopt.c"
1240   GETOPT_O="getopt.o"
1241 fi
1242 AC_SUBST(GETOPT_C)
1243 AC_SUBST(GETOPT_O)
1244
1245 AC_CHECK_FUNC(strerror, STRERROR_O="",
1246   [STRERROR_O="strerror.o"
1247    AC_DEFINE(NEED_STRERROR_H, 1, [Define if strerror.h needs to be included])
1248 ])
1249 if test "$ac_cv_func_strerror" = no ; then
1250   STRERROR_C="strerror.c"
1251   STRERROR_O="strerror.o"
1252 fi
1253 AC_SUBST(STRERROR_C)
1254 AC_SUBST(STRERROR_O)
1255
1256 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
1257   STRCASECMP_O="strcasecmp.o")
1258 if test "$ac_cv_func_strcasecmp" = no ; then
1259   STRCASECMP_C="strcasecmp.c"
1260   STRCASECMP_O="strcasecmp.o"
1261 fi
1262 AC_SUBST(STRCASECMP_C)
1263 AC_SUBST(STRCASECMP_O)
1264
1265 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
1266   STRNCASECMP_O="strncasecmp.o")
1267 if test "$ac_cv_func_strncasecmp" = no ; then
1268   STRNCASECMP_C="strncasecmp.c"
1269   STRNCASECMP_O="strncasecmp.o"
1270 fi
1271 AC_SUBST(STRNCASECMP_C)
1272 AC_SUBST(STRNCASECMP_O)
1273
1274 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
1275   MKSTEMP_O="mkstemp.o")
1276 if test "$ac_cv_func_mkstemp" = no ; then
1277   MKSTEMP_C="mkstemp.c"
1278   MKSTEMP_O="mkstemp.o"
1279 fi
1280 AC_SUBST(MKSTEMP_C)
1281 AC_SUBST(MKSTEMP_O)
1282
1283 ac_save_LIBS="$LIBS"
1284 LIBS="$GLIB_LIBS $LIBS"
1285 G_ASCII_STRTOULL_C=""
1286 G_ASCII_STRTOULL_O=""
1287 G_ASCII_STRTOULL_LO=""
1288 AC_CHECK_FUNC(g_ascii_strtoull,
1289   [G_ASCII_STRTOULL_O=""
1290    G_ASCII_STRTOULL_LO=""],
1291   [G_ASCII_STRTOULL_O="g_ascii_strtoull.o"
1292    G_ASCII_STRTOULL_LO="g_ascii_strtoull.lo"
1293    AC_DEFINE(NEED_G_ASCII_STRTOULL_H, 1, [Define if g_ascii_strtoull.h needs to be included])
1294 ])
1295 LIBS="$ac_save_LIBS"
1296 if test "$ac_cv_func_g_ascii_strtoull" = no ; then
1297   G_ASCII_STRTOULL_C="g_ascii_strtoull.c"
1298   G_ASCII_STRTOULL_O="g_ascii_strtoull.o"
1299   G_ASCII_STRTOULL_LO="g_ascii_strtoull.lo"
1300 fi
1301 AC_SUBST(G_ASCII_STRTOULL_C)
1302 AC_SUBST(G_ASCII_STRTOULL_O)
1303 AC_SUBST(G_ASCII_STRTOULL_LO)
1304
1305 AC_CHECK_FUNC(inet_aton,
1306   [INET_ATON_O=""
1307    INET_ATON_LO=""],
1308   [INET_ATON_O="inet_aton.o"
1309    INET_ATON_LO="inet_aton.lo"
1310 ])
1311 if test "$ac_cv_func_inet_aton" = no ; then
1312   INET_ATON_C="inet_aton.c"
1313   INET_ATON_O="inet_aton.o"
1314   INET_ATON_LO="inet_aton.lo"
1315   AC_DEFINE(NEED_INET_ATON_H, 1, [Define if inet/aton.h needs to be included])
1316 fi
1317 AC_SUBST(INET_ATON_C)
1318 AC_SUBST(INET_ATON_O)
1319 AC_SUBST(INET_ATON_LO)
1320
1321 AC_SEARCH_LIBS(inet_pton, [socket nsl], [
1322   dnl check for pre-BIND82 inet_pton() bug.
1323   AC_MSG_CHECKING(for broken inet_pton)
1324   AC_TRY_RUN([#include <sys/types.h>
1325 #include <sys/socket.h>
1326 #include <netinet/in.h>
1327 #include <arpa/inet.h>
1328 int main()
1329 {
1330 #ifdef AF_INET6
1331   char buf[16];
1332   /* this should return 0 (error) */
1333   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
1334 #else
1335   return 1;
1336 #endif
1337 }], [AC_MSG_RESULT(ok);
1338 have_inet_pton=yes], [AC_MSG_RESULT(broken);
1339 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
1340 have_inet_pton=no])],
1341 have_inet_pton=no)
1342 if test "$have_inet_pton" = no; then
1343   INET_PTON_C="inet_pton.c"
1344   INET_PTON_O="inet_pton.o"
1345   INET_PTON_LO="inet_pton.lo"
1346 else
1347   INET_PTON_C=""
1348   INET_PTON_O=""
1349   INET_PTON_LO=""
1350 fi
1351 AC_SUBST(INET_PTON_C)
1352 AC_SUBST(INET_PTON_O)
1353 AC_SUBST(INET_PTON_LO)
1354
1355 AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
1356   AC_MSG_CHECKING([for inet_ntop prototype])
1357   AC_TRY_COMPILE([#include <stdio.h>
1358 #include <sys/types.h>
1359 #include <sys/socket.h>
1360 #include <netinet/in.h>
1361 #include <arpa/inet.h>
1362
1363 extern const char *inet_ntop(int, const void *, char *, size_t);],, [
1364     AC_MSG_RESULT(yes)
1365     AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
1366     [Define if inet_ntop() prototype exists])], [
1367     AC_TRY_COMPILE([#include <stdio.h>
1368 #include <sys/types.h>
1369 #include <sys/socket.h>
1370 #include <netinet/in.h>
1371 #include <arpa/inet.h>
1372
1373 extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
1374       AC_MSG_RESULT(yes)
1375       AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
1376       [Define if inet_ntop() prototype exists])], [
1377       AC_MSG_RESULT(no)])])
1378   INET_NTOP_O=""
1379   INET_NTOP_LO=""], [
1380   INET_NTOP_C="inet_ntop.c"
1381   INET_NTOP_O="inet_ntop.o"
1382   INET_NTOP_LO="inet_ntop.lo"
1383   AC_DEFINE(NEED_INET_V6DEFS_H, 1,
1384   [Define if inet/v6defs.h needs to be included])])
1385 AC_SUBST(INET_NTOP_C)
1386 AC_SUBST(INET_NTOP_O)
1387 AC_SUBST(INET_NTOP_LO)
1388
1389 AC_CHECK_FUNC(strptime, STRPTIME_O="",
1390   [STRPTIME_O="strptime.o"
1391    AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
1392 ])
1393 if test "$ac_cv_func_strptime" = no ; then
1394   STRPTIME_C="strptime.c"
1395   STRPTIME_O="strptime.o"
1396 fi
1397 AC_SUBST(STRPTIME_C)
1398 AC_SUBST(STRPTIME_O)
1399
1400 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
1401 AC_CHECK_FUNCS(issetugid)
1402 AC_CHECK_FUNCS(mmap mprotect sysconf)
1403
1404 dnl blank for now, but will be used in future
1405 AC_SUBST(wireshark_SUBDIRS)
1406
1407 dnl
1408 dnl check whether plugins should be enabled and, if they should be,
1409 dnl check for plugins directory - stolen from Amanda's configure.in
1410 dnl
1411 dnl we don't wish to expand ${libdir} yet
1412 plugindir='${libdir}/wireshark/plugins/${VERSION}'
1413 AC_ARG_WITH(plugins,
1414   AC_HELP_STRING( [--with-plugins@<:@=DIR@:>@],
1415                   [support plugins (installed in DIR, if supplied).   @<:@default=yes, if possible@:>@]),
1416 [
1417   if test "x$withval" = "xno"; then
1418     have_plugins=no
1419   elif test "x$have_plugins" = "xno"; then
1420       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
1421   elif test "x$withval" != "xyes"; then
1422       plugindir="$withval"
1423   fi
1424 ])
1425 AM_CONDITIONAL(HAVE_PLUGINS, test "x$have_plugins" = "xyes")
1426 if test x$have_plugins = xyes
1427 then
1428   AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
1429 fi
1430 AC_SUBST(plugindir)
1431 CPPFLAGS="$CPPFLAGS '-DPLUGIN_DIR=\"\$(plugindir)\"'"
1432
1433 #
1434 # The plugin dissectors reside in ./plugins/PROTO/
1435 #
1436 PLUGIN_LIBS=""
1437 AC_SUBST(PLUGIN_LIBS)
1438
1439 dnl libtool defs
1440 #
1441 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
1442 # (autoconf?  automake?  libtool?) - with the newer version(s), it's
1443 # just an alias for AC_PROG_LIBTOOL, which is called earlier.
1444 #
1445 # With older version(s) of those tool(s), however, it's not just an
1446 # alias, and the configure scripts don't work without it.
1447 #
1448 AM_PROG_LIBTOOL
1449 AC_SUBST(LIBTOOL_DEPS)
1450
1451 AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes)
1452 if test x$enable_static = xyes -a x$have_plugins = xyes
1453 then
1454   AC_DEFINE(ENABLE_STATIC, 1, [Link plugins statically into Wireshark])
1455 fi
1456 AC_SUBST(ENABLE_STATIC)
1457
1458 dnl Save the cacheable configure results to config.cache before recursing
1459 AC_CACHE_SAVE
1460
1461 AM_CONFIG_HEADER(config.h)
1462 AC_OUTPUT(
1463   Makefile
1464   doxygen.cfg
1465   asn1/Makefile
1466   asn1/acp133/Makefile
1467   asn1/acse/Makefile
1468   asn1/ansi_map/Makefile
1469   asn1/ansi-tcap/Makefile
1470   asn1/camel/Makefile
1471   asn1/cdt/Makefile
1472   asn1/cmip/Makefile
1473   asn1/cms/Makefile
1474   asn1/dap/Makefile
1475   asn1/disp/Makefile
1476   asn1/dop/Makefile
1477   asn1/dsp/Makefile
1478   asn1/ess/Makefile
1479   asn1/ftam/Makefile
1480   asn1/gnm/Makefile
1481   asn1/gsmmap/Makefile
1482   asn1/h225/Makefile
1483   asn1/h235/Makefile
1484   asn1/h245/Makefile
1485   asn1/h248/Makefile
1486   asn1/h282/Makefile
1487   asn1/h283/Makefile
1488   asn1/h323/Makefile
1489   asn1/h450/Makefile
1490   asn1/h450-ros/Makefile
1491   asn1/h460/Makefile
1492   asn1/h501/Makefile
1493   asn1/inap/Makefile
1494   asn1/ldap/Makefile
1495   asn1/logotype-cert-extn/Makefile
1496   asn1/mms/Makefile
1497   asn1/mpeg-audio/Makefile
1498   asn1/mpeg-pes/Makefile
1499   asn1/nbap/Makefile
1500   asn1/ns-cert-exts/Makefile
1501   asn1/ocsp/Makefile
1502   asn1/p7/Makefile
1503   asn1/pcap/Makefile
1504   asn1/pkcs1/Makefile
1505   asn1/pkcs12/Makefile
1506   asn1/pkinit/Makefile
1507   asn1/pkix1explicit/Makefile
1508   asn1/pkix1implicit/Makefile
1509   asn1/pkixcmp/Makefile
1510   asn1/pkixcrmf/Makefile
1511   asn1/pkixproxy/Makefile
1512   asn1/pkixqualified/Makefile
1513   asn1/pkixtsp/Makefile
1514   asn1/pres/Makefile
1515   asn1/q932/Makefile
1516   asn1/q932-ros/Makefile
1517   asn1/qsig/Makefile
1518   asn1/ranap/Makefile
1519   asn1/rnsap/Makefile
1520   asn1/ros/Makefile
1521   asn1/rrc/Makefile
1522   asn1/rrlp/Makefile
1523   asn1/rtse/Makefile
1524   asn1/s1ap/Makefile
1525   asn1/s4406/Makefile
1526   asn1/sabp/Makefile
1527   asn1/smrse/Makefile
1528   asn1/snmp/Makefile
1529   asn1/spnego/Makefile
1530   asn1/t125/Makefile
1531   asn1/t38/Makefile
1532   asn1/tcap/Makefile
1533   asn1/ulp/Makefile
1534   asn1/wlancertextn/Makefile
1535   asn1/x2ap/Makefile
1536   asn1/x411/Makefile
1537   asn1/x420/Makefile
1538   asn1/x509af/Makefile
1539   asn1/x509ce/Makefile
1540   asn1/x509if/Makefile
1541   asn1/x509sat/Makefile
1542   asn1/x721/Makefile
1543   doc/Makefile
1544   epan/Makefile
1545   epan/crypt/Makefile
1546   epan/doxygen.cfg
1547   epan/dfilter/Makefile
1548   epan/dissectors/Makefile
1549   epan/ftypes/Makefile
1550   epan/wslua/Makefile
1551   codecs/Makefile
1552   gtk/Makefile
1553   gtk/doxygen.cfg
1554   help/Makefile
1555   packaging/Makefile
1556   packaging/macosx/Info.plist
1557   packaging/nsis/Makefile
1558   packaging/rpm/Makefile
1559   packaging/rpm/SPECS/Makefile
1560   packaging/rpm/SPECS/wireshark.spec
1561   packaging/svr4/Makefile
1562   packaging/svr4/checkinstall
1563   packaging/svr4/pkginfo
1564   plugins/Makefile
1565   plugins/agentx/Makefile
1566   plugins/artnet/Makefile
1567   plugins/asn1/Makefile
1568   plugins/ciscosm/Makefile
1569   plugins/docsis/Makefile
1570   plugins/enttec/Makefile
1571   plugins/ethercat/Makefile
1572   plugins/giop/Makefile
1573   plugins/gryphon/Makefile
1574   plugins/infiniband/Makefile
1575   plugins/irda/Makefile
1576   plugins/lwres/Makefile
1577   plugins/m2m/Makefile
1578   plugins/mate/Makefile
1579   plugins/opcua/Makefile
1580   plugins/opsi/Makefile
1581   plugins/pcli/Makefile
1582   plugins/profinet/Makefile
1583   plugins/rlm/Makefile
1584   plugins/rtnet/Makefile
1585   plugins/rudp/Makefile
1586   plugins/sbus/Makefile
1587   plugins/sercosiii/Makefile
1588   plugins/stats_tree/Makefile
1589   plugins/unistim/Makefile
1590   plugins/v5ua/Makefile
1591   plugins/wimax/Makefile
1592   plugins/wimaxasncp/Makefile
1593   tools/Makefile
1594   tools/idl2wrs.sh
1595   tools/lemon/Makefile
1596   wiretap/Makefile
1597   ,)
1598 dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])
1599
1600
1601 # Pretty messages
1602
1603 if test "x$enable_setuid_install" = "xyes" ; then
1604         setuid_message="yes"
1605 else
1606         setuid_message="no"
1607 fi
1608
1609 if test "x$want_zlib" = "xno" ; then
1610         zlib_message="no"
1611 else
1612         zlib_message="yes"
1613 fi
1614
1615 if test "x$want_pcre" = "xno" ; then
1616         pcre_message="no"
1617 else
1618         pcre_message="yes"
1619 fi
1620
1621 if test "x$want_lua" = "xyes" -a "x$have_plugins" = "xyes" ; then
1622         lua_message="yes"
1623 else
1624         lua_message="no"
1625 fi
1626
1627 if test "x$want_portaudio" = "xyes" ; then
1628         portaudio_message="yes"
1629 else
1630         portaudio_message="no"
1631 fi
1632
1633 if test "x$want_ssl" = "xno" ; then
1634         ssl_message="no"
1635 else
1636         ssl_message="yes"
1637 fi
1638
1639 if test "x$want_krb5" = "xno" ; then
1640         krb5_message="no"
1641 else
1642         krb5_message="yes ($ac_krb5_version)"
1643 fi
1644
1645 if test "x$have_good_adns" = "xyes" ; then
1646         adns_message="yes"
1647 else
1648         adns_message="no"
1649 fi
1650
1651 if test "x$have_good_libcap" = "xyes" ; then
1652         libcap_message="yes"
1653 else
1654         libcap_message="no"
1655 fi
1656
1657 echo ""
1658 echo "The Wireshark package has been configured with the following options."
1659 echo "                    Build wireshark : $enable_wireshark"
1660 echo "                       Build tshark : $enable_tshark"
1661 echo "                     Build capinfos : $enable_capinfos"
1662 echo "                      Build editcap : $enable_editcap"
1663 echo "                      Build dumpcap : $enable_dumpcap"
1664 echo "                     Build mergecap : $enable_mergecap"
1665 echo "                    Build text2pcap : $enable_text2pcap"
1666 echo "                      Build idl2wrs : $enable_idl2wrs"
1667 echo "                      Build randpkt : $enable_randpkt"
1668 echo "                       Build dftest : $enable_dftest"
1669 echo "                     Build rawshark : $enable_rawshark"
1670 echo ""
1671 echo "             Install dumpcap setuid : $setuid_message"
1672 echo "                        Use plugins : $have_plugins"
1673 echo "                   Build lua plugin : $lua_message"
1674 echo "                   Build rtp_player : $portaudio_message"
1675 echo "                        Use threads : $enable_threads"
1676 echo "             Build profile binaries : $enable_profile_build"
1677 echo "                   Use pcap library : $want_pcap"
1678 echo "                   Use zlib library : $zlib_message"
1679 echo "                   Use pcre library : $pcre_message"
1680 echo "               Use kerberos library : $krb5_message"
1681 echo "               Use GNU ADNS library : $adns_message"
1682 echo "                Use SMI MIB library : $libsmi_message"
1683 echo "             Use GNU crypto library : $gcrypt_message"
1684 echo "             Use SSL crypto library : $ssl_message"
1685 echo "           Use IPv6 name resolution : $enable_ipv6"
1686 echo "                 Use gnutls library : $tls_message"
1687 echo "                 Use libcap library : $libcap_message"