[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] Makefile.flags: use all cflags for crypt and rt checks
From:       Martin Kaiser <lists () kaiser ! cx>
Date:       2021-11-08 16:36:43
Message-ID: 20211108163642.10645-1-lists () kaiser ! cx
[Download RAW message or body]

From: Martin Kaiser <martin@kaiser.cx>

To check if libcrypt and librt are available, we check if we can
compile and link a simple test program.

These checks do not match the actual linking if CONFIG_STATIC is enabled.
For CONFIG_STATIC, CFLAGS_busybox is set to -static. The checks don't use
CFLAGS_busybox and detect a shared libcrypt or librt. If we link busybox
later and we have no static libcrypt or librt, linking will fail.

Update the libcrypt and librt checks to use CFLAGS_busybox.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 Makefile.flags | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.flags b/Makefile.flags
index 667481983..c34356230 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -151,8 +151,8 @@ LDLIBS += m
 # gcc-4.2.1 fails if we try to feed C source on stdin:
 #  echo 'int main(void){return 0;}' | $(CC) $(CFLAGS) -lcrypt -o /dev/null -xc -
 # fall back to using a temp file:
-CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >bb_libtest.c; $(CC) \
$(CFLAGS) -lcrypt -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm \
                bb_libtest.c)
-RT_AVAILABLE    := $(shell echo 'int main(void){return 0;}' >bb_libtest.c; $(CC) \
$(CFLAGS) -lrt    -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm \
bb_libtest.c) +CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' \
>bb_libtest.c; $(CC) $(CFLAGS) $(CFLAGS_busybox) -lcrypt -o /dev/null bb_libtest.c \
> >/dev/null 2>&1 && echo "y"; rm bb_libtest.c)
+RT_AVAILABLE    := $(shell echo 'int main(void){return 0;}' >bb_libtest.c; $(CC) \
$(CFLAGS) $(CFLAGS_busybox) -lrt    -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo \
"y"; rm bb_libtest.c)  ifeq ($(CRYPT_AVAILABLE),y)
 LDLIBS += crypt
 endif
-- 
2.20.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic