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