2 # Run this to generate all the initial makefiles, etc.
11 # Uncomment the line below to debug this file
18 # Leave out NLS checks
20 if [ "x$NAME" = "x--help" ]; then
23 if [ "x$NAME" = "x--disable-nls" ]; then
24 echo "! nls checks disabled"
27 if [ "x$NAME" = "x--no-configure-run" ]; then
30 FC_NEWARGLINE
="$FC_NEWARGLINE $NAME"
34 # print out a debug message if DEBUG is a defined variable
36 if [ ! -z "$DEBUG" ]; then
42 # solve a real name of suitable package
43 # first argument : package name (executable)
44 # second argument : source download url
45 # rest of arguments : major, minor, micro version
55 # check if given package is suitable
56 if version_check
2 $RPACKAGE $RPACKAGE $RURL $RMAJOR $RMINOR $RMICRO; then
57 version_check
1 $RPACKAGE $RPACKAGE $RURL $RMAJOR $RMINOR $RMICRO
59 # given package was too old or not available
60 # search for the newest one
61 if version_search
$RPACKAGE; then
62 if version_check
2 $RPACKAGE $new_pkg $RURL $RMAJOR $RMINOR $RMICRO; then
63 # suitable package found
64 version_check
1 $RPACKAGE $new_pkg $RURL $RMAJOR $RMINOR $RMICRO
66 # the newest package is not new enough or it is broken
67 version_check
1 $RPACKAGE $RPACKAGE $RURL $RMAJOR $RMINOR $RMICRO
71 # no version of given package with version information
72 # in its name available
73 version_check
1 $RPACKAGE $RPACKAGE $RURL $RMAJOR $RMINOR $RMICRO
82 # search the newest version of a package
83 # first argument : package name (executable)
96 for MATCHSTUFF
in `ls "$SEARCHDIR/$SPACKAGE-"* 2> /dev/null` ; do
97 for FOUNDPKG
in $MATCHSTUFF; do
98 # parse version information from name
99 new_s_pkg_major
=`echo $FOUNDPKG | cut -s -d- -f2 | cut -s -d. -f1`
100 new_s_pkg_minor
=`echo $FOUNDPKG | cut -s -d- -f2 | cut -s -d. -f2`
103 # check if version numbers are integers
104 [ ! "x$new_s_pkg_major" = "x" ] && \
105 [ "x`echo $new_s_pkg_major | sed s/[0-9]*//g`" = "x" ] && \
106 [ ! "x$new_s_pkg_minor" = "x" ] && \
107 [ "x`echo $new_s_pkg_minor | sed s/[0-9]*//g`" = "x" ] && \
110 if [ ! -z $CORRECT ]; then
111 if [ "$new_s_pkg_major" -gt "$s_pkg_major" ]; then
112 s_pkg_major
=$new_s_pkg_major
113 s_pkg_minor
=$new_s_pkg_minor
115 elif [ "$new_s_pkg_major" -eq "$s_pkg_major" ]; then
116 if [ "$new_s_pkg_minor" -gt "$s_pkg_minor" ]; then
117 s_pkg_major
=$new_s_pkg_major
118 s_pkg_minor
=$new_s_pkg_minor
127 if [ -z "$new_pkg" ]; then
135 # check the version of a package
136 # first argument : silent ('2'), complain ('1') or not ('0')
137 # second argument : package name
138 # third argument : package name (executable)
139 # fourth argument : source download url
140 # rest of arguments : major, minor, micro version
152 debug
"major $MAJOR minor $MINOR micro $MICRO"
154 if [ ! -z "$MINOR" ]; then VERSION
=$VERSION.
$MINOR; else MINOR
=0; fi
155 if [ ! -z "$MICRO" ]; then VERSION
=$VERSION.
$MICRO; else MICRO
=0; fi
157 debug
"version $VERSION"
158 if [ "$COMPLAIN" -ne "2" ]; then
159 echo "+ checking for $PACKAGEMSG >= $VERSION ... " |
tr -d '\n'
162 ($PACKAGE --version) < /dev
/null
> /dev
/null
2>&1 ||
164 if [ "$COMPLAIN" -ne "2" ]; then
166 echo "You must have $PACKAGEMSG installed to compile $package."
167 echo "Download the appropriate package for your distribution,"
168 echo "or get the source tarball at $URL"
173 # the following line is carefully crafted sed magic
174 pkg_version
=`$PACKAGE --version|head -n 1|sed 's/([^)]*)//g;s/^[a-zA-Z\.\ \-]*//;s/ .*$//'`
175 debug
"pkg_version $pkg_version"
176 pkg_major
=`echo $pkg_version | cut -d. -f1`
177 pkg_minor
=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f2`
178 pkg_micro
=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f3`
179 [ -z "$pkg_minor" ] && pkg_minor
=0
180 [ -z "$pkg_micro" ] && pkg_micro
=0
182 debug
"found major $pkg_major minor $pkg_minor micro $pkg_micro"
184 #start checking the version
185 if [ "$pkg_major" -lt "$MAJOR" ]; then
187 elif [ "$pkg_major" -eq "$MAJOR" ]; then
188 if [ "$pkg_minor" -lt "$MINOR" ]; then
190 elif [ "$pkg_minor" -eq "$MINOR" -a "$pkg_micro" -lt "$MICRO" ]; then
195 if [ ! -z "$WRONG" ]; then
196 if [ "$COMPLAIN" -ne "2" ]; then
197 echo "found $pkg_version, not ok !"
199 if [ "$COMPLAIN" -eq "1" ]; then
201 echo "You must have $PACKAGEMSG $VERSION or greater to compile $package."
202 echo "Get the latest version from <$URL>."
207 if [ "$COMPLAIN" -ne "2" ]; then
208 echo "found $pkg_version, ok."
213 # Chdir to the srcdir, then run auto* tools.
217 echo "Are you sure \"$SRCDIR\" is a valid source directory?"
221 # Check against acinclude.m4, which earlier versions used to generate.
222 [ -f acinclude.
m4 ] && {
223 echo "There is file acinclude.m4 in source directory."
224 echo "It's probably left from earlier Freeciv build, and can cause"
225 echo "unexpected results. Please remove it."
229 # autoconf and autoheader version numbers must be kept in sync
230 real_package_name
"autoconf" "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 61 || DIE
=1
231 AUTOCONF
=$REALPKGNAME
232 real_package_name
"autoheader" "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 61 || DIE
=1
233 AUTOHEADER
=$REALPKGNAME
235 # automake and aclocal version numbers must be kept in sync
236 real_package_name
"automake" "ftp://ftp.gnu.org/pub/gnu/automake/" 1 9 || DIE
=1
237 AUTOMAKE
=$REALPKGNAME
238 real_package_name
"aclocal" "ftp://ftp.gnu.org/pub/gnu/automake/" 1 9 || DIE
=1
240 real_package_name
"libtoolize" "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 4 3 || DIE
=1
241 LIBTOOLIZE
=$REALPKGNAME
243 if [ "$FC_USE_NLS" = "yes" ]; then
245 version_check
1 "xgettext" "xgettext" "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 10 36 || DIE2
=1
246 version_check
1 "msgfmt" "msgfmt" "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 10 36 || DIE2
=1
247 if [ "$DIE2" -eq 1 ]; then
249 echo "You may want to use --disable-nls to disable NLS."
250 echo "This will also remove the dependency for xgettext and msgfmt."
255 if [ "$DIE" -eq 1 ]; then
259 echo "+ running $ACLOCAL ..."
260 $ACLOCAL -I m4 -I dependencies
/m4 $ACLOCAL_FLAGS ||
{
262 echo "$ACLOCAL failed - check that all needed development files are present on system"
266 echo "+ running $AUTOHEADER ... "
269 echo "$AUTOHEADER failed"
272 echo "+ running $LIBTOOLIZE ... "
275 echo "$LIBTOOLIZE failed"
278 echo "+ running $AUTOCONF ... "
281 echo "$AUTOCONF failed"
284 echo "+ running $AUTOMAKE ... "
287 echo "$AUTOMAKE failed"
291 # Chdir back to the builddir before the configure step.
294 # now remove the cache, because it can be considered dangerous in this case
295 echo "+ removing config.cache ... "
298 # exit if we did --no-configure-run
299 if [ "$FC_RUN_CONFIGURE" = "no" ]; then
301 echo "Now type 'configure' to configure $package."
305 echo "+ running configure ... "
307 if [ -z "$FC_NEWARGLINE" ]; then
308 echo "I am going to run ./configure with no arguments - if you wish "
309 echo "to pass any to it, please specify them on the $0 command line."
311 echo "using: $FC_NEWARGLINE"
315 "$SRCDIR/configure" $FC_NEWARGLINE ||
{
317 echo "configure failed"
321 # abort if we did --help
322 if [ "$FC_HELP" = "yes" ]; then
327 echo "Now type 'make' to compile $package."