Hi Nilesh,

On Tue, Sep 23, 2025 at 03:34:01AM +0530, Nilesh Patra wrote:
> +--- a/configure
> ++++ b/configure
> +@@ -641,6 +641,7 @@

You are patching a generated file here. The source file is configure.in.


> + LIBWWW_LIBDIR
> + LIBWWW_LDADD
> + LIBWWW_CONFIG
> ++PKG_CONFIG
> + WININET_LIBDIR
> + WININET_LDADD
> + WININET_CFLAGS
> +@@ -5988,11 +5989,13 @@
> + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL library" >&5
> + $as_echo_n "checking for OpenSSL library... " >&6; }
> + 
> +-if pkg-config openssl; then
> ++: "${PKG_CONFIG:=pkg-config}"
> ++
> ++if $PKG_CONFIG openssl; then
> +   HAVE_OPENSSL=yes
> +-  OPENSSL_LDADD=$(pkg-config openssl --libs)
> ++  OPENSSL_LDADD=`$PKG_CONFIG openssl --libs`
> + 
> +-  OPENSSL_CFLAGS=$(pkg-config openssl --cflags)
> ++  OPENSSL_CFLAGS=`$PKG_CONFIG openssl --cflags`

A better approach here would be using:

PKG_CHECK_MODULES([OPENSSL],[openssl],[HAVE_OPENSSL=yes],[HAVE_OPENSSL=no])

This requires regenerating configure (which is not presently happening
during build). The first argument is the variable prefix and the
variables thus become OPENSSL_LIBS and OPENSSL_CFLAGS. While the latter
matches the existing use, OPENSSL_LDADD would need to be renamed
throughout the code base.

> +--- a/config.mk.in
> ++++ b/config.mk.in
> +@@ -52,7 +52,7 @@
> + CCLD = $(CC)
> + CXXLD = $(CXX)
> + AR = @AR@
> +-PKG_CONFIG = pkg-config
> ++PKG_CONFIG = @PKG_CONFIG@

If possible (and it often is), please do not call pkg-config from
Makefiles. It is meant to be used at configure time collecting all the
flags to be recorded in Makefiles. Substitute the flags instead.

OPENSSL_LIBS = @OPENSSL_LIBS@
OPENSSL_CFLAGS = @OPENSSL_CFLAGS@

Note that PKG_CHECK_MODULES implies the required AC_SUBST for this.

> + RANLIB = @RANLIB@
> + LN_S = ln -s
> + INSTALL = $(SRCDIR)/install-sh
> +--- a/lib/openssl/Makefile
> ++++ b/lib/openssl/Makefile
> +@@ -24,9 +24,10 @@
> + PKGCONFIG_FILES_TO_INSTALL := xmlrpc_openssl.pc
> + 
> + MAJ := 1
> ++PKG_CONFIG ?= pkg-config
> + 
> +-OPENSSL_INCLUDES := $(shell pkg-config openssl --cflags)
> +-OPENSSL_LIBS     := $(shell pkg-config openssl --libs)
> ++OPENSSL_INCLUDES := $(shell $(PKG_CONFIG) openssl --cflags)
> ++OPENSSL_LIBS     := $(shell $(PKG_CONFIG) openssl --libs)

Once you record the detected flags in config.mk, there is no more need
to invoke pkg-config here.

> @@ -13,7 +13,8 @@ override_dh_auto_configure:
>       rm -fv tools/turbocharger/mod_gzip.c
>       dh_auto_configure -- \
>               --disable-libwww-client \
> -             --disable-wininet-client
> +             --disable-wininet-client \
> +             PKG_CONFIG=$(PKG_CONFIG)

As PKG_CHECK_MODULES uses AC_PATH_TOOL, this should become unnecessary.

Would you mind trying to produce an alternate version of this patch
based on PKG_CHECK_MODULES to be sent upstream as that change would be
more sustainable long-term? For the Debian side and short term, your
existing patch may be a good compromise (as long as we disable
autoreconf).

Helmut

Reply via email to