Skip to content

Commit cdf97db

Browse files
author
jbglaw
committedNov 16, 2014
Update from upstream Automake files.
2014-11-16 Jan-Benedict Glaw <[email protected]> * compile: Sync with upstream Automake. * depcomp: Ditto. * install-sh: Ditto. * missing: Ditto. * mkinstalldirs: Ditto. * ylwrap: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217627 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 7b8d51c commit cdf97db

File tree

7 files changed

+1005
-836
lines changed

7 files changed

+1005
-836
lines changed
 

‎ChangeLog

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2014-11-16 Jan-Benedict Glaw <jbglaw@lug-owl.de>
2+
3+
* compile: Sync with upstream Automake.
4+
* depcomp: Ditto.
5+
* install-sh: Ditto.
6+
* missing: Ditto.
7+
* mkinstalldirs: Ditto.
8+
* ylwrap: Ditto.
9+
110
2014-11-16 Jan-Benedict Glaw <jbglaw@lug-owl.de>
211

312
* config.sub: Update from upstream config repo.

‎compile

+220-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#! /bin/sh
2-
# Wrapper for compilers which do not understand `-c -o'.
2+
# Wrapper for compilers which do not understand '-c -o'.
33

4-
scriptversion=2009-04-28.21; # UTC
4+
scriptversion=2012-10-14.11; # UTC
55

6-
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
7-
# Foundation, Inc.
6+
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
87
# Written by Tom Tromey <tromey@cygnus.com>.
98
#
109
# This program is free software; you can redistribute it and/or modify
@@ -29,21 +28,224 @@ scriptversion=2009-04-28.21; # UTC
2928
# bugs to <bug-automake@gnu.org> or send patches to
3029
# <automake-patches@gnu.org>.
3130

