diff options
-rw-r--r-- | acconfig.h | 4 | ||||
-rw-r--r-- | acinclude.m4 | 91 | ||||
-rw-r--r-- | configure.in | 32 | ||||
-rw-r--r-- | wiretap/acconfig.h | 4 | ||||
-rw-r--r-- | wiretap/acinclude.m4 | 152 | ||||
-rw-r--r-- | wiretap/configure.in | 34 |
6 files changed, 287 insertions, 30 deletions
diff --git a/acconfig.h b/acconfig.h index 680271a644..21b1718645 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,7 +1,7 @@ /* acconfig.h * #ifdefs to be controlled by "configure" * - * $Id: acconfig.h,v 1.23 2002/03/12 10:37:01 guy Exp $ + * $Id: acconfig.h,v 1.24 2002/04/08 01:34:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.org> @@ -42,6 +42,8 @@ #undef HAVE_PCAP_VERSION +#undef HAVE_LIBZ + #undef HAVE_UCD_SNMP #undef PLUGIN_DIR diff --git a/acinclude.m4 b/acinclude.m4 index 1bff35e859..38a05706fc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2,7 +2,7 @@ dnl Macros that test for specific features. dnl This file is part of the Autoconf packaging for Ethereal. dnl Copyright (C) 1998-2000 by Gerald Combs. dnl -dnl $Id: acinclude.m4,v 1.43 2002/03/12 10:37:01 guy Exp $ +dnl $Id: acinclude.m4,v 1.44 2002/04/08 01:34:38 guy Exp $ dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -356,13 +356,63 @@ return_pcap_version(void) # AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK, [ + if test "x$zlib_dir" != "x" + then + # + # The user specified a directory in which zlib resides, + # so add the "include" subdirectory of that directory to + # the include file search path and the "lib" subdirectory + # of that directory to the library search path. + # + # XXX - if there's also a zlib in a directory that's + # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't + # make us find the version in the specified directory, + # as the compiler and/or linker will search that other + # directory before it searches the specified directory. + # + ethereal_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I$zlib_dir/include" + ethereal_save_CPPLAGS="$CPPLAGS" + CPPFLAGS="$CPPFLAGS -I$zlib_dir/include" + ethereal_save_LIBS="$LIBS" + AC_ETHEREAL_ADD_DASH_L(LIBS, $zlib_dir/lib) + fi + # # Make sure we have "zlib.h". If we don't, it means we probably # don't have zlib, so don't use it. # - AC_CHECK_HEADER(zlib.h,,enable_zlib=no) + AC_CHECK_HEADER(zlib.h,, + [ + if test "x$zlib_dir" != "x" + then + # + # The user used "--with-zlib=" to specify a directory + # containing zlib, but we didn't find the header file + # there; that either means they didn't specify the + # right directory or are confused about whether zlib + # is, in fact, installed. Report the error and give up. + # + AC_MSG_ERROR([zlib header not found in directory specified in --with-zlib]) + else + if test "x$want_zlib" = "xyes" + then + # + # The user tried to force us to use the library, but we + # couldn't find the header file; report an error. + # + AC_MSG_ERROR(Header file zlib.h not found.) + else + # + # We couldn't find the header file; don't use the + # library, as it's probably not present. + # + want_zlib=no + fi + fi + ]) - if test x$enable_zlib != xno + if test "x$want_zlib" != "xno" then # # Well, we at least have the zlib header file. @@ -388,10 +438,41 @@ AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK, # versions of zlib without "gzgets()" are likely to have # a broken "gzseek()". # - AC_CHECK_LIB(z, gzgets,,enable_zlib=no) + AC_CHECK_LIB(z, gzgets, + [ + if test "x$zlib_dir" != "x" + then + # + # Put the "-I" and "-L" flags for zlib at + # the beginning of CFLAGS, CPPFLAGS, and + # LIBS. + # + LIBS="" + AC_ETHEREAL_ADD_DASH_L(LIBS, $zlib_dir/lib) + LIBS="$LIBS -lz $ethereal_save_LIBS" + else + LIBS="-lz $LIBS" + fi + AC_DEFINE(HAVE_LIBZ) + ],[ + if test "x$zlib_dir" != "x" + then + # + # Restore the versions of CFLAGS, CPPFLAGS, + # and LIBS before we added the "-with-zlib=" + # directory, as we didn't actually find + # zlib there, or didn't find a zlib that + # contains gzgets there. + # + CFLAGS="$ethereal_save_CFLAGS" + CPPFLAGS="$ethereal_save_CPPLAGS" + LIBS="$ethereal_save_LIBS" + fi + want_zlib=no + ]) fi - if test x$enable_zlib != xno + if test "x$want_zlib" != "xno" then # # Well, we at least have the zlib header file and a zlib diff --git a/configure.in b/configure.in index dcde78b453..de5e3dc497 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.161 2002/03/29 03:33:57 gerald Exp $ +# $Id: configure.in,v 1.162 2002/04/08 01:34:38 guy Exp $ dnl dnl Process this file with autoconf 2.13 or later to produce a dnl configure script; 2.12 doesn't generate a "configure" script that @@ -435,16 +435,34 @@ else fi dnl zlib check -AC_ARG_ENABLE(zlib, -[ --enable-zlib use zlib to read compressed data. [default=yes]],,enable_zlib=yes) - AC_MSG_CHECKING(whether to use zlib for reading compressed capture files) -if test "x$enable_zlib" = "xno" ; then + +AC_ARG_WITH(zlib, +[ --with-zlib[=DIR] use zlib (located in directory DIR, if supplied) to read compressed data. [default=yes, if present]], +[ + if test $withval = no + then + want_zlib=no + elif test $withval = yes + then + want_zlib=yes + else + want_zlib=yes + zlib_dir=$withval + fi +],[ + # + # Use zlib if it's present, otherwise don't. + # + want_zlib=ifpresent + zlib_dir= +]) +if test "x$want_zlib" = "xno" ; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_ETHEREAL_ZLIB_CHECK - if test "x$enable_zlib" = "xno" ; then + if test "x$want_zlib" = "xno" ; then AC_MSG_RESULT(zlib not found - disabling compressed capture file support) fi fi @@ -715,6 +733,6 @@ echo "" echo " Install setuid : $setuid_message" echo " Use plugins : $have_plugins" echo " Use pcap library : $want_pcap" -echo " Use zlib library : $enable_zlib" +echo " Use zlib library : $want_zlib" echo " Use IPv6 name resolution : $enable_ipv6" echo " Use UCD SNMP library : $snmp_libs_message" diff --git a/wiretap/acconfig.h b/wiretap/acconfig.h index e9c52e450d..7f318a2d77 100644 --- a/wiretap/acconfig.h +++ b/wiretap/acconfig.h @@ -1,6 +1,6 @@ /* acconfig.h * - * $Id: acconfig.h,v 1.6 2001/11/13 23:55:42 gram Exp $ + * $Id: acconfig.h,v 1.7 2002/04/08 01:34:39 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -24,3 +24,5 @@ #undef PACKAGE #undef VERSION + +#undef HAVE_LIBZ diff --git a/wiretap/acinclude.m4 b/wiretap/acinclude.m4 index d30874b19e..df4cd6a020 100644 --- a/wiretap/acinclude.m4 +++ b/wiretap/acinclude.m4 @@ -2,10 +2,29 @@ dnl Macros that test for specific features. dnl This file is part of the Autoconf packaging for Ethereal. dnl Copyright (C) 1998-2000 by Gerald Combs. dnl -dnl $Id: acinclude.m4,v 1.13 2002/02/06 09:58:30 guy Exp $ +dnl $Id: acinclude.m4,v 1.14 2002/04/08 01:34:39 guy Exp $ dnl # +# AC_WIRETAP_ADD_DASH_L +# +# Add to the variable specified as the first argument a "-L" flag for the +# directory specified as the second argument, and, on Solaris, add a +# "-R" flag for it as well. +# +# XXX - IRIX, and other OSes, may require some flag equivalent to +# "-R" here. +# +AC_DEFUN(AC_WIRETAP_ADD_DASH_L, +[$1="$$1 -L$2" +case "$host_os" in + solaris*) + $1="$$1 -R$2" + ;; +esac +]) + +# # AC_WIRETAP_PCAP_CHECK # AC_DEFUN(AC_WIRETAP_PCAP_CHECK, @@ -46,10 +65,10 @@ AC_DEFUN(AC_WIRETAP_PCAP_CHECK, # the include file search path. # # XXX - if there's also a libpcap in a directory that's - # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't - # make us find the version in the specified directory, - # as the compiler and/or linker will search that other - # directory before it searches the specified directory. + # already in CFLAGS or CPPFLAGS, this won't make us find + # the version in the specified directory, as the compiler + # will search that other directory before it searches the + # specified directory. # CFLAGS="$CFLAGS -I$pcap_dir/include" CPPFLAGS="$CPPFLAGS -I$pcap_dir/include" @@ -64,9 +83,63 @@ AC_DEFUN(AC_WIRETAP_PCAP_CHECK, # AC_DEFUN(AC_WIRETAP_ZLIB_CHECK, [ - AC_CHECK_HEADER(zlib.h,,enable_zlib=no) + if test "x$zlib_dir" != "x" + then + # + # The user specified a directory in which zlib resides, + # so add the "include" subdirectory of that directory to + # the include file search path and the "lib" subdirectory + # of that directory to the library search path. + # + # XXX - if there's also a zlib in a directory that's + # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't + # make us find the version in the specified directory, + # as the compiler and/or linker will search that other + # directory before it searches the specified directory. + # + wiretap_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I$zlib_dir/include" + wiretap_save_CPPLAGS="$CPPLAGS" + CPPFLAGS="$CPPFLAGS -I$zlib_dir/include" + wiretap_save_LIBS="$LIBS" + AC_WIRETAP_ADD_DASH_L(LIBS, $zlib_dir/lib) + fi + + # + # Make sure we have "zlib.h". If we don't, it means we probably + # don't have zlib, so don't use it. + # + AC_CHECK_HEADER(zlib.h,, + [ + if test "x$zlib_dir" != "x" + then + # + # The user used "--with-zlib=" to specify a directory + # containing zlib, but we didn't find the header file + # there; that either means they didn't specify the + # right directory or are confused about whether zlib + # is, in fact, installed. Report the error and give up. + # + AC_MSG_ERROR([zlib header not found in directory specified in --with-zlib]) + else + if test "x$want_zlib" = "xyes" + then + # + # The user tried to force us to use the library, but we + # couldn't find the header file; report an error. + # + AC_MSG_ERROR(Header file zlib.h not found.) + else + # + # We couldn't find the header file; don't use the + # library, as it's probably not present. + # + want_zlib=no + fi + fi + ]) - if test x$enable_zlib != xno + if test "x$want_zlib" != "xno" then # # Well, we at least have the zlib header file. @@ -92,6 +165,69 @@ AC_DEFUN(AC_WIRETAP_ZLIB_CHECK, # versions of zlib without "gzgets()" are likely to have # a broken "gzseek()". # - AC_CHECK_LIB(z, gzgets,,enable_zlib=no) + AC_CHECK_LIB(z, gzgets, + [ + if test "x$zlib_dir" != "x" + then + # + # Put the "-I" and "-L" flags for zlib at + # the beginning of CFLAGS, CPPFLAGS, and + # LIBS. + # + LIBS="" + AC_WIRETAP_ADD_DASH_L(LIBS, $zlib_dir/lib) + LIBS="$LIBS -lz $wiretap_save_LIBS" + else + LIBS="-lz $LIBS" + fi + AC_DEFINE(HAVE_LIBZ) + ],[ + if test "x$zlib_dir" != "x" + then + # + # Restore the versions of CFLAGS, CPPFLAGS, + # and LIBS before we added the "-with-zlib=" + # directory, as we didn't actually find + # zlib there, or didn't find a zlib that + # contains gzgets there. + # + CFLAGS="$wiretap_save_CFLAGS" + CPPFLAGS="$wiretap_save_CPPLAGS" + LIBS="$wiretap_save_LIBS" + fi + want_zlib=no + ]) + fi + + if test "x$want_zlib" != "xno" + then + # + # Well, we at least have the zlib header file and a zlib + # with "gzgets()". + # + # Now check for "gzgets()" in zlib when linking with the + # linker flags for GTK+ applications; people often grab + # XFree86 source and build and install it on their systems, + # and they appear sometimes to misconfigure XFree86 so that, + # even on systems with zlib, it assumes there is no zlib, + # so the XFree86 build process builds and installs its + # own zlib in the X11 library directory. + # + # The XFree86 zlib is an older version that lacks + # "gzgets()", and that's the zlib with which Ethereal + # gets linked, so the build of Ethereal fails. + # + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$GTK_LIBS -lz $LIBS" + AC_MSG_CHECKING([for gzgets missing when linking with X11]) + AC_TRY_LINK_FUNC(gzgets, AC_MSG_RESULT(no), + [ + AC_MSG_RESULT(yes) + AC_MSG_ERROR(old zlib found when linking with X11 - get rid of old zlib.) + ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" fi ]) diff --git a/wiretap/configure.in b/wiretap/configure.in index 86345a3154..f4928dfe36 100644 --- a/wiretap/configure.in +++ b/wiretap/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.37 2002/03/02 20:41:07 guy Exp $ +# $Id: configure.in,v 1.38 2002/04/08 01:34:39 guy Exp $ dnl dnl Process this file with autoconf 2.13 or later to produce a dnl configure script; 2.12 doesn't generate a "configure" script that @@ -165,16 +165,34 @@ AC_ARG_WITH(pcap, AC_WIRETAP_PCAP_CHECK dnl zlib check -AC_ARG_ENABLE(zlib, -[ --enable-zlib use zlib to read compressed data. [default=yes]],,enable_zlib=yes) - AC_MSG_CHECKING(whether to use zlib for reading compressed capture files) -if test "x$enable_zlib" = "xno" ; then - AC_MSG_RESULT(no) + +AC_ARG_WITH(zlib, +[ --with-zlib[=DIR] use zlib (located in directory DIR, if supplied) to read compressed data. [default=yes, if present]], +[ + if test $withval = no + then + want_zlib=no + elif test $withval = yes + then + want_zlib=yes + else + want_zlib=yes + zlib_dir=$withval + fi +],[ + # + # Use zlib if it's present, otherwise don't. + # + want_zlib=ifpresent + zlib_dir= +]) +if test "x$want_zlib" = "xno" ; then + AC_MSG_RESULT(no) else - AC_MSG_RESULT(yes) + AC_MSG_RESULT(yes) AC_WIRETAP_ZLIB_CHECK - if test "x$enable_zlib" = "xno" ; then + if test "x$want_zlib" = "xno" ; then AC_MSG_RESULT(zlib not found - disabling compressed capture file support) fi fi |