Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
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
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
all: version_check $(ALL)
version_check:
+ifeq ($(NL3FOUND),Y)
+else
ifeq ($(NL2FOUND),Y)
else
ifeq ($(NL1FOUND),Y)
$(error No libnl found)
endif
endif
+endif
VERSION_OBJS := $(filter-out version.o, $(OBJS))
#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();
return 0;
}
#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
-#endif /* CONFIG_LIBNL20 */
+#endif /* CONFIG_LIBNL20 && CONFIG_LIBNL30 */
int iw_debug = 0;
#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