1 # $Id: configure.in,v 1.177 2002/09/10 23:26:19 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 AM_INIT_AUTOMAKE(ethereal, 0.9.6)
18 dnl Check for CPU / vendor / OS
21 dnl Checks for programs.
28 AC_PATH_PROG(PERL, perl)
29 AC_PATH_PROG(POD2MAN, pod2man)
30 AC_PATH_PROG(LEX, flex)
31 AC_PATH_PROG(PYTHON, python)
37 # Check for packaging utilities
38 # For now, we check to see if the various packaging utilites are in our
39 # path. I'm too lazy to write code to go hunt for them. - Gerald
40 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
41 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
42 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
44 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
45 -a x$HAVE_PKGTRANS = xyes ; then
46 HAVE_SVR4_PACKAGING=yes
48 HAVE_SVR4_PACKAGING=no
50 AC_SUBST(HAVE_SVR4_PACKAGING)
56 # If we're running gcc, add '-Wall -W' to CFLAGS, and add
57 # '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
58 # flag unused function arguments and not get warnings about them.
60 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
61 # argument will compile with non-GCC compilers.
63 AC_MSG_CHECKING(to see if we can add '-Wall -W' to CFLAGS)
64 if test x$GCC != x ; then
65 CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W $CFLAGS"
68 CFLAGS="-D_U_=\"\" $CFLAGS"
73 # Add any platform-specific compiler flags needed.
75 AC_MSG_CHECKING(for platform-specific compiler flags)
79 # Not GCC - assume it's the vendor's compiler.
84 # HP's ANSI C compiler; flags suggested by Jost Martin.
85 # "-Ae" for ANSI C plus extensions such as "long long".
86 # "+O2", for optimization. XXX - works with "-g"?
88 CFLAGS="-Ae +O2 $CFLAGS"
89 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
93 # It may be called "cc", but it's really a GCC derivative
94 # with a problematic special precompiler and precompiled
95 # headers; turn off the special precompiler, as some
96 # apparently-legal code won't compile with its precompiled
99 CFLAGS="-no-cpp-precomp $CFLAGS"
100 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
103 AC_MSG_RESULT(none needed)
109 # the X11 headers don't automatically include prototype info
110 # and a lot don't include the return type
111 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
112 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
116 # See comments above about Apple's lovely C compiler.
118 CFLAGS="-no-cpp-precomp $CFLAGS"
119 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
122 AC_MSG_RESULT(none needed)
127 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
128 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
130 dnl Look in /usr/local for header files and libraries ?
131 AC_ARG_ENABLE(usr-local,
132 [ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
134 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
135 if test "x$enable_usr_local" = "xyes" ; then
138 # Arrange that we search for header files in the source directory
139 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
140 # as various packages we use ("libpcap", "zlib", an SNMP library)
141 # may have been installed under "/usr/local/include".
143 CFLAGS="$CFLAGS -I/usr/local/include"
144 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
147 # Arrange that we search for libraries in "/usr/local/lib".
149 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
154 # Create DATAFILE_DIR #define for config.h
155 DATAFILE_DIR=$sysconfdir
157 test "x$prefix" = xNONE && prefix=$ac_default_prefix
158 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
159 eval echo "$DATAFILE_DIR"
161 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
162 AC_SUBST(DATAFILE_DIR)
165 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
170 AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
171 if test x$LD_LIBRARY_PATH != x ; then
172 LIBS="$LIBS -R$LD_LIBRARY_PATH"
173 AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
175 AC_MSG_RESULT(no -- this may be a problem in a few seconds)
181 # Check for versions of "sed" inadequate to handle, in libtool, a list
182 # of object files as large as the list in Ethereal.
184 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
185 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
186 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
187 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
188 # is the only "sed" that comes with Solaris that can handle Ethereal.
190 # Add any checks here that are necessary for other OSes.
192 AC_ETHEREAL_GNU_SED_CHECK
193 if test "$HAVE_GNU_SED" = no ; then
196 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
198 /bin/sed|/usr/bin/sed|/usr/ucb/sed)
200 AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
215 # Enable/disable tethereal
217 AC_ARG_ENABLE(ethereal,
218 [ --enable-ethereal build GTK+-based ethereal. [default=yes]],,enable_ethereal=yes)
221 [ --enable-gtk2 build Glib2/Gtk2+-based (t)ethereal. [default=no]],enable_gtk2=yes,enable_gtk2=no)
222 AM_CONDITIONAL(USE_GTK2, test x$enable_gtk2 = xyes)
225 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
226 # programs to be built with GTK+.
228 if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
230 AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
231 elif test "x$enable_gtk2" = "xno" -a "x$enable_ethereal" = "xyes" ; then
233 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
239 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
240 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
241 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
242 # set when generating the Makefile, so we can make programs that require
243 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
244 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
245 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
246 # programs to be built with GLib.
248 if test "$GTK_OK" = "two" ; then
249 ethereal_bin="ethereal"
250 ethereal_man="ethereal.1"
251 ethereal_SUBDIRS="gtk2"
254 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
255 elif test "$GTK_OK" = "one" ; then
256 ethereal_bin="ethereal"
257 ethereal_man="ethereal.1"
258 ethereal_SUBDIRS="gtk"
261 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
267 if test "x$enable_gtk2" = "xyes" ; then
268 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
270 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
275 # Check whether GLib modules are supported, to determine whether we
276 # can support plugins.
278 AC_MSG_CHECKING(whether GLib supports loadable modules)
279 ac_save_CFLAGS="$CFLAGS"
281 CFLAGS="$CFLAGS $GLIB_CFLAGS"
282 LIBS="$GLIB_LIBS $LIBS"
292 if (g_module_supported())
293 return 0; /* success */
295 return 1; /* failure */
297 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
298 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
299 CFLAGS="$ac_save_CFLAGS"
301 if test "$ac_cv_glib_supports_modules" = yes ; then
310 AC_SUBST(ethereal_bin)
311 AC_SUBST(ethereal_man)
315 # Enable/disable tethereal
317 AC_ARG_ENABLE(tethereal,
318 [ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
320 if test "x$enable_tethereal" = "xyes" ; then
321 tethereal_bin="tethereal"
322 tethereal_man="tethereal.1"
327 AC_SUBST(tethereal_bin)
328 AC_SUBST(tethereal_man)
332 # Enable/disable editcap
334 AC_ARG_ENABLE(editcap,
335 [ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
337 if test "x$enable_editcap" = "xyes" ; then
338 editcap_bin="editcap"
339 editcap_man="editcap.1"
344 AC_SUBST(editcap_bin)
345 AC_SUBST(editcap_man)
348 # Enable/disable mergecap
350 AC_ARG_ENABLE(mergecap,
351 [ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
353 if test "x$enable_mergecap" = "xyes" ; then
354 mergecap_bin="mergecap"
355 mergecap_man="mergecap.1"
360 AC_SUBST(mergecap_bin)
361 AC_SUBST(mergecap_man)
364 # Enable/disable text2pcap
366 AC_ARG_ENABLE(text2pcap,
367 [ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
369 if test "x$enable_text2pcap" = "xyes" ; then
370 text2pcap_bin="text2pcap"
371 text2pcap_man="text2pcap.1"
376 AC_SUBST(text2pcap_bin)
377 AC_SUBST(text2pcap_man)
379 # Enable/disable idl2eth
381 AC_ARG_ENABLE(idl2eth,
382 [ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)
384 if test "x$enable_idl2eth" = "xyes" ; then
385 idl2eth_bin="idl2eth"
386 idl2eth_man="idl2eth.1"
391 AC_SUBST(idl2eth_bin)
392 AC_SUBST(idl2eth_man)
395 # Enable/disable dftest
397 AC_ARG_ENABLE(dftest,
398 [ --enable-dftest build dftest. [default=no]],,enable_dftest=no)
400 if test "x$enable_dftest" = "xyes" ; then
408 # Enable/disable randpkt
410 AC_ARG_ENABLE(randpkt,
411 [ --enable-randpkt build randpkt. [default=no]],,enable_randpkt=no)
413 if test "x$enable_randpkt" = "xyes" ; then
414 randpkt_bin="randpkt"
418 AC_SUBST(randpkt_bin)
421 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
422 dnl "gethostbyname()".
423 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
425 dnl Checks for "connect()", used as a proxy for "socket()" - and
426 dnl "-lsocket", if we need it to get "connect()".
427 AC_ETHEREAL_SOCKET_LIB_CHECK
430 AC_MSG_CHECKING(whether to use libpcap for packet capture)
433 [ --with-pcap[=DIR] use libpcap for packet capturing. [default=yes]],
435 if test $withval = no
438 elif test $withval = yes
449 if test "x$want_pcap" = "xno" ; then
453 AC_ETHEREAL_PCAP_CHECK
454 AC_ETHEREAL_PCAP_VERSION_CHECK
458 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
461 [ --with-zlib[=DIR] use zlib (located in directory DIR, if supplied) to read compressed data. [default=yes, if present]],
463 if test $withval = no
466 elif test $withval = yes
475 # Use zlib if it's present, otherwise don't.
480 if test "x$want_zlib" = "xno" ; then
484 AC_ETHEREAL_ZLIB_CHECK
485 if test "x$want_zlib" = "xno" ; then
486 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
493 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
495 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
496 if test "x$enable_ipv6" = "xno" ; then
500 AC_ETHEREAL_IPV6_STACK
504 dnl Check if ethereal should be installed setuid
505 AC_ARG_ENABLE(setuid-install,
506 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
508 AC_MSG_CHECKING(whether to install ethereal setuid)
509 if test "x$enable_setuid_install" = "xno" ; then
515 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
517 dnl Checks for header files.
519 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
520 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
521 AC_CHECK_HEADERS(sys/wait.h)
522 AC_CHECK_HEADERS(netinet/in.h)
523 AC_CHECK_HEADERS(stddef.h)
524 AC_CHECK_HEADERS(arpa/inet.h)
525 AC_CHECK_HEADERS(iconv.h)
529 AC_MSG_CHECKING(whether to use SSL library if available)
530 if test "x$enable_ssl" = "xno" ; then
534 AC_ETHEREAL_SSL_CHECK
540 AC_MSG_CHECKING(whether to use UCD SNMP/NET-SNMP library if available)
543 [ --with-ucdsnmp[=DIR] use UCD SNMP/NET-SNMP client library (located in directory DIR, if supplied). [default=yes, if present]],
545 if test $withval = no
548 elif test $withval = yes
557 # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
558 # if you find it, otherwise don't".
560 want_ucdsnmp=ifpresent
564 if test "x$want_ucdsnmp" = "xno" ; then
568 AC_ETHEREAL_UCDSNMP_CHECK
572 dnl Checks for typedefs, structures, and compiler characteristics.
575 # We need to know whether "struct sockaddr" has an "sa_len" member
576 # for get_interface_list().
578 AC_ETHEREAL_STRUCT_SA_LEN
580 # We must know our byte order
583 # Checks whether "-traditional" is needed when using "ioctl".
584 # XXX - do we need this?
585 AC_PROG_GCC_TRADITIONAL
587 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
588 # then this won't work.
591 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
592 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
593 if test "$ac_cv_func_snprintf" = no ; then
594 SNPRINTF_C="snprintf.c"
595 SNPRINTF_O="snprintf.o"
600 AC_CHECK_FUNC(strerror, STRERROR_O="",
601 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
602 if test "$ac_cv_func_strerror" = no ; then
603 STRERROR_C="strerror.c"
604 STRERROR_O="strerror.o"
609 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
610 STRCASECMP_O="strcasecmp.o")
611 if test "$ac_cv_func_strcasecmp" = no ; then
612 STRCASECMP_C="strcasecmp.c"
613 STRCASECMP_O="strcasecmp.o"
615 AC_SUBST(STRCASECMP_C)
616 AC_SUBST(STRCASECMP_O)
618 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
619 STRNCASECMP_O="strncasecmp.o")
620 if test "$ac_cv_func_strncasecmp" = no ; then
621 STRNCASECMP_C="strncasecmp.c"
622 STRNCASECMP_O="strncasecmp.o"
624 AC_SUBST(STRNCASECMP_C)
625 AC_SUBST(STRNCASECMP_O)
627 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
628 MKSTEMP_O="mkstemp.o")
629 if test "$ac_cv_func_mkstemp" = no ; then
630 MKSTEMP_C="mkstemp.c"
631 MKSTEMP_O="mkstemp.o"
636 AC_CHECK_FUNC(strptime, STRPTIME_O="",
637 STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
638 if test "$ac_cv_func_strptime" = no ; then
639 STRPTIME_C="strptime.c"
640 STRPTIME_O="strptime.o"
645 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
647 dnl blank for now, but will be used in future
648 AC_SUBST(ethereal_SUBDIRS)
651 dnl check whether plugins should be enabled and, if they should be,
652 dnl check for plugins directory - stolen from Amanda's configure.in
654 plugindir="$libdir/ethereal/plugins/$VERSION"
655 PLUGIN_DIR="$plugindir"
657 [ --with-plugins[=DIR] support plugins (installed in DIR, if supplied).],
661 if test x$have_plugins = xno
663 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
670 if test x$have_plugins = xno
672 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
674 PLUGIN_DIR="$withval"
680 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
681 if test x$have_plugins = xyes
683 AC_DEFINE(HAVE_PLUGINS)
685 test "x$prefix" = xNONE && prefix=$ac_default_prefix
686 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
687 eval echo "$PLUGIN_DIR"
689 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
691 AC_DEFINE(PLUGIN_DIR,NULL)
698 AC_SUBST(LIBTOOL_DEPS)
700 AM_CONFIG_HEADER(config.h)
701 AC_CONFIG_SUBDIRS(epan wiretap)
708 packaging/nsis/Makefile
709 packaging/rpm/Makefile
710 packaging/rpm/SPECS/Makefile
711 packaging/rpm/SPECS/ethereal.spec
712 packaging/svr4/Makefile
713 packaging/svr4/checkinstall
714 packaging/svr4/pkginfo
716 plugins/docsis/Makefile
717 plugins/giop/Makefile
718 plugins/gryphon/Makefile
719 plugins/mgcp/Makefile
727 if test "x$enable_setuid_install" = "xyes" ; then
728 setuid_message="yes (DANGEROUS!!!)"
733 if test "x$want_zlib" = "no" ; then
739 if test "x$SNMP_LIBS" = "x" ; then
740 snmp_libs_message="no"
742 snmp_libs_message="yes"
746 echo "The Ethereal package has been configured with the following options."
747 echo " Build ethereal : $enable_ethereal"
748 echo " Build tethereal : $enable_tethereal"
749 echo " Build editcap : $enable_editcap"
750 echo " Build mergecap : $enable_mergecap"
751 echo " Build text2pcap : $enable_text2pcap"
752 echo " Build idl2eth : $enable_idl2eth"
753 echo " Build randpkt : $enable_randpkt"
754 echo " Build dftest : $enable_dftest"
756 echo " Install setuid : $setuid_message"
757 echo " Use plugins : $have_plugins"
758 echo " Use GTK+ v2 library : $enable_gtk2"
759 echo " Use pcap library : $want_pcap"
760 echo " Use zlib library : $zlib_message"
761 echo " Use IPv6 name resolution : $enable_ipv6"
762 echo " Use UCD SNMP library : $snmp_libs_message"