Make Power MachTen use vfork and perl's malloc
[p5sagit/p5-mst-13.2.git] / configpm
index 1fef6fe..0c6a965 100755 (executable)
--- a/configpm
+++ b/configpm
@@ -6,7 +6,7 @@ $config_pm = $ARGV[0] || 'lib/Config.pm';
 # list names to put first (and hence lookup fastest)
 @fast = qw(archname osname osvers prefix libs libpth
        dynamic_ext static_ext extensions dlsrc so
-       sig_name cc ccflags cppflags
+       sig_name sig_num cc ccflags cppflags
        privlibexp archlibexp installprivlib installarchlib
        sharpbang startsh shsharp
 );
@@ -70,8 +70,8 @@ print CONFIG "\n",
 print CONFIG "my \$summary = <<'!END!';\n";
 
 open(MYCONFIG,"<myconfig") || die "open myconfig failed: $!";
-1 while( ($_=<MYCONFIG>) !~ /^Summary of/);
-do { print CONFIG $_ } until ($_ = <MYCONFIG>) =~ /^\s*$/;
+1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
+do { print CONFIG $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
 close(MYCONFIG);
 
 print CONFIG "\n!END!\n", <<'EOT';
@@ -79,7 +79,8 @@ my $summary_expanded = 0;
 
 sub myconfig {
        return $summary if $summary_expanded;
-       $summary =~ s/\$(\w+)/$Config{$1}/ge;
+       $summary =~ s{\$(\w+)}
+                    { my $c = $Config{$1}; defined($c) ? $c : 'undef' }ge;
        $summary_expanded = 1;
        $summary;
 }
@@ -179,6 +180,9 @@ ENDOFSET
 
 print CONFIG <<'ENDOFTAIL';
 
+# avoid Config..Exporter..UNIVERSAL search for DESTROY then AUTOLOAD
+sub DESTROY { }
+
 tie %Config, 'Config';
 
 1;
@@ -245,17 +249,23 @@ See also C<-V:name> in L<perlrun/Switches>.
 Here's a more sophisticated example of using %Config:
 
     use Config;
+    use strict;
+
+    my %sig_num;
+    my @sig_name;
+    unless($Config{sig_name} && $Config{sig_num}) {
+       die "No sigs?";
+    } else {
+       my @names = split ' ', $Config{sig_name};
+       @sig_num{@names} = split ' ', $Config{sig_num};
+       foreach (@names) {
+           $sig_name[$sig_num{$_}] ||= $_;
+       }   
+    }
 
-    defined $Config{sig_name} || die "No sigs?";
-    foreach $name (split(' ', $Config{sig_name})) {
-       $signo{$name} = $i;
-       $signame[$i] = $name;
-       $i++;
-    }   
-
-    print "signal #17 = $signame[17]\n";
-    if ($signo{ALRM}) { 
-       print "SIGALRM is $signo{ALRM}\n";
+    print "signal #17 = $sig_name[17]\n";
+    if ($sig_num{ALRM}) { 
+       print "SIGALRM is $sig_num{ALRM}\n";
     }   
 
 =head1 WARNING