31+
nl='
32+
'
33+
34+
# We need space, tab and new line, in precisely that order. Quoting is
35+
# there to prevent tools from complaining about whitespace usage.
36+
IFS=" "" $nl"
37+
38+
file_conv=
39+
40+
# func_file_conv build_file lazy
41+
# Convert a $build file to $host form and store it in $file
42+
# Currently only supports Windows hosts. If the determined conversion
43+
# type is listed in (the comma separated) LAZY, no conversion will
44+
# take place.
45+
func_file_conv ()
46+
{
47+
file=$1
48+
case $file in
49+
/ | /[!/]*) # absolute file, and not a UNC file
50+
if test -z "$file_conv"; then
51+
# lazily determine how to convert abs files
52+
case `uname -s` in
53+
MINGW*)
54+
file_conv=mingw
55+
;;
56+
CYGWIN*)
57+
file_conv=cygwin
58+
;;
59+
*)
60+
file_conv=wine
61+
;;
62+
esac
63+
fi
64+
case $file_conv/,$2, in
65+
*,$file_conv,*)
66+
;;
67+
mingw/*)
68+
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
69+
;;
70+
cygwin/*)
71+
file=`cygpath -m "$file" || echo "$file"`
72+
;;
73+
wine/*)
74+
file=`winepath -w "$file" || echo "$file"`
75+
;;
76+
esac
77+
;;
78+
esac
79+
}
80+
81+
# func_cl_dashL linkdir
82+
# Make cl look for libraries in LINKDIR
83+
func_cl_dashL ()
84+
{
85+
func_file_conv "$1"
86+
if test -z "$lib_path"; then
87+
lib_path=$file
88+
else
89+
lib_path="$lib_path;$file"
90+
fi
91+
linker_opts="$linker_opts -LIBPATH:$file"
92+
}
93+
94+
# func_cl_dashl library
95+
# Do a library search-path lookup for cl
96+
func_cl_dashl ()
97+
{
98+
lib=$1
99+
found=no
100+
save_IFS=$IFS
101+
IFS=';'
102+
for dir in $lib_path $LIB
103+
do
104+
IFS=$save_IFS
105+
if $shared && test -f "$dir/$lib.dll.lib"; then
106+
found=yes
107+
lib=$dir/$lib.dll.lib
108+
break
109+
fi
110+
if test -f "$dir/$lib.lib"; then
111+
found=yes
112+
lib=$dir/$lib.lib
113+
break
114+
fi
115+
if test -f "$dir/lib$lib.a"; then
116+
found=yes
117+
lib=$dir/lib$lib.a
118+
break
119+
fi
120+
done
121+
IFS=$save_IFS
122+
123+
if test "$found" != yes; then
124+
lib=$lib.lib
125+
fi
126+
}
127+
128+
# func_cl_wrapper cl arg...
129+
# Adjust compile command to suit cl
130+
func_cl_wrapper ()
131+
{
132+
# Assume a capable shell
133+
lib_path=
134+
shared=:
135+
linker_opts=
136+
for arg
137+
do
138+
if test -n "$eat"; then
139+
eat=
140+
else
141+
case $1 in
142+
-o)
143+
# configure might choose to run compile as 'compile cc -o foo foo.c'.
144+
eat=1
145+
case $2 in
146+
*.o | *.[oO][bB][jJ])
147+
func_file_conv "$2"
148+
set x "$@" -Fo"$file"
149+
shift
150+
;;
151+
*)
152+
func_file_conv "$2"
153+
set x "$@" -Fe"$file"
154+
shift
155+
;;
156+
esac
157+
;;
158+
-I)
159+
eat=1
160+
func_file_conv "$2" mingw
161+
set x "$@" -I"$file"
162+
shift
163+
;;
164+
-I*)
165+
func_file_conv "${1#-I}" mingw
166+
set x "$@" -I"$file"
167+
shift
168+
;;
169+
-l)
170+
eat=1
171+
func_cl_dashl "$2"
172+
set x "$@" "$lib"
173+
shift
174+
;;
175+
-l*)
176+
func_cl_dashl "${1#-l}"
177+
set x "$@" "$lib"
178+
shift
179+
;;
180+
-L)
181+
eat=1
182+
func_cl_dashL "$2"
183+
;;
184+
-L*)
185+
func_cl_dashL "${1#-L}"
186+
;;
187+
-static)
188+
shared=false
189+
;;
190+
-Wl,*)
191+
arg=${1#-Wl,}
192+
save_ifs="$IFS"; IFS=','
193+
for flag in $arg; do
194+
IFS="$save_ifs"
195+
linker_opts="$linker_opts $flag"
196+
done
197+
IFS="$save_ifs"
198+
;;
199+
-Xlinker)
200+
eat=1
201+
linker_opts="$linker_opts $2"
202+
;;
203+
-*)
204+
set x "$@" "$1"
205+
shift
206+
;;
207+
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
208+
func_file_conv "$1"
209+
set x "$@" -Tp"$file"
210+
shift
211+
;;
212+
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
213+
func_file_conv "$1" mingw
214+
set x "$@" "$file"
215+
shift
216+
;;
217+
*)
218+
set x "$@" "$1"
219+
shift
220+
;;
221+
esac
222+
fi
223+
shift
224+
done
225+
if test -n "$linker_opts"; then
226+
linker_opts="-link$linker_opts"
227+
fi
228+
exec "$@" $linker_opts
229+
exit 1
230+
}
231+
232+
eat=
233+
32234
case $1 in
33235
'')
34-
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
236+
echo "$0: No command. Try '$0 --help' for more information." 1>&2
35237
exit 1;
36238
;;
37239
-h | --h*)
38240
cat <<\EOF
39241
Usage: compile [--help] [--version] PROGRAM [ARGS]
40242
41-
Wrapper for compilers which do not understand `-c -o'.
42-
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
243+
Wrapper for compilers which do not understand '-c -o'.
244+
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
43245
arguments, and rename the output as expected.
44246
45247
If you are trying to build a whole package this is not the
46-
right script to run: please start by reading the file `INSTALL'.
248+
right script to run: please start by reading the file 'INSTALL'.
47249
48250
Report bugs to <bug-automake@gnu.org>.
49251
EOF
@@ -53,11 +255,13 @@ EOF
53255
echo "compile $scriptversion"
54256
exit $?
55257
;;
258+
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
259+
func_cl_wrapper "$@" # Doesn't return...
260+
;;
56261
esac
57262

58263
ofile=
59264
cfile=
60-
eat=
61265

62266
for arg
63267
do
@@ -66,8 +270,8 @@ do
66270
else
67271
case $1 in
68272
-o)
69-
# configure might choose to run compile as `compile cc -o foo foo.c'.
70-
# So we strip `-o arg' only if arg is an object.
273+
# configure might choose to run compile as 'compile cc -o foo foo.c'.
274+
# So we strip '-o arg' only if arg is an object.
71275
eat=1
72276
case $2 in
73277
*.o | *.obj)
@@ -94,10 +298,10 @@ do
94298
done
95299

96300
if test -z "$ofile" || test -z "$cfile"; then
97-
# If no `-o' option was seen then we might have been invoked from a
301+
# If no '-o' option was seen then we might have been invoked from a
98302
# pattern rule where we don't need one. That is ok -- this is a
99303
# normal compilation that the losing compiler can handle. If no
100-
# `.c' file was seen then we are probably linking. That is also
304+
# '.c' file was seen then we are probably linking. That is also
101305
# ok.
102306
exec "$@"
103307
fi
@@ -106,7 +310,7 @@ fi
106310
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
107311

108312
# Create the lock directory.
109-
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
313+
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
110314
# that we are using for the .o file. Also, base the name on the expected
111315
# object file name, since that is what matters with a parallel build.
112316
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
@@ -124,9 +328,9 @@ trap "rmdir '$lockdir'; exit 1" 1 2 15
124328
ret=$?
125329

126330
if test -f "$cofile"; then
127-
mv "$cofile" "$ofile"
331+
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
128332
elif test -f "${cofile}bj"; then
129-
mv "${cofile}bj" "$ofile"
333+
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
130334
fi
131335

132336
rmdir "$lockdir"

‎depcomp

+335-209
Large diffs are not rendered by default.

‎install-sh

+183-202
Large diffs are not rendered by default.

‎missing

+150-311
Large diffs are not rendered by default.

‎mkinstalldirs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ case $dirmode in
8181
echo "mkdir -p -- $*"
8282
exec mkdir -p -- "$@"
8383
else
84-
# On NextStep and OpenStep, the `mkdir' command does not
84+
# On NextStep and OpenStep, the 'mkdir' command does not
8585
# recognize any option. It will interpret all options as
86-
# directories to create, and then abort because `.' already
86+
# directories to create, and then abort because '.' already
8787
# exists.
8888
test -d ./-p && rmdir ./-p
8989
test -d ./--version && rmdir ./--version

‎ylwrap

+106-96
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#! /bin/sh
22
# ylwrap - wrapper for lex/yacc invocations.
33

4-
scriptversion=2009-04-28.21; # UTC
4+
scriptversion=2013-01-12.17; # UTC
55

6-
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
7-
# 2007, 2009 Free Software Foundation, Inc.
6+
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
87
#
98
# Written by Tom Tromey <tromey@cygnus.com>.
109
#
@@ -30,9 +29,41 @@ scriptversion=2009-04-28.21; # UTC
3029
# bugs to <bug-automake@gnu.org> or send patches to
3130
# <automake-patches@gnu.org>.
3231

32+
get_dirname ()
33+
{
34+
case $1 in
35+
*/*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';;
36+
# Otherwise, we want the empty string (not ".").
37+
esac
38+
}
39+
40+
# guard FILE
41+
# ----------
42+
# The CPP macro used to guard inclusion of FILE.
43+
guard ()
44+
{
45+
printf '%s\n' "$1" \
46+
| sed \
47+
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
48+
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \
49+
-e 's/__*/_/g'
50+
}
51+
52+
# quote_for_sed [STRING]
53+
# ----------------------
54+
# Return STRING (or stdin) quoted to be used as a sed pattern.
55+
quote_for_sed ()
56+
{
57+
case $# in
58+
0) cat;;
59+
1) printf '%s\n' "$1";;
60+
esac \
61+
| sed -e 's|[][\\.*]|\\&|g'
62+
}
63+
3364
case "$1" in
3465
'')
35-
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
66+
echo "$0: No files given. Try '$0 --help' for more information." 1>&2
3667
exit 1
3768
;;
3869
--basedir)
@@ -65,41 +96,62 @@ esac
6596

