add -latomic configure check...
...in preparation for <https://gerrit.libreoffice.org/#/c/78380/> "Add -latomic to the end of Linux C++ linker command lines" (copied from https://github.com/zelcash/zelcash/blob/master/build-aux/m4/l_atomic.m4) Change-Id: I8879a72d730cc08a72c2d8b132ff9f5d2efe7b9f Reviewed-on: https://gerrit.libreoffice.org/78336 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
committed by
Stephan Bergmann
parent
ae5fc99491
commit
098bf3b243
@@ -30,6 +30,7 @@ export AR=@AR@
|
|||||||
export ASSERT_ALWAYS_ABORT=@ASSERT_ALWAYS_ABORT@
|
export ASSERT_ALWAYS_ABORT=@ASSERT_ALWAYS_ABORT@
|
||||||
export ATL_INCLUDE=@ATL_INCLUDE@
|
export ATL_INCLUDE=@ATL_INCLUDE@
|
||||||
export ATL_LIB=@ATL_LIB@
|
export ATL_LIB=@ATL_LIB@
|
||||||
|
export ATOMIC_LIB=@ATOMIC_LIB@
|
||||||
export AVAHI_CFLAGS=$(gb_SPACE)@AVAHI_CFLAGS@
|
export AVAHI_CFLAGS=$(gb_SPACE)@AVAHI_CFLAGS@
|
||||||
export AVAHI_LIBS=$(gb_SPACE)@AVAHI_LIBS@
|
export AVAHI_LIBS=$(gb_SPACE)@AVAHI_LIBS@
|
||||||
export LIBATOMIC_OPS_CFLAGS=$(gb_SPACE)@LIBATOMIC_OPS_CFLAGS@
|
export LIBATOMIC_OPS_CFLAGS=$(gb_SPACE)@LIBATOMIC_OPS_CFLAGS@
|
||||||
|
@@ -6537,6 +6537,14 @@ else
|
|||||||
fi
|
fi
|
||||||
AC_SUBST(CXXFLAGS_CXX11)
|
AC_SUBST(CXXFLAGS_CXX11)
|
||||||
|
|
||||||
|
if test "$GCC" = "yes"; then
|
||||||
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
|
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
|
||||||
|
CHECK_L_ATOMIC
|
||||||
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
|
AC_SUBST(ATOMIC_LIB)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
|
dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
|
||||||
dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
|
dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
|
||||||
dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
|
dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
|
||||||
|
41
m4/l_atomic.m4
Normal file
41
m4/l_atomic.m4
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Some versions of gcc/libstdc++ require linking with -latomic if
|
||||||
|
# using the C++ atomic library.
|
||||||
|
#
|
||||||
|
# Sourced from http://bugs.debian.org/797228
|
||||||
|
|
||||||
|
m4_define([_CHECK_L_ATOMIC_testbody], [[
|
||||||
|
#include <atomic>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::atomic<int64_t> a{};
|
||||||
|
|
||||||
|
int64_t v = 5;
|
||||||
|
int64_t r = a.fetch_add(v);
|
||||||
|
return static_cast<int>(r);
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
AC_DEFUN([CHECK_L_ATOMIC], [
|
||||||
|
|
||||||
|
AC_LANG_PUSH(C++)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether std::atomic can be used without link library])
|
||||||
|
|
||||||
|
AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
LIBS="$LIBS -latomic"
|
||||||
|
AC_MSG_CHECKING([whether std::atomic needs -latomic])
|
||||||
|
AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_L_ATOMIC_testbody])],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
ATOMIC_LIB=-latomic
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
AC_MSG_FAILURE([cannot figure our how to use std::atomic])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_LANG_POP
|
||||||
|
])
|
Reference in New Issue
Block a user