1 # $Id: configure.in,v 1.47 2003/07/23 20:32:37 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.
19 AM_INIT_AUTOMAKE(libwtap.a, 0.0.0)
20 AM_CONFIG_HEADER(config.h)
22 dnl Checks for programs.
28 AC_PATH_PROG(LEX, flex)
33 # If we're running gcc, add '-Wall -W -Wcast-qual' to CFLAGS, and add
34 # '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
35 # flag unused function arguments and not get warnings about them.
36 # If "--with-extra-gcc-checks" was specified, add "-Wcast-align"
37 # as well. (Add more checks here in the future?)
39 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
40 # argument will compile with non-GCC compilers.
42 AC_ARG_WITH(extra-gcc-checks,
43 [ --with-extra-gcc-checks Do additional -W checks in GCC. [default=no]],
45 if test $withval != no
47 ethereal_extra_gcc_flags=" -Wcast-align"
50 AC_MSG_CHECKING(to see if we can add '-Wall -W -Wcast-qual$ethereal_extra_gcc_flags' to CFLAGS)
51 if test x$GCC != x ; then
52 CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W -Wcast-qual$ethereal_extra_gcc_flags $CFLAGS"
55 CFLAGS="-D_U_=\"\" $CFLAGS"
60 # Add any platform-specific compiler flags needed.
62 AC_MSG_CHECKING(for platform-specific compiler flags)
66 # Not GCC - assume it's the vendor's compiler.
71 # HP's ANSI C compiler; flags suggested by Jost Martin.
72 # "-Ae" for ANSI C plus extensions such as "long long".
73 # "+O2", for optimization. XXX - works with "-g"?
75 CFLAGS="-Ae +O2 $CFLAGS"
76 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
80 # It may be called "cc", but it's really a GCC derivative
81 # with a problematic special precompiler and precompiled
82 # headers; turn off the special precompiler, as some
83 # apparently-legal code won't compile with its precompiled
86 CFLAGS="-no-cpp-precomp $CFLAGS"
87 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
90 AC_MSG_RESULT(none needed)
97 # See comments above about Apple's lovely C compiler.
99 CFLAGS="-no-cpp-precomp $CFLAGS"
100 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
103 AC_MSG_RESULT(none needed)
109 [ --enable-gtk2 build Glib2/Gtk2+-based (t)ethereal. [default=no]],enable_gtk2=$enableval,enable_gtk2=no)
111 if test "x$enable_gtk2" = "xyes" ; then
112 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS", , gmodule)
114 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS", , gmodule)
117 dnl Look in /usr/local for header files and libraries ?
118 AC_ARG_ENABLE(usr-local,
119 [ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
121 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
122 if test "x$enable_usr_local" = "xyes" ; then
125 # Arrange that we search for header files in "/usr/local/include",
126 # as various packages we use ("libpcap", "zlib") may have been installed
127 # under "/usr/local/include".
129 # We do this after checking for GLib, so that "-I/usr/local/include"
130 # comes after any "-I" flags added by "AM_PATH_GLIB"; if the user has
131 # installed a pre-1.2.9 version of GLib, it'd probably go under
132 # "/usr/local", and if they then install 1.2.9 or later without
133 # uninstalling the pre-1.2.9 version, 1.2.9's header files won't be
134 # in "/usr/local/include" (they're put in a separate directory so that
135 # GLib 1.2[.x] and 1.3[.x]/2.x can coexist), and if we search
136 # "/usr/local/include" before searching the directory "AM_PATH_GLIB"
137 # specifies, we may pick up headers from the older version.
139 CFLAGS="$CFLAGS -I/usr/local/include"
140 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
143 # Arrange that we search for libraries in "/usr/local/lib", as we'll
144 # be testing whether zlib has gzgets, and we need to be able to find
145 # zlib even if it's in "/usr/local/lib".
147 # We do this after checking for GLib; see above.
149 LDFLAGS="$LDFLAGS -L/usr/local/lib"
154 dnl Checks for header files
156 AC_CHECK_HEADERS(sys/time.h netinet/in.h unistd.h fcntl.h sys/stat.h sys/types.h)
158 # We must know our byte order
162 # Look for libpcap, so we can include <pcap.h> in libpcap.c if it's
165 # "--with-pcap" is merely done to allow the user to specify a directory
166 # in which to look for <pcap.h> (and so that specifying it to the
167 # top-level Ethereal configure script specifies it to the Wiretap
168 # configure script as well); we search for it regardless of whether
169 # "--without-pcap" was specified, as Wiretap isn't linked with it and
170 # there's no benefit to not looking for the header.
173 [ --with-pcap=DIR libpcap is located in directory DIR.],
175 if test $withval != yes -a $withval != no
182 AC_WIRETAP_PCAP_CHECK
185 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
188 [ --with-zlib[=DIR] use zlib (located in directory DIR, if supplied) to read compressed data. [default=yes, if present]],
190 if test $withval = no
193 elif test $withval = yes
202 # Use zlib if it's present, otherwise don't.
207 if test "x$want_zlib" = "xno" ; then
211 AC_WIRETAP_ZLIB_CHECK
212 if test "x$want_zlib" = "xno" ; then
213 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)