1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/s390.
4 dnl It is always possible to access static and hidden symbols in an
5 dnl position independent way.
6 AC_DEFINE(PI_STATIC_AND_HIDDEN)
8 AC_CACHE_CHECK(for __builtin_tbegin, libc_cv_gcc_builtin_tbegin, [dnl
9 cat > conftest.c <<\EOF
10 #include <htmintrin.h>
11 void testtransaction ()
13 if (__builtin_tbegin (0) == _HTM_TBEGIN_STARTED)
20 dnl test, if the tbegin instruction is used by __builtin_tbegin
21 if AC_TRY_COMMAND([${CC-cc} -mhtm -O2 -S conftest.c -o - | grep -w tbegin > /dev/null]) ;
23 libc_cv_gcc_builtin_tbegin=yes
25 libc_cv_gcc_builtin_tbegin=no
29 if test "$libc_cv_gcc_builtin_tbegin" = no ; then
30 critic_missing="$critic_missing The used GCC has no support for __builtin_tbegin, which is needed for lock-elision on target S390."
34 AC_CACHE_CHECK(for S390 vector instruction support, libc_cv_asm_s390_vx, [dnl
35 cat > conftest.c <<\EOF
38 __asm__ (".machine \"z13\" \n\t"
39 ".machinemode \"zarch_nohighgprs\" \n\t"
40 "vistrbs %%v16,%%v17 \n\t"
41 "locghie %%r1,0" : :);
45 dnl test, if assembler supports S390 vector instructions
46 if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
48 libc_cv_asm_s390_vx=yes
50 libc_cv_asm_s390_vx=no
54 if test "$libc_cv_asm_s390_vx" = yes ;
56 AC_DEFINE(HAVE_S390_VX_ASM_SUPPORT)
58 AC_MSG_WARN([Use binutils with vector-support in order to use optimized implementations.])
61 AC_CACHE_CHECK(for S390 vector support in gcc, libc_cv_gcc_s390_vx, [dnl
62 cat > conftest.c <<\EOF
63 void testvecclobber ()
65 __asm__ ("" : : : "v16");
69 dnl test, if gcc supports S390 vector registers as clobber in inline assembly
70 if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
72 libc_cv_gcc_s390_vx=yes
74 libc_cv_gcc_s390_vx=no
78 if test "$libc_cv_gcc_s390_vx" = yes ;
80 AC_DEFINE(HAVE_S390_VX_GCC_SUPPORT)
83 AC_CACHE_CHECK(for S390 arch13 zarch instruction support,
84 libc_cv_asm_s390_arch13, [dnl
85 cat > conftest.c <<\EOF
86 void testinsn (char *buf)
88 __asm__ (".machine \"arch13\" \n\t"
89 ".machinemode \"zarch_nohighgprs\" \n\t"
91 "mvcrl 0(%0),32(%0) \n\t"
92 "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
93 : : "a" (buf) : "memory", "r0");
96 dnl test, if assembler supports S390 arch13 instructions
97 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
98 -o conftest.o &> /dev/null]) ;
100 libc_cv_asm_s390_arch13=yes
102 libc_cv_asm_s390_arch13=no
105 if test "$libc_cv_asm_s390_arch13" = yes ;
107 AC_DEFINE(HAVE_S390_ARCH13_ASM_SUPPORT)
111 AC_CACHE_CHECK(for S390 z10 zarch instruction support as default,
112 libc_cv_asm_s390_min_z10_zarch, [dnl
113 cat > conftest.c <<\EOF
114 void testinsn (void *a, void *b, int n)
116 __asm__ ("exrl %2,1f \n\t"
118 "1: mvc 0(1,%0),0(%1) \n\t"
120 : : "a" (a), "a" (b), "d" (n)
125 dnl test, if assembler supports S390 z10 zarch instructions as default
126 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
127 -o conftest.o &> /dev/null]) ;
129 libc_cv_asm_s390_min_z10_zarch=yes
131 libc_cv_asm_s390_min_z10_zarch=no
135 if test "$libc_cv_asm_s390_min_z10_zarch" = yes ;
137 AC_DEFINE(HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT)
140 AC_CACHE_CHECK(for S390 z196 zarch instruction support as default,
141 libc_cv_asm_s390_min_z196_zarch, [dnl
142 cat > conftest.c <<\EOF
143 float testinsn (double e)
146 __asm__ ("ledbra %0,5,%1,4" : "=f" (d) : "f" (e) );
151 dnl test, if assembler supports S390 z196 zarch instructions as default
152 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
153 -o conftest.o &> /dev/null]) ;
155 libc_cv_asm_s390_min_z196_zarch=yes
157 libc_cv_asm_s390_min_z196_zarch=no
161 if test "$libc_cv_asm_s390_min_z196_zarch" = yes ;
163 AC_DEFINE(HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT)
166 AC_CACHE_CHECK(for S390 z13 zarch instruction support as default,
167 libc_cv_asm_s390_min_z13_zarch, [dnl
168 cat > conftest.c <<\EOF
172 __asm__ ("vl %%v16,0(%%r15)\n\t"
174 : "=d" (i) : : "memory", "v16");
179 dnl test, if assembler supports S390 z13 zarch instructions as default
180 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
181 -o conftest.o &> /dev/null]) ;
183 libc_cv_asm_s390_min_z13_zarch=yes
185 libc_cv_asm_s390_min_z13_zarch=no
189 if test "$libc_cv_asm_s390_min_z13_zarch" = yes ;
191 AC_DEFINE(HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT)
194 AC_CACHE_CHECK(for S390 arch13 zarch instruction support as default,
195 libc_cv_asm_s390_min_arch13_zarch, [dnl
196 cat > conftest.c <<\EOF
197 void testinsn (char *buf)
199 __asm__ ("lghi %%r0,16 \n\t"
200 "mvcrl 0(%0),32(%0) \n\t"
201 "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
202 : : "a" (buf) : "memory", "r0");
205 dnl test, if assembler supports S390 arch13 zarch instructions as default
206 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
207 -o conftest.o &> /dev/null]) ;
209 libc_cv_asm_s390_min_arch13_zarch=yes
211 libc_cv_asm_s390_min_arch13_zarch=no
214 if test "$libc_cv_asm_s390_min_arch13_zarch" = yes ;
216 AC_DEFINE(HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT)
219 dnl test if GCC is new enough. See gcc "Bug 98269 - gcc 6.5.0
220 dnl __builtin_add_overflow() with small uint32_t values incorrectly detects
222 dnl (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269)
223 AC_CACHE_CHECK([if $CC is sufficient to build libc on s390x],
224 libc_cv_compiler_ok_on_s390x, [
226 #if !defined __GNUC__ || __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 1)
227 #error insufficient compiler for building on s390x
230 [libc_cv_compiler_ok_on_s390x=yes],
231 [libc_cv_compiler_ok_on_s390x=no])])
232 if test "$libc_cv_compiler_ok_on_s390x" != yes; then
233 critic_missing="$critic_missing On s390x, GCC >= 7.1.0 is required."
236 test -n "$critic_missing" && AC_MSG_ERROR([
237 *** $critic_missing])