]> mj.ucw.cz Git - libucw.git/blob - ucw/perl/UCW/Configure/LibUCW.pm
Slightly better names for configuration modules.
[libucw.git] / ucw / perl / UCW / Configure / LibUCW.pm
1 # UCW Library configuration system: parameters of the library
2 # (c) 2005--2008 Martin Mares <mj@ucw.cz>
3 # (c) 2006 Robert Spalek <robert@ucw.cz>
4 # (c) 2008 Michal Vaner <vorner@ucw.cz>
5
6 package UCW::Configure::LibUCW;
7 use UCW::Configure;
8
9 # Determine page size
10 Test("CPU_PAGE_SIZE", "Determining page size", sub {
11         my $p;
12         if (IsSet("CONFIG_DARWIN")) {
13                 $p = `sysctl -n hw.pagesize`;
14                 defined $p or Fail "sysctl hw.pagesize failed";
15         } elsif (IsSet("CONFIG_LINUX")) {
16                 $p = `getconf PAGE_SIZE`;
17                 defined $p or Fail "getconf PAGE_SIZE failed";
18         }
19         chomp $p;
20         return $p;
21 });
22
23 if (IsSet("CONFIG_LARGE_FILES") && IsSet("CONFIG_LINUX")) {
24         # Use 64-bit versions of file functions
25         Set("CONFIG_LFS");
26 }
27
28 # Decide how will ucw/partmap.c work
29 Set("PARTMAP_IS_MMAP") if IsSet("CPU_64BIT_POINTERS");
30
31 # Option for ucw/mempool.c
32 Set("POOL_IS_MMAP");
33
34 # Guess optimal bit width of the radix-sorter
35 if (Get("CPU_ARCH") eq "default" || Get("CPU_ARCH") =~ /^i[345]86$/) {
36         # This should be safe everywhere
37         Set("CONFIG_UCW_RADIX_SORTER_BITS" => 10);
38 } else {
39         # Use this on modern CPU's
40         Set("CONFIG_UCW_RADIX_SORTER_BITS" => 12);
41 }
42
43 # We succeeded
44 1;