X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fautoconf.cfg;h=bf372573cfd135d582c47726573e2d8cbb6a8f32;hb=18fcca1138ad1b480854cb1e64fa10a84660dcba;hp=66c4056cd079c14799bf648ae2983641f569fd63;hpb=3355e84f7cd4485564b92145efff82ac73c61873;p=libucw.git diff --git a/lib/autoconf.cfg b/lib/autoconf.cfg index 66c4056c..bf372573 100644 --- a/lib/autoconf.cfg +++ b/lib/autoconf.cfg @@ -75,12 +75,10 @@ sub parse_cpuinfo_darwin() { 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]; @@ -98,7 +96,8 @@ Test("CPU_ARCH", "Checking for CPU architecture", sub { 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) { @@ -128,8 +127,10 @@ Test("CPU_ARCH", "Checking for CPU architecture", sub { } } 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"); @@ -137,21 +138,28 @@ Test("CPU_ARCH", "Checking for CPU architecture", sub { 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 @@ -159,9 +167,7 @@ Set("CLANG" => "-std=gnu99 -fno-common"); # 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)'); } @@ -246,6 +252,9 @@ if (IsSet("CONFIG_LARGE_FILES") && IsSet("CONFIG_LINUX")) { # 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"); + # If debugging memory allocations: #LIBS+=-lefence #CDEBUG+=-DDEBUG_DMALLOC