Fix AC_ETHEREAL_PCAP_CHECK so that, if a directory was specified with

"--with-pcap", it adds the "include" subdirectory of that directory to
the list of directories to search for include files, rather than adding
the directory itself.

Check whether libpcap defines "pcap_version", and define
HAVE_PCAP_VERSION if it does.  Use "pcap_version" iff HAVE_PCAP_VERSION
is defined, rather than special-casing MacOS X.

Don't #define a string for the WinPcap version; just leave
HAVE_PCAP_VERSION undefined on Windows, as WinPcap 2.2beta is out, so we
can no longer assume that the Windows version of Ethereal is using
WinPcap 2.1.

svn path=/trunk/; revision=3792
This commit is contained in:
Guy Harris 2001-07-27 07:10:13 +00:00
parent 8a9917a9a7
commit 5bb08b0970
7 changed files with 70 additions and 40 deletions

View File

@ -1,12 +1,11 @@
/* acconfig.h
* #ifdefs to be controlled by "configure"
*
* $Id: acconfig.h,v 1.19 2001/06/02 06:21:13 guy Exp $
* $Id: acconfig.h,v 1.20 2001/07/27 07:10:09 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* By Gerald Combs <gerald@ethereal.org>
* Copyright 1998 Gerald Combs
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -41,4 +40,6 @@
#undef HAVE_LIBPCAP
#undef HAVE_PCAP_VERSION
#undef PLUGIN_DIR

View File

@ -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.28 2001/07/09 23:42:39 guy Exp $
dnl $Id: acinclude.m4,v 1.29 2001/07/27 07:10:09 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
@ -284,8 +284,9 @@ AC_DEFUN(AC_ETHEREAL_PCAP_CHECK,
else
#
# The user specified a directory in which libpcap resides,
# so add that directory to the include file and library
# search path.
# 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
@ -293,8 +294,8 @@ AC_DEFUN(AC_ETHEREAL_PCAP_CHECK,
# as the compiler and/or linker will search that other
# directory before it searches the specified directory.
#
CFLAGS="$CFLAGS -I$pcap_dir"
CPPFLAGS="$CPPFLAGS -I$pcap_dir"
CFLAGS="$CFLAGS -I$pcap_dir/include"
CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
AC_ETHEREAL_ADD_DASH_L(LDFLAGS, $pcap_dir/lib)
fi
@ -315,6 +316,38 @@ AC_DEFUN(AC_ETHEREAL_PCAP_CHECK,
AC_SUBST(PCAP_LIBS)
])
#
# AC_ETHEREAL_PCAP_VERSION_CHECK
#
# Check whether "pcap_version" is defined by libpcap.
#
AC_DEFUN(AC_ETHEREAL_PCAP_VERSION_CHECK,
[
AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
ac_save_LIBS="$LIBS"
LIBS="$PCAP_LIBS $LIBS"
AC_TRY_LINK([],
[
char *
return_pcap_version(void)
{
extern char pcap_version[];
return pcap_version;
}
],
ac_cv_pcap_version_defined=yes,
ac_cv_pcap_version_defined=no,
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
LIBS="$ac_save_LIBS"
if test "$ac_cv_pcap_version_defined" = yes ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PCAP_VERSION)
else
AC_MSG_RESULT(no)
fi
])
#
# AC_ETHEREAL_ZLIB_CHECK
#

View File

@ -1,4 +1,4 @@
/* $Id: config.h.win32,v 1.29 2001/06/02 08:07:47 guy Exp $ */
/* $Id: config.h.win32,v 1.30 2001/07/27 07:10:09 guy Exp $ */
/* config.h.win32 Generated manually. :-) */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
@ -44,7 +44,6 @@
#define NEED_MKSTEMP 1
#define HAVE_LIBPCAP 1
#define WPCAP_STRING "0.5.2 (WinPcap 2.1)"
/* Define if you have the gethostbyname2 function. */
/* #undef HAVE_GETHOSTBYNAME2 */

View File

