Build System: Require __sync or __atomic functions.

This change causes the configure script to throw an error if neither
__sync nor __atomic builtin functions are available.

ASTERISK-27619

Change-Id: Ie01a281e0f5c41dfeeb5f250c1ccea8752f56ef9
This commit is contained in:
Corey Farrell
2018-01-25 02:37:32 -05:00
parent 6fbd855228
commit 23381d2c5e
7 changed files with 33 additions and 125 deletions

View File

@@ -1074,6 +1074,7 @@ AC_MSG_CHECKING(for compiler sync operations)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
AC_MSG_RESULT(yes)
ax_cv_have_gcc_atomics=1
AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides __sync atomic operations.]),
AC_MSG_RESULT(no)
)
@@ -1082,10 +1083,15 @@ AC_MSG_CHECKING(for compiler atomic operations)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [int foo1; int foo2 = __atomic_fetch_add(&foo1, 1, __ATOMIC_RELAXED);])],
AC_MSG_RESULT(yes)
ax_cv_have_c_atomics=1
AC_DEFINE([HAVE_C_ATOMICS], 1, [Define to 1 if your C compiler provides __atomic operations.]),
AC_MSG_RESULT(no)
)
if test -z $ax_cv_have_c_atomics$ax_cv_have_gcc_atomics; then
AC_MSG_ERROR([*** Atomic operations are not supported by your compiler.])
fi
# glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
AC_MSG_CHECKING([if your system printf is NULL-safe.])
AC_RUN_IFELSE(
@@ -1413,9 +1419,6 @@ AST_C_DEFINE_CHECK([RTLD_NOLOAD], [RTLD_NOLOAD], [dlfcn.h])
AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
AC_CHECK_HEADER([libkern/OSAtomic.h],
[AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])