Quellcode durchsuchen

Use LIBS and CPPFLAGS instead of substituting them individually per
library.

Tatsuhiro Tsujikawa vor 14 Jahren
Ursprung
Commit
3f125dce21
4 geänderte Dateien mit 32 neuen und 34 gelöschten Zeilen
  1. 27 13
      configure.ac
  2. 1 1
      m4/openssl.m4
  3. 1 7
      src/Makefile.am
  4. 3 13
      test/Makefile.am

+ 27 - 13
configure.ac

@@ -12,8 +12,6 @@ AC_CONFIG_HEADERS([config.h])
 
 case "$target" in
   *mingw*|*cygwin*)
-    WINSOCK_LIBS="-lws2_32"
-    AC_SUBST(WINSOCK_LIBS)
     LIBS="-lws2_32 -lcrypto -lwsock32 -lgdi32 -lwinmm $LIBS"
     ;;
 esac
@@ -73,6 +71,8 @@ if test "x$with_libxml2" = "xyes"; then
   AM_PATH_XML2([2.6.24], [have_libxml2=yes])
   if test "x$have_libxml2" = "xyes"; then
     AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
+    LIBS="$XML_LIBS $LIBS"
+    CPPFLAGS="$XML_CPPFLAGS $CPPFLAGS"
   elif test "x$with_libxml2_requested" = "xyes"; then
     ARIA2_DEP_NOT_MET([libxml2])
   fi
@@ -80,16 +80,20 @@ fi
 
 if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
   AM_PATH_LIBEXPAT
-  if test "x$have_libexpat" != "xyes" &&
-     test "x$with_libexpat_requested" = "xyes"; then
+  if test "x$have_libexpat" = "xyes"; then
+    LIBS="$LIBEXPAT_LIBS $LIBS"
+    CPPFLAGS="$LIBEXPAT_CPPFLAGS $CPPFLAGS"
+  elif test "x$with_libexpat_requested" = "xyes"; then
     ARIA2_DEP_NOT_MET([libexpat])
   fi
 fi
 
 if test "x$with_sqlite3" = "xyes"; then
   AM_PATH_SQLITE3
-  if test "x$have_sqlite3" != "xyes" &&
-     test "x$with_sqlite3_requested" = "xyes"; then
+  if test "x$have_sqlite3" = "xyes"; then
+    LIBS="$SQLITE3_LIBS $LIBS"
+    CPPFLAGS="$SQLITE3_CFLAGS $CPPFLAGS"
+  elif test "x$with_sqlite3_requested" = "xyes"; then
     ARIA2_DEP_NOT_MET([sqlite3])
   fi
 fi
@@ -100,32 +104,38 @@ if test "x$with_gnutls" = "xyes"; then
                     [have_libgnutls=yes], [have_libgnutls=no])
   if test "x$have_libgnutls" = "xyes"; then
     AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
+    LIBS="$LIBGNUTLS_LIBS $LIBS"
+    CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
   elif test "x$with_gnutls_requested" = "xyes"; then
     ARIA2_DEP_NOT_MET([gnutls])
   fi
-  AC_SUBST(LIBGNUTLS_LIBS)
-  AC_SUBST(LIBGNUTLS_CFLAGS)
 fi
 
 if test "x$have_libgnutls" = "xyes"; then
   AM_PATH_LIBGCRYPT([1.2.2], [have_libgcrypt=yes])
   if test "x$have_libgcrypt" = "xyes"; then
     AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
+    LIBS="$LIBGCRYPT_LIBS $LIBS"
+    CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
   fi
 fi
 
 if test "x$with_openssl" = "xyes" && test "x$have_libgnutls" != "xyes"; then
   AM_PATH_OPENSSL
-  if test "x$have_openssl" != "xyes" &&
-     test "x$with_openssl_requested" = "xyes"; then
+  if test "x$have_openssl" = "xyes"; then
+    LIBS="$OPENSSL_LIBS $LIBS"
+    CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
+  elif test "x$with_openssl_requested" = "xyes"; then
     ARIA2_DEP_NOT_MET([openssl])
   fi
 fi
 
 if test "x$with_libcares" = "xyes"; then
   AM_PATH_LIBCARES
