Catch up to changes recorded in GDB ChangeLog, to wit:
[deliverable/binutils-gdb.git] / configure
index 4e925084f832df95f705bb311150102815dab05a..6586640ed2b8b8859d74642e477d9e77154bf67a 100755 (executable)
--- a/configure
+++ b/configure
@@ -21,6 +21,9 @@
 
 # $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
 # preparation for compilation.
@@ -41,8 +44,6 @@ symbolic_link='ln -s'
 #hard_link="echo ln"
 #symbolic_link="echo ln -s"
 
-progname=$0
-
 # clear some things potentially inherited from environment.
 
 Makefile=Makefile
@@ -56,6 +57,9 @@ destdir=
 fatal=
 hostsubdir=
 norecursion=
+objdir=
+objdiroption=
+progname=
 recurring=
 removing=
 srcdir=
@@ -65,15 +69,6 @@ targets=
 targetsubdir=
 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 $*;
 do
        case ${arg} in
@@ -101,6 +96,10 @@ do
        -norecursion | +no*)
                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=true
                ;;
@@ -124,6 +123,10 @@ do
                newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
                targets="${newtargets}"
                ;;
+       -tmpdir=* | +tmpdir=* | +tmpdi=* | +tmpd=* | +tmp=* | +tm=*)
+               tmpdiroption=${arg}
+               TMPDIR=`echo ${arg} | sed 's/[+-]t[a-z]*=//'`
+               ;;
        -v | -verbose | +v*)
                verbose=${arg}
                ;;
@@ -145,7 +148,37 @@ do
 done
 
 if [ -n "${verbose}" ] ; then
-       echo `pwd`/configure $*
+       echo $0 $*
+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
+else
+       if (echo $0 | grep '/' > /dev/null) ; then
+               progname=`pwd`/$0
+       else
+               progname=$0
+               PATH=$PATH:`pwd` ; export PATH
+       fi
+fi
+
+configsub=`echo ${progname} | sed 's/configure\$/config.sub/'`
+
+if [ ! -f ${configsub} ] ; then
+       echo '***' cannot find config.sub.
+       echo 1
 fi
 
 # process host and target only if not removing.
@@ -164,15 +197,19 @@ if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
        echo ;
        echo "Options: [defaults in brackets]" ;
        echo " +ansi            configure w/ANSI library. [no ansi lib]" ;
-       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 " +destdir=MYDIR   configure for installation into MYDIR. [\"/usr/local\"]" ;
        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 " +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 " +site            configure with site specific makefile" ;
+# This is correctly aligned in the output, even though it isn't here.
+       echo " +subdirs configure in subdirectories.  [in source directories]" ;
        echo " +target=TARGET   configure for TARGET.  [TARGET = HOST]" ;
+       echo " +tmpdir=TMPDIR   create temporary files in TMPDIR.  [ TMPDIR = \"/tmp\" ]" ;
        echo ;
        echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
        echo "Asking for more than one \"+target\" implies \"+subdirs\".  Any other" ;
@@ -197,16 +234,20 @@ if [ -r configure.in ] ; then
                exit 1
        fi
 
+       if [ -z "${TMPDIR}" ] ; then
+               TMPDIR=/tmp ; export TMPDIR
+       fi
+
        # split configure.in into common, per-host, per-target,
        # and post-target parts.  Post-target is optional.
-       sed -e '/^# per\-host:/,$d' configure.in > configure.com
-       sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
+       sed -e '/^# per\-host:/,$d' configure.in > ${TMPDIR}/configure.$$.com
+       sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > ${TMPDIR}/configure.$$.hst
        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,/^# post\-target:/d' configure.in > configure.pos
+         sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > ${TMPDIR}/configure.$$.tgt
+         sed -e '1,/^# post\-target:/d' configure.in > ${TMPDIR}/configure.$$.pos
        else
-         sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
-         echo >configure.pos
+         sed -e '1,/^# per\-target:/d' configure.in > ${TMPDIR}/configure.$$.tgt
+         echo >${TMPDIR}/configure.$$.pos
        fi
 
 else
@@ -216,7 +257,7 @@ fi
 
 ### do common part of configure.in
 
-. ./configure.com
+. ${TMPDIR}/configure.$$.com
 
 # some sanity checks on configure.in
 if [ -z "${srctrigger}" ] ; then
@@ -233,32 +274,37 @@ for host in ${hosts} ; do
 
        host_alias=${host}
 
-       result=`/bin/sh ./config.sub ${host}`
+       result=`${configsub} ${host}`
        host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
        host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
        host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
        host=${host_cpu}-${host_vendor}-${host_os}
        host_makefile_frag=config/hmake-${host}
 
-       . ./configure.hst
+       . ${TMPDIR}/configure.$$.hst
 
        for target in ${targets} ; do
 
                target_alias=${target}
-               result=`/bin/sh ./config.sub ${target}`
+               result=`${configsub} ${target}`
                target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
                target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
                target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
                target=${target_cpu}-${target_vendor}-${target_os}
                target_makefile_frag=config/tmake-${target}
 
-               . ./configure.tgt
+               . ${TMPDIR}/configure.$$.tgt
 
                # Temporarily, we support only direct subdir builds.
                hostsubdir=H-${host_alias}
                targetsubdir=T-${target_alias}
 
                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 [ -d "${hostsubdir}" ] ; then
                                        rm -rf ${hostsubdir}/${targetsubdir}
@@ -273,6 +319,11 @@ for host in ${hosts} ; do
                                rm -f ${Makefile} config.status ${links}
                        fi
                else
+                       if [ -n "${objdir}" ]; then
+                               srcdir=`pwd`
+                               cd ${objdir}
+                       fi
+
                        if [ -n "${subdirs}" ] ; then
                                # check for existing status before allowing forced subdirs.
                                if [ -f ${Makefile} ] ; then
