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);
} else {
$byteorder_code = "our \$byteorder = '?'x$s;\n";
}
-print CONFIG $byteorder_code;
print CONFIG_HEAVY @non_v, "\n";
$_ = <<'!END!';
EOT
-print CONFIG_HEAVY join("", @v_fast, sort @v_others);
+print CONFIG_HEAVY join('', @v_fast, sort @v_others), "!END!\n";
+
+# Only need the dynamic byteorder code in Config.pm if 'byteorder' is one of
+# the precached keys
+if ($Common{byteorder}) {
+ print CONFIG $byteorder_code;
+} else {
+ print CONFIG_HEAVY $byteorder_code;
+}
print CONFIG_HEAVY <<'EOT';
-!END!
s/(byteorder=)(['"]).*?\2/$1$2$Config::byteorder$2/m;
my $config_sh_len = length $_;
}
$Common{$key} = "$qkey => $value";
}
-my $fast_config = join '', map { " $_,\n" }
- sort (values %Common, 'byteorder => $byteorder');
+
+if ($Common{byteorder}) {
+ $Common{byteorder} = 'byteorder => $byteorder';
+}
+my $fast_config = join '', map { " $_,\n" } sort values %Common;
print CONFIG sprintf <<'ENDOFTIE', $fast_config;