Date: Fri, 18 May 2018 12:21:20 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r333789 - in vendor/libpcap/dist: . SUNOS4 Win32/Include Win32/Prj bpf cmake cmake/Modules config missing msdos pcap tests Message-ID: <201805181221.w4ICLKfl034045@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri May 18 12:21:19 2018 New Revision: 333789 URL: https://svnweb.freebsd.org/changeset/base/333789 Log: Import vendor revision 77da77c36e5d958f9b8d6729876a33f670de031f from: https://github.com/the-tcpdump-group/libpcap.git This among other minor fixes adds support for sniffing RDMA devices. Sponsored by: Mellanox Technologies Added: vendor/libpcap/dist/CONTRIBUTING vendor/libpcap/dist/README.macos vendor/libpcap/dist/bpf_filter.c (contents, props changed) vendor/libpcap/dist/cmake/Modules/ vendor/libpcap/dist/cmake/Modules/FindDAG.cmake vendor/libpcap/dist/cmake/Modules/FindFseeko.cmake vendor/libpcap/dist/cmake/Modules/FindLFS.cmake vendor/libpcap/dist/cmake/Modules/FindPacket.cmake vendor/libpcap/dist/cmake/Modules/FindPthreads-w32.cmake vendor/libpcap/dist/cmake/Modules/FindSNF.cmake vendor/libpcap/dist/cmake/Modules/FindTC.cmake vendor/libpcap/dist/cmake/have_siocglifconf.c (contents, props changed) vendor/libpcap/dist/cmake_uninstall.cmake.in (contents, props changed) vendor/libpcap/dist/diag-control.h (contents, props changed) vendor/libpcap/dist/fmtutils.c (contents, props changed) vendor/libpcap/dist/fmtutils.h (contents, props changed) vendor/libpcap/dist/ftmacros.h (contents, props changed) vendor/libpcap/dist/libpcap.pc.in (contents, props changed) vendor/libpcap/dist/nomkdep vendor/libpcap/dist/optimize.h (contents, props changed) vendor/libpcap/dist/pcap-dll.rc vendor/libpcap/dist/pcap-netmap.c (contents, props changed) vendor/libpcap/dist/pcap-netmap.h (contents, props changed) vendor/libpcap/dist/pcap-npf.c (contents, props changed) vendor/libpcap/dist/pcap-rdmasniff.c (contents, props changed) vendor/libpcap/dist/pcap-rdmasniff.h (contents, props changed) vendor/libpcap/dist/pcap-rpcap-int.h (contents, props changed) vendor/libpcap/dist/pcap-types.h (contents, props changed) vendor/libpcap/dist/pcap/compiler-tests.h (contents, props changed) vendor/libpcap/dist/pcap/funcattrs.h (contents, props changed) vendor/libpcap/dist/pcap/pcap-inttypes.h (contents, props changed) vendor/libpcap/dist/pcap_get_required_select_timeout.3pcap vendor/libpcap/dist/pcap_set_protocol.3pcap vendor/libpcap/dist/rpcap-protocol.c (contents, props changed) vendor/libpcap/dist/rpcap-protocol.h (contents, props changed) vendor/libpcap/dist/sf-pcapng.c (contents, props changed) vendor/libpcap/dist/sf-pcapng.h (contents, props changed) vendor/libpcap/dist/tests/shb-option-too-long.pcapng (contents, props changed) vendor/libpcap/dist/varattrs.h (contents, props changed) Deleted: vendor/libpcap/dist/GenVersion.bat vendor/libpcap/dist/README.macosx vendor/libpcap/dist/SUNOS4/ vendor/libpcap/dist/Win32/Include/ vendor/libpcap/dist/bpf/ vendor/libpcap/dist/cmake/preconfigure.cmake vendor/libpcap/dist/config/ vendor/libpcap/dist/fad-helpers.c vendor/libpcap/dist/gen_version_c.sh vendor/libpcap/dist/gen_version_header.sh vendor/libpcap/dist/inet.c vendor/libpcap/dist/msdos/common.dj vendor/libpcap/dist/msdos/ndis2.c vendor/libpcap/dist/msdos/ndis2.h vendor/libpcap/dist/msdos/ndis_0.asm vendor/libpcap/dist/pcap-stdinc.h vendor/libpcap/dist/pcap-win32.c vendor/libpcap/dist/pcap/export-defs.h vendor/libpcap/dist/pcap_version.h.in vendor/libpcap/dist/remote-ext.h vendor/libpcap/dist/sf-pcap-ng.c vendor/libpcap/dist/sf-pcap-ng.h vendor/libpcap/dist/tests/CMakeLists.txt vendor/libpcap/dist/tests/can_set_rfmon_test.c vendor/libpcap/dist/tests/capturetest.c vendor/libpcap/dist/tests/filtertest.c vendor/libpcap/dist/tests/findalldevstest.c vendor/libpcap/dist/tests/opentest.c vendor/libpcap/dist/tests/reactivatetest.c vendor/libpcap/dist/tests/selpolltest.c vendor/libpcap/dist/tests/valgrindtest.c Modified: vendor/libpcap/dist/CHANGES vendor/libpcap/dist/CMakeLists.txt vendor/libpcap/dist/CREDITS vendor/libpcap/dist/INSTALL.txt vendor/libpcap/dist/Makefile.in vendor/libpcap/dist/README vendor/libpcap/dist/README.septel vendor/libpcap/dist/README.sita vendor/libpcap/dist/VERSION vendor/libpcap/dist/Win32/Prj/wpcap.vcxproj vendor/libpcap/dist/Win32/Prj/wpcap.vcxproj.filters vendor/libpcap/dist/aclocal.m4 vendor/libpcap/dist/bpf_dump.c vendor/libpcap/dist/bpf_image.c vendor/libpcap/dist/chmod_bpf vendor/libpcap/dist/cmakeconfig.h.in vendor/libpcap/dist/config.h.in vendor/libpcap/dist/configure vendor/libpcap/dist/configure.ac vendor/libpcap/dist/dlpisubs.c vendor/libpcap/dist/etherent.c vendor/libpcap/dist/extract.h vendor/libpcap/dist/fad-getad.c vendor/libpcap/dist/fad-gifc.c vendor/libpcap/dist/fad-glifc.c vendor/libpcap/dist/gencode.c vendor/libpcap/dist/gencode.h vendor/libpcap/dist/grammar.y vendor/libpcap/dist/missing/getopt.c vendor/libpcap/dist/missing/getopt.h vendor/libpcap/dist/missing/strtok_r.c vendor/libpcap/dist/msdos/makefile vendor/libpcap/dist/msdos/makefile.dj vendor/libpcap/dist/msdos/makefile.wc vendor/libpcap/dist/nametoaddr.c vendor/libpcap/dist/optimize.c vendor/libpcap/dist/pcap-bpf.c vendor/libpcap/dist/pcap-bt-linux.c vendor/libpcap/dist/pcap-bt-linux.h vendor/libpcap/dist/pcap-bt-monitor-linux.c vendor/libpcap/dist/pcap-bt-monitor-linux.h vendor/libpcap/dist/pcap-common.c vendor/libpcap/dist/pcap-common.h vendor/libpcap/dist/pcap-config.in vendor/libpcap/dist/pcap-dag.c vendor/libpcap/dist/pcap-dag.h vendor/libpcap/dist/pcap-dbus.c vendor/libpcap/dist/pcap-dbus.h vendor/libpcap/dist/pcap-dlpi.c vendor/libpcap/dist/pcap-dos.c vendor/libpcap/dist/pcap-enet.c vendor/libpcap/dist/pcap-filter.manmisc.in vendor/libpcap/dist/pcap-int.h vendor/libpcap/dist/pcap-libdlpi.c vendor/libpcap/dist/pcap-linux.c vendor/libpcap/dist/pcap-netfilter-linux.c vendor/libpcap/dist/pcap-netfilter-linux.h vendor/libpcap/dist/pcap-new.c vendor/libpcap/dist/pcap-nit.c vendor/libpcap/dist/pcap-null.c vendor/libpcap/dist/pcap-pf.c vendor/libpcap/dist/pcap-rpcap.c vendor/libpcap/dist/pcap-rpcap.h vendor/libpcap/dist/pcap-septel.c vendor/libpcap/dist/pcap-septel.h vendor/libpcap/dist/pcap-sita.c vendor/libpcap/dist/pcap-snf.c vendor/libpcap/dist/pcap-snf.h vendor/libpcap/dist/pcap-snit.c vendor/libpcap/dist/pcap-snoop.c vendor/libpcap/dist/pcap-tc.c vendor/libpcap/dist/pcap-tc.h vendor/libpcap/dist/pcap-tstamp.manmisc.in vendor/libpcap/dist/pcap-usb-linux.c vendor/libpcap/dist/pcap-usb-linux.h vendor/libpcap/dist/pcap.3pcap.in vendor/libpcap/dist/pcap.c vendor/libpcap/dist/pcap/bluetooth.h vendor/libpcap/dist/pcap/bpf.h vendor/libpcap/dist/pcap/can_socketcan.h vendor/libpcap/dist/pcap/dlt.h vendor/libpcap/dist/pcap/namedb.h vendor/libpcap/dist/pcap/nflog.h vendor/libpcap/dist/pcap/pcap.h vendor/libpcap/dist/pcap/sll.h vendor/libpcap/dist/pcap/usb.h vendor/libpcap/dist/pcap/vlan.h vendor/libpcap/dist/pcap_breakloop.3pcap vendor/libpcap/dist/pcap_compile.3pcap.in vendor/libpcap/dist/pcap_dump_ftell.3pcap vendor/libpcap/dist/pcap_dump_open.3pcap.in vendor/libpcap/dist/pcap_fileno.3pcap vendor/libpcap/dist/pcap_findalldevs.3pcap vendor/libpcap/dist/pcap_get_selectable_fd.3pcap vendor/libpcap/dist/pcap_lookupdev.3pcap vendor/libpcap/dist/pcap_loop.3pcap vendor/libpcap/dist/pcap_major_version.3pcap vendor/libpcap/dist/pcap_next_ex.3pcap vendor/libpcap/dist/pcap_open_dead.3pcap.in vendor/libpcap/dist/pcap_open_live.3pcap vendor/libpcap/dist/pcap_open_offline.3pcap.in vendor/libpcap/dist/pcap_set_timeout.3pcap vendor/libpcap/dist/pcap_set_tstamp_type.3pcap.in vendor/libpcap/dist/portability.h vendor/libpcap/dist/savefile.c vendor/libpcap/dist/scanner.l vendor/libpcap/dist/sf-pcap.c vendor/libpcap/dist/sockutils.c vendor/libpcap/dist/sockutils.h Modified: vendor/libpcap/dist/CHANGES ============================================================================== --- vendor/libpcap/dist/CHANGES Fri May 18 12:13:44 2018 (r333788) +++ vendor/libpcap/dist/CHANGES Fri May 18 12:21:19 2018 (r333789) @@ -1,3 +1,30 @@ +Wednesday, Jan. 25, 2017 guy@alum.mit.edu + Summary for 1.9.0 libpcap release + Man page improvements + Fix Linux cooked mode userspace filtering (GitHub pull request #429) + Fix compilation if IPv6 support not enabled + Fix some Linux memory-mapped capture buffer size issues + Don't fail if kernel filter can't be set on Linux (GitHub issue + #549) + Improve sorting of interfaces for pcap_findalldevs() + Don't list Linux usbmon devices if usbmon module isn't loaded + Report PCAP_ERROR_PERM_DENIED if no permission to open Linux usbmon + devices + Fix DLT_ type for Solaris IPNET devices + Always return an error message for errors finding DAG or Myricom + devices + If possible, don't require that a device be openable when + enumerating them for pcap_findalldevs() + Don't put incompletely-initialized addresses in the address list for + When finding Myricom devices, update description for regular + interfaces that are Myricom devices and handle SNF_FLAGS=0x2(port + aggregation enabled) + Fix compilation error in DAG support + Fix issues with CMake configuration + Add support for stream buffers larger than 2GB on newer DAG cards + Remove support for building against DAG versions without STREAMS + support (before dag-3.0.0 2007) + Tuesday, Oct. 25, 2016 mcr@sandelman.ca Summary for 1.8.1 libpcap release Add a target in Makefile.in for Exuberant Ctags use: 'extags'. Modified: vendor/libpcap/dist/CMakeLists.txt ============================================================================== --- vendor/libpcap/dist/CMakeLists.txt Fri May 18 12:13:44 2018 (r333788) +++ vendor/libpcap/dist/CMakeLists.txt Fri May 18 12:21:19 2018 (r333789) @@ -1,272 +1,1186 @@ -cmake_minimum_required( VERSION 2.8.8 ) +cmake_minimum_required(VERSION 2.8.6) -project( pcap ) # -# Call the library "wpcap" on Windows, for backwards compatibility. +# Apple doesn't build with an install_name starting with @rpath, and +# neither do we with autotools; don't do so with CMake, either, and +# suppress warnings about that. # -if( WIN32 ) - set( LIBRARY_NAME wpcap ) -else() - set( LIBRARY_NAME pcap ) +if(POLICY CMP0042) + cmake_policy(SET CMP0042 OLD) endif() +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + +project(pcap) + +# +# Try to enable as many C99 features as we can. +# At minimum, we want C++/C99-style // comments. +# +# Newer versions of compilers might default to supporting C99, but older +# versions may require a special flag. +# +# Prior to CMake 3.1, setting CMAKE_C_STANDARD will not have any effect, +# so, unless and until we require CMake 3.1 or later, we have to do it +# ourselves on pre-3.1 CMake, so we just do it ourselves on all versions +# of CMake. +# +# Note: with CMake 3.1 through 3.5, the only compilers for which CMake +# handles CMAKE_C_STANDARD are GCC and Clang. 3.6 adds support only +# for Intel C; 3.9 adds support for PGI C, Sun C, and IBM XL C, and +# 3.10 adds support for Cray C and IAR C, but no version of CMake has +# support for HP C. Therefore, even if we use CMAKE_C_STANDARD with +# compilers for which CMake supports it, we may still have to do it +# ourselves on other compilers. +# +# See the CMake documentation for the CMAKE_<LANG>_COMPILER_ID variables +# for a list of compiler IDs. +# +# We don't worry about MSVC; it doesn't have such a flag - either it +# doesn't support the C99 features we need at all, or it supports them +# regardless of the compiler flag. +# +# XXX - this just tests whether the option works and adds it if it does. +# We don't test whether it's necessary in order to get the C99 features +# that we use; if we ever have a user who tries to compile with a compiler +# that can't be made to support those features, we can add a test to make +# sure we actually *have* C99 support. +# +include(CheckCCompilerFlag) +macro(check_and_add_compiler_option _option) + message(STATUS "Checking C compiler flag ${_option}") + string(REPLACE "=" "-" _temp_option_variable ${_option}) + string(REGEX REPLACE "^-" "" _option_variable ${_temp_option_variable}) + check_c_compiler_flag("${_option}" ${_option_variable}) + if(${${_option_variable}}) + set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} ${_option}") + endif() +endmacro() + +set(C_ADDITIONAL_FLAGS "") +if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR + CMAKE_C_COMPILER_ID MATCHES "Clang") + check_and_add_compiler_option("-std=gnu99") +elseif(CMAKE_C_COMPILER_ID MATCHES "XL") + # + # We want support for extensions picked up for GNU C compatibility, + # so we use -qlanglvl=extc99. + # + check_and_add_compiler_option("-qlanglvl=extc99") +elseif(CMAKE_C_COMPILER_ID MATCHES "HP") + check_and_add_compiler_option("-AC99") +elseif(CMAKE_C_COMPILER_ID MATCHES "Sun") + check_and_add_compiler_option("-xc99") +elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") + check_and_add_compiler_option("-c99") +endif() + +# +# Build all runtimes in the top-level binary directory; that way, +# on Windows, the executables will be in the same directory as +# the DLLs, so the system will find pcap.dll when any of the +# executables are run. +# +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run) + ################################################################### # Parameters ################################################################### -option (INET6 "Enable IPv6" ON) -if( MSVC ) - option (USE_STATIC_RT "Use static Runtime" ON) -endif( MSVC ) -option (BUILD_SHARED_LIBS "Build shared libraries" ON) -if( WIN32 ) +if(WIN32) + # + # On Windows, allow the library name to be overridden, for the + # benefit of projects that combine libpcap with their own + # kernel-mode code to support capturing. + # + set(LIBRARY_NAME pcap CACHE STRING "Library name") +else() + # + # On UN*X, it's always been libpcap. + # + set(LIBRARY_NAME pcap) +endif() + +option(INET6 "Enable IPv6" ON) +if(WIN32) + option(USE_STATIC_RT "Use static Runtime" ON) +endif(WIN32) +option(BUILD_SHARED_LIBS "Build shared libraries" ON) +if(WIN32) set(PACKET_DLL_DIR "" CACHE PATH "Path to directory with include and lib subdirectories for packet.dll") -endif( WIN32 ) +endif(WIN32) +# To pacify those who hate the protochain instruction +option(NO_PROTOCHAIN "Disable protochain instruction" OFF) + # -# XXX - this should be an option, defaulting to "yes" for Windows and to -# "no", for now, on UN*X. +# Start out with the capture mechanism type unspecified; the user +# can explicitly specify it and, if they don't, we'll pick an +# appropriate one. # -if( WIN32 ) - set( HAVE_REMOTE 1 ) -endif( WIN32 ) +set(PCAP_TYPE "" CACHE STRING "Packet capture type") +# +# Default to having remote capture support on Windows and, for now, to +# not having it on UN*X. +# +if(WIN32) + option(ENABLE_REMOTE "Enable remote capture" ON) +else() + option(ENABLE_REMOTE "Enable remote capture" OFF) +endif(WIN32) + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + option(PCAP_SUPPORT_PACKET_RING "Enable Linux packet ring support" ON) + option(BUILD_WITH_LIBNL "Build with libnl" ON) +endif() + +# +# By default, build universal with the appropriate set of architectures +# for the OS on which we're doing the build. +# +if(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + # + # Get the major version of Darwin. + # + string(REGEX MATCH "^([0-9]+)" SYSTEM_VERSION_MAJOR "${CMAKE_SYSTEM_VERSION}") + + if(SYSTEM_VERSION_MAJOR LESS 8) + # + # Pre-Tiger. Build only for 32-bit PowerPC. + # + set(CMAKE_OSX_ARCHITECTURES "ppc") + elseif(SYSTEM_VERSION_MAJOR EQUAL 8) + # + # Tiger. Is this prior to, or with, Intel support? + # + # Get the minor version of Darwin. + # + string(REPLACE "${SYSTEM_VERSION_MAJOR}." "" SYSTEM_MINOR_AND_PATCH_VERSION ${CMAKE_SYSTEM_VERSION}) + string(REGEX MATCH "^([0-9]+)" SYSTEM_VERSION_MINOR "${SYSTEM_MINOR_AND_PATCH_VERSION}") + if(SYSTEM_VERSION_MINOR LESS 4) + # + # Prior to Intel support. Build for 32-bit + # PowerPC and 64-bit PowerPC, with 32-bit PowerPC + # first. (I'm guessing that's what Apple does.) + # + set(CMAKE_OSX_ARCHITECTURES "ppc;ppc64") + elseif(SYSTEM_VERSION_MINOR LESS 7) + # + # With Intel support but prior to x86-64 support. + # Build for 32-bit PowerPC, 64-bit PowerPC, and x86, + # with 32-bit PowerPC first. + # (I'm guessing that's what Apple does.) + # + set(CMAKE_OSX_ARCHITECTURES "ppc;ppc64;i386") + else() + # + # With Intel support including x86-64 support. + # Build for 32-bit PowerPC, 64-bit PowerPC, x86, + # and x86-64, with 32-bit PowerPC first. + # (I'm guessing that's what Apple does.) + # + set(CMAKE_OSX_ARCHITECTURES "ppc;ppc64;i386;x86_64") + endif() + elseif(SYSTEM_VERSION_MAJOR EQUAL 9) + # + # Leopard. Build for 32-bit PowerPC, 64-bit + # PowerPC, x86, and x86-64, with 32-bit PowerPC + # first. (That's what Apple does.) + # + set(CMAKE_OSX_ARCHITECTURES "ppc;ppc64;i386;x86_64") + elseif(SYSTEM_VERSION_MAJOR EQUAL 10) + # + # Snow Leopard. Build for x86-64, x86, and + # 32-bit PowerPC, with x86-64 first. (That's + # what Apple does, even though Snow Leopard + # doesn't run on PPC, so PPC libpcap runs under + # Rosetta, and Rosetta doesn't support BPF + # ioctls, so PPC programs can't do live + # captures.) + # + set(CMAKE_OSX_ARCHITECTURES "x86_64;i386;ppc") + else() + # + # Post-Snow Leopard. Build for x86-64 and + # x86, with x86-64 first. (That's probably what + # Apple does, given that Rosetta is gone.) + # XXX - update if and when Apple drops support + # for 32-bit x86 code. + # + set(CMAKE_OSX_ARCHITECTURES "x86_64;i386") + endif() +endif() + +# +# Additional capture modules. +# +option(DISABLE_USB "Disable USB sniffing support" OFF) +option(DISABLE_BLUETOOTH "Disable Bluetooth sniffing support" OFF) +option(DISABLE_NETMAP "Disable netmap support" OFF) +# +# We don't support D-Bus sniffing on macOS; see +# +# https://bugs.freedesktop.org/show_bug.cgi?id=74029 +# +if(APPLE) + option(DISABLE_DBUS "Disable D-Bus sniffing support" ON) +else(APPLE) + option(DISABLE_DBUS "Disable D-Bus sniffing support" OFF) +endif(APPLE) +option(DISABLE_RDMA "Disable RDMA sniffing support" OFF) + +option(DISABLE_DAG "Disable Endace DAG card support" OFF) + +option(DISABLE_SEPTEL "Disable Septel card support" OFF) +set(SEPTEL_ROOT "${CMAKE_SOURCE_DIR}/../septel" CACHE PATH "Path to directory with include and lib subdirectories for Septel API") + +option(DISABLE_SNF "Disable Myricom SNF support" OFF) + +option(DISABLE_TC "Disable Riverbed TurboCap support" OFF) + +# +# Debugging options. +# +option(BDEBUG "Build optimizer debugging code" OFF) +option(YYDEBUG "Build parser debugging code" OFF) + +################################################################### +# Versioning +################################################################### + +# Get, parse, format and set pcap's version string from [pcap_root]/VERSION +# for later use. + +# Get MAJOR, MINOR, PATCH & SUFFIX +file(STRINGS ${pcap_SOURCE_DIR}/VERSION + PACKAGE_VERSION + LIMIT_COUNT 1 # Read only the first line +) + +# Get "just" MAJOR +string(REGEX MATCH "^([0-9]+)" PACKAGE_VERSION_MAJOR "${PACKAGE_VERSION}") + +# Get MAJOR, MINOR & PATCH +string(REGEX MATCH "^([0-9]+.)?([0-9]+.)?([0-9]+)" PACKAGE_VERSION_NOSUFFIX "${PACKAGE_VERSION}") + +if(WIN32) + # Convert PCAP_VERSION_NOSUFFIX to Windows preferred version format + string(REPLACE "." "," PACKAGE_VERSION_PREDLL ${PACKAGE_VERSION_NOSUFFIX}) + + # Append NANO (used for Windows internal versioning) to PCAP_VERSION_PREDLL + # 0 means unused. + set(PACKAGE_VERSION_DLL ${PACKAGE_VERSION_PREDLL},0) +endif(WIN32) + +set(PACKAGE_NAME "${LIBRARY_NAME}") +set(PACKAGE_STRING "${LIBRARY_NAME} ${PACKAGE_VERSION}") + ###################################### # Project settings ###################################### -add_definitions( -DHAVE_CONFIG_H ) +add_definitions(-DHAVE_CONFIG_H) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${pcap_SOURCE_DIR} ) -if( WIN32 ) - if( NOT "${PACKET_DLL_DIR}" STREQUAL "" ) - include_directories("${PACKET_DLL_DIR}/Include") - if( CMAKE_CL_64 ) - link_directories("${PACKET_DLL_DIR}/Lib/x64") - else( CMAKE_CL_64 ) - link_directories("${PACKET_DLL_DIR}/Lib") - endif( CMAKE_CL_64 ) - endif() - include_directories( - ../Common/ - Win32/Include - ) -endif( WIN32) +include(CheckFunctionExists) +include(CMakePushCheckState) -add_definitions( -DBUILDING_PCAP ) +if(WIN32) -if( MSVC ) - add_definitions( -D__STDC__ ) - add_definitions( -D_CRT_SECURE_NO_WARNINGS ) - add_definitions( "-D_U_=" ) -elseif( CMAKE_COMPILER_IS_GNUCXX ) - add_definitions( "-D_U_=__attribute__((unused))" ) -else(MSVC) - add_definitions( "-D_U_=" ) -endif( MSVC ) + if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/../../Common) + include_directories(${CMAKE_HOME_DIRECTORY}/../../Common) + endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/../../Common) -if( MSVC ) - if (USE_STATIC_RT) - MESSAGE( STATUS "Use STATIC runtime" ) - set(NAME_RT MT) - set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT") - set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") - set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + find_package(Packet) + if(PACKET_FOUND) + set(HAVE_PACKET32 TRUE) + include_directories(${PACKET_INCLUDE_DIRS}) + # + # Check whether we have the NPcap PacketIsLoopbackAdapter() + # function. + # + cmake_push_check_state() + set(CMAKE_REQUIRED_LIBRARIES ${PACKET_LIBRARIES}) + check_function_exists(PacketIsLoopbackAdapter HAVE_PACKET_IS_LOOPBACK_ADAPTER) + cmake_pop_check_state() + endif(PACKET_FOUND) - set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT") - set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT") - set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") - set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") - else (USE_STATIC_RT) - MESSAGE( STATUS "Use DYNAMIC runtime" ) - set(NAME_RT MD) - set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD") - set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") - set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") +endif(WIN32) - set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD") - set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD") - set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD") - set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd") - endif (USE_STATIC_RT) -endif( MSVC ) +if(MSVC) + add_definitions(-D__STDC__) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif(MSVC) +if(USE_STATIC_RT) + message(STATUS "Use STATIC runtime") + if(MSVC) + foreach(RT_FLAG + CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + string(REGEX REPLACE "/MD" "/MT" ${RT_FLAG} "${${RT_FLAG}}") + endforeach(RT_FLAG) + elseif(MINGW) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc") + endif() +else (USE_STATIC_RT) + message(STATUS "Use DYNAMIC runtime") +endif(USE_STATIC_RT) + ################################################################### # Detect available platform features ################################################################### include(CheckIncludeFile) -include(CheckFunctionExists) +include(CheckIncludeFiles) include(CheckStructHasMember) include(CheckTypeSize) # # Header files. # -check_include_file( inttypes.h HAVE_INTTYPES_H ) -check_include_file( stdint.h HAVE_STDINT_H ) -check_include_file( unistd.h HAVE_UNISTD_H ) -if( NOT HAVE_UNISTD_H ) - add_definitions( -DYY_NO_UNISTD_H ) -endif( NOT HAVE_UNISTD_H ) -check_include_file( bitypes.h HAVE_SYS_BITYPES_H ) -check_include_file( limits.h HAVE_LIMITS_H ) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(unistd.h HAVE_UNISTD_H) +if(NOT HAVE_UNISTD_H) + add_definitions(-DYY_NO_UNISTD_H) +endif(NOT HAVE_UNISTD_H) +check_include_file(bitypes.h HAVE_SYS_BITYPES_H) +if(NOT WIN32) + check_include_file(sys/ioccom.h HAVE_SYS_IOCCOM_H) + check_include_file(sys/sockio.h HAVE_SYS_SOCKIO_H) + check_include_file(sys/select.h HAVE_SYS_SELECT_H) +endif(NOT WIN32) +check_include_file(limits.h HAVE_LIMITS_H) +if(NOT WIN32) + check_include_file(netpacket/packet.h HAVE_NETPACKET_PACKET_H) + check_include_files("sys/types.h;sys/socket.h;net/if.h;net/pfvar.h" HAVE_NET_PFVAR_H) + if(HAVE_NET_PFVAR_H) + # + # Check for various PF actions. + # + check_c_source_compiles( +"#include <sys/types.h> +#include <sys/socket.h> +#include <net/if.h> +#include <net/pfvar.h> +int +main(void) +{ + return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR; +} +" + HAVE_PF_NAT_THROUGH_PF_NORDR) + endif(HAVE_NET_PFVAR_H) + check_include_file(netinet/if_ether.h HAVE_NETINET_IF_ETHER_H) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + check_include_file(linux/sockios.h HAVE_LINUX_SOCKIOS_H) + # + # linux/if_bonding.h requires sys/socket.h. + # + check_include_files("sys/socket.h;linux/if_bonding.h" HAVE_LINUX_IF_BONDING_H) + endif() +endif(NOT WIN32) + # # Functions. # -check_function_exists( strerror HAVE_STRERROR ) -check_function_exists( strlcpy HAVE_STRLCPY ) -check_function_exists( snprintf HAVE_SNPRINTF ) -check_function_exists( vsnprintf HAVE_VSNPRINTF ) -check_function_exists( strtok_r HAVE_STRTOK_R ) +check_function_exists(strerror HAVE_STRERROR) +check_function_exists(strerror_r HAVE_STRERROR_R) +check_function_exists(strerror_s HAVE_STRERROR_S) +check_function_exists(strlcpy HAVE_STRLCPY) +check_function_exists(strlcat HAVE_STRLCAT) +check_function_exists(snprintf HAVE_SNPRINTF) +check_function_exists(vsnprintf HAVE_VSNPRINTF) +check_function_exists(strtok_r HAVE_STRTOK_R) -if (WIN32) +# +# These tests are for network applications that need socket functions +# and getaddrinfo()/getnameinfo()-ish functions. We now require +# getaddrinfo() and getnameinfo(). On UN*X systems, we also prefer +# versions of recvmsg() that conform to the Single UNIX Specification, +# so that we can check whether a datagram received with recvmsg() was +# truncated when received due to the buffer being too small. +# +# On Windows, getaddrinfo() is in the ws2_32 library. + +# On most UN*X systems, they're available in the system library. +# +# Under Solaris, we need to link with libsocket and libnsl to get +# getaddrinfo() and getnameinfo() and, if we have libxnet, we need to +# link with libxnet before libsocket to get a version of recvmsg() +# that conforms to the Single UNIX Specification. +# +# We use getaddrinfo() because we want a portable thread-safe way +# of getting information for a host name or port; there exist _r +# versions of gethostbyname() and getservbyname() on some platforms, +# but not on all platforms. +# +# NOTE: if you hand check_library_exists as its last argument a variable +# that's been set, it skips the test, so we need different variables. +# +set(PCAP_LINK_LIBRARIES "") +include(CheckLibraryExists) +include(CheckSymbolExists) +if(WIN32) # - # Check for Windows-only functions, such as packet.dll functions. + # We need winsock2.h and ws2tcpip.h. # - check_function_exists( PacketIsLoopbackAdapter HAVE_PACKET_IS_LOOPBACK_ADAPTER ) -endif() + cmake_push_check_state() + set(CMAKE_REQUIRED_LIBRARIES ws2_32) + check_symbol_exists(getaddrinfo "winsock2.h;ws2tcpip.h" LIBWS2_32_HAS_GETADDRINFO) + cmake_pop_check_state() + if(LIBWS2_32_HAS_GETADDRINFO) + set(PCAP_LINK_LIBRARIES ws2_32 ${PCAP_LINK_LIBRARIES}) + else(LIBWS2_32_HAS_GETADDRINFO) + message(FATAL_ERROR "getaddrinfo is required, but wasn't found") + endif(LIBWS2_32_HAS_GETADDRINFO) +else(WIN32) + # + # UN*X. First try the system libraries, then try the libraries + # for Solaris and possibly other systems that picked up the + # System V library split. + # + check_function_exists(getaddrinfo STDLIBS_HAVE_GETADDRINFO) + if(NOT STDLIBS_HAVE_GETADDRINFO) + # + # Not found in the standard system libraries. + # Try libsocket, which requires libnsl. + # + cmake_push_check_state() + set(CMAKE_REQUIRED_LIBRARIES nsl) + check_library_exists(socket getaddrinfo "" LIBSOCKET_HAS_GETADDRINFO) + cmake_pop_check_state() + if(LIBSOCKET_HAS_GETADDRINFO) + # + # OK, we found it in libsocket. + # + set(PCAP_LINK_LIBRARIES socket nsl ${PCAP_LINK_LIBRARIES}) + else(LIBSOCKET_HAS_GETADDRINFO) + # + # We didn't find it. + # + message(FATAL_ERROR "getaddrinfo is required, but wasn't found") + endif(LIBSOCKET_HAS_GETADDRINFO) + # + # OK, do we have recvmsg() in libxnet? + # We also link with libsocket and libnsl. + # + cmake_push_check_state() + set(CMAKE_REQUIRED_LIBRARIES socket nsl) + check_library_exists(xnet recvmsg "" LIBXNET_HAS_RECVMSG) + cmake_pop_check_state() + if(LIBXNET_HAS_RECVMSG) + # + # Yes - link with it as well. + # + set(PCAP_LINK_LIBRARIES xnet ${PCAP_LINK_LIBRARIES}) + endif(LIBXNET_HAS_RECVMSG) + endif(NOT STDLIBS_HAVE_GETADDRINFO) + + # DLPI needs putmsg under HPUX so test for -lstr while we're at it + check_function_exists(putmsg STDLIBS_HAVE_PUTMSG) + if(NOT STDLIBS_HAVE_PUTMSG) + check_library_exists(str putmsg "" LIBSTR_HAS_PUTMSG) + if(LIBSTR_HAS_PUTMSG) + set(PCAP_LINK_LIBRARIES str ${PCAP_LINK_LIBRARIES}) + endif(LIBSTR_HAS_PUTMSG) + endif(NOT STDLIBS_HAVE_PUTMSG) +endif(WIN32) + # +# Check for reentrant versions of getnetbyname_r(), as provided by +# Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!). +# If we don't find one, we just use getnetbyname(), which uses +# thread-specific data on many platforms, but doesn't use it on +# NetBSD or OpenBSD, and may not use it on older versions of other +# platforms. +# +# Only do the check if we have a declaration of getnetbyname_r(); +# without it, we can't check which API it has. (We assume that +# if there's a declaration, it has a prototype, so that the API +# can be checked.) +# +cmake_push_check_state() +set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LINK_LIBRARIES}) +check_symbol_exists(getnetbyname_r netdb.h NETDB_H_DECLARES_GETNETBYNAME_R) +if(NETDB_H_DECLARES_GETNETBYNAME_R) + check_c_source_compiles( +"#include <netdb.h> + +int +main(void) +{ + struct netent netent_buf; + char buf[1024]; + struct netent *resultp; + int h_errnoval; + + return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval); +} +" + HAVE_LINUX_GETNETBYNAME_R) + if(NOT HAVE_LINUX_GETNETBYNAME_R) + check_c_source_compiles( +"#include <netdb.h> + +int +main(void) +{ + struct netent netent_buf; + char buf[1024]; + + return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL; +} +" + HAVE_SOLARIS_IRIX_GETNETBYNAME_R) + if(NOT HAVE_SOLARIS_IRIX_GETNETBYNAME_R) + check_c_source_compiles( +"#include <netdb.h> + +int +main(void) +{ + struct netent netent_buf; + struct netent_data net_data; + + return getnetbyname_r((const char *)0, &netent_buf, &net_data); +} +" + HAVE_AIX_GETNETBYNAME_R) + endif(NOT HAVE_SOLARIS_IRIX_GETNETBYNAME_R) + endif(NOT HAVE_LINUX_GETNETBYNAME_R) +endif(NETDB_H_DECLARES_GETNETBYNAME_R) +cmake_pop_check_state() + +# +# Check for reentrant versions of getprotobyname_r(), as provided by +# Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!). +# If we don't find one, we just use getprotobyname(), which uses +# thread-specific data on many platforms, but doesn't use it on +# NetBSD or OpenBSD, and may not use it on older versions of other +# platforms. +# +# Only do the check if we have a declaration of getprotobyname_r(); +# without it, we can't check which API it has. (We assume that +# if there's a declaration, it has a prototype, so that the API +# can be checked.) +# +cmake_push_check_state() +set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LINK_LIBRARIES}) +check_symbol_exists(getprotobyname_r netdb.h NETDB_H_DECLARES_GETPROTOBYNAME_R) +if(NETDB_H_DECLARES_GETPROTOBYNAME_R) + check_c_source_compiles( +"#include <netdb.h> + +int +main(void) +{ + struct protoent protoent_buf; + char buf[1024]; + struct protoent *resultp; + + return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp); +} +" + HAVE_LINUX_GETPROTOBYNAME_R) + if(NOT HAVE_LINUX_GETPROTOBYNAME_R) + check_c_source_compiles( +"#include <netdb.h> + +int +main(void) +{ + struct protoent protoent_buf; + char buf[1024]; + + return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL; +} +" + HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R) + if(NOT HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R) + check_c_source_compiles( +"#include <netdb.h> + +int +main(void) +{ + struct protoent protoent_buf; + struct protoent_data proto_data; + + return getprotobyname_r((const char *)0, &protoent_buf, &proto_data); +} +" + HAVE_AIX_GETPROTOBYNAME_R) + endif(NOT HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R) + endif(NOT HAVE_LINUX_GETPROTOBYNAME_R) +endif(NETDB_H_DECLARES_GETPROTOBYNAME_R) +cmake_pop_check_state() + +# # Data types. # -# XXX - there's no check_struct() macro that's like check_struct_has_member() +# XXX - there's no check_type() macro that's like check_type_size() # except that it only checks for the existence of the structure type, -# so we use check_struct_has_member() and look for ss_family. +# so we use check_type_size() and ignore the size. # -check_struct_has_member("struct sockaddr_storage" ss_family sys/socket.h HAVE_SOCKADDR_STORAGE) -set(CMAKE_EXTRA_INCLUDE_FILES unistd.h sys/socket.h) +cmake_push_check_state() +if(WIN32) + set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h) +else(WIN32) + set(CMAKE_EXTRA_INCLUDE_FILES unistd.h sys/socket.h) +endif(WIN32) +check_type_size("struct sockaddr_storage" STRUCT_SOCKADDR_STORAGE) check_type_size("socklen_t" SOCKLEN_T) -set(CMAKE_EXTRA_INCLUDE_FILES unistd.h) +cmake_pop_check_state() # # Structure fields. # -check_struct_has_member("struct sockaddr" sa_len sys/socket.h HAVE_SOCKADDR_SA_LEN ) +if(WIN32) + check_struct_has_member("struct sockaddr" sa_len winsock2.h HAVE_STRUCT_SOCKADDR_SA_LEN) +else(WIN32) + check_struct_has_member("struct sockaddr" sa_len sys/socket.h HAVE_STRUCT_SOCKADDR_SA_LEN) +endif(WIN32) -if( INET6 ) - MESSAGE( STATUS "Use IPv6" ) -endif( INET6 ) +# +# Do we have ffs(), and is it declared in <strings.h>? +# +check_function_exists(ffs HAVE_FFS) +if(HAVE_FFS) + # + # OK, we have ffs(). Is it declared in <strings.h>? + # + # This test fails if we don't have <strings.h> or if we do + # but it doesn't declare ffs(). + # + check_symbol_exists(ffs strings.h STRINGS_H_DECLARES_FFS) +endif() -if( WIN32 ) - add_definitions( -DHAVE_ADDRINFO ) -endif( WIN32 ) +# +# This requires the libraries that we require, as ether_hostton might be +# in one of those libraries. That means we have to do this after +# we check for those libraries. +# +# You are in a twisty little maze of UN*Xes, all different. +# Some might not have ether_hostton(). +# Some might have it and declare it in <net/ethernet.h>. +# Some might have it and declare it in <netinet/ether.h> +# Some might have it and declare it in <sys/ethernet.h>. +# Some might have it and declare it in <arpa/inet.h>. +# Some might have it and declare it in <netinet/if_ether.h>. +# Some might have it and not declare it in any header file. +# +# Before you is a C compiler. +# +cmake_push_check_state() +set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LINK_LIBRARIES}) +check_function_exists(ether_hostton HAVE_ETHER_HOSTTON) +if(HAVE_ETHER_HOSTTON) + # + # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>? + # + # This test fails if we don't have <net/ethernet.h> or if we do + # but it doesn't declare ether_hostton(). + # + check_symbol_exists(ether_hostton net/ethernet.h NET_ETHERNET_H_DECLARES_ETHER_HOSTTON) + if(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON) + # + # Yes - we have it declared. + # + set(HAVE_DECL_ETHER_HOSTTON TRUE) + endif() + # + # Did that succeed? + # + if(NOT HAVE_DECL_ETHER_HOSTTON) + # + # No - how about <netinet/ether.h>, as on Linux? + # + # This test fails if we don't have <netinet/ether.h> + # or if we do but it doesn't declare ether_hostton(). + # + check_symbol_exists(ether_hostton netinet/ether.h NETINET_ETHER_H_DECLARES_ETHER_HOSTTON) + if(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON) + # + # Yes - we have it declared. + # + set(HAVE_DECL_ETHER_HOSTTON TRUE) + endif() + endif() + # + # Did that succeed? + # + if(NOT HAVE_DECL_ETHER_HOSTTON) + # + # No - how about <sys/ethernet.h>, as on Solaris 10 and later? + # + # This test fails if we don't have <sys/ethernet.h> + # or if we do but it doesn't declare ether_hostton(). + # + check_symbol_exists(ether_hostton sys/ethernet.h SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON) + if(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON) + # + # Yes - we have it declared. + # + set(HAVE_DECL_ETHER_HOSTTON TRUE) + endif() + endif() + # + # Did that succeed? + # + if(NOT HAVE_DECL_ETHER_HOSTTON) + # + # No, how about <arpa/inet.h>, as on AIX? + # + # This test fails if we don't have <arpa/inet.h> + # or if we do but it doesn't declare ether_hostton(). + # + check_symbol_exists(ether_hostton arpa/inet.h ARPA_INET_H_DECLARES_ETHER_HOSTTON) + if(ARPA_INET_H_DECLARES_ETHER_HOSTTON) + # + # Yes - we have it declared. + # + set(HAVE_DECL_ETHER_HOSTTON TRUE) + endif() + endif() + # + # Did that succeed? + # + if(NOT HAVE_DECL_ETHER_HOSTTON) + # + # No, how about <netinet/if_ether.h>? + # On some platforms, it requires <net/if.h> and + # <netinet/in.h>, and we always include it with + # both of them, so test it with both of them. + # + # This test fails if we don't have <netinet/if_ether.h> + # and the headers we include before it, or if we do but + # <netinet/if_ether.h> doesn't declare ether_hostton(). + # + check_symbol_exists(ether_hostton "sys/types.h;sys/socket.h;net/if.h;netinet/in.h;netinet/if_ether.h" NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON) + if(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON) + # + # Yes - we have it declared. + # + set(HAVE_DECL_ETHER_HOSTTON TRUE) + endif() + endif() + # + # After all that, is ether_hostton() declared? + # + if(NOT HAVE_DECL_ETHER_HOSTTON) + # + # No, we'll have to declare it ourselves. + # Do we have "struct ether_addr" if we include <netinet/if_ether.h>? + # + # XXX - there's no check_type() macro that's like check_type_size() + # except that it only checks for the existence of the structure type, + # so we use check_type_size() and ignore the size. + # + cmake_push_check_state() + set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h sys/socket.h net/if.h netinet/in.h netinet/if_ether.h) + check_type_size("struct ether_addr" STRUCT_ETHER_ADDR) + cmake_pop_check_state() + endif() +endif() +cmake_pop_check_state() -###################################### -# External dependencies -###################################### +# +# Large file support on UN*X, a/k/a LFS. +# +if(NOT WIN32) + include(FindLFS) + if(LFS_FOUND) + # + # Add the required #defines. + # + add_definitions(${LFS_DEFINITIONS}) + endif() + # + # Check for fseeko as well. + # + include(FindFseeko) + if(FSEEKO_FOUND) + set(HAVE_FSEEKO ON) + + # + # Add the required #defines. + # + add_definitions(${FSEEKO_DEFINITIONS}) + endif() +endif() + +if(INET6) + message(STATUS "Support IPv6") +endif(INET6) + +# +# Pthreads. +# We might need them, because some libraries we use might use them, +# but we don't necessarily need them. +# That's only on UN*X; on Windows, if they use threads, we assume +# they're native Windows threads. +# +if(NOT WIN32) + set(CMAKE_THREAD_PREFER_PTHREAD ON) + find_package(Threads) + if(NOT CMAKE_USE_PTHREADS_INIT) + # + # If it's not pthreads, we won't use it; we use it for libraries + # that require it. + # + set(CMAKE_THREAD_LIBS_INIT "") + endif(NOT CMAKE_USE_PTHREADS_INIT) +endif(NOT WIN32) + ###################################### # Input files ###################################### set(PROJECT_SOURCE_LIST_C bpf_dump.c + bpf_filter.c bpf_image.c etherent.c - fad-helpers.c + fmtutils.c gencode.c - inet.c nametoaddr.c optimize.c pcap-common.c *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805181221.w4ICLKfl034045>