see devo/configure 1.11
authorK. Richard Pixley <rich@cygnus>
Tue, 14 May 1991 14:14:40 +0000 (14:14 +0000)
committerK. Richard Pixley <rich@cygnus>
Tue, 14 May 1991 14:14:40 +0000 (14:14 +0000)
bfd/configure
binutils/configure
gas/configure
gdb/configure
ld/configure

index fc07559..da3adaf 100755 (executable)
@@ -44,6 +44,8 @@ symbolic_link='ln -s'
 #hard_link="echo ln"
 #symbolic_link="echo ln -s"
 
+progname=$0
+
 # clear some things potentially inherited from environment.
 ansi=
 defaulttargets=
@@ -69,7 +71,8 @@ do
        -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
                destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
                ;;
-       -forcesubdirs | +forcesubdirs | +f)
+       -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
+       | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
                forcesubdirs=${arg}
                ;;
        -languages=* | +languages=* | +language=* | +languag=* \
@@ -178,7 +181,7 @@ fi
 srctrigger=libbfd.c
 srcname="bfd"
 
-## end of common part
+## end of common part.
 
 # are we rebuilding config itself?
 if [ -n "${template}" ] ; then
@@ -187,12 +190,17 @@ if [ -n "${template}" ] ; then
                exit 1
        fi
 
-       mv configure configure.old
-       echo "#!/bin/sh" > configure
-       echo "# Please do not edit this file.  It is generated automatically from" >> configure
-       echo "# configure.in and a configure template." >> configure
-       echo "configdirs=" >> configure
-       echo >> configure
+# prep the template
+       sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
+#### configure.in common parts come in here.\
+## end of common part.' \
+       -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
+#### configure.in per-host parts come in here.\
+## end of per-host part.' \
+       -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
+#### configure.in per-target parts come in here.\
+## end of per-target part.' \
+       < ${template} > template.new
 
        if [ -r configure.in ] ; then
                if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
@@ -211,10 +219,10 @@ if [ -n "${template}" ] ; then
                sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
 
                # and insert them
-               sed -e '/^#### configure.in common part/  r configure.com' \
-                       -e '/^#### configure.in per\-host part/  r configure.hst' \
-                       -e '/^#### configure.in per\-target part/  r configure.tgt' \
-                       ${template} >> configure
+               sed -e '/^#### configure.in common parts come in here.$/  r configure.com' \
+                       -e '/^#### configure.in per\-host parts come in here.$/  r configure.hst' \
+                       -e '/^#### configure.in per\-target parts come in here.$/  r configure.tgt' \
+                       template.new > configure.new
 
                rm -f configure.com configure.tgt configure.hst
        else
@@ -222,8 +230,10 @@ if [ -n "${template}" ] ; then
                cat ${template} >> configure
        fi
 
-       chmod a+x configure
-       rm configure.old
+       chmod a+x configure.new
+       rm template.new
+#      mv configure configure.old
+       mv configure.new configure
        echo Rebuilt configure in `pwd`
 
        if [ -z "${norecurse}" ] ; then
@@ -266,7 +276,7 @@ for host in ${hosts} ; do
 
 #### configure.in per-host parts come in here.
 
-## end of per-target part
+## end of per-host part.
 
 
        for target in ${targets} ; do
@@ -279,18 +289,22 @@ for host in ${hosts} ; do
 
 files=
 links=
-## end of per-target part
+## end of per-target part.
 
                # Temporarily, we support only direct subdir builds.
                hostsubdir=Host-${host}
                targetsubdir=Target-${target}
 
                if [ -n "${removing}" ] ; then
-                       if [ -d "${hostsubdir}/${targetsubdir}" ] ; then
-                               rm -rf ${hostsubdir}/${targetsubdir}
+                       if [ -n "${forcesubdirs}" ] ; then
+                               if [ -d "${hostsubdir}" ] ; then
+                                       rm -rf ${hostsubdir}/${targetsubdir}
 
-                               if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
-                                       rm -rf ${hostsubdir}
+                                       if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
+                                               rm -rf ${hostsubdir}
+                                       fi
+                               else
+                                       echo Warning: no `pwd`/${hostsubdir} to remove.
                                fi
                        else
                                rm -f Makefile config.status ${links}
@@ -329,11 +343,12 @@ links=
 
                        if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
                                if [ -z "${srcdirdefaulted}" ] ; then
