@@ -45,6 +45,7 @@ mktempdir() {
45
45
* )
46
46
# At least Haiku, Linux and OpenBSD implementations require explicit
47
47
# trailing X'es in the template, so make it the same suffix as above.
48
+ # XXX - is MSYS2 GNU-based, so that it would be like Linux?
48
49
mktemp -d -t " ${mktempdir_prefix} .XXXXXXXX"
49
50
;;
50
51
esac
@@ -94,6 +95,16 @@ cc_version_nocache() {
94
95
;;
95
96
esac
96
97
;;
98
+ cl)
99
+ # Visual Studio's compiler doesn't have a "print the compiler
100
+ # version" option, but we can get version information by
101
+ # running it with no options, sending its standard error to
102
+ # the standard output, and throwing out the usage message;
103
+ # as we have MSYS2, we can just "head" it out.
104
+ #
105
+ # XXX - does it exit with an error?
106
+ " $CC " 2>&1 | head -2
107
+ ;;
97
108
* )
98
109
" $CC " --version || " $CC " -V || :
99
110
;;
@@ -134,6 +145,12 @@ cc_id_nocache() {
134
145
return
135
146
fi
136
147
148
+ cc_id_guessed=` echo " $cc_id_firstline " | sed ' s/^Microsoft (R) C\/C++ Optimizing Compiler Version \([0-9\.]*\) .*$/msvc-\1/' `
149
+ if [ " $cc_id_firstline " != " $cc_id_guessed " ]; then
150
+ echo " $cc_id_guessed "
151
+ return
152
+ fi
153
+
137
154
# OpenBSD default GCC:
138
155
# "gcc (GCC) 4.2.1 20070719"
139
156
# RedHat GCC:
@@ -184,6 +201,10 @@ cc_werr_cflags() {
184
201
# by default, but an additional option makes the style more consistent.
185
202
echo ' -errwarn=%all -errtags=yes'
186
203
;;
204
+ msvc-* )
205
+ # XXX - what?
206
+ echo ' '
207
+ ;;
187
208
esac
188
209
}
189
210
@@ -208,19 +229,34 @@ os_id() {
208
229
: " ${os_id_version:= `uname -v`} "
209
230
echo " ${os_id_version} .${os_id_release} "
210
231
;;
211
- Darwin|NetBSD |OpenBSD|SunOS)
232
+ Darwin|GNU |OpenBSD|SunOS)
212
233
echo " $os_id_release "
213
234
;;
214
- FreeBSD|Linux)
235
+ FreeBSD|NetBSD| Linux)
215
236
# Meaningful version is usually the substring before the first dash.
237
+ # Or the first underscore.
216
238
echo " $os_id_release " | sed ' s/^\([0-9\.]*\).*$/\1/'
217
239
;;
218
240
Haiku)
219
- # Meaningful version is the substring before the plus sign.
220
- # "hrev55181" stands for "R1/beta3".
221
- # "hrev54154" stands for "R1/beta2".
241
+ # The complete version is a substring before the first space, e.g.:
242
+ # * "hrevNNNNN" for a release without updates, e.g. hrev56578 for
243
+ # R1/beta4, also for a clean build of master branch;
244
+ # * "hrevNNNNN+MM" for a release with updates;
245
+ # * "hrevNNNNN-MM" for a build of a branch that is ahead of the master
246
+ # branch;
247
+ # * "hrevNNNNN_MMMM_KK" for a CI build of a Gerrit review;
248
+ # * something else for a build of a working copy with the changes not
249
+ # yet committed.
250
+ # With this system it is not clear which version components would be
251
+ # meaningful to relate with the build result, so let's return the
252
+ # complete version and leave any interpretation to the user.
222
253
: " ${os_id_version:= `uname -v`} "
223
- echo " $os_id_version " | sed ' s/^\(hrev.*\)+.*$/\1/'
254
+ echo " $os_id_version " | sed -E ' s/^(hrev[^ ]+).+$/\1/'
255
+ ;;
256
+ MSYS* )
257
+ # uname -s produces "MSYS_NT-{NT version?}-{build?}
258
+ # uname -r produces MSYS2 version?
259
+ echo " $os_id_version " , MSYS " $os_id_release "
224
260
;;
225
261
* )
226
262
echo ' UNKNOWN'
@@ -230,7 +266,8 @@ os_id() {
230
266
231
267
increment () {
232
268
# No arithmetic expansion in Solaris /bin/sh before 11.
233
- echo " ${1:? } + 1" | bc
269
+ # shellcheck disable=SC2003
270
+ expr " ${1:? } " + 1
234
271
}
235
272
236
273
# Display text in magenta.
@@ -254,6 +291,9 @@ print_so_deps() {
254
291
Haiku-* )
255
292
run_after_echo objdump -p " ${1:? } "
256
293
;;
294
+ MSYS* )
295
+ run_after_echo dumpbin /dependents " ${1:? } "
296
+ ;;
257
297
* )
258
298
run_after_echo ldd " ${1:? } "
259
299
;;
0 commit comments