config.guess: New upstream version

2004-09-23  Kelley Cook  <kcook@gcc.gnu.org>

	* config.guess: New upstream version
	* compile, depcomp, install-sh, ylwrap: Likewise.

From-SVN: r87914
This commit is contained in:
Kelley Cook 2004-09-23 01:21:50 +00:00 committed by R. Kelley Cook
parent 5b7a26f696
commit 85f59630d8
6 changed files with 379 additions and 212 deletions

View File

@ -1,3 +1,8 @@
2004-09-23 Kelley Cook <kcook@gcc.gnu.org>
* config.guess: New upstream version
* compile, depcomp, install-sh, ylwrap: Likewise.
2004-09-19 Roger Sayle <roger@eyesopen.com> 2004-09-19 Roger Sayle <roger@eyesopen.com>
* config/mh-x86omitfp: New host makefile fragment. Add * config/mh-x86omitfp: New host makefile fragment. Add

84
compile
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Wrapper for compilers which do not understand `-c -o'. # 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>. # Written by Tom Tromey <tromey@cygnus.com>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -55,37 +55,41 @@ EOF
;; ;;
esac esac
prog=$1
shift
ofile= ofile=
cfile= cfile=
args= eat=
while test $# -gt 0; do
case "$1" in for arg
-o) do
# configure might choose to run compile as `compile cc -o foo foo.c'. if test -n "$eat"; then
# So we do something ugly here. eat=
ofile=$2 else
shift case $1 in
case "$ofile" in -o)
*.o | *.obj) # 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
args="$args -o $ofile" case $2 in
ofile= *.o | *.obj)
;; ofile=$2
esac ;;
;; *)
*.c) set x "$@" -o "$2"
cfile=$1 shift
args="$args $1" ;;
;; esac
*) ;;
args="$args $1" *.c)
;; cfile=$1
esac set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift shift
done done
@ -95,36 +99,36 @@ if test -z "$ofile" || test -z "$cfile"; then
# normal compilation that the losing compiler can handle. If no # normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also # `.c' file was seen then we are probably linking. That is also
# ok. # ok.
exec "$prog" $args exec "$@"
fi fi
# Name of file we expect compiler to create. # 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. # Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name # 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 # 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. # 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 while true; do
if mkdir $lockdir > /dev/null 2>&1; then if mkdir "$lockdir" >/dev/null 2>&1; then
break break
fi fi
sleep 1 sleep 1
done done
# FIXME: race condition here if user kills between mkdir and trap. # 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. # Run the compile.
"$prog" $args "$@"
status=$? ret=$?
if test -f "$cofile"; then if test -f "$cofile"; then
mv "$cofile" "$ofile" mv "$cofile" "$ofile"
fi fi
rmdir $lockdir rmdir "$lockdir"
exit $status exit $ret
# Local Variables: # Local Variables:
# mode: shell-script # mode: shell-script

5
config.guess vendored
View File

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
timestamp='2004-08-29' timestamp='2004-09-07'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -827,6 +827,9 @@ EOF
crisv32:Linux:*:*) crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu echo crisv32-axis-linux-gnu
exit 0 ;; exit 0 ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit 0 ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;

104
depcomp
View File

