1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

build: avoid linkage of directly unused libraries

This commit is contained in:
Yang Tse 2012-11-28 18:31:23 +01:00
parent 534d2ca1d7
commit 16a8281f71
5 changed files with 43 additions and 16 deletions

View File

@ -2103,6 +2103,7 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
#
curl_cv_save_LIBS="$LIBS"
curl_cv_gclk_LIBS="unknown"
curl_cv_save_CURL_LIBS="$CURL_LIBS"
#
for x_xlibs in '' '-lrt' '-lposix4' ; do
if test "$curl_cv_gclk_LIBS" = "unknown"; then
@ -2196,6 +2197,7 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
ac_cv_func_clock_gettime="no"
LIBS="$curl_cv_save_LIBS"
CURL_LIBS="$curl_cv_save_CURL_LIBS"
])
fi
#

View File

@ -753,7 +753,7 @@ then
fi
if test ! -z "$winsock_LIB"; then
my_ac_save_LIBS=$LIBS
LIBS="$winsock_LIB $LIBS"
LIBS="$LIBS $winsock_LIB"
AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
@ -869,10 +869,11 @@ CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
dnl **********************************************************************
dnl The preceding library checks are all potentially useful for test
dnl servers (for providing networking support). Save the list of required
dnl libraries at this point for use while linking those test servers.
dnl servers and libtest cases which require networking and clock_gettime
dnl support. Save the list of required libraries at this point for use
dnl while linking those test servers and programs.
dnl **********************************************************************
TEST_SERVER_LIBS=$LIBS
CURL_NETWORK_AND_TIME_LIBS=$LIBS
dnl **********************************************************************
AC_MSG_CHECKING([whether to use libgcc])
@ -3322,22 +3323,20 @@ if test ! -z "$winsock_LIB"; then
dnl end.
LIBS="$LIBS $winsock_LIB"
TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB"
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 only.
dnl Those in $ALL_LIBS apply to all targets, including test targets.
dnl
LIBCURL_LIBS=$LIBS
AC_SUBST(LIBCURL_LIBS)
AC_SUBST(CURL_LIBS)
AC_SUBST(TEST_SERVER_LIBS)
AC_SUBST(CURL_NETWORK_LIBS)
AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
@ -3473,8 +3472,8 @@ squeeze LIBS
squeeze CURL_LIBS
squeeze LIBCURL_LIBS
squeeze TEST_SERVER_LIBS
squeeze CURL_NETWORK_LIBS
squeeze CURL_NETWORK_AND_TIME_LIBS
squeeze SUPPORT_FEATURES
squeeze SUPPORT_PROTOCOLS

View File

@ -56,7 +56,7 @@ test1022.pl Makefile.inc notexists.pl
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
# Dependencies (may need to be overriden)
LDADD = $(top_builddir)/lib/libcurl.la @CURL_LIBS@
LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_LIBS@
DEPENDENCIES = $(top_builddir)/lib/libcurl.la
# Mostly for Windows build targets, when using static libcurl

View File