-  if test "x$have_libcares" != "xyes" &&
-     test "x$with_libcares_requested" = "xyes"; then
+  if test "x$have_libcares" = "xyes"; then
+    LIBS="$LIBCARES_LIBS $LIBS"
+    CPPFLAGS="$LIBCARES_CPPFLAGS $CPPFLAGS"
+  elif test "x$with_libcares_requested" = "xyes"; then
     ARIA2_DEP_NOT_MET([libcares])
   fi
 fi
@@ -133,7 +143,10 @@ fi
 # Check availability of libz
 if test "x$with_libz" = "xyes"; then
   AM_PATH_LIBZ
-  if test "x$have_libz" != "xyes" && test "x$with_libz_requested" = "xyes"; then
+  if test "x$have_libz" = "xyes"; then
+    LIBS="$LIBZ_LIBS $LIBS"
+    CPPFLAGS="$LIBZ_CPPFLAGS $CPPFLAGS"
+  elif test "x$with_libz_requested" = "xyes"; then
     ARIA2_DEP_NOT_MET([libz])
   fi
 fi
@@ -497,6 +510,7 @@ echo "CFLAGS:         $CFLAGS"
 echo "CPPFLAGS:       $CPPFLAGS"
 echo "LDFLAGS:        $LDFLAGS"
 echo "LIBS:           $LIBS"
+echo "DEFS:           $DEFS"
 echo "SQLite3:        $have_sqlite3"
 echo "GnuTLS:         $have_libgnutls"
 echo "OpenSSL:        $have_openssl"

+ 1 - 1
m4/openssl.m4

@@ -6,7 +6,7 @@ AC_ARG_WITH([openssl-prefix],
             [openssl_prefix=""])
 
 if test "x$openssl_prefix" = "x"; then
-  openssl_prefix="/usr/local"
+  openssl_prefix="/usr"
 fi
 
 LIBS_save=$LIBS

+ 1 - 7
src/Makefile.am

@@ -556,14 +556,8 @@ endif # HAVE_KQUEUE
 AR = @AR@
 noinst_LIBRARIES = libaria2c.a
 libaria2c_a_SOURCES = $(SRCS)
-aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ @LIBGNUTLS_LIBS@\
-	@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@\
-	@LIBCARES_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
-	@SQLITE3_LIBS@ #-lprofiler
+aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ #-lprofiler
 #aria2c_LDFLAGS = -pg
 AM_CPPFLAGS =  -Wall\
 	-I$(top_srcdir)/lib -I$(top_srcdir)/intl\
-	@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
-	@LIBCARES_CPPFLAGS@ @LIBEXPAT_CPPFLAGS@\
-	@LIBZ_CPPFLAGS@	 @SQLITE3_CFLAGS@\
 	-DLOCALEDIR=\"@localedir@\" -DCA_BUNDLE=\"$(ca_bundle)\" @DEFS@ #-pg

+ 3 - 13
test/Makefile.am

@@ -213,24 +213,14 @@ aria2c_SOURCES += MetalinkerTest.cc\
 	MetalinkProcessorTest.cc
 endif # ENABLE_METALINK
 
-#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
-#aria2c_LDFLAGS = ${CPPUNIT_LIBS}
-
-aria2c_LDADD = ../src/libaria2c.a\
-    @LIBINTL@ @LIBGNUTLS_LIBS@\
-	@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@\
-	@LIBCARES_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
-	@SQLITE3_LIBS@\
-	${CPPUNIT_LIBS}
+aria2c_LDADD = ../src/libaria2c.a @LIBINTL@ @CPPUNIT_LIBS@
 AM_CPPFLAGS =  -Wall\
-	${CPPUNIT_CFLAGS}\
 	-I$(top_srcdir)/src\
 	-I$(top_srcdir)/lib -I$(top_srcdir)/intl\
-	@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
-	@LIBCARES_CPPFLAGS@ @LIBEXPAT_CPPFLAGS@\
-	@LIBZ_CPPFLAGS@	 @SQLITE3_CFLAGS@ -DLOCALEDIR=\"$(localedir)\"\
+        -DLOCALEDIR=\"$(localedir)\"\
 	-DA2_TEST_DIR=\"$(top_srcdir)/test\"\
 	-DA2_TEST_OUT_DIR=\"${a2_test_outdir}\"\
+	@CPPUNIT_CFLAGS@\
 	@DEFS@
 
 EXTRA_DIST = 4096chunk.txt\