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