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