@ -1,4 +1,4 @@
# $Id: configure.in,v 1.136 2001/07/27 06:10:26 guy Exp $
# $Id: configure.in,v 1.137 2001/07/27 07:10:09 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
@ -375,6 +375,7 @@ if test "x$want_pcap" = "xno" ; then
else
AC_MSG_RESULT(yes)
AC_ETHEREAL_PCAP_CHECK
AC_ETHEREAL_PCAP_VERSION_CHECK
fi
dnl zlib check

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.204 2001/07/26 07:25:48 guy Exp $
* $Id: main.c,v 1.205 2001/07/27 07:10:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -834,18 +834,11 @@ main(int argc, char *argv[])
int opt;
extern char *optarg;
gboolean arg_error = FALSE;
#ifdef HAVE_LIBPCAP
#ifdef WIN32
char pcap_version[] = WPCAP_STRING;
#else
#ifdef __APPLE__
char pcap_version[] = "Unknown";
#else
#ifdef HAVE_PCAP_VERSION
extern char pcap_version[];
#endif
#endif
#endif
#endif /* HAVE_PCAP_VERSION */
#endif /* HAVE_LIBPCAP */
#ifdef WIN32
WSADATA wsaData;
@ -1004,10 +997,14 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
g_string_append(comp_info_str, ", with libpcap ");
#ifdef HAVE_PCAP_VERSION
g_string_append(comp_info_str, pcap_version);
#else
#else /* HAVE_PCAP_VERSION */
g_string_append(comp_info_str, "(version unknown)");
#endif /* HAVE_PCAP_VERSION */
#else /* HAVE_LIBPCAP */
g_string_append(comp_info_str, ", without libpcap");
#endif
#endif /* HAVE_LIBPCAP */
#ifdef HAVE_LIBZ
g_string_append(comp_info_str, ", with libz ");

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.89 2001/07/26 07:25:44 guy Exp $
* $Id: tethereal.c,v 1.90 2001/07/27 07:10:09 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -205,16 +205,10 @@ main(int argc, char *argv[])
extern char *optarg;
gboolean arg_error = FALSE;
#ifdef HAVE_LIBPCAP
#ifdef WIN32
char pcap_version[] = WPCAP_STRING;
#else
#ifdef __APPLE__
char pcap_version[] = "Unknown";
#else
#ifdef HAVE_PCAP_VERSION
extern char pcap_version[];
#endif
#endif
#endif
#endif /* HAVE_PCAP_VERSION */
#endif /* HAVE_LIBPCAP */
#ifdef WIN32
WSADATA wsaData;
@ -309,10 +303,14 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
g_string_append(comp_info_str, ", with libpcap ");
#ifdef HAVE_PCAP_VERSION
g_string_append(comp_info_str, pcap_version);
#else
#else /* HAVE_PCAP_VERSION */
g_string_append(comp_info_str, "(version unknown)");
#endif /* HAVE_PCAP_VERSION */
#else /* HAVE_LIBPCAP */
g_string_append(comp_info_str, ", without libpcap");
#endif
#endif /* HAVE_LIBPCAP */
#ifdef HAVE_LIBZ
g_string_append(comp_info_str, ", with libz ");

View File

@ -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.8 2001/06/27 07:47:49 guy Exp $
dnl $Id: acinclude.m4,v 1.9 2001/07/27 07:10:13 guy Exp $
dnl
# Configure paths for GLIB
@ -239,7 +239,8 @@ AC_DEFUN(AC_WIRETAP_PCAP_CHECK,
else
#
# The user specified a directory in which libpcap resides,
# so add that directory to the search path.
# 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
@ -247,8 +248,8 @@ AC_DEFUN(AC_WIRETAP_PCAP_CHECK,
# as the compiler and/or linker will search that other
# directory before it searches the specified directory.
#
CFLAGS="$CFLAGS -I$pcap_dir"
CPPFLAGS="$CPPFLAGS -I$pcap_dir"
CFLAGS="$CFLAGS -I$pcap_dir/include"
CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
fi
# Pcap header check