Preallocate waitq handle during initialization
[helenos.git] / contrib / tools / toolchain_check.sh
blobbd7446b5af44ae1cccc2f20d1cff1b2e053540c1
1 #!/bin/sh
3 [ -z "$CROSS_HELENOS_PREFIX" ] && CROSS_HELENOS_PREFIX="/usr/local/cross-helenos"
5 get_define() {
6 echo "$2" | "$1" -E -P -
9 print_error() {
10 echo " ERROR:" "$@"
13 check_define() {
14 def_value=`get_define "$1" "$2"`
15 if [ "$def_value" = "$3" ]; then
16 return 0
17 else
18 print_error "Macro $1 not defined (expected '$3', got '$def_value')."
19 return 1
23 print_version() {
24 if [ -x "$1" ]; then
25 echo " " `$1 --version 2>/dev/null | head -n 1` "@ $1"
26 else
27 print_error "$2";
28 return 1
32 for arch_path in "$CROSS_HELENOS_PREFIX"/*; do
33 arch=`echo "$arch_path" | sed -e 's#/$##' -e 's#.*/\([^/]*\)#\1#'`
34 echo "Checking $arch..."
36 gcc_path=`echo "$arch_path"/bin/*-gcc`
37 ld_path=`echo "$arch_path"/bin/*-ld`
38 objcopy_path=`echo "$arch_path"/bin/*-objcopy`
39 gdb_path=`echo "$arch_path"/bin/*-gdb`
41 print_version "$ld_path" "Linker not found!" || continue
43 print_version "$objcopy_path" "objcopy not found!" || continue
45 print_version "$gcc_path" "GCC not found!" || continue
46 check_define "$gcc_path" "__helenos__" 1 || continue
47 check_define "$gcc_path" "helenos_uarch" "$arch" || continue
49 print_version "$gdb_path" "GDB not found!" || continue
50 done