autoconf-patches
[Top][All Lists]
Advanced

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

[RFT] Remove three forks per _AC_RUN_LOG_STDERR


From: Paolo Bonzini
Subject: [RFT] Remove three forks per _AC_RUN_LOG_STDERR
Date: Thu, 06 Nov 2008 11:28:29 +0100
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

In the most common case in which nothing is printed on stderr, we can
avoid the grep, cat and rm to log things on AS_MESSAGE_LOG_FD.  Some
juggling is needed so that conftest.err is provided even when the "if"
condition is false, but even that will not add any fork in that case.

Can anybody test this on Cygwin to see if it gives any interesting speedup?

Paolo

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index de4de33..1ed6a8d 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2253,11 +2253,13 @@ AC_DEFUN([_AC_RUN_LOG],
 # in AS_IF constructs.
 AC_DEFUN([_AC_RUN_LOG_STDERR],
 [{ { $2; } >&AS_MESSAGE_LOG_FD
-  ($1) 2>conftest.er1
+  ($1) 2>conftest.err
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&AS_MESSAGE_LOG_FD
+    mv conftest.er1 conftest.err
+  fi
   _AS_ECHO_LOG([\$? = $ac_status])
   test $ac_status = 0; }])





reply via email to

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