Skip to content

Commit

Permalink
Check and link libatomic if needed
Browse files Browse the repository at this point in the history
Some architectures without native support for 64-bit atomics need
linking with libatomic.
  • Loading branch information
jpalus committed Dec 3, 2023
1 parent a67fd67 commit 1511e9f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,19 @@ CXX="$PTHREAD_CXX"
])

# Atomics
AC_CHECK_HEADERS([stdatomic.h])
AC_CHECK_HEADERS([stdatomic.h],
[AC_MSG_CHECKING([whether libatomic is required])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdatomic.h>]], [[atomic_uint_fast64_t i; i++;]])],
[AC_MSG_RESULT([no])],
[save_LIBS="$LIBS"
LIBS="$LIBS -latomic"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdatomic.h>]], [[atomic_uint_fast64_t i; i++;]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([failed to find working configuration with atomics])]
)]
)],
[]
)

# Check for poll.h (it's in POSIX so everyone should have it?)
AC_CHECK_HEADERS([poll.h])
Expand Down

0 comments on commit 1511e9f

Please sign in to comment.