@ -28,20 +28,25 @@ chkhostname_DEPENDENCIES =
chkhostname_CFLAGS = $(AM_CFLAGS)
lib500_SOURCES = lib500.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE)
lib500_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib501_SOURCES = lib501.c $(SUPPORTFILES)
lib502_SOURCES = lib502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib502_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib503_SOURCES = lib503.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib503_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib504_SOURCES = lib504.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib504_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib505_SOURCES = lib505.c $(SUPPORTFILES)
lib506_SOURCES = lib506.c $(SUPPORTFILES)
lib507_SOURCES = lib507.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib507_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib508_SOURCES = lib508.c $(SUPPORTFILES)
@ -74,31 +79,40 @@ lib523_SOURCES = lib523.c $(SUPPORTFILES)
lib524_SOURCES = lib524.c $(SUPPORTFILES)
lib525_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib525_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib526_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib526_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib526_CPPFLAGS = $(AM_CPPFLAGS) -DLIB526
lib527_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib527_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib527_CPPFLAGS = $(AM_CPPFLAGS) -DLIB527
lib529_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib529_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib529_CPPFLAGS = $(AM_CPPFLAGS) -DLIB529
lib530_SOURCES = lib530.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib530_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib530_CPPFLAGS = $(AM_CPPFLAGS) -DLIB530
lib532_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib532_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib532_CPPFLAGS = $(AM_CPPFLAGS) -DLIB532
lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib533_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib536_SOURCES = lib536.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib536_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib537_SOURCES = lib537.c $(SUPPORTFILES) $(WARNLESS)
lib539_SOURCES = lib539.c $(SUPPORTFILES)
lib540_SOURCES = lib540.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib540_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib541_SOURCES = lib541.c $(SUPPORTFILES)
@ -119,6 +133,7 @@ lib548_CPPFLAGS = $(AM_CPPFLAGS) -DLIB548
lib549_SOURCES = lib549.c $(SUPPORTFILES)
lib555_SOURCES = lib555.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib555_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib552_SOURCES = lib552.c $(SUPPORTFILES) $(WARNLESS)
@ -131,16 +146,19 @@ lib556_SOURCES = lib556.c $(SUPPORTFILES)
lib557_SOURCES = lib557.c $(SUPPORTFILES)
lib560_SOURCES = lib560.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib560_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib574_SOURCES = lib574.c $(SUPPORTFILES)
lib575_SOURCES = lib575.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib575_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib576_SOURCES = lib576.c $(SUPPORTFILES)
lib562_SOURCES = lib562.c $(SUPPORTFILES)
lib564_SOURCES = lib564.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib564_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib565_SOURCES = lib510.c $(SUPPORTFILES)
lib565_CPPFLAGS = $(AM_CPPFLAGS) -DLIB565
@ -160,16 +178,19 @@ lib571_SOURCES = lib571.c $(SUPPORTFILES) $(WARNLESS)
lib572_SOURCES = lib572.c $(SUPPORTFILES)
lib573_SOURCES = lib573.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(TSTTRACE)
lib573_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib578_SOURCES = lib578.c $(SUPPORTFILES)
lib579_SOURCES = lib579.c $(SUPPORTFILES)
lib582_SOURCES = lib582.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib582_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib583_SOURCES = lib583.c $(SUPPORTFILES)
lib585_SOURCES = lib500.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE)
lib585_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib585_CPPFLAGS = $(AM_CPPFLAGS) -DLIB585
lib586_SOURCES = lib586.c $(SUPPORTFILES)
@ -180,19 +201,24 @@ lib587_CPPFLAGS = $(AM_CPPFLAGS) -DLIB587
lib590_SOURCES = lib590.c $(SUPPORTFILES)
lib591_SOURCES = lib591.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib591_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib597_SOURCES = lib597.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib597_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib598_SOURCES = lib598.c $(SUPPORTFILES)
lib599_SOURCES = lib599.c $(SUPPORTFILES)
lib1500_SOURCES = lib1500.c $(SUPPORTFILES) $(TESTUTIL)
lib1500_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib1501_SOURCES = lib1501.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1501_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@
lib1502_SOURCES = lib1502.c $(SUPPORTFILES)
libauthretry_SOURCES = libauthretry.c $(SUPPORTFILES)
libntlmconnect_SOURCES = libntlmconnect.c $(SUPPORTFILES) $(TESTUTIL)
libntlmconnect_LDADD = $(top_builddir)/lib/libcurl.la @CURL_NETWORK_AND_TIME_LIBS@

View File

@ -31,42 +31,42 @@ UTIL = \
getpart_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) \
testpart.c
getpart_LDADD = @TEST_SERVER_LIBS@
getpart_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
getpart_CFLAGS = $(AM_CFLAGS)
resolve_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
resolve.c
resolve_LDADD = @TEST_SERVER_LIBS@
resolve_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
resolve_CFLAGS = $(AM_CFLAGS)
rtspd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
server_sockaddr.h \
rtspd.c
rtspd_LDADD = @TEST_SERVER_LIBS@
rtspd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
rtspd_CFLAGS = $(AM_CFLAGS)
sockfilt_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
server_sockaddr.h \
sockfilt.c \
$(top_srcdir)/lib/inet_pton.c
sockfilt_LDADD = @TEST_SERVER_LIBS@
sockfilt_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
sockfilt_CFLAGS = $(AM_CFLAGS)
sws_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
server_sockaddr.h \
sws.c \
$(top_srcdir)/lib/inet_pton.c
sws_LDADD = @TEST_SERVER_LIBS@
sws_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
sws_CFLAGS = $(AM_CFLAGS)
tftpd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
server_sockaddr.h \
tftpd.c \
tftp.h
tftpd_LDADD = @TEST_SERVER_LIBS@
tftpd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
tftpd_CFLAGS = $(AM_CFLAGS)
fake_ntlm_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
fake_ntlm.c
fake_ntlm_LDADD = @TEST_SERVER_LIBS@
fake_ntlm_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
fake_ntlm_CFLAGS = $(AM_CFLAGS)