Skip to contentSkip to conversation

Only compile mnl_utils when HAVE_LIBMNL is defined

PATCH In review David Ahern 3 participants 3 messages Dec 3, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Only compile mnl_utils when HAVE_LIBMNL is defined

From: David Ahern <[email protected]>

New lib/mnl_utils.c fails to compile if libmnl is not installed:

mnl_utils.c:9:10: fatal error: libmnl/libmnl.h: No such file or directory
9 | #include <libmnl/libmnl.h>

Make it dependent on HAVE_LIBMNL.

Fixes 72858c7b77d0 ("lib: Extract from devlink/mnlg a helper, mnlu_socket_open()")
---
 lib/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/Makefile +4 -1
index e37585c6..603ea83e 100644
@@ -13,7 +13,10 @@ UTILOBJ += bpf_libbpf.o
 endif
 endif
 
-NLOBJ=libgenl.o libnetlink.o mnl_utils.o
+NLOBJ=libgenl.o libnetlink.o
+ifeq ($(HAVE_LIBMNL),y)
+NLOBJ += mnl_utils.o
+endif
 
 all: libnetlink.a libutil.a
 
Signature · 1 line
2.27.0
#1 lore raw

lib/Makefile UTILOBJ += bpf_libbpf.o · line 17

Quoted 11 lines · David Ahern
lib/Makefile +2 -1
index e37585c6..603ea83e 100644
@@ -13,7 +13,10 @@ UTILOBJ += bpf_libbpf.o
 endif
 endif
 
-NLOBJ=libgenl.o libnetlink.o mnl_utils.o
+NLOBJ=libgenl.o libnetlink.o
+ifeq ($(HAVE_LIBMNL),y)

This should test HAVE_MNL, not HAVE_LIBMNL.

#2 lore raw
Quoted 11 lines · Petr Machata
Quoted 8 lines · David Ahern
lib/Makefile +0 -0
index e37585c6..603ea83e 100644
@@ -13,7 +13,10 @@ UTILOBJ += bpf_libbpf.o
 endif
 endif
 
Quoted 6 lines

lib/Makefile UTILOBJ += bpf_libbpf.o · line 17

Quoted 3 lines
lib/Makefile +2 -1
-NLOBJ=libgenl.o libnetlink.o mnl_utils.o
+NLOBJ=libgenl.o libnetlink.o
+ifeq ($(HAVE_LIBMNL),y)

This should test HAVE_MNL, not HAVE_LIBMNL.

d'oh. thanks for catching that.