Skip to content
Snippets Groups Projects
Commit 467e3e5f authored by Jö Fahlke's avatar Jö Fahlke
Browse files

Merge branch 'feature/fs1650-no-as-needed'

parents 6552b897 71e08e51
No related branches found
No related tags found
No related merge requests found
......@@ -278,8 +278,16 @@ if(${CMAKE_VERSION} VERSION_LESS "3.1")
else()
find_package(Threads)
endif()
set(STDTHREAD_LINK_FLAGS "${CMAKE_THREAD_LIBS_INIT}"
CACHE STRING "Linker flags needed to get working C++11 threads support")
# see whether threading needs -no-as-needed
if(EXISTS /etc/dpkg/origins/ubuntu)
set(NO_AS_NEEDED "-Wl,-no-as-needed")
else(EXISTS /etc/dpkg/origins/ubuntu)
set(NO_AS_NEEDED "")
endif(EXISTS /etc/dpkg/origins/ubuntu)
set(STDTHREAD_LINK_FLAGS "${NO_AS_NEEDED} ${CMAKE_THREAD_LIBS_INIT}"
CACHE STRING "Linker flags needed to get working C++11 threads support. On Ubuntu it may be necessary to include -Wl,-no-as-needed (see FS#1650).")
# set linker flags
#
......
......@@ -4,12 +4,13 @@
AC_DEFUN([DUNE_STDTHREAD],[
AC_REQUIRE([ACX_PTHREAD])
AC_REQUIRE([DUNE_NO_AS_NEEDED])
AC_CACHE_CHECK([libraries needed for std::thread],
[dune_cv_stdthread_libs],
[dune_cv_stdthread_libs=$PTHREAD_LIBS])
AC_CACHE_CHECK([linker flags needed for std::thread],
[dune_cv_stdthread_ldflags],
[dune_cv_stdthread_ldflags=$PTHREAD_CFLAGS])
[dune_cv_stdthread_ldflags="$NO_AS_NEEDED $PTHREAD_CFLAGS"])
AC_CACHE_CHECK([compiler flags needed for std::thread],
[dune_cv_stdthread_cppflags],
[dune_cv_stdthread_cppflags=$PTHREAD_CFLAGS])
......@@ -58,3 +59,13 @@ AC_DEFUN([DUNE_STDTHREAD_TESTPROG], [dnl
t.join();
]])dnl
])
AC_DEFUN([DUNE_NO_AS_NEEDED], [dnl
AC_CACHE_CHECK([whether the linker needs -Wl,-no-as-needed],
[dune_cv_no_as_needed],
[AS_IF([test -f /etc/dpkg/origins/ubuntu], [dune_cv_no_as_needed="yes (Ubuntu)"],
[dune_cv_no_as_needed="no"])])
AS_CASE([$dune_cv_no_as_needed],
[yes|"yes "*], [NO_AS_NEEDED=-Wl,-no-as-needed],
[NO_AS_NEEDED=])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment