1 # $Id: configure.in,v 1.143 2001/12/23 21:11:23 gerald Exp $
3 dnl Process this file with autoconf 2.13 or later to produce a
4 dnl configure script; 2.12 doesn't generate a "configure" script that
5 dnl defines SHELL, and "Makefile.in" has
9 dnl which requires it to be defined - and there may be other problems
10 dnl with pre-2.13 "autoconf" as well.
16 AM_INIT_AUTOMAKE(ethereal, 0.9.0)
18 dnl Check for CPU / vendor / OS
21 dnl Checks for programs.
27 AC_PATH_PROG(PERL, perl)
28 AC_PATH_PROG(LEX, flex)
29 AC_PATH_PROG(PYTHON, python)
35 # Check for packaging utilities
36 # For now, we check to see if the various packaging utilites are in our
37 # path. I'm too lazy to write code to go hunt for them. - Gerald
38 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
39 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
40 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
41 AC_CHECK_PROG(HAVE_RPM, rpm, "yes", "no")
43 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
44 -a x$HAVE_PKGTRANS = xyes ; then
45 HAVE_SVR4_PACKAGING=yes
47 HAVE_SVR4_PACKAGING=no
49 AC_SUBST(HAVE_SVR4_PACKAGING)
51 # Grr. Rpm 2.x has a nifty "--showrc" flag that lists all of the current
52 # configuration values. Version 3.x took the niftiness away by returning
53 # the values in their raw, unexpanded, macro-embedded form. We can either
54 # try to expand the values we get from 3.x, or poke around for popular build
57 if test x$HAVE_RPM = xyes ; then
58 AC_MSG_CHECKING(for rpm build directories)
59 RPM_SOURCESDIR=`rpm --showrc | grep "^sourcedir" | \
60 sed -e 's/.*: //' 2> /dev/null`
61 if test x$RPM_SPECDIR = x ; then
62 # Red Hat : /usr/src/redhat
63 # Mandrake : /usr/scr/rpm
64 # SuSE : /usr/src/packages
65 for TEST_DIR in /usr/src/redhat /usr/src/rpm /usr/src/packages ; do
66 if test -d $TEST_DIR/SPECS -a -d $TEST_DIR/SOURCES -a \
67 -d $TEST_DIR/RPMS -a -d $TEST_DIR/SRPMS -a \
68 -d $TEST_DIR/BUILD ; then
69 RPM_SOURCESDIR=$TEST_DIR/SOURCES
73 if test x$RPM_SOURCESDIR = x ; then
74 AC_MSG_RESULT(not found)
78 HAVE_RPM_PACKAGING=yes
81 AC_SUBST(HAVE_RPM_PACKAGING)
84 # If we're running gcc, add '-Wall' to CFLAGS.
85 AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
86 if test x$GCC != x ; then
87 CFLAGS="-Wall -W -Wno-unused $CFLAGS"
94 # Add any platform-specific compiler flags needed.
96 AC_MSG_CHECKING(for platform-specific compiler flags)
100 # Not GCC - assume it's the vendor's compiler.
105 # HP's ANSI C compiler; flags suggested by Jost Martin.
106 # "-Ae" for ANSI C plus extensions such as "long long".
107 # "+O2", for optimization. XXX - works with "-g"?
109 CFLAGS="-Ae +O2 $CFLAGS"
110 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
114 # It may be called "cc", but it's really a GCC derivative
115 # with a problematic special precompiler and precompiled
116 # headers; turn off the special precompiler, as some
117 # apparently-legal code won't compile with its precompiled
120 CFLAGS="-no-cpp-precomp $CFLAGS"
121 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
124 AC_MSG_RESULT(none needed)
130 # the X11 headers don't automatically include prototype info
131 # and a lot don't include the return type
132 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
133 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
137 # See comments above about Apple's lovely C compiler.
139 CFLAGS="-no-cpp-precomp $CFLAGS"
140 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
143 AC_MSG_RESULT(none needed)
149 # Arrange that we search for header files in the source directory
150 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
151 # as various packages we use ("libpcap", "zlib", an SNMP library)
152 # may have been installed under "/usr/local/include".
154 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
155 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
158 # Arrange that we search for libraries in "/usr/local/lib".
160 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
162 # Create DATAFILE_DIR #define for config.h
163 DATAFILE_DIR=$sysconfdir
165 test "x$prefix" = xNONE && prefix=$ac_default_prefix
166 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
167 eval echo "$DATAFILE_DIR"
169 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
170 AC_SUBST(DATAFILE_DIR)
172 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
176 AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
177 if test x$LD_LIBRARY_PATH != x ; then
178 LIBS="$LIBS -R$LD_LIBRARY_PATH"
179 AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
181 AC_MSG_RESULT(no -- this may be a problem in a few seconds)
187 # Enable/disable tethereal
191 AC_ARG_ENABLE(ethereal,
192 [ --enable-ethereal build GTK+-based ethereal. [default=yes]],,enable_ethereal=yes)
195 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
196 # programs to be built with GTK+.
198 if test "x$enable_ethereal" = "xyes" ; then
199 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
203 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
204 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
205 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
206 # set when generating the Makefile, so we can make programs that require
207 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
208 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
209 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
210 # programs to be built with GLib.
212 if test "$GTK_OK" = "yes" -a "x$enable_ethereal" = "xyes" ; then
213 ethereal_bin="ethereal"
214 ethereal_man="ethereal.1"
215 ethereal_SUBDIRS="gtk"
218 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
224 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
228 # Check whether GLib modules are supported, to determine whether we
229 # can support plugins.
231 AC_MSG_CHECKING(whether GLib supports loadable modules)
232 ac_save_CFLAGS="$CFLAGS"
234 CFLAGS="$CFLAGS $GLIB_CFLAGS"
235 LIBS="$GLIB_LIBS $LIBS"
245 if (g_module_supported())
246 return 0; /* success */
248 return 1; /* failure */
250 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
251 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
252 CFLAGS="$ac_save_CFLAGS"
254 if test "$ac_cv_glib_supports_modules" = yes ; then
263 AC_SUBST(ethereal_bin)
264 AC_SUBST(ethereal_man)
268 # Enable/disable tethereal
270 AC_ARG_ENABLE(tethereal,
271 [ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
273 if test "x$enable_tethereal" = "xyes" ; then
274 tethereal_bin="tethereal"
275 tethereal_man="tethereal.1"
280 AC_SUBST(tethereal_bin)
281 AC_SUBST(tethereal_man)
285 # Enable/disable editcap
287 AC_ARG_ENABLE(editcap,
288 [ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
290 if test "x$enable_editcap" = "xyes" ; then
291 editcap_bin="editcap"
292 editcap_man="editcap.1"
297 AC_SUBST(editcap_bin)
298 AC_SUBST(editcap_man)
301 # Enable/disable mergecap
303 AC_ARG_ENABLE(mergecap,
304 [ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
306 if test "x$enable_mergecap" = "xyes" ; then
307 mergecap_bin="mergecap"
308 mergecap_man="mergecap.1"
313 AC_SUBST(mergecap_bin)
314 AC_SUBST(mergecap_man)
317 # Enable/disable text2pcap
319 AC_ARG_ENABLE(text2pcap,
320 [ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
322 if test "x$enable_text2pcap" = "xyes" ; then
323 text2pcap_bin="text2pcap"
324 text2pcap_man="text2pcap.1"
329 AC_SUBST(text2pcap_bin)
330 AC_SUBST(text2pcap_man)
332 # Enable/disable idl2eth
334 AC_ARG_ENABLE(idl2eth,
335 [ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)
337 if test "x$enable_idl2eth" = "xyes" ; then
338 idl2eth_bin="idl2eth"
339 idl2eth_man="idl2eth.1"
344 AC_SUBST(idl2eth_bin)
345 AC_SUBST(idl2eth_man)
348 # Enable/disable dftest
350 AC_ARG_ENABLE(dftest,
351 [ --enable-dftest build dftest. [default=no]],,enable_dftest=no)
353 if test "x$enable_dftest" = "xyes" ; then
361 # Enable/disable randpkt
363 AC_ARG_ENABLE(randpkt,
364 [ --enable-randpkt build randpkt. [default=no]],,enable_randpkt=no)
366 if test "x$enable_randpkt" = "xyes" ; then
367 randpkt_bin="randpkt"
371 AC_SUBST(randpkt_bin)
374 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
375 dnl "gethostbyname()".
376 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
378 dnl Checks for "connect()", used as a proxy for "socket()" - and
379 dnl "-lsocket", if we need it to get "connect()".
380 AC_ETHEREAL_SOCKET_LIB_CHECK
383 AC_MSG_CHECKING(whether to use libpcap for packet capture)
386 [ --with-pcap[=DIR] use libpcap for packet capturing. [default=yes]],
388 if test $withval = no
391 elif test $withval = yes
402 if test "x$want_pcap" = "xno" ; then
406 AC_ETHEREAL_PCAP_CHECK
407 AC_ETHEREAL_PCAP_VERSION_CHECK
412 [ --enable-zlib use zlib to read compressed data. [default=yes]],,enable_zlib=yes)
414 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
415 if test "x$enable_zlib" = "xno" ; then
419 AC_ETHEREAL_ZLIB_CHECK
420 if test "x$enable_zlib" = "xno" ; then
421 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
428 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
430 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
431 if test "x$enable_ipv6" = "xno" ; then
435 AC_ETHEREAL_IPV6_STACK
439 dnl Check if ethereal should be installed setuid
440 AC_ARG_ENABLE(setuid-install,
441 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
443 AC_MSG_CHECKING(whether to install ethereal setuid)
444 if test "x$enable_setuid_install" = "xno" ; then
450 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
452 dnl Checks for header files.
454 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
455 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
456 AC_CHECK_HEADERS(sys/wait.h)
457 AC_CHECK_HEADERS(netinet/in.h)
458 AC_CHECK_HEADERS(stddef.h)
459 AC_CHECK_HEADERS(arpa/inet.h)
460 AC_CHECK_HEADERS(iconv.h)
464 AC_MSG_CHECKING(whether to use SSL library if available)
465 if test "x$enable_ssl" = "xno" ; then
469 AC_ETHEREAL_SSL_CHECK
475 [ --enable-snmp use SNMP library, if available. [default=yes]],,enable_snmp=yes)
478 AC_MSG_CHECKING(whether to use SNMP library if available)
479 if test "x$enable_snmp" = "xno" ; then
483 AC_ETHEREAL_UCDSNMP_CHECK
484 AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
487 # If we found both UCD and CMU SNMP headers, die, as both
488 # packages install the SNMP library as "libsnmp", so either
489 # only one of them is present or they're in different
490 # directories, and we run the risk of picking up the headers
491 # from one and the library from another.
493 if test "$ac_cv_header_ucd_snmp_snmp_h" = yes -a \
494 "$ac_cv_header_snmp_snmp_h" = yes ; then
495 AC_MSG_ERROR([Both UCD and CMU SNMP libraries found - uninstall one of them.])
499 # Look for the string 'sbuf' in ucd-snmp/mib.h. If found, assume
500 # we've encountered a Red Hat-modified version of UCD SNMP.
502 # XXX - Check for 'binit()' in parse.h
504 AC_EGREP_HEADER(sprint_objid.*sbuf, ucd-snmp/mib.h,
505 AC_DEFINE(RED_HAT_MODIFIED_UCD_SNMP))
509 # This may require "-lkstat" on Solaris, sigh.
511 AC_CHECK_LIB(snmp, sprint_objid,
515 # Throw away the cached "we didn't find it" answer.
517 unset ac_cv_lib_snmp_sprint_objid
518 AC_CHECK_LIB(snmp, sprint_objid,
521 # Throw away the cached "we found it" answer, so that if
522 # we rerun "configure", we don't just blow off this check
523 # and blithely assume that we don't need "-lkstat".
525 # XXX - autoconf really needs a way to test for a given
526 # routine in a given library *and* to test whether additional
527 # "-L"/"-R"/whatever flags are needed *before* the "-l"
528 # flag for the library and to test whether additional libraries
529 # are needed after the library *and* to cache all that
532 unset ac_cv_lib_snmp_sprint_objid
533 SNMP_LIBS="-lsnmp -lkstat"
534 ],,$SOCKET_LIBS $NSL_LIBS $SSL_LIBS -lkstat
536 ], $SOCKET_LIBS $NSL_LIBS $SSL_LIBS
540 # If we have SNMP header files but didn't find "sprint_objid()",
541 # fail, as there's something wrong (perhaps the user needs to
542 # specify "--with-ssl").
544 if test '(' "$ac_cv_header_ucd_snmp_snmp_h" = yes -o \
545 "$ac_cv_header_snmp_snmp_h" = yes ')' -a \
546 "$ac_cv_lib_snmp_sprint_objid" = no; then
547 AC_MSG_ERROR([SNMP header files found, but sprint_objid not found in SNMP library.])
552 dnl Checks for typedefs, structures, and compiler characteristics.
555 # We need to know whether "struct sockaddr" has an "sa_len" member
556 # for get_interface_list().
558 AC_ETHEREAL_STRUCT_SA_LEN
560 # We must know our byte order
563 # Checks whether "-traditional" is needed when using "ioctl".
564 # XXX - do we need this?
565 AC_PROG_GCC_TRADITIONAL
567 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
568 # then this won't work.
571 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
572 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
573 if test "$ac_cv_func_snprintf" = no ; then
574 SNPRINTF_C="snprintf.c"
575 SNPRINTF_O="snprintf.o"
580 AC_CHECK_FUNC(strerror, STRERROR_O="",
581 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
582 if test "$ac_cv_func_strerror" = no ; then
583 STRERROR_C="strerror.c"
584 STRERROR_O="strerror.o"
589 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
590 STRCASECMP_O="strcasecmp.o")
591 if test "$ac_cv_func_strcasecmp" = no ; then
592 STRCASECMP_C="strcasecmp.c"
593 STRCASECMP_O="strcasecmp.o"
595 AC_SUBST(STRCASECMP_C)
596 AC_SUBST(STRCASECMP_O)
598 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
599 STRNCASECMP_O="strncasecmp.o")
600 if test "$ac_cv_func_strncasecmp" = no ; then
601 STRNCASECMP_C="strncasecmp.c"
602 STRNCASECMP_O="strncasecmp.o"
604 AC_SUBST(STRNCASECMP_C)
605 AC_SUBST(STRNCASECMP_O)
607 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
608 MKSTEMP_O="mkstemp.o")
609 if test "$ac_cv_func_mkstemp" = no ; then
610 MKSTEMP_C="mkstemp.c"
611 MKSTEMP_O="mkstemp.o"
616 AC_CHECK_FUNC(strptime, STRPTIME_O="",
617 STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
618 if test "$ac_cv_func_strptime" = no ; then
619 STRPTIME_C="strptime.c"
620 STRPTIME_O="strptime.o"
625 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
627 dnl blank for now, but will be used in future
628 AC_SUBST(ethereal_SUBDIRS)
631 dnl check whether plugins should be enabled and, if they should be,
632 dnl check for plugins directory - stolen from Amanda's configure.in
634 PLUGIN_DIR="$libdir/ethereal/plugins/$VERSION"
636 [ --with-plugins[=DIR] support plugins (installed in DIR, if supplied).],
640 if test x$have_plugins = xno
642 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
649 if test x$have_plugins = xno
651 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
653 PLUGIN_DIR="$withval"
659 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
660 if test x$have_plugins = xyes
662 AC_DEFINE(HAVE_PLUGINS)
664 test "x$prefix" = xNONE && prefix=$ac_default_prefix
665 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
666 eval echo "$PLUGIN_DIR"
668 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
670 AC_DEFINE(PLUGIN_DIR,NULL)
677 AC_SUBST(LIBTOOL_DEPS)
679 AM_CONFIG_HEADER(config.h)
680 AC_CONFIG_SUBDIRS(epan wiretap)
686 packaging/nsis/Makefile
687 packaging/rpm/Makefile
688 packaging/rpm/ethereal.spec
689 packaging/svr4/Makefile
690 packaging/svr4/checkinstall
691 packaging/svr4/pkginfo
693 plugins/gryphon/Makefile
694 plugins/mgcp/Makefile
695 plugins/giop/Makefile
703 if test "x$enable_setuid_install" = "xyes" ; then
704 setuid_message="yes (DANGEROUS!!!)"
709 if test "x$SNMP_LIBS" = "x" ; then
710 snmp_libs_message="no"
712 snmp_libs_message="yes"
718 echo "The Ethereal package has been configured with the following options."
719 echo " Build ethereal : $enable_ethereal"
720 echo " Build tethereal : $enable_tethereal"
721 echo " Build editcap : $enable_editcap"
722 echo " Build mergecap : $enable_mergecap"
723 echo " Build text2pcap : $enable_text2pcap"
724 echo " Build idl2eth : $enable_idl2eth"
725 echo " Build randpkt : $enable_randpkt"
726 echo " Build dftest : $enable_dftest"
728 echo " Install setuid : $setuid_message"
729 echo " Use plugins : $have_plugins"
730 echo " Use pcap library : $want_pcap"
731 echo " Use zlib library : $enable_zlib"
732 echo " Use IPv6 name resolution : $enable_ipv6"
733 echo " Use SNMP library : $snmp_libs_message"