aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-10-04 16:22:37 +0000
committerIan Lance Taylor <ian@airs.com>1995-10-04 16:22:37 +0000
commitca2ce3b317d2a38bfacca0de136ab4d776448230 (patch)
treef504d7ff8bdcb3fa7aed0bb0c1571adbb9ce0b9b /configure
parent243b35d7a17bda288ac7dadfcbbddf1dbdf299c5 (diff)
downloadgdb-ca2ce3b317d2a38bfacca0de136ab4d776448230.zip
gdb-ca2ce3b317d2a38bfacca0de136ab4d776448230.tar.gz
gdb-ca2ce3b317d2a38bfacca0de136ab4d776448230.tar.bz2
* configure: If CC and CXX are not set in the environment, set
them, based on either an existing Makefile or on searching for gcc in PATH. Substitute for CC and CXX in Makefile. * configure.in: Remove libm from target_libs. Separate target_configdirs from configdirs. If CC is not set in environment, try to get it from a host Makefile fragment. Rewrite changes of configdirs to use skipdirs instead. A few minor tweaks. Take directories out of target_configdirs as they are taken out of configdirs. Remove existing Makefile files from subdirectories. Substitute for TARGET_CONFIGDIRS and CONFIG_ARGUMENTS in Makefile. * Makefile.in (TARGET_CONFIGDIRS): New variable, automatically set by configure.in. (CONFIG_ARGUMENTS): Likewise. (CONFIGURE_TARGET_MODULES): New variable. ($(DO_X)): Loop over TARGET_CONFIGDIRS as well as SUBDIRS. ($(CONFIGURE_TARGET_MODULES)): New target. (configure-libg++, configure-libio): New targets. (all-libg++): Depend upon configure-libg++. (all-libio): Depend upon configure-libio. (configure-libgloss, all-libgloss): New targets. (configure-libstdc++): New target. (all-libstdc++): Depend upon configure-libstdc++. (configure-librx, all-librx): New targets. (configure-newlib): New target. (all-newlib): Depend upon configure-newlib (configure-xiberty): New target. (all-xiberty): Depend upon configure-xiberty.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure76
1 files changed, 68 insertions, 8 deletions
diff --git a/configure b/configure
index ccfcdc9..499d0eb 100755
--- a/configure
+++ b/configure
@@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please report any problems running this configure script to
# configure@cygnus.com
@@ -523,7 +523,7 @@ tmpfile=${TMPDIR}/cONf$$
# is at the end of the script; these actions are duplicated there, minus
# the "exit 1". Don't use "exit 0" anywhere after this without resetting the
# trap handler, or you'll lose.
-trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
+trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
# split ${srcdir}/configure.in into common, per-host, per-target,
# and post-target parts. Post-target is optional.
@@ -551,7 +551,15 @@ case "${srctrigger}" in
esac
case "${build_alias}" in
-"") ;;
+"")
+ if result=`${config_shell} ${configsub} ${host_alias}` ; then
+ build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+ build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+ build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+ build=${host_cpu}-${host_vendor}-${host_os}
+ build_alias=${host_alias}
+ fi
+ ;;
*)
if result=`${config_shell} ${configsub} ${build_alias}` ; then
buildopt="--build=${build_alias}"
@@ -639,6 +647,45 @@ if [ "${program_prefix}" != "" ] ; then
program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
fi
+# If CC and CXX are not set in the environment, and the Makefile
+# exists, try to extract them from it. This is to handle running
+# ./config.status by hand.
+if [ -z "${CC}" -a -r Makefile ]; then
+ sed -n -e ':loop
+/\\$/ N
+/\\$/ b loop
+s/\\\n//g
+/^CC[ ]*=/ s/CC[ ]*=\(.*\)/\1/p' < Makefile > Makefile.cc
+ CC=`tail -1 Makefile.cc`
+ rm -f Makefile.cc
+fi
+
+if [ -z "${CXX}" -a -r Makefile ]; then
+ sed -n -e ':loop
+/\\$/ N
+/\\$/ b loop
+s/\\\n//g
+/^CXX[ ]*=/ s/CXX[ ]*=\(.*\)/\1/p' < Makefile > Makefile.cc
+ CXX=`tail -1 Makefile.cc`
+ rm -f Makefile.cc
+fi
+
+# If CC is still not set, try to get gcc.
+if [ -z "${CC}" ]; then
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/gcc; then
+ CC="gcc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ CC=${CC-cc}
+fi
+
+CXX=${CXX-"g++ -O"}
+
for subdir in . ${subdirs} ; do
# ${subdir} is relative path from . to the directory we're currently
@@ -876,11 +923,6 @@ EOF
echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
fi
- # make sure that some sort of reasonable default exists for these
- # two variables
- CXX=${CXX-"g++ -O"}
- CC=${CC-cc}
-
# reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
# remove any form feeds.
if [ -z "${subdirs}" ]; then
@@ -893,6 +935,24 @@ EOF
fi
sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
-e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
+ -e "/^CC[ ]*=/{
+ b chkcc
+ :contcc
+ N
+ :chkcc
+ s/\\\\$//
+ t contcc
+ s%^CC[ ]*=.*$%CC = ${CC}%
+ }" \
+ -e "/^CXX[ ]*=/{
+ b chkcxx
+ :contcxx
+ N
+ :chkcxx
+ s/\\\\$//
+ t contcxx
+ s%^CXX[ ]*=.*$%CXX = ${CXX}%
+ }" \
-e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \
-e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \
-e "s/ //" \