summaryrefslogtreecommitdiff
path: root/sysdeps/i386/configure.ac
blob: a3f3067fb7571280fb2b78493ce9fd179d102b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/i386.

# We no longer support i386 since it lacks the atomic instructions
# required to implement NPTL threading.
if test "$config_machine" = i386; then
  AC_MSG_ERROR([
*** ERROR: Support for i386 is deprecated.
*** Please use host i786, i686, i585 or i486.
*** For example: /src/glibc/configure --host=i686-pc-linux-gnu ..."])
fi

# The GNU C Library can't be built for i386.  There are several reasons for
# this restriction.  The primary reason is that i386 lacks the atomic
# operations required to support the current NPTL implementation.  While it is
# possible that such atomic operations could be emulated in the kernel to date
# no such work has been done to enable this.  Even with NPTL disabled you still
# have no atomic.h implementation.  Given the declining use of i386 we disable
# support for building with `-march=i386' or `-mcpu=i386.' We don't explicitly
# check for i386, instead we make sure the compiler has support for inlining
# the builtin __sync_val_compare_and_swap. If it does then we should have no
# problem building for i386.
LIBC_COMPILER_BUILTIN_INLINED(
  [__sync_val_compare_and_swap],
  [int a, b, c; __sync_val_compare_and_swap (&a, b, c);],
  [-O0],
  [libc_cv_unsupported_i386=no],
  [AC_MSG_ERROR([
*** Building with -march=i386/-mcpu=i386 is not supported.
*** Please use host i786, i686, i586, or i486.
*** For example: /source/glibc/configure CFLAGS='-O2 -march=i686' ...])])

AC_CHECK_HEADER([cpuid.h], ,
  [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])],
  [/* No default includes.  */])

dnl Check if -msse4 works.
AC_CACHE_CHECK(for SSE4 support, libc_cv_cc_sse4, [dnl
LIBC_TRY_CC_OPTION([-msse4], [libc_cv_cc_sse4=yes], [libc_cv_cc_sse4=no])
])
if test $libc_cv_cc_sse4 = yes; then
  AC_DEFINE(HAVE_SSE4_SUPPORT)
fi
LIBC_CONFIG_VAR([config-cflags-sse4], [$libc_cv_cc_sse4])

dnl Check if -Wa,-mtune=i686 works.
AC_CACHE_CHECK(for assembler -mtune=i686 support, libc_cv_as_i686, [dnl
LIBC_TRY_CC_OPTION([-Wa,-mtune=i686],
		   [libc_cv_as_i686=yes],
		   [libc_cv_as_i686=no])
])
LIBC_CONFIG_VAR([config-asflags-i686], [$libc_cv_as_i686])

dnl Check if -mavx works.
AC_CACHE_CHECK(for AVX support, libc_cv_cc_avx, [dnl
LIBC_TRY_CC_OPTION([-mavx], [libc_cv_cc_avx=yes], [libc_cv_cc_avx=no])
])
if test $libc_cv_cc_avx = yes; then
  AC_DEFINE(HAVE_AVX_SUPPORT)
fi
LIBC_CONFIG_VAR([config-cflags-avx], [$libc_cv_cc_avx])

dnl Check if -msse2avx works.
AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl
LIBC_TRY_CC_OPTION([-msse2avx],
		   [libc_cv_cc_sse2avx=yes],
		   [libc_cv_cc_sse2avx=no])
])
if test $libc_cv_cc_sse2avx = yes; then
  AC_DEFINE(HAVE_SSE2AVX_SUPPORT)
fi
LIBC_CONFIG_VAR([config-cflags-sse2avx], [$libc_cv_cc_sse2avx])

dnl Check if -mfma4 works.
AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl
LIBC_TRY_CC_OPTION([-mfma4], [libc_cv_cc_fma4=yes], [libc_cv_cc_fma4=no])
])
if test $libc_cv_cc_fma4 = yes; then
  AC_DEFINE(HAVE_FMA4_SUPPORT)
fi
LIBC_CONFIG_VAR([have-mfma4], [$libc_cv_cc_fma4])

dnl Check if -mno-vzeroupper works.
AC_CACHE_CHECK(for -mno-vzeroupper support, libc_cv_cc_novzeroupper, [dnl
LIBC_TRY_CC_OPTION([-mno-vzeroupper],
		   [libc_cv_cc_novzeroupper=yes],
		   [libc_cv_cc_novzeroupper=no])
])
LIBC_CONFIG_VAR([config-cflags-novzeroupper], [$libc_cv_cc_novzeroupper])

dnl Check whether asm supports Intel MPX
AC_CACHE_CHECK(for Intel MPX support, libc_cv_asm_mpx, [dnl
cat > conftest.s <<\EOF
        bndmov %bnd0,(%esp)
EOF
if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
  libc_cv_asm_mpx=yes
else
  libc_cv_asm_mpx=no
fi
rm -f conftest*])
if test $libc_cv_asm_mpx == yes; then
  AC_DEFINE(HAVE_MPX_SUPPORT)
fi

dnl Check if -mavx2 works.
AC_CACHE_CHECK(for AVX2 support, libc_cv_cc_avx2, [dnl
LIBC_TRY_CC_OPTION([-mavx2], [libc_cv_cc_avx2=yes], [libc_cv_cc_avx2=no])
])
if test $libc_cv_cc_avx2 = yes; then
  AC_DEFINE(HAVE_AVX2_SUPPORT)
fi
LIBC_CONFIG_VAR([config-cflags-avx2], [$libc_cv_cc_avx2])

AC_DEFINE(USE_REGPARMS)

dnl It is always possible to access static and hidden symbols in an
dnl position independent way.
AC_DEFINE(PI_STATIC_AND_HIDDEN)