@@ -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:
@@ -181,6 +198,10 @@ cc_werr_cflags() {
181
198
suncc-* )
182
199
echo ' -errwarn=%all'
183
200
;;
201
+ msvc-* )
202
+ # XXX - what?
203
+ echo ' '
204
+ ;;
184
205
esac
185
206
}
186
207
@@ -205,11 +226,12 @@ os_id() {
205
226
: " ${os_id_version:= `uname -v`} "
206
227
echo " ${os_id_version} .${os_id_release} "
207
228
;;
208
- Darwin|NetBSD |OpenBSD|SunOS)
229
+ Darwin|GNU |OpenBSD|SunOS)
209
230
echo " $os_id_release "
210
231
;;
211
- FreeBSD|Linux)
232
+ FreeBSD|NetBSD| Linux)
212
233
# Meaningful version is usually the substring before the first dash.
234
+ # Or the first underscore.
213
235
echo " $os_id_release " | sed ' s/^\([0-9\.]*\).*$/\1/'
214
236
;;
215
237
Haiku)
@@ -220,6 +242,11 @@ os_id() {
220
242
: " ${os_id_version:= `uname -v`} "
221
243
echo " $os_id_version " | sed ' s/^\(hrev.*\)+.*$/\1/'
222
244
;;
245
+ MSYS* )
246
+ # uname -s produces "MSYS_NT-{NT version?}-{build?}
247
+ # uname -r produces MSYS2 version?
248
+ echo " $os_id_version " , MSYS " $os_id_release "
249
+ ;;
223
250
* )
224
251
echo ' UNKNOWN'
225
252
;;
@@ -228,7 +255,8 @@ os_id() {
228
255
229
256
increment () {
230
257
# No arithmetic expansion in Solaris /bin/sh before 11.
231
- echo " ${1:? } + 1" | bc
258
+ # shellcheck disable=SC2003
259
+ expr " ${1:? } " + 1
232
260
}
233
261
234
262
# Display text in magenta.
@@ -252,6 +280,9 @@ print_so_deps() {
252
280
Haiku-* )
253
281
run_after_echo objdump -p " ${1:? } "
254
282
;;
283
+ MSYS* )
284
+ run_after_echo dumpbin /dependents " ${1:? } "
285
+ ;;
255
286
* )
256
287
run_after_echo ldd " ${1:? } "
257
288
;;
0 commit comments