]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: fix the Makefile for multiple libnl installations
authorGuido Trentalancia <guido@trentalancia.com>
Sat, 2 Jun 2012 23:46:45 +0000 (01:46 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 6 Jun 2012 08:45:46 +0000 (10:45 +0200)
All different versions of libnl can cohexist on a system
(libnl-1, libnl-2, libnl-3.0, libnl-3.1 and libnl-3.2).
When multiple versions are installed only link against
the highest versioned one, otherwise there might be
unpredictable results (including segmentation faults):

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bd7f7d in genl_unregister () from /usr/lib64/libnl-genl.so.3
(gdb) where

This patch fixes the Makefile to link against only one
of the libraries, the highest version found.

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
Makefile

index 5747b5af720f79ba686bac121fe3e9f0c5082092..ac238be17097690f7221e34a7da9be7013af7077 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,11 +22,19 @@ OBJS = iw.o genl.o event.o info.o phy.o \
 OBJS += sections.o
 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)
+ifneq ($(NL3xFOUND),Y)
+NL31FOUND := $(shell $(PKG_CONFIG) --exact-version=3.1 libnl-3.1 && echo Y)
+ifneq ($(NL31FOUND),Y)
+NL3FOUND := $(shell $(PKG_CONFIG) --atleast-version=3 libnl-3.0 && echo Y)
+ifneq ($(NL3FOUND),Y)
+NL2FOUND := $(shell $(PKG_CONFIG) --atleast-version=2 libnl-2.0 && echo Y)
+ifneq ($(NL2FOUND),Y)
+NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y)
+endif
+endif
+endif
+endif
 
 ifeq ($(NL1FOUND),Y)
 NLLIBNAME = libnl-1