The Great Rename (Part 2)
[gemrb.git] / autogen.sh
blobf27ef27d973e3eefb65461bc2b60540e29d4d4fa
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 if [ "$1" = "" ]; then
13 dest=$HOME/GemRB
14 else
15 if [ "${1:0:1}" == "/" ]; then
16 dest=$1
17 else
18 dest=$PWD/$1
20 shift
22 # treat any other parameters as additional configure flags
23 if [ "$1" != "" ]; then
24 extra_args="$@"
28 if [ -n "$ACLOCAL" ];
29 then
30 my_aclocal=$ACLOCAL
31 else
32 for file in aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10 aclocal-1.11; do
33 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
34 if [ "$version" -gt 17 ];
35 then
36 my_aclocal=$file
37 break
39 done
42 if [ -z "$my_aclocal" ];
43 then
44 echo "***************************************************************"
45 echo
46 echo "Aclocal version >= 1.7 is required. If it is already installed,"
47 echo "set enviroment variable ACLOCAL to point to it."
48 echo "(for example in bash do: \"export ACLOCAL=/pathto/aclocal-1.7\")"
49 echo
50 echo "***************************************************************"
51 exit 1
54 if [ -n "$AUTOHEADER" ];
55 then
56 my_autoheader=$AUTOHEADER
57 else
58 for file in autoheader autoheader-2.57 autoheader-2.58 autoheader-2.59 autoheader-2.60 autoheader-2.61 autoheader-2.62; do
59 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
60 if [ "$version" -gt 257 ];
61 then
62 my_autoheader=$file
63 break
65 done
68 if [ -z "$my_autoheader" ];
69 then
70 echo "*********************************************************************"
71 echo
72 echo "Autoheader version >= 2.57 is required. If it is already installed,"
73 echo "set enviroment variable AUTOHEADER to point to it."
74 echo "(for example in bash do: \"export AUTOHEADER=/pathto/autoheader-2.58\")"
75 echo
76 echo "*********************************************************************"
77 exit 1
80 if [ -n "$LIBTOOLIZE" ];
81 then
82 my_libtoolize=$LIBTOOLIZE
83 else
84 for file in libtoolize; do
85 libtool_version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,,,g; p; }'`
86 libtool_version_major=`echo "$libtool_version" | cut -d. -f1`
87 libtool_version_minor=`echo "$libtool_version" | cut -d. -f2`
88 echo libtool version: "$libtool_version_major"."$libtool_version_minor"
89 if [ "$libtool_version_major" -gt 1 ] || [ "$libtool_version_minor" -gt 4 ];
90 then
91 my_libtoolize=$file
92 break
94 done
97 if [ -z "$my_libtoolize" ];
98 then
99 echo "***************************************************************"
100 echo
101 echo "Libtool version >= 1.5 is required. If it is already installed,"
102 echo "set enviroment variable LIBTOOLIZE to point to it."
103 echo "(for example in bash do: \"export LIBTOOLIZE=/pathto/libtoolize\")"
104 echo
105 echo "***************************************************************"
106 exit 1
109 if [ -n "$AUTOMAKE" ];
110 then
111 my_automake=$AUTOMAKE
112 else
113 for file in automake automake-1.7 automake-1.8 automake-1.9 automake-1.10 automake-1.11; do
114 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
115 if [ "$version" -gt 17 ];
116 then
117 my_automake=$file
118 break
120 done
123 if [ -z "$my_automake" ];
124 then
125 echo "***************************************************************"
126 echo
127 echo "Automake version >= 1.7 is required. If it is already installed,"
128 echo "set enviroment variable AUTOMAKE to point to it."
129 echo "(for example in bash do: \"export AUTOMAKE=/pathto/automake-1.7\")"
130 echo
131 echo "***************************************************************"
132 exit 1
135 if [ -n "$AUTOCONF" ];
136 then
137 my_autoconf=$AUTOCONF
138 else
139 for file in autoconf autoconf-2.57 autoconf-2.58 autoconf-2.59 autoconf-2.60 autoconf-2.61 autoconf-2.62; do
140 version=`$file --version | sed -n '1 { s/^[^ ]* (.*) //; s/ .*$//; s,\.,,g; p; }'`
141 if [ "$version" -gt 257 ];
142 then
143 my_autoconf=$file
144 break
146 done
149 if [ -z "$my_autoconf" ];
150 then
151 echo "*****************************************************************"
152 echo
153 echo "Autoconf version >= 2.58 is required. If it is already installed,"
154 echo "set enviroment variable AUTOCONF to point to it."
155 echo "(for example in bash do: \"export AUTOCONF=/pathto/autoconf-2.58\")"
156 echo
157 echo "*********************************************************************"
158 exit 1
161 echo Running libtoolize
162 if [ "$libtool_version_major" = "2" ]; then
163 $my_libtoolize --force --no-warn
164 else
165 $my_libtoolize --force
166 fi || exit 1
168 echo Running aclocal
169 $my_aclocal -W no-syntax || $my_aclocal || exit 1
171 echo Running autoconf
172 $my_autoconf || exit 1
174 echo Running autoheader
175 $my_autoheader || exit 1
177 echo Running automake
178 $my_automake --add-missing || exit 1
180 if test -z "$NOCONFIGURE"; then
181 echo Running configure
183 cmd="./configure --prefix=$dest/ --bindir=$dest/ --sysconfdir=$dest/ --datadir=$dest/ --libdir=$dest --disable-subdirs"
184 $cmd "$extra_args"
186 echo
187 echo "Configure was invoked as: $cmd $extra_args"