bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] autopoint and m4_ifndef


From: Daiki Ueno
Subject: Re: [bug-gettext] autopoint and m4_ifndef
Date: Tue, 23 Jul 2013 12:06:32 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Daiki Ueno <address@hidden> writes:

> After this commit we've started using:
>
>   autom4te --language=Autoconf-without-aclocal-m4 --trace
>
> to capture AC_CONFIG_MACRO_DIR* calls more reliably.  Unfortunately, in
> practical cases (like above), it may cause errors in M4 level.  I plan
> to revert it not to use autom4te (patch attached),

Perhaps we could make the autom4te trace robuster by loading some M4
files in advance, like the attached patch.  I could successfully
bootstrap util-linux with it, but maybe there are some corner-cases.

Comments would be appreciated.

Regards,
-- 
Daiki Ueno
>From 9e740aa427619b93c00ebc55cad891e5e11e5b08 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Tue, 23 Jul 2013 11:30:37 +0900
Subject: [PATCH] autopoint: make macro trace using autom4te robuster

* autopoint.in (func_trace): Ignore M4sugar macros which may abort
autom4te, and read gettext.m4 to trace AM_GNU_GETTEXT_* macros.
Reported by Sami Kerola in
<https://lists.gnu.org/archive/html/bug-gettext/2013-07/msg00002.html>.
---
 gettext-tools/misc/ChangeLog    |  8 ++++++++
 gettext-tools/misc/autopoint.in | 36 ++++++++++--------------------------
 2 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog
index bd4de9a..f6941ff 100644
--- a/gettext-tools/misc/ChangeLog
+++ b/gettext-tools/misc/ChangeLog
@@ -1,3 +1,11 @@
+2013-07-23  Daiki Ueno  <address@hidden>
+
+       autopoint: make macro trace using autom4te robuster
+       * autopoint.in (func_trace): Ignore M4sugar macros which may abort
+       autom4te and read gettext.m4 to trace AM_GNU_GETTEXT_* macros.
+       Reported by Sami Kerola in
+       <https://lists.gnu.org/archive/html/bug-gettext/2013-07/msg00002.html>.
+
 2013-07-21  Daiki Ueno  <address@hidden>
 
        * autopoint.in (omitintl): Don't set it 'no' when no
diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in
index 1ea960a..5ee12e3 100644
--- a/gettext-tools/misc/autopoint.in
+++ b/gettext-tools/misc/autopoint.in
@@ -140,32 +140,16 @@ fi
 # 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
+  aclocal_dir=`aclocal --print-ac-dir`
+  echo '\
+dnl ignore M4sugar macros which may abort autom4te
+m4_undefine([m4_assert])
+m4_undefine([m4_fatal])
+m4_undefine([m4_warn])
+m4_undefine([m4_errprintn])
+m4_undefine([m4_exit])' \
+  | autom4te --no-cache --language=Autoconf-without-aclocal-m4 \
+    --trace="$1":\$% - "$aclocal_dir/gettext.m4" "$configure_in"
 }
 
 # func_usage
-- 
1.8.3.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]