]>
Commit | Line | Data |
---|---|---|
ca9bc441 | 1 | # configure.ac for GCC |
46f18e7b RK |
2 | # Process this file with autoconf to generate a configuration script. |
3 | ||
99dee823 | 4 | # Copyright (C) 1997-2021 Free Software Foundation, Inc. |
46f18e7b | 5 | |
1322177d | 6 | #This file is part of GCC. |
46f18e7b | 7 | |
1322177d LB |
8 | #GCC is free software; you can redistribute it and/or modify it under |
9 | #the terms of the GNU General Public License as published by the Free | |
9dcd6f09 | 10 | #Software Foundation; either version 3, or (at your option) any later |
1322177d | 11 | #version. |
46f18e7b | 12 | |
1322177d LB |
13 | #GCC is distributed in the hope that it will be useful, but WITHOUT |
14 | #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | #for more details. | |
46f18e7b RK |
17 | |
18 | #You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
19 | #along with GCC; see the file COPYING3. If not see |
20 | #<http://www.gnu.org/licenses/>. | |
46f18e7b | 21 | |
34a86c2b NN |
22 | # -------------------------------- |
23 | # Initialization and sanity checks | |
24 | # -------------------------------- | |
25 | ||
914c5af7 NN |
26 | AC_INIT |
27 | AC_CONFIG_SRCDIR(tree.c) | |
b7cb92ad | 28 | AC_CONFIG_HEADER(auto-host.h:config.in) |
cdcc6a01 | 29 | |
9f18db39 PB |
30 | gcc_version=`cat $srcdir/BASE-VER` |
31 | ||
34a86c2b | 32 | # Determine the host, build, and target systems |
914c5af7 NN |
33 | AC_CANONICAL_BUILD |
34 | AC_CANONICAL_HOST | |
35 | AC_CANONICAL_TARGET | |
34a86c2b | 36 | |
47e62307 EB |
37 | # Determine the noncanonical host name, for Ada. |
38 | ACX_NONCANONICAL_HOST | |
39 | ||
caa55b1e | 40 | # Determine the noncanonical target name, for directory use. |
392765bf | 41 | ACX_NONCANONICAL_TARGET |
caa55b1e | 42 | |
85c64bbe BS |
43 | # Used for constructing correct paths for offload compilers. |
44 | real_target_noncanonical=${target_noncanonical} | |
45 | accel_dir_suffix= | |
46 | ||
4665e56c NN |
47 | # Determine the target- and build-specific subdirectories |
48 | GCC_TOPLEV_SUBDIRS | |
49 | ||
34a86c2b NN |
50 | # Set program_transform_name |
51 | AC_ARG_PROGRAM | |
46f18e7b | 52 | |
75a39864 JL |
53 | # Check for bogus environment variables. |
54 | # Test if LIBRARY_PATH contains the notation for the current directory | |
55 | # since this would lead to problems installing/building glibc. | |
56 | # LIBRARY_PATH contains the current directory if one of the following | |
57 | # is true: | |
58 | # - one of the terminals (":" and ";") is the first or last sign | |
59 | # - two terminals occur directly after each other | |
60 | # - the path contains an element with a dot in it | |
61 | AC_MSG_CHECKING(LIBRARY_PATH variable) | |
62 | changequote(,)dnl | |
63 | case ${LIBRARY_PATH} in | |
64 | [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) | |
65 | library_path_setting="contains current directory" | |
66 | ;; | |
67 | *) | |
68 | library_path_setting="ok" | |
69 | ;; | |
70 | esac | |
71 | changequote([,])dnl | |
72 | AC_MSG_RESULT($library_path_setting) | |
73 | if test "$library_path_setting" != "ok"; then | |
74 | AC_MSG_ERROR([ | |
75 | *** LIBRARY_PATH shouldn't contain the current directory when | |
079bd08e | 76 | *** building gcc. Please change the environment variable |
75a39864 JL |
77 | *** and run configure again.]) |
78 | fi | |
79 | ||
80 | # Test if GCC_EXEC_PREFIX contains the notation for the current directory | |
81 | # since this would lead to problems installing/building glibc. | |
82 | # GCC_EXEC_PREFIX contains the current directory if one of the following | |
83 | # is true: | |
84 | # - one of the terminals (":" and ";") is the first or last sign | |
85 | # - two terminals occur directly after each other | |
86 | # - the path contains an element with a dot in it | |
87 | AC_MSG_CHECKING(GCC_EXEC_PREFIX variable) | |
88 | changequote(,)dnl | |
89 | case ${GCC_EXEC_PREFIX} in | |
90 | [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) | |
91 | gcc_exec_prefix_setting="contains current directory" | |
92 | ;; | |
93 | *) | |
94 | gcc_exec_prefix_setting="ok" | |
95 | ;; | |
96 | esac | |
97 | changequote([,])dnl | |
98 | AC_MSG_RESULT($gcc_exec_prefix_setting) | |
99 | if test "$gcc_exec_prefix_setting" != "ok"; then | |
100 | AC_MSG_ERROR([ | |
101 | *** GCC_EXEC_PREFIX shouldn't contain the current directory when | |
079bd08e | 102 | *** building gcc. Please change the environment variable |
75a39864 JL |
103 | *** and run configure again.]) |
104 | fi | |
105 | ||
34a86c2b NN |
106 | # ----------- |
107 | # Directories | |
108 | # ----------- | |
109 | ||
110 | # Specify the local prefix | |
111 | local_prefix= | |
112 | AC_ARG_WITH(local-prefix, | |
b88ecf55 AS |
113 | [AS_HELP_STRING([--with-local-prefix=DIR], |
114 | [specifies directory to put local include])], | |
34a86c2b NN |
115 | [case "${withval}" in |
116 | yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;; | |
117 | no) ;; | |
118 | *) local_prefix=$with_local_prefix ;; | |
119 | esac]) | |
120 | ||
121 | # Default local prefix if it is empty | |
122 | if test x$local_prefix = x; then | |
123 | local_prefix=/usr/local | |
124 | fi | |
125 | ||
54b710be YR |
126 | AC_ARG_WITH([native-system-header-dir], |
127 | [ --with-native-system-header-dir=dir | |
128 | use dir as the directory to look for standard | |
129 | system header files in. Defaults to /usr/include.], | |
130 | [ | |
131 | case ${with_native_system_header_dir} in | |
132 | yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;; | |
133 | /* | [[A-Za-z]]:[[\\/]]*) ;; | |
134 | *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; | |
135 | esac | |
136 | configured_native_system_header_dir="${withval}" | |
137 | ], [configured_native_system_header_dir=]) | |
138 | ||
139 | AC_ARG_WITH(build-sysroot, | |
140 | [AS_HELP_STRING([--with-build-sysroot=sysroot], | |
141 | [use sysroot as the system root during the build])], | |
142 | [if test x"$withval" != x ; then | |
143 | SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" | |
144 | fi], | |
145 | [SYSROOT_CFLAGS_FOR_TARGET=]) | |
146 | AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) | |
147 | ||
148 | if test "x$prefix" = xNONE; then | |
149 | test_prefix=/usr/local | |
150 | else | |
151 | test_prefix=$prefix | |
152 | fi | |
153 | if test "x$exec_prefix" = xNONE; then | |
154 | test_exec_prefix=$test_prefix | |
155 | else | |
156 | test_exec_prefix=$exec_prefix | |
157 | fi | |
158 | ||
159 | AC_ARG_WITH(sysroot, | |
160 | [AS_HELP_STRING([[--with-sysroot[=DIR]]], | |
161 | [search for usr/lib, usr/include, et al, within DIR])], | |
162 | [ | |
163 | case ${with_sysroot} in | |
164 | /) ;; | |
165 | */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;; | |
166 | esac | |
167 | case ${with_sysroot} in | |
168 | yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;; | |
169 | *) TARGET_SYSTEM_ROOT=$with_sysroot ;; | |
170 | esac | |
171 | ||
172 | TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' | |
173 | CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' | |
174 | ||
175 | case ${TARGET_SYSTEM_ROOT} in | |
176 | "${test_prefix}"|"${test_prefix}/"*|\ | |
177 | "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ | |
178 | '${prefix}'|'${prefix}/'*|\ | |
179 | '${exec_prefix}'|'${exec_prefix}/'*) | |
180 | t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" | |
181 | TARGET_SYSTEM_ROOT_DEFINE="$t" | |
182 | ;; | |
183 | esac | |
184 | ], [ | |
185 | TARGET_SYSTEM_ROOT= | |
186 | TARGET_SYSTEM_ROOT_DEFINE= | |
187 | CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include' | |
188 | ]) | |
189 | AC_SUBST(TARGET_SYSTEM_ROOT) | |
190 | AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) | |
191 | AC_SUBST(CROSS_SYSTEM_HEADER_DIR) | |
192 | ||
34a86c2b NN |
193 | # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only |
194 | # passed in by the toplevel make and thus we'd get different behavior | |
195 | # depending on where we built the sources. | |
196 | gcc_gxx_include_dir= | |
197 | # Specify the g++ header file directory | |
198 | AC_ARG_WITH(gxx-include-dir, | |
b88ecf55 AS |
199 | [AS_HELP_STRING([--with-gxx-include-dir=DIR], |
200 | [specifies directory to put g++ header files])], | |
34a86c2b NN |
201 | [case "${withval}" in |
202 | yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;; | |
203 | no) ;; | |
204 | *) gcc_gxx_include_dir=$with_gxx_include_dir ;; | |
205 | esac]) | |
206 | ||
b4d3485e EB |
207 | # If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate |
208 | # the former in the latter and, upon success, compute gcc_gxx_include_dir as | |
209 | # relative to the sysroot. | |
210 | gcc_gxx_include_dir_add_sysroot=0 | |
211 | ||
0f57bf40 | 212 | # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO. |
34a86c2b NN |
213 | if test x${gcc_gxx_include_dir} = x; then |
214 | if test x${enable_version_specific_runtime_libs} = xyes; then | |
215 | gcc_gxx_include_dir='${libsubdir}/include/c++' | |
216 | else | |
0f57bf40 MM |
217 | libstdcxx_incdir='include/c++/$(version)' |
218 | if test x$host != x$target; then | |
219 | libstdcxx_incdir="$target_alias/$libstdcxx_incdir" | |
220 | fi | |
15c723f3 | 221 | gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir" |
34a86c2b | 222 | fi |
b4d3485e | 223 | elif test "${with_sysroot+set}" = set; then |
17719d09 HS |
224 | gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'` |
225 | if test "${gcc_gxx_without_sysroot}"; then | |
b4d3485e | 226 | gcc_gxx_include_dir="${gcc_gxx_without_sysroot}" |
17719d09 HS |
227 | gcc_gxx_include_dir_add_sysroot=1 |
228 | fi | |
229 | fi | |
230 | ||
662b9c55 IS |
231 | # Configuration for an alternate set of C++ headers. |
232 | gcc_gxx_libcxx_include_dir= | |
233 | # Specify the alternate g++ header file directory | |
234 | AC_ARG_WITH(gxx-libcxx-include-dir, | |
235 | [AS_HELP_STRING([--with-gxx-libcxx-include-dir=DIR], | |
236 | [specifies directory to find libc++ header files])], | |
237 | [case "${withval}" in | |
238 | yes) AC_MSG_ERROR(bad value ${withval} given for libc++ include directory) ;; | |
239 | no) ;; | |
240 | *) gcc_gxx_libcxx_include_dir=$with_gxx_libcxx_include_dir ;; | |
241 | esac]) | |
242 | ||
243 | # If both --with-sysroot and --with-gxx-libcxx-include-dir are passed, we | |
244 | # check to see if the latter starts with the former and, upon success, compute | |
245 | # gcc_gxx_libcxx_include_dir as relative to the sysroot. | |
246 | gcc_gxx_libcxx_include_dir_add_sysroot=0 | |
247 | ||
248 | if test x${gcc_gxx_libcxx_include_dir} != x; then | |
249 | AC_DEFINE(ENABLE_STDLIB_OPTION, 1, | |
250 | [Define if the -stdlib= option should be enabled.]) | |
251 | else | |
252 | AC_DEFINE(ENABLE_STDLIB_OPTION, 0) | |
253 | fi | |
254 | # ??? This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO. | |
255 | if test x${gcc_gxx_libcxx_include_dir} = x; then | |
256 | if test x${enable_version_specific_runtime_libs} = xyes; then | |
257 | gcc_gxx_libcxx_include_dir='${libsubdir}/libc++_include/c++/v1' | |
258 | else | |
259 | libcxx_incdir='libc++_include/c++/$(version)/v1' | |
260 | if test x$host != x$target; then | |
261 | libcxx_incdir="$target_alias/$libcxx_incdir" | |
262 | fi | |
263 | gcc_gxx_libcxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libcxx_incdir" | |
264 | fi | |
265 | elif test "${with_sysroot+set}" = set; then | |
266 | gcc_gxx_libcxx_without_sysroot=`expr "${gcc_gxx_libcxx_include_dir}" : "${with_sysroot}"'\(.*\)'` | |
267 | if test "${gcc_gxx_libcxx_without_sysroot}"; then | |
268 | gcc_gxx_libcxx_include_dir="${gcc_gxx_libcxx_without_sysroot}" | |
269 | gcc_gxx_libcxx_include_dir_add_sysroot=1 | |
270 | fi | |
271 | fi | |
272 | ||
34a86c2b | 273 | AC_ARG_WITH(cpp_install_dir, |
b88ecf55 AS |
274 | [AC_HELP_STRING([--with-cpp-install-dir=DIR], |
275 | [install the user visible C preprocessor in DIR | |
276 | (relative to PREFIX) as well as PREFIX/bin])], | |
34a86c2b NN |
277 | [if test x$withval = xyes; then |
278 | AC_MSG_ERROR([option --with-cpp-install-dir requires an argument]) | |
279 | elif test x$withval != xno; then | |
280 | cpp_install_dir=$withval | |
281 | fi]) | |
282 | ||
51b9ff45 KC |
283 | # We would like to our source tree to be readonly. However when releases or |
284 | # pre-releases are generated, the flex/bison generated files as well as the | |
285 | # various formats of manuals need to be included along with the rest of the | |
286 | # sources. Therefore we have --enable-generated-files-in-srcdir to do | |
287 | # just that. | |
288 | ||
03787dfd KC |
289 | AC_MSG_CHECKING([whether to place generated files in the source directory]) |
290 | dnl generated-files-in-srcdir is disabled by default | |
291 | AC_ARG_ENABLE(generated-files-in-srcdir, | |
b88ecf55 AS |
292 | [AS_HELP_STRING([--enable-generated-files-in-srcdir], |
293 | [put copies of generated files in source dir | |
294 | intended for creating source tarballs for users | |
295 | without texinfo bison or flex])], | |
03787dfd KC |
296 | generated_files_in_srcdir=$enableval, |
297 | generated_files_in_srcdir=no) | |
298 | ||
299 | AC_MSG_RESULT($generated_files_in_srcdir) | |
300 | ||
301 | if test "$generated_files_in_srcdir" = "yes"; then | |
302 | GENINSRC='' | |
03787dfd KC |
303 | else |
304 | GENINSRC='#' | |
03787dfd KC |
305 | fi |
306 | AC_SUBST(GENINSRC) | |
51b9ff45 | 307 | |
34a86c2b NN |
308 | # ------------------- |
309 | # Find default linker | |
310 | # ------------------- | |
46f18e7b RK |
311 | |
312 | # With GNU ld | |
313 | AC_ARG_WITH(gnu-ld, | |
b88ecf55 | 314 | [AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])], |
df6faf79 JW |
315 | gnu_ld_flag="$with_gnu_ld", |
316 | gnu_ld_flag=no) | |
46f18e7b | 317 | |
eb89c82f IS |
318 | case $target in |
319 | *darwin*) ld64_flag=yes;; # Darwin can only use a ld64-compatible linker. | |
320 | *) ld64_flag=no;; | |
321 | esac | |
322 | ||
ab339d62 AO |
323 | # With pre-defined ld |
324 | AC_ARG_WITH(ld, | |
b88ecf55 | 325 | [AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])], |
3ccc3a56 AO |
326 | DEFAULT_LINKER="$with_ld") |
327 | if test x"${DEFAULT_LINKER+set}" = x"set"; then | |
328 | if test ! -x "$DEFAULT_LINKER"; then | |
99c012a8 | 329 | AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER]) |
e154a394 | 330 | elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then |
ab339d62 | 331 | gnu_ld_flag=yes |
eb89c82f IS |
332 | elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep ld64- > /dev/null; then |
333 | ld64_flag=yes | |
ab339d62 | 334 | fi |
119d24d1 KG |
335 | AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER", |
336 | [Define to enable the use of a default linker.]) | |
ab339d62 AO |
337 | fi |
338 | ||
34a86c2b NN |
339 | AC_MSG_CHECKING([whether a default linker was specified]) |
340 | if test x"${DEFAULT_LINKER+set}" = x"set"; then | |
341 | if test x"$gnu_ld_flag" = x"no"; then | |
342 | AC_MSG_RESULT([yes ($DEFAULT_LINKER)]) | |
343 | else | |
344 | AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)]) | |
345 | fi | |
346 | else | |
347 | AC_MSG_RESULT(no) | |
348 | fi | |
349 | ||
d594623a L |
350 | # With demangler in GNU ld |
351 | AC_ARG_WITH(demangler-in-ld, | |
b88ecf55 | 352 | [AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])], |
d594623a | 353 | demangler_in_ld="$with_demangler_in_ld", |
df45fc34 | 354 | demangler_in_ld=yes) |
d594623a | 355 | |
34a86c2b NN |
356 | # ---------------------- |
357 | # Find default assembler | |
358 | # ---------------------- | |
359 | ||
46f18e7b RK |
360 | # With GNU as |
361 | AC_ARG_WITH(gnu-as, | |
b88ecf55 | 362 | [AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])], |
df6faf79 JW |
363 | gas_flag="$with_gnu_as", |
364 | gas_flag=no) | |
46f18e7b | 365 | |
ab339d62 | 366 | AC_ARG_WITH(as, |
b88ecf55 | 367 | [AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])], |
3ccc3a56 AO |
368 | DEFAULT_ASSEMBLER="$with_as") |
369 | if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then | |
370 | if test ! -x "$DEFAULT_ASSEMBLER"; then | |
99c012a8 | 371 | AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER]) |
e154a394 | 372 | elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then |
ab339d62 AO |
373 | gas_flag=yes |
374 | fi | |
119d24d1 KG |
375 | AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER", |
376 | [Define to enable the use of a default assembler.]) | |
3ccc3a56 | 377 | fi |
ab339d62 | 378 | |
34a86c2b NN |
379 | AC_MSG_CHECKING([whether a default assembler was specified]) |
380 | if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then | |
381 | if test x"$gas_flag" = x"no"; then | |
382 | AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) | |
4e88d51b | 383 | else |
34a86c2b | 384 | AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)]) |
4e88d51b | 385 | fi |
34a86c2b NN |
386 | else |
387 | AC_MSG_RESULT(no) | |
4e88d51b | 388 | fi |
46f18e7b | 389 | |
34a86c2b NN |
390 | # --------------- |
391 | # Find C compiler | |
392 | # --------------- | |
13c22933 | 393 | |
426ca3ca RO |
394 | # If a non-executable a.out is present (e.g. created by GNU as above even if |
395 | # invoked with -v only), the IRIX 6 native ld just overwrites the existing | |
396 | # file, even when creating an executable, so an execution test fails. | |
397 | # Remove possible default executable files to avoid this. | |
398 | # | |
399 | # FIXME: This really belongs into AC_PROG_CC and can be removed once | |
400 | # Autoconf includes it. | |
401 | rm -f a.out a.exe b.out | |
402 | ||
414d23ae HPN |
403 | # Find the native compiler |
404 | AC_PROG_CC | |
00020c16 | 405 | AC_PROG_CXX |
e8679fd5 | 406 | ACX_PROG_GNAT([-I"$srcdir"/ada/libgnat]) |
3d4e720a | 407 | |
13ccfea8 JM |
408 | # Do configure tests with the C++ compiler, since that's what we build with. |
409 | AC_LANG(C++) | |
410 | ||
ec6c7392 PB |
411 | # Remove the -O2: for historical reasons, unless bootstrapping we prefer |
412 | # optimizations to be activated explicitly by the toplevel. | |
413 | case "$CC" in | |
414 | */prev-gcc/xgcc*) ;; | |
dadbefd3 JJ |
415 | *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` |
416 | CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` ;; | |
ec6c7392 PB |
417 | esac |
418 | AC_SUBST(CFLAGS) | |
8bf4ee34 | 419 | AC_SUBST(CXXFLAGS) |
ec6c7392 | 420 | |
e3aa9eba RO |
421 | # Determine PICFLAG for target gnatlib. |
422 | GCC_PICFLAG_FOR_TARGET | |
423 | AC_SUBST(PICFLAG_FOR_TARGET) | |
424 | ||
73458fb7 NN |
425 | # ------------------------- |
426 | # Check C compiler features | |
427 | # ------------------------- | |
428 | ||
60d26958 | 429 | AC_USE_SYSTEM_EXTENSIONS |
5329b59a | 430 | |
34a86c2b NN |
431 | AC_PROG_CPP |
432 | AC_C_INLINE | |
34a86c2b | 433 | |
480767a9 ILT |
434 | AC_SYS_LARGEFILE |
435 | ||
34a86c2b | 436 | # sizeof(char) is 1 by definition. |
bf3b7cd3 JD |
437 | AC_CHECK_SIZEOF(void *) |
438 | AC_CHECK_SIZEOF(short) | |
439 | AC_CHECK_SIZEOF(int) | |
440 | AC_CHECK_SIZEOF(long) | |
5ec1c5e6 | 441 | AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)]) |
7c2a2dbf | 442 | GCC_STDINT_TYPES |
edf6ddf6 RB |
443 | if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then |
444 | AC_MSG_ERROR([uint64_t or int64_t not found]) | |
445 | fi | |
34a86c2b | 446 | |
35987ae9 | 447 | # check what underlying integer type int64_t uses |
35987ae9 RB |
448 | AC_CACHE_CHECK(for int64_t underlying type, ac_cv_int64_t_type, [ |
449 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
450 | #ifdef HAVE_STDINT_H | |
451 | #include <stdint.h> | |
452 | #endif | |
453 | template <typename T> struct X { }; | |
454 | template <> | |
455 | struct X<long> { typedef long t; }; | |
456 | ]], [[X<int64_t>::t x;]])],[ac_cv_int64_t_type=long],[ac_cv_int64_t_type="long long"])]) | |
457 | if test "$ac_cv_int64_t_type" = "long"; then | |
458 | AC_DEFINE(INT64_T_IS_LONG, 1, | |
459 | [Define if int64_t uses long as underlying type.]) | |
460 | else | |
461 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
462 | #ifdef HAVE_STDINT_H | |
463 | #include <stdint.h> | |
464 | #endif | |
465 | template <typename T> struct X { }; | |
466 | template <> | |
467 | struct X<long long> { typedef long long t; }; | |
468 | ]], [[X<int64_t>::t x;]])],[],[AC_MSG_ERROR([error verifying int64_t uses long long])]) | |
469 | fi | |
35987ae9 | 470 | |
3dde4d65 MM |
471 | AC_CACHE_CHECK(for std::swap in <utility>, ac_cv_std_swap_in_utility, [ |
472 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
473 | #include <utility> | |
474 | ]], [[int a, b; std::swap(a,b);]])],[ac_cv_std_swap_in_utility=yes],[ac_cv_std_swap_in_utility=no])]) | |
475 | if test $ac_cv_std_swap_in_utility = yes; then | |
476 | AC_DEFINE(HAVE_SWAP_IN_UTILITY, 1, | |
477 | [Define if <utility> defines std::swap.]) | |
478 | fi | |
479 | ||
4c0cca18 UW |
480 | # Check whether compiler is affected by placement new aliasing bug (PR 29286). |
481 | # If the host compiler is affected by the bug, and we build with optimization | |
482 | # enabled (which happens e.g. when cross-compiling), the pool allocator may | |
483 | # get miscompiled. Use -fno-strict-aliasing to work around this problem. | |
484 | # Since there is no reliable feature check for the presence of this bug, | |
485 | # we simply use a GCC version number check. (This should never trigger for | |
486 | # stages 2 or 3 of a native bootstrap.) | |
487 | aliasing_flags= | |
488 | if test "$GCC" = yes; then | |
489 | saved_CXXFLAGS="$CXXFLAGS" | |
490 | ||
491 | # The following test compilation will succeed if and only if $CXX accepts | |
492 | # -fno-strict-aliasing *and* is older than GCC 4.3. | |
493 | CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" | |
494 | AC_MSG_CHECKING([whether $CXX is affected by placement new aliasing bug]) | |
22e05272 | 495 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
4c0cca18 UW |
496 | #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) |
497 | #error compiler not affected by placement new aliasing bug | |
498 | #endif | |
22e05272 | 499 | ])], |
4c0cca18 UW |
500 | [AC_MSG_RESULT([yes]); aliasing_flags='-fno-strict-aliasing'], |
501 | [AC_MSG_RESULT([no])]) | |
502 | ||
503 | CXXFLAGS="$saved_CXXFLAGS" | |
504 | fi | |
505 | AC_SUBST(aliasing_flags) | |
35987ae9 RB |
506 | |
507 | ||
508 | ||
34a86c2b NN |
509 | # --------------------- |
510 | # Warnings and checking | |
511 | # --------------------- | |
512 | ||
b5472e1d NN |
513 | # Check $CC warning features (if it's GCC). |
514 | # We want to use -pedantic, but we don't want warnings about | |
515 | # * 'long long' | |
516 | # * variadic macros | |
89a42ac8 | 517 | # * overlong strings |
25339f10 | 518 | # * C++11 narrowing conversions in { } |
b5472e1d NN |
519 | # So, we only use -pedantic if we can disable those warnings. |
520 | ||
1652c6da JM |
521 | # In stage 1, disable -Wformat warnings from old GCCs about new % codes |
522 | AC_ARG_ENABLE(build-format-warnings, | |
523 | AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]), | |
524 | [],[enable_build_format_warnings=yes]) | |
525 | AS_IF([test $enable_build_format_warnings = no], | |
526 | [wf_opt=-Wno-format],[wf_opt=]) | |
ff771de3 | 527 | ACX_PROG_CXX_WARNING_OPTS( |
9bf40084 | 528 | m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ], |
0ecf545c MS |
529 | [-Wcast-qual -Wno-error=format-diag $wf_opt])), |
530 | [loose_warn]) | |
f6e377f8 | 531 | ACX_PROG_CC_WARNING_OPTS( |
0ecf545c MS |
532 | m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ], |
533 | [-Wno-error=format-diag])), [c_loose_warn]) | |
ff771de3 | 534 | ACX_PROG_CXX_WARNING_OPTS( |
ec9d5ad1 UB |
535 | m4_quote(m4_do([-Wmissing-format-attribute ], |
536 | [-Woverloaded-virtual])), [strict_warn]) | |
00020c16 ILT |
537 | ACX_PROG_CC_WARNING_OPTS( |
538 | m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn]) | |
ff771de3 | 539 | ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC( |
75c9cbe3 AS |
540 | m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ], |
541 | [-Wno-overlength-strings])), [strict_warn]) | |
ff771de3 | 542 | ACX_PROG_CXX_WARNINGS_ARE_ERRORS([manual], [strict_warn]) |
3bbd5a19 PB |
543 | |
544 | # The above macros do nothing if the compiler is not GCC. However, the | |
00020c16 ILT |
545 | # Makefile has more goo to add other flags, so these variables are used |
546 | # to enable warnings only for GCC. | |
414d23ae | 547 | warn_cflags= |
00020c16 | 548 | warn_cxxflags= |
414d23ae HPN |
549 | if test "x$GCC" = "xyes"; then |
550 | warn_cflags='$(GCC_WARN_CFLAGS)' | |
00020c16 | 551 | warn_cxxflags='$(GCC_WARN_CXXFLAGS)' |
414d23ae HPN |
552 | fi |
553 | AC_SUBST(warn_cflags) | |
00020c16 | 554 | AC_SUBST(warn_cxxflags) |
414d23ae | 555 | |
e9411247 MM |
556 | # Disable exceptions and RTTI if building with g++ |
557 | ACX_PROG_CC_WARNING_OPTS( | |
3d47a53a UB |
558 | m4_quote(m4_do([-fno-exceptions -fno-rtti -fasynchronous-unwind-tables])), |
559 | [noexception_flags]) | |
e9411247 | 560 | |
8b1f719a | 561 | # Enable expensive internal checks |
a1286ef5 ZW |
562 | is_release= |
563 | if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then | |
564 | is_release=yes | |
565 | fi | |
dd859b8a | 566 | |
a494747c | 567 | AC_ARG_ENABLE(checking, |
b88ecf55 AS |
568 | [AS_HELP_STRING([[--enable-checking[=LIST]]], |
569 | [enable expensive run-time checks. With LIST, | |
570 | enable only specific categories of checks. | |
571 | Categories are: yes,no,all,none,release. | |
7db11a5a | 572 | Flags are: assert,df,extra,fold,gc,gcac,gimple,misc, |
b88ecf55 | 573 | rtlflag,rtl,runtime,tree,valgrind,types])], |
e1bbfc5c NS |
574 | [ac_checking_flags="${enableval}"],[ |
575 | # Determine the default checks. | |
576 | if test x$is_release = x ; then | |
7db11a5a | 577 | ac_checking_flags=yes,extra |
e1bbfc5c NS |
578 | else |
579 | ac_checking_flags=release | |
580 | fi]) | |
e1bbfc5c | 581 | IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," |
04c3028a | 582 | for check in release $ac_checking_flags |
e1bbfc5c NS |
583 | do |
584 | case $check in | |
cdce5c16 | 585 | # these set all the flags to specific states |
0d475361 | 586 | yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ; |
7db11a5a | 587 | ac_fold_checking= ; ac_gc_checking=1 ; ac_extra_checking= ; |
726a989a | 588 | ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ; |
232b67d9 | 589 | ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; |
7e98624c | 590 | ac_tree_checking=1 ; ac_valgrind_checking= ; |
1b24a790 | 591 | ac_types_checking=1 ;; |
3089f8b5 | 592 | no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ; |
7db11a5a | 593 | ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ; |
726a989a | 594 | ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; |
232b67d9 | 595 | ac_rtlflag_checking= ; ac_runtime_checking= ; |
7e98624c RG |
596 | ac_tree_checking= ; ac_valgrind_checking= ; |
597 | ac_types_checking= ;; | |
3089f8b5 | 598 | all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ; |
7db11a5a | 599 | ac_fold_checking=1 ; ac_gc_checking=1 ; ac_extra_checking=1 ; |
726a989a | 600 | ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ; |
cdce5c16 | 601 | ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; |
7e98624c RG |
602 | ac_tree_checking=1 ; ac_valgrind_checking= ; |
603 | ac_types_checking=1 ;; | |
3089f8b5 | 604 | release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ; |
7db11a5a | 605 | ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ; |
726a989a | 606 | ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; |
cdce5c16 | 607 | ac_rtlflag_checking= ; ac_runtime_checking=1 ; |
7e98624c RG |
608 | ac_tree_checking= ; ac_valgrind_checking= ; |
609 | ac_types_checking= ;; | |
cdce5c16 | 610 | # these enable particular checks |
e1bbfc5c | 611 | assert) ac_assert_checking=1 ;; |
7db11a5a JJ |
612 | df) ac_df_checking=1 ;; |
613 | extra) ac_extra_checking=1 ;; | |
e1bbfc5c NS |
614 | fold) ac_fold_checking=1 ;; |
615 | gc) ac_gc_checking=1 ;; | |
616 | gcac) ac_gc_always_collect=1 ;; | |
726a989a | 617 | gimple) ac_gimple_checking=1 ;; |
e1bbfc5c | 618 | misc) ac_checking=1 ;; |
e1bbfc5c | 619 | rtl) ac_rtl_checking=1 ;; |
cdce5c16 | 620 | rtlflag) ac_rtlflag_checking=1 ;; |
b53ef395 | 621 | runtime) ac_runtime_checking=1 ;; |
e1bbfc5c | 622 | tree) ac_tree_checking=1 ;; |
7e98624c | 623 | types) ac_types_checking=1 ;; |
cdce5c16 | 624 | valgrind) ac_valgrind_checking=1 ;; |
e1bbfc5c NS |
625 | *) AC_MSG_ERROR(unknown check category $check) ;; |
626 | esac | |
627 | done | |
628 | IFS="$ac_save_IFS" | |
629 | ||
204250d2 | 630 | nocommon_flag="" |
119d24d1 | 631 | if test x$ac_checking != x ; then |
b06f87c7 BE |
632 | AC_DEFINE(CHECKING_P, 1, |
633 | [Define to 0/1 if you want more run-time sanity checks. This one gets a grab | |
634 | bag of miscellaneous but relatively cheap checks.]) | |
204250d2 | 635 | nocommon_flag=-fno-common |
7ec491c0 MM |
636 | else |
637 | AC_DEFINE(CHECKING_P, 0) | |
119d24d1 | 638 | fi |
204250d2 | 639 | AC_SUBST(nocommon_flag) |
b06f87c7 BE |
640 | if test x$ac_extra_checking != x ; then |
641 | AC_DEFINE(ENABLE_EXTRA_CHECKING, 1, | |
642 | [Define to 0/1 if you want extra run-time checking that might affect code | |
643 | generation.]) | |
644 | else | |
645 | AC_DEFINE(ENABLE_EXTRA_CHECKING, 0) | |
646 | fi | |
3089f8b5 PB |
647 | if test x$ac_df_checking != x ; then |
648 | AC_DEFINE(ENABLE_DF_CHECKING, 1, | |
649 | [Define if you want more run-time sanity checks for dataflow.]) | |
650 | fi | |
06c37c96 NS |
651 | if test x$ac_assert_checking != x ; then |
652 | AC_DEFINE(ENABLE_ASSERT_CHECKING, 1, | |
653 | [Define if you want assertions enabled. This is a cheap check.]) | |
654 | fi | |
726a989a RB |
655 | if test x$ac_gimple_checking != x ; then |
656 | AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1, | |
657 | [Define if you want operations on GIMPLE (the basic data structure of | |
658 | the high-level optimizers) to be checked for dynamic type safety at | |
659 | runtime. This is moderately expensive.]) | |
660 | fi | |
232b67d9 | 661 | GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING) |
b53ef395 NS |
662 | if test x$ac_runtime_checking != x ; then |
663 | AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1, | |
664 | [Define if you want runtime assertions enabled. This is a cheap check.]) | |
665 | fi | |
119d24d1 KG |
666 | if test x$ac_tree_checking != x ; then |
667 | AC_DEFINE(ENABLE_TREE_CHECKING, 1, | |
668 | [Define if you want all operations on trees (the basic data | |
669 | structure of the front ends) to be checked for dynamic type safety | |
8d2ccbd2 | 670 | at runtime. This is moderately expensive. |
13f05fd0 | 671 | ]) |
7cb9fd07 | 672 | TREECHECKING=yes |
119d24d1 | 673 | fi |
7e98624c RG |
674 | if test x$ac_types_checking != x ; then |
675 | AC_DEFINE(ENABLE_TYPES_CHECKING, 1, | |
676 | [Define if you want all gimple types to be verified after gimplifiation. | |
677 | This is cheap. | |
678 | ]) | |
679 | fi | |
7cb9fd07 | 680 | AC_SUBST(TREECHECKING) |
119d24d1 KG |
681 | if test x$ac_rtl_checking != x ; then |
682 | AC_DEFINE(ENABLE_RTL_CHECKING, 1, | |
683 | [Define if you want all operations on RTL (the basic data structure | |
684 | of the optimizer and back end) to be checked for dynamic type safety | |
685 | at runtime. This is quite expensive.]) | |
686 | fi | |
4c76f856 JJ |
687 | if test x$ac_rtlflag_checking != x ; then |
688 | AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1, | |
689 | [Define if you want RTL flag accesses to be checked against the RTL | |
690 | codes that are supported for each access macro. This is relatively | |
691 | cheap.]) | |
692 | fi | |
119d24d1 KG |
693 | if test x$ac_gc_checking != x ; then |
694 | AC_DEFINE(ENABLE_GC_CHECKING, 1, | |
695 | [Define if you want the garbage collector to do object poisoning and | |
696 | other memory allocation checks. This is quite expensive.]) | |
697 | fi | |
698 | if test x$ac_gc_always_collect != x ; then | |
699 | AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1, | |
700 | [Define if you want the garbage collector to operate in maximally | |
701 | paranoid mode, validating the entire heap and collecting garbage at | |
702 | every opportunity. This is extremely expensive.]) | |
703 | fi | |
5dfa45d0 JJ |
704 | if test x$ac_fold_checking != x ; then |
705 | AC_DEFINE(ENABLE_FOLD_CHECKING, 1, | |
706 | [Define if you want fold checked that it never destructs its argument. | |
707 | This is quite expensive.]) | |
708 | fi | |
414d23ae HPN |
709 | valgrind_path_defines= |
710 | valgrind_command= | |
6938ec6c NN |
711 | |
712 | dnl # This check AC_REQUIREs various stuff, so it *must not* be inside | |
713 | dnl # an if statement. This was the source of very frustrating bugs | |
714 | dnl # in converting to autoconf 2.5x! | |
715 | AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) | |
716 | ||
279a935f RB |
717 | # It is certainly possible that there's valgrind but no valgrind.h. |
718 | # GCC relies on making annotations so we must have both. | |
719 | AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>) | |
720 | AC_PREPROC_IFELSE([AC_LANG_SOURCE( | |
721 | [[#include <valgrind/memcheck.h> | |
a207b594 HPN |
722 | #ifndef VALGRIND_DISCARD |
723 | #error VALGRIND_DISCARD not defined | |
f04f1d2c | 724 | #endif]])], |
a207b594 HPN |
725 | [gcc_cv_header_valgrind_memcheck_h=yes], |
726 | [gcc_cv_header_valgrind_memcheck_h=no]) | |
279a935f RB |
727 | AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h) |
728 | AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>) | |
729 | AC_PREPROC_IFELSE([AC_LANG_SOURCE( | |
730 | [[#include <memcheck.h> | |
14011ca4 AJ |
731 | #ifndef VALGRIND_DISCARD |
732 | #error VALGRIND_DISCARD not defined | |
f04f1d2c KC |
733 | #endif]])], |
734 | [gcc_cv_header_memcheck_h=yes], | |
735 | [gcc_cv_header_memcheck_h=no]) | |
279a935f RB |
736 | AC_MSG_RESULT($gcc_cv_header_memcheck_h) |
737 | if test $gcc_cv_header_valgrind_memcheck_h = yes; then | |
738 | AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1, | |
739 | [Define if valgrind's valgrind/memcheck.h header is installed.]) | |
740 | fi | |
741 | if test $gcc_cv_header_memcheck_h = yes; then | |
742 | AC_DEFINE(HAVE_MEMCHECK_H, 1, | |
743 | [Define if valgrind's memcheck.h header is installed.]) | |
744 | fi | |
745 | ||
746 | if test x$ac_valgrind_checking != x ; then | |
414d23ae HPN |
747 | AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, |
748 | [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) | |
a207b594 HPN |
749 | if test "x$valgrind_path" = "x" \ |
750 | || (test $have_valgrind_h = no \ | |
751 | && test $gcc_cv_header_memcheck_h = no \ | |
752 | && test $gcc_cv_header_valgrind_memcheck_h = no); then | |
753 | AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h]) | |
414d23ae HPN |
754 | fi |
755 | valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' | |
756 | valgrind_command="$valgrind_path -q" | |
757 | AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, | |
758 | [Define if you want to run subprograms and generated programs | |
759 | through valgrind (a memory checker). This is extremely expensive.]) | |
760 | fi | |
761 | AC_SUBST(valgrind_path_defines) | |
762 | AC_SUBST(valgrind_command) | |
51d0e20c | 763 | |
22aa533e NS |
764 | # Enable code coverage collection |
765 | AC_ARG_ENABLE(coverage, | |
b88ecf55 AS |
766 | [AS_HELP_STRING([[--enable-coverage[=LEVEL]]], |
767 | [enable compiler's code coverage collection. | |
768 | Use to measure compiler performance and locate | |
769 | unused parts of the compiler. With LEVEL, specify | |
770 | optimization. Values are opt, noopt, | |
771 | default is noopt])], | |
22aa533e | 772 | [case "${enableval}" in |
6dd297da | 773 | yes|noopt) |
9879232c | 774 | coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0 -fkeep-static-functions" |
6dd297da NN |
775 | ;; |
776 | opt) | |
9879232c | 777 | coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2 -fkeep-static-functions" |
6dd297da NN |
778 | ;; |
779 | no) | |
780 | # a.k.a. --disable-coverage | |
781 | coverage_flags="" | |
782 | ;; | |
783 | *) | |
784 | AC_MSG_ERROR(unknown coverage setting $enableval) | |
785 | ;; | |
22aa533e | 786 | esac], |
2043c38e | 787 | [coverage_flags=""]) |
22aa533e NS |
788 | AC_SUBST(coverage_flags) |
789 | ||
439a7e54 | 790 | AC_ARG_ENABLE(gather-detailed-mem-stats, |
b88ecf55 AS |
791 | [AS_HELP_STRING([--enable-gather-detailed-mem-stats], |
792 | [enable detailed memory allocation stats gathering])], [], | |
439a7e54 | 793 | [enable_gather_detailed_mem_stats=no]) |
7aa6d18a SB |
794 | gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else echo 0; fi` |
795 | AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats, | |
796 | [Define to enable detailed memory allocation stats gathering.]) | |
439a7e54 | 797 | |
279a935f RB |
798 | AC_ARG_ENABLE(valgrind-annotations, |
799 | [AS_HELP_STRING([--enable-valgrind-annotations], | |
800 | [enable valgrind runtime interaction])], [], | |
801 | [enable_valgrind_annotations=no]) | |
802 | if test x$enable_valgrind_annotations != xno \ | |
803 | || test x$ac_valgrind_checking != x; then | |
804 | if (test $have_valgrind_h = no \ | |
805 | && test $gcc_cv_header_memcheck_h = no \ | |
806 | && test $gcc_cv_header_valgrind_memcheck_h = no); then | |
807 | AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h]) | |
808 | fi | |
809 | AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1, | |
810 | [Define to get calls to the valgrind runtime enabled.]) | |
811 | fi | |
812 | ||
73458fb7 NN |
813 | # ------------------------------- |
814 | # Miscenalleous configure options | |
815 | # ------------------------------- | |
34a86c2b NN |
816 | |
817 | # With stabs | |
818 | AC_ARG_WITH(stabs, | |
b88ecf55 AS |
819 | [AS_HELP_STRING([--with-stabs], |
820 | [arrange to use stabs instead of host debug format])], | |
34a86c2b NN |
821 | stabs="$with_stabs", |
822 | stabs=no) | |
823 | ||
34a86c2b NN |
824 | # Determine whether or not multilibs are enabled. |
825 | AC_ARG_ENABLE(multilib, | |
b88ecf55 AS |
826 | [AS_HELP_STRING([--enable-multilib], |
827 | [enable library support for multiple ABIs])], | |
34a86c2b NN |
828 | [], [enable_multilib=yes]) |
829 | AC_SUBST(enable_multilib) | |
3ecc3258 | 830 | |
e0cdc09f MK |
831 | # Determine whether or not multiarch is enabled. |
832 | AC_ARG_ENABLE(multiarch, | |
833 | [AS_HELP_STRING([--enable-multiarch], | |
834 | [enable support for multiarch paths])], | |
5213f20c MK |
835 | [case "${enableval}" in |
836 | yes|no|auto) enable_multiarch=$enableval;; | |
837 | *) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;; | |
e0cdc09f MK |
838 | esac], [enable_multiarch=auto]) |
839 | if test x${enable_multiarch} = xauto; then | |
840 | if test x${with_native_system_header_dir} != x; then | |
841 | ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)" | |
842 | enable_multiarch=no | |
843 | fi | |
844 | if test x$host != x$target && test "x$with_sysroot" = x; then | |
845 | ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)" | |
846 | enable_multiarch=no | |
847 | fi | |
848 | fi | |
849 | AC_MSG_CHECKING(for multiarch configuration) | |
850 | AC_SUBST(enable_multiarch) | |
851 | AC_MSG_RESULT($enable_multiarch$ma_msg_suffix) | |
852 | ||
853 | # needed for setting the multiarch name for soft-float/hard-float ABIs | |
d757eae9 | 854 | AC_SUBST(with_cpu) |
e0cdc09f MK |
855 | AC_SUBST(with_float) |
856 | ||
630b1e3a TC |
857 | # default stack clash protection guard size as power of twos in bytes. |
858 | # Please keep these in sync with params.def. | |
859 | stk_clash_min=12 | |
860 | stk_clash_max=30 | |
861 | ||
862 | # Keep the default value when the option is not used to 0, this allows us to | |
863 | # distinguish between the cases where the user specifially set a value via | |
864 | # configure and when the normal default value is used. | |
865 | AC_ARG_WITH(stack-clash-protection-guard-size, | |
866 | [AS_HELP_STRING([--with-stack-clash-protection-guard-size=size], | |
867 | [Set the default stack clash protection guard size for specific targets as a power of two in bytes.])], | |
868 | [DEFAULT_STK_CLASH_GUARD_SIZE="$with_stack_clash_protection_guard_size"], [DEFAULT_STK_CLASH_GUARD_SIZE=0]) | |
869 | if test $DEFAULT_STK_CLASH_GUARD_SIZE -ne 0 \ | |
870 | && (test $DEFAULT_STK_CLASH_GUARD_SIZE -lt $stk_clash_min \ | |
871 | || test $DEFAULT_STK_CLASH_GUARD_SIZE -gt $stk_clash_max); then | |
872 | AC_MSG_ERROR(m4_normalize([ | |
873 | Invalid value $DEFAULT_STK_CLASH_GUARD_SIZE for --with-stack-clash-protection-guard-size. \ | |
874 | Must be between $stk_clash_min and $stk_clash_max.])) | |
875 | fi | |
876 | ||
877 | AC_DEFINE_UNQUOTED(DEFAULT_STK_CLASH_GUARD_SIZE, $DEFAULT_STK_CLASH_GUARD_SIZE, | |
878 | [Define to larger than zero set the default stack clash protector size.]) | |
879 | ||
4bafaa6f L |
880 | # Enable __cxa_atexit for C++. |
881 | AC_ARG_ENABLE(__cxa_atexit, | |
b88ecf55 | 882 | [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])], |
4bafaa6f | 883 | [], []) |
2121a768 | 884 | |
486aa804 | 885 | # Enable C extension for decimal float if target supports it. |
3c39bca6 | 886 | GCC_AC_ENABLE_DECIMAL_FLOAT([$target]) |
486aa804 | 887 | |
79b87c74 | 888 | dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` |
486aa804 BE |
889 | AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp, |
890 | [Define to 1 to enable decimal float extension to C.]) | |
891 | ||
cc0ae0ca L |
892 | # Use default_decimal_float for dependency. |
893 | enable_decimal_float=$default_decimal_float | |
894 | ||
79b87c74 MM |
895 | bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` |
896 | AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid, | |
897 | [Define to 1 to specify that we are using the BID decimal floating | |
898 | point format instead of DPD]) | |
899 | ||
ab22c1fa CF |
900 | # Enable C extension for fixed-point arithmetic. |
901 | AC_ARG_ENABLE(fixed-point, | |
b88ecf55 AS |
902 | [AS_HELP_STRING([--enable-fixed-point], |
903 | [enable fixed-point arithmetic extension to C])], | |
904 | [], | |
ab22c1fa CF |
905 | [ |
906 | case $target in | |
655b30bf JB |
907 | arm*) |
908 | enable_fixed_point=yes | |
909 | ;; | |
910 | ||
ab22c1fa | 911 | mips*-*-*) |
b24513a1 | 912 | enable_fixed_point=yes |
ab22c1fa CF |
913 | ;; |
914 | *) | |
84f47d20 | 915 | AC_MSG_WARN([fixed-point is not supported for this target, ignored]) |
ab22c1fa CF |
916 | enable_fixed_point=no |
917 | ;; | |
918 | esac | |
919 | ]) | |
920 | AC_SUBST(enable_fixed_point) | |
921 | ||
922 | fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi` | |
923 | AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint, | |
924 | [Define to 1 to enable fixed-point arithmetic extension to C.]) | |
925 | ||
0bbb1697 RK |
926 | # Enable threads |
927 | # Pass with no value to take the default | |
928 | # Pass with a value to specify a thread package | |
929 | AC_ARG_ENABLE(threads, | |
b88ecf55 AS |
930 | [AS_HELP_STRING([[--enable-threads[=LIB]]], |
931 | [enable thread usage for target GCC, | |
932 | using LIB thread package])],, | |
615be2cf | 933 | [enable_threads='']) |
0bbb1697 | 934 | |
8dea1cca | 935 | AC_ARG_ENABLE(tls, |
b88ecf55 AS |
936 | [AS_HELP_STRING([--enable-tls], |
937 | [enable or disable generation of tls code | |
938 | overriding the assembler check for tls support])], | |
8dea1cca DD |
939 | [ |
940 | case $enable_tls in | |
941 | yes | no) ;; | |
942 | *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls. | |
943 | Valid choices are 'yes' and 'no'.]) ;; | |
944 | esac | |
945 | ], [enable_tls='']) | |
946 | ||
ad103b01 RO |
947 | AC_ARG_ENABLE(vtable-verify, |
948 | [AS_HELP_STRING([--enable-vtable-verify], | |
949 | [enable vtable verification feature])],, | |
950 | [enable_vtable_verify=no]) | |
951 | vtable_verify=`if test x$enable_vtable_verify = xyes; then echo 1; else echo 0; fi` | |
952 | AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify, | |
953 | [Define 0/1 if vtable verification feature is enabled.]) | |
954 | ||
757bf1df DM |
955 | AC_ARG_ENABLE(analyzer, |
956 | [AS_HELP_STRING([--disable-analyzer], | |
957 | [disable -fanalyzer static analyzer])], | |
958 | if test x$enable_analyzer = xno; then | |
959 | analyzer=0 | |
960 | else | |
961 | analyzer=1 | |
962 | fi, | |
963 | analyzer=1) | |
964 | AC_DEFINE_UNQUOTED(ENABLE_ANALYZER, $analyzer, | |
965 | [Define 0/1 if static analyzer feature is enabled.]) | |
966 | ||
d8bb17c8 | 967 | AC_ARG_ENABLE(objc-gc, |
b88ecf55 AS |
968 | [AS_HELP_STRING([--enable-objc-gc], |
969 | [enable the use of Boehm's garbage collector with | |
970 | the GNU Objective-C runtime])], | |
2618c083 | 971 | if test x$enable_objc_gc = xno; then |
d8bb17c8 OP |
972 | objc_boehm_gc='' |
973 | else | |
974 | objc_boehm_gc=1 | |
975 | fi, | |
976 | objc_boehm_gc='') | |
977 | ||
90e6a802 | 978 | AC_ARG_WITH(dwarf2, |
b88ecf55 | 979 | [AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2])], |
87921b81 | 980 | dwarf2="$with_dwarf2", |
90e6a802 RL |
981 | dwarf2=no) |
982 | ||
50503ac8 | 983 | AC_ARG_ENABLE(shared, |
b88ecf55 | 984 | [AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])], |
c785e0fa AO |
985 | [ |
986 | case $enable_shared in | |
987 | yes | no) ;; | |
988 | *) | |
989 | enable_shared=no | |
990 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," | |
991 | for pkg in $enableval; do | |
992 | if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then | |
993 | enable_shared=yes | |
994 | fi | |
995 | done | |
996 | IFS="$ac_save_ifs" | |
997 | ;; | |
998 | esac | |
999 | ], [enable_shared=yes]) | |
50503ac8 RH |
1000 | AC_SUBST(enable_shared) |
1001 | ||
1765b023 RV |
1002 | AC_ARG_ENABLE(gcov, |
1003 | [ --disable-gcov don't provide libgcov and related host tools], | |
1004 | [], [enable_gcov=yes]) | |
1005 | AC_SUBST(enable_gcov) | |
1006 | ||
e11ddaf5 NS |
1007 | AC_ARG_WITH(specs, |
1008 | [AS_HELP_STRING([--with-specs=SPECS], | |
1009 | [add SPECS to driver command-line processing])], | |
1010 | [CONFIGURE_SPECS=$withval], | |
1011 | [CONFIGURE_SPECS=] | |
1012 | ) | |
1013 | AC_SUBST(CONFIGURE_SPECS) | |
1014 | ||
2f41c1d6 | 1015 | ACX_PKGVERSION([GCC]) |
9334ef9e | 1016 | ACX_BUGURL([https://gcc.gnu.org/bugs/]) |
2f41c1d6 | 1017 | |
b4c7ca2e DM |
1018 | # Allow overriding the default URL for documentation |
1019 | AC_ARG_WITH(documentation-root-url, | |
1020 | AS_HELP_STRING([--with-documentation-root-url=URL], | |
1021 | [Root for documentation URLs]), | |
1022 | [case "$withval" in | |
1023 | yes) AC_MSG_ERROR([documentation root URL not specified]) ;; | |
1024 | no) AC_MSG_ERROR([documentation root URL not specified]) ;; | |
e33a1eae JJ |
1025 | */) DOCUMENTATION_ROOT_URL="$withval" ;; |
1026 | *) AC_MSG_ERROR([documentation root URL does not end with /]) ;; | |
b4c7ca2e | 1027 | esac], |
fa29cf0c | 1028 | DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/" |
b4c7ca2e | 1029 | ) |
e33a1eae JJ |
1030 | AC_DEFINE_UNQUOTED(DOCUMENTATION_ROOT_URL,"$DOCUMENTATION_ROOT_URL", |
1031 | [Define to the root for documentation URLs.]) | |
b4c7ca2e | 1032 | |
691eeb65 JJ |
1033 | # Allow overriding the default URL for GCC changes |
1034 | AC_ARG_WITH(changes-root-url, | |
1035 | AS_HELP_STRING([--with-changes-root-url=URL], | |
1036 | [Root for GCC changes URLs]), | |
1037 | [case "$withval" in | |
1038 | yes) AC_MSG_ERROR([changes root URL not specified]) ;; | |
1039 | no) AC_MSG_ERROR([changes root URL not specified]) ;; | |
e33a1eae JJ |
1040 | */) CHANGES_ROOT_URL="$withval" ;; |
1041 | *) AC_MSG_ERROR([changes root URL does not end with /]) ;; | |
691eeb65 JJ |
1042 | esac], |
1043 | CHANGES_ROOT_URL="https://gcc.gnu.org/" | |
1044 | ) | |
e33a1eae JJ |
1045 | AC_DEFINE_UNQUOTED(CHANGES_ROOT_URL,"$CHANGES_ROOT_URL", |
1046 | [Define to the root for URLs about GCC changes.]) | |
691eeb65 | 1047 | |
e4c9c075 PB |
1048 | # Sanity check enable_languages in case someone does not run the toplevel |
1049 | # configure # script. | |
1050 | AC_ARG_ENABLE(languages, | |
b88ecf55 | 1051 | [AS_HELP_STRING([--enable-languages=LIST], [specify which front-ends to build])], |
e4c9c075 PB |
1052 | [case ,${enable_languages}, in |
1053 | ,,|,yes,) | |
1054 | # go safe -- we cannot be much sure without the toplevel | |
1055 | # configure's | |
1056 | # analysis of which target libs are present and usable | |
1057 | enable_languages=c | |
1058 | ;; | |
1059 | *,all,*) | |
1060 | AC_MSG_ERROR([only the toplevel supports --enable-languages=all]) | |
1061 | ;; | |
1062 | *,c,*) | |
1063 | ;; | |
1064 | *) | |
1065 | enable_languages=c,${enable_languages} | |
1066 | ;; | |
1067 | esac], | |
1068 | [enable_languages=c]) | |
1069 | ||
8951374d MR |
1070 | # If top-level libada has been disabled, then wire in install-gnatlib |
1071 | # invocation with `make install', so that one can build and install | |
1072 | # the library manually with `make -C gcc all gnatlib gnattools install'. | |
1073 | if test x"$enable_libada" = xno; then | |
1074 | gnat_install_lib=gnat-install-lib | |
1075 | else | |
1076 | gnat_install_lib= | |
1077 | fi | |
1078 | AC_SUBST(gnat_install_lib) | |
1079 | ||
85c64bbe BS |
1080 | if test x"$enable_as_accelerator_for" != x; then |
1081 | AC_DEFINE(ACCEL_COMPILER, 1, | |
1082 | [Define if this compiler should be built as the offload target compiler.]) | |
1083 | enable_as_accelerator=yes | |
1084 | case "${target}" in | |
1085 | *-intelmicemul-*) | |
1086 | # In this case we expect offload compiler to be built as native, so we | |
1087 | # need to rename the driver to avoid clashes with host's drivers. | |
1088 | program_transform_name="s&^&${target}-&" ;; | |
1089 | esac | |
1090 | sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#" | |
1091 | program_transform_name=`echo $program_transform_name | sed $sedscript` | |
1092 | accel_dir_suffix=/accel/${target_noncanonical} | |
1093 | real_target_noncanonical=${enable_as_accelerator_for} | |
1094 | fi | |
1095 | AC_SUBST(enable_as_accelerator) | |
1096 | AC_SUBST(real_target_noncanonical) | |
1097 | AC_SUBST(accel_dir_suffix) | |
1098 | ||
1099 | for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do | |
1100 | tgt=`echo $tgt | sed 's/=.*//'` | |
b2b40051 | 1101 | |
c56684fd MJ |
1102 | enable_offloading=1 |
1103 | case "$tgt" in | |
1104 | *-intelmic-* | *-intelmicemul-*) | |
1105 | omp_device_property=omp-device-properties-i386 | |
1106 | omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device" | |
1107 | ;; | |
1108 | amdgcn*) | |
1109 | omp_device_property=omp-device-properties-gcn | |
1110 | omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device" | |
1111 | ;; | |
1112 | nvptx*) | |
1113 | omp_device_property=omp-device-properties-nvptx | |
1114 | omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/nvptx/t-omp-device" | |
1115 | ;; | |
1116 | *) | |
1117 | AC_MSG_ERROR([unknown offload target specified]) | |
1118 | ;; | |
1119 | esac | |
1120 | omp_device_properties="${omp_device_properties} ${tgt}=${omp_device_property}" | |
1121 | omp_device_property_deps="${omp_device_property_deps} ${omp_device_property}" | |
b2b40051 | 1122 | |
85c64bbe BS |
1123 | if test x"$offload_targets" = x; then |
1124 | offload_targets=$tgt | |
1125 | else | |
64186aad | 1126 | offload_targets="$offload_targets,$tgt" |
85c64bbe BS |
1127 | fi |
1128 | done | |
9ba66bf5 JJ |
1129 | AC_SUBST(omp_device_properties) |
1130 | AC_SUBST(omp_device_property_deps) | |
1131 | ||
85c64bbe | 1132 | AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets", |
64186aad | 1133 | [Define to offload targets, separated by commas.]) |
b2b40051 | 1134 | if test x"$enable_offloading" != x; then |
85c64bbe BS |
1135 | AC_DEFINE(ENABLE_OFFLOADING, 1, |
1136 | [Define this to enable support for offloading.]) | |
1d899da2 TS |
1137 | else |
1138 | AC_DEFINE(ENABLE_OFFLOADING, 0, | |
1139 | [Define this to enable support for offloading.]) | |
85c64bbe BS |
1140 | fi |
1141 | ||
aca600aa | 1142 | AC_ARG_WITH(multilib-list, |
17a819cb | 1143 | [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])], |
aca600aa AS |
1144 | :, |
1145 | with_multilib_list=default) | |
1146 | ||
c1e66912 KC |
1147 | AC_ARG_WITH(multilib-generator, |
1148 | [AS_HELP_STRING([--with-multilib-generator], [Multi-libs configuration string (RISC-V only)])], | |
1149 | :, | |
1150 | with_multilib_generator=default) | |
1151 | ||
73458fb7 NN |
1152 | # ------------------------- |
1153 | # Checks for other programs | |
1154 | # ------------------------- | |
61842080 | 1155 | |
e9a25f70 JL |
1156 | AC_PROG_MAKE_SET |
1157 | ||
46f18e7b RK |
1158 | # Find some useful tools |
1159 | AC_PROG_AWK | |
776dc15d | 1160 | # We need awk to create options.c and options.h. |
2c4902b9 NN |
1161 | # Bail out if it's missing. |
1162 | case ${AWK} in | |
1163 | "") AC_MSG_ERROR([can't build without awk, bailing out]) ;; | |
1164 | esac | |
1165 | ||
99e757d5 | 1166 | gcc_AC_PROG_LN_S |
ad6717df | 1167 | ACX_PROG_LN($LN_S) |
46f18e7b | 1168 | AC_PROG_RANLIB |
10eb188c | 1169 | ranlib_flags="" |
343a6100 MM |
1170 | AC_SUBST(ranlib_flags) |
1171 | ||
99e757d5 | 1172 | gcc_AC_PROG_INSTALL |
46f18e7b | 1173 | |
3a000df0 KC |
1174 | # See if cmp has --ignore-initial. |
1175 | gcc_AC_PROG_CMP_IGNORE_INITIAL | |
1176 | ||
955be633 JM |
1177 | # See if we have the mktemp command. |
1178 | AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no) | |
1179 | ||
7c27e184 PB |
1180 | # See if makeinfo has been installed and is modern enough |
1181 | # that we can use it. | |
3bbd5a19 | 1182 | ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, |
09fa0705 | 1183 | [GNU texinfo.* \([0-9][0-9.]*\)], |
7326a39e | 1184 | [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) |
09fa0705 ZW |
1185 | if test $gcc_cv_prog_makeinfo_modern = no; then |
1186 | AC_MSG_WARN([ | |
1187 | *** Makeinfo is missing or too old. | |
17db6582 | 1188 | *** Info documentation will not be built.]) |
09fa0705 | 1189 | BUILD_INFO= |
09fa0705 | 1190 | else |
7c27e184 | 1191 | BUILD_INFO=info |
09fa0705 | 1192 | fi |
7c27e184 | 1193 | AC_SUBST(BUILD_INFO) |
09fa0705 | 1194 | |
3f896fc2 JM |
1195 | # Is pod2man recent enough to regenerate manpages? |
1196 | AC_MSG_CHECKING([for recent Pod::Man]) | |
7be33370 | 1197 | if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then |
fd939e46 | 1198 | AC_MSG_RESULT(yes) |
7c27e184 | 1199 | GENERATED_MANPAGES=generated-manpages |
fd939e46 JM |
1200 | else |
1201 | AC_MSG_RESULT(no) | |
1202 | GENERATED_MANPAGES= | |
1203 | fi | |
7c27e184 | 1204 | AC_SUBST(GENERATED_MANPAGES) |
fd939e46 | 1205 | |
3bbd5a19 PB |
1206 | MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing" |
1207 | ||
1e608388 ZW |
1208 | # How about lex? |
1209 | dnl Don't use AC_PROG_LEX; we insist on flex. | |
1210 | dnl LEXLIB is not useful in gcc. | |
7c27e184 | 1211 | AC_CHECK_PROGS([FLEX], flex, [$MISSING flex]) |
1e608388 ZW |
1212 | |
1213 | # Bison? | |
7c27e184 PB |
1214 | AC_CHECK_PROGS([BISON], bison, [$MISSING bison]) |
1215 | ||
1216 | # Binutils are not build modules, unlike bison/flex/makeinfo. So we | |
1217 | # check for build == host before using them. | |
1e608388 | 1218 | |
f6a874ac | 1219 | # NM |
414adbdd GK |
1220 | if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \ |
1221 | && test -d ../binutils ; then | |
bfa912a8 | 1222 | NM='${objdir}/../binutils/nm-new' |
f6a874ac JW |
1223 | else |
1224 | AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm) | |
1225 | fi | |
1226 | ||
1227 | # AR | |
414adbdd GK |
1228 | if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \ |
1229 | && test -d ../binutils ; then | |
bfa912a8 | 1230 | AR='${objdir}/../binutils/ar' |
f6a874ac JW |
1231 | else |
1232 | AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar) | |
1233 | fi | |
1234 | ||
35485da9 DM |
1235 | # The jit documentation looks better if built with sphinx, but can be |
1236 | # built with texinfo if sphinx is not available. | |
1237 | # Set "doc_build_sys" to "sphinx" or "texinfo" accordingly. | |
1238 | AC_CHECK_PROG(doc_build_sys, sphinx-build, sphinx, texinfo) | |
f6a874ac | 1239 | |
73458fb7 NN |
1240 | # -------------------- |
1241 | # Checks for C headers | |
1242 | # -------------------- | |
1243 | ||
ca9bc441 NN |
1244 | # Need to reject headers which give warnings, so that the -Werror bootstrap |
1245 | # works later. *sigh* This needs to come before all header checks. | |
1246 | AC_PROG_CPP_WERROR | |
1247 | ||
73458fb7 NN |
1248 | AC_HEADER_STDC |
1249 | AC_HEADER_TIME | |
4f4e53dd | 1250 | ACX_HEADER_STRING |
73458fb7 | 1251 | AC_HEADER_SYS_WAIT |
c68a6e08 | 1252 | AC_HEADER_TIOCGWINSZ |
dfb77e37 | 1253 | AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ |
37050045 | 1254 | fcntl.h ftw.h unistd.h sys/file.h sys/time.h sys/mman.h \ |
73458fb7 | 1255 | sys/resource.h sys/param.h sys/times.h sys/stat.h \ |
4fbfcf44 | 1256 | direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h) |
73458fb7 NN |
1257 | |
1258 | # Check for thread headers. | |
1259 | AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) | |
1260 | AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) | |
1261 | ||
1262 | # These tests can't be done till we know if we have limits.h. | |
1263 | gcc_AC_C_CHAR_BIT | |
9791c75c | 1264 | AC_C_BIGENDIAN |
73458fb7 | 1265 | |
5427046f ILT |
1266 | # ---------------------- |
1267 | # Checks for C++ headers | |
1268 | # ---------------------- | |
1269 | ||
c658f0ce ILT |
1270 | dnl Autoconf will give an error in the configure script if there is no |
1271 | dnl C++ preprocessor. Hack to prevent that. | |
1272 | m4_pushdef([AC_MSG_ERROR], m4_defn([AC_MSG_WARN]))[]dnl | |
1273 | AC_PROG_CXXCPP | |
1274 | m4_popdef([AC_MSG_ERROR])[]dnl | |
1275 | ||
5427046f ILT |
1276 | AC_CHECK_HEADERS(unordered_map) |
1277 | AC_CHECK_HEADERS(tr1/unordered_map) | |
1278 | AC_CHECK_HEADERS(ext/hash_map) | |
1279 | ||
043378c3 TT |
1280 | # -------- |
1281 | # Dependency checking. | |
1282 | # -------- | |
1283 | ||
043378c3 TT |
1284 | ZW_CREATE_DEPDIR |
1285 | AC_CONFIG_COMMANDS([gccdepdir],[ | |
1286 | ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR | |
73b75827 | 1287 | for lang in $subdirs c-family common analyzer rtl-ssa |
043378c3 TT |
1288 | do |
1289 | ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR | |
1290 | done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR]) | |
1291 | ||
54c09437 | 1292 | ZW_PROG_COMPILER_DEPENDENCIES([CXX]) |
5427046f | 1293 | |
73458fb7 NN |
1294 | # -------- |
1295 | # UNSORTED | |
1296 | # -------- | |
1297 | ||
73458fb7 | 1298 | |
4e70264f ZW |
1299 | # These libraries may be used by collect2. |
1300 | # We may need a special search path to get them linked. | |
1301 | AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs, | |
1302 | [save_LIBS="$LIBS" | |
7f2749d4 | 1303 | for libs in '' -lld -lmld \ |
4e70264f ZW |
1304 | '-L/usr/lib/cmplrs/cc2.11 -lmld' \ |
1305 | '-L/usr/lib/cmplrs/cc3.11 -lmld' | |
1306 | do | |
1307 | LIBS="$libs" | |
1308 | AC_TRY_LINK_FUNC(ldopen, | |
1309 | [gcc_cv_collect2_libs="$libs"; break]) | |
1310 | done | |
1311 | LIBS="$save_LIBS" | |
1312 | test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required']) | |
1313 | case $gcc_cv_collect2_libs in | |
1314 | "none required") ;; | |
1315 | *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;; | |
1316 | esac | |
1317 | AC_SUBST(COLLECT2_LIBS) | |
1318 | ||
7f2749d4 RK |
1319 | # When building Ada code on Alpha, we need exc_resume which is usually in |
1320 | # -lexc. So test for it. | |
1321 | save_LIBS="$LIBS" | |
1322 | LIBS= | |
1323 | AC_SEARCH_LIBS(exc_resume, exc) | |
1324 | GNAT_LIBEXC="$LIBS" | |
1325 | LIBS="$save_LIBS" | |
1326 | AC_SUBST(GNAT_LIBEXC) | |
1327 | ||
e3b3fa45 RO |
1328 | # To support -mcpu=native on Solaris/SPARC, we need libkstat. |
1329 | save_LIBS="$LIBS" | |
1330 | LIBS= | |
1331 | AC_SEARCH_LIBS(kstat_open, kstat) | |
1332 | EXTRA_GCC_LIBS="$LIBS" | |
1333 | LIBS="$save_LIBS" | |
1334 | AC_SUBST(EXTRA_GCC_LIBS) | |
1335 | ||
62c9aa5f ZW |
1336 | # Some systems put ldexp and frexp in libm instead of libc; assume |
1337 | # they're both in the same place. jcf-dump needs them. | |
1338 | save_LIBS="$LIBS" | |
1339 | LIBS= | |
1340 | AC_SEARCH_LIBS(ldexp, m) | |
1341 | LDEXP_LIB="$LIBS" | |
1342 | LIBS="$save_LIBS" | |
1343 | AC_SUBST(LDEXP_LIB) | |
1344 | ||
7431c1a1 AS |
1345 | # Some systems need dlopen |
1346 | save_LIBS="$LIBS" | |
1347 | LIBS= | |
1348 | AC_SEARCH_LIBS(dlopen, dl) | |
1349 | DL_LIB="$LIBS" | |
1350 | LIBS="$save_LIBS" | |
1351 | AC_SUBST(DL_LIB) | |
1352 | ||
7636d567 | 1353 | # Use <inttypes.h> only if it exists, |
35987ae9 RB |
1354 | # doesn't clash with <sys/types.h>, declares intmax_t and defines |
1355 | # PRId64 | |
7636d567 JW |
1356 | AC_MSG_CHECKING(for inttypes.h) |
1357 | AC_CACHE_VAL(gcc_cv_header_inttypes_h, | |
f04f1d2c | 1358 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
35987ae9 RB |
1359 | [[#define __STDC_FORMAT_MACROS |
1360 | #include <sys/types.h> | |
f04f1d2c | 1361 | #include <inttypes.h>]], |
35987ae9 RB |
1362 | [[intmax_t i = -1; |
1363 | #ifndef PRId64 | |
1364 | choke me | |
1365 | #endif]])], | |
9da0e39b | 1366 | [gcc_cv_header_inttypes_h=yes], |
f04f1d2c | 1367 | [gcc_cv_header_inttypes_h=no])]) |
7636d567 | 1368 | AC_MSG_RESULT($gcc_cv_header_inttypes_h) |
9da0e39b | 1369 | if test $gcc_cv_header_inttypes_h = yes; then |
119d24d1 KG |
1370 | AC_DEFINE(HAVE_INTTYPES_H, 1, |
1371 | [Define if you have a working <inttypes.h> header file.]) | |
9da0e39b | 1372 | fi |
cdcc6a01 | 1373 | |
87741e51 ML |
1374 | # Look for the ZSTD package. |
1375 | ZSTD_INCLUDE= | |
1376 | ZSTD_LIB= | |
1377 | AC_SUBST(ZSTD_INCLUDE) | |
1378 | AC_SUBST(ZSTD_LIB) | |
1379 | ZSTD_CPPFLAGS= | |
1380 | ZSTD_LDFLAGS= | |
77625675 MK |
1381 | AC_SUBST(ZSTD_CPPFLAGS) |
1382 | AC_SUBST(ZSTD_LDFLAGS) | |
87741e51 ML |
1383 | AC_ARG_WITH(zstd, |
1384 | [AS_HELP_STRING([--with-zstd=PATH], | |
1385 | [specify prefix directory for installed zstd library. | |
1386 | Equivalent to --with-zstd-include=PATH/include | |
1387 | plus --with-zstd-lib=PATH/lib])]) | |
1388 | AC_ARG_WITH(zstd-include, | |
1389 | [AS_HELP_STRING([--with-zstd-include=PATH], | |
1390 | [specify directory for installed zstd include files])]) | |
1391 | AC_ARG_WITH(zstd-lib, | |
1392 | [AS_HELP_STRING([--with-zstd-lib=PATH], | |
1393 | [specify directory for the installed zstd library])]) | |
1394 | case "x$with_zstd" in | |
1395 | x) ;; | |
1396 | xno) | |
0fb0240a ML |
1397 | ZSTD_INCLUDE= |
1398 | ZSTD_LIB= | |
87741e51 ML |
1399 | ;; |
1400 | *) ZSTD_INCLUDE=$with_zstd/include | |
1401 | ZSTD_LIB=$with_zstd/lib | |
1402 | ;; | |
1403 | esac | |
0fb0240a ML |
1404 | |
1405 | if test "x$with_zstd" != xno; then | |
87741e51 ML |
1406 | if test "x$with_zstd_include" != x; then |
1407 | ZSTD_INCLUDE=$with_zstd_include | |
1408 | fi | |
1409 | if test "x$with_zstd_lib" != x; then | |
1410 | ZSTD_LIB=$with_zstd_lib | |
1411 | fi | |
1412 | if test "x$ZSTD_INCLUDE" != x \ | |
1413 | && test "x$ZSTD_INCLUDE" != xno; then | |
1414 | ZSTD_CPPFLAGS=-I$ZSTD_INCLUDE | |
1415 | fi | |
1416 | if test "x$ZSTD_LIB" != x \ | |
1417 | && test "x$ZSTD_LIB" != xno; then | |
1418 | ZSTD_LDFLAGS=-L$ZSTD_LIB | |
1419 | fi | |
1420 | ||
1421 | CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS" | |
1422 | LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS" | |
1423 | ||
1424 | AC_MSG_CHECKING(for zstd.h) | |
1425 | AC_CACHE_VAL(gcc_cv_header_zstd_h, | |
6649df18 JW |
1426 | # We require version 1.3.0 or later. This is the first version that has |
1427 | # ZSTD_getFrameContentSize. | |
87741e51 | 1428 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
6649df18 JW |
1429 | [[#include <zstd.h> |
1430 | #if ZSTD_VERSION_NUMBER < 10300 | |
1431 | #error "need zstd 1.3.0 or better" | |
1432 | #endif]])], | |
87741e51 ML |
1433 | [gcc_cv_header_zstd_h=yes], |
1434 | [gcc_cv_header_zstd_h=no])]) | |
1435 | AC_MSG_RESULT($gcc_cv_header_zstd_h) | |
1436 | if test $gcc_cv_header_zstd_h = yes; then | |
1437 | AC_DEFINE(HAVE_ZSTD_H, 1, | |
1438 | [Define if you have a working <zstd.h> header file.]) | |
68c4570a | 1439 | elif test "x$with_zstd" != x; then |
0fb0240a | 1440 | as_fn_error $? "Unable to find zstd.h. See config.log for details." "$LINENO" 5 |
87741e51 ML |
1441 | fi |
1442 | ||
1443 | # LTO can use zstd compression algorithm | |
1444 | save_LIBS="$LIBS" | |
1445 | LIBS= | |
1446 | AC_SEARCH_LIBS(ZSTD_compress, zstd) | |
1447 | ZSTD_LIB="$LIBS" | |
1448 | LIBS="$save_LIBS" | |
1449 | AC_SUBST(ZSTD_LIB) | |
0fb0240a | 1450 | fi |
87741e51 | 1451 | |
9612ab65 ZW |
1452 | dnl Disabled until we have a complete test for buggy enum bitfields. |
1453 | dnl gcc_AC_C_ENUM_BF_UNSIGNED | |
c149cc37 | 1454 | |
0d667716 KG |
1455 | define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl |
1456 | ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl | |
1457 | fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl | |
1458 | fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl | |
1459 | putchar_unlocked putc_unlocked) | |
384d8786 | 1460 | AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \ |
b6d94045 | 1461 | popen sysconf strsignal getrusage nl_langinfo \ |
e1f07131 NS |
1462 | gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \ |
1463 | gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat) | |
a81fb89e | 1464 | |
39f6c4c8 KW |
1465 | if test x$ac_cv_func_mbstowcs = xyes; then |
1466 | AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works, | |
f04f1d2c | 1467 | [ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h> |
39f6c4c8 KW |
1468 | int main() |
1469 | { | |
1470 | mbstowcs(0, "", 0); | |
1471 | return 0; | |
f04f1d2c KC |
1472 | }]])], |
1473 | [gcc_cv_func_mbstowcs_works=yes], | |
1474 | [gcc_cv_func_mbstowcs_works=no], | |
1475 | [gcc_cv_func_mbstowcs_works=yes])]) | |
39f6c4c8 KW |
1476 | if test x$gcc_cv_func_mbstowcs_works = xyes; then |
1477 | AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1, | |
1478 | [Define this macro if mbstowcs does not crash when its | |
1479 | first argument is NULL.]) | |
1480 | fi | |
1481 | fi | |
1482 | ||
78c9cb99 | 1483 | AC_CHECK_TYPE(ssize_t, int) |
bba09b5a | 1484 | AC_CHECK_TYPE(caddr_t, char *) |
e1f07131 NS |
1485 | AC_CHECK_TYPE(sighander_t, |
1486 | AC_DEFINE(HAVE_SIGHANDLER_T, 1, | |
1487 | [Define if <sys/signal.h> defines sighandler_t]), | |
1488 | ,signal.h) | |
56f48ce9 | 1489 | |
2f6935f4 | 1490 | GCC_AC_FUNC_MMAP_BLACKLIST |
b27d2bd5 MK |
1491 | |
1492 | case "${host}" in | |
ee262b6f | 1493 | *-*-*vms*) |
2c55543b | 1494 | # Under VMS, vfork works very differently than on Unix. The standard test |
ee262b6f DR |
1495 | # won't work, and it isn't easily adaptable. It makes more sense to |
1496 | # just force it. | |
1497 | ac_cv_func_vfork_works=yes | |
1498 | ;; | |
b27d2bd5 | 1499 | esac |
f04f1d2c | 1500 | AC_FUNC_FORK |
f1b54f9b | 1501 | |
0823efed | 1502 | AM_ICONV |
5b6d595b | 1503 | |
56694dd9 ZW |
1504 | # Until we have in-tree GNU iconv: |
1505 | LIBICONV_DEP= | |
bf5372e7 YS |
1506 | if test -f "$LTLIBICONV"; then |
1507 | LIBICONV_DEP=$LTLIBICONV | |
1508 | fi | |
56694dd9 ZW |
1509 | AC_SUBST(LIBICONV_DEP) |
1510 | ||
1511 | AM_LC_MESSAGES | |
f91abfce | 1512 | |
a03ea89b BM |
1513 | AM_LANGINFO_CODESET |
1514 | ||
86cf1cbd KG |
1515 | # We will need to find libiberty.h and ansidecl.h |
1516 | saved_CFLAGS="$CFLAGS" | |
b8f6a302 | 1517 | CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC" |
87fb500b | 1518 | saved_CXXFLAGS="$CXXFLAGS" |
b8f6a302 | 1519 | CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC" |
13ccfea8 JM |
1520 | |
1521 | # gcc_AC_CHECK_DECLS doesn't support overloaded functions, so use the | |
1522 | # normal autoconf function for these. But force definition of | |
1523 | # HAVE_DECL_BASENAME like gcc_AC_CHECK_DECLS does, to suppress the bizarre | |
1524 | # basename handling in libiberty.h. | |
1525 | AC_CHECK_DECLS([basename(const char*), strstr(const char*,const char*)], , ,[ | |
1526 | #undef HAVE_DECL_BASENAME | |
1527 | #define HAVE_DECL_BASENAME 1 | |
1528 | #include "ansidecl.h" | |
1529 | #include "system.h"]) | |
1530 | ||
384d8786 | 1531 | gcc_AC_CHECK_DECLS(getenv atol atoll asprintf sbrk abort atof getcwd getwd \ |
13ccfea8 | 1532 | madvise stpcpy strnlen strsignal strverscmp \ |
297c364d | 1533 | strtol strtoul strtoll strtoull setenv unsetenv \ |
ed5b9f96 | 1534 | errno snprintf vsnprintf vasprintf malloc realloc calloc \ |
13ccfea8 | 1535 | free getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[ |
d02af173 | 1536 | #include "ansidecl.h" |
86cf1cbd | 1537 | #include "system.h"]) |
c5c76735 | 1538 | |
f31e826b | 1539 | gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[ |
d02af173 | 1540 | #include "ansidecl.h" |
86cf1cbd | 1541 | #include "system.h" |
d2cabf16 KG |
1542 | #ifdef HAVE_SYS_RESOURCE_H |
1543 | #include <sys/resource.h> | |
1544 | #endif | |
1545 | ]) | |
1546 | ||
5187b01a | 1547 | gcc_AC_CHECK_DECLS(mallinfo mallinfo2, , ,[ |
c9ef0409 JH |
1548 | #include "ansidecl.h" |
1549 | #include "system.h" | |
1550 | #ifdef HAVE_MALLOC_H | |
1551 | #include <malloc.h> | |
1552 | #endif | |
1553 | ]) | |
1554 | ||
f04f1d2c | 1555 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
b2522d2b HPN |
1556 | #include "ansidecl.h" |
1557 | #include "system.h" | |
1558 | #ifdef HAVE_SYS_RESOURCE_H | |
1559 | #include <sys/resource.h> | |
1560 | #endif | |
f04f1d2c | 1561 | ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long], |
236ec2d7 | 1562 | [Define to `long' if <sys/resource.h> doesn't define.])]) |
b2522d2b | 1563 | |
2102b2fe RS |
1564 | # On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible |
1565 | # FREAD and FWRITE macros. Fortunately, for GCC's single usage of ldgetname | |
1566 | # in collect2.c, <fcntl.h> isn't visible, but the configure test below needs | |
1567 | # to undef these macros to get the correct value for HAVE_DECL_LDGETNAME. | |
351df804 KG |
1568 | gcc_AC_CHECK_DECLS(ldgetname, , ,[ |
1569 | #include "ansidecl.h" | |
1570 | #include "system.h" | |
1571 | #ifdef HAVE_LDFCN_H | |
2102b2fe RS |
1572 | #undef FREAD |
1573 | #undef FWRITE | |
351df804 KG |
1574 | #include <ldfcn.h> |
1575 | #endif | |
1576 | ]) | |
1577 | ||
c1800ec8 ZW |
1578 | gcc_AC_CHECK_DECLS(times, , ,[ |
1579 | #include "ansidecl.h" | |
1580 | #include "system.h" | |
1581 | #ifdef HAVE_SYS_TIMES_H | |
1582 | #include <sys/times.h> | |
1583 | #endif | |
1584 | ]) | |
1585 | ||
4f6d8cc8 GK |
1586 | gcc_AC_CHECK_DECLS(sigaltstack, , ,[ |
1587 | #include "ansidecl.h" | |
1588 | #include "system.h" | |
1589 | #include <signal.h> | |
1590 | ]) | |
1591 | ||
c1800ec8 ZW |
1592 | # More time-related stuff. |
1593 | AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [ | |
f04f1d2c | 1594 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
c1800ec8 ZW |
1595 | #include "ansidecl.h" |
1596 | #include "system.h" | |
1597 | #ifdef HAVE_SYS_TIMES_H | |
1598 | #include <sys/times.h> | |
1599 | #endif | |
f04f1d2c | 1600 | ]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])]) |
c1800ec8 ZW |
1601 | if test $ac_cv_struct_tms = yes; then |
1602 | AC_DEFINE(HAVE_STRUCT_TMS, 1, | |
1603 | [Define if <sys/times.h> defines struct tms.]) | |
1604 | fi | |
1605 | ||
1606 | # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. | |
1607 | # revisit after autoconf 2.50. | |
1608 | AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [ | |
f04f1d2c | 1609 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
c1800ec8 ZW |
1610 | #include "ansidecl.h" |
1611 | #include "system.h" | |
f04f1d2c | 1612 | ]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])]) |
c1800ec8 ZW |
1613 | if test $gcc_cv_type_clock_t = yes; then |
1614 | AC_DEFINE(HAVE_CLOCK_T, 1, | |
1615 | [Define if <time.h> defines clock_t.]) | |
1616 | fi | |
1617 | ||
c1736aea TJ |
1618 | # Check if F_SETLKW is supported by fcntl. |
1619 | AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [ | |
1620 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1621 | #include <fcntl.h>]], [[ | |
1622 | struct flock fl; | |
1623 | fl.l_whence = 0; | |
1624 | fl.l_start = 0; | |
1625 | fl.l_len = 0; | |
1626 | fl.l_pid = 0; | |
1627 | return fcntl (1, F_SETLKW, &fl);]])], | |
1628 | [ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])]) | |
1629 | if test $ac_cv_f_setlkw = yes; then | |
1630 | AC_DEFINE(HOST_HAS_F_SETLKW, 1, | |
1631 | [Define if F_SETLKW supported by fcntl.]) | |
1632 | fi | |
1633 | ||
e1f07131 NS |
1634 | # Check if O_CLOEXEC is defined by fcntl |
1635 | AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [ | |
1636 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1637 | #include <fcntl.h>]], [[ | |
1638 | return open ("/dev/null", O_RDONLY | O_CLOEXEC);]])], | |
1639 | [ac_cv_o_cloexec=yes],[ac_cv_o_cloexec=no])]) | |
1640 | if test $ac_cv_o_cloexec = yes; then | |
1641 | AC_DEFINE(HOST_HAS_O_CLOEXEC, 1, | |
1642 | [Define if O_CLOEXEC supported by fcntl.]) | |
1643 | fi | |
1644 | ||
1645 | # C++ Modules would like some networking features to provide the mapping | |
1646 | # server. You can still use modules without them though. | |
1647 | # The following network-related checks could probably do with some | |
1648 | # Windows and other non-linux defenses and checking. | |
1649 | ||
1650 | # Local socket connectivity wants AF_UNIX networking | |
1651 | # Check for AF_UNIX networking | |
1652 | AC_CACHE_CHECK(for AF_UNIX, ac_cv_af_unix, [ | |
1653 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1654 | #include <sys/types.h> | |
1655 | #include <sys/socket.h> | |
1656 | #include <sys/un.h> | |
1657 | #include <netinet/in.h>]],[[ | |
1658 | sockaddr_un un; | |
1659 | un.sun_family = AF_UNSPEC; | |
1660 | int fd = socket (AF_UNIX, SOCK_STREAM, 0); | |
1661 | connect (fd, (sockaddr *)&un, sizeof (un));]])], | |
1662 | [ac_cv_af_unix=yes], | |
1663 | [ac_cv_af_unix=no])]) | |
1664 | if test $ac_cv_af_unix = yes; then | |
1665 | AC_DEFINE(HAVE_AF_UNIX, 1, | |
1666 | [Define if AF_UNIX supported.]) | |
1667 | fi | |
1668 | ||
1669 | # Remote socket connectivity wants AF_INET6 networking | |
1670 | # Check for AF_INET6 networking | |
1671 | AC_CACHE_CHECK(for AF_INET6, ac_cv_af_inet6, [ | |
1672 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1673 | #include <sys/types.h> | |
1674 | #include <sys/socket.h> | |
1675 | #include <netinet/in.h> | |
1676 | #include <netdb.h>]],[[ | |
1677 | sockaddr_in6 in6; | |
1678 | in6.sin6_family = AF_UNSPEC; | |
1679 | struct addrinfo *addrs = 0; | |
1680 | struct addrinfo hints; | |
1681 | hints.ai_flags = 0; | |
1682 | hints.ai_family = AF_INET6; | |
1683 | hints.ai_socktype = SOCK_STREAM; | |
1684 | hints.ai_protocol = 0; | |
1685 | hints.ai_canonname = 0; | |
1686 | hints.ai_addr = 0; | |
1687 | hints.ai_next = 0; | |
1688 | int e = getaddrinfo ("localhost", 0, &hints, &addrs); | |
1689 | const char *str = gai_strerror (e); | |
1690 | freeaddrinfo (addrs); | |
1691 | int fd = socket (AF_INET6, SOCK_STREAM, 0); | |
1692 | connect (fd, (sockaddr *)&in6, sizeof (in6));]])], | |
1693 | [ac_cv_af_inet6=yes], | |
1694 | [ac_cv_af_inet6=no])]) | |
1695 | if test $ac_cv_af_inet6 = yes; then | |
1696 | AC_DEFINE(HAVE_AF_INET6, 1, | |
1697 | [Define if AF_INET6 supported.]) | |
1698 | fi | |
1699 | ||
87fb500b | 1700 | # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. |
86cf1cbd | 1701 | CFLAGS="$saved_CFLAGS" |
87fb500b | 1702 | CXXFLAGS="$saved_CXXFLAGS" |
86cf1cbd | 1703 | |
75923b2f | 1704 | # mkdir takes a single argument on some systems. |
99e757d5 | 1705 | gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG |
75923b2f | 1706 | |
46f18e7b RK |
1707 | # File extensions |
1708 | manext='.1' | |
1709 | objext='.o' | |
46f18e7b RK |
1710 | AC_SUBST(manext) |
1711 | AC_SUBST(objext) | |
46f18e7b | 1712 | |
4977bab6 ZW |
1713 | # With Setjmp/Longjmp based exception handling. |
1714 | AC_ARG_ENABLE(sjlj-exceptions, | |
b88ecf55 AS |
1715 | [AS_HELP_STRING([--enable-sjlj-exceptions], |
1716 | [arrange to use setjmp/longjmp exception handling])], | |
399fe3e1 JDA |
1717 | [case $target in |
1718 | *-*-hpux10*) | |
1719 | if test $enableval != yes; then | |
1720 | AC_MSG_WARN([dwarf2 exceptions not supported, sjlj exceptions forced]) | |
1721 | enableval=yes | |
1722 | fi | |
1723 | ;; | |
1724 | esac | |
1725 | force_sjlj_exceptions=yes], | |
1726 | [case $target in | |
1727 | *-*-hpux10*) | |
1728 | force_sjlj_exceptions=yes | |
1729 | enableval=yes | |
1730 | ;; | |
9b0af790 JB |
1731 | lm32*-*-*) |
1732 | force_sjlj_exceptions=yes | |
1733 | enableval=yes | |
1734 | ;; | |
399fe3e1 JDA |
1735 | *) |
1736 | force_sjlj_exceptions=no | |
1737 | ;; | |
1738 | esac]) | |
1739 | if test $force_sjlj_exceptions = yes; then | |
1740 | sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` | |
1741 | AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj, | |
1742 | [Define 0/1 to force the choice for exception handling model.]) | |
1743 | fi | |
4977bab6 | 1744 | |
34a86c2b NN |
1745 | # -------------------------------------------------------- |
1746 | # Build, host, and target specific configuration fragments | |
1747 | # -------------------------------------------------------- | |
1748 | ||
5b28c537 | 1749 | # Collect build-machine-specific information. |
2c811fd3 | 1750 | . ${srcdir}/config.build || exit 1 |
5b28c537 | 1751 | |
a89ea0df | 1752 | # Collect host-machine-specific information. |
2c811fd3 | 1753 | . ${srcdir}/config.host || exit 1 |
a89ea0df | 1754 | |
ef69da62 | 1755 | target_gtfiles= |
a89ea0df NN |
1756 | |
1757 | # Collect target-machine-specific information. | |
2c811fd3 | 1758 | . ${srcdir}/config.gcc || exit 1 |
46f18e7b RK |
1759 | |
1760 | extra_objs="${host_extra_objs} ${extra_objs}" | |
30500d84 | 1761 | extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}" |
46f18e7b RK |
1762 | |
1763 | # Default the target-machine variables that were not explicitly set. | |
75bffa71 | 1764 | if test x"$tm_file" = x |
46f18e7b RK |
1765 | then tm_file=$cpu_type/$cpu_type.h; fi |
1766 | ||
6b2adea9 | 1767 | if test x"$extra_headers" = x |
46f18e7b RK |
1768 | then extra_headers=; fi |
1769 | ||
75bffa71 | 1770 | if test x$md_file = x |
e98e406f | 1771 | then md_file=$cpu_type/$cpu_type.md; fi |
46f18e7b | 1772 | |
75bffa71 | 1773 | if test x$out_file = x |
46f18e7b RK |
1774 | then out_file=$cpu_type/$cpu_type.c; fi |
1775 | ||
75bffa71 | 1776 | if test x"$tmake_file" = x |
46f18e7b RK |
1777 | then tmake_file=$cpu_type/t-$cpu_type |
1778 | fi | |
1779 | ||
e9c9f128 JJ |
1780 | # Support --enable-initfini-array. |
1781 | if test x$enable_initfini_array != xno; then | |
1782 | tm_file="${tm_file} initfini-array.h" | |
1783 | fi | |
1784 | ||
90e6a802 | 1785 | if test x"$dwarf2" = xyes |
756ee602 | 1786 | then tm_file="$tm_file tm-dwarf2.h" |
90e6a802 RL |
1787 | fi |
1788 | ||
46f18e7b | 1789 | # Say what files are being used for the output code and MD file. |
11642c3a | 1790 | echo "Using \`$srcdir/config/$out_file' for machine-specific logic." |
46f18e7b RK |
1791 | echo "Using \`$srcdir/config/$md_file' as machine description file." |
1792 | ||
11642c3a | 1793 | # If any of the xm_file variables contain nonexistent files, warn |
4dc0535b ZW |
1794 | # about them and drop them. |
1795 | ||
11642c3a ZW |
1796 | bx= |
1797 | for x in $build_xm_file; do | |
1798 | if test -f $srcdir/config/$x | |
1799 | then bx="$bx $x" | |
11642c3a ZW |
1800 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1801 | fi | |
1802 | done | |
1803 | build_xm_file="$bx" | |
1804 | ||
1805 | hx= | |
1806 | for x in $host_xm_file; do | |
1807 | if test -f $srcdir/config/$x | |
1808 | then hx="$hx $x" | |
11642c3a ZW |
1809 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1810 | fi | |
1811 | done | |
1812 | host_xm_file="$hx" | |
1813 | ||
1814 | tx= | |
1815 | for x in $xm_file; do | |
1816 | if test -f $srcdir/config/$x | |
1817 | then tx="$tx $x" | |
11642c3a ZW |
1818 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1819 | fi | |
1820 | done | |
1821 | xm_file="$tx" | |
1822 | ||
46f18e7b RK |
1823 | count=a |
1824 | for f in $tm_file; do | |
1825 | count=${count}x | |
1826 | done | |
75bffa71 | 1827 | if test $count = ax; then |
46f18e7b RK |
1828 | echo "Using \`$srcdir/config/$tm_file' as target machine macro file." |
1829 | else | |
1830 | echo "Using the following target machine macro files:" | |
1831 | for f in $tm_file; do | |
1832 | echo " $srcdir/config/$f" | |
1833 | done | |
1834 | fi | |
1835 | ||
99fa8911 AP |
1836 | if test x$use_long_long_for_widest_fast_int = xyes; then |
1837 | AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1, | |
edf6ddf6 | 1838 | [Define to 1 if the 'long long' type is wider than 'long' but still |
99fa8911 AP |
1839 | efficiently supported by the host hardware.]) |
1840 | fi | |
1841 | ||
b993039f EB |
1842 | gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi` |
1843 | AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.]) | |
1844 | ||
1845 | gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi` | |
1846 | AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.]) | |
1847 | ||
46f18e7b RK |
1848 | count=a |
1849 | for f in $host_xm_file; do | |
1850 | count=${count}x | |
1851 | done | |
11642c3a ZW |
1852 | if test $count = a; then |
1853 | : | |
1854 | elif test $count = ax; then | |
46f18e7b RK |
1855 | echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file." |
1856 | else | |
1857 | echo "Using the following host machine macro files:" | |
1858 | for f in $host_xm_file; do | |
1859 | echo " $srcdir/config/$f" | |
1860 | done | |
1861 | fi | |
476d9098 | 1862 | echo "Using ${out_host_hook_obj} for host machine hooks." |
46f18e7b | 1863 | |
75bffa71 | 1864 | if test "$host_xm_file" != "$build_xm_file"; then |
46f18e7b RK |
1865 | count=a |
1866 | for f in $build_xm_file; do | |
1867 | count=${count}x | |
1868 | done | |
11642c3a ZW |
1869 | if test $count = a; then |
1870 | : | |
1871 | elif test $count = ax; then | |
46f18e7b RK |
1872 | echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file." |
1873 | else | |
1874 | echo "Using the following build machine macro files:" | |
1875 | for f in $build_xm_file; do | |
1876 | echo " $srcdir/config/$f" | |
1877 | done | |
1878 | fi | |
1879 | fi | |
1880 | ||
08b2bad2 SB |
1881 | if test -n "$configured_native_system_header_dir"; then |
1882 | native_system_header_dir=$configured_native_system_header_dir | |
1883 | fi | |
1884 | NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir" | |
1885 | AC_SUBST(NATIVE_SYSTEM_HEADER_DIR) | |
1886 | ||
4f6d8cc8 | 1887 | case ${host} in |
b8ec3cc8 | 1888 | powerpc*-*-darwin*) |
4f6d8cc8 GK |
1889 | AC_CACHE_CHECK([whether mcontext_t fields have underscores], |
1890 | gcc_cv_mcontext_underscores, | |
22e05272 | 1891 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
ba7da42a | 1892 | #include <sys/cdefs.h> |
de4fb767 | 1893 | #include <sys/signal.h> |
4f6d8cc8 GK |
1894 | #include <ucontext.h> |
1895 | int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; } | |
22e05272 | 1896 | ])], |
4f6d8cc8 GK |
1897 | gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes)) |
1898 | if test $gcc_cv_mcontext_underscores = yes; then | |
1899 | AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl | |
1900 | [mcontext_t fields start with __]) | |
1901 | fi | |
1902 | ;; | |
1903 | esac | |
1904 | ||
8bb915b6 NN |
1905 | # --------- |
1906 | # Threading | |
1907 | # --------- | |
1908 | ||
c2e494a8 | 1909 | # Check if a valid thread package |
615be2cf | 1910 | case ${enable_threads} in |
c2e494a8 NN |
1911 | "" | no) |
1912 | # No threads | |
1913 | target_thread_file='single' | |
1914 | ;; | |
1915 | yes) | |
1916 | # default | |
1917 | target_thread_file='single' | |
1918 | ;; | |
ddaad3c8 | 1919 | aix | dce | lynx | mipssde | posix | rtems | \ |
da90c957 | 1920 | single | tpf | vxworks | win32) |
615be2cf | 1921 | target_thread_file=${enable_threads} |
c2e494a8 NN |
1922 | ;; |
1923 | *) | |
615be2cf | 1924 | echo "${enable_threads} is an unknown thread package" 1>&2 |
c2e494a8 NN |
1925 | exit 1 |
1926 | ;; | |
1927 | esac | |
1928 | ||
1929 | if test x${thread_file} = x; then | |
1930 | # No thread file set by target-specific clauses in config.gcc, | |
1931 | # so use file chosen by default logic above | |
1932 | thread_file=${target_thread_file} | |
46f18e7b | 1933 | fi |
46f18e7b | 1934 | |
8bb915b6 NN |
1935 | # -------- |
1936 | # UNSORTED | |
1937 | # -------- | |
1938 | ||
18fbf599 | 1939 | use_cxa_atexit=no |
2121a768 JT |
1940 | if test x$enable___cxa_atexit = xyes || \ |
1941 | test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then | |
18fbf599 | 1942 | if test x$host = x$target; then |
97388150 DS |
1943 | case $host in |
1944 | # mingw32 doesn't have __cxa_atexit but uses atexit registration | |
1945 | # keyed to flag_use_cxa_atexit | |
1946 | *-*-mingw32*) | |
1947 | use_cxa_atexit=yes | |
1948 | ;; | |
99113dff DE |
1949 | powerpc-ibm-aix*) |
1950 | use_cxa_atexit=yes | |
1951 | ;; | |
97388150 DS |
1952 | *) |
1953 | AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes], | |
1954 | [echo "__cxa_atexit can't be enabled on this target"]) | |
5f60e48f | 1955 | ;; |
97388150 | 1956 | esac |
18fbf599 PB |
1957 | else |
1958 | # We can't check for __cxa_atexit when building a cross, so assume | |
1959 | # it is available | |
1960 | use_cxa_atexit=yes | |
1961 | fi | |
1962 | if test x$use_cxa_atexit = xyes; then | |
c7b5e395 | 1963 | AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2, |
18fbf599 PB |
1964 | [Define if you want to use __cxa_atexit, rather than atexit, to |
1965 | register C++ destructors for local statics and global objects. | |
1966 | This is essential for fully standards-compliant handling of | |
1967 | destructors, but requires __cxa_atexit in libc.]) | |
1968 | fi | |
2121a768 JT |
1969 | fi |
1970 | ||
a5381466 | 1971 | # Look for a file containing extra machine modes. |
1c0ca89d ZW |
1972 | if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then |
1973 | extra_modes_file='$(srcdir)'/config/${extra_modes} | |
a5381466 | 1974 | AC_SUBST(extra_modes_file) |
e22340b0 | 1975 | AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes", |
a5381466 ZW |
1976 | [Define to the name of a file containing a list of extra machine modes |
1977 | for this architecture.]) | |
a5381466 ZW |
1978 | fi |
1979 | ||
75685792 RS |
1980 | # Convert extra_options into a form suitable for Makefile use. |
1981 | extra_opt_files= | |
fd438373 | 1982 | all_opt_files= |
75685792 RS |
1983 | for f in $extra_options; do |
1984 | extra_opt_files="$extra_opt_files \$(srcdir)/config/$f" | |
fd438373 | 1985 | all_opt_files="$all_opt_files $srcdir/config/$f" |
75685792 RS |
1986 | done |
1987 | AC_SUBST(extra_opt_files) | |
1988 | ||
b7cb92ad | 1989 | # auto-host.h is the file containing items generated by autoconf and is |
e9a25f70 | 1990 | # the first file included by config.h. |
4977bab6 | 1991 | # If host=build, it is correct to have bconfig include auto-host.h |
db81d74a RH |
1992 | # as well. If host!=build, we are in error and need to do more |
1993 | # work to find out the build config parameters. | |
75bffa71 | 1994 | if test x$host = x$build |
db81d74a | 1995 | then |
eaf4e618 | 1996 | build_auto=auto-host.h |
499d66aa | 1997 | HAVE_AUTO_BUILD='# ' |
b7cb92ad JL |
1998 | else |
1999 | # We create a subdir, then run autoconf in the subdir. | |
2000 | # To prevent recursion we set host and build for the new | |
2001 | # invocation of configure to the build for this invocation | |
2002 | # of configure. | |
2003 | tempdir=build.$$ | |
2004 | rm -rf $tempdir | |
2005 | mkdir $tempdir | |
2006 | cd $tempdir | |
2007 | case ${srcdir} in | |
b86ecfa9 | 2008 | /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; |
b7cb92ad JL |
2009 | *) realsrcdir=../${srcdir};; |
2010 | esac | |
2ceb362d AM |
2011 | # Clearing GMPINC is necessary to prevent host headers being |
2012 | # used by the build compiler. Defining GENERATOR_FILE stops | |
2013 | # system.h from including gmp.h. | |
d920e825 | 2014 | CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ |
2ceb362d AM |
2015 | CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ |
2016 | LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ | |
2017 | GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ | |
d920e825 | 2018 | ${realsrcdir}/configure \ |
33e70558 | 2019 | --enable-languages=${enable_languages-all} \ |
499d66aa AO |
2020 | ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \ |
2021 | ${enable_option_checking+--enable-option-checking="$enable_option_checking"} \ | |
2022 | --target=$target_alias --host=$build_alias \ | |
2023 | --build=$build_alias || exit # retaining $tempdir | |
b7cb92ad JL |
2024 | |
2025 | # We just finished tests for the build machine, so rename | |
2026 | # the file auto-build.h in the gcc directory. | |
2027 | mv auto-host.h ../auto-build.h | |
2028 | cd .. | |
2029 | rm -rf $tempdir | |
eaf4e618 | 2030 | build_auto=auto-build.h |
499d66aa | 2031 | HAVE_AUTO_BUILD= |
db81d74a | 2032 | fi |
71b5d516 | 2033 | AC_SUBST(build_subdir) |
499d66aa | 2034 | AC_SUBST(HAVE_AUTO_BUILD) |
db81d74a | 2035 | |
eaf4e618 | 2036 | tm_file="${tm_file} defaults.h" |
4977bab6 | 2037 | tm_p_file="${tm_p_file} tm-preds.h" |
b4c522fa | 2038 | tm_d_file="${tm_d_file} defaults.h" |
4977bab6 ZW |
2039 | host_xm_file="auto-host.h ansidecl.h ${host_xm_file}" |
2040 | build_xm_file="${build_auto} ansidecl.h ${build_xm_file}" | |
49691411 | 2041 | # We don't want ansidecl.h in target files, write code there in ISO/GNU C. |
b4862477 | 2042 | # put this back in temporarily. |
232b67d9 | 2043 | xm_file="auto-host.h ansidecl.h ${xm_file}" |
0056a9b5 | 2044 | |
34a86c2b NN |
2045 | # -------- |
2046 | # UNSORTED | |
2047 | # -------- | |
2048 | ||
afabd8e6 | 2049 | changequote(,)dnl |
cc1e60ea | 2050 | # Compile in configure arguments. |
8105825d | 2051 | if test -f configargs.h ; then |
cc1e60ea | 2052 | # Being re-configured. |
022dae81 | 2053 | gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'` |
54de7d7d JJ |
2054 | gcc_reconf_arguments=`echo "$gcc_config_arguments" | sed -e 's/^.*\( : (reconfigured) .*$\)/\1/'` |
2055 | if [ "$gcc_reconf_arguments" != " : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" ]; then | |
2056 | gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" | |
2057 | fi | |
cc1e60ea JM |
2058 | else |
2059 | gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" | |
2060 | fi | |
eeae7b41 DJ |
2061 | |
2062 | # Double all backslashes and backslash all quotes to turn | |
2063 | # gcc_config_arguments into a C string. | |
2064 | sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out | |
2065 | $gcc_config_arguments | |
2066 | EOF | |
2067 | gcc_config_arguments_str=`cat conftest.out` | |
2068 | rm -f conftest.out | |
2069 | ||
cc1e60ea JM |
2070 | cat > configargs.h <<EOF |
2071 | /* Generated automatically. */ | |
eeae7b41 | 2072 | static const char configuration_arguments[] = "$gcc_config_arguments_str"; |
a6687d2b | 2073 | static const char thread_model[] = "$thread_file"; |
7816bea0 DJ |
2074 | |
2075 | static const struct { | |
2076 | const char *name, *value; | |
2077 | } configure_default_options[] = $configure_default_options; | |
cc1e60ea | 2078 | EOF |
75bffa71 | 2079 | changequote([,])dnl |
46f18e7b | 2080 | |
0c463e16 | 2081 | changequote(,)dnl |
40540e68 RAE |
2082 | gcc_BASEVER=`cat $srcdir/BASE-VER` |
2083 | gcc_DEVPHASE=`cat $srcdir/DEV-PHASE` | |
2084 | gcc_DATESTAMP=`cat $srcdir/DATESTAMP` | |
0c463e16 | 2085 | if test -f $srcdir/REVISION ; then |
40540e68 | 2086 | gcc_REVISION=`cat $srcdir/REVISION` |
0c463e16 RAE |
2087 | else |
2088 | gcc_REVISION="" | |
2089 | fi | |
2090 | cat > plugin-version.h <<EOF | |
2091 | #include "configargs.h" | |
2092 | ||
bf588455 BS |
2093 | #define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'` |
2094 | #define GCCPLUGIN_VERSION_MINOR `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'` | |
2095 | #define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'` | |
2096 | #define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR) | |
2097 | ||
0c463e16 RAE |
2098 | static char basever[] = "$gcc_BASEVER"; |
2099 | static char datestamp[] = "$gcc_DATESTAMP"; | |
2100 | static char devphase[] = "$gcc_DEVPHASE"; | |
2101 | static char revision[] = "$gcc_REVISION"; | |
2102 | ||
2103 | /* FIXME plugins: We should make the version information more precise. | |
2104 | One way to do is to add a checksum. */ | |
2105 | ||
2106 | static struct plugin_gcc_version gcc_version = {basever, datestamp, | |
2107 | devphase, revision, | |
2108 | configuration_arguments}; | |
2109 | EOF | |
2110 | changequote([,])dnl | |
2111 | ||
3c36aa6b JJ |
2112 | # Determine what GCC version number to use in filesystem paths. |
2113 | GCC_BASE_VER | |
2114 | ||
ab87f8c8 | 2115 | # Internationalization |
56694dd9 | 2116 | ZW_GNU_GETTEXT_SISTER_DIR |
dc6746e7 | 2117 | |
56694dd9 ZW |
2118 | # If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get |
2119 | # -liconv on the link line twice. | |
2120 | case "$LIBINTL" in *$LIBICONV*) | |
2121 | LIBICONV= ;; | |
2122 | esac | |
ab87f8c8 | 2123 | |
7f970b70 | 2124 | AC_ARG_ENABLE(secureplt, |
b88ecf55 AS |
2125 | [AS_HELP_STRING([--enable-secureplt], |
2126 | [enable -msecure-plt by default for PowerPC])], | |
7f970b70 AM |
2127 | [], []) |
2128 | ||
446163e2 TP |
2129 | AC_ARG_ENABLE(mingw-wildcard, |
2130 | [AS_HELP_STRING([--enable-mingw-wildcard], | |
2131 | [Set whether to expand wildcard on command-line. | |
2132 | Default to platform configuration])], | |
2133 | [],[enable_mingw_wildcard=platform]) | |
2134 | AS_IF([test x"$enable_mingw_wildcard" != xplatform ], | |
2135 | [AC_DEFINE_UNQUOTED(MINGW_DOWILDCARD, | |
2136 | $(test x"$enable_mingw_wildcard" = xno; echo $?), | |
2137 | [Value to set mingw's _dowildcard to.])]) | |
2138 | ||
67aeaded AO |
2139 | AC_ARG_ENABLE(large-address-aware, |
2140 | [AS_HELP_STRING([--enable-large-address-aware], | |
2141 | [Link mingw executables with --large-address-aware])]) | |
2142 | AS_IF([test x"$enable_large_address_aware" = xyes], | |
2143 | [AC_DEFINE([MINGW_DEFAULT_LARGE_ADDR_AWARE], 1, | |
2144 | [Define if we should link mingw executables with --large-address-aware])]) | |
2145 | ||
ad211091 KT |
2146 | AC_ARG_ENABLE(leading-mingw64-underscores, |
2147 | AS_HELP_STRING([--enable-leading-mingw64-underscores], | |
b88ecf55 | 2148 | [enable leading underscores on 64 bit mingw targets]), |
ad211091 KT |
2149 | [],[]) |
2150 | AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ], | |
2151 | [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1, | |
2152 | [Define if we should use leading underscore on 64 bit mingw targets])]) | |
2153 | ||
922e3e33 | 2154 | AC_ARG_ENABLE(cld, |
b88ecf55 | 2155 | [AS_HELP_STRING([--enable-cld], [enable -mcld by default for 32bit x86])], [], |
922e3e33 UB |
2156 | [enable_cld=no]) |
2157 | ||
d79389af | 2158 | AC_ARG_ENABLE(frame-pointer, |
b88ecf55 | 2159 | [AS_HELP_STRING([--enable-frame-pointer], |
fd661a34 | 2160 | [enable -fno-omit-frame-pointer by default for x86])], [], |
d79389af L |
2161 | [ |
2162 | case $target_os in | |
6221eb9d | 2163 | linux* | gnu* | darwin[[8912]]* | cygwin* | mingw*) |
7d48b7ad | 2164 | # Enable -fomit-frame-pointer by default for these systems with DWARF2. |
d79389af L |
2165 | enable_frame_pointer=no |
2166 | ;; | |
2167 | *) | |
2168 | enable_frame_pointer=yes | |
2169 | ;; | |
2170 | esac | |
2171 | ]) | |
2172 | ||
fd661a34 UB |
2173 | case $target in |
2174 | i[[34567]]86-*-* | x86_64-*-*) | |
2175 | if test "x$enable_cld" = xyes; then | |
2176 | tm_defines="${tm_defines} USE_IX86_CLD=1" | |
2177 | fi | |
2178 | if test "x$enable_frame_pointer" = xyes; then | |
2179 | tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1" | |
2180 | fi | |
2181 | ;; | |
2182 | esac | |
2183 | ||
f4ab28e3 MK |
2184 | # Windows32 Registry support for specifying GCC installation paths. |
2185 | AC_ARG_ENABLE(win32-registry, | |
b88ecf55 AS |
2186 | [AS_HELP_STRING([--disable-win32-registry], |
2187 | [disable lookup of installation paths in the | |
2188 | Registry on Windows hosts]) | |
2189 | AS_HELP_STRING([--enable-win32-registry], [enable registry lookup (default)]) | |
2190 | AS_HELP_STRING([--enable-win32-registry=KEY], | |
2191 | [use KEY instead of GCC version as the last portion | |
2192 | of the registry key])],,) | |
a1286ef5 | 2193 | |
4e70264f | 2194 | case $host_os in |
abe64d9e | 2195 | win32 | pe | cygwin* | mingw32*) |
a1286ef5 ZW |
2196 | if test "x$enable_win32_registry" != xno; then |
2197 | AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no]) | |
2198 | fi | |
f4ab28e3 | 2199 | |
a1286ef5 ZW |
2200 | if test "x$enable_win32_registry" != xno; then |
2201 | AC_DEFINE(ENABLE_WIN32_REGISTRY, 1, | |
2202 | [Define to 1 if installation paths should be looked up in the Windows | |
2203 | Registry. Ignored on non-Windows hosts.]) | |
2204 | ||
2205 | if test "x$enable_win32_registry" != xyes \ | |
2206 | && test "x$enable_win32_registry" != x; then | |
2207 | AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry", | |
2208 | [Define to be the last component of the Windows registry key under which | |
2209 | to look for installation paths. The full key used will be | |
2210 | HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}. | |
2211 | The default is the GCC version number.]) | |
2212 | fi | |
2213 | fi | |
f4ab28e3 MK |
2214 | ;; |
2215 | esac | |
2216 | ||
7fa10b25 | 2217 | # Get an absolute path to the GCC top-level source directory |
1e6347d8 | 2218 | holddir=`${PWDCMD-pwd}` |
7fa10b25 | 2219 | cd $srcdir |
1e6347d8 | 2220 | topdir=`${PWDCMD-pwd}` |
7fa10b25 RK |
2221 | cd $holddir |
2222 | ||
af5e4ada | 2223 | # Conditionalize the makefile for this host machine. |
2ed26f6b | 2224 | xmake_file= |
c406e779 | 2225 | for f in ${host_xmake_file} |
94f42018 | 2226 | do |
75bffa71 | 2227 | if test -f ${srcdir}/config/$f |
94f42018 | 2228 | then |
2ed26f6b | 2229 | xmake_file="${xmake_file} \$(srcdir)/config/$f" |
94f42018 DE |
2230 | fi |
2231 | done | |
46f18e7b | 2232 | |
af5e4ada | 2233 | # Conditionalize the makefile for this target machine. |
2ed26f6b | 2234 | tmake_file_= |
c406e779 | 2235 | for f in ${tmake_file} |
94f42018 | 2236 | do |
75bffa71 | 2237 | if test -f ${srcdir}/config/$f |
94f42018 | 2238 | then |
2ed26f6b | 2239 | tmake_file_="${tmake_file_} \$(srcdir)/config/$f" |
94f42018 DE |
2240 | fi |
2241 | done | |
d228ee80 | 2242 | tmake_file="${tmake_file_}${omp_device_property_tmake_file}" |
5891b37d | 2243 | |
af5e4ada | 2244 | out_object_file=`basename $out_file .c`.o |
c49a6962 | 2245 | common_out_object_file=`basename $common_out_file .c`.o |
5891b37d | 2246 | |
75685792 | 2247 | tm_file_list="options.h" |
f938f60c | 2248 | tm_include_list="options.h insn-constants.h" |
af5e4ada | 2249 | for f in $tm_file; do |
64ccbc99 | 2250 | case $f in |
3ca43df7 RS |
2251 | ./* ) |
2252 | f=`echo $f | sed 's/^..//'` | |
2253 | tm_file_list="${tm_file_list} $f" | |
2254 | tm_include_list="${tm_include_list} $f" | |
2255 | ;; | |
d02af173 | 2256 | defaults.h ) |
e22340b0 ZW |
2257 | tm_file_list="${tm_file_list} \$(srcdir)/$f" |
2258 | tm_include_list="${tm_include_list} $f" | |
2259 | ;; | |
2260 | * ) | |
2261 | tm_file_list="${tm_file_list} \$(srcdir)/config/$f" | |
2262 | tm_include_list="${tm_include_list} config/$f" | |
2263 | ;; | |
64ccbc99 | 2264 | esac |
af5e4ada | 2265 | done |
46f18e7b | 2266 | |
11642c3a | 2267 | tm_p_file_list= |
e22340b0 | 2268 | tm_p_include_list= |
11642c3a | 2269 | for f in $tm_p_file; do |
4977bab6 ZW |
2270 | case $f in |
2271 | tm-preds.h ) | |
e22340b0 ZW |
2272 | tm_p_file_list="${tm_p_file_list} $f" |
2273 | tm_p_include_list="${tm_p_include_list} $f" | |
2274 | ;; | |
2275 | * ) | |
2276 | tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" | |
2277 | tm_p_include_list="${tm_p_include_list} config/$f" | |
2278 | esac | |
2279 | done | |
2280 | ||
b4c522fa IB |
2281 | tm_d_file_list= |
2282 | tm_d_include_list="options.h insn-constants.h" | |
2283 | for f in $tm_d_file; do | |
2284 | case $f in | |
2285 | defaults.h ) | |
2286 | tm_d_file_list="${tm_d_file_list} \$(srcdir)/$f" | |
2287 | tm_d_include_list="${tm_d_include_list} $f" | |
2288 | ;; | |
2289 | * ) | |
2290 | tm_d_file_list="${tm_d_file_list} \$(srcdir)/config/$f" | |
2291 | tm_d_include_list="${tm_d_include_list} config/$f" | |
2292 | ;; | |
2293 | esac | |
2294 | done | |
2295 | ||
e22340b0 ZW |
2296 | xm_file_list= |
2297 | xm_include_list= | |
2298 | for f in $xm_file; do | |
2299 | case $f in | |
2300 | ansidecl.h ) | |
2301 | xm_file_list="${xm_file_list} \$(srcdir)/../include/$f" | |
2302 | xm_include_list="${xm_include_list} $f" | |
2303 | ;; | |
2304 | auto-host.h ) | |
2305 | xm_file_list="${xm_file_list} $f" | |
2306 | xm_include_list="${xm_include_list} $f" | |
2307 | ;; | |
2308 | * ) | |
2309 | xm_file_list="${xm_file_list} \$(srcdir)/config/$f" | |
2310 | xm_include_list="${xm_include_list} config/$f" | |
2311 | ;; | |
4977bab6 | 2312 | esac |
11642c3a ZW |
2313 | done |
2314 | ||
af5e4ada | 2315 | host_xm_file_list= |
e22340b0 | 2316 | host_xm_include_list= |
af5e4ada | 2317 | for f in $host_xm_file; do |
64ccbc99 | 2318 | case $f in |
d02af173 | 2319 | ansidecl.h ) |
e22340b0 ZW |
2320 | host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f" |
2321 | host_xm_include_list="${host_xm_include_list} $f" | |
2322 | ;; | |
e2500fed | 2323 | auto-host.h ) |
e22340b0 ZW |
2324 | host_xm_file_list="${host_xm_file_list} $f" |
2325 | host_xm_include_list="${host_xm_include_list} $f" | |
2326 | ;; | |
2327 | * ) | |
2328 | host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" | |
2329 | host_xm_include_list="${host_xm_include_list} config/$f" | |
2330 | ;; | |
64ccbc99 | 2331 | esac |
af5e4ada DE |
2332 | done |
2333 | ||
2334 | build_xm_file_list= | |
2335 | for f in $build_xm_file; do | |
64ccbc99 | 2336 | case $f in |
d02af173 | 2337 | ansidecl.h ) |
e22340b0 ZW |
2338 | build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f" |
2339 | build_xm_include_list="${build_xm_include_list} $f" | |
2340 | ;; | |
e2500fed | 2341 | auto-build.h | auto-host.h ) |
e22340b0 ZW |
2342 | build_xm_file_list="${build_xm_file_list} $f" |
2343 | build_xm_include_list="${build_xm_include_list} $f" | |
2344 | ;; | |
2345 | * ) | |
2346 | build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" | |
2347 | build_xm_include_list="${build_xm_include_list} config/$f" | |
2348 | ;; | |
64ccbc99 | 2349 | esac |
af5e4ada | 2350 | done |
46f18e7b | 2351 | |
2989d30c GK |
2352 | # Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a |
2353 | # cross-compiler which does not use the native headers and libraries. | |
a078a589 ZW |
2354 | # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR. |
2355 | CROSS= AC_SUBST(CROSS) | |
2356 | ALL=all.internal AC_SUBST(ALL) | |
2357 | SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR) | |
0c90d48b | 2358 | BUILD_SYSTEM_HEADER_DIR=$SYSTEM_HEADER_DIR AC_SUBST(BUILD_SYSTEM_HEADER_DIR) |
b28250ab | 2359 | |
0c90d48b BE |
2360 | if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x || |
2361 | test x$build != x$host || test "x$with_build_sysroot" != x; then | |
2362 | if test "x$with_build_sysroot" != x; then | |
2363 | BUILD_SYSTEM_HEADER_DIR=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' | |
2364 | else | |
2365 | BUILD_SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' | |
2366 | fi | |
b28250ab | 2367 | |
0c90d48b BE |
2368 | if test x$host != x$target |
2369 | then | |
2370 | CROSS="-DCROSS_DIRECTORY_STRUCTURE" | |
2371 | ALL=all.cross | |
2372 | SYSTEM_HEADER_DIR=$BUILD_SYSTEM_HEADER_DIR | |
2373 | elif test "x$TARGET_SYSTEM_ROOT" != x; then | |
2374 | SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' | |
2375 | fi | |
46f18e7b | 2376 | |
0c90d48b BE |
2377 | if test "x$with_build_sysroot" != "x"; then |
2378 | target_header_dir="${with_build_sysroot}${native_system_header_dir}" | |
7d7d00ba HPN |
2379 | elif test "x$with_sysroot" = x; then |
2380 | target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" | |
7d7d00ba HPN |
2381 | elif test "x$with_sysroot" = xyes; then |
2382 | target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" | |
2383 | else | |
2384 | target_header_dir="${with_sysroot}${native_system_header_dir}" | |
2385 | fi | |
2386 | else | |
2387 | target_header_dir=${native_system_header_dir} | |
2388 | fi | |
2389 | ||
b39d221a EC |
2390 | # If this is a cross-compiler that does not |
2391 | # have its own set of headers then define | |
2392 | # inhibit_libc | |
2393 | ||
dc06db20 R |
2394 | # If this is using newlib, without having the headers available now, |
2395 | # then define inhibit_libc in LIBGCC2_CFLAGS. | |
fecd6201 ZW |
2396 | # This prevents libgcc2 from containing any code which requires libc |
2397 | # support. | |
a929bc28 | 2398 | : ${inhibit_libc=false} |
dc06db20 R |
2399 | if { { test x$host != x$target && test "x$with_sysroot" = x ; } || |
2400 | test x$with_newlib = xyes ; } && | |
7d7d00ba | 2401 | { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then |
160633c6 | 2402 | inhibit_libc=true |
b39d221a EC |
2403 | fi |
2404 | AC_SUBST(inhibit_libc) | |
2405 | ||
a078a589 ZW |
2406 | # When building gcc with a cross-compiler, we need to adjust things so |
2407 | # that the generator programs are still built with the native compiler. | |
52c0e446 | 2408 | # Also, we cannot run fixincludes. |
a078a589 ZW |
2409 | |
2410 | # These are the normal (build=host) settings: | |
eaf9f3b2 | 2411 | CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD) |
bdd5dc28 | 2412 | CXX_FOR_BUILD='$(CXX)' AC_SUBST(CXX_FOR_BUILD) |
4977bab6 | 2413 | BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS) |
bdd5dc28 | 2414 | BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS) |
f8c33439 | 2415 | BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS) |
a078a589 | 2416 | STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC) |
587dc9c6 | 2417 | |
5148d2e3 L |
2418 | BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS)' AC_SUBST(BUILD_NO_PIE_CFLAGS) |
2419 | BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' AC_SUBST(BUILD_NO_PIE_FLAG) | |
2420 | ||
83599948 NS |
2421 | # And these apply if build != host, or we are generating coverage data |
2422 | if test x$build != x$host || test "x$coverage_flags" != x | |
af5e4ada | 2423 | then |
b11e4747 | 2424 | BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' |
c012dc48 | 2425 | BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' |
f8c33439 | 2426 | BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' |
5148d2e3 L |
2427 | |
2428 | NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}} | |
2429 | NO_PIE_FLAG_FOR_BUILD=${NO_PIE_FLAG_FOR_BUILD-${NO_PIE_FLAG}} | |
2430 | BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS_FOR_BUILD)' | |
2431 | BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG_FOR_BUILD)' | |
af5e4ada | 2432 | fi |
5148d2e3 L |
2433 | AC_SUBST(NO_PIE_CFLAGS_FOR_BUILD) |
2434 | AC_SUBST(NO_PIE_FLAG_FOR_BUILD) | |
46f18e7b | 2435 | |
ae3a15bb DE |
2436 | # Expand extra_headers to include complete path. |
2437 | # This substitutes for lots of t-* files. | |
2438 | extra_headers_list= | |
b1ef58c8 NN |
2439 | # Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers. |
2440 | for file in ${extra_headers} ; do | |
2441 | extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}" | |
2442 | done | |
ae3a15bb | 2443 | |
1617e5ee GK |
2444 | # If use_gcc_tgmath is set, append ginclude/tgmath.h. |
2445 | if test x"$use_gcc_tgmath" = xyes | |
2446 | then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h" | |
2447 | fi | |
2448 | ||
c38f02df ILT |
2449 | # Define collect2 in Makefile. |
2450 | case $host_can_use_collect2 in | |
2451 | no) collect2= ;; | |
2452 | *) collect2='collect2$(exeext)' ;; | |
2453 | esac | |
2454 | AC_SUBST([collect2]) | |
2455 | ||
af5e4ada | 2456 | # Add a definition of USE_COLLECT2 if system wants one. |
34a86c2b NN |
2457 | case $use_collect2 in |
2458 | no) use_collect2= ;; | |
2459 | "") ;; | |
2460 | *) | |
2461 | host_xm_defines="${host_xm_defines} USE_COLLECT2" | |
2462 | xm_defines="${xm_defines} USE_COLLECT2" | |
c38f02df ILT |
2463 | case $host_can_use_collect2 in |
2464 | no) | |
2465 | AC_MSG_ERROR([collect2 is required but cannot be built on this system]) | |
2466 | ;; | |
2467 | esac | |
34a86c2b NN |
2468 | ;; |
2469 | esac | |
af5e4ada | 2470 | |
1cd0b716 DK |
2471 | AC_DEFINE_UNQUOTED(LTOPLUGINSONAME,"${host_lto_plugin_soname}", |
2472 | [Define to the name of the LTO plugin DSO that must be | |
2473 | passed to the linker's -plugin=LIB option.]) | |
2474 | ||
630327c3 NN |
2475 | # --------------------------- |
2476 | # Assembler & linker features | |
2477 | # --------------------------- | |
2478 | ||
da0f6381 PB |
2479 | # During stage 2, ld is actually gcc/collect-ld, which is a small script to |
2480 | # discern between when to use prev-ld/ld-new and when to use ld/ld-new. | |
2481 | # However when ld-new is first executed from the build tree, libtool will | |
2482 | # relink it as .libs/lt-ld-new, so that it can give it an RPATH that refers | |
2483 | # to the build tree. While doing this we need to use the previous-stage | |
2484 | # linker, or we have an infinite loop. The presence of a shell script as | |
2485 | # ld/ld-new, and the fact that the script *uses ld itself*, is what confuses | |
2486 | # the gcc/collect-ld script. So we need to know how libtool works, or | |
2487 | # exec-tool will fail. | |
2488 | ||
2489 | m4_defun([_LT_CONFIG_COMMANDS], []) | |
2490 | AC_PROG_LIBTOOL | |
2491 | AC_SUBST(objdir) | |
2492 | AC_SUBST(enable_fast_install) | |
2493 | ||
d869a8c4 NN |
2494 | # Identify the assembler which will work hand-in-glove with the newly |
2495 | # built GCC, so that we can examine its features. This is the assembler | |
2496 | # which will be driven by the driver program. | |
2497 | # | |
2498 | # If build != host, and we aren't building gas in-tree, we identify a | |
2499 | # build->target assembler and hope that it will have the same features | |
2500 | # as the host->target assembler we'll be using. | |
981d4858 JM |
2501 | gcc_cv_gas_major_version= |
2502 | gcc_cv_gas_minor_version= | |
a2f319ea | 2503 | gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas |
e8b05380 PB |
2504 | |
2505 | m4_pattern_allow([AS_FOR_TARGET])dnl | |
2506 | AS_VAR_SET_IF(gcc_cv_as,, [ | |
3ccc3a56 AO |
2507 | if test -x "$DEFAULT_ASSEMBLER"; then |
2508 | gcc_cv_as="$DEFAULT_ASSEMBLER" | |
6b1786aa | 2509 | elif test -f $gcc_cv_as_gas_srcdir/configure.ac \ |
08d105fa AO |
2510 | && test -f ../gas/Makefile \ |
2511 | && test x$build = x$host; then | |
e8b05380 PB |
2512 | gcc_cv_as=../gas/as-new$build_exeext |
2513 | elif test -x as$build_exeext; then | |
2514 | # Build using assembler in the current directory. | |
2515 | gcc_cv_as=./as$build_exeext | |
4a150fc8 | 2516 | elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2517 | gcc_cv_as="$AS_FOR_TARGET" |
2518 | else | |
2519 | AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET) | |
2520 | fi]) | |
2521 | ||
2522 | ORIGINAL_AS_FOR_TARGET=$gcc_cv_as | |
2523 | AC_SUBST(ORIGINAL_AS_FOR_TARGET) | |
be0fe523 PB |
2524 | case "$ORIGINAL_AS_FOR_TARGET" in |
2525 | ./as | ./as$build_exeext) ;; | |
2526 | *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;; | |
2527 | esac | |
e8b05380 PB |
2528 | |
2529 | AC_MSG_CHECKING(what assembler to use) | |
2530 | if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then | |
08d105fa AO |
2531 | # Single tree build which includes gas. We want to prefer it |
2532 | # over whatever linker top-level may have detected, since | |
2533 | # we'll use what we're building after installation anyway. | |
e8b05380 | 2534 | AC_MSG_RESULT(newly built gas) |
ad9c4d9f NN |
2535 | in_tree_gas=yes |
2536 | _gcc_COMPUTE_GAS_VERSION | |
5408ac6c HPN |
2537 | in_tree_gas_is_elf=no |
2538 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ | |
2539 | || (grep 'obj_format = multi' ../gas/Makefile \ | |
2540 | && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null | |
2541 | then | |
2542 | in_tree_gas_is_elf=yes | |
2543 | fi | |
e8b05380 PB |
2544 | else |
2545 | AC_MSG_RESULT($gcc_cv_as) | |
2546 | in_tree_gas=no | |
981d4858 JM |
2547 | fi |
2548 | ||
40f213e6 L |
2549 | default_ld= |
2550 | AC_ARG_ENABLE(ld, | |
2551 | [[ --enable-ld[=ARG] build ld [ARG={default,yes,no}]]], | |
2552 | [case "${enableval}" in | |
2553 | no) | |
2554 | default_ld=ld.gold | |
2555 | ;; | |
2556 | esac]) | |
2557 | ||
95204cd5 | 2558 | install_gold_as_default=no |
40f213e6 L |
2559 | AC_ARG_ENABLE(gold, |
2560 | [[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]], | |
2561 | [case "${enableval}" in | |
2562 | default) | |
2563 | install_gold_as_default=yes | |
2564 | ;; | |
2565 | yes) | |
2566 | if test x${default_ld} != x; then | |
2567 | install_gold_as_default=yes | |
2568 | fi | |
2569 | ;; | |
2570 | no) | |
2571 | ;; | |
2572 | *) | |
2573 | AC_MSG_ERROR([invalid --enable-gold argument]) | |
2574 | ;; | |
95204cd5 | 2575 | esac]) |
40f213e6 | 2576 | |
d869a8c4 NN |
2577 | # Identify the linker which will work hand-in-glove with the newly |
2578 | # built GCC, so that we can examine its features. This is the linker | |
2579 | # which will be driven by the driver program. | |
2580 | # | |
2581 | # If build != host, and we aren't building gas in-tree, we identify a | |
2582 | # build->target linker and hope that it will have the same features | |
2583 | # as the host->target linker we'll be using. | |
275b60d6 JJ |
2584 | gcc_cv_gld_major_version= |
2585 | gcc_cv_gld_minor_version= | |
2586 | gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld | |
40f213e6 | 2587 | gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold |
275b60d6 | 2588 | gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd |
e8b05380 PB |
2589 | |
2590 | AS_VAR_SET_IF(gcc_cv_ld,, [ | |
275b60d6 JJ |
2591 | if test -x "$DEFAULT_LINKER"; then |
2592 | gcc_cv_ld="$DEFAULT_LINKER" | |
40f213e6 L |
2593 | elif test $install_gold_as_default = yes \ |
2594 | && test -f $gcc_cv_ld_gold_srcdir/configure.ac \ | |
2595 | && test -f ../gold/Makefile \ | |
2596 | && test x$build = x$host; then | |
2597 | gcc_cv_ld=../gold/ld-new$build_exeext | |
6b1786aa | 2598 | elif test -f $gcc_cv_ld_gld_srcdir/configure.ac \ |
08d105fa AO |
2599 | && test -f ../ld/Makefile \ |
2600 | && test x$build = x$host; then | |
e8b05380 PB |
2601 | gcc_cv_ld=../ld/ld-new$build_exeext |
2602 | elif test -x collect-ld$build_exeext; then | |
2603 | # Build using linker in the current directory. | |
2604 | gcc_cv_ld=./collect-ld$build_exeext | |
4a150fc8 | 2605 | elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2606 | gcc_cv_ld="$LD_FOR_TARGET" |
2607 | else | |
2608 | AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET) | |
2609 | fi]) | |
2610 | ||
5938f74d | 2611 | ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld |
36d21883 | 2612 | PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"` |
01a88d35 AP |
2613 | # if the PLUGIN_LD is set ld-new, just have it as ld |
2614 | # as that is the installed named. | |
3cecbdfa TS |
2615 | if test x$PLUGIN_LD_SUFFIX = xld-new \ |
2616 | || test x$PLUGIN_LD_SUFFIX = xcollect-ld ; then | |
01a88d35 AP |
2617 | PLUGIN_LD_SUFFIX=ld |
2618 | fi | |
5938f74d | 2619 | AC_ARG_WITH(plugin-ld, |
b88ecf55 | 2620 | [AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])], |
5938f74d L |
2621 | [if test x"$withval" != x; then |
2622 | ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval" | |
bcefc344 | 2623 | PLUGIN_LD_SUFFIX="$withval" |
5938f74d L |
2624 | fi]) |
2625 | AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET) | |
36d21883 | 2626 | AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker]) |
5938f74d | 2627 | |
1dcc82c2 DK |
2628 | # Check to see if we are using gold instead of ld |
2629 | AC_MSG_CHECKING(whether we are using gold) | |
2630 | ld_is_gold=no | |
2631 | if test x$gcc_cv_ld != x; then | |
2632 | if $gcc_cv_ld --version 2>/dev/null | sed 1q \ | |
2633 | | grep "GNU gold" > /dev/null; then | |
2634 | ld_is_gold=yes | |
2635 | fi | |
2636 | fi | |
2637 | AC_MSG_RESULT($ld_is_gold) | |
2638 | ||
402565b6 LB |
2639 | AC_MSG_CHECKING(gold linker with split stack support as non default) |
2640 | # Check to see if default ld is not gold, but gold is | |
2641 | # available and has support for split stack. If gcc was configured | |
2642 | # with gold then no checking is done. | |
2643 | # | |
2644 | if test x$ld_is_gold = xno && which ${gcc_cv_ld}.gold >/dev/null 2>&1; then | |
2645 | ||
2646 | # For platforms other than powerpc64*, enable as appropriate. | |
2647 | ||
2648 | gold_non_default=no | |
2649 | ld_gold=`which ${gcc_cv_ld}.gold` | |
2650 | # Make sure this gold has minimal split stack support | |
2651 | if $ld_gold --help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then | |
2652 | ld_vers=`$ld_gold --version | sed 1q` | |
2653 | gold_vers=`echo $ld_vers | sed -n \ | |
2654 | -e 's,^[[^)]]*[[ ]]\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*[[^)]]*\)) .*$,\1,p'` | |
2655 | case $target in | |
2656 | # check that the gold version contains the complete split stack support | |
2657 | # on powerpc64 big and little endian | |
2658 | powerpc64*-*-*) | |
2659 | case "$gold_vers" in | |
2660 | 2.25.[[1-9]]*|2.2[[6-9]][[.0-9]]*|2.[[3-9]][[.0-9]]*|[[3-9]].[[.0-9]]*) gold_non_default=yes | |
2661 | ;; | |
2662 | *) gold_non_default=no | |
2663 | ;; | |
2664 | esac | |
2665 | ;; | |
2666 | esac | |
2667 | fi | |
2668 | if test $gold_non_default = yes; then | |
2669 | AC_DEFINE(HAVE_GOLD_NON_DEFAULT_SPLIT_STACK, 1, | |
2670 | [Define if the gold linker supports split stack and is available as a non-default]) | |
2671 | fi | |
2672 | fi | |
2673 | AC_MSG_RESULT($gold_non_default) | |
2674 | ||
e8b05380 PB |
2675 | ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld |
2676 | AC_SUBST(ORIGINAL_LD_FOR_TARGET) | |
be0fe523 PB |
2677 | case "$ORIGINAL_LD_FOR_TARGET" in |
2678 | ./collect-ld | ./collect-ld$build_exeext) ;; | |
2679 | *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;; | |
2680 | esac | |
e8b05380 PB |
2681 | |
2682 | AC_MSG_CHECKING(what linker to use) | |
55b46574 RO |
2683 | if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \ |
2684 | || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then | |
08d105fa AO |
2685 | # Single tree build which includes ld. We want to prefer it |
2686 | # over whatever linker top-level may have detected, since | |
2687 | # we'll use what we're building after installation anyway. | |
e8b05380 | 2688 | AC_MSG_RESULT(newly built ld) |
34a86c2b | 2689 | in_tree_ld=yes |
5408ac6c HPN |
2690 | in_tree_ld_is_elf=no |
2691 | if (grep 'EMUL = .*elf' ../ld/Makefile \ | |
8a45d680 AN |
2692 | || grep 'EMUL = .*linux' ../ld/Makefile \ |
2693 | || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then | |
5408ac6c | 2694 | in_tree_ld_is_elf=yes |
55b46574 RO |
2695 | elif test "$ld_is_gold" = yes; then |
2696 | in_tree_ld_is_elf=yes | |
5408ac6c | 2697 | fi |
6b1786aa | 2698 | for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.ac $gcc_cv_ld_gld_srcdir/Makefile.in |
275b60d6 JJ |
2699 | do |
2700 | changequote(,)dnl | |
81179208 | 2701 | gcc_cv_gld_version=`sed -n -e 's/^[ ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f` |
275b60d6 JJ |
2702 | if test x$gcc_cv_gld_version != x; then |
2703 | break | |
2704 | fi | |
2705 | done | |
81179208 HPN |
2706 | case $gcc_cv_gld_version in |
2707 | VERSION=[0-9]*) ;; | |
2708 | changequote([,])dnl | |
2709 | *) AC_MSG_ERROR([[cannot find version of in-tree linker]]) ;; | |
2710 | changequote(,)dnl | |
2711 | esac | |
275b60d6 JJ |
2712 | gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"` |
2713 | gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"` | |
2714 | changequote([,])dnl | |
40f213e6 L |
2715 | ORIGINAL_LD_BFD_FOR_TARGET=../ld/ld-new$build_exeext |
2716 | ORIGINAL_LD_GOLD_FOR_TARGET=../gold/ld-new$build_exeext | |
e8b05380 PB |
2717 | else |
2718 | AC_MSG_RESULT($gcc_cv_ld) | |
2719 | in_tree_ld=no | |
40f213e6 L |
2720 | gcc_cvs_ld_program=`dirname $gcc_cv_ld`/`basename $gcc_cv_ld $host_exeext` |
2721 | ORIGINAL_LD_BFD_FOR_TARGET=${gcc_cvs_ld_program}.bfd$host_exeext | |
2722 | ORIGINAL_LD_GOLD_FOR_TARGET=${gcc_cvs_ld_program}.gold$host_exeext | |
275b60d6 JJ |
2723 | fi |
2724 | ||
40f213e6 L |
2725 | AC_SUBST(ORIGINAL_LD_BFD_FOR_TARGET) |
2726 | AC_SUBST(ORIGINAL_LD_GOLD_FOR_TARGET) | |
2727 | ||
981d4858 | 2728 | # Figure out what nm we will be using. |
f9c1196a | 2729 | gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils |
e8b05380 | 2730 | AS_VAR_SET_IF(gcc_cv_nm,, [ |
6b1786aa | 2731 | if test -f $gcc_cv_binutils_srcdir/configure.ac \ |
c15b113b DD |
2732 | && test -f ../binutils/Makefile \ |
2733 | && test x$build = x$host; then | |
9f18db39 PB |
2734 | gcc_cv_nm=../binutils/nm-new$build_exeext |
2735 | elif test -x nm$build_exeext; then | |
57991eba | 2736 | gcc_cv_nm=./nm$build_exeext |
4a150fc8 | 2737 | elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2738 | gcc_cv_nm="$NM_FOR_TARGET" |
2739 | else | |
2740 | AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET) | |
2741 | fi]) | |
9f18db39 | 2742 | |
9f18db39 | 2743 | AC_MSG_CHECKING(what nm to use) |
e8b05380 PB |
2744 | if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then |
2745 | # Single tree build which includes binutils. | |
2746 | AC_MSG_RESULT(newly built nm) | |
2747 | in_tree_nm=yes | |
2748 | else | |
2749 | AC_MSG_RESULT($gcc_cv_nm) | |
2750 | in_tree_nm=no | |
2751 | fi | |
2752 | ||
2753 | ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm | |
2754 | AC_SUBST(ORIGINAL_NM_FOR_TARGET) | |
be0fe523 PB |
2755 | case "$ORIGINAL_NM_FOR_TARGET" in |
2756 | ./nm | ./nm$build_exeext) ;; | |
2757 | *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;; | |
2758 | esac | |
2759 | ||
981d4858 | 2760 | |
3cae5780 | 2761 | # Figure out what objdump we will be using. |
e8b05380 | 2762 | AS_VAR_SET_IF(gcc_cv_objdump,, [ |
6b1786aa | 2763 | if test -f $gcc_cv_binutils_srcdir/configure.ac \ |
c15b113b DD |
2764 | && test -f ../binutils/Makefile \ |
2765 | && test x$build = x$host; then | |
f9c1196a | 2766 | # Single tree build which includes binutils. |
9f18db39 | 2767 | gcc_cv_objdump=../binutils/objdump$build_exeext |
d739199a DJ |
2768 | elif test -x objdump$build_exeext; then |
2769 | gcc_cv_objdump=./objdump$build_exeext | |
4a150fc8 | 2770 | elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2771 | gcc_cv_objdump="$OBJDUMP_FOR_TARGET" |
2772 | else | |
2773 | AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET) | |
2774 | fi]) | |
d739199a | 2775 | |
d739199a | 2776 | AC_MSG_CHECKING(what objdump to use) |
e8b05380 PB |
2777 | if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then |
2778 | # Single tree build which includes binutils. | |
2779 | AC_MSG_RESULT(newly built objdump) | |
2780 | elif test x$gcc_cv_objdump = x; then | |
2781 | AC_MSG_RESULT(not found) | |
2782 | else | |
2783 | AC_MSG_RESULT($gcc_cv_objdump) | |
2784 | fi | |
3cae5780 | 2785 | |
6e97481b JJ |
2786 | # Figure out what readelf we will be using. |
2787 | AS_VAR_SET_IF(gcc_cv_readelf,, [ | |
6b1786aa | 2788 | if test -f $gcc_cv_binutils_srcdir/configure.ac \ |
6e97481b JJ |
2789 | && test -f ../binutils/Makefile \ |
2790 | && test x$build = x$host; then | |
2791 | # Single tree build which includes binutils. | |
2792 | gcc_cv_readelf=../binutils/readelf$build_exeext | |
2793 | elif test -x readelf$build_exeext; then | |
2794 | gcc_cv_readelf=./readelf$build_exeext | |
32a18c8c L |
2795 | elif ( set dummy $READELF_FOR_TARGET; test -x $[2] ); then |
2796 | gcc_cv_readelf="$READELF_FOR_TARGET" | |
6e97481b | 2797 | else |
32a18c8c | 2798 | AC_PATH_PROG(gcc_cv_readelf, $READELF_FOR_TARGET) |
6e97481b JJ |
2799 | fi]) |
2800 | ||
2801 | AC_MSG_CHECKING(what readelf to use) | |
2802 | if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then | |
2803 | # Single tree build which includes binutils. | |
2804 | AC_MSG_RESULT(newly built readelf) | |
2805 | elif test x$gcc_cv_readelf = x; then | |
2806 | AC_MSG_RESULT(not found) | |
2807 | else | |
2808 | AC_MSG_RESULT($gcc_cv_readelf) | |
2809 | fi | |
2810 | ||
e4a9a572 IS |
2811 | # Figure out what otool we will be using. |
2812 | AS_VAR_SET_IF(gcc_cv_otool,, [ | |
2813 | if test -x otool$build_exeext; then | |
2814 | gcc_cv_otool=./otool$build_exeext | |
2815 | elif ( set dummy $OTOOL_FOR_TARGET; test -x $[2] ); then | |
2816 | gcc_cv_otool="$OTOOL_FOR_TARGET" | |
2817 | else | |
2818 | AC_PATH_PROG(gcc_cv_otool, $OTOOL_FOR_TARGET) | |
2819 | fi]) | |
2820 | ||
2821 | AC_MSG_CHECKING(what otool to use) | |
2822 | if test x$gcc_cv_otool = x; then | |
2823 | AC_MSG_RESULT(not found) | |
2824 | else | |
2825 | AC_MSG_RESULT($gcc_cv_otool) | |
2826 | fi | |
2827 | ||
981d4858 | 2828 | # Figure out what assembler alignment features are present. |
8ada417f ZW |
2829 | gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align, |
2830 | [2,6,0],, | |
2831 | [.balign 4 | |
2832 | .p2align 2],, | |
2833 | [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1, | |
2834 | [Define if your assembler supports .balign and .p2align.])]) | |
2835 | ||
2836 | gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align, | |
2837 | [2,8,0],, | |
2838 | [.p2align 4,,7],, | |
2839 | [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1, | |
2840 | [Define if your assembler supports specifying the maximum number | |
2841 | of bytes to skip when using the GAS .p2align command.])]) | |
2842 | ||
5708d18d MS |
2843 | gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16, |
2844 | [2,8,0],, | |
2845 | [.literal16],, | |
2846 | [AC_DEFINE(HAVE_GAS_LITERAL16, 1, | |
2847 | [Define if your assembler supports .literal16.])]) | |
2848 | ||
8ada417f ZW |
2849 | gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1, |
2850 | [elf,2,9,0],, | |
2851 | [conftest_label1: .word 0 | |
d1accaa3 JJ |
2852 | .subsection -1 |
2853 | conftest_label2: .word 0 | |
8ada417f ZW |
2854 | .previous], |
2855 | [if test x$gcc_cv_nm != x; then | |
2856 | $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 | |
2857 | $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 | |
2858 | if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1 | |
2859 | then : | |
2860 | else gcc_cv_as_subsection_m1=yes | |
2861 | fi | |
2862 | rm -f conftest.nm1 conftest.nm2 | |
2863 | fi], | |
2864 | [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1, | |
2865 | [Define if your assembler supports .subsection and .subsection -1 starts | |
2866 | emitting at the beginning of your section.])]) | |
2867 | ||
2868 | gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak, | |
2869 | [2,2,0],, | |
2870 | [ .weak foobar],, | |
2871 | [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])]) | |
2872 | ||
a0203ca7 AO |
2873 | gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref, |
2874 | [2,17,0],, | |
2875 | [ .weakref foobar, barfnot],, | |
2876 | [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])]) | |
2877 | ||
e41f3691 JDA |
2878 | gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat, |
2879 | [2,15,91],, | |
2880 | [ .SPACE $TEXT$ | |
2881 | .NSUBSPA $CODE$,COMDAT],, | |
2882 | [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])]) | |
2883 | ||
8ada417f ZW |
2884 | # .hidden needs to be supported in both the assembler and the linker, |
2885 | # because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN. | |
2886 | # This is irritatingly difficult to feature test for; we have to check the | |
2887 | # date string after the version number. If we've got an in-tree | |
2888 | # ld, we don't know its patchlevel version, so we set the baseline at 2.13 | |
2889 | # to be safe. | |
2890 | # The gcc_GAS_CHECK_FEATURE call just sets a cache variable. | |
8d91472f DE |
2891 | case "${target}" in |
2892 | *-*-aix*) | |
2893 | conftest_s=' .globl foobar,hidden' | |
2894 | ;; | |
2895 | *) | |
2896 | conftest_s=' .hidden foobar | |
2897 | foobar:' | |
2898 | ;; | |
2899 | esac | |
8ada417f | 2900 | gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden, |
8d91472f | 2901 | [elf,2,13,0],, [$conftest_s]) |
ee610fcd RO |
2902 | case "${target}" in |
2903 | *-*-darwin*) | |
2904 | # Darwin as has some visibility support, though with a different syntax. | |
2905 | gcc_cv_as_hidden=yes | |
2906 | ;; | |
2907 | esac | |
8ada417f | 2908 | |
ba885ec5 NS |
2909 | # gnu_indirect_function type is an extension proposed at |
2910 | # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime | |
2911 | # selection of function implementation | |
f6c5fbfd NS |
2912 | AC_ARG_ENABLE(gnu-indirect-function, |
2913 | [AS_HELP_STRING([--enable-gnu-indirect-function], | |
2914 | [enable the use of the @gnu_indirect_function to glibc systems])], | |
2915 | [case $enable_gnu_indirect_function in | |
2916 | yes | no) ;; | |
2917 | *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function. | |
2918 | Valid choices are 'yes' and 'no'.]) ;; | |
2919 | esac], | |
2920 | [enable_gnu_indirect_function="$default_gnu_indirect_function"]) | |
2f251a05 | 2921 | |
97976c07 NC |
2922 | case "${target}" in |
2923 | riscv*-*-linux*) | |
2924 | AC_MSG_CHECKING(linker ifunc IRELATIVE support) | |
2925 | cat > conftest.s <<EOF | |
2926 | .text | |
2927 | .type foo_resolver, @function | |
2928 | foo_resolver: | |
2929 | ret | |
2930 | .size foo_resolver, .-foo_resolver | |
2931 | ||
2932 | .globl foo | |
2933 | .type foo, %gnu_indirect_function | |
2934 | .set foo, foo_resolver | |
2935 | ||
2936 | .globl bar | |
2937 | .type bar, @function | |
2938 | bar: | |
2939 | call foo | |
2940 | ret | |
2941 | .size bar, .-bar | |
2942 | EOF | |
2943 | if test x$gcc_cv_as != x \ | |
2944 | && test x$gcc_cv_ld != x \ | |
2945 | && test x$gcc_cv_readelf != x \ | |
2946 | && $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ | |
2947 | && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \ | |
2948 | && $gcc_cv_readelf --relocs --wide conftest \ | |
2949 | | grep R_RISCV_IRELATIVE > /dev/null 2>&1; then | |
2950 | enable_gnu_indirect_function=yes | |
2951 | fi | |
2952 | rm -f conftest conftest.o conftest.s | |
2953 | AC_MSG_RESULT($enable_gnu_indirect_function) | |
2954 | ;; | |
2955 | esac | |
2956 | ||
2f251a05 AI |
2957 | gif=`if test x$enable_gnu_indirect_function = xyes; then echo 1; else echo 0; fi` |
2958 | AC_DEFINE_UNQUOTED(HAVE_GNU_INDIRECT_FUNCTION, $gif, | |
2959 | [Define if your system supports gnu indirect functions.]) | |
2960 | ||
ba885ec5 | 2961 | |
10ca6198 JJ |
2962 | changequote(,)dnl |
2963 | if test $in_tree_ld != yes ; then | |
2964 | ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q` | |
55b46574 RO |
2965 | if echo "$ld_ver" | grep GNU > /dev/null; then |
2966 | if test x"$ld_is_gold" = xyes; then | |
2967 | # GNU gold --version looks like this: | |
2968 | # | |
2969 | # GNU gold (GNU Binutils 2.21.51.20110225) 1.11 | |
2970 | # | |
2971 | # We extract the binutils version which is more familiar and specific | |
2972 | # than the gold version. | |
2973 | ld_vers=`echo $ld_ver | sed -n \ | |
2974 | -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'` | |
2975 | else | |
2976 | # GNU ld --version looks like this: | |
2977 | # | |
2978 | # GNU ld (GNU Binutils) 2.21.51.20110225 | |
2979 | ld_vers=`echo $ld_ver | sed -n \ | |
2980 | -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'` | |
2981 | fi | |
08bf7bde | 2982 | ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)\(-*\)\([01][0-9]\)\2\([0-3][0-9]\).*$,\1\3\4,p'` |
10ca6198 JJ |
2983 | ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` |
2984 | ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` | |
2985 | ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'` | |
55c4f715 RO |
2986 | else |
2987 | case "${target}" in | |
2988 | *-*-solaris2*) | |
dea82cdb | 2989 | # Solaris 2 ld -V output looks like this for a regular version: |
55c4f715 | 2990 | # |
dea82cdb RO |
2991 | # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699 |
2992 | # | |
2993 | # but test versions add stuff at the end: | |
2994 | # | |
2995 | # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10 | |
2996 | # | |
dea82cdb RO |
2997 | # ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version |
2998 | # numbers can be used in ld.so.1 feature checks even if a different | |
2999 | # linker is configured. | |
55c4f715 | 3000 | ld_ver=`$gcc_cv_ld -V 2>&1` |
7cd4af82 | 3001 | if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then |
55c4f715 | 3002 | ld_vers=`echo $ld_ver | sed -n \ |
7cd4af82 | 3003 | -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` |
55c4f715 RO |
3004 | ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` |
3005 | ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` | |
3006 | fi | |
3007 | ;; | |
3008 | esac | |
10ca6198 JJ |
3009 | fi |
3010 | fi | |
3011 | changequote([,])dnl | |
3012 | ||
8ada417f | 3013 | AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden, |
e5dfb95f | 3014 | [[if test $in_tree_ld = yes ; then |
8ada417f ZW |
3015 | gcc_cv_ld_hidden=no |
3016 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 13 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
3017 | && test $in_tree_ld_is_elf = yes; then | |
3018 | gcc_cv_ld_hidden=yes | |
3019 | fi | |
3020 | else | |
3021 | gcc_cv_ld_hidden=yes | |
55b46574 RO |
3022 | if test x"$ld_is_gold" = xyes; then |
3023 | : | |
3024 | elif echo "$ld_ver" | grep GNU > /dev/null; then | |
8ada417f ZW |
3025 | if test 0"$ld_date" -lt 20020404; then |
3026 | if test -n "$ld_date"; then | |
3027 | # If there was date string, but was earlier than 2002-04-04, fail | |
3028 | gcc_cv_ld_hidden=no | |
3029 | elif test -z "$ld_vers"; then | |
3030 | # If there was no date string nor ld version number, something is wrong | |
3031 | gcc_cv_ld_hidden=no | |
3032 | else | |
8ada417f ZW |
3033 | test -z "$ld_vers_patch" && ld_vers_patch=0 |
3034 | if test "$ld_vers_major" -lt 2; then | |
3035 | gcc_cv_ld_hidden=no | |
3036 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then | |
3037 | gcc_cv_ld_hidden="no" | |
3038 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then | |
3039 | gcc_cv_ld_hidden=no | |
c72931a6 | 3040 | fi |
8ada417f | 3041 | fi |
789b7de5 | 3042 | fi |
8ada417f | 3043 | else |
28690784 | 3044 | case "${target}" in |
8d91472f DE |
3045 | *-*-aix[789]*) |
3046 | gcc_cv_ld_hidden=yes | |
3047 | ;; | |
ee610fcd RO |
3048 | *-*-darwin*) |
3049 | # Darwin ld has some visibility support. | |
3050 | gcc_cv_ld_hidden=yes | |
3051 | ;; | |
b0fd7d27 | 3052 | hppa64*-*-hpux* | ia64*-*-hpux*) |
28690784 JDA |
3053 | gcc_cv_ld_hidden=yes |
3054 | ;; | |
ccd1242e | 3055 | *-*-solaris2*) |
a93e1899 RO |
3056 | # Support for .hidden in Sun ld appeared in Solaris 9 FCS, but |
3057 | # .symbolic was only added in Solaris 9 12/02. | |
5e87dc23 RO |
3058 | gcc_cv_ld_hidden=yes |
3059 | ;; | |
28690784 JDA |
3060 | *) |
3061 | gcc_cv_ld_hidden=no | |
3062 | ;; | |
3063 | esac | |
8ada417f | 3064 | fi |
e5dfb95f | 3065 | fi]]) |
8ada417f | 3066 | libgcc_visibility=no |
9e944a16 | 3067 | AC_SUBST(libgcc_visibility) |
232b67d9 | 3068 | GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN]) |
0f31374d | 3069 | if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then |
8ada417f ZW |
3070 | libgcc_visibility=yes |
3071 | AC_DEFINE(HAVE_GAS_HIDDEN, 1, | |
3072 | [Define if your assembler and linker support .hidden.]) | |
3073 | fi | |
6a9c5260 | 3074 | |
e73da78e RO |
3075 | AC_MSG_CHECKING(linker read-only and read-write section mixing) |
3076 | gcc_cv_ld_ro_rw_mix=unknown | |
3077 | if test $in_tree_ld = yes ; then | |
3078 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
3079 | && test $in_tree_ld_is_elf = yes; then | |
3080 | gcc_cv_ld_ro_rw_mix=read-write | |
3081 | fi | |
3082 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then | |
3083 | echo '.section myfoosect, "a"' > conftest1.s | |
3084 | echo '.section myfoosect, "aw"' > conftest2.s | |
3085 | echo '.byte 1' >> conftest2.s | |
3086 | echo '.section myfoosect, "a"' > conftest3.s | |
3087 | echo '.byte 0' >> conftest3.s | |
3088 | if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \ | |
3089 | && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \ | |
3090 | && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \ | |
3091 | && $gcc_cv_ld -shared -o conftest1.so conftest1.o \ | |
3092 | conftest2.o conftest3.o > /dev/null 2>&1; then | |
3093 | gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ | |
3094 | | sed -e '/myfoosect/!d' -e N` | |
3095 | if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then | |
3096 | if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then | |
3097 | gcc_cv_ld_ro_rw_mix=read-only | |
3098 | else | |
3099 | gcc_cv_ld_ro_rw_mix=read-write | |
3100 | fi | |
3101 | fi | |
3102 | fi | |
3103 | changequote(,)dnl | |
3104 | rm -f conftest.* conftest[123].* | |
3105 | changequote([,])dnl | |
3106 | fi | |
3107 | if test x$gcc_cv_ld_ro_rw_mix = xread-write; then | |
3108 | AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1, | |
3109 | [Define if your linker links a mix of read-only | |
3110 | and read-write sections into a read-write section.]) | |
3111 | fi | |
3112 | AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) | |
3113 | ||
e9c9f128 JJ |
3114 | gcc_AC_INITFINI_ARRAY |
3115 | ||
8ada417f | 3116 | # Check if we have .[us]leb128, and support symbol arithmetic with it. |
2133e773 IS |
3117 | # Older versions of GAS and some non-GNU assemblers, have a bugs handling |
3118 | # these directives, even when they appear to accept them. | |
8ada417f | 3119 | gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, |
2133e773 | 3120 | [elf,2,11,0],, |
8ada417f | 3121 | [ .data |
b7460f24 RH |
3122 | .uleb128 L2 - L1 |
3123 | L1: | |
3124 | .uleb128 1280 | |
3125 | .sleb128 -1010 | |
2133e773 IS |
3126 | L2: |
3127 | .uleb128 0x8000000000000000 | |
3128 | ], | |
3129 | [[ | |
3130 | if test "x$gcc_cv_objdump" != x; then | |
3131 | if $gcc_cv_objdump -s conftest.o 2>/dev/null \ | |
3132 | | grep '04800a8e 78808080 80808080 808001' >/dev/null; then | |
3133 | gcc_cv_as_leb128=yes | |
3134 | fi | |
3135 | elif test "x$gcc_cv_otool" != x; then | |
3136 | if $gcc_cv_otool -d conftest.o 2>/dev/null \ | |
3137 | | grep '04 80 0a 8e 78 80 80 80 80 80 80 80 80 80 01' >/dev/null; then | |
3138 | gcc_cv_as_leb128=yes | |
3139 | fi | |
3140 | else | |
3141 | # play safe, assume the assembler is broken. | |
3142 | : | |
3143 | fi | |
3144 | ]], | |
3145 | [AC_DEFINE(HAVE_AS_LEB128, 1, | |
3146 | [Define if your assembler supports .sleb128 and .uleb128.])], | |
3147 | [AC_DEFINE(HAVE_AS_LEB128, 0, | |
3148 | [Define if your assembler supports .sleb128 and .uleb128.])]) | |
8ada417f | 3149 | |
a836f142 RO |
3150 | # Determine if an .eh_frame section is read-only. |
3151 | gcc_fn_eh_frame_ro () { | |
3152 | $gcc_cv_as $1 -o conftest.o conftest.s > /dev/null 2>&1 && \ | |
3153 | $gcc_cv_objdump -h conftest.o 2>/dev/null | \ | |
3154 | sed -e '/.eh_frame/!d' -e N | grep READONLY > /dev/null | |
3155 | } | |
3156 | ||
d4ea4622 RH |
3157 | # Check if we have assembler support for unwind directives. |
3158 | gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive, | |
6e60703f | 3159 | ,, |
d4ea4622 RH |
3160 | [ .text |
3161 | .cfi_startproc | |
3162 | .cfi_offset 0, 0 | |
3163 | .cfi_same_value 1 | |
3164 | .cfi_def_cfa 1, 2 | |
3165 | .cfi_escape 1, 2, 3, 4, 5 | |
e73da78e RO |
3166 | .cfi_endproc], |
3167 | [case "$target" in | |
3168 | *-*-solaris*) | |
3169 | # If the linker used on Solaris (like Sun ld) isn't capable of merging | |
3170 | # read-only and read-write sections, we need to make sure that the | |
3171 | # assembler used emits read-write .eh_frame sections. | |
a836f142 RO |
3172 | if test "x$gcc_cv_ld_ro_rw_mix" = xread-write; then |
3173 | gcc_cv_as_cfi_directive=yes | |
3174 | elif test "x$gcc_cv_objdump" = x; then | |
3175 | # No objdump, err on the side of caution. | |
3176 | gcc_cv_as_cfi_directive=no | |
3177 | else | |
3178 | if test x$gas = xyes; then | |
3179 | as_32_opt="--32" | |
3180 | as_64_opt="--64" | |
e73da78e | 3181 | else |
a836f142 RO |
3182 | as_32_opt="-m32" |
3183 | as_64_opt="-m64" | |
e73da78e | 3184 | fi |
a836f142 RO |
3185 | case "$target" in |
3186 | sparc*-*-solaris2.*) | |
3187 | # On Solaris/SPARC, .eh_frame sections should always be read-write. | |
3188 | if gcc_fn_eh_frame_ro $as_32_opt \ | |
3189 | || gcc_fn_eh_frame_ro $as_64_opt; then | |
3190 | gcc_cv_as_cfi_directive=no | |
3191 | else | |
3192 | gcc_cv_as_cfi_directive=yes | |
3193 | fi | |
3194 | ;; | |
3195 | i?86-*-solaris2.* | x86_64-*-solaris2.*) | |
3196 | # On Solaris/x86, make sure that GCC and assembler agree on using | |
3197 | # read-only .eh_frame sections for 64-bit. | |
3198 | if gcc_fn_eh_frame_ro $as_32_opt; then | |
3199 | gcc_cv_as_cfi_directive=no | |
3200 | elif gcc_fn_eh_frame_ro $as_64_opt; then | |
3201 | gcc_cv_as_cfi_directive=yes | |
3202 | else | |
3203 | gcc_cv_as_cfi_directive=no | |
3204 | fi | |
3205 | ;; | |
3206 | esac | |
e73da78e RO |
3207 | fi |
3208 | ;; | |
3209 | *-*-*) | |
3210 | gcc_cv_as_cfi_directive=yes | |
3211 | ;; | |
3212 | esac]) | |
92053f38 | 3213 | if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then |
6e97481b JJ |
3214 | gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working, |
3215 | ,, | |
3216 | [ .text | |
3217 | .cfi_startproc | |
3218 | .cfi_adjust_cfa_offset 64 | |
7ac22e17 | 3219 | .skip 75040, 0 |
6e97481b JJ |
3220 | .cfi_adjust_cfa_offset 128 |
3221 | .cfi_endproc], | |
e5dfb95f | 3222 | [[ |
92053f38 | 3223 | if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \ |
7ac22e17 | 3224 | | grep 'DW_CFA_advance_loc[24]:[ ][ ]*75040[ ]' >/dev/null; then |
6e97481b JJ |
3225 | gcc_cv_as_cfi_advance_working=yes |
3226 | fi | |
e5dfb95f | 3227 | ]]) |
6e97481b | 3228 | else |
92053f38 | 3229 | # no objdump, err on the side of caution |
66f91112 | 3230 | gcc_cv_as_cfi_advance_working=no |
6e97481b | 3231 | fi |
174425ad | 3232 | GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_DIRECTIVE) |
d4ea4622 | 3233 | AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE, |
6e97481b JJ |
3234 | [`if test $gcc_cv_as_cfi_directive = yes \ |
3235 | && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`], | |
058514b3 RH |
3236 | [Define 0/1 if your assembler supports CFI directives.]) |
3237 | ||
174425ad | 3238 | GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE) |
058514b3 | 3239 | gcc_GAS_CHECK_FEATURE([cfi personality directive], |
6e60703f | 3240 | gcc_cv_as_cfi_personality_directive, ,, |
058514b3 | 3241 | [ .text |
042628f9 | 3242 | .cfi_startproc |
058514b3 RH |
3243 | .cfi_personality 0, symbol |
3244 | .cfi_endproc]) | |
3245 | AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE, | |
22e05272 | 3246 | [`if test $gcc_cv_as_cfi_personality_directive = yes; then echo 1; else echo 0; fi`], |
058514b3 | 3247 | [Define 0/1 if your assembler supports .cfi_personality.]) |
d4ea4622 | 3248 | |
7d45fb94 JJ |
3249 | gcc_GAS_CHECK_FEATURE([cfi sections directive], |
3250 | gcc_cv_as_cfi_sections_directive, ,, | |
3251 | [ .text | |
3252 | .cfi_sections .debug_frame, .eh_frame | |
3253 | .cfi_startproc | |
92053f38 RH |
3254 | .cfi_endproc], |
3255 | [case $target_os in | |
abe64d9e | 3256 | win32 | pe | cygwin* | mingw32*) |
92053f38 RH |
3257 | # Need to check that we generated the correct relocation for the |
3258 | # .debug_frame section. This was fixed for binutils 2.21. | |
3259 | gcc_cv_as_cfi_sections_directive=no | |
3260 | if test "x$gcc_cv_objdump" != x; then | |
3261 | if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \ | |
3262 | grep secrel > /dev/null; then | |
3263 | gcc_cv_as_cfi_sections_directive=yes | |
3264 | fi | |
3265 | fi | |
3266 | ;; | |
3267 | *) | |
3268 | gcc_cv_as_cfi_sections_directive=yes | |
3269 | ;; | |
3270 | esac]) | |
174425ad | 3271 | GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_SECTIONS_DIRECTIVE) |
7d45fb94 | 3272 | AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE, |
22e05272 | 3273 | [`if test $gcc_cv_as_cfi_sections_directive = yes; then echo 1; else echo 0; fi`], |
7d45fb94 JJ |
3274 | [Define 0/1 if your assembler supports .cfi_sections.]) |
3275 | ||
8ada417f ZW |
3276 | # GAS versions up to and including 2.11.0 may mis-optimize |
3277 | # .eh_frame data. | |
3278 | gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame, | |
3279 | [elf,2,12,0],, | |
3280 | [ .text | |
c64688ae RH |
3281 | .LFB1: |
3282 | .4byte 0 | |
3283 | .L1: | |
3284 | .4byte 0 | |
3285 | .LFE1: | |
3286 | .section .eh_frame,"aw",@progbits | |
3287 | __FRAME_BEGIN__: | |
3288 | .4byte .LECIE1-.LSCIE1 | |
3289 | .LSCIE1: | |
3290 | .4byte 0x0 | |
3291 | .byte 0x1 | |
3292 | .ascii "z\0" | |
3293 | .byte 0x1 | |
3294 | .byte 0x78 | |
3295 | .byte 0x1a | |
3296 | .byte 0x0 | |
3297 | .byte 0x4 | |
3298 | .4byte 1 | |
3299 | .p2align 1 | |
3300 | .LECIE1: | |
3301 | .LSFDE1: | |
3302 | .4byte .LEFDE1-.LASFDE1 | |
3303 | .LASFDE1: | |
3304 | .4byte .LASFDE1-__FRAME_BEGIN__ | |
3305 | .4byte .LFB1 | |
3306 | .4byte .LFE1-.LFB1 | |
3307 | .byte 0x4 | |
3308 | .4byte .LFE1-.LFB1 | |
3309 | .byte 0x4 | |
3310 | .4byte .L1-.LFB1 | |
8ada417f | 3311 | .LEFDE1:], |
ba479fd2 NN |
3312 | [ dnl # For autoconf 2.5x, must protect trailing spaces with @&t@. |
3313 | cat > conftest.lit <<EOF | |
c64688ae RH |
3314 | 0000 10000000 00000000 017a0001 781a0004 .........z..x... |
3315 | 0010 01000000 12000000 18000000 00000000 ................ | |
ba479fd2 | 3316 | 0020 08000000 04080000 0044 .........D @&t@ |
01efb963 | 3317 | EOF |
ba479fd2 | 3318 | cat > conftest.big <<EOF |
01efb963 AS |
3319 | 0000 00000010 00000000 017a0001 781a0004 .........z..x... |
3320 | 0010 00000001 00000012 00000018 00000000 ................ | |
ba479fd2 | 3321 | 0020 00000008 04000000 0844 .........D @&t@ |
c64688ae | 3322 | EOF |
8ada417f ZW |
3323 | # If the assembler didn't choke, and we can objdump, |
3324 | # and we got the correct data, then succeed. | |
dbc02e7f AS |
3325 | # The text in the here-document typically retains its unix-style line |
3326 | # endings, while the output of objdump will use host line endings. | |
3327 | # Therefore, use diff -b for the comparisons. | |
8ada417f ZW |
3328 | if test x$gcc_cv_objdump != x \ |
3329 | && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \ | |
3330 | | tail -3 > conftest.got \ | |
dbc02e7f AS |
3331 | && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \ |
3332 | || diff -b conftest.big conftest.got > /dev/null 2>&1; } | |
8ada417f ZW |
3333 | then |
3334 | gcc_cv_as_eh_frame=yes | |
3335 | elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then | |
3336 | gcc_cv_as_eh_frame=buggy | |
3337 | else | |
3338 | # Uh oh, what do we do now? | |
3339 | gcc_cv_as_eh_frame=no | |
3340 | fi]) | |
3341 | ||
3342 | if test $gcc_cv_as_eh_frame = buggy; then | |
3343 | AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1, | |
3344 | [Define if your assembler mis-optimizes .eh_frame data.]) | |
201556f0 | 3345 | fi |
201556f0 | 3346 | |
f8d70404 RO |
3347 | # Test if the assembler supports the section flag 'e' or #exclude for |
3348 | # specifying an excluded section. | |
3349 | gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_e, | |
3350 | [2,22,51], [--fatal-warnings], | |
3351 | [.section foo1,"e" | |
3352 | .byte 0,0,0,0]) | |
3353 | if test $gcc_cv_as_section_exclude_e = no; then | |
3354 | case "${target}" in | |
3355 | # Solaris as uses #exclude instead. | |
3356 | *-*-solaris2*) | |
3357 | case "${target}" in | |
3358 | sparc*-*-solaris2*) | |
3359 | conftest_s='.section "foo1", #exclude' | |
3360 | ;; | |
3361 | i?86-*-solaris2* | x86_64-*-solaris2*) | |
3362 | conftest_s='.section foo1, #exclude' | |
3363 | ;; | |
3364 | esac | |
3365 | ;; | |
3366 | esac | |
3367 | gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_hash,,, | |
3368 | [$conftest_s | |
3369 | .byte 0,0,0,0]) | |
3370 | fi | |
3371 | AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE, | |
3372 | [`if test $gcc_cv_as_section_exclude_e = yes || test $gcc_cv_as_section_exclude_hash = yes; then echo 1; else echo 0; fi`], | |
3373 | [Define if your assembler supports specifying the exclude section flag.]) | |
3374 | ||
6fbec038 L |
3375 | # Test if the assembler supports the section flag 'R' for specifying |
3376 | # section with SHF_GNU_RETAIN. | |
3377 | case "${target}" in | |
3378 | # Solaris may use GNU assembler with Solairs ld. Even if GNU | |
3379 | # assembler supports the section flag 'R', it doesn't mean that | |
3380 | # Solairs ld supports it. | |
3381 | *-*-solaris2*) | |
3382 | gcc_cv_as_shf_gnu_retain=no | |
3383 | ;; | |
3384 | *) | |
3385 | gcc_GAS_CHECK_FEATURE([section 'R' flag], gcc_cv_as_shf_gnu_retain, | |
3386 | [elf,2,36,0], [--fatal-warnings], | |
3387 | [.section .foo,"awR",%progbits | |
3388 | .byte 0]) | |
3389 | ;; | |
3390 | esac | |
3391 | AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_GNU_RETAIN, | |
3392 | [`if test $gcc_cv_as_shf_gnu_retain = yes; then echo 1; else echo 0; fi`], | |
3393 | [Define 0/1 if your assembler supports marking sections with SHF_GNU_RETAIN flag.]) | |
3394 | ||
694d4a6d L |
3395 | # Test if the assembler supports the section flag 'o' for specifying |
3396 | # section with link-order. | |
3397 | case "${target}" in | |
3398 | # Solaris may use GNU assembler with Solairs ld. Even if GNU | |
3399 | # assembler supports the section flag 'o', it doesn't mean that | |
3400 | # Solairs ld supports it. | |
3401 | *-*-solaris2*) | |
3402 | gcc_cv_as_section_link_order=no | |
3403 | ;; | |
3404 | *) | |
3405 | gcc_GAS_CHECK_FEATURE([section 'o' flag], gcc_cv_as_section_link_order, | |
3406 | [2,35,0], [--fatal-warnings], | |
3407 | [.section .foo,"a" | |
3408 | .byte 0 | |
3409 | .section __patchable_function_entries,"awo",%progbits,.foo | |
3410 | .byte 0]) | |
3411 | ;; | |
3412 | esac | |
3413 | AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_LINK_ORDER, | |
3414 | [`if test $gcc_cv_as_section_link_order = yes; then echo 1; else echo 0; fi`], | |
3415 | [Define 0/1 if your assembler supports 'o' flag in .section directive.]) | |
3416 | ||
8ada417f ZW |
3417 | gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, |
3418 | [elf,2,12,0], [--fatal-warnings], | |
5d4856a0 | 3419 | [.section .rodata.str, "aMS", @progbits, 1]) |
c18a5b6c MM |
3420 | if test $gcc_cv_as_shf_merge = no; then |
3421 | gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, | |
3422 | [elf,2,12,0], [--fatal-warnings], | |
3423 | [.section .rodata.str, "aMS", %progbits, 1]) | |
3424 | fi | |
5d4856a0 RO |
3425 | AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE, |
3426 | [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`], | |
3427 | [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.]) | |
8ada417f | 3428 | |
dc6b6330 RO |
3429 | gcc_cv_ld_aligned_shf_merge=yes |
3430 | case "$target" in | |
dc6b6330 RO |
3431 | # SHF_MERGE support is broken in Solaris ld up to Solaris 11.3/SPARC for |
3432 | # alignment > 1. | |
3433 | sparc*-*-solaris2.11*) | |
3434 | if test x"$gnu_ld" = xno \ | |
3435 | && test "$ld_vers_major" -lt 2 && test "$ld_vers_minor" -lt 3159; then | |
3436 | gcc_cv_ld_aligned_shf_merge=no | |
3437 | fi | |
3438 | ;; | |
3439 | esac | |
3440 | AC_DEFINE_UNQUOTED(HAVE_LD_ALIGNED_SHF_MERGE, | |
3441 | [`if test $gcc_cv_ld_aligned_shf_merge = yes; then echo 1; else echo 0; fi`], | |
3442 | [Define 0/1 if your linker supports the SHF_MERGE flag with section alignment > 1.]) | |
3443 | ||
01704e5a RO |
3444 | gcc_GAS_CHECK_FEATURE([stabs directive], gcc_cv_as_stabs_directive, ,, |
3445 | [.stabs "gcc2_compiled.",60,0,0,0],, | |
3446 | [AC_DEFINE(HAVE_AS_STABS_DIRECTIVE, 1, | |
3447 | [Define if your assembler supports .stabs.])]) | |
3448 | ||
2ca48caa RO |
3449 | gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)], |
3450 | gcc_cv_as_comdat_group, | |
11176d2a | 3451 | [elf,2,16,0], [--fatal-warnings], |
c18a5b6c MM |
3452 | [.section .text,"axG",@progbits,.foo,comdat]) |
3453 | if test $gcc_cv_as_comdat_group = yes; then | |
3454 | gcc_cv_as_comdat_group_percent=no | |
2ca48caa | 3455 | gcc_cv_as_comdat_group_group=no |
c18a5b6c | 3456 | else |
2ca48caa RO |
3457 | gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)], |
3458 | gcc_cv_as_comdat_group_percent, | |
11176d2a | 3459 | [elf,2,16,0], [--fatal-warnings], |
c18a5b6c | 3460 | [.section .text,"axG",%progbits,.foo,comdat]) |
2ca48caa RO |
3461 | if test $gcc_cv_as_comdat_group_percent = yes; then |
3462 | gcc_cv_as_comdat_group_group=no | |
3463 | else | |
3464 | case "${target}" in | |
3465 | # Sun as uses a completely different syntax. | |
3466 | *-*-solaris2*) | |
3467 | case "${target}" in | |
3468 | sparc*-*-solaris2*) | |
3469 | conftest_s=' | |
3470 | .group foo,".text%foo",#comdat | |
3471 | .section ".text%foo", #alloc,#execinstr,#progbits | |
3472 | .globl foo | |
3473 | foo: | |
3474 | ' | |
3475 | ;; | |
ccd1242e | 3476 | i?86-*-solaris2* | x86_64-*-solaris2*) |
2ca48caa RO |
3477 | conftest_s=' |
3478 | .group foo,.text%foo,#comdat | |
3479 | .section .text%foo, "ax", @progbits | |
3480 | .globl foo | |
3481 | foo: | |
3482 | ' | |
3483 | ;; | |
3484 | esac | |
3485 | gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)], | |
3486 | gcc_cv_as_comdat_group_group, | |
3487 | ,, [$conftest_s]) | |
3488 | ;; | |
3489 | esac | |
56e675ce RO |
3490 | if test -z "${gcc_cv_as_comdat_group_group+set}"; then |
3491 | gcc_cv_as_comdat_group_group=no | |
3492 | fi | |
2ca48caa | 3493 | fi |
c18a5b6c | 3494 | fi |
1dcc82c2 DK |
3495 | if test x"$ld_is_gold" = xyes; then |
3496 | comdat_group=yes | |
3497 | elif test $in_tree_ld = yes ; then | |
39ba7b7d JB |
3498 | comdat_group=no |
3499 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
3500 | && test $in_tree_ld_is_elf = yes; then | |
3501 | comdat_group=yes | |
3502 | fi | |
55c4f715 | 3503 | elif echo "$ld_ver" | grep GNU > /dev/null; then |
11176d2a JB |
3504 | comdat_group=yes |
3505 | if test 0"$ld_date" -lt 20050308; then | |
3506 | if test -n "$ld_date"; then | |
3507 | # If there was date string, but was earlier than 2005-03-08, fail | |
3508 | comdat_group=no | |
3509 | elif test "$ld_vers_major" -lt 2; then | |
3510 | comdat_group=no | |
3511 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then | |
3512 | comdat_group=no | |
3513 | fi | |
3514 | fi | |
1cf0118d | 3515 | else |
55c4f715 RO |
3516 | changequote(,)dnl |
3517 | case "${target}" in | |
3518 | *-*-solaris2.1[1-9]*) | |
2ca48caa | 3519 | comdat_group=no |
55c4f715 RO |
3520 | # Sun ld has COMDAT group support since Solaris 9, but it doesn't |
3521 | # interoperate with GNU as until Solaris 11 build 130, i.e. ld | |
3522 | # version 1.688. | |
3523 | # | |
2ca48caa RO |
3524 | # If using Sun as for COMDAT group as emitted by GCC, one needs at |
3525 | # least ld version 1.2267. | |
3526 | if test "$ld_vers_major" -gt 1; then | |
55c4f715 | 3527 | comdat_group=yes |
2ca48caa RO |
3528 | elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then |
3529 | comdat_group=yes | |
3530 | elif test "$ld_vers_minor" -ge 2267; then | |
3531 | comdat_group=yes | |
55c4f715 RO |
3532 | fi |
3533 | ;; | |
3534 | *) | |
3535 | # Assume linkers other than GNU ld don't support COMDAT group. | |
3536 | comdat_group=no | |
3537 | ;; | |
3538 | esac | |
3539 | changequote([,])dnl | |
1cf0118d | 3540 | fi |
55c4f715 RO |
3541 | # Allow overriding the automatic COMDAT group tests above. |
3542 | AC_ARG_ENABLE(comdat, | |
3543 | [AS_HELP_STRING([--enable-comdat], [enable COMDAT group support])], | |
3544 | [comdat_group="$enable_comdat"]) | |
1cf0118d RO |
3545 | if test $comdat_group = no; then |
3546 | gcc_cv_as_comdat_group=no | |
3547 | gcc_cv_as_comdat_group_percent=no | |
2ca48caa | 3548 | gcc_cv_as_comdat_group_group=no |
11176d2a JB |
3549 | fi |
3550 | AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP, | |
2ca48caa RO |
3551 | [`if test $gcc_cv_as_comdat_group = yes \ |
3552 | || test $gcc_cv_as_comdat_group_percent = yes \ | |
3553 | || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi`], | |
11176d2a | 3554 | [Define 0/1 if your assembler and linker support COMDAT groups.]) |
c18a5b6c | 3555 | |
af2e3244 RO |
3556 | # Restrict this test to Solaris/x86: other targets define this statically. |
3557 | case "${target}" in | |
3558 | i?86-*-solaris2* | x86_64-*-solaris2*) | |
3559 | AC_MSG_CHECKING(support for hidden thunks in linkonce sections) | |
3560 | if test $in_tree_ld = yes || echo "$ld_ver" | grep GNU > /dev/null; then | |
3561 | hidden_linkonce=yes | |
3562 | else | |
3563 | case "${target}" in | |
3564 | # Full support for hidden thunks in linkonce sections only appeared in | |
3565 | # Solaris 11/OpenSolaris. | |
3566 | *-*-solaris2.1[[1-9]]*) | |
3567 | hidden_linkonce=yes | |
3568 | ;; | |
3569 | *) | |
3570 | hidden_linkonce=no | |
3571 | ;; | |
3572 | esac | |
3573 | fi | |
3574 | AC_MSG_RESULT($hidden_linkonce) | |
3575 | AC_DEFINE_UNQUOTED(USE_HIDDEN_LINKONCE, | |
3576 | [`if test $hidden_linkonce = yes; then echo 1; else echo 0; fi`], | |
3577 | [Define 0/1 if your linker supports hidden thunks in linkonce sections.]) | |
3578 | ;; | |
3579 | esac | |
3580 | ||
894f597f AO |
3581 | gcc_GAS_CHECK_FEATURE([line table is_stmt support], |
3582 | gcc_cv_as_is_stmt, | |
3583 | [2,16,92],, | |
3584 | [ .text | |
3585 | .file 1 "conf.c" | |
3586 | .loc 1 1 0 is_stmt 1],, | |
3587 | [AC_DEFINE(HAVE_GAS_LOC_STMT, 1, | |
3588 | [Define if your assembler supports the .loc is_stmt sub-directive.])]) | |
3589 | ||
6c52e687 CC |
3590 | gcc_GAS_CHECK_FEATURE([line table discriminator support], |
3591 | gcc_cv_as_discriminator, | |
3592 | [2,19,51],, | |
3593 | [ .text | |
3594 | .file 1 "conf.c" | |
3595 | .loc 1 1 0 discriminator 1],, | |
3596 | [AC_DEFINE(HAVE_GAS_DISCRIMINATOR, 1, | |
3597 | [Define if your assembler supports the .loc discriminator sub-directive.])]) | |
3598 | ||
02afb6a9 JL |
3599 | # Catch the newlib flag of the same name so we can gate GCC features on it. |
3600 | AC_ARG_ENABLE(newlib-nano-formatted-io, | |
3601 | [AS_HELP_STRING([--enable-newlib-nano-formatted-io], [Use nano version | |
3602 | formatted IO])], | |
3603 | [case "${enableval}" in | |
3604 | yes|no) | |
3605 | ;; | |
3606 | *) | |
3607 | AC_MSG_ERROR([unknown newlib-nano-formatted-io setting $enableval]) | |
3608 | ;; | |
3609 | esac], []) | |
3610 | ||
6a7a462c | 3611 | # Thread-local storage - the check is heavily parameterized. |
f996902d RH |
3612 | conftest_s= |
3613 | tls_first_major= | |
3614 | tls_first_minor= | |
9739c90c | 3615 | tls_as_opt= |
f996902d RH |
3616 | case "$target" in |
3617 | changequote(,)dnl | |
6f9b006d RH |
3618 | alpha*-*-*) |
3619 | conftest_s=' | |
3620 | .section ".tdata","awT",@progbits | |
3621 | foo: .long 25 | |
3622 | .text | |
3623 | ldq $27,__tls_get_addr($29) !literal!1 | |
3624 | lda $16,foo($29) !tlsgd!1 | |
3625 | jsr $26,($27),__tls_get_addr !lituse_tlsgd!1 | |
3626 | ldq $27,__tls_get_addr($29) !literal!2 | |
3627 | lda $16,foo($29) !tlsldm!2 | |
3628 | jsr $26,($27),__tls_get_addr !lituse_tlsldm!2 | |
3629 | ldq $1,foo($29) !gotdtprel | |
3630 | ldah $2,foo($29) !dtprelhi | |
3631 | lda $3,foo($2) !dtprello | |
3632 | lda $4,foo($29) !dtprel | |
3633 | ldq $1,foo($29) !gottprel | |
3634 | ldah $2,foo($29) !tprelhi | |
3635 | lda $3,foo($2) !tprello | |
3636 | lda $4,foo($29) !tprel' | |
3637 | tls_first_major=2 | |
3638 | tls_first_minor=13 | |
2f3321ca | 3639 | tls_as_opt=--fatal-warnings |
6f9b006d | 3640 | ;; |
28633bbd CZ |
3641 | arc*-*-*) |
3642 | conftest_s=' | |
3643 | add_s r0,r0, @foo@tpoff' | |
3644 | tls_first_major=2 | |
3645 | tls_first_minor=23 | |
3646 | ;; | |
ad9646c7 HPN |
3647 | cris-*-*|crisv32-*-*) |
3648 | conftest_s=' | |
3649 | .section ".tdata","awT",@progbits | |
3650 | x: .long 25 | |
3651 | .text | |
3652 | move.d x:IE,$r10 | |
3653 | nop' | |
3654 | tls_first_major=2 | |
3655 | tls_first_minor=20 | |
3656 | tls_as_opt=--fatal-warnings | |
3657 | ;; | |
e4dd71de AH |
3658 | frv*-*-*) |
3659 | conftest_s=' | |
3660 | .section ".tdata","awT",@progbits | |
3661 | x: .long 25 | |
3662 | .text | |
3663 | call #gettlsoff(x)' | |
3664 | tls_first_major=2 | |
3665 | tls_first_minor=14 | |
3666 | ;; | |
51076f96 RC |
3667 | hppa*-*-linux*) |
3668 | conftest_s=' | |
3669 | t1: .reg %r20 | |
3670 | t2: .reg %r21 | |
3671 | gp: .reg %r19 | |
3672 | .section ".tdata","awT",@progbits | |
3673 | foo: .long 25 | |
3674 | .text | |
3675 | .align 4 | |
3676 | addil LT%foo-$tls_gdidx$,gp | |
3677 | ldo RT%foo-$tls_gdidx$(%r1),%arg0 | |
3678 | b __tls_get_addr | |
3679 | nop | |
3680 | addil LT%foo-$tls_ldidx$,gp | |
3681 | b __tls_get_addr | |
3682 | ldo RT%foo-$tls_ldidx$(%r1),%arg0 | |
3683 | addil LR%foo-$tls_dtpoff$,%ret0 | |
3684 | ldo RR%foo-$tls_dtpoff$(%r1),%t1 | |
3685 | mfctl %cr27,%t1 | |
3686 | addil LT%foo-$tls_ieoff$,gp | |
3687 | ldw RT%foo-$tls_ieoff$(%r1),%t2 | |
3688 | add %t1,%t2,%t3 | |
3689 | mfctl %cr27,%t1 | |
3690 | addil LR%foo-$tls_leoff$,%t1 | |
3691 | ldo RR%foo-$tls_leoff$(%r1),%t2' | |
3692 | tls_first_major=2 | |
3693 | tls_first_minor=15 | |
3694 | tls_as_opt=--fatal-warnings | |
3695 | ;; | |
d3585b76 DJ |
3696 | arm*-*-*) |
3697 | conftest_s=' | |
3698 | .section ".tdata","awT",%progbits | |
3699 | foo: .long 25 | |
3700 | .text | |
3701 | .word foo(gottpoff) | |
3702 | .word foo(tpoff) | |
3703 | .word foo(tlsgd) | |
3704 | .word foo(tlsldm) | |
3705 | .word foo(tlsldo)' | |
3706 | tls_first_major=2 | |
3707 | tls_first_minor=17 | |
3708 | ;; | |
fe4e71e4 | 3709 | i[34567]86-*-* | x86_64-*-*) |
f1c26cad | 3710 | case "$target" in |
ccd1242e | 3711 | i[34567]86-*-solaris2.* | x86_64-*-solaris2.*) |
f1c26cad | 3712 | on_solaris=yes |
fbdd5d87 | 3713 | ;; |
f1c26cad RO |
3714 | *) |
3715 | on_solaris=no | |
3716 | ;; | |
3717 | esac | |
3718 | if test x$on_solaris = xyes && test x$gas_flag = xno; then | |
3719 | conftest_s=' | |
3720 | .section .tdata,"awt",@progbits' | |
3721 | tls_first_major=0 | |
3722 | tls_first_minor=0 | |
caa16d41 | 3723 | tls_section_flag=t |
f1c26cad RO |
3724 | changequote([,])dnl |
3725 | AC_DEFINE(TLS_SECTION_ASM_FLAG, 't', | |
3726 | [Define to the flag used to mark TLS sections if the default (`T') doesn't work.]) | |
3727 | changequote(,)dnl | |
3728 | else | |
3729 | conftest_s=' | |
3730 | .section ".tdata","awT",@progbits' | |
3731 | tls_first_major=2 | |
3732 | tls_first_minor=14 | |
caa16d41 | 3733 | tls_section_flag=T |
f1c26cad RO |
3734 | tls_as_opt="--fatal-warnings" |
3735 | fi | |
fe4e71e4 RO |
3736 | case "$target" in |
3737 | i[34567]86-*-*) | |
700d4572 RO |
3738 | if test x$on_solaris = xyes; then |
3739 | case $gas_flag in | |
3740 | yes) tls_as_opt="$tls_as_opt --32" ;; | |
3741 | esac | |
3742 | fi | |
fe4e71e4 | 3743 | conftest_s="$conftest_s |
f996902d RH |
3744 | foo: .long 25 |
3745 | .text | |
3746 | movl %gs:0, %eax | |
f1c26cad RO |
3747 | leal foo@tlsgd(,%ebx,1), %eax |
3748 | leal foo@tlsldm(%ebx), %eax | |
3749 | leal foo@dtpoff(%eax), %edx | |
3750 | movl foo@gottpoff(%ebx), %eax | |
3751 | subl foo@gottpoff(%ebx), %eax | |
3752 | addl foo@gotntpoff(%ebx), %eax | |
3753 | movl foo@indntpoff, %eax | |
3754 | movl \$foo@tpoff, %eax | |
3755 | subl \$foo@tpoff, %eax | |
3756 | leal foo@ntpoff(%ecx), %eax" | |
fe4e71e4 RO |
3757 | ;; |
3758 | x86_64-*-*) | |
3759 | if test x$on_solaris = xyes; then | |
3760 | case $gas_flag in | |
3761 | yes) tls_as_opt="$tls_as_opt --64" ;; | |
3762 | no) tls_as_opt="$tls_as_opt -xarch=amd64" ;; | |
3763 | esac | |
3764 | fi | |
3765 | conftest_s="$conftest_s | |
75d38379 JJ |
3766 | foo: .long 25 |
3767 | .text | |
3768 | movq %fs:0, %rax | |
fe4e71e4 RO |
3769 | leaq foo@tlsgd(%rip), %rdi |
3770 | leaq foo@tlsld(%rip), %rdi | |
3771 | leaq foo@dtpoff(%rax), %rdx | |
3772 | movq foo@gottpoff(%rip), %rax | |
3773 | movq \$foo@tpoff, %rax" | |
3774 | ;; | |
3775 | esac | |
3776 | ;; | |
7b6e506e RH |
3777 | ia64-*-*) |
3778 | conftest_s=' | |
3779 | .section ".tdata","awT",@progbits | |
3780 | foo: data8 25 | |
3781 | .text | |
3782 | addl r16 = @ltoff(@dtpmod(foo#)), gp | |
3783 | addl r17 = @ltoff(@dtprel(foo#)), gp | |
3784 | addl r18 = @ltoff(@tprel(foo#)), gp | |
3785 | addl r19 = @dtprel(foo#), gp | |
3786 | adds r21 = @dtprel(foo#), r13 | |
3787 | movl r23 = @dtprel(foo#) | |
3788 | addl r20 = @tprel(foo#), gp | |
3789 | adds r22 = @tprel(foo#), r13 | |
3790 | movl r24 = @tprel(foo#)' | |
3791 | tls_first_major=2 | |
3792 | tls_first_minor=13 | |
2f3321ca | 3793 | tls_as_opt=--fatal-warnings |
7b6e506e | 3794 | ;; |
8cc9a5a5 EI |
3795 | microblaze*-*-*) |
3796 | conftest_s=' | |
3797 | .section .tdata,"awT",@progbits | |
3798 | x: | |
3799 | .word 2 | |
3800 | .text | |
3801 | addik r5,r20,x@TLSGD | |
3802 | addik r5,r20,x@TLSLDM' | |
3803 | tls_first_major=2 | |
3804 | tls_first_minor=20 | |
3805 | tls_as_opt='--fatal-warnings' | |
3806 | ;; | |
69229b81 DJ |
3807 | mips*-*-*) |
3808 | conftest_s=' | |
3809 | .section .tdata,"awT",@progbits | |
3810 | x: | |
3811 | .word 2 | |
3812 | .text | |
3813 | addiu $4, $28, %tlsgd(x) | |
3814 | addiu $4, $28, %tlsldm(x) | |
3815 | lui $4, %dtprel_hi(x) | |
3816 | addiu $4, $4, %dtprel_lo(x) | |
3817 | lw $4, %gottprel(x)($28) | |
3818 | lui $4, %tprel_hi(x) | |
3819 | addiu $4, $4, %tprel_lo(x)' | |
3820 | tls_first_major=2 | |
3821 | tls_first_minor=16 | |
3822 | tls_as_opt='-32 --fatal-warnings' | |
3823 | ;; | |
75df395f MK |
3824 | m68k-*-*) |
3825 | conftest_s=' | |
3826 | .section .tdata,"awT",@progbits | |
3827 | x: | |
3828 | .word 2 | |
3829 | .text | |
3830 | foo: | |
3831 | move.l x@TLSGD(%a5),%a0 | |
3832 | move.l x@TLSLDM(%a5),%a0 | |
3833 | move.l x@TLSLDO(%a5),%a0 | |
3834 | move.l x@TLSIE(%a5),%a0 | |
3835 | move.l x@TLSLE(%a5),%a0' | |
3836 | tls_first_major=2 | |
3837 | tls_first_minor=19 | |
3838 | tls_as_opt='--fatal-warnings' | |
3839 | ;; | |
e430824f CLT |
3840 | nios2-*-*) |
3841 | conftest_s=' | |
3842 | .section ".tdata","awT",@progbits' | |
3843 | tls_first_major=2 | |
3844 | tls_first_minor=23 | |
3845 | tls_as_opt="--fatal-warnings" | |
3846 | ;; | |
24034425 IB |
3847 | aarch64*-*-*) |
3848 | conftest_s=' | |
3849 | .section ".tdata","awT",%progbits | |
3850 | foo: .long 25 | |
3851 | .text | |
3852 | adrp x0, :tlsgd:x | |
3853 | add x0, x0, #:tlsgd_lo12:x | |
3854 | bl __tls_get_addr | |
3855 | nop' | |
3856 | tls_first_major=2 | |
3857 | tls_first_minor=20 | |
3858 | tls_as_opt='--fatal-warnings' | |
3859 | ;; | |
3965b35f SH |
3860 | or1k*-*-*) |
3861 | conftest_s=' | |
3862 | .section ".tdata","awT",@progbits | |
3863 | foo: .long 25 | |
3864 | .text | |
3865 | l.movhi r3, tpoffha(foo) | |
3866 | l.add r3, r3, r10 | |
3867 | l.lwz r4, tpofflo(foo)(r3)' | |
3868 | tls_first_major=2 | |
3869 | tls_first_minor=30 | |
3870 | tls_as_opt=--fatal-warnings | |
3871 | ;; | |
7a8b1ec4 DE |
3872 | powerpc-ibm-aix*) |
3873 | conftest_s=' | |
3874 | .extern __get_tpointer | |
3875 | .toc | |
3876 | LC..1: | |
3877 | .tc a[TC],a[TL]@le | |
3878 | .csect .text[PR] | |
3879 | .tlstest: | |
3880 | lwz 9,LC..1(2) | |
3881 | bla __get_tpointer | |
3882 | lwzx 3,9,3 | |
3883 | .globl a | |
3884 | .csect a[TL],4 | |
3885 | a: | |
3886 | .space 4' | |
3887 | tls_first_major=0 | |
3888 | tls_first_minor=0 | |
3889 | ;; | |
227eb343 | 3890 | powerpc64*-*-*) |
c4501e62 JJ |
3891 | conftest_s=' |
3892 | .section ".tdata","awT",@progbits | |
3893 | .align 3 | |
3894 | ld0: .space 8 | |
3895 | ld1: .space 8 | |
3896 | x1: .space 8 | |
3897 | x2: .space 8 | |
3898 | x3: .space 8 | |
3899 | .text | |
3900 | addi 3,2,ld0@got@tlsgd | |
3901 | bl .__tls_get_addr | |
3902 | nop | |
3903 | addi 3,2,ld1@toc | |
3904 | bl .__tls_get_addr | |
3905 | nop | |
3906 | addi 3,2,x1@got@tlsld | |
3907 | bl .__tls_get_addr | |
3908 | nop | |
3909 | addi 9,3,x1@dtprel | |
3910 | bl .__tls_get_addr | |
3911 | nop | |
3912 | addis 9,3,x2@dtprel@ha | |
3913 | addi 9,9,x2@dtprel@l | |
3914 | bl .__tls_get_addr | |
3915 | nop | |
3916 | ld 9,x3@got@dtprel(2) | |
3917 | add 9,9,3 | |
3918 | bl .__tls_get_addr | |
3919 | nop' | |
3920 | tls_first_major=2 | |
3921 | tls_first_minor=14 | |
2f3321ca | 3922 | tls_as_opt="-a64 --fatal-warnings" |
c4501e62 | 3923 | ;; |
01ae4861 AM |
3924 | powerpc*-*-*) |
3925 | conftest_s=' | |
3926 | .section ".tdata","awT",@progbits | |
3927 | .align 2 | |
3928 | ld0: .space 4 | |
3929 | ld1: .space 4 | |
3930 | x1: .space 4 | |
3931 | x2: .space 4 | |
3932 | x3: .space 4 | |
3933 | .text | |
3934 | addi 3,31,ld0@got@tlsgd | |
3935 | bl __tls_get_addr | |
3936 | addi 3,31,x1@got@tlsld | |
3937 | bl __tls_get_addr | |
3938 | addi 9,3,x1@dtprel | |
3939 | addis 9,3,x2@dtprel@ha | |
3940 | addi 9,9,x2@dtprel@l | |
3941 | lwz 9,x3@got@tprel(31) | |
3942 | add 9,9,x@tls | |
3943 | addi 9,2,x1@tprel | |
3944 | addis 9,2,x2@tprel@ha | |
3945 | addi 9,9,x2@tprel@l' | |
3946 | tls_first_major=2 | |
3947 | tls_first_minor=14 | |
3948 | tls_as_opt="-a32 --fatal-warnings" | |
3949 | ;; | |
09cae750 PD |
3950 | riscv*-*-*) |
3951 | conftest_s=' | |
3952 | .section .tdata,"awT",@progbits | |
3953 | x: .word 2 | |
3954 | .text | |
3955 | la.tls.gd a0,x | |
3956 | call __tls_get_addr' | |
3957 | tls_first_major=2 | |
3958 | tls_first_minor=21 | |
3959 | tls_as_opt='--fatal-warnings' | |
3960 | ;; | |
fd3cd001 UW |
3961 | s390-*-*) |
3962 | conftest_s=' | |
3963 | .section ".tdata","awT",@progbits | |
3964 | foo: .long 25 | |
3965 | .text | |
3966 | .long foo@TLSGD | |
3967 | .long foo@TLSLDM | |
3968 | .long foo@DTPOFF | |
3969 | .long foo@NTPOFF | |
3970 | .long foo@GOTNTPOFF | |
3971 | .long foo@INDNTPOFF | |
3972 | l %r1,foo@GOTNTPOFF(%r12) | |
3973 | l %r1,0(%r1):tls_load:foo | |
3974 | bas %r14,0(%r1,%r13):tls_gdcall:foo | |
3975 | bas %r14,0(%r1,%r13):tls_ldcall:foo' | |
3976 | tls_first_major=2 | |
3977 | tls_first_minor=14 | |
2f3321ca | 3978 | tls_as_opt="-m31 --fatal-warnings" |
fd3cd001 UW |
3979 | ;; |
3980 | s390x-*-*) | |
3981 | conftest_s=' | |
3982 | .section ".tdata","awT",@progbits | |
3983 | foo: .long 25 | |
3984 | .text | |
3985 | .quad foo@TLSGD | |
3986 | .quad foo@TLSLDM | |
3987 | .quad foo@DTPOFF | |
3988 | .quad foo@NTPOFF | |
3989 | .quad foo@GOTNTPOFF | |
3990 | lg %r1,foo@GOTNTPOFF(%r12) | |
3991 | larl %r1,foo@INDNTPOFF | |
3992 | brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo | |
3993 | brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' | |
3994 | tls_first_major=2 | |
3995 | tls_first_minor=14 | |
2f3321ca | 3996 | tls_as_opt="-m64 -Aesame --fatal-warnings" |
fd3cd001 | 3997 | ;; |
311adabe | 3998 | sh-*-* | sh[123456789lbe]*-*-*) |
9ff13962 KK |
3999 | conftest_s=' |
4000 | .section ".tdata","awT",@progbits | |
4001 | foo: .long 25 | |
4002 | .text | |
4003 | .long foo@TLSGD | |
4004 | .long foo@TLSLDM | |
4005 | .long foo@DTPOFF | |
4006 | .long foo@GOTTPOFF | |
4007 | .long foo@TPOFF' | |
4008 | tls_first_major=2 | |
4009 | tls_first_minor=13 | |
2f3321ca | 4010 | tls_as_opt=--fatal-warnings |
9ff13962 | 4011 | ;; |
5751a10b | 4012 | sparc*-*-*) |
2f3321ca EB |
4013 | case "$target" in |
4014 | sparc*-sun-solaris2.*) | |
4015 | on_solaris=yes | |
4016 | ;; | |
4017 | *) | |
4018 | on_solaris=no | |
4019 | ;; | |
4020 | esac | |
4021 | if test x$on_solaris = xyes && test x$gas_flag = xno; then | |
4022 | conftest_s=' | |
16c9d3b1 | 4023 | .section ".tdata",#alloc,#write,#tls' |
2f3321ca EB |
4024 | tls_first_major=0 |
4025 | tls_first_minor=0 | |
4026 | else | |
4027 | conftest_s=' | |
16c9d3b1 RO |
4028 | .section ".tdata","awT",@progbits' |
4029 | tls_first_major=2 | |
4030 | tls_first_minor=14 | |
4031 | tls_as_opt="-32 --fatal-warnings" | |
4032 | fi | |
4033 | conftest_s="$conftest_s | |
5751a10b JJ |
4034 | foo: .long 25 |
4035 | .text | |
4036 | sethi %tgd_hi22(foo), %o0 | |
4037 | add %o0, %tgd_lo10(foo), %o1 | |
4038 | add %l7, %o1, %o0, %tgd_add(foo) | |
4039 | call __tls_get_addr, %tgd_call(foo) | |
4040 | sethi %tldm_hi22(foo), %l1 | |
4041 | add %l1, %tldm_lo10(foo), %l2 | |
4042 | add %l7, %l2, %o0, %tldm_add(foo) | |
4043 | call __tls_get_addr, %tldm_call(foo) | |
4044 | sethi %tldo_hix22(foo), %l3 | |
4045 | xor %l3, %tldo_lox10(foo), %l4 | |
4046 | add %o0, %l4, %l5, %tldo_add(foo) | |
4047 | sethi %tie_hi22(foo), %o3 | |
4048 | add %o3, %tie_lo10(foo), %o3 | |
4049 | ld [%l7 + %o3], %o2, %tie_ld(foo) | |
4050 | add %g7, %o2, %o4, %tie_add(foo) | |
4051 | sethi %tle_hix22(foo), %l1 | |
4052 | xor %l1, %tle_lox10(foo), %o5 | |
16c9d3b1 | 4053 | ld [%g7 + %o5], %o1" |
5751a10b | 4054 | ;; |
dd552284 WL |
4055 | tilepro*-*-*) |
4056 | conftest_s=' | |
4057 | .section ".tdata","awT",@progbits | |
4058 | foo: .long 25 | |
4059 | .text | |
4060 | addli r0, zero, tls_gd(foo) | |
4061 | auli r0, zero, tls_gd_ha16(foo) | |
4062 | addli r0, r0, tls_gd_lo16(foo) | |
4063 | jal __tls_get_addr | |
4064 | addli r0, zero, tls_ie(foo) | |
4065 | auli r0, r0, tls_ie_ha16(foo) | |
4066 | addli r0, r0, tls_ie_lo16(foo)' | |
4067 | tls_first_major=2 | |
4068 | tls_first_minor=22 | |
4069 | tls_as_opt="--fatal-warnings" | |
4070 | ;; | |
4071 | tilegx*-*-*) | |
4072 | conftest_s=' | |
4073 | .section ".tdata","awT",@progbits | |
4074 | foo: .long 25 | |
4075 | .text | |
4076 | shl16insli r0, zero, hw0_last_tls_gd(foo) | |
4077 | shl16insli r0, zero, hw1_last_tls_gd(foo) | |
4078 | shl16insli r0, r0, hw0_tls_gd(foo) | |
4079 | jal __tls_get_addr | |
4080 | shl16insli r0, zero, hw1_last_tls_ie(foo) | |
4081 | shl16insli r0, r0, hw0_tls_ie(foo)' | |
4082 | tls_first_major=2 | |
4083 | tls_first_minor=22 | |
4084 | tls_as_opt="--fatal-warnings" | |
4085 | ;; | |
6a7a462c BW |
4086 | xtensa*-*-*) |
4087 | conftest_s=' | |
4088 | .section ".tdata","awT",@progbits | |
4089 | foo: .long 25 | |
4090 | .text | |
4091 | movi a8, foo@TLSFUNC | |
4092 | movi a10, foo@TLSARG | |
4093 | callx8.tls a8, foo@TLSCALL' | |
4094 | tls_first_major=2 | |
4095 | tls_first_minor=19 | |
4096 | ;; | |
5751a10b | 4097 | changequote([,])dnl |
f996902d | 4098 | esac |
8dea1cca DD |
4099 | set_have_as_tls=no |
4100 | if test "x$enable_tls" = xno ; then | |
4101 | : # TLS explicitly disabled. | |
4102 | elif test "x$enable_tls" = xyes ; then | |
4103 | set_have_as_tls=yes # TLS explicitly enabled. | |
4104 | elif test -z "$tls_first_major"; then | |
8ada417f ZW |
4105 | : # If we don't have a check, assume no support. |
4106 | else | |
4107 | gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls, | |
2f3321ca | 4108 | [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],, |
8dea1cca DD |
4109 | [set_have_as_tls=yes]) |
4110 | fi | |
4111 | if test $set_have_as_tls = yes ; then | |
4112 | AC_DEFINE(HAVE_AS_TLS, 1, | |
16c9d3b1 | 4113 | [Define if your assembler and linker support thread-local storage.]) |
f996902d | 4114 | fi |
8ada417f ZW |
4115 | |
4116 | # Target-specific assembler checks. | |
f996902d | 4117 | |
7e9d8517 L |
4118 | AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option) |
4119 | gcc_cv_ld_static_dynamic=no | |
c6092243 RO |
4120 | gcc_cv_ld_static_option='-Bstatic' |
4121 | gcc_cv_ld_dynamic_option='-Bdynamic' | |
7e9d8517 | 4122 | if test $in_tree_ld = yes ; then |
83f0ccb8 | 4123 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2; then |
7e9d8517 L |
4124 | gcc_cv_ld_static_dynamic=yes |
4125 | fi | |
4126 | elif test x$gcc_cv_ld != x; then | |
bb127cd8 | 4127 | # Check if linker supports -Bstatic/-Bdynamic option |
8dc877eb RO |
4128 | if $gcc_cv_ld --help 2>&1 | grep -- -Bstatic > /dev/null \ |
4129 | && $gcc_cv_ld --help 2>&1 | grep -- -Bdynamic > /dev/null; then | |
bb127cd8 RO |
4130 | gcc_cv_ld_static_dynamic=yes |
4131 | else | |
4132 | case "$target" in | |
478f60f9 MH |
4133 | # AIX ld uses -b flags |
4134 | *-*-aix4.[[23]]* | *-*-aix[[5-9]]*) | |
4135 | gcc_cv_ld_static_dynamic=yes | |
4136 | gcc_cv_ld_static_option="-bstatic" | |
4137 | gcc_cv_ld_dynamic_option="-bdynamic" | |
4138 | ;; | |
f903e000 SE |
4139 | # HP-UX ld uses -a flags to select between shared and archive. |
4140 | *-*-hpux*) | |
4141 | if test x"$gnu_ld" = xno; then | |
4142 | gcc_cv_ld_static_dynamic=yes | |
4143 | gcc_cv_ld_static_option="-aarchive_shared" | |
4144 | gcc_cv_ld_dynamic_option="-adefault" | |
4145 | fi | |
4146 | ;; | |
bb127cd8 RO |
4147 | # Solaris 2 ld always supports -Bstatic/-Bdynamic. |
4148 | *-*-solaris2*) | |
4149 | gcc_cv_ld_static_dynamic=yes | |
4150 | ;; | |
4151 | esac | |
4152 | fi | |
7e9d8517 L |
4153 | fi |
4154 | if test x"$gcc_cv_ld_static_dynamic" = xyes; then | |
4155 | AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1, | |
c6092243 RO |
4156 | [Define if your linker supports -Bstatic/-Bdynamic or equivalent options.]) |
4157 | AC_DEFINE_UNQUOTED(LD_STATIC_OPTION, "$gcc_cv_ld_static_option", | |
4158 | [Define to the linker option to disable use of shared objects.]) | |
4159 | AC_DEFINE_UNQUOTED(LD_DYNAMIC_OPTION, "$gcc_cv_ld_dynamic_option", | |
4160 | [Define to the linker option to enable use of shared objects.]) | |
7e9d8517 L |
4161 | fi |
4162 | AC_MSG_RESULT($gcc_cv_ld_static_dynamic) | |
4163 | ||
deb3da39 DM |
4164 | AC_MSG_CHECKING(linker --version-script option) |
4165 | gcc_cv_ld_version_script=no | |
4166 | ld_version_script_option='' | |
4167 | if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then | |
4168 | gcc_cv_ld_version_script=yes | |
4169 | ld_version_script_option='--version-script' | |
4170 | elif test x$gcc_cv_ld != x; then | |
4171 | case "$target" in | |
4172 | # Solaris 2 ld always supports -M. It also supports a subset of | |
4173 | # --version-script since Solaris 11.4, but requires | |
4174 | # -z gnu-version-script-compat to activate. | |
4175 | *-*-solaris2*) | |
4176 | gcc_cv_ld_version_script=yes | |
4177 | ld_version_script_option='-M' | |
4178 | ;; | |
4179 | esac | |
4180 | fi | |
4181 | # Don't AC_DEFINE result, only used in jit/Make-lang.in so far. | |
4182 | AC_MSG_RESULT($gcc_cv_ld_version_script) | |
4183 | AC_SUBST(ld_version_script_option) | |
4184 | ||
4185 | AC_MSG_CHECKING(linker soname option) | |
4186 | gcc_cv_ld_soname=no | |
4187 | if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then | |
4188 | gcc_cv_ld_soname=yes | |
4189 | ld_soname_option='-soname' | |
4190 | elif test x$gcc_cv_ld != x; then | |
4191 | case "$target" in | |
4192 | *-*-darwin*) | |
4193 | gcc_cv_ld_soname=yes | |
4194 | ld_soname_option='-install_name' | |
4195 | ;; | |
ea143da7 RO |
4196 | # Solaris 2 ld always supports -h. It also supports --soname for GNU |
4197 | # ld compatiblity since some Solaris 10 update. | |
4198 | *-*-solaris2*) | |
4199 | gcc_cv_ld_soname=yes | |
4200 | ld_soname_option='-h' | |
4201 | ;; | |
deb3da39 DM |
4202 | esac |
4203 | fi | |
4204 | # Don't AC_DEFINE result, only used in jit/Make-lang.in so far. | |
4205 | AC_MSG_RESULT($gcc_cv_ld_soname) | |
4206 | AC_SUBST(ld_soname_option) | |
4207 | ||
d594623a L |
4208 | if test x"$demangler_in_ld" = xyes; then |
4209 | AC_MSG_CHECKING(linker --demangle support) | |
4210 | gcc_cv_ld_demangle=no | |
4211 | if test $in_tree_ld = yes; then | |
4212 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 14 -o "$gcc_cv_gld_major_version" -gt 2; then \ | |
4213 | gcc_cv_ld_demangle=yes | |
4214 | fi | |
4215 | elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then | |
4216 | # Check if the GNU linker supports --demangle option | |
8dc877eb | 4217 | if $gcc_cv_ld --help 2>&1 | grep no-demangle > /dev/null; then |
d594623a L |
4218 | gcc_cv_ld_demangle=yes |
4219 | fi | |
4220 | fi | |
4221 | if test x"$gcc_cv_ld_demangle" = xyes; then | |
4222 | AC_DEFINE(HAVE_LD_DEMANGLE, 1, | |
4223 | [Define if your linker supports --demangle option.]) | |
4224 | fi | |
4225 | AC_MSG_RESULT($gcc_cv_ld_demangle) | |
4226 | fi | |
4227 | ||
96bdf9b4 | 4228 | AC_MSG_CHECKING(linker plugin support) |
55b46574 | 4229 | gcc_cv_lto_plugin=0 |
f3d533d3 | 4230 | if test -f liblto_plugin.la; then |
df33b41f RO |
4231 | save_ld_ver="$ld_ver" |
4232 | save_ld_vers_major="$ld_vers_major" | |
4233 | save_ld_vers_minor="$ld_vers_minor" | |
4234 | save_ld_is_gold="$ld_is_gold" | |
4235 | ||
4236 | ld_is_gold=no | |
55b46574 | 4237 | |
df33b41f RO |
4238 | if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then |
4239 | ld_ver="GNU ld" | |
4240 | # FIXME: ld_is_gold? | |
4241 | ld_vers_major="$gcc_cv_gld_major_version" | |
4242 | ld_vers_minor="$gcc_cv_gld_minor_version" | |
4243 | else | |
4244 | # Determine plugin linker version. | |
4245 | # FIXME: Partial duplicate from above, generalize. | |
4246 | changequote(,)dnl | |
4247 | ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q` | |
4248 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
4249 | if echo "$ld_ver" | grep "GNU gold" > /dev/null; then | |
4250 | ld_is_gold=yes | |
4251 | ld_vers=`echo $ld_ver | sed -n \ | |
4252 | -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'` | |
4253 | else | |
4254 | ld_vers=`echo $ld_ver | sed -n \ | |
4255 | -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'` | |
4256 | fi | |
4257 | ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` | |
4258 | ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` | |
55b46574 | 4259 | fi |
df33b41f RO |
4260 | changequote([,])dnl |
4261 | fi | |
4262 | ||
4263 | # Determine plugin support. | |
4264 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
55b46574 RO |
4265 | # Require GNU ld or gold 2.21+ for plugin support by default. |
4266 | if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then | |
4267 | gcc_cv_lto_plugin=2 | |
4268 | # Allow -fuse-linker-plugin to enable plugin support in GNU gold 2.20. | |
4269 | elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 20; then | |
4270 | gcc_cv_lto_plugin=1 | |
96bdf9b4 | 4271 | fi |
96bdf9b4 | 4272 | fi |
df33b41f RO |
4273 | |
4274 | ld_ver="$save_ld_ver" | |
4275 | ld_vers_major="$save_ld_vers_major" | |
4276 | ld_vers_minor="$save_ld_vers_minor" | |
4277 | ld_is_gold="$save_ld_is_gold" | |
96bdf9b4 | 4278 | fi |
55b46574 RO |
4279 | AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin, |
4280 | [Define to the level of your linker's plugin support.]) | |
96bdf9b4 JH |
4281 | AC_MSG_RESULT($gcc_cv_lto_plugin) |
4282 | ||
b410cf1d IS |
4283 | # Target OS-specific assembler checks. |
4284 | ||
4285 | case "$target_os" in | |
4286 | darwin*) | |
4287 | gcc_GAS_CHECK_FEATURE([-mmacosx-version-min option], | |
4288 | gcc_cv_as_mmacosx_version_min,, | |
4289 | [-mmacosx-version-min=10.1], [.text],, | |
4290 | [AC_DEFINE(HAVE_AS_MMACOSX_VERSION_MIN_OPTION, 1, | |
4291 | [Define if your Mac OS X assembler supports the -mmacos-version-min option.])]) | |
4292 | ;; | |
4293 | esac | |
4294 | ||
4295 | # Target CPU-specific assembler checks. | |
4296 | ||
275b60d6 | 4297 | case "$target" in |
63892fa2 KV |
4298 | aarch64*-*-*) |
4299 | gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,, | |
4300 | [-mabi=lp64], [.text],,,) | |
4301 | if test x$gcc_cv_as_aarch64_mabi = xyes; then | |
4302 | AC_DEFINE(HAVE_AS_MABI_OPTION, 1, | |
4303 | [Define if your assembler supports the -mabi option.]) | |
4304 | else | |
4305 | if test x$with_abi = xilp32; then | |
4306 | AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\ | |
4307 | Upgrade the Assembler.]) | |
4308 | fi | |
4309 | if test x"$with_multilib_list" = xdefault; then | |
4310 | TM_MULTILIB_CONFIG=lp64 | |
4311 | else | |
4312 | aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'` | |
4313 | for aarch64_multilib in ${aarch64_multilibs}; do | |
4314 | case ${aarch64_multilib} in | |
4315 | ilp32) | |
4316 | AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\ | |
4317 | Upgrade the Assembler.]) | |
4318 | ;; | |
4319 | *) | |
4320 | ;; | |
4321 | esac | |
4322 | done | |
4323 | fi | |
4324 | fi | |
34ecdb0f JW |
4325 | # Check if we have binutils support for relocations types needed by -fpic |
4326 | gcc_GAS_CHECK_FEATURE([-fpic relocs], gcc_cv_as_aarch64_picreloc,,, | |
4327 | [ | |
4328 | .text | |
4329 | ldr x0, [[x2, #:gotpage_lo15:globalsym]] | |
4330 | ],,[AC_DEFINE(HAVE_AS_SMALL_PIC_RELOCS, 1, | |
4331 | [Define if your assembler supports relocs needed by -fpic.])]) | |
c7ff4f0f SD |
4332 | # Enable Branch Target Identification Mechanism and Return Address |
4333 | # Signing by default. | |
4334 | AC_ARG_ENABLE(standard-branch-protection, | |
4335 | [ | |
4336 | AS_HELP_STRING([--enable-standard-branch-protection], | |
4337 | [enable Branch Target Identification Mechanism and Return Address Signing by default for AArch64]) | |
4338 | AS_HELP_STRING([--disable-standard-branch-protection], | |
4339 | [disable Branch Target Identification Mechanism and Return Address Signing by default for AArch64]) | |
4340 | ], | |
4341 | [ | |
4342 | case $enableval in | |
4343 | yes) | |
4344 | tm_defines="${tm_defines} TARGET_ENABLE_BTI=1 TARGET_ENABLE_PAC_RET=1" | |
4345 | ;; | |
4346 | no) | |
4347 | ;; | |
4348 | *) | |
4349 | AC_MSG_ERROR(['$enableval' is an invalid value for --enable-standard-branch-protection.\ | |
4350 | Valid choices are 'yes' and 'no'.]) | |
4351 | ;; | |
4352 | esac | |
4353 | ], | |
4354 | []) | |
5e396da6 KT |
4355 | # Enable default workaround for AArch64 Cortex-A53 erratum 835769. |
4356 | AC_ARG_ENABLE(fix-cortex-a53-835769, | |
4357 | [ | |
4358 | AS_HELP_STRING([--enable-fix-cortex-a53-835769], | |
4359 | [enable workaround for AArch64 Cortex-A53 erratum 835769 by default]) | |
4360 | AS_HELP_STRING([--disable-fix-cortex-a53-835769], | |
4361 | [disable workaround for AArch64 Cortex-A53 erratum 835769 by default]) | |
4362 | ], | |
4363 | [ | |
4364 | case $enableval in | |
4365 | yes) | |
4366 | tm_defines="${tm_defines} TARGET_FIX_ERR_A53_835769_DEFAULT=1" | |
4367 | ;; | |
4368 | no) | |
4369 | ;; | |
4370 | *) | |
4371 | AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-835769.\ | |
4372 | Valid choices are 'yes' and 'no'.]) | |
4373 | ;; | |
4374 | ||
4375 | esac | |
4376 | ], | |
4377 | []) | |
bf05ef76 YR |
4378 | # Enable default workaround for AArch64 Cortex-A53 erratum 843419. |
4379 | AC_ARG_ENABLE(fix-cortex-a53-843419, | |
4380 | [ | |
4381 | AS_HELP_STRING([--enable-fix-cortex-a53-843419], | |
4382 | [enable workaround for AArch64 Cortex-A53 erratum 843419 by default]) | |
4383 | AS_HELP_STRING([--disable-fix-cortex-a53-843419], | |
4384 | [disable workaround for AArch64 Cortex-A53 erratum 843419 by default]) | |
4385 | ], | |
4386 | [ | |
4387 | case $enableval in | |
4388 | yes) | |
4389 | tm_defines="${tm_defines} TARGET_FIX_ERR_A53_843419_DEFAULT=1" | |
4390 | ;; | |
4391 | no) | |
4392 | ;; | |
4393 | *) | |
4394 | AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-843419.\ | |
4395 | Valid choices are 'yes' and 'no'.]) | |
4396 | ;; | |
4397 | ||
4398 | esac | |
4399 | ], | |
4400 | []) | |
63892fa2 KV |
4401 | ;; |
4402 | ||
3a37b08e | 4403 | # All TARGET_ABI_OSF targets. |
5c30094f | 4404 | alpha*-*-linux* | alpha*-*-*bsd*) |
8ada417f ZW |
4405 | gcc_GAS_CHECK_FEATURE([explicit relocation support], |
4406 | gcc_cv_as_alpha_explicit_relocs, [2,12,0],, | |
4407 | [ .set nomacro | |
3a37b08e RH |
4408 | .text |
4409 | extbl $3, $2, $3 !lituse_bytoff!1 | |
4410 | ldq $2, a($29) !literal!1 | |
4411 | ldq $4, b($29) !literal!2 | |
4412 | ldq_u $3, 0($2) !lituse_base!1 | |
4413 | ldq $27, f($29) !literal!5 | |
4414 | jsr $26, ($27), f !lituse_jsr!5 | |
4415 | ldah $29, 0($26) !gpdisp!3 | |
4416 | lda $0, c($29) !gprel | |
4417 | ldah $1, d($29) !gprelhigh | |
4418 | lda $1, d($1) !gprellow | |
8ada417f ZW |
4419 | lda $29, 0($29) !gpdisp!3],, |
4420 | [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1, | |
4421 | [Define if your assembler supports explicit relocations.])]) | |
d006f5eb RH |
4422 | gcc_GAS_CHECK_FEATURE([jsrdirect relocation support], |
4423 | gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],, | |
4424 | [ .set nomacro | |
4425 | .text | |
4426 | ldq $27, a($29) !literal!1 | |
4427 | jsr $26, ($27), a !lituse_jsrdirect!1],, | |
4428 | [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1, | |
4429 | [Define if your assembler supports the lituse_jsrdirect relocation.])]) | |
3a37b08e | 4430 | ;; |
e95b1e6a | 4431 | |
0c9dc4ae GJL |
4432 | avr-*-*) |
4433 | gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax,, | |
4434 | [--mlink-relax], [.text],, | |
4435 | [AC_DEFINE(HAVE_AS_AVR_MLINK_RELAX_OPTION, 1, | |
4436 | [Define if your avr assembler supports --mlink-relax option.])]) | |
4437 | ||
4438 | gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,, | |
4439 | [-mrmw], [.text],, | |
4440 | [AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1, | |
4441 | [Define if your avr assembler supports -mrmw option.])]) | |
3266ddb3 | 4442 | |
63866e04 GJL |
4443 | gcc_GAS_CHECK_FEATURE([__gcc_isr pseudo instruction], |
4444 | gcc_cv_as_avr_mgccisr,, | |
4445 | [-mgcc-isr], [.text | |
4446 | __gcc_isr 1 | |
4447 | __gcc_isr 2 | |
4448 | __gcc_isr 0,r24 | |
4449 | ],, | |
4450 | [AC_DEFINE(HAVE_AS_AVR_MGCCISR_OPTION, 1, | |
4451 | [Define if your avr assembler supports -mgcc-isr option.])]) | |
4452 | ||
3266ddb3 GJL |
4453 | # Check how default linker description file implements .rodata for |
4454 | # avrxmega3 (PR21472). avr-gcc assumes .rodata is *not* loaded to | |
4455 | # RAM so avr-gcc skips __do_copy_data for .rodata objects. | |
4456 | AC_MSG_CHECKING(binutils for avrxmega3 .rodata support) | |
4457 | cat > conftest.s <<EOF | |
4458 | .section .rodata,"a",@progbits | |
4459 | .global xxvaryy | |
4460 | ;; avr-nm should print "... R xxvaryy", not "... D xxvaryy". | |
4461 | xxvaryy: | |
4462 | .word 1 | |
4463 | EOF | |
4464 | rm -f conftest.nm | |
4465 | AC_TRY_COMMAND([$gcc_cv_as -mmcu=avrxmega3 conftest.s -o conftest.o]) | |
4466 | AC_TRY_COMMAND([$gcc_cv_ld -mavrxmega3 conftest.o -o conftest.elf]) | |
4467 | AC_TRY_COMMAND([$gcc_cv_nm conftest.elf > conftest.nm]) | |
98f9d0ca | 4468 | if test -s conftest.nm |
3266ddb3 GJL |
4469 | then |
4470 | if grep ' R xxvaryy' conftest.nm > /dev/null; then | |
4471 | AC_MSG_RESULT(yes) | |
98f9d0ca GJL |
4472 | AC_DEFINE(HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH, 1, |
4473 | [Define if your default avr linker script for avrxmega3 leaves .rodata in flash.]) | |
3266ddb3 GJL |
4474 | else |
4475 | AC_MSG_RESULT(no: avrxmega3 .rodata located in RAM) | |
4476 | echo "$as_me: nm output was" >&AS_MESSAGE_LOG_FD | |
4477 | cat conftest.nm >&AS_MESSAGE_LOG_FD | |
3266ddb3 | 4478 | avr_ld_ver="`$gcc_cv_ld -v | sed -e 's:^.* ::'`" |
98f9d0ca | 4479 | AC_MSG_WARN([[support for avrxmega3 .rodata in flash needs Binutils 2.29 or higher (have $avr_ld_ver)]]) |
3266ddb3 GJL |
4480 | fi |
4481 | else | |
4482 | AC_MSG_RESULT(test failed) | |
4483 | echo "$as_me: failed program was" >&AS_MESSAGE_LOG_FD | |
4484 | cat conftest.s >&AS_MESSAGE_LOG_FD | |
98f9d0ca | 4485 | AC_MSG_WARN([[see `config.log' for details]]) |
3266ddb3 | 4486 | fi |
98f9d0ca | 4487 | rm -f conftest.s conftest.o conftest.elf conftest.nm |
0c9dc4ae GJL |
4488 | ;; |
4489 | ||
682a45fc HPN |
4490 | cris-*-*) |
4491 | gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option], | |
4492 | gcc_cv_as_cris_no_mul_bug,[2,15,91], | |
4493 | [-no-mul-bug-abort], [.text],, | |
4494 | [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1, | |
4495 | [Define if your assembler supports the -no-mul-bug-abort option.])]) | |
4496 | ;; | |
4497 | ||
8ada417f | 4498 | sparc*-*-*) |
8ada417f ZW |
4499 | gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,, |
4500 | [-relax], [.text],, | |
4501 | [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1, | |
4502 | [Define if your assembler supports -relax option.])]) | |
4503 | ||
878ee0ab DM |
4504 | gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs], |
4505 | gcc_cv_as_sparc_gotdata_op,, | |
4506 | [-K PIC], | |
4507 | [.text | |
6d7b45ad | 4508 | .align 4 |
878ee0ab DM |
4509 | foo: |
4510 | nop | |
4511 | bar: | |
4512 | sethi %gdop_hix22(foo), %g1 | |
4513 | xor %g1, %gdop_lox10(foo), %g1 | |
4514 | ld [[%l7 + %g1]], %g2, %gdop(foo)], | |
4515 | [if test x$gcc_cv_ld != x \ | |
46bc665f | 4516 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then |
7673c962 RO |
4517 | if test x$gcc_cv_objdump != x; then |
4518 | if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \ | |
4519 | | grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then | |
46bc665f | 4520 | gcc_cv_as_sparc_gotdata_op=no |
7673c962 | 4521 | else |
46bc665f | 4522 | gcc_cv_as_sparc_gotdata_op=yes |
46bc665f | 4523 | fi |
46bc665f | 4524 | fi |
878ee0ab DM |
4525 | fi |
4526 | rm -f conftest], | |
4527 | [AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1, | |
4528 | [Define if your assembler and linker support GOTDATA_OP relocs.])]) | |
4529 | ||
8ada417f ZW |
4530 | gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs], |
4531 | gcc_cv_as_sparc_ua_pcrel,, | |
4532 | [-K PIC], | |
4533 | [.text | |
4534 | foo: | |
4535 | nop | |
4536 | .data | |
4537 | .align 4 | |
4538 | .byte 0 | |
4539 | .uaword %r_disp32(foo)], | |
4540 | [if test x$gcc_cv_ld != x \ | |
4541 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then | |
4542 | gcc_cv_as_sparc_ua_pcrel=yes | |
4543 | fi | |
4544 | rm -f conftest], | |
4545 | [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, | |
17e9e88c | 4546 | [Define if your assembler and linker support unaligned PC relative relocs.]) |
cf7b8b0d | 4547 | |
8ada417f ZW |
4548 | gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols], |
4549 | gcc_cv_as_sparc_ua_pcrel_hidden,, | |
4550 | [-K PIC], | |
4551 | [.data | |
4552 | .align 4 | |
4553 | .byte 0x31 | |
4554 | .uaword %r_disp32(foo) | |
4555 | .byte 0x32, 0x33, 0x34 | |
4556 | .global foo | |
4557 | .hidden foo | |
4558 | foo: | |
4559 | .skip 4], | |
4560 | [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ | |
4561 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \ | |
4562 | && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \ | |
4563 | | grep ' 31000000 07323334' > /dev/null 2>&1; then | |
4564 | if $gcc_cv_objdump -R conftest 2> /dev/null \ | |
4565 | | grep 'DISP32' > /dev/null 2>&1; then | |
4566 | : | |
22252625 | 4567 | else |
8ada417f | 4568 | gcc_cv_as_sparc_ua_pcrel_hidden=yes |
5b68c389 | 4569 | fi |
8ada417f ZW |
4570 | fi |
4571 | rm -f conftest], | |
4572 | [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1, | |
4573 | [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])]) | |
4574 | ]) # unaligned pcrel relocs | |
4575 | ||
4576 | gcc_GAS_CHECK_FEATURE([offsetable %lo()], | |
4577 | gcc_cv_as_sparc_offsetable_lo10,, | |
4578 | [-xarch=v9], | |
4579 | [.text | |
4580 | or %g1, %lo(ab) + 12, %g1 | |
4581 | or %g1, %lo(ab + 12), %g1], | |
4582 | [if test x$gcc_cv_objdump != x \ | |
ecb0ccbc | 4583 | && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \ |
8ada417f | 4584 | | grep ' 82106000 82106000' > /dev/null 2>&1; then |
1b5c0152 | 4585 | gcc_cv_as_sparc_offsetable_lo10=yes |
8ada417f ZW |
4586 | fi], |
4587 | [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1, | |
4588 | [Define if your assembler supports offsetable %lo().])]) | |
e8b141b5 DM |
4589 | |
4590 | gcc_GAS_CHECK_FEATURE([FMAF, HPC, and VIS 3.0 instructions], | |
4591 | gcc_cv_as_sparc_fmaf,, | |
4592 | [-xarch=v9d], | |
4593 | [.text | |
26e2f443 DM |
4594 | .register %g2, #scratch |
4595 | .register %g3, #scratch | |
e8b141b5 DM |
4596 | .align 4 |
4597 | fmaddd %f0, %f2, %f4, %f6 | |
4598 | addxccc %g1, %g2, %g3 | |
4599 | fsrl32 %f2, %f4, %f8 | |
4600 | fnaddd %f10, %f12, %f14],, | |
4601 | [AC_DEFINE(HAVE_AS_FMAF_HPC_VIS3, 1, | |
4602 | [Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions.])]) | |
8b98b5fd DM |
4603 | |
4604 | gcc_GAS_CHECK_FEATURE([SPARC4 instructions], | |
4605 | gcc_cv_as_sparc_sparc4,, | |
4606 | [-xarch=sparc4], | |
4607 | [.text | |
4608 | .register %g2, #scratch | |
4609 | .register %g3, #scratch | |
4610 | .align 4 | |
4611 | cxbe %g2, %g3, 1f | |
4612 | 1: cwbneg %g2, %g3, 1f | |
4613 | 1: sha1 | |
4614 | md5 | |
4615 | aes_kexpand0 %f4, %f6, %f8 | |
4616 | des_round %f38, %f40, %f42, %f44 | |
4617 | camellia_f %f54, %f56, %f58, %f60 | |
4618 | kasumi_fi_xor %f46, %f48, %f50, %f52],, | |
4619 | [AC_DEFINE(HAVE_AS_SPARC4, 1, | |
4620 | [Define if your assembler supports SPARC4 instructions.])]) | |
1f65ae7a | 4621 | |
690f24b7 JM |
4622 | gcc_GAS_CHECK_FEATURE([SPARC5 and VIS 4.0 instructions], |
4623 | gcc_cv_as_sparc_sparc5,, | |
4624 | [-xarch=sparc5], | |
4625 | [.text | |
4626 | .register %g2, #scratch | |
4627 | .register %g3, #scratch | |
4628 | .align 4 | |
4629 | subxc %g1, %g2, %g3 | |
4630 | fpadd8 %f0, %f2, %f4],, | |
4631 | [AC_DEFINE(HAVE_AS_SPARC5_VIS4, 1, | |
4632 | [Define if your assembler supports SPARC5 and VIS 4.0 instructions.])]) | |
4633 | ||
bcc3c3f1 JM |
4634 | gcc_GAS_CHECK_FEATURE([SPARC6 instructions], |
4635 | gcc_cv_as_sparc_sparc6,, | |
4636 | [-xarch=sparc6], | |
4637 | [.text | |
4638 | .register %g2, #scratch | |
4639 | .register %g3, #scratch | |
4640 | .align 4 | |
4641 | rd %entropy, %g1 | |
4642 | fpsll64x %f0, %f2, %f4],, | |
4643 | [AC_DEFINE(HAVE_AS_SPARC6, 1, | |
4644 | [Define if your assembler supports SPARC6 instructions.])]) | |
4645 | ||
1f65ae7a EB |
4646 | gcc_GAS_CHECK_FEATURE([LEON instructions], |
4647 | gcc_cv_as_sparc_leon,, | |
4648 | [-Aleon], | |
4649 | [.text | |
4650 | .register %g2, #scratch | |
4651 | .register %g3, #scratch | |
4652 | .align 4 | |
4653 | smac %g2, %g3, %g1 | |
4654 | umac %g2, %g3, %g1 | |
ba21a04a | 4655 | casa [[%g2]] 0xb, %g3, %g1],, |
1f65ae7a EB |
4656 | [AC_DEFINE(HAVE_AS_LEON, 1, |
4657 | [Define if your assembler supports LEON instructions.])]) | |
1cb36a98 RH |
4658 | ;; |
4659 | ||
4660 | changequote(,)dnl | |
c307e6dd | 4661 | i[34567]86-*-* | x86_64-*-*) |
1cb36a98 | 4662 | changequote([,])dnl |
f7e413e2 DK |
4663 | case $target_os in |
4664 | cygwin*) | |
4665 | # Full C++ conformance when using a shared libstdc++-v3 requires some | |
4666 | # support from the Cygwin DLL, which in more recent versions exports | |
4667 | # wrappers to aid in interposing and redirecting operators new, delete, | |
4668 | # etc., as per n2800 #17.6.4.6 [replacement.functions]. Check if we | |
4669 | # are configuring for a version of Cygwin that exports the wrappers. | |
b802ae5c | 4670 | if test x$host = x$target && test x$host_cpu = xi686; then |
f7e413e2 DK |
4671 | AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no]) |
4672 | else | |
4673 | # Can't check presence of libc functions during cross-compile, so | |
4674 | # we just have to assume we're building for an up-to-date target. | |
4675 | gcc_ac_cygwin_dll_wrappers=yes | |
4676 | fi | |
4677 | AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS, | |
4678 | [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`], | |
4679 | [Define if you want to generate code by default that assumes that the | |
4680 | Cygwin DLL exports wrappers to support libstdc++ function replacement.]) | |
4681 | esac | |
d38bc601 | 4682 | case $target_os in |
ee2499b4 | 4683 | cygwin* | pe | mingw32*) |
233215fe DK |
4684 | # Recent binutils allows the three-operand form of ".comm" on PE. This |
4685 | # definition is used unconditionally to initialise the default state of | |
4686 | # the target option variable that governs usage of the feature. | |
4687 | gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align, | |
4688 | [2,19,52],,[.comm foo,1,32]) | |
4689 | AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM, | |
4690 | [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`], | |
4691 | [Define if your assembler supports specifying the alignment | |
4692 | of objects allocated using the GAS .comm command.]) | |
d38bc601 BF |
4693 | # Used for DWARF 2 in PE |
4694 | gcc_GAS_CHECK_FEATURE([.secrel32 relocs], | |
4695 | gcc_cv_as_ix86_pe_secrel32, | |
4696 | [2,15,91],, | |
4697 | [.text | |
4698 | foo: nop | |
4699 | .data | |
4700 | .secrel32 foo], | |
4701 | [if test x$gcc_cv_ld != x \ | |
4702 | && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then | |
4703 | gcc_cv_as_ix86_pe_secrel32=yes | |
4704 | fi | |
4705 | rm -f conftest], | |
4706 | [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1, | |
4707 | [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])]) | |
3bec79c5 DK |
4708 | # Test if the assembler supports the extended form of the .section |
4709 | # directive that specifies section alignment. LTO support uses this, | |
4710 | # but normally only after installation, so we warn but don't fail the | |
4711 | # configure if LTO is enabled but the assembler does not support it. | |
4712 | gcc_GAS_CHECK_FEATURE([.section with alignment], gcc_cv_as_section_has_align, | |
4713 | [2,20,1],-fatal-warnings,[.section lto_test,"dr0"]) | |
4714 | if test x$gcc_cv_as_section_has_align != xyes; then | |
4715 | case ",$enable_languages," in | |
4716 | *,lto,*) | |
4717 | AC_MSG_WARN([LTO for $target requires binutils >= 2.20.1, but version found appears insufficient; LTO will not work until binutils is upgraded.]) | |
4718 | ;; | |
4719 | esac | |
4720 | fi | |
d38bc601 BF |
4721 | ;; |
4722 | esac | |
4723 | ||
8c2e5ecf RO |
4724 | gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment,, |
4725 | [-xbrace_comment=no], [.text],, | |
4726 | [AC_DEFINE(HAVE_AS_XBRACE_COMMENT_OPTION, 1, | |
4727 | [Define if your assembler supports -xbrace_comment option.])]) | |
4728 | ||
8ada417f | 4729 | gcc_GAS_CHECK_FEATURE([filds and fists mnemonics], |
a3a5e3d1 | 4730 | gcc_cv_as_ix86_filds,,, |
005f915e | 4731 | [filds (%ebp); fists (%ebp)],, |
a3a5e3d1 UB |
4732 | [AC_DEFINE(HAVE_AS_IX86_FILDS, 1, |
4733 | [Define if your assembler uses filds and fists mnemonics.])]) | |
4734 | ||
4735 | gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics], | |
4736 | gcc_cv_as_ix86_fildq,,, | |
005f915e | 4737 | [fildq (%ebp); fistpq (%ebp)],, |
a3a5e3d1 UB |
4738 | [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1, |
4739 | [Define if your assembler uses fildq and fistq mnemonics.])]) | |
8ada417f | 4740 | |
f6f5dff2 RO |
4741 | gcc_GAS_CHECK_FEATURE([cmov syntax], |
4742 | gcc_cv_as_ix86_cmov_sun_syntax,,, | |
4743 | [cmovl.l %edx, %eax],, | |
4744 | [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1, | |
4745 | [Define if your assembler supports the Sun syntax for cmov.])]) | |
4746 | ||
b6c03bcd RS |
4747 | gcc_GAS_CHECK_FEATURE([ffreep mnemonic], |
4748 | gcc_cv_as_ix86_ffreep,,, | |
4749 | [ffreep %st(1)],, | |
4750 | [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1, | |
4751 | [Define if your assembler supports the ffreep mnemonic.])]) | |
4752 | ||
ed104137 RO |
4753 | gcc_GAS_CHECK_FEATURE([.quad directive], |
4754 | gcc_cv_as_ix86_quad,,, | |
4755 | [.quad 0],, | |
4756 | [AC_DEFINE(HAVE_AS_IX86_QUAD, 1, | |
4757 | [Define if your assembler supports the .quad directive.])]) | |
4758 | ||
38ca3765 UB |
4759 | gcc_GAS_CHECK_FEATURE([sahf mnemonic], |
4760 | gcc_cv_as_ix86_sahf,,, | |
953c29f7 UB |
4761 | [.code64 |
4762 | sahf],, | |
38ca3765 | 4763 | [AC_DEFINE(HAVE_AS_IX86_SAHF, 1, |
953c29f7 | 4764 | [Define if your assembler supports the sahf mnemonic in 64bit mode.])]) |
38ca3765 | 4765 | |
fe04878d UB |
4766 | gcc_GAS_CHECK_FEATURE([interunit movq mnemonic], |
4767 | gcc_cv_as_ix86_interunit_movq,,, | |
4768 | [.code64 | |
4769 | movq %mm0, %rax | |
13a26a7d UB |
4770 | movq %rax, %xmm0]) |
4771 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_INTERUNIT_MOVQ, | |
4772 | [`if test $gcc_cv_as_ix86_interunit_movq = yes; then echo 1; else echo 0; fi`], | |
4773 | [Define if your assembler supports interunit movq mnemonic.]) | |
fe04878d | 4774 | |
5dcfdccd KY |
4775 | gcc_GAS_CHECK_FEATURE([hle prefixes], |
4776 | gcc_cv_as_ix86_hle,,, | |
54af4523 | 4777 | [lock xacquire cmpxchg %esi, (%ecx)],, |
5dcfdccd KY |
4778 | [AC_DEFINE(HAVE_AS_IX86_HLE, 1, |
4779 | [Define if your assembler supports HLE prefixes.])]) | |
4780 | ||
afd2c302 SD |
4781 | gcc_GAS_CHECK_FEATURE([swap suffix], |
4782 | gcc_cv_as_ix86_swap,,, | |
4783 | [movl.s %esp, %ebp],, | |
4784 | [AC_DEFINE(HAVE_AS_IX86_SWAP, 1, | |
4785 | [Define if your assembler supports the swap suffix.])]) | |
4786 | ||
68b92f78 RS |
4787 | gcc_GAS_CHECK_FEATURE([different section symbol subtraction], |
4788 | gcc_cv_as_ix86_diff_sect_delta,,, | |
4789 | [.section .rodata | |
4790 | .L1: | |
4791 | .long .L2-.L1 | |
4792 | .long .L3-.L1 | |
4793 | .text | |
4794 | .L3: nop | |
4795 | .L2: nop],, | |
4796 | [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1, | |
4797 | [Define if your assembler supports the subtraction of symbols in different sections.])]) | |
4798 | ||
2433310d RO |
4799 | gcc_GAS_CHECK_FEATURE([rep and lock prefix], |
4800 | gcc_cv_as_ix86_rep_lock_prefix,,, | |
4801 | [rep movsl | |
43283548 UB |
4802 | rep ret |
4803 | rep nop | |
4804 | rep bsf %ecx, %eax | |
4805 | rep bsr %ecx, %eax | |
4bade865 | 4806 | lock addl %edi, (%eax,%esi) |
7085bfb6 UB |
4807 | lock orl $0, (%esp)],, |
4808 | [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1, | |
4809 | [Define if the assembler supports 'rep <insn>, lock <insn>'.])]) | |
2433310d | 4810 | |
88f7c49a RM |
4811 | gcc_GAS_CHECK_FEATURE([ud2 mnemonic], |
4812 | gcc_cv_as_ix86_ud2,,, | |
4813 | [ud2],, | |
4814 | [AC_DEFINE(HAVE_AS_IX86_UD2, 1, | |
4815 | [Define if your assembler supports the 'ud2' mnemonic.])]) | |
4816 | ||
e1ebd31d UB |
4817 | # Enforce 32-bit output with gas and gld. |
4818 | if test x$gas = xyes; then | |
4819 | as_ix86_gas_32_opt="--32" | |
4820 | fi | |
4821 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
4822 | if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then | |
4823 | ld_ix86_gld_32_opt="-melf_i386_sol2" | |
4824 | else | |
4825 | ld_ix86_gld_32_opt="-melf_i386" | |
4826 | fi | |
4827 | fi | |
4828 | ||
8950516e | 4829 | gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc], |
e1ebd31d UB |
4830 | gcc_cv_as_ix86_tlsgdplt,, |
4831 | [$as_ix86_gas_32_opt], | |
0f24748c RO |
4832 | [call tls_gd@tlsgdplt], |
4833 | [if test x$gcc_cv_ld != x \ | |
e1ebd31d | 4834 | && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then |
0f24748c RO |
4835 | gcc_cv_as_ix86_tlsgdplt=yes |
4836 | fi | |
4837 | rm -f conftest], | |
8950516e | 4838 | [AC_DEFINE(HAVE_AS_IX86_TLSGDPLT, 1, |
0f24748c | 4839 | [Define if your assembler and linker support @tlsgdplt.])]) |
8950516e | 4840 | |
040c446d RO |
4841 | conftest_s=' |
4842 | .section .tdata,"aw'$tls_section_flag'",@progbits | |
4843 | tls_ld: | |
4844 | .section .text,"ax",@progbits | |
4845 | call tls_ld@tlsldmplt' | |
e1ebd31d | 4846 | |
8950516e | 4847 | gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc], |
e1ebd31d UB |
4848 | gcc_cv_as_ix86_tlsldmplt,, |
4849 | [$as_ix86_gas_32_opt], | |
040c446d | 4850 | [$conftest_s], |
0f24748c | 4851 | [if test x$gcc_cv_ld != x \ |
e1ebd31d | 4852 | && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then |
0f24748c RO |
4853 | gcc_cv_as_ix86_tlsldmplt=yes |
4854 | fi | |
caa16d41 RO |
4855 | rm -f conftest]) |
4856 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDMPLT, | |
4857 | [`if test $gcc_cv_as_ix86_tlsldmplt = yes; then echo 1; else echo 0; fi`], | |
4858 | [Define to 1 if your assembler and linker support @tlsldmplt.]) | |
4859 | ||
caa16d41 RO |
4860 | conftest_s=' |
4861 | .section .text,"ax",@progbits | |
4862 | .globl _start | |
4863 | .type _start, @function | |
4864 | _start: | |
4865 | leal value@tlsldm(%ebx), %eax | |
4866 | call ___tls_get_addr@plt | |
4867 | ||
4868 | .section .tdata,"aw'$tls_section_flag'",@progbits | |
4869 | .type value, @object | |
4870 | value:' | |
4871 | gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc], | |
4872 | gcc_cv_as_ix86_tlsldm,, | |
49677530 | 4873 | [$as_ix86_gas_32_opt], |
caa16d41 RO |
4874 | [$conftest_s], |
4875 | [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ | |
49677530 | 4876 | && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o $ld_tls_libs -lc > /dev/null 2>&1; then |
caa16d41 RO |
4877 | if $gcc_cv_objdump -d conftest 2>/dev/null | grep nop > /dev/null \ |
4878 | || dis conftest 2>/dev/null | grep nop > /dev/null; then | |
4879 | gcc_cv_as_ix86_tlsldm=yes | |
4880 | fi | |
4881 | fi | |
4882 | rm -f conftest]) | |
4883 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDM, | |
4884 | [`if test $gcc_cv_as_ix86_tlsldm = yes; then echo 1; else echo 0; fi`], | |
4885 | [Define to 1 if your assembler and linker support @tlsldm.]) | |
8950516e | 4886 | |
c0597759 L |
4887 | conftest_s=' |
4888 | .data | |
4889 | bar: | |
4890 | .byte 1 | |
4891 | .text | |
4892 | .global _start | |
4893 | _start: | |
4894 | cmpl $0, bar@GOT | |
4895 | jmp *_start@GOT' | |
4896 | gcc_GAS_CHECK_FEATURE([R_386_GOT32X reloc], | |
4897 | gcc_cv_as_ix86_got32x,, | |
49677530 | 4898 | [$as_ix86_gas_32_opt], |
c0597759 L |
4899 | [$conftest_s], |
4900 | [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ | |
4901 | && test x$gcc_cv_readelf != x \ | |
4902 | && $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \ | |
4903 | | grep R_386_GOT32X > /dev/null 2>&1 \ | |
49677530 | 4904 | && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o > /dev/null 2>&1; then |
c0597759 L |
4905 | if $gcc_cv_objdump -dw conftest 2>&1 \ |
4906 | | grep 0xffffff > /dev/null 2>&1; then | |
4907 | gcc_cv_as_ix86_got32x=no | |
4908 | else | |
4909 | gcc_cv_as_ix86_got32x=yes | |
4910 | fi | |
4911 | fi | |
4912 | rm -f conftest]) | |
4913 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_GOT32X, | |
4914 | [`if test x"$gcc_cv_as_ix86_got32x" = xyes; then echo 1; else echo 0; fi`], | |
4915 | [Define 0/1 if your assembler and linker support @GOT.]) | |
e1ebd31d UB |
4916 | |
4917 | gcc_GAS_CHECK_FEATURE([GOTOFF in data], | |
4918 | gcc_cv_as_ix86_gotoff_in_data, [2,11,0], | |
4919 | [$as_ix86_gas_32_opt], | |
4920 | [ .text | |
4921 | .L0: | |
4922 | nop | |
4923 | .data | |
4924 | .long .L0@GOTOFF]) | |
4925 | AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA, | |
4926 | [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`], | |
4927 | [Define true if the assembler supports '.long foo@GOTOFF'.]) | |
4928 | ||
de86ff8f L |
4929 | conftest_s=' |
4930 | .section .text,"ax",@progbits | |
4931 | .globl _start | |
4932 | .type _start, @function | |
4933 | _start: | |
4934 | leal ld@tlsldm(%ecx), %eax | |
4935 | call *___tls_get_addr@GOT(%ecx) | |
4936 | leal gd@tlsgd(%ecx), %eax | |
4937 | call *___tls_get_addr@GOT(%ecx) | |
4938 | ||
4939 | .section .tdata,"aw'$tls_section_flag'",@progbits | |
4940 | .type ld, @object | |
4941 | ld: | |
4942 | .byte 0 | |
4943 | .globl gd | |
4944 | .type gd, @object | |
4945 | gd: | |
4946 | .byte 0' | |
4947 | gcc_GAS_CHECK_FEATURE([calling ___tls_get_addr via GOT], | |
4948 | gcc_cv_as_ix86_tls_get_addr_via_got,, | |
4949 | [$as_ix86_gas_32_opt], | |
4950 | [$conftest_s], | |
4951 | [if test x$gcc_cv_ld != x \ | |
4952 | && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o > /dev/null 2>&1; then | |
4953 | gcc_cv_as_ix86_tls_get_addr_via_got=yes | |
4954 | fi | |
4955 | rm -f conftest]) | |
4956 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLS_GET_ADDR_GOT, | |
4957 | [`if test x"$gcc_cv_as_ix86_tls_get_addr_via_got" = xyes; then echo 1; else echo 0; fi`], | |
4958 | [Define 0/1 if your assembler and linker support calling ___tls_get_addr via GOT.]) | |
1cb36a98 | 4959 | ;; |
ef1ecf87 RH |
4960 | |
4961 | ia64*-*-*) | |
8ada417f ZW |
4962 | gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs], |
4963 | gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],, | |
cfa9ee99 | 4964 | [ .text |
ef1ecf87 RH |
4965 | addl r15 = @ltoffx(x#), gp |
4966 | ;; | |
d8b3b4f4 JM |
4967 | ld8.mov r16 = [[r15]], x# |
4968 | ],, | |
8ada417f ZW |
4969 | [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1, |
4970 | [Define if your assembler supports ltoffx and ldxmov relocations.])]) | |
4971 | ||
ef1ecf87 | 4972 | ;; |
8ada417f | 4973 | |
2c4a9cff | 4974 | powerpc*-*-*) |
4b7a5264 | 4975 | |
8ada417f | 4976 | case $target in |
8af4d362 PB |
4977 | *-*-darwin*) |
4978 | gcc_GAS_CHECK_FEATURE([.machine directive support], | |
4979 | gcc_cv_as_machine_directive,,, | |
4980 | [ .machine ppc7400]) | |
4981 | if test x$gcc_cv_as_machine_directive != xyes; then | |
4982 | echo "*** This target requires an assembler supporting \".machine\"" >&2 | |
aeebd94c | 4983 | echo you can get it from: https://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2 |
8af4d362 PB |
4984 | test x$build = x$target && exit 1 |
4985 | fi | |
4b7a5264 DE |
4986 | ;; |
4987 | esac | |
4988 | ||
4989 | case $target in | |
4990 | *-*-aix*) conftest_s=' .machine "pwr5" | |
4991 | .csect .text[[PR]] | |
4992 | mfcr 3,128';; | |
4993 | *-*-darwin*) conftest_s=' .text | |
6b37db3c | 4994 | mfcr r3,128';; |
4c67db14 | 4995 | *) conftest_s=' .machine power4 |
d2ab3e37 | 4996 | .text |
6b37db3c | 4997 | mfcr 3,128';; |
8ada417f | 4998 | esac |
8ada417f ZW |
4999 | |
5000 | gcc_GAS_CHECK_FEATURE([mfcr field support], | |
5001 | gcc_cv_as_powerpc_mfcrf, [2,14,0],, | |
5002 | [$conftest_s],, | |
5003 | [AC_DEFINE(HAVE_AS_MFCRF, 1, | |
5004 | [Define if your assembler supports mfcr field.])]) | |
432218ba | 5005 | |
7f970b70 AM |
5006 | case $target in |
5007 | *-*-aix*) conftest_s=' .csect .text[[PR]] | |
5008 | LCF..0: | |
5009 | addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';; | |
5010 | *-*-darwin*) | |
5011 | conftest_s=' .text | |
5012 | LCF0: | |
5013 | addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';; | |
5014 | *) conftest_s=' .text | |
5015 | .LCF0: | |
5016 | addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';; | |
5017 | esac | |
5018 | ||
695d8830 AS |
5019 | gcc_GAS_CHECK_FEATURE([rel16 relocs], |
5020 | gcc_cv_as_powerpc_rel16, [2,17,0], -a32, | |
5021 | [$conftest_s],, | |
5022 | [AC_DEFINE(HAVE_AS_REL16, 1, | |
5023 | [Define if your assembler supports R_PPC_REL16 relocs.])]) | |
5024 | ||
d40c9e33 PB |
5025 | case $target in |
5026 | *-*-aix*) conftest_s=' .machine "pwr7" | |
5027 | .csect .text[[PR]] | |
5028 | lxvd2x 1,2,3';; | |
5029 | *) conftest_s=' .machine power7 | |
5030 | .text | |
5031 | lxvd2x 1,2,3';; | |
5032 | esac | |
5033 | ||
5034 | gcc_GAS_CHECK_FEATURE([vector-scalar support], | |
cacf1ca8 | 5035 | gcc_cv_as_powerpc_vsx, [2,19,2], -a32, |
d40c9e33 PB |
5036 | [$conftest_s],, |
5037 | [AC_DEFINE(HAVE_AS_VSX, 1, | |
5038 | [Define if your assembler supports VSX instructions.])]) | |
5039 | ||
e51917ae JM |
5040 | gcc_GAS_CHECK_FEATURE([.gnu_attribute support], |
5041 | gcc_cv_as_powerpc_gnu_attribute, [2,18,0],, | |
5042 | [.gnu_attribute 4,1],, | |
5043 | [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, | |
5044 | [Define if your assembler supports .gnu_attribute.])]) | |
9752c4ad | 5045 | |
157bb85d UW |
5046 | gcc_GAS_CHECK_FEATURE([prologue entry point marker support], |
5047 | gcc_cv_as_powerpc_entry_markers, [2,26,0],-a64 --fatal-warnings, | |
5048 | [ .reloc .,R_PPC64_ENTRY; nop],, | |
5049 | [AC_DEFINE(HAVE_AS_ENTRY_MARKERS, 1, | |
5050 | [Define if your assembler supports the R_PPC64_ENTRY relocation.])]) | |
5051 | ||
3f79c0ad AM |
5052 | gcc_GAS_CHECK_FEATURE([plt sequence marker support], |
5053 | gcc_cv_as_powerpc_pltseq_markers, [2,31,0],-a32 --fatal-warnings, | |
5054 | [ .reloc .,R_PPC_PLTSEQ; nop],, | |
5055 | [AC_DEFINE(HAVE_AS_PLTSEQ, 1, | |
5056 | [Define if your assembler supports R_PPC*_PLTSEQ relocations.])]) | |
5057 | ||
636cf8b1 RS |
5058 | case $target in |
5059 | *-*-aix*) | |
a52f938b | 5060 | gcc_GAS_CHECK_FEATURE([AIX .ref support], |
e8548a47 | 5061 | gcc_cv_as_aix_ref, [2,21,0],, |
636cf8b1 RS |
5062 | [ .csect stuff[[rw]] |
5063 | stuff: | |
5064 | .long 1 | |
5065 | .extern sym | |
5066 | .ref sym | |
5067 | ],, | |
5068 | [AC_DEFINE(HAVE_AS_REF, 1, | |
5069 | [Define if your assembler supports .ref])]) | |
53b5ce19 | 5070 | |
a52f938b | 5071 | gcc_GAS_CHECK_FEATURE([AIX DWARF location lists section support], |
51fbbb92 | 5072 | gcc_cv_as_aix_dwloc, [2,21,0],, |
a52f938b DE |
5073 | [ .dwsect 0xA0000 |
5074 | Lframe..0: | |
eb657a49 | 5075 | .vbyte 4,Lframe..0 |
51fbbb92 DE |
5076 | ],, |
5077 | [AC_DEFINE(HAVE_XCOFF_DWARF_EXTRAS, 1, | |
a52f938b | 5078 | [Define if your assembler supports AIX debug frame section label reference.])]) |
51fbbb92 DE |
5079 | ;; |
5080 | esac | |
5081 | ;; | |
5082 | ||
8ada417f ZW |
5083 | mips*-*-*) |
5084 | gcc_GAS_CHECK_FEATURE([explicit relocation support], | |
5085 | gcc_cv_as_mips_explicit_relocs, [2,14,0],, | |
5086 | [ lw $4,%gp_rel(foo)($4)],, | |
5087 | [if test x$target_cpu_default = x | |
5088 | then target_cpu_default=MASK_EXPLICIT_RELOCS | |
5089 | else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS" | |
5090 | fi]) | |
51fbbb92 | 5091 | |
4551169f RS |
5092 | gcc_GAS_CHECK_FEATURE([-mno-shared support], |
5093 | gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],, | |
5094 | [AC_DEFINE(HAVE_AS_NO_SHARED, 1, | |
5095 | [Define if the assembler understands -mno-shared.])]) | |
dcb957d9 JM |
5096 | |
5097 | gcc_GAS_CHECK_FEATURE([.gnu_attribute support], | |
5098 | gcc_cv_as_mips_gnu_attribute, [2,18,0],, | |
5099 | [.gnu_attribute 4,1],, | |
5100 | [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, | |
5101 | [Define if your assembler supports .gnu_attribute.])]) | |
a44380d2 | 5102 | |
050af144 | 5103 | gcc_GAS_CHECK_FEATURE([.module support], |
a871c139 MF |
5104 | gcc_cv_as_mips_dot_module,,[-32], |
5105 | [.module mips2 | |
5106 | .module fp=xx],, | |
050af144 MF |
5107 | [AC_DEFINE(HAVE_AS_DOT_MODULE, 1, |
5108 | [Define if your assembler supports .module.])]) | |
5109 | if test x$gcc_cv_as_mips_dot_module = xno \ | |
5110 | && test x$with_fp_32 != x; then | |
5111 | AC_MSG_ERROR( | |
5112 | [Requesting --with-fp-32= requires assembler support for .module.]) | |
5113 | fi | |
5114 | ||
22c4c869 | 5115 | gcc_GAS_CHECK_FEATURE([.micromips support], |
b1485a33 | 5116 | gcc_cv_as_micromips_support,,[--fatal-warnings], |
22c4c869 CM |
5117 | [.set micromips],, |
5118 | [AC_DEFINE(HAVE_GAS_MICROMIPS, 1, | |
5119 | [Define if your assembler supports the .set micromips directive])]) | |
5120 | ||
a44380d2 JM |
5121 | gcc_GAS_CHECK_FEATURE([.dtprelword support], |
5122 | gcc_cv_as_mips_dtprelword, [2,18,0],, | |
5123 | [.section .tdata,"awT",@progbits | |
5124 | x: | |
5125 | .word 2 | |
5126 | .text | |
5127 | .dtprelword x+0x8000],, | |
5128 | [AC_DEFINE(HAVE_AS_DTPRELWORD, 1, | |
5129 | [Define if your assembler supports .dtprelword.])]) | |
b53da244 | 5130 | |
293b77b0 CF |
5131 | gcc_GAS_CHECK_FEATURE([DSPR1 mult with four accumulators support], |
5132 | gcc_cv_as_mips_dspr1_mult,,, | |
5133 | [ .set mips32r2 | |
5134 | .set nodspr2 | |
5135 | .set dsp | |
5136 | madd $ac3,$4,$5 | |
5137 | maddu $ac3,$4,$5 | |
5138 | msub $ac3,$4,$5 | |
5139 | msubu $ac3,$4,$5 | |
5140 | mult $ac3,$4,$5 | |
5141 | multu $ac3,$4,$5],, | |
5142 | [AC_DEFINE(HAVE_AS_DSPR1_MULT, 1, | |
5143 | [Define if your assembler supports DSPR1 mult.])]) | |
5144 | ||
b53da244 AN |
5145 | AC_MSG_CHECKING(assembler and linker for explicit JALR relocation) |
5146 | gcc_cv_as_ld_jalr_reloc=no | |
5147 | if test $gcc_cv_as_mips_explicit_relocs = yes; then | |
5148 | if test $in_tree_ld = yes ; then | |
5149 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 20 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
5150 | && test $in_tree_ld_is_elf = yes; then | |
5151 | gcc_cv_as_ld_jalr_reloc=yes | |
5152 | fi | |
5153 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x; then | |
5154 | echo ' .ent x' > conftest.s | |
1e1f96b5 CM |
5155 | echo 'x: lw $2,%got_disp(y)($3)' >> conftest.s |
5156 | echo ' lw $25,%call16(y)($28)' >> conftest.s | |
b53da244 AN |
5157 | echo ' .reloc 1f,R_MIPS_JALR,y' >> conftest.s |
5158 | echo '1: jalr $25' >> conftest.s | |
5159 | echo ' .reloc 1f,R_MIPS_JALR,x' >> conftest.s | |
5160 | echo '1: jalr $25' >> conftest.s | |
5161 | echo ' .end x' >> conftest.s | |
5162 | if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&AS_MESSAGE_LOG_FD \ | |
5163 | && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&AS_MESSAGE_LOG_FD; then | |
bc492e47 RO |
5164 | if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null 2>&1 \ |
5165 | && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null 2>&1; then | |
b53da244 AN |
5166 | gcc_cv_as_ld_jalr_reloc=yes |
5167 | fi | |
5168 | fi | |
5169 | rm -f conftest.* | |
5170 | fi | |
5171 | fi | |
5172 | if test $gcc_cv_as_ld_jalr_reloc = yes; then | |
5173 | if test x$target_cpu_default = x; then | |
5174 | target_cpu_default=MASK_RELAX_PIC_CALLS | |
5175 | else | |
5176 | target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS" | |
5177 | fi | |
5178 | fi | |
5179 | AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc) | |
49576e25 RS |
5180 | |
5181 | AC_CACHE_CHECK([linker for .eh_frame personality relaxation], | |
5182 | [gcc_cv_ld_mips_personality_relaxation], | |
5183 | [gcc_cv_ld_mips_personality_relaxation=no | |
5184 | if test $in_tree_ld = yes ; then | |
5185 | if test "$gcc_cv_gld_major_version" -eq 2 \ | |
5186 | -a "$gcc_cv_gld_minor_version" -ge 21 \ | |
5187 | -o "$gcc_cv_gld_major_version" -gt 2; then | |
5188 | gcc_cv_ld_mips_personality_relaxation=yes | |
5189 | fi | |
5190 | elif test x$gcc_cv_as != x \ | |
5191 | -a x$gcc_cv_ld != x \ | |
5192 | -a x$gcc_cv_readelf != x ; then | |
5193 | cat > conftest.s <<EOF | |
5194 | .cfi_startproc | |
5195 | .cfi_personality 0x80,indirect_ptr | |
5196 | .ent test | |
5197 | test: | |
5198 | nop | |
5199 | .end test | |
5200 | .cfi_endproc | |
5201 | ||
5202 | .section .data,"aw",@progbits | |
5203 | indirect_ptr: | |
5204 | .dc.a personality | |
5205 | EOF | |
5206 | if $gcc_cv_as -KPIC -o conftest.o conftest.s > /dev/null 2>&1 \ | |
5207 | && $gcc_cv_ld -o conftest conftest.o -shared > /dev/null 2>&1; then | |
5208 | if $gcc_cv_readelf -d conftest 2>&1 \ | |
5209 | | grep TEXTREL > /dev/null 2>&1; then | |
5210 | : | |
5211 | elif $gcc_cv_readelf --relocs conftest 2>&1 \ | |
5212 | | grep 'R_MIPS_REL32 *$' > /dev/null 2>&1; then | |
5213 | : | |
5214 | else | |
5215 | gcc_cv_ld_mips_personality_relaxation=yes | |
5216 | fi | |
5217 | fi | |
5218 | fi | |
5219 | rm -f conftest.s conftest.o conftest]) | |
5220 | if test x$gcc_cv_ld_mips_personality_relaxation = xyes; then | |
5221 | AC_DEFINE(HAVE_LD_PERSONALITY_RELAXATION, 1, | |
5222 | [Define if your linker can relax absolute .eh_frame personality | |
5223 | pointers into PC-relative form.]) | |
5224 | fi | |
ff3f3951 MR |
5225 | |
5226 | gcc_GAS_CHECK_FEATURE([-mnan= support], | |
5227 | gcc_cv_as_mips_nan,, | |
5228 | [-mnan=2008],,, | |
5229 | [AC_DEFINE(HAVE_AS_NAN, 1, | |
5230 | [Define if the assembler understands -mnan=.])]) | |
5231 | if test x$gcc_cv_as_mips_nan = xno \ | |
5232 | && test x$with_nan != x; then | |
5233 | AC_MSG_ERROR( | |
5234 | [Requesting --with-nan= requires assembler support for -mnan=]) | |
5235 | fi | |
dbad5e72 | 5236 | ;; |
8682b1a5 JL |
5237 | msp430-*-*) |
5238 | # Earlier GAS versions generically support .gnu_attribute, but the | |
5239 | # msp430 assembler will not do anything with it. | |
5240 | gcc_GAS_CHECK_FEATURE([.gnu_attribute support], | |
5241 | gcc_cv_as_msp430_gnu_attribute, [2,33,50],, | |
5242 | [.gnu_attribute 4,1],, | |
5243 | [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, | |
5244 | [Define if your assembler supports .gnu_attribute.])]) | |
5245 | gcc_GAS_CHECK_FEATURE([.mspabi_attribute support], | |
5246 | gcc_cv_as_msp430_mspabi_attribute, [2,33,50],, | |
b75863a8 | 5247 | [.mspabi_attribute 4,2],, |
8682b1a5 JL |
5248 | [AC_DEFINE(HAVE_AS_MSPABI_ATTRIBUTE, 1, |
5249 | [Define if your assembler supports .mspabi_attribute.])]) | |
02afb6a9 JL |
5250 | if test x$enable_newlib_nano_formatted_io = xyes; then |
5251 | AC_DEFINE(HAVE_NEWLIB_NANO_FORMATTED_IO, 1, [Define if GCC has been | |
5252 | configured with --enable-newlib-nano-formatted-io.]) | |
5253 | fi | |
8682b1a5 | 5254 | ;; |
2d33dcfe SL |
5255 | nios2-*-*) |
5256 | # Versions 2.33 and earlier lacked support for the %gotoff relocation | |
5257 | # syntax that is documented in the ABI specification. | |
5258 | gcc_GAS_CHECK_FEATURE([support for %gotoff relocations in constant data], | |
5259 | gcc_cv_as_nios2_gotoff_relocation,,, | |
5260 | [ .extern foo | |
5261 | .data | |
5262 | .long %gotoff(foo)],, | |
5263 | [AC_DEFINE(HAVE_AS_NIOS2_GOTOFF_RELOCATION, 1, | |
5264 | [Define if your assembler supports %gotoff relocation syntax.])]) | |
5265 | ;; | |
8e966210 KC |
5266 | riscv*-*-*) |
5267 | gcc_GAS_CHECK_FEATURE([.attribute support], | |
5268 | gcc_cv_as_riscv_attribute, [2,32,0],, | |
5269 | [.attribute stack_align,4],, | |
5270 | [AC_DEFINE(HAVE_AS_RISCV_ATTRIBUTE, 1, | |
5271 | [Define if your assembler supports .attribute.])]) | |
4b815282 KC |
5272 | gcc_GAS_CHECK_FEATURE([-misa-spec= support], |
5273 | gcc_cv_as_riscv_isa_spec,, | |
5274 | [-misa-spec=2.2],,, | |
5275 | [AC_DEFINE(HAVE_AS_MISA_SPEC, 1, | |
5276 | [Define if the assembler understands -misa-spec=.])]) | |
5277 | gcc_GAS_CHECK_FEATURE([-march=rv32i_zifencei support], | |
5278 | gcc_cv_as_riscv_march_zifencei,, | |
5279 | [-march=rv32i_zifencei],,, | |
5280 | [AC_DEFINE(HAVE_AS_MARCH_ZIFENCEI, 1, | |
5281 | [Define if the assembler understands -march=rv*_zifencei.])]) | |
8e966210 | 5282 | ;; |
45901378 AK |
5283 | s390*-*-*) |
5284 | gcc_GAS_CHECK_FEATURE([.gnu_attribute support], | |
5285 | gcc_cv_as_s390_gnu_attribute, [2,18,0],, | |
5286 | [.gnu_attribute 8,1],, | |
5287 | [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, | |
5288 | [Define if your assembler supports .gnu_attribute.])]) | |
ec47b086 DV |
5289 | gcc_GAS_CHECK_FEATURE([.machine and .machinemode support], |
5290 | gcc_cv_as_s390_machine_machinemode, [2,24,0],, | |
5291 | [ .machinemode push | |
5292 | .machinemode pop | |
5293 | .machine push | |
5294 | .machine pop],, | |
5295 | [AC_DEFINE(HAVE_AS_MACHINE_MACHINEMODE, 1, | |
5296 | [Define if your assembler supports .machine and .machinemode.])]) | |
5297 | gcc_GAS_CHECK_FEATURE([architecture modifiers support], | |
5298 | gcc_cv_as_s390_architecture_modifiers, [2,26,0],, | |
5299 | [ .machine z13+vx ],, | |
5300 | [AC_DEFINE(HAVE_AS_ARCHITECTURE_MODIFIERS, 1, | |
5301 | [Define if your assembler supports architecture modifiers.])]) | |
b8923037 AK |
5302 | gcc_GAS_CHECK_FEATURE([vector load/store alignment hints], |
5303 | gcc_cv_as_s390_vector_loadstore_alignment_hints, [2,31,0],, | |
5304 | [ vl %v24,0(%r15),3 ],, | |
5305 | [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS, 1, | |
5306 | [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument.])]) | |
929fd91b SSF |
5307 | gcc_GAS_CHECK_FEATURE([vector load/store alignment hints on z13], |
5308 | gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13,, [-mzarch -march=z13], | |
5309 | [ vl %v24,0(%r15),3 ],, | |
5310 | [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13, 1, | |
5311 | [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument on z13.])]) | |
b8923037 | 5312 | |
45901378 | 5313 | ;; |
dbad5e72 SE |
5314 | esac |
5315 | ||
5316 | # Mips and HP-UX need the GNU assembler. | |
5317 | # Linux on IA64 might be able to use the Intel assembler. | |
8ada417f | 5318 | |
dbad5e72 SE |
5319 | case "$target" in |
5320 | mips*-*-* | *-*-hpux* ) | |
82563d35 RS |
5321 | if test x$gas_flag = xyes \ |
5322 | || test x"$host" != x"$build" \ | |
5323 | || test ! -x "$gcc_cv_as" \ | |
5324 | || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then | |
5325 | : | |
5326 | else | |
5327 | echo "*** This configuration requires the GNU assembler" >&2 | |
5328 | exit 1 | |
5329 | fi | |
8ada417f ZW |
5330 | ;; |
5331 | esac | |
dbad5e72 | 5332 | |
9d147085 RH |
5333 | # ??? Not all targets support dwarf2 debug_line, even within a version |
5334 | # of gas. Moreover, we need to emit a valid instruction to trigger any | |
5335 | # info to the output file. So, as supported targets are added to gas 2.11, | |
5336 | # add some instruction here to (also) show we expect this might work. | |
5337 | # ??? Once 2.11 is released, probably need to add first known working | |
5338 | # version to the per-target configury. | |
7fa2619a | 5339 | case "$cpu_type" in |
56856b58 | 5340 | aarch64 | alpha | arc | arm | avr | bfin | cris | csky | i386 | m32c | m68k \ |
2f2aeda9 | 5341 | | microblaze | mips | nds32 | nios2 | pa | riscv | rs6000 | score | sparc \ |
7c22e690 | 5342 | | tilegx | tilepro | visium | xstormy16 | xtensa) |
9d147085 RH |
5343 | insn="nop" |
5344 | ;; | |
7fa2619a | 5345 | ia64 | s390) |
9d147085 RH |
5346 | insn="nop 0" |
5347 | ;; | |
7fa2619a | 5348 | mmix) |
2853bc5a HPN |
5349 | insn="swym 0" |
5350 | ;; | |
8ada417f ZW |
5351 | esac |
5352 | if test x"$insn" != x; then | |
5353 | conftest_s="\ | |
5354 | .file 1 \"conftest.s\" | |
5355 | .loc 1 3 0 | |
5356 | $insn" | |
5357 | gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support], | |
5358 | gcc_cv_as_dwarf2_debug_line, | |
5359 | [elf,2,11,0],, [$conftest_s], | |
080a5bb0 EB |
5360 | [if test x$gcc_cv_objdump != x \ |
5361 | && $gcc_cv_objdump -h conftest.o 2> /dev/null \ | |
5362 | | grep debug_line > /dev/null 2>&1; then | |
8ada417f | 5363 | gcc_cv_as_dwarf2_debug_line=yes |
f1b2727f IS |
5364 | elif test x$gcc_cv_otool != x \ |
5365 | && $gcc_cv_otool -l conftest.o 2> /dev/null \ | |
5366 | | grep debug_line > /dev/null 2>&1; then | |
5367 | gcc_cv_as_dwarf2_debug_line=yes | |
8ada417f ZW |
5368 | fi]) |
5369 | ||
5370 | # The .debug_line file table must be in the exact order that | |
5371 | # we specified the files, since these indices are also used | |
5372 | # by DW_AT_decl_file. Approximate this test by testing if | |
5373 | # the assembler bitches if the same index is assigned twice. | |
5374 | gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive], | |
5375 | gcc_cv_as_dwarf2_file_buggy,,, | |
5376 | [ .file 1 "foo.s" | |
5377 | .file 1 "bar.s"]) | |
5378 | ||
5379 | if test $gcc_cv_as_dwarf2_debug_line = yes \ | |
5380 | && test $gcc_cv_as_dwarf2_file_buggy = no; then | |
bd2b9f1e | 5381 | AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1, |
8ada417f | 5382 | [Define if your assembler supports dwarf2 .file/.loc directives, |
eaec9b3d | 5383 | and preserves file table indices exactly as given.]) |
bd2b9f1e AO |
5384 | |
5385 | if test $gcc_cv_as_leb128 = yes; then | |
5386 | conftest_s="\ | |
5387 | .file 1 \"conftest.s\" | |
5388 | .loc 1 3 0 view .LVU1 | |
5389 | $insn | |
5390 | .data | |
5391 | .uleb128 .LVU1 | |
5392 | .uleb128 .LVU1 | |
5393 | " | |
5394 | gcc_GAS_CHECK_FEATURE([dwarf2 debug_view support], | |
5395 | gcc_cv_as_dwarf2_debug_view, | |
5396 | [elf,2,27,0],,[$conftest_s],, | |
5397 | [AC_DEFINE(HAVE_AS_DWARF2_DEBUG_VIEW, 1, | |
5398 | [Define if your assembler supports views in dwarf2 .loc directives.])]) | |
5399 | fi | |
8ada417f ZW |
5400 | fi |
5401 | ||
5402 | gcc_GAS_CHECK_FEATURE([--gdwarf2 option], | |
5403 | gcc_cv_as_gdwarf2_flag, | |
5404 | [elf,2,11,0], [--gdwarf2], [$insn],, | |
5405 | [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1, | |
5406 | [Define if your assembler supports the --gdwarf2 option.])]) | |
5407 | ||
6923255e JJ |
5408 | gcc_GAS_CHECK_FEATURE([--gdwarf-5 option], |
5409 | gcc_cv_as_gdwarf_5_flag, | |
5410 | [elf,2,36,0], [--gdwarf-5], [$insn],, | |
5411 | [AC_DEFINE(HAVE_AS_GDWARF_5_DEBUG_FLAG, 1, | |
5412 | [Define if your assembler supports the --gdwarf-5 option.])]) | |
5413 | ||
5414 | dwarf4_debug_info_size=0x46 | |
5415 | dwarf4_high_pc_form=7 | |
5416 | dwarf4_debug_aranges_size=0x2c | |
5417 | dwarf4_line_sz=9 | |
5418 | for dwarf4_addr_size in 8 4; do | |
5419 | conftest_s="\ | |
5420 | .file \"a.c\" | |
5421 | .text | |
5422 | .Ltext0: | |
5423 | .p2align 4 | |
5424 | .globl foo | |
5425 | .type foo, %function | |
5426 | foo: | |
5427 | .LFB0: | |
5428 | .LM1: | |
5429 | $insn | |
5430 | .LM2: | |
5431 | .LFE0: | |
5432 | .size foo, .-foo | |
5433 | .Letext0: | |
5434 | .section .debug_info,\"\",%progbits | |
5435 | .Ldebug_info0: | |
5436 | .4byte $dwarf4_debug_info_size | |
5437 | .2byte 0x4 | |
5438 | .4byte .Ldebug_abbrev0 | |
5439 | .byte 0x$dwarf4_addr_size | |
5440 | .byte 0x1 | |
5441 | .ascii \"GNU C17\\0\" | |
5442 | .byte 0xc | |
5443 | .ascii \"a.c\\0\" | |
5444 | .ascii \"/\\0\" | |
5445 | .${dwarf4_addr_size}byte .Ltext0 | |
5446 | .${dwarf4_addr_size}byte .Letext0-.Ltext0 | |
5447 | .4byte .Ldebug_line0 | |
5448 | .byte 0x2 | |
5449 | .ascii \"foo\\0\" | |
5450 | .byte 0x1 | |
5451 | .byte 0x2 | |
5452 | .byte 0x1 | |
5453 | .${dwarf4_addr_size}byte .LFB0 | |
5454 | .${dwarf4_addr_size}byte .LFE0-.LFB0 | |
5455 | .byte 0x1 | |
5456 | .byte 0x9c | |
5457 | .byte 0 | |
5458 | .section .debug_abbrev,\"\",%progbits | |
5459 | .Ldebug_abbrev0: | |
5460 | .byte 0x1 | |
5461 | .byte 0x11 | |
5462 | .byte 0x1 | |
5463 | .byte 0x25 | |
5464 | .byte 0x8 | |
5465 | .byte 0x13 | |
5466 | .byte 0xb | |
5467 | .byte 0x3 | |
5468 | .byte 0x8 | |
5469 | .byte 0x1b | |
5470 | .byte 0x8 | |
5471 | .byte 0x11 | |
5472 | .byte 0x1 | |
5473 | .byte 0x12 | |
5474 | .byte 0x$dwarf4_high_pc_form | |
5475 | .byte 0x10 | |
5476 | .byte 0x17 | |
5477 | .byte 0 | |
5478 | .byte 0 | |
5479 | .byte 0x2 | |
5480 | .byte 0x2e | |
5481 | .byte 0 | |
5482 | .byte 0x3f | |
5483 | .byte 0x19 | |
5484 | .byte 0x3 | |
5485 | .byte 0x8 | |
5486 | .byte 0x3a | |
5487 | .byte 0xb | |
5488 | .byte 0x3b | |
5489 | .byte 0xb | |
5490 | .byte 0x39 | |
5491 | .byte 0xb | |
5492 | .byte 0x11 | |
5493 | .byte 0x1 | |
5494 | .byte 0x12 | |
5495 | .byte 0x$dwarf4_high_pc_form | |
5496 | .byte 0x40 | |
5497 | .byte 0x18 | |
5498 | .byte 0 | |
5499 | .byte 0 | |
5500 | .byte 0 | |
5501 | .section .debug_aranges,\"\",%progbits | |
5502 | .4byte $dwarf4_debug_aranges_size | |
5503 | .2byte 0x2 | |
5504 | .4byte .Ldebug_info0 | |
5505 | .byte 0x8 | |
5506 | .byte 0 | |
5507 | .2byte 0 | |
5508 | .2byte 0 | |
5509 | .${dwarf4_addr_size}byte .Ltext0 | |
5510 | .${dwarf4_addr_size}byte .Letext0-.Ltext0 | |
5511 | .${dwarf4_addr_size}byte 0 | |
5512 | .${dwarf4_addr_size}byte 0 | |
5513 | .section .debug_line,\"\",%progbits | |
5514 | .Ldebug_line0: | |
5515 | .4byte .LELT0-.LSLT0 | |
5516 | .LSLT0: | |
5517 | .2byte 0x4 | |
5518 | .4byte .LELTP0-.LASLTP0 | |
5519 | .LASLTP0: | |
5520 | .byte 0x1 | |
5521 | .byte 0x1 | |
5522 | .byte 0x1 | |
5523 | .byte 0xf6 | |
5524 | .byte 0xf2 | |
5525 | .byte 0xd | |
5526 | .byte 0 | |
5527 | .byte 0x1 | |
5528 | .byte 0x1 | |
5529 | .byte 0x1 | |
5530 | .byte 0x1 | |
5531 | .byte 0 | |
5532 | .byte 0 | |
5533 | .byte 0 | |
5534 | .byte 0x1 | |
5535 | .byte 0 | |
5536 | .byte 0 | |
5537 | .byte 0x1 | |
5538 | .byte 0 | |
5539 | .ascii \"a.c\\0\" | |
5540 | .byte 0 | |
5541 | .byte 0 | |
5542 | .byte 0 | |
5543 | .byte 0 | |
5544 | .LELTP0: | |
5545 | .byte 0 | |
5546 | .byte 0x$dwarf4_line_sz | |
5547 | .byte 0x2 | |
5548 | .${dwarf4_addr_size}byte .LM1 | |
5549 | .byte 0x18 | |
5550 | .byte 0x5 | |
5551 | .byte 0x1 | |
5552 | .byte 0 | |
5553 | .byte 0x$dwarf4_line_sz | |
5554 | .byte 0x2 | |
5555 | .${dwarf4_addr_size}byte .LM2 | |
5556 | .byte 0x1 | |
5557 | .byte 0x5 | |
5558 | .byte 0x1 | |
5559 | .byte 0 | |
5560 | .byte 0x$dwarf4_line_sz | |
5561 | .byte 0x2 | |
5562 | .${dwarf4_addr_size}byte .Letext0 | |
5563 | .byte 0 | |
5564 | .byte 0x1 | |
5565 | .byte 0x1 | |
5566 | .LELT0: | |
5567 | .section .debug_str,\"\",%progbits | |
5568 | .ident \"GCC\" | |
5569 | " | |
5570 | dwarf4_success=no | |
5571 | if test $dwarf4_addr_size = 4; then | |
5572 | gcc_GAS_CHECK_FEATURE([assembly of compiler generated 32-bit .debug_line], | |
5573 | gcc_cv_as_debug_line_32_flag, | |
5574 | [elf,2,36,0], [], [$conftest_s],, | |
1aeb7d7d | 5575 | [dwarf4_success=yes]) |
6923255e JJ |
5576 | else |
5577 | gcc_GAS_CHECK_FEATURE([assembly of compiler generated 64-bit .debug_line], | |
5578 | gcc_cv_as_debug_line_64_flag, | |
5579 | [elf,2,36,0], [], [$conftest_s],, | |
5580 | [dwarf4_success=yes]) | |
5581 | fi | |
5582 | if test $dwarf4_success = yes; then | |
1aeb7d7d | 5583 | dwarf4_success=no |
6923255e JJ |
5584 | gcc_GAS_CHECK_FEATURE([--gdwarf-4 not refusing compiler generated .debug_line], |
5585 | gcc_cv_as_dwarf_4_debug_line_flag, | |
5586 | [elf,2,36,0], [--gdwarf-4], [$conftest_s],, | |
1aeb7d7d | 5587 | [dwarf4_success=yes]) |
6923255e JJ |
5588 | break |
5589 | fi | |
5590 | dwarf4_debug_info_size=0x36 | |
5591 | dwarf4_high_pc_form=6 | |
5592 | dwarf4_debug_aranges_size=0x1c | |
5593 | dwarf4_line_sz=5 | |
5594 | done | |
5595 | ||
1aeb7d7d L |
5596 | if test $dwarf4_success = yes; then |
5597 | conftest_s="\ | |
5598 | .file \"foo.c\" | |
5599 | .text | |
5600 | bar: | |
5601 | #APP | |
5602 | # 82 \"xxx.h\" 1 | |
5603 | $insn | |
5604 | # 0 \"\" 2 | |
5605 | #NO_APP | |
5606 | $insn | |
5607 | foo: | |
5608 | .file 1 \"foo.c\" | |
5609 | $insn | |
5610 | .file 2 \"foo.h\" | |
5611 | ret | |
5612 | " | |
5613 | dwarf4_success=no | |
5614 | gcc_GAS_CHECK_FEATURE([--gdwarf-4 with the APP marker], | |
5615 | gcc_cv_as_dwarf_4_app_flag,, | |
5616 | [--gdwarf-4], [$conftest_s],, [dwarf4_success=yes]) | |
5617 | fi | |
5618 | ||
5619 | if test $dwarf4_success = yes; then | |
5620 | conftest_s="\ | |
5621 | .text | |
5622 | .globl foo | |
5623 | .type foo, %function | |
5624 | foo: | |
5625 | $insn | |
5626 | .size foo, .-foo | |
5627 | .file 1 \"foo.c\" | |
5628 | " | |
5629 | gcc_GAS_CHECK_FEATURE([working --gdwarf-4/--gdwarf-5 for all sources], | |
5630 | gcc_cv_as_working_gdwarf_n_flag,, | |
5631 | [--gdwarf-4], | |
5632 | [$conftest_s], | |
5633 | [changequote(,)dnl | |
5634 | if test x$gcc_cv_readelf != x \ | |
5635 | && $gcc_cv_readelf -w conftest.o 2>&1 \ | |
5636 | | grep conftest.s > /dev/null 2>&1; then | |
5637 | gcc_cv_as_working_gdwarf_n_flag=no | |
5638 | else | |
5639 | gcc_cv_as_working_gdwarf_n_flag=yes | |
5640 | fi | |
5641 | changequote([,])dnl]) | |
5642 | if test $gcc_cv_as_working_gdwarf_n_flag = yes; then | |
5643 | AC_DEFINE(HAVE_AS_WORKING_DWARF_N_FLAG, 1, | |
5644 | [Define if your assembler supports --gdwarf-4/--gdwarf-5 even with | |
5645 | compiler generated .debug_line.]) | |
5646 | fi | |
5647 | fi | |
5648 | ||
8ada417f ZW |
5649 | gcc_GAS_CHECK_FEATURE([--gstabs option], |
5650 | gcc_cv_as_gstabs_flag, | |
d9f069ab | 5651 | [elf,2,11,0], [--gstabs], [$insn],, |
8ada417f ZW |
5652 | [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1, |
5653 | [Define if your assembler supports the --gstabs option.])]) | |
c8aea42c PB |
5654 | |
5655 | gcc_GAS_CHECK_FEATURE([--debug-prefix-map option], | |
5656 | gcc_cv_as_debug_prefix_map_flag, | |
303a4698 | 5657 | [2,18,0], [--debug-prefix-map /a=/b], [$insn],, |
c8aea42c PB |
5658 | [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1, |
5659 | [Define if your assembler supports the --debug-prefix-map option.])]) | |
9d147085 | 5660 | fi |
5f0e9ea2 | 5661 | |
29d7cbd1 | 5662 | gcc_GAS_CHECK_FEATURE([compressed debug sections], |
7320a4b5 | 5663 | gcc_cv_as_compress_debug,,,, |
29d7cbd1 RO |
5664 | [# gas compiled without zlib cannot compress debug sections and warns |
5665 | # about it, but still exits successfully. So check for this, too. | |
5666 | if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null | |
5667 | then | |
5668 | gcc_cv_as_compress_debug=0 | |
7320a4b5 RO |
5669 | # Since binutils 2.26, gas supports --compress-debug-sections=type, |
5670 | # defaulting to the ELF gABI format. | |
5671 | elif $gcc_cv_as --compress-debug-sections=zlib-gnu -o conftest.o conftest.s > /dev/null 2>&1 | |
5672 | then | |
5673 | gcc_cv_as_compress_debug=2 | |
5674 | gcc_cv_as_compress_debug_option="--compress-debug-sections" | |
5675 | gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections" | |
5676 | # Before binutils 2.26, gas only supported --compress-debug-options and | |
5677 | # emitted the traditional GNU format. | |
29d7cbd1 RO |
5678 | elif $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s > /dev/null 2>&1 |
5679 | then | |
5680 | gcc_cv_as_compress_debug=1 | |
5681 | gcc_cv_as_compress_debug_option="--compress-debug-sections" | |
5682 | gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections" | |
5683 | else | |
5684 | gcc_cv_as_compress_debug=0 | |
29d7cbd1 RO |
5685 | fi]) |
5686 | AC_DEFINE_UNQUOTED(HAVE_AS_COMPRESS_DEBUG, $gcc_cv_as_compress_debug, | |
5687 | [Define to the level of your assembler's compressed debug section support.]) | |
5688 | AC_DEFINE_UNQUOTED(AS_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_compress_debug_option", | |
5689 | [Define to the assembler option to enable compressed debug sections.]) | |
5690 | AC_DEFINE_UNQUOTED(AS_NO_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_no_compress_debug_option", | |
5691 | [Define to the assembler option to disable compressed debug sections.]) | |
5692 | ||
28e6bb13 NC |
5693 | gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment, |
5694 | ,, | |
5695 | [.lcomm bar,4,16],, | |
5696 | [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1, | |
5697 | [Define if your assembler supports .lcomm with an alignment field.])]) | |
5698 | ||
75a2bcc0 JM |
5699 | if test x$with_sysroot = x && test x$host = x$target \ |
5700 | && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \ | |
5701 | && test "$prefix" != "NONE"; then | |
5702 | AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include", | |
5703 | [Define to PREFIX/include if cpp should also search that directory.]) | |
5704 | fi | |
5705 | ||
75a2bcc0 JM |
5706 | # Determine the version of glibc, if any, used on the target. |
5707 | AC_MSG_CHECKING([for target glibc version]) | |
5708 | AC_ARG_WITH([glibc-version], | |
5709 | [AS_HELP_STRING([--with-glibc-version=M.N], | |
5710 | [assume GCC used with glibc version M.N or later])], [ | |
5711 | if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then | |
5712 | glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'` | |
5713 | glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'` | |
5714 | else | |
5715 | AC_MSG_ERROR([option --with-glibc-version requires a version number M.N]) | |
5716 | fi], [ | |
5717 | glibc_version_major=0 | |
5718 | glibc_version_minor=0 | |
5719 | [if test -f $target_header_dir/features.h \ | |
5720 | && glibc_version_major_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+[0-9]' $target_header_dir/features.h` \ | |
5721 | && glibc_version_minor_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+[0-9]' $target_header_dir/features.h`; then | |
5722 | glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[ ]*//'` | |
5723 | glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[ ]*//'` | |
5724 | fi]]) | |
5725 | AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor]) | |
2f73a6c7 JM |
5726 | AC_DEFINE_UNQUOTED([TARGET_GLIBC_MAJOR], [$glibc_version_major], |
5727 | [GNU C Library major version number used on the target, or 0.]) | |
5728 | AC_DEFINE_UNQUOTED([TARGET_GLIBC_MINOR], [$glibc_version_minor], | |
5729 | [GNU C Library minor version number used on the target, or 0.]) | |
75a2bcc0 | 5730 | |
e31bcd1b | 5731 | AC_ARG_ENABLE(gnu-unique-object, |
87e6d9dc TB |
5732 | [AS_HELP_STRING([--enable-gnu-unique-object], |
5733 | [enable the use of the @gnu_unique_object ELF extension on glibc systems])], | |
e31bcd1b JM |
5734 | [case $enable_gnu_unique_object in |
5735 | yes | no) ;; | |
5736 | *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object. | |
5737 | Valid choices are 'yes' and 'no'.]) ;; | |
5738 | esac], | |
5739 | [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object, | |
5740 | [elf,2,19,52],, | |
5ab22850 RR |
5741 | [.type foo, '$target_type_format_char'gnu_unique_object],, |
5742 | # We need to unquote above to to use the definition from config.gcc. | |
e31bcd1b | 5743 | # Also check for ld.so support, i.e. glibc 2.11 or higher. |
75a2bcc0 JM |
5744 | [GCC_GLIBC_VERSION_GTE_IFELSE([2], [11], [enable_gnu_unique_object=yes], )] |
5745 | )]) | |
e31bcd1b JM |
5746 | if test x$enable_gnu_unique_object = xyes; then |
5747 | AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1, | |
5748 | [Define if your assembler supports @gnu_unique_object.]) | |
5749 | fi | |
5750 | ||
03943c05 AO |
5751 | AC_CACHE_CHECK([assembler for tolerance to line number 0], |
5752 | [gcc_cv_as_line_zero], | |
5753 | [gcc_cv_as_line_zero=no | |
5754 | if test $in_tree_gas = yes; then | |
cf0eb7a1 | 5755 | gcc_GAS_VERSION_GTE_IFELSE(2, 16, 91, [gcc_cv_as_line_zero=yes]) |
03943c05 AO |
5756 | elif test "x$gcc_cv_as" != x; then |
5757 | { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s | |
5758 | if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) && | |
5759 | test "x`cat conftest.out`" = x | |
5760 | then | |
5761 | gcc_cv_as_line_zero=yes | |
5762 | else | |
5763 | echo "configure: failed program was" >&AS_MESSAGE_LOG_FD | |
5764 | cat conftest.s >&AS_MESSAGE_LOG_FD | |
5765 | echo "configure: error output was" >&AS_MESSAGE_LOG_FD | |
5766 | cat conftest.out >&AS_MESSAGE_LOG_FD | |
5767 | fi | |
5768 | rm -f conftest.o conftest.s conftest.out | |
5769 | fi]) | |
5770 | if test "x$gcc_cv_as_line_zero" = xyes; then | |
5771 | AC_DEFINE([HAVE_AS_LINE_ZERO], 1, | |
5772 | [Define if the assembler won't complain about a line such as # 0 "" 2.]) | |
5773 | fi | |
5774 | ||
25e08379 PP |
5775 | AC_MSG_CHECKING(support for thin archives) |
5776 | thin_archive_support=no | |
5777 | echo 'int main (void) { return 0; }' > conftest.c | |
5778 | if ($AR --version | sed 1q | grep "GNU ar" \ | |
5779 | && $CC $CFLAGS -c conftest.c \ | |
5780 | && $AR rcT conftest.a conftest.o \ | |
5781 | && $CC $CFLAGS $LDFLAGS -o conftest conftest.a) >/dev/null 2>&1; then | |
5782 | thin_archive_support=yes | |
5783 | fi | |
5784 | rm -f conftest.c conftest.o conftest.a conftest | |
5785 | AC_MSG_RESULT($thin_archive_support) | |
5786 | AC_SUBST(thin_archive_support) | |
5787 | ||
275b60d6 JJ |
5788 | AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support) |
5789 | gcc_cv_ld_eh_frame_hdr=no | |
34a86c2b | 5790 | if test $in_tree_ld = yes ; then |
5408ac6c HPN |
5791 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 \ |
5792 | && test $in_tree_ld_is_elf = yes; then | |
275b60d6 JJ |
5793 | gcc_cv_ld_eh_frame_hdr=yes |
5794 | fi | |
5795 | elif test x$gcc_cv_ld != x; then | |
6961669f RO |
5796 | if echo "$ld_ver" | grep GNU > /dev/null; then |
5797 | # Check if linker supports --eh-frame-hdr option | |
8dc877eb | 5798 | if $gcc_cv_ld --help 2>&1 | grep eh-frame-hdr > /dev/null; then |
6961669f RO |
5799 | gcc_cv_ld_eh_frame_hdr=yes |
5800 | fi | |
5801 | else | |
5802 | case "$target" in | |
5803 | *-*-solaris2*) | |
e279edb0 RO |
5804 | # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251. |
5805 | if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then | |
6961669f RO |
5806 | gcc_cv_ld_eh_frame_hdr=yes |
5807 | fi | |
5808 | ;; | |
5809 | esac | |
5810 | fi | |
275b60d6 | 5811 | fi |
232b67d9 | 5812 | GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR]) |
275b60d6 JJ |
5813 | if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then |
5814 | AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1, | |
6961669f | 5815 | [Define if your linker supports .eh_frame_hdr.]) |
275b60d6 JJ |
5816 | fi |
5817 | AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr) | |
5818 | ||
5022315a RO |
5819 | AC_MSG_CHECKING(linker CIEv3 in .eh_frame support) |
5820 | gcc_cv_ld_eh_frame_ciev3=no | |
5821 | if test $in_tree_ld = yes ; then | |
5822 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
5823 | && test $in_tree_ld_is_elf = yes; then | |
5824 | gcc_cv_ld_eh_frame_ciev3=yes | |
5825 | fi | |
5826 | elif test x$gcc_cv_ld != x; then | |
5827 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
5828 | gcc_cv_ld_eh_frame_ciev3=yes | |
5829 | if test 0"$ld_date" -lt 20040513; then | |
5830 | if test -n "$ld_date"; then | |
5831 | # If there was date string, but was earlier than 2004-05-13, fail | |
5832 | gcc_cv_ld_eh_frame_ciev3=no | |
5833 | elif test "$ld_vers_major" -lt 2; then | |
5834 | gcc_cv_ld_eh_frame_ciev3=no | |
5835 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then | |
5836 | gcc_cv_ld_eh_frame_ciev3=no | |
5837 | fi | |
5838 | fi | |
5839 | else | |
5840 | case "$target" in | |
5841 | *-*-solaris2*) | |
5842 | # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1. | |
5843 | if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then | |
5844 | gcc_cv_ld_eh_frame_ciev3=yes | |
5845 | fi | |
5846 | ;; | |
5847 | esac | |
5848 | fi | |
5849 | fi | |
5850 | AC_DEFINE_UNQUOTED(HAVE_LD_EH_FRAME_CIEV3, | |
5851 | [`if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi`], | |
5852 | [Define 0/1 if your linker supports CIE v3 in .eh_frame.]) | |
5853 | AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3) | |
5854 | ||
24a4dd31 JJ |
5855 | AC_MSG_CHECKING(linker position independent executable support) |
5856 | gcc_cv_ld_pie=no | |
5857 | if test $in_tree_ld = yes ; then | |
df2a1cc4 RO |
5858 | case "$target" in |
5859 | # Full PIE support on Solaris was only introduced in gld 2.26. | |
5860 | *-*-solaris2*) gcc_gld_pie_min_version=26 ;; | |
5861 | *) gcc_gld_pie_min_version=15 ;; | |
5862 | esac | |
5863 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge "$gcc_gld_pie_min_version" -o "$gcc_cv_gld_major_version" -gt 2 \ | |
5408ac6c | 5864 | && test $in_tree_ld_is_elf = yes; then |
24a4dd31 JJ |
5865 | gcc_cv_ld_pie=yes |
5866 | fi | |
5867 | elif test x$gcc_cv_ld != x; then | |
df2a1cc4 | 5868 | # Check if linker supports -pie option |
8dc877eb | 5869 | if $gcc_cv_ld --help 2>&1 | grep -- -pie > /dev/null; then |
df2a1cc4 RO |
5870 | gcc_cv_ld_pie=yes |
5871 | case "$target" in | |
5872 | *-*-solaris2*) | |
5873 | if echo "$ld_ver" | grep GNU > /dev/null \ | |
5874 | && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then | |
5875 | gcc_cv_ld_pie=no | |
5876 | fi | |
5877 | ;; | |
5878 | esac | |
5879 | else | |
5880 | case "$target" in | |
5881 | *-*-solaris2.1[[1-9]]*) | |
f021f1d3 | 5882 | # Solaris 11.3 added PIE support. |
df2a1cc4 RO |
5883 | if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then |
5884 | gcc_cv_ld_pie=yes | |
24a4dd31 | 5885 | fi |
df2a1cc4 RO |
5886 | ;; |
5887 | esac | |
5888 | fi | |
24a4dd31 JJ |
5889 | fi |
5890 | if test x"$gcc_cv_ld_pie" = xyes; then | |
5891 | AC_DEFINE(HAVE_LD_PIE, 1, | |
df2a1cc4 | 5892 | [Define if your linker supports PIE option.]) |
24a4dd31 JJ |
5893 | fi |
5894 | AC_MSG_RESULT($gcc_cv_ld_pie) | |
77ad54d9 ST |
5895 | |
5896 | AC_MSG_CHECKING(linker PIE support with copy reloc) | |
5897 | gcc_cv_ld_pie_copyreloc=no | |
5898 | if test $gcc_cv_ld_pie = yes ; then | |
5899 | if test $in_tree_ld = yes ; then | |
5900 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then | |
5901 | gcc_cv_ld_pie_copyreloc=yes | |
5902 | fi | |
5903 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then | |
5904 | # Check if linker supports -pie option with copy reloc | |
5905 | case "$target" in | |
5906 | i?86-*-linux* | x86_64-*-linux*) | |
5907 | cat > conftest1.s <<EOF | |
5908 | .globl a_glob | |
5909 | .data | |
5910 | .type a_glob, @object | |
5911 | .size a_glob, 4 | |
5912 | a_glob: | |
5913 | .long 2 | |
5914 | EOF | |
5915 | cat > conftest2.s <<EOF | |
5916 | .text | |
5917 | .globl main | |
5918 | .type main, @function | |
5919 | main: | |
5920 | movl %eax, a_glob(%rip) | |
5921 | .size main, .-main | |
7b3592ee L |
5922 | .globl ptr |
5923 | .section .data.rel,"aw",@progbits | |
5924 | .type ptr, @object | |
5925 | ptr: | |
5926 | .quad a_glob | |
77ad54d9 ST |
5927 | EOF |
5928 | if $gcc_cv_as --64 -o conftest1.o conftest1.s > /dev/null 2>&1 \ | |
5929 | && $gcc_cv_ld -shared -melf_x86_64 -o conftest1.so conftest1.o > /dev/null 2>&1 \ | |
5930 | && $gcc_cv_as --64 -o conftest2.o conftest2.s > /dev/null 2>&1 \ | |
5931 | && $gcc_cv_ld -pie -melf_x86_64 -o conftest conftest2.o conftest1.so > /dev/null 2>&1; then | |
5932 | gcc_cv_ld_pie_copyreloc=yes | |
5933 | fi | |
5934 | rm -f conftest conftest1.so conftest1.o conftest2.o conftest1.s conftest2.s | |
5935 | ;; | |
5936 | esac | |
5937 | fi | |
77ad54d9 | 5938 | fi |
1be71446 L |
5939 | AC_DEFINE_UNQUOTED(HAVE_LD_PIE_COPYRELOC, |
5940 | [`if test x"$gcc_cv_ld_pie_copyreloc" = xyes; then echo 1; else echo 0; fi`], | |
5941 | [Define 0/1 if your linker supports -pie option with copy reloc.]) | |
77ad54d9 | 5942 | AC_MSG_RESULT($gcc_cv_ld_pie_copyreloc) |
24a4dd31 | 5943 | |
22ba88ef EB |
5944 | AC_MSG_CHECKING(linker EH-compatible garbage collection of sections) |
5945 | gcc_cv_ld_eh_gc_sections=no | |
5946 | if test $in_tree_ld = yes ; then | |
5947 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 17 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
5948 | && test $in_tree_ld_is_elf = yes; then | |
5949 | gcc_cv_ld_eh_gc_sections=yes | |
5950 | fi | |
5951 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then | |
5952 | cat > conftest.s <<EOF | |
5953 | .section .text | |
5954 | .globl _start | |
5955 | .type _start, @function | |
5956 | _start: | |
5957 | .long foo | |
5958 | .size _start, .-_start | |
5959 | .section .text.foo,"ax",@progbits | |
5960 | .type foo, @function | |
5961 | foo: | |
5962 | .long 0 | |
5963 | .size foo, .-foo | |
5964 | .section .gcc_except_table.foo,"a",@progbits | |
5965 | .L0: | |
5966 | .long 0 | |
5967 | .section .eh_frame,"a",@progbits | |
5968 | .long .L0 | |
5969 | EOF | |
5970 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
5971 | if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \ | |
5972 | | grep "gc-sections option ignored" > /dev/null; then | |
5973 | gcc_cv_ld_eh_gc_sections=no | |
2e2b183b RO |
5974 | elif $gcc_cv_objdump -h conftest 2> /dev/null \ |
5975 | | grep gcc_except_table > /dev/null; then | |
22ba88ef | 5976 | gcc_cv_ld_eh_gc_sections=yes |
e9d207d9 EB |
5977 | # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections. |
5978 | if test x$gcc_cv_as_comdat_group != xyes; then | |
5979 | gcc_cv_ld_eh_gc_sections=no | |
5980 | cat > conftest.s <<EOF | |
5981 | .section .text | |
5982 | .globl _start | |
5983 | .type _start, @function | |
5984 | _start: | |
5985 | .long foo | |
5986 | .size _start, .-_start | |
5987 | .section .gnu.linkonce.t.foo,"ax",@progbits | |
5988 | .type foo, @function | |
5989 | foo: | |
5990 | .long 0 | |
5991 | .size foo, .-foo | |
5992 | .section .gcc_except_table.foo,"a",@progbits | |
5993 | .L0: | |
5994 | .long 0 | |
5995 | .section .eh_frame,"a",@progbits | |
5996 | .long .L0 | |
5997 | EOF | |
5998 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
5999 | if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \ | |
6000 | | grep "gc-sections option ignored" > /dev/null; then | |
6001 | gcc_cv_ld_eh_gc_sections=no | |
2e2b183b RO |
6002 | elif $gcc_cv_objdump -h conftest 2> /dev/null \ |
6003 | | grep gcc_except_table > /dev/null; then | |
e9d207d9 EB |
6004 | gcc_cv_ld_eh_gc_sections=yes |
6005 | fi | |
6006 | fi | |
6007 | fi | |
22ba88ef EB |
6008 | fi |
6009 | fi | |
6010 | rm -f conftest.s conftest.o conftest | |
6011 | fi | |
e9d207d9 EB |
6012 | case "$target" in |
6013 | hppa*-*-linux*) | |
6014 | # ??? This apparently exposes a binutils bug with PC-relative relocations. | |
6015 | gcc_cv_ld_eh_gc_sections=no | |
6016 | ;; | |
6017 | esac | |
22ba88ef EB |
6018 | if test x$gcc_cv_ld_eh_gc_sections = xyes; then |
6019 | AC_DEFINE(HAVE_LD_EH_GC_SECTIONS, 1, | |
6020 | [Define if your linker supports garbage collection of | |
6021 | sections in presence of EH frames.]) | |
6022 | fi | |
6023 | AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections) | |
6024 | ||
1b500976 JJ |
6025 | AC_MSG_CHECKING(linker EH garbage collection of sections bug) |
6026 | gcc_cv_ld_eh_gc_sections_bug=no | |
6027 | if test $in_tree_ld = yes ; then | |
6028 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -lt 19 -o "$gcc_cv_gld_major_version" -lt 2 \ | |
6029 | && test $in_tree_ld_is_elf = yes; then | |
6030 | gcc_cv_ld_eh_gc_sections_bug=yes | |
6031 | fi | |
6032 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x -a x$gcc_cv_as_comdat_group = xyes; then | |
6033 | gcc_cv_ld_eh_gc_sections_bug=yes | |
6034 | cat > conftest.s <<EOF | |
6035 | .section .text | |
6036 | .globl _start | |
6037 | .type _start, @function | |
6038 | _start: | |
6039 | .long foo | |
6040 | .size _start, .-_start | |
6041 | .section .text.startup.foo,"ax",@progbits | |
6042 | .type foo, @function | |
6043 | foo: | |
6044 | .long 0 | |
6045 | .size foo, .-foo | |
6046 | .section .gcc_except_table.foo,"a",@progbits | |
6047 | .L0: | |
6048 | .long 0 | |
6049 | .section .eh_frame,"a",@progbits | |
6050 | .long .L0 | |
6051 | EOF | |
6052 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
6053 | if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \ | |
6054 | | grep "gc-sections option ignored" > /dev/null; then | |
6055 | : | |
6056 | elif $gcc_cv_objdump -h conftest 2> /dev/null \ | |
6057 | | grep gcc_except_table > /dev/null; then | |
6058 | gcc_cv_ld_eh_gc_sections_bug=no | |
6059 | fi | |
6060 | fi | |
6061 | rm -f conftest.s conftest.o conftest | |
6062 | fi | |
6063 | if test x$gcc_cv_ld_eh_gc_sections_bug = xyes; then | |
6064 | AC_DEFINE(HAVE_LD_EH_GC_SECTIONS_BUG, 1, | |
6065 | [Define if your linker has buggy garbage collection of | |
6066 | sections support when .text.startup.foo like sections are used.]) | |
6067 | fi | |
6068 | AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug) | |
6069 | ||
29d7cbd1 RO |
6070 | AC_MSG_CHECKING(linker for compressed debug sections) |
6071 | # gold/gld support compressed debug sections since binutils 2.19/2.21 | |
7320a4b5 | 6072 | # In binutils 2.26, gld gained support for the ELF gABI format. |
29d7cbd1 RO |
6073 | if test $in_tree_ld = yes ; then |
6074 | gcc_cv_ld_compress_debug=0 | |
6075 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 19 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
6076 | && test $in_tree_ld_is_elf = yes && test $ld_is_gold = yes; then | |
6077 | gcc_cv_ld_compress_debug=2 | |
6078 | gcc_cv_ld_compress_debug_option="--compress-debug-sections" | |
7320a4b5 RO |
6079 | elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 26 -o "$gcc_cv_gld_major_version" -gt 2 \ |
6080 | && test $in_tree_ld_is_elf = yes && test $ld_is_gold = no; then | |
6081 | gcc_cv_ld_compress_debug=3 | |
6082 | gcc_cv_ld_compress_debug_option="--compress-debug-sections" | |
29d7cbd1 RO |
6083 | elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2 \ |
6084 | && test $in_tree_ld_is_elf = yes; then | |
6085 | gcc_cv_ld_compress_debug=1 | |
6086 | fi | |
6087 | elif echo "$ld_ver" | grep GNU > /dev/null; then | |
7320a4b5 RO |
6088 | if test "$ld_vers_major" -lt 2 \ |
6089 | || test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then | |
6090 | gcc_cv_ld_compress_debug=0 | |
6091 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then | |
6092 | gcc_cv_ld_compress_debug=1 | |
6093 | else | |
6094 | gcc_cv_ld_compress_debug=3 | |
6095 | gcc_cv_ld_compress_debug_option="--compress-debug-sections" | |
29d7cbd1 RO |
6096 | fi |
6097 | if test $ld_is_gold = yes; then | |
6098 | gcc_cv_ld_compress_debug=2 | |
6099 | gcc_cv_ld_compress_debug_option="--compress-debug-sections" | |
6100 | fi | |
6101 | else | |
6102 | changequote(,)dnl | |
6103 | case "${target}" in | |
6104 | *-*-solaris2*) | |
6105 | # Introduced in Solaris 11.2. | |
6106 | if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then | |
6107 | gcc_cv_ld_compress_debug=3 | |
6108 | gcc_cv_ld_compress_debug_option="-z compress-sections" | |
6109 | else | |
6110 | gcc_cv_ld_compress_debug=0 | |
6111 | fi | |
6112 | ;; | |
6113 | *) | |
6114 | # Assume linkers other than GNU ld don't support compessed debug | |
6115 | # sections. | |
6116 | gcc_cv_ld_compress_debug=0 | |
6117 | ;; | |
6118 | esac | |
6119 | changequote([,])dnl | |
6120 | fi | |
6121 | AC_DEFINE_UNQUOTED(HAVE_LD_COMPRESS_DEBUG, $gcc_cv_ld_compress_debug, | |
6122 | [Define to the level of your linker's compressed debug section support.]) | |
6123 | AC_DEFINE_UNQUOTED(LD_COMPRESS_DEBUG_OPTION, "$gcc_cv_ld_compress_debug_option", | |
6124 | [Define to the linker option to enable compressed debug sections.]) | |
6125 | AC_MSG_RESULT($gcc_cv_ld_compress_debug) | |
6126 | ||
eb89c82f IS |
6127 | if test x"$ld64_flag" = x"yes"; then |
6128 | ||
6129 | # Set defaults for possibly untestable items. | |
6130 | gcc_cv_ld64_export_dynamic=0 | |
6131 | ||
6132 | if test "$build" = "$host"; then | |
6133 | darwin_try_test=1 | |
6134 | else | |
6135 | darwin_try_test=0 | |
6136 | fi | |
6137 | ||
6138 | # On Darwin, because of FAT library support, it is often possible to execute | |
6139 | # exes from compatible archs even when the host differs from the build system. | |
6140 | case "$build","$host" in | |
6141 | x86_64-*-darwin*,i?86-*-darwin* | powerpc64*-*-darwin*,powerpc*-*-darwin*) | |
6142 | darwin_try_test=1;; | |
6143 | *) ;; | |
6144 | esac | |
6145 | ||
6146 | # If the configurer specified a minimum ld64 version to be supported, then use | |
6147 | # that to determine feature support. | |
6148 | if test x"${gcc_cv_ld64_version}" != x; then | |
c6d01ef8 IS |
6149 | AC_MSG_CHECKING(ld64 specified version) |
6150 | gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'` | |
eb89c82f IS |
6151 | AC_MSG_RESULT($gcc_cv_ld64_major) |
6152 | if test "$gcc_cv_ld64_major" -ge 236; then | |
6153 | gcc_cv_ld64_export_dynamic=1 | |
6154 | fi | |
6155 | elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then | |
6156 | # If the version was not specified, try to find it. | |
6157 | AC_MSG_CHECKING(linker version) | |
6158 | if test x"${gcc_cv_ld64_version}" = x; then | |
6159 | gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | grep ld64 | sed s/.*ld64-// | awk '{print $1}'` | |
6160 | fi | |
6161 | AC_MSG_RESULT($gcc_cv_ld64_version) | |
6162 | ||
6163 | AC_MSG_CHECKING(linker for -export_dynamic support) | |
6164 | gcc_cv_ld64_export_dynamic=1 | |
6165 | if $gcc_cv_ld -export_dynamic < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then | |
6166 | gcc_cv_ld64_export_dynamic=0 | |
6167 | fi | |
6168 | AC_MSG_RESULT($gcc_cv_ld64_export_dynamic) | |
6169 | fi | |
6170 | ||
6171 | if test x"${gcc_cv_ld64_version}" != x; then | |
6172 | AC_DEFINE_UNQUOTED(LD64_VERSION, "${gcc_cv_ld64_version}", | |
6173 | [Define to ld64 version.]) | |
6174 | fi | |
6175 | ||
6176 | AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic, | |
6177 | [Define to 1 if ld64 supports '-export_dynamic'.]) | |
6178 | fi | |
6179 | ||
630327c3 NN |
6180 | # -------- |
6181 | # UNSORTED | |
6182 | # -------- | |
6183 | ||
82e923f6 RS |
6184 | AC_CACHE_CHECK(linker --as-needed support, |
6185 | gcc_cv_ld_as_needed, | |
6186 | [gcc_cv_ld_as_needed=no | |
e927b6ad RO |
6187 | gcc_cv_ld_as_needed_option='--as-needed' |
6188 | gcc_cv_ld_no_as_needed_option='--no-as-needed' | |
765f1bf9 AM |
6189 | if test $in_tree_ld = yes ; then |
6190 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
6191 | && test $in_tree_ld_is_elf = yes; then | |
6192 | gcc_cv_ld_as_needed=yes | |
fefedb94 JJ |
6193 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 28; then |
6194 | gcc_cv_ld_as_needed_option='--push-state --as-needed' | |
6195 | gcc_cv_ld_no_as_needed_option='--pop-state' | |
6196 | fi | |
765f1bf9 AM |
6197 | fi |
6198 | elif test x$gcc_cv_ld != x; then | |
8dc877eb RO |
6199 | # Check if linker supports --as-needed and --no-as-needed options |
6200 | if $gcc_cv_ld --help 2>&1 | grep as-needed > /dev/null; then | |
6201 | gcc_cv_ld_as_needed=yes | |
fefedb94 JJ |
6202 | if $gcc_cv_ld --help 2>&1 | grep push-state > /dev/null \ |
6203 | && $gcc_cv_ld --help 2>&1 | grep pop-state > /dev/null \ | |
6204 | && echo "$ld_ver" | grep GNU > /dev/null \ | |
6205 | && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 28; then | |
6206 | # Use these options only when both ld.bfd and ld.gold support | |
6207 | # --push-state/--pop-state, which unfortunately wasn't added | |
6208 | # at the same time. | |
6209 | gcc_cv_ld_as_needed_option='--push-state --as-needed' | |
6210 | gcc_cv_ld_no_as_needed_option='--pop-state' | |
6211 | fi | |
8dc877eb RO |
6212 | fi |
6213 | case "$target:$gnu_ld" in | |
6214 | *-*-solaris2*:no) | |
6215 | # Solaris 2 ld always supports -z ignore/-z record. Prefer the native | |
6216 | # forms. | |
6217 | gcc_cv_ld_as_needed=yes | |
6218 | gcc_cv_ld_as_needed_option="-z ignore" | |
6219 | gcc_cv_ld_no_as_needed_option="-z record" | |
6220 | ;; | |
6221 | esac | |
765f1bf9 | 6222 | fi |
56cf7859 RO |
6223 | # --as-needed/-z ignore can only be used if libgcc_s.so.1 uses |
6224 | # dl_iterate_phdr, i.e. since Solaris 11. | |
6225 | case "$target" in | |
6226 | *-*-solaris2.1[[1-9]]*) | |
6227 | case "$target" in | |
6228 | i?86-*-* | x86_64-*-*) | |
6229 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
6230 | # Doesn't work with gld on Solaris/x86 due to PR ld/12320. | |
6231 | gcc_cv_ld_as_needed=no | |
6232 | fi | |
6233 | ;; | |
6234 | esac | |
6235 | ;; | |
6236 | *-*-solaris2*) | |
6237 | gcc_cv_ld_as_needed=no | |
6238 | ;; | |
6239 | esac | |
82e923f6 | 6240 | ]) |
765f1bf9 AM |
6241 | if test x"$gcc_cv_ld_as_needed" = xyes; then |
6242 | AC_DEFINE(HAVE_LD_AS_NEEDED, 1, | |
e927b6ad RO |
6243 | [Define if your linker supports --as-needed/--no-as-needed or equivalent options.]) |
6244 | AC_DEFINE_UNQUOTED(LD_AS_NEEDED_OPTION, "$gcc_cv_ld_as_needed_option", | |
6245 | [Define to the linker option to ignore unused dependencies.]) | |
6246 | AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, "$gcc_cv_ld_no_as_needed_option", | |
6247 | [Define to the linker option to keep unused dependencies.]) | |
765f1bf9 | 6248 | fi |
765f1bf9 | 6249 | |
3c698bf0 RO |
6250 | AC_MSG_CHECKING(linker mapfile support for clearing hardware capabilities) |
6251 | saved_LDFLAGS="$LDFLAGS" | |
6252 | for clearcap_map in sol2-clearcapv2.map sol2-clearcap.map; do | |
6253 | LDFLAGS="$saved_LDFLAGS -Wl,-M,${srcdir}/config/$clearcap_map" | |
22e05272 | 6254 | AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], |
3c698bf0 RO |
6255 | [gcc_cv_ld_clearcap=yes; break], [gcc_cv_ld_clearcap=no]) |
6256 | done | |
6257 | LDFLAGS="$saved_LDFLAGS" | |
6258 | if test "x$gcc_cv_ld_clearcap" = xyes; then | |
6259 | AC_DEFINE([HAVE_LD_CLEARCAP], 1, | |
6260 | [Define if the linker supports clearing hardware capabilities via mapfile.]) | |
6261 | AC_CONFIG_LINKS([clearcap.map:${srcdir}/config/$clearcap_map]) | |
6262 | fi | |
6263 | AC_MSG_RESULT($gcc_cv_ld_clearcap) | |
6264 | ||
e9dda04f AM |
6265 | case "$target" in |
6266 | powerpc*-*-*) | |
6267 | case "$target" in | |
6268 | *le-*-linux*) | |
6269 | emul_name="-melf32lppc" | |
6270 | ;; | |
6271 | *) | |
6272 | emul_name="-melf32ppc" | |
6273 | ;; | |
6274 | esac | |
6275 | AC_CACHE_CHECK(linker .gnu.attributes long double support, | |
6276 | gcc_cv_ld_ppc_attr, | |
6277 | [gcc_cv_ld_ppc_attr=no | |
6278 | if test x"$ld_is_gold" = xyes; then | |
6279 | gcc_cv_ld_ppc_attr=yes | |
6280 | elif test $in_tree_ld = yes ; then | |
6281 | if test "$gcc_cv_gld_major_version" -eq 2 \ | |
6282 | -a "$gcc_cv_gld_minor_version" -ge 28 \ | |
6283 | -o "$gcc_cv_gld_major_version" -gt 2; then | |
6284 | gcc_cv_ld_ppc_attr=yes | |
6285 | fi | |
6286 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then | |
6287 | # check that merging the long double .gnu_attribute doesn't warn | |
6288 | cat > conftest1.s <<EOF | |
6289 | .gnu_attribute 4,1 | |
6290 | EOF | |
6291 | cat > conftest2.s <<EOF | |
6292 | .gnu_attribute 4,9 | |
6293 | EOF | |
6294 | if $gcc_cv_as -a32 -o conftest1.o conftest1.s > /dev/null 2>&1 \ | |
6295 | && $gcc_cv_as -a32 -o conftest2.o conftest2.s > /dev/null 2>&1 \ | |
6296 | && $gcc_cv_ld $emul_name -r -o conftest.o conftest1.o conftest2.o > /dev/null 2> conftest.err \ | |
6297 | && test ! -s conftest.err; then | |
6298 | gcc_cv_ld_ppc_attr=yes | |
6299 | fi | |
6300 | rm -f conftest.err conftest.o conftest1.o conftest2.o conftest1.s conftest2.s | |
6301 | fi | |
6302 | ]) | |
6303 | if test x$gcc_cv_ld_ppc_attr = xyes; then | |
6304 | AC_DEFINE(HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE, 1, | |
6305 | [Define if your PowerPC linker has .gnu.attributes long double support.]) | |
6306 | fi | |
6307 | ;; | |
6308 | esac | |
6309 | ||
d82bf747 | 6310 | case "$target:$tm_file" in |
a26f86dc AT |
6311 | powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) |
6312 | case "$target" in | |
14523c25 AB |
6313 | *le-*-linux*) |
6314 | emul_name="-melf64lppc" | |
6315 | ;; | |
a26f86dc AT |
6316 | *-*-linux*) |
6317 | emul_name="-melf64ppc" | |
6318 | ;; | |
2a418323 PK |
6319 | *le-*-freebsd*) |
6320 | emul_name="-melf64lppc_fbsd" | |
6321 | ;; | |
a26f86dc AT |
6322 | *-*-freebsd*) |
6323 | emul_name="-melf64ppc_fbsd" | |
6324 | ;; | |
6325 | esac | |
85b776df AM |
6326 | AC_CACHE_CHECK(linker support for omitting dot symbols, |
6327 | gcc_cv_ld_no_dot_syms, | |
6328 | [gcc_cv_ld_no_dot_syms=no | |
38e1b75f AM |
6329 | if test x"$ld_is_gold" = xyes; then |
6330 | gcc_cv_ld_no_dot_syms=yes | |
6331 | elif test $in_tree_ld = yes ; then | |
85b776df AM |
6332 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then |
6333 | gcc_cv_ld_no_dot_syms=yes | |
6334 | fi | |
6335 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then | |
6336 | cat > conftest1.s <<EOF | |
6337 | .text | |
6338 | bl .foo | |
6339 | EOF | |
6340 | cat > conftest2.s <<EOF | |
6341 | .section ".opd","aw" | |
6342 | .align 3 | |
6343 | .globl foo | |
6344 | .type foo,@function | |
6345 | foo: | |
6346 | .quad .LEfoo,.TOC.@tocbase,0 | |
6347 | .text | |
6348 | .LEfoo: | |
6349 | blr | |
6350 | .size foo,.-.LEfoo | |
6351 | EOF | |
6352 | if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \ | |
6353 | && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \ | |
a26f86dc | 6354 | && $gcc_cv_ld $emul_name -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then |
85b776df AM |
6355 | gcc_cv_ld_no_dot_syms=yes |
6356 | fi | |
6357 | rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s | |
6358 | fi | |
6359 | ]) | |
6360 | if test x"$gcc_cv_ld_no_dot_syms" = xyes; then | |
6361 | AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1, | |
6362 | [Define if your PowerPC64 linker only needs function descriptor syms.]) | |
6363 | fi | |
070b27da AM |
6364 | |
6365 | AC_CACHE_CHECK(linker large toc support, | |
6366 | gcc_cv_ld_large_toc, | |
6367 | [gcc_cv_ld_large_toc=no | |
38e1b75f AM |
6368 | if test x"$ld_is_gold" = xyes; then |
6369 | gcc_cv_ld_large_toc=yes | |
6370 | elif test $in_tree_ld = yes ; then | |
070b27da AM |
6371 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then |
6372 | gcc_cv_ld_large_toc=yes | |
6373 | fi | |
6374 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then | |
6375 | cat > conftest.s <<EOF | |
6376 | .section ".tbss","awT",@nobits | |
6377 | .align 3 | |
6378 | ie0: .space 8 | |
6379 | .global _start | |
6380 | .text | |
6381 | _start: | |
6382 | addis 9,13,ie0@got@tprel@ha | |
6383 | ld 9,ie0@got@tprel@l(9) | |
6384 | EOF | |
6385 | if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \ | |
a26f86dc | 6386 | && $gcc_cv_ld $emul_name --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then |
070b27da AM |
6387 | gcc_cv_ld_large_toc=yes |
6388 | fi | |
6389 | rm -f conftest conftest.o conftest.s | |
6390 | fi | |
6391 | ]) | |
6392 | if test x"$gcc_cv_ld_large_toc" = xyes; then | |
6393 | AC_DEFINE(HAVE_LD_LARGE_TOC, 1, | |
6394 | [Define if your PowerPC64 linker supports a large TOC.]) | |
6395 | fi | |
3954ead0 AM |
6396 | |
6397 | AC_CACHE_CHECK(linker toc pointer alignment, | |
6398 | gcc_cv_ld_toc_align, | |
6399 | [if test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_nm != x; then | |
6400 | cat > conftest.s <<EOF | |
6401 | .global _start | |
6402 | .text | |
6403 | _start: | |
6404 | addis 9,2,x@got@ha | |
6405 | .section .data.rel.ro,"aw",@progbits | |
6406 | .p2align 16 | |
6407 | .space 32768 | |
6408 | x: .quad .TOC. | |
6409 | EOF | |
6410 | if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \ | |
458bc9b1 | 6411 | && $gcc_cv_ld $emul_name -z norelro -o conftest conftest.o > /dev/null 2>&1; then |
3954ead0 AM |
6412 | gcc_cv_ld_toc_align=`$gcc_cv_nm conftest | ${AWK} '/\.TOC\./ { match ($0, "0[[[:xdigit:]]]*", a); print strtonum ("0x" substr(a[[0]], length(a[[0]])-3)) }'` |
6413 | fi | |
6414 | rm -f conftest conftest.o conftest.s | |
6415 | fi | |
6416 | ]) | |
6417 | if test -n "$gcc_cv_ld_toc_align" && test $gcc_cv_ld_toc_align -gt 8; then | |
6418 | AC_DEFINE_UNQUOTED(POWERPC64_TOC_POINTER_ALIGNMENT, $gcc_cv_ld_toc_align, | |
6419 | [Define to .TOC. alignment forced by your linker.]) | |
6420 | fi | |
85b776df AM |
6421 | ;; |
6422 | esac | |
6423 | ||
9e81cc8b DE |
6424 | case "$target" in |
6425 | *-*-aix*) | |
6426 | AC_CACHE_CHECK(linker large toc support, | |
6427 | gcc_cv_ld_large_toc, | |
6428 | [gcc_cv_ld_large_toc=no | |
6429 | if test x$gcc_cv_as != x ; then | |
6430 | cat > conftest.s <<EOF | |
6431 | .toc | |
6432 | LC..1: | |
6433 | .tc a[[TC]],a[[RW]] | |
6434 | .extern a[[RW]] | |
6435 | .csect .text[[PR]] | |
6436 | .largetoctest: | |
6437 | addis 9,LC..1@u(2) | |
6438 | ld 3,LC..1@l(9) | |
6439 | EOF | |
6440 | if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then | |
6441 | gcc_cv_ld_large_toc=yes | |
6442 | fi | |
6443 | rm -f conftest conftest.o conftest.s | |
6444 | fi | |
6445 | ]) | |
6446 | if test x"$gcc_cv_ld_large_toc" = xyes; then | |
6447 | AC_DEFINE(HAVE_LD_LARGE_TOC, 1, | |
01ae4861 | 6448 | [Define if your PowerPC64 linker supports a large TOC.]) |
9e81cc8b DE |
6449 | fi |
6450 | ;; | |
6451 | esac | |
6452 | ||
cd533689 PP |
6453 | AC_CACHE_CHECK(linker --build-id support, |
6454 | gcc_cv_ld_buildid, | |
6455 | [gcc_cv_ld_buildid=no | |
6456 | if test $in_tree_ld = yes ; then | |
6457 | if test "$gcc_cv_gld_major_version" -eq 2 -a \ | |
6458 | "$gcc_cv_gld_minor_version" -ge 18 -o \ | |
6459 | "$gcc_cv_gld_major_version" -gt 2 \ | |
6460 | && test $in_tree_ld_is_elf = yes; then | |
6461 | gcc_cv_ld_buildid=yes | |
6462 | fi | |
6463 | elif test x$gcc_cv_ld != x; then | |
8dc877eb | 6464 | if $gcc_cv_ld --help 2>&1 | grep build-id > /dev/null; then |
cd533689 PP |
6465 | gcc_cv_ld_buildid=yes |
6466 | fi | |
6467 | fi]) | |
6468 | if test x"$gcc_cv_ld_buildid" = xyes; then | |
6469 | AC_DEFINE(HAVE_LD_BUILDID, 1, | |
6470 | [Define if your linker supports --build-id.]) | |
6471 | fi | |
6472 | ||
6473 | AC_ARG_ENABLE(linker-build-id, | |
b88ecf55 AS |
6474 | [AS_HELP_STRING([--enable-linker-build-id], |
6475 | [compiler will always pass --build-id to linker])], | |
cd533689 PP |
6476 | [], |
6477 | enable_linker_build_id=no) | |
6478 | ||
6479 | if test x"$enable_linker_build_id" = xyes; then | |
6480 | if test x"$gcc_cv_ld_buildid" = xyes; then | |
6481 | AC_DEFINE(ENABLE_LD_BUILDID, 1, | |
6482 | [Define if gcc should always pass --build-id to linker.]) | |
6483 | else | |
6484 | AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored) | |
6485 | fi | |
6486 | fi | |
6487 | ||
a6198222 RO |
6488 | # In binutils 2.21, GNU ld gained support for new emulations fully |
6489 | # supporting the Solaris 2 ABI. Detect their presence in the linker used. | |
6490 | AC_CACHE_CHECK(linker *_sol2 emulation support, | |
6491 | gcc_cv_ld_sol2_emulation, | |
6492 | [gcc_cv_ld_sol2_emulation=no | |
6493 | if test $in_tree_ld = yes ; then | |
6494 | if test "$gcc_cv_gld_major_version" -eq 2 -a \ | |
6495 | "$gcc_cv_gld_minor_version" -ge 21 -o \ | |
6496 | "$gcc_cv_gld_major_version" -gt 2 \ | |
6497 | && test $in_tree_ld_is_elf = yes; then | |
6498 | gcc_cv_ld_sol2_emulation=yes | |
6499 | fi | |
6500 | elif test x$gcc_cv_ld != x; then | |
6501 | if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \ | |
6502 | grep _sol2 > /dev/null; then | |
6503 | gcc_cv_ld_sol2_emulation=yes | |
6504 | fi | |
6505 | fi]) | |
6506 | if test x"$gcc_cv_ld_sol2_emulation" = xyes; then | |
6507 | AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1, | |
6508 | [Define if your linker supports the *_sol2 emulations.]) | |
6509 | fi | |
6510 | ||
380e5ca4 MM |
6511 | AC_CACHE_CHECK(linker --sysroot support, |
6512 | gcc_cv_ld_sysroot, | |
6513 | [gcc_cv_ld_sysroot=no | |
6514 | if test $in_tree_ld = yes ; then | |
6515 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 ; then | |
7032df40 | 6516 | gcc_cv_ld_sysroot=yes |
380e5ca4 MM |
6517 | fi |
6518 | elif test x$gcc_cv_ld != x; then | |
8dc877eb | 6519 | if $gcc_cv_ld --help 2>&1 | grep sysroot > /dev/null; then |
380e5ca4 MM |
6520 | gcc_cv_ld_sysroot=yes |
6521 | fi | |
6522 | fi]) | |
6523 | if test x"$gcc_cv_ld_sysroot" = xyes; then | |
6524 | AC_DEFINE(HAVE_LD_SYSROOT, 1, | |
6525 | [Define if your linker supports --sysroot.]) | |
6526 | fi | |
6527 | ||
2d110442 RO |
6528 | case $target in |
6529 | *-*-solaris2*) | |
6530 | # Check for system-provided CRTs on Solaris 11.x and Solaris 12. | |
6531 | AC_CACHE_CHECK([system-provided CRTs on Solaris], | |
6532 | gcc_cv_solaris_crts, | |
6533 | [gcc_cv_solaris_crts=no | |
6534 | if test x$host != x$target; then | |
6535 | if test "x$with_sysroot" = xyes; then | |
6536 | target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root" | |
6537 | else | |
6538 | target_sysroot="${with_sysroot}" | |
6539 | fi | |
6540 | fi | |
6541 | target_libdir="$target_sysroot/usr/lib" | |
6542 | # At the time they were added, gcrt1.o became a symlink for backwards | |
6543 | # compatibility on x86, while crt1.o was added on sparc, so check for that. | |
6544 | case $target in | |
6545 | i?86-*-solaris2* | x86_64-*-solaris2*) | |
6546 | if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi | |
6547 | ;; | |
6548 | sparc*-*-solaris2*) | |
6549 | if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi | |
6550 | ;; | |
6551 | esac]) | |
6552 | ;; | |
6553 | esac | |
6554 | if test x$gcc_cv_solaris_crts = xyes; then | |
6555 | AC_DEFINE(HAVE_SOLARIS_CRTS, 1, | |
6556 | [Define if the system-provided CRTs are present on Solaris.]) | |
6557 | fi | |
6558 | ||
78fd4c51 SL |
6559 | AC_ARG_ENABLE(libssp, |
6560 | [AS_HELP_STRING([--enable-libssp], [enable linking against libssp])], | |
6561 | [case "${enableval}" in | |
6562 | yes|no) | |
6563 | ;; | |
6564 | *) | |
6565 | AC_MSG_ERROR([unknown libssp setting $enableval]) | |
6566 | ;; | |
6567 | esac], []) | |
6568 | ||
77008252 | 6569 | # Test for stack protector support in target C library. |
a6ccdbab | 6570 | AC_CACHE_CHECK(__stack_chk_fail in target C library, |
78fd4c51 SL |
6571 | gcc_cv_libc_provides_ssp, |
6572 | [gcc_cv_libc_provides_ssp=no | |
6573 | if test "x$enable_libssp" = "xno"; then | |
6574 | gcc_cv_libc_provides_ssp=yes | |
6575 | elif test "x$enable_libssp" = "xyes"; then | |
6576 | gcc_cv_libc_provides_ssp=no | |
6577 | else | |
a6ccdbab | 6578 | case "$target" in |
755658a5 GR |
6579 | *-*-musl*) |
6580 | # All versions of musl provide stack protector | |
6581 | gcc_cv_libc_provides_ssp=yes;; | |
8466af06 | 6582 | *-*-linux* | *-*-kfreebsd*-gnu) |
75a2bcc0 | 6583 | # glibc 2.4 and later provides __stack_chk_fail and |
77008252 | 6584 | # either __stack_chk_guard, or TLS access to stack guard canary. |
75a2bcc0 JM |
6585 | GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_libc_provides_ssp=yes], [ |
6586 | [if test -f $target_header_dir/features.h \ | |
1a242e3c | 6587 | && $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \ |
6961669f | 6588 | $target_header_dir/features.h > /dev/null; then |
75a2bcc0 | 6589 | if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \ |
6961669f RO |
6590 | $target_header_dir/features.h > /dev/null && \ |
6591 | test -f $target_header_dir/bits/uClibc_config.h && \ | |
1a242e3c | 6592 | $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_SSP__[ ]+1' \ |
6961669f | 6593 | $target_header_dir/bits/uClibc_config.h > /dev/null; then |
fed6d628 | 6594 | gcc_cv_libc_provides_ssp=yes |
77008252 | 6595 | fi |
40295cc7 IZ |
6596 | # all versions of Bionic support stack protector |
6597 | elif test -f $target_header_dir/sys/cdefs.h \ | |
6598 | && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \ | |
6599 | $target_header_dir/sys/cdefs.h > /dev/null; then | |
6600 | gcc_cv_libc_provides_ssp=yes | |
75a2bcc0 | 6601 | fi]]) |
a6ccdbab | 6602 | ;; |
4cc115a2 TS |
6603 | *-*-gnu*) |
6604 | # Avoid complicated tests (see | |
6605 | # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now | |
6606 | # simply assert that glibc does provide this, which is true for all | |
6607 | # realistically usable GNU/Hurd configurations. | |
755658a5 | 6608 | # All supported versions of musl provide it as well |
4cc115a2 | 6609 | gcc_cv_libc_provides_ssp=yes;; |
388dc9e6 | 6610 | *-*-darwin* | *-*-freebsd* | *-*-netbsd*) |
a6ccdbab EC |
6611 | AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], |
6612 | [echo "no __stack_chk_fail on this target"]) | |
6613 | ;; | |
78fd4c51 SL |
6614 | *) gcc_cv_libc_provides_ssp=no ;; |
6615 | esac | |
6616 | fi]) | |
a6ccdbab | 6617 | |
77008252 JJ |
6618 | if test x$gcc_cv_libc_provides_ssp = xyes; then |
6619 | AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1, | |
6620 | [Define if your target C library provides stack protector support]) | |
6621 | fi | |
6622 | ||
e0f6cba0 MG |
6623 | # Check whether --enable-default-ssp was given. |
6624 | AC_ARG_ENABLE(default-ssp, | |
6625 | [AS_HELP_STRING([--enable-default-ssp], | |
6626 | [enable Stack Smashing Protection as default])],[ | |
6627 | if test x$gcc_cv_libc_provides_ssp = xyes; then | |
6628 | case "$target" in | |
6629 | ia64*-*-*) enable_default_ssp=no ;; | |
6630 | *) enable_default_ssp=$enableval ;; | |
6631 | esac | |
6632 | else | |
6633 | enable_default_ssp=no | |
6634 | fi], | |
6635 | enable_default_ssp=no) | |
9a557138 | 6636 | if test x$enable_default_ssp = xyes ; then |
e0f6cba0 MG |
6637 | AC_DEFINE(ENABLE_DEFAULT_SSP, 1, |
6638 | [Define if your target supports default stack protector and it is enabled.]) | |
6639 | fi | |
6640 | AC_SUBST([enable_default_ssp]) | |
6641 | ||
f4e749b4 TT |
6642 | # Test for <sys/sdt.h> on the target. |
6643 | GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H]) | |
6644 | AC_MSG_CHECKING(sys/sdt.h in the target C library) | |
6645 | have_sys_sdt_h=no | |
6646 | if test -f $target_header_dir/sys/sdt.h; then | |
d11aaed7 | 6647 | have_sys_sdt_h=yes |
f4e749b4 TT |
6648 | AC_DEFINE(HAVE_SYS_SDT_H, 1, |
6649 | [Define if your target C library provides sys/sdt.h]) | |
6650 | fi | |
6651 | AC_MSG_RESULT($have_sys_sdt_h) | |
6652 | ||
ed965309 JJ |
6653 | # Check if TFmode long double should be used by default or not. |
6654 | # Some glibc targets used DFmode long double, but with glibc 2.4 | |
6655 | # and later they can use TFmode. | |
6656 | case "$target" in | |
f7cc5390 | 6657 | powerpc*-*-linux* | \ |
ed965309 JJ |
6658 | sparc*-*-linux* | \ |
6659 | s390*-*-linux* | \ | |
6660 | alpha*-*-linux*) | |
6661 | AC_ARG_WITH(long-double-128, | |
b88ecf55 AS |
6662 | [AS_HELP_STRING([--with-long-double-128], |
6663 | [use 128-bit long double by default])], | |
8d7be8d6 SN |
6664 | gcc_cv_target_ldbl128="$with_long_double_128", [ |
6665 | case "$target" in | |
6666 | s390*-*-linux-musl*) | |
6667 | gcc_cv_target_ldbl128=yes | |
6668 | ;; | |
6669 | powerpc*-*-linux-musl*) | |
6670 | gcc_cv_target_ldbl128=no | |
6671 | ;; | |
6672 | *)] | |
75a2bcc0 JM |
6673 | [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [ |
6674 | [gcc_cv_target_ldbl128=no | |
ed965309 | 6675 | grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \ |
6961669f | 6676 | $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \ |
65280f6c | 6677 | && gcc_cv_target_ldbl128=yes |
8d7be8d6 SN |
6678 | ]])] |
6679 | [ | |
6680 | ;; | |
6681 | esac | |
6682 | ]) | |
ed965309 JJ |
6683 | ;; |
6684 | esac | |
6685 | if test x$gcc_cv_target_ldbl128 = xyes; then | |
6686 | AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1, | |
6687 | [Define if TFmode long double should be the default]) | |
6688 | fi | |
6689 | ||
8c7a27d5 MM |
6690 | # Check if TFmode long double target should use the IBM extended double or IEEE |
6691 | # 128-bit floating point formats if long doubles are 128-bits long. The long | |
6692 | # double type can only be switched on powerpc64 bit Linux systems where VSX is | |
6693 | # supported. Other PowerPC systems do not build the IEEE 128-bit emulator in | |
6694 | # libgcc. | |
6695 | AC_ARG_WITH([long-double-format], | |
6696 | [AS_HELP_STRING([--with-long-double-format={ieee,ibm}] | |
6697 | [Specify whether PowerPC long double uses IEEE or IBM format])],[ | |
6698 | case "$target:$with_long_double_format" in | |
6699 | powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm) | |
6700 | : | |
6701 | ;; | |
6702 | powerpc64-*-linux*:ieee | powerpc64-*-linux*:ibm) | |
6703 | # IEEE 128-bit emulation is only built on 64-bit VSX Linux systems | |
6704 | case "$with_cpu" in | |
6705 | power7 | power8 | power9 | power1*) | |
6706 | : | |
6707 | ;; | |
6708 | *) | |
6709 | AC_MSG_ERROR([Configuration option --with-long-double-format is only \ | |
6710 | supported if the default cpu is power7 or newer]) | |
6711 | with_long_double_format="" | |
6712 | ;; | |
6713 | esac | |
6714 | ;; | |
de2c1d00 | 6715 | powerpc64*-*-linux*:*) |
8c7a27d5 MM |
6716 | AC_MSG_ERROR([--with-long-double-format argument should be ibm or ieee]) |
6717 | with_long_double_format="" | |
6718 | ;; | |
6719 | *) | |
6720 | AC_MSG_ERROR([Configure option --with-long-double-format is only supported \ | |
6721 | on 64-bit PowerPC VSX Linux systems]) | |
6722 | with_long_double_format="" | |
6723 | ;; | |
6724 | esac], | |
6725 | []) | |
6726 | ||
26a2e6ae PB |
6727 | # Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP |
6728 | # values in the TCB. Currently, only GLIBC 2.23 and later support this. | |
6729 | gcc_cv_libc_provides_hwcap_in_tcb=no | |
6730 | case "$target" in | |
6731 | powerpc*-*-linux*) | |
6732 | GCC_GLIBC_VERSION_GTE_IFELSE([2], [23], [gcc_cv_libc_provides_hwcap_in_tcb=yes], ) | |
6733 | ;; | |
6734 | esac | |
6735 | if test x$gcc_cv_libc_provides_hwcap_in_tcb = xyes; then | |
6736 | AC_DEFINE(TARGET_LIBC_PROVIDES_HWCAP_IN_TCB, 1, | |
6737 | [Define if your target C Library provides the AT_HWCAP value in the TCB]) | |
6738 | fi | |
6739 | ||
54b3d52c DM |
6740 | # Check if the target LIBC handles PT_GNU_STACK. |
6741 | gcc_cv_libc_gnustack=unknown | |
6742 | case "$target" in | |
6743 | mips*-*-linux*) | |
6744 | GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], ) | |
6745 | ;; | |
6746 | esac | |
6747 | if test x$gcc_cv_libc_gnustack = xyes; then | |
6748 | AC_DEFINE(TARGET_LIBC_GNUSTACK, 1, | |
6749 | [Define if your target C Library properly handles PT_GNU_STACK]) | |
6750 | fi | |
6751 | ||
6961669f RO |
6752 | AC_MSG_CHECKING(dl_iterate_phdr in target C library) |
6753 | gcc_cv_target_dl_iterate_phdr=unknown | |
6754 | case "$target" in | |
ccd1242e | 6755 | *-*-solaris2*) |
6961669f RO |
6756 | # <link.h> needs both a dl_iterate_phdr declaration and support for |
6757 | # compilation with largefile support. | |
6758 | if grep dl_iterate_phdr $target_header_dir/link.h > /dev/null 2>&1 \ | |
6759 | && grep 'large file capable' $target_header_dir/link.h > /dev/null 2>&1; then | |
6760 | gcc_cv_target_dl_iterate_phdr=yes | |
6761 | else | |
6762 | gcc_cv_target_dl_iterate_phdr=no | |
6763 | fi | |
6764 | ;; | |
dbed5a9b JM |
6765 | *-*-dragonfly* | *-*-freebsd*) |
6766 | if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then | |
6767 | gcc_cv_target_dl_iterate_phdr=yes | |
6768 | else | |
6769 | gcc_cv_target_dl_iterate_phdr=no | |
6770 | fi | |
6771 | ;; | |
755658a5 GR |
6772 | *-linux-musl*) |
6773 | gcc_cv_target_dl_iterate_phdr=yes | |
6774 | ;; | |
6961669f RO |
6775 | esac |
6776 | GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) | |
6777 | if test x$gcc_cv_target_dl_iterate_phdr = xyes; then | |
6778 | AC_DEFINE(TARGET_DL_ITERATE_PHDR, 1, | |
6779 | [Define if your target C library provides the `dl_iterate_phdr' function.]) | |
6780 | fi | |
6781 | AC_MSG_RESULT($gcc_cv_target_dl_iterate_phdr) | |
6782 | ||
cd030c07 DN |
6783 | # We no longer support different GC mechanisms. Emit an error if |
6784 | # the user configures with --with-gc. | |
81bf3d9e | 6785 | AC_ARG_WITH(gc, |
b88ecf55 | 6786 | [AS_HELP_STRING([--with-gc={page,zone}], |
cd030c07 DN |
6787 | [this option is not supported anymore. It used to choose |
6788 | the garbage collection mechanism to use with the compiler])], | |
6789 | [AC_MSG_ERROR([Configure option --with-gc is only supported up to GCC 4.7.x])], | |
6790 | []) | |
81bf3d9e | 6791 | |
00020c16 ILT |
6792 | # Libraries to use on the host. This will normally be set by the top |
6793 | # level Makefile. Here we simply capture the value for our Makefile. | |
6794 | if test -z "${HOST_LIBS+set}"; then | |
6795 | HOST_LIBS= | |
6796 | fi | |
6797 | AC_SUBST(HOST_LIBS) | |
6798 | ||
3c809ba4 | 6799 | # Use the system's zlib library. |
96a58590 | 6800 | AM_ZLIB |
3c809ba4 | 6801 | |
dc6746e7 PT |
6802 | dnl Very limited version of automake's enable-maintainer-mode |
6803 | ||
6804 | AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) | |
6805 | dnl maintainer-mode is disabled by default | |
6806 | AC_ARG_ENABLE(maintainer-mode, | |
b88ecf55 AS |
6807 | [AS_HELP_STRING([--enable-maintainer-mode], |
6808 | [enable make rules and dependencies not useful | |
6809 | (and sometimes confusing) to the casual installer])], | |
dc6746e7 PT |
6810 | maintainer_mode=$enableval, |
6811 | maintainer_mode=no) | |
6812 | ||
6813 | AC_MSG_RESULT($maintainer_mode) | |
6814 | ||
6815 | if test "$maintainer_mode" = "yes"; then | |
6816 | MAINT='' | |
6817 | else | |
6818 | MAINT='#' | |
6819 | fi | |
6820 | AC_SUBST(MAINT)dnl | |
6821 | ||
427b248d JM |
6822 | dnl Whether to prevent multiple front-ends from linking at the same time |
6823 | ||
6824 | AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once]) | |
6825 | AC_ARG_ENABLE(link-mutex, | |
6826 | [AS_HELP_STRING([--enable-link-mutex], | |
6827 | [avoid linking multiple front-ends at once to avoid thrashing | |
6828 | on the build machine])], | |
6829 | do_link_mutex=$enableval, | |
6830 | do_link_mutex=no) | |
6831 | AC_MSG_RESULT($do_link_mutex) | |
6832 | ||
6833 | if test "$do_link_mutex" = "yes"; then | |
6834 | DO_LINK_MUTEX=true | |
6835 | else | |
6836 | DO_LINK_MUTEX=false | |
6837 | fi | |
6838 | AC_SUBST(DO_LINK_MUTEX) | |
6839 | ||
d326ebc9 JJ |
6840 | dnl Whether to prevent multiple GCC front-ends from linking at the same time |
6841 | ||
6842 | AC_MSG_CHECKING([whether to serialize linking of multiple front-ends]) | |
6843 | AC_ARG_ENABLE(link-serialization, | |
6844 | [AS_HELP_STRING([--enable-link-serialization], | |
6845 | [avoid linking multiple GCC front-ends at once using make | |
6846 | dependencies to avoid thrashing on the build machine])], | |
6847 | do_link_serialization=$enableval, | |
6848 | do_link_serialization=no) | |
6849 | AC_MSG_RESULT($do_link_serialization) | |
6850 | ||
6851 | case "$do_link_serialization" in | |
6852 | yes) | |
6853 | DO_LINK_SERIALIZATION=1;; | |
6854 | [[1-9]] | [[1-9]][[0-9]] | [[1-9]][[0-9]][[0-9]]) | |
6855 | DO_LINK_SERIALIZATION=$do_link_serialization;; | |
6856 | no) | |
6857 | DO_LINK_SERIALIZATION=;; | |
6858 | *) | |
6859 | AC_MSG_ERROR(bad value ${do_link_serialization} given for --enable-link-serialization) ;; | |
6860 | esac | |
6861 | AC_SUBST(DO_LINK_SERIALIZATION) | |
6862 | ||
630327c3 NN |
6863 | # -------------- |
6864 | # Language hooks | |
6865 | # -------------- | |
6866 | ||
571a8de5 DE |
6867 | # Make empty files to contain the specs and options for each language. |
6868 | # Then add #include lines to for a compiler that has specs and/or options. | |
6869 | ||
cc11cc9b | 6870 | subdirs= |
d7b42618 | 6871 | lang_opt_files= |
571a8de5 | 6872 | lang_specs_files= |
3103b7db | 6873 | lang_tree_files= |
571a8de5 DE |
6874 | # These (without "all_") are set in each config-lang.in. |
6875 | # `language' must be a single word so is spelled singularly. | |
6876 | all_languages= | |
571a8de5 | 6877 | all_compilers= |
fda9c731 | 6878 | all_outputs='Makefile' |
223bf296 TS |
6879 | # List of language configure and makefile fragments. |
6880 | all_lang_configurefrags= | |
2ed26f6b | 6881 | all_lang_makefrags= |
11a67599 | 6882 | # Additional files for gengtype |
ef69da62 | 6883 | all_gtfiles="$target_gtfiles" |
571a8de5 | 6884 | |
cc11cc9b PB |
6885 | # These are the languages that are set in --enable-languages, |
6886 | # and are available in the GCC tree. | |
6887 | all_selected_languages= | |
6888 | ||
571a8de5 DE |
6889 | # Add the language fragments. |
6890 | # Languages are added via two mechanisms. Some information must be | |
6891 | # recorded in makefile variables, these are defined in config-lang.in. | |
6892 | # We accumulate them and plug them into the main Makefile. | |
6893 | # The other mechanism is a set of hooks for each of the main targets | |
6894 | # like `clean', `install', etc. | |
6895 | ||
571a8de5 DE |
6896 | language_hooks="Make-hooks" |
6897 | ||
cc11cc9b | 6898 | for lang in ${srcdir}/*/config-lang.in |
571a8de5 | 6899 | do |
cc11cc9b | 6900 | changequote(,)dnl |
1546bb64 PB |
6901 | test "$lang" = "${srcdir}/*/config-lang.in" && continue |
6902 | ||
cc11cc9b PB |
6903 | lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` |
6904 | if test "x$lang_alias" = x | |
6905 | then | |
6906 | echo "$lang doesn't set \$language." 1>&2 | |
6907 | exit 1 | |
6908 | fi | |
6909 | subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" | |
6910 | subdirs="$subdirs $subdir" | |
349c3166 OH |
6911 | |
6912 | # $gcc_subdir is where the gcc integration files are to be found | |
6913 | # for a language, both for internal compiler purposes (compiler | |
6914 | # sources implementing front-end to GCC tree converters), and for | |
6915 | # build infrastructure purposes (Make-lang.in, etc.) | |
6916 | # | |
6917 | # This will be <subdir> (relative to $srcdir) if a line like | |
6918 | # gcc_subdir="<subdir>" or gcc_subdir=<subdir> | |
6919 | # is found in <langdir>/config-lang.in, and will remain <langdir> | |
6920 | # otherwise. | |
6921 | # | |
6922 | # Except for the language alias (fetched above), the regular | |
6923 | # "config-lang.in" contents are always retrieved from $gcc_subdir, | |
6924 | # so a <langdir>/config-lang.in setting gcc_subdir typically sets | |
6925 | # only this and the language alias. | |
6926 | ||
6927 | gcc_subdir=`sed -n -e 's,^gcc_subdir=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^gcc_subdir=\([^ ]*\).*$,\1,p' $lang` | |
6928 | if [ "$gcc_subdir" = "" ]; then | |
6929 | gcc_subdir="$subdir" | |
6930 | fi | |
6931 | ||
cc11cc9b PB |
6932 | case ",$enable_languages," in |
6933 | *,$lang_alias,*) | |
6934 | all_selected_languages="$all_selected_languages $lang_alias" | |
349c3166 OH |
6935 | if test -f $srcdir/$gcc_subdir/lang-specs.h; then |
6936 | lang_specs_files="$lang_specs_files $srcdir/$gcc_subdir/lang-specs.h" | |
cc11cc9b PB |
6937 | fi |
6938 | ;; | |
6939 | esac | |
6940 | changequote([,])dnl | |
6941 | ||
cc11cc9b PB |
6942 | language= |
6943 | boot_language= | |
6944 | compilers= | |
cc11cc9b PB |
6945 | outputs= |
6946 | gtfiles= | |
1546bb64 | 6947 | subdir_requires= |
349c3166 | 6948 | . ${srcdir}/$gcc_subdir/config-lang.in |
cc11cc9b PB |
6949 | if test "x$language" = x |
6950 | then | |
349c3166 | 6951 | echo "${srcdir}/$gcc_subdir/config-lang.in doesn't set \$language." 1>&2 |
cc11cc9b PB |
6952 | exit 1 |
6953 | fi | |
1546bb64 PB |
6954 | |
6955 | ok=: | |
6956 | case ",$enable_languages," in | |
6957 | *,$lang_alias,*) ;; | |
6958 | *) | |
6959 | for i in $subdir_requires; do | |
b6348cb3 | 6960 | test -f "${srcdir}/$i/config-lang.in" && continue |
1546bb64 PB |
6961 | ok=false |
6962 | break | |
6963 | done | |
6964 | ;; | |
6965 | esac | |
6966 | $ok || continue | |
6967 | ||
223bf296 | 6968 | all_lang_configurefrags="$all_lang_configurefrags \$(srcdir)/$gcc_subdir/config-lang.in" |
349c3166 OH |
6969 | all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in" |
6970 | if test -f $srcdir/$gcc_subdir/lang.opt; then | |
6971 | lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt" | |
fd438373 | 6972 | all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt" |
1546bb64 | 6973 | fi |
349c3166 OH |
6974 | if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then |
6975 | lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def" | |
1546bb64 | 6976 | fi |
cc11cc9b | 6977 | all_languages="$all_languages $language" |
cc11cc9b | 6978 | all_compilers="$all_compilers $compilers" |
cc11cc9b | 6979 | all_outputs="$all_outputs $outputs" |
11a67599 | 6980 | all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles" |
d7f09764 DN |
6981 | case ",$enable_languages," in |
6982 | *,lto,*) | |
6983 | AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.]) | |
6984 | enable_lto=yes | |
6985 | AC_SUBST(enable_lto) | |
6986 | ;; | |
6987 | *) ;; | |
6988 | esac | |
571a8de5 DE |
6989 | done |
6990 | ||
cbc59f01 | 6991 | check_languages= |
cc11cc9b | 6992 | for language in $all_selected_languages |
cbc59f01 | 6993 | do |
cc11cc9b | 6994 | check_languages="$check_languages check-$language" |
cbc59f01 DD |
6995 | done |
6996 | ||
033eb567 DM |
6997 | selftest_languages= |
6998 | for language in $all_selected_languages | |
6999 | do | |
7000 | selftest_languages="$selftest_languages selftest-$language" | |
7001 | done | |
7002 | ||
62b81e45 | 7003 | # We link each language in with a set of hooks, reached indirectly via |
cc11cc9b | 7004 | # lang.${target}. Only do so for selected languages. |
571a8de5 DE |
7005 | |
7006 | rm -f Make-hooks | |
7007 | touch Make-hooks | |
bd97af06 | 7008 | target_list="all.cross start.encap rest.encap tags \ |
55bcd32b AJ |
7009 | install-common install-man install-info install-pdf install-html dvi \ |
7010 | pdf html uninstall info man srcextra srcman srcinfo \ | |
2a4c0366 | 7011 | mostlyclean clean distclean maintainer-clean install-plugin" |
cc11cc9b | 7012 | |
571a8de5 DE |
7013 | for t in $target_list |
7014 | do | |
7015 | x= | |
cc11cc9b | 7016 | for lang in $all_selected_languages |
571a8de5 | 7017 | do |
cc11cc9b | 7018 | x="$x $lang.$t" |
571a8de5 DE |
7019 | done |
7020 | echo "lang.$t: $x" >> Make-hooks | |
7021 | done | |
7022 | ||
d326ebc9 JJ |
7023 | echo "ifeq (\$(DO_LINK_SERIALIZATION),)" >> Make-hooks |
7024 | echo "SERIAL_LIST =" >> Make-hooks | |
7025 | echo else >> Make-hooks | |
7026 | lang_cnt=0 | |
7027 | lang_list= | |
a774a6a2 | 7028 | prev=c |
d326ebc9 JJ |
7029 | serialization_languages=c |
7030 | for lang in $all_selected_languages | |
7031 | do | |
7032 | test $lang = c && continue | |
7033 | if test $lang = lto; then | |
7034 | serialization_languages="$serialization_languages lto1 lto2" | |
7035 | else | |
7036 | serialization_languages="$serialization_languages $lang" | |
7037 | fi | |
7038 | done | |
7039 | for lang in $serialization_languages | |
7040 | do | |
7041 | test $lang = c && continue | |
7042 | lang_cnt=`expr $lang_cnt + 1` | |
7043 | lang_list=" $prev$lang_list" | |
a774a6a2 | 7044 | prev=${lang} |
d326ebc9 JJ |
7045 | done |
7046 | echo "SERIAL_LIST = \$(wordlist \$(DO_LINK_SERIALIZATION),$lang_cnt,$lang_list)" >> Make-hooks | |
7047 | echo endif >> Make-hooks | |
7048 | echo "SERIAL_COUNT = `expr $lang_cnt + 1`" >> Make-hooks | |
7049 | echo "INDEX.c = 0" >> Make-hooks | |
7050 | lang_idx=1 | |
7051 | for lang in $serialization_languages | |
7052 | do | |
7053 | test $lang = c && continue | |
a774a6a2 | 7054 | echo "$lang.prev = \$(if \$(word $lang_cnt,\$(SERIAL_LIST)),\$(\$(word $lang_cnt,\$(SERIAL_LIST)).serial))" >> Make-hooks |
d326ebc9 JJ |
7055 | echo "INDEX.$lang = $lang_idx" >> Make-hooks |
7056 | lang_cnt=`expr $lang_cnt - 1` | |
7057 | lang_idx=`expr $lang_idx + 1` | |
7058 | done | |
7059 | ||
fd438373 MM |
7060 | # -------- |
7061 | # Option include files | |
7062 | # -------- | |
7063 | ||
7064 | ${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk | |
7065 | option_includes="option-includes.mk" | |
7066 | AC_SUBST_FILE(option_includes) | |
7067 | ||
630327c3 NN |
7068 | # -------- |
7069 | # UNSORTED | |
7070 | # -------- | |
7071 | ||
cc06d68c | 7072 | # Create .gdbinit. |
296e46bd | 7073 | |
cc06d68c GP |
7074 | echo "dir ." > .gdbinit |
7075 | echo "dir ${srcdir}" >> .gdbinit | |
7076 | if test x$gdb_needs_out_file_path = xyes | |
7077 | then | |
7078 | echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit | |
7079 | fi | |
7080 | if test "x$subdirs" != x; then | |
7081 | for s in $subdirs | |
7082 | do | |
7083 | echo "dir ${srcdir}/$s" >> .gdbinit | |
7084 | done | |
296e46bd | 7085 | fi |
cc06d68c | 7086 | echo "source ${srcdir}/gdbinit.in" >> .gdbinit |
8dce4dbc | 7087 | echo "python import sys; sys.path.append('${srcdir}'); import gdbhooks" >> .gdbinit |
296e46bd | 7088 | |
3bd7b086 L |
7089 | # Put a breakpoint on __asan_report_error to help with debugging buffer |
7090 | # overflow. | |
7091 | case "$CFLAGS" in | |
7092 | *-fsanitize=address*) | |
7093 | echo "source ${srcdir}/gdbasan.in" >> .gdbinit | |
7094 | ;; | |
7095 | esac | |
7096 | ||
15c723f3 | 7097 | gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)' |
d062c304 | 7098 | AC_SUBST(gcc_tooldir) |
4c112cda | 7099 | AC_SUBST(dollar) |
d062c304 | 7100 | |
2bbea3a6 RH |
7101 | # Find a directory in which to install a shared libgcc. |
7102 | ||
7103 | AC_ARG_ENABLE(version-specific-runtime-libs, | |
b88ecf55 AS |
7104 | [AS_HELP_STRING([--enable-version-specific-runtime-libs], |
7105 | [specify that runtime libraries should be | |
7106 | installed in a compiler-specific directory])]) | |
2bbea3a6 | 7107 | |
46f18e7b RK |
7108 | # Substitute configuration variables |
7109 | AC_SUBST(subdirs) | |
8ac9d31f | 7110 | AC_SUBST(srcdir) |
46f18e7b | 7111 | AC_SUBST(all_compilers) |
e2500fed | 7112 | AC_SUBST(all_gtfiles) |
223bf296 | 7113 | AC_SUBST(all_lang_configurefrags) |
2ed26f6b | 7114 | AC_SUBST(all_lang_makefrags) |
9f3d1bc2 | 7115 | AC_SUBST(all_languages) |
cc11cc9b | 7116 | AC_SUBST(all_selected_languages) |
9f3d1bc2 BK |
7117 | AC_SUBST(build_exeext) |
7118 | AC_SUBST(build_install_headers_dir) | |
7119 | AC_SUBST(build_xm_file_list) | |
e22340b0 | 7120 | AC_SUBST(build_xm_include_list) |
11642c3a | 7121 | AC_SUBST(build_xm_defines) |
a0e527e3 | 7122 | AC_SUBST(build_file_translate) |
cbc59f01 | 7123 | AC_SUBST(check_languages) |
033eb567 | 7124 | AC_SUBST(selftest_languages) |
9f3d1bc2 | 7125 | AC_SUBST(cpp_install_dir) |
2ed26f6b ZW |
7126 | AC_SUBST(xmake_file) |
7127 | AC_SUBST(tmake_file) | |
aca600aa AS |
7128 | AC_SUBST(TM_ENDIAN_CONFIG) |
7129 | AC_SUBST(TM_MULTILIB_CONFIG) | |
7130 | AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG) | |
30500d84 | 7131 | AC_SUBST(extra_gcc_objs) |
9b91e436 KT |
7132 | AC_SUBST(user_headers_inc_next_pre) |
7133 | AC_SUBST(user_headers_inc_next_post) | |
9f3d1bc2 | 7134 | AC_SUBST(extra_headers_list) |
46f18e7b | 7135 | AC_SUBST(extra_objs) |
9f3d1bc2 | 7136 | AC_SUBST(extra_programs) |
9f3d1bc2 | 7137 | AC_SUBST(float_h_file) |
cc1e60ea | 7138 | AC_SUBST(gcc_config_arguments) |
9f3d1bc2 | 7139 | AC_SUBST(gcc_gxx_include_dir) |
17719d09 | 7140 | AC_SUBST(gcc_gxx_include_dir_add_sysroot) |
662b9c55 IS |
7141 | AC_SUBST(gcc_gxx_libcxx_include_dir) |
7142 | AC_SUBST(gcc_gxx_libcxx_include_dir_add_sysroot) | |
9f3d1bc2 | 7143 | AC_SUBST(host_exeext) |
46f18e7b | 7144 | AC_SUBST(host_xm_file_list) |
e22340b0 | 7145 | AC_SUBST(host_xm_include_list) |
11642c3a | 7146 | AC_SUBST(host_xm_defines) |
476d9098 | 7147 | AC_SUBST(out_host_hook_obj) |
9f3d1bc2 | 7148 | AC_SUBST(install) |
d7b42618 | 7149 | AC_SUBST(lang_opt_files) |
9f3d1bc2 | 7150 | AC_SUBST(lang_specs_files) |
3103b7db | 7151 | AC_SUBST(lang_tree_files) |
46f18e7b | 7152 | AC_SUBST(local_prefix) |
9f3d1bc2 BK |
7153 | AC_SUBST(md_file) |
7154 | AC_SUBST(objc_boehm_gc) | |
7155 | AC_SUBST(out_file) | |
7156 | AC_SUBST(out_object_file) | |
c49a6962 JM |
7157 | AC_SUBST(common_out_file) |
7158 | AC_SUBST(common_out_object_file) | |
9f3d1bc2 | 7159 | AC_SUBST(tm_file_list) |
e22340b0 | 7160 | AC_SUBST(tm_include_list) |
d5355cb2 | 7161 | AC_SUBST(tm_defines) |
11642c3a | 7162 | AC_SUBST(tm_p_file_list) |
e22340b0 | 7163 | AC_SUBST(tm_p_include_list) |
b4c522fa IB |
7164 | AC_SUBST(tm_d_file_list) |
7165 | AC_SUBST(tm_d_include_list) | |
e22340b0 ZW |
7166 | AC_SUBST(xm_file_list) |
7167 | AC_SUBST(xm_include_list) | |
3d9d2476 | 7168 | AC_SUBST(xm_defines) |
207bf79d | 7169 | AC_SUBST(use_gcc_stdint) |
aac69a49 NC |
7170 | AC_SUBST(c_target_objs) |
7171 | AC_SUBST(cxx_target_objs) | |
c776a6d0 | 7172 | AC_SUBST(fortran_target_objs) |
b4c522fa | 7173 | AC_SUBST(d_target_objs) |
11642c3a | 7174 | AC_SUBST(target_cpu_default) |
46f18e7b | 7175 | |
46f18e7b RK |
7176 | AC_SUBST_FILE(language_hooks) |
7177 | ||
7903cebc NN |
7178 | # Echo link setup. |
7179 | if test x${build} = x${host} ; then | |
7180 | if test x${host} = x${target} ; then | |
7181 | echo "Links are now set up to build a native compiler for ${target}." 1>&2 | |
7182 | else | |
7183 | echo "Links are now set up to build a cross-compiler" 1>&2 | |
7184 | echo " from ${host} to ${target}." 1>&2 | |
7185 | fi | |
46f18e7b | 7186 | else |
7903cebc NN |
7187 | if test x${host} = x${target} ; then |
7188 | echo "Links are now set up to build (on ${build}) a native compiler" 1>&2 | |
7189 | echo " for ${target}." 1>&2 | |
7190 | else | |
7191 | echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2 | |
7192 | echo " from ${host} to ${target}." 1>&2 | |
7193 | fi | |
46f18e7b RK |
7194 | fi |
7195 | ||
6de9cd9a DN |
7196 | AC_ARG_VAR(GMPLIBS,[How to link GMP]) |
7197 | AC_ARG_VAR(GMPINC,[How to find GMP include files]) | |
7198 | ||
e357a5e0 SP |
7199 | AC_ARG_VAR(ISLLIBS,[How to link isl]) |
7200 | AC_ARG_VAR(ISLINC,[How to find isl include files]) | |
eae1a5d4 RG |
7201 | if test "x${ISLLIBS}" != "x" ; then |
7202 | AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.]) | |
7203 | fi | |
f8bf9252 | 7204 | |
ddc8de03 | 7205 | GCC_ENABLE_PLUGINS |
68a607d8 DN |
7206 | AC_SUBST(pluginlibs) |
7207 | AC_SUBST(enable_plugin) | |
7208 | if test x"$enable_plugin" = x"yes"; then | |
7209 | AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.]) | |
7210 | fi | |
7211 | ||
87e6d9dc | 7212 | |
459260ec DM |
7213 | # Enable --enable-host-shared |
7214 | AC_ARG_ENABLE(host-shared, | |
7215 | [AS_HELP_STRING([--enable-host-shared], | |
7216 | [build host code as shared libraries])], | |
7217 | [PICFLAG=-fPIC], [PICFLAG=]) | |
7218 | AC_SUBST(enable_host_shared) | |
7219 | AC_SUBST(PICFLAG) | |
7220 | ||
7221 | ||
87e6d9dc TB |
7222 | AC_ARG_ENABLE(libquadmath-support, |
7223 | [AS_HELP_STRING([--disable-libquadmath-support], | |
7224 | [disable libquadmath support for Fortran])], | |
7225 | ENABLE_LIBQUADMATH_SUPPORT=$enableval, | |
7226 | ENABLE_LIBQUADMATH_SUPPORT=yes) | |
7227 | if test "${ENABLE_LIBQUADMATH_SUPPORT}" != "no" ; then | |
7228 | AC_DEFINE(ENABLE_LIBQUADMATH_SUPPORT, 1, | |
7229 | [Define to 1 to enable libquadmath support]) | |
7230 | fi | |
7231 | ||
7232 | ||
79bec923 ST |
7233 | # Specify what hash style to use by default. |
7234 | AC_ARG_WITH([linker-hash-style], | |
7235 | [AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}], | |
7236 | [specify the linker hash style])], | |
7237 | [case x"$withval" in | |
7238 | xsysv) | |
7239 | LINKER_HASH_STYLE=sysv | |
7240 | ;; | |
7241 | xgnu) | |
7242 | LINKER_HASH_STYLE=gnu | |
7243 | ;; | |
7244 | xboth) | |
7245 | LINKER_HASH_STYLE=both | |
7246 | ;; | |
7247 | *) | |
7248 | AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style]) | |
7249 | ;; | |
7250 | esac], | |
7251 | [LINKER_HASH_STYLE='']) | |
7252 | if test x"${LINKER_HASH_STYLE}" != x; then | |
7253 | AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE", | |
7254 | [The linker hash style]) | |
7255 | fi | |
7256 | ||
899c78ae JJ |
7257 | # Specify what should be the default of -fdiagnostics-color option. |
7258 | AC_ARG_WITH([diagnostics-color], | |
7259 | [AC_HELP_STRING([--with-diagnostics-color={never,auto,auto-if-env,always}], | |
7260 | [specify the default of -fdiagnostics-color option | |
7261 | auto-if-env stands for -fdiagnostics-color=auto if | |
7262 | GCC_COLOR environment variable is present and | |
7263 | -fdiagnostics-color=never otherwise])], | |
7264 | [case x"$withval" in | |
7265 | xnever) | |
7266 | DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_NO | |
7267 | ;; | |
7268 | xauto) | |
7269 | DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO | |
7270 | ;; | |
7271 | xauto-if-env) | |
7272 | DIAGNOSTICS_COLOR_DEFAULT=-1 | |
7273 | ;; | |
7274 | xalways) | |
7275 | DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_YES | |
7276 | ;; | |
7277 | *) | |
7278 | AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-color]) | |
7279 | ;; | |
7280 | esac], | |
7281 | [DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO]) | |
7282 | AC_DEFINE_UNQUOTED(DIAGNOSTICS_COLOR_DEFAULT, $DIAGNOSTICS_COLOR_DEFAULT, | |
7283 | [The default for -fdiagnostics-color option]) | |
7284 | ||
458c8d64 BE |
7285 | # Specify what should be the default of -fdiagnostics-urls option. |
7286 | AC_ARG_WITH([diagnostics-urls], | |
7287 | [AC_HELP_STRING([--with-diagnostics-urls={never,auto,auto-if-env,always}], | |
7288 | [specify the default of -fdiagnostics-urls option | |
7289 | auto-if-env stands for -fdiagnostics-urls=auto if | |
7290 | GCC_URLS or TERM_URLS environment variable is present and | |
7291 | -fdiagnostics-urls=never otherwise])], | |
7292 | [case x"$withval" in | |
7293 | xnever) | |
7294 | DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_NO | |
7295 | ;; | |
7296 | xauto) | |
7297 | DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_AUTO | |
7298 | ;; | |
7299 | xauto-if-env) | |
7300 | DIAGNOSTICS_URLS_DEFAULT=-1 | |
7301 | ;; | |
7302 | xalways) | |
7303 | DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_YES | |
7304 | ;; | |
7305 | *) | |
7306 | AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-urls]) | |
7307 | ;; | |
7308 | esac], | |
7309 | [DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_AUTO]) | |
7310 | AC_DEFINE_UNQUOTED(DIAGNOSTICS_URLS_DEFAULT, $DIAGNOSTICS_URLS_DEFAULT, | |
7311 | [The default for -fdiagnostics-urls option]) | |
7312 | ||
35485da9 DM |
7313 | # Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit |
7314 | # of jit/jit-playback.c. | |
001ddaa8 DM |
7315 | gcc_driver_version=`eval "${get_gcc_base_ver} $srcdir/BASE-VER"` |
7316 | echo "gcc_driver_version: ${gcc_driver_version}" | |
35485da9 | 7317 | cat > gcc-driver-name.h <<EOF |
001ddaa8 | 7318 | #define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_driver_version}${exeext}" |
35485da9 DM |
7319 | EOF |
7320 | ||
428b3812 L |
7321 | # Check whether --enable-default-pie was given. |
7322 | AC_ARG_ENABLE(default-pie, | |
7323 | [AS_HELP_STRING([--enable-default-pie], | |
7324 | [enable Position Independent Executable as default])], | |
7325 | enable_default_pie=$enableval, | |
7326 | enable_default_pie=no) | |
9a557138 | 7327 | if test x$enable_default_pie = xyes ; then |
428b3812 L |
7328 | AC_DEFINE(ENABLE_DEFAULT_PIE, 1, |
7329 | [Define if your target supports default PIE and it is enabled.]) | |
7330 | fi | |
7331 | AC_SUBST([enable_default_pie]) | |
7332 | ||
7333 | # Check if -fno-PIE works. | |
7334 | AC_CACHE_CHECK([for -fno-PIE option], | |
7335 | [gcc_cv_c_no_fpie], | |
fee22a80 L |
7336 | [saved_CXXFLAGS="$CXXFLAGS" |
7337 | CXXFLAGS="$CXXFLAGS -fno-PIE" | |
22e05272 | 7338 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], |
428b3812 L |
7339 | [gcc_cv_c_no_fpie=yes], |
7340 | [gcc_cv_c_no_fpie=no]) | |
fee22a80 | 7341 | CXXFLAGS="$saved_CXXFLAGS"]) |
428b3812 L |
7342 | if test "$gcc_cv_c_no_fpie" = "yes"; then |
7343 | NO_PIE_CFLAGS="-fno-PIE" | |
7344 | fi | |
7345 | AC_SUBST([NO_PIE_CFLAGS]) | |
7346 | ||
7347 | # Check if -no-pie works. | |
7348 | AC_CACHE_CHECK([for -no-pie option], | |
7349 | [gcc_cv_no_pie], | |
7350 | [saved_LDFLAGS="$LDFLAGS" | |
7351 | LDFLAGS="$LDFLAGS -no-pie" | |
22e05272 | 7352 | AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], |
428b3812 L |
7353 | [gcc_cv_no_pie=yes], |
7354 | [gcc_cv_no_pie=no]) | |
7355 | LDFLAGS="$saved_LDFLAGS"]) | |
7356 | if test "$gcc_cv_no_pie" = "yes"; then | |
7357 | NO_PIE_FLAG="-no-pie" | |
7358 | fi | |
7359 | AC_SUBST([NO_PIE_FLAG]) | |
7360 | ||
7e9c5bb0 L |
7361 | # Enable Intel CET on Intel CET enabled host if jit is enabled. |
7362 | GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) | |
7363 | case x$enable_languages in | |
7364 | *jit*) | |
7365 | ;; | |
7366 | *) | |
7367 | CET_HOST_FLAGS= | |
7368 | ;; | |
7369 | esac | |
7370 | AC_SUBST(CET_HOST_FLAGS) | |
7371 | ||
6de59c8a IE |
7372 | # Check linker supports '-z bndplt' |
7373 | ld_bndplt_support=no | |
7374 | AC_MSG_CHECKING(linker -z bndplt option) | |
7375 | if test x"$ld_is_gold" = xno; then | |
7376 | if test $in_tree_ld = yes ; then | |
7377 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then | |
7378 | ld_bndplt_support=yes | |
7379 | fi | |
7380 | elif test x$gcc_cv_ld != x; then | |
7381 | # Check if linker supports -a bndplt option | |
8dc877eb | 7382 | if $gcc_cv_ld --help 2>&1 | grep -- '-z bndplt' > /dev/null; then |
6de59c8a IE |
7383 | ld_bndplt_support=yes |
7384 | fi | |
7385 | fi | |
7386 | fi | |
7387 | if test x"$ld_bndplt_support" = xyes; then | |
7388 | AC_DEFINE(HAVE_LD_BNDPLT_SUPPORT, 1, | |
7389 | [Define if your linker supports -z bndplt]) | |
7390 | fi | |
7391 | AC_MSG_RESULT($ld_bndplt_support) | |
7392 | ||
7e495577 AI |
7393 | # Check linker supports '--push-state'/'--pop-state' |
7394 | ld_pushpopstate_support=no | |
7395 | AC_MSG_CHECKING(linker --push-state/--pop-state options) | |
7396 | if test x"$ld_is_gold" = xno; then | |
7397 | if test $in_tree_ld = yes ; then | |
7398 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then | |
7399 | ld_pushpopstate_support=yes | |
7400 | fi | |
7401 | elif test x$gcc_cv_ld != x; then | |
7402 | # Check if linker supports --push-state/--pop-state options | |
8dc877eb | 7403 | if $gcc_cv_ld --help 2>&1 | grep -- '--push-state' > /dev/null; then |
7e495577 AI |
7404 | ld_pushpopstate_support=yes |
7405 | fi | |
7406 | fi | |
7407 | fi | |
7408 | if test x"$ld_pushpopstate_support" = xyes; then | |
7409 | AC_DEFINE(HAVE_LD_PUSHPOPSTATE_SUPPORT, 1, | |
7410 | [Define if your linker supports --push-state/--pop-state]) | |
7411 | fi | |
7412 | AC_MSG_RESULT($ld_pushpopstate_support) | |
7413 | ||
a5dd6b69 MH |
7414 | # On s390, float_t has historically been statically defined as double for no |
7415 | # good reason. To comply with the C standard in the light of this definition, | |
7416 | # gcc has evaluated float expressions in double precision when in | |
7417 | # standards-compatible mode or when given -fexcess-precision=standard. To enable | |
7418 | # a smooth transition towards the new model used by most architectures, where | |
7419 | # gcc describes its behavior via the macro __FLT_EVAL_METHOD__ and glibc derives | |
7420 | # float_t from that, this behavior can be configured with | |
7421 | # --enable-s390-excess-float-precision. When given as enabled, that flag selects | |
33f92509 MH |
7422 | # the old model. When omitted, native builds and cross compiles that have target |
7423 | # libc headers will detect whether libc clamps float_t to double and in that | |
7424 | # case maintain the old model. Otherwise, they will default to the new model. | |
a5dd6b69 MH |
7425 | AC_ARG_ENABLE(s390-excess-float-precision, |
7426 | [AS_HELP_STRING([--enable-s390-excess-float-precision], | |
7427 | [on s390 targets, evaluate float with double precision | |
7428 | when in standards-conforming mode])], | |
7429 | [],[enable_s390_excess_float_precision=auto]) | |
7430 | ||
7431 | case $target in | |
7432 | s390*-linux*) | |
33f92509 MH |
7433 | if test x"$enable_s390_excess_float_precision" = xauto; then |
7434 | # Can we autodetect the behavior of the target libc? | |
7435 | if test "$target" = "$host" -a "$host" = "$build"; then | |
7436 | enable_s390_excess_float_precision=autodetect | |
7437 | elif test "x$with_headers" != xno; then | |
7438 | # cross build. are target headers available? | |
7439 | # carefully coerce the build-system compiler to use target headers | |
7440 | saved_CXXFLAGS="$CXXFLAGS" | |
7441 | CROSS_TEST_CXXFLAGS="-nostdinc ${XGCC_FLAGS_FOR_TARGET//-B/-idirafter/}" | |
7442 | CXXFLAGS="$CROSS_TEST_CXXFLAGS" | |
7443 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | |
7444 | #include <math.h> | |
7445 | ]])], [enable_s390_excess_float_precision=autodetect], []) | |
7446 | CXXFLAGS="$saved_CXXFLAGS" | |
7447 | fi | |
7448 | ||
7449 | if test x"$enable_s390_excess_float_precision" = xautodetect; then | |
7450 | saved_CXXFLAGS="$CXXFLAGS" | |
7451 | if ! test "$target" = "$host" -a "$host" = "$build"; then | |
7452 | CXXFLAGS="$CROSS_TEST_CXXFLAGS" | |
7453 | unset CROSS_TEST_CXXFLAGS | |
7454 | fi | |
7455 | AC_CACHE_CHECK([for glibc clamping float_t to double], | |
7456 | gcc_cv_float_t_clamped_to_double, [ | |
7457 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | |
a5dd6b69 MH |
7458 | #define __FLT_EVAL_METHOD__ 0 |
7459 | #include <math.h> | |
33f92509 MH |
7460 | int dummy[sizeof(float_t) == sizeof(double) ? 1 : -1]; |
7461 | ]])], | |
7462 | [gcc_cv_float_t_clamped_to_double=yes], | |
7463 | [gcc_cv_float_t_clamped_to_double=no])]) | |
7464 | CXXFLAGS="$saved_CXXFLAGS" | |
7465 | enable_s390_excess_float_precision="$gcc_cv_float_t_clamped_to_double" | |
7466 | else | |
7467 | # no way to detect behavior of target libc, default to new model | |
7468 | enable_s390_excess_float_precision=no | |
a5dd6b69 MH |
7469 | fi |
7470 | fi | |
7471 | ||
7472 | GCC_TARGET_TEMPLATE(ENABLE_S390_EXCESS_FLOAT_PRECISION) | |
7473 | if test x"$enable_s390_excess_float_precision" = xyes; then | |
7474 | AC_DEFINE(ENABLE_S390_EXCESS_FLOAT_PRECISION, 1, | |
7475 | [Define to enable evaluating float expressions with double precision in | |
7476 | standards-compatible mode on s390 targets.]) | |
7477 | fi | |
7478 | ;; | |
7479 | esac | |
7480 | ||
46f18e7b RK |
7481 | # Configure the subdirectories |
7482 | # AC_CONFIG_SUBDIRS($subdirs) | |
7483 | ||
7484 | # Create the Makefile | |
5891b37d | 7485 | # and configure language subdirectories |
914c5af7 NN |
7486 | AC_CONFIG_FILES($all_outputs) |
7487 | ||
7488 | AC_CONFIG_COMMANDS([default], | |
cdcc6a01 | 7489 | [ |
f1faaabd NN |
7490 | case ${CONFIG_HEADERS} in |
7491 | *auto-host.h:config.in*) | |
7492 | echo > cstamp-h ;; | |
cdcc6a01 | 7493 | esac |
2ed26f6b | 7494 | # Make sure all the subdirs exist. |
c49a6962 | 7495 | for d in $subdirs doc build common c-family |
2ed26f6b | 7496 | do |
2ed26f6b | 7497 | test -d $d || mkdir $d |
2ed26f6b | 7498 | done |
0d24f4d1 | 7499 | ], |
35f06ae4 | 7500 | [subdirs='$subdirs']) |
914c5af7 | 7501 | AC_OUTPUT |
fd438373 | 7502 |