Get netlink detection working with cmake (not complete)
authorJörg Mayer <jmayer@loplof.de>
Thu, 6 Sep 2012 10:37:17 +0000 (10:37 -0000)
committerJörg Mayer <jmayer@loplof.de>
Thu, 6 Sep 2012 10:37:17 +0000 (10:37 -0000)
svn path=/trunk/; revision=44791

CMakeLists.txt
CMakeOptions.txt
ConfigureChecks.cmake
cmake/modules/FindNL.cmake
cmakeconfig.h.in

index edd7619f0eec0400807fca699497541a6516e74d..3420bf185b855a68f8dadb022d9849c3e9df498e 100644 (file)
@@ -740,7 +740,7 @@ if(BUILD_wireshark AND GTK_FOUND)
                ${LIBEPAN_LIBS}
                ${APPLE_CORE_SERVICES_LIBRARY}
                ${APPLE_COCOA_LIBRARY}
-               ${LIBNL_LIBRARIES}
+               ${NL_LIBRARIES}
        )
        # qtshark and wireshark share wireshark_FILES
 
@@ -761,6 +761,7 @@ if(BUILD_qtshark AND QT_FOUND)
                ${LIBEPAN_LIBS}
                ${APPLE_CORE_SERVICES_LIBRARY}
                ${APPLE_COCOA_LIBRARY}
+               ${NL_LIBRARIES}
        )
        # qtshark and wireshark share wireshark_FILES
 
@@ -936,7 +937,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
                ${GTHREAD2_LIBRARIES}
                ${ZLIB_LIBRARIES}
                ${APPLE_COCOA_LIBRARY}
-               ${LIBNL_LIBRARIES}
+               ${NL_LIBRARIES}
        )
        set(dumpcap_FILES
                svnversion.h
index cb983b96f4983983028d989f3e28eacf499472b9..a1ac43e5e3df68250ac027d7f6b6c322c3f7394d 100644 (file)
@@ -44,6 +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)
+option(ENABLE_NETLINK    "Build with libnl support" ON)
 # todo Mostly hardcoded
 option(ENABLE_KERBEROS   "Build with Kerberos support" ON)
index b81cc47fb6d46a9393e50d679502b9e129e66dfc..07b0e80b110a90b07bc9fd19b8a184a83d0ac5df 100644 (file)
@@ -75,3 +75,8 @@ check_function_exists("mprotect"         HAVE_MPROTECT)
 check_function_exists("mkdtemp"          HAVE_MKDTEMP)
 check_function_exists("mkstemp"          HAVE_MKSTEMP)
 check_function_exists("sysconf"          HAVE_SYSCONF)
+
+#Symbols
+include(CheckSymbolExists)
+check_symbol_exists(NL80211_CMD_SET_CHANNEL "linux/nl80211.h" HAVE_NL80211_CMD_SET_CHANNEL)
+
index d7c4c2975b4a3b28faca863d336379039be81415..aa3f26c984955576bac6850f4c80db6860ae8c8c 100644 (file)
@@ -1,50 +1,70 @@
 #
 # $Id$
 #
-# - Find libnl
-# Find the native LIBNL includes and library
+# - Find netlink
+# Find the native netlink 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.
+#  NL_INCLUDE_DIRS - where to find libnl.h, etc.
+#  NL_LIBRARIES    - List of libraries when using libnl3.
+#  NL_FOUND        - True if libnl found.
 
-FIND_PATH(
-    LIBNL_INCLUDE_DIR
+SET( SEARCHPATHS
+    /opt/local
+    /sw
+    /usr
+    /usr/local
+)
+
+FIND_PATH( NL_INCLUDE_DIR
+  PATH_SUFFIXES
+    include/libnl3
   NAMES
-    netlink/netlink.h
+    netlink/version.h netlink/netlink.h
   PATHS
-    /opt/local/include
-    /sw/include
-    /usr/include
-    /usr/local/include
+    $(SEARCHPATHS)
+)
+
+FIND_LIBRARY( NL_LIBRARY
+  NAMES
+    nl-3 nl
   PATH_SUFFIXES
-    libnl3
+    lib64 lib
+  PATHS
+    $(SEARCHPATHS)
 )
 
-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()
+FIND_LIBRARY( NLGENL_LIBRARY
+  NAMES
+    nl-genl-3 nl-genl
+  PATH_SUFFIXES
+    lib64 lib
+  PATHS
+    $(SEARCHPATHS)
+)
 
-# handle the QUIETLY and REQUIRED arguments and set LIBNL_FOUND to TRUE if
+FIND_LIBRARY( NLROUTE_LIBRARY
+  NAMES
+    nl-route-3 nl-route
+  PATH_SUFFIXES
+    lib64 lib
+  PATHS
+    $(SEARCHPATHS)
+)
+
+# handle the QUIETLY and REQUIRED arguments and set NL_FOUND to TRUE if
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBNL DEFAULT_MSG LIBNL_LIBRARY LIBNL_INCLUDE_DIRS)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(NL DEFAULT_MSG NL_LIBRARY NL_INCLUDE_DIR)
 
-IF(LIBNL_FOUND)
-  SET( LIBNL_LIBRARIES ${LIBNL_LIBRARY} ${LIBNLGENL_LIBRARY} ${LIBNLROUTE_LIBRARY})
-  SET( LIBNL_INCLUDE_DIRS ${LIBNL_INCLUDE_DIR})
+IF(NL_FOUND)
+  SET( NL_LIBRARIES ${NLGENL_LIBRARY} ${NLROUTE_LIBRARY} ${NL_LIBRARY} )
+  SET( NL_INCLUDE_DIRS ${NL_INCLUDE_DIR})
+# FIXME: Differentiate between libnl versions
+  SET( HAVE_LIBNL3 1 )
 ELSE()
-  SET( LIBNL_LIBRARIES )
-  SET( LIBNL_INCLUDE_DIRS )
+  SET( NL_LIBRARIES )
+  SET( NL_INCLUDE_DIRS )
 ENDIF()
 
-MARK_AS_ADVANCED( LIBNL_LIBRARIES LIBNL_INCLUDE_DIRS )
+MARK_AS_ADVANCED( NL_LIBRARIES NL_INCLUDE_DIRS )
+
index f2bd8e69446e5e6a65cf3421a1f945c6ba6e971a..b1015e3332641bf14363704a9d8dae3247883311 100644 (file)
 /* Define to use the libnl library */
 #cmakedefine HAVE_LIBNL 1
 
+/* Define to use the libnl library */
+#cmakedefine HAVE_LIBNL1 1
+
+/* Define to use the libnl library */
+#cmakedefine HAVE_LIBNL2 1
+
+/* Define to use the libnl library */
+#cmakedefine HAVE_LIBNL3 1
+
 /* Define to use C ares library */
 #cmakedefine HAVE_C_ARES 1
 
 /* Define if strptime.h needs to be included */
 #cmakedefine NEED_STRPTIME_H 1
 
+/* Define if linux/nl80211.h defines NL80211_CMD_SET_CHANNEL */
+#cmakedefine HAVE_NL80211_CMD_SET_CHANNEL 1
+
 /* Name of package */
 #cmakedefine PACKAGE