From f8d75a6647830b496d6ff4697925204cb4d420d9 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Tue, 10 Jun 2014 18:44:08 +0200 Subject: [PATCH] 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 --- autogen.sh | 21 +++++++++------------ configure.ac | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/autogen.sh b/autogen.sh index 7bbcc75ecc..d1a686c163 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,28 +13,26 @@ THEDIR=`pwd` cd $srcdir DIE=0 +# provide simple gettext backward compatibility autopoint_fun () { # we have to deal with set -e ... - rm -f configure.ac.autogenbak 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) - tmp=$(echo -e "$GT_VER_DEF\n$tmp" | sort -V | head -n1) + # check against this hardcoded set of alternative gettext versions + gt_ver=`gettext --version |\ + sed -n -e 's/.* \(0\.18\|0\.18\.[1-2]\)$/\1/p'` - if [ "$tmp" != "$GT_VER_DEF" ]; then - echo "warning, force autopoint to use old gettext $tmp" + if [ -n "$gt_ver" ]; then + echo "warning, force autopoint to use old gettext $gt_ver" + rm -f configure.ac.autogenbak sed -i.autogenbak configure.ac \ - -e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$tmp])/" + -e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$gt_ver])/" fi autopoint "$@" || ret=$? - ret=$? - if [ "$tmp" != "$GT_VER_DEF" ]; then + if [ -n "$gt_ver" ]; then mv configure.ac.autogenbak configure.ac fi @@ -94,7 +92,6 @@ fi echo echo "Generate build-system by:" - echo " autopoint: $(autopoint --version | head -1)" echo " aclocal: $(aclocal --version | head -1)" echo " autoconf: $(autoconf --version | head -1)" diff --git a/configure.ac b/configure.ac index ba31abca7d..7b9959e532 100644 --- a/configure.ac +++ b/configure.ac @@ -152,7 +152,7 @@ UL_SET_ARCH([HPPA], [hppa*]) 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([external]) -- 2.47.2