Merge branch 'maint'
[platform/upstream/automake.git] / t / gettext-macros.sh
index 38749d3..1d94dad 100755 (executable)
@@ -18,7 +18,7 @@
 # to the test cases requiring them.
 # See also automake bug#9807.
 
-. ./defs || Exit 1
+. ./defs || exit 1
 
 extract_program_version ()
 {
@@ -49,7 +49,7 @@ fi
 # in the AM_GNU_GETTEXT_VERSION call in configure.ac 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` \
+autopoint_version=$(extract_program_version $am_gettextize_command) \
   && test -n "$autopoint_version" \
   || autopoint_version=0.10.35
 
@@ -61,10 +61,7 @@ AM_GNU_GETTEXT
 AM_GNU_GETTEXT_VERSION([$autopoint_version])
 END
 
-if $am_gettextize_command --force && test -f m4/gettext.m4; then
-  echo "ACLOCAL_PATH='`pwd`/m4':\$ACLOCAL_PATH" >> get.sh
-  echo "export ACLOCAL_PATH" >> get.sh
-else
+if ! ($am_gettextize_command --force && test -f m4/gettext.m4); then
   # Older versions of gettext might not have a gettextize program
   # available, but this doesn't mean the user hasn't made the gettext
   # macros available, e.g., by properly setting ACLOCAL_PATH.
@@ -78,6 +75,13 @@ else
   fi
 fi
 
+echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
+echo "export ACLOCAL_PATH" >> get.sh
+
+# Even recent versions of gettext used the now-obsolete 'AM_PROG_MKDIR_P'
+# m4 macro.  So we need the following to avoid spurious errors.
+echo 'AC_DEFUN([AM_MKDIR_P], [AC_MKDIR_P([$@])])' >> m4/mk-dirp.m4
+
 . ./get.sh
 
 $ACLOCAL --force -I m4 || cat >> get.sh <<'END'
@@ -86,6 +90,10 @@ $ACLOCAL --force -I m4 || cat >> get.sh <<'END'
 ACLOCAL="$ACLOCAL -Wno-syntax"
 END
 
+# Remove any Makefile.in possibly created by gettextize/autopoint, to
+# avoid spurious maintainer-check failures.
+rm -f $(find . -name Makefile.in)
+
 # The file gettextize or autopoint might have copied in the 'm4'
 # subdirectory of the test directory are going to be needed by
 # other tests, so we must not remove the test directory.