### CPU ###
-Test("CPU_ARCH", "Checking for CPU architecture", sub {
+Test("ARCH", "Checking for machine architecture", sub {
my $mach = `uname -m`;
chomp $mach;
Fail "Unable to determine machine type" if $? || $mach eq "";
if ($mach =~ /^i[0-9]86$/) {
+ return "i386";
+ } elsif ($mach =~ /^(x86[_-]|amd)64$/) {
+ return "amd64";
+ } else {
+ return "unknown";
+ }
+});
+
+Test("CPU_ARCH", "Checking for CPU architecture", sub {
+ my $mach = Get("ARCH");
+ if ($mach eq "i386") {
Set("CPU_I386");
UnSet("CPU_64BIT_POINTERS");
Set("CPU_LITTLE_ENDIAN");
}
}
return $arch ? $arch : "i386";
- } elsif ($mach =~ /^(x86[_-]|amd)64$/) {
+ } elsif ($mach eq "amd64") {
Set("CPU_AMD64");
Set("CPU_64BIT_POINTERS");
Set("CPU_LITTLE_ENDIAN");
Set("CPU_STRUCT_ALIGN" => 8);
return "x86-64";
} else {
- return "unknown";
+ return undef;
}
});
-if (Get("CPU_ARCH") eq "unknown") { Warn "CPU type not recognized, using defaults, keep fingers crossed."; }
+
+if (!IsSet("CPU_ARCH")) { Warn "CPU type not recognized, using defaults, keep fingers crossed."; }
### Compiler and its Options ###