diff options
author | Jörg Mayer <jmayer@loplof.de> | 2012-06-20 20:59:43 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2012-06-20 20:59:43 +0000 |
commit | c0da019caa57f8c90c71260436694f54e38198be (patch) | |
tree | f20e57e6191713d7f4ffe4219ca351f10c1e26e4 | |
parent | 49849233c382116d77f3a6d15a38135d5dbe3ee2 (diff) |
Complete cmake support for netlink detection
svn path=/trunk/; revision=43421
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | CMakeOptions.txt | 1 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | cmake/modules/FindNL.cmake | 50 | ||||
-rw-r--r-- | cmakeconfig.h.in | 3 |
5 files changed, 63 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e074abbb40..eae1a8d5c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,6 +312,10 @@ if(ENABLE_GEOIP) set(PACKAGELIST ${PACKAGELIST} GEOIP) endif() +if(ENABLE_NETLINK) + set(PACKAGELIST ${PACKAGELIST} NL) +endif() + # Capabilities if(ENABLE_CAP) set(PACKAGELIST ${PACKAGELIST} CAP) @@ -380,6 +384,9 @@ endif() if(ENABLE_AIRPCAP) set(HAVE_AIRPCAP 1) endif() +if(HAVE_LIBNL AND ENABLE_AIRPCAP) + message(ERROR "Airpcap and Libnl support are mutually exclusive") +endif() # No matter which version of GTK is present if(GTK2_FOUND OR GTK3_FOUND) set(GTK_FOUND ON) @@ -904,6 +911,7 @@ if(BUILD_dumpcap AND PCAP_FOUND) ${GTHREAD2_LIBRARIES} ${ZLIB_LIBRARIES} ${APPLE_COCOA_LIBRARY} + ${LIBNL_LIBRARIES} ) set(dumpcap_FILES svnversion.h diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 21af1f2d93..cb983b96f4 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -44,5 +44,6 @@ option(ENABLE_GCRYPT "Build with GNU crypto support" ON) option(ENABLE_GEOIP "Build with GeoIP support" ON) option(ENABLE_CAP "Build with posix capabilities support" ON) option(ENABLE_CARES "Build with c_ares support" ON) +option(ENABLE_LIBNL "Build with libnl support" ON) # todo Mostly hardcoded option(ENABLE_KERBEROS "Build with Kerberos support" ON) diff --git a/Makefile.am b/Makefile.am index d692e071b1..4b0ab05676 100644 --- a/Makefile.am +++ b/Makefile.am @@ -832,6 +832,7 @@ EXTRA_DIST = \ cmake/modules/FindGTK3.cmake \ cmake/modules/FindHtmlViewer.cmake \ cmake/modules/FindKERBEROS.cmake \ + cmake/modules/FindLIBNL.cmake \ cmake/modules/FindLEX.cmake \ cmake/modules/FindLUA.cmake \ cmake/modules/FindLYNX.cmake \ diff --git a/cmake/modules/FindNL.cmake b/cmake/modules/FindNL.cmake new file mode 100644 index 0000000000..d7c4c2975b --- /dev/null +++ b/cmake/modules/FindNL.cmake @@ -0,0 +1,50 @@ +# +# $Id$ +# +# - Find libnl +# Find the native LIBNL includes and library +# +# LIBNL_INCLUDE_DIRS - where to find libnl.h, etc. +# LIBNL_LIBRARIES - List of libraries when using libnl3. +# LIBNL_FOUND - True if libnl found. + +FIND_PATH( + LIBNL_INCLUDE_DIR + NAMES + netlink/netlink.h + PATHS + /opt/local/include + /sw/include + /usr/include + /usr/local/include + PATH_SUFFIXES + libnl3 +) + +SET(LIBNL_NAMES nl-3) +FIND_LIBRARY(LIBNL_LIBRARY NAMES ${LIBNL_NAMES} ) +FIND_LIBRARY(LIBNLGENL_LIBRARY NAMES nl-genl-3 ) +FIND_LIBRARY(LIBNLROUTE_LIBRARY NAMES nl-route-3 ) + +IF(NOT LIBNL_FOUND) + FIND_PATH(LIBNL_INCLUDE_DIR netlink/netlink.h /usr/include/) + SET(LIBNL_NAMES nl) + FIND_LIBRARY(LIBNL_LIBRARY NAMES ${LIBNL_NAMES} ) + FIND_LIBRARY(LIBNLGENL_LIBRARY NAMES nl-genl ) + FIND_LIBRARY(LIBNLROUTE_LIBRARY NAMES nl-route ) +ENDIF() + +# handle the QUIETLY and REQUIRED arguments and set LIBNL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBNL DEFAULT_MSG LIBNL_LIBRARY LIBNL_INCLUDE_DIRS) + +IF(LIBNL_FOUND) + SET( LIBNL_LIBRARIES ${LIBNL_LIBRARY} ${LIBNLGENL_LIBRARY} ${LIBNLROUTE_LIBRARY}) + SET( LIBNL_INCLUDE_DIRS ${LIBNL_INCLUDE_DIR}) +ELSE() + SET( LIBNL_LIBRARIES ) + SET( LIBNL_INCLUDE_DIRS ) +ENDIF() + +MARK_AS_ADVANCED( LIBNL_LIBRARIES LIBNL_INCLUDE_DIRS ) diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 8578ef05be..f0ed5fffd0 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -60,6 +60,9 @@ /* Define to use the airpcap library */ #cmakedefine HAVE_AIRPCAP 1 +/* Define to use the libnl library */ +#cmakedefine HAVE_LIBNL 1 + /* Define to use C ares library */ #cmakedefine HAVE_C_ARES 1 |