autotools: detect and link brotlicommon library for brotli

`brotlicommon` is necessary when linking brotli statically.
E.g. on Alpine Linux with `PKG_CONFIG='pkg-config --static'`.

It also syncs brotli libs listed in `libcurl.pc` and `curl-config` with
those generated by cmake, which already listed `brotlicommon` there.

Also:
- remove workaround from GHA/configure-vs-cmake CI jobs.

Ref: 69cda1b704
Follow-up to f2adb3b6d7 #15431
Reported-by: Christopher Boyd
Fixes #17678
Closes #17723
This commit is contained in:
Viktor Szakats 2025-06-23 19:09:30 +02:00
parent 6c85579c84
commit 4914c2177e
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 13 additions and 6 deletions

View file

@ -44,10 +44,10 @@ jobs:
run: |
autoreconf -fi
export PKG_CONFIG_DEBUG_SPEW=1
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --without-brotli
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl
- name: 'run cmake'
run: cmake -B bld-cm -DCURL_WERROR=ON -DCURL_USE_LIBPSL=OFF -DCURL_BROTLI=OFF
run: cmake -B bld-cm -DCURL_WERROR=ON -DCURL_USE_LIBPSL=OFF
- name: 'configure log'
run: cat bld-am/config.log 2>/dev/null || true
@ -90,13 +90,12 @@ jobs:
run: |
autoreconf -fi
export PKG_CONFIG_DEBUG_SPEW=1
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --disable-ldap --with-zstd
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --disable-ldap --with-brotli --with-zstd
- name: 'run cmake'
run: |
cmake -B bld-cm -DCURL_WERROR=ON -DCURL_USE_LIBPSL=OFF -DCURL_DISABLE_LDAP=ON \
-DCMAKE_C_COMPILER_TARGET="$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
-DCURL_BROTLI=OFF \
-DCURL_USE_LIBSSH2=OFF
- name: 'configure log'

View file

@ -1442,9 +1442,17 @@ if test X"$OPT_BROTLI" != Xno; then
LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec`
CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec`
version=`$PKGCONFIG --modversion libbrotlidec`
DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/^-L//'`
fi
CURL_CHECK_PKGCONFIG(libbrotlicommon)
if test "$PKGCONFIG" != "no"; then
LIB_BROTLI="$LIB_BROTLI `$PKGCONFIG --libs-only-l libbrotlicommon`"
LD_BROTLI="$LD_BROTLI `$PKGCONFIG --libs-only-L libbrotlicommon`"
CPP_BROTLI="$CPP_BROTLI `$PKGCONFIG --cflags-only-I libbrotlicommon`"
fi
DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/^-L//'`
;;
off)
dnl no --with-brotli option given, just check default places
@ -1457,7 +1465,7 @@ if test X"$OPT_BROTLI" != Xno; then
dnl if given with a prefix, we set -L and -I based on that
if test -n "$PREFIX_BROTLI"; then
LIB_BROTLI="-lbrotlidec"
LIB_BROTLI="-lbrotlidec -lbrotlicommon"
LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
CPP_BROTLI=-I${PREFIX_BROTLI}/include
DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff