# Configuration script for GNU CC
# Copyright (C) 1988, 1990, 1991, 1992 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)
#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, 675 Mass Ave, Cambridge, MA 02139, USA.
# Shell script to create proper links to machine-dependent files in
# preparation for compiling gcc.
# Options: --srcdir=DIR specifies directory where sources are.
# --host=HOST specifies host configuration.
# --target=TARGET specifies target configuration.
# --build=TARGET specifies configuration of machine you are
# --prefix=DIR specifies directory to install in.
# --exec-prefix=DIR specifies directory to install executables in.
# --with-gnu-ld arrange to work with GNU ld.
# --with-gnu-as arrange to work with GAS.
# --with-stabs arrange to use stabs instead of host debug format.
# --nfp assume system has no FPU.
# If configure succeeds, it leaves its status in config.status.
# If configure fails after disturbing the status quo,
# config.status is removed.
# Default --srcdir to the directory where the script is found,
# if a directory was specified.
# The second sed call is to convert `.//configure' to `./configure'.
srcdir
=`echo $0 | sed 's|//|/|' | sed 's|/[^/]*$||'`
# Default prefix to /usr/local.
# Default is to let the Makefile set exec_prefix from $(prefix)
exec_prefix
='$(prefix)/gcc2'
# Record all the arguments, to write them in config.status.
#symbolic_link="echo ln -s"
-srcdir |
--srcdir |
--srcdi |
--srcd |
--src |
--sr |
--s)
-srcdir=* |
--srcdir=* |
--srcdi=* |
--srcd=* |
--src=* |
--sr=* |
--s=*)
srcdir
=`echo $arg | sed 's/-*s[a-z]*=//'`
-host |
--host |
--hos |
--ho |
--h)
-host=* |
--host=* |
--hos=* |
--ho=* |
--h=*)
host=`echo $arg | sed 's/-*h[a-z]*=//'`
-target |
--target |
--targe |
--targ |
--tar |
--ta |
--t)
-target=* |
--target=* |
--targe=* |
--targ=* |
--tar=* |
--ta=* |
--t=*)
target
=`echo $arg | sed 's/-*t[a-z]*=//'`
-build |
--build |
--buil |
--bui |
--bu |
--b)
-build=* |
--build=* |
--buil=* |
--bui=* |
--bu=* |
--b=*)
build
=`echo $arg | sed 's/-*b[a-z]*=//'`
-prefix |
--prefix |
--prefi |
--pref |
--pre |
--pr |
--p)
-prefix=* |
--prefix=* |
--prefi=* |
--pref=* |
--pre=* |
--pr=* |
--p=*)
prefix
=`echo $arg | sed 's/-*p[a-z]*=//'`
-exec-prefix |
--exec-prefix |
--exec-prefi |
--exec-pref |
--exec-pre \
|
--exec-pr |
--exec-p |
--exec- |
--exec |
--exe |
--ex |
--e)
-exec-prefix=* |
--exec-prefix=* |
--exec-prefi=* |
--exec-pref=* \
|
--exec-pre=* |
--exec-pr=* |
--exec-p=* |
--exec-=* |
--exec=* \
|
--exe=* |
--ex=* |
--e=*)
exec_prefix
=`echo $arg | sed 's/-*e[-a-z]*=//'`
-with-gnu-ld |
--with-gnu-ld |
--with-gnu-l)
-gas |
--gas |
--ga |
--g |
-with-gnu-as |
--with-gnu-as |
-with-gnu-a)
-nfp |
--nfp |
--nf |
--n)
-with-stabs |
-with-stab |
-with-sta |
-with-st |
-with-s \
|
--with-stabs |
--with-stab |
--with-sta |
--with-st |
--with-s \
|
-stabs |
-stab |
-sta |
-st \
|
--stabs |
--stab |
--sta |
--st)
-with-* |
--with-*) ;; #ignored
echo "Invalid option \`$arg'" 1>&2
# Allow configure HOST TARGET
# Find the source files, if location was not specified.
if [ ! -r ${srcdir}/tree.c
]
if [ x
$srcdirdefaulted = x
]
echo "$progname: Can't find compiler sources in \`${srcdir}'" 1>&2
echo "$progname: Can't find compiler sources in \`.' or \`..'" 1>&2
if [ -r ${srcdir}/config.status
] && [ x
$srcdir != x.
]
echo "$progname: \`configure' has been run in \`${srcdir}'" 1>&2
# Complain if an arg is missing
echo "No target specified." 1>&2
Usage: `basename $progname` [--host=HOST] [--build=BUILD]
[--prefix=DIR] [--exec-pref=DIR]
[--with-gnu-as] [--with-gnu-ld] [--with-stabs] [--nfp] TARGET" 1>&2
echo "Where HOST, TARGET and BUILD are three-part configuration names " 1>&2
tail +2 config.status
1>&2
# If $build was not specified, use $host.
# Validate the specs, and canonicalize them.
canon_build
=`$srcdir/config.sub $build` ||
exit 1
canon_host
=`$srcdir/config.sub $host` ||
exit 1
canon_target
=`$srcdir/config.sub $target` ||
exit 1
# Decode the host machine, then the target machine.
# For the host machine, we save the xm_file variable as host_xm_file;
# then we decode the target machine and forget everything else
# that came from the host machine.
for machine
in $canon_build $canon_host $canon_target; do
# Set this to force installation and use of collect2.
# Set this to override the default target model.
# Set this to force use of install.sh.
# Set this to control which fixincludes program to use.
# Support site-specific machine types.
if [ -f $srcdir/config
/x-
$machine ] ; \
then xmake_file
=x-
$machine; \
if [ -f $srcdir/config
/t-
$machine ] ; \
then tmake_file
=t-
$machine; \
vax-
*-bsd*) # vaxen running BSD
vax-
*-ultrix*) # vaxen running ultrix
vax-
*-vms*) # vaxen running VMS
vax-
*-sysv*) # vaxen running system V
# This hasn't been upgraded to GCC 2.
# tahoe-harris-*) # Harris tahoe, using COFF.
# tahoe-*-bsd*) # tahoe running BSD
i
[34]86-*-osfrose*) # 386 using OSF/rose
i
[34]86-sequent-bsd*) # 80386 from Sequent
i
[34]86-*-sco3.2v4
*) # 80386 running SCO 3.2v4 system
i
[34]86-*-sco*) # 80386 running SCO system
i
[34]86-*-isc*) # 80386 running ISC system
i
[34]86-ibm-aix*) # IBM PS/2 running AIX
i386-sun-sunos
*) # Sun i386 roadrunner
i
[34]86-*-linux*) # Intel 80386's running Linux
i486-ncr-sysv4
*) # NCR 3000 - i486 running system V.4
i
[34]86-*-sysv4*) # Intel 80386's running system V.4
i
[34]86-*-sysv*) # Intel 80386's running system V
i860-alliant-
*) # Alliant FX/2800
sparc-
*-solaris2* | sparc-
*-sunos5*)
m68k-cbm-sysv4
*) # Commodore variant of V.4.
header_files
=math-68881.h
m68k-
*-sysv4*) # Motorola m68k's running system V.4
header_files
=math-68881.h
m68k-bull-sysv
*) # Bull DPX/2
echo dpx2 supported only with GAS
1>&2
header_files
=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
m68k-sun-sunos
*) # For SunOS 4 (the default).
header_files
=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
m68k-hp-hpux
*) # HP 9000 series 300
header_files
=math-68881.h
m68k-hp-bsd
*) # HP 9000/3xx running Berkeley Unix
header_files
=math-68881.h
m68k-omron-bsd
*) # OMRON LUNA-I/LUNA-II running Berkeley Unix
# header_files=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
m68k-sony-bsd
* | m68k-sony-newsos
*)
header_files
=math-68881.h
m68k-altos-sysv
*) # Altos 3068
echo "The Altos is supported only with the GNU assembler" 1>&2
header_files
=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
m68k-ncr-sysv
*) # NCR Tower 32 SVR3
header_files
=math-68881.h
m68k-
*-sysv3*) # Motorola m68k's running system V.3
header_files
=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
m68000-hp-hpux
*) # HP 9000 series 300
header_files
=math-68881.h
m68000-hp-bsd
*) # HP 9000/200 running BSD
header_files
=math-68881.h
header_files
=math-68881.h
header_files
=math-68881.h
ns32k-encore-osf
*) # Encore with OSF/rose
# This has not been updated to GCC 2.
# This hasn't been upgraded to GCC 2.
# fx80-alliant-*) # Alliant FX/80
arm-
*-*) # Acorn RISC machine
tm_file
=convex32.h
# Convex C32xx
tm_file
=convex34.h
# Convex C34xx
tm_file
=convex38.h
# Convex C38xx
mips-sgi-irix4
*) # Mostly like a MIPS.
if [ x
$stabs = xyes
]; then
mips-sgi-
*) # Mostly like a MIPS.
if [ x
$stabs = xyes
]; then
mips-dec-ultrix
*) # Decstation.
if [ x
$stabs = xyes
]; then
mips-dec-osfrose
*) # Decstation running OSF/1 reference port with OSF/rose.
mips-dec-osf
*) # Decstation running OSF/1 as shipped by DIGITAL
if [ x
$stabs = xyes
]; then
mips-sony-bsd
* | mips-sony-newsos
*) # Sony NEWS 3600 or risc/news.
if [ x
$stabs = xyes
]; then
mips-sony-sysv
*) # Sony NEWS 3800 with NEWSOS5.0.
# t-svr4 is not right because this system doesn't use ELF.
if [ x
$stabs = xyes
]; then
mips-
*riscos
[56789]bsd
* | mips-
*riscos
[56789]-bsd*)
if [ x
$stabs = xyes
]; then # MIPS BSD 4.3, RISC-OS 5.0
mips-
*-bsd* | mips-
*riscosbsd
* | mips-
*riscos
[1234]bsd
* \
| mips-
*riscos-bsd
* | mips-
*riscos
[1234]-bsd*)
if [ x
$stabs = xyes
]; then # MIPS BSD 4.3, RISC-OS 4.0
mips-
*riscos
[56789]sysv4
* | mips-
*riscos
[56789]-sysv4*)
if [ x
$stabs = xyes
]; then # MIPS System V.4., RISC-OS 5.0
mips-
*-sysv4* | mips-
*riscos
[1234]sysv4
* | mips-
*riscossysv4
* \
| mips-
*riscos
[1234]-sysv4* | mips-
*riscos-sysv4
*)
if [ x
$stabs = xyes
]; then # MIPS System V.4. RISC-OS 4.0
mips-
*riscos
[56789]sysv
* | mips-
*-riscos[56788]-sysv*)
if [ x
$stabs = xyes
]; then # MIPS System V.3, RISC-OS 5.0
mips-
*-sysv* | mips-
*riscossysv
* | mips-
*riscos-sysv
*)
if [ x
$stabs = xyes
]; then # MIPS System V.3, RISC-OS 4.0
mips-
*riscos
[56789]*) # Default MIPS RISC-OS 5.0.
if [ x
$stabs = xyes
]; then
mips-
*-*) # Default MIPS RISC-OS 4.0.
if [ x
$stabs = xyes
]; then
# This hasn't been upgraded to GCC 2.
a29k-
*-*) # Default a29k environment.
i960-
*-*) # Default i960 environment.
echo "Configuration $machine not supported" 1>&2
# Distinguish i386 from i486.
# No need for collect2 if we have the GNU linker.
# Default certain vars that apply to both host and target in turn.
then cpu_type
=`echo $machine | sed 's/-.*$//'`
# Save data on machine being used to compile GCC in build_xm_file.
# Save data on host machine in vars host_xm_file and host_xmake_file.
if [ x
$xm_file = x
]; then build_xm_file
=xm-
$cpu_type.h
else build_xm_file
=$xm_file
if [ x
$xm_file = x
]; then host_xm_file
=xm-
$cpu_type.h
else host_xm_file
=$xm_file
then xmake_file
=x-
$cpu_type
host_xmake_file
=$xmake_file
host_broken_install
=$broken_install
# Default the target-machine variables that were not explicitly set.
then tm_file
=$cpu_type.h
; fi
if [ x
$header_files = x
]
then xm_file
=xm-
$cpu_type.h
; fi
then out_file
=$cpu_type.c
; fi
then tmake_file
=t-
$cpu_type
# Set up the list of links to be made.
# $links is the list of link names, and $files is the list of names to link to.
files
="$host_xm_file $tm_file $md_file $out_file $xm_file $build_xm_file"
links
="config.h tm.h md aux-output.c tconfig.h hconfig.h"
# set file to car of files, files to cdr of files
set $files; file=$1; shift; files
=$
*
set $links; link
=$1; shift; links
=$
*
if [ ! -r ${srcdir}/config
/$file ]
echo "$progname: cannot create a link \`$link'," 1>&2
echo "since the file \`config/$file' does not exist" 1>&2
# Make a symlink if possible, otherwise try a hard link
$symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link || $copy ${srcdir}/config
/$file $link
echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'" 1>&2
echo "Linked \`$link' to \`${srcdir}/config/$file'"
# 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.
cp Makefile.
in Makefile.tem
echo "VPATH = ${srcdir}" \
|
cat - ${srcdir}/Makefile.
in \
|
sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
echo "dir ${srcdir}" >> .gdbinit
echo "source ${srcdir}/.gdbinit" >> .gdbinit
# Conditionalize the makefile for this host machine.
if [ -f ${srcdir}/config
/${host_xmake_file} ]
sed -e "/####host/ r ${srcdir}/config/${host_xmake_file}" Makefile.tem
> Makefile.xx
echo "Merged ${host_xmake_file}."
mv Makefile.xx Makefile.tem
# Say in the makefile that there is no host_xmake_file,
# by using a name which (when interpreted relative to $srcdir/config)
# will duplicate another dependency: $srcdir/Makefile.in.
host_xmake_file
=..
/Makefile.
in
# Add a definition for INSTALL if system wants one.
# This substitutes for lots of x-* files.
if [ x
$host_broken_install = x
]
abssrcdir
=`cd ${srcdir}; pwd`
sed "s|^INSTALL = .*|INSTALL = ${abssrcdir}/install.sh -c|" Makefile.tem
> Makefile.xx
mv Makefile.xx Makefile.tem
# Set EXTRA_HEADERS according to header_files.
# This substitutes for lots of t-* files.
if [ x
$header_files = x
]
sed "s/^EXTRA_HEADERS =/EXTRA_HEADERS = $header_files/" Makefile.tem
> Makefile.xx
mv Makefile.xx Makefile.tem
# 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
]
(echo "USE_COLLECT2 = ld"; echo "MAYBE_USE_COLLECT2 = -DUSE_COLLECT2")\
|
cat - Makefile.tem
> Makefile.xx
mv Makefile.xx Makefile.tem
# Add -DTARGET_CPU_DEFAULT for toplev.c if system wants one.
# This substitutes for lots of *.h files.
if [ x
$target_cpu_default = x
]
(echo "MAYBE_TARGET_DEFAULT = -DTARGET_CPU_DEFAULT=$target_cpu_default")\
|
cat - Makefile.tem
> Makefile.xx
mv Makefile.xx Makefile.tem
# Conditionalize the makefile for this target machine.
if [ -f ${srcdir}/config
/${tmake_file} ]
sed -e "/####target/ r ${srcdir}/config/${tmake_file}" Makefile.tem
> Makefile.xx
echo "Merged ${tmake_file}."
mv Makefile.xx Makefile.tem
# Say in the makefile that there is no tmake_file,
# by using a name which (when interpreted relative to $srcdir/config)
# will duplicate another dependency: $srcdir/Makefile.in.
tmake_file
=..
/Makefile.
in
# Remove all formfeeds, since some Makes get confused by them.
# Also arrange to give the variables `target', `host_xmake_file',
# `tmake_file', `prefix', `exec_prefix' and `FIXINCLUDES'
# values in the Makefile from the values they have in this script.
sed -e "s/\f//" -e "s/^target=.*$/target=${target}/" \
-e "s|^xmake_file=.*$|xmake_file=${host_xmake_file}|" \
-e "s|^tmake_file=.*$|tmake_file=${tmake_file}|" \
-e "s|^prefix[ ]*=.*|prefix = $prefix|" \
-e "s|^exec_prefix[ ]*=.*|exec_prefix = $exec_prefix|" \
-e "s|^FIXINCLUDES[ ]*=.*|FIXINCLUDES = $fixincludes|" \
Makefile.tem
> Makefile.xx
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.
# When build gcc with cross-compiler, we need to fix a
echo "build= $build" > Makefile
sed -e "/####build/ r ${srcdir}/build-make" Makefile.tem
>> Makefile
rm -f Makefile.tem Makefile.xx
echo "CROSS=-DCROSS_COMPILE" > Makefile
sed -e "/####cross/ r ${srcdir}/cross-make" Makefile.tem
>> Makefile
rm -f Makefile.tem Makefile.xx
echo "Created \`Makefile'."
# Describe the chosen configuration in config.status.
# Make that file a shellscript which will reestablish the same configuration.
# GCC was configured as follows:
${srcdir}/configure" $arguments > config.status
echo echo host=$canon_host target
=$canon_target build
=$canon_build >> config.status
if [ x
$canon_host = x
$canon_target ]
echo "Links are now set up for target $canon_target."
echo "Links are now set up for host $canon_host and target $canon_target."