build system: remove special-casing for extra libs

It is not reliable (tried on three systems, multiple problems).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2015-10-12 03:12:17 +02:00
parent 2dbbf823ef
commit c8e5ead03a
2 changed files with 11 additions and 22 deletions

View File

@ -514,14 +514,6 @@ config PIE
Most people will leave this set to 'N'. Most people will leave this set to 'N'.
config LINK_WITH_PTHREAD
bool "Link with pthread library"
default n
help
On some systems, some libraries (such as crypt) also require pthread.
Select this only if your build otherwise fails.
config NOMMU config NOMMU
bool "Force NOMMU build" bool "Force NOMMU build"
default n default n

View File

@ -129,22 +129,19 @@ else
LDLIBS += m LDLIBS += m
endif endif
ifeq ($(CONFIG_LINK_WITH_PTHREAD),y) # libpam may use libpthread, libdl and/or libaudit.
PTHREAD_AVAILABLE := $(shell echo 'int main(void){return 0;}' >pthreadtest.c; $(CC) $(CFLAGS) -lpthread -o /dev/null pthreadtest.c >/dev/null 2>&1 && echo "y"; rm pthreadtest.c) # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
ifeq ($(PTHREAD_AVAILABLE),y) # However, on *other platforms* it fails when some of those flags
LDLIBS += pthread # given needlessly. On some systems, crypt needs pthread.
endif #
endif # I even had a system where a runtime test for pthread
# (similar to CRYPT_AVAILABLE test above) was not reliable.
#
# Do not propagate this mess by adding libraries to CONFIG_PAM/CRYPT_AVAILABLE blocks.
# Add libraries you need to CONFIG_EXTRA_LDLIBS instead.
ifeq ($(CONFIG_PAM),y) ifeq ($(CONFIG_PAM),y)
# libpam uses libpthread, libdl and libaudit, so for static builds busybox LDLIBS += pam pam_misc
# must be linked to libpthread, libdl and libaudit. On some platforms that
# requires an explicit -lpthread, -ldl and -laudit, so it should be in
# LDLIBS. For non-static builds, scripts/trylink will take care of removing
# these flags if possible. (Not bothering to check CONFIG_STATIC because
# even in a non-static build it could be that the only libpam available is
# libpam.a, so -lpthread & Co. could still be needed.)
LDLIBS += pam pam_misc pthread dl audit
endif endif
ifeq ($(CONFIG_SELINUX),y) ifeq ($(CONFIG_SELINUX),y)