-                                 echo "${progname}: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
                                else
-                                 echo "${progname}: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
                                fi
 
+                               echo \(At least ${srctrigger} is missing.\) 1>&2
                                exit 1
                        fi
 
@@ -477,8 +492,22 @@ links=
                        originaldir=`pwd`
                        cd ${srcdir}
                fi
-       done
-done
+       done # for each target
+
+#      # Now build a Makefile for this host.
+#      if [ -n "${forcesubdirs}" ] ; then
+#              cd ${hostsubdir}
+#              cat > GNUmakefile << E!O!F
+## Makefile generated by configure for host ${host}.
+#
+#%:
+#      for i in ${targets} ; do \
+#              $(MAKE) -C Target-\$i \$@
+#
+#all clean stage1 stage2 stage3 stage4etags tags TAGS
+#E!O!F
+#      fi
+done # for each host
 
 # If there are subdirectories, then recurse. 
 
@@ -554,8 +583,23 @@ exit 0
 
 #
 # $Log$
-# Revision 1.7  1991/04/17 01:41:18  rich
-# Fixed a problem with host dependent parts.
+# Revision 1.8  1991/05/14 14:14:25  rich
+# see devo/configure 1.11
+#
+# Revision 1.10  1991/05/04  00:58:38  rich
+# Fix program name bug.
+#
+# Revision 1.9  1991/05/03  19:14:18  rich
+# Changed getopt to libiberty, commented out an aborted attempt at host
+# level Makefiles because it caused errors on +rm, add a warning for
+# directories expected to be removed on +rm but that don't exist.
+#
+# Revision 1.8  1991/04/24  16:50:59  rich
+# Three staging checkpoint.
+#
+# Revision 1.7  1991/04/17  01:34:47  rich
+# Added getopt for binutils, fixed problem with host dependancies in
+# configure.template.
 #
 # Revision 1.6  1991/04/16  00:18:44  rich
 # Now handles multiple hosts and targets.
index 21a2347..b354c13 100755 (executable)
@@ -44,6 +44,8 @@ symbolic_link='ln -s'
 #hard_link="echo ln"
 #symbolic_link="echo ln -s"
 
+progname=$0
+
 # clear some things potentially inherited from environment.
 ansi=
 defaulttargets=
@@ -69,7 +71,8 @@ do
        -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
                destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
                ;;
-       -forcesubdirs | +forcesubdirs | +f)
+       -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
+       | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
                forcesubdirs=${arg}
                ;;
        -languages=* | +languages=* | +language=* | +languag=* \
@@ -178,7 +181,7 @@ fi
 srctrigger=ar.c
 srcname="binutils"
 
-## end of common part
+## end of common part.
 
 # are we rebuilding config itself?
 if [ -n "${template}" ] ; then
@@ -187,12 +190,17 @@ if [ -n "${template}" ] ; then
                exit 1
        fi
 
-       mv configure configure.old
-       echo "#!/bin/sh" > configure
-       echo "# Please do not edit this file.  It is generated automatically from" >> configure
-       echo "# configure.in and a configure template." >> configure
-       echo "configdirs=" >> configure
-       echo >> configure
+# prep the template
+       sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
+#### configure.in common parts come in here.\
+## end of common part.' \
+       -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
+#### configure.in per-host parts come in here.\
+## end of per-host part.' \
+       -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
+#### configure.in per-target parts come in here.\
+## end of per-target part.' \
+       < ${template} > template.new
 
        if [ -r configure.in ] ; then
                if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
@@ -211,10 +219,10 @@ if [ -n "${template}" ] ; then
                sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
 
                # and insert them
-               sed -e '/^#### configure.in common part/  r configure.com' \
-                       -e '/^#### configure.in per\-host part/  r configure.hst' \
-                       -e '/^#### configure.in per\-target part/  r configure.tgt' \
-                       ${template} >> configure
+               sed -e '/^#### configure.in common parts come in here.$/  r configure.com' \
+                       -e '/^#### configure.in per\-host parts come in here.$/  r configure.hst' \
+                       -e '/^#### configure.in per\-target parts come in here.$/  r configure.tgt' \
+                       template.new > configure.new
 
                rm -f configure.com configure.tgt configure.hst
        else
