Use "version.h" if autoconf is being used (as that assumes a
UN*Xy-enough platform that the Makefile.in rules to generate "version.h" work), and use the stuff from "version.h" iff HAVE_VERSION_H is defined, so we can use it even with WinPcap.
This commit is contained in:
parent
14eb2792bd
commit
529f98f94f
|
@ -100,6 +100,9 @@
|
|||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* define if version.h is generated in the build procedure */
|
||||
#undef HAVE_VERSION_H
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
# From configure.in Revision: 1.109 .
|
||||
# From configure.in Revision: 1.110 .
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.57.
|
||||
#
|
||||
|
@ -5487,6 +5487,16 @@ _ACEOF
|
|||
|
||||
fi
|
||||
|
||||
#
|
||||
# Makefile.in includes rules to generate version.h, so we assume
|
||||
# that it will be generated if autoconf is used.
|
||||
#
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_VERSION_H 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
rm -f net
|
||||
ln -s ${srcdir}/bpf/net net
|
||||
|
||||
|
|
10
configure.in
10
configure.in
|
@ -1,4 +1,4 @@
|
|||
dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.109 2004-12-16 22:22:20 guy Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.110 2004-12-17 23:25:36 guy Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1994, 1995, 1996, 1997
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
|
@ -6,7 +6,7 @@ dnl
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_REVISION($Revision: 1.109 $)
|
||||
AC_REVISION($Revision: 1.110 $)
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(pcap.c)
|
||||
|
||||
|
@ -570,6 +570,12 @@ AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
|
|||
|
||||
AC_LBL_UNALIGNED_ACCESS
|
||||
|
||||
#
|
||||
# Makefile.in includes rules to generate version.h, so we assume
|
||||
# that it will be generated if autoconf is used.
|
||||
#
|
||||
AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
|
||||
|
||||
rm -f net
|
||||
ln -s ${srcdir}/bpf/net net
|
||||
|
||||
|
|
47
pcap.c
47
pcap.c
|
@ -33,7 +33,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.78 2004-12-17 20:41:59 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.79 2004-12-17 23:25:36 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -766,6 +766,12 @@ pcap_close(pcap_t *p)
|
|||
* was linked, or even weirder things, such as the string being the one
|
||||
* from the library but being truncated).
|
||||
*/
|
||||
#ifdef HAVE_VERSION_H
|
||||
#include "version.h"
|
||||
#else
|
||||
static const char pcap_version_string[] = "libpcap version 0.9[.x]";
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* XXX - it'd be nice if we could somehow generate the WinPcap and libpcap
|
||||
|
@ -774,18 +780,18 @@ pcap_close(pcap_t *p)
|
|||
*/
|
||||
static const char wpcap_version_string[] = "3.0";
|
||||
static const char pcap_version_string_fmt[] =
|
||||
"WinPcap version %s, based on libpcap version 0.8";
|
||||
"WinPcap version %s, based on %s";
|
||||
static const char pcap_version_string_packet_dll_fmt[] =
|
||||
"WinPcap version %s (packet.dll version %s), based on libpcap version 0.8";
|
||||
static char *pcap_version_string;
|
||||
"WinPcap version %s (packet.dll version %s), based on %s";
|
||||
static char *full_pcap_version_string;
|
||||
|
||||
const char *
|
||||
pcap_lib_version(void)
|
||||
{
|
||||
char *packet_version_string;
|
||||
size_t pcap_version_string_len;
|
||||
size_t full_pcap_version_string_len;
|
||||
|
||||
if (pcap_version_string == NULL) {
|
||||
if (full_pcap_version_string == NULL) {
|
||||
/*
|
||||
* Generate the version string.
|
||||
*/
|
||||
|
@ -796,12 +802,15 @@ pcap_lib_version(void)
|
|||
* string are the same; just report the WinPcap
|
||||
* version.
|
||||
*/
|
||||
pcap_version_string_len =
|
||||
(sizeof pcap_version_string_fmt - 2) +
|
||||
strlen(wpcap_version_string);
|
||||
pcap_version_string = malloc(pcap_version_string_len);
|
||||
sprintf(pcap_version_string, pcap_version_string_fmt,
|
||||
wpcap_version_string);
|
||||
full_pcap_version_string_len =
|
||||
(sizeof pcap_version_string_fmt - 4) +
|
||||
strlen(wpcap_version_string) +
|
||||
strlen(pcap_version_string);
|
||||
full_pcap_version_string =
|
||||
malloc(full_pcap_version_string_len);
|
||||
sprintf(full_pcap_version_string,
|
||||
pcap_version_string_fmt, wpcap_version_string,
|
||||
pcap_version_string);
|
||||
} else {
|
||||
/*
|
||||
* WinPcap version string and packet.dll version
|
||||
|
@ -811,20 +820,20 @@ pcap_lib_version(void)
|
|||
* versions.
|
||||
*/
|
||||
pcap_version_string_len =
|
||||
(sizeof pcap_version_string_packet_dll_fmt - 4) +
|
||||
(sizeof pcap_version_string_packet_dll_fmt - 6) +
|
||||
strlen(wpcap_version_string) +
|
||||
strlen(packet_version_string);
|
||||
strlen(packet_version_string) +
|
||||
strlen(pcap_version_string);
|
||||
pcap_version_string = malloc(pcap_version_string_len);
|
||||
sprintf(pcap_version_string,
|
||||
sprintf(full_pcap_version_string,
|
||||
pcap_version_string_packet_dll_fmt,
|
||||
wpcap_version_string, packet_version_string);
|
||||
wpcap_version_string, packet_version_string,
|
||||
pcap_version_string);
|
||||
}
|
||||
}
|
||||
return (pcap_version_string);
|
||||
return (full_pcap_version_string);
|
||||
}
|
||||
#else
|
||||
#include "version.h"
|
||||
|
||||
const char *
|
||||
pcap_lib_version(void)
|
||||
{
|
||||
|
|
Reference in New Issue