* t/gettext.sh: Move checks about PR/381 ...
* t/gettext-pr381.sh: ... to this new test.
* t/gettext.sh: Move checks about config.rpath requirement ...
* t/gettext-config-rpath.sh: ... to this new test.

Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com>
---
 t/gettext-config-rpath.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
 t/gettext-pr381.sh        | 45 +++++++++++++++++++++++++++++++++++++++++++++
 t/gettext.sh              | 41 +++--------------------------------------
 3 files changed, 93 insertions(+), 38 deletions(-)
 create mode 100755 t/gettext-config-rpath.sh
 create mode 100755 t/gettext-pr381.sh

diff --git a/t/gettext-config-rpath.sh b/t/gettext-config-rpath.sh
new file mode 100755
index 0000000..613ee82
--- /dev/null
+++ b/t/gettext-config-rpath.sh
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check the config.rpath requirement.
+
+required='gettext'
+. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AM_GNU_GETTEXT
+# config.rpath is required by versions >= 0.14.3.
+AM_GNU_GETTEXT_VERSION([0.14.3])
+AC_OUTPUT
+END
+
+echo 'SUBDIRS = po intl' >Makefile.am
+mkdir po intl
+
+# If aclocal fails here, it may be that gettext is too old to provide
+# AM_GNU_GETTEXT_VERSION.  Similarly, autopoint will fail if it's
+# from an older version.  If gettext is too old to provide autopoint,
+# this will fail as well, so we're safe here.
+if ! $ACLOCAL && autopoint -n; then
+  skip_ "too old gettext installation"
+fi
+
+AUTOMAKE_fails --add-missing
+grep '^configure\.ac:.*required file.*config.rpath' stderr
+: > config.rpath
+$AUTOMAKE
+
+:
diff --git a/t/gettext-pr381.sh b/t/gettext-pr381.sh
new file mode 100755
index 0000000..1bb6320
--- /dev/null
+++ b/t/gettext-pr381.sh
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Automake gettext support: regression check for PR/381:
+# 'SUBDIRS = po intl' must not be required if 'po/' doesn't exist.
+
+required='gettext'
+. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AM_GNU_GETTEXT
+AC_OUTPUT
+END
+
+$ACLOCAL
+
+: > config.guess
+: > config.rpath
+: > config.sub
+
+test ! -d po # Sanity check.
+mkdir sub
+echo 'SUBDIRS = sub' > Makefile.am
+$AUTOMAKE
+
+# Still, SUBDIRS must be defined.
+
+: > Makefile.am
+AUTOMAKE_fails
+grep '^configure\.ac:.*AM_GNU_GETTEXT used but SUBDIRS not defined' stderr
+
+:
diff --git a/t/gettext.sh b/t/gettext.sh
index 3527f70..5f89b61 100755
--- a/t/gettext.sh
+++ b/t/gettext.sh
@@ -19,36 +19,15 @@
 required='gettext'
 . ./defs || exit 1
 
-cat >>configure.ac <<END
+cat >> configure.ac << 'END'
 AM_GNU_GETTEXT
-AM_GNU_GETTEXT_VERSION([0.14.3])
 AC_OUTPUT
 END
 
-: >Makefile.am
+: > Makefile.am
+: > config.rpath
 mkdir po intl
 
-# config.rpath is required by versions >= 0.14.3.  We try to verify
-# this requirement, but only when we find we have a working and recent
-# gettext installation.
-
-# If aclocal fails here, it may be that gettext is too old to
-# provide AM_GNU_GETTEXT_VERSION.
-if $ACLOCAL; then
-  # autopoint will fail if it's from an older version.
-  # If gettext is too old to provide autopoint, this will
-  # fail as well, so we're safe here.
-  if autopoint -n; then
-    AUTOMAKE_fails --add-missing
-    grep 'required.*config.rpath' stderr
-  fi
-fi
-
-: >config.rpath
-sed '/AM_GNU_GETTEXT_VERSION/d' configure.ac >configure.int
-mv -f configure.int configure.ac
-
-rm -rf autom4te.cache
 $ACLOCAL
 $AUTOCONF
 
@@ -76,18 +55,4 @@ echo distdir: > po/Makefile
 echo distdir: > intl/Makefile
 $MAKE -n distcheck | grep '.*--with-included-gettext'
 
-# 'SUBDIRS = po intl' isn't required if po/ doesn't exist.
-# PR/381.
-
-rm -rf po
-mkdir sub
-echo 'SUBDIRS = sub' >Makefile.am
-$AUTOMAKE
-
-# Still, SUBDIRS must be defined.
-
-: >Makefile.am
-AUTOMAKE_fails --add-missing
-grep 'AM_GNU_GETTEXT.*SUBDIRS' stderr
-
 :
-- 
1.7.12.rc0


Reply via email to