--- toast 2004/01/15 19:39:47 1.276 +++ toast 2004/01/16 23:59:32 1.277 @@ -884,7 +884,7 @@ return $pwd if defined($pwd); my($env) = $ENV{PWD}; - return $pwd = $env if -d($env) && samefile($env, "."); + return $pwd = $env if defined($env) && -d($env) && samefile($env, "."); my($dir, $result) = (".", ""); for(1..1024) @@ -2220,24 +2220,20 @@ } my(@socc) = qw[gcc -shared -Wall]; + push(@socc, qw[-Werror]) if strictpreload; + my(@sol) = (); + push(@sol, qw[-ldl]) if $^O =~ /linux/i; writefile(path($helperdir, "dummy.c"), "void ____toast_dummy_4u38291(){}\n"); - cdrun($helperdir, @socc, qw[dummy.c -o rewrite.so]); + writefile(path($helperdir, "rewrite.c"), $code); - push(@socc, qw[-Werror]) if strictpreload; - push(@socc, qw[rewrite.c -o rewrite.so.helper]); - push(@socc, "-ldl") if $^O =~ /linux/i; + return path($helperdir, "rewrite.so") + if optcdrun($helperdir, @socc, qw[dummy.c -o rewrite.so]) + && optcdrun($helperdir, @socc, qw[rewrite.c -o rewrite.so.helper], @sol); - writefile(path($helperdir, "rewrite.c"), $code); - if(optcdrun($helperdir, @socc)) - { - return path($helperdir, "rewrite.so"); - } - else - { - error("unable to compile rewrite.so") if strictpreload; - return undef; - } + error("unable to compile with strictpreload enabled") if strictpreload; + explain("unable to compile; strictpreload disabled, continuing"); + return undef; } sub helphome($$$)