66 #elif defined(__sun) |
66 #elif defined(__sun) |
67 std::cout << "toolchain:suncc" << std::endl; |
67 std::cout << "toolchain:suncc" << std::endl; |
68 #else |
68 #else |
69 std::cout << "toolchain:unknown" << std::endl; |
69 std::cout << "toolchain:unknown" << std::endl; |
70 #endif |
70 #endif |
71 std:cout << "wsize:" << sizeof(void*)*8 << std::endl; |
71 std::cout << "wsize:" << sizeof(void*)*8 << std::endl; |
72 return 0; |
72 return 0; |
73 } |
73 } |
74 __EOF__ |
74 __EOF__ |
75 rm -f "$TEMP_DIR/checkcc" |
75 rm -f "$TEMP_DIR/checkcc" |
76 $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null |
76 $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null |
122 if [ -n "$TOOLCHAIN_CC" ]; then |
122 if [ -n "$TOOLCHAIN_CC" ]; then |
123 check_c_lib "$1" "$2" |
123 check_c_lib "$1" "$2" |
124 elif [ -n "$TOOLCHAIN_CXX" ]; then |
124 elif [ -n "$TOOLCHAIN_CXX" ]; then |
125 check_cpp_lib "$1" "$2" |
125 check_cpp_lib "$1" "$2" |
126 fi |
126 fi |
|
127 } |
|
128 |
|
129 parse_toolchain_properties() |
|
130 { |
|
131 info_file="$1" |
|
132 TOOLCHAIN=`grep '^toolchain:' "$info_file" | tail -c +11` |
|
133 TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` |
|
134 TOOLCHAIN_WSIZE=`grep '^wsize:' "$info_file" | tail -c +7` |
127 } |
135 } |
128 |
136 |
129 detect_c_compiler() |
137 detect_c_compiler() |
130 { |
138 { |
131 if [ -n "$TOOLCHAIN_CC" ]; then |
139 if [ -n "$TOOLCHAIN_CC" ]; then |
134 printf "detect C compiler... " |
142 printf "detect C compiler... " |
135 if [ -n "$CC" ]; then |
143 if [ -n "$CC" ]; then |
136 if check_c_compiler "$CC"; then |
144 if check_c_compiler "$CC"; then |
137 TOOLCHAIN_CC=$CC |
145 TOOLCHAIN_CC=$CC |
138 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
146 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
139 TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` |
147 parse_toolchain_properties "$TEMP_DIR/checkcc_out" |
140 TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` |
|
141 TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7` |
|
142 TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` |
148 TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` |
143 echo "$CC" |
149 echo "$CC" |
144 return 0 |
150 return 0 |
145 else |
151 else |
146 echo "$CC is not a working C compiler" |
152 echo "$CC is not a working C compiler" |
150 for COMP in $C_COMPILERS |
156 for COMP in $C_COMPILERS |
151 do |
157 do |
152 if check_c_compiler "$COMP"; then |
158 if check_c_compiler "$COMP"; then |
153 TOOLCHAIN_CC=$COMP |
159 TOOLCHAIN_CC=$COMP |
154 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
160 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
155 TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` |
161 parse_toolchain_properties "$TEMP_DIR/checkcc_out" |
156 TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` |
|
157 TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7` |
|
158 TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` |
162 TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13` |
159 echo "$COMP" |
163 echo "$COMP" |
160 return 0 |
164 return 0 |
161 fi |
165 fi |
162 done |
166 done |
174 |
178 |
175 if [ -n "$CXX" ]; then |
179 if [ -n "$CXX" ]; then |
176 if check_cpp_compiler "$CXX"; then |
180 if check_cpp_compiler "$CXX"; then |
177 TOOLCHAIN_CXX=$CXX |
181 TOOLCHAIN_CXX=$CXX |
178 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
182 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
179 TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` |
183 parse_toolchain_properties "$TEMP_DIR/checkcc_out" |
180 TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` |
|
181 echo "$CXX" |
184 echo "$CXX" |
182 return 0 |
185 return 0 |
183 else |
186 else |
184 echo "$CXX is not a working C++ compiler" |
187 echo "$CXX is not a working C++ compiler" |
185 return 1 |
188 return 1 |
188 for COMP in $CPP_COMPILERS |
191 for COMP in $CPP_COMPILERS |
189 do |
192 do |
190 if check_cpp_compiler "$COMP"; then |
193 if check_cpp_compiler "$COMP"; then |
191 TOOLCHAIN_CXX=$COMP |
194 TOOLCHAIN_CXX=$COMP |
192 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
195 "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out" |
193 TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11` |
196 parse_toolchain_properties "$TEMP_DIR/checkcc_out" |
194 TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` |
|
195 echo "$COMP" |
197 echo "$COMP" |
196 return 0 |
198 return 0 |
197 fi |
199 fi |
198 done |
200 done |
199 echo "${TOOLCHAIN_CXX:-"not found"}" |
201 echo "${TOOLCHAIN_CXX:-"not found"}" |