summaryrefslogtreecommitdiff
path: root/compile
diff options
context:
space:
mode:
authorkcook <kcook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-23 01:21:50 +0000
committerkcook <kcook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-23 01:21:50 +0000
commit2109ded23bb61f4f3b3eaf1081865ddc1aa2a4b2 (patch)
tree0ce5b0ac94a126a4b9e01591de64ca22f7c57216 /compile
parentab0617935af90b2fa2a91c6ad3b4d9d08b4266d9 (diff)
downloadgcc-2109ded23bb61f4f3b3eaf1081865ddc1aa2a4b2.tar.gz
2004-09-23 Kelley Cook <kcook@gcc.gnu.org>
* config.guess: New upstream version * compile, depcomp, install-sh, ylwrap: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87914 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'compile')
-rw-r--r--compile84
1 files changed, 44 insertions, 40 deletions
diff --git a/compile b/compile
index a81e000ae1a..80b645b015f 100644
--- a/compile
+++ b/compile
@@ -1,9 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
-scriptversion=2003-11-09.00
+scriptversion=2004-09-10.20
-# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -55,37 +55,41 @@ EOF
;;
esac
-
-prog=$1
-shift
-
ofile=
cfile=
-args=
-while test $# -gt 0; do
- case "$1" in
- -o)
- # configure might choose to run compile as `compile cc -o foo foo.c'.
- # So we do something ugly here.
- ofile=$2
- shift
- case "$ofile" in
- *.o | *.obj)
- ;;
- *)
- args="$args -o $ofile"
- ofile=
- ;;
- esac
- ;;
- *.c)
- cfile=$1
- args="$args $1"
- ;;
- *)
- args="$args $1"
- ;;
- esac
+eat=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as `compile cc -o foo foo.c'.
+ # So we strip `-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
shift
done
@@ -95,36 +99,36 @@ if test -z "$ofile" || test -z "$cfile"; then
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
- exec "$prog" $args
+ exec "$@"
fi
# Name of file we expect compiler to create.
-cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
-lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
- if mkdir $lockdir > /dev/null 2>&1; then
+ if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
-trap "rmdir $lockdir; exit 1" 1 2 15
+trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
-"$prog" $args
-status=$?
+"$@"
+ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
fi
-rmdir $lockdir
-exit $status
+rmdir "$lockdir"
+exit $ret
# Local Variables:
# mode: shell-script