@@ -222,8 +230,10 @@ if [ -n "${template}" ] ; then
                cat ${template} >> configure
        fi
 
-       chmod a+x configure
-       rm configure.old
+       chmod a+x configure.new
+       rm template.new
+#      mv configure configure.old
+       mv configure.new configure
        echo Rebuilt configure in `pwd`
 
        if [ -z "${norecurse}" ] ; then
@@ -266,7 +276,7 @@ for host in ${hosts} ; do
 
 #### configure.in per-host parts come in here.
 
-## end of per-target part
+## end of per-host part.
 
 
        for target in ${targets} ; do
@@ -280,18 +290,22 @@ for host in ${hosts} ; do
 files=
 links=
 
-## end of per-target part
+## end of per-target part.
 
                # Temporarily, we support only direct subdir builds.
                hostsubdir=Host-${host}
                targetsubdir=Target-${target}
 
                if [ -n "${removing}" ] ; then
-                       if [ -d "${hostsubdir}/${targetsubdir}" ] ; then
-                               rm -rf ${hostsubdir}/${targetsubdir}
+                       if [ -n "${forcesubdirs}" ] ; then
+                               if [ -d "${hostsubdir}" ] ; then
+                                       rm -rf ${hostsubdir}/${targetsubdir}
 
-                               if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
-                                       rm -rf ${hostsubdir}
+                                       if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
+                                               rm -rf ${hostsubdir}
+                                       fi
+                               else
+                                       echo Warning: no `pwd`/${hostsubdir} to remove.
                                fi
                        else
                                rm -f Makefile config.status ${links}
@@ -330,11 +344,12 @@ links=
 
                        if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
                                if [ -z "${srcdirdefaulted}" ] ; then
-                                 echo "${progname}: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
                                else
-                                 echo "${progname}: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
                                fi
 
+                               echo \(At least ${srctrigger} is missing.\) 1>&2
                                exit 1
                        fi
 
@@ -478,8 +493,22 @@ links=
                        originaldir=`pwd`
                        cd ${srcdir}
                fi
-       done
-done
+       done # for each target
+
+#      # Now build a Makefile for this host.
+#      if [ -n "${forcesubdirs}" ] ; then
+#              cd ${hostsubdir}
+#              cat > GNUmakefile << E!O!F
+## Makefile generated by configure for host ${host}.
+#
+#%:
+#      for i in ${targets} ; do \
+#              $(MAKE) -C Target-\$i \$@
+#
+#all clean stage1 stage2 stage3 stage4etags tags TAGS
+#E!O!F
+#      fi
+done # for each host
 
 # If there are subdirectories, then recurse. 
 
@@ -555,8 +584,23 @@ exit 0
 
 #
 # $Log$
-# Revision 1.7  1991/04/17 01:41:03  rich
-# Fixed a problem with host dependent parts.
+# Revision 1.8  1991/05/14 14:14:18  rich
+# see devo/configure 1.11
+#
+# Revision 1.10  1991/05/04  00:58:38  rich
+# Fix program name bug.
+#
+# Revision 1.9  1991/05/03  19:14:18  rich
+# Changed getopt to libiberty, commented out an aborted attempt at host
+# level Makefiles because it caused errors on +rm, add a warning for
+# directories expected to be removed on +rm but that don't exist.
+#
+# Revision 1.8  1991/04/24  16:50:59  rich
+# Three staging checkpoint.
+#
+# Revision 1.7  1991/04/17  01:34:47  rich
+# Added getopt for binutils, fixed problem with host dependancies in
+# configure.template.
 #
 # Revision 1.6  1991/04/16  00:18:44  rich
 # Now handles multiple hosts and targets.
index dc78dc1..75b176c 100755 (executable)
@@ -44,6 +44,8 @@ symbolic_link='ln -s'
 #hard_link="echo ln"
 #symbolic_link="echo ln -s"
 
+progname=$0
+
 # clear some things potentially inherited from environment.
 ansi=
 defaulttargets=
@@ -69,7 +71,8 @@ do
        -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
                destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
                ;;
-       -forcesubdirs | +forcesubdirs | +f)
+       -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
+       | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
                forcesubdirs=${arg}
                ;;
        -languages=* | +languages=* | +language=* | +languag=* \
@@ -178,7 +181,7 @@ fi
 srctrigger=as.c
 srcname="gas"
 
