autoconf
[Top][All Lists]
Advanced

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

Re: Perl and perl modules test


From: Russ Allbery
Subject: Re: Perl and perl modules test
Date: Mon, 07 Jan 2002 16:35:20 -0800
User-agent: Gnus/5.090004 (Oort Gnus v0.04) XEmacs/21.4 (Common Lisp, sparc-sun-solaris2.6)

Sergio <address@hidden> writes:

> Is there macros for testing the existing of perl and the version ?

> Is there macros to test the existence of perl modules like the one for
> testing libs ?

I don't believe there are macros for either in the mainline autoconf, but
various people have written their own versions.

The (autoconf 2.13-compatible) macro that I use for testing the Perl
version is:

dnl Check for a required version of Perl.  The separate shell variable and
dnl the changequotes are necessary for autoconf 2.13; autoconf 2.50 will
dnl provide a different interface that will allow this to work correctly.
changequote(<<,>>)dnl
inn_perl_command='print $]'
changequote([,])dnl
AC_DEFUN([INN_PERL_VERSION],
[AC_CACHE_CHECK(for Perl version, inn_cv_perl_version,
[if $_PATH_PERL -e 'require $1;' > /dev/null 2>&1 ; then
    inn_cv_perl_version=`$_PATH_PERL -e "$inn_perl_command"`
else
    AC_MSG_ERROR(Perl $1 or greater is required)
fi])])

With the new autoconf support for inserting literal square-brackets into
the output, this could be cleaned up somewhat.

Testing for modules can use a very similar idiom, but with "use Module" as
the Perl code to execute.

Note, however, that if you're doing anything extensive with Perl, you
probably want to use Perl's own ExtUtils::MakeMaker setup instead, which
supports module prerequisites and other similar things but even more
importantly will pick up the correct paths for installing Perl modules
from the user's Perl installation, something that autoconf would have
difficulty extracting.

-- 
Russ Allbery (address@hidden)             <http://www.eyrie.org/~eagle/>



reply via email to

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