1GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2# Local configure fragment for sysdeps/sparc/sparc32
3
4# Test if compiler targets at least sparcv8.
5AC_CACHE_CHECK([for at least sparcv8 support],
6  [libc_cv_sparcv8],
7  [AC_EGREP_CPP(yes,[#if defined (__sparc_v8__) || defined (__sparc_v9__)
8                      yes
9                     #endif
10  ], libc_cv_sparcv8=yes, libc_cv_sparcv8=no)])
11if test $libc_cv_sparcv8 = no; then
12  AC_MSG_ERROR([no support for pre-v8 sparc])
13fi
14
15# Test if compiler generates external calls to libatomic for CAS operation.
16# It is suffice to check for int only and the test is similar of C11
17# atomic_compare_exchange_strong using GCC builtins.
18AC_CACHE_CHECK(for external libatomic calls,
19	       libc_cv_cas_uses_libatomic,
20	       [cat > conftest.c <<EOF
21	       _Bool foo (int *ptr, int *expected, int desired)
22	       {
23		 return __atomic_compare_exchange_n (ptr, expected, desired, 0,
24						     __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
25	       }
26EOF
27	       libc_cv_cas_uses_libatomic=no
28	       if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
29		 if grep '__atomic_compare_exchange_4' conftest.s >/dev/null; then
30		   libc_cv_cas_uses_libatomic=yes
31		 fi
32	       fi
33	       rm -f conftest.c conftest.s
34	       ])
35if test $libc_cv_cas_uses_libatomic = yes; then
36  AC_MSG_ERROR([external dependency of libatomic is not supported])
37fi
38