6697

6798
# The input.
68-
input="$1"
99+
input=$1
69100
shift
70-
case "$input" in
101+
# We'll later need for a correct munging of "#line" directives.
102+
input_sub_rx=`get_dirname "$input" | quote_for_sed`
103+
case $input in
71104
[\\/]* | ?:[\\/]*)
72105
# Absolute path; do nothing.
73106
;;
74107
*)
75108
# Relative path. Make it absolute.
76-
input="`pwd`/$input"
109+
input=`pwd`/$input
77110
;;
78111
esac
112+
input_rx=`get_dirname "$input" | quote_for_sed`
113+
114+
# The parser itself, the first file, is the destination of the .y.c
115+
# rule in the Makefile.
116+
parser=$1
117+
118+
# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
119+
# instance, we rename #include "y.tab.h" into #include "parse.h"
120+
# during the conversion from y.tab.c to parse.c.
121+
sed_fix_filenames=
122+
123+
# Also rename header guards, as Bison 2.7 for instance uses its header
124+
# guard in its implementation file.
125+
sed_fix_header_guards=
79126

80-
pairlist=
81-
while test "$#" -ne 0; do
82-
if test "$1" = "--"; then
127+
while test $# -ne 0; do
128+
if test x"$1" = x"--"; then
83129
shift
84130
break
85131
fi
86-
pairlist="$pairlist $1"
132+
from=$1
87133
shift
134+
to=$1
135+
shift
136+
sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;"
137+
sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;"
88138
done
89139

