initial commit
[glibc.git] / sysdeps / x86 / configure
1 # This file is generated from configure.ac by Autoconf. DO NOT EDIT!
2 # Local configure fragment for sysdeps/x86.
3
4 if test $enable_cet != no; then
5 # Check if CET can be enabled.
6 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CET can be enabled" >&5
7 $as_echo_n "checking whether CET can be enabled... " >&6; }
8 if ${libc_cv_x86_cet_available+:} false; then :
9 $as_echo_n "(cached) " >&6
10 else
11 cat > conftest.c <<EOF
12 #if !defined __CET__ || __CET__ != 3
13 # error CET isn't available.
14 #endif
15 EOF
16 if { ac_try='${CC-cc} -c $CFLAGS -fcf-protection -include cet.h conftest.c 1>&5'
17 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
18 (eval $ac_try) 2>&5
19 ac_status=$?
20 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
21 test $ac_status = 0; }; }; then
22 libc_cv_x86_cet_available=yes
23 else
24 libc_cv_x86_cet_available=no
25 fi
26 rm -rf conftest*
27 fi
28 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_x86_cet_available" >&5
29 $as_echo "$libc_cv_x86_cet_available" >&6; }
30 if test $libc_cv_x86_cet_available != yes; then
31 as_fn_error $? "$CC doesn't support CET" "$LINENO" 5
32 fi
33 fi
34 if test $enable_cet != no; then
35 # Check if assembler supports CET.
36 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $AS supports CET" >&5
37 $as_echo_n "checking whether $AS supports CET... " >&6; }
38 if ${libc_cv_x86_cet_as+:} false; then :
39 $as_echo_n "(cached) " >&6
40 else
41 cat > conftest.s <<EOF
42 incsspd %ecx
43 EOF
44 if { ac_try='${CC-cc} -c $CFLAGS conftest.s -o conftest.o 1>&5'
45 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
46 (eval $ac_try) 2>&5
47 ac_status=$?
48 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
49 test $ac_status = 0; }; }; then
50 libc_cv_x86_cet_as=yes
51 else
52 libc_cv_x86_cet_as=no
53 fi
54 rm -rf conftest*
55 fi
56 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_x86_cet_as" >&5
57 $as_echo "$libc_cv_x86_cet_as" >&6; }
58 if test $libc_cv_x86_cet_as = no; then
59 as_fn_error $? "$AS doesn't support CET" "$LINENO" 5
60 fi
61 fi
62 if test $enable_cet = yes; then
63 $as_echo "#define DEFAULT_DL_X86_CET_CONTROL cet_elf_property" >>confdefs.h
64
65 elif test $enable_cet = permissive; then
66 $as_echo "#define DEFAULT_DL_X86_CET_CONTROL cet_permissive" >>confdefs.h
67
68 fi
69 config_vars="$config_vars
70 enable-cet = $enable_cet"
71
72 # Check if linker supports x86 ISA level.
73 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker x86 ISA level support" >&5
74 $as_echo_n "checking for linker x86 ISA level support... " >&6; }
75 if ${libc_cv_include_x86_isa_level+:} false; then :
76 $as_echo_n "(cached) " >&6
77 else
78 cat > conftest1.S <<EOF
79 #ifdef __LP64__
80 # define P2ALIGN 3
81 #else
82 # define P2ALIGN 2
83 #endif
84 .section ".note.gnu.property", "a"
85 .p2align P2ALIGN
86 .long 1f - 0f /* name length. */
87 .long 4f - 1f /* data length. */
88 /* NT_GNU_PROPERTY_TYPE_0 */
89 .long 5 /* note type. */
90 0:
91 .asciz "GNU" /* vendor name. */
92 1:
93 .p2align P2ALIGN
94 /* GNU_PROPERTY_X86_ISA_1_NEEDED */
95 .long 0xc0008002 /* pr_type. */
96 .long 3f - 2f /* pr_datasz. */
97 2:
98 .long 0x1
99 3:
100 .p2align P2ALIGN
101 4:
102 EOF
103 cat > conftest2.S <<EOF
104 #ifdef __LP64__
105 # define P2ALIGN 3
106 #else
107 # define P2ALIGN 2
108 #endif
109 .section ".note.gnu.property", "a"
110 .p2align P2ALIGN
111 .long 1f - 0f /* name length. */
112 .long 4f - 1f /* data length. */
113 /* NT_GNU_PROPERTY_TYPE_0 */
114 .long 5 /* note type. */
115 0:
116 .asciz "GNU" /* vendor name. */
117 1:
118 .p2align P2ALIGN
119 /* GNU_PROPERTY_X86_ISA_1_NEEDED */
120 .long 0xc0008002 /* pr_type. */
121 .long 3f - 2f /* pr_datasz. */
122 2:
123 .long 0x2
124 3:
125 .p2align P2ALIGN
126 4:
127 EOF
128 libc_cv_include_x86_isa_level=no
129 if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S'
130 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
131 (eval $ac_try) 2>&5
132 ac_status=$?
133 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
134 test $ac_status = 0; }; }; then
135 count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
136 if test "$count" = 1; then
137 libc_cv_include_x86_isa_level=yes
138 fi
139 fi
140 rm -f conftest*
141 fi
142 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_include_x86_isa_level" >&5
143 $as_echo "$libc_cv_include_x86_isa_level" >&6; }
144 if test $libc_cv_include_x86_isa_level = yes; then
145 $as_echo "#define INCLUDE_X86_ISA_LEVEL 1" >>confdefs.h
146
147 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LAHF/SAHF instruction support" >&5
148 $as_echo_n "checking for LAHF/SAHF instruction support... " >&6; }
149 if ${libc_cv_have_x86_lahf_sahf+:} false; then :
150 $as_echo_n "(cached) " >&6
151 else
152 libc_cv_have_x86_lahf_sahf=no
153 if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null'
154 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
155 (eval $ac_try) 2>&5
156 ac_status=$?
157 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
158 test $ac_status = 0; }; } | grep -qE '(-msahf\b|-march=x86-64-v)'; then
159 libc_cv_have_x86_lahf_sahf=yes
160 fi
161 fi
162 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_x86_lahf_sahf" >&5
163 $as_echo "$libc_cv_have_x86_lahf_sahf" >&6; }
164 if test $libc_cv_have_x86_lahf_sahf = yes; then
165 $as_echo "#define HAVE_X86_LAHF_SAHF 1" >>confdefs.h
166
167 fi
168 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MOVBE instruction support" >&5
169 $as_echo_n "checking for MOVBE instruction support... " >&6; }
170 if ${libc_cv_have_x86_movbe+:} false; then :
171 $as_echo_n "(cached) " >&6
172 else
173 libc_cv_have_x86_movbe=no
174 if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /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; }; } | grep -qE '(-mmovbe\b|-march=x86-64-v([3-9]|[1-9][0-9]))'; then
180 libc_cv_have_x86_movbe=yes
181 fi
182 fi
183 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_x86_movbe" >&5
184 $as_echo "$libc_cv_have_x86_movbe" >&6; }
185 if test $libc_cv_have_x86_movbe = yes; then
186 $as_echo "#define HAVE_X86_MOVBE 1" >>confdefs.h
187
188 fi
189 fi
190 config_vars="$config_vars
191 enable-x86-isa-level = $libc_cv_include_x86_isa_level"
192
193 $as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
194