]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
configure: improve nettle, gmp, and hogweed soname detection
authorVitezslav Cizek <vcizek@suse.com>
Tue, 9 Jun 2020 11:54:04 +0000 (13:54 +0200)
committerVitezslav Cizek <vcizek@suse.com>
Tue, 9 Jun 2020 12:57:14 +0000 (14:57 +0200)
Some linkers might optimize away the libraries passed on the
command line if they aren't actually needed, such as gnu ld with
--as-needed.
The ldd output then won't list the shared libraries and the
detection will fail.
Make sure nettle and others are really used.

Signed-off-by: Vitezslav Cizek <vcizek@suse.com>
configure.ac

index e4ca66aecb390289cbf39e0e5aa81476342d4810..ccbe4e563383f6ea4df9fc01b1d70fcd76c8ba2d 100644 (file)
@@ -741,7 +741,10 @@ LIBS=$save_LIBS
 save_LIBS=$LIBS
 LIBS="$LIBS $GMP_LIBS"
 AC_MSG_CHECKING([gmp soname])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+               #include <gmp.h>],[
+               mpz_t n;
+               mpz_init(n);])],
        [gmp_so=`(eval "$LDDPROG conftest$EXEEXT $LDDPOSTPROC") | grep '^libgmp\.so'`],
        [gmp_so=none])
 if test -z "$gmp_so"; then
@@ -754,7 +757,10 @@ LIBS=$save_LIBS
 save_LIBS=$LIBS
 LIBS="$LIBS $NETTLE_LIBS"
 AC_MSG_CHECKING([nettle soname])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+               #include <nettle/sha2.h>],[
+               struct sha256_ctx ctx;
+               sha256_init(&ctx);])],
        [nettle_so=`(eval "$LDDPROG conftest$EXEEXT $LDDPOSTPROC") | grep '^libnettle\.so'`],
        [nettle_so=none])
 if test -z "$nettle_so"; then
@@ -767,7 +773,10 @@ LIBS=$save_LIBS
 save_LIBS=$LIBS
 LIBS="$LIBS $HOGWEED_LIBS"
 AC_MSG_CHECKING([hogweed soname])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+               #include <nettle/rsa.h>],[
+               struct rsa_private_key priv;
+               nettle_rsa_private_key_init(&priv);])],
        [hogweed_so=`(eval "$LDDPROG conftest$EXEEXT $LDDPOSTPROC") | grep '^libhogweed\.so'`],
        [hogweed_so=none])
 if test -z "$hogweed_so"; then