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