From Kurt.Hornik@ci.tuwien.ac.at  Fri Apr  7 07:17:13 2000
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Fri, 7 Apr 2000 08:17:13 +0200 (CEST)
Subject: [Rd] Re: [R] Perl v5.6.0 breaks the configure script
In-Reply-To: <Pine.GSO.4.05.10004051414570.1837-100000@auk.stats>
References: <20000405083728.A29748@eddelbuettel.com>
 <Pine.GSO.4.05.10004051414570.1837-100000@auk.stats>
Message-ID: <14573.32105.668793.488172@aragorn.ci.tuwien.ac.at>

>>>>> Prof Brian D Ripley writes:

> On Wed, 5 Apr 2000, Dirk Eddelbuettel wrote:
>> 
>> On Wed, Apr 05, 2000 at 10:31:57AM +0100, Prof Brian D Ripley wrote:
>> > On Wed, 5 Apr 2000, tom kennedy wrote:
>> [..] 
>> > I think the trick is to use perl itself, as in
>> > 
>> > perl_version=`${PERL} -e '$v=$]; $v =~ s/(.)\..*/\1/;print $v'`
>> > 
>> > as perl is guaranteed to return its version as a number like 5.006
>> > even for `v5.6.0'.
>> > 
>> > Unfortunately the "]" in there confuses m4 when building configure
>> > from aclocal.m4, but I am sure the experts can fix that.

Guess this means that I am not an autoconf expert any more.

>> 
>> One would be to use the English module and PERL_VERSION instead:
>> 
>> perl_version=
>> = `${PERL}-MEnglish  -e '$v=$PERL_VERSION; $v =~ s/(.)\..*/\1/;print $v'`
>> 
>> > One could even do the whole test in Perl:
>> > 
>> > r_cv_prog_perl_v5=
>> > `${PERL} -e 'if($] >= 5) {print "yes";} else {print "no"}'`
>> 
>> Likewise:
>> 
>> r_cv_prog_perl_v5=
>> `${PERL} -MEnglish -e 'if($] >= 5) {print "yes";} else {print "no"}'`
> Um, not that but I think we know what you meant!

> Yes, I know and I considered that, but I do not think the English
> module is guaranteed to be present. This is a test of the Perl
> version, and as far as I could see -MEnglish does not work in Perl 4.
> (The -M flag is not in the Quick Reference Guide for 4.019.)  So I
> think your version assumes the thing it is testing for, Perl 5.x.

I also think we should not assume that English is there.

Anyway, I tried adding a line of code to configure.in which uses $], but
I failed miserably ... I would either get M4 syntax errors or not get
the `]'.  Hence, I changed the test to

    AC_CACHE_CHECK([whether perl version is at least 5],
      r_cv_prog_perl_v5,
      [ ${PERL} -e 'require 5' 2>/dev/null
        if test ${?} -eq 0; then
          r_cv_prog_perl_v5=yes
        else
          r_cv_prog_perl_v5=no
        fi
      ])

which I think should also do the job.

Changed in r-devel only.  If anyone thinks we should also do this in
r-release for 1.0.1, pls let me know && I will make the change (assuming
that the fix is correct).

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Re: [R] Perl v5.6.0 breaks the configure script
Kurt Hornik