summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2012-09-06 10:37:17 +0000
committerJörg Mayer <jmayer@loplof.de>2012-09-06 10:37:17 +0000
commitd8a7eed0a74ac3ca7168a5fce5acf473d93a40f6 (patch)
treea547db4417bb030cab346e80f7af59aae516f33a
parentfc5c9f7853deb65d9cb3c6e8c6c50665d2159cc2 (diff)
downloadwireshark-d8a7eed0a74ac3ca7168a5fce5acf473d93a40f6.tar.gz
Get netlink detection working with cmake (not complete)
svn path=/trunk/; revision=44791
-rw-r--r--CMakeLists.txt5
-rw-r--r--CMakeOptions.txt2
-rw-r--r--ConfigureChecks.cmake5
-rw-r--r--cmake/modules/FindNL.cmake86
-rw-r--r--cmakeconfig.h.in12
5 files changed, 74 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edd7619f0e..3420bf185b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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
diff --git a/CMakeOptions.txt b/CMakeOptions.txt
index cb983b96f4..a1ac43e5e3 100644
--- a/CMakeOptions.txt
+++ b/CMakeOptions.txt
@@ -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)
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index b81cc47fb6..07b0e80b11 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -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)
+
diff --git a/cmake/modules/FindNL.cmake b/cmake/modules/FindNL.cmake
index d7c4c2975b..aa3f26c984 100644
--- a/cmake/modules/FindNL.cmake
+++ b/cmake/modules/FindNL.cmake
@@ -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 )
+
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in
index f2bd8e6944..b1015e3332 100644
--- a/cmakeconfig.h.in
+++ b/cmakeconfig.h.in
@@ -63,6 +63,15 @@
/* 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
@@ -316,6 +325,9 @@
/* 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