The version of Time::HiRes (1.38) currently in bleadperl fails to 
build on VMS as part of the core, though it builds fine when built as 
a separate extension.  When built separately, the generated Makefile 
tells me that these are the libraries passed in the arguments to 
WriteMakefile:

#     LIBS => [q[-lrt], q[-lposix4]]

This is not really right, though apparently harmless.  The 
functionality provided by these libraries may well be in the C 
run-time somewhere, but the libraries don't exist under these names 
and there is no need to specify them to the linker.

When built in the core, we get

#     LIBS => []

This is right, though for the wrong reason, and despite being right,
it doesn't work.  The reason rt and posix4 don't show up is because
the compiler command used by Time::HiRes's Makefile.PL during its
configuration phase when doing a core build on VMS is not quite
right.  There's a good chance that's my fault and in any case I will
follow up with Jarkko on this elsewhere; it has nothing directly to 
do with MM.

Finally getting to the MakeMaker issue, though, there is a problem 
when you pass an empty array reference as the LIBS argument to 
WriteMakefile.  In MM_Unix::init_others this causes the call to 
MM_Unix::extliblist to be skipped, which in turn means that 
EXTRALIBS, BSLOADLIBS, LDLOADLIBS, and LD_RUN_PATH will never be 
initialized.  I don't know about other platforms, but on VMS that 
causes link failures, which was the symptom that first led me down 
this twisty path.  The patch below makes the link failures go away
and the core build succeed.  Basically $self->{LIBS} is true when it
is an array reference even when the array has no elements, so we need
to explicitly check for that case.  However, the change introduces 
the following failure:

lib/ExtUtils/t/writemakefile_args....FAILED at test 6
 
so I don't think I'm quite done yet, but that's all I can get to at the moment.

BTW, in the penultimate line of context in the patch, is it possible 
for "ref \$self->{LIBS}" ever be equal to 'SCALAR'?  Isn't "ref \$foo" 
always going to be 'REF'?

--- lib/ExtUtils/MM_Unix.pm;-0  Sat Nov 30 16:40:42 2002
+++ lib/ExtUtils/MM_Unix.pm     Mon Dec  2 23:17:49 2002
@@ -1764,7 +1764,9 @@
     # undefined. In any case we turn it into an anon array:
 
     # May check $Config{libs} too, thus not empty.
-    $self->{LIBS}=[''] unless $self->{LIBS};
+    $self->{LIBS}=['']
+      unless ref($self->{LIBS}) eq 'SCALAR' && $self->{LIBS}
+      || ref($self->{LIBS}) eq 'ARRAY' && @{$self->{LIBS}};
 
     $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq 'SCALAR';
     $self->{LD_RUN_PATH} = "";
[end of not quite a patch]

-- 
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Reply via email to