- fix a mispell bug
[telepathy.git] / configure
blob28e8a7271f83b3fc10da84ce4c775f363cd4a74d
1 #! /bin/sh
3 # waf configure wrapper
5 # Fancy colors used to beautify the output a bit.
7 if [ "$NOCOLOR" ] ; then
8 NORMAL=""
9 BOLD=""
10 RED=""
11 YELLOW=""
12 GREEN=""
13 else
14 NORMAL="\033[0m"
15 BOLD="\033[1m"
16 RED="\033[91m"
17 YELLOW="\033[01;93m"
18 GREEN="\033[92m"
21 EXIT_SUCCESS=0
22 EXIT_FAILURE=1
23 EXIT_ERROR=2
24 EXIT_BUG=10
26 CUR_DIR=$PWD
28 #possible relative path
29 WORKINGDIR=`dirname $0`
30 cd $WORKINGDIR
31 #abs path
32 WORKINGDIR=`pwd`
33 cd $CUR_DIR
35 # Checks for Python interpreter. Honours $PYTHON if set. Stores path to
36 # interpreter in $PYTHON.
38 checkPython()
40 if [ -z "$PYTHON" ] ; then
41 PYTHON=`which python 2>/dev/null`
43 printf "Checking for Python\t\t\t: "
44 if [ ! -x "$PYTHON" ] ; then
45 printf $RED"not found!"$NORMAL"\n"
46 echo "Please make sure that the Python interpreter is available in your PATH"
47 echo "or invoke configure using the PYTHON flag, e.g."
48 echo "$ PYTHON=/usr/local/bin/python configure"
49 exit $EXIT_FAILURE
51 printf $GREEN"$PYTHON"$NORMAL"\n"
54 # Checks for WAF. Honours $WAF if set. Stores path to 'waf' in $WAF.
55 # Requires that $PYTHON is set.
57 checkWAF()
59 printf "Checking for WAF\t\t\t: "
60 #installed miniwaf in sourcedir
61 if [ -z "$WAF" ] ; then
62 if [ -f "${WORKINGDIR}/waf" ] ; then
63 WAF="${WORKINGDIR}/waf"
64 if [ ! -x "$WAF" ] ; then
65 chmod +x $WAF
69 if [ -z "$WAF" ] ; then
70 if [ -f "${WORKINGDIR}/waf-light" ] ; then
71 ${WORKINGDIR}/waf-light --make-waf
72 WAF="${WORKINGDIR}/waf"
75 #global installed waf with waf->waf.py link
76 if [ -z "$WAF" ] ; then
77 WAF=`which waf 2>/dev/null`
79 # neither waf nor miniwaf could be found
80 if [ ! -x "$WAF" ] ; then
81 printf $RED"not found"$NORMAL"\n"
82 echo "Go to http://code.google.com/p/waf/"
83 echo "and download a waf version"
84 exit $EXIT_FAILURE
85 else
86 printf $GREEN"$WAF"$NORMAL"\n"
90 # Generates a Makefile. Requires that $WAF is set.
92 generateMakefile()
94 cat > Makefile << EOF
95 #!/usr/bin/make -f
96 # Waf Makefile wrapper
97 WAF_HOME=$CUR_DIR
99 all:
100 @$WAF build
102 all-debug:
103 @$WAF -v build
105 all-progress:
106 @$WAF -p build
108 install:
109 @if test -n "\$(DESTDIR)"; then \\
110 $WAF install --destdir="\$(DESTDIR)"; \\
111 else \\
112 $WAF install; \\
115 uninstall:
116 @if test -n "\$(DESTDIR)"; then \\
117 $WAF uninstall --destdir="\$(DESTDIR)"; \\
118 else \\
119 $WAF uninstall; \\
122 clean:
123 @$WAF clean
125 distclean:
126 @$WAF distclean
127 @-rm -rf _build_
128 @-rm -f Makefile
130 check:
131 @$WAF check
133 dist:
134 @$WAF dist
139 checkPython
140 checkWAF
142 echo "calling waf configure with parameters"
143 $WAF configure $* || exit $EXIT_ERROR
145 if [ -f "Makefile" ] ; then
146 echo ""
147 else
148 generateMakefile
151 exit $EXIT_SUCCESS