mirror of
https://github.com/libusb/libusb.git
synced 2025-06-01 16:17:40 +00:00
configure.ac: Link with -latomic only if no atomic builtins
Follow-up to561dbda
, a check of GCC atomic builtins needs to be done first. I'm no autoconf guru, but using this:0df485c285/configure.ac (L469)
as inspiration, I created a pre-check before calling AC_SEARCH_LIBS(...) Fixes #1135 Closes #1139
This commit is contained in:
parent
0c09ba6daf
commit
95e601ce11
2 changed files with 16 additions and 2 deletions
16
configure.ac
16
configure.ac
|
@ -153,7 +153,21 @@ if test "x$platform" = xposix; then
|
|||
AC_SEARCH_LIBS([pthread_create], [pthread],
|
||||
[test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
|
||||
[], [])
|
||||
AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
|
||||
dnl Check for new-style atomic builtins. We first check without linking to -latomic.
|
||||
AC_MSG_CHECKING(whether __atomic_load_n is supported)
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdint.h>
|
||||
int main() {
|
||||
struct {
|
||||
uint64_t *v;
|
||||
} x;
|
||||
return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
|
||||
(int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
|
||||
}]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no)
|
||||
AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_SUPPORTED)
|
||||
if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then
|
||||
AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
|
||||
fi
|
||||
elif test "x$platform" = xwindows; then
|
||||
AC_DEFINE([PLATFORM_WINDOWS], [1], [Define to 1 if compiling for a Windows platform.])
|
||||
else
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define LIBUSB_NANO 11733
|
||||
#define LIBUSB_NANO 11734
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue