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
37 --chdir=dir change directory before writing files
41 use vars qw(%Config $Config_SH_expanded);
43 my $how_many_common = 22;
45 # commonly used names to precache (and hence lookup fastest)
48 while ($how_many_common--) {
51 /^(\S+):\s*(\d+)$/ or die "Malformed line '$_'";
55 # Post 37589e1eefb1bd62 DynaLoader defaults to reading these at runtime.
56 # Ideally we're redo the data below, but Fotango's build system made it
57 # wonderfully easy to instrument, and no longer exists.
58 $Common{$_} = $_ foreach qw(dlext so);
60 # names of things which may need to have slashes changed to double-colons
61 my %Extensions = map {($_,$_)}
62 qw(dynamic_ext static_ext extensions known_extensions);
64 # allowed opts as well as specifies default and initial values
66 'cross' => '', # --cross=PLATFORM - crosscompiling for PLATFORM
67 'glossary' => 1, # --no-glossary - no glossary file inclusion,
69 'chdir' => '', # --chdir=dir - change directory before writing files
73 # user specified options
76 (map {/^--([\-_\w]+)=(.*)$/} @ARGV),
77 # --opt --no-opt --noopt
78 (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV),
81 my %opts = (%Allowed_Opts, %given_opts);
83 for my $opt (grep {!exists $Allowed_Opts{$_}} keys %given_opts) {
84 warn "option '$opt' is not recognized";
87 @ARGV = grep {!/^--/} @ARGV;
96 chdir $Opts{chdir} or die "$0: could not chdir $Opts{chdir}: $!"
99 my ($Config_SH, $Config_PM, $Config_heavy, $Config_POD);
100 my $Glossary = 'Porting/Glossary';
103 # creating cross-platform config file
105 mkdir "xlib/$Opts{cross}";
106 $Config_PM = "xlib/$Opts{cross}/Config.pm";
107 $Config_POD = "xlib/$Opts{cross}/Config.pod";
108 $Config_SH = "Cross/config-$Opts{cross}.sh";
111 $Config_PM = "lib/Config.pm";
112 $Config_POD = "lib/Config.pod";
113 $Config_SH = "config.sh";
115 ($Config_heavy = $Config_PM) =~ s/\.pm$/_heavy.pl/;
116 die "Can't automatically determine name for Config_heavy.pl from '$Config_PM'"
117 if $Config_heavy eq $Config_PM;
122 $heavy_txt .= <<'ENDOFBEG';
123 # This file was created by configpm when Perl was built. Any changes
124 # made to this file will be lost the next time perl is built.
128 # use warnings; Pulls in Carp
129 # use vars pulls in Carp
132 my ($bincompat, $non_bincompat, $date, @patches) = Internals::V();
134 my $opts = join ' ', sort split ' ', "$bincompat $non_bincompat";
136 # wrap at 76 columns.
138 $opts =~ s/(?=.{53})(.{1,53}) /$1\n /mg;
140 print Config::myconfig();
142 print "\nCharacteristics of this PERLSHR image: \n";
144 print "\nCharacteristics of this binary (from libperl): \n";
147 print " Compile-time options: $opts\n";
150 print " Locally applied patches:\n";
151 print "\t$_\n" foreach @patches;
154 print " Built under $^O\n";
156 print " $date\n" if defined $date;
158 my @env = map { "$_=\"$ENV{$_}\"" } sort grep {/^PERL/} keys %ENV;
159 push @env, "CYGWIN=\"$ENV{CYGWIN}\"" if $^O eq 'cygwin';
163 print " $_\n" foreach @env;
166 print " $_\n" foreach @INC;
171 my $myver = sprintf "%vd", $^V;
173 $config_txt .= sprintf <<'ENDOFBEG', ($myver) x 3;
174 # This file was created by configpm when Perl was built. Any changes
175 # made to this file will be lost the next time perl is built.
177 # for a description of the variables, please have a look at the
178 # Glossary file, as written in the Porting folder, or use the url:
179 # http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary
183 # use warnings; Pulls in Carp
184 # use vars pulls in Carp
185 @Config::EXPORT = qw(%%Config);
186 @Config::EXPORT_OK = qw(myconfig config_sh config_vars config_re);
188 # Need to stub all the functions to make code such as print Config::config_sh
196 # Skip @Config::EXPORT because it only contains %%Config, which we special
197 # case below as it's not a function. @Config::EXPORT won't change in the
198 # lifetime of Perl 5.
199 my %%Export_Cache = map {($_ => 1)} @Config::EXPORT_OK;
203 # Define our own import method to avoid pulling in the full Exporter:
206 @_ = @Config::EXPORT unless @_;
208 my @funcs = grep $_ ne '%%Config', @_;
209 my $export_Config = @funcs < @_ ? 1 : 0;
212 my $callpkg = caller(0);
213 foreach my $func (@funcs) {
214 die qq{"$func" is not exported by the Config module\n}
215 unless $Export_Cache{$func};
216 *{$callpkg.'::'.$func} = \&{$func};
219 *{"$callpkg\::Config"} = \%%Config if $export_Config;
223 die "Perl lib version (%s) doesn't match executable '$0' version ($])"
227 or die "Perl lib version (%s) doesn't match executable '$0' version (" .
228 sprintf("v%%vd",$^V) . ")";
242 open(CONFIG_SH, $Config_SH) || die "Can't open $Config_SH: $!";
243 while (<CONFIG_SH>) {
244 next if m:^#!/bin/sh:;
246 # Catch PERL_CONFIG_SH=true and PERL_VERSION=n line from Configure.
247 s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/ or m/^(\w+)='(.*)'$/;
248 my($k, $v) = ($1, $2);
250 # grandfather PATCHLEVEL and SUBVERSION and CONFIG
252 if ($k eq 'PERL_VERSION') {
253 push @v_others, "PATCHLEVEL='$v'\n";
255 elsif ($k eq 'PERL_SUBVERSION') {
256 push @v_others, "SUBVERSION='$v'\n";
258 elsif ($k eq 'PERL_CONFIG_SH') {
259 push @v_others, "CONFIG='$v'\n";
263 # We can delimit things in config.sh with either ' or ".
264 unless ($in_v or m/^(\w+)=(['"])(.*\n)/){
265 push(@non_v, "#$_"); # not a name='value' line
273 ($name,$val) = ($1,$3);
275 $in_v = $val !~ /$quote\n/;
278 s,/,::,g if $Extensions{$name};
280 $val =~ s/$quote\n?\z//;
282 my $line = "$name=$quote$val$quote\n";
283 push(@v_others, $line);
284 $seen_quotes{$quote}++;
289 # This is somewhat grim, but I want the code for parsing config.sh here and
290 # now so that I can expand $Config{ivsize} and $Config{ivtype}
292 my $fetch_string = <<'EOT';
294 # Search for it in the big string
296 my($self, $key) = @_;
300 if ($seen_quotes{'"'}) {
301 # We need the full ' and " code
303 $fetch_string .= <<'EOT';
304 return undef unless my ($quote_type, $value) = $Config_SH_expanded =~ /\n$key=(['"])(.*?)\1\n/s;
306 # If we had a double-quote, we'd better eval it so escape
307 # sequences and such can be interpolated. Since the incoming
308 # value is supposed to follow shell rules and not perl rules,
309 # we escape any perl variable markers
311 # Historically, since " 'support' was added in change 1409, the
312 # interpolation was done before the undef. Stick to this arguably buggy
313 # behaviour as we're refactoring.
314 if ($quote_type eq '"') {
315 $value =~ s/\$/\\\$/g;
316 $value =~ s/\@/\\\@/g;
317 eval "\$value = \"$value\"";
320 # So we can say "if $Config{'foo'}".
321 $self->{$key} = $value eq 'undef' ? undef : $value; # cache it
326 # We only have ' delimted.
328 $fetch_string .= <<'EOT';
329 return undef unless $Config_SH_expanded =~ /\n$key=\'(.*?)\'\n/s;
330 # So we can say "if $Config{'foo'}".
331 $self->{$key} = $1 eq 'undef' ? undef : $1;
340 # Calculation for the keys for byteorder
341 # This is somewhat grim, but I need to run fetch_string here.
342 our $Config_SH_expanded = join "\n", '', @v_others;
344 my $t = fetch_string ({}, 'ivtype');
345 my $s = fetch_string ({}, 'ivsize');
347 # byteorder does exist on its own but we overlay a virtual
348 # dynamically recomputed value.
350 # However, ivtype and ivsize will not vary for sane fat binaries
352 my $f = $t eq 'long' ? 'L!' : $s == 8 ? 'Q': 'I';
355 if ($s == 4 || $s == 8) {
356 my $list = join ',', reverse(2..$s);
358 $byteorder_code = <<"EOT";
361 foreach my \$c ($list) { \$i |= ord(\$c); \$i <<= 8 }
363 our \$byteorder = join('', unpack('$format', pack('$f', \$i)));
366 $byteorder_code = "our \$byteorder = '?'x$s;\n";
371 if (fetch_string({},'userelocatableinc')) {
372 foreach my $what (qw(prefixexp
421 installvendorhtml1dir
422 installvendorhtml3dir
428 push @need_relocation, $what if fetch_string({}, $what) =~ m!^\.\.\./!;
433 @need_relocation{@need_relocation} = @need_relocation;
435 # This can have .../ anywhere:
436 if (fetch_string({}, 'otherlibdirs') =~ m!\.\.\./!) {
437 $need_relocation{otherlibdirs} = 'otherlibdirs';
440 my $relocation_code = <<'EOT';
444 return $libdir unless $libdir =~ s!^\.\.\./!!;
446 if ($prefix =~ s!/[^/]*$!!) {
447 while ($libdir =~ m!^\.\./!) {
448 # Loop while $libdir starts "../" and $prefix still has a trailing
450 last unless $prefix =~ s!/([^/]+)$!!;
451 # but bail out if the directory we picked off the end of $prefix is .
453 if ($1 eq '.' or $1 eq '..') {
454 # Undo! This should be rare, hence code it this way rather than a
455 # check each time before the s!!! above.
456 $prefix = "$prefix/$1";
459 # Remove that leading ../ and loop again
460 substr ($libdir, 0, 3, '');
462 $libdir = "$prefix/$libdir";
468 if (%need_relocation) {
469 my $relocations_in_common;
470 # otherlibdirs only features in the hash
471 foreach (keys %need_relocation) {
472 $relocations_in_common++ if $Common{$_};
474 if ($relocations_in_common) {
475 $config_txt .= $relocation_code;
477 $heavy_txt .= $relocation_code;
481 $heavy_txt .= join('', @non_v) . "\n";
483 # copy config summary format from the myconfig.SH script
484 $heavy_txt .= "our \$summary = <<'!END!';\n";
485 open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
486 1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
487 do { $heavy_txt .= $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
490 $heavy_txt .= "\n!END!\n" . <<'EOT';
491 my $summary_expanded;
494 return $summary_expanded if $summary_expanded;
495 ($summary_expanded = $summary) =~ s{\$(\w+)}
498 if ($1 eq 'git_ancestor_line') {
499 if ($Config::Config{git_ancestor}) {
500 $c= "\n Ancestor: $Config::Config{git_ancestor}";
505 $c = $Config::Config{$1};
507 defined($c) ? $c : 'undef'
516 $heavy_txt .= join('', sort @v_others) . "!END!\n";
518 # Only need the dynamic byteorder code in Config.pm if 'byteorder' is one of
520 if ($Common{byteorder}) {
521 $config_txt .= $byteorder_code;
523 $heavy_txt .= $byteorder_code;
526 if (@need_relocation) {
527 $heavy_txt .= 'foreach my $what (qw(' . join (' ', @need_relocation) .
529 s/^($what=)(['"])(.*?)\2/$1 . $2 . relocate_inc($3) . $2/me;
532 # Currently it only makes sense to do the ... relocation on Unix, so there's
533 # no need to emulate the "which separator for this platform" logic in perl.c -
534 # ':' will always be applicable
535 if ($need_relocation{otherlibdirs}) {
536 $heavy_txt .= << 'EOT';
537 s{^(otherlibdirs=)(['"])(.*?)\2}
538 {$1 . $2 . join ':', map {relocate_inc($_)} split ':', $3 . $2}me;
543 $heavy_txt .= <<'EOT';
544 s/(byteorder=)(['"]).*?\2/$1$2$Config::byteorder$2/m;
546 my $config_sh_len = length $_;
548 our $Config_SH_expanded = "\n$_" . << 'EOVIRTUAL';
551 foreach my $prefix (qw(ccflags ldflags)) {
552 my $value = fetch_string ({}, $prefix);
553 my $withlargefiles = fetch_string ({}, $prefix . "_uselargefiles");
554 if (defined $withlargefiles) {
555 $value =~ s/\Q$withlargefiles\E\b//;
556 $heavy_txt .= "${prefix}_nolargefiles='$value'\n";
560 foreach my $prefix (qw(libs libswanted)) {
561 my $value = fetch_string ({}, $prefix);
562 my $withlf = fetch_string ({}, 'libswanted_uselargefiles');
563 next unless defined $withlf;
565 = split(' ', fetch_string ({}, 'libswanted_uselargefiles'));
568 @lflibswanted{@lflibswanted} = ();
569 if ($prefix eq 'libs') {
570 my @libs = grep { /^-l(.+)/ &&
571 not exists $lflibswanted{$1} }
572 split(' ', fetch_string ({}, 'libs'));
573 $value = join(' ', @libs);
575 my @libswanted = grep { not exists $lflibswanted{$_} }
576 split(' ', fetch_string ({}, 'libswanted'));
577 $value = join(' ', @libswanted);
580 $heavy_txt .= "${prefix}_nolargefiles='$value'\n";
583 $heavy_txt .= "EOVIRTUAL\n";
585 $heavy_txt .= <<'ENDOFGIT';
587 # do not have hairy conniptions if this isnt available
588 require 'Config_git.pl';
589 $Config_SH_expanded .= $Config::Git_Data;
591 } or warn "Warning: failed to load Config_git.pl, something strange about this perl...\n";
594 $heavy_txt .= $fetch_string;
596 $config_txt .= <<'ENDOFEND';
599 my($self, $key) = @_;
601 # check for cached value (which may be undef so we use exists not defined)
602 return $self->{$key} if exists $self->{$key};
604 return $self->fetch_string($key);
608 $heavy_txt .= <<'ENDOFEND';
614 substr($Config_SH_expanded, 1, index($Config_SH_expanded, '=') - 1 );
619 if ($seen_quotes{'"'}) {
620 $heavy_txt .= <<'ENDOFEND';
621 # Find out how the current key's quoted so we can skip to its end.
622 my $quote = substr($Config_SH_expanded,
623 index($Config_SH_expanded, "=", $prevpos)+1, 1);
624 my $pos = index($Config_SH_expanded, qq($quote\n), $prevpos) + 2;
627 # Just ' quotes, so it's much easier.
628 $heavy_txt .= <<'ENDOFEND';
629 my $pos = index($Config_SH_expanded, qq('\n), $prevpos) + 2;
632 $heavy_txt .= <<'ENDOFEND';
633 my $len = index($Config_SH_expanded, "=", $pos) - $pos;
635 $len > 0 ? substr($Config_SH_expanded, $pos, $len) : undef;
639 return 1 if exists($_[0]->{$_[1]});
641 return(index($Config_SH_expanded, "\n$_[1]='") != -1
643 if ($seen_quotes{'"'}) {
644 $heavy_txt .= <<'ENDOFEND';
645 or index($Config_SH_expanded, "\n$_[1]=\"") != -1
648 $heavy_txt .= <<'ENDOFEND';
652 sub STORE { die "\%Config::Config is read-only\n" }
658 substr $Config_SH_expanded, 1, $config_sh_len;
663 return map { chomp; $_ } grep eval{ /^(?:$re)=/ }, split /^/,
668 # implements -V:cfgvar option (see perlrun -V:)
670 # find optional leading, trailing colons; and query-spec
671 my ($notag,$qry,$lncont) = m/^(:)?(.*?)(:)?$/; # flags fore and aft,
672 # map colon-flags to print decorations
673 my $prfx = $notag ? '': "$qry="; # tag-prefix for print
674 my $lnend = $lncont ? ' ' : ";\n"; # line ending for print
676 # all config-vars are by definition \w only, any \W means regex
678 my @matches = config_re($qry);
679 print map "$_$lnend", @matches ? @matches : "$qry: not found" if !$notag;
680 print map { s/\w+=//; "$_$lnend" } @matches ? @matches : "$qry: not found" if $notag;
682 my $v = (exists $Config::Config{$qry}) ? $Config::Config{$qry}
684 $v = 'undef' unless defined $v;
685 print "${prfx}'${v}'$lnend";
690 # Called by the real AUTOLOAD
693 goto \&$Config::AUTOLOAD;
700 $config_txt .= <<'ENDOFSET';
703 my ($value, $v) = $Config_SH_expanded =~ m/^used_aout='(.*)'\s*$/m;
704 for (split ' ', $value) {
705 ($v) = $Config_SH_expanded =~ m/^aout_$_='(.*)'\s*$/m;
706 $preconfig{$_} = $v eq 'undef' ? undef : $v;
709 $preconfig{d_fork} = undef unless $OS2::can_fork; # Some funny cases can't
710 sub TIEHASH { bless {%preconfig} }
712 # Extract the name of the DLL from the makefile to avoid duplication
713 my ($f) = grep -r, qw(GNUMakefile Makefile);
715 if (open my $fh, '<', $f) {
717 $dll = $1, last if /^PERL_DLL_BASE\s*=\s*(\S*)\s*$/;
720 $config_txt .= <<ENDOFSET if $dll;
721 \$preconfig{dll_name} = '$dll';
724 $config_txt .= <<'ENDOFSET';
731 foreach my $key (keys %Common) {
732 my $value = fetch_string ({}, $key);
733 # Is it safe on the LHS of => ?
734 my $qkey = $key =~ /^[A-Za-z_][A-Za-z0-9_]*$/ ? $key : "'$key'";
735 if (defined $value) {
736 # Quote things for a '' string
737 $value =~ s!\\!\\\\!g;
740 if ($key eq 'otherlibdirs') {
741 $value = "join (':', map {relocate_inc(\$_)} split (':', $value))";
742 } elsif ($need_relocation{$key}) {
743 $value = "relocate_inc($value)";
748 $Common{$key} = "$qkey => $value";
751 if ($Common{byteorder}) {
752 $Common{byteorder} = 'byteorder => $byteorder';
754 my $fast_config = join '', map { " $_,\n" } sort values %Common;
756 # Sanity check needed to stop an infite loop if Config_heavy.pl fails to define
757 # &launcher for some reason (eg it got truncated)
758 $config_txt .= sprintf <<'ENDOFTIE', $fast_config;
763 require 'Config_heavy.pl';
764 goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/;
765 die "&Config::AUTOLOAD failed on $Config::AUTOLOAD";
768 # tie returns the object, so the value returned to require will be true.
769 tie %%Config, 'Config', {
774 open(CONFIG_POD, ">$Config_POD") or die "Can't open $Config_POD: $!";
775 print CONFIG_POD <<'ENDOFTAIL';
778 Config - access Perl configuration information
783 if ($Config{usethreads}) {
784 print "has thread support\n"
787 use Config qw(myconfig config_sh config_vars config_re);
795 config_vars(qw(osname archname));
800 The Config module contains all the information that was available to
801 the C<Configure> program at Perl build time (over 900 values).
803 Shell variables from the F<config.sh> file (written by Configure) are
804 stored in the readonly-variable C<%Config>, indexed by their names.
806 Values stored in config.sh as 'undef' are returned as undefined
807 values. The perl C<exists> function can be used to check if a
808 named variable exists.
810 For a description of the variables, please have a look at the
811 Glossary file, as written in the Porting folder, or use the url:
812 http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary
818 Returns a textual summary of the major perl configuration values.
819 See also C<-V> in L<perlrun/Switches>.
823 Returns the entire perl configuration information in the form of the
824 original config.sh shell variable assignment script.
826 =item config_re($regex)
828 Like config_sh() but returns, as a list, only the config entries who's
829 names match the $regex.
831 =item config_vars(@names)
833 Prints to STDOUT the values of the named configuration variable. Each is
834 printed on a separate line in the form:
838 Names which are unknown are output as C<name='UNKNOWN';>.
839 See also C<-V:name> in L<perlrun/Switches>.
845 Here's a more sophisticated example of using %Config:
852 unless($Config{sig_name} && $Config{sig_num}) {
855 my @names = split ' ', $Config{sig_name};
856 @sig_num{@names} = split ' ', $Config{sig_num};
858 $sig_name[$sig_num{$_}] ||= $_;
862 print "signal #17 = $sig_name[17]\n";
863 if ($sig_num{ALRM}) {
864 print "SIGALRM is $sig_num{ALRM}\n";
869 Because this information is not stored within the perl executable
870 itself it is possible (but unlikely) that the information does not
871 relate to the actual perl binary which is being used to access it.
873 The Config module is installed into the architecture and version
874 specific library directory ($Config{installarchlib}) and it checks the
875 perl version number when loaded.
877 The values stored in config.sh may be either single-quoted or
878 double-quoted. Double-quoted strings are handy for those cases where you
879 need to include escape sequences in the strings. To avoid runtime variable
880 interpolation, any C<$> and C<@> characters are replaced by C<\$> and
881 C<\@>, respectively. This isn't foolproof, of course, so don't embed C<\$>
882 or C<\@> in double-quoted strings unless you're willing to deal with the
883 consequences. (The slashes will end up escaped and the C<$> or C<@> will
884 trigger variable interpolation)
888 Most C<Config> variables are determined by the C<Configure> script
889 on platforms supported by it (which is most UNIX platforms). Some
890 platforms have custom-made C<Config> variables, and may thus not have
891 some of the variables described below, or may have extraneous variables
892 specific to that particular port. See the port specific documentation
899 if ($Opts{glossary}) {
900 open(GLOS, "<$Glossary") or die "Can't open $Glossary: $!";
907 if (s/\A(\w*)\s+\(([\w.]+)\):\s*\n(\t?)/=item C<$1>\n\nFrom F<$2>:\n\n/m) {
908 my $c = substr $1, 0, 1;
909 unless ($seen{$c}++) {
910 print CONFIG_POD <<EOF if $text;
916 print CONFIG_POD <<EOF;
927 elsif (!$text || !/\A\t/) {
928 warn "Expected a Configure variable header",
929 ($text ? " or another paragraph of description" : () );
931 s/n't/n\00t/g; # leave can't, won't etc untouched
932 s/^\t\s+(.*)/\n$1/gm; # Indented lines ===> new paragraph
933 s/^(?<!\n\n)\t(.*)/$1/gm; # Not indented lines ===> text
934 s{([\'\"])(?=[^\'\"\s]*[./][^\'\"\s]*\1)([^\'\"\s]+)\1}(F<$2>)g; # '.o'
935 s{([\'\"])([^\'\"\s]+)\1}(C<$2>)g; # "date" command
936 s{\'([A-Za-z_\- *=/]+)\'}(C<$1>)g; # 'ln -s'
938 (?<! [\w./<\'\"] ) # Only standalone file names
939 (?! e \. g \. ) # Not e.g.
940 (?! \. \. \. ) # Not ...
942 (?! read/ ) # Not read/write
943 (?! etc\. ) # Not etc.
946 \$ ? # Allow leading $
947 [\w./]* [./] [\w./]* # Require . or / inside
949 (?<! \. (?= [\s)] ) ) # Do not include trailing dot
950 (?! [\w/] ) # Include all of it
952 (F<$1>)xg; # /usr/local
953 s/((?<=\s)~\w*)/F<$1>/g; # ~name
954 s/(?<![.<\'\"])\b([A-Z_]{2,})\b(?![\'\"])/C<$1>/g; # UNISTD
955 s/(?<![.<\'\"])\b(?!the\b)(\w+)\s+macro\b/C<$1> macro/g; # FILE_cnt macro
956 s/n[\0]t/n't/g; # undo can't, won't damage
959 if ($Opts{glossary}) {
960 <GLOS>; # Skip the "DO NOT EDIT"
961 <GLOS>; # Skip the preamble
968 print CONFIG_POD <<'ENDOFTAIL';
974 Information on the git commit from which the current perl binary was compiled
975 can be found in the variable C<$Config::Git_Data>. The variable is a
976 structured string that looks something like this:
978 git_commit_id='ea0c2dbd5f5ac6845ecc7ec6696415bf8e27bd52'
979 git_describe='GitLive-blead-1076-gea0c2db'
980 git_branch='smartmatch'
981 git_uncommitted_changes=''
982 git_commit_id_title='Commit id:'
983 git_commit_date='2009-05-09 17:47:31 +0200'
985 Its format is not guaranteed not to change over time.
989 This module contains a good example of how to use tie to implement a
990 cache and an example of how to make a tied variable readonly to those
997 close(GLOS) if $Opts{glossary};
999 print "written $Config_POD\n";
1001 my $orig_config_txt = "";
1002 my $orig_heavy_txt = "";
1006 $orig_config_txt = <$fh> if open $fh, "<", $Config_PM;
1007 $orig_heavy_txt = <$fh> if open $fh, "<", $Config_heavy;
1010 if ($orig_config_txt ne $config_txt or $orig_heavy_txt ne $heavy_txt) {
1011 open CONFIG, ">", $Config_PM or die "Can't open $Config_PM: $!\n";
1012 open CONFIG_HEAVY, ">", $Config_heavy or die "Can't open $Config_heavy: $!\n";
1013 print CONFIG $config_txt;
1014 print CONFIG_HEAVY $heavy_txt;
1015 close(CONFIG_HEAVY);
1017 print "updated $Config_PM\n";
1018 print "updated $Config_heavy\n";
1022 # Now create Cross.pm if needed
1024 open CROSS, ">lib/Cross.pm" or die "Can not open >lib/Cross.pm: $!";
1025 my $cross = <<'EOS';
1026 # typical invocation:
1027 # perl -MCross Makefile.PL
1028 # perl -MCross=wince -V:cc
1032 my ($package,$platform) = @_;
1033 unless (defined $platform) {
1034 # if $platform is not specified, then use last one when
1035 # 'configpm; was invoked with --cross option
1036 $platform = '***replace-marker***';
1038 @INC = map {/\blib\b/?(do{local $_=$_;s/\blib\b/xlib\/$platform/;$_},$_):($_)} @INC;
1039 $::Cross::platform = $platform;
1044 $cross =~ s/\*\*\*replace-marker\*\*\*/$Opts{cross}/g;
1047 print "written lib/Cross.pm\n";
1048 unshift(@INC,"xlib/$Opts{cross}");
1051 # Now do some simple tests on the Config.pm file we have created
1052 unshift(@INC,'lib');
1053 unshift(@INC,'xlib/symbian') if $Opts{cross};
1055 require $Config_heavy;
1058 die "$0: $Config_PM not valid"
1059 unless $Config{'PERL_CONFIG_SH'} eq 'true';
1061 die "$0: error processing $Config_PM"
1062 if defined($Config{'an impossible name'})
1063 or $Config{'PERL_CONFIG_SH'} ne 'true' # test cache
1066 die "$0: error processing $Config_PM"
1067 if eval '$Config{"cc"} = 1'
1068 or eval 'delete $Config{"cc"}'
1073 # Popularity of various entries in %Config, based on a large build and test
1074 # run of code in the Fotango build system:
1092 inc_version_list: 783
1095 usevendorprefix: 642
1116 installsiteman1dir: 489
1117 installsiteman3dir: 489
1118 installvendorman1dir: 489
1119 installvendorman3dir: 489
1123 installsitearch: 344
1128 installprefixexp: 336
1131 installvendorarch: 336
1132 installvendorbin: 336
1133 installvendorlib: 336