Use _LDADD to specify libraries instead of _LDFLAGS
This is because _LDFLAGS comes before _LDADD. If we specify a library and another library in _LDADD depends on it, we get undefined reference error.
This commit is contained in:
parent
682db00ba9
commit
fbd9bcb00e
|
@ -236,7 +236,7 @@ AC_LANG_POP()
|
|||
# Checks for libraries.
|
||||
|
||||
# Additional libraries required for tests.
|
||||
TESTLDFLAGS=
|
||||
TESTLDADD=
|
||||
|
||||
# Additional libraries required for programs under src directory.
|
||||
APPLDFLAGS=
|
||||
|
@ -245,7 +245,7 @@ LIBS_OLD=$LIBS
|
|||
# Search for dlsym function, which is used in tests. Linux needs -ldl,
|
||||
# but netbsd does not need it.
|
||||
AC_SEARCH_LIBS([dlsym], [dl])
|
||||
TESTLDFLAGS="$LIBS $TESTLDFLAGS"
|
||||
TESTLDADD="$LIBS $TESTLDADD"
|
||||
LIBS=$LIBS_OLD
|
||||
|
||||
LIBS_OLD=$LIBS
|
||||
|
@ -636,7 +636,7 @@ if test "x$threads" != "xyes" ||
|
|||
AC_DEFINE([NOTHREADS], [1], [Define to 1 if you want to disable threads.])
|
||||
fi
|
||||
|
||||
AC_SUBST([TESTLDFLAGS])
|
||||
AC_SUBST([TESTLDADD])
|
||||
AC_SUBST([APPLDFLAGS])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
|
|
|
@ -33,12 +33,10 @@ AM_CPPFLAGS = \
|
|||
@LIBEVENT_OPENSSL_CFLAGS@ \
|
||||
@OPENSSL_CFLAGS@ \
|
||||
@DEFS@
|
||||
AM_LDFLAGS = \
|
||||
LDADD = $(top_builddir)/lib/libnghttp2.la \
|
||||
$(top_builddir)/third-party/libhttp-parser.la \
|
||||
@LIBEVENT_OPENSSL_LIBS@ \
|
||||
@OPENSSL_LIBS@
|
||||
LDADD = \
|
||||
$(top_builddir)/lib/libnghttp2.la \
|
||||
$(top_builddir)/third-party/libhttp-parser.la
|
||||
|
||||
noinst_PROGRAMS = client libevent-client libevent-server deflate
|
||||
|
||||
|
@ -63,22 +61,18 @@ if ENABLE_ASIO_LIB
|
|||
noinst_PROGRAMS += asio-sv asio-sv2 asio-sv3
|
||||
|
||||
ASIOCPPFLAGS = ${BOOST_CPPFLAGS} ${AM_CPPFLAGS}
|
||||
ASIOLDFLAGS = @JEMALLOC_LIBS@
|
||||
ASIOLDADD = $(top_builddir)/src/libnghttp2_asio.la
|
||||
ASIOLDADD = $(top_builddir)/src/libnghttp2_asio.la @JEMALLOC_LIBS@
|
||||
|
||||
asio_sv_SOURCES = asio-sv.cc
|
||||
asio_sv_CPPFLAGS = ${ASIOCPPFLAGS}
|
||||
asio_sv_LDFLAGS = ${ASIOLDFLAGS}
|
||||
asio_sv_LDADD = ${ASIOLDADD}
|
||||
|
||||
asio_sv2_SOURCES = asio-sv2.cc
|
||||
asio_sv2_CPPFLAGS = ${ASIOCPPFLAGS}
|
||||
asio_sv2_LDFLAGS = ${ASIOLDFLAGS}
|
||||
asio_sv2_LDADD = ${ASIOLDADD}
|
||||
|
||||
asio_sv3_SOURCES = asio-sv3.cc
|
||||
asio_sv3_CPPFLAGS = ${ASIOCPPFLAGS}
|
||||
asio_sv3_LDFLAGS = ${ASIOLDFLAGS}
|
||||
asio_sv3_LDADD = ${ASIOLDADD}
|
||||
|
||||
endif # ENABLE_ASIO_LIB
|
||||
|
|
|
@ -41,7 +41,9 @@ AM_CPPFLAGS = \
|
|||
@JANSSON_CFLAGS@ \
|
||||
@ZLIB_CFLAGS@ \
|
||||
@DEFS@
|
||||
AM_LDFLAGS = \
|
||||
|
||||
LDADD = $(top_builddir)/lib/libnghttp2.la \
|
||||
$(top_builddir)/third-party/libhttp-parser.la \
|
||||
@JEMALLOC_LIBS@ \
|
||||
@LIBSPDYLAY_LIBS@ \
|
||||
@XML_LIBS@ \
|
||||
|
@ -51,10 +53,6 @@ AM_LDFLAGS = \
|
|||
@ZLIB_LIBS@ \
|
||||
@APPLDFLAGS@
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/lib/libnghttp2.la \
|
||||
$(top_builddir)/third-party/libhttp-parser.la
|
||||
|
||||
if ENABLE_APP
|
||||
|
||||
bin_PROGRAMS += nghttp nghttpd nghttpx
|
||||
|
@ -131,8 +129,7 @@ noinst_LIBRARIES = libnghttpx.a
|
|||
libnghttpx_a_SOURCES = ${NGHTTPX_SRCS}
|
||||
|
||||
nghttpx_SOURCES = shrpx.cc shrpx.h
|
||||
nghttpx_LDFLAGS =
|
||||
nghttpx_LDADD = libnghttpx.a ${LDADD} ${AM_LDFLAGS}
|
||||
nghttpx_LDADD = libnghttpx.a ${LDADD}
|
||||
|
||||
if HAVE_CUNIT
|
||||
check_PROGRAMS += nghttpx-unittest
|
||||
|
@ -147,10 +144,8 @@ nghttpx_unittest_SOURCES = shrpx-unittest.cc \
|
|||
ringbuf_test.cc ringbuf_test.h \
|
||||
memchunk_test.cc memchunk_test.h
|
||||
nghttpx_unittest_CPPFLAGS = ${AM_CPPFLAGS}\
|
||||
-DNGHTTP2_TESTS_DIR=\"$(top_srcdir)/tests\"
|
||||
nghttpx_unittest_LDFLAGS = ${AM_LDFLAGS} \
|
||||
@CUNIT_LIBS@ @TESTLDFLAGS@
|
||||
nghttpx_unittest_LDADD = libnghttpx.a ${LDADD}
|
||||
-DNGHTTP2_TESTS_DIR=\"$(top_srcdir)/tests\"
|
||||
nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} @CUNIT_LIBS@ @TESTLDADD@
|
||||
|
||||
TESTS += nghttpx-unittest
|
||||
endif # HAVE_CUNIT
|
||||
|
@ -186,15 +181,14 @@ libnghttp2_asio_la_SOURCES = \
|
|||
util.cc util.h http2.cc http2.h \
|
||||
ssl.cc ssl.h
|
||||
|
||||
libnghttp2_asio_la_CPPFLAGS= ${AM_CPPFLAGS} ${BOOST_CPPFLAGS}
|
||||
libnghttp2_asio_la_LDFLAGS = \
|
||||
libnghttp2_asio_la_CPPFLAGS = ${AM_CPPFLAGS} ${BOOST_CPPFLAGS}
|
||||
libnghttp2_asio_la_LDFLAGS = -no-undefined -version-info 0:0:0
|
||||
libnghttp2_asio_la_LIBADD = \
|
||||
$(top_builddir)/lib/libnghttp2.la \
|
||||
${BOOST_LDFLAGS} \
|
||||
${BOOST_ASIO_LIB} \
|
||||
${BOOST_THREAD_LIB} \
|
||||
${BOOST_SYSTEM_LIB} \
|
||||
@OPENSSL_LIBS@ \
|
||||
-no-undefined \
|
||||
-version-info 0:0:0
|
||||
libnghttp2_asio_la_LIBADD = $(top_builddir)/lib/libnghttp2.la
|
||||
@OPENSSL_LIBS@
|
||||
|
||||
endif # ENABLE_ASIO_LIB
|
||||
|
|
|
@ -49,8 +49,8 @@ HFILES = nghttp2_pq_test.h nghttp2_map_test.h nghttp2_queue_test.h \
|
|||
|
||||
main_SOURCES = $(HFILES) $(OBJECTS)
|
||||
|
||||
main_LDADD = ${top_builddir}/lib/libnghttp2.la
|
||||
main_LDFLAGS = -static @CUNIT_LIBS@ @TESTLDFLAGS@
|
||||
main_LDADD = ${top_builddir}/lib/libnghttp2.la @CUNIT_LIBS@ @TESTLDADD@
|
||||
main_LDFLAGS = -static
|
||||
|
||||
if ENABLE_FAILMALLOC
|
||||
failmalloc_SOURCES = failmalloc.c failmalloc_test.c failmalloc_test.h \
|
||||
|
|
Loading…
Reference in New Issue