build-sys: fix autopoint gettext version fun

We avoid or fix many portability issues.

The first more generic "sort --version-sort" solution was almost
useless anyway because autopoint itself can also only deal with
a few hardcoded versions.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
Ruediger Meier 2014-06-10 18:44:08 +02:00
parent 91c520bc9b
commit f8d75a6647
2 changed files with 10 additions and 13 deletions

View File

@ -13,28 +13,26 @@ THEDIR=`pwd`
cd $srcdir cd $srcdir
DIE=0 DIE=0
# provide simple gettext backward compatibility
autopoint_fun () autopoint_fun ()
{ {
# we have to deal with set -e ... # we have to deal with set -e ...
rm -f configure.ac.autogenbak
ret="0" ret="0"
GT_VER_MIN="0.18"
GT_VER_DEF=$(sed -n 's/AM_GNU_GETTEXT_VERSION(\[\(.*\)\])/\1/p' configure.ac)
GT_VER_HAVE="$(gettext --version | head -n 1 | sed 's/.* //g')"
tmp=$(echo -e "$GT_VER_MIN\n$GT_VER_HAVE" | sort -V | tail -n1) # check against this hardcoded set of alternative gettext versions
tmp=$(echo -e "$GT_VER_DEF\n$tmp" | sort -V | head -n1) gt_ver=`gettext --version |\
sed -n -e 's/.* \(0\.18\|0\.18\.[1-2]\)$/\1/p'`
if [ "$tmp" != "$GT_VER_DEF" ]; then if [ -n "$gt_ver" ]; then
echo "warning, force autopoint to use old gettext $tmp" echo "warning, force autopoint to use old gettext $gt_ver"
rm -f configure.ac.autogenbak
sed -i.autogenbak configure.ac \ sed -i.autogenbak configure.ac \
-e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$tmp])/" -e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$gt_ver])/"
fi fi
autopoint "$@" || ret=$? autopoint "$@" || ret=$?
ret=$?
if [ "$tmp" != "$GT_VER_DEF" ]; then if [ -n "$gt_ver" ]; then
mv configure.ac.autogenbak configure.ac mv configure.ac.autogenbak configure.ac
fi fi
@ -94,7 +92,6 @@ fi
echo echo
echo "Generate build-system by:" echo "Generate build-system by:"
echo " autopoint: $(autopoint --version | head -1)" echo " autopoint: $(autopoint --version | head -1)"
echo " aclocal: $(aclocal --version | head -1)" echo " aclocal: $(aclocal --version | head -1)"
echo " autoconf: $(autoconf --version | head -1)" echo " autoconf: $(autoconf --version | head -1)"

View File

@ -152,7 +152,7 @@ UL_SET_ARCH([HPPA], [hppa*])
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
dnl we want this gettext version but still allow older ones via autogen.sh dnl Don't forget to maintain alternatively allowed versions in autogen.sh!
AM_GNU_GETTEXT_VERSION([0.18.3]) AM_GNU_GETTEXT_VERSION([0.18.3])
AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT([external])