Ethereal-dev: [Ethereal-dev] --with-pcap and --with-zlib patches against 0.9.3
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Albert Chin <ethereal-dev@xxxxxxxxxxxxxxxxxx>
Date: Wed, 3 Apr 2002 01:32:26 -0600
Patches against 0.9.3 to specify the PCAP/ZLIB directory with --with-pcap and --with-zlib. -- albert chin (china@xxxxxxxxxxxxxxxxxx) -- snip snip --- wiretap/configure.in.orig Wed Apr 3 01:12:44 2002 +++ wiretap/configure.in Wed Apr 3 01:17:19 2002 @@ -165,18 +157,6 @@ 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) -else - AC_MSG_RESULT(yes) - AC_WIRETAP_ZLIB_CHECK - if test "x$enable_zlib" = "xno" ; then - AC_MSG_RESULT(zlib not found - disabling compressed capture file support) - fi -fi +AC_WIRETAP_ZLIB_CHECK AC_OUTPUT(Makefile) --- acinclude.m4.orig Wed Apr 3 01:11:59 2002 +++ acinclude.m4 Wed Apr 3 01:26:55 2002 @@ -255,68 +250,67 @@ # AC_DEFUN(AC_ETHEREAL_PCAP_CHECK, [ - if test -z "$pcap_dir" - then - # - # The user didn't specify a directory in which libpcap resides; - # we assume that the current library search path will work, - # but we may have to look for the header in a "pcap" - # subdirectory of "/usr/include" or "/usr/local/include", - # as some systems apparently put "pcap.h" in a "pcap" - # subdirectory, and we also check "$prefix/include". - # - # XXX - should we just add "$prefix/include" to the include - # search path and "$prefix/lib" to the library search path? - # - AC_MSG_CHECKING(for extraneous pcap header directories) - found_pcap_dir="" - for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include - do - if test -d $pcap_dir ; then - CFLAGS="$CFLAGS -I$pcap_dir" - CPPFLAGS="$CPPFLAGS -I$pcap_dir" - found_pcap_dir=" $found_pcap_dir -I$pcap_dir" - fi - done - - if test "$found_pcap_dir" != "" ; then - AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS) - else - AC_MSG_RESULT(not found) - fi - else - # - # The user specified a directory in which libpcap 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 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. - # - CFLAGS="$CFLAGS -I$pcap_dir/include" - CPPFLAGS="$CPPFLAGS -I$pcap_dir/include" - AC_ETHEREAL_ADD_DASH_L(LDFLAGS, $pcap_dir/lib) + AC_ARG_WITH(pcap, + [ --with-pcap[=DIR] use libpcap for packet capturing (and + search DIR for includes/libraries) [default=yes]],[ + case "${with_pcap}" in + no) + use_pcap=no + ;; + yes) + use_pcap=yes + ;; + *) + use_pcap=yes + if test -d "${with_pcap}"; then + CPPFLAGS="${CPPFLAGS} -I${with_pcap}/include" + LDFLAGS="${LDFLAGS} -L${with_pcap}/lib" + fi + ;; + esac + ],[ + use_pcap=yes + ]) + + # if --with-pcap not set to a path, search in pre-defined locations + if test "${with_pcap}" = "yes"; then + # Evidently, some systems have pcap.h, etc. in */include/pcap + AC_MSG_CHECKING(for extraneous pcap header directories) + found_pcap_dir="" + + for pcap_dir in /usr/include/pcap /usr/local/include/pcap \ + $prefix/include; do + if test -d $pcap_dir ; then + CPPFLAGS="$CPPFLAGS -I$pcap_dir" + found_pcap_dir=" $found_pcap_dir -I$pcap_dir" + break + fi + done + + if test "$found_pcap_dir" != "" ; then + AC_MSG_RESULT([$found_pcap_dir added to CPPFLAGS]) + else + AC_MSG_RESULT([not found]) + fi fi - # Pcap header checks - AC_CHECK_HEADER(net/bpf.h,, - AC_MSG_ERROR([[Header file net/bpf.h not found; if you installed libpcap from source, did you also do \"make install-incl\"?]])) - AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Header file pcap.h not found.)) - - # - # Check to see if we find "pcap_open_live" in "-lpcap". - # - AC_CHECK_LIB(pcap, pcap_open_live, - [ - PCAP_LIBS=-lpcap - AC_DEFINE(HAVE_LIBPCAP) - ], AC_MSG_ERROR(Library libpcap not found.), - $SOCKET_LIBS $NSL_LIBS) - AC_SUBST(PCAP_LIBS) + if test "${use_pcap}" = "yes"; then + # Pcap header checks + AC_CHECK_HEADER(net/bpf.h, , + AC_MSG_ERROR([[Header file net/bpf.h not found; if you installed libpcap from source, did you also do \"make install-incl\"?]])) + AC_CHECK_HEADER(pcap.h, , + AC_MSG_ERROR([Header file pcap.h not found])) + + # + # Check to see if we find "pcap_open_live" in "-lpcap". + # + AC_CHECK_LIB(pcap, pcap_open_live,[ + PCAP_LIBS=-lpcap + AC_DEFINE(HAVE_LIBPCAP)], + AC_MSG_ERROR([Library libpcap not found]), + $SOCKET_LIBS $NSL_LIBS) + AC_SUBST(PCAP_LIBS) + fi ]) # @@ -356,71 +350,41 @@ # AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK, [ - # - # 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) - - if test x$enable_zlib != xno - then - # - # Well, we at least have the zlib header file. - # - # Check for "gzgets()" in zlib, because we need it, but - # some older versions of zlib don't have it. It appears - # from the zlib ChangeLog that any released version of zlib - # with "gzgets()" should have the other routines we - # depend on, such as "gzseek()", "gztell()", and "zError()". - # - # Another reason why we require "gzgets()" is that - # some versions of zlib that didn't have it, such - # as 1.0.8, had a bug in "gzseek()" that meant that it - # doesn't work correctly on uncompressed files; this - # means we cannot use version 1.0.8. (Unfortunately, - # that's the version that comes with recent X11 source, - # and many people who install XFree86 on their Slackware - # boxes don't realize that they should configure it to - # use the native zlib rather than building and installing - # the crappy old version that comes with XFree86.) - # - # I.e., we can't just avoid using "gzgets()", as - # versions of zlib without "gzgets()" are likely to have - # a broken "gzseek()". - # - AC_CHECK_LIB(z, gzgets,,enable_zlib=no) - fi + _cppflags=${CPPFLAGS} + _ldflags=${LDFLAGS} - if test x$enable_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" + AC_ARG_WITH(zlib, + [ --with-zlib[=DIR] use zlib to read compressed data (and + search in DIR for includes/libraries) [default=yes]],[ + case "${with_zlib}" in + no) + use_zlib=no + ;; + yes) + use_zlib=yes + ;; + *) + use_zlib=yes + if test -d "$with_zlib"; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + ;; + esac + ],[ + use_zlib=yes + ]) + + if test "${use_zlib}" = "yes"; then + AC_CHECK_HEADER(zlib.h, + AC_CHECK_LIB(z, gzread, , use_zlib=no), + use_zlib=no) + + if test "${use_zlib}" = "no"; then + CPPFLAGS=${_cppflags} + LDFLAGS=${_ldflags} + AC_MSG_WARN([zlib not found -- disabling compressed capture file support]) + fi fi ]) --- wiretap/acinclude.m4.orig Wed Apr 3 01:12:41 2002 +++ wiretap/acindlude.m4 Wed Apr 3 01:27:09 2002 @@ -10,53 +10,56 @@ # AC_DEFUN(AC_WIRETAP_PCAP_CHECK, [ - if test -z "$pcap_dir" - then - # - # The user didn't specify a directory in which libpcap resides; - # we assume that the current library search path will work, - # but we may have to look for the header in a "pcap" - # subdirectory of "/usr/include" or "/usr/local/include", - # as some systems apparently put "pcap.h" in a "pcap" - # subdirectory, and we also check "$prefix/include". - # - # XXX - should we just add "$prefix/include" to the include - # search path? - # - AC_MSG_CHECKING(for extraneous pcap header directories) - found_pcap_dir="" - for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include - do - if test -d $pcap_dir ; then - CFLAGS="$CFLAGS -I$pcap_dir" - CPPFLAGS="$CPPFLAGS -I$pcap_dir" - found_pcap_dir=" $found_pcap_dir -I$pcap_dir" - fi - done - - if test "$found_pcap_dir" != "" ; then - AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS) - else - AC_MSG_RESULT(not found) - fi - else - # - # The user specified a directory in which libpcap resides, - # so add the "include" subdirectory of that directory to - # 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. - # - CFLAGS="$CFLAGS -I$pcap_dir/include" - CPPFLAGS="$CPPFLAGS -I$pcap_dir/include" + _cppflags=${CPPFLAGS} + + AC_ARG_WITH(pcap, + [ --with-pcap[=DIR] use libpcap for packet capturing (and + search DIR for includes) [default=yes]],[ + case "${with_pcap}" in + no) + use_pcap=no + ;; + yes) + use_pcap=yes + ;; + *) + use_pcap=yes + if test -d "$withval"; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + fi + ;; + esac + ],[ + use_pcap=yes + ]) + + # if --with-pcap not set to a path, search in pre-defined locations + if test "${with_pcap}" = "yes"; then + # Evidently, some systems have pcap.h, etc. in */include/pcap + AC_MSG_CHECKING(for extraneous pcap header directories) + found_pcap_dir="" + + for pcap_dir in /usr/include/pcap /usr/local/include/pcap \ + $prefix/include; do + if test -d $pcap_dir ; then + CPPFLAGS="$CPPFLAGS -I$pcap_dir" + found_pcap_dir=" $found_pcap_dir -I$pcap_dir" + break + fi + done + + if test "$found_pcap_dir" != "" ; then + AC_MSG_RESULT([$found_pcap_dir added to CPPFLAGS]) + else + AC_MSG_RESULT([not found]) + fi fi - # Pcap header check - AC_CHECK_HEADERS(pcap.h) + if test "${use_pcap}" = "yes"; then + # Pcap header checks + AC_CHECK_HEADERS(pcap.h, , + test -n "${_cppflags}" && CPPFLAGS=${_cppflags}) + fi ]) # @@ -64,34 +67,40 @@ # AC_DEFUN(AC_WIRETAP_ZLIB_CHECK, [ - AC_CHECK_HEADER(zlib.h,,enable_zlib=no) + _cppflags=${CPPFLAGS} + _ldflags=${LDFLAGS} + + AC_ARG_WITH(zlib, + [ --with-zlib[=DIR] use zlib to read compressed data (and + search in DIR for includes/libraries) [default=yes]],[ + case "${with_zlib}" in + no) + use_zlib=no + ;; + yes) + use_zlib=yes + ;; + *) + use_zlib=yes + if test -d "$with_zlib"; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + ;; + esac + ],[ + use_zlib=yes + ]) + + if test "${use_zlib}" = "yes"; then + AC_CHECK_HEADER(zlib.h, + AC_CHECK_LIB(z, gzread, , use_zlib=no), + use_zlib=no) - if test x$enable_zlib != xno - then - # - # Well, we at least have the zlib header file. - # - # Check for "gzgets()" in zlib, because we need it, but - # some older versions of zlib don't have it. It appears - # from the zlib ChangeLog that any released version of zlib - # with "gzgets()" should have the other routines we - # depend on, such as "gzseek()", "gztell()", and "zError()". - # - # Another reason why we require "gzgets()" is that - # some versions of zlib that didn't have it, such - # as 1.0.8, had a bug in "gzseek()" that meant that it - # doesn't work correctly on uncompressed files; this - # means we cannot use version 1.0.8. (Unfortunately, - # that's the version that comes with recent X11 source, - # and many people who install XFree86 on their Slackware - # boxes don't realize that they should configure it to - # use the native zlib rather than building and installing - # the crappy old version that comes with XFree86.) - # - # I.e., we can't just avoid using "gzgets()", as - # versions of zlib without "gzgets()" are likely to have - # a broken "gzseek()". - # - AC_CHECK_LIB(z, gzgets,,enable_zlib=no) + if test "${use_zlib}" = "no"; then + CPPFLAGS=${_cppflags} + LDFLAGS=${_ldflags} + AC_MSG_WARN([zlib not found -- disabling compressed capture file support]) + fi fi ])
- Follow-Ups:
- Re: [Ethereal-dev] --with-pcap and --with-zlib patches against 0.9.3
- From: Guy Harris
- Re: [Ethereal-dev] --with-pcap and --with-zlib patches against 0.9.3
- Prev by Date: Re: [Ethereal-dev] dns-over-tcp reassembly problems
- Next by Date: Re: [Ethereal-dev] --with-pcap and --with-zlib patches against 0.9.3
- Previous by thread: Re: [Ethereal-dev] dns-over-tcp reassembly problems
- Next by thread: Re: [Ethereal-dev] --with-pcap and --with-zlib patches against 0.9.3
- Index(es):