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 [ "x$VERSION" != "x" ] ; then
159 if [ "$COMPLAIN" -ne "2" ]; then
160 echo "+ checking for $PACKAGEMSG >= $VERSION ... " |
tr -d '\n'
164 if [ "$COMPLAIN" -ne "2" ]; then
165 echo "+ checking for $PACKAGEMSG ... " |
tr -d '\n'
169 ($PACKAGE --version) < /dev
/null
> /dev
/null
2>&1 ||
171 if [ "$COMPLAIN" -ne "2" ]; then
173 echo "You must have $PACKAGEMSG installed to compile $package."
174 echo "Download the appropriate package for your distribution,"
175 echo "or get the source tarball at $URL"
180 # The following line is carefully crafted sed magic
181 pkg_version
=`$PACKAGE --version 2>&1|grep -a -v " line " |head -n 1|sed 's/([^)]*)//g;s/^[a-zA-Z\.\ \-]*//;s/ .*$//'`
182 debug
"pkg_version $pkg_version"
183 pkg_major
=`echo $pkg_version | cut -d. -f1`
184 pkg_minor
=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f2`
185 pkg_micro
=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f3`
186 [ -z "$pkg_major" ] && pkg_major
=0
187 [ -z "$pkg_minor" ] && pkg_minor
=0
188 [ -z "$pkg_micro" ] && pkg_micro
=0
190 debug
"found major $pkg_major minor $pkg_minor micro $pkg_micro"
192 # Start checking the version
193 if [ "$pkg_major" -lt "$MAJOR" ]; then
195 elif [ "$pkg_major" -eq "$MAJOR" ]; then
196 if [ "$pkg_minor" -lt "$MINOR" ]; then
198 elif [ "$pkg_minor" -eq "$MINOR" -a "$pkg_micro" -lt "$MICRO" ]; then
203 if [ ! -z "$WRONG" ]; then
204 if [ "$COMPLAIN" -ne "2" ]; then
205 echo "found $pkg_version, not ok !"
207 if [ "$COMPLAIN" -eq "1" ]; then
209 echo "You must have $PACKAGEMSG $VERSION or greater to compile $package."
210 echo "Get the latest version from <$URL>."
215 if [ "$COMPLAIN" -ne "2" ]; then
216 echo "found $pkg_version, ok."
221 # Chdir to the srcdir, then run auto* tools.
225 echo "Are you sure \"$SRCDIR\" is a valid source directory?"
229 # Check against acinclude.m4, which earlier versions used to generate.
230 [ -f acinclude.
m4 ] && {
231 echo "There is file acinclude.m4 in source directory."
232 echo "It's probably left from earlier Freeciv build, and can cause"
233 echo "unexpected results. Please remove it."
237 # autoconf and autoheader version numbers must be kept in sync
238 real_package_name
"autoconf" "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 61 || DIE
=1
239 AUTOCONF
=$REALPKGNAME
240 real_package_name
"autoheader" "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 61 || DIE
=1
241 AUTOHEADER
=$REALPKGNAME
243 # automake and aclocal version numbers must be kept in sync
244 real_package_name
"automake" "ftp://ftp.gnu.org/pub/gnu/automake/" 1 10 || DIE
=1
245 AUTOMAKE
=$REALPKGNAME
246 real_package_name
"aclocal" "ftp://ftp.gnu.org/pub/gnu/automake/" 1 10 || DIE
=1
248 real_package_name
"libtoolize" "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 2 || DIE
=1
249 LIBTOOLIZE
=$REALPKGNAME
250 real_package_name
"python" "https://www.python.org/" || DIE
=1
252 if [ "$FC_USE_NLS" = "yes" ]; then
254 version_check
1 "xgettext" "xgettext" "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 14 || DIE2
=1
255 version_check
1 "msgfmt" "msgfmt" "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 14 || DIE2
=1
256 if [ "$DIE2" -eq 1 ]; then
258 echo "You may want to use --disable-nls to disable NLS."
259 echo "This will also remove the dependency for xgettext and msgfmt."
264 if [ "$DIE" -eq 1 ]; then
268 echo "+ running $ACLOCAL ..."
269 $ACLOCAL -I m4 -I dependencies
/m4 $ACLOCAL_FLAGS ||
{
271 echo "$ACLOCAL failed - check that all needed development files are present on system"
275 echo "+ running $AUTOHEADER ... "
278 echo "$AUTOHEADER failed"
281 echo "+ running $LIBTOOLIZE ... "
282 $LIBTOOLIZE -f -c ||
{
284 echo "$LIBTOOLIZE failed"
287 echo "+ running $ACLOCAL for libtool installed files..."
288 $ACLOCAL -I m4 -I dependencies
/m4 $ACLOCAL_FLAGS ||
{
290 echo "$ACLOCAL failed on libtool files run"
293 echo "+ running $AUTOCONF ... "
296 echo "$AUTOCONF failed"
299 echo "+ running $AUTOMAKE ... "
302 echo "$AUTOMAKE failed"
306 # Chdir back to the builddir before the configure step.
309 # now remove the cache, because it can be considered dangerous in this case
310 echo "+ removing config.cache ... "
313 # exit if we did --no-configure-run
314 if [ "$FC_RUN_CONFIGURE" = "no" ]; then
316 echo "Now type 'configure' to configure $package."
320 echo "+ running configure ... "
322 if [ -z "$FC_NEWARGLINE" ]; then
323 echo "I am going to run ./configure with no arguments - if you wish "
324 echo "to pass any to it, please specify them on the $0 command line."
326 echo "using: $FC_NEWARGLINE"
330 "$SRCDIR/configure" $FC_NEWARGLINE ||
{
332 echo "configure failed"
336 # abort if we did --help
337 if [ "$FC_HELP" = "yes" ]; then
342 echo "Now type 'make' to compile $package."