1N/A# commonly used names to put first (and hence lookup fastest) 1N/A# names of things which may need to have slashes changed to double-colons 1N/A# allowed opts as well as specifies default and initial values 1N/A 'cross' => '', # --cross=PALTFORM - crosscompiling for PLATFORM 1N/A 'glossary' => 1, # --no-glossary - no glossary file inclusion, 1N/A # user specified options 1N/A # --opt --no-opt --noopt 1N/A # creating cross-platform config file 1N/A# This file was created by configpm when Perl was built. Any changes 1N/A# made to this file will be lost the next time perl is built. 1N/A# Define our own import method to avoid pulling in the full Exporter: 1N/Adie "Perl lib version (%s) doesn't match executable version ($])" 1N/A or die "Perl lib version (%s) doesn't match executable version (" .
1N/A# This is somewhat grim, but I want the code for parsing config.sh here and 1N/A# now so that I can expand $Config{ivsize} and $Config{ivtype} 1N/A# Search for it in the big string 1N/A # Check for the common case, ' delimited 1N/A # If that failed, check for " delimited 1N/A # It's the very first thing we found. Skip $start forward 1N/A # and figure out the quote mark after the =. 1N/A # If we had a double-quote, we'd better eval it so escape 1N/A # sequences and such can be interpolated. Since the incoming 1N/A # value is supposed to follow shell rules and not perl rules, 1N/A # we escape any perl variable markers 1N/A # So we can say "if $Config{'foo'}". 1N/A # Catch PERL_CONFIG_SH=true and PERL_VERSION=n line from Configure. 1N/A s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/ or m/^(\w+)='(.*)'$/; 1N/A my($k, $v) = ($1, $2); 1N/A # grandfather PATCHLEVEL and SUBVERSION and CONFIG 1N/A if ($k eq 'PERL_VERSION') { 1N/A elsif ($k eq 'PERL_SUBVERSION') { 1N/A elsif ($k eq 'PERL_CONFIG_SH') { 1N/A push(@non_v, "#$_"); # not a name='value' line 1N/A ($name,$val) = ($1,$3); 1N/A $in_v = $val !~ /$quote\n/; 1N/A s,/,::,g if $Extensions{$name}; 1N/A $val =~ s/$quote\n?\z//; 1N/A my $line = "$name=$quote$val$quote\n"; 1N/A if (!$Common{$name}){ 1N/A push(@v_others, $line); 1N/A push(@v_fast, $line); 1N/A $v_fast{$name} = "'$name' => $quote$val$quote"; 1N/Aprint CONFIG @non_v, "\n"; 1N/Aprint CONFIG "our \$summary : unique = <<'!END!';\n"; 1N/A1 while defined($_ = <MYCONFIG>) && !/^Summary of/; 1N/Ado { print CONFIG $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/; 1N/A# NB. as $summary is unique, we need to copy it in a lexical variable 1N/A# before expanding it, because may have been made readonly if a perl 1N/A# interpreter has been cloned. 1N/Aprint CONFIG "\n!END!\n", <<'EOT'; 1N/Amy $summary_expanded; 1N/A return $summary_expanded if $summary_expanded; 1N/A ($summary_expanded = $summary) =~ s{\$(\w+)} 1N/A { my $c = $Config{$1}; defined($c) ? $c : 'undef' }ge; 1N/Aour $Config_SH : unique = <<'!END!'; 1N/Aprint CONFIG join("", @v_fast, sort @v_others); 1N/Aprint CONFIG "!END!\n", $fetch_string; 1N/A my($self, $key) = @_; 1N/A if ($key =~ /^((?:cc|ld)flags|libs(?:wanted)?)_nolargefiles/) { 1N/A # These are purely virtual, they do not exist, but need to 1N/A # be computed on demand for largefile-incapable extensions. 1N/A my $new_key = "${1}_uselargefiles"; 1N/A $value = $Config{$1}; 1N/A my $withlargefiles = $Config{$new_key}; 1N/A if ($new_key =~ /^(?:cc|ld)flags_/) { 1N/A $value =~ s/\Q$withlargefiles\E\b//; 1N/A } elsif ($new_key =~ /^libs/) { 1N/A my @lflibswanted = split(' ', $Config{libswanted_uselargefiles}); 1N/A if (@lflibswanted) { 1N/A @lflibswanted{@lflibswanted} = (); 1N/A if ($new_key =~ /^libs_/) { 1N/A my @libs = grep { /^-l(.+)/ && 1N/A not exists $lflibswanted{$1} } 1N/A split(' ', $Config{libs}); 1N/A $Config{libs} = join(' ', @libs); 1N/A } elsif ($new_key =~ /^libswanted_/) { 1N/A my @libswanted = grep { not exists $lflibswanted{$_} } 1N/A split(' ', $Config{libswanted}); 1N/A $Config{libswanted} = join(' ', @libswanted); 1N/A $self->{$key} = $value; 1N/A my($self, $key) = @_; 1N/A # check for cached value (which may be undef so we use exists not defined) 1N/A return $self->{$key} if exists $self->{$key}; 1N/A $self->fetch_string($key); 1N/A return $self->{$key} if exists $self->{$key}; 1N/A $self->fetch_virtual($key); 1N/A # Might not exist, in which undef is correct. 1N/A return $self->{$key}; 1N/A substr($Config_SH, 0, index($Config_SH, '=') ); 1N/A # Extract the name of the DLL from the makefile to avoid duplication 1N/A\$preconfig{dll_name} = '$dll'; 1N/A# Calculation for the keys for byteorder 1N/A# This is somewhat grim, but I need to run fetch_string here. 1N/A# byteorder does exist on its own but we overlay a virtual 1N/A# dynamically recomputed value. 1N/A# However, ivtype and ivsize will not vary for sane fat binaries 1N/Amy $f = $t eq 'long' ? 'L!' : $s == 8 ? 'Q': 'I'; 1N/Aif ($s == 4 || $s == 8) { 1N/A print "built by gcc\n"; 1N/Anames match the $regex. 1N/A=item config_vars(@names) 1N/APrints to STDOUT the values of the named configuration variable. Each is 1N/Aprinted on a separate line in the form: 1N/ANames which are unknown are output as C<name='UNKNOWN';>. 1N/Aconsequences. (The slashes will end up escaped and the C<$> or C<@> will 1N/Atrigger variable interpolation) 1N/AMost C<Config> variables are determined by the C<Configure> script 1N/Aon platforms supported by it (which is most UNIX platforms). Some 1N/Aplatforms have custom-made C<Config> variables, and may thus not have 1N/Asome of the variables described below, or may have extraneous variables 1N/Aspecific to that particular port. See the port specific documentation 1N/Aif ($Opts{glossary}) { 1N/A if (s/\A(\w*)\s+\(([\w.]+)\):\s*\n(\t?)/=item C<$1>\n\nFrom F<$2>:\n\n/m) { 1N/A my $c = substr $1, 0, 1; 1N/A print CONFIG_POD <<EOF; 1N/A s/n't/n\00t/g; # leave can't, won't etc untouched 1N/A s/^\t\s+(.*)/\n$1/gm; # Indented lines ===> new paragraph 1N/A s/^(?<!\n\n)\t(.*)/$1/gm; # Not indented lines ===> text 1N/A s{([\'\"])(?=[^\'\"\s]*[./][^\'\"\s]*\1)([^\'\"\s]+)\1}(F<$2>)g; # '.o' 1N/A s{([\'\"])([^\'\"\s]+)\1}(C<$2>)g; # "date" command 1N/A s{\'([A-Za-z_\- *=/]+)\'}(C<$1>)g; # 'ln -s' 1N/A (?<! [\w./<\'\"] ) # Only standalone file names 1N/A (?! \. \. \. ) # Not ... 1N/A (?! \d ) # Not 5.004 1N/A (?! etc\. ) # Not etc. 1N/A \$ ? # Allow leading $ 1N/A [\w./]* [./] [\w./]* # Require . or / inside 1N/A (?<! \. (?= [\s)] ) ) # Do not include trailing dot 1N/A (?! [\w/] ) # Include all of it 1N/A s/((?<=\s)~\w*)/F<$1>/g; # ~name 1N/A s/(?<![.<\'\"])\b([A-Z_]{2,})\b(?![\'\"])/C<$1>/g; # UNISTD 1N/A s/(?<![.<\'\"])\b(?!the\b)(\w+)\s+macro\b/C<$1> macro/g; # FILE_cnt macro 1N/A s/n[\0]t/n't/g; # undo can't, won't damage 1N/A <GLOS>; # Skip the preamble 1N/Aprint CONFIG_POD <<'ENDOFTAIL'; 1N/AThis module contains a good example of how to use tie to implement a 1N/Acache and an example of how to make a tied variable readonly to those 1N/A# typical invocation: 1N/A# perl -MCross=wince -V:cc 1N/A # 'configpm; was invoked with --cross option 1N/A# Now do some simple tests on the Config.pm file we have created 1N/A or $Config{'PERL_CONFIG_SH'} ne 'true' # test cache