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