summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-11-23 22:57:29 +0900
committerGitHub <noreply@github.com>2016-11-23 22:57:29 +0900
commitc087ab1ba1234899db2b5e7aa6f221ae8a930e1b (patch)
tree633cb86cc0f6fa649aa25f11b30b0d2caaf99410
parent9d58ad912a8da9e25725d053598c8f5fdf76e41b (diff)
parent02985711df432e5fa8349cec5a05f0445c1d48b0 (diff)
Merge pull request #773 from mgorny/pkgconfig
configure: Use pkg-config to find libs whenever possible
-rw-r--r--configure.ac32
-rw-r--r--m4/libexpat.m419
-rw-r--r--src/Makefile.am4
-rw-r--r--test/Makefile.am4
4 files changed, 14 insertions, 45 deletions
diff --git a/configure.ac b/configure.ac
index 34f0f793..41cac35e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,6 @@ AC_SUBST(LT_REVISION, 0)
AC_SUBST(LT_AGE, 0)
AC_CONFIG_MACRO_DIR([m4])
-m4_ifdef([AM_PATH_CPPUNIT], [AM_PATH_CPPUNIT(1.10.2)])
AC_CONFIG_SRCDIR([src/a2io.h])
AC_CONFIG_HEADERS([config.h])
@@ -202,6 +201,9 @@ fi
# Checks for libraries.
+# Check availability of cppunit
+PKG_CHECK_MODULES([CPPUNIT], [cppunit >= 1.10.2], [], [])
+
# Check availability of libz
if test "x$with_libz" = "xyes"; then
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
@@ -318,13 +320,7 @@ AM_CONDITIONAL([HAVE_LIBUV], [test "x$have_libuv" = "xyes"])
have_libxml2=no
if test "x$with_libxml2" = "xyes"; then
- m4_ifdef([AM_PATH_XML2], [AM_PATH_XML2([2.6.24], [have_libxml2=yes])], [
- AC_MSG_WARN([configure was generated without libxml2 detection. libxml2 detection is disabled])
- XML_CPPFLAGS=
- XML_LIBS=
- AC_SUBST([XML_CPPFLAGS])
- AC_SUBST([XML_LIBS])
- ])
+ PKG_CHECK_MODULES([LIBXML2],[libxml-2.0 >= 2.6.24],[have_libxml2=yes],[have_libxml2=no])
if test "x$have_libxml2" = "xyes"; then
AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
elif test "x$with_libxml2_requested" = "xyes"; then
@@ -334,13 +330,7 @@ fi
have_libexpat=no
if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
- m4_ifdef([AM_PATH_LIBEXPAT], [AM_PATH_LIBEXPAT], [
- AC_MSG_WARN([configure was generated without libexpat detection. libexpat detection is disabled])
- EXPAT_CFLAGS=
- EXPAT_LIBS=
- AC_SUBST([EXPAT_CFLAGS])
- AC_SUBST([EXPAT_LIBS])
- ])
+ PKG_CHECK_MODULES([EXPAT],[expat],[have_libexpat=yes],[have_libexpat=no])
if test "x$have_libexpat" != "xyes" &&
test "x$with_libexpat_requested" = "xyes"; then
ARIA2_DEP_NOT_MET([libexpat])
@@ -511,14 +501,12 @@ have_libgcrypt=no
if test "x$have_openssl" != "xyes"; then
if test "x$with_libnettle" = "xyes" &&
test "x$have_nativetls" != "xyes"; then
- AC_CHECK_LIB([nettle], [nettle_sha1_init],
- [have_libnettle=yes], [have_libnettle=no])
+ PKG_CHECK_MODULES([LIBNETTLE], [nettle],
+ [have_libnettle=yes], [have_libnettle=no])
if test "x$have_libnettle" = "xyes"; then
- LIBNETTLE_CFLAGS=
- LIBNETTLE_LIBS="-lnettle"
- AC_SUBST([LIBNETTLE_CFLAGS])
- AC_SUBST([LIBNETTLE_LIBS])
AC_DEFINE([HAVE_LIBNETTLE], [1], [Define to 1 if you have libnettle.])
+ elif test "x$with_libnettle_requested" = "xyes"; then
+ ARIA2_DEP_NOT_MET([nettle])
fi
fi
if test "x$with_libgmp" = "xyes" &&
@@ -1229,7 +1217,7 @@ CA Bundle: $ca_bundle
LibNettle: $have_libnettle (CFLAGS='$LIBNETTLE_CFLAGS' LIBS='$LIBNETTLE_LIBS')
LibGmp: $have_libgmp (CFLAGS='$LIBGMP_CFLAGS' LIBS='$LIBGMP_LIBS')
LibGcrypt: $have_libgcrypt (CFLAGS='$LIBGCRYPT_CFLAGS' LIBS='$LIBGCRYPT_LIBS')
-LibXML2: $have_libxml2 (CFLAGS='$XML_CPPFLAGS' LIBS='$XML_LIBS')
+LibXML2: $have_libxml2 (CFLAGS='$LIBXML2_CFLAGS' LIBS='$LIBXML2_LIBS')
LibExpat: $have_libexpat (CFLAGS='$EXPAT_CFLAGS' LIBS='$EXPAT_LIBS')
LibCares: $have_libcares (CFLAGS='$LIBCARES_CFLAGS' LIBS='$LIBCARES_LIBS')
Zlib: $have_zlib (CFLAGS='$ZLIB_CFLAGS' LIBS='$ZLIB_LIBS')
diff --git a/m4/libexpat.m4 b/m4/libexpat.m4
deleted file mode 100644
index cee8a96a..00000000
--- a/m4/libexpat.m4
+++ /dev/null
@@ -1,19 +0,0 @@
-AC_DEFUN([AM_PATH_LIBEXPAT],
-[
-LIBS_save=$LIBS
-CPPFLAGS_save=$CPPFLAGS
-
-LIBS="-lexpat $LIBS"
-AC_CHECK_LIB([expat], [XML_ParserCreate], [have_libexpat=yes])
-if test "x$have_libexpat" = "xyes"; then
- AC_DEFINE([HAVE_LIBEXPAT], [1], [Define to 1 if you have libexpat.])
- EXPAT_LIBS=-lexpat
- EXPAT_CFLAGS=
- AC_SUBST([EXPAT_LIBS])
- AC_SUBST([EXPAT_CFLAGS])
-fi
-
-LIBS=$LIBS_save
-CPPFLAGS=$CPPFLAGS_save
-
-])
diff --git a/src/Makefile.am b/src/Makefile.am
index 634e4796..9322112c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -711,7 +711,7 @@ AM_CPPFLAGS = \
@EXTRACPPFLAGS@ \
@ZLIB_CFLAGS@ \
@LIBUV_CFLAGS@ \
- @XML_CPPFLAGS@ \
+ @LIBXML2_CFLAGS@ \
@EXPAT_CFLAGS@ \
@SQLITE3_CFLAGS@ \
@LIBGNUTLS_CFLAGS@ \
@@ -733,7 +733,7 @@ EXTLDADD = @ALLOCA@ \
@EXTRALIBS@ \
@ZLIB_LIBS@ \
@LIBUV_LIBS@ \
- @XML_LIBS@ \
+ @LIBXML2_LIBS@ \
@EXPAT_LIBS@ \
@SQLITE3_LIBS@ \
@WINTLS_LIBS@ \
diff --git a/test/Makefile.am b/test/Makefile.am
index 48a962ec..c7114449 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -246,7 +246,7 @@ aria2c_LDADD = \
@EXTRALIBS@ \
@ZLIB_LIBS@ \
@LIBUV_LIBS@ \
- @XML_LIBS@ \
+ @LIBXML2_LIBS@ \
@EXPAT_LIBS@ \
@SQLITE3_LIBS@ \
@WINTLS_LIBS@ \
@@ -274,7 +274,7 @@ AM_CPPFLAGS = \
@EXTRACPPFLAGS@ \
@ZLIB_CFLAGS@ \
@LIBUV_CFLAGS@ \
- @XML_CPPFLAGS@ \
+ @LIBXML2_CFLAGS@ \
@EXPAT_CFLAGS@ \
@SQLITE3_CFLAGS@ \
@LIBGNUTLS_CFLAGS@ \