Use more robust test for libatomics

Taken from Mesa configure script:

https://github.com/mesa3d/mesa/blob/17.2/configure.ac#L405-L427
This commit is contained in:
Matthew Bauer 2019-10-01 21:22:18 -04:00
parent 74b4737d8f
commit b1c34152fe

View file

@ -157,11 +157,18 @@ AX_BOOST_BASE([1.66], [CXXFLAGS="$BOOST_CPPFLAGS $CXXFLAGS"], [AC_MSG_ERROR([Nix
# ends up with LDFLAGS being empty, so we set it afterwards. # ends up with LDFLAGS being empty, so we set it afterwards.
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS" LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
# Boost atomic needs GCC libatomic on 32-bit ARM # On some platforms, new-style atomics need a helper library
case "$host_cpu" in AC_MSG_CHECKING(whether -latomic is needed)
armv5*|armv6*|armv7*) LIBS="-latomic $LIBS" AC_LINK_IFELSE([AC_LANG_SOURCE([[
esac #include <stdint.h>
uint64_t v;
int main() {
return (int)__atomic_load_n(&v, __ATOMIC_ACQUIRE);
}]])], GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=no, GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=yes)
AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC)
if test "x$GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC" = xyes; then
LIBS="-latomic $LIBS"
fi
# Look for OpenSSL, a required dependency. # Look for OpenSSL, a required dependency.
PKG_CHECK_MODULES([OPENSSL], [libcrypto], [CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS"]) PKG_CHECK_MODULES([OPENSSL], [libcrypto], [CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS"])