configure.ac: find libpsl with pkg-config

Find libpsl with pkg-config to avoid static build failures.

Ref: http://autobuild.buildroot.org/results/1fb15e1a99472c403d0d3b1a688902f32e78d002

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Closes #12947
This commit is contained in:
Fabrice Fontaine 2024-02-15 20:59:25 +01:00 committed by Daniel Stenberg
parent 8dbc3c7a6b
commit 9b3f67e267
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 67 additions and 19 deletions

View File

@ -2075,19 +2075,74 @@ dnl **********************************************************************
dnl Check for libpsl dnl Check for libpsl
dnl ********************************************************************** dnl **********************************************************************
AC_ARG_WITH(libpsl, dnl Default to compiler & linker defaults for LIBPSL files & libraries.
AS_HELP_STRING([--without-libpsl], OPT_LIBPSL=off
[disable support for libpsl]), AC_ARG_WITH(libpsl,dnl
with_libpsl=$withval, AS_HELP_STRING([--with-libpsl=PATH],[Where to look for libpsl, PATH points to the LIBPSL installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
with_libpsl=yes) AS_HELP_STRING([--without-libpsl], [disable LIBPSL]),
curl_psl_msg="no (libpsl disabled)" OPT_LIBPSL=$withval)
if test $with_libpsl != "no"; then
AC_SEARCH_LIBS(psl_builtin, psl, if test X"$OPT_LIBPSL" != Xno; then
[curl_psl_msg="enabled"; dnl backup the pre-libpsl variables
AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled]) CLEANLDFLAGS="$LDFLAGS"
], CLEANCPPFLAGS="$CPPFLAGS"
[AC_MSG_ERROR([libpsl was not found]) ] CLEANLIBS="$LIBS"
case "$OPT_LIBPSL" in
yes)
dnl --with-libpsl (without path) used
CURL_CHECK_PKGCONFIG(libpsl)
if test "$PKGCONFIG" != "no" ; then
LIB_PSL=`$PKGCONFIG --libs-only-l libpsl`
LD_PSL=`$PKGCONFIG --libs-only-L libpsl`
CPP_PSL=`$PKGCONFIG --cflags-only-I libpsl`
else
dnl no libpsl pkg-config found
LIB_PSL="-lpsl"
fi
;;
off)
dnl no --with-libpsl option given, just check default places
LIB_PSL="-lpsl"
;;
*)
dnl use the given --with-libpsl spot
LIB_PSL="-lpsl"
PREFIX_PSL=$OPT_LIBPSL
;;
esac
dnl if given with a prefix, we set -L and -I based on that
if test -n "$PREFIX_PSL"; then
LD_PSL=-L${PREFIX_PSL}/lib$libsuff
CPP_PSL=-I${PREFIX_PSL}/include
fi
LDFLAGS="$LDFLAGS $LD_PSL"
CPPFLAGS="$CPPFLAGS $CPP_PSL"
LIBS="$LIB_PSL $LIBS"
AC_CHECK_LIB(psl, psl_builtin,
[
AC_CHECK_HEADERS(libpsl.h,
curl_psl_msg="enabled"
LIBPSL_ENABLED=1
AC_DEFINE(USE_LIBPSL, 1, [if libpsl is in use])
AC_SUBST(USE_LIBPSL, [1])
)
],
dnl not found, revert back to clean variables
LDFLAGS=$CLEANLDFLAGS
CPPFLAGS=$CLEANCPPFLAGS
LIBS=$CLEANLIBS
) )
if test X"$OPT_LIBPSL" != Xoff &&
test "$LIBPSL_ENABLED" != "1"; then
AC_MSG_ERROR([libpsl libs and/or directories were not found where specified!])
fi
fi fi
AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "enabled"]) AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "enabled"])

View File

@ -183,7 +183,6 @@
19.4 Package curl for Windows in a signed installer 19.4 Package curl for Windows in a signed installer
19.5 make configure use --cache-file more and better 19.5 make configure use --cache-file more and better
19.6 build curl with Windows Unicode support 19.6 build curl with Windows Unicode support
19.7 use pkg-config to find libpsl
20. Test suite 20. Test suite
20.1 SSL tunnel 20.1 SSL tunnel
@ -1340,12 +1339,6 @@
See https://github.com/curl/curl/issues/7229 See https://github.com/curl/curl/issues/7229
19.7 use pkg-config to find libpsl
When enabled in configure, libpsl is not found and picked up using details
with pkg-config, thus sometimes missing out on platform specific adjustments.
This should be fixed.
20. Test suite 20. Test suite
20.1 SSL tunnel 20.1 SSL tunnel