* [PATCH] ipvsadm: detect LIBS and CFLAGS for libnl versions
@ 2013-08-09 16:00 Jesper Dangaard Brouer
2013-08-09 16:08 ` Daniel Borkmann
0 siblings, 1 reply; 5+ messages in thread
From: Jesper Dangaard Brouer @ 2013-08-09 16:00 UTC (permalink / raw)
To: Simon Horman
Cc: Wensong Zhang, Thomas Graf, Ryan O'Hara, Julian Anastasov,
lvs-devel, Daniel Borkmann
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>
---
Makefile | 8 +++++++-
libipvs/Makefile | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 6e36d79..4cd59f5 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 "-ln"; 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 \
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ipvsadm: detect LIBS and CFLAGS for libnl versions
2013-08-09 16:00 [PATCH] ipvsadm: detect LIBS and CFLAGS for libnl versions Jesper Dangaard Brouer
@ 2013-08-09 16:08 ` Daniel Borkmann
2013-08-09 16:28 ` [PATCH v2] " Jesper Dangaard Brouer
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2013-08-09 16:08 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Simon Horman, Wensong Zhang, Thomas Graf, Ryan O'Hara,
Julian Anastasov, lvs-devel
On 08/09/2013 06:00 PM, Jesper Dangaard Brouer wrote:
> 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>
> ---
> Makefile | 8 +++++++-
> libipvs/Makefile | 7 +++++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 6e36d79..4cd59f5 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 "-ln"; fi)
-lnl
Otherwise looks good. Thanks Jesper!
> 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 \
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] ipvsadm: detect LIBS and CFLAGS for libnl versions
2013-08-09 16:08 ` Daniel Borkmann
@ 2013-08-09 16:28 ` Jesper Dangaard Brouer
2013-08-09 16:33 ` Daniel Borkmann
0 siblings, 1 reply; 5+ messages in thread
From: Jesper Dangaard Brouer @ 2013-08-09 16:28 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Jesper Dangaard Brouer, Simon Horman, Wensong Zhang, Thomas Graf,
Ryan O'Hara, Julian Anastasov, lvs-devel
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>
---
V2: Fix small bug noticed by Daniel, fall-through libs case missed a "l"
Makefile | 8 +++++++-
libipvs/Makefile | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
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 \
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ipvsadm: detect LIBS and CFLAGS for libnl versions
2013-08-09 16:28 ` [PATCH v2] " Jesper Dangaard Brouer
@ 2013-08-09 16:33 ` Daniel Borkmann
2013-08-13 2:17 ` Simon Horman
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2013-08-09 16:33 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Simon Horman, Wensong Zhang, Thomas Graf, Ryan O'Hara,
Julian Anastasov, lvs-devel
On 08/09/2013 06:28 PM, Jesper Dangaard Brouer wrote:
> 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>
> ---
> V2: Fix small bug noticed by Daniel, fall-through libs case missed a "l"
>
> Makefile | 8 +++++++-
> libipvs/Makefile | 7 +++++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
Acked-by: Daniel Borkmann <dborkman@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ipvsadm: detect LIBS and CFLAGS for libnl versions
2013-08-09 16:33 ` Daniel Borkmann
@ 2013-08-13 2:17 ` Simon Horman
0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-08-13 2:17 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Jesper Dangaard Brouer, Wensong Zhang, Thomas Graf,
Ryan O'Hara, Julian Anastasov, lvs-devel
On Fri, Aug 09, 2013 at 06:33:29PM +0200, Daniel Borkmann wrote:
> On 08/09/2013 06:28 PM, Jesper Dangaard Brouer wrote:
> >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>
> >---
> >V2: Fix small bug noticed by Daniel, fall-through libs case missed a "l"
> >
> > Makefile | 8 +++++++-
> > libipvs/Makefile | 7 +++++++
> > 2 files changed, 14 insertions(+), 1 deletion(-)
>
> Acked-by: Daniel Borkmann <dborkman@redhat.com>
Thanks, I will queue this up.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-13 2:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-09 16:00 [PATCH] ipvsadm: detect LIBS and CFLAGS for libnl versions Jesper Dangaard Brouer
2013-08-09 16:08 ` Daniel Borkmann
2013-08-09 16:28 ` [PATCH v2] " Jesper Dangaard Brouer
2013-08-09 16:33 ` Daniel Borkmann
2013-08-13 2:17 ` Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.