From 02f00350683769ece96a367ad8b987d3179d4b5d Mon Sep 17 00:00:00 2001
Message-ID: <02f00350683769ece96a367ad8b987d3179d4b5d.1760957586.git.sam@gentoo.org>
In-Reply-To: <9f08064fef75ce02df9b6133d240c0fa84df458e.1760957586.git.sam@gentoo.org>
References: <9f08064fef75ce02df9b6133d240c0fa84df458e.1760957586.git.sam@gentoo.org>
From: Sam James <sam@gentoo.org>
Date: Sun, 6 Oct 2024 05:53:52 +0100
Subject: [PATCH 10/10] configure.ac: use pkg-config to find curl

A bunch of checks were already relying on pkg-config, let's do it
for curl too.

2024-10-06  Sam James <sam@gentoo.org>

	* configure.ac: Find curl via pkg-config.
---
 configure.ac    | 6 +-----
 src/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7e47b9d..44bad76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,14 +89,10 @@ AC_ARG_ENABLE([curl],
               [curl_enabled=$enableval], [curl_enabled=yes])
 have_curl=no
 AS_IF([test "x$curl_enabled" = "xyes"], [
-    AC_CHECK_LIB([curl], [curl_global_init], [have_curl=yes], [])
-    AS_IF([test "x$have_curl" = "xyes"], [
-        CURLLIBS=-lcurl
-    ], [
+    PKG_CHECK_MODULES([CURL], [libcurl], [have_curl=yes], [
         AC_MSG_ERROR([curl support enabled but libcurl not found])
     ])
 ], [])
-AC_SUBST([CURLLIBS])
 
 AC_ARG_ENABLE([uuid],
               AS_HELP_STRING([--enable-uuid],
diff --git a/src/Makefile.am b/src/Makefile.am
index f1e8fa7..07041f0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -159,7 +159,7 @@ endif
 
 if REMOTE_DESCRIPTORS
   AM_CPPFLAGS += -DREMOTE_DESCRIPTORS
-  librec_la_LIBADD += $(CURLLIBS)
+  librec_la_LIBADD += $(CURL_LIBS)
 endif
 
 if UUID_TYPE
-- 
2.51.1

