Add detection of rpcap support in libpcap and use it if available.

svn path=/trunk/; revision=37914
This commit is contained in:
Jörg Mayer 2011-07-06 09:28:40 +00:00
parent 48683778a0
commit 950e4d19ad
2 changed files with 22 additions and 10 deletions

View File

@ -40,16 +40,16 @@
# Find the PCAP includes and library
# http://www.tcpdump.org/
#
# The environment variable PCAPDIR allows to specficy where to find
# The environment variable PCAPDIR allows to specficy where to find
# libpcap in non standard location.
#
#
# PCAP_INCLUDE_DIRS - where to find pcap.h, etc.
# PCAP_LIBRARIES - List of libraries when using pcap.
# PCAP_FOUND - True if pcap found.
IF(EXISTS $ENV{PCAPDIR})
FIND_PATH(PCAP_INCLUDE_DIR
FIND_PATH(PCAP_INCLUDE_DIR
NAMES
pcap/pcap.h
pcap.h
@ -57,28 +57,28 @@ IF(EXISTS $ENV{PCAPDIR})
$ENV{PCAPDIR}
NO_DEFAULT_PATH
)
FIND_LIBRARY(PCAP_LIBRARY
NAMES
NAMES
pcap
PATHS
$ENV{PCAPDIR}
NO_DEFAULT_PATH
)
ELSE(EXISTS $ENV{PCAPDIR})
FIND_PATH(PCAP_INCLUDE_DIR
FIND_PATH(PCAP_INCLUDE_DIR
NAMES
pcap/pcap.h
pcap.h
)
FIND_LIBRARY(PCAP_LIBRARY
NAMES
NAMES
pcap
)
ENDIF(EXISTS $ENV{PCAPDIR})
SET(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR})
@ -120,6 +120,14 @@ CHECK_FUNCTION_EXISTS("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
CHECK_FUNCTION_EXISTS("pcap_lib_version" HAVE_PCAP_LIB_VERSION)
CHECK_FUNCTION_EXISTS("pcap_get_selectable_fd" HAVE_PCAP_GET_SELECTABLE_FD)
CHECK_FUNCTION_EXISTS("pcap_free_datalinks" HAVE_PCAP_FREE_DATALINKS)
# Remote pcap checks
CHECK_FUNCTION_EXISTS("pcap_open" H_PCAP_OPEN)
CHECK_FUNCTION_EXISTS("pcap_findalldevs_ex" H_FINDALLDEVS_EX)
CHECK_FUNCTION_EXISTS("pcap_createsrcstr" H_CREATESRCSTR)
if(H_PCAP_OPEN AND H_FINDALLDEVS_EX AND H_CREATESRCSTR)
SET(HAVE_PCAP_REMOTE 1)
SET(HAVE_REMOTE 1)
endif()
# reset vars
SET(CMAKE_REQUIRED_INCLUDES "")
SET(CMAKE_REQUIRED_LIBRARIES "")

View File

@ -227,6 +227,10 @@
/* Define if plugins are enabled */
#cmakedefine HAVE_PLUGINS 1
/* Define if rpcap:// type remote capture is supported */
#cmakedefine HAVE_PCAP_REMOTE 1
#cmakedefine HAVE_REMOTE 1
/* Define to 1 if you have the <portaudio.h> header file. */
#cmakedefine HAVE_PORTAUDIO_H 1