mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
Use john's heuristic for finding ourselves. kinda like hare krishna.
This commit is contained in:
161
configure
vendored
161
configure
vendored
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
# Please email any bugs, comments, and/or additions to this file to:
|
||||||
|
# configure@cygnus.com
|
||||||
|
|
||||||
#
|
#
|
||||||
# Shell script to create proper links to machine-dependent files in
|
# Shell script to create proper links to machine-dependent files in
|
||||||
# preparation for compilation.
|
# preparation for compilation.
|
||||||
@ -30,7 +33,7 @@
|
|||||||
# config.status is removed.
|
# config.status is removed.
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e
|
# set -e
|
||||||
|
|
||||||
remove=rm
|
remove=rm
|
||||||
hard_link=ln
|
hard_link=ln
|
||||||
@ -41,8 +44,6 @@ symbolic_link='ln -s'
|
|||||||
#hard_link="echo ln"
|
#hard_link="echo ln"
|
||||||
#symbolic_link="echo ln -s"
|
#symbolic_link="echo ln -s"
|
||||||
|
|
||||||
progname=$0
|
|
||||||
|
|
||||||
# clear some things potentially inherited from environment.
|
# clear some things potentially inherited from environment.
|
||||||
|
|
||||||
Makefile=Makefile
|
Makefile=Makefile
|
||||||
@ -56,6 +57,9 @@ destdir=
|
|||||||
fatal=
|
fatal=
|
||||||
hostsubdir=
|
hostsubdir=
|
||||||
norecursion=
|
norecursion=
|
||||||
|
objdir=
|
||||||
|
objdiroption=
|
||||||
|
progname=
|
||||||
recurring=
|
recurring=
|
||||||
removing=
|
removing=
|
||||||
srcdir=
|
srcdir=
|
||||||
@ -65,15 +69,6 @@ targets=
|
|||||||
targetsubdir=
|
targetsubdir=
|
||||||
verbose=
|
verbose=
|
||||||
|
|
||||||
#if [ "$0" != "./configure" ] ; then
|
|
||||||
# exec ./configure $*
|
|
||||||
#fi
|
|
||||||
|
|
||||||
#if [ ! -f ./config.sub ] ; then
|
|
||||||
# echo '***' Can not find config.sub.
|
|
||||||
# exit 1
|
|
||||||
#fi
|
|
||||||
|
|
||||||
for arg in $*;
|
for arg in $*;
|
||||||
do
|
do
|
||||||
case ${arg} in
|
case ${arg} in
|
||||||
@ -101,6 +96,10 @@ do
|
|||||||
-norecursion | +no*)
|
-norecursion | +no*)
|
||||||
norecursion=true
|
norecursion=true
|
||||||
;;
|
;;
|
||||||
|
-objdir=* | +objdir=* | +objdi=* | +objd=* | +obj=* | +ob=* | +o=*)
|
||||||
|
objdiroption=${arg}
|
||||||
|
objdir=`echo ${arg} | sed 's/[+-]o[a-z]*=//'`
|
||||||
|
;;
|
||||||
-recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re)
|
-recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re)
|
||||||
recurring=true
|
recurring=true
|
||||||
;;
|
;;
|
||||||
@ -124,6 +123,10 @@ do
|
|||||||
newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
|
newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
|
||||||
targets="${newtargets}"
|
targets="${newtargets}"
|
||||||
;;
|
;;
|
||||||
|
-tmpdir=* | +tmpdir=* | +tmpdi=* | +tmpd=* | +tmp=* | +tm=*)
|
||||||
|
tmpdiroption=${arg}
|
||||||
|
TMPDIR=`echo ${arg} | sed 's/[+-]t[a-z]*=//'`
|
||||||
|
;;
|
||||||
-v | -verbose | +v*)
|
-v | -verbose | +v*)
|
||||||
verbose=${arg}
|
verbose=${arg}
|
||||||
;;
|
;;
|
||||||
@ -145,9 +148,43 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "${verbose}" ] ; then
|
if [ -n "${verbose}" ] ; then
|
||||||
echo `pwd`/configure $*
|
echo $0 $*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## this is a little touchy and won't always work, but...
|
||||||
|
##
|
||||||
|
## if the argv[0] starts with a slash then it is an absolute name that can be
|
||||||
|
## used as is.
|
||||||
|
##
|
||||||
|
## otherwise, if argv[0] has no slash in it, we can assume that it is on the
|
||||||
|
## path. Since PATH might include "." we also add `pwd` to the end of PATH.
|
||||||
|
##
|
||||||
|
## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
|
||||||
|
## path.
|
||||||
|
##
|
||||||
|
|
||||||
|
if (echo $0 | grep '^/' > /dev/null) ; then
|
||||||
|
progname=$0
|
||||||
|
configsub=`echo $0 | sed -e 's:[^/]*$:config.sub:'`
|
||||||
|
else
|
||||||
|
if (echo $0 | grep '/' > /dev/null) ; then
|
||||||
|
progname=`pwd`/$0
|
||||||
|
|
||||||
|
if [ ! -f config.sub ] ; then
|
||||||
|
echo '***' can not find config.sub.
|
||||||
|
echo 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
configsub=`pwd`/config.sub
|
||||||
|
else
|
||||||
|
progname=$0
|
||||||
|
configsub="config.sub"
|
||||||
|
PATH=$PATH:`pwd` ; export PATH
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo configure = ${progname}, config.sub = ${configsub}
|
||||||
|
|
||||||
# process host and target only if not removing.
|
# process host and target only if not removing.
|
||||||
if [ -z "${removing}" -a -z "${fatal}" ] ; then
|
if [ -z "${removing}" -a -z "${fatal}" ] ; then
|
||||||
# Complain if an arg is missing
|
# Complain if an arg is missing
|
||||||
@ -164,15 +201,17 @@ if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
|
|||||||
echo ;
|
echo ;
|
||||||
echo "Options: [defaults in brackets]" ;
|
echo "Options: [defaults in brackets]" ;
|
||||||
echo " +ansi configure w/ANSI library. [no ansi lib]" ;
|
echo " +ansi configure w/ANSI library. [no ansi lib]" ;
|
||||||
echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
|
echo " +destdir=MYDIR configure for installation into MYDIR. [\"/usr/local\"]" ;
|
||||||
echo " +subdirs configure in subdirectories. [in source directories]" ;
|
|
||||||
echo " +lang=LANG configure to build LANG. [gcc]" ;
|
|
||||||
echo " +help print this message. [normal config]" ;
|
|
||||||
echo " +gas configure the compilers for use with gas. [native as]" ;
|
echo " +gas configure the compilers for use with gas. [native as]" ;
|
||||||
|
echo " +help print this message. [normal config]" ;
|
||||||
|
echo " +lang=LANG configure to build LANG. [gcc]" ;
|
||||||
echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
|
echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
|
||||||
echo " +norecursion configure this directory only. [recurse]" ;
|
echo " +norecursion configure this directory only. [recurse]" ;
|
||||||
|
echo " +objdir=ODIR configure in a parallel tree rooted in ODIR. [rooted in \".\"]" ;
|
||||||
echo " +rm remove this configuration. [build a configuration]" ;
|
echo " +rm remove this configuration. [build a configuration]" ;
|
||||||
|
echo " +subdirs configure in subdirectories. [in source directories]" ;
|
||||||
echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
|
echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
|
||||||
|
echo " +tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
|
||||||
echo ;
|
echo ;
|
||||||
echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
|
echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
|
||||||
echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
|
echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
|
||||||
@ -197,16 +236,20 @@ if [ -r configure.in ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${TMPDIR}" ] ; then
|
||||||
|
TMPDIR=/tmp ; export TMPDIR
|
||||||
|
fi
|
||||||
|
|
||||||
# split configure.in into common, per-host, per-target,
|
# split configure.in into common, per-host, per-target,
|
||||||
# and post-target parts. Post-target is optional.
|
# and post-target parts. Post-target is optional.
|
||||||
sed -e '/^# per\-host:/,$d' configure.in > configure.com
|
sed -e '/^# per\-host:/,$d' configure.in > ${TMPDIR}/configure.$$.com
|
||||||
sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
|
sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > ${TMPDIR}/configure.$$.hst
|
||||||
if grep -s '^# post-target:' configure.in ; then
|
if grep -s '^# post-target:' configure.in ; then
|
||||||
sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
|
sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > ${TMPDIR}/configure.$$.tgt
|
||||||
sed -e '1,/^# post\-target:/d' configure.in > configure.pos
|
sed -e '1,/^# post\-target:/d' configure.in > ${TMPDIR}/configure.$$.pos
|
||||||
else
|
else
|
||||||
sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
|
sed -e '1,/^# per\-target:/d' configure.in > ${TMPDIR}/configure.$$.tgt
|
||||||
echo >configure.pos
|
echo >${TMPDIR}/configure.$$.pos
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -216,7 +259,7 @@ fi
|
|||||||
|
|
||||||
### do common part of configure.in
|
### do common part of configure.in
|
||||||
|
|
||||||
. ./configure.com
|
. ${TMPDIR}/configure.$$.com
|
||||||
|
|
||||||
# some sanity checks on configure.in
|
# some sanity checks on configure.in
|
||||||
if [ -z "${srctrigger}" ] ; then
|
if [ -z "${srctrigger}" ] ; then
|
||||||
@ -233,32 +276,37 @@ for host in ${hosts} ; do
|
|||||||
|
|
||||||
host_alias=${host}
|
host_alias=${host}
|
||||||
|
|
||||||
result=`/bin/sh ./config.sub ${host}`
|
result=`${configsub} ${host}`
|
||||||
host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
||||||
host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
|
host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
|
||||||
host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
|
host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
|
||||||
host=${host_cpu}-${host_vendor}-${host_os}
|
host=${host_cpu}-${host_vendor}-${host_os}
|
||||||
host_makefile_frag=config/hmake-${host}
|
host_makefile_frag=config/hmake-${host}
|
||||||
|
|
||||||
. ./configure.hst
|
. ${TMPDIR}/configure.$$.hst
|
||||||
|
|
||||||
for target in ${targets} ; do
|
for target in ${targets} ; do
|
||||||
|
|
||||||
target_alias=${target}
|
target_alias=${target}
|
||||||
result=`/bin/sh ./config.sub ${target}`
|
result=`${configsub} ${target}`
|
||||||
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
||||||
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
|
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
|
||||||
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
|
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
|
||||||
target=${target_cpu}-${target_vendor}-${target_os}
|
target=${target_cpu}-${target_vendor}-${target_os}
|
||||||
target_makefile_frag=config/tmake-${target}
|
target_makefile_frag=config/tmake-${target}
|
||||||
|
|
||||||
. ./configure.tgt
|
. ${TMPDIR}/configure.$$.tgt
|
||||||
|
|
||||||
# Temporarily, we support only direct subdir builds.
|
# Temporarily, we support only direct subdir builds.
|
||||||
hostsubdir=H-${host_alias}
|
hostsubdir=H-${host_alias}
|
||||||
targetsubdir=T-${target_alias}
|
targetsubdir=T-${target_alias}
|
||||||
|
|
||||||
if [ -n "${removing}" ] ; then
|
if [ -n "${removing}" ] ; then
|
||||||
|
if [ -n "${objdir}" ] ; then
|
||||||
|
echo '***' +rm not supported for +objdir. Just \"rm -rf ${objdir}\" by hand.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${subdirs}" ] ; then
|
if [ -n "${subdirs}" ] ; then
|
||||||
if [ -d "${hostsubdir}" ] ; then
|
if [ -d "${hostsubdir}" ] ; then
|
||||||
rm -rf ${hostsubdir}/${targetsubdir}
|
rm -rf ${hostsubdir}/${targetsubdir}
|
||||||
@ -273,6 +321,11 @@ for host in ${hosts} ; do
|
|||||||
rm -f ${Makefile} config.status ${links}
|
rm -f ${Makefile} config.status ${links}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [ -n "${objdir}" ]; then
|
||||||
|
srcdir=`pwd`
|
||||||
|
cd ${objdir}
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${subdirs}" ] ; then
|
if [ -n "${subdirs}" ] ; then
|
||||||
# check for existing status before allowing forced subdirs.
|
# check for existing status before allowing forced subdirs.
|
||||||
if [ -f ${Makefile} ] ; then
|
if [ -f ${Makefile} ] ; then
|
||||||
@ -297,7 +350,9 @@ for host in ${hosts} ; do
|
|||||||
|
|
||||||
cd ${targetsubdir}
|
cd ${targetsubdir}
|
||||||
|
|
||||||
srcdir=../..
|
if [ -z "${srcdir}" ] ; then
|
||||||
|
srcdir=../..
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# if not subdir builds, then make sure none exist.
|
# if not subdir builds, then make sure none exist.
|
||||||
if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then
|
if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then
|
||||||
@ -399,9 +454,11 @@ for host in ${hosts} ; do
|
|||||||
echo "target_os = ${target_os}" >> ${Makefile}
|
echo "target_os = ${target_os}" >> ${Makefile}
|
||||||
|
|
||||||
if [ -n "${subdirs}" ] ; then
|
if [ -n "${subdirs}" ] ; then
|
||||||
echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
|
(echo "subdir = /${hostsubdir}/${targetsubdir}" ;
|
||||||
|
echo "unsubdir = ../..") >> ${Makefile}
|
||||||
else
|
else
|
||||||
echo "subdir =" >> ${Makefile}
|
(echo "subdir =" ;
|
||||||
|
echo "unsubdir = .") >> ${Makefile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echo "workdir = `pwd`" >> ${Makefile}
|
# echo "workdir = `pwd`" >> ${Makefile}
|
||||||
@ -486,8 +543,8 @@ for host in ${hosts} ; do
|
|||||||
echo "Created \"${Makefile}\"" in `pwd`${andandusing}.
|
echo "Created \"${Makefile}\"" in `pwd`${andandusing}.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ./configure.pos ] ; then
|
if [ -f ${TMPDIR}/configure.$$.pos ] ; then
|
||||||
. ./configure.pos
|
. ${TMPDIR}/configure.$$.pos
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# describe the chosen configuration in config.status.
|
# describe the chosen configuration in config.status.
|
||||||
@ -496,8 +553,8 @@ for host in ${hosts} ; do
|
|||||||
# Makefiles.
|
# Makefiles.
|
||||||
|
|
||||||
echo "#!/bin/sh
|
echo "#!/bin/sh
|
||||||
# ${srcname} was configured as follows:
|
# `pwd` was configured as follows:
|
||||||
${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status
|
(cd ${srcdir} ; ${progname}" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` ")" > config.status
|
||||||
chmod a+x config.status
|
chmod a+x config.status
|
||||||
|
|
||||||
originaldir=`pwd`
|
originaldir=`pwd`
|
||||||
@ -512,9 +569,17 @@ ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norec
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d ${configdir} ] ; then
|
if [ -d ${configdir} ] ; then
|
||||||
|
if [ -n "${objdir}" ] ; then
|
||||||
|
if [ ! -d ${objdir}/${configdir} ] ; then
|
||||||
|
mkdir ${objdir}/${configdir}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
(cd ${configdir} ;
|
(cd ${configdir} ;
|
||||||
configure +recurring ${host_alias} +target=${target_alias} \
|
${progname} +recurring ${host_alias} +target=${target_alias} \
|
||||||
${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
|
${verbose} ${subdirs} ${removing} +destdir=${destdir} \
|
||||||
|
`if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \
|
||||||
|
${tmpdiroption}) \
|
||||||
| sed 's/^/ /'
|
| sed 's/^/ /'
|
||||||
else
|
else
|
||||||
if [ -n "${verbose}" ] ; then
|
if [ -n "${verbose}" ] ; then
|
||||||
@ -527,6 +592,12 @@ ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norec
|
|||||||
|
|
||||||
# Now build a Makefile for this host.
|
# Now build a Makefile for this host.
|
||||||
if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
|
if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
|
||||||
|
push=`pwd`
|
||||||
|
|
||||||
|
if [ -n "${objdir}" ] ; then
|
||||||
|
cd ${objdir}
|
||||||
|
fi
|
||||||
|
|
||||||
cd ${hostsubdir}
|
cd ${hostsubdir}
|
||||||
cat > GNUmakefile << E!O!F
|
cat > GNUmakefile << E!O!F
|
||||||
# Makefile generated by configure for host ${host_alias}.
|
# Makefile generated by configure for host ${host_alias}.
|
||||||
@ -538,20 +609,30 @@ ALL := $(shell ls -d T-*)
|
|||||||
|
|
||||||
all:
|
all:
|
||||||
E!O!F
|
E!O!F
|
||||||
cd ..
|
cd ${push}
|
||||||
fi
|
fi
|
||||||
done # for each host
|
done # for each host
|
||||||
|
|
||||||
### clean up.
|
### clean up.
|
||||||
|
|
||||||
rm -f configure.com configure.tgt configure.hst configure.pos
|
rm -f ${TMPDIR}/configure.$$.com ${TMPDIR}/configure.$$.tgt ${TMPDIR}/configure.$$.hst ${TMPDIR}/configure.$$.pos
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# $Log$
|
# $Log$
|
||||||
# Revision 1.46 1991/10/02 06:29:53 rich
|
# Revision 1.49 1991/10/04 22:52:09 rich
|
||||||
|
# Use john's heuristic for finding ourselves. kinda like hare krishna.
|
||||||
|
#
|
||||||
|
# Revision 1.48 1991/10/02 13:17:28 rich
|
||||||
|
# take out the set -e for now
|
||||||
|
#
|
||||||
|
# Revision 1.47 1991/10/02 10:02:23 rich
|
||||||
|
# * temporary files in TMPDIR
|
||||||
|
# * +objdir
|
||||||
|
#
|
||||||
|
# Revision 1.46 1991/10/02 06:29:53 rich
|
||||||
# Added +site=foo option for naming site specific Makefile fragments.
|
# Added +site=foo option for naming site specific Makefile fragments.
|
||||||
#
|
#
|
||||||
# Revision 1.45 1991/10/02 06:15:13 rich
|
# Revision 1.45 1991/10/02 06:15:13 rich
|
||||||
|
Reference in New Issue
Block a user