aboutsummaryrefslogtreecommitdiff
path: root/Makefile.flags
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-03-10 16:30:00 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2012-03-10 16:30:00 +0100
commitc528917195498e03c8b776bbcfee4f41ea3a818f (patch)
tree6fc9e5e410191fcff45d4a2fdab5941b74139f70 /Makefile.flags
parent79bec06168a561bda99292b7a6be15aeffa4a70d (diff)
downloadbusybox-c528917195498e03c8b776bbcfee4f41ea3a818f.tar.gz
build system: detect missing crypt and drop it from linking
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'Makefile.flags')
-rw-r--r--Makefile.flags15
1 files changed, 8 insertions, 7 deletions
diff --git a/Makefile.flags b/Makefile.flags
index 92aae6fb5..2c826bac1 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -97,13 +97,6 @@ CFLAGS += $(strip $(subst ",,$(CONFIG_EXTRA_CFLAGS)))
#"))
endif
-ifneq ($(CONFIG_CROSS_COMPILER_PREFIX),"arm-linux-androideabi-")
-LDLIBS += m crypt
-else
-# Android libc has no crypt. TODO: make a generic CONFIG_LINK_WITH_CRYPT option?
-LDLIBS += m
-endif
-
# Note: both "" (string consisting of two quote chars) and empty string
# are possible, and should be skipped below.
ifneq ($(subst "",,$(CONFIG_SYSROOT)),)
@@ -111,6 +104,14 @@ CFLAGS += --sysroot=$(CONFIG_SYSROOT)
export SYSROOT=$(CONFIG_SYSROOT)
endif
+# Android has no separate crypt library
+CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' | $(CC) $(CFLAGS) $(1) -lcrypt -o /dev/null -xc - >/dev/null 2>&1 && echo "y")
+ifeq ($(CRYPT_AVAILABLE),y)
+LDLIBS += m crypt
+else
+LDLIBS += m
+endif
+
ifeq ($(CONFIG_PAM),y)
# libpam uses libpthread, so for static builds busybox must be linked to
# libpthread. On some platforms that requires an explicit -lpthread, so