-## end of common part
+## end of common part.
 
 # are we rebuilding config itself?
 if [ -n "${template}" ] ; then
@@ -187,12 +190,17 @@ if [ -n "${template}" ] ; then
                exit 1
        fi
 
-       mv configure configure.old
-       echo "#!/bin/sh" > configure
-       echo "# Please do not edit this file.  It is generated automatically from" >> configure
-       echo "# configure.in and a configure template." >> configure
-       echo "configdirs=" >> configure
-       echo >> configure
+# prep the template
+       sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
+#### configure.in common parts come in here.\
+## end of common part.' \
+       -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
+#### configure.in per-host parts come in here.\
+## end of per-host part.' \
+       -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
+#### configure.in per-target parts come in here.\
+## end of per-target part.' \
+       < ${template} > template.new
 
        if [ -r configure.in ] ; then
                if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
@@ -211,10 +219,10 @@ if [ -n "${template}" ] ; then
                sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
 
                # and insert them
-               sed -e '/^#### configure.in common part/  r configure.com' \
-                       -e '/^#### configure.in per\-host part/  r configure.hst' \
-                       -e '/^#### configure.in per\-target part/  r configure.tgt' \
-                       ${template} >> configure
+               sed -e '/^#### configure.in common parts come in here.$/  r configure.com' \
+                       -e '/^#### configure.in per\-host parts come in here.$/  r configure.hst' \
+                       -e '/^#### configure.in per\-target parts come in here.$/  r configure.tgt' \
+                       template.new > configure.new
 
                rm -f configure.com configure.tgt configure.hst
        else
@@ -222,8 +230,10 @@ if [ -n "${template}" ] ; then
                cat ${template} >> configure
        fi
 
-       chmod a+x configure
-       rm configure.old
+       chmod a+x configure.new
+       rm template.new
+#      mv configure configure.old
+       mv configure.new configure
        echo Rebuilt configure in `pwd`
 
        if [ -z "${norecurse}" ] ; then
@@ -266,7 +276,7 @@ for host in ${hosts} ; do
 
 #### configure.in per-host parts come in here.
 
-## end of per-target part
+## end of per-host part.
 
 
        for target in ${targets} ; do
@@ -331,18 +341,22 @@ files="config/ho-${host}.h config/tc-${cpu_type}.c \
        config/atof-${atof}.c"
 
 links="host.h targ-cpu.c targ-cpu.h targ-env.h obj-format.h obj-format.c atof-targ.c"
-## end of per-target part
+## end of per-target part.
 
                # Temporarily, we support only direct subdir builds.
                hostsubdir=Host-${host}
                targetsubdir=Target-${target}
 
                if [ -n "${removing}" ] ; then
-                       if [ -d "${hostsubdir}/${targetsubdir}" ] ; then
-                               rm -rf ${hostsubdir}/${targetsubdir}
+                       if [ -n "${forcesubdirs}" ] ; then
+                               if [ -d "${hostsubdir}" ] ; then
+                                       rm -rf ${hostsubdir}/${targetsubdir}
 
-                               if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
-                                       rm -rf ${hostsubdir}
+                                       if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
+                                               rm -rf ${hostsubdir}
+                                       fi
+                               else
+                                       echo Warning: no `pwd`/${hostsubdir} to remove.
                                fi
                        else
                                rm -f Makefile config.status ${links}
@@ -381,11 +395,12 @@ links="host.h targ-cpu.c targ-cpu.h targ-env.h obj-format.h obj-format.c atof-ta
 
                        if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
                                if [ -z "${srcdirdefaulted}" ] ; then
-                                 echo "${progname}: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
                                else
-                                 echo "${progname}: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
                                fi
 
+                               echo \(At least ${srctrigger} is missing.\) 1>&2
                                exit 1
                        fi
 
@@ -529,8 +544,22 @@ links="host.h targ-cpu.c targ-cpu.h targ-env.h obj-format.h obj-format.c atof-ta
                        originaldir=`pwd`
                        cd ${srcdir}
                fi
-       done
-done
+       done # for each target
+
+#      # Now build a Makefile for this host.
+#      if [ -n "${forcesubdirs}" ] ; then
+#              cd ${hostsubdir}
+#              cat > GNUmakefile << E!O!F
+## Makefile generated by configure for host ${host}.
+#
+#%:
+#      for i in ${targets} ; do \
+#              $(MAKE) -C Target-\$i \$@
+#
+#all clean stage1 stage2 stage3 stage4etags tags TAGS
+#E!O!F
+#      fi
+done # for each host
 
 # If there are subdirectories, then recurse. 
 
