From e45d8f94fca96c8bcb49ef0d18ed2ffab6dbe4f8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 15 Oct 2021 23:02:39 +0200 Subject: [PATCH] Link C modules with libpthread under Unix systems Specify -pthread option which should be universally supported under non-{MSW,Mac} platforms by now and which is required under Linux to link the tests using boost::shared_ptr<>, which uses pthread_mutex_xxx(). --- configure.ac | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index c8ed80e0f..c7dfd357b 100644 --- a/configure.ac +++ b/configure.ac @@ -2434,20 +2434,31 @@ fi AC_SUBST(RBIN) -# C module on Mac OS X tweaks +#---------------------------------------------------------------- +# Nothing to look for in C case, just define some variables +#---------------------------------------------------------------- + +# Some tweaks for creating shared modules. +C_SO='$(SO)' + case $host in -*-*-darwin*) - C_LDSHARED="cc -dynamiclib" - CXX_LDSHARED="g++ -dynamiclib" +*-*-darwin*) + C_LDFLAGS='-dynamiclib' C_SO=".dylib" ;; +*-*-cygwin* | *-*-mingw*) + # Nothing special to do. + ;; *) - C_LDSHARED='$(LDSHARED)' - CXX_LDSHARED='$(CXXSHARED)' - C_SO='$(SO)' + # This is needed for linking with Boost which uses mutexes and does no + # harm in all the other cases. + C_LDFLAGS='-pthread' ;; esac +C_LDSHARED="\$(LDSHARED) $C_LDFLAGS" +CXX_LDSHARED="\$(CXXSHARED) $C_LDFLAGS" + AC_SUBST(C_LDSHARED) AC_SUBST(CXX_LDSHARED) AC_SUBST(C_SO)