]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
autopoint: Respect AM_GNU_GETTEXT_REQUIRE_VERSION
authorDaiki Ueno <ueno@gnu.org>
Fri, 21 Aug 2015 06:19:21 +0000 (15:19 +0900)
committerDaiki Ueno <ueno@gnu.org>
Fri, 21 Aug 2015 06:42:48 +0000 (15:42 +0900)
* gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT_REQUIRE_VERSION): New macro.
Bump serial to 67.
* gettext-tools/doc/autopoint.texi: Mention AM_GNU_GETTEXT_REQUIRE_VERSION.
* gettext-tools/misc/gettextize.in: Check if AM_GNU_GETTEXT_VERSION is
used.
* gettext-tools/misc/autopoint.in: Respect AM_GNU_GETTEXT_REQUIRE_VERSION.
* gettext-tools/tests/autopoint-2: Check AM_GNU_GETTEXT_REQUIRE_VERSION.

gettext-runtime/m4/ChangeLog
gettext-runtime/m4/gettext.m4
gettext-tools/doc/ChangeLog
gettext-tools/doc/autopoint.texi
gettext-tools/misc/ChangeLog
gettext-tools/misc/autopoint.in
gettext-tools/misc/gettextize.in
gettext-tools/tests/ChangeLog
gettext-tools/tests/autopoint-2

index 3ef9da61498e3bcbb9c70ef33743ca597978c468..2a44796d8794b9677f4bbfef25c54e983e536e47 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-28  Daiki Ueno  <ueno@gnu.org>
+
+       * gettext.m4 (AM_GNU_GETTEXT_REQUIRE_VERSION): New macro.  Bump
+       serial to 67.
+
 2015-07-10  Daiki Ueno  <ueno@gnu.org>
 
        * gettext 0.19.5 released.
index be247bf7b88860d0f565884bd192d44f6e23e9ec..b522a370c006940b43f7a713386eeb0e2a25171e 100644 (file)
@@ -1,4 +1,4 @@
-# gettext.m4 serial 66 (gettext-0.18.2)
+# gettext.m4 serial 67 (gettext-0.19.6)
 dnl Copyright (C) 1995-2014 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -399,3 +399,7 @@ AC_DEFUN([AM_GNU_GETTEXT_NEED],
 
 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
+
+
+dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])
index d236412578b7cd61a1fac1a7214acad3ed43a6a0..de4f20cd4faf1ab80f87bf34938f6f0c38922c14 100644 (file)
@@ -1,3 +1,7 @@
+2015-07-28  Daiki Ueno  <ueno@gnu.org>
+
+       * autopoint.texi: Mention AM_GNU_GETTEXT_REQUIRE_VERSION.
+
 2015-07-10  Daiki Ueno  <ueno@gnu.org>
 
        * gettext 0.19.5 released.
index a2827edb198d7bcf39d1b66b17dbc71741ee46ff..7934cf029128d9f093b24e4b600bf7c2db00df8e 100644 (file)
@@ -11,6 +11,13 @@ into a source package.  It extracts from a macro call of the form
 used by the package, and copies the infrastructure files belonging to
 this version into the package.
 
+To extract the latest available infrastructure which satisfies a version
+requirement, then you can use the form
+@code{AM_GNU_GETTEXT_REQUIRE_VERSION(@var{version})} instead.  For example, if
+gettext @value{VERSION} is installed on your system and @code{0.19.1} is
+requested, then the infrastructure files of version @value{VERSION} will
+be copied into a source package.
+
 @subsubsection Options
 
 @table @samp
index 53c25ccf3f3d905cf3e3d9255bed9d0adc5e588b..a33b574caf6802a729a813a1547ea80ec782568c 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-28  Daiki Ueno  <ueno@gnu.org>
+
+       * gettextize.in: Check if AM_GNU_GETTEXT_VERSION is used.
+       * autopoint.in: Respect AM_GNU_GETTEXT_REQUIRE_VERSION.
+
 2015-07-28  Daiki Ueno  <ueno@gnu.org>
 
        * gettextize.in (archive_version): New variable, set to
index d7ce4f7f04b5647507eec70b09c29d6c5d13cdd2..b443ff21beeb7d7d8734485f1b51ead78055248f 100644 (file)
@@ -23,6 +23,7 @@
 progname=$0
 package=@PACKAGE@
 version=@VERSION@
+archive_version=@ARCHIVE_VERSION@
 
 # Set variables
 # - gettext_datadir     directory where the data files are stored.
@@ -313,29 +314,59 @@ else
   func_trace=func_trace_sed
 fi
 
-# Check whether the -V option and the version number in configure.in match.
-# At least one of the two must be given. If both are given, they must agree.
+# func_version_prereq required_version version
+# compares the required version and the latest archive version.
+func_version_prereq ()
+{
+  req="$1"
+  ver="$2"
+  echo "m4_if(m4_version_compare([$ver], [$req]), [-1], [m4_exit([1])])" \
+    | "$AUTOM4TE" --language=M4sugar 2>&1 >/dev/null
+}
+
+# If AM_GNU_GETTEXT_REQUIRE_VERSION is used and archive_version is newer than
+# that, use archive_version.
+xreq=`func_trace_sed AM_GNU_GETTEXT_REQUIRE_VERSION "$configure_in"`
 
 # Need to use func_trace_sed instead of $func_trace, since
 # AM_GNU_GETTEXT_VERSION is not a standard Autoconf trace.
 xver=`func_trace_sed AM_GNU_GETTEXT_VERSION "$configure_in"`