@@ -606,8 +635,23 @@ exit 0
 
 #
 # $Log$
-# Revision 1.8  1991/04/17 01:40:45  rich
-# Fixed a problem with host dependent parts.
+# Revision 1.9  1991/05/14 14:14:08  rich
+# see devo/configure 1.11
+#
+# Revision 1.10  1991/05/04  00:58:38  rich
+# Fix program name bug.
+#
+# Revision 1.9  1991/05/03  19:14:18  rich
+# Changed getopt to libiberty, commented out an aborted attempt at host
+# level Makefiles because it caused errors on +rm, add a warning for
+# directories expected to be removed on +rm but that don't exist.
+#
+# Revision 1.8  1991/04/24  16:50:59  rich
+# Three staging checkpoint.
+#
+# Revision 1.7  1991/04/17  01:34:47  rich
+# Added getopt for binutils, fixed problem with host dependancies in
+# configure.template.
 #
 # Revision 1.6  1991/04/16  00:18:44  rich
 # Now handles multiple hosts and targets.
index 44a6967..49fc13f 100755 (executable)
@@ -44,8 +44,11 @@ symbolic_link='ln -s'
 #hard_link="echo ln"
 #symbolic_link="echo ln -s"
 
+progname=$0
+
 # clear some things potentially inherited from environment.
 ansi=
+defaulttargets=
 destdir=
 fatal=
 hostsubdir=
@@ -68,7 +71,8 @@ do
        -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
                destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
                ;;
-       -forcesubdirs | +forcesubdirs | +f)
+       -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
+       | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
                forcesubdirs=${arg}
                ;;
        -languages=* | +languages=* | +language=* | +languag=* \
@@ -174,13 +178,11 @@ fi
 # script appropriate for this directory.  For more information, check
 # any existing configure script.
 
-configdirs="bfd binutils ld gas gnulib gcc clib"
+configdirs="libiberty bfd binutils ld gas gcc gnulib clib"
 srctrigger=README.configure
 srcname="gnu development package"
 
-# per-host:
-
-## end of common part
+## end of common part.
 
 # are we rebuilding config itself?
 if [ -n "${template}" ] ; then
@@ -189,12 +191,17 @@ if [ -n "${template}" ] ; then
                exit 1
        fi
 
-       mv configure configure.old
-       echo "#!/bin/sh" > configure
-       echo "# Please do not edit this file.  It is generated automatically from" >> configure
-       echo "# configure.in and a configure template." >> configure
-       echo "configdirs=" >> configure
-       echo >> configure
+# prep the template
+       sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
+#### configure.in common parts come in here.\
+## end of common part.' \
+       -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
+#### configure.in per-host parts come in here.\
+## end of per-host part.' \
+       -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
+#### configure.in per-target parts come in here.\
+## end of per-target part.' \
+       < ${template} > template.new
 
        if [ -r configure.in ] ; then
                if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
@@ -207,21 +214,27 @@ if [ -n "${template}" ] ; then
                        exit 1
                fi
 
-               sed -e '/^# per\-target:/,$d' configure.in > configure.com
+               # split configure.in into common, per-host, and per-target parts
+               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 '1,/^# per\-target:/d' configure.in > configure.tgt
 
-               sed -e '/^#### configure.in common parts/  r configure.com' \
-                       -e '/^##### /  r configure.tgt' \
-                       ${template} >> configure
+               # and insert them
+               sed -e '/^#### configure.in common parts come in here.$/  r configure.com' \
+                       -e '/^#### configure.in per\-host parts come in here.$/  r configure.hst' \
+                       -e '/^#### configure.in per\-target parts come in here.$/  r configure.tgt' \
+                       template.new > configure.new
 
-               rm -f configure.top configure.bot
+               rm -f configure.com configure.tgt configure.hst
        else
                echo Warning: no configure.in in `pwd`
                cat ${template} >> configure
        fi
 
-       chmod a+x configure
-       rm configure.old
+       chmod a+x configure.new
+       rm template.new
+#      mv configure configure.old
+       mv configure.new configure
        echo Rebuilt configure in `pwd`
 
        if [ -z "${norecurse}" ] ; then
