aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <jbrouer@redhat.com>2013-08-09 18:28:53 +0200
committerSimon Horman <horms@verge.net.au>2013-08-13 12:16:24 +1000
commit175a6f8480116d1b25297832dbe9d285350b369e (patch)
tree42dbea4e17501ddd496d7d1a73a7d95e3ff785f9
parentca23ad37d5c7b1b393afa0f72461d81ee884e059 (diff)
downloadipvsadm-175a6f8480116d1b25297832dbe9d285350b369e.tar.gz
ipvsadm: detect LIBS and CFLAGS for libnl versions
Automated detecting of LIBS and CFLAGS for different versions of libnl via using pkg-config, in the Makefiles. This should make it easier to compile on different distributions. Detecting in prioritized order from the most recent version, and only the first detected lib is used. Thus, supporting several libnl version being installed on the same system. Only tested with libnl-1 and libnl-3.0, but also adding support for libnl-2.0. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--Makefile8
-rw-r--r--libipvs/Makefile7
2 files changed, 14 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 6e36d79..91a2991 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,13 @@ RPMBUILD = $(shell \
OBJS = ipvsadm.o config_stream.o dynamic_array.o
LIBS = -lpopt
ifneq (0,$(HAVE_NL))
-LIBS += -lnl
+LIBS += $(shell \
+ if which pkg-config > /dev/null 2>&1; then \
+ if pkg-config --libs libnl-genl-3.0 2> /dev/null; then :;\
+ elif pkg-config --libs libnl-2.0 2> /dev/null; then :;\
+ elif pkg-config --libs libnl-1 2> /dev/null; then :;\
+ fi; \
+ else echo "-lnl"; fi)
endif
DEFINES = -DVERSION=\"$(VERSION)\" -DSCHEDULERS=\"$(SCHEDULERS)\" \
-DPE_LIST=\"$(PE_LIST)\" $(POPT_DEFINE)
diff --git a/libipvs/Makefile b/libipvs/Makefile
index eafc3e5..f845c8b 100644
--- a/libipvs/Makefile
+++ b/libipvs/Makefile
@@ -4,6 +4,13 @@ CC = gcc
CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -fPIC
ifneq (0,$(HAVE_NL))
CFLAGS += -DLIBIPVS_USE_NL
+CFLAGS += $(shell \
+ if which pkg-config > /dev/null 2>&1; then \
+ if pkg-config --cflags libnl-3.0 2> /dev/null; then :; \
+ elif pkg-config --cflags libnl-2.0 2> /dev/null; then :; \
+ elif pkg-config --cflags libnl-1 2> /dev/null; then :; \
+ fi; \
+ fi)
endif
INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \