]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: fix autopoint gettext version fun
authorRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 10 Jun 2014 16:44:08 +0000 (18:44 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 10 Jun 2014 18:20:35 +0000 (20:20 +0200)
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>
autogen.sh
configure.ac

index 7bbcc75ecce43bf2d7c8410e7e6a2114c3a2978c..d1a686c1636c729377b9e40686c33865c84cf00b 100755 (executable)
@@ -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)"
index ba31abca7d946e8bfd156815bba2035436d73ab4..7b9959e5326a979296007c01170d2bef12c85afc 100644 (file)
@@ -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])