90140
# The program to run.
91-
prog="$1"
141+
prog=$1
92142
shift
93143
# Make any relative path in $prog absolute.
94-
case "$prog" in
144+
case $prog in
95145
[\\/]* | ?:[\\/]*) ;;
96-
*[\\/]*) prog="`pwd`/$prog" ;;
146+
*[\\/]*) prog=`pwd`/$prog ;;
97147
esac
98148

99-
# FIXME: add hostname here for parallel makes that run commands on
100-
# other machines. But that might take us over the 14-char limit.
101149
dirname=ylwrap$$
102-
trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
150+
do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
151+
trap "ret=129; $do_exit" 1
152+
trap "ret=130; $do_exit" 2
153+
trap "ret=141; $do_exit" 13
154+
trap "ret=143; $do_exit" 15
103155
mkdir $dirname || exit 1
104156

105157
cd $dirname
@@ -111,98 +163,56 @@ esac
111163
ret=$?
112164

113165
if test $ret -eq 0; then
114-
set X $pairlist
115-
shift
116-
first=yes
117-
# Since DOS filename conventions don't allow two dots,
118-
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
119-
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
120-
y_tab_nodot="no"
121-
if test -f y_tab.c || test -f y_tab.h; then
122-
y_tab_nodot="yes"
123-
fi
124-
125-
# The directory holding the input.
126-
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
127-
# Quote $INPUT_DIR so we can use it in a regexp.
128-
# FIXME: really we should care about more than `.' and `\'.
129-
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
130-
131-
while test "$#" -ne 0; do
132-
from="$1"
133-
# Handle y_tab.c and y_tab.h output by DOS
134-
if test $y_tab_nodot = "yes"; then
135-
if test $from = "y.tab.c"; then
136-
from="y_tab.c"
137-
else
138-
if test $from = "y.tab.h"; then
139-
from="y_tab.h"
140-
fi
141-
fi
142-
fi
166+
for from in *
167+
do
168+
to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"`
143169
if test -f "$from"; then
144170
# If $2 is an absolute path name, then just use that,
145-
# otherwise prepend `../'.
146-
case "$2" in
147-
[\\/]* | ?:[\\/]*) target="$2";;
148-
*) target="../$2";;
171+
# otherwise prepend '../'.
172+
case $to in
173+
[\\/]* | ?:[\\/]*) target=$to;;
174+
*) target=../$to;;
149175
esac
150176