@@ -297,7 +348,9 @@ for host in ${hosts} ; do
 
                                cd ${targetsubdir}
 
-                               srcdir=../..
+                               if [ -z "${srcdir}" ] ; then
+                                       srcdir=../..
+                               fi
                        else
                                # if not subdir builds, then make sure none exist.
                                if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then
@@ -399,9 +452,11 @@ for host in ${hosts} ; do
                        echo "target_os = ${target_os}" >> ${Makefile}
 
                        if [ -n "${subdirs}" ] ; then
-                               echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
+                               (echo "subdir = /${hostsubdir}/${targetsubdir}" ;
+                                       echo "unsubdir = ../..") >> ${Makefile}
                        else
-                               echo "subdir =" >> ${Makefile}
+                               (echo "subdir =" ;
+                                       echo "unsubdir = .") >> ${Makefile}
                        fi
 
                #       echo "workdir = `pwd`" >> ${Makefile}
@@ -430,7 +485,7 @@ for host in ${hosts} ; do
 
                                if [ -f ${srcdir}/${site_makefile_frag} ] ; then
                                        (echo "site_makefile_frag = ${srcdir}/${site_makefile_frag}" ; 
-                                               sed -e "/^####/  r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
+                                               sed -e "/^####/  r ${srcdir}/${site_makefile_frag}" ${Makefile}) > Makefile.tem
                                        mv Makefile.tem ${Makefile}
                                fi
                        fi
@@ -479,15 +534,15 @@ for host in ${hosts} ; do
                                        andandusing="${andusing} and \"${site_makefile_frag}\""
                                fi
                        else
-                               andandusing=${using}
+                               andandusing=${andusing}
                        fi
 
                        if [ -n "${verbose}" -o -z "${recurring}" ] ; then
                                echo "Created \"${Makefile}\"" in `pwd`${andandusing}.
                        fi
 
-                       if [ -f ./configure.pos ] ; then
-                               . ./configure.pos
+                       if [ -f ${TMPDIR}/configure.$$.pos ] ; then
+                               . ${TMPDIR}/configure.$$.pos
                        fi
 
                        # describe the chosen configuration in config.status.
@@ -496,8 +551,8 @@ for host in ${hosts} ; do
                        # Makefiles.
 
                        echo "#!/bin/sh
-# ${srcname} was configured as follows:
-${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status
+# `pwd` was configured as follows:
+(cd ${srcdir} ; ${progname}" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` ")" > config.status
                        chmod a+x config.status
 
                        originaldir=`pwd`
@@ -512,10 +567,28 @@ ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norec
                                fi
 
                                if [ -d ${configdir} ] ; then
-                                       (cd ${configdir} ;
-                                               configure +recurring ${host_alias} +target=${target_alias} \
-                                                       ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
-                                               | sed 's/^/     /'
+                                       if [ -n "${objdir}" ] ; then
+                                               if [ ! -d ${objdir}/${configdir} ] ; then
+                                                       mkdir ${objdir}/${configdir}
+                                               fi
+                                       fi
+
+                                       POPDIR=`pwd`
+                                       cd ${configdir} 
+
+                                       ${progname} +recurring ${host_alias} +target=${target_alias} \
+                                               ${verbose} ${subdirs} ${removing} +destdir=${destdir} \
+                                               `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \
+                                               ${tmpdiroption}
+
+                                       cd ${POPDIR}
+
+#                                      (cd ${configdir} ;
+#                                              if (${progname} +recurring ${host_alias} +target=${target_alias} \
+#                                                      ${verbose} ${subdirs} ${removing} +destdir=${destdir} \
+#                                                      `if [ -n "${objdir}" ] ; then echo +objdir=${objdir}/${configdir} ; fi` \
+#                                                      ${tmpdiroption}) ; then true ; else exit 1 ; fi) \
+#                                              | sed 's/^/     /'
                                else
                                        if [ -n "${verbose}" ] ; then
                                                echo Warning: directory \"${configdir}\" is missing.
@@ -527,6 +600,12 @@ ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norec
 
        # Now build a Makefile for this host.
        if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
+               push=`pwd`
+
+               if [ -n "${objdir}" ] ; then
+                       cd ${objdir}
+               fi
+
                cd ${hostsubdir}
                cat > GNUmakefile << E!O!F
 # Makefile generated by configure for host ${host_alias}.
@@ -538,20 +617,52 @@ ALL := $(shell ls -d T-*)
 
 all:
 E!O!F
-               cd ..
+               cd ${push}
        fi
 done # for each host
 
 ### 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
 
 #
 #
 # $Log$
-# Revision 1.46  1991/10/02 06:29:53  rich
+# Revision 1.55  1991/10/10 04:57:23  rich
+# * Die when sub-configure's do.
+# * get the makefile building message line correct.
+# * set -e
+#
+# Revision 1.54  1991/10/10  01:04:42  rich
+# Backed out the "/bin/sh config.sub" change.  Fails when config.sub was
+# on PATH.
+#
+# Revision 1.53  1991/10/10  00:38:08  rich
+# Call config.sub as "/bin/sh config.sub" instead of directly.  This
+# protects us from the case where config.sub isn't executable.
+#
+# Revision 1.52  1991/10/09  00:48:26  rich
+# Another patch from jim.
+#
+# Revision 1.51  1991/10/08  06:07:58  wilson
+# Fix bug in smake- file code.
+#
+# Revision 1.50  1991/10/04  23:49:37  rich
+# Per's patch for my config.sub botch.
+#
+# 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.
 #
 # Revision 1.45  1991/10/02  06:15:13  rich
This page took 0.028332 seconds and 4 git commands to generate.