[pacman-dev] [PATCH 03/11] buildsys: use pkg-config for libarchive detection

Dave Reisner dreisner at archlinux.org
Mon Apr 2 17:15:48 EDT 2012


This also introduces a versioned dependency of >=3.0.0.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 configure.ac            |    6 +++---
 lib/libalpm/Makefile.am |    4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 824241d..30a20f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,8 +153,8 @@ AC_CHECK_LIB([m], [fabs], ,
 	AC_MSG_ERROR([libm is needed to compile pacman!]))
 
 # Check for libarchive
-AC_CHECK_LIB([archive], [archive_read_data], ,
-	AC_MSG_ERROR([libarchive is needed to compile pacman!]))
+PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 2.8.0], ,
+	AC_MSG_ERROR([*** libarchive >= 2.8.0 is needed to compile pacman!]))
 
 # Check for OpenSSL
 if test "x$with_openssl" != "xno"; then
@@ -410,7 +410,7 @@ ${PACKAGE_NAME}:
     preprocessor flags     : ${CPPFLAGS}
     compiler flags         : ${CFLAGS}
     defines                : ${DEFS}
-    library flags          : ${LIBS} ${LIBSSL_LIBS}
+    library flags          : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS}
     linker flags           : ${LDFLAGS}
 
     Architecture           : ${CARCH}
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 8d1be90..3aa3e4f 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -67,10 +67,12 @@ libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@
 
 libalpm_la_CFLAGS = \
 	$(AM_CFLAGS) \
+	$(LIBARCHIVE_CFLAGS) \
 	$(LIBSSL_CFLAGS)
 
 libalpm_la_LIBADD = \
 	$(LTLIBINTL) \
-	$(LIBSSL_LIBS)
+	$(LIBSSL_LIBS) \
+	$(LIBARCHIVE_LIBS) \
 
 # vim:set ts=2 sw=2 noet:
-- 
1.7.9.5



More information about the pacman-dev mailing list