1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

oauth: Run Autoconf tests with correct compiler flags

Commit b0635bfda split off the CPPFLAGS/LDFLAGS/LDLIBS for libcurl into
their own separate Makefile variables, but I neglected to move the
existing AC_CHECKs for Curl into a place where they would make use of
those variables. They instead tested the system libcurl, which 1) is
unhelpful if a different Curl is being used for the build and 2) will
fail the build entirely if no system libcurl exists. Correct the order
of operations here.

Reported-by: Ivan Kush <ivan.kush@tantorlabs.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Ivan Kush <ivan.kush@tantorlabs.com>
Discussion: https://postgr.es/m/8a611028-51a1-408c-b592-832e2e6e1fc9%40tantorlabs.com
Backpatch-through: 18
This commit is contained in:
Jacob Champion
2025-07-11 10:06:41 -07:00
parent 8d33fbacba
commit 990571a08b
2 changed files with 26 additions and 14 deletions

View File

@ -284,20 +284,26 @@ AC_DEFUN([PGAC_CHECK_STRIP],
AC_DEFUN([PGAC_CHECK_LIBCURL], AC_DEFUN([PGAC_CHECK_LIBCURL],
[ [
AC_CHECK_HEADER(curl/curl.h, [], # libcurl compiler/linker flags are kept separate from the global flags, so
[AC_MSG_ERROR([header file <curl/curl.h> is required for --with-libcurl])]) # they have to be added back temporarily for the following tests.
AC_CHECK_LIB(curl, curl_multi_init, [
AC_DEFINE([HAVE_LIBCURL], [1], [Define to 1 if you have the `curl' library (-lcurl).])
AC_SUBST(LIBCURL_LDLIBS, -lcurl)
],
[AC_MSG_ERROR([library 'curl' does not provide curl_multi_init])])
pgac_save_CPPFLAGS=$CPPFLAGS pgac_save_CPPFLAGS=$CPPFLAGS
pgac_save_LDFLAGS=$LDFLAGS pgac_save_LDFLAGS=$LDFLAGS
pgac_save_LIBS=$LIBS pgac_save_LIBS=$LIBS
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS" LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS"
AC_CHECK_HEADER(curl/curl.h, [],
[AC_MSG_ERROR([header file <curl/curl.h> is required for --with-libcurl])])
# LIBCURL_LDLIBS is determined here. Like the compiler flags, it should not
# pollute the global LIBS setting.
AC_CHECK_LIB(curl, curl_multi_init, [
AC_DEFINE([HAVE_LIBCURL], [1], [Define to 1 if you have the `curl' library (-lcurl).])
AC_SUBST(LIBCURL_LDLIBS, -lcurl)
],
[AC_MSG_ERROR([library 'curl' does not provide curl_multi_init])])
LIBS="$LIBCURL_LDLIBS $LIBS" LIBS="$LIBCURL_LDLIBS $LIBS"
# Check to see whether the current platform supports threadsafe Curl # Check to see whether the current platform supports threadsafe Curl

18
configure vendored
View File

@ -12717,6 +12717,15 @@ fi
if test "$with_libcurl" = yes ; then if test "$with_libcurl" = yes ; then
# libcurl compiler/linker flags are kept separate from the global flags, so
# they have to be added back temporarily for the following tests.
pgac_save_CPPFLAGS=$CPPFLAGS
pgac_save_LDFLAGS=$LDFLAGS
pgac_save_LIBS=$LIBS
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS"
ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default"
if test "x$ac_cv_header_curl_curl_h" = xyes; then : if test "x$ac_cv_header_curl_curl_h" = xyes; then :
@ -12725,6 +12734,9 @@ else
fi fi
# LIBCURL_LDLIBS is determined here. Like the compiler flags, it should not
# pollute the global LIBS setting.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_multi_init in -lcurl" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_multi_init in -lcurl" >&5
$as_echo_n "checking for curl_multi_init in -lcurl... " >&6; } $as_echo_n "checking for curl_multi_init in -lcurl... " >&6; }
if ${ac_cv_lib_curl_curl_multi_init+:} false; then : if ${ac_cv_lib_curl_curl_multi_init+:} false; then :
@ -12774,12 +12786,6 @@ else
fi fi
pgac_save_CPPFLAGS=$CPPFLAGS
pgac_save_LDFLAGS=$LDFLAGS
pgac_save_LIBS=$LIBS
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS"
LIBS="$LIBCURL_LDLIBS $LIBS" LIBS="$LIBCURL_LDLIBS $LIBS"
# Check to see whether the current platform supports threadsafe Curl # Check to see whether the current platform supports threadsafe Curl