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