@ -1,7 +1,9 @@
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
scriptversion=2004-05-31.23
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -25,22 +27,45 @@
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v | --v*)
echo "depcomp $scriptversion"
exit 0
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2 echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1 exit 1
fi fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
@ -172,19 +197,25 @@ sgi)
aix) aix)
# The C for AIX Compiler uses -M and outputs the dependencies # The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory. # in a .u file. In older versions, this file always lives in the
# Also, the AIX compiler puts `$object:' at the start of each line; # current directory. Also, the AIX compiler puts `$object:' at the
# $object doesn't have directory information. # start of each line; $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` # Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u" tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then if test "$libtool" = yes; then
"$@" -Wc,-M "$@" -Wc,-M
else else
"$@" -M "$@" -M
fi fi
stat=$? stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then : if test $stat -eq 0; then :
else else
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
@ -192,6 +223,7 @@ aix)
fi fi
if test -f "$tmpdepfile"; then if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'. # Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to # Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'. # `$object: dependent.h' and one to simply `dependent.h:'.
@ -255,31 +287,40 @@ tru64)
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
# Dependencies are output in .lo.d with libtool 1.4.
# With libtool 1.5 they are output both in $dir.libs/$base.o.d
# and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
# latter, because the former will be cleaned when $dir.libs is
# erased.
tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d" tmpdepfile2="$dir$base.o.d"
tmpdepfile3="$dir.libs/$base.d"
"$@" -Wc,-MD "$@" -Wc,-MD
else else
tmpdepfile1="$dir$base.o.d" tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d" tmpdepfile2="$dir$base.d"
tmpdepfile3="$dir$base.d"
"$@" -MD "$@" -MD
fi fi
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -eq 0; then :
else else
rm -f "$tmpdepfile1" "$tmpdepfile2" rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat exit $stat
fi fi
if test -f "$tmpdepfile1"; then if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1" tmpdepfile="$tmpdepfile1"
else elif test -f "$tmpdepfile2"; then
tmpdepfile="$tmpdepfile2" tmpdepfile="$tmpdepfile2"
else
tmpdepfile="$tmpdepfile3"
fi fi
if test -f "$tmpdepfile"; then if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the []. # That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else else
echo "#dummy" > "$depfile" echo "#dummy" > "$depfile"
fi fi
@ -292,7 +333,7 @@ tru64)
dashmstdout) dashmstdout)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o. # always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $? "$@" || exit $?
# Remove the call to Libtool. # Remove the call to Libtool.
@ -388,7 +429,7 @@ makedepend)
cpp) cpp)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout. # always write the preprocessed file to stdout.
"$@" || exit $? "$@" || exit $?
# Remove the call to Libtool. # Remove the call to Libtool.
@ -430,7 +471,7 @@ cpp)
msvisualcpp) msvisualcpp)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o, # always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool. # because we must use -o when running libtool.
"$@" || exit $? "$@" || exit $?
IFS=" " IFS=" "
@ -470,3 +511,12 @@ none)
esac esac
exit 0 exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# install - install a program, script, or datafile # install - install a program, script, or datafile
scriptversion=2004-02-15.20 scriptversion=2004-09-10.20
# This originates from X11R5 (mit/util/scripts/install.sh), which was # This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the # later released in X11R6 (xc/config/util/install.sh) with the
@ -58,9 +58,6 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}" rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}" mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=
transform_arg=
instcmd="$mvprog"
chmodcmd="$chmodprog 0755" chmodcmd="$chmodprog 0755"
chowncmd= chowncmd=
chgrpcmd= chgrpcmd=
@ -70,23 +67,27 @@ mvcmd="$mvprog"
src= src=
dst= dst=
dir_arg= dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... SRCFILE DSTFILE usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 -d DIRECTORIES... or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. In the 1st form, copy SRCFILE to DSTFILE.
In the second, create the directory path DIR. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options: Options:
-b=TRANSFORMBASENAME -c (ignored)
-c copy source (using $cpprog) instead of moving (using $mvprog).
-d create directories instead of installing files. -d create directories instead of installing files.
-g GROUP $chgrp installed files to GROUP. -g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmod installed files to MODE. -m MODE $chmodprog installed files to MODE.
-o USER $chown installed files to USER. -o USER $chownprog installed files to USER.
-s strip installed files (using $stripprog). -s $stripprog installed files.
-t=TRANSFORM -t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit. --help display this help and exit.
--version display version info and exit. --version display version info and exit.
@ -96,12 +97,7 @@ Environment variables override the default commands:
while test -n "$1"; do while test -n "$1"; do
case $1 in case $1 in
-b=*) transformbasename=`echo $1 | sed 's/-b=//'` -c) shift
shift
continue;;
-c) instcmd=$cpprog
shift
continue;; continue;;
-d) dir_arg=true -d) dir_arg=true
@ -129,14 +125,20 @@ while test -n "$1"; do
shift shift
continue;; continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'` -t) dstarg=$2
shift shift
continue;; shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit 0;; --version) echo "$0 $scriptversion"; exit 0;;
*) # When -d is used, all remaining arguments are directories to create. *) # When -d is used, all remaining arguments are directories to create.
test -n "$dir_arg" && break # When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@. # Otherwise, the last argument is the destination. Remove it from $@.
for arg for arg
do do
@ -174,13 +176,13 @@ do
src= src=
if test -d "$dst"; then if test -d "$dst"; then
instcmd=: mkdircmd=:
chmodcmd= chmodcmd=
else else
instcmd=$mkdirprog mkdircmd=$mkdirprog
fi fi
else else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad # might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'. # if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then if test ! -f "$src" && test ! -d "$src"; then
@ -202,6 +204,10 @@ do
# If destination is a directory, append the input filename; won't work # If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored. # if double slashes aren't ignored.
if test -d "$dst"; then if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"` dst=$dst/`basename "$src"`
fi fi
fi fi
@ -229,77 +235,77 @@ do
pathcomp=$pathcomp$1 pathcomp=$pathcomp$1
shift shift
if test ! -d "$pathcomp"; then if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp" || lasterr=$? $mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several # mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This # install-sh are creating the directory concurrently. This
# is OK. # is OK.
test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } test -d "$pathcomp" || exit
fi fi
pathcomp=$pathcomp/ pathcomp=$pathcomp/
done done
fi fi
if test -n "$dir_arg"; then if test -n "$dir_arg"; then
$doit $instcmd "$dst" \ $doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else else
# If we're going to rename the final executable, determine the name now. dstfile=`basename "$dst"`
if test -z "$transformarg"; then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename \
| sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename.
test -z "$dstfile" && dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory. # Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_ dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_ rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit. # Trap to clean up those temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15 trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name # Copy the file name to the temp name.
$doit $instcmd "$src" "$dsttmp" && $doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits. # and set any options; do chmod last to preserve setuid bits.
# #
# If any of these fail, we abort the whole thing. If we want to # If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore # ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command. # errors from the above "$doit $cpprog $src $dsttmp" command.
# #
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now remove or move aside any old file at destination location. We
# try this two ways since rm can't unlink itself on some systems and
# the destination file might be busy for other reasons. In this case,
# the final cleanup might fail but the new file should still install
# successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination. # Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile" { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit; } fi || { (exit 1); exit; }
done done

