]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: add libnl-3.0 support
authorYegor Yefremov <yegor_sub1@visionsystems.de>
Thu, 21 Jul 2011 15:06:17 +0000 (15:06 +0000)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 7 Sep 2011 16:10:58 +0000 (18:10 +0200)
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Makefile
iw.c
iw.h

index 885e48f08f250d5ee478fd1b0a268ff458e60868..8443ee69f26fdabf603356c1895e6b036fc3a35e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ ALL = iw
 
 NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y)
 NL2FOUND := $(shell $(PKG_CONFIG) --atleast-version=2 libnl-2.0 && echo Y)
+NL3FOUND := $(shell $(PKG_CONFIG) --atleast-version=3 libnl-3.0 && echo Y)
 
 ifeq ($(NL1FOUND),Y)
 NLLIBNAME = libnl-1
@@ -35,6 +36,12 @@ LIBS += -lnl-genl
 NLLIBNAME = libnl-2.0
 endif
 
+ifeq ($(NL3FOUND),Y)
+CFLAGS += -DCONFIG_LIBNL30
+LIBS += -lnl-genl
+NLLIBNAME = libnl-3.0
+endif
+
 ifeq ($(NLLIBNAME),)
 $(error Cannot find development files for any supported version of libnl)
 endif
@@ -53,6 +60,8 @@ endif
 all: version_check $(ALL)
 
 version_check:
+ifeq ($(NL3FOUND),Y)
+else
 ifeq ($(NL2FOUND),Y)
 else
 ifeq ($(NL1FOUND),Y)
@@ -60,6 +69,7 @@ else
        $(error No libnl found)
 endif
 endif
+endif
 
 
 VERSION_OBJS := $(filter-out version.o, $(OBJS))
diff --git a/iw.c b/iw.c
index 50c3a4205515dba18bfafae5311e76aea1c5c7da..895c51a5c7877d90c9adb7d150edd894919fec71 100644 (file)
--- a/iw.c
+++ b/iw.c
@@ -23,9 +23,8 @@
 #include "nl80211.h"
 #include "iw.h"
 
-#ifndef CONFIG_LIBNL20
-/* libnl 2.0 compatibility code */
-
+/* libnl 1.x compatibility code */
+#if !defined(CONFIG_LIBNL20) && !defined(CONFIG_LIBNL30)
 static inline struct nl_handle *nl_socket_alloc(void)
 {
        return nl_handle_alloc();
@@ -45,7 +44,7 @@ static inline int __genl_ctrl_alloc_cache(struct nl_sock *h, struct nl_cache **c
        return 0;
 }
 #define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
-#endif /* CONFIG_LIBNL20 */
+#endif /* CONFIG_LIBNL20 && CONFIG_LIBNL30 */
 
 int iw_debug = 0;
 
diff --git a/iw.h b/iw.h
index 616fa04c579aee7e00613f2e2b7f088ecec72b22..dd964c16436e46bc1255bf3b6419731f775e76ed 100644 (file)
--- a/iw.h
+++ b/iw.h
@@ -11,7 +11,8 @@
 
 #define ETH_ALEN 6
 
-#ifndef CONFIG_LIBNL20
+/* libnl 1.x compatibility code */
+#if !defined(CONFIG_LIBNL20) && !defined(CONFIG_LIBNL30)
 #  define nl_sock nl_handle
 #endif