cmake: check the right python variable and be more verbose about it
[gemrb.git] / autogen.sh
blob52845e377278f7569e4e6593d4d9c899607adc3e
1 #!/bin/sh
4 # Gentoo and Mandrake specific flags
5 export WANT_AUTOMAKE="1.10"
6 export WANT_AUTOCONF="2.5"
8 # FreeBSD favourite paths
9 #export CXXFLAGS="-ggdb -I/usr/local/include"
10 #export LDFLAGS="-ggdb -L/usr/local/lib"
12 echo "
14 The autotools build system is NO LONGER MAINTAINED and may be dropped in
15 future versions! Please switch to using cmake instead.
19 if [ "$1" = "" ]; then
20 dest=$HOME/GemRB
21 else
22 if [ "${1:0:1}" == "/" ]; then
23 dest=$1
24 else
25 dest=$PWD/$1
27 shift
29 # treat any other parameters as additional configure flags
30 if [ "$1" != "" ]; then
31 extra_args="$@"
35 if [ -n "$ACLOCAL" ];
36 then
37 my_aclocal=$ACLOCAL
38 else
39 for file in aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10 aclocal-1.11; do
40 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
41 if [ "$version" -gt 17 ];
42 then
43 my_aclocal=$file
44 break
46 done
49 if [ -z "$my_aclocal" ];
50 then
51 echo "***************************************************************"
52 echo
53 echo "Aclocal version >= 1.7 is required. If it is already installed,"
54 echo "set enviroment variable ACLOCAL to point to it."
55 echo "(for example in bash do: \"export ACLOCAL=/pathto/aclocal-1.7\")"
56 echo
57 echo "***************************************************************"
58 exit 1
61 if [ -n "$AUTOHEADER" ];
62 then
63 my_autoheader=$AUTOHEADER
64 else
65 for file in autoheader autoheader-2.57 autoheader-2.58 autoheader-2.59 autoheader-2.60 autoheader-2.61 autoheader-2.62; do
66 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
67 if [ "$version" -gt 257 ];
68 then
69 my_autoheader=$file
70 break
72 done
75 if [ -z "$my_autoheader" ];
76 then
77 echo "*********************************************************************"
78 echo
79 echo "Autoheader version >= 2.57 is required. If it is already installed,"
80 echo "set enviroment variable AUTOHEADER to point to it."
81 echo "(for example in bash do: \"export AUTOHEADER=/pathto/autoheader-2.58\")"
82 echo
83 echo "*********************************************************************"
84 exit 1
87 if [ -n "$LIBTOOLIZE" ];
88 then
89 my_libtoolize=$LIBTOOLIZE
90 else
91 for file in libtoolize; do
92 libtool_version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,,,g; p; }'`
93 libtool_version_major=`echo "$libtool_version" | cut -d. -f1`
94 libtool_version_minor=`echo "$libtool_version" | cut -d. -f2`
95 echo libtool version: "$libtool_version_major"."$libtool_version_minor"
96 if [ "$libtool_version_major" -gt 1 ] || [ "$libtool_version_minor" -gt 4 ];
97 then
98 my_libtoolize=$file
99 break
101 done
104 if [ -z "$my_libtoolize" ];
105 then
106 echo "***************************************************************"
107 echo
108 echo "Libtool version >= 1.5 is required. If it is already installed,"
109 echo "set enviroment variable LIBTOOLIZE to point to it."
110 echo "(for example in bash do: \"export LIBTOOLIZE=/pathto/libtoolize\")"
111 echo
112 echo "***************************************************************"
113 exit 1
116 if [ -n "$AUTOMAKE" ];
117 then
118 my_automake=$AUTOMAKE
119 else
120 for file in automake automake-1.7 automake-1.8 automake-1.9 automake-1.10 automake-1.11; do
121 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
122 if [ "$version" -gt 17 ];
123 then
124 my_automake=$file
125 break
127 done
130 if [ -z "$my_automake" ];
131 then
132 echo "***************************************************************"
133 echo
134 echo "Automake version >= 1.7 is required. If it is already installed,"
135 echo "set enviroment variable AUTOMAKE to point to it."
136 echo "(for example in bash do: \"export AUTOMAKE=/pathto/automake-1.7\")"
137 echo
138 echo "***************************************************************"
139 exit 1
142 if [ -n "$AUTOCONF" ];
143 then
144 my_autoconf=$AUTOCONF
145 else
146 for file in autoconf autoconf-2.57 autoconf-2.58 autoconf-2.59 autoconf-2.60 autoconf-2.61 autoconf-2.62; do
147 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
148 if [ "$version" -gt 257 ];
149 then
150 my_autoconf=$file
151 break
153 done
156 if [ -z "$my_autoconf" ];
157 then
158 echo "*****************************************************************"
159 echo
160 echo "Autoconf version >= 2.58 is required. If it is already installed,"
161 echo "set enviroment variable AUTOCONF to point to it."
162 echo "(for example in bash do: \"export AUTOCONF=/pathto/autoconf-2.58\")"
163 echo
164 echo "*********************************************************************"
165 exit 1
168 echo Running libtoolize
169 if [ "$libtool_version_major" = "2" ]; then
170 $my_libtoolize --force --no-warn
171 else
172 $my_libtoolize --force
173 fi || exit 1
175 echo Running aclocal
176 $my_aclocal -W no-syntax || $my_aclocal || exit 1
178 echo Running autoconf
179 $my_autoconf || exit 1
181 echo Running autoheader
182 $my_autoheader || exit 1
184 echo Running automake
185 $my_automake --add-missing || exit 1
187 if test -z "$NOCONFIGURE"; then
188 echo Running configure
190 cmd="./configure --prefix=$dest/ --bindir=$dest/ --sysconfdir=$dest/ --datadir=$dest/ --libdir=$dest --disable-subdirs"
191 $cmd "$extra_args"
193 echo
194 echo "Configure was invoked as: $cmd $extra_args"