curl-curl/.github
Viktor Szakats 38107d3354
configure: fix --with-ngtcp2=<path> option for crypto libs
ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files.
This broke certain build cases in curl, because configure was is
querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the
directory specified via `--with-*=` options, including `--with-ngtcp2=`.
Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore
system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no
longer find its indirect dependencies, if those were present at system
locations (where they typically are). Another fallout was BoringSSL,
because it does not provide `openssl.pc` on its own, and successful
detection relied on finding a non-BoringSSL copy, typically at a system
location (also fixed in ngtcp2 main branch).

Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and
instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`.
This ensures to pick up any dependent modules from system locations.

Note the side-effect is that potentially undesired modules may be
detected this way from system locations, i.e. it makes this particular
detection less "hermetic" than the rest used in curl configure.

(Configurations using a bare `--with-ngtcp2` with no path were not
affected, and served as a workaround before this patch. It remains a
valid way of configuration after.)

Both `pkgconf` and `pkg-config` use this logic to calculate their search
directory list:
```pseudo
search = {}
if PKG_CONFIG_PATH is set
  search += PKG_CONFIG_PATH
endif
if PKG_CONFIG_LIBDIR is set (even if empty)
  search += PKG_CONFIG_LIBDIR
else
  search += built-in-pkg-config-dirs
endif
```

Refs:
https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`)
c0874ce824
https://man.archlinux.org/man/pkgconf.1.en
https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html
https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html
10e27fd63c

Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041
Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664
Follow-up to 04d90b5deb #20931
Follow-up to 3c64ffaff4 #18415 #18188
Follow-up to 99500660af #18028 #18022

Closes #20920
2026-03-17 14:37:53 +01:00
..
ISSUE_TEMPLATE VULN-DISCLOSURE-POLICY.md: use hackerone 2026-02-26 07:57:19 +01:00
scripts GHA: make typos ignore RELEASE-NOTES 2026-03-13 13:12:21 +01:00
workflows configure: fix --with-ngtcp2=<path> option for crypto libs 2026-03-17 14:37:53 +01:00
CODEOWNERS CI: add whitespace checker 2024-06-27 13:33:30 +02:00
CONTRIBUTING.md tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
dependabot.yml GHA/dependabot: tidy-ups 2025-11-02 17:45:50 +01:00
FUNDING.yml copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
labeler.yml tidy-up: merge root packages directory into projects 2026-01-12 23:49:35 +01:00
lock.yml copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
stale.yml badwords: fix issues found in scripts and other files 2025-11-17 17:18:07 +01:00