X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=utils%2Fc2ph.PL;h=38b259f0db187aa81fdbc574a31b177eed18ea8a;hb=90fdbbb75512007b809510f03fc507ff5c145e16;hp=97d17af655982a229fbf5aaa8e07b7a37a2ffdb4;hpb=1fef88e72b0b21420614d87ecab0aaedf3725271;p=p5sagit%2Fp5-mst-13.2.git diff --git a/utils/c2ph.PL b/utils/c2ph.PL index 97d17af..38b259f 100644 --- a/utils/c2ph.PL +++ b/utils/c2ph.PL @@ -2,6 +2,7 @@ use Config; use File::Basename qw(&basename &dirname); +use Cwd; # List explicitly here the variables you want Configure to # generate. Metaconfig only looks for shell variables, so you @@ -12,10 +13,10 @@ use File::Basename qw(&basename &dirname); # This forces PL files to create target in same directory as PL file. # This is so that make depend always knows where to find PL derivatives. -chdir(dirname($0)); -($file = basename($0)) =~ s/\.PL$//; -$file =~ s/\.pl$// - if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving" +$origdir = cwd; +chdir dirname($0); +$file = basename($0, '.PL'); +$file .= '.com' if $^O eq 'VMS'; open OUT,">$file" or die "Can't create $file: $!"; @@ -25,9 +26,9 @@ print "Extracting $file (with variable substitutions)\n"; # You can use $Config{...} to use Configure variables. print OUT <<"!GROK!THIS!"; -$Config{'startperl'} - eval 'exec perl -S \$0 "\$@"' - if 0; +$Config{startperl} + eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' + if \$running_under_some_shell; !GROK!THIS! # In the following, perl variables are not expanded during extraction. @@ -1252,7 +1253,7 @@ main() { EOF for $type (@intrinsics) { - next if !type || $type eq 'void' || $type =~ /complex/; # sun stuff + next if !$type || $type eq 'void' || $type =~ /complex/; # sun stuff print <<"EOF"; printf(mask,sizeof($type), "$type"); EOF @@ -1399,3 +1400,4 @@ if (defined $Config{d_link}) { File::Copy::syscopy('c2ph', 'pstruct'); } exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; +chdir $origdir;