]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Refactor Autoconf trace in autopoint.in.
authorDaiki Ueno <ueno@gnu.org>
Wed, 1 May 2013 09:16:28 +0000 (18:16 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 2 May 2013 05:51:41 +0000 (14:51 +0900)
gettext-tools/misc/ChangeLog
gettext-tools/misc/autopoint.in
gettext-tools/misc/gettextize.in

index 5704341c651ae87bb1081b95b18ce5c81535e7f2..d31f45bf52cc5f53f32ba53564f4147236748aca 100644 (file)
@@ -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
index 745fdb4f33e5d3482a4e4d7211bce40dd0cc0eb8..87723ec01b8205c72263228f13f55dec79f8ad86 100644 (file)
@@ -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
index 319543cbda7b7416e782b8301e216c59fa9295df..63190428aab3c5ad0a982128a821c132e3bfc8a2 100644 (file)
@@ -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."