From 4825009e420da111c82ce73647c53c55e8a6e41d Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mon, 26 Oct 2015 20:30:13 +0100 Subject: [PATCH] tests: fix broken linkage with --disable-static --- configure.ac | 3 +++ tests/Makefile.am | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 63e48f14..69c50ddd 100644 --- a/configure.ac +++ b/configure.ac @@ -695,6 +695,9 @@ if test "x$threads" != "xyes" || AC_DEFINE([NOTHREADS], [1], [Define to 1 if you want to disable threads.]) fi +# propagate $enable_static to tests/Makefile.am +AM_CONDITIONAL([ENABLE_STATIC], [test "x$enable_static" = "xyes"]) + AC_SUBST([TESTLDADD]) AC_SUBST([APPLDFLAGS]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 4ef17bb8..efcd7a5d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -49,7 +49,15 @@ HFILES = nghttp2_pq_test.h nghttp2_map_test.h nghttp2_queue_test.h \ main_SOURCES = $(HFILES) $(OBJECTS) -main_LDADD = ${top_builddir}/lib/libnghttp2.la @CUNIT_LIBS@ @TESTLDADD@ +if ENABLE_STATIC +main_LDADD = ${top_builddir}/lib/libnghttp2.la +else +# With static lib disabled and symbol hiding enabled, we have to link object +# files directly because the tests use symbols not included in public API. +main_LDADD = ${top_builddir}/lib/.libs/*.o +endif + +main_LDADD += @CUNIT_LIBS@ @TESTLDADD@ main_LDFLAGS = -static if ENABLE_FAILMALLOC