1 # $Id: configure.in,v 1.183 2002/10/22 20:06:15 jmayer 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 dnl Check for CPU / vendor / OS
20 AM_INIT_AUTOMAKE(ethereal, 0.9.7)
22 dnl Checks for programs.
29 AC_PATH_PROG(PERL, perl)
30 AC_PATH_PROG(POD2MAN, pod2man)
31 AC_PATH_PROG(LEX, flex)
32 AC_PATH_PROG(PYTHON, python)
38 # Check for packaging utilities
39 # For now, we check to see if the various packaging utilites are in our
40 # path. I'm too lazy to write code to go hunt for them. - Gerald
41 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
42 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
43 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
45 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
46 -a x$HAVE_PKGTRANS = xyes ; then
47 HAVE_SVR4_PACKAGING=yes
49 HAVE_SVR4_PACKAGING=no
51 AC_SUBST(HAVE_SVR4_PACKAGING)
57 # If we're running gcc, add '-Wall -W' to CFLAGS, and add
58 # '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
59 # flag unused function arguments and not get warnings about them.
61 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
62 # argument will compile with non-GCC compilers.
64 AC_MSG_CHECKING(to see if we can add '-Wall -W' to CFLAGS)
65 if test x$GCC != x ; then
66 CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W $CFLAGS"
69 CFLAGS="-D_U_=\"\" $CFLAGS"
74 # Add any platform-specific compiler flags needed.
76 AC_MSG_CHECKING(for platform-specific compiler flags)
80 # Not GCC - assume it's the vendor's compiler.
85 # HP's ANSI C compiler; flags suggested by Jost Martin.
86 # "-Ae" for ANSI C plus extensions such as "long long".
87 # "+O2", for optimization. XXX - works with "-g"?
89 CFLAGS="-Ae +O2 $CFLAGS"
90 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
94 # It may be called "cc", but it's really a GCC derivative
95 # with a problematic special precompiler and precompiled
96 # headers; turn off the special precompiler, as some
97 # apparently-legal code won't compile with its precompiled
100 CFLAGS="-no-cpp-precomp $CFLAGS"
101 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
104 AC_MSG_RESULT(none needed)
110 # the X11 headers don't automatically include prototype info
111 # and a lot don't include the return type
112 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
113 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
117 # See comments above about Apple's lovely C compiler.
119 CFLAGS="-no-cpp-precomp $CFLAGS"
120 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
123 AC_MSG_RESULT(none needed)
128 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
129 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
131 dnl Look in /usr/local for header files and libraries ?
132 AC_ARG_ENABLE(usr-local,
133 [ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
135 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
136 if test "x$enable_usr_local" = "xyes" ; then
139 # Arrange that we search for header files in the source directory
140 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
141 # as various packages we use ("libpcap", "zlib", an SNMP library)
142 # may have been installed under "/usr/local/include".
144 CFLAGS="$CFLAGS -I/usr/local/include"
145 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
148 # Arrange that we search for libraries in "/usr/local/lib".
150 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
155 # Create DATAFILE_DIR #define for config.h
156 DATAFILE_DIR=$sysconfdir
158 test "x$prefix" = xNONE && prefix=$ac_default_prefix
159 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
160 eval echo "$DATAFILE_DIR"
162 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
163 AC_SUBST(DATAFILE_DIR)
166 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
171 AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
172 if test x$LD_LIBRARY_PATH != x ; then
173 LIBS="$LIBS -R$LD_LIBRARY_PATH"
174 AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
176 AC_MSG_RESULT(no -- this may be a problem in a few seconds)
182 # Check for versions of "sed" inadequate to handle, in libtool, a list
183 # of object files as large as the list in Ethereal.
185 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
186 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
187 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
188 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
189 # is the only "sed" that comes with Solaris that can handle Ethereal.
191 # Add any checks here that are necessary for other OSes.
193 AC_ETHEREAL_GNU_SED_CHECK
194 if test "$HAVE_GNU_SED" = no ; then
197 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
199 /bin/sed|/usr/bin/sed|/usr/ucb/sed)
201 AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
216 # Enable/disable tethereal
218 AC_ARG_ENABLE(ethereal,
219 [ --enable-ethereal build GTK+-based ethereal. [default=yes]],,enable_ethereal=yes)
222 [ --enable-gtk2 build Glib2/Gtk2+-based (t)ethereal. [default=no]],enable_gtk2=yes,enable_gtk2=no)
223 AM_CONDITIONAL(USE_GTK2, test x$enable_gtk2 = xyes)
226 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
227 # programs to be built with GTK+.
229 if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
231 AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
232 elif test "x$enable_gtk2" = "xno" -a "x$enable_ethereal" = "xyes" ; then
234 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
240 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
241 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
242 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
243 # set when generating the Makefile, so we can make programs that require
244 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
245 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
246 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
247 # programs to be built with GLib.
249 if test "$GTK_OK" = "two" ; then
250 ethereal_bin="ethereal"
251 ethereal_man="ethereal.1"
252 ethereal_SUBDIRS="gtk2"
255 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
256 elif test "$GTK_OK" = "one" ; then
257 ethereal_bin="ethereal"
258 ethereal_man="ethereal.1"
259 ethereal_SUBDIRS="gtk"
262 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
268 if test "x$enable_gtk2" = "xyes" ; then
269 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
271 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
276 # Check whether GLib modules are supported, to determine whether we
277 # can support plugins.
279 AC_MSG_CHECKING(whether GLib supports loadable modules)
280 ac_save_CFLAGS="$CFLAGS"
282 CFLAGS="$CFLAGS $GLIB_CFLAGS"
283 LIBS="$GLIB_LIBS $LIBS"
293 if (g_module_supported())
294 return 0; /* success */
296 return 1; /* failure */
298 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
299 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
300 CFLAGS="$ac_save_CFLAGS"
302 if test "$ac_cv_glib_supports_modules" = yes ; then
311 AC_SUBST(ethereal_bin)
312 AC_SUBST(ethereal_man)
316 # Enable/disable tethereal
318 AC_ARG_ENABLE(tethereal,
319 [ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
321 if test "x$enable_tethereal" = "xyes" ; then
322 tethereal_bin="tethereal"
323 tethereal_man="tethereal.1"
328 AC_SUBST(tethereal_bin)
329 AC_SUBST(tethereal_man)
333 # Enable/disable editcap
335 AC_ARG_ENABLE(editcap,
336 [ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
338 if test "x$enable_editcap" = "xyes" ; then
339 editcap_bin="editcap"
340 editcap_man="editcap.1"
345 AC_SUBST(editcap_bin)
346 AC_SUBST(editcap_man)
349 # Enable/disable mergecap
351 AC_ARG_ENABLE(mergecap,
352 [ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
354 if test "x$enable_mergecap" = "xyes" ; then
355 mergecap_bin="mergecap"
356 mergecap_man="mergecap.1"
361 AC_SUBST(mergecap_bin)
362 AC_SUBST(mergecap_man)
365 # Enable/disable text2pcap
367 AC_ARG_ENABLE(text2pcap,
368 [ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
370 if test "x$enable_text2pcap" = "xyes" ; then
371 text2pcap_bin="text2pcap"
372 text2pcap_man="text2pcap.1"
377 AC_SUBST(text2pcap_bin)
378 AC_SUBST(text2pcap_man)
380 # Enable/disable idl2eth
382 AC_ARG_ENABLE(idl2eth,
383 [ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)
385 if test "x$enable_idl2eth" = "xyes" ; then
386 idl2eth_bin="idl2eth"
387 idl2eth_man="idl2eth.1"
392 AC_SUBST(idl2eth_bin)
393 AC_SUBST(idl2eth_man)
396 # Enable/disable dftest
398 AC_ARG_ENABLE(dftest,
399 [ --enable-dftest build dftest. [default=no]],,enable_dftest=no)
401 if test "x$enable_dftest" = "xyes" ; then
409 # Enable/disable randpkt
411 AC_ARG_ENABLE(randpkt,
412 [ --enable-randpkt build randpkt. [default=no]],,enable_randpkt=no)
414 if test "x$enable_randpkt" = "xyes" ; then
415 randpkt_bin="randpkt"
419 AC_SUBST(randpkt_bin)
422 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
423 dnl "gethostbyname()".
424 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
426 dnl Checks for "connect()", used as a proxy for "socket()" - and
427 dnl "-lsocket", if we need it to get "connect()".
428 AC_ETHEREAL_SOCKET_LIB_CHECK
431 AC_MSG_CHECKING(whether to use libpcap for packet capture)
434 [ --with-pcap[=DIR] use libpcap for packet capturing. [default=yes]],
436 if test $withval = no
439 elif test $withval = yes
450 if test "x$want_pcap" = "xno" ; then
454 AC_ETHEREAL_PCAP_CHECK
455 AC_ETHEREAL_PCAP_VERSION_CHECK
459 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
462 [ --with-zlib[=DIR] use zlib (located in directory DIR, if supplied) to read compressed data. [default=yes, if present]],
464 if test $withval = no
467 elif test $withval = yes
476 # Use zlib if it's present, otherwise don't.
481 if test "x$want_zlib" = "xno" ; then
485 AC_ETHEREAL_ZLIB_CHECK
486 if test "x$want_zlib" = "xno" ; then
487 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
494 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
496 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
497 if test "x$enable_ipv6" = "xno" ; then
501 AC_ETHEREAL_IPV6_STACK
505 dnl Check if ethereal should be installed setuid
506 AC_ARG_ENABLE(setuid-install,
507 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
509 AC_MSG_CHECKING(whether to install ethereal setuid)
510 if test "x$enable_setuid_install" = "xno" ; then
516 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
518 dnl Checks for header files.
520 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
521 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
522 AC_CHECK_HEADERS(sys/wait.h)
523 AC_CHECK_HEADERS(netinet/in.h)
524 AC_CHECK_HEADERS(stddef.h)
525 AC_CHECK_HEADERS(arpa/inet.h)
526 AC_CHECK_HEADERS(iconv.h)
530 AC_MSG_CHECKING(whether to use SSL library if available)
531 if test "x$enable_ssl" = "xno" ; then
535 AC_ETHEREAL_SSL_CHECK
541 AC_MSG_CHECKING(whether to use UCD SNMP/NET-SNMP library if available)
543 AC_ARG_WITH(net-snmp,
544 [ --with-net-snmp=PATH use PATH as thee location of the net-snmp-config shell script that comes with the net-snmp package.],
545 [netsnmpconfig=$withval]
549 [ --with-ucdsnmp[=DIR] use UCD SNMP/NET-SNMP client library (located in directory DIR, if supplied). [default=yes, if present]],
551 if test $withval = no
554 elif test $withval = yes
563 # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
564 # if you find it, otherwise don't".
566 want_ucdsnmp=ifpresent
570 dnl try net-snmp first
571 if test "x$netsnmpconfig" != "xno" ; then
572 dnl get the net-snmp-config binary
573 if test "x$netsnmpconfig" = "xyes" -o "x$netsnmpconfig" = "x" ; then
575 AC_PATH_PROG(NETSNMPCONFIG,net-snmp-config)
577 ac_cv_prog_NETSNMPCONFIG=$netsnmpconfig
578 if test ! -x $ac_cv_prog_NETSNMPCONFIG ; then
579 AC_MSG_ERROR(Invalid net-snmp-config: $ac_cv_prog_NETSNMPCONFIG)
584 if test "x$ac_cv_prog_NETSNMPCONFIG" != "xno" -a "x$ac_cv_prog_NETSNMPCONFIG" != "x" -a -x "$ac_cv_prog_NETSNMPCONFIG" ; then
585 dnl other choices for flags to use here: could also use
586 dnl --prefix or --exec-prefix if you don't want the full list.
587 CFLAGS="$CFLAGS `net-snmp-config --cflags`"
588 CPPFLAGS="$CPPLAGS `net-snmp-config --cflags`"
589 SNMP_LIBS=`net-snmp-config --libs`
591 # XXX: make sure we can find net-snmp/net-snmp-config.h
592 # XXX: make sure we can find net-snmp/net-snmp-includes.h
593 AC_DEFINE(HAVE_NET_SNMP)
594 AC_MSG_RESULT(yes (net-snmp))
596 if test "x$want_ucdsnmp" = "xno" ; then
599 AC_MSG_RESULT(yes (ucd-snmp))
600 AC_ETHEREAL_UCDSNMP_CHECK
606 dnl Checks for typedefs, structures, and compiler characteristics.
609 # We need to know whether "struct sockaddr" has an "sa_len" member
610 # for get_interface_list().
612 AC_ETHEREAL_STRUCT_SA_LEN
614 # We must know our byte order
617 # Checks whether "-traditional" is needed when using "ioctl".
618 # XXX - do we need this?
619 AC_PROG_GCC_TRADITIONAL
621 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
622 # then this won't work.
625 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
626 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
627 if test "$ac_cv_func_snprintf" = no ; then
628 SNPRINTF_C="snprintf.c"
629 SNPRINTF_O="snprintf.o"
634 AC_CHECK_FUNC(strerror, STRERROR_O="",
635 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
636 if test "$ac_cv_func_strerror" = no ; then
637 STRERROR_C="strerror.c"
638 STRERROR_O="strerror.o"
643 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
644 STRCASECMP_O="strcasecmp.o")
645 if test "$ac_cv_func_strcasecmp" = no ; then
646 STRCASECMP_C="strcasecmp.c"
647 STRCASECMP_O="strcasecmp.o"
649 AC_SUBST(STRCASECMP_C)
650 AC_SUBST(STRCASECMP_O)
652 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
653 STRNCASECMP_O="strncasecmp.o")
654 if test "$ac_cv_func_strncasecmp" = no ; then
655 STRNCASECMP_C="strncasecmp.c"
656 STRNCASECMP_O="strncasecmp.o"
658 AC_SUBST(STRNCASECMP_C)
659 AC_SUBST(STRNCASECMP_O)
661 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
662 MKSTEMP_O="mkstemp.o")
663 if test "$ac_cv_func_mkstemp" = no ; then
664 MKSTEMP_C="mkstemp.c"
665 MKSTEMP_O="mkstemp.o"
670 AC_CHECK_FUNC(strptime, STRPTIME_O="",
671 STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
672 if test "$ac_cv_func_strptime" = no ; then
673 STRPTIME_C="strptime.c"
674 STRPTIME_O="strptime.o"
679 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
681 dnl blank for now, but will be used in future
682 AC_SUBST(ethereal_SUBDIRS)
685 dnl check whether plugins should be enabled and, if they should be,
686 dnl check for plugins directory - stolen from Amanda's configure.in
688 plugindir="$libdir/ethereal/plugins/$VERSION"
689 PLUGIN_DIR="$plugindir"
691 [ --with-plugins[=DIR] support plugins (installed in DIR, if supplied).],
695 if test x$have_plugins = xno
697 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
704 if test x$have_plugins = xno
706 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
708 PLUGIN_DIR="$withval"
714 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
715 if test x$have_plugins = xyes
717 AC_DEFINE(HAVE_PLUGINS)
719 test "x$prefix" = xNONE && prefix=$ac_default_prefix
720 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
721 eval echo "$PLUGIN_DIR"
723 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
725 AC_DEFINE(PLUGIN_DIR,NULL)
732 AC_SUBST(LIBTOOL_DEPS)
734 AM_CONFIG_HEADER(config.h)
735 AC_CONFIG_SUBDIRS(epan wiretap)
742 packaging/nsis/Makefile
743 packaging/rpm/Makefile
744 packaging/rpm/SPECS/Makefile
745 packaging/rpm/SPECS/ethereal.spec
746 packaging/svr4/Makefile
747 packaging/svr4/checkinstall
748 packaging/svr4/pkginfo
750 plugins/docsis/Makefile
751 plugins/giop/Makefile
752 plugins/gryphon/Makefile
753 plugins/mgcp/Makefile
754 plugins/pcli/Makefile
762 if test "x$enable_setuid_install" = "xyes" ; then
763 setuid_message="yes (DANGEROUS!!!)"
768 if test "x$want_zlib" = "xno" ; then
774 if test "x$ac_cv_prog_NETSNMPCONFIG" != "xno" -a "x$ac_cv_prog_NETSNMPCONFIG" != "x" -a -x "$ac_cv_prog_NETSNMPCONFIG" ; then
775 snmp_libs_message="yes (net-snmp)"
776 elif test "x$SNMP_LIBS" = "x" ; then
777 snmp_libs_message="no"
779 snmp_libs_message="yes (ucd-snmp)"
783 echo "The Ethereal package has been configured with the following options."
784 echo " Build ethereal : $enable_ethereal"
785 echo " Build tethereal : $enable_tethereal"
786 echo " Build editcap : $enable_editcap"
787 echo " Build mergecap : $enable_mergecap"
788 echo " Build text2pcap : $enable_text2pcap"
789 echo " Build idl2eth : $enable_idl2eth"
790 echo " Build randpkt : $enable_randpkt"
791 echo " Build dftest : $enable_dftest"
793 echo " Install setuid : $setuid_message"
794 echo " Use plugins : $have_plugins"
795 echo " Use GTK+ v2 library : $enable_gtk2"
796 echo " Use pcap library : $want_pcap"
797 echo " Use zlib library : $zlib_message"
798 echo " Use IPv6 name resolution : $enable_ipv6"
799 echo " Use UCD SNMP library : $snmp_libs_message"