Browse code

Add missing autotools artifacts

Shawn Webb authored on 2014/03/06 04:15:09
Showing 3 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,347 @@
0
+#! /bin/sh
1
+# Wrapper for compilers which do not understand '-c -o'.
2
+
3
+scriptversion=2012-10-14.11; # UTC
4
+
5
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
6
+# Written by Tom Tromey <tromey@cygnus.com>.
7
+#
8
+# This program is free software; you can redistribute it and/or modify
9
+# it under the terms of the GNU General Public License as published by
10
+# the Free Software Foundation; either version 2, or (at your option)
11
+# any later version.
12
+#
13
+# This program is distributed in the hope that it will be useful,
14
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+# GNU General Public License for more details.
17
+#
18
+# You should have received a copy of the GNU General Public License
19
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+
21
+# As a special exception to the GNU General Public License, if you
22
+# distribute this file as part of a program that contains a
23
+# configuration script generated by Autoconf, you may include it under
24
+# the same distribution terms that you use for the rest of that program.
25
+
26
+# This file is maintained in Automake, please report
27
+# bugs to <bug-automake@gnu.org> or send patches to
28
+# <automake-patches@gnu.org>.
29
+
30
+nl='
31
+'
32
+
33
+# We need space, tab and new line, in precisely that order.  Quoting is
34
+# there to prevent tools from complaining about whitespace usage.
35
+IFS=" ""	$nl"
36
+
37
+file_conv=
38
+
39
+# func_file_conv build_file lazy
40
+# Convert a $build file to $host form and store it in $file
41
+# Currently only supports Windows hosts. If the determined conversion
42
+# type is listed in (the comma separated) LAZY, no conversion will
43
+# take place.
44
+func_file_conv ()
45
+{
46
+  file=$1
47
+  case $file in
48
+    / | /[!/]*) # absolute file, and not a UNC file
49
+      if test -z "$file_conv"; then
50
+	# lazily determine how to convert abs files
51
+	case `uname -s` in
52
+	  MINGW*)
53
+	    file_conv=mingw
54
+	    ;;
55
+	  CYGWIN*)
56
+	    file_conv=cygwin
57
+	    ;;
58
+	  *)
59
+	    file_conv=wine
60
+	    ;;
61
+	esac
62
+      fi
63
+      case $file_conv/,$2, in
64
+	*,$file_conv,*)
65
+	  ;;
66
+	mingw/*)
67
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
68
+	  ;;
69
+	cygwin/*)
70
+	  file=`cygpath -m "$file" || echo "$file"`
71
+	  ;;
72
+	wine/*)
73
+	  file=`winepath -w "$file" || echo "$file"`
74
+	  ;;
75
+      esac
76
+      ;;
77
+  esac
78
+}
79
+
80
+# func_cl_dashL linkdir
81
+# Make cl look for libraries in LINKDIR
82
+func_cl_dashL ()
83
+{
84
+  func_file_conv "$1"
85
+  if test -z "$lib_path"; then
86
+    lib_path=$file
87
+  else
88
+    lib_path="$lib_path;$file"
89
+  fi
90
+  linker_opts="$linker_opts -LIBPATH:$file"
91
+}
92
+
93
+# func_cl_dashl library
94
+# Do a library search-path lookup for cl
95
+func_cl_dashl ()
96
+{
97
+  lib=$1
98
+  found=no
99
+  save_IFS=$IFS
100
+  IFS=';'
101
+  for dir in $lib_path $LIB
102
+  do
103
+    IFS=$save_IFS
104
+    if $shared && test -f "$dir/$lib.dll.lib"; then
105
+      found=yes
106
+      lib=$dir/$lib.dll.lib
107
+      break
108
+    fi
109
+    if test -f "$dir/$lib.lib"; then
110
+      found=yes
111
+      lib=$dir/$lib.lib
112
+      break
113
+    fi
114
+    if test -f "$dir/lib$lib.a"; then
115
+      found=yes
116
+      lib=$dir/lib$lib.a
117
+      break
118
+    fi
119
+  done
120
+  IFS=$save_IFS
121
+
122
+  if test "$found" != yes; then
123
+    lib=$lib.lib
124
+  fi
125
+}
126
+
127
+# func_cl_wrapper cl arg...
128
+# Adjust compile command to suit cl
129
+func_cl_wrapper ()
130
+{
131
+  # Assume a capable shell
132
+  lib_path=
133
+  shared=:
134
+  linker_opts=
135
+  for arg
136
+  do
137
+    if test -n "$eat"; then
138
+      eat=
139
+    else
140
+      case $1 in
141
+	-o)
142
+	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
143
+	  eat=1
144
+	  case $2 in
145
+	    *.o | *.[oO][bB][jJ])
146
+	      func_file_conv "$2"
147
+	      set x "$@" -Fo"$file"
148
+	      shift
149
+	      ;;
150
+	    *)
151
+	      func_file_conv "$2"
152
+	      set x "$@" -Fe"$file"
153
+	      shift
154
+	      ;;
155
+	  esac
156
+	  ;;
157
+	-I)
158
+	  eat=1
159
+	  func_file_conv "$2" mingw
160
+	  set x "$@" -I"$file"
161
+	  shift
162
+	  ;;
163
+	-I*)
164
+	  func_file_conv "${1#-I}" mingw
165
+	  set x "$@" -I"$file"
166
+	  shift
167
+	  ;;
168
+	-l)
169
+	  eat=1
170
+	  func_cl_dashl "$2"
171
+	  set x "$@" "$lib"
172
+	  shift
173
+	  ;;
174
+	-l*)
175
+	  func_cl_dashl "${1#-l}"
176
+	  set x "$@" "$lib"
177
+	  shift
178
+	  ;;
179
+	-L)
180
+	  eat=1
181
+	  func_cl_dashL "$2"
182
+	  ;;
183
+	-L*)
184
+	  func_cl_dashL "${1#-L}"
185
+	  ;;
186
+	-static)
187
+	  shared=false
188
+	  ;;
189
+	-Wl,*)
190
+	  arg=${1#-Wl,}
191
+	  save_ifs="$IFS"; IFS=','
192
+	  for flag in $arg; do
193
+	    IFS="$save_ifs"
194
+	    linker_opts="$linker_opts $flag"
195
+	  done
196
+	  IFS="$save_ifs"
197
+	  ;;
198
+	-Xlinker)
199
+	  eat=1
200
+	  linker_opts="$linker_opts $2"
201
+	  ;;
202
+	-*)
203
+	  set x "$@" "$1"
204
+	  shift
205
+	  ;;
206
+	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
207
+	  func_file_conv "$1"
208
+	  set x "$@" -Tp"$file"
209
+	  shift
210
+	  ;;
211
+	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
212
+	  func_file_conv "$1" mingw
213
+	  set x "$@" "$file"
214
+	  shift
215
+	  ;;
216
+	*)
217
+	  set x "$@" "$1"
218
+	  shift
219
+	  ;;
220
+      esac
221
+    fi
222
+    shift
223
+  done
224
+  if test -n "$linker_opts"; then
225
+    linker_opts="-link$linker_opts"
226
+  fi
227
+  exec "$@" $linker_opts
228
+  exit 1
229
+}
230
+
231
+eat=
232
+
233
+case $1 in
234
+  '')
235
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
236
+     exit 1;
237
+     ;;
238
+  -h | --h*)
239
+    cat <<\EOF
240
+Usage: compile [--help] [--version] PROGRAM [ARGS]
241
+
242
+Wrapper for compilers which do not understand '-c -o'.
243
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
244
+arguments, and rename the output as expected.
245
+
246
+If you are trying to build a whole package this is not the
247
+right script to run: please start by reading the file 'INSTALL'.
248
+
249
+Report bugs to <bug-automake@gnu.org>.
250
+EOF
251
+    exit $?
252
+    ;;
253
+  -v | --v*)
254
+    echo "compile $scriptversion"
255
+    exit $?
256
+    ;;
257
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
258
+    func_cl_wrapper "$@"      # Doesn't return...
259
+    ;;
260
+esac
261
+
262
+ofile=
263
+cfile=
264
+
265
+for arg
266
+do
267
+  if test -n "$eat"; then
268
+    eat=
269
+  else
270
+    case $1 in
271
+      -o)
272
+	# configure might choose to run compile as 'compile cc -o foo foo.c'.
273
+	# So we strip '-o arg' only if arg is an object.
274
+	eat=1
275
+	case $2 in
276
+	  *.o | *.obj)
277
+	    ofile=$2
278
+	    ;;
279
+	  *)
280
+	    set x "$@" -o "$2"
281
+	    shift
282
+	    ;;
283
+	esac
284
+	;;
285
+      *.c)
286
+	cfile=$1
287
+	set x "$@" "$1"
288
+	shift
289
+	;;
290
+      *)
291
+	set x "$@" "$1"
292
+	shift
293
+	;;
294
+    esac
295
+  fi
296
+  shift
297
+done
298
+
299
+if test -z "$ofile" || test -z "$cfile"; then
300
+  # If no '-o' option was seen then we might have been invoked from a
301
+  # pattern rule where we don't need one.  That is ok -- this is a
302
+  # normal compilation that the losing compiler can handle.  If no
303
+  # '.c' file was seen then we are probably linking.  That is also
304
+  # ok.
305
+  exec "$@"
306
+fi
307
+
308
+# Name of file we expect compiler to create.
309
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
310
+
311
+# Create the lock directory.
312
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
313
+# that we are using for the .o file.  Also, base the name on the expected
314
+# object file name, since that is what matters with a parallel build.
315
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
316
+while true; do
317
+  if mkdir "$lockdir" >/dev/null 2>&1; then
318
+    break
319
+  fi
320
+  sleep 1
321
+done
322
+# FIXME: race condition here if user kills between mkdir and trap.
323
+trap "rmdir '$lockdir'; exit 1" 1 2 15
324
+
325
+# Run the compile.
326
+"$@"
327
+ret=$?
328
+
329
+if test -f "$cofile"; then
330
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
331
+elif test -f "${cofile}bj"; then
332
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
333
+fi
334
+
335
+rmdir "$lockdir"
336
+exit $ret
337
+
338
+# Local Variables:
339
+# mode: shell-script
340
+# sh-indentation: 2
341
+# eval: (add-hook 'write-file-hooks 'time-stamp)
342
+# time-stamp-start: "scriptversion="
343
+# time-stamp-format: "%:y-%02m-%02d.%02H"
344
+# time-stamp-time-zone: "UTC"
345
+# time-stamp-end: "; # UTC"
346
+# End:
0 347
new file mode 100755
... ...
@@ -0,0 +1,139 @@
0
+#! /bin/sh
1
+# test-driver - basic testsuite driver script.
2
+
3
+scriptversion=2013-07-13.22; # UTC
4
+
5
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
6
+#
7
+# This program is free software; you can redistribute it and/or modify
8
+# it under the terms of the GNU General Public License as published by
9
+# the Free Software Foundation; either version 2, or (at your option)
10
+# any later version.
11
+#
12
+# This program is distributed in the hope that it will be useful,
13
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+# GNU General Public License for more details.
16
+#
17
+# You should have received a copy of the GNU General Public License
18
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+
20
+# As a special exception to the GNU General Public License, if you
21
+# distribute this file as part of a program that contains a
22
+# configuration script generated by Autoconf, you may include it under
23
+# the same distribution terms that you use for the rest of that program.
24
+
25
+# This file is maintained in Automake, please report
26
+# bugs to <bug-automake@gnu.org> or send patches to
27
+# <automake-patches@gnu.org>.
28
+
29
+# Make unconditional expansion of undefined variables an error.  This
30
+# helps a lot in preventing typo-related bugs.
31
+set -u
32
+
33
+usage_error ()
34
+{
35
+  echo "$0: $*" >&2
36
+  print_usage >&2
37
+  exit 2
38
+}
39
+
40
+print_usage ()
41
+{
42
+  cat <<END
43
+Usage:
44
+  test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
45
+              [--expect-failure={yes|no}] [--color-tests={yes|no}]
46
+              [--enable-hard-errors={yes|no}] [--]
47
+              TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
48
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
49
+END
50
+}
51
+
52
+test_name= # Used for reporting.
53
+log_file=  # Where to save the output of the test script.
54
+trs_file=  # Where to save the metadata of the test run.
55
+expect_failure=no
56
+color_tests=no
57
+enable_hard_errors=yes
58
+while test $# -gt 0; do
59
+  case $1 in
60
+  --help) print_usage; exit $?;;
61
+  --version) echo "test-driver $scriptversion"; exit $?;;
62
+  --test-name) test_name=$2; shift;;
63
+  --log-file) log_file=$2; shift;;
64
+  --trs-file) trs_file=$2; shift;;
65
+  --color-tests) color_tests=$2; shift;;
66
+  --expect-failure) expect_failure=$2; shift;;
67
+  --enable-hard-errors) enable_hard_errors=$2; shift;;
68
+  --) shift; break;;
69
+  -*) usage_error "invalid option: '$1'";;
70
+   *) break;;
71
+  esac
72
+  shift
73
+done
74
+
75
+missing_opts=
76
+test x"$test_name" = x && missing_opts="$missing_opts --test-name"
77
+test x"$log_file"  = x && missing_opts="$missing_opts --log-file"
78
+test x"$trs_file"  = x && missing_opts="$missing_opts --trs-file"
79
+if test x"$missing_opts" != x; then
80
+  usage_error "the following mandatory options are missing:$missing_opts"
81
+fi
82
+
83
+if test $# -eq 0; then
84
+  usage_error "missing argument"
85
+fi
86
+
87
+if test $color_tests = yes; then
88
+  # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
89
+  red='' # Red.
90
+  grn='' # Green.
91
+  lgn='' # Light green.
92
+  blu='' # Blue.
93
+  mgn='' # Magenta.
94
+  std=''     # No color.
95
+else
96
+  red= grn= lgn= blu= mgn= std=
97
+fi
98
+
99
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
100
+trap "st=129; $do_exit" 1
101
+trap "st=130; $do_exit" 2
102
+trap "st=141; $do_exit" 13
103
+trap "st=143; $do_exit" 15
104
+
105
+# Test script is run here.
106
+"$@" >$log_file 2>&1
107
+estatus=$?
108
+if test $enable_hard_errors = no && test $estatus -eq 99; then
109
+  estatus=1
110
+fi
111
+
112
+case $estatus:$expect_failure in
113
+  0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
114
+  0:*)   col=$grn res=PASS  recheck=no  gcopy=no;;
115
+  77:*)  col=$blu res=SKIP  recheck=no  gcopy=yes;;
116
+  99:*)  col=$mgn res=ERROR recheck=yes gcopy=yes;;
117
+  *:yes) col=$lgn res=XFAIL recheck=no  gcopy=yes;;
118
+  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
119
+esac
120
+
121
+# Report outcome to console.
122
+echo "${col}${res}${std}: $test_name"
123
+
124
+# Register the test result, and other relevant metadata.
125
+echo ":test-result: $res" > $trs_file
126
+echo ":global-test-result: $res" >> $trs_file
127
+echo ":recheck: $recheck" >> $trs_file
128
+echo ":copy-in-global-log: $gcopy" >> $trs_file
129
+
130
+# Local Variables:
131
+# mode: shell-script
132
+# sh-indentation: 2
133
+# eval: (add-hook 'write-file-hooks 'time-stamp)
134
+# time-stamp-start: "scriptversion="
135
+# time-stamp-format: "%:y-%02m-%02d.%02H"
136
+# time-stamp-time-zone: "UTC"
137
+# time-stamp-end: "; # UTC"
138
+# End:
0 139
new file mode 100755
... ...
@@ -0,0 +1,347 @@
0
+#! /bin/sh
1
+# Wrapper for compilers which do not understand '-c -o'.
2
+
3
+scriptversion=2012-10-14.11; # UTC
4
+
5
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
6
+# Written by Tom Tromey <tromey@cygnus.com>.
7
+#
8
+# This program is free software; you can redistribute it and/or modify
9
+# it under the terms of the GNU General Public License as published by
10
+# the Free Software Foundation; either version 2, or (at your option)
11
+# any later version.
12
+#
13
+# This program is distributed in the hope that it will be useful,
14
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+# GNU General Public License for more details.
17
+#
18
+# You should have received a copy of the GNU General Public License
19
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+
21
+# As a special exception to the GNU General Public License, if you
22
+# distribute this file as part of a program that contains a
23
+# configuration script generated by Autoconf, you may include it under
24
+# the same distribution terms that you use for the rest of that program.
25
+
26
+# This file is maintained in Automake, please report
27
+# bugs to <bug-automake@gnu.org> or send patches to
28
+# <automake-patches@gnu.org>.
29
+
30
+nl='
31
+'
32
+
33
+# We need space, tab and new line, in precisely that order.  Quoting is
34
+# there to prevent tools from complaining about whitespace usage.
35
+IFS=" ""	$nl"
36
+
37
+file_conv=
38
+
39
+# func_file_conv build_file lazy
40
+# Convert a $build file to $host form and store it in $file
41
+# Currently only supports Windows hosts. If the determined conversion
42
+# type is listed in (the comma separated) LAZY, no conversion will
43
+# take place.
44
+func_file_conv ()
45
+{
46
+  file=$1
47
+  case $file in
48
+    / | /[!/]*) # absolute file, and not a UNC file
49
+      if test -z "$file_conv"; then
50
+	# lazily determine how to convert abs files
51
+	case `uname -s` in
52
+	  MINGW*)
53
+	    file_conv=mingw
54
+	    ;;
55
+	  CYGWIN*)
56
+	    file_conv=cygwin
57
+	    ;;
58
+	  *)
59
+	    file_conv=wine
60
+	    ;;
61
+	esac
62
+      fi
63
+      case $file_conv/,$2, in
64
+	*,$file_conv,*)
65
+	  ;;
66
+	mingw/*)
67
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
68
+	  ;;
69
+	cygwin/*)
70
+	  file=`cygpath -m "$file" || echo "$file"`
71
+	  ;;
72
+	wine/*)
73
+	  file=`winepath -w "$file" || echo "$file"`
74
+	  ;;
75
+      esac
76
+      ;;
77
+  esac
78
+}
79
+
80
+# func_cl_dashL linkdir
81
+# Make cl look for libraries in LINKDIR
82
+func_cl_dashL ()
83
+{
84
+  func_file_conv "$1"
85
+  if test -z "$lib_path"; then
86
+    lib_path=$file
87
+  else
88
+    lib_path="$lib_path;$file"
89
+  fi
90
+  linker_opts="$linker_opts -LIBPATH:$file"
91
+}
92
+
93
+# func_cl_dashl library
94
+# Do a library search-path lookup for cl
95
+func_cl_dashl ()
96
+{
97
+  lib=$1
98
+  found=no
99
+  save_IFS=$IFS
100
+  IFS=';'
101
+  for dir in $lib_path $LIB
102
+  do
103
+    IFS=$save_IFS
104
+    if $shared && test -f "$dir/$lib.dll.lib"; then
105
+      found=yes
106
+      lib=$dir/$lib.dll.lib
107
+      break
108
+    fi
109
+    if test -f "$dir/$lib.lib"; then
110
+      found=yes
111
+      lib=$dir/$lib.lib
112
+      break
113
+    fi
114
+    if test -f "$dir/lib$lib.a"; then
115
+      found=yes
116
+      lib=$dir/lib$lib.a
117
+      break
118
+    fi
119
+  done
120
+  IFS=$save_IFS
121
+
122
+  if test "$found" != yes; then
123
+    lib=$lib.lib
124
+  fi
125
+}
126
+
127
+# func_cl_wrapper cl arg...
128
+# Adjust compile command to suit cl
129
+func_cl_wrapper ()
130
+{
131
+  # Assume a capable shell
132
+  lib_path=
133
+  shared=:
134
+  linker_opts=
135
+  for arg
136
+  do
137
+    if test -n "$eat"; then
138
+      eat=
139
+    else
140
+      case $1 in
141
+	-o)
142
+	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
143
+	  eat=1
144
+	  case $2 in
145
+	    *.o | *.[oO][bB][jJ])
146
+	      func_file_conv "$2"
147
+	      set x "$@" -Fo"$file"
148
+	      shift
149
+	      ;;
150
+	    *)
151
+	      func_file_conv "$2"
152
+	      set x "$@" -Fe"$file"
153
+	      shift
154
+	      ;;
155
+	  esac
156
+	  ;;
157
+	-I)
158
+	  eat=1
159
+	  func_file_conv "$2" mingw
160
+	  set x "$@" -I"$file"
161
+	  shift
162
+	  ;;
163
+	-I*)
164
+	  func_file_conv "${1#-I}" mingw
165
+	  set x "$@" -I"$file"
166
+	  shift
167
+	  ;;
168
+	-l)
169
+	  eat=1
170
+	  func_cl_dashl "$2"
171
+	  set x "$@" "$lib"
172
+	  shift
173
+	  ;;
174
+	-l*)
175
+	  func_cl_dashl "${1#-l}"
176
+	  set x "$@" "$lib"
177
+	  shift
178
+	  ;;
179
+	-L)
180
+	  eat=1
181
+	  func_cl_dashL "$2"
182
+	  ;;
183
+	-L*)
184
+	  func_cl_dashL "${1#-L}"
185
+	  ;;
186
+	-static)
187
+	  shared=false
188
+	  ;;
189
+	-Wl,*)
190
+	  arg=${1#-Wl,}
191
+	  save_ifs="$IFS"; IFS=','
192
+	  for flag in $arg; do
193
+	    IFS="$save_ifs"
194
+	    linker_opts="$linker_opts $flag"
195
+	  done
196
+	  IFS="$save_ifs"
197
+	  ;;
198
+	-Xlinker)
199
+	  eat=1
200
+	  linker_opts="$linker_opts $2"
201
+	  ;;
202
+	-*)
203
+	  set x "$@" "$1"
204
+	  shift
205
+	  ;;
206
+	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
207
+	  func_file_conv "$1"
208
+	  set x "$@" -Tp"$file"
209
+	  shift
210
+	  ;;
211
+	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
212
+	  func_file_conv "$1" mingw
213
+	  set x "$@" "$file"
214
+	  shift
215
+	  ;;
216
+	*)
217
+	  set x "$@" "$1"
218
+	  shift
219
+	  ;;
220
+      esac
221
+    fi
222
+    shift
223
+  done
224
+  if test -n "$linker_opts"; then
225
+    linker_opts="-link$linker_opts"
226
+  fi
227
+  exec "$@" $linker_opts
228
+  exit 1
229
+}
230
+
231
+eat=
232
+
233
+case $1 in
234
+  '')
235
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
236
+     exit 1;
237
+     ;;
238
+  -h | --h*)
239
+    cat <<\EOF
240
+Usage: compile [--help] [--version] PROGRAM [ARGS]
241
+
242
+Wrapper for compilers which do not understand '-c -o'.
243
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
244
+arguments, and rename the output as expected.
245
+
246
+If you are trying to build a whole package this is not the
247
+right script to run: please start by reading the file 'INSTALL'.
248
+
249
+Report bugs to <bug-automake@gnu.org>.
250
+EOF
251
+    exit $?
252
+    ;;
253
+  -v | --v*)
254
+    echo "compile $scriptversion"
255
+    exit $?
256
+    ;;
257
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
258
+    func_cl_wrapper "$@"      # Doesn't return...
259
+    ;;
260
+esac
261
+
262
+ofile=
263
+cfile=
264
+
265
+for arg
266
+do
267
+  if test -n "$eat"; then
268
+    eat=
269
+  else
270
+    case $1 in
271
+      -o)
272
+	# configure might choose to run compile as 'compile cc -o foo foo.c'.
273
+	# So we strip '-o arg' only if arg is an object.
274
+	eat=1
275
+	case $2 in
276
+	  *.o | *.obj)
277
+	    ofile=$2
278
+	    ;;
279
+	  *)
280
+	    set x "$@" -o "$2"
281
+	    shift
282
+	    ;;
283
+	esac
284
+	;;
285
+      *.c)
286
+	cfile=$1
287
+	set x "$@" "$1"
288
+	shift
289
+	;;
290
+      *)
291
+	set x "$@" "$1"
292
+	shift
293
+	;;
294
+    esac
295
+  fi
296
+  shift
297
+done
298
+
299
+if test -z "$ofile" || test -z "$cfile"; then
300
+  # If no '-o' option was seen then we might have been invoked from a
301
+  # pattern rule where we don't need one.  That is ok -- this is a
302
+  # normal compilation that the losing compiler can handle.  If no
303
+  # '.c' file was seen then we are probably linking.  That is also
304
+  # ok.
305
+  exec "$@"
306
+fi
307
+
308
+# Name of file we expect compiler to create.
309
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
310
+
311
+# Create the lock directory.
312
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
313
+# that we are using for the .o file.  Also, base the name on the expected
314
+# object file name, since that is what matters with a parallel build.
315
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
316
+while true; do
317
+  if mkdir "$lockdir" >/dev/null 2>&1; then
318
+    break
319
+  fi
320
+  sleep 1
321
+done
322
+# FIXME: race condition here if user kills between mkdir and trap.
323
+trap "rmdir '$lockdir'; exit 1" 1 2 15
324
+
325
+# Run the compile.
326
+"$@"
327
+ret=$?
328
+
329
+if test -f "$cofile"; then
330
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
331
+elif test -f "${cofile}bj"; then
332
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
333
+fi
334
+
335
+rmdir "$lockdir"
336
+exit $ret
337
+
338
+# Local Variables:
339
+# mode: shell-script
340
+# sh-indentation: 2
341
+# eval: (add-hook 'write-file-hooks 'time-stamp)
342
+# time-stamp-start: "scriptversion="
343
+# time-stamp-format: "%:y-%02m-%02d.%02H"
344
+# time-stamp-time-zone: "UTC"
345
+# time-stamp-end: "; # UTC"
346
+# End: