1 # $Id: configure.in,v 1.144 2002/01/09 23:21:54 gram 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)
148 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan"
149 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan"
151 dnl Look in /usr/local for header files and libraries ?
152 AC_ARG_ENABLE(usr-local,
153 [ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
155 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
156 if test "x$enable_usr_local" = "xyes" ; then
159 # Arrange that we search for header files in the source directory
160 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
161 # as various packages we use ("libpcap", "zlib", an SNMP library)
162 # may have been installed under "/usr/local/include".
164 CFLAGS="$CFLAGS -I/usr/local/include"
165 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
168 # Arrange that we search for libraries in "/usr/local/lib".
170 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
175 # Create DATAFILE_DIR #define for config.h
176 DATAFILE_DIR=$sysconfdir
178 test "x$prefix" = xNONE && prefix=$ac_default_prefix
179 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
180 eval echo "$DATAFILE_DIR"
182 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
183 AC_SUBST(DATAFILE_DIR)
185 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
189 AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
190 if test x$LD_LIBRARY_PATH != x ; then
191 LIBS="$LIBS -R$LD_LIBRARY_PATH"
192 AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
194 AC_MSG_RESULT(no -- this may be a problem in a few seconds)
200 # Enable/disable tethereal
204 AC_ARG_ENABLE(ethereal,
205 [ --enable-ethereal build GTK+-based ethereal. [default=yes]],,enable_ethereal=yes)
208 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
209 # programs to be built with GTK+.
211 if test "x$enable_ethereal" = "xyes" ; then
212 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
216 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
217 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
218 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
219 # set when generating the Makefile, so we can make programs that require
220 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
221 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
222 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
223 # programs to be built with GLib.
225 if test "$GTK_OK" = "yes" -a "x$enable_ethereal" = "xyes" ; then
226 ethereal_bin="ethereal"
227 ethereal_man="ethereal.1"
228 ethereal_SUBDIRS="gtk"
231 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
237 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
241 # Check whether GLib modules are supported, to determine whether we
242 # can support plugins.
244 AC_MSG_CHECKING(whether GLib supports loadable modules)
245 ac_save_CFLAGS="$CFLAGS"
247 CFLAGS="$CFLAGS $GLIB_CFLAGS"
248 LIBS="$GLIB_LIBS $LIBS"
258 if (g_module_supported())
259 return 0; /* success */
261 return 1; /* failure */
263 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
264 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
265 CFLAGS="$ac_save_CFLAGS"
267 if test "$ac_cv_glib_supports_modules" = yes ; then
276 AC_SUBST(ethereal_bin)
277 AC_SUBST(ethereal_man)
281 # Enable/disable tethereal
283 AC_ARG_ENABLE(tethereal,
284 [ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
286 if test "x$enable_tethereal" = "xyes" ; then
287 tethereal_bin="tethereal"
288 tethereal_man="tethereal.1"
293 AC_SUBST(tethereal_bin)
294 AC_SUBST(tethereal_man)
298 # Enable/disable editcap
300 AC_ARG_ENABLE(editcap,
301 [ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
303 if test "x$enable_editcap" = "xyes" ; then
304 editcap_bin="editcap"
305 editcap_man="editcap.1"
310 AC_SUBST(editcap_bin)
311 AC_SUBST(editcap_man)
314 # Enable/disable mergecap
316 AC_ARG_ENABLE(mergecap,
317 [ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
319 if test "x$enable_mergecap" = "xyes" ; then
320 mergecap_bin="mergecap"
321 mergecap_man="mergecap.1"
326 AC_SUBST(mergecap_bin)
327 AC_SUBST(mergecap_man)
330 # Enable/disable text2pcap
332 AC_ARG_ENABLE(text2pcap,
333 [ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
335 if test "x$enable_text2pcap" = "xyes" ; then
336 text2pcap_bin="text2pcap"
337 text2pcap_man="text2pcap.1"
342 AC_SUBST(text2pcap_bin)
343 AC_SUBST(text2pcap_man)
345 # Enable/disable idl2eth
347 AC_ARG_ENABLE(idl2eth,
348 [ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)
350 if test "x$enable_idl2eth" = "xyes" ; then
351 idl2eth_bin="idl2eth"
352 idl2eth_man="idl2eth.1"
357 AC_SUBST(idl2eth_bin)
358 AC_SUBST(idl2eth_man)
361 # Enable/disable dftest
363 AC_ARG_ENABLE(dftest,
364 [ --enable-dftest build dftest. [default=no]],,enable_dftest=no)
366 if test "x$enable_dftest" = "xyes" ; then
374 # Enable/disable randpkt
376 AC_ARG_ENABLE(randpkt,
377 [ --enable-randpkt build randpkt. [default=no]],,enable_randpkt=no)
379 if test "x$enable_randpkt" = "xyes" ; then
380 randpkt_bin="randpkt"
384 AC_SUBST(randpkt_bin)
387 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
388 dnl "gethostbyname()".
389 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
391 dnl Checks for "connect()", used as a proxy for "socket()" - and
392 dnl "-lsocket", if we need it to get "connect()".
393 AC_ETHEREAL_SOCKET_LIB_CHECK
396 AC_MSG_CHECKING(whether to use libpcap for packet capture)
399 [ --with-pcap[=DIR] use libpcap for packet capturing. [default=yes]],
401 if test $withval = no
404 elif test $withval = yes
415 if test "x$want_pcap" = "xno" ; then
419 AC_ETHEREAL_PCAP_CHECK
420 AC_ETHEREAL_PCAP_VERSION_CHECK
425 [ --enable-zlib use zlib to read compressed data. [default=yes]],,enable_zlib=yes)
427 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
428 if test "x$enable_zlib" = "xno" ; then
432 AC_ETHEREAL_ZLIB_CHECK
433 if test "x$enable_zlib" = "xno" ; then
434 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
441 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
443 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
444 if test "x$enable_ipv6" = "xno" ; then
448 AC_ETHEREAL_IPV6_STACK
452 dnl Check if ethereal should be installed setuid
453 AC_ARG_ENABLE(setuid-install,
454 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
456 AC_MSG_CHECKING(whether to install ethereal setuid)
457 if test "x$enable_setuid_install" = "xno" ; then
463 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
465 dnl Checks for header files.
467 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
468 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
469 AC_CHECK_HEADERS(sys/wait.h)
470 AC_CHECK_HEADERS(netinet/in.h)
471 AC_CHECK_HEADERS(stddef.h)
472 AC_CHECK_HEADERS(arpa/inet.h)
473 AC_CHECK_HEADERS(iconv.h)
477 AC_MSG_CHECKING(whether to use SSL library if available)
478 if test "x$enable_ssl" = "xno" ; then
482 AC_ETHEREAL_SSL_CHECK
488 [ --enable-snmp use SNMP library, if available. [default=yes]],,enable_snmp=yes)
491 AC_MSG_CHECKING(whether to use SNMP library if available)
492 if test "x$enable_snmp" = "xno" ; then
496 AC_ETHEREAL_UCDSNMP_CHECK
497 AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
500 # If we found both UCD and CMU SNMP headers, die, as both
501 # packages install the SNMP library as "libsnmp", so either
502 # only one of them is present or they're in different
503 # directories, and we run the risk of picking up the headers
504 # from one and the library from another.
506 if test "$ac_cv_header_ucd_snmp_snmp_h" = yes -a \
507 "$ac_cv_header_snmp_snmp_h" = yes ; then
508 AC_MSG_ERROR([Both UCD and CMU SNMP libraries found - uninstall one of them.])
512 # Look for the string 'sbuf' in ucd-snmp/mib.h. If found, assume
513 # we've encountered a Red Hat-modified version of UCD SNMP.
515 # XXX - Check for 'binit()' in parse.h
517 AC_EGREP_HEADER(sprint_objid.*sbuf, ucd-snmp/mib.h,
518 AC_DEFINE(RED_HAT_MODIFIED_UCD_SNMP))
522 # This may require "-lkstat" on Solaris, sigh.
524 AC_CHECK_LIB(snmp, sprint_objid,
528 # Throw away the cached "we didn't find it" answer.
530 unset ac_cv_lib_snmp_sprint_objid
531 AC_CHECK_LIB(snmp, sprint_objid,
534 # Throw away the cached "we found it" answer, so that if
535 # we rerun "configure", we don't just blow off this check
536 # and blithely assume that we don't need "-lkstat".
538 # XXX - autoconf really needs a way to test for a given
539 # routine in a given library *and* to test whether additional
540 # "-L"/"-R"/whatever flags are needed *before* the "-l"
541 # flag for the library and to test whether additional libraries
542 # are needed after the library *and* to cache all that
545 unset ac_cv_lib_snmp_sprint_objid
546 SNMP_LIBS="-lsnmp -lkstat"
547 ],,$SOCKET_LIBS $NSL_LIBS $SSL_LIBS -lkstat
549 ], $SOCKET_LIBS $NSL_LIBS $SSL_LIBS
553 # If we have SNMP header files but didn't find "sprint_objid()",
554 # fail, as there's something wrong (perhaps the user needs to
555 # specify "--with-ssl").
557 if test '(' "$ac_cv_header_ucd_snmp_snmp_h" = yes -o \
558 "$ac_cv_header_snmp_snmp_h" = yes ')' -a \
559 "$ac_cv_lib_snmp_sprint_objid" = no; then
560 AC_MSG_ERROR([SNMP header files found, but sprint_objid not found in SNMP library.])
565 dnl Checks for typedefs, structures, and compiler characteristics.
568 # We need to know whether "struct sockaddr" has an "sa_len" member
569 # for get_interface_list().
571 AC_ETHEREAL_STRUCT_SA_LEN
573 # We must know our byte order
576 # Checks whether "-traditional" is needed when using "ioctl".
577 # XXX - do we need this?
578 AC_PROG_GCC_TRADITIONAL
580 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
581 # then this won't work.
584 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
585 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
586 if test "$ac_cv_func_snprintf" = no ; then
587 SNPRINTF_C="snprintf.c"
588 SNPRINTF_O="snprintf.o"
593 AC_CHECK_FUNC(strerror, STRERROR_O="",
594 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
595 if test "$ac_cv_func_strerror" = no ; then
596 STRERROR_C="strerror.c"
597 STRERROR_O="strerror.o"
602 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
603 STRCASECMP_O="strcasecmp.o")
604 if test "$ac_cv_func_strcasecmp" = no ; then
605 STRCASECMP_C="strcasecmp.c"
606 STRCASECMP_O="strcasecmp.o"
608 AC_SUBST(STRCASECMP_C)
609 AC_SUBST(STRCASECMP_O)
611 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
612 STRNCASECMP_O="strncasecmp.o")
613 if test "$ac_cv_func_strncasecmp" = no ; then
614 STRNCASECMP_C="strncasecmp.c"
615 STRNCASECMP_O="strncasecmp.o"
617 AC_SUBST(STRNCASECMP_C)
618 AC_SUBST(STRNCASECMP_O)
620 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
621 MKSTEMP_O="mkstemp.o")
622 if test "$ac_cv_func_mkstemp" = no ; then
623 MKSTEMP_C="mkstemp.c"
624 MKSTEMP_O="mkstemp.o"
629 AC_CHECK_FUNC(strptime, STRPTIME_O="",
630 STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
631 if test "$ac_cv_func_strptime" = no ; then
632 STRPTIME_C="strptime.c"
633 STRPTIME_O="strptime.o"
638 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
640 dnl blank for now, but will be used in future
641 AC_SUBST(ethereal_SUBDIRS)
644 dnl check whether plugins should be enabled and, if they should be,
645 dnl check for plugins directory - stolen from Amanda's configure.in
647 PLUGIN_DIR="$libdir/ethereal/plugins/$VERSION"
649 [ --with-plugins[=DIR] support plugins (installed in DIR, if supplied).],
653 if test x$have_plugins = xno
655 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
662 if test x$have_plugins = xno
664 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
666 PLUGIN_DIR="$withval"
672 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
673 if test x$have_plugins = xyes
675 AC_DEFINE(HAVE_PLUGINS)
677 test "x$prefix" = xNONE && prefix=$ac_default_prefix
678 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
679 eval echo "$PLUGIN_DIR"
681 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
683 AC_DEFINE(PLUGIN_DIR,NULL)
690 AC_SUBST(LIBTOOL_DEPS)
692 AM_CONFIG_HEADER(config.h)
693 AC_CONFIG_SUBDIRS(epan wiretap)
699 packaging/nsis/Makefile
700 packaging/rpm/Makefile
701 packaging/rpm/ethereal.spec
702 packaging/svr4/Makefile
703 packaging/svr4/checkinstall
704 packaging/svr4/pkginfo
706 plugins/gryphon/Makefile
707 plugins/mgcp/Makefile
708 plugins/giop/Makefile
716 if test "x$enable_setuid_install" = "xyes" ; then
717 setuid_message="yes (DANGEROUS!!!)"
722 if test "x$SNMP_LIBS" = "x" ; then
723 snmp_libs_message="no"
725 snmp_libs_message="yes"
731 echo "The Ethereal package has been configured with the following options."
732 echo " Build ethereal : $enable_ethereal"
733 echo " Build tethereal : $enable_tethereal"
734 echo " Build editcap : $enable_editcap"
735 echo " Build mergecap : $enable_mergecap"
736 echo " Build text2pcap : $enable_text2pcap"
737 echo " Build idl2eth : $enable_idl2eth"
738 echo " Build randpkt : $enable_randpkt"
739 echo " Build dftest : $enable_dftest"
741 echo " Install setuid : $setuid_message"
742 echo " Use plugins : $have_plugins"
743 echo " Use pcap library : $want_pcap"
744 echo " Use zlib library : $enable_zlib"
745 echo " Use IPv6 name resolution : $enable_ipv6"
746 echo " Use SNMP library : $snmp_libs_message"