curl/m4
Viktor Szakats d511ec8b0a
build: omit certain deps from libcurl.pc unless found via pkg-config
The idea of linking dependencies found to `libcurl.pc` turns out not
to work in practice in some cases.

Specifically: gss, ldap, mbedtls, libmsh3, rustls

A `.pc` may not work or be missing for a couple of reasons:
- not all build methods generate it: mbedTLS, Rustls
- generated file is broken: msh3
  Ref: https://github.com/nibanks/msh3/pull/225
- installed package flavour isn't shipping with one:
  FreeBSD GSS, OmniOS LDAP, macOS LDAP

The effect of such issues shall be subtle in theory, because
`libcurl.pc` normally lists these dependencies in the `Requires.private`
section meant for static linking. But, e.g. `pkg-config --exists`
requires these to be present, and builds sometimes use this check
regardless of build type. This bug is not present in `pkgconf`; it only
checks for them when `--static` is also passed.

Fix these by adding affected `.pc` references to `libcurl.pc` only when
we detected the dependency via `pkg-config`.

There are a few side-effects of this solution:
- references are never added for dependencies where curl doesn't
  implement `pkg-config` detection. These are:
  - autotools: ldap, mbedtls, msh3
  - cmake: ldap (pending #15273)
- generated `libcurl.pc` depends on the build-time environment.
- generated `libcurl.pc` depends on curl build tool (cmake, autotools).
- generated `libcurl.pc` depends on curl build implementation details.

Make an exception for GNU GSS, where I blindly guess that `gss.pc` is
always available, as no issues were reported.

Other, not mentioned, dependencies continue to be added regardless
of the detection method.

Reported-by: Harmen Stoppels, Thomas, Daniel Engberg, Andy Fiddaman
Fixes #15469
Fixes #15507
Fixes #15535
Fixes https://github.com/curl/curl/pull/15163#issuecomment-2473358444
Closes #15573
2024-11-14 22:38:47 +01:00
..
.gitignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-amissl.m4 configure: delete unused HAVE_OPENSSL3 macro 2024-08-26 11:01:11 +02:00
curl-bearssl.m4 configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
curl-compilers.m4 tidy-up: whitespace, fix CI spacecheck for docs 2024-10-30 23:15:28 +01:00
curl-confopts.m4 configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
curl-functions.m4 curl_addrinfo: support operating systems with only getaddrinfo(3) 2024-11-02 22:28:59 +01:00
curl-gnutls.m4 configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
curl-mbedtls.m4 build: omit certain deps from libcurl.pc unless found via pkg-config 2024-11-14 22:38:47 +01:00
curl-openssl.m4 configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
curl-override.m4 tidy-up: indent, whitespace, #error in make files 2024-09-22 09:51:15 +02:00
curl-reentrant.m4 tidy-up: indentation in autotools sources 2024-09-25 09:10:45 +02:00
curl-rustls.m4 build: omit certain deps from libcurl.pc unless found via pkg-config 2024-11-14 22:38:47 +01:00
curl-schannel.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-sectransp.m4 configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
curl-sysconfig.m4 configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
curl-wolfssl.m4 configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
xc-am-iface.m4 misc: cleanup after removing years from copyright 2024-07-30 14:11:48 +02:00
xc-cc-check.m4 misc: cleanup after removing years from copyright 2024-07-30 14:11:48 +02:00
xc-lt-iface.m4 misc: cleanup after removing years from copyright 2024-07-30 14:11:48 +02:00
xc-val-flgs.m4 configure: fix indentation more 2024-08-26 11:14:01 +02:00
zz40-xc-ovr.m4 misc: cleanup after removing years from copyright 2024-07-30 14:11:48 +02:00
zz50-xc-ovr.m4 misc: cleanup after removing years from copyright 2024-07-30 14:11:48 +02:00
zz60-xc-ovr.m4 misc: cleanup after removing years from copyright 2024-07-30 14:11:48 +02:00