xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/installperl (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#
2*0Sstevel@tonic-gate# This is a version of the 5.8.4 installperl script that has been modified to
3*0Sstevel@tonic-gate# work correctly as part of the ON build process.  The changes are as follows:
4*0Sstevel@tonic-gate#    * umask set to 022
5*0Sstevel@tonic-gate#    * install locations modified to be relative to $ROOT
6*0Sstevel@tonic-gate#    * check for 'make test' being run before install removed
7*0Sstevel@tonic-gate#    * executables installed with mode 0555
8*0Sstevel@tonic-gate#    * executables only overwritten if different from last build
9*0Sstevel@tonic-gate#    * check for other versions of perl in $PATH removed
10*0Sstevel@tonic-gate#    * .packlist entries cleaned of $ROOT prefix
11*0Sstevel@tonic-gate#    * SCCS directories and .tstamp files ignored on install
12*0Sstevel@tonic-gate#    * The contents of the additional contrib_bin directory are installed
13*0Sstevel@tonic-gate#
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gateBEGIN {
16*0Sstevel@tonic-gate    require 5.004;
17*0Sstevel@tonic-gate    chdir '..' if !-d 'lib' and -d '../lib';
18*0Sstevel@tonic-gate    @INC = 'lib';
19*0Sstevel@tonic-gate    $ENV{PERL5LIB} = 'lib';
20*0Sstevel@tonic-gate}
21*0Sstevel@tonic-gate
22*0Sstevel@tonic-gateuse strict;
23*0Sstevel@tonic-gatemy ($Is_VMS, $Is_W32, $Is_OS2, $Is_Cygwin, $Is_Darwin,
24*0Sstevel@tonic-gate    $nonono, $dostrip, $versiononly, $silent, $verbose, $force,
25*0Sstevel@tonic-gate    $otherperls, $archname, $Is_NetWare, $nwinstall, $nopods);
26*0Sstevel@tonic-gateuse vars qw /$depth/;
27*0Sstevel@tonic-gate
28*0Sstevel@tonic-gateBEGIN {
29*0Sstevel@tonic-gate    $Is_VMS = $^O eq 'VMS';
30*0Sstevel@tonic-gate    $Is_W32 = $^O eq 'MSWin32';
31*0Sstevel@tonic-gate    $Is_OS2 = $^O eq 'os2';
32*0Sstevel@tonic-gate    $Is_Cygwin = $^O eq 'cygwin';
33*0Sstevel@tonic-gate    $Is_Darwin = $^O eq 'darwin';
34*0Sstevel@tonic-gate    if ($Is_VMS) { eval 'use VMS::Filespec;' }
35*0Sstevel@tonic-gate}
36*0Sstevel@tonic-gate
37*0Sstevel@tonic-gatemy $scr_ext = ($Is_VMS ? '.Com' : $Is_W32 ? '.bat' : '');
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gateuse File::Find;
40*0Sstevel@tonic-gateuse File::Compare;
41*0Sstevel@tonic-gateuse File::Copy ();
42*0Sstevel@tonic-gateuse File::Path ();
43*0Sstevel@tonic-gateuse ExtUtils::Packlist;
44*0Sstevel@tonic-gateuse Config;
45*0Sstevel@tonic-gateuse subs qw(unlink link chmod);
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gateif ($Config{d_umask}) {
48*0Sstevel@tonic-gate    umask(022); # umasks like 077 aren't that useful for installations
49*0Sstevel@tonic-gate}
50*0Sstevel@tonic-gate
51*0Sstevel@tonic-gate$Is_NetWare = $Config{osname} eq 'NetWare';
52*0Sstevel@tonic-gateif ($Is_NetWare) {
53*0Sstevel@tonic-gate    $Is_W32 = 0;
54*0Sstevel@tonic-gate    $scr_ext = '.pl';
55*0Sstevel@tonic-gate}
56*0Sstevel@tonic-gate
57*0Sstevel@tonic-gate# override the ones in the rest of the script
58*0Sstevel@tonic-gatesub mkpath {
59*0Sstevel@tonic-gate    File::Path::mkpath(@_) unless $nonono;
60*0Sstevel@tonic-gate}
61*0Sstevel@tonic-gate
62*0Sstevel@tonic-gatemy $mainperldir = "/usr/bin";
63*0Sstevel@tonic-gatemy $exe_ext = $Config{exe_ext};
64*0Sstevel@tonic-gate
65*0Sstevel@tonic-gate# Allow ``make install PERLNAME=something_besides_perl'':
66*0Sstevel@tonic-gatemy $perl = defined($ENV{PERLNAME}) ? $ENV{PERLNAME} : 'perl';
67*0Sstevel@tonic-gate
68*0Sstevel@tonic-gate# This is the base used for versioned names, like "perl5.6.0".
69*0Sstevel@tonic-gate# It's separate because a common use of $PERLNAME is to install
70*0Sstevel@tonic-gate# perl as "perl5", if that's used as base for versioned files you
71*0Sstevel@tonic-gate# get "perl55.6.0".
72*0Sstevel@tonic-gatemy $perl_verbase = defined($ENV{PERLNAME_VERBASE})
73*0Sstevel@tonic-gate		    ? $ENV{PERLNAME_VERBASE}
74*0Sstevel@tonic-gate		    : $perl;
75*0Sstevel@tonic-gatemy $dbg = '';
76*0Sstevel@tonic-gatemy $ndbg = '';
77*0Sstevel@tonic-gateif ( $Is_VMS ) {
78*0Sstevel@tonic-gate    if ( defined $Config{usevmsdebug} ) {
79*0Sstevel@tonic-gate        if ( $Config{usevmsdebug} eq 'define' ) {
80*0Sstevel@tonic-gate            $dbg = 'dbg';
81*0Sstevel@tonic-gate            $ndbg = 'ndbg';
82*0Sstevel@tonic-gate        }
83*0Sstevel@tonic-gate    }
84*0Sstevel@tonic-gate}
85*0Sstevel@tonic-gate
86*0Sstevel@tonic-gate$otherperls = 1;
87*0Sstevel@tonic-gatemy $destdir = '';
88*0Sstevel@tonic-gatewhile (@ARGV) {
89*0Sstevel@tonic-gate    $nonono = 1 if $ARGV[0] eq '-n';
90*0Sstevel@tonic-gate    $dostrip = 1 if $ARGV[0] eq '-s';
91*0Sstevel@tonic-gate    $versiononly = 1 if $ARGV[0] eq '-v';
92*0Sstevel@tonic-gate    $versiononly = 0 if $ARGV[0] eq '+v';
93*0Sstevel@tonic-gate    $silent = 1 if $ARGV[0] eq '-S';
94*0Sstevel@tonic-gate    $otherperls = 0 if $ARGV[0] eq '-o';
95*0Sstevel@tonic-gate    $force = 1 if $ARGV[0] eq '-f';
96*0Sstevel@tonic-gate    $verbose = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n';
97*0Sstevel@tonic-gate    $archname = 1 if $ARGV[0] eq '-A';
98*0Sstevel@tonic-gate    $nwinstall = 1 if $ARGV[0] eq '-netware';
99*0Sstevel@tonic-gate    $nopods = 1 if $ARGV[0] eq '-p';
100*0Sstevel@tonic-gate    $destdir = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/;
101*0Sstevel@tonic-gate    if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) {
102*0Sstevel@tonic-gate	print <<"EOT";
103*0Sstevel@tonic-gateUsage $0: [switches]
104*0Sstevel@tonic-gate  -n	    Don't actually run any commands; just print them.
105*0Sstevel@tonic-gate  -s        Run strip on installed binaries.
106*0Sstevel@tonic-gate  -v        Only install perl as a binary with the version number in the name.
107*0Sstevel@tonic-gate            (Override whatever config.sh says)
108*0Sstevel@tonic-gate  +v        Install perl as "perl" and as a binary with the version number in
109*0Sstevel@tonic-gate            the name.  (Override whatever config.sh says)
110*0Sstevel@tonic-gate  -S        Silent mode.
111*0Sstevel@tonic-gate  -f        Force installation (don't check if same version is there)
112*0Sstevel@tonic-gate  -o        Skip checking for other copies of perl in your PATH.
113*0Sstevel@tonic-gate  -V        Verbose mode.
114*0Sstevel@tonic-gate  -A        Also install perl with the architecture's name in the perl binary's
115*0Sstevel@tonic-gate            name.
116*0Sstevel@tonic-gate  -p        Don't install the pod files. [This will break use diagnostics;]
117*0Sstevel@tonic-gate  -netware  Install correctly on a Netware server.
118*0Sstevel@tonic-gate  -destdir  Prefix installation directories by this string.
119*0Sstevel@tonic-gateEOT
120*0Sstevel@tonic-gate	exit;
121*0Sstevel@tonic-gate    }
122*0Sstevel@tonic-gate    shift;
123*0Sstevel@tonic-gate}
124*0Sstevel@tonic-gate
125*0Sstevel@tonic-gate$versiononly = 1 if $Config{versiononly} && !defined $versiononly;
126*0Sstevel@tonic-gatemy (@scripts, @tolink);
127*0Sstevel@tonic-gateopen SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!";
128*0Sstevel@tonic-gatewhile (<SCRIPTS>) {
129*0Sstevel@tonic-gate    next if /^#/;
130*0Sstevel@tonic-gate    s/\s*#\s*pod\s*=.*//; # install script regardless of pod location
131*0Sstevel@tonic-gate    next if /a2p/; # a2p is binary, to be installed separately
132*0Sstevel@tonic-gate    chomp;
133*0Sstevel@tonic-gate    if (/(\S*)\s*#\s*link\s*=\s*(\S*)/) {
134*0Sstevel@tonic-gate	push @scripts, $1;
135*0Sstevel@tonic-gate	push @tolink, [$1, $2];
136*0Sstevel@tonic-gate    } else {
137*0Sstevel@tonic-gate	push @scripts, $_;
138*0Sstevel@tonic-gate    }
139*0Sstevel@tonic-gate}
140*0Sstevel@tonic-gateclose SCRIPTS;
141*0Sstevel@tonic-gate
142*0Sstevel@tonic-gate# Added for ON - install the scripts (if any) from contrib_bin.
143*0Sstevel@tonic-gatemy $dh;
144*0Sstevel@tonic-gateif (opendir($dh, 'contrib_bin')) {
145*0Sstevel@tonic-gate	push(@scripts,
146*0Sstevel@tonic-gate	    map("contrib_bin/$_", grep($_ !~ /^\./, readdir($dh))));
147*0Sstevel@tonic-gate	closedir($dh);
148*0Sstevel@tonic-gate}
149*0Sstevel@tonic-gate
150*0Sstevel@tonic-gateif ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; }
151*0Sstevel@tonic-gate
152*0Sstevel@tonic-gatemy @pods = $nopods ? () : (<pod/*.pod>, 'x2p/a2p.pod');
153*0Sstevel@tonic-gate
154*0Sstevel@tonic-gate# Specify here any .pm files that are actually architecture-dependent.
155*0Sstevel@tonic-gate# (Those included with XS extensions under ext/ are automatically
156*0Sstevel@tonic-gate# added later.)
157*0Sstevel@tonic-gate# Now that the default privlib has the full perl version number included,
158*0Sstevel@tonic-gate# we no longer have to play the trick of sticking version-specific .pm
159*0Sstevel@tonic-gate# files under the archlib directory.
160*0Sstevel@tonic-gatemy %archpms = (
161*0Sstevel@tonic-gate    Config => 1,
162*0Sstevel@tonic-gate    lib => 1,
163*0Sstevel@tonic-gate    Cwd => 1,
164*0Sstevel@tonic-gate);
165*0Sstevel@tonic-gate
166*0Sstevel@tonic-gateif ($^O eq 'dos') {
167*0Sstevel@tonic-gate    push(@scripts,'djgpp/fixpmain');
168*0Sstevel@tonic-gate    $archpms{config} = $archpms{filehand} = 1;
169*0Sstevel@tonic-gate}
170*0Sstevel@tonic-gate
171*0Sstevel@tonic-gateif ((-e "testcompile") && (defined($ENV{'COMPILE'}))) {
172*0Sstevel@tonic-gate    push(@scripts, map("$_.exe", @scripts));
173*0Sstevel@tonic-gate}
174*0Sstevel@tonic-gate
175*0Sstevel@tonic-gatefind(sub {
176*0Sstevel@tonic-gate    if ("$File::Find::dir/$_" =~ m{^ext\b(.*)/([^/]+)\.pm$}) {
177*0Sstevel@tonic-gate	my($path, $modname) = ($1,$2);
178*0Sstevel@tonic-gate
179*0Sstevel@tonic-gate	# strip trailing component first
180*0Sstevel@tonic-gate	$path =~ s{/[^/]*$}{};
181*0Sstevel@tonic-gate
182*0Sstevel@tonic-gate	# strip optional "/lib";
183*0Sstevel@tonic-gate	$path =~ s{/lib\b}{};
184*0Sstevel@tonic-gate
185*0Sstevel@tonic-gate	# strip any leading /
186*0Sstevel@tonic-gate	$path =~ s{^/}{};
187*0Sstevel@tonic-gate
188*0Sstevel@tonic-gate	# reconstitute canonical module name
189*0Sstevel@tonic-gate	$modname = "$path/$modname" if length $path;
190*0Sstevel@tonic-gate
191*0Sstevel@tonic-gate	# remember it
192*0Sstevel@tonic-gate	$archpms{$modname} = 1;
193*0Sstevel@tonic-gate    }
194*0Sstevel@tonic-gate}, 'ext');
195*0Sstevel@tonic-gate
196*0Sstevel@tonic-gate# print "[$_]\n" for sort keys %archpms;
197*0Sstevel@tonic-gate
198*0Sstevel@tonic-gatemy $ver = $Config{version};
199*0Sstevel@tonic-gatemy $release = substr($],0,3);   # Not used currently.
200*0Sstevel@tonic-gatemy $patchlevel = substr($],3,2);
201*0Sstevel@tonic-gatedie "Patchlevel of perl ($patchlevel)",
202*0Sstevel@tonic-gate    "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
203*0Sstevel@tonic-gate	if $patchlevel != $Config{'PERL_VERSION'};
204*0Sstevel@tonic-gate
205*0Sstevel@tonic-gate# Fetch some frequently-used items from %Config
206*0Sstevel@tonic-gatemy $installbin = "$destdir$Config{installbin}";
207*0Sstevel@tonic-gatemy $installscript = "$destdir$Config{installscript}";
208*0Sstevel@tonic-gatemy $installprivlib = "$destdir$Config{installprivlib}";
209*0Sstevel@tonic-gatemy $installarchlib = "$destdir$Config{installarchlib}";
210*0Sstevel@tonic-gatemy $installsitelib = "$destdir$Config{installsitelib}";
211*0Sstevel@tonic-gatemy $installsitearch = "$destdir$Config{installsitearch}";
212*0Sstevel@tonic-gatemy $installman1dir = "$destdir$Config{installman1dir}";
213*0Sstevel@tonic-gatemy $man1ext = $Config{man1ext};
214*0Sstevel@tonic-gatemy $libperl = "$destdir$Config{libperl}";
215*0Sstevel@tonic-gate# Shared library and dynamic loading suffixes.
216*0Sstevel@tonic-gatemy $so = $Config{so};
217*0Sstevel@tonic-gatemy $dlext = $Config{dlext};
218*0Sstevel@tonic-gatemy $dlsrc = $Config{dlsrc};
219*0Sstevel@tonic-gateif ($^O eq 'os390') {
220*0Sstevel@tonic-gate    my $pwd;
221*0Sstevel@tonic-gate    chomp($pwd=`pwd`);
222*0Sstevel@tonic-gate    my $archlibexp = $Config{archlibexp};
223*0Sstevel@tonic-gate    my $usedl = $Config{usedl};
224*0Sstevel@tonic-gate    if ($usedl eq 'define') {
225*0Sstevel@tonic-gate	`./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`;
226*0Sstevel@tonic-gate    }
227*0Sstevel@tonic-gate}
228*0Sstevel@tonic-gate
229*0Sstevel@tonic-gateif ($nwinstall) {
230*0Sstevel@tonic-gate    # This is required only if we are installing on a NetWare server
231*0Sstevel@tonic-gate    $installscript = $Config{installnwscripts};
232*0Sstevel@tonic-gate    $installprivlib = $Config{installnwlib};
233*0Sstevel@tonic-gate    $installarchlib = $Config{installnwlib};
234*0Sstevel@tonic-gate    $installsitelib = $Config{installnwlib};
235*0Sstevel@tonic-gate}
236*0Sstevel@tonic-gate
237*0Sstevel@tonic-gatemy $d_dosuid = $Config{d_dosuid};
238*0Sstevel@tonic-gatemy $binexp = $Config{binexp};
239*0Sstevel@tonic-gate
240*0Sstevel@tonic-gateif ($Is_VMS) {  # Hang in there until File::Spec hits the big time
241*0Sstevel@tonic-gate    foreach ( \$installbin,     \$installscript,  \$installprivlib,
242*0Sstevel@tonic-gate	      \$installarchlib, \$installsitelib, \$installsitearch,
243*0Sstevel@tonic-gate	      \$installman1dir ) {
244*0Sstevel@tonic-gate	$$_ = unixify($$_);  $$_ =~ s:/$::;
245*0Sstevel@tonic-gate    }
246*0Sstevel@tonic-gate}
247*0Sstevel@tonic-gate
248*0Sstevel@tonic-gate# Do some quick sanity checks.
249*0Sstevel@tonic-gate
250*0Sstevel@tonic-gateif (!$nonono && $d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
251*0Sstevel@tonic-gate
252*0Sstevel@tonic-gate   $installbin		|| die "No installbin directory in config.sh\n";
253*0Sstevel@tonic-gate-d $installbin		|| mkpath($installbin, $verbose, 0777);
254*0Sstevel@tonic-gate-d $installbin		|| $nonono || die "$installbin is not a directory\n";
255*0Sstevel@tonic-gate-w $installbin		|| $nonono || die "$installbin is not writable by you\n"
256*0Sstevel@tonic-gate	unless $installbin =~ m#^/afs/# || $nonono;
257*0Sstevel@tonic-gate
258*0Sstevel@tonic-gateif (!$Is_NetWare) {
259*0Sstevel@tonic-gateif (!$Is_VMS) {
260*0Sstevel@tonic-gate-x 'perl' . $exe_ext	|| die "perl isn't executable!\n";
261*0Sstevel@tonic-gate}
262*0Sstevel@tonic-gateelse {
263*0Sstevel@tonic-gate-x $ndbg . 'perl' . $exe_ext	|| die "${ndbg}perl$exe_ext isn't executable!\n";
264*0Sstevel@tonic-gate    if ($dbg) {
265*0Sstevel@tonic-gate        -x $dbg . 'perl' . $exe_ext	|| die "${dbg}perl$exe_ext isn't executable!\n";
266*0Sstevel@tonic-gate    }
267*0Sstevel@tonic-gate}
268*0Sstevel@tonic-gate-x 'suidperl' . $exe_ext|| die "suidperl isn't executable!\n" if $d_dosuid;
269*0Sstevel@tonic-gate
270*0Sstevel@tonic-gate# Removed for ON
271*0Sstevel@tonic-gate#-f 't/rantests'		|| $Is_W32
272*0Sstevel@tonic-gate#			|| warn "WARNING: You've never run 'make test' or",
273*0Sstevel@tonic-gate#				" some tests failed! (Installing anyway.)\n";
274*0Sstevel@tonic-gate} #if (!$Is_NetWare)
275*0Sstevel@tonic-gate
276*0Sstevel@tonic-gateif (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) {
277*0Sstevel@tonic-gate    my $perldll;
278*0Sstevel@tonic-gate
279*0Sstevel@tonic-gate    if ($Is_Cygwin) {
280*0Sstevel@tonic-gate	$perldll = $libperl;
281*0Sstevel@tonic-gate	my $v_e_r_s = $ver; $v_e_r_s =~ tr/./_/;
282*0Sstevel@tonic-gate	$perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/;
283*0Sstevel@tonic-gate	$perldll =~ s/^lib/cyg/;
284*0Sstevel@tonic-gate	if ($Config{useshrplib} eq 'true') {
285*0Sstevel@tonic-gate	    # install ld2 and perlld as well
286*0Sstevel@tonic-gate	    foreach ('ld2', 'perlld') {
287*0Sstevel@tonic-gate		safe_unlink("$installbin/$_");
288*0Sstevel@tonic-gate		copy("$_", "$installbin/$_");
289*0Sstevel@tonic-gate		chmod(0755, "$installbin/$_");
290*0Sstevel@tonic-gate	    };
291*0Sstevel@tonic-gate	    open (LD2, ">$installbin/ld2");
292*0Sstevel@tonic-gate	    print LD2 <<SHELL;
293*0Sstevel@tonic-gate#!/bin/sh
294*0Sstevel@tonic-gate#
295*0Sstevel@tonic-gate# ld wrapper, passes all args to perlld;
296*0Sstevel@tonic-gate#
297*0Sstevel@tonic-gatefor trythis in $installbin/perl
298*0Sstevel@tonic-gatedo
299*0Sstevel@tonic-gate  if [ -x \$trythis ]
300*0Sstevel@tonic-gate  then
301*0Sstevel@tonic-gate    \$trythis $installbin/perlld "\$\@"
302*0Sstevel@tonic-gate    exit \$?
303*0Sstevel@tonic-gate  fi
304*0Sstevel@tonic-gatedone
305*0Sstevel@tonic-gate# hard luck!
306*0Sstevel@tonic-gateecho I see no perl executable around there
307*0Sstevel@tonic-gateecho perl is required to build dynamic libraries
308*0Sstevel@tonic-gateecho look if the path to perl in /bin/ld2 is correct
309*0Sstevel@tonic-gateexit 1
310*0Sstevel@tonic-gateSHELL
311*0Sstevel@tonic-gate	    close LD2;
312*0Sstevel@tonic-gate	    chmod(0755, "$installbin/ld2");
313*0Sstevel@tonic-gate	};
314*0Sstevel@tonic-gate    } else {
315*0Sstevel@tonic-gate	$perldll = 'perl58.' . $dlext;
316*0Sstevel@tonic-gate    }
317*0Sstevel@tonic-gate
318*0Sstevel@tonic-gate    if ($dlsrc ne "dl_none.xs") {
319*0Sstevel@tonic-gate	-f $perldll || die "No perl DLL built\n";
320*0Sstevel@tonic-gate    }
321*0Sstevel@tonic-gate
322*0Sstevel@tonic-gate    # Install the DLL
323*0Sstevel@tonic-gate    safe_unlink("$installbin/$perldll");
324*0Sstevel@tonic-gate    copy("$perldll", "$installbin/$perldll");
325*0Sstevel@tonic-gate    chmod(0755, "$installbin/$perldll");
326*0Sstevel@tonic-gate} # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin)
327*0Sstevel@tonic-gate
328*0Sstevel@tonic-gate# This will be used to store the packlist
329*0Sstevel@tonic-gatemy $packlist = ExtUtils::Packlist->new("$installarchlib/.packlist");
330*0Sstevel@tonic-gate
331*0Sstevel@tonic-gate# First we install the version-numbered executables.
332*0Sstevel@tonic-gate
333*0Sstevel@tonic-gateif ($Is_VMS) {
334*0Sstevel@tonic-gate    safe_unlink("$installbin/perl_setup.com");
335*0Sstevel@tonic-gate    copy("perl_setup.com", "$installbin/perl_setup.com");
336*0Sstevel@tonic-gate    chmod(0755, "$installbin/perl_setup.com");
337*0Sstevel@tonic-gate    safe_unlink("$installbin/$dbg$perl$exe_ext");
338*0Sstevel@tonic-gate    copy("$dbg$perl$exe_ext", "$installbin/$dbg$perl$exe_ext");
339*0Sstevel@tonic-gate    chmod(0755, "$installbin/$dbg$perl$exe_ext");
340*0Sstevel@tonic-gate    safe_unlink("$installbin/$dbg${perl}shr$exe_ext");
341*0Sstevel@tonic-gate    copy("$dbg${perl}shr$exe_ext", "$installbin/$dbg${perl}shr$exe_ext");
342*0Sstevel@tonic-gate    chmod(0755, "$installbin/$dbg${perl}shr$exe_ext");
343*0Sstevel@tonic-gate    if ($ndbg) {
344*0Sstevel@tonic-gate        safe_unlink("$installbin/$ndbg$perl$exe_ext");
345*0Sstevel@tonic-gate        copy("$ndbg$perl$exe_ext", "$installbin/$ndbg$perl$exe_ext");
346*0Sstevel@tonic-gate        chmod(0755, "$installbin/$ndbg$perl$exe_ext");
347*0Sstevel@tonic-gate	safe_unlink("$installbin/${dbg}a2p$exe_ext");
348*0Sstevel@tonic-gate	copy("x2p/${dbg}a2p$exe_ext", "$installbin/${dbg}a2p$exe_ext");
349*0Sstevel@tonic-gate	chmod(0755, "$installbin/${dbg}a2p$exe_ext");
350*0Sstevel@tonic-gate    }
351*0Sstevel@tonic-gate}
352*0Sstevel@tonic-gateelsif ($^O eq 'mpeix') {
353*0Sstevel@tonic-gate    # MPE lacks hard links and requires that executables with special
354*0Sstevel@tonic-gate    # capabilities reside in the MPE namespace.
355*0Sstevel@tonic-gate    safe_unlink("$installbin/perl$ver$exe_ext", $Config{perlpath});
356*0Sstevel@tonic-gate    # Install the primary executable into the MPE namespace as perlpath.
357*0Sstevel@tonic-gate    copy("perl$exe_ext", $Config{perlpath});
358*0Sstevel@tonic-gate    chmod(0755, $Config{perlpath});
359*0Sstevel@tonic-gate    # Create a backup copy with the version number.
360*0Sstevel@tonic-gate    link($Config{perlpath}, "$installbin/perl$ver$exe_ext");
361*0Sstevel@tonic-gate}
362*0Sstevel@tonic-gateelsif ($^O ne 'dos') {
363*0Sstevel@tonic-gate    if (!$Is_NetWare) {
364*0Sstevel@tonic-gate	if (copy_if_diff("perl$exe_ext",
365*0Sstevel@tonic-gate	    "$installbin/$perl_verbase$ver$exe_ext")) {
366*0Sstevel@tonic-gate	    strip("$installbin/$perl_verbase$ver$exe_ext");
367*0Sstevel@tonic-gate	    chmod(0555, "$installbin/$perl_verbase$ver$exe_ext");
368*0Sstevel@tonic-gate	}
369*0Sstevel@tonic-gate    }
370*0Sstevel@tonic-gate    else {
371*0Sstevel@tonic-gate	# If installing onto a NetWare server
372*0Sstevel@tonic-gate	if ($nwinstall) {
373*0Sstevel@tonic-gate	    # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm
374*0Sstevel@tonic-gate	    mkpath($Config{installnwsystem}, 1, 0777);
375*0Sstevel@tonic-gate	    copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem});
376*0Sstevel@tonic-gate	    copy("netware\\testnlm\\echo\\echo.nlm", $Config{installnwsystem});
377*0Sstevel@tonic-gate	    copy("netware\\testnlm\\type\\type.nlm", $Config{installnwsystem});
378*0Sstevel@tonic-gate	    copy("x2p\\a2p.nlm", $Config{installnwsystem});
379*0Sstevel@tonic-gate	    chmod(0755, "$Config{installnwsystem}\\perl.nlm");
380*0Sstevel@tonic-gate	    mkpath($Config{installnwlcgi}, 1, 0777);
381*0Sstevel@tonic-gate	    copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi});
382*0Sstevel@tonic-gate	}
383*0Sstevel@tonic-gate    } #if (!$Is_NetWare)
384*0Sstevel@tonic-gate}
385*0Sstevel@tonic-gateelse {
386*0Sstevel@tonic-gate    safe_unlink("$installbin/$perl.exe");
387*0Sstevel@tonic-gate    copy("perl.exe", "$installbin/$perl.exe");
388*0Sstevel@tonic-gate}
389*0Sstevel@tonic-gate
390*0Sstevel@tonic-gatesafe_unlink("$installbin/s$perl_verbase$ver$exe_ext");
391*0Sstevel@tonic-gateif ($d_dosuid) {
392*0Sstevel@tonic-gate    copy("suidperl$exe_ext", "$installbin/s$perl_verbase$ver$exe_ext");
393*0Sstevel@tonic-gate    chmod(04711, "$installbin/s$perl_verbase$ver$exe_ext");
394*0Sstevel@tonic-gate}
395*0Sstevel@tonic-gate
396*0Sstevel@tonic-gate# Install library files.
397*0Sstevel@tonic-gate
398*0Sstevel@tonic-gatemy ($do_installarchlib, $do_installprivlib) = (0, 0);
399*0Sstevel@tonic-gate
400*0Sstevel@tonic-gatemkpath($installprivlib, $verbose, 0777);
401*0Sstevel@tonic-gatemkpath($installarchlib, $verbose, 0777);
402*0Sstevel@tonic-gatemkpath($installsitelib, $verbose, 0777) if ($installsitelib);
403*0Sstevel@tonic-gatemkpath($installsitearch, $verbose, 0777) if ($installsitearch);
404*0Sstevel@tonic-gate
405*0Sstevel@tonic-gateif (chdir "lib") {
406*0Sstevel@tonic-gate    $do_installarchlib = ! samepath($installarchlib, '.');
407*0Sstevel@tonic-gate    $do_installprivlib = ! samepath($installprivlib, '.');
408*0Sstevel@tonic-gate    $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$ver/);
409*0Sstevel@tonic-gate
410*0Sstevel@tonic-gate    if ($do_installarchlib || $do_installprivlib) {
411*0Sstevel@tonic-gate	find(\&installlib, '.');
412*0Sstevel@tonic-gate    }
413*0Sstevel@tonic-gate    chdir ".." || die "Can't cd back to source directory: $!\n";
414*0Sstevel@tonic-gate}
415*0Sstevel@tonic-gateelse {
416*0Sstevel@tonic-gate    warn "Can't cd to lib to install lib files: $!\n";
417*0Sstevel@tonic-gate}
418*0Sstevel@tonic-gate
419*0Sstevel@tonic-gate# Install header files and libraries.
420*0Sstevel@tonic-gatemkpath("$installarchlib/CORE", $verbose, 0777);
421*0Sstevel@tonic-gatemy @corefiles;
422*0Sstevel@tonic-gateif ($Is_VMS) {  # We did core file selection during build
423*0Sstevel@tonic-gate    my $coredir = "lib/$Config{archname}/$ver/CORE";
424*0Sstevel@tonic-gate    $coredir =~ tr/./_/;
425*0Sstevel@tonic-gate    map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
426*0Sstevel@tonic-gate}
427*0Sstevel@tonic-gateelse {
428*0Sstevel@tonic-gate    # [als] hard-coded 'libperl' name... not good!
429*0Sstevel@tonic-gate    @corefiles = <*.h *.inc libperl*.* perl*$Config{lib_ext}>;
430*0Sstevel@tonic-gate
431*0Sstevel@tonic-gate    # AIX needs perl.exp installed as well.
432*0Sstevel@tonic-gate    push(@corefiles,'perl.exp') if $^O eq 'aix';
433*0Sstevel@tonic-gate    if ($^O eq 'mpeix') {
434*0Sstevel@tonic-gate	# MPE needs mpeixish.h installed as well.
435*0Sstevel@tonic-gate	mkpath("$installarchlib/CORE/mpeix", $verbose, 0777);
436*0Sstevel@tonic-gate	push(@corefiles,'mpeix/mpeixish.h');
437*0Sstevel@tonic-gate    }
438*0Sstevel@tonic-gate    # If they have built sperl.o...
439*0Sstevel@tonic-gate    push(@corefiles,'sperl.o') if -f 'sperl.o';
440*0Sstevel@tonic-gate}
441*0Sstevel@tonic-gateforeach my $file (@corefiles) {
442*0Sstevel@tonic-gate    # HP-UX (at least) needs to maintain execute permissions
443*0Sstevel@tonic-gate    # on dynamically-loadable libraries. So we do it for all.
444*0Sstevel@tonic-gate    if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
445*0Sstevel@tonic-gate	if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
446*0Sstevel@tonic-gate	    strip("-S", "$installarchlib/CORE/$file") if $^O =~ /^(rhapsody|darwin)$/;
447*0Sstevel@tonic-gate	    chmod(0555, "$installarchlib/CORE/$file");
448*0Sstevel@tonic-gate	} else {
449*0Sstevel@tonic-gate	    chmod(0444, "$installarchlib/CORE/$file");
450*0Sstevel@tonic-gate	}
451*0Sstevel@tonic-gate    }
452*0Sstevel@tonic-gate}
453*0Sstevel@tonic-gate
454*0Sstevel@tonic-gate# Switch in the 5.005-threads versions of he threadsafe queue and semaphore
455*0Sstevel@tonic-gate# modules if so needed.
456*0Sstevel@tonic-gateif ($Config{use5005threads}) {
457*0Sstevel@tonic-gate    for my $m (qw(Queue Semaphore)) {
458*0Sstevel@tonic-gate	my $t = "$installprivlib/Thread/$m.pm";
459*0Sstevel@tonic-gate	unlink $t;
460*0Sstevel@tonic-gate	copy("ext/Thread/$m.pmx", $t);
461*0Sstevel@tonic-gate	chmod(0444, $t);
462*0Sstevel@tonic-gate    }
463*0Sstevel@tonic-gate}
464*0Sstevel@tonic-gate
465*0Sstevel@tonic-gate# Install main perl executables
466*0Sstevel@tonic-gate# Make links to ordinary names if installbin directory isn't current directory.
467*0Sstevel@tonic-gate
468*0Sstevel@tonic-gateif (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) {
469*0Sstevel@tonic-gate    safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
470*0Sstevel@tonic-gate    if ($^O eq 'mpeix') {
471*0Sstevel@tonic-gate	# MPE doesn't support hard links, so use a symlink.
472*0Sstevel@tonic-gate	# We don't want another cloned copy.
473*0Sstevel@tonic-gate	symlink($Config{perlpath}, "$installbin/perl$exe_ext");
474*0Sstevel@tonic-gate    } elsif ($^O eq 'vos') {
475*0Sstevel@tonic-gate	# VOS doesn't support hard links, so use a symlink.
476*0Sstevel@tonic-gate	symlink("$installbin/$perl_verbase$ver$exe_ext",
477*0Sstevel@tonic-gate		"$installbin/$perl$exe_ext");
478*0Sstevel@tonic-gate    } else {
479*0Sstevel@tonic-gate	link("$installbin/$perl_verbase$ver$exe_ext",
480*0Sstevel@tonic-gate		"$installbin/$perl$exe_ext");
481*0Sstevel@tonic-gate    }
482*0Sstevel@tonic-gate    link("$installbin/$perl_verbase$ver$exe_ext",
483*0Sstevel@tonic-gate	    "$installbin/suid$perl$exe_ext")
484*0Sstevel@tonic-gate      if $d_dosuid;
485*0Sstevel@tonic-gate}
486*0Sstevel@tonic-gate
487*0Sstevel@tonic-gate# For development purposes it can be very useful to have multiple perls
488*0Sstevel@tonic-gate# build for different "architectures" (eg threading or not) simultaneously.
489*0Sstevel@tonic-gateif ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
490*0Sstevel@tonic-gate    my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext";
491*0Sstevel@tonic-gate    safe_unlink("$installbin/$archperl");
492*0Sstevel@tonic-gate    if ($^O eq 'mpeix') {
493*0Sstevel@tonic-gate	# MPE doesn't support hard links, so use a symlink.
494*0Sstevel@tonic-gate	# We don't want another cloned copy.
495*0Sstevel@tonic-gate	symlink($Config{perlpath}, "$installbin/$archperl");
496*0Sstevel@tonic-gate    } elsif ($^O eq 'vos') {
497*0Sstevel@tonic-gate	# VOS doesn't support hard links, so use a symlink.
498*0Sstevel@tonic-gate	symlink("$installbin/$perl_verbase$ver$exe_ext",
499*0Sstevel@tonic-gate		"$installbin/$archperl");
500*0Sstevel@tonic-gate    } else {
501*0Sstevel@tonic-gate	link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl");
502*0Sstevel@tonic-gate    }
503*0Sstevel@tonic-gate}
504*0Sstevel@tonic-gate
505*0Sstevel@tonic-gate# Offer to install perl in a "standard" location
506*0Sstevel@tonic-gate
507*0Sstevel@tonic-gatemy $mainperl_is_instperl = 0;
508*0Sstevel@tonic-gate
509*0Sstevel@tonic-gateif ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
510*0Sstevel@tonic-gate    !$versiononly && !$nonono && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR
511*0Sstevel@tonic-gate	&& -w $mainperldir && ! samepath($mainperldir, $installbin)) {
512*0Sstevel@tonic-gate    my($usrbinperl)	= "$mainperldir/$perl$exe_ext";
513*0Sstevel@tonic-gate    my($instperl)	= "$installbin/$perl$exe_ext";
514*0Sstevel@tonic-gate    my($expinstperl)	= "$binexp/$perl$exe_ext";
515*0Sstevel@tonic-gate
516*0Sstevel@tonic-gate    # First make sure $usrbinperl is not already the same as the perl we
517*0Sstevel@tonic-gate    # just installed.
518*0Sstevel@tonic-gate    if (-x $usrbinperl) {
519*0Sstevel@tonic-gate	# Try to be clever about mainperl being a symbolic link
520*0Sstevel@tonic-gate	# to binexp/perl if binexp and installbin are different.
521*0Sstevel@tonic-gate	$mainperl_is_instperl =
522*0Sstevel@tonic-gate	    samepath($usrbinperl, $instperl) ||
523*0Sstevel@tonic-gate	    samepath($usrbinperl, $expinstperl) ||
524*0Sstevel@tonic-gate	     (($binexp ne $installbin) &&
525*0Sstevel@tonic-gate	      (-l $usrbinperl) &&
526*0Sstevel@tonic-gate	      ((readlink $usrbinperl) eq $expinstperl));
527*0Sstevel@tonic-gate    }
528*0Sstevel@tonic-gate    if (! $mainperl_is_instperl) {
529*0Sstevel@tonic-gate	unlink($usrbinperl);
530*0Sstevel@tonic-gate	( $Config{'d_link'} eq 'define' &&
531*0Sstevel@tonic-gate	  eval { CORE::link $instperl, $usrbinperl } )	||
532*0Sstevel@tonic-gate	eval { symlink $expinstperl, $usrbinperl }	||
533*0Sstevel@tonic-gate	copy($instperl, $usrbinperl);
534*0Sstevel@tonic-gate
535*0Sstevel@tonic-gate	$mainperl_is_instperl = 1;
536*0Sstevel@tonic-gate    }
537*0Sstevel@tonic-gate}
538*0Sstevel@tonic-gate
539*0Sstevel@tonic-gate# Make links to ordinary names if installbin directory isn't current directory.
540*0Sstevel@tonic-gateif (!$Is_NetWare && $dbg eq '') {
541*0Sstevel@tonic-gate    if (! samepath($installbin, 'x2p')) {
542*0Sstevel@tonic-gate	my $base = 'a2p';
543*0Sstevel@tonic-gate	$base .= $ver if $versiononly;
544*0Sstevel@tonic-gate	copy_if_diff("x2p/a2p$exe_ext", "$installbin/$base$exe_ext");
545*0Sstevel@tonic-gate	strip("$installbin/$base$exe_ext");
546*0Sstevel@tonic-gate	chmod(0555, "$installbin/$base$exe_ext");
547*0Sstevel@tonic-gate    }
548*0Sstevel@tonic-gate}
549*0Sstevel@tonic-gate
550*0Sstevel@tonic-gate# cppstdin is just a script, but it is architecture-dependent, so
551*0Sstevel@tonic-gate# it can't safely be shared.  Place it in $installbin.
552*0Sstevel@tonic-gate# Note that Configure doesn't build cppstin if it isn't needed, so
553*0Sstevel@tonic-gate# we skip this if cppstdin doesn't exist.
554*0Sstevel@tonic-gateif (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
555*0Sstevel@tonic-gate    safe_unlink("$installbin/cppstdin");
556*0Sstevel@tonic-gate    copy("cppstdin", "$installbin/cppstdin");
557*0Sstevel@tonic-gate    chmod(0555, "$installbin/cppstdin");
558*0Sstevel@tonic-gate}
559*0Sstevel@tonic-gate
560*0Sstevel@tonic-gatesub script_alias {
561*0Sstevel@tonic-gate    my ($installscript, $orig, $alias, $scr_ext) = @_;
562*0Sstevel@tonic-gate
563*0Sstevel@tonic-gate    safe_unlink("$installscript/$alias$scr_ext");
564*0Sstevel@tonic-gate    if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
565*0Sstevel@tonic-gate	copy("$installscript/$orig$scr_ext",
566*0Sstevel@tonic-gate	     "$installscript/$alias$scr_ext");
567*0Sstevel@tonic-gate    } elsif ($^O eq 'vos') {
568*0Sstevel@tonic-gate	symlink("$installscript/$orig$scr_ext",
569*0Sstevel@tonic-gate		"$installscript/$alias$scr_ext");
570*0Sstevel@tonic-gate    } else {
571*0Sstevel@tonic-gate	link("$installscript/$orig$scr_ext",
572*0Sstevel@tonic-gate	     "$installscript/$alias$scr_ext");
573*0Sstevel@tonic-gate    }
574*0Sstevel@tonic-gate}
575*0Sstevel@tonic-gate
576*0Sstevel@tonic-gate# Install scripts.
577*0Sstevel@tonic-gatemkpath($installscript, $verbose, 0777);
578*0Sstevel@tonic-gateif ($versiononly) {
579*0Sstevel@tonic-gate    for (@scripts) {
580*0Sstevel@tonic-gate	(my $base = $_) =~ s#.*/##;
581*0Sstevel@tonic-gate	$base .= $ver;
582*0Sstevel@tonic-gate	if (copy_if_diff($_,    "$installscript/$base")) {
583*0Sstevel@tonic-gate	    chmod(0555, "$installscript/$base");
584*0Sstevel@tonic-gate	}
585*0Sstevel@tonic-gate    }
586*0Sstevel@tonic-gate
587*0Sstevel@tonic-gate    for (@tolink) {
588*0Sstevel@tonic-gate	my ($from, $to) = map { "$_$ver" } @$_;
589*0Sstevel@tonic-gate	(my $frbase = $from) =~ s#.*/##;
590*0Sstevel@tonic-gate	(my $tobase = $to) =~ s#.*/##;
591*0Sstevel@tonic-gate	script_alias($installscript, $frbase, $tobase, $scr_ext);
592*0Sstevel@tonic-gate    }
593*0Sstevel@tonic-gate} else {
594*0Sstevel@tonic-gate    for (@scripts) {
595*0Sstevel@tonic-gate	(my $base = $_) =~ s#.*/##;
596*0Sstevel@tonic-gate	copy_if_diff($_, "$installscript/$base");
597*0Sstevel@tonic-gate	chmod(0555, "$installscript/$base");
598*0Sstevel@tonic-gate    }
599*0Sstevel@tonic-gate
600*0Sstevel@tonic-gate    for (@tolink) {
601*0Sstevel@tonic-gate	my ($from, $to) = @$_;
602*0Sstevel@tonic-gate	(my $frbase = $from) =~ s#.*/##;
603*0Sstevel@tonic-gate	(my $tobase = $to) =~ s#.*/##;
604*0Sstevel@tonic-gate	script_alias($installscript, $frbase, $tobase, $scr_ext);
605*0Sstevel@tonic-gate    }
606*0Sstevel@tonic-gate}
607*0Sstevel@tonic-gate
608*0Sstevel@tonic-gate# Install pod pages.  Where? I guess in $installprivlib/pod
609*0Sstevel@tonic-gate# ($installprivlib/pods for cygwin).
610*0Sstevel@tonic-gate
611*0Sstevel@tonic-gatemy $pod = ($Is_Cygwin || $Is_Darwin) ? 'pods' : 'pod';
612*0Sstevel@tonic-gateif ( !$versiononly || ($installprivlib =~ m/\Q$ver/)) {
613*0Sstevel@tonic-gate    mkpath("${installprivlib}/$pod", $verbose, 0777);
614*0Sstevel@tonic-gate
615*0Sstevel@tonic-gate    # If Perl 5.003's perldiag.pod is there, rename it.
616*0Sstevel@tonic-gate    if (open POD, "${installprivlib}/$pod/perldiag.pod") {
617*0Sstevel@tonic-gate	read POD, $_, 4000;
618*0Sstevel@tonic-gate	close POD;
619*0Sstevel@tonic-gate	# Some of Perl 5.003's diagnostic messages ended with periods.
620*0Sstevel@tonic-gate	if (/^=.*\.$/m) {
621*0Sstevel@tonic-gate	    my ($from, $to) = ("${installprivlib}/$pod/perldiag.pod",
622*0Sstevel@tonic-gate			       "${installprivlib}/$pod/perldiag-5.003.pod");
623*0Sstevel@tonic-gate	    print "  rename $from $to";
624*0Sstevel@tonic-gate	    rename($from, $to)
625*0Sstevel@tonic-gate		or warn "Couldn't rename $from to $to: $!\n"
626*0Sstevel@tonic-gate		unless $nonono;
627*0Sstevel@tonic-gate	}
628*0Sstevel@tonic-gate    }
629*0Sstevel@tonic-gate
630*0Sstevel@tonic-gate    for (@pods) {
631*0Sstevel@tonic-gate	# $_ is a name like  pod/perl.pod
632*0Sstevel@tonic-gate	(my $base = $_) =~ s#.*/##;
633*0Sstevel@tonic-gate	if (copy_if_diff($_, "${installprivlib}/$pod/${base}")) {
634*0Sstevel@tonic-gate	    chmod(0444, "${installprivlib}/$pod/${base}");
635*0Sstevel@tonic-gate	}
636*0Sstevel@tonic-gate    }
637*0Sstevel@tonic-gate
638*0Sstevel@tonic-gate}
639*0Sstevel@tonic-gate
640*0Sstevel@tonic-gate# Check to make sure there aren't other perls around in installer's
641*0Sstevel@tonic-gate# path.  This is probably UNIX-specific.  Check all absolute directories
642*0Sstevel@tonic-gate# in the path except for where public executables are supposed to live.
643*0Sstevel@tonic-gate# Also skip $mainperl if the user opted to have it be a link to the
644*0Sstevel@tonic-gate# installed perl.
645*0Sstevel@tonic-gate
646*0Sstevel@tonic-gate# Note: Removed for ON.
647*0Sstevel@tonic-gate
648*0Sstevel@tonic-gate#if (!$versiononly && $otherperls) {
649*0Sstevel@tonic-gate#    my ($path, @path);
650*0Sstevel@tonic-gate#    my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ;
651*0Sstevel@tonic-gate#    ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
652*0Sstevel@tonic-gate#    @path = split(/$dirsep/, $path);
653*0Sstevel@tonic-gate#    if ($Is_VMS) {
654*0Sstevel@tonic-gate#	my $i = 0;
655*0Sstevel@tonic-gate#	while (exists $ENV{'DCL$PATH' . $i}) {
656*0Sstevel@tonic-gate#	    my $dir = unixpath($ENV{'DCL$PATH' . $i});  $dir =~ s-/$--;
657*0Sstevel@tonic-gate#	    push(@path,$dir);
658*0Sstevel@tonic-gate#	}
659*0Sstevel@tonic-gate#    }
660*0Sstevel@tonic-gate#    my @otherperls;
661*0Sstevel@tonic-gate#    my %otherperls;
662*0Sstevel@tonic-gate#    for (@path) {
663*0Sstevel@tonic-gate#	next unless m,^/,;
664*0Sstevel@tonic-gate#	# Use &samepath here because some systems have other dirs linked
665*0Sstevel@tonic-gate#	# to $mainperldir (like SunOS)
666*0Sstevel@tonic-gate#	next if samepath($_, $binexp);
667*0Sstevel@tonic-gate#	next if ($mainperl_is_instperl && samepath($_, $mainperldir));
668*0Sstevel@tonic-gate#	my $otherperl = "$_/$perl$exe_ext";
669*0Sstevel@tonic-gate#	next if $otherperls{$otherperl}++;
670*0Sstevel@tonic-gate#	push(@otherperls, $otherperl)
671*0Sstevel@tonic-gate#	    if (-x $otherperl && ! -d $otherperl);
672*0Sstevel@tonic-gate#    }
673*0Sstevel@tonic-gate#    if (@otherperls) {
674*0Sstevel@tonic-gate#	warn "\nWarning: $perl appears in your path in the following " .
675*0Sstevel@tonic-gate#	    "locations beyond where\nwe just installed it:\n";
676*0Sstevel@tonic-gate#	for (@otherperls) {
677*0Sstevel@tonic-gate#	    warn "    ", $_, "\n";
678*0Sstevel@tonic-gate#	}
679*0Sstevel@tonic-gate#	warn "\n";
680*0Sstevel@tonic-gate#    }
681*0Sstevel@tonic-gate#}
682*0Sstevel@tonic-gate
683*0Sstevel@tonic-gate# Added for ON - remove $ROOT prefix from the packlist entries.
684*0Sstevel@tonic-gatemy $pat = qr{^$destdir};
685*0Sstevel@tonic-gatewhile (my ($k, $v) = each(%{$packlist})) {
686*0Sstevel@tonic-gate	delete($packlist->{$k});
687*0Sstevel@tonic-gate	$k =~ s/$pat//;
688*0Sstevel@tonic-gate	if ($v->{type} eq 'link') {
689*0Sstevel@tonic-gate		my $l = delete($v->{from});
690*0Sstevel@tonic-gate		$l =~ s/$pat//;
691*0Sstevel@tonic-gate		$v->{from} = $l;
692*0Sstevel@tonic-gate	}
693*0Sstevel@tonic-gate	$packlist->{$k} = $v;
694*0Sstevel@tonic-gate}
695*0Sstevel@tonic-gateif (! $nonono) {
696*0Sstevel@tonic-gate    $packlist->write("$installarchlib/.packlist.tmp");
697*0Sstevel@tonic-gate    if (copy_if_diff("$installarchlib/.packlist.tmp",
698*0Sstevel@tonic-gate    "$installarchlib/.packlist")) {
699*0Sstevel@tonic-gate        chmod(0444, "$installarchlib/.packlist");
700*0Sstevel@tonic-gate    }
701*0Sstevel@tonic-gate    safe_unlink("$installarchlib/.packlist.tmp");
702*0Sstevel@tonic-gate}
703*0Sstevel@tonic-gate
704*0Sstevel@tonic-gateprint "  Installation complete\n" if $verbose;
705*0Sstevel@tonic-gate
706*0Sstevel@tonic-gateexit 0;
707*0Sstevel@tonic-gate
708*0Sstevel@tonic-gate###############################################################################
709*0Sstevel@tonic-gate
710*0Sstevel@tonic-gatesub yn {
711*0Sstevel@tonic-gate    my($prompt) = @_;
712*0Sstevel@tonic-gate    my($answer);
713*0Sstevel@tonic-gate    my($default) = $prompt =~ m/\[([yn])\]\s*$/i;
714*0Sstevel@tonic-gate    print STDERR $prompt;
715*0Sstevel@tonic-gate    chop($answer = <STDIN>);
716*0Sstevel@tonic-gate    $answer = $default if $answer =~ m/^\s*$/;
717*0Sstevel@tonic-gate    ($answer =~ m/^[yY]/);
718*0Sstevel@tonic-gate}
719*0Sstevel@tonic-gate
720*0Sstevel@tonic-gatesub unlink {
721*0Sstevel@tonic-gate    my(@names) = @_;
722*0Sstevel@tonic-gate    my($cnt) = 0;
723*0Sstevel@tonic-gate
724*0Sstevel@tonic-gate    return scalar(@names) if $Is_VMS;
725*0Sstevel@tonic-gate
726*0Sstevel@tonic-gate    foreach my $name (@names) {
727*0Sstevel@tonic-gate	next unless -e $name;
728*0Sstevel@tonic-gate	chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare);
729*0Sstevel@tonic-gate	print "  unlink $name\n" if $verbose;
730*0Sstevel@tonic-gate	( CORE::unlink($name) and ++$cnt
731*0Sstevel@tonic-gate	  or warn "Couldn't unlink $name: $!\n" ) unless $nonono;
732*0Sstevel@tonic-gate    }
733*0Sstevel@tonic-gate    return $cnt;
734*0Sstevel@tonic-gate}
735*0Sstevel@tonic-gate
736*0Sstevel@tonic-gatesub safe_unlink {
737*0Sstevel@tonic-gate    return if $nonono or $Is_VMS;
738*0Sstevel@tonic-gate    my @names = @_;
739*0Sstevel@tonic-gate    foreach my $name (@names) {
740*0Sstevel@tonic-gate	next unless -e $name;
741*0Sstevel@tonic-gate	chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_NetWare);
742*0Sstevel@tonic-gate	print "  unlink $name\n" if $verbose;
743*0Sstevel@tonic-gate	next if CORE::unlink($name);
744*0Sstevel@tonic-gate	warn "Couldn't unlink $name: $!\n";
745*0Sstevel@tonic-gate	if ($! =~ /busy/i) {
746*0Sstevel@tonic-gate	    print "  mv $name $name.old\n" if $verbose;
747*0Sstevel@tonic-gate	    safe_rename($name, "$name.old")
748*0Sstevel@tonic-gate		or warn "Couldn't rename $name: $!\n";
749*0Sstevel@tonic-gate	}
750*0Sstevel@tonic-gate    }
751*0Sstevel@tonic-gate}
752*0Sstevel@tonic-gate
753*0Sstevel@tonic-gatesub safe_rename {
754*0Sstevel@tonic-gate    my($from,$to) = @_;
755*0Sstevel@tonic-gate    if (-f $to and not unlink($to)) {
756*0Sstevel@tonic-gate	my($i);
757*0Sstevel@tonic-gate	for ($i = 1; $i < 50; $i++) {
758*0Sstevel@tonic-gate	    last if rename($to, "$to.$i");
759*0Sstevel@tonic-gate	}
760*0Sstevel@tonic-gate	warn("Cannot rename to `$to.$i': $!"), return 0
761*0Sstevel@tonic-gate	   if $i >= 50;	# Give up!
762*0Sstevel@tonic-gate    }
763*0Sstevel@tonic-gate    link($from,$to) || return 0;
764*0Sstevel@tonic-gate    unlink($from);
765*0Sstevel@tonic-gate}
766*0Sstevel@tonic-gate
767*0Sstevel@tonic-gatesub link {
768*0Sstevel@tonic-gate    my($from,$to) = @_;
769*0Sstevel@tonic-gate    my($success) = 0;
770*0Sstevel@tonic-gate
771*0Sstevel@tonic-gate    my $xfrom = $from;
772*0Sstevel@tonic-gate    $xfrom =~ s/^\Q$destdir\E// if $destdir;
773*0Sstevel@tonic-gate    my $xto = $to;
774*0Sstevel@tonic-gate    $xto =~ s/^\Q$destdir\E// if $destdir;
775*0Sstevel@tonic-gate    print $verbose ? "  ln $xfrom $xto\n" : "  $xto\n" unless $silent;
776*0Sstevel@tonic-gate    eval {
777*0Sstevel@tonic-gate	CORE::link($from, $to)
778*0Sstevel@tonic-gate	    ? $success++
779*0Sstevel@tonic-gate	    : ($from =~ m#^/afs/# || $to =~ m#^/afs/#)
780*0Sstevel@tonic-gate	      ? die "AFS"  # okay inside eval {}
781*0Sstevel@tonic-gate	      : die "Couldn't link $from to $to: $!\n"
782*0Sstevel@tonic-gate	  unless $nonono;
783*0Sstevel@tonic-gate	$packlist->{$xto} = { from => $xfrom, type => 'link' };
784*0Sstevel@tonic-gate    };
785*0Sstevel@tonic-gate    if ($@) {
786*0Sstevel@tonic-gate	warn "Replacing link() with File::Copy::copy(): $@";
787*0Sstevel@tonic-gate	print $verbose ? "  cp $from $xto\n" : "  $xto\n" unless $silent;
788*0Sstevel@tonic-gate	print "  creating new version of $xto\n"
789*0Sstevel@tonic-gate		 if $Is_VMS and -e $to and !$silent;
790*0Sstevel@tonic-gate	unless ($nonono or File::Copy::copy($from, $to) and ++$success) {
791*0Sstevel@tonic-gate	    # Might have been that F::C::c can't overwrite the target
792*0Sstevel@tonic-gate	    warn "Couldn't copy $from to $to: $!\n"
793*0Sstevel@tonic-gate		unless -f $to and (chmod(0666, $to), unlink $to)
794*0Sstevel@tonic-gate			and File::Copy::copy($from, $to) and ++$success;
795*0Sstevel@tonic-gate	}
796*0Sstevel@tonic-gate	$packlist->{$xto} = { type => 'file' };
797*0Sstevel@tonic-gate    }
798*0Sstevel@tonic-gate    $success;
799*0Sstevel@tonic-gate}
800*0Sstevel@tonic-gate
801*0Sstevel@tonic-gatesub chmod {
802*0Sstevel@tonic-gate    my($mode,$name) = @_;
803*0Sstevel@tonic-gate
804*0Sstevel@tonic-gate    return if ($^O eq 'dos');
805*0Sstevel@tonic-gate    printf "  chmod %o %s\n", $mode, $name if $verbose;
806*0Sstevel@tonic-gate    CORE::chmod($mode,$name)
807*0Sstevel@tonic-gate	|| warn sprintf("Couldn't chmod %o %s: $!\n", $mode, $name)
808*0Sstevel@tonic-gate      unless $nonono;
809*0Sstevel@tonic-gate}
810*0Sstevel@tonic-gate
811*0Sstevel@tonic-gatesub copy {
812*0Sstevel@tonic-gate    my($from,$to) = @_;
813*0Sstevel@tonic-gate
814*0Sstevel@tonic-gate    my $xto = $to;
815*0Sstevel@tonic-gate    $xto =~ s/^\Q$destdir\E// if $destdir;
816*0Sstevel@tonic-gate    print $verbose ? "  cp $from $xto\n" : "  $xto\n" unless $silent;
817*0Sstevel@tonic-gate    print "  creating new version of $xto\n" if $Is_VMS and -e $to and !$silent;
818*0Sstevel@tonic-gate    unless ($nonono or File::Copy::copy($from, $to)) {
819*0Sstevel@tonic-gate	# Might have been that F::C::c can't overwrite the target
820*0Sstevel@tonic-gate	warn "Couldn't copy $from to $to: $!\n"
821*0Sstevel@tonic-gate	    unless -f $to and (chmod(0666, $to), unlink $to)
822*0Sstevel@tonic-gate		   and File::Copy::copy($from, $to);
823*0Sstevel@tonic-gate    }
824*0Sstevel@tonic-gate    $packlist->{$xto} = { type => 'file' };
825*0Sstevel@tonic-gate}
826*0Sstevel@tonic-gate
827*0Sstevel@tonic-gatesub samepath {
828*0Sstevel@tonic-gate    my($p1, $p2) = @_;
829*0Sstevel@tonic-gate
830*0Sstevel@tonic-gate    return (lc($p1) eq lc($p2)) if ($Is_W32 || $Is_NetWare);
831*0Sstevel@tonic-gate
832*0Sstevel@tonic-gate    if ($p1 ne $p2) {
833*0Sstevel@tonic-gate	my($dev1, $ino1, $dev2, $ino2);
834*0Sstevel@tonic-gate	($dev1, $ino1) = stat($p1);
835*0Sstevel@tonic-gate	($dev2, $ino2) = stat($p2);
836*0Sstevel@tonic-gate	($dev1 == $dev2 && $ino1 == $ino2);
837*0Sstevel@tonic-gate    }
838*0Sstevel@tonic-gate    else {
839*0Sstevel@tonic-gate	1;
840*0Sstevel@tonic-gate    }
841*0Sstevel@tonic-gate}
842*0Sstevel@tonic-gate
843*0Sstevel@tonic-gatesub installlib {
844*0Sstevel@tonic-gate    my $dir = $File::Find::dir;
845*0Sstevel@tonic-gate    $dir =~ s#^\.(?![^/])/?##;
846*0Sstevel@tonic-gate    local($depth) = $dir ? "lib/$dir" : "lib";
847*0Sstevel@tonic-gate
848*0Sstevel@tonic-gate    my $name = $_;
849*0Sstevel@tonic-gate
850*0Sstevel@tonic-gate    # Ignore version control directories and ON artifacts.
851*0Sstevel@tonic-gate    if (($name =~ /^(?:CVS|RCS|SCCS|\.svn)\z/ and -d $name)
852*0Sstevel@tonic-gate        or ($name eq '.tstamp' and -f $name)) {
853*0Sstevel@tonic-gate	$File::Find::prune = 1;
854*0Sstevel@tonic-gate	return;
855*0Sstevel@tonic-gate    }
856*0Sstevel@tonic-gate
857*0Sstevel@tonic-gate    # ignore patch backups, RCS files, emacs backup & temp files and the
858*0Sstevel@tonic-gate    # .exists files, .PL files, and test files.
859*0Sstevel@tonic-gate    return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$} ||
860*0Sstevel@tonic-gate	      $dir  =~ m{/t(?:/|$)};
861*0Sstevel@tonic-gate
862*0Sstevel@tonic-gate    # XXX xsubpp back out of the list. prove now integrated. Out of order, so
863*0Sstevel@tonic-gate    # p4 will conflict on the next update to the following lines:
864*0Sstevel@tonic-gate
865*0Sstevel@tonic-gate    # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp
866*0Sstevel@tonic-gate    # scripts in lib/ExtUtils, and the prove script in lib/Test/Harness
867*0Sstevel@tonic-gate    # (they're installed later with other utils)
868*0Sstevel@tonic-gate    return if $name =~ /^(?:cpan|instmodsh|prove)\z/;
869*0Sstevel@tonic-gate
870*0Sstevel@tonic-gate    # ignore the Makefiles
871*0Sstevel@tonic-gate    return if $name =~ /^makefile$/i;
872*0Sstevel@tonic-gate    # ignore the test extensions
873*0Sstevel@tonic-gate    return if $dir =~ m{ext/XS/(?:APItest|Typemap)/};
874*0Sstevel@tonic-gate
875*0Sstevel@tonic-gate    $name = "$dir/$name" if $dir ne '';
876*0Sstevel@tonic-gate
877*0Sstevel@tonic-gate    my $installlib = $installprivlib;
878*0Sstevel@tonic-gate    if ($dir =~ /^auto/ ||
879*0Sstevel@tonic-gate	  ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
880*0Sstevel@tonic-gate	  ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare))
881*0Sstevel@tonic-gate       ) {
882*0Sstevel@tonic-gate	$installlib = $installarchlib;
883*0Sstevel@tonic-gate	return unless $do_installarchlib;
884*0Sstevel@tonic-gate    } else {
885*0Sstevel@tonic-gate	return unless $do_installprivlib;
886*0Sstevel@tonic-gate    }
887*0Sstevel@tonic-gate
888*0Sstevel@tonic-gate    if (-f $_) {
889*0Sstevel@tonic-gate	if (/\.(?:al|ix)$/ && !($dir =~ m[^auto/(.*)$] && $archpms{$1})) {
890*0Sstevel@tonic-gate	    $installlib = $installprivlib;
891*0Sstevel@tonic-gate	    #We're installing *.al and *.ix files into $installprivlib,
892*0Sstevel@tonic-gate	    #but we have to delete old *.al and *.ix files from the 5.000
893*0Sstevel@tonic-gate	    #distribution:
894*0Sstevel@tonic-gate	    #This might not work because $archname might have changed.
895*0Sstevel@tonic-gate	    unlink("$installarchlib/$name");
896*0Sstevel@tonic-gate	}
897*0Sstevel@tonic-gate	my $xname = "$installlib/$name";
898*0Sstevel@tonic-gate	$xname =~ s/^\Q$destdir\E// if $destdir;
899*0Sstevel@tonic-gate	$packlist->{$xname} = { type => 'file' };
900*0Sstevel@tonic-gate	if ($force || compare($_, "$installlib/$name") || $nonono) {
901*0Sstevel@tonic-gate	    unlink("$installlib/$name");
902*0Sstevel@tonic-gate	    mkpath("$installlib/$dir", $verbose, 0777);
903*0Sstevel@tonic-gate	    # HP-UX (at least) needs to maintain execute permissions
904*0Sstevel@tonic-gate	    # on dynamically-loaded libraries.
905*0Sstevel@tonic-gate	    if ($Is_NetWare && !$nwinstall) {
906*0Sstevel@tonic-gate		# Don't copy .nlp,.nlm files, doesn't make sense on Windows and also
907*0Sstevel@tonic-gate		# if copied will give problems when building new extensions.
908*0Sstevel@tonic-gate		# Has to be copied if we are installing on a NetWare server and hence
909*0Sstevel@tonic-gate		# the check !$nwinstall
910*0Sstevel@tonic-gate		if (!(/\.(?:nlp|nlm|bs)$/)) {
911*0Sstevel@tonic-gate		    copy_if_diff($_, "$installlib/$name")
912*0Sstevel@tonic-gate			and chmod($name =~ /\.(so|$dlext)$/o ? 0555 : 0444,
913*0Sstevel@tonic-gate				  "$installlib/$name");
914*0Sstevel@tonic-gate		}
915*0Sstevel@tonic-gate	   } else {
916*0Sstevel@tonic-gate		if (copy_if_diff($_, "$installlib/$name")) {
917*0Sstevel@tonic-gate		    if ($name =~ /\.(so|$dlext)$/o) {
918*0Sstevel@tonic-gate			strip("-S", "$installlib/$name") if $^O =~ /^(rhapsody|darwin)$/;
919*0Sstevel@tonic-gate			chmod(0555, "$installlib/$name");
920*0Sstevel@tonic-gate		    } else {
921*0Sstevel@tonic-gate			strip("-S", "$installlib/$name")
922*0Sstevel@tonic-gate			    if ($name =~ /\.a$/o and $^O =~ /^(rhapsody|darwin)$/);
923*0Sstevel@tonic-gate			chmod(0444, "$installlib/$name");
924*0Sstevel@tonic-gate		    }
925*0Sstevel@tonic-gate		}
926*0Sstevel@tonic-gate	    } #if ($Is_NetWare)
927*0Sstevel@tonic-gate	}
928*0Sstevel@tonic-gate    }
929*0Sstevel@tonic-gate}
930*0Sstevel@tonic-gate
931*0Sstevel@tonic-gate# Copy $from to $to, only if $from is different than $to.
932*0Sstevel@tonic-gate# Also preserve modification times for .a libraries.
933*0Sstevel@tonic-gate# On some systems, if you do
934*0Sstevel@tonic-gate#   ranlib libperl.a
935*0Sstevel@tonic-gate#   cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a
936*0Sstevel@tonic-gate# and then try to link against the installed libperl.a, you might
937*0Sstevel@tonic-gate# get an error message to the effect that the symbol table is older
938*0Sstevel@tonic-gate# than the library.
939*0Sstevel@tonic-gate# Return true if copying occurred.
940*0Sstevel@tonic-gate
941*0Sstevel@tonic-gatesub copy_if_diff {
942*0Sstevel@tonic-gate    my($from,$to)=@_;
943*0Sstevel@tonic-gate    return 1 if (($^O eq 'VMS') && (-d $from));
944*0Sstevel@tonic-gate    my $xto = $to;
945*0Sstevel@tonic-gate    $xto =~ s/^\Q$destdir\E// if $destdir;
946*0Sstevel@tonic-gate    my $perlpodbadsymlink;
947*0Sstevel@tonic-gate    if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
948*0Sstevel@tonic-gate	-l $from &&
949*0Sstevel@tonic-gate	! -e $from) {
950*0Sstevel@tonic-gate	# Some Linux implementations have problems traversing over
951*0Sstevel@tonic-gate	# multiple symlinks (when going over NFS?) and fail to read
952*0Sstevel@tonic-gate	# the symlink target.  Combine this with the fact that some
953*0Sstevel@tonic-gate	# of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS),
954*0Sstevel@tonic-gate	# and you end up with those pods not getting installed.
955*0Sstevel@tonic-gate	$perlpodbadsymlink = 1;
956*0Sstevel@tonic-gate    }
957*0Sstevel@tonic-gate    -f $from || $perlpodbadsymlink || warn "$0: $from not found";
958*0Sstevel@tonic-gate    $packlist->{$xto} = { type => 'file' };
959*0Sstevel@tonic-gate    if ($force || compare($from, $to) || $nonono) {
960*0Sstevel@tonic-gate	safe_unlink($to);   # In case we don't have write permissions.
961*0Sstevel@tonic-gate	if ($nonono) {
962*0Sstevel@tonic-gate	    $from = $depth . "/" . $from if $depth;
963*0Sstevel@tonic-gate	}
964*0Sstevel@tonic-gate	if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) {
965*0Sstevel@tonic-gate	    $from = "README.$1";
966*0Sstevel@tonic-gate	}
967*0Sstevel@tonic-gate	copy($from, $to);
968*0Sstevel@tonic-gate	# Restore timestamps if it's a .a library or for OS/2.
969*0Sstevel@tonic-gate	if (!$nonono && ($Is_OS2 || $to =~ /\.a$/)) {
970*0Sstevel@tonic-gate	    my ($atime, $mtime) = (stat $from)[8,9];
971*0Sstevel@tonic-gate	    utime $atime, $mtime, $to;
972*0Sstevel@tonic-gate	}
973*0Sstevel@tonic-gate	1;
974*0Sstevel@tonic-gate    }
975*0Sstevel@tonic-gate}
976*0Sstevel@tonic-gate
977*0Sstevel@tonic-gatesub strip
978*0Sstevel@tonic-gate{
979*0Sstevel@tonic-gate    my(@args) = @_;
980*0Sstevel@tonic-gate
981*0Sstevel@tonic-gate    return unless $dostrip;
982*0Sstevel@tonic-gate
983*0Sstevel@tonic-gate    my @opts;
984*0Sstevel@tonic-gate    while (@args && $args[0] =~ /^(-\w+)$/) {
985*0Sstevel@tonic-gate	push @opts, shift @args;
986*0Sstevel@tonic-gate    }
987*0Sstevel@tonic-gate
988*0Sstevel@tonic-gate    foreach my $file (@args) {
989*0Sstevel@tonic-gate	if (-f $file) {
990*0Sstevel@tonic-gate	    if ($verbose) {
991*0Sstevel@tonic-gate		print "  strip " . join(' ', @opts);
992*0Sstevel@tonic-gate		print " " if (@opts);
993*0Sstevel@tonic-gate		print "$file\n";
994*0Sstevel@tonic-gate	    }
995*0Sstevel@tonic-gate	    system("strip", @opts, $file);
996*0Sstevel@tonic-gate	} else {
997*0Sstevel@tonic-gate	    print "# file '$file' skipped\n" if $verbose;
998*0Sstevel@tonic-gate	}
999*0Sstevel@tonic-gate    }
1000*0Sstevel@tonic-gate}
1001