autoconf-patches
[Top][All Lists]
Advanced

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

Re: autoupdate fun


From: Ralf Wildenhues
Subject: Re: autoupdate fun
Date: Mon, 27 Mar 2006 20:06:57 +0200
User-agent: Mutt/1.5.9i

Hi Stepan,

> * Stepan Kasal wrote on Wed, Mar 22, 2006 at 12:49:20AM CET:
> >   I have a patch prepared on my disk.
> > The problem was that if configure.ac started with
> >     AC_PREREQ(2.54)
> >     m4_define([gnumeric_version_epoch], [1])
> >     ...
> > then the m4_define disappeared after an autoupdate run.
> > 
> > The fix happen to be quite a big change, but I'm quite sure it makes
> > things more consistent.  Please see the attached patch.

How about this patch on top of yours?  It turns this:

$ cat configure.ac
AC_INIT
AC_CYGWIN
$ autoupdate
configure.ac:102: warning: AC_CYGWIN is obsolete: use AC_CANONICAL_HOST and 
check if $host_os
matches *cygwin*

into this:

$ autoupdate
configure.ac:2: warning: AC_CYGWIN is obsolete: use AC_CANONICAL_HOST and check 
if $host_os
matches *cygwin*

?  Note the last changed line is a bit underquoted, but I think it is ok
to expect that neither _au__first_line nor _first_line have been defined
before (else it would need another round of changequotes inside that
last line before the user line).

Alternatively, do you think we should rather redefine __line__ (so that
whatever user code may use that also gets the correct lines)?

Cheers,
Ralf

        * bin/autoupdate.in: Redefine m4_location so that warnings print
        the correct lines of the input file by subtracting..
        (_au__first_line): ..this new definition.

--- bin/autoupdate.in   2006-03-27 19:50:55.000000000 +0200
+++ bin/autoupdate.in   2006-03-27 19:51:35.000000000 +0200
@@ -288,6 +288,9 @@
       # Redefine __file__ to make warnings nicer; $file is replaced below.
       m4_define([__file__], [$file])
 
+      # Redefine m4_location to fix the line number.
+      m4_define([m4_location], [__file__:m4_eval(__line__ - _au__first_line)])
+
       # Move all the builtins into the `_au_' pseudo namespace
       m4_include([m4save.m4])
 
@@ -373,11 +376,11 @@
       # `_au_disable' would be wrong.
       _au__include([unm4.m4])
 
-      # Disable special characters.
+      # Disable special characters, and set the first line number.
       _au_m4_changequote()
       _au_m4_changecom()
 
-      _au__divert(0)_au_dnl
+      _au_m4_define(_au__first_line, _au___line__)_au__divert(0)_au_dnl
 EOF
 
     $input_m4 =~ s/^      //mg;




reply via email to

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