From: Derek Price Date: Thu, 27 Mar 2003 13:18:34 +0000 (+0000) Subject: * lib/autoconf/general.m4 (AC_ARG_VAR): Use AS_HELP_STRING instead of X-Git-Tag: AUTOCONF-2.57a~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed71ef7fc3b8c5598bda5a79a7f7d682a4268cc2;p=thirdparty%2Fautoconf.git * 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. * tests/acgeneral.at: Regenerated. --- diff --git a/ChangeLog b/ChangeLog index 8a7c7aa29..e76ab3909 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-03-26 Derek Price + + * 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. + + * tests/acgeneral.at: Regenerated. + 2003-03-26 Derek Price * lib/autotest/general.m4: s/DEFAULT/DEFAULTS/ since it makes more diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index e5d8c49ef..ef89a3523 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -214,54 +214,10 @@ m4_define([AC_FOREACH], ## ----------------------------------- ## -# 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([$@])dnl ]) @@ -1484,7 +1440,7 @@ m4_divert_once([HELP_VAR_END], [[ 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 diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 497775c45..ee2cfa7a5 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -850,6 +850,59 @@ _AS_PATH_WALK([$PATH], [echo "PATH: $as_dir"]) }]) +# 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. ## diff --git a/tests/acgeneral.at b/tests/acgeneral.at index 324d05c72..e70f6aa56 100644 --- a/tests/acgeneral.at +++ b/tests/acgeneral.at @@ -16,6 +16,7 @@ AT_CHECK_MACRO([AC_PREFIX_DEFAULT]) 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]) diff --git a/tests/m4sh.at b/tests/m4sh.at index 0bdf57825..7fbce6503 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -352,3 +352,31 @@ AT_CHECK_M4SH 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@&t@_HELP_STRING]]) + +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