diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-07-22 10:51:48 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-07-22 10:51:48 +0000 |
commit | 8468119f6ee8085392e5c77b735fdba19cf0f08e (patch) | |
tree | 2487c7f85fb6389d2ff81b6c42e535cf3ce227d7 /configpm | |
parent | b8170e599aeb3f6442d8a57b9d8231b9a8251123 (diff) | |
download | perl-8468119f6ee8085392e5c77b735fdba19cf0f08e.tar.gz |
Config::config_re and config_sh would report the byteorder as 'ffff'
p4raw-id: //depot/perl@23147
Diffstat (limited to 'configpm')
-rwxr-xr-x | configpm | 76 |
1 files changed, 40 insertions, 36 deletions
@@ -210,6 +210,34 @@ while (<CONFIG_SH>) { } close CONFIG_SH; +# Calculation for the keys for byteorder +# This is somewhat grim, but I need to run fetch_string here. +our $Config_SH = join "\n", @v_fast, @v_others; + +my $t = fetch_string ({}, 'ivtype'); +my $s = fetch_string ({}, 'ivsize'); + +# byteorder does exist on its own but we overlay a virtual +# dynamically recomputed value. + +# However, ivtype and ivsize will not vary for sane fat binaries + +my $f = $t eq 'long' ? 'L!' : $s == 8 ? 'Q': 'I'; + +my $byteorder_code; +if ($s == 4 || $s == 8) { + my $list = join ',', reverse(2..$s); + my $format = 'a'x$s; + $byteorder_code = <<"EOT"; +my \$i = 0; +foreach my \$c ($list) { \$i |= ord(\$c); \$i <<= 8 } +\$i |= ord(1); +my \$byteorder = join('', unpack('$format', pack('$f', \$i))); +EOT +} else { + $byteorder_code = "my \$byteorder = '?'x$s;\n"; +} + print CONFIG @non_v, "\n"; # copy config summary format from the myconfig.SH script @@ -223,7 +251,7 @@ close(MYCONFIG); # before expanding it, because may have been made readonly if a perl # interpreter has been cloned. -print CONFIG "\n!END!\n", <<'EOT'; +print CONFIG "\n!END!\n", $byteorder_code, <<'EOT'; my $summary_expanded; sub myconfig { @@ -233,12 +261,19 @@ sub myconfig { $summary_expanded; } -our $Config_SH : unique = <<'!END!'; +local *_ = \my $a; +$_ = <<'!END!'; EOT print CONFIG join("", @v_fast, sort @v_others); -print CONFIG "!END!\n", $fetch_string; +print CONFIG <<'EOT'; +!END! +s/(byteorder=)(['"]).*?\2/$1$2$byteorder$2/m; +our $Config_SH : unique = $_; +EOT + +print CONFIG $fetch_string; print CONFIG <<'ENDOFEND'; @@ -384,45 +419,14 @@ sub TIEHASH { ENDOFSET } - -# Calculation for the keys for byteorder -# This is somewhat grim, but I need to run fetch_string here. -our $Config_SH = join "\n", @v_fast, @v_others; - -my $t = fetch_string ({}, 'ivtype'); -my $s = fetch_string ({}, 'ivsize'); - -# byteorder does exist on its own but we overlay a virtual -# dynamically recomputed value. - -# However, ivtype and ivsize will not vary for sane fat binaries - -my $f = $t eq 'long' ? 'L!' : $s == 8 ? 'Q': 'I'; - -my $byteorder_code; -if ($s == 4 || $s == 8) { - my $list = join ',', reverse(2..$s); - my $format = 'a'x$s; - $byteorder_code = <<"EOT"; -my \$i = 0; -foreach my \$c ($list) { \$i |= ord(\$c); \$i <<= 8 } -\$i |= ord(1); -my \$value = join('', unpack('$format', pack('$f', \$i))); -EOT -} else { - $byteorder_code = "\$value = '?'x$s;\n"; -} - my $fast_config = join '', map { " $_,\n" } - sort values (%v_fast), 'byteorder => $value' ; + sort values (%v_fast), 'byteorder => $byteorder' ; -print CONFIG sprintf <<'ENDOFTIE', $byteorder_code, $fast_config; +print CONFIG sprintf <<'ENDOFTIE', $fast_config; # avoid Config..Exporter..UNIVERSAL search for DESTROY then AUTOLOAD sub DESTROY { } -%s - tie %%Config, 'Config', { %s }; |