diff options
author | Daiki Ueno <ueno@gnu.org> | 2015-08-21 15:19:21 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2015-08-21 15:42:48 +0900 |
commit | 50eae3f047204e270e0b70292810868c0dbf179c (patch) | |
tree | 585d0eb649113273f9b3ab0a8f95a9cca3a8d4f4 | |
parent | 15363cca838ff1d69f6e3bfbb47ecfe90c0f5000 (diff) | |
download | external_gettext-50eae3f047204e270e0b70292810868c0dbf179c.zip external_gettext-50eae3f047204e270e0b70292810868c0dbf179c.tar.gz external_gettext-50eae3f047204e270e0b70292810868c0dbf179c.tar.bz2 |
autopoint: Respect AM_GNU_GETTEXT_REQUIRE_VERSION
* 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.
-rw-r--r-- | gettext-runtime/m4/ChangeLog | 5 | ||||
-rw-r--r-- | gettext-runtime/m4/gettext.m4 | 6 | ||||
-rw-r--r-- | gettext-tools/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gettext-tools/doc/autopoint.texi | 7 | ||||
-rw-r--r-- | gettext-tools/misc/ChangeLog | 5 | ||||
-rw-r--r-- | gettext-tools/misc/autopoint.in | 55 | ||||
-rw-r--r-- | gettext-tools/misc/gettextize.in | 7 | ||||
-rw-r--r-- | gettext-tools/tests/ChangeLog | 4 | ||||
-rwxr-xr-x | gettext-tools/tests/autopoint-2 | 60 |
9 files changed, 138 insertions, 15 deletions
diff --git a/gettext-runtime/m4/ChangeLog b/gettext-runtime/m4/ChangeLog index 3ef9da6..2a44796 100644 --- a/gettext-runtime/m4/ChangeLog +++ b/gettext-runtime/m4/ChangeLog @@ -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. diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4 index be247bf..b522a37 100644 --- a/gettext-runtime/m4/gettext.m4 +++ b/gettext-runtime/m4/gettext.m4 @@ -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], []) diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog index d236412..de4f20c 100644 --- a/gettext-tools/doc/ChangeLog +++ b/gettext-tools/doc/ChangeLog @@ -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. diff --git a/gettext-tools/doc/autopoint.texi b/gettext-tools/doc/autopoint.texi index a2827ed..7934cf0 100644 --- a/gettext-tools/doc/autopoint.texi +++ b/gettext-tools/doc/autopoint.texi @@ -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 diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index 53c25cc..a33b574 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,5 +1,10 @@ 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 ARCHIVE_VERSION. Use it as the argument of AM_GNU_GETTEXT_VERSION. diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in index d7ce4f7..b443ff2 100644 --- a/gettext-tools/misc/autopoint.in +++ b/gettext-tools/misc/autopoint.in @@ -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 | \ diff --git a/gettext-tools/misc/gettextize.in b/gettext-tools/misc/gettextize.in index bd7eb92..286a253 100644 --- a/gettext-tools/misc/gettextize.in +++ b/gettext-tools/misc/gettextize.in @@ -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. diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index 042886e..c30af79 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,5 +1,9 @@ 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. * autopoint-2: Use ARCHIVE_VERSION, instead of the hard-coded version string. diff --git a/gettext-tools/tests/autopoint-2 b/gettext-tools/tests/autopoint-2 index c807b3a..740937a 100755 --- a/gettext-tools/tests/autopoint-2 +++ b/gettext-tools/tests/autopoint-2 @@ -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 |