From a0a47f2767b6b17c6fdeeb2418e1371df25cbc6d Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sat, 17 Feb 2007 01:29:01 +0000 Subject: [PATCH] Better separate the library dependencies into those required by libcurl and those required by other components to avoid forcing unneeded dependencies into the target objects. --- configure.ac | 23 ++++++++++++++++++++++- lib/Makefile.am | 3 ++- src/Makefile.am | 2 +- tests/server/Makefile.am | 8 ++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 5e6e15ed3..67feec7e8 100644 --- a/configure.ac +++ b/configure.ac @@ -90,6 +90,11 @@ dnl initialize all the info variables curl_verbose_msg="enabled (--disable-verbose)" curl_sspi_msg="no (--enable-sspi)" +dnl +dnl Save anything in $LIBS for later +dnl +ALL_LIBS=$LIBS + dnl dnl Detect the canonical host and target build environment dnl @@ -435,7 +440,7 @@ AC_ARG_ENABLE(libgcc, AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]), [ case "$enableval" in yes) - LIBS="$LIBS -lgcc" + ALL_LIBS="$ALL_LIBS -lgcc" AC_MSG_RESULT(yes) ;; *) AC_MSG_RESULT(no) @@ -1401,6 +1406,7 @@ else AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file]) AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available]) + CURL_LIBS="$CURL_LIBS -lz" LIBS="$LIBS -lz" dnl replace 'HAVE_LIBZ' in the automake makefile.ams @@ -2187,6 +2193,21 @@ if test "x$ws2" = "xyes"; then fi +dnl +dnl All the library dependencies put into $LIB apply to libcurl only. +dnl Those in $CURL_LIBS apply to the curl command-line client only. +dnl Those in $TEST_SERVER_LIBS apply to test servers (for simplicity, this +dnl is currently the same as libcurl's libraries). +dnl Those in $ALL_LIBS apply to all targets, including test targets. +dnl +LIBCURL_LIBS=$LIBS +TEST_SERVER_LIBS=$LIBCURL_LIBS + +AC_SUBST(LIBCURL_LIBS) +AC_SUBST(CURL_LIBS) +AC_SUBST(TEST_SERVER_LIBS) +LIBS=$ALL_LIBS dnl LIBS is a magic variable + AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes) AC_CONFIG_FILES([Makefile \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 1a0f5fa63..edefb0e01 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -39,6 +39,7 @@ EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos \ CLEANFILES = $(DSP) $(VCPROJ) lib_LTLIBRARIES = libcurl.la +LIBCURL_LIBS = @LIBCURL_LIBS@ # we use srcdir/include for the static global include files # we use builddir/lib for the generated lib/config.h file to get found @@ -89,7 +90,7 @@ if MIMPURE MIMPURE = -mimpure-text endif -libcurl_la_LDFLAGS = $(UNDEF) $(VERSION) $(MIMPURE) +libcurl_la_LDFLAGS = $(UNDEF) $(VERSION) $(MIMPURE) $(LIBCURL_LIBS) # Makefile.inc provides the CSOURCES and HHEADERS defines include Makefile.inc diff --git a/src/Makefile.am b/src/Makefile.am index 77f0abfd4..13fad213e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,7 +37,7 @@ bin_PROGRAMS = curl include Makefile.inc -curl_LDADD = ../lib/libcurl.la +curl_LDADD = ../lib/libcurl.la @CURL_LIBS@ curl_DEPENDENCIES = ../lib/libcurl.la BUILT_SOURCES = hugehelp.c CLEANFILES = hugehelp.c diff --git a/tests/server/Makefile.am b/tests/server/Makefile.am index 9b20d5c99..21edfd3ef 100644 --- a/tests/server/Makefile.am +++ b/tests/server/Makefile.am @@ -36,11 +36,19 @@ useful = getpart.c getpart.h $(top_srcdir)/lib/strequal.c \ $(top_srcdir)/lib/memdebug.c $(top_srcdir)/lib/timeval.c resolve_SOURCES= resolve.c util.c util.h $(useful) +resolve_LDADD = @TEST_SERVER_LIBS@ + sws_SOURCES= sws.c util.c util.h $(useful) +sws_LDADD = @TEST_SERVER_LIBS@ + sockfilt_SOURCES = sockfilt.c util.c util.h $(useful) \ $(top_srcdir)/lib/inet_pton.c +sockfilt_LDADD = @TEST_SERVER_LIBS@ + getpart_SOURCES= testpart.c $(useful) + tftpd_SOURCES = tftpd.c util.c util.h $(useful) tftp.h +tftpd_LDADD = @TEST_SERVER_LIBS@ extra_DIST = base64.pl