sub parse_cpuinfo() {
my @cpu;
- if (IsSet("CONFIG_EXACT_CPU")) {
- if (IsSet("CONFIG_LINUX")) {
- @cpu = parse_cpuinfo_linux();
- } elsif (IsSet("CONFIG_DARWIN")) {
- @cpu = parse_cpuinfo_darwin();
- }
+ if (IsSet("CONFIG_LINUX")) {
+ @cpu = parse_cpuinfo_linux();
+ } elsif (IsSet("CONFIG_DARWIN")) {
+ @cpu = parse_cpuinfo_darwin();
}
$cpu[0] = "" if !defined $cpu[0];
$cpu[1] = 0 if !defined $cpu[1];
UnSet("CPU_BIG_ENDIAN");
Set("CPU_ALLOW_UNALIGNED");
Set("CPU_STRUCT_ALIGN" => 4);
- if (my ($vendor, $family, $model) = parse_cpuinfo()) {
+ if (IsSet("CONFIG_EXACT_CPU")) {
+ my ($vendor, $family, $model) = parse_cpuinfo();
# Try to understand CPU vendor, family and model [inspired by MPlayer's configure script]
if ($vendor eq "AuthenticAMD") {
if ($family >= 6) {
}
}
Log (($arch ne "") ? "(using /proc/cpuinfo) " : "(don't understand /proc/cpuinfo) ");
+ return $arch;
+ } else {
+ return "default";
}
- return $arch;
} elsif ($mach eq "amd64") {
Set("CPU_AMD64");
Set("CPU_64BIT_POINTERS");
UnSet("CPU_BIG_ENDIAN");
Set("CPU_ALLOW_UNALIGNED");
Set("CPU_STRUCT_ALIGN" => 8);
- if (my ($vendor, $family, $model) = parse_cpuinfo()) {
+ if (IsSet("CONFIG_EXACT_CPU")) {
# In x86-64 world, the detection is somewhat easier so far...
+ my ($vendor, $family, $model) = parse_cpuinfo();
if ($vendor eq "AuthenticAMD") {
$arch = "athlon64";
} elsif ($vendor eq "GenuineIntel") {
$arch = "nocona";
}
Log (($arch ne "") ? "(using /proc/cpuinfo) " : "(don't understand /proc/cpuinfo) ");
+ return $arch;
+ } else {
+ return "default";
}
- return $arch;
} else {
- return "";
+ return "unknown";
}
});
+if (Get("CPU_ARCH") eq "unknown") {
+ Warn "CPU architecture not recognized, using defaults, keep fingers crossed.\n";
+}
+
### Compiler and its Options ###
# C flags: tell the compiler we're speaking C99, and disable common symbols
# C optimizations
Set("COPT" => '-O2');
-if (Get("CPU_ARCH") eq "") {
- Warn "CPU type not recognized, using defaults, keep fingers crossed.";
-} else {
+if (Get("CPU_ARCH") ne "unknown" && Get("CPU_ARCH") ne "default") {
Append("COPT", '-march=$(CPU_ARCH)');
}
Append("CWARNS" => "-Wundef -Wredundant-decls -Wno-pointer-sign -Wdisabled-optimization -Wno-missing-field-initializers");
Append("CWARNS_OFF" => "-Wno-pointer-sign");
Append("COPT" => "-finline-limit=5000 --param large-function-insns=5000 --param inline-unit-growth=200 --param large-function-growth=400");
+} elsif ($gccver == 4002) {
+ Append("CWARNS" => "-Wundef -Wredundant-decls -Wno-pointer-sign -Wdisabled-optimization -Wno-missing-field-initializers");
+ Append("CWARNS_OFF" => "-Wno-pointer-sign");
+ Append("COPT" => "-finline-limit=5000 --param large-function-insns=5000 --param inline-unit-growth=200 --param large-function-growth=400 -fgnu89-inline");
} else {
Warn "Don't know anything about this GCC version, using default switches.\n";
}
# Decide how will lib/partmap.c work
Set("PARTMAP_IS_MMAP") if IsSet("CPU_64BIT_POINTERS");
+# Option for lib/mempool.c
+Set("POOL_IS_MMAP");
+
+# Guess optimal bit width of the radix-sorter
+if (Get("CPU_ARCH") eq "default" || Get("CPU_ARCH") =~ /^i[345]86$/) {
+ # This should be safe everywhere
+ Set("CONFIG_UCW_RADIX_SORTER_BITS" => 10);
+} else {
+ # Use this on modern CPU's
+ Set("CONFIG_UCW_RADIX_SORTER_BITS" => 12);
+}
+
# If debugging memory allocations:
#LIBS+=-lefence
#CDEBUG+=-DDEBUG_DMALLOC