configure: look for libngtcp2_crypto_libressl first

configure only fall back to quictls when libressl crypto was not found
This commit is contained in:
Viktor Szakats 2025-08-23 11:53:11 +02:00
parent b6056c2ad5
commit 51ecba2b06
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 61 additions and 1 deletions

View file

@ -3241,7 +3241,66 @@ if test X"$want_tcp2" != Xno; then
fi
fi
if test "x$USE_NGTCP2" = "x1" -a "x$OPENSSL_ENABLED" = "x1" -a \
if test "x$USE_NGTCP2" = "x1" -a "x$OPENSSL_ENABLED" = "x1" -a "$HAVE_LIBRESSL" = "1"; then
dnl backup the pre-ngtcp2_crypto_libressl variables
CLEANLDFLAGS="$LDFLAGS"
CLEANLDFLAGSPC="$LDFLAGSPC"
CLEANCPPFLAGS="$CPPFLAGS"
CLEANLIBS="$LIBS"
CURL_CHECK_PKGCONFIG(libngtcp2_crypto_libressl, $want_tcp2_path)
if test "$PKGCONFIG" != "no"; then
LIB_NGTCP2_CRYPTO_LIBRESSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
$PKGCONFIG --libs-only-l libngtcp2_crypto_libressl`
AC_MSG_NOTICE([-l is $LIB_NGTCP2_CRYPTO_LIBRESSL])
CPP_NGTCP2_CRYPTO_LIBRESSL=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl
$PKGCONFIG --cflags-only-I libngtcp2_crypto_libressl`
AC_MSG_NOTICE([-I is $CPP_NGTCP2_CRYPTO_LIBRESSL])
LD_NGTCP2_CRYPTO_LIBRESSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
$PKGCONFIG --libs-only-L libngtcp2_crypto_libressl`
AC_MSG_NOTICE([-L is $LD_NGTCP2_CRYPTO_LIBRESSL])
LDFLAGS="$LDFLAGS $LD_NGTCP2_CRYPTO_LIBRESSL"
LDFLAGSPC="$LDFLAGSPC $LD_NGTCP2_CRYPTO_LIBRESSL"
CPPFLAGS="$CPPFLAGS $CPP_NGTCP2_CRYPTO_LIBRESSL"
LIBS="$LIB_NGTCP2_CRYPTO_LIBRESSL $LIBS"
if test "x$cross_compiling" != "xyes"; then
DIR_NGTCP2_CRYPTO_LIBRESSL=`echo $LD_NGTCP2_CRYPTO_LIBRESSL | $SED -e 's/^-L//'`
fi
AC_CHECK_LIB(ngtcp2_crypto_libressl, ngtcp2_crypto_recv_client_initial_cb,
[
AC_CHECK_HEADERS(ngtcp2/ngtcp2_crypto.h,
USE_NGTCP2=1
CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGTCP2_CRYPTO_LIBRESSL"
export CURL_LIBRARY_PATH
AC_MSG_NOTICE([Added $DIR_NGTCP2_CRYPTO_LIBRESSL to CURL_LIBRARY_PATH])
LIBCURL_PC_REQUIRES_PRIVATE="$LIBCURL_PC_REQUIRES_PRIVATE libngtcp2_crypto_libressl"
)
],
dnl not found, revert back to clean variables
LDFLAGS=$CLEANLDFLAGS
LDFLAGSPC=$CLEANLDFLAGSPC
CPPFLAGS=$CLEANCPPFLAGS
LIBS=$CLEANLIBS
)
else
dnl no ngtcp2_crypto_libressl 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_WARN([--with-ngtcp2 was specified but could not find ngtcp2_crypto_libressl pkg-config file.])
dnl Pretend to be quictls to fall back to using ngtcp2_crypto_quictls
fi
HAVE_LIBRESSL=0
fi
fi
if test "x$USE_NGTCP2" = "x1" -a "x$OPENSSL_ENABLED" = "x1" -a "$HAVE_LIBRESSL" != "1" -a \
"x$OPENSSL_IS_BORINGSSL" != "x1" -a "x$OPENSSL_QUIC_API2" != "x1"; then
dnl backup the pre-ngtcp2_crypto_quictls variables
CLEANLDFLAGS="$LDFLAGS"

View file

@ -292,6 +292,7 @@ if test "x$OPT_OPENSSL" != xno; then
],[
AC_MSG_RESULT([yes])
ssl_msg="LibreSSL"
HAVE_LIBRESSL=1
],[
AC_MSG_RESULT([no])
])