]> The Tcpdump Group git mirrors - libpcap/commitdiff
Merge branch 'master' into man 648/head
authorAli Abdulkadir <[email protected]>
Sat, 21 Oct 2017 10:06:58 +0000 (13:06 +0300)
committerGitHub <[email protected]>
Sat, 21 Oct 2017 10:06:58 +0000 (13:06 +0300)
1  2 
CMakeLists.txt

diff --combined CMakeLists.txt
index 2080c2edc7df58ca20101ce58e6063fbc958c6a0,3e378a398755ffd7fbb5c33f6773a08ad5ce6460..fc9a8ce493a0f68ae14e3d4cbd52d7f398d7e9e2
@@@ -13,19 -13,24 +13,24 @@@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DI
  
  project(pcap)
  
- #
- # Call the library "wpcap" on Windows, for backwards compatibility.
- #
+ ###################################################################
+ #   Parameters
+ ###################################################################
  if(WIN32)
-     set(LIBRARY_NAME wpcap)
+     #
+     # 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()
  
- ###################################################################
- #   Parameters
- ###################################################################
  option(INET6 "Enable IPv6" ON)
  if(WIN32)
      option(USE_STATIC_RT "Use static Runtime" ON)
@@@ -195,7 -200,7 +200,7 @@@ if(WIN32
  
      # Append NANO (used for Windows internal versioning) to PCAP_VERSION_PREDLL
      # 0 means unused.
-     set(PACKAGE_VERSION_DLL "${PACKAGE_VERSION_PREDLL},0")
+     set(PACKAGE_VERSION_DLL ${PACKAGE_VERSION_PREDLL},0)
  endif(WIN32)
  
  set(PACKAGE_NAME "${LIBRARY_NAME}")
@@@ -618,6 -623,18 +623,18 @@@ else(
          # Check for a bunch of headers for various packet capture mechanisms.
          #
          check_include_files("sys/types.h;net/bpf.h" HAVE_NET_BPF_H)
+         if(HAVE_NET_BPF_H)
+             #
+             # Does it define BIOCSETIF?
+             # I.e., is it a header for an LBL/BSD-style capture
+             # mechanism, or is it just a header for a BPF filter
+             # engine?  Some versions of Arch Linux, for example,
+             # have a net/bpf.h that doesn't define BIOCSETIF;
+             # as it's a Linux, it should use packet sockets,
+             # instead.
+             #
+             check_symbol_exists(BIOCSETIF net/bpf.h BPF_H_DEFINES_BIOCSETIF)
+         endif(HAVE_NET_BPF_H)
          check_include_file(net/pfilt.h HAVE_NET_PFILT_H)
          check_include_file(net/enet.h HAVE_NET_ENET_H)
          check_include_file(net/nit.h HAVE_NET_NIT_H)
          check_include_file(net/raw.h HAVE_NET_RAW_H)
          check_include_file(sys/dlpi.h HAVE_SYS_DLPI_H)
  
-         if(HAVE_NET_BPF_H)
+         if(BPF_H_DEFINES_BIOCSETIF)
              #
              # BPF.
              # Check this before DLPI, so that we pick BPF on
              # Solaris 11 and later.
              #
              set(PCAP_TYPE bpf)
+         elseif(HAVE_LINUX_SOCKET_H)
+             #
+             # No prizes for guessing this one.
+             #
+             set(PCAP_TYPE linux)
          elseif(HAVE_NET_PFILT_H)
              #
              # DEC OSF/1, Digital UNIX, Tru64 UNIX
              # Pre-SunOS 4.x non-STREAMS NIT.
              #
              set(PCAP_TYPE nit)
-         elseif(HAVE_LINUX_SOCKET_H)
-             #
-             # No prizes for guessing this one.
-             #
-             set(PCAP_TYPE linux)
          elseif(HAVE_NET_RAW_H)
              #
              # IRIX snoop.
@@@ -1214,18 -1231,10 +1231,10 @@@ if(ENABLE_REMOTE
      add_subdirectory(rpcapd)
  endif(ENABLE_REMOTE)
  
- file(GLOB PROJECT_SOURCE_LIST_CORE_H
+ file(GLOB PROJECT_SOURCE_LIST_H
      *.h
      pcap/*.h
  )
- set(PROJECT_SOURCE_LIST_H ${PROJECT_SOURCE_LIST_H} ${PROJECT_SOURCE_LIST_CORE_H})
- if(WIN32)
-     file(GLOB PROJECT_SOURCE_LIST_WIN32_H
-         Win32/Include/*.h
-     )
-     set(PROJECT_SOURCE_LIST_H ${PROJECT_SOURCE_LIST_H} ${PROJECT_SOURCE_LIST_WIN32_H})
- endif(WIN32)
  
  #
  # Check and add warning options if we have a .devel file.
@@@ -1462,7 -1471,6 +1471,6 @@@ if(BUILD_SHARED_LIBS
          ${PROJECT_SOURCE_LIST_C}
          ${CMAKE_CURRENT_BINARY_DIR}/grammar.c
          ${CMAKE_CURRENT_BINARY_DIR}/scanner.c
-         ${PROJECT_SOURCE_LIST_H}
          ${PROJECT_EXTERNAL_OBJECT_LIST}
      )
      add_dependencies(${LIBRARY_NAME} SerializeTarget)
@@@ -1472,7 -1480,6 +1480,6 @@@ add_library(${LIBRARY_NAME}_static STAT
      ${PROJECT_SOURCE_LIST_C}
      ${CMAKE_CURRENT_BINARY_DIR}/grammar.c
      ${CMAKE_CURRENT_BINARY_DIR}/scanner.c
-     ${PROJECT_SOURCE_LIST_H}
      ${PROJECT_EXTERNAL_OBJECT_LIST}
  )
  add_dependencies(${LIBRARY_NAME}_static SerializeTarget)
@@@ -1559,17 -1566,6 +1566,17 @@@ include(GNUInstallDirs
  set(LIBRARY_NAME_STATIC ${LIBRARY_NAME}_static)
  
  function(install_manpage_symlink SOURCE TARGET MANDIR)
 +    if(MINGW)
 +        find_program(LINK_EXECUTABLE ln)
 +            if(LINK_EXECUTABLE)
 +                set(LINK_COMMAND "\"${LINK_EXECUTABLE}\" \"-s\" \"${SOURCE}\" \"${TARGET}\"")
 +            else(LINK_EXECUTABLE)
 +                message(FATAL_ERROR "ln (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ln.html) not find.")
 +            endif(LINK_EXECUTABLE)
 +    else(MINGW)
 +        set(LINK_COMMAND "\"${CMAKE_COMMAND}\" \"-E\" \"create_symlink\" \"${SOURCE}\" \"${TARGET}\"")
 +    endif(MINGW)
 +
      install(CODE
          "message(STATUS \"Symlinking: ${CMAKE_INSTALL_PREFIX}/${MANDIR}/${SOURCE} to ${TARGET}\")
           execute_process(
              WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${MANDIR}
            )
           execute_process(
 -            COMMAND \"${CMAKE_COMMAND}\" \"-E\" \"create_symlink\" \"${SOURCE}\" \"${TARGET}\"
 +            COMMAND ${LINK_COMMAND}
              WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${MANDIR}
              RESULT_VARIABLE EXIT_STATUS
            )
@@@ -1698,51 -1694,6 +1705,51 @@@ if(WIN32
      endif(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
  else(WIN32)
      install(TARGETS ${LIBRARY_NAME} ${LIBRARY_NAME_STATIC} DESTINATION lib)
 +endif(WIN32)
 +
 +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pcap/ DESTINATION include/pcap)
 +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap.h DESTINATION include)
 +
 +# On UN*X, and on Windows when not using MSVC, generate pcap-config and process
 +# man pages and arrange that they be installed.
 +if(NOT MSVC)
 +    set(PACKAGE_NAME ${LIBRARY_NAME})
 +    set(prefix ${CMAKE_INSTALL_PREFIX})
 +    set(exec_prefix "\${prefix}")
 +    set(includedir "\${prefix}/include")
 +    set(libdir "\${exec_prefix}/lib")
 +    if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
 +       CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
 +       CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
 +       CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
 +       CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
 +       CMAKE_SYSTEM_NAME STREQUAL "OSF1")
 +        #
 +        # Platforms where the linker is the GNU linker
 +        # or accepts command-line arguments like
 +        # those the GNU linker accepts.
 +        #
 +        set(V_RPATH_OPT "-Wl,-rpath,")
 +    elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
 +        #
 +        # SunOS 5.x.
 +        #
 +        # XXX - this assumes GCC is using the Sun linker,
 +        # rather than the GNU linker.
 +        #
 +        set(V_RPATH_OPT "-Wl,-R,")
 +    else()
 +        #
 +        # No option needed to set the RPATH.
 +        #
 +        set(V_RPATH_OPT "")
 +    endif()
 +    set(LIBS "")
 +    foreach(LIB ${PCAP_LINK_LIBRARIES})
 +        set(LIBS "${LIBS} -l${LIB}")
 +    endforeach(LIB)
 +    configure_file(${CMAKE_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
 +    install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
  
      #
      # Man pages.
      # For each section of the manual for which we have man pages
      # that require macro expansion, do the expansion.
      #
 -    # XXX - symlinks.
 -    #
      set(MAN1 "")
      foreach(MANPAGE ${MAN1_NOEXPAND})
          set(MAN1 ${MAN1} ${CMAKE_SOURCE_DIR}/${MANPAGE})
          set(MANMISC ${MANMISC} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
      endforeach(TEMPLATE_MANPAGE)
      install(FILES ${MANMISC} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_MISC_INFO})
 -endif(WIN32)
 -
 -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pcap/ DESTINATION include/pcap)
 -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap.h DESTINATION include)
 -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-namedb.h DESTINATION include)
 -
 -# On UN*X, and on Windows when not using MSVC, generate pcap-config and arrange
 -# that it be installed.
 -if(NOT MSVC)
 -    set(PACKAGE_NAME ${LIBRARY_NAME})
 -    set(prefix ${CMAKE_INSTALL_PREFIX})
 -    set(exec_prefix "\${prefix}")
 -    set(includedir "\${prefix}/include")
 -    set(libdir "\${exec_prefix}/lib")
 -    if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
 -       CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
 -       CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
 -       CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
 -       CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
 -       CMAKE_SYSTEM_NAME STREQUAL "OSF1")
 -        #
 -        # Platforms where the linker is the GNU linker
 -        # or accepts command-line arguments like
 -        # those the GNU linker accepts.
 -        #
 -        set(V_RPATH_OPT "-Wl,-rpath,")
 -    elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
 -        #
 -        # SunOS 5.x.
 -        #
 -        # XXX - this assumes GCC is using the Sun linker,
 -        # rather than the GNU linker.
 -        #
 -        set(V_RPATH_OPT "-Wl,-R,")
 -    else()
 -        #
 -        # No option needed to set the RPATH.
 -        #
 -        set(V_RPATH_OPT "")
 -    endif()
 -    set(LIBS "")
 -    foreach(LIB ${PCAP_LINK_LIBRARIES})
 -        set(LIBS "${LIBS} -l${LIB}")
 -    endforeach(LIB)
 -    configure_file(${CMAKE_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
 -    install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
  endif(NOT MSVC)
  
  # uninstall target