summaryrefslogtreecommitdiff
path: root/lib/replace/wscript
diff options
context:
space:
mode:
Diffstat (limited to 'lib/replace/wscript')
-rw-r--r--lib/replace/wscript25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 84516898003..f0040b18e02 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -106,6 +106,7 @@ struct foo bar = { .y = 'X', .x = 1 };
conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h')
conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h malloc.h')
conf.CHECK_HEADERS('syscall.h sys/syscall.h inttypes.h')
+ conf.CHECK_HEADERS('sys/atomic.h')
# Check for process set name support
conf.CHECK_CODE('''
@@ -225,6 +226,30 @@ struct foo bar = { .y = 'X', .x = 1 };
msg="Checking whether we have ucontext_t",
headers='signal.h sys/ucontext.h')
+ # Check for atomic builtins. */
+ conf.CHECK_CODE('''
+ int main(void) {
+ int i;
+ (void)__sync_fetch_and_add(&i, 1);
+ return 0;
+ }
+ ''',
+ 'HAVE___SYNC_FETCH_AND_ADD',
+ msg='Checking for __sync_fetch_and_add compiler builtin')
+
+ conf.CHECK_CODE('''
+ #include <stdint.h>
+ #include <sys/atomic.h>
+ int main(void) {
+ int32_t i;
+ atomic_add_32(&i, 1);
+ return 0;
+ }
+ ''',
+ 'HAVE_ATOMIC_ADD_32',
+ headers='stdint.h sys/atomic.h',
+ msg='Checking for atomic_add_32 compiler builtin')
+
# these may be builtins, so we need the link=False strategy
conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False)