--- /dev/null
+# configure.lang for GNU CC
+# This script is run by configure for configuration of language
+# subdirectories which conform to the old GCC configure mechansim
+# for such subdirectories.
+
+# Copyright (C) 1997 Free Software Foundation, Inc.
+
+#This file is part of GNU CC.
+
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING. If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
+savesrcdir=$srcdir
+for subdir in . $subdirs
+do
+ oldsrcdir=$savesrcdir
+
+ # Re-adjust the path
+ case $oldsrcdir in
+ /*)
+ case $subdir in
+ .)
+ srcdir=$oldsrcdir
+ ;;
+ *)
+ srcdir=$oldsrcdir/$subdir
+ ;;
+ esac
+ ;;
+ *)
+ case $subdir in
+ .)
+ ;;
+ *)
+ oldsrcdir=../${oldsrcdir}
+ srcdir=$oldsrcdir/$subdir
+ ;;
+ esac
+ ;;
+ esac
+ mainsrcdir=$oldsrcdir
+ STARTDIR=`pwd`
+ test -d $subdir || mkdir $subdir
+ cd $subdir
+
+ # Create Makefile.tem from Makefile.in.
+ # Make it set VPATH if necessary so that the sources are found.
+ # Also change its value of srcdir.
+ # Also create a .gdbinit file which runs the one in srcdir
+ # and tells GDB to look there for source files.
+ case $srcdir in
+ . | ./$subdir | .././$subdir)
+ rm -f Makefile.tem
+ cp Makefile.in Makefile.tem
+ chmod +w Makefile.tem
+ ;;
+ *)
+ rm -f Makefile.tem
+ echo "VPATH = ${srcdir}" \
+ | cat - ${srcdir}/Makefile.in \
+ | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
+ rm -f .gdbinit
+ echo "dir ." > .gdbinit
+ echo "dir ${srcdir}" >> .gdbinit
+ if [ x$gdb_needs_out_file_path = xyes ]
+ then
+ echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
+ fi
+ if [ "x$subdirs" != x ]; then
+ for s in $subdirs
+ do
+ echo "dir ${srcdir}/$s" >> .gdbinit
+ done
+ fi
+ echo "source ${srcdir}/.gdbinit" >> .gdbinit
+ ;;
+ esac
+
+ # Conditionalize the makefile for this host machine.
+ rm -f Makefile.xx Makefile.ll
+ merged_frags=
+ for f in .. ${host_xmake_file}
+ do
+ if [ -f ${mainsrcdir}/config/$f ]
+ then
+ cat ${mainsrcdir}/config/$f >> Makefile.ll
+ if [ x"${merged_frags}" != x ]
+ then
+ merged_frags="${merged_frags} and "
+ fi
+ merged_frags="${merged_frags}${f}"
+ fi
+ done
+ if [ x"${merged_frags}" != x ]
+ then
+ sed -e "/####host/ r Makefile.ll" Makefile.tem > Makefile.xx
+ echo "Merged ${merged_frags}."
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ rm -f Makefile.ll
+ fi
+
+ # Add a definition for MAKE if system wants one.
+ case "$SET_MAKE" in
+ ?*)
+ rm -f Makefile.xx
+ (echo "$SET_MAKE"; cat Makefile.tem) >Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ esac
+
+ # Add a definition for INSTALL if system wants one.
+ # This substitutes for lots of x-* files.
+ if [ x$build_broken_install = x ]
+ then true
+ else
+ rm -f Makefile.xx
+ abssrcdir=`cd ${srcdir}; pwd`
+ sed "s|^INSTALL = .*|INSTALL = ${abssrcdir}/install.sh -c|" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Some of the following don't make sense in the language makefiles,
+ # but rather than introduce another level of nesting, we leave them
+ # as is.
+
+ # Set EXTRA_HEADERS according to extra_headers.
+ # This substitutes for lots of t-* files.
+ extra_headers_list=
+ if [ "x$extra_headers" = x ]
+ then true
+ else
+ rm -f Makefile.xx
+ sed "s|^EXTRA_HEADERS =|EXTRA_HEADERS = ${extra_headers_list}|" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Set EXTRA_PASSES according to extra_passes.
+ # This substitutes for lots of t-* files.
+ if [ "x$extra_passes" = x ]
+ then true
+ else
+ rm -f Makefile.xx
+ sed "s/^EXTRA_PASSES =/EXTRA_PASSES = $extra_passes/" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Set EXTRA_PARTS according to extra_parts.
+ # This substitutes for lots of t-* files.
+ if [ "x$extra_parts" = x ]
+ then true
+ else
+ rm -f Makefile.xx
+ sed "s/^EXTRA_PARTS =/EXTRA_PARTS = $extra_parts/" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Set EXTRA_PROGRAMS according to extra_programs.
+ if [ "x$extra_programs" = x ]
+ then true
+ else
+ rm -f Makefile.xx
+ sed "s/^EXTRA_PROGRAMS =/EXTRA_PROGRAMS = $extra_programs/" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Set EXTRA_OBJS according to extra_objs.
+ # This substitutes for lots of t-* files.
+ if [ "x$extra_objs" = x ]
+ then true
+ else
+ rm -f Makefile.xx
+ sed "s|^EXTRA_OBJS =|EXTRA_OBJS = $extra_objs|" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Set EXTRA_GCC_OBJS according to host_extra_gcc_objs.
+ # This substitutes for lots of x-* files.
+ if [ "x$host_extra_gcc_objs" = x ]
+ then true
+ else
+ rm -f Makefile.xx
+ sed "s|^EXTRA_GCC_OBJS =|EXTRA_GCC_OBJS = $host_extra_gcc_objs|"
+Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Add a definition of USE_COLLECT2 if system wants one.
+ # Also tell toplev.c what to do.
+ # This substitutes for lots of t-* files.
+ if [ x$use_collect2 != x ]
+ then
+ rm -f Makefile.xx
+ (echo "USE_COLLECT2 = ld"; echo "MAYBE_USE_COLLECT2 = -DUSE_COLLECT2")\
+ | cat - Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Set MD_DEPS if the real md file is in md.pre-cpp.
+ # Set MD_CPP to the cpp to pass the md file through. Md files use ';'
+ # for line oriented comments, so we must always use a GNU cpp. If
+ # building gcc with a cross compiler, use the cross compiler just
+ # built. Otherwise, we can use the cpp just built.
+ if [ "x$md_cppflags" != x ]
+ then
+ rm -f Makefile.xx
+ (if [ x$host = x$build ] ; then
+ echo "MD_DEPS = $(md_file) cpp" ; echo "MD_CPP = ./cpp"
+ else
+ echo "MD_DEPS = md.pre-cpp" ; echo "MD_CPP = \$(HOST_CC) -x c -E"
+ fi
+ echo "MD_CPPFLAGS = $md_cppflags") | \
+ cat - Makefile.tem | sed -e "s|^MD_FILE[ ]*=.*|MD_FILE = md|" > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # If using -program-transform-name, override the installation names.
+ if [ "x${program_transform_set}" = "xyes" ] ; then
+ sed -e "s/^program_transform_name[ ]*=.*$/program_transform_name =
+$program_transform_name/" \
+ -e "s/^program_transform_cross_name[
+]*=.*$/program_transform_cross_name = $program_transform_name/" \
+ Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # Conditionalize the makefile for this target machine.
+ rm -f Makefile.xx Makefile.ll
+ merged_frags=
+ for f in .. ${tmake_file}
+ do
+ if [ -f ${mainsrcdir}/config/$f ]
+ then
+ cat ${mainsrcdir}/config/$f >> Makefile.ll
+ if [ x"${merged_frags}" != x ]
+ then
+ merged_frags="${merged_frags} and "
+ fi
+ merged_frags="${merged_frags}$f"
+ fi
+ done
+ if [ x"${merged_frags}" != x ]
+ then
+ sed -e "/####target/ r Makefile.ll" Makefile.tem > Makefile.xx
+ echo "Merged ${merged_frags}."
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ rm -f Makefile.ll
+ fi
+
+ # If this is the top level Makefile, add the language fragments.
+ # Languages are added via two mechanisms. Some information must be
+ # recorded in makefile variables, these are defined in config-lang.in.
+ # We accumulate them and plug them into the main Makefile.
+ # The other mechanism is a set of hooks for each of the main targets
+ # like `clean', `install', etc.
+ if [ $subdir = . ]
+ then
+ rm -f Makefile.xx Makefile.ll
+ touch Makefile.ll
+ sed -e "/####language fragments/ r Makefile.ll" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ subdirs=`echo $subdirs`
+ sed -e "s|^SUBDIRS[ ]*=.*$|SUBDIRS = $subdirs|" \
+ -e "s|^LANGUAGES[ ]*=[ ]*\(.*\)$|LANGUAGES = \1 $all_languages|" \
+ -e "s|^BOOT_LANGUAGES[ ]*=[ ]*\(.*\)$|BOOT_LANGUAGES = \1 $all_boot_languages|" \
+ -e "s|^COMPILERS[ ]*=[ ]*\(.*\)$|COMPILERS = \1 $all_compilers|" \
+ -e "s|^LANG_MAKEFILES[ ]*=.*$|LANG_MAKEFILES = $all_lang_makefiles|" \
+ -e "s|^LANG_STAGESTUFF[ ]*=.*$|LANG_STAGESTUFF = $all_stagestuff|" \
+ -e "s|^LANG_DIFF_EXCLUDES[ ]*=.*$|LANG_DIFF_EXCLUDES = $all_diff_excludes|" \
+ -e "s|^LANG_EXTRA_HEADERS[ ]*=.*$|LANG_EXTRA_HEADERS = $all_headers|" \
+ -e "s|^LANG_LIB2FUNCS[ ]*=.*$|LANG_LIB2FUNCS = $all_lib2funcs|" \
+ Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+
+ # Since we can't use `::' targets, we link each language in
+ # with a set of hooks, reached indirectly via lang.${target}.
+ rm -f Makefile.ll
+ for t in $target_list
+ do
+ x=
+ for l in .. $all_languages
+ do
+ if [ $l != ".." ]; then
+ x="$x $l.$t"
+ fi
+ done
+ echo "lang.$t: $x" >> Makefile.ll
+ done
+ sed -e "/####language hooks/ r Makefile.ll" Makefile.tem > Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ rm -f Makefile.ll
+
+ # If the host doesn't support symlinks, modify CC in
+ # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
+ # Otherwise, we can use "CC=$(CC)".
+ rm -f symtest.tem
+ if $symbolic_link symtest1.tem symtest.tem 2>/dev/null
+ then
+ sed -e 's,CC=set-by-configure,CC=$(CC),' \
+ Makefile.tem > Makefile.xx
+ sed -e 's,STAGE_PREFIX=set-by-configure,STAGE_PREFIX=$(STAGE_PREFIX),' \
+ Makefile.xx > Makefile.yy
+ else
+ sed -e "s,CC=set-by-configure,CC=\`case '\$(CC)' in *stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`," \
+ Makefile.tem > Makefile.xx
+ sed -e "s,STAGE_PREFIX=set-by-configure,STAGE_PREFIX=\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`," \
+ Makefile.xx > Makefile.yy
+ fi
+ rm -f Makefile.tem Makefile.xx
+ mv Makefile.yy Makefile.tem
+ rm -f symtest.tem
+
+ if [ "x$all_languages" != x ]
+ then
+ # Missing space after `Merged' is intentional.
+ echo "Merged$all_languages fragment(s)."
+ fi
+
+ # Otherwise, this is a language subdirectory. If the host supports
+ # symlinks, point stage[123] at ../stage[123] so bootstrapping and the
+ # installation procedure can still use CC="stage1/xgcc -Bstage1/".
+ # If the host doesn't support symlinks, FLAGS_TO_PASS has been
+ # modified to solve the problem there.
+ else
+ for t in stage1 stage2 stage3 stage4 include
+ do
+ rm -f $t
+ $symbolic_link ../$t $t 2>/dev/null
+ done
+ fi
+
+ # Remove all formfeeds, since some Makes get confused by them.
+ # Also arrange to give the variables `target', `host_xmake_file',
+ # `tmake_file', `prefix', `local_prefix', `exec_prefix', `FIXINCLUDES'
+ # `out_file', `out_object', `md_file', `lang_specs_files',
+ # `lang_options_files', `INSTALL_HEADERS_DIR', and `CROSS_FLOAT_H'
+ # values in the Makefile from the values they have in this script.
+ rm -f Makefile.xx
+ rm -f aux-output.c aux-output.o md
+ # Create an empty Makefile.sed first, to work around a Nextstep 3.3 bug.
+ echo 's|\f||' > Makefile.sed
+ rm Makefile.sed
+ echo 's|\f||' > Makefile.sed
+ echo "s|^target=.*$|target=${target}|" >> Makefile.sed
+ echo "s|^target_alias=.*$|target_alias=${target}|" >> Makefile.sed
+ echo "s|^xmake_file=.*$|xmake_file=${dep_host_xmake_file}|" >> Makefile.sed
+ echo "s|^tmake_file=.*$|tmake_file=${dep_tmake_file}|" >> Makefile.sed
+ echo "s|^version=.*$|version=${version}|" >> Makefile.sed
+ echo "s|^version=.*$|version=${version}|" >> Makefile.sed
+ echo "s|^out_file=.*$|out_file=${srcdir}/config/${out_file}|" >> Makefile.sed
+ echo "s|^out_object_file=.*$|out_object_file=${out_object_file}|" >> Makefile.sed
+ echo "s|^md_file=.*$|md_file=${md_file}|" >> Makefile.sed
+ echo "s|^tm_file=.*$|tm_file=${tm_file_sub}|" >> Makefile.sed
+ echo "s|^host_xm_file=.*$|host_xm_file=${host_xm_file_sub}|" >> Makefile.sed
+ echo "s|^build_xm_file=.*$|build_xm_file=${build_xm_file_sub}|" >> Makefile.sed
+ echo "s|^lang_specs_files=.*$|lang_specs_files=${lang_specs_files}|" >> Makefile.sed
+ echo "s|^lang_options_files=.*$|lang_options_files=${lang_options_files}|" >> Makefile.sed
+ echo "s|^OBJC_THREAD_FILE=.*$|OBJC_THREAD_FILE=thr-${objc_thread_file}|" >> Makefile.sed
+ echo "s|^prefix[ ]*=.*|prefix = $prefix|" >> Makefile.sed
+ echo "s|^local_prefix[ ]*=.*|local_prefix = $local_prefix|" >> Makefile.sed
+ echo "s|^exec_prefix[ ]*=.*|exec_prefix = $exec_prefix|" >> Makefile.sed
+ echo "s|^FIXINCLUDES[ ]*=.*|FIXINCLUDES = $fixincludes|" >> Makefile.sed
+ echo "s|^INSTALL_HEADERS_DIR[ ]*=.*$|INSTALL_HEADERS_DIR = ${build_install_headers_dir}|" >> Makefile.sed
+ echo "s|^exeext[ ]*=.*$|exeext = ${build_exeext}|" >> Makefile.sed
+ echo "s|^CROSS_FLOAT_H[ ]*=.*|CROSS_FLOAT_H=\$(srcdir)/config/float-${float_format}.h|" >> Makefile.sed
+ sed -f Makefile.sed Makefile.tem > Makefile.xx
+ rm -f Makefile.tem Makefile.sed
+ mv Makefile.xx Makefile.tem
+
+ # Install Makefile for real, after making final changes.
+ # Define macro CROSS_COMPILE in compilation
+ # if this is a cross-compiler.
+ # Also use all.cross instead of all.internal
+ # and add cross-make to Makefile.
+ if [ x$host != x$target ]
+ then
+ rm -f Makefile.xx
+ echo "CROSS=-DCROSS_COMPILE" > Makefile.xx
+ sed -e "/####cross/ r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ # When building gcc with a cross-compiler, we need to fix a few things.
+ # This must come after cross-make as we want all.build to override
+ # all.cross.
+ if [ x$build != x$host ]
+ then
+ rm -f Makefile.xx
+ echo "build= $build" > Makefile.xx
+ echo "host= $host" >> Makefile.xx
+ sed -e "s|objc-runtime$||" \
+ -e "/####build/ r ${mainsrcdir}/build-make" Makefile.tem >> Makefile.xx
+ rm -f Makefile.tem
+ mv Makefile.xx Makefile.tem
+ fi
+
+ if [ $subdir != . ]
+ then
+ rm -f Makefile
+ mv Makefile.tem Makefile
+ echo "Created \`$subdir/Makefile'."
+ else
+ rm -f Makefile.tem
+ fi
+
+ cd $STARTDIR
+done # end of current-dir SUBDIRS loop
+
+srcdir=$savesrcdir