Signed-off-by: Tim Gardner <tim.gardner@canonical.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
-endif
-
-ifeq ($(NL2FOUND),Y)
-CFLAGS += -DCONFIG_LIBNL20
+ifeq ($(NL3FOUND),Y)
+CFLAGS += -DCONFIG_LIBNL30
NLLIBS += -lnl-genl
-NLLIBNAME = libnl-2.0
+NLLIBNAME = libnl-3.0
+else
+ ifeq ($(NL2FOUND),Y)
+ CFLAGS += -DCONFIG_LIBNL20
+ NLLIBS += -lnl-genl
+ NLLIBNAME = libnl-2.0
+ else
+ ifeq ($(NL1FOUND),Y)
+ NLLIBNAME = libnl-1
+ endif
+ endif
endif
ifeq ($(NLLIBNAME),)
#include "regdb.h"
#include "reglib.h"
-#ifndef CONFIG_LIBNL20
+#if !defined(CONFIG_LIBNL20) && !defined(CONFIG_LIBNL30)
/* libnl 2.0 compatibility code */
static inline struct nl_handle *nl_socket_alloc(void)
{
#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
#define nl_sock nl_handle
-#endif /* CONFIG_LIBNL20 */
+#endif /* CONFIG_LIBNL20 && CONFIG_LIBNL30 */
struct nl80211_state {
struct nl_sock *nl_sock;