@@ -257,12 +270,14 @@ fi
 
 for host in ${hosts} ; do
        # Default other arg
-       if [ -z "${targets}" ] ; then
+       if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
                targets=${host}
+               defaulttargets=true
        fi
 
 #### configure.in per-host parts come in here.
-## end of per-target part
+
+## end of per-host part.
 
 
        for target in ${targets} ; do
@@ -272,18 +287,23 @@ for host in ${hosts} ; do
                fi
 
 #### configure.in per-target parts come in here.
-## end of per-target part
+
+## end of per-target part.
 
                # Temporarily, we support only direct subdir builds.
                hostsubdir=Host-${host}
                targetsubdir=Target-${target}
 
                if [ -n "${removing}" ] ; then
-                       if [ -d "${hostsubdir}/${targetsubdir}" ] ; then
-                               rm -rf ${hostsubdir}/${targetsubdir}
+                       if [ -n "${forcesubdirs}" ] ; then
+                               if [ -d "${hostsubdir}" ] ; then
+                                       rm -rf ${hostsubdir}/${targetsubdir}
 
-                               if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
-                                       rm -rf ${hostsubdir}
+                                       if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
+                                               rm -rf ${hostsubdir}
+                                       fi
+                               else
+                                       echo Warning: no `pwd`/${hostsubdir} to remove.
                                fi
                        else
                                rm -f Makefile config.status ${links}
@@ -322,11 +342,12 @@ for host in ${hosts} ; do
 
                        if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
                                if [ -z "${srcdirdefaulted}" ] ; then
-                                 echo "${progname}: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
                                else
-                                 echo "${progname}: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
                                fi
 
+                               echo \(At least ${srctrigger} is missing.\) 1>&2
                                exit 1
                        fi
 
@@ -470,8 +491,22 @@ for host in ${hosts} ; do
                        originaldir=`pwd`
                        cd ${srcdir}
                fi
-       done
-done
+       done # for each target
+
+#      # Now build a Makefile for this host.
+#      if [ -n "${forcesubdirs}" ] ; then
+#              cd ${hostsubdir}
+#              cat > GNUmakefile << E!O!F
+## Makefile generated by configure for host ${host}.
+#
+#%:
+#      for i in ${targets} ; do \
+#              $(MAKE) -C Target-\$i \$@
+#
+#all clean stage1 stage2 stage3 stage4etags tags TAGS
+#E!O!F
+#      fi
+done # for each host
 
 # If there are subdirectories, then recurse. 
 
@@ -483,44 +518,92 @@ for configdir in ${configdirs} ; do
        specifics=
        commons=
 
-       for target in ${targets} ; do
-               # check for target specific dir override
-               if [ -d ${configdir}.${target} ] ; then
-                       newspecifics="${specifics} ${target}"
-                       specifics=${newspecifics}
-               else
-                       newcommons="${commons} +target=${target}"
-                       commons=${newcommons}
-               fi
+       if [ -n "${defaulttargets}" ] ; then
+               for host in ${hosts} ; do
+                       if [ -d ${configdir}.${host} ] ; then
+                               newspecifics="${specifics} ${host}"
+                               specifics=${newspecifics}
+                       else
+                               newcommons="${commons} ${host}"
+                               commons=${newcommons}
+                       fi # if target specific
+               done # for each host
+
+               if [ -n "${commons}" ] ; then
+                       (cd ${configdir} ;
+                               ./configure ${commons} ${verbose} ${forcesubdirs} ${removing}) \
+                               | sed 's/^/     /'
+               fi # if any common hosts
+
+               if [ -n "${specifics}" ] ; then
+                       for host in ${specifics} ; do
+                               echo Configuring target specific directory ${configdir}.${host}...
+                               (cd ${configdir}.${host} ;
+                                       ./configure ${host} ${verbose} ${forcesubdirs} ${removing}) \
+                                       | sed 's/^/     /'
+                       done # for host in specifics
+               fi # if there are any specifics
+       else
 
-       done
+               for target in ${targets} ; do
+                       if [ -d ${configdir}.${target} ] ; then
+                               newspecifics="${specifics} ${target}"
+                               specifics=${newspecifics}
+                       else
+                               newcommons="${commons} +target=${target}"
+                               commons=${newcommons}
+                       fi
 
