Skip to content

Commit 3d23f68

Browse files
committed
oauth: Run Autoconf tests with correct compiler flags
Commit b0635bf 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
1 parent f36e577 commit 3d23f68

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

config/programs.m4

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,20 +284,26 @@ AC_DEFUN([PGAC_CHECK_STRIP],
284284

285285
AC_DEFUN([PGAC_CHECK_LIBCURL],
286286
[
287+
# libcurl compiler/linker flags are kept separate from the global flags, so
288+
# they have to be added back temporarily for the following tests.
289+
pgac_save_CPPFLAGS=$CPPFLAGS
290+
pgac_save_LDFLAGS=$LDFLAGS
291+
pgac_save_LIBS=$LIBS
292+
293+
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
294+
LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS"
295+
287296
AC_CHECK_HEADER(curl/curl.h, [],
288297
[AC_MSG_ERROR([header file <curl/curl.h> is required for --with-libcurl])])
298+
299+
# LIBCURL_LDLIBS is determined here. Like the compiler flags, it should not
300+
# pollute the global LIBS setting.
289301
AC_CHECK_LIB(curl, curl_multi_init, [
290302
AC_DEFINE([HAVE_LIBCURL], [1], [Define to 1 if you have the `curl' library (-lcurl).])
291303
AC_SUBST(LIBCURL_LDLIBS, -lcurl)
292304
],
293305
[AC_MSG_ERROR([library 'curl' does not provide curl_multi_init])])
294306
295-
pgac_save_CPPFLAGS=$CPPFLAGS
296-
pgac_save_LDFLAGS=$LDFLAGS
297-
pgac_save_LIBS=$LIBS
298-
299-
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
300-
LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS"
301307
LIBS="$LIBCURL_LDLIBS $LIBS"
302308
303309
# Check to see whether the current platform supports threadsafe Curl

configure

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12717,6 +12717,15 @@ fi
1271712717

1271812718
if test "$with_libcurl" = yes ; then
1271912719

12720+
# libcurl compiler/linker flags are kept separate from the global flags, so
12721+
# they have to be added back temporarily for the following tests.
12722+
pgac_save_CPPFLAGS=$CPPFLAGS
12723+
pgac_save_LDFLAGS=$LDFLAGS
12724+
pgac_save_LIBS=$LIBS
12725+
12726+
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
12727+
LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS"
12728+
1272012729
ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default"
1272112730
if test "x$ac_cv_header_curl_curl_h" = xyes; then :
1272212731

@@ -12725,6 +12734,9 @@ else
1272512734
fi
1272612735

1272712736

12737+
12738+
# LIBCURL_LDLIBS is determined here. Like the compiler flags, it should not
12739+
# pollute the global LIBS setting.
1272812740
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_multi_init in -lcurl" >&5
1272912741
$as_echo_n "checking for curl_multi_init in -lcurl... " >&6; }
1273012742
if ${ac_cv_lib_curl_curl_multi_init+:} false; then :
@@ -12774,12 +12786,6 @@ else
1277412786
fi
1277512787

1277612788

12777-
pgac_save_CPPFLAGS=$CPPFLAGS
12778-
pgac_save_LDFLAGS=$LDFLAGS
12779-
pgac_save_LIBS=$LIBS
12780-
12781-
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
12782-
LDFLAGS="$LIBCURL_LDFLAGS $LDFLAGS"
1278312789
LIBS="$LIBCURL_LDLIBS $LIBS"
1278412790

1278512791
# Check to see whether the current platform supports threadsafe Curl

0 commit comments

Comments
 (0)