[PATCH util-macros] Add XORG_WITH_PERL macro

Dan Nicholson dbn.lists at gmail.com
Wed Jun 22 08:46:52 PDT 2011


On Wed, Jun 22, 2011 at 7:55 AM, Gaetan Nadon <memsize at videotron.ca> wrote:
> Following the same pattern as XMLTO and friends.
> Allows all modules to use the same interface, variables
> and options to check for perl.
> Perl is used in libX11 and xserver.
>
> Signed-off-by: Gaetan Nadon <memsize at videotron.ca>

Seems like a bit of overkill, but I guess there's not any harm besides
churning things more.

> ---
>  xorg-macros.m4.in |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 58 insertions(+), 0 deletions(-)
>
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index d3b0b7e..756ff2d 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -494,6 +494,64 @@ m4_ifval([$1],[AC_MSG_WARN(Checking for MIN-VERSION is not implemented.)])
>  AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
>  ]) # XORG_WITH_XSLTPROC
>
> +# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
> +# ----------------------------------------
> +# Minimum version: 1.15.0
> +#
> +# PERL (Practical Extraction and Report Language) is a language optimized for
> +# scanning arbitrary text files, extracting information from those text files,
> +# and printing reports based on that information.
> +#
> +# When DEFAULT is not specified, --with-perl assumes 'auto'.
> +#
> +# Interface to module:
> +# HAVE_PERL: used in makefiles to conditionally scan text files
> +# PERL:             returns the path of the perl program found
> +#           returns the path set by the user in the environment
> +# --with-perl: 'yes' user instructs the module to use perl
> +#             'no' user instructs the module not to use perl
> +# have_perl: returns yes if perl found in PATH or no
> +#
> +# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
> +#
> +AC_DEFUN([XORG_WITH_PERL],[
> +AC_ARG_VAR([PERL], [Path to perl command])
> +m4_define([_defopt], m4_default([$2], [auto]))
> +AC_ARG_WITH(perl,
> +       AS_HELP_STRING([--with-perl],
> +          [Use perl for extracting information from files (default: ]_defopt[)]),
> +          [use_perl=$withval], [use_perl=]_defopt)
> +m4_undefine([_defopt])
> +
> +if test "x$use_perl" = x"auto"; then
> +   AC_PATH_PROG([PERL], [perl])
> +   if test "x$PERL" = "x"; then
> +        AC_MSG_WARN([perl not found - cannot extract information and report])
> +       have_perl=no
> +   else
> +        have_perl=yes
> +   fi
> +elif test "x$use_perl" = x"yes" ; then
> +   AC_PATH_PROG([PERL], [perl])
> +   if test "x$PERL" = "x"; then
> +        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
> +   fi
> +   have_perl=yes
> +elif test "x$use_perl" = x"no" ; then
> +   if test "x$PERL" != "x"; then
> +      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
> +   fi
> +   have_perl=no
> +else
> +   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
> +fi
> +
> +# Checking for minimum version is not implemented
> +# but we want to keep the interface consistent with other commands
> +m4_ifval([$1],[AC_MSG_WARN(Checking for MIN-VERSION is not implemented.)])

Instead of AC_MSG_WARN, wouldn't it be better to spit the warning with
m4 so you can tell the person specifying the version that it's
unsupported? Once configure is built, nothing can be done about it. I
suggest:

m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is
not implemented])])

Then you'd get something like this when autoconf is run:

configure.ac:17: warning: Checking for perl MIN-VERSION is not implemented

--
Dan


More information about the xorg-devel mailing list