Hello!

This patch fixes CPPFLAGS, LDFLAGS, LIBS when checking AsyncDNS libcurl support in configure

Custom parameters and paths to libcurl were mistakenly excluded from CPPFLAGS, LDFLAGS, and LIBS, although AsyncDNS check was OK.

For example, the command `pkg-config --libs libcurl` gives `-L/usr/local/lib -lcurl`. LDFLAGS will not contain `-L/usr/local/lib`.

This patch fixes such behaviour.


Test case:

I've tested custom Postgres in an old Debian based Linux distro. This distro contains old libcurl (< 7.61, package libcurl3) that was compiled with symbols CURL_OPENSSL_3. So I've installed newer version of libcurlssl, package libcurl4-openssl-dev, that contains symbols CURL_OPENSSL_4 and compiled my libcurl version > 7.61.

After compilation during testing some Postgres shared libraries or binaries that was linked with libcurl showed an error "version CURL_OPENSSL_3 not found (required by …/libcurl.so.4)"

--
Best wishes,
Ivan Kush
Tantor Labs LLC
From 8a24c24f85c40e2aa0c40afc8f9cd7a19afa66c3 Mon Sep 17 00:00:00 2001
From: Ivan Kush <ivan.k...@tantorlabs.com>
Date: Fri, 20 Jun 2025 12:16:47 +0300
Subject: [PATCH] oauth: Fix CPPFLAGS, LDFLAGS, LIBS when checking AsyncDNS libcurl support

Custom parameters and paths to libcurl were mistakenly excluded from CPPFLAGS,
LDFLAGS, and LIBS.
For example, the command `pkg-config --libs libcurl` gives
`-L/usr/local/lib -lcurl`. LDFLAGS will not contain `-L/usr/local/lib`

This patch fixes this.

Author: Ivan Kush <ivan.k...@tantorlabs.com>
Author: Lev Nikolaev <lev.nikol...@tantorlabs.com>
Reviewed-by:
Discussion:
---
 config/programs.m4 | 7 +++----
 configure          | 8 +++-----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/config/programs.m4 b/config/programs.m4
index 0ad1e58b48d..2556e469323 100644
--- a/config/programs.m4
+++ b/config/programs.m4
@@ -348,9 +348,8 @@ AC_DEFUN([PGAC_CHECK_LIBCURL],
 *** The installed version of libcurl does not support asynchronous DNS
 *** lookups. Rebuild libcurl with the AsynchDNS feature enabled in order
 *** to use it with libpq.])
+    CPPFLAGS=$pgac_save_CPPFLAGS
+    LDFLAGS=$pgac_save_LDFLAGS
+    LIBS=$pgac_save_LIBS
   fi
-
-  CPPFLAGS=$pgac_save_CPPFLAGS
-  LDFLAGS=$pgac_save_LDFLAGS
-  LIBS=$pgac_save_LIBS
 ])# PGAC_CHECK_LIBCURL
diff --git a/configure b/configure
index 4f15347cc95..46a011d1d1b 100755
--- a/configure
+++ b/configure
@@ -12883,12 +12883,10 @@ $as_echo "$pgac_cv__libcurl_async_dns" >&6; }
 *** The installed version of libcurl does not support asynchronous DNS
 *** lookups. Rebuild libcurl with the AsynchDNS feature enabled in order
 *** to use it with libpq." "$LINENO" 5
+    CPPFLAGS=$pgac_save_CPPFLAGS
+    LDFLAGS=$pgac_save_LDFLAGS
+    LIBS=$pgac_save_LIBS
   fi
-
-  CPPFLAGS=$pgac_save_CPPFLAGS
-  LDFLAGS=$pgac_save_LDFLAGS
-  LIBS=$pgac_save_LIBS
-
 fi

 if test "$with_gssapi" = yes ; then
--
2.34.1

Reply via email to