autoconf-patches
[Top][All Lists]
Advanced

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

FYI: Move on here-docs


From: Akim Demaille
Subject: FYI: Move on here-docs
Date: 09 Jun 2001 20:40:52 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Copyleft)

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * doc/autoconf.texi (Limitations of Builtins): Complete the
        description of the here-docs penalties with Alexandre Oliva's
        explanations.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.457
diff -u -u -r1.457 autoconf.texi
--- doc/autoconf.texi 2001/06/09 18:28:20 1.457
+++ doc/autoconf.texi 2001/06/09 18:38:30
@@ -5975,6 +5975,39 @@
 shell, e.g., by using the command @samp{bash ./configure} rather than
 plain @samp{./configure}.
 
+Some shells can be extremely inefficient when there are a lot of
+here-documents inside a single statement.  For instance if your
address@hidden includes something like:
+
address@hidden
address@hidden
+if <cross_compiling>; then
+  assume this and that
+else
+  check this
+  check that
+  check something else
+  on and on forever
+fi
address@hidden group
address@hidden example
+
+A shell parses the whole @code{if}/@code{fi} construct, creating
+temporary files for each here document in it.  Some shells create links
+for such here-documents on every @code{fork ()}, so that the clean-up
+code they had installed correctly removes them.  It is creating the
+links that the shell can take forever.
+
+Moving the tests out of the @code{if}/@code{fi}, or creating multiple
address@hidden/@code{fi} constructs, would improve the performance
+significantly.  Anyway, this kind of construct is not exactly the
+typical use of Autoconf.  In fact, it's even not recommended, because M4
+macros can't look into shell conditionals, so we may fail to expand a
+macro when it was expanded before in a conditional path, and the
+condition turned out to be false at run-time, and we end up not
+executing the macro at all.
+
+
 @item @command{exit}
 @c -----------------
 @cindex @command{exit}



reply via email to

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