-if test -z "$xver" && test -f intl/VERSION; then
-  xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'`
+
+# Prefer AM_GNU_GETTEXT_REQUIRE_VERSION over AM_GNU_GETTEXT_VERSION if both are
+# specified.
+if test -n "$xreq" && test -n "$xver"; then
+  echo "autopoint: using AM_GNU_GETTEXT_REQUIRE_VERSION instead of AM_GNU_GETTEXT_VERSION"
 fi
-if test -n "$xver"; then
-  if test -n "$ver"; then
-    if test "X$ver" != "X$xver"; then
-      func_fatal_error "Version mismatch: specified -V $ver but the package uses gettext version $xver"
-    fi
+
+if test -n "$xreq"; then
+  if func_version_prereq "$xreq" "$archive_version"; then
+    ver="$archive_version"
   else
-    ver="$xver"
+    func_fatal_error "gettext version $xreq or newer is required"
   fi
 else
-  if test -z "$ver"; then
-    func_fatal_error "Missing version: please specify in $configure_in through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using"
+  if test -z "$xver" && test -f intl/VERSION; then
+    xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'`
+  fi
+
+  # Check whether the -V option and the version number in configure.in match.
+  # At least one of the two must be given. If both are given, they must agree.
+
+  if test -n "$xver"; then
+    if test -n "$ver"; then
+      if test "X$ver" != "X$xver"; then
+        func_fatal_error "Version mismatch: specified -V $ver but the package uses gettext version $xver"
+      fi
+    else
+      ver="$xver"
+    fi
   fi
 fi
 
+if test -z "$ver"; then
+  func_fatal_error "Missing version: please specify in $configure_in through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using"
+fi
+
 # Check whether the version number is supported.
 case "$ver" in
   0.10.35 | 0.10.36 | 0.10.37 | 0.10.38 | 0.10.39 | 0.10.40 | \
index bd7eb929eb71e78ac4af30fa35a19ef53a50d0c9..286a253e4c8389e20965f20af949e330907282e7 100644 (file)
@@ -1236,8 +1236,11 @@ sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *
 func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile."
 sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
 func_modify_configure_in "(AC_LINK_FILES): Remove invocation."
-sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
-func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version."
+# AM_GNU_GETTEXT_VERSION may not be present, when AM_GNU_GETTEXT_REQUIRE_VERSION is used.
+if grep '^AM_GNU_GETTEXT_VERSION(' "$srcdir/$configure_in" 2>&1 >/dev/null; then
+  sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
+  func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version."
+fi
 $do_changelog && func_ChangeLog_finish
 
 # Recommend replacement for deprecated Makefile variables.
index 042886ed692320a485c1264a970346dfa2999626..c30af799c2173432962e41ee89756d520c48cc69 100644 (file)
@@ -1,3 +1,7 @@
+2015-07-28  Daiki Ueno  <ueno@gnu.org>
+
+       * autopoint-2: Add checks for AM_GNU_GETTEXT_REQUIRE_VERSION.
+
 2015-07-28  Daiki Ueno  <ueno@gnu.org>
 
        * init-env.in (ARCHIVE_VERSION): New substituted variable.
index c807b3a5da7c8b15ff538771eddb3a4784653039..740937ad38d78ff4ce92501f9274a2b5197fac7a 100755 (executable)
@@ -166,3 +166,63 @@ test -f m4/po.m4 || exit 1
 test -f po/Makefile.in.in || exit 1
 
 rm -fr m4 po
+
+# Check for AM_GNU_GETTEXT_REQUIRE_VERSION.
+cat <<EOF >configure.ac
+AC_INIT
+AC_CONFIG_SRCDIR(hello.c)
+
+AC_PROG_CC
+AM_GNU_GETTEXT_REQUIRE_VERSION([0.19])
+AM_GNU_GETTEXT([external])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([po/Makefile.in])
+AC_OUTPUT
+EOF
+
+$gettext_datadir/autopoint >/dev/null 2>autopoint.err
+test $? = 0 || { cat autopoint.err; exit 1; }
+
+test ! -d intl || exit 1
+test -d m4 || exit 1
+test -d po || exit 1
+
+test -f m4/po.m4 || exit 1
+test -f po/Makefile.in.in || exit 1
+
+# Check for the case where both AM_GNU_GETTEXT_REQUIRE_VERSION and
+# AM_GNU_GETTEXT_VERSION are used.
+cat <<EOF >configure.ac
+AC_INIT
+AC_CONFIG_SRCDIR(hello.c)
+
+AC_PROG_CC
+AM_GNU_GETTEXT
+AM_GNU_GETTEXT_REQUIRE_VERSION([0.19])
+# This shall be ignored when AM_GNU_GETTEXT_REQUIRE_VERSION is defined
+AM_GNU_GETTEXT_VERSION([0.19])
+
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([po/Makefile.in])
+AC_OUTPUT
+EOF
+
+$gettext_datadir/autopoint >autopoint.out 2>autopoint.err
+test $? = 0 || { cat autopoint.err; exit 1; }
+
+grep 'using AM_GNU_GETTEXT_REQUIRE_VERSION' autopoint.out 2>&1 >/dev/null || exit 1
+
+test -d intl || exit 1
+test -d m4 || exit 1
+test -d po || exit 1
+
+cat >autopoint.ver <<EOF
+GNU gettext library from gettext-$ARCHIVE_VERSION
+EOF
+: ${DIFF=diff}
+${DIFF} autopoint.ver intl/VERSION || exit 1
+test -f m4/po.m4 || exit 1
+test -f po/Makefile.in.in || exit 1