151-
# We do not want to overwrite a header file if it hasn't
152-
# changed. This avoid useless recompilations. However the
153-
# parser itself (the first file) should always be updated,
154-
# because it is the destination of the .y.c rule in the
155-
# Makefile. Divert the output of all other files to a temporary
156-
# file so we can compare them to existing versions.
157-
if test $first = no; then
158-
realtarget="$target"
159-
target="tmp-`echo $target | sed s/.*[\\/]//g`"
177+
# Do not overwrite unchanged header files to avoid useless
178+
# recompilations. Always update the parser itself: it is the
179+
# destination of the .y.c rule in the Makefile. Divert the
180+
# output of all other files to a temporary file so we can
181+
# compare them to existing versions.
182+
if test $from != $parser; then
183+
realtarget=$target
184+
target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'`
160185
fi
161-
# Edit out `#line' or `#' directives.
162-
#
163-
# We don't want the resulting debug information to point at
164-
# an absolute srcdir; it is better for it to just mention the
165-
# .y file with no path.
166-
#
167-
# We want to use the real output file name, not yy.lex.c for
168-
# instance.
169-
#
170-
# We want the include guards to be adjusted too.
171-
FROM=`echo "$from" | sed \
172-
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
173-
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
174-
TARGET=`echo "$2" | sed \
175-
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
176-
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
177-
178-
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
179-
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
180-
181-
# Check whether header files must be updated.
182-
if test $first = no; then
183-
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
184-
echo "$2" is unchanged
185-
rm -f "$target"
186-
else
187-
echo updating "$2"
186+
187+
# Munge "#line" or "#" directives. Don't let the resulting
188+
# debug information point at an absolute srcdir. Use the real
189+
# output file name, not yy.lex.c for instance. Adjust the
190+
# include guards too.
191+
sed -e "/^#/!b" \
192+
-e "s|$input_rx|$input_sub_rx|" \
193+
-e "$sed_fix_filenames" \
194+
-e "$sed_fix_header_guards" \
195+
"$from" >"$target" || ret=$?
196+
197+
# Check whether files must be updated.
198+
if test "$from" != "$parser"; then
199+
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
200+
echo "$to is unchanged"
201+
rm -f "$target"
202+
else
203+
echo "updating $to"
188204
mv -f "$target" "$realtarget"
189205
fi
190206
fi
191207
else
192-
# A missing file is only an error for the first file. This
193-
# is a blatant hack to let us support using "yacc -d". If -d
194-
# is not specified, we don't want an error when the header
195-
# file is "missing".
196-
if test $first = yes; then
208+
# A missing file is only an error for the parser. This is a
209+
# blatant hack to let us support using "yacc -d". If -d is not
210+
# specified, don't fail when the header file is "missing".
211+
if test "$from" = "$parser"; then
197212
ret=1
198213
fi
199214
fi
200-
shift
201-
shift
202-
first=no
203215
done
204-
else
205-
ret=$?
206216
fi
207217

208218
# Remove the directory.

0 commit comments

Comments
 (0)
Please sign in to comment.