Skip to content

Commit 40420d4

Browse files
flichtenheldcron2
authored andcommitted
configure: Try to use pkg-config to detect mbedTLS
mbedTLS does not seem to have pkg-config support on e.g. Debian/Ubuntu, so we definitely need to keep the fallback check as well. Change-Id: I5d0da76018e874cda5dbab9202a2b817ad5e4692 Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Yuriy Darnobyt <[email protected]> Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg29090.html Signed-off-by: Gert Doering <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1422 (cherry picked from commit c829f57) Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg34911.html Signed-off-by: Gert Doering <[email protected]>
1 parent 09c35f8 commit 40420d4

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

configure.ac

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,14 +1010,21 @@ elif test "${with_crypto_library}" = "mbedtls"; then
10101010

10111011
if test -z "${MBEDTLS_CFLAGS}" -a -z "${MBEDTLS_LIBS}"; then
10121012
# if the user did not explicitly specify flags, try to autodetect
1013-
LIBS="${LIBS} -lmbedtls -lmbedx509 -lmbedcrypto"
1014-
AC_CHECK_LIB(
1015-
[mbedtls],
1016-
[mbedtls_ssl_init],
1017-
[MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"],
1018-
[AC_MSG_ERROR([Could not find mbed TLS.])],
1019-
[${PKCS11_HELPER_LIBS}]
1013+
PKG_CHECK_MODULES([MBEDTLS],
1014+
[mbedtls >= 2.0.0 mbedx509 >= 2.0.0 mbedcrypto >= 2.0.0],
1015+
[have_mbedtls="yes"],
1016+
[LIBS="${LIBS} -lmbedtls -lmbedx509 -lmbedcrypto"]
10201017
)
1018+
# mbedtls might not have pkgconfig integration, so try manually
1019+
if test "${have_mbedtls}" != "yes"; then
1020+
AC_CHECK_LIB(
1021+
[mbedtls],
1022+
[mbedtls_ssl_init],
1023+
[MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"],
1024+
[AC_MSG_ERROR([Could not find mbed TLS.])],
1025+
[${PKCS11_HELPER_LIBS}]
1026+
)
1027+
fi
10211028
fi
10221029

10231030
CFLAGS="${MBEDTLS_CFLAGS} ${PKCS11_HELPER_CFLAGS} ${CFLAGS}"

0 commit comments

Comments
 (0)