]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/configure.in
c-cppbuiltin.c (cb_register_builtins): Define LP64 builtins for LP64 targets.
[thirdparty/gcc.git] / gcc / configure.in
CommitLineData
1322177d 1# configure.in for GCC
46f18e7b
RK
2# Process this file with autoconf to generate a configuration script.
3
027faee7 4# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003
eb70d86d 5# Free Software Foundation, Inc.
46f18e7b 6
1322177d 7#This file is part of GCC.
46f18e7b 8
1322177d
LB
9#GCC is free software; you can redistribute it and/or modify it under
10#the terms of the GNU General Public License as published by the Free
11#Software Foundation; either version 2, or (at your option) any later
12#version.
46f18e7b 13
1322177d
LB
14#GCC is distributed in the hope that it will be useful, but WITHOUT
15#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17#for more details.
46f18e7b
RK
18
19#You should have received a copy of the GNU General Public License
1322177d
LB
20#along with GCC; see the file COPYING. If not, write to the Free
21#Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22#02111-1307, USA.
46f18e7b 23
34a86c2b
NN
24# --------------------------------
25# Initialization and sanity checks
26# --------------------------------
27
890ad3ea 28AC_PREREQ(2.13)
46f18e7b 29AC_INIT(tree.c)
b7cb92ad 30AC_CONFIG_HEADER(auto-host.h:config.in)
cdcc6a01 31
34a86c2b
NN
32# Determine the host, build, and target systems
33AC_CANONICAL_SYSTEM
34
35# Set program_transform_name
36AC_ARG_PROGRAM
46f18e7b 37
75a39864
JL
38# Check for bogus environment variables.
39# Test if LIBRARY_PATH contains the notation for the current directory
40# since this would lead to problems installing/building glibc.
41# LIBRARY_PATH contains the current directory if one of the following
42# is true:
43# - one of the terminals (":" and ";") is the first or last sign
44# - two terminals occur directly after each other
45# - the path contains an element with a dot in it
46AC_MSG_CHECKING(LIBRARY_PATH variable)
47changequote(,)dnl
48case ${LIBRARY_PATH} in
49 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
50 library_path_setting="contains current directory"
51 ;;
52 *)
53 library_path_setting="ok"
54 ;;
55esac
56changequote([,])dnl
57AC_MSG_RESULT($library_path_setting)
58if test "$library_path_setting" != "ok"; then
59AC_MSG_ERROR([
60*** LIBRARY_PATH shouldn't contain the current directory when
079bd08e 61*** building gcc. Please change the environment variable
75a39864
JL
62*** and run configure again.])
63fi
64
65# Test if GCC_EXEC_PREFIX contains the notation for the current directory
66# since this would lead to problems installing/building glibc.
67# GCC_EXEC_PREFIX contains the current directory if one of the following
68# is true:
69# - one of the terminals (":" and ";") is the first or last sign
70# - two terminals occur directly after each other
71# - the path contains an element with a dot in it
72AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
73changequote(,)dnl
74case ${GCC_EXEC_PREFIX} in
75 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
76 gcc_exec_prefix_setting="contains current directory"
77 ;;
78 *)
79 gcc_exec_prefix_setting="ok"
80 ;;
81esac
82changequote([,])dnl
83AC_MSG_RESULT($gcc_exec_prefix_setting)
84if test "$gcc_exec_prefix_setting" != "ok"; then
85AC_MSG_ERROR([
86*** GCC_EXEC_PREFIX shouldn't contain the current directory when
079bd08e 87*** building gcc. Please change the environment variable
75a39864
JL
88*** and run configure again.])
89fi
90
34a86c2b
NN
91# -----------
92# Directories
93# -----------
94
95# Specify the local prefix
96local_prefix=
97AC_ARG_WITH(local-prefix,
98[ --with-local-prefix=DIR specifies directory to put local include],
99[case "${withval}" in
100yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
101no) ;;
102*) local_prefix=$with_local_prefix ;;
103esac])
104
105# Default local prefix if it is empty
106if test x$local_prefix = x; then
107 local_prefix=/usr/local
108fi
109
110# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
111# passed in by the toplevel make and thus we'd get different behavior
112# depending on where we built the sources.
113gcc_gxx_include_dir=
114# Specify the g++ header file directory
115AC_ARG_WITH(gxx-include-dir,
116[ --with-gxx-include-dir=DIR
117 specifies directory to put g++ header files],
118[case "${withval}" in
119yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
120no) ;;
121*) gcc_gxx_include_dir=$with_gxx_include_dir ;;
122esac])
123
124if test x${gcc_gxx_include_dir} = x; then
125 if test x${enable_version_specific_runtime_libs} = xyes; then
126 gcc_gxx_include_dir='${libsubdir}/include/c++'
127 else
128 topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
129changequote(<<, >>)dnl
130 gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir}
131changequote([, ])dnl
132 fi
133fi
134
135AC_ARG_WITH(cpp_install_dir,
136[ --with-cpp-install-dir=DIR
137 install the user visible C preprocessor in DIR
138 (relative to PREFIX) as well as PREFIX/bin],
139[if test x$withval = xyes; then
140 AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
141elif test x$withval != xno; then
142 cpp_install_dir=$withval
143fi])
144
145# -------------------
146# Find default linker
147# -------------------
46f18e7b
RK
148
149# With GNU ld
150AC_ARG_WITH(gnu-ld,
151[ --with-gnu-ld arrange to work with GNU ld.],
df6faf79
JW
152gnu_ld_flag="$with_gnu_ld",
153gnu_ld_flag=no)
46f18e7b 154
ab339d62
AO
155# With pre-defined ld
156AC_ARG_WITH(ld,
e8bec136 157[ --with-ld arrange to use the specified ld (full pathname)],
3ccc3a56
AO
158DEFAULT_LINKER="$with_ld")
159if test x"${DEFAULT_LINKER+set}" = x"set"; then
160 if test ! -x "$DEFAULT_LINKER"; then
161 AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
e154a394 162 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
ab339d62
AO
163 gnu_ld_flag=yes
164 fi
119d24d1
KG
165 AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
166 [Define to enable the use of a default linker.])
ab339d62
AO
167fi
168
34a86c2b
NN
169AC_MSG_CHECKING([whether a default linker was specified])
170if test x"${DEFAULT_LINKER+set}" = x"set"; then
171 if test x"$gnu_ld_flag" = x"no"; then
172 AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
173 else
174 AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
175 fi
176else
177 AC_MSG_RESULT(no)
178fi
179
180# ----------------------
181# Find default assembler
182# ----------------------
183
46f18e7b
RK
184# With GNU as
185AC_ARG_WITH(gnu-as,
e8bec136 186[ --with-gnu-as arrange to work with GNU as],
df6faf79
JW
187gas_flag="$with_gnu_as",
188gas_flag=no)
46f18e7b 189
ab339d62 190AC_ARG_WITH(as,
e8bec136 191[ --with-as arrange to use the specified as (full pathname)],
3ccc3a56
AO
192DEFAULT_ASSEMBLER="$with_as")
193if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
194 if test ! -x "$DEFAULT_ASSEMBLER"; then
195 AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
e154a394 196 elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
ab339d62
AO
197 gas_flag=yes
198 fi
119d24d1
KG
199 AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
200 [Define to enable the use of a default assembler.])
3ccc3a56 201fi
ab339d62 202
34a86c2b
NN
203AC_MSG_CHECKING([whether a default assembler was specified])
204if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
205 if test x"$gas_flag" = x"no"; then
206 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
4e88d51b 207 else
34a86c2b 208 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
4e88d51b 209 fi
34a86c2b
NN
210else
211 AC_MSG_RESULT(no)
4e88d51b 212fi
46f18e7b 213
34a86c2b
NN
214# ---------------
215# Find C compiler
216# ---------------
13c22933 217
414d23ae
HPN
218# Find the native compiler
219AC_PROG_CC
220AC_PROG_CC_C_O
221# autoconf is lame and doesn't give us any substitution variable for this.
222if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
223 NO_MINUS_C_MINUS_O=yes
224else
225 OUTPUT_OPTION='-o $@'
226fi
227AC_SUBST(NO_MINUS_C_MINUS_O)
228AC_SUBST(OUTPUT_OPTION)
229
414d23ae
HPN
230AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
231ac_cv_prog_cc_no_long_long,
232[save_CFLAGS="$CFLAGS"
233CFLAGS="-Wno-long-long"
234AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
235 ac_cv_prog_cc_no_long_long=no)
236CFLAGS="$save_CFLAGS"])
237
34a86c2b
NN
238AC_PROG_CPP
239AC_C_INLINE
240gcc_AC_C_VOLATILE
241
242gcc_AC_C_LONG_DOUBLE
243gcc_AC_C_LONG_LONG
244gcc_AC_C__BOOL
245
246# sizeof(char) is 1 by definition.
247AC_COMPILE_CHECK_SIZEOF(short)
248AC_COMPILE_CHECK_SIZEOF(int)
249AC_COMPILE_CHECK_SIZEOF(long)
250if test $ac_cv_c_long_long = yes; then
251 AC_COMPILE_CHECK_SIZEOF(long long)
252fi
253if test $ac_cv_c___int64 = yes; then
254 AC_COMPILE_CHECK_SIZEOF(__int64)
255fi
256
257gcc_AC_C_CHARSET
258
259# -----------------
260# Find Ada compiler
261# -----------------
262
263# See if GNAT has been installed
264gcc_AC_PROG_GNAT
265
414d23ae
HPN
266if test x$have_gnat != xno ; then
267AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
268ac_cv_prog_adac_no_long_long,
269[cat >conftest.adb <<EOF
270procedure conftest is begin null; end conftest;
271EOF
272if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then
273 ac_cv_prog_adac_no_long_long=yes
274else
275 ac_cv_prog_adac_no_long_long=no
276fi
277rm -f conftest*])
278else
279 ac_cv_prog_adac_no_long_long=yes
280fi
281
34a86c2b
NN
282# ---------------------
283# Warnings and checking
284# ---------------------
285
414d23ae
HPN
286strict1_warn=
287if test $ac_cv_prog_cc_no_long_long = yes && \
288 test $ac_cv_prog_adac_no_long_long = yes ; then
289 strict1_warn="-pedantic -Wno-long-long"
290fi
291AC_SUBST(strict1_warn)
292
414d23ae
HPN
293# If the native compiler is GCC, we can enable warnings even in stage1.
294# That's useful for people building cross-compilers, or just running a
295# quick `make'.
296warn_cflags=
297if test "x$GCC" = "xyes"; then
298 warn_cflags='$(GCC_WARN_CFLAGS)'
299fi
300AC_SUBST(warn_cflags)
301
dd859b8a
KG
302# Enable -Werror in bootstrap stage2 and later.
303# Change the default to "no" on release branches.
304AC_ARG_ENABLE(werror,
305[ --enable-werror enable -Werror in bootstrap stage2 and later], [],
306[enable_werror=yes])
307if test x$enable_werror = xyes ; then
308 WERROR=-Werror
309fi
310AC_SUBST(WERROR)
311
a494747c
MM
312# Enable expensive internal checks
313AC_ARG_ENABLE(checking,
f4524c9e
ZW
314[ --enable-checking[=LIST]
315 enable expensive run-time checks. With LIST,
316 enable only specific categories of checks.
4c76f856
JJ
317 Categories are: misc,tree,rtl,rtlflag,gc,gcac;
318 default is misc,tree,gc,rtlflag],
119d24d1
KG
319[ac_checking=
320ac_tree_checking=
321ac_rtl_checking=
4c76f856 322ac_rtlflag_checking=
119d24d1
KG
323ac_gc_checking=
324ac_gc_always_collect=
325case "${enableval}" in
4c76f856
JJ
326yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;
327 ac_rtlflag_checking=1 ;;
4e88d51b 328no) ;;
59f406b7 329*) IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
f4524c9e
ZW
330 set fnord $enableval; shift
331 IFS="$ac_save_IFS"
c62e45ad
KG
332 for check
333 do
f4524c9e 334 case $check in
119d24d1
KG
335 misc) ac_checking=1 ;;
336 tree) ac_tree_checking=1 ;;
4c76f856 337 rtlflag) ac_rtlflag_checking=1 ;;
119d24d1
KG
338 rtl) ac_rtl_checking=1 ;;
339 gc) ac_gc_checking=1 ;;
340 gcac) ac_gc_always_collect=1 ;;
414d23ae 341 valgrind) ac_checking_valgrind=1 ;;
f4524c9e
ZW
342 *) AC_MSG_ERROR(unknown check category $check) ;;
343 esac
344 done
345 ;;
119d24d1 346esac
51d0e20c
AJ
347],
348# Enable some checks by default for development versions of GCC
4c76f856 349[ac_checking=1; ac_tree_checking=1; ac_gc_checking=1; ac_rtlflag_checking=1;])
204250d2 350nocommon_flag=""
119d24d1
KG
351if test x$ac_checking != x ; then
352 AC_DEFINE(ENABLE_CHECKING, 1,
353[Define if you want more run-time sanity checks. This one gets a grab
354 bag of miscellaneous but relatively cheap checks.])
204250d2 355 nocommon_flag=-fno-common
119d24d1 356fi
204250d2 357AC_SUBST(nocommon_flag)
119d24d1
KG
358if test x$ac_tree_checking != x ; then
359 AC_DEFINE(ENABLE_TREE_CHECKING, 1,
360[Define if you want all operations on trees (the basic data
361 structure of the front ends) to be checked for dynamic type safety
362 at runtime. This is moderately expensive.])
363fi
364if test x$ac_rtl_checking != x ; then
365 AC_DEFINE(ENABLE_RTL_CHECKING, 1,
366[Define if you want all operations on RTL (the basic data structure
367 of the optimizer and back end) to be checked for dynamic type safety
368 at runtime. This is quite expensive.])
369fi
4c76f856
JJ
370if test x$ac_rtlflag_checking != x ; then
371 AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
372[Define if you want RTL flag accesses to be checked against the RTL
373 codes that are supported for each access macro. This is relatively
374 cheap.])
375fi
119d24d1
KG
376if test x$ac_gc_checking != x ; then
377 AC_DEFINE(ENABLE_GC_CHECKING, 1,
378[Define if you want the garbage collector to do object poisoning and
379 other memory allocation checks. This is quite expensive.])
380fi
381if test x$ac_gc_always_collect != x ; then
382 AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
383[Define if you want the garbage collector to operate in maximally
384 paranoid mode, validating the entire heap and collecting garbage at
385 every opportunity. This is extremely expensive.])
386fi
414d23ae
HPN
387valgrind_path_defines=
388valgrind_command=
389if test x$ac_checking_valgrind != x ; then
390 # It is certainly possible that there's valgrind but no valgrind.h.
391 # GCC relies on making annotations so we must have both.
14011ca4
AJ
392 AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
393 AC_TRY_CPP(
394 [#include <memcheck.h>
395#ifndef VALGRIND_DISCARD
396#error VALGRIND_DISCARD not defined
397#endif],
398 [gcc_cv_header_memcheck_h=yes],
399 gcc_cv_header_memcheck_h=no)
400 AC_MSG_RESULT($gcc_cv_header_memcheck_h)
414d23ae
HPN
401 AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
402 AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
403 [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
404 if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then
405 AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h])
406 fi
407 valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
408 valgrind_command="$valgrind_path -q"
409 AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
410[Define if you want to run subprograms and generated programs
411 through valgrind (a memory checker). This is extremely expensive.])
14011ca4
AJ
412 if test $gcc_cv_header_memcheck_h = yes; then
413 AC_DEFINE(HAVE_MEMCHECK_H, 1,
414 [Define if valgrind's memcheck.h header is installed.])
415 fi
414d23ae
HPN
416fi
417AC_SUBST(valgrind_path_defines)
418AC_SUBST(valgrind_command)
51d0e20c 419
22aa533e
NS
420# Enable code coverage collection
421AC_ARG_ENABLE(coverage,
422[ --enable-coverage[=LEVEL]
423 enable compiler\'s code coverage collection.
424 Use to measure compiler performance and locate
8601608f 425 unused parts of the compiler. With LEVEL, specify
22aa533e
NS
426 optimization. Values are opt, noopt,
427 default is noopt],
428[case "${enableval}" in
429yes|noopt)
8601608f 430 coverage_flags="-fprofile-arcs -ftest-coverage -O0 -DSELF_COVERAGE=1"
22aa533e
NS
431 ;;
432opt)
8601608f 433 coverage_flags="-fprofile-arcs -ftest-coverage -O2 -DSELF_COVERAGE=2"
22aa533e
NS
434 ;;
435*)
436 AC_MSG_ERROR(unknown coverage setting $enableval)
437 ;;
438esac],
2043c38e 439[coverage_flags=""])
22aa533e
NS
440AC_SUBST(coverage_flags)
441
34a86c2b
NN
442# --------
443# UNSORTED
444# --------
445
446# With stabs
447AC_ARG_WITH(stabs,
448[ --with-stabs arrange to use stabs instead of host debug format],
449stabs="$with_stabs",
450stabs=no)
451
452# With ELF
453AC_ARG_WITH(elf,
454[ --with-elf arrange to use ELF instead of host debug format],
455elf="$with_elf",
456elf=no)
457
458# Determine whether or not multilibs are enabled.
459AC_ARG_ENABLE(multilib,
460[ --enable-multilib enable library support for multiple ABIs],
461[], [enable_multilib=yes])
462AC_SUBST(enable_multilib)
3ecc3258 463
4bafaa6f
L
464# Enable __cxa_atexit for C++.
465AC_ARG_ENABLE(__cxa_atexit,
466[ --enable-__cxa_atexit enable __cxa_atexit for C++],
467[], [])
468if test x$enable___cxa_atexit = xyes; then
469 AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1,
470 [Define if you want to use __cxa_atexit, rather than atexit, to
471 register C++ destructors for local statics and global objects.
472 This is essential for fully standards-compliant handling of
473 destructors, but requires __cxa_atexit in libc.])
474fi
475
c5c76735
JL
476# Enable Multibyte Characters for C/C++
477AC_ARG_ENABLE(c-mbchar,
e8bec136 478[ --enable-c-mbchar enable multibyte characters for C and C++],
2618c083 479if test x$enable_c_mbchar != xno; then
9ec7291f
ZW
480 AC_DEFINE(MULTIBYTE_CHARS, 1,
481 [Define if you want the C and C++ compilers to support multibyte
482 character sets for source code.])
c5c76735
JL
483fi)
484
0bbb1697
RK
485# Enable threads
486# Pass with no value to take the default
487# Pass with a value to specify a thread package
488AC_ARG_ENABLE(threads,
e8bec136
RO
489[ --enable-threads enable thread usage for target GCC
490 --enable-threads=LIB use LIB thread package for target GCC],,
0bbb1697
RK
491enable_threads='')
492
e445171e 493enable_threads_flag=$enable_threads
0bbb1697 494# Check if a valid thread package
e445171e 495case x${enable_threads_flag} in
0bbb1697
RK
496 x | xno)
497 # No threads
a851212a 498 target_thread_file='single'
0bbb1697
RK
499 ;;
500 xyes)
501 # default
a851212a 502 target_thread_file=''
0bbb1697
RK
503 ;;
504 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
e08f13ee 505 xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix)
e445171e 506 target_thread_file=$enable_threads_flag
0bbb1697
RK
507 ;;
508 *)
509 echo "$enable_threads is an unknown thread package" 1>&2
510 exit 1
511 ;;
512esac
513
d8bb17c8
OP
514AC_ARG_ENABLE(objc-gc,
515[ --enable-objc-gc enable the use of Boehm's garbage collector with
e8bec136 516 the GNU Objective-C runtime],
2618c083 517if test x$enable_objc_gc = xno; then
d8bb17c8
OP
518 objc_boehm_gc=''
519else
520 objc_boehm_gc=1
521fi,
522objc_boehm_gc='')
523
90e6a802 524AC_ARG_WITH(dwarf2,
e8bec136 525[ --with-dwarf2 force the default debug format to be DWARF 2],
90e6a802
RL
526dwarf2="$with_dwarf2",
527dwarf2=no)
528
50503ac8 529AC_ARG_ENABLE(shared,
e8bec136 530[ --disable-shared don't provide a shared libgcc],
c785e0fa
AO
531[
532 case $enable_shared in
533 yes | no) ;;
534 *)
535 enable_shared=no
536 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
537 for pkg in $enableval; do
538 if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
539 enable_shared=yes
540 fi
541 done
542 IFS="$ac_save_ifs"
543 ;;
544 esac
545], [enable_shared=yes])
50503ac8
RH
546AC_SUBST(enable_shared)
547
4977bab6
ZW
548AC_ARG_WITH(sysroot,
549[ --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
550[
551 case ${with_sysroot} in
91710e62 552 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
4977bab6
ZW
553 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
554 esac
555
556 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
557 CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
047d636f
DJ
558
559 if test "x$exec_prefix" = xNONE; then
560 if test "x$prefix" = xNONE; then
561 test_prefix=/usr/local
562 else
563 test_prefix=$prefix
564 fi
565 else
566 test_prefix=$exec_prefix
567 fi
568 case ${TARGET_SYSTEM_ROOT} in
91710e62
AO
569 "${test_prefix}"|"${test_prefix}/"*|\
570 '${exec_prefix}'|'${exec_prefix}/'*)
047d636f
DJ
571 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
572 TARGET_SYSTEM_ROOT_DEFINE="$t"
573 ;;
574 esac
4977bab6
ZW
575], [
576 TARGET_SYSTEM_ROOT=
db720d9a 577 TARGET_SYSTEM_ROOT_DEFINE=
4977bab6
ZW
578 CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
579])
580AC_SUBST(TARGET_SYSTEM_ROOT)
581AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
582AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
583
5b67ad6f 584# Stage specific cflags for build.
b8dad04b 585stage1_cflags=
5b67ad6f
DA
586case $build in
587vax-*-*)
588 if test x$GCC = xyes
589 then
b8dad04b 590 stage1_cflags="-Wa,-J"
5b67ad6f 591 else
b8dad04b 592 stage1_cflags="-J"
5b67ad6f
DA
593 fi
594 ;;
5dd8a9b1
ZW
595powerpc-*-darwin*)
596 # The spiffy cpp-precomp chokes on some legitimate constructs in GCC
597 # sources; use -no-cpp-precomp to get to GNU cpp.
598 # Apple's GCC has bugs in designated initializer handling, so disable
599 # that too.
600 stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
601 ;;
5b67ad6f 602esac
b8dad04b 603AC_SUBST(stage1_cflags)
61842080 604
e9a25f70
JL
605AC_PROG_MAKE_SET
606
4070d885
AJ
607AC_MSG_CHECKING(for GNU C library)
608AC_CACHE_VAL(gcc_cv_glibc,
609[AC_TRY_COMPILE(
610 [#include <features.h>],[
611#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
612#error Not a GNU C library system
613#endif],
614 [gcc_cv_glibc=yes],
615 gcc_cv_glibc=no)])
616AC_MSG_RESULT($gcc_cv_glibc)
c2f7d403 617if test $gcc_cv_glibc = yes; then
4070d885
AJ
618 AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library])
619fi
4797e955 620
46f18e7b
RK
621# Find some useful tools
622AC_PROG_AWK
99e757d5
KG
623gcc_AC_PROG_LN
624gcc_AC_PROG_LN_S
46f18e7b 625AC_PROG_RANLIB
99e757d5 626gcc_AC_PROG_INSTALL
46f18e7b 627
956d6950
JL
628AC_HEADER_STDC
629AC_HEADER_TIME
827ae6cf 630gcc_AC_HEADER_STDBOOL
99e757d5 631gcc_AC_HEADER_STRING
e9831ca0 632AC_HEADER_SYS_WAIT
03c41c05 633AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
7719ffbf 634 fcntl.h unistd.h sys/file.h sys/time.h \
03c41c05 635 sys/resource.h sys/param.h sys/times.h sys/stat.h \
351df804 636 direct.h malloc.h langinfo.h ldfcn.h)
7636d567 637
f24af81b
TT
638# Check for thread headers.
639AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
640AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
641
84c041a1 642# These tests can't be done till we know if we have limits.h.
75e93faa 643gcc_AC_C_CHAR_BIT
4977bab6 644AC_C_BIGENDIAN_CROSS
2d6eb5bf 645gcc_AC_C_FLOAT_FORMAT
75e93faa 646
955be633
JM
647# See if we have the mktemp command.
648AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
649
09fa0705
ZW
650# Do we have a single-tree copy of texinfo?
651if test -f $srcdir/../texinfo/Makefile.in; then
652 MAKEINFO='$(objdir)/../texinfo/makeinfo/makeinfo'
653 gcc_cv_prog_makeinfo_modern=yes
654 AC_MSG_RESULT([Using makeinfo from the unified source tree.])
655else
656 # See if makeinfo has been installed and is modern enough
657 # that we can use it.
658 gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
659 [GNU texinfo.* \([0-9][0-9.]*\)],
a38f87a9 660 [4.[2-9]*])
09fa0705
ZW
661fi
662
663if test $gcc_cv_prog_makeinfo_modern = no; then
664 AC_MSG_WARN([
665*** Makeinfo is missing or too old.
17db6582 666*** Info documentation will not be built.])
09fa0705 667 BUILD_INFO=
09fa0705
ZW
668else
669 BUILD_INFO=info AC_SUBST(BUILD_INFO)
09fa0705
ZW
670fi
671
3f896fc2
JM
672# Is pod2man recent enough to regenerate manpages?
673AC_MSG_CHECKING([for recent Pod::Man])
7be33370 674if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
fd939e46
JM
675 AC_MSG_RESULT(yes)
676 GENERATED_MANPAGES=generated-manpages AC_SUBST(GENERATED_MANPAGES)
677else
678 AC_MSG_RESULT(no)
679 GENERATED_MANPAGES=
680fi
681
1e608388
ZW
682# How about lex?
683dnl Don't use AC_PROG_LEX; we insist on flex.
684dnl LEXLIB is not useful in gcc.
685if test -f $srcdir/../flex/skel.c; then
686 FLEX='$(objdir)/../flex/flex'
687else
9118405f 688 AC_CHECK_PROG(FLEX, flex, flex, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing flex)
1e608388
ZW
689fi
690
691# Bison?
692# The -L switch is so bison can find its skeleton file.
693if test -f $srcdir/../bison/bison.simple; then
694 BISON='$(objdir)/../bison/bison -L $(srcdir)/../bison/'
695else
9118405f 696 AC_CHECK_PROG(BISON, bison, bison, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing bison)
1e608388
ZW
697fi
698
4e70264f
ZW
699# These libraries may be used by collect2.
700# We may need a special search path to get them linked.
701AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
702[save_LIBS="$LIBS"
7f2749d4 703for libs in '' -lld -lmld \
4e70264f
ZW
704 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
705 '-L/usr/lib/cmplrs/cc3.11 -lmld'
706do
707 LIBS="$libs"
708 AC_TRY_LINK_FUNC(ldopen,
709 [gcc_cv_collect2_libs="$libs"; break])
710done
711LIBS="$save_LIBS"
712test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
713case $gcc_cv_collect2_libs in
714 "none required") ;;
715 *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
716esac
717AC_SUBST(COLLECT2_LIBS)
718
7f2749d4
RK
719# When building Ada code on Alpha, we need exc_resume which is usually in
720# -lexc. So test for it.
721save_LIBS="$LIBS"
722LIBS=
723AC_SEARCH_LIBS(exc_resume, exc)
724GNAT_LIBEXC="$LIBS"
725LIBS="$save_LIBS"
726AC_SUBST(GNAT_LIBEXC)
727
890ad3ea 728# See if the stage1 system preprocessor understands the ANSI C
4bc5fbd4 729# preprocessor stringification operator. (Used by symcat.h.)
890ad3ea 730AC_C_STRINGIZE
76844337 731
7636d567
JW
732# Use <inttypes.h> only if it exists,
733# doesn't clash with <sys/types.h>, and declares intmax_t.
734AC_MSG_CHECKING(for inttypes.h)
735AC_CACHE_VAL(gcc_cv_header_inttypes_h,
736[AC_TRY_COMPILE(
737 [#include <sys/types.h>
738#include <inttypes.h>],
739 [intmax_t i = -1;],
9da0e39b 740 [gcc_cv_header_inttypes_h=yes],
7636d567
JW
741 gcc_cv_header_inttypes_h=no)])
742AC_MSG_RESULT($gcc_cv_header_inttypes_h)
9da0e39b 743if test $gcc_cv_header_inttypes_h = yes; then
119d24d1
KG
744 AC_DEFINE(HAVE_INTTYPES_H, 1,
745 [Define if you have a working <inttypes.h> header file.])
9da0e39b 746fi
cdcc6a01 747
9612ab65
ZW
748dnl Disabled until we have a complete test for buggy enum bitfields.
749dnl gcc_AC_C_ENUM_BF_UNSIGNED
c149cc37 750
6af8c740
KG
751AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \
752 sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \
a15135c9
MM
753 fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
754 scandir alphasort)
a81fb89e 755
f12bc141 756AC_CHECK_TYPE(ssize_t, int)
56f48ce9 757
e256b8b6
DA
758# Try to determine the array type of the second argument of getgroups
759# for the target system (int or gid_t).
760AC_TYPE_GETGROUPS
761if test "${target}" = "${build}"; then
762 TARGET_GETGROUPS_T=$ac_cv_type_getgroups
763else
764 case "${target}" in
765 # This condition may need some tweaking. It should include all
766 # targets where the array type of the second argument of getgroups
767 # is int and the type of gid_t is not equivalent to int.
768 *-*-sunos* | *-*-ultrix*)
769 TARGET_GETGROUPS_T=int
770 ;;
771 *)
772 TARGET_GETGROUPS_T=gid_t
773 ;;
774 esac
775fi
776AC_SUBST(TARGET_GETGROUPS_T)
777
99e757d5 778gcc_AC_FUNC_PRINTF_PTR
b27d2bd5
MK
779
780case "${host}" in
781*-*-uwin*)
34fa3e7d
MM
782 AC_MSG_ERROR([
783*** UWIN may not be used as a host platform because
784*** linking with posix.dll is not allowed by the GNU GPL])
b27d2bd5 785 ;;
ee262b6f
DR
786*-*-*vms*)
787 # Under VMS, vfork works very different than on Unix. The standard test
788 # won't work, and it isn't easily adaptable. It makes more sense to
789 # just force it.
790 ac_cv_func_vfork_works=yes
791 ;;
b27d2bd5 792esac
c375c43b 793AC_FUNC_VFORK
4acab94b 794AC_FUNC_MMAP_ANYWHERE
56f02b88 795AC_FUNC_MMAP_FILE
f1b54f9b 796
f91abfce
TT
797AM_ICONV
798
86cf1cbd
KG
799# We will need to find libiberty.h and ansidecl.h
800saved_CFLAGS="$CFLAGS"
801CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
8e944909 802gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \
3b681e9d 803 strsignal putc_unlocked fputs_unlocked fwrite_unlocked \
a7475ab1 804 fprintf_unlocked strstr errno vasprintf \
c1800ec8 805 malloc realloc calloc free basename getopt clock, , ,[
d02af173 806#include "ansidecl.h"
86cf1cbd 807#include "system.h"])
c5c76735 808
f31e826b 809gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
d02af173 810#include "ansidecl.h"
86cf1cbd 811#include "system.h"
d2cabf16
KG
812#ifdef HAVE_SYS_RESOURCE_H
813#include <sys/resource.h>
814#endif
815])
816
b2522d2b
HPN
817AC_TRY_COMPILE([
818#include "ansidecl.h"
819#include "system.h"
820#ifdef HAVE_SYS_RESOURCE_H
821#include <sys/resource.h>
822#endif
823],[rlim_t l = 0;],,[AC_DEFINE([rlim_t],[long],
824[Define to \`long' if <sys/resource.h> doesn't define.])])
825
351df804
KG
826gcc_AC_CHECK_DECLS(ldgetname, , ,[
827#include "ansidecl.h"
828#include "system.h"
829#ifdef HAVE_LDFCN_H
830#include <ldfcn.h>
831#endif
832])
833
c1800ec8
ZW
834gcc_AC_CHECK_DECLS(times, , ,[
835#include "ansidecl.h"
836#include "system.h"
837#ifdef HAVE_SYS_TIMES_H
838#include <sys/times.h>
839#endif
840])
841
842# More time-related stuff.
843AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
844AC_TRY_COMPILE([
845#include "ansidecl.h"
846#include "system.h"
847#ifdef HAVE_SYS_TIMES_H
848#include <sys/times.h>
849#endif
850], [struct tms tms;], ac_cv_struct_tms=yes, ac_cv_struct_tms=no)])
851if test $ac_cv_struct_tms = yes; then
852 AC_DEFINE(HAVE_STRUCT_TMS, 1,
853 [Define if <sys/times.h> defines struct tms.])
854fi
855
856# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
857# revisit after autoconf 2.50.
858AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
859AC_TRY_COMPILE([
860#include "ansidecl.h"
861#include "system.h"
862], [clock_t x;], gcc_cv_type_clock_t=yes, gcc_cv_type_clock_t=no)])
863if test $gcc_cv_type_clock_t = yes; then
864 AC_DEFINE(HAVE_CLOCK_T, 1,
865 [Define if <time.h> defines clock_t.])
866fi
867
a12b5bd9
ZW
868AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
869[AC_TRY_COMPILE([
870#include "ansidecl.h"
871#include "system.h"
872],
873[if ((uchar *)0) return 0;
874 if (sizeof(uchar)) return 0;],
875ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
876if test $ac_cv_type_uchar = yes; then
877 AC_DEFINE(HAVE_UCHAR, 1,
878 [Define if <sys/types.h> defines \`uchar'.])
879fi
880
86cf1cbd
KG
881# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
882CFLAGS="$saved_CFLAGS"
883
eb70d86d
AS
884gcc_AC_INITFINI_ARRAY
885
75923b2f 886# mkdir takes a single argument on some systems.
99e757d5 887gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
75923b2f 888
46f18e7b
RK
889# File extensions
890manext='.1'
891objext='.o'
46f18e7b
RK
892AC_SUBST(manext)
893AC_SUBST(objext)
46f18e7b 894
4977bab6
ZW
895# With Setjmp/Longjmp based exception handling.
896AC_ARG_ENABLE(sjlj-exceptions,
897[ --enable-sjlj-exceptions
898 arrange to use setjmp/longjmp exception handling],
899[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
900AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
901 [Define 0/1 to force the choice for exception handling model.])])
902
903AC_CHECK_LIB(unwind, main, use_libunwind_default=yes, use_libunwind_default=no)
904# Use libunwind based exception handling.
905AC_ARG_ENABLE(libunwind-exceptions,
906[ --enable-libunwind-exceptions force use libunwind for exceptions],
907use_libunwind_exceptions=$enableval,
908use_libunwind_exceptions=$use_libunwind_default)
909if test x"$use_libunwind_exceptions" = xyes; then
910 AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1,
911 [Define if gcc should use -lunwind.])
912fi
913
34a86c2b
NN
914# --------------------------------------------------------
915# Build, host, and target specific configuration fragments
916# --------------------------------------------------------
917
ef69da62 918target_gtfiles=
46f18e7b 919build_xm_file=
61536478 920build_xm_defines=
46f18e7b
RK
921build_install_headers_dir=install-headers-tar
922build_exeext=
923host_xm_file=
61536478 924host_xm_defines=
46f18e7b
RK
925host_xmake_file=
926host_truncate_target=
6e26218f 927host_exeext=
46f18e7b
RK
928
929# Decode the host machine, then the target machine.
930# For the host machine, we save the xm_file variable as host_xm_file;
931# then we decode the target machine and forget everything else
932# that came from the host machine.
933for machine in $build $host $target; do
61ed06c3 934 . ${srcdir}/config.gcc
46f18e7b
RK
935done
936
937extra_objs="${host_extra_objs} ${extra_objs}"
938
939# Default the target-machine variables that were not explicitly set.
75bffa71 940if test x"$tm_file" = x
46f18e7b
RK
941then tm_file=$cpu_type/$cpu_type.h; fi
942
6b2adea9 943if test x"$extra_headers" = x
46f18e7b
RK
944then extra_headers=; fi
945
75bffa71 946if test x$md_file = x
e98e406f 947then md_file=$cpu_type/$cpu_type.md; fi
46f18e7b 948
75bffa71 949if test x$out_file = x
46f18e7b
RK
950then out_file=$cpu_type/$cpu_type.c; fi
951
75bffa71 952if test x"$tmake_file" = x
46f18e7b
RK
953then tmake_file=$cpu_type/t-$cpu_type
954fi
955
90e6a802 956if test x"$dwarf2" = xyes
756ee602 957then tm_file="$tm_file tm-dwarf2.h"
90e6a802
RL
958fi
959
46f18e7b 960# Say what files are being used for the output code and MD file.
11642c3a 961echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
46f18e7b
RK
962echo "Using \`$srcdir/config/$md_file' as machine description file."
963
11642c3a 964# If any of the xm_file variables contain nonexistent files, warn
4dc0535b
ZW
965# about them and drop them.
966
11642c3a
ZW
967bx=
968for x in $build_xm_file; do
969 if test -f $srcdir/config/$x
970 then bx="$bx $x"
11642c3a
ZW
971 else AC_MSG_WARN($srcdir/config/$x does not exist.)
972 fi
973done
974build_xm_file="$bx"
975
976hx=
977for x in $host_xm_file; do
978 if test -f $srcdir/config/$x
979 then hx="$hx $x"
11642c3a
ZW
980 else AC_MSG_WARN($srcdir/config/$x does not exist.)
981 fi
982done
983host_xm_file="$hx"
984
985tx=
986for x in $xm_file; do
987 if test -f $srcdir/config/$x
988 then tx="$tx $x"
11642c3a
ZW
989 else AC_MSG_WARN($srcdir/config/$x does not exist.)
990 fi
991done
992xm_file="$tx"
993
46f18e7b
RK
994count=a
995for f in $tm_file; do
996 count=${count}x
997done
75bffa71 998if test $count = ax; then
46f18e7b
RK
999 echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
1000else
1001 echo "Using the following target machine macro files:"
1002 for f in $tm_file; do
1003 echo " $srcdir/config/$f"
1004 done
1005fi
1006
4977bab6
ZW
1007if test x$need_64bit_hwint = xyes; then
1008 AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1,
1009[Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).])
1010fi
1011
46f18e7b
RK
1012count=a
1013for f in $host_xm_file; do
1014 count=${count}x
1015done
11642c3a
ZW
1016if test $count = a; then
1017 :
1018elif test $count = ax; then
46f18e7b
RK
1019 echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
1020else
1021 echo "Using the following host machine macro files:"
1022 for f in $host_xm_file; do
1023 echo " $srcdir/config/$f"
1024 done
1025fi
476d9098 1026echo "Using ${out_host_hook_obj} for host machine hooks."
46f18e7b 1027
75bffa71 1028if test "$host_xm_file" != "$build_xm_file"; then
46f18e7b
RK
1029 count=a
1030 for f in $build_xm_file; do
1031 count=${count}x
1032 done
11642c3a
ZW
1033 if test $count = a; then
1034 :
1035 elif test $count = ax; then
46f18e7b
RK
1036 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
1037 else
1038 echo "Using the following build machine macro files:"
1039 for f in $build_xm_file; do
1040 echo " $srcdir/config/$f"
1041 done
1042 fi
1043fi
1044
75bffa71
ILT
1045if test x$thread_file = x; then
1046 if test x$target_thread_file != x; then
a851212a
JW
1047 thread_file=$target_thread_file
1048 else
1049 thread_file='single'
1050 fi
46f18e7b 1051fi
46f18e7b 1052
a5381466 1053# Look for a file containing extra machine modes.
1c0ca89d
ZW
1054if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
1055 extra_modes_file='$(srcdir)'/config/${extra_modes}
a5381466 1056 AC_SUBST(extra_modes_file)
1c0ca89d 1057 AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "$extra_modes",
a5381466
ZW
1058 [Define to the name of a file containing a list of extra machine modes
1059 for this architecture.])
1060 AC_DEFINE(EXTRA_CC_MODES, 1,
1061 [Define if the target architecture needs extra machine modes to represent
1062 the results of comparisons.])
1063fi
1064
b7cb92ad 1065# auto-host.h is the file containing items generated by autoconf and is
e9a25f70 1066# the first file included by config.h.
4977bab6 1067# If host=build, it is correct to have bconfig include auto-host.h
db81d74a
RH
1068# as well. If host!=build, we are in error and need to do more
1069# work to find out the build config parameters.
75bffa71 1070if test x$host = x$build
db81d74a 1071then
eaf4e618 1072 build_auto=auto-host.h
06f0b04c 1073 FORBUILD=..
b7cb92ad
JL
1074else
1075 # We create a subdir, then run autoconf in the subdir.
1076 # To prevent recursion we set host and build for the new
1077 # invocation of configure to the build for this invocation
1078 # of configure.
1079 tempdir=build.$$
1080 rm -rf $tempdir
1081 mkdir $tempdir
1082 cd $tempdir
1083 case ${srcdir} in
b86ecfa9 1084 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
b7cb92ad
JL
1085 *) realsrcdir=../${srcdir};;
1086 esac
d920e825
L
1087 saved_CFLAGS="${CFLAGS}"
1088 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
1089 ${realsrcdir}/configure \
534d0cc0 1090 --target=$target_alias --host=$build_alias --build=$build_alias
d920e825 1091 CFLAGS="${saved_CFLAGS}"
b7cb92ad
JL
1092
1093 # We just finished tests for the build machine, so rename
1094 # the file auto-build.h in the gcc directory.
1095 mv auto-host.h ../auto-build.h
1096 cd ..
1097 rm -rf $tempdir
eaf4e618 1098 build_auto=auto-build.h
61138bb6 1099 FORBUILD=../build-$build_alias
db81d74a 1100fi
06f0b04c 1101AC_SUBST(FORBUILD)
db81d74a 1102
eaf4e618 1103tm_file="${tm_file} defaults.h"
4977bab6
ZW
1104tm_p_file="${tm_p_file} tm-preds.h"
1105host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
1106build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
49691411 1107# We don't want ansidecl.h in target files, write code there in ISO/GNU C.
b4862477
KG
1108# put this back in temporarily.
1109xm_file="ansidecl.h ${xm_file}"
0056a9b5 1110
34a86c2b
NN
1111# --------
1112# UNSORTED
1113# --------
1114
46f18e7b 1115# Truncate the target if necessary
75bffa71 1116if test x$host_truncate_target != x; then
46f18e7b
RK
1117 target=`echo $target | sed -e 's/\(..............\).*/\1/'`
1118fi
1119
f1943b77 1120# Get the version trigger filename from the toplevel
75bffa71 1121if test "${with_gcc_version_trigger+set}" = set; then
f1943b77
MH
1122 gcc_version_trigger=$with_gcc_version_trigger
1123else
1124 gcc_version_trigger=${srcdir}/version.c
1125fi
75bffa71 1126changequote(,)dnl
022dae81 1127gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'`
8763704d 1128gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
cc1e60ea
JM
1129
1130# Compile in configure arguments.
8105825d 1131if test -f configargs.h ; then
cc1e60ea 1132 # Being re-configured.
022dae81 1133 gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
cc1e60ea
JM
1134 gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
1135else
1136 gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
1137fi
1138cat > configargs.h <<EOF
1139/* Generated automatically. */
1140static const char configuration_arguments[] = "$gcc_config_arguments";
a6687d2b 1141static const char thread_model[] = "$thread_file";
cc1e60ea 1142EOF
75bffa71 1143changequote([,])dnl
46f18e7b 1144
ab87f8c8
JL
1145# Internationalization
1146PACKAGE=gcc
1147VERSION="$gcc_version"
ab87f8c8
JL
1148AC_SUBST(PACKAGE)
1149AC_SUBST(VERSION)
1150
dc6746e7 1151# Enable NLS support by default
ab87f8c8 1152AC_ARG_ENABLE(nls,
dc6746e7
PT
1153 [ --enable-nls use Native Language Support (default)],
1154 , enable_nls=yes)
1155
1156# if cross compiling, disable NLS support.
1157# It's not worth the trouble, at least for now.
1158
063a4b85 1159if test "${build}" != "${host}" && test "x$enable_nls" = "xyes"; then
dc6746e7
PT
1160 AC_MSG_WARN(Disabling NLS support for canadian cross compiler.)
1161 enable_nls=no
1162fi
ab87f8c8
JL
1163
1164AM_GNU_GETTEXT
ab87f8c8 1165
f4ab28e3
MK
1166# Windows32 Registry support for specifying GCC installation paths.
1167AC_ARG_ENABLE(win32-registry,
1168[ --disable-win32-registry
e8bec136
RO
1169 disable lookup of installation paths in the
1170 Registry on Windows hosts
1171 --enable-win32-registry enable registry lookup (default)
f4ab28e3 1172 --enable-win32-registry=KEY
e8bec136
RO
1173 use KEY instead of GCC version as the last portion
1174 of the registry key],,)
4e70264f
ZW
1175case $host_os in
1176 win32 | pe | cygwin* | mingw32* | uwin*)
f4ab28e3 1177AC_MSG_CHECKING(whether windows registry support is requested)
9dd53f2c 1178if test "x$enable_win32_registry" != xno; then
119d24d1
KG
1179 AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
1180[Define to 1 if installation paths should be looked up in Windows32
91029a29 1181 Registry. Ignored on non windows32 hosts.])
f4ab28e3 1182 AC_MSG_RESULT(yes)
4e70264f 1183 AC_SEARCH_LIBS(RegOpenKeyExA, advapi32)
f4ab28e3
MK
1184else
1185 AC_MSG_RESULT(no)
1186fi
1187
1188# Check if user specified a different registry key.
9dd53f2c 1189case "x${enable_win32_registry}" in
f4ab28e3
MK
1190x | xyes)
1191 # default.
1192 gcc_cv_win32_registry_key="$VERSION"
1193 ;;
1194xno)
1195 # no registry lookup.
1196 gcc_cv_win32_registry_key=''
1197 ;;
1198*)
1199 # user-specified key.
1200 gcc_cv_win32_registry_key="$enable_win32_registry"
1201 ;;
1202esac
1203
9dd53f2c 1204if test "x$enable_win32_registry" != xno; then
f4ab28e3 1205 AC_MSG_CHECKING(registry key on windows hosts)
119d24d1
KG
1206 AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$gcc_cv_win32_registry_key",
1207 [Define to be the last portion of registry key on windows hosts.])
f4ab28e3
MK
1208 AC_MSG_RESULT($gcc_cv_win32_registry_key)
1209fi
4e70264f
ZW
1210;;
1211esac
f4ab28e3 1212
7fa10b25 1213# Get an absolute path to the GCC top-level source directory
1e6347d8 1214holddir=`${PWDCMD-pwd}`
7fa10b25 1215cd $srcdir
1e6347d8 1216topdir=`${PWDCMD-pwd}`
7fa10b25
RK
1217cd $holddir
1218
af5e4ada 1219# Conditionalize the makefile for this host machine.
94f42018
DE
1220# Make-host contains the concatenation of all host makefile fragments
1221# [there can be more than one]. This file is built by configure.frag.
1222host_overrides=Make-host
af5e4ada 1223dep_host_xmake_file=
94f42018
DE
1224for f in .. ${host_xmake_file}
1225do
75bffa71 1226 if test -f ${srcdir}/config/$f
94f42018
DE
1227 then
1228 dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f"
1229 fi
1230done
46f18e7b 1231
af5e4ada 1232# Conditionalize the makefile for this target machine.
94f42018
DE
1233# Make-target contains the concatenation of all host makefile fragments
1234# [there can be more than one]. This file is built by configure.frag.
1235target_overrides=Make-target
af5e4ada 1236dep_tmake_file=
94f42018
DE
1237for f in .. ${tmake_file}
1238do
75bffa71 1239 if test -f ${srcdir}/config/$f
94f42018
DE
1240 then
1241 dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f"
1242 fi
1243done
5891b37d 1244
34a86c2b
NN
1245symbolic_link='ln -s'
1246
af5e4ada
DE
1247# If the host doesn't support symlinks, modify CC in
1248# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
1249# Otherwise, we can use "CC=$(CC)".
1250rm -f symtest.tem
61536478 1251if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null
af5e4ada
DE
1252then
1253 cc_set_by_configure="\$(CC)"
5aa82ace 1254 quoted_cc_set_by_configure="\$(CC)"
af5e4ada 1255 stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
596151e1 1256 quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
af5e4ada 1257else
61536478
JL
1258 rm -f symtest.tem
1259 if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null
1260 then
1261 symbolic_link="cp -p"
1262 else
1263 symbolic_link="cp"
1264 fi
af5e4ada 1265 cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
5aa82ace 1266 quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
af5e4ada 1267 stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
596151e1 1268 quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`"
af5e4ada
DE
1269fi
1270rm -f symtest.tem
5891b37d 1271
af5e4ada 1272out_object_file=`basename $out_file .c`.o
5891b37d 1273
af5e4ada
DE
1274tm_file_list=
1275for f in $tm_file; do
64ccbc99 1276 case $f in
d02af173
ZW
1277 ansidecl.h )
1278 tm_file_list="${tm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
1279 defaults.h )
e2500fed 1280 tm_file_list="${tm_file_list} \$(srcdir)/$f" ;;
64ccbc99
KG
1281 *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;;
1282 esac
af5e4ada 1283done
46f18e7b 1284
11642c3a
ZW
1285tm_p_file_list=
1286for f in $tm_p_file; do
4977bab6
ZW
1287 case $f in
1288 tm-preds.h )
1289 tm_p_file_list="${tm_p_file_list} $f" ;;
1290 *) tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" ;;
1291 esac
11642c3a
ZW
1292done
1293
af5e4ada
DE
1294host_xm_file_list=
1295for f in $host_xm_file; do
64ccbc99 1296 case $f in
d02af173
ZW
1297 ansidecl.h )
1298 host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
e2500fed 1299 auto-host.h )
64ccbc99 1300 host_xm_file_list="${host_xm_file_list} $f" ;;
e2500fed
GK
1301 defaults.h )
1302 host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;;
64ccbc99
KG
1303 *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;;
1304 esac
af5e4ada
DE
1305done
1306
1307build_xm_file_list=
1308for f in $build_xm_file; do
64ccbc99 1309 case $f in
d02af173
ZW
1310 ansidecl.h )
1311 build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;;
e2500fed 1312 auto-build.h | auto-host.h )
64ccbc99 1313 build_xm_file_list="${build_xm_file_list} $f" ;;
e2500fed
GK
1314 defaults.h )
1315 host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;;
64ccbc99
KG
1316 *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;;
1317 esac
af5e4ada 1318done
46f18e7b 1319
a078a589
ZW
1320# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
1321# Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
1322CROSS= AC_SUBST(CROSS)
1323ALL=all.internal AC_SUBST(ALL)
1324SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
75bffa71 1325if test x$host != x$target
af5e4ada 1326then
a078a589
ZW
1327 CROSS="-DCROSS_COMPILE"
1328 ALL=all.cross
1329 SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
343f59d9
AM
1330 case "$host","$target" in
1331 i?86-*-*,x86_64-*-* \
1332 | powerpc*-*-*,powerpc64*-*-*)
1333 CROSS="$CROSS -DNATIVE_CROSS" ;;
1334 esac
af5e4ada 1335fi
46f18e7b 1336
b39d221a
EC
1337# If this is a cross-compiler that does not
1338# have its own set of headers then define
1339# inhibit_libc
1340
fecd6201
ZW
1341# If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS.
1342# This prevents libgcc2 from containing any code which requires libc
1343# support.
b39d221a 1344inhibit_libc=
4977bab6
ZW
1345if { test x$host != x$target && test "x$with_headers" = x &&
1346 test "x$with_sysroot" = x ; } || test x$with_newlib = xyes ; then
b39d221a 1347 inhibit_libc=-Dinhibit_libc
b39d221a
EC
1348fi
1349AC_SUBST(inhibit_libc)
1350
a078a589
ZW
1351# When building gcc with a cross-compiler, we need to adjust things so
1352# that the generator programs are still built with the native compiler.
1353# Also, we cannot run fixincludes or fix-header.
a078a589
ZW
1354
1355# These are the normal (build=host) settings:
5c35940c
NN
1356BUILD_PREFIX= AC_SUBST(BUILD_PREFIX)
1357BUILD_PREFIX_1=ignore- AC_SUBST(BUILD_PREFIX_1)
4977bab6
ZW
1358BUILD_CC='$(CC)' AC_SUBST(BUILD_CC)
1359BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
a078a589
ZW
1360
1361STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
1362STMP_FIXPROTO=stmp-fixproto AC_SUBST(STMP_FIXPROTO)
1363
1364# And these apply if build != host.
75bffa71 1365if test x$build != x$host
af5e4ada 1366then
5c35940c
NN
1367 BUILD_PREFIX=build-
1368 BUILD_PREFIX_1=build-
4977bab6
ZW
1369 BUILD_CC='$(CC_FOR_BUILD)'
1370 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)'
a078a589
ZW
1371
1372 STMP_FIXINC=
1373 STMP_FIXPROTO=
af5e4ada 1374fi
46f18e7b 1375
ae3a15bb
DE
1376# Expand extra_headers to include complete path.
1377# This substitutes for lots of t-* files.
1378extra_headers_list=
75bffa71 1379if test "x$extra_headers" = x
ae3a15bb
DE
1380then true
1381else
29f7a208 1382 # Prepend ${srcdir}/config/${cpu_type}/ to every entry in extra_headers.
ae3a15bb
DE
1383 for file in $extra_headers;
1384 do
29f7a208 1385 extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
ae3a15bb
DE
1386 done
1387fi
1388
af5e4ada 1389# Add a definition of USE_COLLECT2 if system wants one.
34a86c2b
NN
1390case $use_collect2 in
1391 no) use_collect2= ;;
1392 "") ;;
1393 *)
1394 host_xm_defines="${host_xm_defines} USE_COLLECT2"
1395 xm_defines="${xm_defines} USE_COLLECT2"
1396 ;;
1397esac
af5e4ada 1398
af5e4ada 1399# If we have gas in the build tree, make a link to it.
75bffa71 1400if test -f ../gas/Makefile; then
6e26218f 1401 rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
af5e4ada
DE
1402fi
1403
3cae5780 1404# If we have nm and objdump in the build tree, make a link to them.
75bffa71 1405if test -f ../binutils/Makefile; then
4b95eb49 1406 rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null
3cae5780 1407 rm -f objdump; $symbolic_link ../binutils/objdump$host_exeext objdump$host_exeext 2>/dev/null
4b95eb49
JL
1408fi
1409
af5e4ada 1410# If we have ld in the build tree, make a link to it.
75bffa71 1411if test -f ../ld/Makefile; then
2cc07db4 1412 rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
af5e4ada
DE
1413fi
1414
981d4858
JM
1415# Figure out what assembler we will be using.
1416AC_MSG_CHECKING(what assembler to use)
34a86c2b 1417in_tree_gas=no
9e423e6d 1418gcc_cv_as=
981d4858
JM
1419gcc_cv_gas_major_version=
1420gcc_cv_gas_minor_version=
a2f319ea 1421gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
0936a455 1422gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
3ccc3a56
AO
1423if test -x "$DEFAULT_ASSEMBLER"; then
1424 gcc_cv_as="$DEFAULT_ASSEMBLER"
1425elif test -x "$AS"; then
1426 gcc_cv_as="$AS"
ab339d62 1427elif test -x as$host_exeext; then
9e423e6d
JW
1428 # Build using assembler in the current directory.
1429 gcc_cv_as=./as$host_exeext
34a86c2b
NN
1430elif test -f $gcc_cv_as_gas_srcdir/configure.in \
1431 && test -f ../gas/Makefile; then
9e423e6d 1432 # Single tree build which includes gas.
34a86c2b 1433 in_tree_gas=yes
0936a455 1434 for f in $gcc_cv_as_bfd_srcdir/configure $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in
9e423e6d 1435 do
75bffa71
ILT
1436changequote(,)dnl
1437 gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
1438changequote([,])dnl
1439 if test x$gcc_cv_gas_version != x; then
9e423e6d
JW
1440 break
1441 fi
1442 done
75bffa71
ILT
1443changequote(,)dnl
1444 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
1445 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
c72931a6 1446 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"`
75bffa71 1447changequote([,])dnl
981d4858
JM
1448fi
1449
534d0cc0 1450if test "x$gcc_cv_as" = x; then
779243f7
JL
1451 # Search the same directories that the installed compiler will
1452 # search. Else we may find the wrong assembler and lose. If we
1453 # do not find a suitable assembler binary, then try the user's
1454 # path.
1455 #
1456 # Also note we have to check MD_EXEC_PREFIX before checking the
1457 # user's path. Unfortunately, there is no good way to get at the
1458 # value of MD_EXEC_PREFIX here. So we do a brute force search
1459 # through all the known MD_EXEC_PREFIX values. Ugh. This needs
1460 # to be fixed as part of the make/configure rewrite too.
1461
1462 if test "x$exec_prefix" = xNONE; then
1463 if test "x$prefix" = xNONE; then
1464 test_prefix=/usr/local
1465 else
1466 test_prefix=$prefix
1467 fi
1468 else
1469 test_prefix=$exec_prefix
1470 fi
1471
1472 # If the loop below does not find an assembler, then use whatever
1473 # one we can find in the users's path.
1474 # user's path.
55a2ea2a
AM
1475 if test "x$program_prefix" != xNONE; then
1476 gcc_cv_as=${program_prefix}as$host_exeext
1477 else
1478 gcc_cv_as=`echo as | sed ${program_transform_name}`$host_exeext
1479 fi
1480
1481 test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
1482 $test_prefix/lib/gcc-lib/$target_alias \
1483 /usr/lib/gcc/$target_alias/$gcc_version \
1484 /usr/lib/gcc/$target_alias \
1485 $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
1486 $test_prefix/$target_alias/bin"
1487
1488 if test x$host = x$target; then
1489 test_dirs="$test_dirs \
779243f7
JL
1490 /usr/libexec \
1491 /usr/ccs/gcc \
1492 /usr/ccs/bin \
1493 /udk/usr/ccs/bin \
1494 /bsd43/usr/lib/cmplrs/cc \
1495 /usr/cross64/usr/bin \
1496 /usr/lib/cmplrs/cc \
1497 /sysv/usr/lib/cmplrs/cc \
1498 /svr4/usr/lib/cmplrs/cc \
1499 /usr/bin"
55a2ea2a 1500 fi
779243f7
JL
1501
1502 for dir in $test_dirs; do
55a2ea2a 1503 if test -x $dir/as$host_exeext; then
779243f7
JL
1504 gcc_cv_as=$dir/as$host_exeext
1505 break;
1506 fi
1507 done
9e423e6d 1508fi
34a86c2b
NN
1509case $in_tree_gas in
1510 yes)
1511 AC_MSG_RESULT("newly built gas")
1512 ;;
1513 no)
1514 AC_MSG_RESULT($gcc_cv_as)
1515 ;;
1516esac
981d4858 1517
275b60d6
JJ
1518# Figure out what linker we will be using.
1519AC_MSG_CHECKING(what linker to use)
34a86c2b 1520in_tree_ld=no
275b60d6
JJ
1521gcc_cv_ld=
1522gcc_cv_gld_major_version=
1523gcc_cv_gld_minor_version=
1524gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
1525gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1526if test -x "$DEFAULT_LINKER"; then
1527 gcc_cv_ld="$DEFAULT_LINKER"
1528elif test -x "$LD"; then
1529 gcc_cv_ld="$LD"
1530elif test -x ld$host_exeext; then
1531 # Build using linker in the current directory.
1532 gcc_cv_ld=./ld$host_exeext
34a86c2b
NN
1533elif test -f $gcc_cv_ld_gld_srcdir/configure.in \
1534 && test -f ../ld/Makefile; then
275b60d6 1535 # Single tree build which includes ld.
34a86c2b 1536 in_tree_ld=yes
275b60d6
JJ
1537 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
1538 do
1539changequote(,)dnl
1540 gcc_cv_gld_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
1541changequote([,])dnl
1542 if test x$gcc_cv_gld_version != x; then
1543 break
1544 fi
1545 done
1546changequote(,)dnl
1547 gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
1548 gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
1549changequote([,])dnl
1550fi
1551
534d0cc0 1552if test "x$gcc_cv_ld" = x; then
275b60d6
JJ
1553 # Search the same directories that the installed compiler will
1554 # search. Else we may find the wrong linker and lose. If we
1555 # do not find a suitable linker binary, then try the user's
1556 # path.
1557 #
1558 # Also note we have to check MD_EXEC_PREFIX before checking the
1559 # user's path. Unfortunately, there is no good way to get at the
1560 # value of MD_EXEC_PREFIX here. So we do a brute force search
1561 # through all the known MD_EXEC_PREFIX values. Ugh. This needs
1562 # to be fixed as part of the make/configure rewrite too.
1563
1564 if test "x$exec_prefix" = xNONE; then
1565 if test "x$prefix" = xNONE; then
1566 test_prefix=/usr/local
1567 else
1568 test_prefix=$prefix
1569 fi
1570 else
1571 test_prefix=$exec_prefix
1572 fi
1573
1574 # If the loop below does not find an linker, then use whatever
1575 # one we can find in the users's path.
1576 # user's path.
55a2ea2a
AM
1577 if test "x$program_prefix" != xNONE; then
1578 gcc_cv_ld=${program_prefix}ld$host_exeext
1579 else
1580 gcc_cv_ld=`echo ld | sed ${program_transform_name}`$host_exeext
1581 fi
1582
1583 test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \
1584 $test_prefix/lib/gcc-lib/$target_alias \
1585 /usr/lib/gcc/$target_alias/$gcc_version \
1586 /usr/lib/gcc/$target_alias \
1587 $test_prefix/$target_alias/bin/$target_alias/$gcc_version \
1588 $test_prefix/$target_alias/bin"
1589
1590 if test x$host = x$target; then
1591 test_dirs="$test_dirs \
275b60d6
JJ
1592 /usr/libexec \
1593 /usr/ccs/gcc \
1594 /usr/ccs/bin \
1595 /udk/usr/ccs/bin \
1596 /bsd43/usr/lib/cmplrs/cc \
1597 /usr/cross64/usr/bin \
1598 /usr/lib/cmplrs/cc \
1599 /sysv/usr/lib/cmplrs/cc \
1600 /svr4/usr/lib/cmplrs/cc \
1601 /usr/bin"
55a2ea2a 1602 fi
275b60d6
JJ
1603
1604 for dir in $test_dirs; do
55a2ea2a 1605 if test -x $dir/ld$host_exeext; then
275b60d6
JJ
1606 gcc_cv_ld=$dir/ld$host_exeext
1607 break;
1608 fi
1609 done
1610fi
34a86c2b
NN
1611case $in_tree_ld in
1612 yes)
1613 AC_MSG_RESULT("newly built ld")
1614 ;;
1615 no)
1616 AC_MSG_RESULT($gcc_cv_ld)
1617 ;;
1618esac
275b60d6 1619
981d4858
JM
1620# Figure out what nm we will be using.
1621AC_MSG_CHECKING(what nm to use)
1622if test -x nm$host_exeext; then
1623 gcc_cv_nm=./nm$host_exeext
534d0cc0
AM
1624elif test "x$program_prefix" != xNONE; then
1625 gcc_cv_nm=${program_prefix}nm$host_exeext
1626else
1627 gcc_cv_nm=`echo nm | sed ${program_transform_name}`$host_exeext
981d4858
JM
1628fi
1629AC_MSG_RESULT($gcc_cv_nm)
1630
3cae5780
AS
1631# Figure out what objdump we will be using.
1632AC_MSG_CHECKING(what objdump to use)
1633if test -x objdump$host_exeext; then
1634 gcc_cv_objdump=./objdump$host_exeext
534d0cc0
AM
1635elif test "x$program_prefix" != xNONE; then
1636 gcc_cv_objdump=${program_prefix}objdump$host_exeext
1637else
1638 gcc_cv_objdump=`echo objdump | sed ${program_transform_name}`$host_exeext
3cae5780
AS
1639fi
1640AC_MSG_RESULT($gcc_cv_objdump)
1641
981d4858
JM
1642# Figure out what assembler alignment features are present.
1643AC_MSG_CHECKING(assembler alignment features)
9d147085 1644gcc_cv_as_alignment_features=none
34a86c2b 1645if test $in_tree_gas = yes; then
981d4858
JM
1646 # Gas version 2.6 and later support for .balign and .p2align.
1647 # bytes to skip when using .p2align.
1648 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then
1649 gcc_cv_as_alignment_features=".balign and .p2align"
1650 AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
1651 fi
1652 # Gas version 2.8 and later support specifying the maximum
1653 # bytes to skip when using .p2align.
1654 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then
1655 gcc_cv_as_alignment_features=".p2align including maximum skip"
1656 AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
1657 fi
1658elif test x$gcc_cv_as != x; then
00ccc16d
JL
1659 # Check if we have .balign and .p2align
1660 echo ".balign 4" > conftest.s
1661 echo ".p2align 2" >> conftest.s
1662 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1663 gcc_cv_as_alignment_features=".balign and .p2align"
1664 AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
1665 fi
1666 rm -f conftest.s conftest.o
9e423e6d
JW
1667 # Check if specifying the maximum bytes to skip when
1668 # using .p2align is supported.
1669 echo ".p2align 4,,7" > conftest.s
1670 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1671 gcc_cv_as_alignment_features=".p2align including maximum skip"
1672 AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
1673 fi
1674 rm -f conftest.s conftest.o
1675fi
1676AC_MSG_RESULT($gcc_cv_as_alignment_features)
1677
d1accaa3 1678AC_MSG_CHECKING(assembler subsection support)
9d147085 1679gcc_cv_as_subsections=no
34a86c2b 1680if test $in_tree_gas = yes ; then
981d4858
JM
1681 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1682 gcc_cv_as_subsections="working .subsection -1"
1683 fi
1684elif test x$gcc_cv_as != x; then
d1accaa3
JJ
1685 # Check if we have .subsection
1686 echo ".subsection 1" > conftest.s
1687 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1688 gcc_cv_as_subsections=".subsection"
d1accaa3
JJ
1689 if test x$gcc_cv_nm != x; then
1690 cat > conftest.s <<EOF
1691conftest_label1: .word 0
1692.subsection -1
1693conftest_label2: .word 0
1694.previous
1695EOF
1696 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1697 $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
1698 $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
1b015bec
AO
1699 if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then
1700 :
1701 else
d1accaa3 1702 gcc_cv_as_subsections="working .subsection -1"
d1accaa3
JJ
1703 fi
1704 fi
1705 fi
1706 fi
1707 rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1708fi
981d4858
JM
1709if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then
1710 AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
1711[Define if your assembler supports .subsection and .subsection -1 starts
1712 emitting at the beginning of your section.])
1713fi
d1accaa3
JJ
1714AC_MSG_RESULT($gcc_cv_as_subsections)
1715
12822146 1716AC_MSG_CHECKING(assembler weak support)
9d147085 1717gcc_cv_as_weak=no
34a86c2b 1718if test $in_tree_gas = yes ; then
981d4858
JM
1719 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then
1720 gcc_cv_as_weak="yes"
1721 fi
1722elif test x$gcc_cv_as != x; then
12822146
JL
1723 # Check if we have .weak
1724 echo " .weak foobar" > conftest.s
1725 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
12822146
JL
1726 gcc_cv_as_weak="yes"
1727 fi
1728 rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1729fi
981d4858
JM
1730if test x"$gcc_cv_as_weak" = xyes; then
1731 AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])
1732fi
12822146
JL
1733AC_MSG_RESULT($gcc_cv_as_weak)
1734
6a9c5260 1735AC_MSG_CHECKING(assembler hidden support)
9d147085 1736gcc_cv_as_hidden=no
34a86c2b 1737if test $in_tree_gas = yes ; then
c72931a6
RH
1738 if test "$gcc_cv_gas_major_version" -eq 2 \
1739 -a "$gcc_cv_gas_minor_version" -eq 12 \
1740 -a "$gcc_cv_gas_patch_version" -ge 1 \
1741 -o "$gcc_cv_gas_major_version" -eq 2 \
1742 -a "$gcc_cv_gas_minor_version" -gt 12 \
1743 -o "$gcc_cv_gas_major_version" -gt 2 \
1744 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
981d4858
JM
1745 gcc_cv_as_hidden="yes"
1746 fi
1747elif test x$gcc_cv_as != x; then
6a9c5260
UD
1748 # Check if we have .hidden
1749 echo " .hidden foobar" > conftest.s
1750 echo "foobar:" >> conftest.s
1751 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
6a9c5260
UD
1752 gcc_cv_as_hidden="yes"
1753 fi
1754 rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
c72931a6
RH
1755
1756 # GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
1757 # This is irritatingly difficult to feature test for. Look for
1758 # the date string after the version number.
1759 ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1`
1760 if echo "$ld_ver" | grep GNU > /dev/null; then
1761changequote(,)dnl
4832c9e1
JJ
1762 ld_vers=`echo $ld_ver | sed -n 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\(\|\.[0-9][0-9]*\)\)\([ ].*\|\)$,\1,p'`
1763 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'`
c72931a6 1764 if test 0"$ld_date" -lt 20020404; then
4832c9e1
JJ
1765 if test -n "$ld_date"; then
1766 # If there was date string, but was earlier than 2002-04-04, fail
1767 gcc_cv_as_hidden="no"
1768 elif test -z "$ld_vers"; then
1769 # If there was no date string nor ld version number, something is wrong
1770 gcc_cv_as_hidden="no"
1771 else
1772 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
1773 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
1774 ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
1775 test -z "$ld_vers_patch" && ld_vers_patch=0
1776 if test "$ld_vers_major" -lt 2; then
1777 gcc_cv_as_hidden="no"
1778 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
1779 gcc_cv_as_hidden="no"
1780 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 \
1781 -a "$ld_vers_patch" -eq 0; then
1782 gcc_cv_as_hidden="no"
1783 fi
1784 fi
c72931a6 1785 fi
4832c9e1 1786changequote([,])dnl
c72931a6 1787 fi
6a9c5260 1788fi
981d4858
JM
1789if test x"$gcc_cv_as_hidden" = xyes; then
1790 AC_DEFINE(HAVE_GAS_HIDDEN, 1,
1791 [Define if your assembler supports .hidden.])
1792fi
6a9c5260 1793AC_MSG_RESULT($gcc_cv_as_hidden)
9e944a16 1794libgcc_visibility=$gcc_cv_as_hidden
789b7de5 1795case "$target" in
027faee7 1796 mips-sgi-irix6*)
789b7de5
RO
1797 if test x"$gnu_ld_flag" = x"no"; then
1798 # Even if using gas with .hidden support, the resulting object files
027faee7
AO
1799 # cannot be linked with the IRIX 6 O32 linker. With the N32 and
1800 # N64 linkers, the problem is that the linker refuses to accept
1801 # -call_shared (passed by default to the linker) and -r (used to
1802 # link the object file generated without .hidden directives with
1803 # one that hides symbols), so we also lose.
789b7de5
RO
1804 libgcc_visibility=no
1805 fi
1806 ;;
1807esac
9e944a16 1808AC_SUBST(libgcc_visibility)
6a9c5260 1809
b7460f24 1810AC_MSG_CHECKING(assembler leb128 support)
fbe42b1b 1811gcc_cv_as_leb128=no
34a86c2b 1812if test $in_tree_gas = yes ; then
fbe42b1b 1813 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
b7460f24
RH
1814 gcc_cv_as_leb128="yes"
1815 fi
1816elif test x$gcc_cv_as != x; then
1817 # Check if we have .[us]leb128, and support symbol arithmetic with it.
1818 cat > conftest.s <<EOF
1819 .data
1820 .uleb128 L2 - L1
1821L1:
1822 .uleb128 1280
1823 .sleb128 -1010
1824L2:
1825EOF
1826 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
78e766a0
RH
1827 gcc_cv_as_leb128="yes"
1828
1829 # GAS versions before 2.11 do not support uleb128,
1830 # despite appearing to.
1831 # ??? There exists an elf-specific test that will crash
1832 # the assembler. Perhaps it's better to figure out whether
1833 # arbitrary sections are supported and try the test.
1834 as_ver=`$gcc_cv_as --version 2>/dev/null | head -1`
1835 if echo "$as_ver" | grep GNU > /dev/null; then
78e766a0 1836changequote(,)dnl
5fed851d 1837 as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
0461a052 1838 as_major=`echo $as_ver | sed 's/\..*//'`
3d399d67 1839 as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
78e766a0
RH
1840changequote([,])dnl
1841 if test $as_major -eq 2 -a $as_minor -lt 11; then
1842 gcc_cv_as_leb128="no"
1843 fi
fbe42b1b 1844 fi
b7460f24
RH
1845 fi
1846 rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
1847fi
1848if test x"$gcc_cv_as_leb128" = xyes; then
1849 AC_DEFINE(HAVE_AS_LEB128, 1,
1850 [Define if your assembler supports .uleb128.])
1851fi
1852AC_MSG_RESULT($gcc_cv_as_leb128)
1853
c64688ae
RH
1854AC_MSG_CHECKING(assembler eh_frame optimization)
1855gcc_cv_as_eh_frame=no
34a86c2b 1856if test $in_tree_gas = yes ; then
c64688ae
RH
1857 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
1858 gcc_cv_as_eh_frame="yes"
1859 fi
1860elif test x$gcc_cv_as != x; then
1861 # Check if this is GAS.
41948db5
SS
1862 as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1`
1863 rm -f a.out 2> /dev/null
c64688ae
RH
1864 if echo "$as_ver" | grep GNU > /dev/null; then
1865 # Versions up to and including 2.11.0 may mis-optimize
1866 # .eh_frame data. Try something.
1867 cat > conftest.s <<EOF
1868 .text
1869.LFB1:
1870 .4byte 0
1871.L1:
1872 .4byte 0
1873.LFE1:
1874 .section .eh_frame,"aw",@progbits
1875__FRAME_BEGIN__:
1876 .4byte .LECIE1-.LSCIE1
1877.LSCIE1:
1878 .4byte 0x0
1879 .byte 0x1
1880 .ascii "z\0"
1881 .byte 0x1
1882 .byte 0x78
1883 .byte 0x1a
1884 .byte 0x0
1885 .byte 0x4
1886 .4byte 1
1887 .p2align 1
1888.LECIE1:
1889.LSFDE1:
1890 .4byte .LEFDE1-.LASFDE1
1891.LASFDE1:
1892 .4byte .LASFDE1-__FRAME_BEGIN__
1893 .4byte .LFB1
1894 .4byte .LFE1-.LFB1
1895 .byte 0x4
1896 .4byte .LFE1-.LFB1
1897 .byte 0x4
1898 .4byte .L1-.LFB1
1899.LEFDE1:
1900EOF
01efb963 1901 cat > conftest.lit <<EOF
c64688ae
RH
1902 0000 10000000 00000000 017a0001 781a0004 .........z..x...
1903 0010 01000000 12000000 18000000 00000000 ................
1904 0020 08000000 04080000 0044 .........D
01efb963
AS
1905EOF
1906 cat > conftest.big <<EOF
1907 0000 00000010 00000000 017a0001 781a0004 .........z..x...
1908 0010 00000001 00000012 00000018 00000000 ................
1909 0020 00000008 04000000 0844 .........D
c64688ae
RH
1910EOF
1911 # If the assembler didn't choke, and we can objdump,
1912 # and we got the correct data, then succeed.
1913 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
3cae5780 1914 && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
c64688ae 1915 | tail -3 > conftest.got \
01efb963
AS
1916 && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
1917 || cmp conftest.big conftest.got > /dev/null 2>&1; }
c64688ae
RH
1918 then
1919 gcc_cv_as_eh_frame="yes"
1920 else
1921 gcc_cv_as_eh_frame="bad"
1922 if $gcc_cv_as -o conftest.o --traditional-format /dev/null; then
1923 AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
1924 [Define if your assembler mis-optimizes .eh_frame data.])
1925 fi
1926 fi
1927 fi
1928 rm -f conftest.*
1929fi
1930AC_MSG_RESULT($gcc_cv_as_eh_frame)
1931
201556f0
JJ
1932AC_MSG_CHECKING(assembler section merging support)
1933gcc_cv_as_shf_merge=no
34a86c2b 1934if test $in_tree_gas = yes ; then
201556f0 1935 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
a8b7afb9 1936 gcc_cv_as_shf_merge=yes
201556f0
JJ
1937 fi
1938elif test x$gcc_cv_as != x; then
1939 # Check if we support SHF_MERGE sections
1940 echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s
a8b7afb9 1941 if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1; then
201556f0
JJ
1942 gcc_cv_as_shf_merge=yes
1943 fi
1944 rm -f conftest.s conftest.o
1945fi
1946if test x"$gcc_cv_as_shf_merge" = xyes; then
1947 AC_DEFINE(HAVE_GAS_SHF_MERGE, 1,
1948[Define if your assembler supports marking sections with SHF_MERGE flag.])
1949fi
1950AC_MSG_RESULT($gcc_cv_as_shf_merge)
1951
f996902d
RH
1952AC_MSG_CHECKING(assembler thread-local storage support)
1953gcc_cv_as_tls=no
1954conftest_s=
1955tls_first_major=
1956tls_first_minor=
1957case "$target" in
1958changequote(,)dnl
6f9b006d
RH
1959 alpha*-*-*)
1960 conftest_s='
1961 .section ".tdata","awT",@progbits
1962foo: .long 25
1963 .text
1964 ldq $27,__tls_get_addr($29) !literal!1
1965 lda $16,foo($29) !tlsgd!1
1966 jsr $26,($27),__tls_get_addr !lituse_tlsgd!1
1967 ldq $27,__tls_get_addr($29) !literal!2
1968 lda $16,foo($29) !tlsldm!2
1969 jsr $26,($27),__tls_get_addr !lituse_tlsldm!2
1970 ldq $1,foo($29) !gotdtprel
1971 ldah $2,foo($29) !dtprelhi
1972 lda $3,foo($2) !dtprello
1973 lda $4,foo($29) !dtprel
1974 ldq $1,foo($29) !gottprel
1975 ldah $2,foo($29) !tprelhi
1976 lda $3,foo($2) !tprello
1977 lda $4,foo($29) !tprel'
1978 tls_first_major=2
1979 tls_first_minor=13
1980 ;;
f996902d
RH
1981 i[34567]86-*-*)
1982changequote([,])dnl
1983 conftest_s='
1984 .section ".tdata","awT",@progbits
1985foo: .long 25
1986 .text
1987 movl %gs:0, %eax
1988 leal foo@TLSGD(,%ebx,1), %eax
1989 leal foo@TLSLDM(%ebx), %eax
1990 leal foo@DTPOFF(%eax), %edx
1991 movl foo@GOTTPOFF(%ebx), %eax
1992 subl foo@GOTTPOFF(%ebx), %eax
75d38379
JJ
1993 addl foo@GOTNTPOFF(%ebx), %eax
1994 movl foo@INDNTPOFF, %eax
f996902d
RH
1995 movl $foo@TPOFF, %eax
1996 subl $foo@TPOFF, %eax
1997 leal foo@NTPOFF(%ecx), %eax'
1998 tls_first_major=2
75d38379
JJ
1999 tls_first_minor=14
2000 ;;
2001 x86_64-*-*)
2002 conftest_s='
2003 .section ".tdata","awT",@progbits
2004foo: .long 25
2005 .text
2006 movq %fs:0, %rax
2007 leaq foo@TLSGD(%rip), %rdi
2008 leaq foo@TLSLD(%rip), %rdi
2009 leaq foo@DTPOFF(%rax), %rdx
2010 movq foo@GOTTPOFF(%rip), %rax
2011 movq $foo@TPOFF, %rax'
2012 tls_first_major=2
2013 tls_first_minor=14
f996902d 2014 ;;
7b6e506e
RH
2015 ia64-*-*)
2016 conftest_s='
2017 .section ".tdata","awT",@progbits
2018foo: data8 25
2019 .text
2020 addl r16 = @ltoff(@dtpmod(foo#)), gp
2021 addl r17 = @ltoff(@dtprel(foo#)), gp
2022 addl r18 = @ltoff(@tprel(foo#)), gp
2023 addl r19 = @dtprel(foo#), gp
2024 adds r21 = @dtprel(foo#), r13
2025 movl r23 = @dtprel(foo#)
2026 addl r20 = @tprel(foo#), gp
2027 adds r22 = @tprel(foo#), r13
2028 movl r24 = @tprel(foo#)'
2029 tls_first_major=2
2030 tls_first_minor=13
2031 ;;
fd3cd001
UW
2032 s390-*-*)
2033 conftest_s='
2034 .section ".tdata","awT",@progbits
2035foo: .long 25
2036 .text
2037 .long foo@TLSGD
2038 .long foo@TLSLDM
2039 .long foo@DTPOFF
2040 .long foo@NTPOFF
2041 .long foo@GOTNTPOFF
2042 .long foo@INDNTPOFF
2043 l %r1,foo@GOTNTPOFF(%r12)
2044 l %r1,0(%r1):tls_load:foo
2045 bas %r14,0(%r1,%r13):tls_gdcall:foo
2046 bas %r14,0(%r1,%r13):tls_ldcall:foo'
2047 tls_first_major=2
2048 tls_first_minor=14
2049 ;;
2050 s390x-*-*)
2051 conftest_s='
2052 .section ".tdata","awT",@progbits
2053foo: .long 25
2054 .text
2055 .quad foo@TLSGD
2056 .quad foo@TLSLDM
2057 .quad foo@DTPOFF
2058 .quad foo@NTPOFF
2059 .quad foo@GOTNTPOFF
2060 lg %r1,foo@GOTNTPOFF(%r12)
2061 larl %r1,foo@INDNTPOFF
2062 brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo
2063 brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo'
2064 tls_first_major=2
2065 tls_first_minor=14
2066 ;;
f996902d
RH
2067esac
2068if test -z "$tls_first_major"; then
2069 :
34a86c2b 2070elif test $in_tree_gas = yes ; then
f996902d
RH
2071 if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \
2072 -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \
2073 -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then
2074 gcc_cv_as_tls=yes
2075 fi
2076elif test x$gcc_cv_as != x; then
2077 echo "$conftest_s" > conftest.s
2078 if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1
2079 then
2080 gcc_cv_as_tls=yes
2081 fi
2082 rm -f conftest.s conftest.o
2083fi
2084if test "$gcc_cv_as_tls" = yes; then
2085 AC_DEFINE(HAVE_AS_TLS, 1,
2086 [Define if your assembler supports thread-local storage.])
2087fi
2088AC_MSG_RESULT($gcc_cv_as_tls)
2089
275b60d6 2090case "$target" in
3a37b08e
RH
2091 # All TARGET_ABI_OSF targets.
2092 alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
2093 AC_CACHE_CHECK([assembler supports explicit relocations],
2094 gcc_cv_as_explicit_relocs, [
2095 gcc_cv_as_explicit_relocs=unknown
34a86c2b 2096 if test $in_tree_gas = yes ; then
3a37b08e
RH
2097 if test "$gcc_cv_gas_major_version" -eq 2 \
2098 -a "$gcc_cv_gas_minor_version" -ge 12 \
2099 -o "$gcc_cv_gas_major_version" -gt 2; then
2100 gcc_cv_as_explicit_relocs=yes
2101 fi
2102 elif test x$gcc_cv_as != x; then
2103 cat > conftest.s << 'EOF'
2104 .set nomacro
2105 .text
2106 extbl $3, $2, $3 !lituse_bytoff!1
2107 ldq $2, a($29) !literal!1
2108 ldq $4, b($29) !literal!2
2109 ldq_u $3, 0($2) !lituse_base!1
2110 ldq $27, f($29) !literal!5
2111 jsr $26, ($27), f !lituse_jsr!5
2112 ldah $29, 0($26) !gpdisp!3
2113 lda $0, c($29) !gprel
2114 ldah $1, d($29) !gprelhigh
2115 lda $1, d($1) !gprellow
2116 lda $29, 0($29) !gpdisp!3
2117EOF
2118 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
2119 gcc_cv_as_explicit_relocs=yes
2120 else
2121 gcc_cv_as_explicit_relocs=no
2122 fi
2123 rm -f conftest.s conftest.o
2124 fi
2125 ])
2126 if test "x$gcc_cv_as_explicit_relocs" = xyes; then
2127 AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
2128 [Define if your assembler supports explicit relocations.])
2129 fi
2130 ;;
1cb36a98 2131 sparc*-*-*)
5b68c389
AO
2132 AC_CACHE_CHECK([assembler .register pseudo-op support],
2133 gcc_cv_as_register_pseudo_op, [
2134 gcc_cv_as_register_pseudo_op=unknown
2135 if test x$gcc_cv_as != x; then
2136 # Check if we have .register
2137 echo ".register %g2, #scratch" > conftest.s
2138 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
1cb36a98 2139 gcc_cv_as_register_pseudo_op=yes
5b68c389
AO
2140 else
2141 gcc_cv_as_register_pseudo_op=no
2142 fi
2143 rm -f conftest.s conftest.o
1cb36a98 2144 fi
5b68c389
AO
2145 ])
2146 if test "x$gcc_cv_as_register_pseudo_op" = xyes; then
119d24d1
KG
2147 AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
2148 [Define if your assembler supports .register.])
1cb36a98 2149 fi
1cb36a98 2150
e95b1e6a
JJ
2151 AC_CACHE_CHECK([assembler supports -relax],
2152 gcc_cv_as_relax_opt, [
2153 gcc_cv_as_relax_opt=unknown
2154 if test x$gcc_cv_as != x; then
2155 # Check if gas supports -relax
2156 echo ".text" > conftest.s
2157 if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then
2158 gcc_cv_as_relax_opt=yes
2159 else
2160 gcc_cv_as_relax_opt=no
2161 fi
2162 rm -f conftest.s conftest.o
2163 fi
2164 ])
2165 if test "x$gcc_cv_as_relax_opt" = xyes; then
2166 AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
2167 [Define if your assembler supports -relax option.])
2168 fi
2169
17e9e88c
JJ
2170 AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
2171 gcc_cv_as_sparc_ua_pcrel, [
2172 gcc_cv_as_sparc_ua_pcrel=unknown
2173 if test x$gcc_cv_as != x -a x$gcc_cv_ld != x; then
2174 gcc_cv_as_sparc_ua_pcrel=no
2175 echo ".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo)" > conftest.s
cf7b8b0d
JJ
2176 if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \
2177 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
2178 gcc_cv_as_sparc_ua_pcrel=yes
17e9e88c
JJ
2179 fi
2180 rm -f conftest.s conftest.o conftest
2181 fi
2182 ])
2183 if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then
2184 AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
2185 [Define if your assembler and linker support unaligned PC relative relocs.])
2186 fi
2187
cf7b8b0d
JJ
2188 AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs against hidden symbols],
2189 gcc_cv_as_sparc_ua_pcrel_hidden, [
2190 if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then
2191 gcc_cv_as_sparc_ua_pcrel_hidden=unknown
2192 if test x$gcc_cv_objdump != x; then
2193 gcc_cv_as_sparc_ua_pcrel_hidden=no
2194 echo ".data; .align 4; .byte 0x31; .uaword %r_disp32(foo)" > conftest.s
2195 echo ".byte 0x32, 0x33, 0x34; .global foo; .hidden foo" >> conftest.s
2196 echo "foo: .skip 4" >> conftest.s
2197 if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \
2198 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
2199 && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
2200 | grep ' 31000000 07323334' > /dev/null 2>&1; then
2201 if $gcc_cv_objdump -R conftest 2> /dev/null \
2202 | grep 'DISP32' > /dev/null 2>&1; then
2203 :
2204 else
2205 gcc_cv_as_sparc_ua_pcrel_hidden=yes
2206 fi
2207 fi
2208 fi
2209 rm -f conftest.s conftest.o conftest
2210 else
2211 gcc_cv_as_sparc_ua_pcrel_hidden="$gcc_cv_as_sparc_ua_pcrel"
2212 fi
2213 ])
2214 if test "x$gcc_cv_as_sparc_ua_pcrel_hidden" = xyes; then
2215 AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
2216 [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])
2217 fi
2218
22252625
JJ
2219 AC_CACHE_CHECK([for assembler offsetable %lo() support],
2220 gcc_cv_as_offsetable_lo10, [
2221 gcc_cv_as_offsetable_lo10=unknown
2222 if test "x$gcc_cv_as" != x; then
2223 # Check if assembler has offsetable %lo()
2224 echo "or %g1, %lo(ab) + 12, %g1" > conftest.s
2225 echo "or %g1, %lo(ab + 12), %g1" > conftest1.s
2226 if $gcc_cv_as -xarch=v9 -o conftest.o conftest.s \
2227 > /dev/null 2>&1 &&
2228 $gcc_cv_as -xarch=v9 -o conftest1.o conftest1.s \
2229 > /dev/null 2>&1; then
2230 if cmp conftest.o conftest1.o > /dev/null 2>&1; then
5b68c389 2231 gcc_cv_as_offsetable_lo10=no
22252625
JJ
2232 else
2233 gcc_cv_as_offsetable_lo10=yes
1cb36a98 2234 fi
22252625
JJ
2235 else
2236 gcc_cv_as_offsetable_lo10=no
5b68c389 2237 fi
22252625 2238 rm -f conftest.s conftest.o conftest1.s conftest1.o
1cb36a98 2239 fi
22252625
JJ
2240 ])
2241 if test "x$gcc_cv_as_offsetable_lo10" = xyes; then
2242 AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
2243 [Define if your assembler supports offsetable %lo().])
1cb36a98 2244 fi
cb65112a 2245
1cb36a98
RH
2246 ;;
2247
2248changequote(,)dnl
c307e6dd 2249 i[34567]86-*-* | x86_64-*-*)
1cb36a98
RH
2250changequote([,])dnl
2251 AC_MSG_CHECKING(assembler instructions)
2252 gcc_cv_as_instructions=
34a86c2b 2253 if test $in_tree_gas = yes ; then
981d4858
JM
2254 if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then
2255 gcc_cv_as_instructions="filds fists"
2256 fi
2257 elif test x$gcc_cv_as != x; then
53b5ce19
JW
2258 set "filds fists" "filds mem; fists mem"
2259 while test $# -gt 0
2260 do
2261 echo "$2" > conftest.s
2262 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
2263 gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" "
53b5ce19
JW
2264 fi
2265 shift 2
2266 done
2267 rm -f conftest.s conftest.o
1cb36a98 2268 fi
981d4858 2269 if test x"$gcc_cv_as_instructions" != x; then
ee7692d2 2270 AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$gcc_cv_as_instructions" | sed -e 's/ $//' | tr '[a-z ]' '[A-Z_]'`)
981d4858 2271 fi
1cb36a98 2272 AC_MSG_RESULT($gcc_cv_as_instructions)
f88c65f7
RH
2273
2274 AC_MSG_CHECKING(assembler GOTOFF in data directives)
2275 gcc_cv_as_gotoff_in_data=no
34a86c2b 2276 if test $in_tree_gas = yes ; then
f88c65f7
RH
2277 if test "$gcc_cv_gas_major_version" -eq 2 \
2278 -a "$gcc_cv_gas_minor_version" -ge 11 \
2279 -o "$gcc_cv_gas_major_version" -gt 2; then
2280 gcc_cv_as_gotoff_in_data=yes
2281 fi
2282 elif test x$gcc_cv_as != x; then
2283 cat > conftest.s <<EOF
2284 .text
2285.L0:
2286 nop
2287 .data
2288 .long .L0@GOTOFF
2289EOF
2290 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
2291 gcc_cv_as_gotoff_in_data=yes
2292 fi
2293 fi
2294 AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
2295 [`if test $gcc_cv_as_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
2296 [Define true if the assembler supports '.long foo@GOTOFF'.])
2297 AC_MSG_RESULT($gcc_cv_as_gotoff_in_data)
1cb36a98 2298 ;;
ef1ecf87
RH
2299
2300 ia64*-*-*)
2301 AC_CACHE_CHECK([assembler supports ltoffx and ldxmov],
2302 gcc_cv_as_ltoffx_ldxmov_relocs, [
2303 gcc_cv_as_ltoffx_ldxmov_relocs=unknown
2304 if test x$gcc_cv_gas_major_version != x \
2305 -a x$gcc_cv_gas_minor_version != x
2306 then
2307 if test "$gcc_cv_gas_major_version" -eq 2 \
2308 -a "$gcc_cv_gas_minor_version" -ge 14 \
2309 -o "$gcc_cv_gas_major_version" -gt 2; then
2310 gcc_cv_as_ltoffx_ldxmov_relocs=yes
2311 fi
2312 elif test x$gcc_cv_as != x; then
2313 cat > conftest.s << 'EOF'
2314changequote(,)dnl
2315 .text
2316 addl r15 = @ltoffx(x#), gp
2317 ;;
2318 ld8.mov r16 = [r15], x#
2319EOF
2320changequote([,])dnl
2321 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
2322 gcc_cv_as_ltoffx_ldxmov_relocs=yes
2323 else
2324 gcc_cv_as_ltoffx_ldxmov_relocs=no
2325 fi
2326 rm -f conftest.s conftest.o
2327 fi
2328 ])
2329 if test "x$gcc_cv_as_ltoffx_ldxmov_relocs" = xyes; then
2330 AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
2331 [Define if your assembler supports ltoffx and ldxmov relocations.])
2332 fi
2333 ;;
1cb36a98 2334esac
53b5ce19 2335
9d147085
RH
2336AC_MSG_CHECKING(assembler dwarf2 debug_line support)
2337gcc_cv_as_dwarf2_debug_line=no
2338# ??? Not all targets support dwarf2 debug_line, even within a version
2339# of gas. Moreover, we need to emit a valid instruction to trigger any
2340# info to the output file. So, as supported targets are added to gas 2.11,
2341# add some instruction here to (also) show we expect this might work.
2342# ??? Once 2.11 is released, probably need to add first known working
2343# version to the per-target configury.
2344case "$target" in
80486e06
DJ
2345 i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
2346 | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-*)
9d147085
RH
2347 insn="nop"
2348 ;;
2349 ia64*-*-*)
2350 insn="nop 0"
2351 ;;
2352 esac
34a86c2b 2353if test $in_tree_gas = yes ; then
9d147085
RH
2354 if test "$gcc_cv_gas_major_version" -eq 2 \
2355 -a "$gcc_cv_gas_minor_version" -ge 11 \
2356 -o "$gcc_cv_gas_major_version" -gt 2 \
2357 && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2358 && test x"$insn" != x ; then
2359 gcc_cv_as_dwarf2_debug_line="yes"
2360 fi
2361elif test x$gcc_cv_as != x -a x"$insn" != x ; then
acc187f5
RH
2362 echo ' .file 1 "conftest.s"' > conftest.s
2363 echo ' .loc 1 3 0' >> conftest.s
9d147085 2364 echo " $insn" >> conftest.s
981975b6 2365 # ??? This fails with non-gnu grep.
9d147085
RH
2366 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
2367 && grep debug_line conftest.o > /dev/null 2>&1 ; then
981975b6 2368 # The .debug_line file table must be in the exact order that
eaec9b3d 2369 # we specified the files, since these indices are also used
981975b6
RH
2370 # by DW_AT_decl_file. Approximate this test by testing if
2371 # the assembler bitches if the same index is assigned twice.
2372 echo ' .file 1 "foo.s"' > conftest.s
2373 echo ' .file 1 "bar.s"' >> conftest.s
2374 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1
2375 then
2376 gcc_cv_as_dwarf2_debug_line="no"
2377 else
2378 gcc_cv_as_dwarf2_debug_line="yes"
2379 fi
9d147085
RH
2380 fi
2381 rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
2382fi
2383if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then
2384 AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
981975b6 2385[Define if your assembler supports dwarf2 .file/.loc directives,
eaec9b3d 2386 and preserves file table indices exactly as given.])
9d147085
RH
2387fi
2388AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
2389
5f0e9ea2
GK
2390AC_MSG_CHECKING(assembler --gdwarf2 support)
2391gcc_cv_as_gdwarf2_flag=no
34a86c2b 2392if test $in_tree_gas = yes ; then
5f0e9ea2
GK
2393 if test "$gcc_cv_gas_major_version" -eq 2 \
2394 -a "$gcc_cv_gas_minor_version" -ge 11 \
2395 -o "$gcc_cv_gas_major_version" -gt 2 \
2396 && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2397 && test x"$insn" != x ; then
da77408f 2398 gcc_cv_as_gdwarf2_flag="yes"
5f0e9ea2
GK
2399 fi
2400elif test x$gcc_cv_as != x -a x"$insn" != x ; then
2401 echo '' > conftest.s
2402 # ??? This fails with non-gnu grep.
2403 if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1
2404 then
2405 gcc_cv_as_gdwarf2_flag="yes"
2406 fi
2407 rm -f conftest.s conftest.o
2408fi
2409if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then
2410 AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
2411[Define if your assembler supports the --gdwarf2 option.])
2412fi
2413AC_MSG_RESULT($gcc_cv_as_gdwarf2_flag)
2414
2415AC_MSG_CHECKING(assembler --gstabs support)
2416gcc_cv_as_gstabs_flag=no
34a86c2b 2417if test $in_tree_gas = yes ; then
5f0e9ea2
GK
2418 if test "$gcc_cv_gas_major_version" -eq 2 \
2419 -a "$gcc_cv_gas_minor_version" -ge 11 \
2420 -o "$gcc_cv_gas_major_version" -gt 2 \
2421 && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
2422 && test x"$insn" != x ; then
da77408f 2423 gcc_cv_as_gstabs_flag="yes"
5f0e9ea2
GK
2424 fi
2425elif test x$gcc_cv_as != x -a x"$insn" != x ; then
2426 echo '' > conftest.s
2427 # ??? This fails with non-gnu grep.
2428 if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then
2429 gcc_cv_as_gstabs_flag="yes"
2430 fi
2431 rm -f conftest.s conftest.o
2432fi
2433if test x"$gcc_cv_as_gstabs_flag" = xyes; then
2434 AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
2435[Define if your assembler supports the --gstabs option.])
2436fi
2437AC_MSG_RESULT($gcc_cv_as_gstabs_flag)
2438
96d0f4dc
JJ
2439AC_MSG_CHECKING(linker read-only and read-write section mixing)
2440gcc_cv_ld_ro_rw_mix=unknown
34a86c2b 2441if test $in_tree_ld = yes ; then
96d0f4dc
JJ
2442 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 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
2443 gcc_cv_ld_ro_rw_mix=read-write
2444 fi
2445elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
2446 echo '.section "myfoosect", "a"' > conftest1.s
2447 echo '.section "myfoosect", "aw"' > conftest2.s
2448 echo '.byte 1' >> conftest2.s
2449 echo '.section "myfoosect", "a"' > conftest3.s
2450 echo '.byte 0' >> conftest3.s
6cd656d0
KC
2451 if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
2452 && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
2453 && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
96d0f4dc
JJ
2454 && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
2455 conftest2.o conftest3.o; then
2456 gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
2457 | grep -A1 myfoosect`
2458 if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
2459 if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
2460 gcc_cv_ld_ro_rw_mix=read-only
2461 else
2462 gcc_cv_ld_ro_rw_mix=read-write
2463 fi
2464 fi
2465 fi
2466changequote(,)dnl
2467 rm -f conftest.* conftest[123].*
2468changequote([,])dnl
2469fi
2470if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
2471 AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
2472 [Define if your linker links a mix of read-only
2473 and read-write sections into a read-write section.])
2474fi
2475AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
2476
275b60d6
JJ
2477AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
2478gcc_cv_ld_eh_frame_hdr=no
34a86c2b 2479if test $in_tree_ld = yes ; then
275b60d6
JJ
2480 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 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
2481 gcc_cv_ld_eh_frame_hdr=yes
2482 fi
2483elif test x$gcc_cv_ld != x; then
2484 # Check if linker supports --eh-frame-hdr option
2485 if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then
2486 gcc_cv_ld_eh_frame_hdr=yes
2487 fi
2488fi
2489if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
2490 AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
2491[Define if your linker supports --eh-frame-hdr option.])
2492fi
2493AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
2494
4357a6c3
CD
2495# Miscellaneous target-specific checks.
2496case "$target" in
2497 mips*-*-*)
2498 AC_MSG_CHECKING(whether libgloss uses STARTUP directives consistently)
2499 gcc_cv_mips_libgloss_startup=no
2500 gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss
2501 if test "x$exec_prefix" = xNONE; then
2502 if test "x$prefix" = xNONE; then
2503 test_prefix=/usr/local
2504 else
2505 test_prefix=$prefix
2506 fi
2507 else
2508 test_prefix=$exec_prefix
2509 fi
2510 for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld
2511 do
2512 if grep '^STARTUP' $f > /dev/null 2>&1; then
2513 gcc_cv_mips_libgloss_startup=yes
2514 break
2515 fi
2516 done
2517 if test x"$gcc_cv_mips_libgloss_startup" = xyes; then
2518 AC_DEFINE(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES, 1,
2519 [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.])
2520 fi
2521 AC_MSG_RESULT($gcc_cv_mips_libgloss_startup)
2522 ;;
2523esac
2524
9fb28a67 2525if test x$with_sysroot = x && test x$host = x$target \
047d636f 2526 && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
793e9558
PB
2527 AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
2528fi
2529
571a8de5 2530# Figure out what language subdirectories are present.
71205e0b
MH
2531# Look if the user specified --enable-languages="..."; if not, use
2532# the environment variable $LANGUAGES if defined. $LANGUAGES might
2533# go away some day.
cc9a08e0 2534# NB: embedded tabs in this IF block -- do not untabify
71205e0b
MH
2535if test x"${enable_languages+set}" != xset; then
2536 if test x"${LANGUAGES+set}" = xset; then
cc9a08e0
PE
2537 enable_languages="${LANGUAGES}"
2538 AC_MSG_WARN([setting LANGUAGES is deprecated, use --enable-languages instead])
2539
71205e0b
MH
2540 else
2541 enable_languages=all
2542 fi
d6c6b553 2543else
015089dd
TJ
2544 if test x"${enable_languages}" = x \
2545 || test x"${enable_languages}" = xyes;
cc9a08e0
PE
2546 then
2547 AC_MSG_ERROR([--enable-languages needs at least one language argument])
d6c6b553 2548 fi
71205e0b 2549fi
cc9a08e0 2550enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'`
75382c6d
TT
2551
2552# First scan to see if an enabled language requires some other language.
2553# We assume that a given config-lang.in will list all the language
2554# front ends it requires, even if some are required indirectly.
2555for lang in ${srcdir}/*/config-lang.in ..
2556do
2557 case $lang in
2558 ..)
2559 ;;
2560 # The odd quoting in the next line works around
2561 # an apparent bug in bash 1.12 on linux.
2562changequote(,)dnl
2563 ${srcdir}/[*]/config-lang.in)
2564 ;;
2565 *)
2566 lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang`
2567 this_lang_requires=`sed -n -e 's,^lang_requires=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^lang_requires=\([^ ]*\).*$,\1,p' $lang`
2568 for other in $this_lang_requires
2569 do
2570 case ,${enable_languages}, in
2571 *,$other,*)
2572 ;;
2573 *,all,*)
2574 ;;
1bf17cc4 2575 *,$lang_alias,*)
75382c6d
TT
2576 enable_languages="$enable_languages,$other"
2577 ;;
2578 esac
2579 done
2580 ;;
2581changequote([,])dnl
2582 esac
2583done
2584
015089dd
TJ
2585expected_languages=`echo ,${enable_languages}, | sed -e 's:,: :g' -e 's: *: :g' -e 's: *: :g' -e 's:^ ::' -e 's: $::'`
2586found_languages=
571a8de5
DE
2587subdirs=
2588for lang in ${srcdir}/*/config-lang.in ..
2589do
2590 case $lang in
2591 ..) ;;
2592 # The odd quoting in the next line works around
2593 # an apparent bug in bash 1.12 on linux.
75bffa71
ILT
2594changequote(,)dnl
2595 ${srcdir}/[*]/config-lang.in) ;;
71205e0b
MH
2596 *)
2597 lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang`
2b60b2cb
AO
2598 this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ ]*\).*$,\1,p' $lang`
2599 build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ ]*\).*$,\1,p' $lang`
71205e0b
MH
2600 if test "x$lang_alias" = x
2601 then
2602 echo "$lang doesn't set \$language." 1>&2
2603 exit 1
2604 fi
2b60b2cb
AO
2605 case ${build_by_default},${enable_languages}, in
2606 *,$lang_alias,*) add_this_lang=yes ;;
2607 no,*) add_this_lang=no ;;
2608 *,all,*) add_this_lang=yes ;;
2609 *) add_this_lang=no ;;
2610 esac
015089dd 2611 found_languages="${found_languages} ${lang_alias}"
71205e0b
MH
2612 if test x"${add_this_lang}" = xyes; then
2613 case $lang in
2614 ${srcdir}/ada/config-lang.in)
1ffc5c6e 2615 if test x$have_gnat = xyes ; then
71205e0b
MH
2616 subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
2617 fi
2618 ;;
2619 *)
2620 subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
2621 ;;
2622 esac
2623 fi
2624 ;;
75bffa71 2625changequote([,])dnl
571a8de5
DE
2626 esac
2627done
2628
015089dd
TJ
2629missing_languages=
2630for expected_language in ${expected_languages} ..
2631do
2632 if test "${expected_language}" != ..; then
2633 missing_language="${expected_language}"
2634 if test "${expected_language}" = "c" \
2635 || test "${expected_language}" = "all"; then
2636 missing_language=
2637 fi
2638 for found_language in ${found_languages} ..
2639 do
2640 if test "${found_language}" != ..; then
2641 if test "${expected_language}" = "${found_language}"; then
2642 missing_language=
2643 fi
2644 fi
2645 done
2646 if test "x${missing_language}" != x; then
2647 missing_languages="${missing_languages} ${missing_language}"
2648 fi
2649 fi
2650done
2651
2652if test "x$missing_languages" != x; then
2653 AC_MSG_ERROR([
2654The following requested languages were not found:${missing_languages}
2655The following languages were available: c${found_languages}])
02ef40d9
TJ
2656fi
2657
f24af81b
TT
2658# Make gthr-default.h if we have a thread file.
2659gthread_flags=
75bffa71 2660if test $thread_file != single; then
f24af81b 2661 rm -f gthr-default.h
db0d1ed9 2662 echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h
f24af81b
TT
2663 gthread_flags=-DHAVE_GTHR_DEFAULT
2664fi
2665AC_SUBST(gthread_flags)
2666
81bf3d9e
RH
2667# Find out what GC implementation we want, or may, use.
2668AC_ARG_WITH(gc,
e8bec136
RO
2669[ --with-gc={simple,page} choose the garbage collection mechanism to use
2670 with the compiler],
81bf3d9e
RH
2671[case "$withval" in
2672 simple | page)
2673 GGC=ggc-$withval
2674 ;;
2675 *)
2676 AC_MSG_ERROR([$withval is an invalid option to --with-gc])
2677 ;;
2678esac],
130fadbb 2679[GGC=ggc-page])
81bf3d9e
RH
2680AC_SUBST(GGC)
2681echo "Using $GGC for garbage collection."
2682
3c809ba4 2683# Use the system's zlib library.
b8dad04b
ZW
2684zlibdir=-L../zlib
2685zlibinc="-I\$(srcdir)/../zlib"
3c809ba4
AG
2686AC_ARG_WITH(system-zlib,
2687[ --with-system-zlib use installed libz],
2688zlibdir=
2689zlibinc=
2690)
2691AC_SUBST(zlibdir)
2692AC_SUBST(zlibinc)
2693
dc6746e7
PT
2694dnl Very limited version of automake's enable-maintainer-mode
2695
2696AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2697 dnl maintainer-mode is disabled by default
2698 AC_ARG_ENABLE(maintainer-mode,
e8bec136
RO
2699[ --enable-maintainer-mode
2700 enable make rules and dependencies not useful
dc6746e7
PT
2701 (and sometimes confusing) to the casual installer],
2702 maintainer_mode=$enableval,
2703 maintainer_mode=no)
2704
2705AC_MSG_RESULT($maintainer_mode)
2706
2707if test "$maintainer_mode" = "yes"; then
2708 MAINT=''
2709else
2710 MAINT='#'
2711fi
2712AC_SUBST(MAINT)dnl
2713
571a8de5
DE
2714# Make empty files to contain the specs and options for each language.
2715# Then add #include lines to for a compiler that has specs and/or options.
2716
2717lang_specs_files=
2718lang_options_files=
3103b7db 2719lang_tree_files=
571a8de5
DE
2720for subdir in . $subdirs
2721do
75bffa71 2722 if test -f $srcdir/$subdir/lang-specs.h; then
0d24f4d1 2723 lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
571a8de5 2724 fi
75bffa71 2725 if test -f $srcdir/$subdir/lang-options.h; then
0d24f4d1 2726 lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h"
571a8de5 2727 fi
3103b7db 2728 if test -f $srcdir/$subdir/$subdir-tree.def; then
0d24f4d1 2729 lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
3103b7db 2730 fi
571a8de5
DE
2731done
2732
2733# These (without "all_") are set in each config-lang.in.
2734# `language' must be a single word so is spelled singularly.
2735all_languages=
2736all_boot_languages=
2737all_compilers=
2738all_stagestuff=
e34a3d31 2739all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc mkheaders'
571a8de5
DE
2740# List of language makefile fragments.
2741all_lang_makefiles=
e2500fed 2742# Files for gengtype
ef69da62 2743all_gtfiles="$target_gtfiles"
8ac9d31f
TJ
2744# Files for gengtype with language
2745all_gtfiles_files_langs=
2746all_gtfiles_files_files=
571a8de5
DE
2747
2748# Add the language fragments.
2749# Languages are added via two mechanisms. Some information must be
2750# recorded in makefile variables, these are defined in config-lang.in.
2751# We accumulate them and plug them into the main Makefile.
2752# The other mechanism is a set of hooks for each of the main targets
2753# like `clean', `install', etc.
2754
2755language_fragments="Make-lang"
2756language_hooks="Make-hooks"
2757
2758for s in .. $subdirs
2759do
75bffa71 2760 if test $s != ".."
571a8de5
DE
2761 then
2762 language=
2763 boot_language=
2764 compilers=
2765 stagestuff=
0280cf84 2766 outputs=
e2500fed 2767 gtfiles=
571a8de5 2768 . ${srcdir}/$s/config-lang.in
75bffa71 2769 if test "x$language" = x
571a8de5
DE
2770 then
2771 echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2
2772 exit 1
2773 fi
72aaffbd
ZW
2774 all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in"
2775 if test -f ${srcdir}/$s/Makefile.in
2776 then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in"
2777 fi
571a8de5 2778 all_languages="$all_languages $language"
75bffa71 2779 if test "x$boot_language" = xyes
571a8de5
DE
2780 then
2781 all_boot_languages="$all_boot_languages $language"
2782 fi
2783 all_compilers="$all_compilers $compilers"
2784 all_stagestuff="$all_stagestuff $stagestuff"
0280cf84 2785 all_outputs="$all_outputs $outputs"
e2500fed 2786 all_gtfiles="$all_gtfiles $gtfiles"
8ac9d31f
TJ
2787 for f in .. $gtfiles
2788 do
2789 if test $f != ".."
2790 then
2791 all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} "
2792 all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
2793 fi
2794 done
571a8de5
DE
2795 fi
2796done
2797
8ac9d31f
TJ
2798# Pick up gtfiles for c
2799gtfiles=
2800s="c"
2801. ${srcdir}/c-config-lang.in
2802all_gtfiles="$all_gtfiles $gtfiles"
2803for f in .. $gtfiles
2804do
2805 if test $f != ".."
2806 then
2807 all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} "
2808 all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
2809 fi
2810done
2811
cbc59f01
DD
2812check_languages=
2813for language in .. $all_languages
2814do
2815 if test $language != ".."
2816 then
2817 check_languages="$check_languages check-$language"
2818 fi
2819done
2820
571a8de5
DE
2821# Since we can't use `::' targets, we link each language in
2822# with a set of hooks, reached indirectly via lang.${target}.
2823
2824rm -f Make-hooks
2825touch Make-hooks
65ebbf81 2826target_list="all.build all.cross start.encap rest.encap tags \
d3945f0a 2827 info dvi generated-manpages \
571a8de5 2828 install-normal install-common install-info install-man \
436a88a6 2829 uninstall \
571a8de5
DE
2830 mostlyclean clean distclean extraclean maintainer-clean \
2831 stage1 stage2 stage3 stage4"
2832for t in $target_list
2833do
2834 x=
ab87f8c8 2835 for lang in .. $all_languages
571a8de5 2836 do
ab87f8c8
JL
2837 if test $lang != ".."; then
2838 x="$x $lang.$t"
571a8de5
DE
2839 fi
2840 done
2841 echo "lang.$t: $x" >> Make-hooks
2842done
2843
cc06d68c 2844# Create .gdbinit.
296e46bd 2845
cc06d68c
GP
2846echo "dir ." > .gdbinit
2847echo "dir ${srcdir}" >> .gdbinit
2848if test x$gdb_needs_out_file_path = xyes
2849then
2850 echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
2851fi
2852if test "x$subdirs" != x; then
2853 for s in $subdirs
2854 do
2855 echo "dir ${srcdir}/$s" >> .gdbinit
2856 done
296e46bd 2857fi
cc06d68c 2858echo "source ${srcdir}/gdbinit.in" >> .gdbinit
296e46bd 2859
88111b26
JL
2860# Define variables host_canonical and build_canonical
2861# because some Cygnus local changes in the Makefile depend on them.
2862build_canonical=${build}
2863host_canonical=${host}
2864target_subdir=
75bffa71 2865if test "${host}" != "${target}" ; then
924c96eb 2866 target_subdir=${target_alias}/
88111b26
JL
2867fi
2868AC_SUBST(build_canonical)
2869AC_SUBST(host_canonical)
2870AC_SUBST(target_subdir)
2871
8f8d3278
NC
2872# If $(exec_prefix) exists and is not the same as $(prefix), then compute an
2873# absolute path for gcc_tooldir based on inserting the number of up-directory
2874# movements required to get from $(exec_prefix) to $(prefix) into the basic
2875# $(libsubdir)/@(unlibsubdir) based path.
82cbf8f7
JL
2876# Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
2877# make and thus we'd get different behavior depending on where we built the
2878# sources.
5949a9fc 2879if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
d062c304
JL
2880 gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)'
2881else
8f8d3278
NC
2882changequote(<<, >>)dnl
2883# An explanation of the sed strings:
2884# -e 's|^\$(prefix)||' matches and eliminates 'prefix' from 'exec_prefix'
2885# -e 's|/$||' match a trailing forward slash and eliminates it
2886# -e 's|^[^/]|/|' forces the string to start with a forward slash (*)
ff7cc307 2887# -e 's|/[^/]*|../|g' replaces each occurrence of /<directory> with ../
8f8d3278
NC
2888#
2889# (*) Note this pattern overwrites the first character of the string
2890# with a forward slash if one is not already present. This is not a
2891# problem because the exact names of the sub-directories concerned is
2892# unimportant, just the number of them matters.
2893#
2894# The practical upshot of these patterns is like this:
2895#
2896# prefix exec_prefix result
2897# ------ ----------- ------
2898# /foo /foo/bar ../
2899# /foo/ /foo/bar ../
2900# /foo /foo/bar/ ../
2901# /foo/ /foo/bar/ ../
2902# /foo /foo/bar/ugg ../../
2903#
4c112cda
NC
2904 dollar='$$'
2905 gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)"
8f8d3278 2906changequote([, ])dnl
d062c304
JL
2907fi
2908AC_SUBST(gcc_tooldir)
4c112cda 2909AC_SUBST(dollar)
d062c304 2910
2bbea3a6
RH
2911# Find a directory in which to install a shared libgcc.
2912
2913AC_ARG_ENABLE(version-specific-runtime-libs,
e8bec136
RO
2914[ --enable-version-specific-runtime-libs
2915 specify that runtime libraries should be
2916 installed in a compiler-specific directory])
2bbea3a6 2917
5b15f277
RH
2918AC_ARG_WITH(slibdir,
2919[ --with-slibdir=DIR shared libraries in DIR [LIBDIR]],
2920slibdir="$with_slibdir",
2921if test "${enable_version_specific_runtime_libs+set}" = set; then
2bbea3a6 2922 slibdir='$(libsubdir)'
5b15f277 2923elif test "$host" != "$target"; then
2bbea3a6
RH
2924 slibdir='$(build_tooldir)/lib'
2925else
5b15f277
RH
2926 slibdir='$(libdir)'
2927fi)
2bbea3a6
RH
2928AC_SUBST(slibdir)
2929
1e6347d8 2930objdir=`${PWDCMD-pwd}`
7e717196
JL
2931AC_SUBST(objdir)
2932
94f42018
DE
2933# Process the language and host/target makefile fragments.
2934${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file"
47866ac0 2935
46f18e7b
RK
2936# Substitute configuration variables
2937AC_SUBST(subdirs)
8ac9d31f 2938AC_SUBST(srcdir)
46f18e7b
RK
2939AC_SUBST(all_boot_languages)
2940AC_SUBST(all_compilers)
e2500fed 2941AC_SUBST(all_gtfiles)
8ac9d31f
TJ
2942AC_SUBST(all_gtfiles_files_langs)
2943AC_SUBST(all_gtfiles_files_files)
9f3d1bc2
BK
2944AC_SUBST(all_lang_makefiles)
2945AC_SUBST(all_languages)
9f3d1bc2
BK
2946AC_SUBST(all_stagestuff)
2947AC_SUBST(build_exeext)
2948AC_SUBST(build_install_headers_dir)
2949AC_SUBST(build_xm_file_list)
11642c3a
ZW
2950AC_SUBST(build_xm_file)
2951AC_SUBST(build_xm_defines)
cbc59f01 2952AC_SUBST(check_languages)
9f3d1bc2 2953AC_SUBST(cc_set_by_configure)
5aa82ace 2954AC_SUBST(quoted_cc_set_by_configure)
9f3d1bc2 2955AC_SUBST(cpp_install_dir)
9f3d1bc2
BK
2956AC_SUBST(dep_host_xmake_file)
2957AC_SUBST(dep_tmake_file)
9f3d1bc2 2958AC_SUBST(extra_headers_list)
46f18e7b 2959AC_SUBST(extra_objs)
9f3d1bc2
BK
2960AC_SUBST(extra_parts)
2961AC_SUBST(extra_passes)
2962AC_SUBST(extra_programs)
9f3d1bc2 2963AC_SUBST(float_h_file)
cc1e60ea 2964AC_SUBST(gcc_config_arguments)
9f3d1bc2 2965AC_SUBST(gcc_gxx_include_dir)
e2187d3b 2966AC_SUBST(libstdcxx_incdir)
9f3d1bc2 2967AC_SUBST(gcc_version)
8763704d 2968AC_SUBST(gcc_version_full)
9f3d1bc2
BK
2969AC_SUBST(gcc_version_trigger)
2970AC_SUBST(host_exeext)
46f18e7b 2971AC_SUBST(host_extra_gcc_objs)
46f18e7b 2972AC_SUBST(host_xm_file_list)
11642c3a
ZW
2973AC_SUBST(host_xm_file)
2974AC_SUBST(host_xm_defines)
476d9098 2975AC_SUBST(out_host_hook_obj)
9f3d1bc2 2976AC_SUBST(install)
46f18e7b 2977AC_SUBST(lang_options_files)
9f3d1bc2 2978AC_SUBST(lang_specs_files)
3103b7db 2979AC_SUBST(lang_tree_files)
46f18e7b 2980AC_SUBST(local_prefix)
9f3d1bc2
BK
2981AC_SUBST(md_file)
2982AC_SUBST(objc_boehm_gc)
2983AC_SUBST(out_file)
2984AC_SUBST(out_object_file)
46f18e7b 2985AC_SUBST(stage_prefix_set_by_configure)
596151e1 2986AC_SUBST(quoted_stage_prefix_set_by_configure)
e9a25f70 2987AC_SUBST(symbolic_link)
9f3d1bc2
BK
2988AC_SUBST(thread_file)
2989AC_SUBST(tm_file_list)
11642c3a 2990AC_SUBST(tm_file)
d5355cb2 2991AC_SUBST(tm_defines)
11642c3a
ZW
2992AC_SUBST(tm_p_file_list)
2993AC_SUBST(tm_p_file)
2994AC_SUBST(xm_file)
3d9d2476 2995AC_SUBST(xm_defines)
66fe41af 2996AC_SUBST(target_alias)
aac69a49
NC
2997AC_SUBST(c_target_objs)
2998AC_SUBST(cxx_target_objs)
11642c3a 2999AC_SUBST(target_cpu_default)
46f18e7b
RK
3000
3001AC_SUBST_FILE(target_overrides)
3002AC_SUBST_FILE(host_overrides)
46f18e7b
RK
3003AC_SUBST_FILE(language_fragments)
3004AC_SUBST_FILE(language_hooks)
3005
3006# Echo that links are built
75bffa71 3007if test x$host = x$target
46f18e7b
RK
3008then
3009 str1="native "
3010else
3011 str1="cross-"
3012 str2=" from $host"
3013fi
3014
75bffa71 3015if test x$host != x$build
46f18e7b
RK
3016then
3017 str3=" on a $build system"
3018fi
3019
75bffa71 3020if test "x$str2" != x || test "x$str3" != x
46f18e7b
RK
3021then
3022 str4=
3023fi
3024
3025echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2
3026
75bffa71 3027if test "x$str2" != x || test "x$str3" != x
46f18e7b
RK
3028then
3029 echo " ${str2}${str3}." 1>&2
3030fi
3031
61536478 3032# Truncate the target if necessary
75bffa71 3033if test x$host_truncate_target != x; then
61536478
JL
3034 target=`echo $target | sed -e 's/\(..............\).*/\1/'`
3035fi
3036
46f18e7b
RK
3037# Configure the subdirectories
3038# AC_CONFIG_SUBDIRS($subdirs)
3039
3040# Create the Makefile
5891b37d 3041# and configure language subdirectories
0280cf84 3042AC_OUTPUT($all_outputs,
cdcc6a01 3043[
cdcc6a01 3044case x$CONFIG_HEADERS in
b7cb92ad 3045xauto-host.h:config.in)
818b66cc 3046echo > cstamp-h ;;
cdcc6a01 3047esac
93cf819d
BK
3048# If the host supports symlinks, point stage[1234] at ../stage[1234] so
3049# bootstrapping and the installation procedure can still use
3050# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks,
3051# FLAGS_TO_PASS has been modified to solve the problem there.
3052# This is virtually a duplicate of what happens in configure.lang; we do
3053# an extra check to make sure this only happens if ln -s can be used.
75bffa71 3054if test "$symbolic_link" = "ln -s"; then
d8140df6 3055 for d in .. ${subdirs} fixinc ; do
75bffa71 3056 if test $d != ..; then
1e6347d8 3057 STARTDIR=`${PWDCMD-pwd}`
4e8a434e
BK
3058 cd $d
3059 for t in stage1 stage2 stage3 stage4 include
3060 do
3061 rm -f $t
3062 $symbolic_link ../$t $t 2>/dev/null
3063 done
3064 cd $STARTDIR
93cf819d
BK
3065 fi
3066 done
3067else true ; fi
ab87f8c8
JL
3068# Avoid having to add intl to our include paths.
3069if test -f intl/libintl.h; then
3070 echo creating libintl.h
3071 echo '#include "intl/libintl.h"' >libintl.h
3072fi
0d24f4d1
ZW
3073],
3074[subdirs='$subdirs'
3075symbolic_link='$symbolic_link'
cdcc6a01 3076])