Skip to content

Commit 971fe81

Browse files
committed
build: fix openssl detection for cross builds
Make sure that the detected openssl successfully links before enabling support.
1 parent 74ad63a commit 971fe81

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build-aux/m4/bitcoin_secp.m4

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ AC_DEFUN([SECP_OPENSSL_CHECK],[
3030
if test x"$use_pkgconfig" = x"yes"; then
3131
: #NOP
3232
m4_ifdef([PKG_CHECK_MODULES],[
33-
PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes; AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])],[has_libcrypto=no])
34-
: #NOP
33+
PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes],[has_libcrypto=no])
34+
if test x"$has_libcrypto" = x"yes"; then
35+
TEMP_LIBS="$LIBS"
36+
LIBS="$LIBS $CRYPTO_LIBS"
37+
AC_CHECK_LIB(crypto, main,[AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])],[has_libcrypto=no])
38+
LIBS="$TEMP_LIBS"
39+
fi
3540
])
3641
else
3742
AC_CHECK_HEADER(openssl/crypto.h,[AC_CHECK_LIB(crypto, main,[has_libcrypto=yes; CRYPTO_LIBS=-lcrypto; AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])]

0 commit comments

Comments
 (0)