diff --git a/.github/workflows/http3-linux.yml b/.github/workflows/http3-linux.yml index 732ca11550..3f21c91507 100644 --- a/.github/workflows/http3-linux.yml +++ b/.github/workflows/http3-linux.yml @@ -346,6 +346,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 env: + CURL_TRACE_PKG_CONFIG: '1' MATRIX_BUILD: ${{ matrix.build.generate && 'cmake' || 'autotools' }} MATRIX_INSTALL_PACKAGES: '${{ matrix.build.install_packages }}' strategy: diff --git a/acinclude.m4 b/acinclude.m4 index 646074fb65..ed48a6eb3a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1326,6 +1326,29 @@ AC_DEFUN([CURL_EXPORT_PCDIR], [ fi ]) +dnl CURL_TRACE_PCDIR ($module, [$pcdir]) +dnl ------------------------ +dnl show pkg-config module lookup details, along with a detailed errors +dnl message in case of failure. Supports both pkg-config and pkgconf. +dnl + +AC_DEFUN([CURL_TRACE_PCDIR], [ + dnl Example pkgconf line: + dnl libpkgconf/pkg.c:746 [pkgconf_pkg_t *pkgconf_pkg_try_specific_path(pkgconf_client_t *, [...]*)]: trying path: /usr/local/lib/pkgconfig for libngtcp2_crypto_gnutls + dnl Rest of strings are for catching classic pkg-config lines. + trc=`CURL_EXPORT_PCDIR([$2]) dnl + $PKGCONFIG --exists --debug $1 2>&1 | $EGREP '(trying path:|Adding directory|Looking for|Scanning directory|Cannot open directory)' | $SED 's/^.*trying path:/trying path:/'` + msg=`CURL_EXPORT_PCDIR([$2]) dnl + $PKGCONFIG --exists --print-errors $1 2>&1` + if test -n "$msg"; then + trc=`echo "$trc"; echo '==== error:'; echo "$msg"` + fi + AC_MSG_NOTICE([pkg-config --exists $1 trace: +---- begin +${trc} +---- end]) +]) + dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir]) dnl ------------------------ dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the @@ -1354,10 +1377,16 @@ AC_DEFUN([CURL_CHECK_PKGCONFIG], [ if test -z "$itexists"; then dnl pkg-config does not have info about the given module! set the dnl variable to 'no' - PKGCONFIG="no" AC_MSG_RESULT([no]) + if test -n "$CURL_TRACE_PKG_CONFIG$CURL_CI"; then + CURL_TRACE_PCDIR([$1], [$2]) + fi + PKGCONFIG="no" else AC_MSG_RESULT([found]) + if test -n "$CURL_TRACE_PKG_CONFIG"; then + CURL_TRACE_PCDIR([$1], [$2]) + fi fi fi ]) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index ee567441bd..ef3407de3e 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -135,6 +135,10 @@ curl can be built to use a whole range of libraries to provide various useful services, and configure tries to auto-detect a decent default. If you want to alter it, you can select how to deal with each individual library. +To debug the build itself, you can set the environment variable +`CURL_TRACE_PKG_CONFIG` to a non-empty value to enable detailed trace +information and verbose errors from `pkg-config` module detection invocations. + ## Select TLS backend These options are provided to select the TLS backend to use.