-       if [ -n "${verbose}" ] ; then
-               echo "  "commons=\"${commons}\"
-               echo "  "specifics=\"${specifics}\"
-       fi
+               done # check for target specific dir override
 
-       if [ -n "${commons}" ] ; then
-               (cd ${configdir} ;
-                       ./configure ${host} ${verbose} ${forcesubdirs} ${removing} ${commons}) \
-                       | sed 's/^/     /'
-       fi
+               if [ -n "${verbose}" ] ; then
+                       echo "  "commons=\"${commons}\"
+                       echo "  "specifics=\"${specifics}\"
+               fi # if verbose
 
-       if [ -n "${specifics}" ] ; then
-               for target in ${specifics} ; do
-                       echo Configuring target specific directory ${configdir}.${target}...
-                       (cd ${configdir}.${target} ;
-                               ./configure ${host} ${verbose} ${forcesubdirs} ${removing} "+target=${target}") \
+               if [ -n "${commons}" ] ; then
+                       (cd ${configdir} ;
+                               ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons}) \
                                | sed 's/^/     /'
-               done
-       fi
+               fi # if any commons
+
+               if [ -n "${specifics}" ] ; then
+                       for target in ${specifics} ; do
+                               echo Configuring target specific directory ${configdir}.${target}...
+                               (cd ${configdir}.${target} ;
+                                       ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}") \
+                                       | sed 's/^/     /'
+                       done
+               fi # if any specifics
+       fi # not default targets
 done
 
 exit 0
 
 #
 # $Log$
-# Revision 1.2  1991/04/15 23:46:48  rich
+# Revision 1.3  1991/05/14 14:14:40  rich
+# see devo/configure 1.11
+#
+# Revision 1.10  1991/05/04  00:58:38  rich
+# Fix program name bug.
+#
+# Revision 1.9  1991/05/03  19:14:18  rich
+# Changed getopt to libiberty, commented out an aborted attempt at host
+# level Makefiles because it caused errors on +rm, add a warning for
+# directories expected to be removed on +rm but that don't exist.
+#
+# Revision 1.8  1991/04/24  16:50:59  rich
+# Three staging checkpoint.
+#
+# Revision 1.7  1991/04/17  01:34:47  rich
+# Added getopt for binutils, fixed problem with host dependancies in
+# configure.template.
+#
+# Revision 1.6  1991/04/16  00:18:44  rich
+# Now handles multiple hosts and targets.
+#
+# Revision 1.5  1991/04/15  23:43:44  rich
 # Now handles multiple hosts and targets.
 #
 # Revision 1.4  1991/04/13  02:11:03  rich
index 5a938b5..75d5755 100755 (executable)
@@ -44,6 +44,8 @@ symbolic_link='ln -s'
 #hard_link="echo ln"
 #symbolic_link="echo ln -s"
 
+progname=$0
+
 # clear some things potentially inherited from environment.
 ansi=
 defaulttargets=
@@ -69,7 +71,8 @@ do
        -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
                destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
                ;;
-       -forcesubdirs | +forcesubdirs | +f)
+       -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
+       | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
                forcesubdirs=${arg}
                ;;
        -languages=* | +languages=* | +language=* | +languag=* \
@@ -179,7 +182,7 @@ configdirs=
 srctrigger=ldversion.c
 srcname="linker"
 
-## end of common part
+## end of common part.
 
 # are we rebuilding config itself?
 if [ -n "${template}" ] ; then
@@ -188,12 +191,17 @@ if [ -n "${template}" ] ; then
                exit 1
        fi
 
-       mv configure configure.old
-       echo "#!/bin/sh" > configure
-       echo "# Please do not edit this file.  It is generated automatically from" >> configure
-       echo "# configure.in and a configure template." >> configure
-       echo "configdirs=" >> configure
-       echo >> configure
+# prep the template
+       sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
+#### configure.in common parts come in here.\
+## end of common part.' \
+       -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
+#### configure.in per-host parts come in here.\
+## end of per-host part.' \
+       -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
+#### configure.in per-target parts come in here.\
+## end of per-target part.' \
+       < ${template} > template.new
 
        if [ -r configure.in ] ; then
                if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
@@ -212,10 +220,10 @@ if [ -n "${template}" ] ; then
                sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
 
                # and insert them
