acinclude.m4 (PSPP_CHECK_XGETTEXT): Use sed instead of parameter expansion
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 3 Jan 2021 07:44:23 +0000 (08:44 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 3 Jan 2021 07:57:30 +0000 (08:57 +0100)
Several persons have said that the initial version of this macro failed on their
systems.  Hopefully this will work better.

acinclude.m4

index 14f746effa78da7462eef88f712011374a7131f8..750a87efb19495d35d9cfa454c4cef4acee13b10 100644 (file)
@@ -355,15 +355,16 @@ AC_DEFUN([PSPP_CHECK_DOT],
 
 
 dnl Check that xgettext is sufficiently recent
-dnl Before calling this function the variable XGETTEXT must point to the xgettext binary
+dnl Before calling this macro, AC_CHECK_PROGS([XGETTEXT], [xgettext]) should have been called,
+dnl which sets the ac_cv_prog_XGETTEXT cache variable.
 AC_DEFUN([PSPP_CHECK_XGETTEXT],
  [AC_CACHE_CHECK([whether gettext is sufficiently recent],
    [pspp_cv_progrecent_xgettext],
    [pspp_cv_progrecent_xgettext=maybe
     ver=`$ac_cv_prog_XGETTEXT --version | sed -n -e '/xgettext/s/[[^0-9]]*\([[0-9\.]][[0-9\.]]*\).*/\1/p'`
-    major=${ver%%.[[0-9]][[0-9]]*}
-    majmin=${ver%.[[0-9]][[0-9]]*}
-    minor=${majmin##[0-9]*.}
+    majmin=`echo $ver | sed -e 's/\.[[0-9]]*$//'`
+    major=`echo $majmin | sed -e 's/\.[[0-9]]*$//'`
+    minor=`echo $majmin | sed -e 's/^[[0-9]]*\.//'`
     if test "$major" -lt 0; then
       pspp_cv_progrecent_xgettext=no;
     elif test "$minor" -lt 20; then
@@ -371,4 +372,3 @@ AC_DEFUN([PSPP_CHECK_XGETTEXT],
     else
       pspp_cv_progrecent_xgettext=yes
     fi])])
-