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