[libvirt] [PATCH 06/89] m4/virt-lib: introduce LIBVIRT_ARG_WITH(_ALT) macro

Jiri Denemark jdenemar at redhat.com
Mon Dec 19 12:13:41 UTC 2016


On Fri, Dec 16, 2016 at 10:10:34 +0100, Pavel Hrdina wrote:
> Those macros helps to create unified output of "configure --help".

"These macros help create"...

> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  m4/virt-lib.m4 | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 86 insertions(+)
> 
> diff --git a/m4/virt-lib.m4 b/m4/virt-lib.m4
> index a9efb74138..f498af0fc7 100644
> --- a/m4/virt-lib.m4
> +++ b/m4/virt-lib.m4
> @@ -395,3 +395,89 @@ AC_DEFUN([LIBVIRT_RESULT_LIB],[
>  
>    m4_popdef([check_name])
>  ])
> +
> +dnl
> +dnl To be used instead of AC_ARG_WITH
> +dnl
> +dnl LIBVIRT_ARG_WITH([CHECK_NAME], [HELP_NAME], [DEFAULT_ACTION], [MIN_VERSION])
> +dnl
> +dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
> +dnl       HELP_NAME: Name that will be appear in configure --help

s/will be/will/

> +dnl  DEFAULT_ACTION: Default configure action
> +dnl     MIN_VERSION: Specify minimal version that will be added to
> +dnl                  configure --help (optional)
> +dnl
> +dnl LIBVIRT_ARG_WITH([SELINUX], [SeLinux], [check])
> +dnl LIBVIRT_ARG_WITH([GLUSTERFS], [glusterfs], [check], [3.4.1])
> +dnl
> +AC_DEFUN([LIBVIRT_ARG_WITH], [
> +  m4_pushdef([check_name], [$1])
> +  m4_pushdef([help_name], [[$2]])
> +  m4_pushdef([default_action], [$3])
> +  m4_pushdef([min_version], [$4])
> +
> +  m4_pushdef([check_name_lc], m4_tolower(check_name))
> +  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
> +
> +  m4_pushdef([arg_var], [with-]check_name_dash)
> +  m4_pushdef([with_var], [with_]check_name_lc)
> +
> +  m4_pushdef([version_text], m4_ifnblank(min_version, [[ (>= ]]min_version[[)]]))
> +
> +  m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
> +  AC_ARG_WITH([check_name_dash],
> +    [AS_HELP_STRING([[--]arg_var],
> +                   [with ]]m4_dquote(help_name)m4_dquote(version_text)[[ support @<:@default=]]m4_dquote(default_action)[[@:>@])])

Strange indentation, the "[AS_HELP_STRING" part is a second argument to
AC_ARG_WITH() and thus it should be aligned with "[check_name_dash]".
The second argument of AS_HELP_STRING() is not aligned with the first
one either.

> +
> +  m4_popdef([version_text])
> +
> +  m4_popdef([with_var])
> +  m4_popdef([arg_var])
> +
> +  m4_popdef([check_name_dash])
> +  m4_popdef([check_name_lc])
> +
> +  m4_popdef([min_version])
> +  m4_popdef([default_action])
> +  m4_popdef([help_name])
> +  m4_popdef([check_name])
> +])
> +
> +dnl
> +dnl To be used instead of AC_ARG_WITH
> +dnl
> +dnl LIBVIRT_ARG_WITH_ALT([CHECK_NAME], [HELP_DESC], [DEFAULT_ACTION])
> +dnl
> +dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
> +dnl       HELP_DESC: Description that will be appear in configure --help

s/will be/will/

> +dnl  DEFAULT_ACTION: Default configure action
> +dnl
> +dnl LIBVIRT_ARG_WITH([PACKAGER], [Extra packager name], [no])
> +dnl LIBVIRT_ARG_WITH([HTML_DIR], [path to base html directory], [$(datadir)/doc])

s/LIBVIRT_ARG_WITH/LIBVIRT_ARG_WITH_ALT/ in the two lines above

> +dnl
> +AC_DEFUN([LIBVIRT_ARG_WITH_ALT], [
> +  m4_pushdef([check_name], [$1])
> +  m4_pushdef([help_desc], [[$2]])
> +  m4_pushdef([default_action], [$3])
> +
> +  m4_pushdef([check_name_lc], m4_tolower(check_name))
> +  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
> +
> +  m4_pushdef([arg_var], [with-]check_name_dash)
> +  m4_pushdef([with_var], [with_]check_name_lc)
> +
> +  m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
> +  AC_ARG_WITH([check_name_dash],
> +    [AS_HELP_STRING([[--]arg_var],
> +                    ]m4_dquote(help_desc)[[ @<:@default=]]m4_dquote(default_action)[[@:>@])])

Strange indentation again.

ACK

Jirka




More information about the libvir-list mailing list