extensions/known_extensions and insanity (was Re: VMS, configure.com and nonxs_ext)

Nicholas Clark <[email protected]>
Newsgroups gmane.comp.lang.perl.ports.vms,gmane.comp.lang.perl.perl5.porters
Message-ID <[email protected]>
On Tue, Sep 08, 2009 at 10:33:02AM +0100, Nicholas Clark wrote:
> On Mon, Sep 07, 2009 at 05:15:51PM -0500, Craig A. Berry wrote:

> > There's also dynamic_ext, right?  Shouldn't dynamic_ext plus  
> > nonxs_extensions equal known_extensions?
> 
> Well, probably it should, but what actually happens is:
> 
> $ cat extensions.pl
> #!perl -w
> use strict;
> use Config;
> 
> printf "%-24s", 'extensions';
> 
> my @types = qw(static_ext dynamic_ext nonxs_ext known_extensions);
> my %lookup;
> my %short;
> foreach (@types) {
>     my $short = $_;
>     $short =~ s/_.*//;
>     $short{$_} = $short;
> 
>     printf "%-8s", $short;
>     $lookup{$_} = {map {$_, 1} split/ /, $Config{$_}};
> }
> print "\n\n";
> 
> foreach my $ext (sort split / /, $Config{extensions}) {
>     printf "%-24s", $ext;
>     foreach (@types) {
>         printf "%-8s", $lookup{$_}{$ext} ? $short{$_} : '';
>     }
>     print "\n";
> }
> 
> __END__

> "extensions" is everything.
> 
> "known_extensions" = "static_ext" + "dynamic_ext"
> "extensions" = "nonxs_ext" + "known_extensions"
> 
> 
> which isn't logical, but I suspect is due to something historical.

Oops. I'm not correct.

I *think I am here:

0: DynaLoader doesn't count as an extension
1: known_extensions are all known XS extensions
2: static_ext, dynamic_ext and nonxs_ext are actually what they say they are,
   assuming you were thinking about "extensions we have configured here"
3: extensions is the sum of the 3 immediately above

Hence if you have not built some XS extensions on your platform (which, I
think, is always true, as you can't build both VMS and Win32 extensions
anywhere), there will always be something in known_extensions that is not
in extensions.

Likewise, if you *have* build something nonxs (which you have do, as you can't
build DynaLoader without (at least) ExtUtils::ParseXS), there will always be
something in extensions that isn't in known_extensions.

Good, eh?

As an encore, the Unix Configure script teases you with -Dnoextensions
to disable extensions, but only actually honours it for XS extensions.
Right know it assumes that all nonxs extensions will work everywhere.

Nicholas Clark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.