259
ylwrap
View File

@ -1,6 +1,11 @@
#! /bin/sh #! /bin/sh
# ylwrap - wrapper for lex/yacc invocations. # ylwrap - wrapper for lex/yacc invocations.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
scriptversion=2004-09-10.20
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
#
# Written by Tom Tromey <tromey@cygnus.com>. # Written by Tom Tromey <tromey@cygnus.com>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -17,56 +22,81 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Usage: # As a special exception to the GNU General Public License, if you
# ylwrap PROGRAM INPUT [OUTPUT DESIRED]... -- [ARGS]... # distribute this file as part of a program that contains a
# * PROGRAM is program to run. # configuration script generated by Autoconf, you may include it under
# * INPUT is the input file # the same distribution terms that you use for the rest of that program.
# * OUTPUT is file PROG generates
# * DESIRED is file we actually want # This file is maintained in Automake, please report
# * ARGS are passed to PROG # bugs to <bug-automake@gnu.org> or send patches to
# Any number of OUTPUT,DESIRED pairs may be used. # <automake-patches@gnu.org>.
case "$1" in
'')
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
exit 1
;;
--basedir)
basedir=$2
shift 2
;;
-h|--h*)
cat <<\EOF
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
Wrapper for lex/yacc invocations, renaming files as desired.
INPUT is the input file
OUTPUT is one file PROG generates
DESIRED is the file we actually want instead of OUTPUT
PROGRAM is program to run
ARGS are passed to PROG
Any number of OUTPUT,DESIRED pairs may be used.
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v|--v*)
echo "ylwrap $scriptversion"
exit 0
;;
esac
# The input.
input="$1"
shift
case "$input" in
[\\/]* | ?:[\\/]*)
# Absolute path; do nothing.
;;
*)
# Relative path. Make it absolute.
input="`pwd`/$input"
;;
esac
pairlist=
while test "$#" -ne 0; do
if test "$1" = "--"; then
shift
break
fi
pairlist="$pairlist $1"
shift
done
# The program to run. # The program to run.
prog="$1" prog="$1"
shift shift
# Make any relative path in $prog absolute. # Make any relative path in $prog absolute.
case "$prog" in case "$prog" in
/* | [A-Za-z]:\\*) ;; [\\/]* | ?:[\\/]*) ;;
*/*) prog="`pwd`/$prog" ;; *[\\/]*) prog="`pwd`/$prog" ;;
esac esac
# The input.
input="$1"
shift
case "$input" in
/* | [A-Za-z]:\\*)
# Absolute path; do nothing.
;;
*)
# Relative path. Make it absolute. Why? Because otherwise any
# debugging info in the generated file will point to the wrong
# place. This is really gross.
input="`pwd`/$input"
;;
esac
# We don't want to use the absolute path if the input in the current
# directory like when making a tar ball.
input_base=`echo $input | sed -e 's|.*/||'`
if test -f $input_base && cmp $input_base $input >/dev/null 2>&1; then
input=$input_base
fi
pairlist=
while test "$#" -ne 0; do
if test "$1" = "--"; then
shift
break
fi
pairlist="$pairlist $1"
shift
done
# FIXME: add hostname here for parallel makes that run commands on # FIXME: add hostname here for parallel makes that run commands on
# other machines. But that might take us over the 14-char limit. # other machines. But that might take us over the 14-char limit.
dirname=ylwrap$$ dirname=ylwrap$$
@ -74,50 +104,119 @@ trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
mkdir $dirname || exit 1 mkdir $dirname || exit 1
cd $dirname cd $dirname
case "$input" in
/* | [A-Za-z]:\\*)
# Absolute path; do nothing.
;;
*)
# Make a symbolic link, hard link or hardcopy.
ln -s ../"$input" . > /dev/null 2>&1 || ln ../"$input" . > /dev/null 2>&1 || cp ../"$input" .
;;
esac
$prog ${1+"$@"} "$input"
status=$?
if test $status -eq 0; then case $# in
set X $pairlist 0) $prog "$input" ;;
shift *) $prog "$@" "$input" ;;
first=yes esac
while test "$#" -ne 0; do ret=$?
if test -f "$1"; then
# If $2 is an absolute path name, then just use that, if test $ret -eq 0; then
# otherwise prepend `../'. set X $pairlist
case "$2" in shift
/* | [A-Za-z]:\\*) target="$2";; first=yes
*) target="../$2";; # Since DOS filename conventions don't allow two dots,
esac # the DOS version of Bison writes out y_tab.c instead of y.tab.c
mv "$1" "$target" || status=$? # and y_tab.h instead of y.tab.h. Test to see if this is the case.
y_tab_nodot="no"
if test -f y_tab.c || test -f y_tab.h; then
y_tab_nodot="yes"
fi
# The directory holding the input.
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
# Quote $INPUT_DIR so we can use it in a regexp.
# FIXME: really we should care about more than `.' and `\'.
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
while test "$#" -ne 0; do
from="$1"
# Handle y_tab.c and y_tab.h output by DOS
if test $y_tab_nodot = "yes"; then
if test $from = "y.tab.c"; then
from="y_tab.c"
else else
# A missing file is only an error for the first file. This if test $from = "y.tab.h"; then
# is a blatant hack to let us support using "yacc -d". If -d from="y_tab.h"
# is not specified, we don't want an error when the header fi
# file is "missing".
if test $first = yes; then
status=1
fi
fi fi
shift fi
shift if test -f "$from"; then
first=no # If $2 is an absolute path name, then just use that,
done # otherwise prepend `../'.
case "$2" in
[\\/]* | ?:[\\/]*) target="$2";;
*) target="../$2";;
esac
# We do not want to overwrite a header file if it hasn't
# changed. This avoid useless recompilations. However the
# parser itself (the first file) should always be updated,
# because it is the destination of the .y.c rule in the
# Makefile. Divert the output of all other files to a temporary
# file so we can compare them to existing versions.
if test $first = no; then
realtarget="$target"
target="tmp-`echo $target | sed s/.*[\\/]//g`"
fi
# Edit out `#line' or `#' directives.
#
# We don't want the resulting debug information to point at
# an absolute srcdir; it is better for it to just mention the
# .y file with no path.
#
# We want to use the real output file name, not yy.lex.c for
# instance.
#
# We want the include guards to be adjusted too.
FROM=`echo "$from" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
TARGET=`echo "$2" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
# Check whether header files must be updated.
if test $first = no; then
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$2" is unchanged
rm -f "$target"
else
echo updating "$2"
mv -f "$target" "$realtarget"
fi
fi
else
# A missing file is only an error for the first file. This
# is a blatant hack to let us support using "yacc -d". If -d
# is not specified, we don't want an error when the header
# file is "missing".
if test $first = yes; then
ret=1
fi
fi
shift
shift
first=no
done
else else
status=$? ret=$?
fi fi
# Remove the directory. # Remove the directory.
cd .. cd ..
rm -rf $dirname rm -rf $dirname
exit $status exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End: