diff mbox series

[iproute2-next] Only compile mnl_utils when HAVE_LIBMNL is defined

Message ID 20201203041101.11116-1-dsahern@kernel.org
State New
Headers show
Series [iproute2-next] Only compile mnl_utils when HAVE_LIBMNL is defined | expand

Commit Message

David Ahern Dec. 3, 2020, 4:11 a.m. UTC
From: David Ahern <dsahern@gmail.com>

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()")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
 lib/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Petr Machata Dec. 3, 2020, 9:45 p.m. UTC | #1
David Ahern <dsahern@kernel.org> writes:

> diff --git a/lib/Makefile b/lib/Makefile
> index e37585c6..603ea83e 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -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.
diff mbox series

Patch

diff --git a/lib/Makefile b/lib/Makefile
index e37585c6..603ea83e 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -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