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