Fixed a Python 2.5 incompatibility introduced by r6f106cb9f5c9d2ea933dda68481220c85c5...
[third_party/waf.waf15] / configure
1 #! /bin/sh
2
3 # waf configure wrapper
4
5 # Fancy colors used to beautify the output a bit.
6 #
7 if [ "$NOCOLOR" ] ; then
8     NORMAL=""
9     BOLD=""
10     RED=""
11     YELLOW=""
12     GREEN=""
13 else
14     NORMAL='\033[0m'
15     BOLD='\033[01;1m'
16     RED='\033[01;91m'
17     YELLOW='\033[00;33m'
18     GREEN='\033[01;92m'
19 fi
20
21 EXIT_SUCCESS=0
22 EXIT_FAILURE=1
23 EXIT_ERROR=2
24 EXIT_BUG=10
25
26 CUR_DIR=$PWD
27
28 #possible relative path
29 WORKINGDIR=`dirname $0`
30 cd $WORKINGDIR
31 #abs path
32 WORKINGDIR=`pwd`
33 cd $CUR_DIR
34
35
36 # Checks for WAF. Honours $WAF if set. Stores path to 'waf' in $WAF.
37 # Requires that $PYTHON is set.
38 #
39 checkWAF()
40 {
41         printf "Checking for WAF\t\t\t:  "
42         #installed miniwaf in sourcedir
43         if [ -z "$WAF" ] ; then
44             if [ -f "${WORKINGDIR}/waf" ] ; then
45                 WAF="${WORKINGDIR}/waf"
46                 if [ ! -x "$WAF" ] ; then
47                     chmod +x $WAF
48                 fi
49             fi
50         fi
51         if [ -z "$WAF" ] ; then
52             if [ -f "${WORKINGDIR}/waf-light" ] ; then
53                 ${WORKINGDIR}/waf-light --make-waf
54                 WAF="${WORKINGDIR}/waf"
55             fi
56         fi
57         #global installed waf with waf->waf.py link
58         if [ -z "$WAF" ] ; then
59             WAF=`which waf 2>/dev/null`
60         fi
61         # neither waf nor miniwaf could be found
62         if [ ! -x "$WAF" ] ; then
63             printf "$RED""not found""$NORMAL""\n"
64             echo "Go to http://code.google.com/p/waf/"
65             echo "and download a waf version"
66             exit $EXIT_FAILURE
67         else
68           printf "$GREEN""$WAF""$NORMAL""\n"
69         fi
70 }
71
72 # Generates a Makefile. Requires that $WAF is set.
73 #
74 generateMakefile()
75 {
76         cat > Makefile << EOF
77 #!/usr/bin/make -f
78 # Waf Makefile wrapper
79 WAF_HOME=$CUR_DIR
80
81 all:
82 #@$WAF build
83
84 all-debug:
85         @$WAF -v build
86
87 all-progress:
88         @$WAF -p build
89
90 install:
91         $WAF install --yes;
92
93 uninstall:
94         $WAF uninstall
95
96 clean:
97         @$WAF clean
98
99 distclean:
100         @$WAF distclean
101         @-rm -rf build
102         @-rm -f Makefile
103
104 check:
105         @$WAF check
106
107 dist:
108         @$WAF dist
109
110 .PHONY: clean dist distclean check uninstall install all
111
112 EOF
113 }
114
115 checkWAF
116 generateMakefile
117
118 "${WAF}" configure $*
119 exit $?