[BRLTTY] Building with Autoconf 2.62

Stepan Kasal kasal at ucw.cz
Fri Sep 12 15:14:31 EDT 2008


Hello Dave,
  I have written the patch, find it attached to this mail.
(The name of the file is the same, but the contents differs from what
I mailed previously.)
Please bear with me for a moment, the explanation is somewhat longer.

I have noticed one more problem with Autoconf 2.62: the help is
misformatted:

  --with-text-table=FILE        default text table
                                - cz
                                           Czech (iso-8859-2)
                                - da
                                           Danish (iso-8859-1)
				etc.

The text for "cz" on the next line, while it should be on the same.

I traced this to the usage of m4_text_wrap in BRLTTY_TEXT_TABLE.
Let me quote from
http://www.gnu.org/software/autoconf/manual/html_node/Text-processing-Macros.html
---
m4_text_wrap (STRING, [PREFIX], [PREFIX1], [WIDTH])
[...] If PREFIX1 is longer than PREFIX, then the first line consists
of just PREFIX1. [...] No expansions occur on PREFIX, PREFIX1, or
STRING, [...]
---
The NEWS file explains that the macro m4_text_wrap was first
documented in 2.62, after some ``bug fixes or semantic changes.''

Then I realized that the above behaviour was a consequence of the
fact that the parameter PREFIX1 was the long unexpanded string
containing "m4_format([%-8s " etc.
Later on, macro brltty_tables_text has been expanded again, so the
cause of the problem was somewhat masked.

That's how I came to the second half of the attached patch.

Then I looked again to our original problem; I noticed that
AS_HELP_STRING contains code to support the previous undocumented
behaviour.  So there is no need to supply the number instead of the
prefix, we just have to expand the prefix before we pass it, so that
it is recognized.  In the patch, I'm using
   ..., m4_defn([brltty_help_prefix]))
but
   ..., []brltty_help_prefix))
would work as well, choose whatever you like more.

(m4_defn does expand only once, ie. not recursively, and the result
is quoted.  The [] in the second is necessary to stop the white space
skipping when macro parameters are collected.)

I have tested that the patch does work with Autoconf 2.62, and that
it does not change a byte in the resulting configure with Autoconf
2.59.  It does apply cleanly to the svn version fo brltty.

On Thu, Sep 11, 2008 at 09:46:03AM -0400, Dave Mielke wrote:
> Can you tell me how to test which release of autoconf is running?

So this is a purely academical question now.  Anyway:

Autoconf 2.62 has introduced macro AC_AUTOCONF_VERSION; in prior
versions, this macro was not defined.  To compare versions, there is
m4_version_compare, documented since 2.62.
But in this particular case, you could use
m4_ifdef([AC_AUTOCONF_VERSION],  ... )
to check for version >= 2.62.
If you are interested, see:
http://www.gnu.org/software/autoconf/manual/html_node/Versioning.html

Have a nice day,
	Stepan Kasal
-------------- next part --------------
2008-09-12  Stepan Kasal  <skasal at redhat.com>


	* aclocal.m4 (BRLTTY_HELP_STRING, BRLTTY_TEXT_TABLE,
	BRLTTY_ATTRIBUTES_TABLE): Expand parameters to AC_HELP_STRING
	and m4_text_wrap, to be compatible with Autoconf 2.62+.

--- brltty-3.9.orig/aclocal.m4.orig	2007-10-17 17:19:31.000000000 +0200
+++ brltty-3.9.orig/aclocal.m4	2008-09-12 18:05:21.000000000 +0200
@@ -144,7 +144,7 @@
 
 AC_DEFUN([BRLTTY_HELP_STRING], [dnl
 AC_HELP_STRING([$1], patsubst([$2], [
-.*$]), [brltty_help_prefix])dnl
+.*$]), m4_defn([brltty_help_prefix]))dnl
 patsubst(patsubst([$2], [\`[^
 ]*]), [
 ], [\&brltty_help_prefix])[]dnl
@@ -384,11 +384,11 @@
 
 AC_DEFUN([BRLTTY_TEXT_TABLE], [dnl
 define([brltty_tables_text], ifdef([brltty_tables_text], [brltty_tables_text])[
-m4_text_wrap([$2], [           ], [- m4_format([%-8s ], [$1])], brltty_help_width)])])
+m4_text_wrap([$2], [           ], [- ]m4_format([%-8s ], [$1]), brltty_help_width)])])
 
 AC_DEFUN([BRLTTY_ATTRIBUTES_TABLE], [dnl
 define([brltty_tables_attributes], ifdef([brltty_tables_attributes], [brltty_tables_attributes])[
-m4_text_wrap([$2], [             ], [- m4_format([%-10s ], [$1])], brltty_help_width)])])
+m4_text_wrap([$2], [             ], [- ]m4_format([%-10s ], [$1]), brltty_help_width)])])
 
 AC_DEFUN([BRLTTY_SUMMARY_BEGIN], [dnl
 brltty_summary_lines="Options Summary:"


More information about the BRLTTY mailing list