autoconf-patches
[Top][All Lists]
Advanced

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

01-nested-autoupdate.patch


From: Akim Demaille
Subject: 01-nested-autoupdate.patch
Date: 16 Oct 2000 09:42:14 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Hi people!

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        Fix autoupdate: updating `AC_OUTPUT_COMMANDS' was failing because
        it includes another AU defined macro.

        * autoupdate.sh (input.m4:_au_defun): New macro.
        (au.m4): Use it instead of inlining _au_enable/_au_disable
        invocations in the definition of all these macros.
        (input.m4:__au_enable, input.m4:__au_disable): New macros.
        (input.m4:_au_enable, input.m4:_au_disable): Use them.
        * tests/mktests.sh (update_exclude_list): Add `AC_OUTPUT'.
        Running it twice in a configure.in is not valid.
        Add `AC_LINK_FILES' since it requires arguments.
        * tests/tools.m4 (autoupdating AC_LINK_FILES): New test.

Index: autoupdate.sh
--- autoupdate.sh Sun, 15 Oct 2000 09:30:12 +0200 akim (ace/11_autoupdate 1.23 
666)
+++ autoupdate.sh Sun, 15 Oct 2000 19:18:49 +0200 akim (ace/11_autoupdate 1.23 
666)
@@ -239,8 +239,8 @@
   >$tmp/au-del.sed

 # au.m4 -- definitions the AU macros.
-$autoconf --trace AU_DEFUN:'define(@<:@$1@:>@,
-@<:@_au_enable[]$2[]_au_disable@:>@)' -i /dev/null \
+$autoconf --trace AU_DEFUN:'_au_defun(@<:@$1@:>@,
+@<:@$2@:>@)' -i /dev/null \
   >$tmp/au.m4

 # quote.sed -- enable the quote `[', `]' right before any AU macro.
@@ -280,21 +280,43 @@
   # input.m4 -- m4 program to produce the updated file.
   # Load the values, the dispatcher, neutralize m4, and the prepared
   # input file.
-  $sed 's/^ *//' >$tmp/input.m4 <<EOF
+  $sed 's/^    //' >$tmp/input.m4 <<EOF
     divert(-1)                                            -*- Autoconf -*-
     changequote([, ])

     # Move all the builtins into the \`_au_' pseudo namespace
     include([$tmp/m4save.m4])

+    # _au_defun(NAME, BODY)
+    # ---------------------
+    # Define NAME to BODY, plus AU activation/deactivation.
+    define([_au_defun],
+    [define([\$1],
+    [_au_enable()dnl
+    \$2[]dnl
+    _au_disable()])])
+
     # Import the definition of the obsolete macros.
     include([$tmp/au.m4])

-    # _au_enable
-    # ----------
-    # Called at the beginning of all the obsolete macros.  Reenable the
-    # builtins, and libm4.
-    define([_au_enable],
+
+    ## ------------------------ ##
+    ## _au_enable/_au_disable.  ##
+    ## ------------------------ ##
+
+    # They work by pair: each time an AU macro is activated, it runs
+    # _au_enable, and at its end its runs _au_disable (see _au_defun
+    # above).  But since AU macros might use AU macros, which should
+    # enable/disable only for the outter AU macros.
+    #
+    # \`_au_enabled' is used to this end, condionning whether we really
+    # enable/disable.
+
+
+    # __au_enable
+    # -----------
+    # Reenable the builtins, and libm4.
+    define([__au_enable],
     [_au_divert(-1)
     # Enable special characters.
     _au_changecom([#])
@@ -306,23 +328,46 @@

     _au_divert(0)])

-    # _au_disable
-    # -----------
-    # Called at the end of all the obsolete macros.  Disable the
-    # builtins, and libm4.
-    define([_au_disable],
+    # _au_enable
+    # ----------
+    # Called at the beginning of all the obsolete macros.  Reenable the
+    # builtins, and libm4 if needed.
+    define([_au_enable],
+    [_au_ifdef([_au_enabled],
+               [],
+               [__au_enable()])_au_dnl
+    _au_pushdef([_au_enabled])])
+
+
+    # __au_disable
+    # ------------
+    # Disable the builtins, and libm4.
+    define([__au_disable],
     [_au_divert(-1)
     # Disable libm4, the AC autoquoting macros, and m4.
     _au_include([$tmp/disable.m4])
     _au_include([$tmp/unm4.m4])

-     # Disable special characters.
-     _au_changequote()
-     _au_changecom()
+    # Disable special characters.
+    _au_changequote()
+    _au_changecom()

-     _au_divert(0)])
+    _au_divert(0)])

-    # Disable, and process.
+    # _au_disable
+    # -----------
+    # Called at the end of all the obsolete macros.  Disable the
+    # builtins, and libm4 if needed..
+    define([_au_disable],
+    [_au_popdef([_au_enabled])_au_dnl
+    _au_ifdef([_au_enabled],
+              [],
+              [__au_disable()])])
+
+
+    ## ------------------------------- ##
+    ## Disable, and process the file.  ##
+    ## ------------------------------- ##
     _au_disable()_au_dnl
 EOF

@@ -975,7 +1020,22 @@ AC_DEFUN.
     _au_changequote([, ])OLD(1, 2)
     NEW([0, 0], [0])

-Finally, version V is ready.  And there is much rejoicing.  (And I
+Finally, version V is ready.
+
+Well... almost.
+
+There is a slight problem that remains: if an AU macro OUTTER includes
+an AU macro INNER, then _au_enable will be run when entering OUTTER
+and when entering INNER (not good, but not too bad yet).  But when
+getting out of INNER, _au_disable will disable everything while we
+were still in OUTTER.  Badaboom.
+
+Therefore _au_enable and _au_disable have to be written to work by
+pairs: each _au_enable pushdef's _au_enabled, and each _au_disable
+popdef's _au_enabled.  And of course _au_enable and _au_disable are
+effective when _au_enabled is *not* defined.
+
+Finally, version V' is ready.  And there is much rejoicing.  (And I
 have free time again.  I think.  Yeah, right.)

 EOF
Index: tests/syntax.m4
--- tests/syntax.m4 Sun, 15 Oct 2000 09:30:12 +0200 akim (ace/b/21_syntax.m4 
1.11 666)
+++ tests/syntax.m4 Sun, 15 Oct 2000 19:27:06 +0200 akim (ace/b/21_syntax.m4 
1.11 666)
@@ -13,12 +13,12 @@
 AT_CHECK_MACRO([AC_ARG_PROGRAM])
 AT_CHECK_MACRO([AC_ARG_WITH])
 AT_CHECK_MACRO([AC_CANONICAL_TARGET])
+AT_CHECK_MACRO([AC_CHECK_TOOL_PREFIX])
+AT_CHECK_MACRO([AC_COMPILE_CHECK])
 AT_CHECK_MACRO([AC_C_BIGENDIAN])
 AT_CHECK_MACRO([AC_C_CHAR_UNSIGNED])
 AT_CHECK_MACRO([AC_C_CROSS])
-AT_CHECK_MACRO([AC_CHECK_TOOL_PREFIX])
 AT_CHECK_MACRO([AC_C_LONG_DOUBLE])
-AT_CHECK_MACRO([AC_COMPILE_CHECK])
 AT_CHECK_MACRO([AC_C_PROTOTYPES])
 AT_CHECK_MACRO([AC_C_STRINGIZE])
 AT_CHECK_MACRO([AC_DECL_SYS_SIGLIST])
Index: tests/tools.m4
--- tests/tools.m4 Sun, 15 Oct 2000 09:30:12 +0200 akim (ace/b/30_tools.m4 1.15 
666)
+++ tests/tools.m4 Sun, 15 Oct 2000 19:41:14 +0200 akim (ace/b/30_tools.m4 1.15 
666)
@@ -160,7 +160,7 @@
 ## autoupdate.  ##
 ## ------------ ##

-# Check that AC_LINK_FILES and AC_OUTPUT are properly updated.
+# Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
 AT_SETUP(autoupdate)

 AT_DATA(configure.in,
@@ -185,6 +185,31 @@
 AT_CLEANUP


+AT_SETUP([autoupdating AC_LINK FILES])
+
+AT_DATA(configure.in,
+[[AC_INIT
+AC_LINK_FILES(dst1 dst2, src1 src2)
+AC_OUTPUT
+]])
+
+AT_DATA(dst1, dst1
+)
+AT_DATA(dst2, dst2
+)
+
+# Checking `autoupdate'.
+AT_CHECK([../autoupdate --autoconf-dir $top_srcdir], 0, [],
+         [autoupdate: `configure.in' is updated
+])
+AT_CHECK([../autoconf --autoconf-dir $top_srcdir], 0)
+AT_CHECK([./configure], 0, ignore)
+AT_CHECK([cat src1], 0, [dst1
+])
+AT_CHECK([cat src2], 0, [dst2
+])
+
+AT_CLEANUP


 ## ------------------ ##



reply via email to

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