7 # List explicitly here the variables you want Configure to
8 # generate. Metaconfig only looks for shell variables, so you
9 # have to mention them as if they were shell variables, not
15 # This forces PL files to create target in same directory as PL file.
16 # This is so that make depend always knows where to find PL derivatives.
19 my $file = basename($0, '.PL');
20 $file .= '.com' if $^O eq 'VMS';
23 open OUT,">$file" or die "Can't create $file: $!";
25 print "Extracting $file (with variable substitutions)\n";
27 # In this section, perl variables will be expanded during extraction.
28 # You can use $Config{...} to use Configure variables.
30 print OUT <<"!GROK!THIS!";
32 eval 'exec $Config{'perlpath'} -S \$0 \${1+"\$@"}'
33 if \$running_under_some_shell;
36 print OUT "\n# perlivp $^V\n";
38 # In the following, perl variables are not expanded during extraction.
40 print OUT <<'!NO!SUBS!';
47 $0 [-a] [-p] [-v] | [-h]
49 -a Run all tests (default is to skip .ph tests)
50 -p Print a preface before each test telling what it will test.
51 -v Verbose mode in which extra information about test results
52 is printed. Test failures always print out some extra information
53 regardless of whether or not this switch is set.
54 -h Prints this help message.
59 use vars qw(%opt); # allow testing with older versions (do not use our)
61 @opt{ qw/? H h P p V v/ } = qw(0 0 0 0 0 0 0);
63 while ($ARGV[0] =~ /^-/) {
65 for my $flag (split(//,$ARGV[0])) {
66 usage() if '?' =~ /\Q$flag/;
67 usage() if 'h' =~ /\Q$flag/;
68 usage() if 'H' =~ /\Q$flag/;
69 usage("unknown flag: `$flag'") unless 'HhPpVva' =~ /\Q$flag/;
70 warn "$0: `$flag' flag already set\n" if $opt{$flag}++;
84 # We cannot merely check the variable `$^X' in general since on many
85 # Unixes it is the basename rather than the full path to the perl binary.
87 if (defined($Config{'perlpath'})) { $perlpath = $Config{'perlpath'}; }
89 # The useithreads Config variable plays a role in whether or not
90 # threads and threads/shared work when C<use>d. They apparently always
91 # get installed on systems that can run Configure.
93 if (defined($Config{'useithreads'})) { $useithreads = $Config{'useithreads'}; }
95 print OUT <<"!GROK!THIS!";
96 my \$perlpath = '$perlpath';
97 my \$useithreads = '$useithreads';
100 print OUT <<'!NO!SUBS!';
102 print "## Checking Perl binary via variable `\$perlpath' = $perlpath.\n" if $opt{'p'};
105 print "## Perl binary `$perlpath' appears executable.\n" if $opt{'v'};
110 print "# Perl binary `$perlpath' does not appear executable.\n";
117 print "## Checking Perl version via variable `\$]'.\n" if $opt{'p'};
121 print OUT <<"!GROK!THIS!";
122 my \$ivp_VERSION = "$]";
125 print OUT <<'!NO!SUBS!';
126 if ($ivp_VERSION eq $]) {
127 print "## Perl version `$]' appears installed as expected.\n" if $opt{'v'};
132 print "# Perl version `$]' installed, expected $ivp_VERSION.\n";
139 print "## Checking roots of the Perl library directory tree via variable `\@INC'.\n" if $opt{'p'};
144 next if $_ eq '.'; # skip -d test here
145 if ($^O eq 'MacOS') {
146 next if $_ eq ':'; # skip -d test here
147 next if $_ eq 'Dev:Pseudo:'; # why is this in @INC?
150 print "## Perl \@INC directory `$_' exists.\n" if $opt{'v'};
154 print "# Perl \@INC directory `$_' does not appear to exist.\n";
158 if ($INC_total == $INC_there) {
169 print "## Checking installations of modules necessary for ivp.\n" if $opt{'p'};
171 my $needed_total = 0;
172 my $needed_there = 0;
173 foreach (qw(Config.pm ExtUtils/Installed.pm)) {
176 eval "require \"$_\";";
178 print "## Module `$_' appears to be installed.\n" if $opt{'v'};
182 print "# Needed module `$_' does not appear to be properly installed.\n";
186 if ($needed_total == $needed_there) {
197 print "## Checking installations of extensions built with perl.\n" if $opt{'p'};
201 my $extensions_total = 0;
202 my $extensions_there = 0;
203 if (defined($Config{'extensions'})) {
204 my @extensions = split(/\s+/,$Config{'extensions'});
205 foreach (@extensions) {
207 if ( $useithreads !~ /define/i ) {
208 next if ($_ eq 'threads');
209 next if ($_ eq 'threads/shared');
211 # that's a distribution name, not a module name
212 next if $_ eq 'IO/Compress';
213 next if $_ eq 'Devel/DProf';
214 next if $_ eq 'libnet';
215 next if $_ eq 'Locale/Codes';
216 next if $_ eq 'podlators';
218 next if $_ eq 'XS/APItest';
219 next if $_ eq 'XS/Typemap';
220 # VMS$ perl -e "eval ""require \""Devel/DProf.pm\"";"" print $@"
221 # \NT> perl -e "eval \"require 'Devel/DProf.pm'\"; print $@"
222 # DProf: run perl with -d to use DProf.
223 # Compilation failed in require at (eval 1) line 1.
224 eval " require \"$_.pm\"; ";
226 print "## Module `$_' appears to be installed.\n" if $opt{'v'};
230 print "# Required module `$_' does not appear to be properly installed.\n";
236 # A silly name for a module (that hopefully won't ever exist).
237 # Note that this test serves more as a check of the validity of the
238 # actuall required module tests above.
239 my $unnecessary = 'bLuRfle';
241 if (!grep(/$unnecessary/, @extensions)) {
243 eval " require \"$unnecessary.pm\"; ";
245 print "## Unnecessary module `$unnecessary' does not appear to be installed.\n" if $opt{'v'};
248 print "# Unnecessary module `$unnecessary' appears to be installed.\n";
254 if ($extensions_total == $extensions_there) {
265 print "## Checking installations of later additional extensions.\n" if $opt{'p'};
267 use ExtUtils::Installed;
269 my $installed_total = 0;
270 my $installed_there = 0;
271 my $version_check = 0;
272 my $installed = ExtUtils::Installed -> new();
273 my @modules = $installed -> modules();
278 # Consider it there if it contains one or more files,
279 # and has zero missing files,
280 # and has a defined version
282 $version = $installed -> version($_);
284 print "## $_; $version\n" if $opt{'v'};
288 print "# $_; NO VERSION\n" if $opt{'v'};
292 @missing = $installed -> validate($_);
294 # .bs files are optional
295 @missing = grep { ! /\.bs$/ } @missing;
296 # man files are often compressed
297 @missing = grep { ! ( -s "$_.gz" || -s "$_.bz2" ) } @missing;
299 if ($#missing >= 0) {
300 print "# file",+($#missing == 0) ? '' : 's'," missing from installation:\n";
301 print '# ',join(' ',@missing),"\n";
303 elsif ($#missing == -1) {
308 if (($installed_total == $installed_there) &&
309 ($installed_total == $version_check)) {
321 print "## Checking installations of *.h -> *.ph header files.\n" if $opt{'p'};
326 # Just about "any" C implementation ought to have a stdio.h (even if
327 # Config.pm may not list a i_stdio var).
328 my @ph_files = qw(stdio.ph);
329 # Add the ones that we know that perl thinks are there:
330 while (($var, $val) = each %Config) {
331 if ($var =~ m/i_(.+)/ && $val eq 'define') {
333 # Some header and symbol names don't match for hysterical raisins.
334 $h_file = 'arpa/inet' if $h_file eq 'arpainet';
335 $h_file = 'netinet/in' if $h_file eq 'niin';
336 $h_file = 'netinet/tcp' if $h_file eq 'netinettcp';
337 $h_file = 'sys/resource' if $h_file eq 'sysresrc';
338 $h_file = 'sys/select' if $h_file eq 'sysselct';
339 $h_file = 'sys/security' if $h_file eq 'syssecrt';
340 $h_file = 'rpcsvc/dbm' if $h_file eq 'rpcsvcdbm';
341 # This ought to distinguish syslog from sys/syslog.
342 # (NB syslog.ph is heavily used for the DBI pre-requisites).
343 $h_file =~ s{^sys(\w.+)}{sys/$1} unless $h_file eq 'syslog';
344 push(@ph_files, "$h_file.ph");
347 #foreach (qw(stdio.ph syslog.ph)) {
348 foreach (@ph_files) {
350 eval "require \"$_\";";
352 print "## Perl header `$_' appears to be installed.\n" if $opt{'v'};
356 print "# Perl header `$_' does not appear to be properly installed.\n";
361 if (scalar(@ph_files) == $ph_there) {
372 print "## Skip checking of *.ph header files.\n" if $opt{'p'};
375 # Final report (rather than feed ousrselves to Test::Harness::runtests()
376 # we simply format some output on our own to keep things simple and
377 # easier to "fix" - at least for now.
379 if ($error_total == 0 && $tests_total) {
380 print "All tests successful.\n";
381 } elsif ($tests_total==0){
382 die "FAILED--no tests were run for some reason.\n";
385 if ($tests_total > 0) { $rate = sprintf "%.2f", 100.0 * ($pass__total / $tests_total); }
386 printf " %d/%d subtests failed, %.2f%% okay.\n",
387 $error_total, $tests_total, $rate;
392 perlivp - Perl Installation Verification Procedure
396 B<perlivp> [B<-a>] [B<-p>] [B<-v>] [B<-h>]
400 The B<perlivp> program is set up at Perl source code build time to test the
401 Perl version it was built under. It can be used after running:
405 (or your platform's equivalent procedure) to verify that B<perl> and its
406 libraries have been installed correctly. A correct installation is verified
407 by output that looks like:
420 Prints out a brief help message.
422 =item B<-a> run all tests
424 Normally tests for optional features are skipped. With -a all tests
427 =item B<-p> print preface
429 Gives a description of each test prior to performing it.
433 Gives more detailed information about each test, after it has been performed.
434 Note that any failed tests ought to print out some extra information whether
443 =item * print "# Perl binary `$perlpath' does not appear executable.\n";
445 Likely to occur for a perl binary that was not properly installed.
446 Correct by conducting a proper installation.
448 =item * print "# Perl version `$]' installed, expected $ivp_VERSION.\n";
450 Likely to occur for a perl that was not properly installed.
451 Correct by conducting a proper installation.
453 =item * print "# Perl \@INC directory `$_' does not appear to exist.\n";
455 Likely to occur for a perl library tree that was not properly installed.
456 Correct by conducting a proper installation.
458 =item * print "# Needed module `$_' does not appear to be properly installed.\n";
460 One of the two modules that is used by perlivp was not present in the
461 installation. This is a serious error since it adversely affects perlivp's
462 ability to function. You may be able to correct this by performing a
463 proper perl installation.
465 =item * print "# Required module `$_' does not appear to be properly installed.\n";
467 An attempt to C<eval "require $module"> failed, even though the list of
468 extensions indicated that it should succeed. Correct by conducting a proper
471 =item * print "# Unnecessary module `bLuRfle' appears to be installed.\n";
473 This test not coming out ok could indicate that you have in fact installed
474 a bLuRfle.pm module or that the C<eval " require \"$module_name.pm\"; ">
475 test may give misleading results with your installation of perl. If yours
476 is the latter case then please let the author know.
478 =item * print "# file",+($#missing == 0) ? '' : 's'," missing from installation:\n";
480 One or more files turned up missing according to a run of
481 C<ExtUtils::Installed -E<gt> validate()> over your installation.
482 Correct by conducting a proper installation.
484 =item * print "# Perl header `$_' does not appear to be properly installed.\n";
486 Correct by running B<h2ph> over your system's C header files. If necessary,
487 edit the resulting *.ph files to eliminate perl syntax errors.
491 For further information on how to conduct a proper installation consult the
492 INSTALL file that comes with the perl source and the README file for your
503 close OUT or die "Can't close $file: $!";
504 chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
505 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';