make/toolchain.sh

Sat, 03 Dec 2022 12:27:00 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 03 Dec 2022 12:27:00 +0100
changeset 445
834351da593b
parent 260
4779a6fb4fbe
child 515
2c3fe06a9210
permissions
-rw-r--r--

improve acceptor error handling

204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # toolchain detection
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 C_COMPILERS="cc gcc clang suncc"
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 CPP_COMPILERS="CC g++ clang++ sunCC"
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 unset CC_ARG_CHECKED
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 unset TOOLCHAIN_DETECTION_ERROR
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 unset TOOLCHAIN_NAME
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 check_c_compiler()
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 {
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
14 cat > $TEMP_DIR/test.c << __EOF__
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 /* test file */
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #include <stdio.h>
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 int main(int argc, char **argv) {
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
18 #if defined(__clang__)
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
19 printf("clang\n");
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
20 #elif defined(__GNUC__)
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
21 printf("gcc\n");
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 #elif defined(__sun)
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
23 printf("suncc\n");
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 #else
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
25 printf("unknown\n");
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 #endif
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
27 return 0;
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 }
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 __EOF__
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
30 rm -f $TEMP_DIR/checkcc
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
31 $1 -o $TEMP_DIR/checkcc $CFLAGS $LDFLAGS $TEMP_DIR/test.c 2> /dev/null
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
32
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
33 if [ $? -ne 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
34 return 1
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
35 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
36 return 0
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 }
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 check_cpp_compiler()
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 {
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
41 cat > $TEMP_DIR/test.cpp << __EOF__
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 /* test file */
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 #include <iostream>
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 int main(int argc, char **argv) {
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
45 #if defined(__clang__)
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
46 std::cout << "clang" << std::endl;
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
47 #elif defined(__GNUC__)
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
48 std::cout << "gcc" << std::endl;
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 #elif defined(__sun)
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 std::cout << "suncc" << std::endl;
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 #else
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
52 std::cout << "unknown" << std::endl;
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 #endif
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
54 return 0;
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 }
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 __EOF__
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
57 rm -f $TEMP_DIR/checkcc
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
58 $1 -o $TEMP_DIR/checkcc $CXXFLAGS $LDFLAGS $TEMP_DIR/test.cpp 2> /dev/null
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
59
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
60 if [ $? -ne 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
61 return 1
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
62 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
63 return 0
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 }
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65
207
27f8a41882a7 more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 206
diff changeset
66 printf "detect C compiler... "
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 for COMP in $C_COMPILERS
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 do
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
70 check_c_compiler $COMP
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
71 if [ $? -ne 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
72 if [ ! -z "$CC" ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
73 if [ $COMP = $CC ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
74 echo "$CC is not a working C Compiler"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
75 TOOLCHAIN_DETECTION_ERROR="error"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
76 break
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
77 fi
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 fi
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
79 else
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
80 TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
81 USE_TOOLCHAIN=$TOOLCHAIN_NAME
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 if [ $COMP = "cc" ]; then
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
83 # we have found a working compiler, but in case
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
84 # the compiler is gcc or clang, we try to use
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
85 # these commands and not 'cc'
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
86 TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
87 if [ $TOOLCHAIN_NAME = "gcc" ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
88 check_c_compiler "gcc"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
89 if [ $? -eq 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
90 COMP=gcc
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
91 USE_TOOLCHAIN="gcc"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
92 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
93 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
94 if [ $TOOLCHAIN_NAME = "clang" ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
95 check_c_compiler "clang"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
96 if [ $? -eq 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
97 COMP=clang
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
98 USE_TOOLCHAIN="clang"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
99 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
100 fi
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 fi
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
103 TOOLCHAIN_NAME=$USE_TOOLCHAIN
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
104 TOOLCHAIN_CC=$COMP
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
105 echo $COMP
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
106 break
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
107 fi
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 done
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 if [ -z $TOOLCHAIN_CC ]; then
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
110 echo "not found"
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 fi
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 printf "detect C++ compiler... "
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 for COMP in $CPP_COMPILERS
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 do
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
117 check_cpp_compiler $COMP
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
118 if [ $? -ne 0 ]; then
209
a6d8181a8127 replace source with . in configure script and fix toolchain detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 207
diff changeset
119 if [ ! -z "$CXX" ]; then
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
120 if [ $COMP = $CXX ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
121 echo "$CC is not a working C++ Compiler"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
122 TOOLCHAIN_DETECTION_ERROR="error"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
123 break
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
124 fi
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 fi
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
126 else
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
127 if [ $COMP = "CC" ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
128 # we have found a working compiler, but in case
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
129 # the compiler is gcc or clang, we try to use
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
130 # these commands and not 'cc'
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
131 TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
132 USE_TOOLCHAIN=$TOOLCHAIN_NAME
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
133 if [ $TOOLCHAIN_NAME = "gcc" ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
134 check_cpp_compiler "g++"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
135 if [ $? -eq 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
136 COMP=g++
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
137 USE_TOOLCHAIN="gcc"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
138 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
139 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
140 if [ $TOOLCHAIN_NAME = "clang" ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
141 check_cpp_compiler "clang++"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
142 if [ $? -eq 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
143 COMP=clang++
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
144 USE_TOOLCHAIN="clang"
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
145 fi
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
146 fi
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 fi
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
149 TOOLCHAIN_NAME=$USE_TOOLCHAIN
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
150 TOOLCHAIN_CXX=$COMP
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
151 echo $COMP
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
152 break
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
153 fi
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 done
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 if [ -z $TOOLCHAIN_CXX ]; then
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
156 echo "not found"
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 fi
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 TOOLCHAIN_LD=$TOOLCHAIN_CC
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160
207
27f8a41882a7 more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 206
diff changeset
161 if [ -z "$TOOLCHAIN_NAME" ]; then
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
162 TOOLCHAIN_DETECTION_ERROR="error"
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 else
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
164 cat >> $TEMP_DIR/config.mk << __EOF__
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 # toolchain
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 __EOF__
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 echo "CC = ${TOOLCHAIN_CC}" >> $TEMP_DIR/config.mk
206
f5bdca63bbe7 fix some incompabilities in configure
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 204
diff changeset
168 if [ ! -z "$TOOLCHAIN_CXX" ]; then
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 echo "CXX = ${TOOLCHAIN_CXX}" >> $TEMP_DIR/config.mk
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 fi
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
171 echo "LD = ${TOOLCHAIN_LD}" >> $TEMP_DIR/config.mk
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
172 echo >> $TEMP_DIR/config.mk
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
173
207
27f8a41882a7 more buildsystem fixes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 206
diff changeset
174 cat "make/${TOOLCHAIN_NAME}.mk" > /dev/null 2>&1
260
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
175 if [ $? -eq 0 ]; then
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
176 echo "include \$(BUILD_ROOT)/make/${TOOLCHAIN_NAME}.mk" >> $TEMP_DIR/config.mk
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
177 else
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
178 echo "SHLIB_CFLAGS = -fPIC" >> $TEMP_DIR/config.mk
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
179 echo "SHLIB_LDFLAGS = -shared" >> $TEMP_DIR/config.mk
4779a6fb4fbe fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 209
diff changeset
180 fi
204
e870a7c8f223 replace old build system with uwproj
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 fi

mercurial