autoconf-patches
[Top][All Lists]
Advanced

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

02AS_HELP_STRING.diff


From: derek
Subject: 02AS_HELP_STRING.diff
Date: Wed, 26 Mar 2003 13:05:20 +0000

Index: ChangeLog
2003-03-21  Derek Price  <address@hidden>

        * lib/autoconf/general.m4 (AC_ARG_VAR): Use AS_HELP_STRING instead of
        obsolete AC_HELP_STRING.
        (AC_HELP_STRING): AU_DEFUN to...
        * lib/m4sugar/m4sh.m4 (AS_HELP_STRING): ...here.
        * tests/m4sh.at (AS_HELP_STRING): New test.

Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.812
diff -u -r1.812 general.m4
--- lib/autoconf/general.m4     20 Feb 2003 16:52:11 -0000      1.812
+++ lib/autoconf/general.m4     25 Mar 2003 22:32:10 -0000
@@ -214,54 +214,10 @@
 ## ----------------------------------- ##
 
 
-# AC_HELP_STRING(LHS, RHS, [COLUMN])
+# AU::AC_HELP_STRING(LHS, RHS, [COLUMN])
 # ----------------------------------
-#
-# Format an Autoconf macro's help string so that it looks pretty when
-# the user executes "configure --help".  This macro takes three
-# arguments, a "left hand side" (LHS), a "right hand side" (RHS), and
-# the COLUMN which is a string of white spaces which leads to the
-# the RHS column (default: 26 white spaces).
-#
-# The resulting string is suitable for use in other macros that require
-# a help string (e.g. AC_ARG_WITH).
-#
-# Here is the sample string from the Autoconf manual (Node: External
-# Software) which shows the proper spacing for help strings.
-#
-#    --with-readline         support fancy command line editing
-#  ^ ^                       ^
-#  | |                       |
-#  | column 2                column 26
-#  |
-#  column 0
-#
-# A help string is made up of a "left hand side" (LHS) and a "right
-# hand side" (RHS).  In the example above, the LHS is
-# "--with-readline", while the RHS is "support fancy command line
-# editing".
-#
-# If the LHS extends past column 24, then the LHS is terminated with a
-# newline so that the RHS is on a line of its own beginning in column
-# 26.
-#
-# Therefore, if the LHS were instead "--with-readline-blah-blah-blah",
-# then the AC_HELP_STRING macro would expand into:
-#
-#
-#    --with-readline-blah-blah-blah
-#  ^ ^                       support fancy command line editing
-#  | |                       ^
-#  | column 2                |
-#  column 0                  column 26
-#
-m4_define([AC_HELP_STRING],
-[m4_pushdef([AC_Prefix], m4_default([$3], [                          ]))dnl
-m4_pushdef([AC_Prefix_Format],
-           [  %-]m4_eval(m4_len(AC_Prefix) - 3)[s ])dnl [  %-23s ]
-m4_text_wrap([$2], AC_Prefix, m4_format(AC_Prefix_Format, [$1]))dnl
-m4_popdef([AC_Prefix_Format])dnl
-m4_popdef([AC_Prefix])dnl
+AU_DEFUN([AC_HELP_STRING],
+[AS_HELP_STRING(address@hidden)dnl
 ])
 
 
@@ -1484,7 +1440,7 @@
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.]])dnl
 m4_expand_once([m4_divert_once([HELP_VAR],
-                               [AC_HELP_STRING([$1], [$2], [              
])])],
+                               [AS_HELP_STRING([$1], [$2], [              
])])],
                [$0($1)])dnl
 _AC_ARG_VAR_PRECIOUS([$1])dnl
 ])# AC_ARG_VAR
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.93
diff -u -r1.93 m4sh.m4
--- lib/m4sugar/m4sh.m4 25 Feb 2003 06:45:05 -0000      1.93
+++ lib/m4sugar/m4sh.m4 25 Mar 2003 22:32:11 -0000
@@ -850,6 +850,59 @@
 }])
 
 
