On platforms such as FreeBSD 13 where curl.h is not installed on the
usual compiler search path, we NEED to include the CURL_CFLAGS as
determined by pkg-config before doing any compile-time checks for
declarations; if we don't, the compile-time check will fail because
the header wasn't found, rather than because the symbol was present or
absent; with delayed symptoms of failing to build due to attempts to
use deprecated interfaces that we would have avoided had the
declaration checks worked.  We were already doing this for libs later
on when checking for functions, time to just hoist that earlier and
include CFLAGS in the mix.

Fixes: 9ed65418 ("curl: Remove unnecessary checks for CURL_SSLVERSION_MAX_* 
macros", v1.41.9)
Fixes: 9408b8c7 ("curl: Use CURLOPT_PROTOCOLS_STR if available", v1.33.8)
Signed-off-by: Eric Blake <ebl...@redhat.com>
---
 configure.ac | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d40f7f1..121e7ab2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1206,6 +1206,10 @@ AS_IF([test "$with_curl" != "no"],[
         printf "libcurl version is "; $PKG_CONFIG --modversion libcurl
         AC_SUBST([CURL_CFLAGS])
         AC_SUBST([CURL_LIBS])
+        old_CFLAGS="$CFLAGS"
+        CFLAGS="$CURL_CFLAGS $CFLAGS"
+        old_LIBS="$LIBS"
+        LIBS="$CURL_LIBS $LIBS"
         AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.])
         AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [
             AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1],
@@ -1244,12 +1248,11 @@ AS_IF([test "$with_curl" != "no"],[
         dnl https://github.com/curl/curl/pull/11750
         dnl https://github.com/curl/curl/commit/9ffd4117357
         dnl curl_version_info was added in 7.10
-        old_LIBS="$LIBS"
-        LIBS="$CURL_LIBS $LIBS"
         AC_CHECK_FUNCS([\
             curl_multi_get_handles \
             curl_version_info \
         ])
+        CFLAGS="$old_CFLAGS"
         LIBS="$old_LIBS"
     ],
     [AC_MSG_WARN([curl not found, curl plugin will be disabled])])
-- 
2.48.1
_______________________________________________
Libguestfs mailing list -- guestfs@lists.libguestfs.org
To unsubscribe send an email to guestfs-le...@lists.libguestfs.org

Reply via email to