@@ -7,6 +7,7 @@ use File::Spec;
77use Cwd;
88use File::Temp qw[ tempdir] ;
99
10+ use ExtUtils::MakeMaker;
1011use MakeMaker::Test::Utils;
1112
1213# Liblist wants to be an object which has File::Spec capabilities, so we
@@ -42,7 +43,7 @@ test_kid_win32() if $OS eq 'win32';
4243# system configuration does not affect the test results.
4344
4445sub conf_reset {
45- my @save_keys = qw{ so dlsrc osname } ;
46+ my @save_keys = qw{ so dlsrc osname make } ;
4647 my %save_config ;
4748 @save_config { @save_keys } = @Config { @save_keys };
4849 %Config = %save_config ;
@@ -129,7 +130,7 @@ sub test_kid_unix_os2 {
129130 my @out = _ext( ' -L. -lfoo' );
130131 my $qlibre = qr / -L[^"]+\s +-lfoo/ ;
131132 like( $out [0], $qlibre , ' existing file results in quoted extralibs' );
132- like( $out [2], $qlibre , ' existing file results in quotes ldloadlibs' );
133+ like( $out [2], $qlibre , ' existing file results in quoted ldloadlibs' );
133134 ok $out [3], ' existing file results in true LD_RUN_PATH' ;
134135 is_deeply [ _ext( ' -L. -lnotthere' ) ], [ (' ' ) x 4 ], ' non-present lib = empty' ;
135136 my $curr_dirspace = File::Spec-> rel2abs( ' di r' );
@@ -140,6 +141,18 @@ sub test_kid_unix_os2 {
140141 my @got = _ext( ' -ldir_test' );
141142 is_deeply \@got , [ ' -ldir_test' , ' ' , ' -ldir_test' , ' di r' ], ' Config.libpth directories with spaces work' or diag explain \@got ;
142143 }
144+ my $mm = WriteMakefile(
145+ NAME => ' Big::Dummy' ,
146+ VERSION => ' 1.00' ,
147+ LIBS => [' -L. -lfoo' ],
148+ );
149+ like $mm -> {LDLOADLIBS }, $qlibre , ' single LIBS works' ;
150+ $mm = WriteMakefile(
151+ NAME => ' Big::Dummy' ,
152+ VERSION => ' 1.00' ,
153+ LIBS => [' -L. -lnotthere' , ' -L. -lfoo' ],
154+ );
155+ like $mm -> {LDLOADLIBS }, $qlibre , ' two LIBS correctly gets second' ;
143156}
144157
145158sub test_kid_win32 {
@@ -178,10 +191,24 @@ sub test_kid_win32 {
178191 is_deeply( [ _ext( qq{ "-Ldir" dir_test} ) ], [ double(quote(" $curr \\ dir\\ dir_test.lib" ), ' ' ) ], ' relative -L directories work' );
179192 is_deeply( [ _ext( ' -L"di r" dir_test' ) ], [ double(quote($curr . ' \di r\dir_test.lib' ), ' ' ) ], ' -L directories with spaces work' );
180193
181- $Config {perllibs } = ' pl' ;
182- is_deeply( [ _ext( ' unreal_test' ) ], [ double(quote(' pl.lib' ), ' ' ) ], ' $Config{perllibs} adds extra libs to be searched' );
183- is_deeply( [ _ext( ' unreal_test :nodefault' ) ], [ (' ' ) x 4 ], ' :nodefault flag prevents $Config{perllibs} from being added' );
184- delete $Config {perllibs };
194+ {
195+ local $Config {perllibs } = ' pl' ;
196+ is_deeply( [ _ext( ' unreal_test' ) ], [ (' ' ) x 4 ], ' _ext not add $Config{perllibs}' );
197+ is_deeply( [ _ext( ' unreal_test :nodefault' ) ], [ (' ' ) x 4 ], ' :nodefault flag prevents $Config{perllibs} from being added' );
198+ my $mm = WriteMakefile(
199+ NAME => ' Big::Dummy' ,
200+ VERSION => ' 1.00' ,
201+ LIBS => [' -l_test' ],
202+ );
203+ my $exp = ' "lib_test.lib" "pl.lib"' ;
204+ is $mm -> {LDLOADLIBS }, $exp , ' single LIBS works' ;
205+ $mm = WriteMakefile(
206+ NAME => ' Big::Dummy' ,
207+ VERSION => ' 1.00' ,
208+ LIBS => [' -L. -lnotthere' , ' -l_test' ],
209+ );
210+ is $mm -> {LDLOADLIBS }, $exp , ' two LIBS correctly gets second' ;
211+ }
185212
186213 {
187214 local $Config {libpth } = ' libpath' ;
@@ -219,6 +246,4 @@ sub test_kid_win32 {
219246
220247 $ENV {LIB } = ' vc' ;
221248 is_deeply( [ _ext( ' vctest.lib' ) ], [ double(quote(' vc\vctest.lib' ), ' ' ) ], ' [vc] $ENV{LIB} adds search paths' );
222-
223- return ;
224249}
0 commit comments