1 # $Id: configure.in,v 1.161 2002/03/29 03:33:57 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.3)
18 dnl Check for CPU / vendor / OS
21 dnl Checks for programs.
27 AC_PATH_PROG(PERL, perl)
28 AC_PATH_PROG(POD2MAN, pod2man)
29 AC_PATH_PROG(LEX, flex)
30 AC_PATH_PROG(PYTHON, python)
36 # Check for packaging utilities
37 # For now, we check to see if the various packaging utilites are in our
38 # path. I'm too lazy to write code to go hunt for them. - Gerald
39 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
40 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
41 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "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)
55 # If we're running gcc, add '-Wall -W -Wno-unused' to CFLAGS, and add
56 # '-D_U_="__attribute__((unused))"' as well, for future use when we
57 # remove '-Wno-unused'.
59 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
60 # argument will compile with non-GCC compilers.
62 AC_MSG_CHECKING(to see if we can add '-Wall -W -Wno-unused' to CFLAGS)
63 if test x$GCC != x ; then
64 CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W -Wno-unused $CFLAGS"
67 CFLAGS="-D_U_=\"\" $CFLAGS"
72 # Add any platform-specific compiler flags needed.
74 AC_MSG_CHECKING(for platform-specific compiler flags)
78 # Not GCC - assume it's the vendor's compiler.
83 # HP's ANSI C compiler; flags suggested by Jost Martin.
84 # "-Ae" for ANSI C plus extensions such as "long long".
85 # "+O2", for optimization. XXX - works with "-g"?
87 CFLAGS="-Ae +O2 $CFLAGS"
88 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
92 # It may be called "cc", but it's really a GCC derivative
93 # with a problematic special precompiler and precompiled
94 # headers; turn off the special precompiler, as some
95 # apparently-legal code won't compile with its precompiled
98 CFLAGS="-no-cpp-precomp $CFLAGS"
99 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
102 AC_MSG_RESULT(none needed)
108 # the X11 headers don't automatically include prototype info
109 # and a lot don't include the return type
110 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
111 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
115 # See comments above about Apple's lovely C compiler.
117 CFLAGS="-no-cpp-precomp $CFLAGS"
118 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
121 AC_MSG_RESULT(none needed)
126 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
127 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
129 dnl Look in /usr/local for header files and libraries ?
130 AC_ARG_ENABLE(usr-local,
131 [ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
133 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
134 if test "x$enable_usr_local" = "xyes" ; then
137 # Arrange that we search for header files in the source directory
138 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
139 # as various packages we use ("libpcap", "zlib", an SNMP library)
140 # may have been installed under "/usr/local/include".
142 CFLAGS="$CFLAGS -I/usr/local/include"
143 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
146 # Arrange that we search for libraries in "/usr/local/lib".
148 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
153 # Create DATAFILE_DIR #define for config.h
154 DATAFILE_DIR=$sysconfdir
156 test "x$prefix" = xNONE && prefix=$ac_default_prefix
157 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
158 eval echo "$DATAFILE_DIR"
160 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
161 AC_SUBST(DATAFILE_DIR)
164 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
169 AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
170 if test x$LD_LIBRARY_PATH != x ; then
171 LIBS="$LIBS -R$LD_LIBRARY_PATH"
172 AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
174 AC_MSG_RESULT(no -- this may be a problem in a few seconds)
180 # Check for versions of "sed" inadequate to handle, in libtool, a list
181 # of object files as large as the list in Ethereal.
183 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
184 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
185 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
186 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
187 # is the only "sed" that comes with Solaris that can handle Ethereal.
189 # Add any checks here that are necessary for other OSes.
191 AC_ETHEREAL_GNU_SED_CHECK
192 if test "$HAVE_GNU_SED" = no ; then
195 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
197 /bin/sed|/usr/bin/sed|/usr/ucb/sed)
199 AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
214 # Enable/disable tethereal
218 AC_ARG_ENABLE(ethereal,
219 [ --enable-ethereal build GTK+-based ethereal. [default=yes]],,enable_ethereal=yes)
222 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
223 # programs to be built with GTK+.
225 if test "x$enable_ethereal" = "xyes" ; then
226 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
230 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
231 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
232 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
233 # set when generating the Makefile, so we can make programs that require
234 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
235 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
236 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
237 # programs to be built with GLib.
239 if test "$GTK_OK" = "yes" -a "x$enable_ethereal" = "xyes" ; then
240 ethereal_bin="ethereal"
241 ethereal_man="ethereal.1"
242 ethereal_SUBDIRS="gtk"
245 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
251 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
255 # Check whether GLib modules are supported, to determine whether we
256 # can support plugins.
258 AC_MSG_CHECKING(whether GLib supports loadable modules)
259 ac_save_CFLAGS="$CFLAGS"
261 CFLAGS="$CFLAGS $GLIB_CFLAGS"
262 LIBS="$GLIB_LIBS $LIBS"
272 if (g_module_supported())
273 return 0; /* success */
275 return 1; /* failure */
277 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
278 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
279 CFLAGS="$ac_save_CFLAGS"
281 if test "$ac_cv_glib_supports_modules" = yes ; then
290 AC_SUBST(ethereal_bin)
291 AC_SUBST(ethereal_man)
295 # Enable/disable tethereal
297 AC_ARG_ENABLE(tethereal,
298 [ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
300 if test "x$enable_tethereal" = "xyes" ; then
301 tethereal_bin="tethereal"
302 tethereal_man="tethereal.1"
307 AC_SUBST(tethereal_bin)
308 AC_SUBST(tethereal_man)
312 # Enable/disable editcap
314 AC_ARG_ENABLE(editcap,
315 [ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
317 if test "x$enable_editcap" = "xyes" ; then
318 editcap_bin="editcap"
319 editcap_man="editcap.1"
324 AC_SUBST(editcap_bin)
325 AC_SUBST(editcap_man)
328 # Enable/disable mergecap
330 AC_ARG_ENABLE(mergecap,
331 [ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
333 if test "x$enable_mergecap" = "xyes" ; then
334 mergecap_bin="mergecap"
335 mergecap_man="mergecap.1"
340 AC_SUBST(mergecap_bin)
341 AC_SUBST(mergecap_man)
344 # Enable/disable text2pcap
346 AC_ARG_ENABLE(text2pcap,
347 [ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
349 if test "x$enable_text2pcap" = "xyes" ; then
350 text2pcap_bin="text2pcap"
351 text2pcap_man="text2pcap.1"
356 AC_SUBST(text2pcap_bin)
357 AC_SUBST(text2pcap_man)
359 # Enable/disable idl2eth
361 AC_ARG_ENABLE(idl2eth,
362 [ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)
364 if test "x$enable_idl2eth" = "xyes" ; then
365 idl2eth_bin="idl2eth"
366 idl2eth_man="idl2eth.1"
371 AC_SUBST(idl2eth_bin)
372 AC_SUBST(idl2eth_man)
375 # Enable/disable dftest
377 AC_ARG_ENABLE(dftest,
378 [ --enable-dftest build dftest. [default=no]],,enable_dftest=no)
380 if test "x$enable_dftest" = "xyes" ; then
388 # Enable/disable randpkt
390 AC_ARG_ENABLE(randpkt,
391 [ --enable-randpkt build randpkt. [default=no]],,enable_randpkt=no)
393 if test "x$enable_randpkt" = "xyes" ; then
394 randpkt_bin="randpkt"
398 AC_SUBST(randpkt_bin)
401 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
402 dnl "gethostbyname()".
403 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
405 dnl Checks for "connect()", used as a proxy for "socket()" - and
406 dnl "-lsocket", if we need it to get "connect()".
407 AC_ETHEREAL_SOCKET_LIB_CHECK
410 AC_MSG_CHECKING(whether to use libpcap for packet capture)
413 [ --with-pcap[=DIR] use libpcap for packet capturing. [default=yes]],
415 if test $withval = no
418 elif test $withval = yes
429 if test "x$want_pcap" = "xno" ; then
433 AC_ETHEREAL_PCAP_CHECK
434 AC_ETHEREAL_PCAP_VERSION_CHECK
439 [ --enable-zlib use zlib to read compressed data. [default=yes]],,enable_zlib=yes)
441 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
442 if test "x$enable_zlib" = "xno" ; then
446 AC_ETHEREAL_ZLIB_CHECK
447 if test "x$enable_zlib" = "xno" ; then
448 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
455 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
457 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
458 if test "x$enable_ipv6" = "xno" ; then
462 AC_ETHEREAL_IPV6_STACK
466 dnl Check if ethereal should be installed setuid
467 AC_ARG_ENABLE(setuid-install,
468 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
470 AC_MSG_CHECKING(whether to install ethereal setuid)
471 if test "x$enable_setuid_install" = "xno" ; then
477 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
479 dnl Checks for header files.
481 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
482 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
483 AC_CHECK_HEADERS(sys/wait.h)
484 AC_CHECK_HEADERS(netinet/in.h)
485 AC_CHECK_HEADERS(stddef.h)
486 AC_CHECK_HEADERS(arpa/inet.h)
487 AC_CHECK_HEADERS(iconv.h)
491 AC_MSG_CHECKING(whether to use SSL library if available)
492 if test "x$enable_ssl" = "xno" ; then
496 AC_ETHEREAL_SSL_CHECK
502 AC_MSG_CHECKING(whether to use UCD SNMP/NET-SNMP library if available)
505 [ --with-ucdsnmp[=DIR] use UCD SNMP/NET-SNMP client library (located in directory DIR, if supplied). [default=yes, if present]],
507 if test $withval = no
510 elif test $withval = yes
519 # For now, we default to *not* using the UCD SNMP library unless
520 # the user explicitly asks for it, as the current release has
521 # buffer-overflow vulnerabilities we can't avoid.
523 # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
524 # if you find it, otherwise don't".
530 if test "x$want_ucdsnmp" = "xno" ; then
534 AC_ETHEREAL_UCDSNMP_CHECK
538 dnl Checks for typedefs, structures, and compiler characteristics.
541 # We need to know whether "struct sockaddr" has an "sa_len" member
542 # for get_interface_list().
544 AC_ETHEREAL_STRUCT_SA_LEN
546 # We must know our byte order
549 # Checks whether "-traditional" is needed when using "ioctl".
550 # XXX - do we need this?
551 AC_PROG_GCC_TRADITIONAL
553 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
554 # then this won't work.
557 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
558 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
559 if test "$ac_cv_func_snprintf" = no ; then
560 SNPRINTF_C="snprintf.c"
561 SNPRINTF_O="snprintf.o"
566 AC_CHECK_FUNC(strerror, STRERROR_O="",
567 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
568 if test "$ac_cv_func_strerror" = no ; then
569 STRERROR_C="strerror.c"
570 STRERROR_O="strerror.o"
575 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
576 STRCASECMP_O="strcasecmp.o")
577 if test "$ac_cv_func_strcasecmp" = no ; then
578 STRCASECMP_C="strcasecmp.c"
579 STRCASECMP_O="strcasecmp.o"
581 AC_SUBST(STRCASECMP_C)
582 AC_SUBST(STRCASECMP_O)
584 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
585 STRNCASECMP_O="strncasecmp.o")
586 if test "$ac_cv_func_strncasecmp" = no ; then
587 STRNCASECMP_C="strncasecmp.c"
588 STRNCASECMP_O="strncasecmp.o"
590 AC_SUBST(STRNCASECMP_C)
591 AC_SUBST(STRNCASECMP_O)
593 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
594 MKSTEMP_O="mkstemp.o")
595 if test "$ac_cv_func_mkstemp" = no ; then
596 MKSTEMP_C="mkstemp.c"
597 MKSTEMP_O="mkstemp.o"
602 AC_CHECK_FUNC(strptime, STRPTIME_O="",
603 STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
604 if test "$ac_cv_func_strptime" = no ; then
605 STRPTIME_C="strptime.c"
606 STRPTIME_O="strptime.o"
611 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
613 dnl blank for now, but will be used in future
614 AC_SUBST(ethereal_SUBDIRS)
617 dnl check whether plugins should be enabled and, if they should be,
618 dnl check for plugins directory - stolen from Amanda's configure.in
620 PLUGIN_DIR="$libdir/ethereal/plugins/$VERSION"
622 [ --with-plugins[=DIR] support plugins (installed in DIR, if supplied).],
626 if test x$have_plugins = xno
628 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
635 if test x$have_plugins = xno
637 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
639 PLUGIN_DIR="$withval"
645 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
646 if test x$have_plugins = xyes
648 AC_DEFINE(HAVE_PLUGINS)
650 test "x$prefix" = xNONE && prefix=$ac_default_prefix
651 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
652 eval echo "$PLUGIN_DIR"
654 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
656 AC_DEFINE(PLUGIN_DIR,NULL)
663 AC_SUBST(LIBTOOL_DEPS)
665 AM_CONFIG_HEADER(config.h)
666 AC_CONFIG_SUBDIRS(epan wiretap)
672 packaging/nsis/Makefile
673 packaging/rpm/Makefile
674 packaging/rpm/SPECS/Makefile
675 packaging/rpm/SPECS/ethereal.spec
676 packaging/svr4/Makefile
677 packaging/svr4/checkinstall
678 packaging/svr4/pkginfo
680 plugins/gryphon/Makefile
681 plugins/mgcp/Makefile
682 plugins/giop/Makefile
690 if test "x$enable_setuid_install" = "xyes" ; then
691 setuid_message="yes (DANGEROUS!!!)"
696 if test "x$SNMP_LIBS" = "x" ; then
697 snmp_libs_message="no"
699 snmp_libs_message="yes"
705 echo "The Ethereal package has been configured with the following options."
706 echo " Build ethereal : $enable_ethereal"
707 echo " Build tethereal : $enable_tethereal"
708 echo " Build editcap : $enable_editcap"
709 echo " Build mergecap : $enable_mergecap"
710 echo " Build text2pcap : $enable_text2pcap"
711 echo " Build idl2eth : $enable_idl2eth"
712 echo " Build randpkt : $enable_randpkt"
713 echo " Build dftest : $enable_dftest"
715 echo " Install setuid : $setuid_message"
716 echo " Use plugins : $have_plugins"
717 echo " Use pcap library : $want_pcap"
718 echo " Use zlib library : $enable_zlib"
719 echo " Use IPv6 name resolution : $enable_ipv6"
720 echo " Use UCD SNMP library : $snmp_libs_message"