automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI] {maint} tests: fix handling of gettext macros requirement


From: Stefano Lattarini
Subject: [FYI] {maint} tests: fix handling of gettext macros requirement
Date: Sat, 24 Dec 2011 09:28:17 +0100

The code introduced in the earlier change `v1.11-581-gb7d67d5'
and aimed at automatically fetching all the .m4 files provided by
gettext has proven inadequate, since it hasn't managed to truly
and always get *all* the required .m4 files.  For example, it has
failed to fetch the file `intldir.m4' (present in gettext 0.18.1,
and where the macro `AM_GNU_GETTEXT_INTL_SUBDIR' is defined),
which in turn has caused spurious SKIPs of at least the test
`gettext3.test'.

The reason for this debacle is that autopoint looks at the version
specified in AM_GNU_GETTEXT_VERSION to decide which version of the
gettext infrastructure to bring in; since we were unconditionally
specifying the older 0.10.35 version, the newer `.m4' files weren't
brought in.

* tests/gettext-macros.test: In AM_GNU_GETTEXT_VERSION, instead
of unconditionally specifying the older 0.10.35 version, specify
the version of the available `gettextize' or `autopoint' program,
dynamically extracted with the help of ...
(extract_program_version):... this new function, and saved ...
($autopoint_version): ... in this new variable.
---
 ChangeLog                 |   26 ++++++++++++++++++++++++++
 tests/gettext-macros.test |   24 +++++++++++++++++++-----
 2 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d97d461..b5c08ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2011-12-24  Stefano Lattarini  <address@hidden>
+
+       tests: fix handling of gettext macros requirement
+
+       The code introduced in the earlier change `v1.11-581-gb7d67d5'
+       and aimed at automatically fetching all the .m4 files provided by
+       gettext has proven inadequate, since it hasn't managed to truly
+       and always get *all* the required .m4 files.  For example, it has
+       failed to fetch the file `intldir.m4' (present in gettext 0.18.1,
+       and where the macro `AM_GNU_GETTEXT_INTL_SUBDIR' is defined),
+       which in turn has caused spurious SKIPs of at least the test
+       `gettext3.test'.
+
+       The reason for this debacle is that autopoint looks at the version
+       specified in AM_GNU_GETTEXT_VERSION to decide which version of the
+       gettext infrastructure to bring in; since we were unconditionally
+       specifying the older 0.10.35 version, the newer `.m4' files weren't
+       brought in.
+
+       * tests/gettext-macros.test: In AM_GNU_GETTEXT_VERSION, instead
+       of unconditionally specifying the older 0.10.35 version, specify
+       the version of the available `gettextize' or `autopoint' program,
+       dynamically extracted with the help of ...
+       (extract_program_version):... this new function, and saved ...
+       ($autopoint_version): ... in this new variable.
+
 2011-12-14  Stefano Lattarini  <address@hidden>
 
        tests: better handling of gettext and libtool requirements
diff --git a/tests/gettext-macros.test b/tests/gettext-macros.test
index 7fe1274..4ab2b5e 100755
--- a/tests/gettext-macros.test
+++ b/tests/gettext-macros.test
@@ -20,17 +20,17 @@
 
 . ./defs || Exit 1
 
+extract_program_version ()
+{
+  "$1" --version | sed 1q | $PERL -ne '/(\d(?:\.\d+)+)/ and print "$1\n"'
+}
+
 echo "# Automatically generated by $me." > get.sh
 echo : >> get.sh
 
 # The `gettextize' and `autopoint' scripts will look into Makefile.am.
 echo ACLOCAL_AMFLAGS = -I m4 > Makefile.am
 
-# Required by autopoint.
-echo 'AM_GNU_GETTEXT' > configure.in
-# Likewise; and older version specified here *won't* work!
-echo 'AM_GNU_GETTEXT_VERSION([0.10.35])' >> configure.in
-
 # Prefer autopoint to gettextize, since the more modern versions of the
 # latter might unconditionally require user interaction to complete;
 # yes, this means confirmation from /dev/tty (!) -- see:
@@ -45,6 +45,20 @@ else
   am_gettextize_command=gettextize
 fi
 
+# We will need to specify the correct autopoint (or gettextize) version
+# in the AM_GNU_GETTEXT_VERSION call in configure.in if we want autopoint
+# (or gettextize) to setup the correct infrastructure -- in particular,
+# for what concerns us, to bring in all the required .m4 files.
+autopoint_version=`extract_program_version $am_gettextize_command` \
+  && test -n "$autopoint_version" \
+  || autopoint_version=0.10.35
+
+cat > configure.in <<END
+# Both required by autopoint.
+AM_GNU_GETTEXT
+AM_GNU_GETTEXT_VERSION([$autopoint_version])
+END
+
 if $am_gettextize_command --force && test -f m4/gettext.m4; then
   unindent >> get.sh <<END
     ACLOCAL_PATH="`pwd`/m4":\$ACLOCAL_PATH
-- 
1.7.7.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]