9cd11133f9
We really only support building Unit with GCC and Clang. Cc: Dan Callahan <d.callahan@f5.com> Reviewed-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
41 lines
1.1 KiB
Text
41 lines
1.1 KiB
Text
|
|
# Copyright (C) Igor Sysoev
|
|
# Copyright (C) NGINX, Inc.
|
|
|
|
|
|
# GCC 4.1+ builtin atomic operations.
|
|
|
|
nxt_feature="GCC builtin atomic operations"
|
|
nxt_feature_name=NXT_HAVE_GCC_ATOMIC
|
|
nxt_feature_run=yes
|
|
nxt_feature_incs=
|
|
nxt_feature_libs=
|
|
nxt_feature_test="int main(void) {
|
|
long n = 0;
|
|
|
|
if (!__sync_bool_compare_and_swap(&n, 0, 3))
|
|
return 1;
|
|
if (__sync_fetch_and_add(&n, 1) != 3)
|
|
return 1;
|
|
if (__sync_lock_test_and_set(&n, 5) != 4)
|
|
return 1;
|
|
if (n != 5)
|
|
return 1;
|
|
if (__sync_or_and_fetch(&n, 2) != 7)
|
|
return 1;
|
|
if (__sync_and_and_fetch(&n, 5) != 5)
|
|
return 1;
|
|
__sync_lock_release(&n);
|
|
if (n != 0)
|
|
return 1;
|
|
return 0;
|
|
}"
|
|
. auto/feature
|
|
|
|
|
|
if [ $nxt_found = no ]; then
|
|
$echo
|
|
$echo $0: error: no atomic operations found.
|
|
$echo
|
|
exit 1;
|
|
fi
|