=item init_others
-Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, LD,
+Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP,
FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F,
TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N
+LD is initialized in init_linker()
+
=cut
sub init_others { # --- Initialize Other Attributes
my($self) = shift;
- $self->{LD} ||= 'ld';
+
# Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
# Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
Unix has no need of special linker flags.
+However this does initialize the default linker if it has not already been set. It uses
+the value from Config and then falls back to 'ld'
+
=cut
sub init_linker {
my($self) = shift;
+ $self->{LD} ||= $Config{ld} || 'ld';
$self->{PERL_ARCHIVE} ||= '';
$self->{PERL_ARCHIVE_AFTER} ||= '';
$self->{EXPORT_LIST} ||= '';
Override some of the Unix specific commands with portable
ExtUtils::Command ones.
-Also provide defaults for LD and AR in case the %Config values aren't
-set.
+Also provide a default for AR in case the %Config values aren't
+set. LD is now set in init_linker().
LDLOADLIBS's default is changed to $Config{libs}.
$self->{TEST_F} ||= '$(PERLRUN) -MExtUtils::Command -e test_f';
$self->{DEV_NULL} ||= '> NUL';
- $self->{LD} ||= $Config{ld} || 'link';
+
$self->{AR} ||= $Config{ar} || 'lib';
$self->SUPER::init_others;
=item init_linker
+Unless previosuly set initializes LD to be the linker specified in Config and falls back
+to the standard Win32 linker 'link'.
+
=cut
sub init_linker {
my $self = shift;
+ $self->{LD} ||= $Config{ld} || 'link';
$self->{PERL_ARCHIVE} = "\$(PERL_INC)\\$Config{libperl}";
$self->{PERL_ARCHIVE_AFTER} = '';
$self->{EXPORT_LIST} = '$(BASEEXT).def';
plan skip_all => 'Non-Unix platform';
}
else {
- plan tests => 115;
+ plan tests => 116;
}
}
###############################################################################
$t->init_linker;
-foreach (qw/ EXPORT_LIST PERL_ARCHIVE PERL_ARCHIVE_AFTER /)
+foreach (qw/ EXPORT_LIST PERL_ARCHIVE PERL_ARCHIVE_AFTER LD /)
{
ok( exists $t->{$_}, "$_ was defined" );
is( $t->{$_}, '', "$_ is empty on Unix");
}
# init_others(): check if all keys are created and set?
-# qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F LD AR LDLOADLIBS DEV_NUL )
+# qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F AR LDLOADLIBS DEV_NUL )
{
my $mm_w32 = bless( { BASEEXT => 'Foo' }, 'MM' );
$mm_w32->init_others();
my @keys = qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP
- TEST_F LD AR LDLOADLIBS DEV_NULL );
+ TEST_F AR LDLOADLIBS DEV_NULL );
for my $key ( @keys ) {
ok( $mm_w32->{ $key }, "init_others: $key" );
}
my $after = '';
$MM->init_linker;
+ ok( $MM->{ LD }, "init_linker sets LD" );
is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' );
is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' );
is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' );