diff -aurp old/Makefile new/Makefile --- old/Makefile 2011-11-04 10:53:29.000000000 +0000 +++ new/Makefile 2011-11-14 09:30:04.514995618 +0000 @@ -25,6 +25,8 @@ 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) +NL31FOUND := $(shell $(PKG_CONFIG) --exact-version=3.1 libnl-3.1 && echo Y) +NL3xFOUND := $(shell $(PKG_CONFIG) --atleast-version=3.2 libnl-3.0 && echo Y) ifeq ($(NL1FOUND),Y) NLLIBNAME = libnl-1 @@ -36,18 +38,34 @@ LIBS += -lnl-genl NLLIBNAME = libnl-2.0 endif +ifeq ($(NL3xFOUND),Y) +NL3FOUND = N +CFLAGS += -DCONFIG_LIBNL30 +LIBS += -lnl-genl-3 +NLLIBNAME = libnl-3.0 +endif + ifeq ($(NL3FOUND),Y) CFLAGS += -DCONFIG_LIBNL30 LIBS += -lnl-genl NLLIBNAME = libnl-3.0 endif +# nl-3.1 has a broken libnl-gnl-3.1.pc file +# as show by pkg-config --debug --libs --cflags --exact-version=3.1 libnl-genl-3.1;echo $? +ifeq ($(NL31FOUND),Y) +CFLAGS += -DCONFIG_LIBNL30 +LIBS += -lnl-genl +NLLIBNAME = libnl-3.1 +endif + ifeq ($(NLLIBNAME),) $(error Cannot find development files for any supported version of libnl) endif LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME)) CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME)) +NLVERSION :=$(shell $(PKG_CONFIG) --print-provides $(NLLIBNAME)) ifeq ($(V),1) Q= @@ -57,20 +75,7 @@ Q=@ NQ=echo endif -all: version_check $(ALL) - -version_check: -ifeq ($(NL3FOUND),Y) -else -ifeq ($(NL2FOUND),Y) -else -ifeq ($(NL1FOUND),Y) -else - $(error No libnl found) -endif -endif -endif - +all: $(ALL) VERSION_OBJS := $(filter-out version.o, $(OBJS))