Use '%z' instead of '%Z' on printf functions
[glibc.git] / sysdeps / s390 / configure.ac
blobdaf1bc68233fcb076ac35f28e43014722f3d280a
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/s390.
4 AC_CACHE_CHECK(for __builtin_tbegin, libc_cv_gcc_builtin_tbegin, [dnl
5 cat > conftest.c <<\EOF
6 #include <htmintrin.h>
7 void testtransaction ()
9   if (__builtin_tbegin (0) == _HTM_TBEGIN_STARTED)
10     {
11       __builtin_tend ();
12     }
14 EOF
15 dnl
16 dnl test, if the tbegin instruction is used by __builtin_tbegin
17 if AC_TRY_COMMAND([${CC-cc} -mhtm -O2 -S conftest.c -o - | grep -w tbegin > /dev/null]) ;
18 then
19   libc_cv_gcc_builtin_tbegin=yes
20 else
21   libc_cv_gcc_builtin_tbegin=no
23 rm -f conftest* ])
25 if test "$libc_cv_gcc_builtin_tbegin" = no ; then
26    critic_missing="$critic_missing The used GCC has no support for __builtin_tbegin, which is needed for lock-elision on target S390."
30 AC_CACHE_CHECK(for S390 vector instruction support, libc_cv_asm_s390_vx, [dnl
31 cat > conftest.c <<\EOF
32 void testvecinsn ()
34     __asm__ (".machine \"z13\" \n\t"
35              ".machinemode \"zarch_nohighgprs\" \n\t"
36              "vistrbs %%v16,%%v17 \n\t"
37              "locghie %%r1,0" : :);
39 EOF
40 dnl
41 dnl test, if assembler supports S390 vector instructions
42 if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
43 then
44   libc_cv_asm_s390_vx=yes
45 else
46   libc_cv_asm_s390_vx=no
48 rm -f conftest* ])
50 if test "$libc_cv_asm_s390_vx" = yes ;
51 then
52   AC_DEFINE(HAVE_S390_VX_ASM_SUPPORT)
53 else
54   AC_MSG_WARN([Use binutils with vector-support in order to use optimized implementations.])
57 AC_CACHE_CHECK(for S390 vector support in gcc, libc_cv_gcc_s390_vx, [dnl
58 cat > conftest.c <<\EOF
59 void testvecclobber ()
61   __asm__ ("" : : : "v16");
63 EOF
64 dnl
65 dnl test, if gcc supports S390 vector registers as clobber in inline assembly
66 if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
67 then
68   libc_cv_gcc_s390_vx=yes
69 else
70   libc_cv_gcc_s390_vx=no
72 rm -f conftest* ])
74 if test "$libc_cv_gcc_s390_vx" = yes ;
75 then
76   AC_DEFINE(HAVE_S390_VX_GCC_SUPPORT)
79 AC_CACHE_CHECK(for S390 arch13 zarch instruction support,
80                libc_cv_asm_s390_arch13, [dnl
81 cat > conftest.c <<\EOF
82 void testinsn (char *buf)
84     __asm__ (".machine \"arch13\" \n\t"
85              ".machinemode \"zarch_nohighgprs\" \n\t"
86              "lghi %%r0,16 \n\t"
87              "mvcrl 0(%0),32(%0) \n\t"
88              "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
89              : : "a" (buf) : "memory", "r0");
91 EOF
92 dnl test, if assembler supports S390 arch13 instructions
93 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
94                         -o conftest.o &> /dev/null]) ;
95 then
96   libc_cv_asm_s390_arch13=yes
97 else
98   libc_cv_asm_s390_arch13=no
100 rm -f conftest* ])
101 if test "$libc_cv_asm_s390_arch13" = yes ;
102 then
103   AC_DEFINE(HAVE_S390_ARCH13_ASM_SUPPORT)
107 AC_CACHE_CHECK(for S390 z10 zarch instruction support as default,
108                libc_cv_asm_s390_min_z10_zarch, [dnl
109 cat > conftest.c <<\EOF
110 void testinsn (void *a, void *b, int n)
112     __asm__ ("exrl %2,1f \n\t"
113              "j 2f \n\t"
114              "1: mvc 0(1,%0),0(%1) \n\t"
115              "2:"
116              : : "a" (a), "a" (b), "d" (n)
117              : "memory", "cc");
121 dnl test, if assembler supports S390 z10 zarch instructions as default
122 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
123                         -o conftest.o &> /dev/null]) ;
124 then
125   libc_cv_asm_s390_min_z10_zarch=yes
126 else
127   libc_cv_asm_s390_min_z10_zarch=no
129 rm -f conftest* ])
131 if test "$libc_cv_asm_s390_min_z10_zarch" = yes ;
132 then
133   AC_DEFINE(HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT)
136 AC_CACHE_CHECK(for S390 z196 zarch instruction support as default,
137                libc_cv_asm_s390_min_z196_zarch, [dnl
138 cat > conftest.c <<\EOF
139 float testinsn (double e)
141     float d;
142     __asm__ ("ledbra %0,5,%1,4" : "=f" (d) : "f" (e) );
143     return d;
147 dnl test, if assembler supports S390 z196 zarch instructions as default
148 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
149                         -o conftest.o &> /dev/null]) ;
150 then
151   libc_cv_asm_s390_min_z196_zarch=yes
152 else
153   libc_cv_asm_s390_min_z196_zarch=no
155 rm -f conftest* ])
157 if test "$libc_cv_asm_s390_min_z196_zarch" = yes ;
158 then
159   AC_DEFINE(HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT)
162 AC_CACHE_CHECK(for S390 z13 zarch instruction support as default,
163                libc_cv_asm_s390_min_z13_zarch, [dnl
164 cat > conftest.c <<\EOF
165 int testinsn (void)
167     int i;
168     __asm__ ("vl %%v16,0(%%r15)\n\t"
169              "vlgvf %0,%%v16,0"
170              : "=d" (i) : : "memory", "v16");
171     return i;
175 dnl test, if assembler supports S390 z13 zarch instructions as default
176 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
177                         -o conftest.o &> /dev/null]) ;
178 then
179   libc_cv_asm_s390_min_z13_zarch=yes
180 else
181   libc_cv_asm_s390_min_z13_zarch=no
183 rm -f conftest* ])
185 if test "$libc_cv_asm_s390_min_z13_zarch" = yes ;
186 then
187   AC_DEFINE(HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT)
190 AC_CACHE_CHECK(for S390 arch13 zarch instruction support as default,
191                libc_cv_asm_s390_min_arch13_zarch, [dnl
192 cat > conftest.c <<\EOF
193 void testinsn (char *buf)
195     __asm__ ("lghi %%r0,16 \n\t"
196              "mvcrl 0(%0),32(%0) \n\t"
197              "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
198              : : "a" (buf) : "memory", "r0");
201 dnl test, if assembler supports S390 arch13 zarch instructions as default
202 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
203                         -o conftest.o &> /dev/null]) ;
204 then
205   libc_cv_asm_s390_min_arch13_zarch=yes
206 else
207   libc_cv_asm_s390_min_arch13_zarch=no
209 rm -f conftest* ])
210 if test "$libc_cv_asm_s390_min_arch13_zarch" = yes ;
211 then
212   AC_DEFINE(HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT)
215 dnl test if GCC is new enough. See gcc "Bug 98269 - gcc 6.5.0
216 dnl __builtin_add_overflow() with small uint32_t values incorrectly detects
217 dnl overflow
218 dnl (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269)
219 AC_CACHE_CHECK([if $CC is sufficient to build libc on s390x],
220 libc_cv_compiler_ok_on_s390x, [
221 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
222 #if !defined __GNUC__ || __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 1)
223 #error insufficient compiler for building on s390x
224 #endif
225 ]])],
226         [libc_cv_compiler_ok_on_s390x=yes],
227         [libc_cv_compiler_ok_on_s390x=no])])
228 if test "$libc_cv_compiler_ok_on_s390x" != yes; then
229    critic_missing="$critic_missing On s390x, GCC >= 7.1.0 is required."
232 test -n "$critic_missing" && AC_MSG_ERROR([
233 *** $critic_missing])