[PATCH v2] Makefile.flags: fix the OS detection for libresolv

Martin Kaiser lists at kaiser.cx
Fri Jan 8 11:24:28 UTC 2021


From: Martin Kaiser <martin at kaiser.cx>

054493350 ("Do not add -lresolv on non-Linux systems") adds a condition
to link with libresolv only on linux systems.

The check requires that CONFIG_UNAME_OSNAME equals Linux. This is too
strict. By default, CONFIG_UNAME_OSNAME is the output of uname -o. For most
linux systems, uname -o returns "GNU/Linux".

Modify the check to succeed if CONFIG_UNAME_OSNAME contains the word Linux.

Use findstring to search for the substring (this might be a GNU Make
extension, but it's used by busybox in other places as well).

Fixes: 054493350 ("Do not add -lresolv on non-Linux systems")
Signed-off-by: Martin Kaiser <martin at kaiser.cx>
---
changes in v2
- findstring must be inside $(...)
- fix the order ot the two parameters

 Makefile.flags | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.flags b/Makefile.flags
index 5673bc48a..3768eceb9 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -181,7 +181,7 @@ LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%
 endif
 
 ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
-ifeq ($(CONFIG_UNAME_OSNAME),Linux)
+ifneq (,$(findstring Linux,$(CONFIG_UNAME_OSNAME)))
 LDLIBS += resolv
 endif
 endif
-- 
2.20.1



More information about the busybox mailing list