-               sed -e '/^#### configure.in common part/  r configure.com' \
-                       -e '/^#### configure.in per\-host part/  r configure.hst' \
-                       -e '/^#### configure.in per\-target part/  r configure.tgt' \
-                       ${template} >> configure
+               sed -e '/^#### configure.in common parts come in here.$/  r configure.com' \
+                       -e '/^#### configure.in per\-host parts come in here.$/  r configure.hst' \
+                       -e '/^#### configure.in per\-target parts come in here.$/  r configure.tgt' \
+                       template.new > configure.new
 
                rm -f configure.com configure.tgt configure.hst
        else
@@ -223,8 +231,10 @@ if [ -n "${template}" ] ; then
                cat ${template} >> configure
        fi
 
-       chmod a+x configure
-       rm configure.old
+       chmod a+x configure.new
+       rm template.new
+#      mv configure configure.old
+       mv configure.new configure
        echo Rebuilt configure in `pwd`
 
        if [ -z "${norecurse}" ] ; then
@@ -267,7 +277,7 @@ for host in ${hosts} ; do
 
 #### configure.in per-host parts come in here.
 
-## end of per-target part
+## end of per-host part.
 
 
        for target in ${targets} ; do
@@ -278,18 +288,22 @@ for host in ${hosts} ; do
 
 #### configure.in per-target parts come in here.
 
-## end of per-target part
+## end of per-target part.
 
                # Temporarily, we support only direct subdir builds.
                hostsubdir=Host-${host}
                targetsubdir=Target-${target}
 
                if [ -n "${removing}" ] ; then
-                       if [ -d "${hostsubdir}/${targetsubdir}" ] ; then
-                               rm -rf ${hostsubdir}/${targetsubdir}
+                       if [ -n "${forcesubdirs}" ] ; then
+                               if [ -d "${hostsubdir}" ] ; then
+                                       rm -rf ${hostsubdir}/${targetsubdir}
 
-                               if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
-                                       rm -rf ${hostsubdir}
+                                       if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
+                                               rm -rf ${hostsubdir}
+                                       fi
+                               else
+                                       echo Warning: no `pwd`/${hostsubdir} to remove.
                                fi
                        else
                                rm -f Makefile config.status ${links}
@@ -328,11 +342,12 @@ for host in ${hosts} ; do
 
                        if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
                                if [ -z "${srcdirdefaulted}" ] ; then
-                                 echo "${progname}: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
                                else
-                                 echo "${progname}: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
+                                       echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
                                fi
 
+                               echo \(At least ${srctrigger} is missing.\) 1>&2
                                exit 1
                        fi
 
@@ -476,8 +491,22 @@ for host in ${hosts} ; do
                        originaldir=`pwd`
                        cd ${srcdir}
                fi
-       done
-done
+       done # for each target
+
+#      # Now build a Makefile for this host.
+#      if [ -n "${forcesubdirs}" ] ; then
+#              cd ${hostsubdir}
+#              cat > GNUmakefile << E!O!F
+## Makefile generated by configure for host ${host}.
+#
+#%:
+#      for i in ${targets} ; do \
+#              $(MAKE) -C Target-\$i \$@
+#
+#all clean stage1 stage2 stage3 stage4etags tags TAGS
+#E!O!F
+#      fi
+done # for each host
 
 # If there are subdirectories, then recurse. 
 
@@ -553,8 +582,23 @@ exit 0
 
 #
 # $Log$
-# Revision 1.8  1991/04/17 01:41:32  rich
-# Fixed a problem with host dependent parts.
+# Revision 1.9  1991/05/14 14:14:30  rich
+# see devo/configure 1.11
+#
+# Revision 1.10  1991/05/04  00:58:38  rich
+# Fix program name bug.
+#
+# Revision 1.9  1991/05/03  19:14:18  rich
+# Changed getopt to libiberty, commented out an aborted attempt at host
+# level Makefiles because it caused errors on +rm, add a warning for
+# directories expected to be removed on +rm but that don't exist.
+#
+# Revision 1.8  1991/04/24  16:50:59  rich
+# Three staging checkpoint.
+#
+# Revision 1.7  1991/04/17  01:34:47  rich
+# Added getopt for binutils, fixed problem with host dependancies in
+# configure.template.
 #
 # Revision 1.6  1991/04/16  00:18:44  rich
 # Now handles multiple hosts and targets.