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