test/make/toolchain.sh

Sun, 10 Sep 2023 13:10:07 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 10 Sep 2023 13:10:07 +0200
changeset 44
1d963f2c7e91
parent 38
02b000e40e5e
child 51
5c12e9e29733
permissions
-rw-r--r--

make FeatureType.default an xs:boolean - fixes #296

0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # toolchain detection
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
6 C_COMPILERS="cc gcc clang suncc"
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
7 CPP_COMPILERS="CC g++ clang++ sunCC"
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 unset CC_ARG_CHECKED
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 unset TOOLCHAIN_DETECTION_ERROR
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 unset TOOLCHAIN_NAME
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
12 check_c_compiler()
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 {
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
14 cat > "$TEMP_DIR/test.c" << __EOF__
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 /* test file */
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #include <stdio.h>
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 int main(int argc, char **argv) {
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
18 #if defined(__clang__)
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
19 printf("clang\n");
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
20 #elif defined(__GNUC__)
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
21 printf("gcc\n");
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 #elif defined(__sun)
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
23 printf("suncc\n");
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 #else
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
25 printf("unknown\n");
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 #endif
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
27 return 0;
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 __EOF__
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
30 rm -f "$TEMP_DIR/checkcc"
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
31 $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
32
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
33 if [ $? -ne 0 ]; then
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
34 return 1
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
35 fi
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
36 return 0
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
37 }
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
38
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
39 check_cpp_compiler()
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
40 {
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
41 cat > "$TEMP_DIR/test.cpp" << __EOF__
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
42 /* test file */
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
43 #include <iostream>
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
44 int main(int argc, char **argv) {
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
45 #if defined(__clang__)
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
46 std::cout << "clang" << std::endl;
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
47 #elif defined(__GNUC__)
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
48 std::cout << "gcc" << std::endl;
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
49 #elif defined(__sun)
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
50 std::cout << "suncc" << std::endl;
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
51 #else
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
52 std::cout << "unknown" << std::endl;
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
53 #endif
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
54 return 0;
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
55 }
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
56 __EOF__
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
57 rm -f "$TEMP_DIR/checkcc"
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
58 $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
59
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
60 if [ $? -ne 0 ]; then
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
61 return 1
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
62 fi
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
63 return 0
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65
31
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
66 check_lib()
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
67 {
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
68 if [ -z "$TOOLCHAIN_LD" ]; then
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
69 return 1
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
70 fi
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
71 cat > "$TEMP_DIR/test.c" << __EOF__
31
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
72 /* libtest file */
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
73 int main(int argc, char **argv) {
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
74 return 0;
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
75 }
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
76 __EOF__
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
77 rm -f "$TEMP_DIR/checklib"
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
78 $TOOLCHAIN_LD -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null
31
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
79
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
80 if [ $? -ne 0 ]; then
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
81 return 1
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
82 fi
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
83 return 0
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
84 }
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
85
10
135c0599f883 fix toolchain script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 9
diff changeset
86 printf "detect C compiler... "
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
88 for COMP in $C_COMPILERS
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 do
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
90 check_c_compiler "$COMP"
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
91 if [ $? -ne 0 ]; then
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
92 if [ -n "$CC" ]; then
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
93 if [ "$COMP" = "$CC" ]; then
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
94 echo "$CC is not a working C compiler"
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
95 TOOLCHAIN_DETECTION_ERROR="error"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
96 break
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
97 fi
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
98 fi
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
99 else
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
100 TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
101 USE_TOOLCHAIN=$TOOLCHAIN_NAME
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
102 if [ "$COMP" = "cc" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
103 # we have found a working compiler, but in case
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
104 # the compiler is gcc or clang, we try to use
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
105 # these commands and not 'cc'
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
106 TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
107 if [ "$TOOLCHAIN_NAME" = "gcc" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
108 check_c_compiler "gcc"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
109 if [ $? -eq 0 ]; then
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
110 COMP=gcc
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
111 USE_TOOLCHAIN="gcc"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
112 fi
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
113 fi
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
114 if [ "$TOOLCHAIN_NAME" = "clang" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
115 check_c_compiler "clang"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
116 if [ $? -eq 0 ]; then
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
117 COMP=clang
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
118 USE_TOOLCHAIN="clang"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
119 fi
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
120 fi
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
121 fi
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
122
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
123 TOOLCHAIN_NAME=$USE_TOOLCHAIN
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
124 TOOLCHAIN_CC=$COMP
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
125 echo $COMP
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
126 break
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
127 fi
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 done
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
129 if [ -z "$TOOLCHAIN_CC" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
130 echo "not found"
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
131 fi
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
132
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
133 printf "detect C++ compiler... "
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
134
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
135 for COMP in $CPP_COMPILERS
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
136 do
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
137 check_cpp_compiler "$COMP"
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
138 if [ $? -ne 0 ]; then
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
139 if [ -n "$CXX" ]; then
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
140 if [ "$COMP" = "$CXX" ]; then
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
141 echo "$CXX is not a working C++ compiler"
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
142 TOOLCHAIN_DETECTION_ERROR="error"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
143 break
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
144 fi
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
145 fi
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
146 else
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
147 if [ $COMP = "CC" ]; then
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
148 # we have found a working compiler, but in case
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
149 # the compiler is gcc or clang, we try to use
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
150 # these commands and not 'CC'
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
151 TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
152 USE_TOOLCHAIN=$TOOLCHAIN_NAME
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
153 if [ "$TOOLCHAIN_NAME" = "gcc" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
154 check_cpp_compiler "g++"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
155 if [ $? -eq 0 ]; then
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
156 COMP=g++
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
157 USE_TOOLCHAIN="gcc"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
158 fi
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
159 fi
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
160 if [ "$TOOLCHAIN_NAME" = "clang" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
161 check_cpp_compiler "clang++"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
162 if [ $? -eq 0 ]; then
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
163 COMP=clang++
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
164 USE_TOOLCHAIN="clang"
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
165 fi
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
166 fi
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
167 fi
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
168
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
169 TOOLCHAIN_NAME=$USE_TOOLCHAIN
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
170 TOOLCHAIN_CXX=$COMP
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
171 echo $COMP
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
172 break
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
173 fi
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
174 done
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
175 if [ -z "$TOOLCHAIN_CXX" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
176 echo "not found"
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
177 fi
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 TOOLCHAIN_LD=$TOOLCHAIN_CC
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180
10
135c0599f883 fix toolchain script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 9
diff changeset
181 if [ -z "$TOOLCHAIN_NAME" ]; then
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
182 TOOLCHAIN_DETECTION_ERROR="error"
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 else
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
184 cat >> "$TEMP_DIR/config.mk" << __EOF__
7
686991ae6e2f add configureable make variables
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
185 # toolchain
686991ae6e2f add configureable make variables
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
186 __EOF__
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
187 echo "CC = ${TOOLCHAIN_CC}" >> "$TEMP_DIR/config.mk"
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
188 if [ -n "$TOOLCHAIN_CXX" ]; then
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
189 echo "CXX = ${TOOLCHAIN_CXX}" >> "$TEMP_DIR/config.mk"
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
190 fi
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
191 echo "LD = ${TOOLCHAIN_LD}" >> "$TEMP_DIR/config.mk"
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
192 echo >> "$TEMP_DIR/config.mk"
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
193
36
9e386a530bdf copy contents of toolchain.mk instead of including them - fixes #287
Mike Becker <universe@uap-core.de>
parents: 35
diff changeset
194 if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then
9e386a530bdf copy contents of toolchain.mk instead of including them - fixes #287
Mike Becker <universe@uap-core.de>
parents: 35
diff changeset
195 cat "make/${TOOLCHAIN_NAME}.mk" >> "$TEMP_DIR/config.mk"
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
196 else
38
02b000e40e5e fix missing initialization of CFLAGS and LDFLAGS when toolchain is unknown - fixes #288
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
197 cat >> "$TEMP_DIR/config.mk" << __EOF__
02b000e40e5e fix missing initialization of CFLAGS and LDFLAGS when toolchain is unknown - fixes #288
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
198 CFLAGS =
02b000e40e5e fix missing initialization of CFLAGS and LDFLAGS when toolchain is unknown - fixes #288
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
199 LDFLAGS =
02b000e40e5e fix missing initialization of CFLAGS and LDFLAGS when toolchain is unknown - fixes #288
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
200
02b000e40e5e fix missing initialization of CFLAGS and LDFLAGS when toolchain is unknown - fixes #288
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
201 SHLIB_CFLAGS = -fPIC
02b000e40e5e fix missing initialization of CFLAGS and LDFLAGS when toolchain is unknown - fixes #288
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
202 SHLIB_LDFLAGS = -shared
02b000e40e5e fix missing initialization of CFLAGS and LDFLAGS when toolchain is unknown - fixes #288
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
203 __EOF__
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
204 fi
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 fi

mercurial