atomic operations test-run
diff --git a/auto/cc/conf b/auto/cc/conf
index 8916ad0..a7c8a09 100644
--- a/auto/cc/conf
+++ b/auto/cc/conf
@@ -127,13 +127,18 @@
ngx_feature="gcc builtin atomic operations"
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
- ngx_feature_run=no
+ ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
- ngx_feature_test="long n;
- __sync_bool_compare_and_swap(&n, 0, 1);
- __sync_fetch_and_add(&n, 1);"
+ ngx_feature_test="long n = 0;
+ if (!__sync_bool_compare_and_swap(&n, 0, 1))
+ return 1;
+ if (__sync_fetch_and_add(&n, 1) != 1)
+ return 1;
+ if (n != 2)
+ return 1;
+ __sync_synchronize();"
. auto/feature
diff --git a/auto/lib/libatomic/conf b/auto/lib/libatomic/conf
index a06ab1a..214feb3 100644
--- a/auto/lib/libatomic/conf
+++ b/auto/lib/libatomic/conf
@@ -13,15 +13,18 @@
ngx_feature="atomic_ops library"
ngx_feature_name=NGX_HAVE_LIBATOMIC
- ngx_feature_run=no
+ ngx_feature_run=yes
ngx_feature_incs="#include <atomic_ops.h>"
ngx_feature_path=
ngx_feature_libs="-latomic_ops"
- ngx_feature_test="AO_t *n;
- AO_compare_and_swap(n, 0, 1);
- AO_fetch_and_add(n, 1);
+ ngx_feature_test="long n = 0;
+ if (!AO_compare_and_swap(&n, 0, 1))
+ return 1;
+ if (AO_fetch_and_add(&n, 1) != 1)
+ return 1;
+ if (n != 2)
+ return 1;
AO_nop();"
-
. auto/feature
if [ $ngx_found = yes ]; then