test/make/toolchain.sh

Sun, 15 Oct 2023 19:20:41 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 15 Oct 2023 19:20:41 +0200
changeset 90
a13789dd1cfb
parent 70
d79fc765fd4a
child 101
7f40964bf1e9
permissions
-rw-r--r--

add --init and --update options

fixes #308
fixes #307

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
52
afcb57893858 major evolution of configure template - fixes #283
Mike Becker <universe@uap-core.de>
parents: 51
diff changeset
6 C_COMPILERS="gcc clang suncc cc"
afcb57893858 major evolution of configure template - fixes #283
Mike Becker <universe@uap-core.de>
parents: 51
diff changeset
7 CPP_COMPILERS="g++ clang++ sunCC CC"
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 unset TOOLCHAIN_NAME
52
afcb57893858 major evolution of configure template - fixes #283
Mike Becker <universe@uap-core.de>
parents: 51
diff changeset
9 unset TOOLCHAIN_CC
afcb57893858 major evolution of configure template - fixes #283
Mike Becker <universe@uap-core.de>
parents: 51
diff changeset
10 unset TOOLCHAIN_CXX
0
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
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
32 }
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
33
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
34 check_cpp_compiler()
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
35 {
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
36 cat > "$TEMP_DIR/test.cpp" << __EOF__
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
37 /* test file */
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
38 #include <iostream>
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
39 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
40 #if defined(__clang__)
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
41 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
42 #elif defined(__GNUC__)
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
43 std::cout << "gcc" << std::endl;
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
44 #elif defined(__sun)
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
45 std::cout << "suncc" << std::endl;
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
46 #else
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
47 std::cout << "cc" << std::endl;
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
48 #endif
15
971ac4f0f1df fix toolchain detection in case gcc is not available
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 13
diff changeset
49 return 0;
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
50 }
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
51 __EOF__
35
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
52 rm -f "$TEMP_DIR/checkcc"
57ea620a54ac fix several unquoted variable uses
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
53 $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
56 create_libtest_source()
31
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
57 {
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
58 # $1: filename
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
59 # $2: optional include
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
60 cat > "$TEMP_DIR/$1" << __EOF__
31
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
61 /* libtest file */
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
62 int main(int argc, char **argv) {
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
63 return 0;
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
64 }
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
65 __EOF__
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
66 if [ -n "$2" ]; then
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
67 echo "#include <$2>" >> "$TEMP_DIR/$1"
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
68 fi
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
69 }
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
71 check_c_lib()
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
72 {
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
73 # $1: libname
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
74 # $2: optional include
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
75 if [ -z "$TOOLCHAIN_CC" ]; then
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
76 return 1
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
77 fi
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
78 create_libtest_source "test.c" "$2"
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
79 rm -f "$TEMP_DIR/checklib"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
80 $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
81 }
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
82
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
83 check_cpp_lib()
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
84 {
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
85 # $1: libname
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
86 # $2: optional include
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
87 if [ -z "$TOOLCHAIN_CXX" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
88 return 1
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
89 fi
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
90 create_libtest_source "test.cpp" "$2"
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
91 rm -f "$TEMP_DIR/checklib"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
92 $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
93 }
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
94
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
95 check_lib()
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
96 {
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
97 # $1: libname
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
98 # $2: optional include
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
99 if [ -n "$TOOLCHAIN_CC" ]; then
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
100 check_c_lib "$1" "$2"
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
101 elif [ -n "$TOOLCHAIN_CXX" ]; then
70
d79fc765fd4a add optional include file for the checklib function - fixes #305
Mike Becker <universe@uap-core.de>
parents: 69
diff changeset
102 check_cpp_lib "$1" "$2"
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
103 fi
31
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
104 }
4c6060dad560 add check_lib() utility to toolchain.sh
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
105
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
106 detect_c_compiler()
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
107 {
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
108 if [ -n "$TOOLCHAIN_CC" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
109 return 0
52
afcb57893858 major evolution of configure template - fixes #283
Mike Becker <universe@uap-core.de>
parents: 51
diff changeset
110 fi
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
111 printf "detect C compiler... "
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
112 if [ -n "$CC" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
113 if check_c_compiler "$CC"; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
114 TOOLCHAIN_CC=$CC
54
2b8f40c58944 make configure script svr4 compatible again
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 52
diff changeset
115 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
116 echo "$CC"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
117 return 0
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
118 else
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
119 echo "$CC is not a working C compiler"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
120 return 1
52
afcb57893858 major evolution of configure template - fixes #283
Mike Becker <universe@uap-core.de>
parents: 51
diff changeset
121 fi
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
122 else
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
123 for COMP in $C_COMPILERS
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
124 do
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
125 if check_c_compiler "$COMP"; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
126 TOOLCHAIN_CC=$COMP
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
127 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
128 echo "$COMP"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
129 return 0
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
130 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
131 done
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
132 echo "not found"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
133 return 1
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
134 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
135 }
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
137 detect_cpp_compiler()
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
138 {
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
139 if [ -n "$TOOLCHAIN_CXX" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
140 return 0
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
141 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
142 printf "detect C++ compiler... "
52
afcb57893858 major evolution of configure template - fixes #283
Mike Becker <universe@uap-core.de>
parents: 51
diff changeset
143
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
144 if [ -n "$CXX" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
145 if check_cpp_compiler "$CXX"; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
146 TOOLCHAIN_CXX=$CXX
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
147 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
148 echo "$CXX"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
149 return 0
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
150 else
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
151 echo "$CXX is not a working C++ compiler"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
152 return 1
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
153 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
154 else
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
155 for COMP in $CPP_COMPILERS
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
156 do
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
157 if check_cpp_compiler "$COMP"; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
158 TOOLCHAIN_CXX=$COMP
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
159 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
160 echo "$COMP"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
161 return 0
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
162 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
163 done
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
164 echo "${TOOLCHAIN_CXX:-"not found"}"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
165 return 1
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
166 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
167 }
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
168
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
169 write_toolchain_defaults()
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
170 {
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
171 echo "# toolchain" >> "$1"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
172 if [ -n "$TOOLCHAIN_CC" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
173 echo "CC = ${TOOLCHAIN_CC}" >> "$1"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
174 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
175 if [ -n "$TOOLCHAIN_CXX" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
176 echo "CXX = ${TOOLCHAIN_CXX}" >> "$1"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
177 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
178 echo >> "$1"
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
179 if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
180 cat "make/${TOOLCHAIN_NAME}.mk" >> "$1"
69
96d8badffe58 use cc.mk as default if someone does not want to create a separate mk file for every toolchain
Mike Becker <universe@uap-core.de>
parents: 66
diff changeset
181 elif [ -f "make/cc.mk" ]; then
96d8badffe58 use cc.mk as default if someone does not want to create a separate mk file for every toolchain
Mike Becker <universe@uap-core.de>
parents: 66
diff changeset
182 cat "make/cc.mk" >> "$1"
66
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
183 else
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
184 echo "!!! WARNING !!! Default toolchain flags not found. Configuration might be incomplete."
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
185 fi
dc758dcd4645 add basic support for the lang element - fixes #284
Mike Becker <universe@uap-core.de>
parents: 54
diff changeset
186 }

mercurial