summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2020-05-20 23:36:21 +0200
committerPeter Wu <peter@lekensteyn.nl>2020-05-22 21:10:07 +0200
commit06e266e0a5c877e692eab8a653a1ea47adfae43e (patch)
tree940b7e0a8df254c09c6af872b151b851727bb854 /configure.ac
parentf6c6a159f52315b018f883fde177463aaeac4749 (diff)
downloadcurl-06e266e0a5c877e692eab8a653a1ea47adfae43e.tar.gz
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.
Diffstat (limited to 'configure.ac')
-rwxr-xr-xconfigure.ac15
1 files changed, 13 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 9e1fdbeba..0c1decc72 100755
--- a/configure.ac
+++ b/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 first check for function without lib
+ 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"
+
+ 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