1 # $Id: configure.in,v 1.108 2000/11/09 10:04:46 gram 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.8.13)
18 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
20 dnl Check for CPU / vendor / OS
23 dnl Checks for programs.
29 AC_PATH_PROG(PERL, perl)
30 AC_PATH_PROG(LEX, flex)
31 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")
44 AC_CHECK_PROG(HAVE_RPM, rpm, "yes", "no")
46 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
47 -a x$HAVE_PKGTRANS = xyes ; then
48 HAVE_SVR4_PACKAGING=yes
50 HAVE_SVR4_PACKAGING=no
52 AC_SUBST(HAVE_SVR4_PACKAGING)
54 # Grr. Rpm 2.x has a nifty "--showrc" flag that lists all of the current
55 # configuration values. Version 3.x took the niftiness away by returning
56 # the values in their raw, unexpanded, macro-embedded form. We can either
57 # try to expand the values we get from 3.x, or poke around for popular build
60 if test x$HAVE_RPM = xyes ; then
61 AC_MSG_CHECKING(for rpm build directories)
62 RPM_SOURCESDIR=`rpm --showrc | grep "^sourcedir" | \
63 sed -e 's/.*: //' 2> /dev/null`
64 if test x$RPM_SPECDIR = x ; then
65 # Red Hat : /usr/src/redhat
66 # Mandrake : /usr/scr/rpm
67 # SuSE : /usr/src/packages
68 for TEST_DIR in /usr/src/redhat /usr/src/rpm /usr/src/packages ; do
69 if test -d $TEST_DIR/SPECS -a -d $TEST_DIR/SOURCES -a \
70 -d $TEST_DIR/RPMS -a -d $TEST_DIR/SRPMS -a \
71 -d $TEST_DIR/BUILD ; then
72 RPM_SOURCESDIR=$TEST_DIR/SOURCES
76 if test x$RPM_SOURCESDIR = x ; then
77 AC_MSG_RESULT(not found)
81 HAVE_RPM_PACKAGING=yes
84 AC_SUBST(HAVE_RPM_PACKAGING)
87 # If we're running gcc, add '-Wall' to CFLAGS.
88 AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
89 if test x$GCC != x ; then
90 CFLAGS="-Wall $CFLAGS"
97 # Add any platform-specific compiler flags needed.
99 AC_MSG_CHECKING(for platform-specific compiler flags)
103 # Not GCC - assume it's the vendor's compiler.
108 # HP's ANSI C compiler; flags suggested by Jost Martin.
109 # "-Ae" for ANSI C plus extensions such as "long long".
110 # "+O2", for optimization. XXX - works with "-g"?
112 CFLAGS="-Ae +O2 $CFLAGS"
113 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
116 AC_MSG_RESULT(none needed)
120 AC_MSG_RESULT(none needed)
124 # Arrange that we search for header files in the source directory
125 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
126 # as various packages we use ("libpcap", "zlib", an SNMP library)
127 # may have been installed under "/usr/local/include".
129 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
130 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
133 # Arrange that we search for libraries in "/usr/local/lib".
135 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
137 # Create DATAFILE_DIR #define for config.h
138 DATAFILE_DIR=$sysconfdir
140 test "x$prefix" = xNONE && prefix=$ac_default_prefix
141 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
142 eval echo "$DATAFILE_DIR"
144 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
145 AC_SUBST(DATAFILE_DIR)
147 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
151 AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
152 if test x$LD_LIBRARY_PATH != x ; then
153 LIBS="$LIBS -R$LD_LIBRARY_PATH"
154 AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
156 AC_MSG_RESULT(no -- this may be a problem in a few seconds)
162 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
163 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
164 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
165 # set when generating the Makefile, so we can make programs that require
166 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
167 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
168 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
169 # programs to be built with GLib.
171 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
174 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
175 # programs to be built with GTK+.
177 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS",
178 AC_MSG_ERROR(GTK+ distribution not found.))
180 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
181 dnl "gethostbyname()".
182 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
184 dnl Checks for "connect()", used as a proxy for "socket()" - and
185 dnl "-lsocket", if we need it to get "connect()".
186 AC_ETHEREAL_SOCKET_LIB_CHECK
190 [ --enable-pcap use libpcap for packet capturing. [default=yes]],,enable_pcap=yes)
192 AC_MSG_CHECKING(whether to use libpcap for packet capture)
193 if test "x$enable_pcap" = "xno" ; then
197 AC_ETHEREAL_PCAP_CHECK
202 [ --enable-zlib use zlib to read compressed data. [default=yes]],,enable_zlib=yes)
204 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
205 if test "x$enable_zlib" = "xno" ; then
209 AC_ETHEREAL_ZLIB_CHECK
210 if test "x$enable_zlib" = "xno" ; then
211 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
218 [ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],,enable_ipv6=yes)
220 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
221 if test "x$enable_ipv6" = "xno" ; then
225 AC_ETHEREAL_IPV6_STACK
229 dnl Check if ethereal should be installed setuid
230 AC_ARG_ENABLE(setuid-install,
231 [ --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
233 AC_MSG_CHECKING(whether to install ethereal setuid)
234 if test "x$enable_setuid_install" = "xno" ; then
240 dnl Checks for header files.
242 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
243 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
244 AC_CHECK_HEADERS(sys/wait.h)
245 AC_CHECK_HEADERS(netinet/in.h)
246 AC_CHECK_HEADERS(stddef.h)
247 AC_CHECK_HEADERS(dlfcn.h)
248 AC_CHECK_HEADERS(arpa/inet.h)
251 # XXX - we should also somehow arrange to support dynamic linking on
252 # HP-UX, even though it hasn't yet, apparently, implemented the
253 # UNIX standard "dlopen()" interface atop its own interface.
255 if test "$ac_cv_header_dlfcn_h" = yes ; then
256 AC_DEFINE(HAVE_PLUGINS)
261 [ --enable-snmp use SNMP library, if available. [default=yes]],,enable_snmp=yes)
264 AC_MSG_CHECKING(whether to use SNMP library if available)
265 if test "x$enable_snmp" = "xno" ; then
269 AC_ETHEREAL_UCDSNMP_CHECK
270 AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
273 # This may require "-lkstat" on Solaris, sigh.
275 AC_CHECK_LIB(snmp, sprint_objid,
279 # Throw away the cached "we didn't find it" answer.
281 unset ac_cv_lib_snmp_sprint_objid
282 AC_CHECK_LIB(snmp, sprint_objid,
285 # Throw away the cached "we found it" answer, so that if
286 # we rerun "configure", we don't just blow off this check
287 # and blithely assume that we don't need "-lkstat".
289 # XXX - autoconf really needs a way to test for a given
290 # routine in a given library *and* to test whether additional
291 # "-L"/"-R"/whatever flags are needed *before* the "-l"
292 # flag for the library and to test whether additional libraries
293 # are needed after the library *and* to cache all that
296 unset ac_cv_lib_snmp_sprint_objid
297 SNMP_LIBS="-lsnmp -lkstat"
298 ],,$SOCKET_LIBS $NSL_LIBS -lkstat
300 ], $SOCKET_LIBS $NSL_LIBS
306 dnl Checks for typedefs, structures, and compiler characteristics.
309 # We need to know whether "struct sockaddr" has an "sa_len" member
310 # for get_interface_list().
312 AC_ETHEREAL_STRUCT_SA_LEN
314 # We must know our byte order
317 # Checks whether "-traditional" is needed when using "ioctl".
318 # XXX - do we need this?
319 AC_PROG_GCC_TRADITIONAL
321 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
322 # then this won't work.
325 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
326 SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
327 if test "$ac_cv_func_snprintf" = no ; then
328 SNPRINTF_C="snprintf.c"
329 SNPRINTF_O="snprintf.o"
334 AC_CHECK_FUNC(strerror, STRERROR_O="",
335 STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
336 if test "$ac_cv_func_strerror" = no ; then
337 STRERROR_C="strerror.c"
338 STRERROR_O="strerror.o"
343 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
344 STRCASECMP_O="strcasecmp.o")
345 if test "$ac_cv_func_strcasecmp" = no ; then
346 STRCASECMP_C="strcasecmp.c"
347 STRCASECMP_O="strcasecmp.o"
349 AC_SUBST(STRCASECMP_C)
350 AC_SUBST(STRCASECMP_O)
352 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
353 STRNCASECMP_O="strncasecmp.o")
354 if test "$ac_cv_func_strncasecmp" = no ; then
355 STRNCASECMP_C="strncasecmp.c"
356 STRNCASECMP_O="strncasecmp.o"
358 AC_SUBST(STRNCASECMP_C)
359 AC_SUBST(STRNCASECMP_O)
361 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
362 MKSTEMP_O="mkstemp.o")
363 if test "$ac_cv_func_mkstemp" = no ; then
364 MKSTEMP_C="mkstemp.c"
365 MKSTEMP_O="mkstemp.o"
366 AC_DEFINE(NEED_MKSTEMP)
371 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
373 dnl blank for now, but will be used in future
374 AC_SUBST(ethereal_SUBDIRS)
376 dnl check for plugins directory - stolen from Amanda's configure.in
377 AC_ARG_WITH(plugindir,
378 [ --with-plugindir=DIR install plugins in DIR],
381 "" | y | ye | yes | n | no)
382 AC_MSG_ERROR([*** You must supply an argument to the --with-plugindir option.])
384 *) PLUGIN_DIR="$withval"
387 : ${PLUGIN_DIR=$libdir/ethereal/plugins/0.8.13}
391 test "x$prefix" = xNONE && prefix=$ac_default_prefix
392 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
393 eval echo "$PLUGIN_DIR"
395 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
401 AC_SUBST(LIBTOOL_DEPS)
403 AM_CONFIG_HEADER(config.h)
404 AC_CONFIG_SUBDIRS(epan wiretap)
411 packaging/rpm/Makefile
412 packaging/rpm/ethereal.spec
413 packaging/svr4/Makefile
414 packaging/svr4/checkinstall
415 packaging/svr4/pkginfo
417 plugins/gryphon/Makefile
418 plugins/mgcp/Makefile)