configure: add libngtcp2_crypto_boringssl detection

If OpenSSL is found to be BoringSSL or AWS-LC, and ngtcp2 is requested,
try to detect libngtcp2_crypto_boringssl.

Reported-by: ウさん
Fixes #12724
Closes #12769
This commit is contained in:
Tatsuhiro Tsujikawa 2024-01-24 17:56:24 +09:00 committed by Daniel Stenberg
parent 199c1d720d
commit fe537e21e4
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 58 additions and 1 deletions

View File

@ -2836,7 +2836,7 @@ if test X"$want_tcp2" != Xno; then
fi
if test "x$NGTCP2_ENABLED" = "x1" -a "x$OPENSSL_ENABLED" = "x1"; then
if test "x$NGTCP2_ENABLED" = "x1" -a "x$OPENSSL_ENABLED" = "x1" -a "x$OPENSSL_IS_BORINGSSL" != "x1"; then
dnl backup the pre-ngtcp2_crypto_quictls variables
CLEANLDFLAGS="$LDFLAGS"
CLEANCPPFLAGS="$CPPFLAGS"
@ -2891,6 +2891,61 @@ if test "x$NGTCP2_ENABLED" = "x1" -a "x$OPENSSL_ENABLED" = "x1"; then
fi
fi
if test "x$NGTCP2_ENABLED" = "x1" -a "x$OPENSSL_ENABLED" = "x1" -a "x$OPENSSL_IS_BORINGSSL" = "x1"; then
dnl backup the pre-ngtcp2_crypto_boringssl variables
CLEANLDFLAGS="$LDFLAGS"
CLEANCPPFLAGS="$CPPFLAGS"
CLEANLIBS="$LIBS"
CURL_CHECK_PKGCONFIG(libngtcp2_crypto_boringssl, $want_tcp2_path)
if test "$PKGCONFIG" != "no" ; then
LIB_NGTCP2_CRYPTO_BORINGSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
$PKGCONFIG --libs-only-l libngtcp2_crypto_boringssl`
AC_MSG_NOTICE([-l is $LIB_NGTCP2_CRYPTO_BORINGSSL])
CPP_NGTCP2_CRYPTO_BORINGSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl
$PKGCONFIG --cflags-only-I libngtcp2_crypto_boringssl`
AC_MSG_NOTICE([-I is $CPP_NGTCP2_CRYPTO_BORINGSSL])
LD_NGTCP2_CRYPTO_BORINGSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
$PKGCONFIG --libs-only-L libngtcp2_crypto_boringssl`
AC_MSG_NOTICE([-L is $LD_NGTCP2_CRYPTO_BORINGSSL])
LDFLAGS="$LDFLAGS $LD_NGTCP2_CRYPTO_BORINGSSL"
CPPFLAGS="$CPPFLAGS $CPP_NGTCP2_CRYPTO_BORINGSSL"
LIBS="$LIB_NGTCP2_CRYPTO_BORINGSSL $LIBS"
if test "x$cross_compiling" != "xyes"; then
DIR_NGTCP2_CRYPTO_BORINGSSL=`echo $LD_NGTCP2_CRYPTO_BORINGSSL | $SED -e 's/^-L//'`
fi
AC_CHECK_LIB(ngtcp2_crypto_boringssl, ngtcp2_crypto_recv_client_initial_cb,
[
AC_CHECK_HEADERS(ngtcp2/ngtcp2_crypto.h,
NGTCP2_ENABLED=1
AC_DEFINE(USE_NGTCP2_CRYPTO_BORINGSSL, 1, [if ngtcp2_crypto_boringssl is in use])
AC_SUBST(USE_NGTCP2_CRYPTO_BORINGSSL, [1])
CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGTCP2_CRYPTO_BORINGSSL"
export CURL_LIBRARY_PATH
AC_MSG_NOTICE([Added $DIR_NGTCP2_CRYPTO_BORINGSSL to CURL_LIBRARY_PATH])
)
],
dnl not found, revert back to clean variables
LDFLAGS=$CLEANLDFLAGS
CPPFLAGS=$CLEANCPPFLAGS
LIBS=$CLEANLIBS
)
else
dnl no ngtcp2_crypto_boringssl pkg-config found, deal with it
if test X"$want_tcp2" != Xdefault; then
dnl To avoid link errors, we do not allow --with-ngtcp2 without
dnl a pkgconfig file
AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file.])
fi
fi
fi
if test "x$NGTCP2_ENABLED" = "x1" -a "x$GNUTLS_ENABLED" = "x1"; then
dnl backup the pre-ngtcp2_crypto_gnutls variables
CLEANLDFLAGS="$LDFLAGS"

View File

@ -271,6 +271,7 @@ if test "x$OPT_OPENSSL" != xno; then
],[
AC_MSG_RESULT([yes])
ssl_msg="BoringSSL"
OPENSSL_IS_BORINGSSL=1
],[
AC_MSG_RESULT([no])
])
@ -287,6 +288,7 @@ if test "x$OPT_OPENSSL" != xno; then
],[
AC_MSG_RESULT([yes])
ssl_msg="AWS-LC"
OPENSSL_IS_BORINGSSL=1
],[
AC_MSG_RESULT([no])
])