-
Notifications
You must be signed in to change notification settings - Fork 31
/
checkenv
executable file
·55 lines (43 loc) · 1.68 KB
/
checkenv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Analyse the environment for Microsoft C Compilers
# Care needed because spaces in directory names are a given
# (if only Unix were routinely configured that way...)
# IFS chosen to be a character illegal in Windows filenames and unlikely in Unix
SAVE_IFS=$IFS
test ()
{
IFS=*
for f in $1; do find "$f" -maxdepth 1 -iname $2 -print -quit; done 2>/dev/null | grep "." -q
if [ $? -eq 1 ] ; then
echo "Cannot find $3">&2
exit 1
fi
IFS=$SAVE_IFS
}
# Check for Windows.h in INCLUDE
test "${INCLUDE//;/*}" windows.h "Windows SDK Headers (Windows.h, etc.)"
# Check for stdlib.h in INCLUDE
test "${INCLUDE//;/*}" stdlib.h "Microsoft CRT Headers (stdlib.h, etc.)"
# Check for msvcrt.lib in LIB
test "${LIB//;/*}" msvcrt.lib "Microsoft CRT Libraries (msvcrt.lib, etc.)"
# Check for kernel32.lib in LIB
test "${LIB//;/*}" kernel32.lib "Windows SDK Libraries (kernel32.lib, etc.)"
# Check for cl.exe in PATH
test "${PATH//:/*}" cl.exe "Microsoft C Compiler (cl.exe)"
# Check for rc.exe in PATH
test "${PATH//:/*}" rc.exe "Microsoft Resource Compiler (rc.exe)"
# Check for link.exe in PATH (largely academic - should hit coreutils link if nothing else)
test "${PATH//:/*}" link.exe "Microsoft Linker (link.exe)"
PROB=
# Check that link is the Microsoft Linker
if [ "`link --version | head -1 | fgrep "Microsoft (R) Incremental Linker"`" == "" ] ; then
echo "Warning - link does not appear to be the Microsoft Linker, you may need to adjust your PATH"
PROB="Probably "
fi
echo Microsoft C Compiler environment appears to be sound
if [ -z "`cl /? 2>&1 | head -1 | fgrep x86`" ] ; then
CHAINS=msvc64
else
CHAINS=msvc
fi
echo ${PROB}OK to build using MSVC_DETECT=0 CHAINS=$CHAINS