5 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
6 # 2002, 2003, 2004, 2005, 2006, 2007 Larry Wall and others.
14 # lib/Cross.pm (optionally)
17 # from the contents of the static files
22 # and from the contents of the Configure-generated file
26 # Note that output directory is xlib/[cross-name]/ for cross-compiling
28 # It will only update Config.pm and Config_heavy.pl if the contents of
29 # either file would be different. Note that *both* files are updated in
30 # this case, since for example an extension makefile that has a dependency
31 # on Config.pm should trigger even if only Config_heavy.pl has changed.
33 sub usage { die <<EOF }
35 --cross=PLATFORM cross-compile for a different platform
36 --no-glossary don't include Porting/Glossary in lib/Config.pod
40 use vars qw(%Config $Config_SH_expanded);
42 my $how_many_common = 22;
44 # commonly used names to precache (and hence lookup fastest)
47 while ($how_many_common--) {
50 /^(\S+):\s*(\d+)$/ or die "Malformed line '$_'";
54 # names of things which may need to have slashes changed to double-colons
55 my %Extensions = map {($_,$_)}
56 qw(dynamic_ext static_ext extensions known_extensions);
58 # allowed opts as well as specifies default and initial values
60 'cross' => '', # --cross=PLATFORM - crosscompiling for PLATFORM
61 'glossary' => 1, # --no-glossary - no glossary file inclusion,
66 # user specified options
69 (map {/^--([\-_\w]+)=(.*)$/} @ARGV),
70 # --opt --no-opt --noopt
71 (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV),
74 my %opts = (%Allowed_Opts, %given_opts);
76 for my $opt (grep {!exists $Allowed_Opts{$_}} keys %given_opts) {
77 warn "option '$opt' is not recognized";
80 @ARGV = grep {!/^--/} @ARGV;
88 my ($Config_SH, $Config_PM, $Config_heavy, $Config_POD);
89 my $Glossary = 'Porting/Glossary';
92 # creating cross-platform config file
94 mkdir "xlib/$Opts{cross}";
95 $Config_PM = "xlib/$Opts{cross}/Config.pm";
96 $Config_POD = "xlib/$Opts{cross}/Config.pod";
97 $Config_SH = "Cross/config-$Opts{cross}.sh";
100 $Config_PM = "lib/Config.pm";
101 $Config_POD = "lib/Config.pod";
102 $Config_SH = "config.sh";
104 ($Config_heavy = $Config_PM) =~ s/\.pm$/_heavy.pl/;
105 die "Can't automatically determine name for Config_heavy.pl from '$Config_PM'"
106 if $Config_heavy eq $Config_PM;
111 $heavy_txt .= <<'ENDOFBEG';
112 # This file was created by configpm when Perl was built. Any changes
113 # made to this file will be lost the next time perl is built.
117 # use warnings; Pulls in Carp
118 # use vars pulls in Carp
121 my $myver = sprintf "%vd", $^V;
123 $config_txt .= sprintf <<'ENDOFBEG', ($myver) x 3;
124 # This file was created by configpm when Perl was built. Any changes
125 # made to this file will be lost the next time perl is built.
129 # use warnings; Pulls in Carp
130 # use vars pulls in Carp
131 @Config::EXPORT = qw(%%Config);
132 @Config::EXPORT_OK = qw(myconfig config_sh config_vars config_re);
134 # Need to stub all the functions to make code such as print Config::config_sh
142 my %%Export_Cache = map {($_ => 1)} (@Config::EXPORT, @Config::EXPORT_OK);
146 # Define our own import method to avoid pulling in the full Exporter:
149 @_ = @Config::EXPORT unless @_;
151 my @funcs = grep $_ ne '%%Config', @_;
152 my $export_Config = @funcs < @_ ? 1 : 0;
155 my $callpkg = caller(0);
156 foreach my $func (@funcs) {
157 die sprintf qq{"%%s" is not exported by the %%s module\n},
158 $func, __PACKAGE__ unless $Export_Cache{$func};
159 *{$callpkg.'::'.$func} = \&{$func};
162 *{"$callpkg\::Config"} = \%%Config if $export_Config;
166 die "Perl lib version (%s) doesn't match executable version ($])"
170 or die "Perl lib version (%s) doesn't match executable version (" .
171 sprintf("v%%vd",$^V) . ")";
185 open(CONFIG_SH, $Config_SH) || die "Can't open $Config_SH: $!";
186 while (<CONFIG_SH>) {
187 next if m:^#!/bin/sh:;
189 # Catch PERL_CONFIG_SH=true and PERL_VERSION=n line from Configure.
190 s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/ or m/^(\w+)='(.*)'$/;
191 my($k, $v) = ($1, $2);
193 # grandfather PATCHLEVEL and SUBVERSION and CONFIG
195 if ($k eq 'PERL_VERSION') {
196 push @v_others, "PATCHLEVEL='$v'\n";
198 elsif ($k eq 'PERL_SUBVERSION') {
199 push @v_others, "SUBVERSION='$v'\n";
201 elsif ($k eq 'PERL_CONFIG_SH') {
202 push @v_others, "CONFIG='$v'\n";
206 # We can delimit things in config.sh with either ' or ".
207 unless ($in_v or m/^(\w+)=(['"])(.*\n)/){
208 push(@non_v, "#$_"); # not a name='value' line
216 ($name,$val) = ($1,$3);
218 $in_v = $val !~ /$quote\n/;
221 s,/,::,g if $Extensions{$name};
223 $val =~ s/$quote\n?\z//;
225 my $line = "$name=$quote$val$quote\n";
226 push(@v_others, $line);
227 $seen_quotes{$quote}++;
232 # This is somewhat grim, but I want the code for parsing config.sh here and
233 # now so that I can expand $Config{ivsize} and $Config{ivtype}
235 my $fetch_string = <<'EOT';
237 # Search for it in the big string
239 my($self, $key) = @_;
243 if ($seen_quotes{'"'}) {
244 # We need the full ' and " code
245 $fetch_string .= <<'EOT';
246 my $quote_type = "'";
247 my $marker = "$key=";
249 # Check for the common case, ' delimited
250 my $start = index($Config_SH_expanded, "\n$marker$quote_type");
251 # If that failed, check for " delimited
254 $start = index($Config_SH_expanded, "\n$marker$quote_type");
258 $fetch_string .= <<'EOT';
259 # We only have ' delimted.
260 my $start = index($Config_SH_expanded, "\n$key=\'");
263 $fetch_string .= <<'EOT';
264 # Start can never be -1 now, as we've rigged the long string we're
265 # searching with an initial dummy newline.
266 return undef if $start == -1;
268 $start += length($key) + 3;
271 if (!$seen_quotes{'"'}) {
272 # Don't need the full ' and " code, or the eval expansion.
273 $fetch_string .= <<'EOT';
274 my $value = substr($Config_SH_expanded, $start,
275 index($Config_SH_expanded, "'\n", $start)
279 $fetch_string .= <<'EOT';
280 my $value = substr($Config_SH_expanded, $start,
281 index($Config_SH_expanded, "$quote_type\n", $start)
284 # If we had a double-quote, we'd better eval it so escape
285 # sequences and such can be interpolated. Since the incoming
286 # value is supposed to follow shell rules and not perl rules,
287 # we escape any perl variable markers
288 if ($quote_type eq '"') {
289 $value =~ s/\$/\\\$/g;
290 $value =~ s/\@/\\\@/g;
291 eval "\$value = \"$value\"";
295 $fetch_string .= <<'EOT';
296 # So we can say "if $Config{'foo'}".
297 $value = undef if $value eq 'undef';
298 $self->{$key} = $value; # cache it
305 # Calculation for the keys for byteorder
306 # This is somewhat grim, but I need to run fetch_string here.
307 our $Config_SH_expanded = join "\n", '', @v_others;
309 my $t = fetch_string ({}, 'ivtype');
310 my $s = fetch_string ({}, 'ivsize');
312 # byteorder does exist on its own but we overlay a virtual
313 # dynamically recomputed value.
315 # However, ivtype and ivsize will not vary for sane fat binaries
317 my $f = $t eq 'long' ? 'L!' : $s == 8 ? 'Q': 'I';
320 if ($s == 4 || $s == 8) {
321 my $list = join ',', reverse(2..$s);
323 $byteorder_code = <<"EOT";
326 foreach my \$c ($list) { \$i |= ord(\$c); \$i <<= 8 }
328 our \$byteorder = join('', unpack('$format', pack('$f', \$i)));
331 $byteorder_code = "our \$byteorder = '?'x$s;\n";
336 if (fetch_string({},'userelocatableinc')) {
337 foreach my $what (qw(prefixexp
386 installvendorhtml1dir
387 installvendorhtml3dir
393 push @need_relocation, $what if fetch_string({}, $what) =~ m!^\.\.\./!;
398 @need_relocation{@need_relocation} = @need_relocation;
400 # This can have .../ anywhere:
401 if (fetch_string({}, 'otherlibdirs') =~ m!\.\.\./!) {
402 $need_relocation{otherlibdirs} = 'otherlibdirs';
405 my $relocation_code = <<'EOT';
409 return $libdir unless $libdir =~ s!^\.\.\./!!;
411 if ($prefix =~ s!/[^/]*$!!) {
412 while ($libdir =~ m!^\.\./!) {
413 # Loop while $libdir starts "../" and $prefix still has a trailing
415 last unless $prefix =~ s!/([^/]+)$!!;
416 # but bail out if the directory we picked off the end of $prefix is .
418 if ($1 eq '.' or $1 eq '..') {
419 # Undo! This should be rare, hence code it this way rather than a
420 # check each time before the s!!! above.
421 $prefix = "$prefix/$1";
424 # Remove that leading ../ and loop again
425 substr ($libdir, 0, 3, '');
427 $libdir = "$prefix/$libdir";
433 if (%need_relocation) {
434 my $relocations_in_common;
435 # otherlibdirs only features in the hash
436 foreach (keys %need_relocation) {
437 $relocations_in_common++ if $Common{$_};
439 if ($relocations_in_common) {
440 $config_txt .= $relocation_code;
442 $heavy_txt .= $relocation_code;
446 $heavy_txt .= join('', @non_v) . "\n";
448 # copy config summary format from the myconfig.SH script
449 $heavy_txt .= "our \$summary = <<'!END!';\n";
450 open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
451 1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
452 do { $heavy_txt .= $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
455 $heavy_txt .= "\n!END!\n" . <<'EOT';
456 my $summary_expanded;
459 return $summary_expanded if $summary_expanded;
460 ($summary_expanded = $summary) =~ s{\$(\w+)}
463 if ($1 eq 'git_ancestor_line') {
464 if ($Config::Config{git_ancestor}) {
465 $c= "\n Ancestor: $Config::Config{git_ancestor}";
470 $c = $Config::Config{$1};
472 defined($c) ? $c : 'undef'
481 $heavy_txt .= join('', sort @v_others) . "!END!\n";
483 # Only need the dynamic byteorder code in Config.pm if 'byteorder' is one of
485 if ($Common{byteorder}) {
486 $config_txt .= $byteorder_code;
488 $heavy_txt .= $byteorder_code;
491 if (@need_relocation) {
492 $heavy_txt .= 'foreach my $what (qw(' . join (' ', @need_relocation) .
494 s/^($what=)(['"])(.*?)\2/$1 . $2 . relocate_inc($3) . $2/me;
497 # Currently it only makes sense to do the ... relocation on Unix, so there's
498 # no need to emulate the "which separator for this platform" logic in perl.c -
499 # ':' will always be applicable
500 if ($need_relocation{otherlibdirs}) {
501 $heavy_txt .= << 'EOT';
502 s{^(otherlibdirs=)(['"])(.*?)\2}
503 {$1 . $2 . join ':', map {relocate_inc($_)} split ':', $3 . $2}me;
508 $heavy_txt .= <<'EOT';
509 s/(byteorder=)(['"]).*?\2/$1$2$Config::byteorder$2/m;
511 my $config_sh_len = length $_;
513 our $Config_SH_expanded = "\n$_" . << 'EOVIRTUAL';
516 foreach my $prefix (qw(ccflags ldflags)) {
517 my $value = fetch_string ({}, $prefix);
518 my $withlargefiles = fetch_string ({}, $prefix . "_uselargefiles");
519 if (defined $withlargefiles) {
520 $value =~ s/\Q$withlargefiles\E\b//;
521 $heavy_txt .= "${prefix}_nolargefiles='$value'\n";
525 foreach my $prefix (qw(libs libswanted)) {
526 my $value = fetch_string ({}, $prefix);
527 my $withlf = fetch_string ({}, 'libswanted_uselargefiles');
528 next unless defined $withlf;
530 = split(' ', fetch_string ({}, 'libswanted_uselargefiles'));
533 @lflibswanted{@lflibswanted} = ();
534 if ($prefix eq 'libs') {
535 my @libs = grep { /^-l(.+)/ &&
536 not exists $lflibswanted{$1} }
537 split(' ', fetch_string ({}, 'libs'));
538 $value = join(' ', @libs);
540 my @libswanted = grep { not exists $lflibswanted{$_} }
541 split(' ', fetch_string ({}, 'libswanted'));
542 $value = join(' ', @libswanted);
545 $heavy_txt .= "${prefix}_nolargefiles='$value'\n";
548 $heavy_txt .= "EOVIRTUAL\n";
550 $heavy_txt .= <<'ENDOFGIT';
551 require 'Config_git.pl';
552 $Config_SH_expanded .= $Config::Git_Data;
555 $heavy_txt .= $fetch_string;
557 $config_txt .= <<'ENDOFEND';
560 my($self, $key) = @_;
562 # check for cached value (which may be undef so we use exists not defined)
563 return $self->{$key} if exists $self->{$key};
565 return $self->fetch_string($key);
569 $heavy_txt .= <<'ENDOFEND';
575 substr($Config_SH_expanded, 1, index($Config_SH_expanded, '=') - 1 );
580 if ($seen_quotes{'"'}) {
581 $heavy_txt .= <<'ENDOFEND';
582 # Find out how the current key's quoted so we can skip to its end.
583 my $quote = substr($Config_SH_expanded,
584 index($Config_SH_expanded, "=", $prevpos)+1, 1);
585 my $pos = index($Config_SH_expanded, qq($quote\n), $prevpos) + 2;
588 # Just ' quotes, so it's much easier.
589 $heavy_txt .= <<'ENDOFEND';
590 my $pos = index($Config_SH_expanded, qq('\n), $prevpos) + 2;
593 $heavy_txt .= <<'ENDOFEND';
594 my $len = index($Config_SH_expanded, "=", $pos) - $pos;
596 $len > 0 ? substr($Config_SH_expanded, $pos, $len) : undef;
600 return 1 if exists($_[0]->{$_[1]});
602 return(index($Config_SH_expanded, "\n$_[1]='") != -1
604 if ($seen_quotes{'"'}) {
605 $heavy_txt .= <<'ENDOFEND';
606 or index($Config_SH_expanded, "\n$_[1]=\"") != -1
609 $heavy_txt .= <<'ENDOFEND';
613 sub STORE { die "\%Config::Config is read-only\n" }
619 substr $Config_SH_expanded, 1, $config_sh_len;
624 return map { chomp; $_ } grep eval{ /^(?:$re)=/ }, split /^/,
629 # implements -V:cfgvar option (see perlrun -V:)
631 # find optional leading, trailing colons; and query-spec
632 my ($notag,$qry,$lncont) = m/^(:)?(.*?)(:)?$/; # flags fore and aft,
633 # map colon-flags to print decorations
634 my $prfx = $notag ? '': "$qry="; # tag-prefix for print
635 my $lnend = $lncont ? ' ' : ";\n"; # line ending for print
637 # all config-vars are by definition \w only, any \W means regex
639 my @matches = config_re($qry);
640 print map "$_$lnend", @matches ? @matches : "$qry: not found" if !$notag;
641 print map { s/\w+=//; "$_$lnend" } @matches ? @matches : "$qry: not found" if $notag;
643 my $v = (exists $Config::Config{$qry}) ? $Config::Config{$qry}
645 $v = 'undef' unless defined $v;
646 print "${prfx}'${v}'$lnend";
651 # Called by the real AUTOLOAD
654 goto \&$Config::AUTOLOAD;
661 $config_txt .= <<'ENDOFSET';
664 my ($value, $v) = $Config_SH_expanded =~ m/^used_aout='(.*)'\s*$/m;
665 for (split ' ', $value) {
666 ($v) = $Config_SH_expanded =~ m/^aout_$_='(.*)'\s*$/m;
667 $preconfig{$_} = $v eq 'undef' ? undef : $v;
670 $preconfig{d_fork} = undef unless $OS2::can_fork; # Some funny cases can't
671 sub TIEHASH { bless {%preconfig} }
673 # Extract the name of the DLL from the makefile to avoid duplication
674 my ($f) = grep -r, qw(GNUMakefile Makefile);
676 if (open my $fh, '<', $f) {
678 $dll = $1, last if /^PERL_DLL_BASE\s*=\s*(\S*)\s*$/;
681 $config_txt .= <<ENDOFSET if $dll;
682 \$preconfig{dll_name} = '$dll';
685 $config_txt .= <<'ENDOFSET';
692 foreach my $key (keys %Common) {
693 my $value = fetch_string ({}, $key);
694 # Is it safe on the LHS of => ?
695 my $qkey = $key =~ /^[A-Za-z_][A-Za-z0-9_]*$/ ? $key : "'$key'";
696 if (defined $value) {
697 # Quote things for a '' string
698 $value =~ s!\\!\\\\!g;
701 if ($key eq 'otherlibdirs') {
702 $value = "join (':', map {relocate_inc(\$_)} split (':', $value))";
703 } elsif ($need_relocation{$key}) {
704 $value = "relocate_inc($value)";
709 $Common{$key} = "$qkey => $value";
712 if ($Common{byteorder}) {
713 $Common{byteorder} = 'byteorder => $byteorder';
715 my $fast_config = join '', map { " $_,\n" } sort values %Common;
717 # Sanity check needed to stop an infite loop if Config_heavy.pl fails to define
718 # &launcher for some reason (eg it got truncated)
719 $config_txt .= sprintf <<'ENDOFTIE', $fast_config;
724 require 'Config_heavy.pl';
725 goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/;
726 die "&Config::AUTOLOAD failed on $Config::AUTOLOAD";
729 # tie returns the object, so the value returned to require will be true.
730 tie %%Config, 'Config', {
735 open(CONFIG_POD, ">$Config_POD") or die "Can't open $Config_POD: $!";
736 print CONFIG_POD <<'ENDOFTAIL';
739 Config - access Perl configuration information
744 if ($Config{usethreads}) {
745 print "has thread support\n"
748 use Config qw(myconfig config_sh config_vars config_re);
756 config_vars(qw(osname archname));
761 The Config module contains all the information that was available to
762 the C<Configure> program at Perl build time (over 900 values).
764 Shell variables from the F<config.sh> file (written by Configure) are
765 stored in the readonly-variable C<%Config>, indexed by their names.
767 Values stored in config.sh as 'undef' are returned as undefined
768 values. The perl C<exists> function can be used to check if a
769 named variable exists.
775 Returns a textual summary of the major perl configuration values.
776 See also C<-V> in L<perlrun/Switches>.
780 Returns the entire perl configuration information in the form of the
781 original config.sh shell variable assignment script.
783 =item config_re($regex)
785 Like config_sh() but returns, as a list, only the config entries who's
786 names match the $regex.
788 =item config_vars(@names)
790 Prints to STDOUT the values of the named configuration variable. Each is
791 printed on a separate line in the form:
795 Names which are unknown are output as C<name='UNKNOWN';>.
796 See also C<-V:name> in L<perlrun/Switches>.
802 Here's a more sophisticated example of using %Config:
809 unless($Config{sig_name} && $Config{sig_num}) {
812 my @names = split ' ', $Config{sig_name};
813 @sig_num{@names} = split ' ', $Config{sig_num};
815 $sig_name[$sig_num{$_}] ||= $_;
819 print "signal #17 = $sig_name[17]\n";
820 if ($sig_num{ALRM}) {
821 print "SIGALRM is $sig_num{ALRM}\n";
826 Because this information is not stored within the perl executable
827 itself it is possible (but unlikely) that the information does not
828 relate to the actual perl binary which is being used to access it.
830 The Config module is installed into the architecture and version
831 specific library directory ($Config{installarchlib}) and it checks the
832 perl version number when loaded.
834 The values stored in config.sh may be either single-quoted or
835 double-quoted. Double-quoted strings are handy for those cases where you
836 need to include escape sequences in the strings. To avoid runtime variable
837 interpolation, any C<$> and C<@> characters are replaced by C<\$> and
838 C<\@>, respectively. This isn't foolproof, of course, so don't embed C<\$>
839 or C<\@> in double-quoted strings unless you're willing to deal with the
840 consequences. (The slashes will end up escaped and the C<$> or C<@> will
841 trigger variable interpolation)
845 Most C<Config> variables are determined by the C<Configure> script
846 on platforms supported by it (which is most UNIX platforms). Some
847 platforms have custom-made C<Config> variables, and may thus not have
848 some of the variables described below, or may have extraneous variables
849 specific to that particular port. See the port specific documentation
856 if ($Opts{glossary}) {
857 open(GLOS, "<$Glossary") or die "Can't open $Glossary: $!";
864 if (s/\A(\w*)\s+\(([\w.]+)\):\s*\n(\t?)/=item C<$1>\n\nFrom F<$2>:\n\n/m) {
865 my $c = substr $1, 0, 1;
866 unless ($seen{$c}++) {
867 print CONFIG_POD <<EOF if $text;
873 print CONFIG_POD <<EOF;
884 elsif (!$text || !/\A\t/) {
885 warn "Expected a Configure variable header",
886 ($text ? " or another paragraph of description" : () );
888 s/n't/n\00t/g; # leave can't, won't etc untouched
889 s/^\t\s+(.*)/\n$1/gm; # Indented lines ===> new paragraph
890 s/^(?<!\n\n)\t(.*)/$1/gm; # Not indented lines ===> text
891 s{([\'\"])(?=[^\'\"\s]*[./][^\'\"\s]*\1)([^\'\"\s]+)\1}(F<$2>)g; # '.o'
892 s{([\'\"])([^\'\"\s]+)\1}(C<$2>)g; # "date" command
893 s{\'([A-Za-z_\- *=/]+)\'}(C<$1>)g; # 'ln -s'
895 (?<! [\w./<\'\"] ) # Only standalone file names
896 (?! e \. g \. ) # Not e.g.
897 (?! \. \. \. ) # Not ...
899 (?! read/ ) # Not read/write
900 (?! etc\. ) # Not etc.
903 \$ ? # Allow leading $
904 [\w./]* [./] [\w./]* # Require . or / inside
906 (?<! \. (?= [\s)] ) ) # Do not include trailing dot
907 (?! [\w/] ) # Include all of it
909 (F<$1>)xg; # /usr/local
910 s/((?<=\s)~\w*)/F<$1>/g; # ~name
911 s/(?<![.<\'\"])\b([A-Z_]{2,})\b(?![\'\"])/C<$1>/g; # UNISTD
912 s/(?<![.<\'\"])\b(?!the\b)(\w+)\s+macro\b/C<$1> macro/g; # FILE_cnt macro
913 s/n[\0]t/n't/g; # undo can't, won't damage
916 if ($Opts{glossary}) {
917 <GLOS>; # Skip the "DO NOT EDIT"
918 <GLOS>; # Skip the preamble
925 print CONFIG_POD <<'ENDOFTAIL';
931 This module contains a good example of how to use tie to implement a
932 cache and an example of how to make a tied variable readonly to those
939 close(GLOS) if $Opts{glossary};
941 print "written $Config_POD\n";
943 my $orig_config_txt = "";
944 my $orig_heavy_txt = "";
948 $orig_config_txt = <$fh> if open $fh, "<", $Config_PM;
949 $orig_heavy_txt = <$fh> if open $fh, "<", $Config_heavy;
952 if ($orig_config_txt ne $config_txt or $orig_heavy_txt ne $heavy_txt) {
953 open CONFIG, ">", $Config_PM or die "Can't open $Config_PM: $!\n";
954 open CONFIG_HEAVY, ">", $Config_heavy or die "Can't open $Config_heavy: $!\n";
955 print CONFIG $config_txt;
956 print CONFIG_HEAVY $heavy_txt;
959 print "updated $Config_PM\n";
960 print "updated $Config_heavy\n";
964 # Now create Cross.pm if needed
966 open CROSS, ">lib/Cross.pm" or die "Can not open >lib/Cross.pm: $!";
968 # typical invocation:
969 # perl -MCross Makefile.PL
970 # perl -MCross=wince -V:cc
974 my ($package,$platform) = @_;
975 unless (defined $platform) {
976 # if $platform is not specified, then use last one when
977 # 'configpm; was invoked with --cross option
978 $platform = '***replace-marker***';
980 @INC = map {/\blib\b/?(do{local $_=$_;s/\blib\b/xlib\/$platform/;$_},$_):($_)} @INC;
981 $::Cross::platform = $platform;
986 $cross =~ s/\*\*\*replace-marker\*\*\*/$Opts{cross}/g;
989 print "written lib/Cross.pm\n";
990 unshift(@INC,"xlib/$Opts{cross}");
993 # Now do some simple tests on the Config.pm file we have created
995 unshift(@INC,'xlib/symbian') if $Opts{cross};
997 require $Config_heavy;
1000 die "$0: $Config_PM not valid"
1001 unless $Config{'PERL_CONFIG_SH'} eq 'true';
1003 die "$0: error processing $Config_PM"
1004 if defined($Config{'an impossible name'})
1005 or $Config{'PERL_CONFIG_SH'} ne 'true' # test cache
1008 die "$0: error processing $Config_PM"
1009 if eval '$Config{"cc"} = 1'
1010 or eval 'delete $Config{"cc"}'
1015 # Popularity of various entries in %Config, based on a large build and test
1016 # run of code in the Fotango build system:
1034 inc_version_list: 783
1037 usevendorprefix: 642
1058 installsiteman1dir: 489
1059 installsiteman3dir: 489
1060 installvendorman1dir: 489
1061 installvendorman3dir: 489
1065 installsitearch: 344
1070 installprefixexp: 336
1073 installvendorarch: 336
1074 installvendorbin: 336
1075 installvendorlib: 336