diff options
author | Daiki Ueno <ueno@gnu.org> | 2013-05-01 18:16:28 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2013-05-02 14:51:41 +0900 |
commit | a54a5d345a7285b39b80d8476a0d072ad02074b8 (patch) | |
tree | d35a32cca3b0af94ca01bd0ca42e3dcff63f040d /gettext-tools | |
parent | 5deb7561ce60d75256f4c55cc07c296678f4019f (diff) | |
download | external_gettext-a54a5d345a7285b39b80d8476a0d072ad02074b8.zip external_gettext-a54a5d345a7285b39b80d8476a0d072ad02074b8.tar.gz external_gettext-a54a5d345a7285b39b80d8476a0d072ad02074b8.tar.bz2 |
Refactor Autoconf trace in autopoint.in.
Diffstat (limited to 'gettext-tools')
-rw-r--r-- | gettext-tools/misc/ChangeLog | 7 | ||||
-rw-r--r-- | gettext-tools/misc/autopoint.in | 80 | ||||
-rw-r--r-- | gettext-tools/misc/gettextize.in | 4 |
3 files changed, 56 insertions, 35 deletions
diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index 5704341..d31f45b 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,3 +1,10 @@ +2013-05-02 Daiki Ueno <ueno@gnu.org> + + * autopoint.in (func_trace): New function; use it all in places + where Autoconf macro trace is needed. + (func_version): Bump copyright year. + * gettextize.in (func_version): Bump copyright year. + 2013-03-05 Daiki Ueno <ueno@gnu.org> * po-mode.el (po-font-lock-keywords): Properly highlight C format diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in index 745fdb4..87723ec 100644 --- a/gettext-tools/misc/autopoint.in +++ b/gettext-tools/misc/autopoint.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2013 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 @@ -30,8 +30,6 @@ prefix="@prefix@" datarootdir="@datarootdir@" gettext_dir="@datadir@/gettext" -autom4te="autom4te --no-cache --language=Autoconf-without-aclocal-m4" - # func_tmpdir # creates a temporary directory. # Sets variable @@ -138,6 +136,38 @@ if test "@RELOCATABLE@" = yes; then gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'` fi +# func_trace macro +# traces an Autoconf macro call and outputs the arguments to stdout. +func_trace () +{ + case "$1" in + AC_*) + # For Autoconf standard macros, autom4te --trace can be used. + autom4te --no-cache --language=Autoconf-without-aclocal-m4 --trace="$1":\$% "$configure_in" + ;; + *) + # Otherwise, manually extract macro calls in configure.ac with + # sed. This is less reliable than the above way and does not + # support multiple calls. + sed_extract_arguments=' +s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; +/'"$1"'(/ { + ta + :a + s/)/)/ + tb + s/\\$// + N + ba + :b + s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p +} +d' + sed -e "$sed_extract_arguments" "$configure_in" + ;; + esac +} + # func_usage # outputs to stdout the --help usage message. func_usage () @@ -165,7 +195,7 @@ func_version () { echo "$progname (GNU $package) $version" echo "Uses a versions archive in @ARCHIVE_FORMAT@ format." - echo "Copyright (C) 2002-2010 Free Software Foundation, Inc. + echo "Copyright (C) 2002-2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." @@ -258,15 +288,7 @@ 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. -sed_extract_AM_GNU_GETTEXT_VERSION_argument=' -s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; -/AM_GNU_GETTEXT_VERSION/ { - s,^.*AM_GNU_GETTEXT_VERSION(\([^()]*\)).*$,xver=\1, - s,^xver=\[\(.*\)\]$,xver=\1, - p -} -d' -eval `sed "$sed_extract_AM_GNU_GETTEXT_VERSION_argument" "$configure_in"` +xver=`func_trace AM_GNU_GETTEXT_VERSION` 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 @@ -304,15 +326,15 @@ case "$ver" in esac # Check in which directory config.rpath, mkinstalldirs etc. belong. -auxdir=`$autom4te --trace=AC_CONFIG_AUX_DIR:\$% "$configure_in"` +auxdir=`func_trace AC_CONFIG_AUX_DIR` if test -n "$auxdir"; then auxdir="$auxdir/" fi # Check in which directory the *.m4 macros belong. -macrodirs=`$autom4te --trace=AC_CONFIG_MACRO_DIR_TRACE:\$% "$configure_in"` +macrodirs=`func_trace AC_CONFIG_MACRO_DIR_TRACE` if test -z "$macrodirs"; then - macrodirs=`$autom4te --trace=AC_CONFIG_MACRO_DIR:\$% "$configure_in"` + macrodirs=`func_trace AC_CONFIG_MACRO_DIR` fi for arg in $macrodirs; do m4dir="$arg" @@ -339,25 +361,17 @@ if test -z "$m4dir" && test -f Makefile.am; then fi # Check whether to omit the intl/ directory. -omitintl=`cat "$configure_in" | grep '^AM_GNU_GETTEXT' | sed -n -e 's/^AM_GNU_GETTEXT(\([^(),]*\).*$/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q` -omitintl=`if test 'external' = "$omitintl"; then echo yes; fi` +omitintl=no +xargs=`func_trace AM_GNU_GETTEXT` +for arg in $xargs; do + if test 'external' = "$arg"; then + omitintl=yes + break + fi +done # Check in which directory or directories the po/* infrastructure belongs. -sed_extract_config_files='s,#.*$,, -s,^dnl .*$,, -s, dnl .*$,, -/AC_CONFIG_FILES(/ { - ta - :a - s/)/)/ - tb - s/\\$// - N - ba - :b - s,^.*AC_CONFIG_FILES([[ ]*\([^]"$`\\)]*\).*$,\1,p -}' -configfiles=`cat "$configure_in" | sed -n -e "$sed_extract_config_files"` +configfiles=`func_trace AC_CONFIG_FILES` # PO directories have a Makefile.in generated from Makefile.in.in. # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO diff --git a/gettext-tools/misc/gettextize.in b/gettext-tools/misc/gettextize.in index 319543c..6319042 100644 --- a/gettext-tools/misc/gettextize.in +++ b/gettext-tools/misc/gettextize.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 1995-1998, 2000-2010 Free Software Foundation, Inc. +# Copyright (C) 1995-1998, 2000-2013 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 @@ -165,7 +165,7 @@ Report bugs to <bug-gnu-gettext@gnu.org>." func_version () { echo "$progname (GNU $package) $version" - echo "Copyright (C) 1995-1998, 2000-2010 Free Software Foundation, Inc. + echo "Copyright (C) 1995-1998, 2000-2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." |