1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-29 12:03:03 +00:00
freebsd/contrib/gcc/configure.lang
1999-08-26 09:30:50 +00:00

234 lines
7.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# configure.lang for GNU CC
# This script is run by configure for configuration of language
# subdirectories which conform to the old GCC configure mechanism
# for such subdirectories.
# Copyright (C) 1997, 1998 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 . $oldstyle_subdirs
do
# We only want to do this in language subdirs, but we have to handle
# the case of $oldstyle_subdirs = "".
if [ $subdir = . ]
then
continue
fi
oldsrcdir=$savesrcdir
# Re-adjust the path
case $oldsrcdir in
/*)
srcdir=$oldsrcdir/$subdir
;;
*)
oldsrcdir=../${oldsrcdir}
srcdir=$oldsrcdir/$subdir
;;
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
echo "dir ${mainsrcdir}" >> .gdbinit
if [ x$gdb_needs_out_file_path = xyes ]
then
echo "dir ${mainsrcdir}/config/"`dirname ${out_file}` >> .gdbinit
fi
echo "source ${mainsrcdir}/.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}|" 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 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.
for t in stage1 stage2 stage3 stage4 include
do
rm -f $t
$symbolic_link ../$t $t 2>/dev/null
done
# Remove all formfeeds, since some Makes get confused by them.
# Also arrange to give the variables `target', `target_alias',
# `host_xmake_file', `tmake_file', `prefix', `local_prefix',
# `exec_prefix', `INSTALL_HEADERS_DIR', `exeext'
# values in the Makefile from the values they have in this script.
rm -f Makefile.xx
# 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_alias}|" >> 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|^GCC_THREAD_FILE=.*$|GCC_THREAD_FILE=${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|^INSTALL_HEADERS_DIR[ ]*=.*$|INSTALL_HEADERS_DIR = ${build_install_headers_dir}|" >> Makefile.sed
echo "s|^exeext[ ]*=.*$|exeext = ${build_exeext}|" >> 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
rm -f Makefile
mv Makefile.tem Makefile
echo "Created \`$subdir/Makefile'."
cd $STARTDIR
done # end of current-dir SUBDIRS loop
# Restore this, remember we're invoked with `.'.
srcdir=$savesrcdir