mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 09:21:50 -05:00
configure: fix pthread check with static boringssl
A shared boringssl/OpenSSL library requires -lcrypto only for linking. A static build additionally requires `-ldl -lpthread`. In the latter case `-lpthread` is added to LIBS which prevented `-pthread` from being added to CFLAGS. Clear LIBS to fix linking failures for libtest tests.
This commit is contained in:
parent
f6c6a159f5
commit
06e266e0a5
13
configure.ac
13
configure.ac
@ -1744,6 +1744,8 @@ if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
|
||||
# only set this if pkg-config wasn't used
|
||||
CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
|
||||
fi
|
||||
# Linking previously failed, try extra paths from --with-ssl or pkg-config.
|
||||
# Use a different function name to avoid reusing the earlier cached result.
|
||||
AC_CHECK_LIB(crypto, HMAC_Init_ex,[
|
||||
HAVECRYPTO="yes"
|
||||
LIBS="-lcrypto $LIBS"], [
|
||||
@ -1765,6 +1767,7 @@ if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
dnl ok, so what about both -ldl and -lpthread?
|
||||
dnl This may be necessary for static libraries.
|
||||
|
||||
AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
|
||||
LIBS="$CLEANLIBS -lcrypto -ldl -lpthread"
|
||||
@ -4312,9 +4315,17 @@ if test "$want_pthreads" != "no"; then
|
||||
AC_CHECK_HEADER(pthread.h,
|
||||
[ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
|
||||
save_CFLAGS="$CFLAGS"
|
||||
dnl When statically linking against boringssl, -lpthread is added to LIBS.
|
||||
dnl Make sure to that this does not pass the check below, we really want
|
||||
dnl -pthread in CFLAGS as recommended for GCC. This also ensures that
|
||||
dnl lib1541 and lib1565 tests are built with these options. Otherwise
|
||||
dnl they fail the build since tests/libtest/Makefile.am clears LIBS.
|
||||
save_LIBS="$LIBS"
|
||||
|
||||
dnl first check for function without lib
|
||||
LIBS=
|
||||
dnl Check for libc variants without a separate pthread lib like bionic
|
||||
AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
dnl on HPUX, life is more complicated...
|
||||
case $host in
|
||||
|
Loading…
x
Reference in New Issue
Block a user