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