annotate GEMBASSY-1.0.3/compile @ 1:84a17b3fad1f draft

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