8sa1-gcc/gcc/configure.lang

350 lines
11 KiB
Plaintext
Raw Normal View History

1997-06-09 16:48:17 -04:00
# 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.
# 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
# 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| ||' > Makefile.sed
rm Makefile.sed
echo 's| ||' > 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|^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|^GCC_THREAD_FILE=.*$|GCC_THREAD_FILE=${thread_file}|" >> Makefile.sed
1997-06-09 16:48:17 -04:00
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