src/main/resources/make/toolchain.sh

changeset 156
75627f46495d
parent 154
121757311440
child 157
eb788903e8c6
equal deleted inserted replaced
155:64521cedb78e 156:75627f46495d
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # toolchain detection 3 # toolchain detection
4 # 4 #
5 5
6 TAIL=tail 6 TAIL="tail"
7 if isplatform "bsd" && notisplatform "openbsd"; then 7 if isplatform "bsd" && notisplatform "openbsd"; then
8 C_COMPILERS="clang gcc cc" 8 C_COMPILERS="clang gcc cc"
9 CPP_COMPILERS="clang++ g++ CC" 9 CPP_COMPILERS="clang++ g++ CC"
10 elif isplatform "solaris"; then 10 elif isplatform "solaris"; then
11 C_COMPILERS="cc suncc gcc clang" 11 C_COMPILERS="cc suncc gcc clang"
22 unset TOOLCHAIN_CC 22 unset TOOLCHAIN_CC
23 unset TOOLCHAIN_CXX 23 unset TOOLCHAIN_CXX
24 24
25 check_c_compiler() 25 check_c_compiler()
26 { 26 {
27 command -v $1 2>&1 >/dev/null 27 if ! command -v "$1" >/dev/null 2>&1 ; then
28 if [ $? -ne 0 ]; then
29 return 1 28 return 1
30 fi 29 fi
31 cat > "$TEMP_DIR/test.c" << __EOF__ 30 cat > "$TEMP_DIR/test.c" << __EOF__
32 /* test file */ 31 /* test file */
33 #include <stdio.h> 32 #include <stdio.h>
54 $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null 53 $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null
55 } 54 }
56 55
57 check_cpp_compiler() 56 check_cpp_compiler()
58 { 57 {
59 command -v $1 2>&1 >/dev/null 58 if ! command -v "$1" >/dev/null 2>&1 ; then
60 if [ $? -ne 0 ]; then
61 return 1 59 return 1
62 fi 60 fi
63 cat > "$TEMP_DIR/test.cpp" << __EOF__ 61 cat > "$TEMP_DIR/test.cpp" << __EOF__
64 /* test file */ 62 /* test file */
65 #include <iostream> 63 #include <iostream>

mercurial