detect if 'cc' is a symlink to 'gcc'
[amitay/build-farm.git] / generic.fns
1 per_run_hook
2
3 global_lock
4
5 system=`uname`
6
7 ENVCFLAGS=$CFLAGS
8 cur_compiler_sum=""
9 last_compiler_sum=""
10 for compiler in gcc cc icc; do
11
12   # arrgh, "which" gives no err code on solaris
13   path=`which $compiler`
14   if [ -x "$path" ]; then
15
16     # We do not want to build with the same compiler twice
17     # cc is a symlink to gcc on some systems
18     cur_compiler_sum="`sum $path`"
19     test x"$cur_compiler_sum" = x"" && {
20        cur_compiler_sum="$path"
21     }
22     test x"$last_compiler_sum" = x"$cur_compiler_sum" && {
23        continue;
24     }
25     last_compiler_sum="$cur_compiler_sum"
26
27     if $compiler -v 2>&1 | grep gcc.version > /dev/null; then
28        isgcc=1
29        CFLAGS="$ENVCFLAGS -Wall"
30     else
31        isgcc=0
32        CFLAGS="$ENVCFLAGS"
33     fi
34     CFLAGS_THIS_COMPILER=`eval CFLAGS_$compiler 2>/dev/null`
35     if [ $? = 0 ] ; then
36             CFLAGS="$CFLAGS_THIS_COMPILER $CFLAGS"
37     fi
38     export CFLAGS
39     test_tree samba_4_0_waf source4 $compiler
40     if [ $compiler = gcc -o $isgcc = 0 ]; then
41       . common.fns
42       test_tree lorikeet-heimdal . $compiler
43
44       # only attempt samba_4_0_test if we have perl
45       if which perl > /dev/null; then
46         # use gmake if available
47         if [ "x$MAKE" = "x" ] && which gmake > /dev/null; then
48                 MAKE=gmake test_tree samba_4_0_test source $compiler
49         else
50                 test_tree samba_4_0_test source $compiler
51         fi        
52       fi
53
54       # only attempt samba-gtk if we have perl and gtk+-2.0
55       if which perl > /dev/null && which pkg-config > /dev/null && pkg-config --exists gtk+-2.0; then
56         test_tree samba-gtk . $compiler
57       fi
58
59       test_tree samba_3_current source $compiler
60       test_tree samba_3_next source $compiler
61       test_tree samba_3_master source $compiler
62
63       # by default build ppp only on SunOS or Linux systems
64       if [ "$system" = Linux -o "$system" = SunOS ]; then
65          test_tree ppp . $compiler
66       fi
67     fi
68   fi
69 done
70
71 # only attempt pidl if we have perl
72 if which perl > /dev/null; then
73   test_tree pidl . cc build test
74 fi
75
76 global_unlock