autoconf: 1999-09-29 Akim Demaille <akim@epita.fr> (4341b)

From 4341ba89a357afa5324fa433ca46f6437e4b21b4 Mon Sep 17 00:00:00 2001
From: Akim Demaille <[EMAIL REDACTED]>
Date: Fri, 1 Oct 1999 12:41:40 +0000
Subject: [PATCH] 1999-09-29  Akim Demaille  <akim@epita.fr>

	* acgeneral.m4 (AC_WRAP): Don't output an extra space after the
	last word.
---
 ChangeLog               |  5 +++++
 acgeneral.m4            | 16 ++++++++++++----
 lib/autoconf/general.m4 | 16 ++++++++++++----
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 697907a1..901e5203 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-09-29  Akim Demaille  <akim@epita.fr>
+
+	* acgeneral.m4 (AC_WRAP): Don't output an extra space after the
+	last word.
+
 1999-09-29  Akim Demaille  <akim@epita.fr>
 
 	Merged the trunk into the experimental branch.
diff --git a/acgeneral.m4 b/acgeneral.m4
index 38d21b83..279d851a 100644
--- a/acgeneral.m4
+++ b/acgeneral.m4
@@ -582,23 +582,31 @@ dnl FIXME: there is no checking of a longer PREFIX than WIDTH, but do
 dnl we really want to bother with people trying each single corner
 dnl of a software?
 dnl
-dnl FIXME: Currently this macro leaves a white space behind it, which,
-dnl in some cases is quite a pain.  Remove this trailing space.
+dnl This macro does not leave a trailing space behind the last word,
+dnl what complicates it a bit.  The algorithm is stupid simple: all the
+dnl words are preceded by AC_Separator which is defined to empty for the
+dnl first word, and then ` ' (single space) for all the others.
 define([AC_WRAP],
 [pushdef([AC_Prefix], m4_default([$2], []))dnl
 pushdef([AC_Prefix1], m4_default([$3], [AC_Prefix]))dnl
 pushdef([AC_Width], m4_default([$4], 79))dnl
 pushdef([AC_Cursor], len(AC_Prefix1))dnl
+pushdef([AC_Separator], [])dnl
 AC_Prefix1[]dnl
 ifelse(m4_eval(AC_Cursor > len(AC_Prefix)),
        1, [define([AC_Cursor], len(AC_Prefix))
 AC_Prefix])[]dnl
 AC_FOREACH([AC_Word], [$1],
 [define([AC_Cursor], m4_eval(AC_Cursor + len(AC_Word) + 1))dnl
+dnl New line if too long, else insert a space unless it is the first
+dnl of the words.
 ifelse(m4_eval(AC_Cursor > AC_Width),
        1, [define([AC_Cursor], m4_eval(len(AC_Prefix) + len(AC_Word) + 1))]
-AC_Prefix)dnl
-AC_Word ])dnl
+AC_Prefix,
+       [AC_Separator])[]dnl
+AC_Word[]dnl
+define([AC_Separator], [ ])])dnl
+popdef([AC_Separator])dnl
 popdef([AC_Cursor])dnl
 popdef([AC_Width])dnl
 popdef([AC_Prefix1])dnl
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 38d21b83..279d851a 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -582,23 +582,31 @@ dnl FIXME: there is no checking of a longer PREFIX than WIDTH, but do
 dnl we really want to bother with people trying each single corner
 dnl of a software?
 dnl
-dnl FIXME: Currently this macro leaves a white space behind it, which,
-dnl in some cases is quite a pain.  Remove this trailing space.
+dnl This macro does not leave a trailing space behind the last word,
+dnl what complicates it a bit.  The algorithm is stupid simple: all the
+dnl words are preceded by AC_Separator which is defined to empty for the
+dnl first word, and then ` ' (single space) for all the others.
 define([AC_WRAP],
 [pushdef([AC_Prefix], m4_default([$2], []))dnl
 pushdef([AC_Prefix1], m4_default([$3], [AC_Prefix]))dnl
 pushdef([AC_Width], m4_default([$4], 79))dnl
 pushdef([AC_Cursor], len(AC_Prefix1))dnl
+pushdef([AC_Separator], [])dnl
 AC_Prefix1[]dnl
 ifelse(m4_eval(AC_Cursor > len(AC_Prefix)),
        1, [define([AC_Cursor], len(AC_Prefix))
 AC_Prefix])[]dnl
 AC_FOREACH([AC_Word], [$1],
 [define([AC_Cursor], m4_eval(AC_Cursor + len(AC_Word) + 1))dnl
+dnl New line if too long, else insert a space unless it is the first
+dnl of the words.
 ifelse(m4_eval(AC_Cursor > AC_Width),
        1, [define([AC_Cursor], m4_eval(len(AC_Prefix) + len(AC_Word) + 1))]
-AC_Prefix)dnl
-AC_Word ])dnl
+AC_Prefix,
+       [AC_Separator])[]dnl
+AC_Word[]dnl
+define([AC_Separator], [ ])])dnl
+popdef([AC_Separator])dnl
 popdef([AC_Cursor])dnl
 popdef([AC_Width])dnl
 popdef([AC_Prefix1])dnl