autoconf-patches
[Top][All Lists]
Advanced

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

[Autoconf-patches] No more empty lines from m4_ifvanl


From: Pavel Roskin
Subject: [Autoconf-patches] No more empty lines from m4_ifvanl
Date: Tue, 19 Sep 2000 17:15:46 -0400 (EDT)

Hello!

This patch changes the behaviour of the "m4_ifvanl" macro - now it doesn't
emit an empty line for empty arguments.

This reduces significantly the number of empty lines in configure scripts
produced by Autoconf. Consider e.g. this construct from AC_SHELL_IFELSE:

m4_ifvanl([$3],
[else
  $3])dnl
fi

If [$3] is not empty - fine, it will be printed with a trailing newline
between "else" and "fi". But if [$3] is empty there will be a newline
anyway, this time from the missing third argument to m4_ifvanl. This will
result in a newline before "fi".

More important issue is autoupdate. For example, autoupdate now adds two
newlines before AC_OUTPUT. Autoupdate output may be edited by humans, thus
it is important not to change the existing formatting.

I realize that modifying m4_ifvanl is a dangerous thing, but all the
callers have been examined and the testsuite still passes.

Regards,
Pavel Roskin

================================
Index: ChangeLog
--- ChangeLog   Tue Sep 19 14:17:34 2000
+++ ChangeLog   Tue Sep 19 16:54:16 2000
@@ -0,0 +1,5 @@
+2000-09-19  Pavel Roskin  <address@hidden>
+
+       * libm4.m4 (m4_ifvanl): Don't output a newline for empty
+       arguments
+
Index: libm4.m4
--- libm4.m4    Mon Aug  7 09:13:48 2000
+++ libm4.m4    Tue Sep 19 16:51:14 2000
@@ -184,12 +184,13 @@
 
 # m4_ifvanl(COND, [IF-TRUE], [IF-FALSE])
 # --------------------------------------
-# Same as `ifval', but add an extra newline to IF-TRUE or IF-FALSE.
+# Same as `ifval', but add an extra newline to IF-TRUE or IF-FALSE
+# unless that argument is empty.
 define([m4_ifvanl], [ifelse([$1], [],
-[$3
-],
-[$2
-])])
+[ifelse([$3], [], [], [$3
+])],
+[ifelse([$2], [], [], [$2
+])])])
 
 
 # ifset(MACRO, [IF-TRUE], [IF-FALSE])
================================




reply via email to

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