configure: do not echo most inherited LDFLAGS to config files

`libcurl.pc` `Libs.private` (since 8.11.0, and in `Libs` before 7.20.0)
and `curl-config` `--static-libs` (since 7.17.1, and in `Libs` between
7.7.2-7.25.0). This included all flags inherited from the environment,
in addition to those coming from dependency detections.

To avoid spilling all linker flags inherited from the environment to
the libcurl config files, this patch omits them all, except `-L`, `-F`,
`--library-path=` and `-framework` options, which are still passed.
The rationale for the exceptions is that `LIBS` is passed as-is, and
`LDFLAGS`, `LIBS` are the canonical way to pass custom libs options
to a build. `LIBS` may not work without a matching custom libpath.

This brings autotools behaviour closer to cmake, and `curl-config`
closer to `libcurl.pc`.

Follow-up to 9f56bb608e #14681
Follow-up to 4c8adc8fee
Reported-by: Peter Marko
Fixes #15533
Closes #15550
This commit is contained in:
Viktor Szakats 2024-11-11 13:21:58 +01:00
parent 2638570241
commit e244d50064
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
14 changed files with 116 additions and 11 deletions

View file

@ -173,7 +173,7 @@ while test "$#" -gt 0; do
--static-libs)
if test 'X@ENABLE_STATIC@' != 'Xno'; then
echo "@libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_PC_LIBS_PRIVATE@"
echo "@libdir@/libcurl.@libext@ @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@"
else
echo 'curl was built with static libraries disabled' >&2
exit 1