+# AS_HELP_STRING(LHS, RHS, [COLUMN])
+# ----------------------------------
+#
+# Format a help string so that it looks pretty when
+# the user executes "script --help".  This macro takes three
+# arguments, a "left hand side" (LHS), a "right hand side" (RHS), and
+# the COLUMN which is a string of white spaces which leads to the
+# the RHS column (default: 26 white spaces).
+#
+# The resulting string is suitable for use in other macros that require
+# a help string (e.g. AC_ARG_WITH).
+#
+# Here is the sample string from the Autoconf manual (Node: External
+# Software) which shows the proper spacing for help strings.
+#
+#    --with-readline         support fancy command line editing
+#  ^ ^                       ^
+#  | |                       |
+#  | column 2                column 26
+#  |
+#  column 0
+#
+# A help string is made up of a "left hand side" (LHS) and a "right
+# hand side" (RHS).  In the example above, the LHS is
+# "--with-readline", while the RHS is "support fancy command line
+# editing".
+#
+# If the LHS is contains more than (COLUMN - 3) characters, then the LHS
+# is terminated with a newline so that the RHS starts on a line of its
+# own beginning with COLUMN.  In the default case, this corresponds to
+# an LHS with more than 23 characters.
+#
+# Therefore, in the example, if the LHS were instead
+# "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
+# expand into:
+#
+#
+#    --with-readline-blah-blah-blah
+#  ^ ^                       support fancy command line editing
+#  | |                       ^
+#  | column 2                |
+#  column 0                  column 26
+#
+m4_define([AS_HELP_STRING],
+[m4_pushdef([AS_Prefix], m4_default([$3], [                          ]))dnl
+m4_pushdef([AS_Prefix_Format],
+           [  %-]m4_eval(m4_len(AS_Prefix) - 3)[s ])dnl [  %-23s ]
+m4_text_wrap([$2], AS_Prefix, m4_format(AS_Prefix_Format, [$1]))dnl
+m4_popdef([AS_Prefix_Format])dnl
+m4_popdef([AS_Prefix])dnl
+])
+
+
 
 ## ------------------------------------ ##
 ## Common m4/sh character translation.  ##
Index: tests/acgeneral.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/acgeneral.at,v
retrieving revision 1.6
diff -u -r1.6 acgeneral.at
--- tests/acgeneral.at  27 Oct 2002 18:30:39 -0000      1.6
+++ tests/acgeneral.at  25 Mar 2003 22:32:11 -0000
@@ -16,6 +16,7 @@
 AT_CHECK_AU_MACRO([AC_CHECKING])
 AT_CHECK_AU_MACRO([AC_COMPILE_CHECK])
 AT_CHECK_AU_MACRO([AC_ENABLE])
+AT_CHECK_AU_MACRO([AC_HELP_STRING])
 AT_CHECK_AU_MACRO([AC_TRY_COMPILE])
 AT_CHECK_AU_MACRO([AC_TRY_CPP])
 AT_CHECK_AU_MACRO([AC_TRY_LINK])
Index: tests/m4sh.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/m4sh.at,v
retrieving revision 1.35
diff -u -r1.35 m4sh.at
--- tests/m4sh.at       28 Sep 2002 14:10:11 -0000      1.35
+++ tests/m4sh.at       25 Mar 2003 22:32:11 -0000
@@ -352,3 +352,31 @@
 AT_CHECK([./script])
 
 AT_CLEANUP
+
+## -------------- ##
+## AS_HELP_STRING ##
+## -------------- ##
+
+# I'm not totally certain that we want to enforce the defaults here,
+# but at least it is being tested.
+
+AT_SETUP([[AS@&address@hidden)
+
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+_AS_LINENO_PREPARE
+
+echo "AS_HELP_STRING([--an-option],[some text])"
+echo "AS_HELP_STRING([--another-much-longer-option],
+[some other text which should wrap at our default of 80 characters.])"
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([./script], [0],
+[  --an-option             some text
+  --another-much-longer-option
+                          some other text which should wrap at our default of
+                          80 characters.
+])
+
+AT_CLEANUP




reply via email to

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