1 # $Id: configure.in,v 1.188 2002/11/28 04:21:28 guy 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.
60 # If "--with-extra-gcc-checks" was specified, add "-Wcast-qual
61 # -Wcast-align" as well. (Add more checks here in the future?)
63 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
64 # argument will compile with non-GCC compilers.
66 AC_ARG_WITH(extra-gcc-checks,
67 [ --with-extra-gcc-checks do additional -W checks in GCC. [default=no]],
69 if test $withval != no
71 ethereal_extra_gcc_flags=" -Wcast-qual -Wcast-align"
74 AC_MSG_CHECKING(to see if we can add '-Wall -W$ethereal_extra_gcc_flags' to CFLAGS)
75 if test x$GCC != x ; then
76 CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W$ethereal_extra_gcc_flags $CFLAGS"
79 CFLAGS="-D_U_=\"\" $CFLAGS"
84 # Add any platform-specific compiler flags needed.
86 AC_MSG_CHECKING(for platform-specific compiler flags)
90 # Not GCC - assume it's the vendor's compiler.
95 # HP's ANSI C compiler; flags suggested by Jost Martin.
96 # "-Ae" for ANSI C plus extensions such as "long long".
97 # "+O2", for optimization. XXX - works with "-g"?
99 CFLAGS="-Ae +O2 $CFLAGS"
100 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
104 # It may be called "cc", but it's really a GCC derivative
105 # with a problematic special precompiler and precompiled
106 # headers; turn off the special precompiler, as some
107 # apparently-legal code won't compile with its precompiled
110 CFLAGS="-no-cpp-precomp $CFLAGS"
111 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
114 AC_MSG_RESULT(none needed)
120 # the X11 headers don't automatically include prototype info
121 # and a lot don't include the return type
122 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
123 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
127 # See comments above about Apple's lovely C compiler.
129 CFLAGS="-no-cpp-precomp $CFLAGS"
130 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
133 AC_MSG_RESULT(none needed)
138 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
139 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
141 dnl Look in /usr/local for header files and libraries ?
142 AC_ARG_ENABLE(usr-local,
143 [ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
145 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
146 if test "x$enable_usr_local" = "xyes" ; then
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/usr/local/include"
155 CPPFLAGS="$CPPFLAGS -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)
165 # Create DATAFILE_DIR #define for config.h
166 DATAFILE_DIR=$sysconfdir
168 test "x$prefix" = xNONE && prefix=$ac_default_prefix
169 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
170 eval echo "$DATAFILE_DIR"
172 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
173 AC_SUBST(DATAFILE_DIR)
176 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
181 AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
182 if test x$LD_LIBRARY_PATH != x ; then
183 LIBS="$LIBS -R$LD_LIBRARY_PATH"
184 AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
186 AC_MSG_RESULT(no -- this may be a problem in a few seconds)
192 # Check for versions of "sed" inadequate to handle, in libtool, a list
193 # of object files as large as the list in Ethereal.
195 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
196 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
197 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
198 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
199 # is the only "sed" that comes with Solaris that can handle Ethereal.
201 # Add any checks here that are necessary for other OSes.
203 AC_ETHEREAL_GNU_SED_CHECK
204 if test "$HAVE_GNU_SED" = no ; then
207 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
209 /bin/sed|/usr/bin/sed|/usr/ucb/sed)
211 AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
226 # Enable/disable tethereal
228 AC_ARG_ENABLE(ethereal,
229 [ --enable-ethereal build GTK+-based ethereal. [default=yes]],,enable_ethereal=yes)
232 [ --enable-gtk2 build Glib2/Gtk2+-based (t)ethereal. [default=no]],enable_gtk2=yes,enable_gtk2=no)
233 AM_CONDITIONAL(USE_GTK2, test x$enable_gtk2 = xyes)
236 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
237 # programs to be built with GTK+.
239 if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
241 AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
242 elif test "x$enable_gtk2" = "xno" -a "x$enable_ethereal" = "xyes" ; then
244 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
250 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
251 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
252 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
253 # set when generating the Makefile, so we can make programs that require
254 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
255 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
256 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
257 # programs to be built with GLib.
259 if test "$GTK_OK" = "no" ; then
264 if test "x$enable_gtk2" = "xyes" ; then
265 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
267 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
270 ethereal_bin="ethereal"
271 ethereal_man="ethereal.1"
272 ethereal_SUBDIRS="gtk"
274 if test "$GTK_OK" = "two" ; then
275 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
277 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
282 # Check whether GLib modules are supported, to determine whether we
283 # can support plugins.
285 AC_MSG_CHECKING(whether GLib supports loadable modules)
286 ac_save_CFLAGS="$CFLAGS"
288 CFLAGS="$CFLAGS $GLIB_CFLAGS"
289 LIBS="$GLIB_LIBS $LIBS"
299 if (g_module_supported())
300 return 0; /* success */
302 return 1; /* failure */
304 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
305 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
306 CFLAGS="$ac_save_CFLAGS"
308 if test "$ac_cv_glib_supports_modules" = yes ; then
317 AC_SUBST(ethereal_bin)
318 AC_SUBST(ethereal_man)
322 # Enable/disable tethereal
324 AC_ARG_ENABLE(tethereal,
325 [ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
327 if test "x$enable_tethereal" = "xyes" ; then
328 tethereal_bin="tethereal"
329 tethereal_man="tethereal.1"
334 AC_SUBST(tethereal_bin)
335 AC_SUBST(tethereal_man)
339 # Enable/disable editcap
341 AC_ARG_ENABLE(editcap,
342 [ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
344 if test "x$enable_editcap" = "xyes" ; then
345 editcap_bin="editcap"
346 editcap_man="editcap.1"
351 AC_SUBST(editcap_bin)
352 AC_SUBST(editcap_man)
355 # Enable/disable mergecap
357 AC_ARG_ENABLE(mergecap,
358 [ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
360 if test "x$enable_mergecap" = "xyes" ; then
361 mergecap_bin="mergecap"
362 mergecap_man="mergecap.1"
367 AC_SUBST(mergecap_bin)
368 AC_SUBST(mergecap_man)
371 # Enable/disable text2pcap
373 AC_ARG_ENABLE(text2pcap,
374 [ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
376 if test "x$enable_text2pcap" = "xyes" ; then
377 text2pcap_bin="text2pcap"
378 text2pcap_man="text2pcap.1"
383 AC_SUBST(text2pcap_bin)
384 AC_SUBST(text2pcap_man)
386 # Enable/disable idl2eth
388 AC_ARG_ENABLE(idl2eth,
389 [ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)
391 if test "x$enable_idl2eth" = "xyes" ; then
392 idl2eth_bin="idl2eth"
393 idl2eth_man="idl2eth.1"
398 AC_SUBST(idl2eth_bin)
399 AC_SUBST(idl2eth_man)
402 # Enable/disable dftest
404 AC_ARG_ENABLE(dftest,
405 [ --enable-dftest build dftest. [default=no]],,enable_dftest=no)
407 if test "x$enable_dftest" = "xyes" ; then
415 # Enable/disable randpkt
417 AC_ARG_ENABLE(randpkt,
418 [ --enable-randpkt build randpkt. [default=no]],,enable_randpkt=no)
420 if test "x$enable_randpkt" = "xyes" ; then
421 randpkt_bin="randpkt"
425 AC_SUBST(randpkt_bin)
428 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
429 dnl "gethostbyname()".
430 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
432 dnl Checks for "connect()", used as a proxy for "socket()" - and
433 dnl "-lsocket", if we need it to get "connect()".
434 AC_ETHEREAL_SOCKET_LIB_CHECK
437 AC_MSG_CHECKING(whether to use libpcap for packet capture)
440 [ --with-pcap[=DIR] use libpcap for packet capturing. [default=yes]],
442 if test $withval = no
445 elif test $withval = yes
456 if test "x$want_pcap" = "xno" ; then
460 AC_ETHEREAL_PCAP_CHECK
461 AC_ETHEREAL_PCAP_VERSION_CHECK
465 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
468 [ --with-zlib[=DIR] use zlib (located in directory DIR, if supplied) to read compressed data. [default=yes, if present]],
470 if test $withval = no
473 elif test $withval = yes
482 # Use zlib if it's present, otherwise don't.
487 if test "x$want_zlib" = "xno" ; then
491 AC_ETHEREAL_ZLIB_CHECK
492 if test "x$want_zlib" = "xno" ; then
493 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
500 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
502 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
503 if test "x$enable_ipv6" = "xno" ; then
507 AC_ETHEREAL_IPV6_STACK
511 dnl Check if ethereal should be installed setuid
512 AC_ARG_ENABLE(setuid-install,
513 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
515 AC_MSG_CHECKING(whether to install ethereal setuid)
516 if test "x$enable_setuid_install" = "xno" ; then
522 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
524 dnl Checks for header files.
526 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
527 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
528 AC_CHECK_HEADERS(sys/wait.h)
529 AC_CHECK_HEADERS(netinet/in.h)
530 AC_CHECK_HEADERS(stddef.h)
531 AC_CHECK_HEADERS(arpa/inet.h)
532 AC_CHECK_HEADERS(iconv.h)
536 AC_MSG_CHECKING(whether to use SSL library if available)
537 if test "x$enable_ssl" = "xno" ; then
541 AC_ETHEREAL_SSL_CHECK
547 AC_MSG_CHECKING(whether to use UCD SNMP/NET-SNMP library if available)
549 AC_ARG_WITH(net-snmp,
550 [ --with-net-snmp=PATH use PATH as the location of the net-snmp-config shell script that comes with the net-snmp package.],
551 [netsnmpconfig=$withval]
555 [ --with-ucdsnmp[=DIR] use UCD SNMP/NET-SNMP client library (located in directory DIR, if supplied). [default=yes, if present]],
557 if test $withval = no
560 elif test $withval = yes
569 # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
570 # if you find it, otherwise don't".
572 want_ucdsnmp=ifpresent
576 dnl try net-snmp first
577 if test "x$netsnmpconfig" != "xno" ; then
578 dnl get the net-snmp-config binary
579 if test "x$netsnmpconfig" = "xyes" -o "x$netsnmpconfig" = "x" ; then
581 AC_PATH_PROG(NETSNMPCONFIG,net-snmp-config)
583 NETSNMPCONFIG=$netsnmpconfig
584 if test ! -x $NETSNMPCONFIG ; then
585 AC_MSG_ERROR(Invalid net-snmp-config: $NETSNMPCONFIG)
590 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
591 dnl other choices for flags to use here: could also use
592 dnl --prefix or --exec-prefix if you don't want the full list.
594 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h net-snmp/library/default_store.h)
595 if test "x$ac_cv_header_net_snmp_net_snmp_config_h" = "xyes" -a "x$ac_cv_header_net_snmp_library_default_store_h" = "xyes" ; then
596 CFLAGS="$CFLAGS `net-snmp-config --cflags`"
597 CPPFLAGS="$CPPLAGS `net-snmp-config --cflags`"
598 SNMP_LIBS=`net-snmp-config --libs`
599 AC_DEFINE(HAVE_NET_SNMP)
600 AC_MSG_RESULT(yes (net-snmp))
602 # technically, we should retry ucd-snmp but it's
603 # unlikely they have installed net-snmp-config and not
604 # the net-snmp headers but do have the ucd-snmp
605 # headers. This would likely be a broken system to
606 # try and use anyway.
611 if test "x$want_ucdsnmp" = "xno" ; then
614 AC_MSG_RESULT(yes (ucd-snmp))
615 AC_ETHEREAL_UCDSNMP_CHECK
621 dnl Checks for typedefs, structures, and compiler characteristics.
624 # We need to know whether "struct sockaddr" has an "sa_len" member
625 # for get_interface_list().
627 AC_ETHEREAL_STRUCT_SA_LEN
629 # We must know our byte order
632 # Checks whether "-traditional" is needed when using "ioctl".
633 # XXX - do we need this?
634 AC_PROG_GCC_TRADITIONAL
636 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
637 # then this won't work.
640 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
641 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
642 if test "$ac_cv_func_snprintf" = no ; then
643 SNPRINTF_C="snprintf.c"
644 SNPRINTF_O="snprintf.o"
649 AC_CHECK_FUNC(strerror, STRERROR_O="",
650 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
651 if test "$ac_cv_func_strerror" = no ; then
652 STRERROR_C="strerror.c"
653 STRERROR_O="strerror.o"
658 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
659 STRCASECMP_O="strcasecmp.o")
660 if test "$ac_cv_func_strcasecmp" = no ; then
661 STRCASECMP_C="strcasecmp.c"
662 STRCASECMP_O="strcasecmp.o"
664 AC_SUBST(STRCASECMP_C)
665 AC_SUBST(STRCASECMP_O)
667 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
668 STRNCASECMP_O="strncasecmp.o")
669 if test "$ac_cv_func_strncasecmp" = no ; then
670 STRNCASECMP_C="strncasecmp.c"
671 STRNCASECMP_O="strncasecmp.o"
673 AC_SUBST(STRNCASECMP_C)
674 AC_SUBST(STRNCASECMP_O)
676 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
677 MKSTEMP_O="mkstemp.o")
678 if test "$ac_cv_func_mkstemp" = no ; then
679 MKSTEMP_C="mkstemp.c"
680 MKSTEMP_O="mkstemp.o"
685 AC_CHECK_FUNC(strptime, STRPTIME_O="",
686 STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
687 if test "$ac_cv_func_strptime" = no ; then
688 STRPTIME_C="strptime.c"
689 STRPTIME_O="strptime.o"
694 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
696 dnl blank for now, but will be used in future
697 AC_SUBST(ethereal_SUBDIRS)
700 dnl check whether plugins should be enabled and, if they should be,
701 dnl check for plugins directory - stolen from Amanda's configure.in
703 plugindir="$libdir/ethereal/plugins/$VERSION"
704 PLUGIN_DIR="$plugindir"
706 [ --with-plugins[=DIR] support plugins (installed in DIR, if supplied).],
710 if test x$have_plugins = xno
712 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
719 if test x$have_plugins = xno
721 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
723 PLUGIN_DIR="$withval"
729 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
730 if test x$have_plugins = xyes
732 AC_DEFINE(HAVE_PLUGINS)
734 test "x$prefix" = xNONE && prefix=$ac_default_prefix
735 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
736 eval echo "$PLUGIN_DIR"
738 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
740 AC_DEFINE(PLUGIN_DIR,NULL)
747 AC_SUBST(LIBTOOL_DEPS)
749 AM_CONFIG_HEADER(config.h)
750 AC_CONFIG_SUBDIRS(epan wiretap)
756 packaging/nsis/Makefile
757 packaging/rpm/Makefile
758 packaging/rpm/SPECS/Makefile
759 packaging/rpm/SPECS/ethereal.spec
760 packaging/svr4/Makefile
761 packaging/svr4/checkinstall
762 packaging/svr4/pkginfo
764 plugins/docsis/Makefile
765 plugins/giop/Makefile
766 plugins/gryphon/Makefile
767 plugins/mgcp/Makefile
768 plugins/pcli/Makefile
776 if test "x$enable_setuid_install" = "xyes" ; then
777 setuid_message="yes (DANGEROUS!!!)"
782 if test "x$want_zlib" = "xno" ; then
788 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
789 snmp_libs_message="yes (net-snmp)"
790 elif test "x$SNMP_LIBS" = "x" ; then
791 snmp_libs_message="no"
793 snmp_libs_message="yes (ucd-snmp)"
797 echo "The Ethereal package has been configured with the following options."
798 echo " Build ethereal : $enable_ethereal"
799 echo " Build tethereal : $enable_tethereal"
800 echo " Build editcap : $enable_editcap"
801 echo " Build mergecap : $enable_mergecap"
802 echo " Build text2pcap : $enable_text2pcap"
803 echo " Build idl2eth : $enable_idl2eth"
804 echo " Build randpkt : $enable_randpkt"
805 echo " Build dftest : $enable_dftest"
807 echo " Install setuid : $setuid_message"
808 echo " Use plugins : $have_plugins"
809 echo " Use GTK+ v2 library : $enable_gtk2"
810 echo " Use pcap library : $want_pcap"
811 echo " Use zlib library : $zlib_message"
812 echo " Use IPv6 name resolution : $enable_ipv6"
813 echo " Use UCD SNMP/NET-SNMP library : $snmp_libs_message"