$NetBSD: patch-configure,v 1.5 2022/10/07 20:22:56 he Exp $ Portability. Also, test whether we can do atomics on time_t, not possible on 32-bit CPUs running NetBSD (where time_t is __int64_t) --- configure.orig 2018-09-17 11:27:47.000000000 +0000 +++ configure @@ -15579,7 +15579,7 @@ $as_echo "#define OS_AIX 1" >>confdefs.h ;; esac - if test x$os_type == xapple; then + if test x$os_type = xapple; then OS_APPLE_TRUE= OS_APPLE_FALSE='#' else @@ -15587,7 +15587,7 @@ else OS_APPLE_FALSE= fi - if test x$os_type == xlinux; then + if test x$os_type = xlinux; then OS_LINUX_TRUE= OS_LINUX_FALSE='#' else @@ -15595,7 +15595,7 @@ else OS_LINUX_FALSE= fi - if test x$os_type == xaix; then + if test x$os_type = xaix; then OS_AIX_TRUE= OS_AIX_FALSE='#' else @@ -17265,40 +17265,54 @@ else else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include int main() { unsigned long val = 1010, tmp, *mem = &val; + time_t tval = 1010, ttmp, *tmem = &tval; + if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020) return 1; - tmp = val; - if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010) return 1; - if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0) return 1; - tmp = 3030; - if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp) return 1; - if (__sync_lock_test_and_set(&val, 4040) != 3030) return 1; - mem = &tmp; - if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp) return 1; + if (__sync_fetch_and_add(&tval, 1010) != 1010 || tval != 2020) + return 1; + ttmp = tval; + if (__sync_fetch_and_sub(tmem, 1010) != ttmp || tval != 1010) + return 1; + if (__sync_sub_and_fetch(&tval, 1010) != 0 || tval != 0) + return 1; + ttmp = 3030; + if (__sync_val_compare_and_swap(tmem, 0, ttmp) != 0 || tval != ttmp) + return 1; + if (__sync_lock_test_and_set(&tval, 4040) != 3030) + return 1; + tmem = &ttmp; + if (__sync_val_compare_and_swap(&tmem, &ttmp, &tval) != &ttmp) + return 1; + __sync_synchronize(); if (mem != &val) return 1; + if (tmem != &tval) + return 1; + return 0; } _ACEOF