[PATCH util-macros] Add XORG_WITH_PERL macro

Gaetan Nadon memsize at videotron.ca
Wed Jun 22 09:46:26 PDT 2011


On Wed, 2011-06-22 at 08:46 -0700, Dan Nicholson wrote:

> 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.

Same here. You never know when usage will grow. I recall running around
all the modules with docs to replace existing code.

> 
> > ---
> >  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:
> 

Ah, yes. Unlearning is harder than learning. The separation of roles,
one creating the configuration versus one running it. Will do.

Thanks!

> 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110622/f1eb96c0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110622/f1eb96c0/attachment.pgp>


More information about the xorg-devel mailing list