1 # $Id: configure.in,v 1.149 2002/01/30 23:01:30 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.0)
18 dnl Check for CPU / vendor / OS
21 dnl Checks for programs.
22 AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
23 if test -z "$CC" -a "$with_gcc" = no ; then
32 AC_PATH_PROG(PERL, perl)
33 AC_PATH_PROG(LEX, flex)
34 AC_PATH_PROG(PYTHON, python)
40 # Check for packaging utilities
41 # For now, we check to see if the various packaging utilites are in our
42 # path. I'm too lazy to write code to go hunt for them. - Gerald
43 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
44 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
45 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
47 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
48 -a x$HAVE_PKGTRANS = xyes ; then
49 HAVE_SVR4_PACKAGING=yes
51 HAVE_SVR4_PACKAGING=no
53 AC_SUBST(HAVE_SVR4_PACKAGING)
58 # If we're running gcc, add '-Wall' to CFLAGS.
59 AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
60 if test x$GCC != x ; then
61 CFLAGS="-Wall -W -Wno-unused $CFLAGS"
68 # Add any platform-specific compiler flags needed.
70 AC_MSG_CHECKING(for platform-specific compiler flags)
74 # Not GCC - assume it's the vendor's compiler.
79 # HP's ANSI C compiler; flags suggested by Jost Martin.
80 # "-Ae" for ANSI C plus extensions such as "long long".
81 # "+O2", for optimization. XXX - works with "-g"?
83 CFLAGS="-Ae +O2 $CFLAGS"
84 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
88 # It may be called "cc", but it's really a GCC derivative
89 # with a problematic special precompiler and precompiled
90 # headers; turn off the special precompiler, as some
91 # apparently-legal code won't compile with its precompiled
94 CFLAGS="-no-cpp-precomp $CFLAGS"
95 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
98 AC_MSG_RESULT(none needed)
104 # the X11 headers don't automatically include prototype info
105 # and a lot don't include the return type
106 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
107 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
111 # See comments above about Apple's lovely C compiler.
113 CFLAGS="-no-cpp-precomp $CFLAGS"
114 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
117 AC_MSG_RESULT(none needed)
122 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
123 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
125 dnl Look in /usr/local for header files and libraries ?
126 AC_ARG_ENABLE(usr-local,
127 [ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
129 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
130 if test "x$enable_usr_local" = "xyes" ; then
133 # Arrange that we search for header files in the source directory
134 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
135 # as various packages we use ("libpcap", "zlib", an SNMP library)
136 # may have been installed under "/usr/local/include".
138 CFLAGS="$CFLAGS -I/usr/local/include"
139 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
142 # Arrange that we search for libraries in "/usr/local/lib".
144 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
149 # Create DATAFILE_DIR #define for config.h
150 DATAFILE_DIR=$sysconfdir
152 test "x$prefix" = xNONE && prefix=$ac_default_prefix
153 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
154 eval echo "$DATAFILE_DIR"
156 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
157 AC_SUBST(DATAFILE_DIR)
160 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
163 # Also, make sure that "sed" does *NOT* refer to "/usr/bin/sed" or
164 # "/usr/ucb/sed", as, on Solaris, both of them are inadequate to
165 # handle, in libtool, a list of object files as large as the list
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)
177 AC_MSG_CHECKING(whether one of /usr/bin/sed or /usr/ucb/sed will be used)
179 /usr/bin/sed|/usr/ucb/sed)
181 AC_MSG_ERROR([change your path to search /usr/xpg4/bin before /usr/bin (and /usr/ucb)])
192 # Enable/disable tethereal
196 AC_ARG_ENABLE(ethereal,
197 [ --enable-ethereal build GTK+-based ethereal. [default=yes]],,enable_ethereal=yes)
200 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
201 # programs to be built with GTK+.
203 if test "x$enable_ethereal" = "xyes" ; then
204 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
208 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
209 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
210 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
211 # set when generating the Makefile, so we can make programs that require
212 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
213 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
214 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
215 # programs to be built with GLib.
217 if test "$GTK_OK" = "yes" -a "x$enable_ethereal" = "xyes" ; then
218 ethereal_bin="ethereal"
219 ethereal_man="ethereal.1"
220 ethereal_SUBDIRS="gtk"
223 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
229 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
233 # Check whether GLib modules are supported, to determine whether we
234 # can support plugins.
236 AC_MSG_CHECKING(whether GLib supports loadable modules)
237 ac_save_CFLAGS="$CFLAGS"
239 CFLAGS="$CFLAGS $GLIB_CFLAGS"
240 LIBS="$GLIB_LIBS $LIBS"
250 if (g_module_supported())
251 return 0; /* success */
253 return 1; /* failure */
255 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
256 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
257 CFLAGS="$ac_save_CFLAGS"
259 if test "$ac_cv_glib_supports_modules" = yes ; then
268 AC_SUBST(ethereal_bin)
269 AC_SUBST(ethereal_man)
273 # Enable/disable tethereal
275 AC_ARG_ENABLE(tethereal,
276 [ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
278 if test "x$enable_tethereal" = "xyes" ; then
279 tethereal_bin="tethereal"
280 tethereal_man="tethereal.1"
285 AC_SUBST(tethereal_bin)
286 AC_SUBST(tethereal_man)
290 # Enable/disable editcap
292 AC_ARG_ENABLE(editcap,
293 [ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
295 if test "x$enable_editcap" = "xyes" ; then
296 editcap_bin="editcap"
297 editcap_man="editcap.1"
302 AC_SUBST(editcap_bin)
303 AC_SUBST(editcap_man)
306 # Enable/disable mergecap
308 AC_ARG_ENABLE(mergecap,
309 [ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
311 if test "x$enable_mergecap" = "xyes" ; then
312 mergecap_bin="mergecap"
313 mergecap_man="mergecap.1"
318 AC_SUBST(mergecap_bin)
319 AC_SUBST(mergecap_man)
322 # Enable/disable text2pcap
324 AC_ARG_ENABLE(text2pcap,
325 [ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
327 if test "x$enable_text2pcap" = "xyes" ; then
328 text2pcap_bin="text2pcap"
329 text2pcap_man="text2pcap.1"
334 AC_SUBST(text2pcap_bin)
335 AC_SUBST(text2pcap_man)
337 # Enable/disable idl2eth
339 AC_ARG_ENABLE(idl2eth,
340 [ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)
342 if test "x$enable_idl2eth" = "xyes" ; then
343 idl2eth_bin="idl2eth"
344 idl2eth_man="idl2eth.1"
349 AC_SUBST(idl2eth_bin)
350 AC_SUBST(idl2eth_man)
353 # Enable/disable dftest
355 AC_ARG_ENABLE(dftest,
356 [ --enable-dftest build dftest. [default=no]],,enable_dftest=no)
358 if test "x$enable_dftest" = "xyes" ; then
366 # Enable/disable randpkt
368 AC_ARG_ENABLE(randpkt,
369 [ --enable-randpkt build randpkt. [default=no]],,enable_randpkt=no)
371 if test "x$enable_randpkt" = "xyes" ; then
372 randpkt_bin="randpkt"
376 AC_SUBST(randpkt_bin)
379 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
380 dnl "gethostbyname()".
381 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
383 dnl Checks for "connect()", used as a proxy for "socket()" - and
384 dnl "-lsocket", if we need it to get "connect()".
385 AC_ETHEREAL_SOCKET_LIB_CHECK
388 AC_MSG_CHECKING(whether to use libpcap for packet capture)
391 [ --with-pcap[=DIR] use libpcap for packet capturing. [default=yes]],
393 if test $withval = no
396 elif test $withval = yes
407 if test "x$want_pcap" = "xno" ; then
411 AC_ETHEREAL_PCAP_CHECK
412 AC_ETHEREAL_PCAP_VERSION_CHECK
417 [ --enable-zlib use zlib to read compressed data. [default=yes]],,enable_zlib=yes)
419 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
420 if test "x$enable_zlib" = "xno" ; then
424 AC_ETHEREAL_ZLIB_CHECK
425 if test "x$enable_zlib" = "xno" ; then
426 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
433 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
435 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
436 if test "x$enable_ipv6" = "xno" ; then
440 AC_ETHEREAL_IPV6_STACK
444 dnl Check if ethereal should be installed setuid
445 AC_ARG_ENABLE(setuid-install,
446 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
448 AC_MSG_CHECKING(whether to install ethereal setuid)
449 if test "x$enable_setuid_install" = "xno" ; then
455 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
457 dnl Checks for header files.
459 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
460 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
461 AC_CHECK_HEADERS(sys/wait.h)
462 AC_CHECK_HEADERS(netinet/in.h)
463 AC_CHECK_HEADERS(stddef.h)
464 AC_CHECK_HEADERS(arpa/inet.h)
465 AC_CHECK_HEADERS(iconv.h)
469 AC_MSG_CHECKING(whether to use SSL library if available)
470 if test "x$enable_ssl" = "xno" ; then
474 AC_ETHEREAL_SSL_CHECK
480 [ --enable-snmp use SNMP library, if available. [default=yes]],,enable_snmp=yes)
483 AC_MSG_CHECKING(whether to use SNMP library if available)
484 if test "x$enable_snmp" = "xno" ; then
488 AC_ETHEREAL_UCDSNMP_CHECK
489 AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
492 # If we found both UCD and CMU SNMP headers, die, as both
493 # packages install the SNMP library as "libsnmp", so either
494 # only one of them is present or they're in different
495 # directories, and we run the risk of picking up the headers
496 # from one and the library from another.
498 if test "$ac_cv_header_ucd_snmp_snmp_h" = yes -a \
499 "$ac_cv_header_snmp_snmp_h" = yes ; then
500 AC_MSG_ERROR([Both UCD and CMU SNMP libraries found - uninstall one of them.])
504 # Look for the string 'sbuf' in ucd-snmp/mib.h. If found, assume
505 # we've encountered a Red Hat-modified version of UCD SNMP.
507 # XXX - Check for 'binit()' in parse.h
509 AC_EGREP_HEADER(sprint_objid.*sbuf, ucd-snmp/mib.h,
510 AC_DEFINE(RED_HAT_MODIFIED_UCD_SNMP))
514 # This may require "-lkstat" on Solaris, sigh.
516 AC_CHECK_LIB(snmp, sprint_objid,
520 # Throw away the cached "we didn't find it" answer.
522 unset ac_cv_lib_snmp_sprint_objid
523 AC_CHECK_LIB(snmp, sprint_objid,
526 # Throw away the cached "we found it" answer, so that if
527 # we rerun "configure", we don't just blow off this check
528 # and blithely assume that we don't need "-lkstat".
530 # XXX - autoconf really needs a way to test for a given
531 # routine in a given library *and* to test whether additional
532 # "-L"/"-R"/whatever flags are needed *before* the "-l"
533 # flag for the library and to test whether additional libraries
534 # are needed after the library *and* to cache all that
537 unset ac_cv_lib_snmp_sprint_objid
538 SNMP_LIBS="-lsnmp -lkstat"
539 ],,$SOCKET_LIBS $NSL_LIBS $SSL_LIBS -lkstat
541 ], $SOCKET_LIBS $NSL_LIBS $SSL_LIBS
545 # If we have SNMP header files but didn't find "sprint_objid()",
546 # fail, as there's something wrong (perhaps the user needs to
547 # specify "--with-ssl").
549 if test '(' "$ac_cv_header_ucd_snmp_snmp_h" = yes -o \
550 "$ac_cv_header_snmp_snmp_h" = yes ')' -a \
551 "$ac_cv_lib_snmp_sprint_objid" = no; then
552 AC_MSG_ERROR([SNMP header files found, but sprint_objid not found in SNMP library.])
557 dnl Checks for typedefs, structures, and compiler characteristics.
560 # We need to know whether "struct sockaddr" has an "sa_len" member
561 # for get_interface_list().
563 AC_ETHEREAL_STRUCT_SA_LEN
565 # We must know our byte order
568 # Checks whether "-traditional" is needed when using "ioctl".
569 # XXX - do we need this?
570 AC_PROG_GCC_TRADITIONAL
572 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
573 # then this won't work.
576 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
577 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
578 if test "$ac_cv_func_snprintf" = no ; then
579 SNPRINTF_C="snprintf.c"
580 SNPRINTF_O="snprintf.o"
585 AC_CHECK_FUNC(strerror, STRERROR_O="",
586 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
587 if test "$ac_cv_func_strerror" = no ; then
588 STRERROR_C="strerror.c"
589 STRERROR_O="strerror.o"
594 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
595 STRCASECMP_O="strcasecmp.o")
596 if test "$ac_cv_func_strcasecmp" = no ; then
597 STRCASECMP_C="strcasecmp.c"
598 STRCASECMP_O="strcasecmp.o"
600 AC_SUBST(STRCASECMP_C)
601 AC_SUBST(STRCASECMP_O)
603 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
604 STRNCASECMP_O="strncasecmp.o")
605 if test "$ac_cv_func_strncasecmp" = no ; then
606 STRNCASECMP_C="strncasecmp.c"
607 STRNCASECMP_O="strncasecmp.o"
609 AC_SUBST(STRNCASECMP_C)
610 AC_SUBST(STRNCASECMP_O)
612 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
613 MKSTEMP_O="mkstemp.o")
614 if test "$ac_cv_func_mkstemp" = no ; then
615 MKSTEMP_C="mkstemp.c"
616 MKSTEMP_O="mkstemp.o"
621 AC_CHECK_FUNC(strptime, STRPTIME_O="",
622 STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
623 if test "$ac_cv_func_strptime" = no ; then
624 STRPTIME_C="strptime.c"
625 STRPTIME_O="strptime.o"
630 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
632 dnl blank for now, but will be used in future
633 AC_SUBST(ethereal_SUBDIRS)
636 dnl check whether plugins should be enabled and, if they should be,
637 dnl check for plugins directory - stolen from Amanda's configure.in
639 PLUGIN_DIR="$libdir/ethereal/plugins/$VERSION"
641 [ --with-plugins[=DIR] support plugins (installed in DIR, if supplied).],
645 if test x$have_plugins = xno
647 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
654 if test x$have_plugins = xno
656 AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
658 PLUGIN_DIR="$withval"
664 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
665 if test x$have_plugins = xyes
667 AC_DEFINE(HAVE_PLUGINS)
669 test "x$prefix" = xNONE && prefix=$ac_default_prefix
670 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
671 eval echo "$PLUGIN_DIR"
673 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
675 AC_DEFINE(PLUGIN_DIR,NULL)
682 AC_SUBST(LIBTOOL_DEPS)
684 AM_CONFIG_HEADER(config.h)
685 AC_CONFIG_SUBDIRS(epan wiretap)
691 packaging/nsis/Makefile
692 packaging/rpm/Makefile
693 packaging/rpm/SPECS/Makefile
694 packaging/rpm/SPECS/ethereal.spec
695 packaging/svr4/Makefile
696 packaging/svr4/checkinstall
697 packaging/svr4/pkginfo
699 plugins/gryphon/Makefile
700 plugins/mgcp/Makefile
701 plugins/giop/Makefile
709 if test "x$enable_setuid_install" = "xyes" ; then
710 setuid_message="yes (DANGEROUS!!!)"
715 if test "x$SNMP_LIBS" = "x" ; then
716 snmp_libs_message="no"
718 snmp_libs_message="yes"
724 echo "The Ethereal package has been configured with the following options."
725 echo " Build ethereal : $enable_ethereal"
726 echo " Build tethereal : $enable_tethereal"
727 echo " Build editcap : $enable_editcap"
728 echo " Build mergecap : $enable_mergecap"
729 echo " Build text2pcap : $enable_text2pcap"
730 echo " Build idl2eth : $enable_idl2eth"
731 echo " Build randpkt : $enable_randpkt"
732 echo " Build dftest : $enable_dftest"
734 echo " Install setuid : $setuid_message"
735 echo " Use plugins : $have_plugins"
736 echo " Use pcap library : $want_pcap"
737 echo " Use zlib library : $enable_zlib"
738 echo " Use IPv6 name resolution : $enable_ipv6"
739 echo " Use SNMP library : $snmp_libs_message"