On Thu, Feb 06, 2025 at 02:50:48PM -0600, Eric Blake wrote:
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.
Hmm - I just audited to see if we had any other similar issues, and it looks like we are relatively consistent elsewhere of just setting old_CFLAGS around AC_CHECK_DECLS and old_LIBS around AC_CHECK_FUNCS (for example, look at the HAVE_GNUTLS checks around line 693). I will redo this patch to match that prevailing style (ie. add old_CFLAGS stuff, but leave old_LIBS alone).
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 <eblake@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-leave@lists.libguestfs.org
-- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org