Enable AVX2 optimized memset only if -mavx2 works
[glibc.git] / sysdeps / i386 / configure
blob6e89b597e3e9486f2a865cb4cd3b5129ce3d1552
2 # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
3 # -------------------------------------------------------
4 # Tests whether HEADER exists and can be compiled using the include files in
5 # INCLUDES, setting the cache variable VAR accordingly.
6 ac_fn_c_check_header_compile ()
8   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
9   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
10 $as_echo_n "checking for $2... " >&6; }
11 if eval \${$3+:} false; then :
12   $as_echo_n "(cached) " >&6
13 else
14   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15 /* end confdefs.h.  */
17 #include <$2>
18 _ACEOF
19 if ac_fn_c_try_compile "$LINENO"; then :
20   eval "$3=yes"
21 else
22   eval "$3=no"
24 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
26 eval ac_res=\$$3
27                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
28 $as_echo "$ac_res" >&6; }
29   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
31 } # ac_fn_c_check_header_compile
32 # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
33  # Local configure fragment for sysdeps/i386.
35 # We no longer support i386 since it lacks the atomic instructions
36 # required to implement NPTL threading.
37 if test "$config_machine" = i386; then
38   as_fn_error $? "
39 *** ERROR: Support for i386 is deprecated.
40 *** Please use host i786, i686, i585 or i486.
41 *** For example: /src/glibc/configure --host=i686-pc-linux-gnu ...\"" "$LINENO" 5
44 # The GNU C Library can't be built for i386.  There are several reasons for
45 # this restriction.  The primary reason is that i386 lacks the atomic
46 # operations required to support the current NPTL implementation.  While it is
47 # possible that such atomic operations could be emulated in the kernel to date
48 # no such work has been done to enable this.  Even with NPTL disabled you still
49 # have no atomic.h implementation.  Given the declining use of i386 we disable
50 # support for building with `-march=i386' or `-mcpu=i386.' We don't explicitly
51 # check for i386, instead we make sure the compiler has support for inlining
52 # the builtin __sync_val_compare_and_swap. If it does then we should have no
53 # problem building for i386.
54 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler support of inlined builtin function __sync_val_compare_and_swap" >&5
55 $as_echo_n "checking for compiler support of inlined builtin function __sync_val_compare_and_swap... " >&6; }
56 libc_compiler_builtin_inlined=no
57 cat > conftest.c <<EOF
58 int _start (void) { int a, b, c; __sync_val_compare_and_swap (&a, b, c); return 0; }
59 EOF
60 if ! { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
61                      -O0 -nostdlib -nostartfiles
62                      -S conftest.c -o - | fgrep "__sync_val_compare_and_swap"
63                      1>&5'
64   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
65   (eval $ac_try) 2>&5
66   ac_status=$?
67   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
68   test $ac_status = 0; }; }
69 then
70   libc_compiler_builtin_inlined=yes
72 rm -f conftest*
73 if test $libc_compiler_builtin_inlined = yes; then
74   libc_cv_unsupported_i386=no
75 else
76   as_fn_error $? "
77 *** Building with -march=i386/-mcpu=i386 is not supported.
78 *** Please use host i786, i686, i586, or i486.
79 *** For example: /source/glibc/configure CFLAGS='-O2 -march=i686' ..." "$LINENO" 5
81 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_compiler_builtin_inlined" >&5
82 $as_echo "$libc_compiler_builtin_inlined" >&6; }
85 ac_fn_c_check_header_compile "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "/* No default includes.  */
87 if test "x$ac_cv_header_cpuid_h" = xyes; then :
89 else
90   as_fn_error $? "gcc must provide the <cpuid.h> header" "$LINENO" 5
95 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSE4 support" >&5
96 $as_echo_n "checking for SSE4 support... " >&6; }
97 if ${libc_cv_cc_sse4+:} false; then :
98   $as_echo_n "(cached) " >&6
99 else
100   if { ac_try='${CC-cc} -msse4 -xc /dev/null -S -o /dev/null'
101   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
102   (eval $ac_try) 2>&5
103   ac_status=$?
104   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
105   test $ac_status = 0; }; }; then :
106   libc_cv_cc_sse4=yes
107 else
108   libc_cv_cc_sse4=no
112 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse4" >&5
113 $as_echo "$libc_cv_cc_sse4" >&6; }
114 if test $libc_cv_cc_sse4 = yes; then
115   $as_echo "#define HAVE_SSE4_SUPPORT 1" >>confdefs.h
118 config_vars="$config_vars
119 config-cflags-sse4 = $libc_cv_cc_sse4"
121 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler -mtune=i686 support" >&5
122 $as_echo_n "checking for assembler -mtune=i686 support... " >&6; }
123 if ${libc_cv_as_i686+:} false; then :
124   $as_echo_n "(cached) " >&6
125 else
126   if { ac_try='${CC-cc} -Wa,-mtune=i686 -xc /dev/null -S -o /dev/null'
127   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
128   (eval $ac_try) 2>&5
129   ac_status=$?
130   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
131   test $ac_status = 0; }; }; then :
132   libc_cv_as_i686=yes
133 else
134   libc_cv_as_i686=no
138 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_as_i686" >&5
139 $as_echo "$libc_cv_as_i686" >&6; }
140 config_vars="$config_vars
141 config-asflags-i686 = $libc_cv_as_i686"
143 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX support" >&5
144 $as_echo_n "checking for AVX support... " >&6; }
145 if ${libc_cv_cc_avx+:} false; then :
146   $as_echo_n "(cached) " >&6
147 else
148   if { ac_try='${CC-cc} -mavx -xc /dev/null -S -o /dev/null'
149   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
150   (eval $ac_try) 2>&5
151   ac_status=$?
152   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
153   test $ac_status = 0; }; }; then :
154   libc_cv_cc_avx=yes
155 else
156   libc_cv_cc_avx=no
160 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_avx" >&5
161 $as_echo "$libc_cv_cc_avx" >&6; }
162 if test $libc_cv_cc_avx = yes; then
163   $as_echo "#define HAVE_AVX_SUPPORT 1" >>confdefs.h
166 config_vars="$config_vars
167 config-cflags-avx = $libc_cv_cc_avx"
169 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX encoding of SSE instructions" >&5
170 $as_echo_n "checking for AVX encoding of SSE instructions... " >&6; }
171 if ${libc_cv_cc_sse2avx+:} false; then :
172   $as_echo_n "(cached) " >&6
173 else
174   if { ac_try='${CC-cc} -msse2avx -xc /dev/null -S -o /dev/null'
175   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
176   (eval $ac_try) 2>&5
177   ac_status=$?
178   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
179   test $ac_status = 0; }; }; then :
180   libc_cv_cc_sse2avx=yes
181 else
182   libc_cv_cc_sse2avx=no
186 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse2avx" >&5
187 $as_echo "$libc_cv_cc_sse2avx" >&6; }
188 if test $libc_cv_cc_sse2avx = yes; then
189   $as_echo "#define HAVE_SSE2AVX_SUPPORT 1" >>confdefs.h
192 config_vars="$config_vars
193 config-cflags-sse2avx = $libc_cv_cc_sse2avx"
195 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FMA4 support" >&5
196 $as_echo_n "checking for FMA4 support... " >&6; }
197 if ${libc_cv_cc_fma4+:} false; then :
198   $as_echo_n "(cached) " >&6
199 else
200   if { ac_try='${CC-cc} -mfma4 -xc /dev/null -S -o /dev/null'
201   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
202   (eval $ac_try) 2>&5
203   ac_status=$?
204   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
205   test $ac_status = 0; }; }; then :
206   libc_cv_cc_fma4=yes
207 else
208   libc_cv_cc_fma4=no
212 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_fma4" >&5
213 $as_echo "$libc_cv_cc_fma4" >&6; }
214 if test $libc_cv_cc_fma4 = yes; then
215   $as_echo "#define HAVE_FMA4_SUPPORT 1" >>confdefs.h
218 config_vars="$config_vars
219 have-mfma4 = $libc_cv_cc_fma4"
221 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mno-vzeroupper support" >&5
222 $as_echo_n "checking for -mno-vzeroupper support... " >&6; }
223 if ${libc_cv_cc_novzeroupper+:} false; then :
224   $as_echo_n "(cached) " >&6
225 else
226   if { ac_try='${CC-cc} -mno-vzeroupper -xc /dev/null -S -o /dev/null'
227   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
228   (eval $ac_try) 2>&5
229   ac_status=$?
230   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
231   test $ac_status = 0; }; }; then :
232   libc_cv_cc_novzeroupper=yes
233 else
234   libc_cv_cc_novzeroupper=no
238 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5
239 $as_echo "$libc_cv_cc_novzeroupper" >&6; }
240 config_vars="$config_vars
241 config-cflags-novzeroupper = $libc_cv_cc_novzeroupper"
243 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX2 support" >&5
244 $as_echo_n "checking for AVX2 support... " >&6; }
245 if ${libc_cv_cc_avx2+:} false; then :
246   $as_echo_n "(cached) " >&6
247 else
248   if { ac_try='${CC-cc} -mavx2 -xc /dev/null -S -o /dev/null'
249   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
250   (eval $ac_try) 2>&5
251   ac_status=$?
252   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
253   test $ac_status = 0; }; }; then :
254   libc_cv_cc_avx2=yes
255 else
256   libc_cv_cc_avx2=no
260 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_avx2" >&5
261 $as_echo "$libc_cv_cc_avx2" >&6; }
262 if test $libc_cv_cc_avx2 = yes; then
263   $as_echo "#define HAVE_AVX2_SUPPORT 1" >>confdefs.h
266 config_vars="$config_vars
267 config-cflags-avx2 = $libc_cv_cc_avx2"
269 $as_echo "#define USE_REGPARMS 1" >>confdefs.h
272 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h