turbidity in av.[ch]
[p5sagit/p5-mst-13.2.git] / installperl
index 3b4f5c2..5632824 100755 (executable)
@@ -16,8 +16,7 @@ while (@ARGV) {
 
 umask 022;
 
-@scripts = qw(cppstdin
-               utils/c2ph utils/h2ph utils/h2xs utils/pstruct
+@scripts = qw( utils/c2ph utils/h2ph utils/h2xs utils/pstruct
                utils/perlbug utils/perldoc
                x2p/s2p x2p/find2perl
                pod/pod2man pod/pod2html pod/pod2latex pod/pod2text);
@@ -44,9 +43,7 @@ $installsitelib = $Config{installsitelib};
 $installsitearch = $Config{installsitearch};
 $installman1dir = $Config{installman1dir};
 $man1ext = $Config{man1ext};
-# Did we build libperl as a shared library?
-$d_shrplib = $Config{d_shrplib};
-$shrpdir = $Config{shrpdir};
+$libperl = $Config{libperl};
 # Shared library and dynamic loading suffixes.
 $so = $Config{so};
 $dlext = $Config{dlext};
@@ -70,17 +67,6 @@ if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
 -x 't/TEST'            || warn "WARNING: You've never run 'make test'!!!",
        "  (Installing anyway.)\n";
 
-if ($d_shrplib) {
-    if (!<libperl*.$so*>) {
-       warn "WARNING: Can't find libperl*.$so* to install into $shrpdir.",
-           "  (Installing other things anyway.)\n";
-    } else {
-       mkpath($shrpdir, 1, 0777);
-       -w $shrpdir     || $nonono || die "$shrpdir is not writable by you\n";
-       &cmd("cp libperl*.$so* $shrpdir");
-    }
-}
-
 # First we install the version-numbered executables.
 
 &safe_unlink("$installbin/perl$ver$exe_ext");
@@ -109,15 +95,23 @@ if (! &samepath($installbin, 'x2p')) {
     &chmod(0755, "$installbin/a2p$exe_ext");
 }
 
+# cppstdin is just a script, but it is architecture-dependent, so
+# it can't safely be shared.  Place it in $installbin.
+# Note that Configure doesn't build cppstin if it isn't needed, so
+# we skip this if cppstdin doesn't exist.
+if ((-f cppstdin) && (! &samepath($installbin, '.'))) {
+    &safe_unlink("$installbin/cppstdin");
+    &cmd("cp cppstdin $installbin/cppstdin");
+    &chmod(0755, "$installbin/cppstdin");
+}
+
 # Install scripts.
 
 mkpath($installscript, 1, 0777);
 
 for (@scripts) {
-    if (-f $_) {   # cppstdin might not exist on this system.
-       &cmd("cp $_ $installscript");
-       s#.*/##; &chmod(0755, "$installscript/$_");
-    }
+    &cmd("cp $_ $installscript");
+    s#.*/##; &chmod(0755, "$installscript/$_");
 }
 
 # Install pod pages.  Where? I guess in $installprivlib/pod.
@@ -175,15 +169,15 @@ else {
 
 # Install header files and libraries.
 mkpath("$installarchlib/CORE", 1, 0777);
-foreach $file (<*.h libperl*.*>) {
-    cp_if_diff($file,"$installarchlib/CORE/$file");
-}
+@corefiles = <*.h libperl*.*>;
 # AIX needs perl.exp installed as well.
-cp_if_diff("perl.exp" ,"$installarchlib/CORE/perl.exp") if ($^O eq 'aix');
-
+push(@corefiles,'perl.exp') if $^O eq 'aix';
 # If they have built sperl.o...
-cp_if_diff("sperl.o" ,"$installarchlib/CORE/sperl.o") if (-f 'sperl.o');
-
+push(@corefiles,'sperl.o') if -f 'sperl.o';
+foreach $file (@corefiles) {
+    cp_if_diff($file,"$installarchlib/CORE/$file");
+    &chmod($file =~ /^libperl/ ? 0555 : 0444,"$installarchlib/CORE/$file");
+}
 
 # Offer to install perl in a "standard" location
 
@@ -208,9 +202,9 @@ if (-w $mainperldir && ! &samepath($mainperldir, $installbin) && !$nonono) {
             "$binexp/perl? [y] ")))
     {  
        unlink("$mainperldir/perl$exe_ext");
-       eval 'link("$installbin/perl$exe_ext", "$mainperldir/perl$exe_ext")' ||
-       eval 'symlink("$binexp/perl$exe_ext", "$mainperldir/perl$exe_ext")' ||
-       &cmd("cp $installbin/perl$exe_ext $mainperldir$exe_ext");
+       CORE::link("$installbin/perl$exe_ext", "$mainperldir/perl$exe_ext") ||
+           symlink("$binexp/perl$exe_ext", "$mainperldir/perl$exe_ext") ||
+               cmd("cp $installbin/perl$exe_ext $mainperldir$exe_ext");
        $mainperl_is_instperl = 1;
     }
 }
@@ -314,16 +308,18 @@ sub rename {
 }
 
 sub link {
-    local($from,$to) = @_;
+    my($from,$to) = @_;
+    my($success) = 0;
 
     print STDERR "  ln $from $to\n";
     eval {
-      CORE::link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono;
+      CORE::link($from,$to) ? $success++ : warn "Couldn't link $from to $to: $!\n" unless $nonono;
     };
     if ($@) {
-      system( $cp, $from, $to )
-       && warn "Couldn't copy $from to $to: $!\n" unless $nonono;
+      system( $cp, $from, $to )==0 ? $success++ :
+       warn "Couldn't copy $from to $to: $!\n" unless $nonono;
     }
+    $success;
 }
 
 sub chmod {