Fix 'duplicate symbol' error for tests using multiple static libs (OS X)
authorIvan Maidanski <ivmai@mail.ru>
Tue, 26 Feb 2019 21:48:12 +0000 (00:48 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Feb 2019 21:53:05 +0000 (00:53 +0300)
commit4199c59c4ceb53f00f87b6d8a4eaa45db78358cf
treec31cd5dad7ebb7e5d407d5ac965dcf93cef16727
parentd11b6dc29ebe5f412dd49a066ac637d908353452
Fix 'duplicate symbol' error for tests using multiple static libs (OS X)

Issue #263 (bdwgc).

If configured with --enable-static, libtool passes libgc.a to gcc
twice (with a relative path and with an absolute one) when linking
tests that depend on libcord.a, libgccpp.a or libstaticrootslib_test.a
which, in turn, depends on libgc.a.  Double specification of libgc.a
seems to confuse ld tool of MacOS 10.14.

The workaround is to omit libgc.la in *_LDADD specification of the
mentioned tests when the shared libraries are not requested, at least.

* configure.ac (ENABLE_SHARED): New AM_CONDITIONAL.
* cord/cord.am (cordtest_LDADD): Do not add libgc.la unless
ENABLE_SHARED; add comment.
* tests/tests.am (staticrootstest_LDADD): Likewise.
* tests/tests.am [CPLUSPLUS && !AVOID_CPP_LIB] (test_cpp_LDADD):
Likewise.
configure.ac
cord/cord.am
tests/tests.am