die "Don't know how to find myself. Please set SRCDIR manually.";
}
}
- require "$srcdir/ucw/perl/UCW/Configure.pm";
- UCW::Configure::import UCW::Configure;
}
+use lib "$srcdir/ucw/perl/";
+use UCW::Configure;
+
Init($srcdir, "default.cfg");
Include "ucw/default.cfg";
Log "### Configuring Sherlock Libraries " . Get("SHERLOCK_VERSION") . " with configuration " . Get("CONFIG") . "\n";
Include Get("CONFIG");
-Include "ucw/paths.cfg";
-Include "ucw/autoconf.cfg";
-Include "ucw/ucw.cfg";
+require UCW::Configure::Paths;
+require UCW::Configure::Autoconf;
+require UCW::Configure::UCW;
Finish();
Log "\nConfigured, run `make' to build everything.\n";
die "Don't know how to find myself. Please set SRCDIR manually.";
}
}
- require "$srcdir/ucw/perl/UCW/Configure.pm";
- UCW::Configure::import UCW::Configure;
}
+use lib "$srcdir/ucw/perl/";
+use UCW::Configure;
+
Init($srcdir, "default.cfg");
Include "ucw/default.cfg";
Log "### Configuring TestApp ###\n\n";
Include Get("CONFIG");
-Include "ucw/paths.cfg";
-Include "ucw/autoconf.cfg";
-Include "ucw/ucw.cfg";
+require UCW::Configure::Paths;
+require UCW::Configure::Autoconf;
+require UCW::Configure::UCW;
Finish();
Log "\nConfigured, run `make' to build everything.\n";
+++ /dev/null
-# Automatic configuration, OS & CPU detection part
-# (c) 2005--2008 Martin Mares <mj@ucw.cz>
-# (c) 2006 Robert Spalek <robert@ucw.cz>
-# (c) 2008 Michal Vaner <vorner@ucw.cz>
-
-### OS ###
-
-Test("OS", "Checking on which OS we run", sub {
- my $os = `uname`;
- chomp $os;
- Fail "Unable to determine OS type" if $? || $os eq "";
- return $os;
-});
-
-if (Get("OS") eq "Linux") {
- Set("CONFIG_LINUX");
-} elsif (Get("OS") eq "Darwin") {
- Set("CONFIG_DARWIN");
-} else {
- Fail "Don't know how to run on this operating system.";
-}
-
-### Compiler ###
-
-# Default compiler
-Test("CC", "Checking for C compiler", sub { return "gcc"; });
-
-# GCC version
-Test("GCCVER", "Checking for GCC version", sub {
- my $gcc = Get("CC");
- my $ver = `$gcc --version | sed '2,\$d; s/^\\(.* \\)*\\([0-9]*\\.[0-9]*\\).*/\\2/'`;
- chomp $ver;
- Fail "Unable to determine GCC version" if $? || $ver eq "";
- return $ver;
-});
-my ($gccmaj, $gccmin) = split(/\./, Get("GCCVER"));
-my $gccver = 1000*$gccmaj + $gccmin;
-$gccver >= 3000 or Fail "GCC older than 3.0 doesn't support C99 well enough.";
-
-### CPU ###
-
-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";
- }
-});
-
-sub parse_cpuinfo_linux() {
- open X, "/proc/cpuinfo" || undef;
- my %pc = ();
- while (<X>) {
- chomp;
- /^$/ && last;
- /^([^\t]+)\t+:\s*(.*)$/ and $pc{$1}=$2;
- }
- close X;
- return ($pc{'vendor_id'},
- $pc{'cpu family'},
- $pc{'model'});
-}
-
-sub parse_cpuinfo_darwin() {
- @cpu = (`sysctl -n machdep.cpu.vendor`,
- `sysctl -n machdep.cpu.family`,
- `sysctl -n machdep.cpu.model`);
- chomp @cpu;
- return @cpu;
-}
-
-sub parse_cpuinfo() {
- my @cpu;
- 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];
- $cpu[2] = 0 if !defined $cpu[2];
- return @cpu;
-}
-
-Test("CPU_ARCH", "Checking for CPU architecture", sub {
- my $mach = Get("ARCH");
- my $arch = "";
- if ($mach eq "i386") {
- Set("CPU_I386");
- UnSet("CPU_64BIT_POINTERS");
- Set("CPU_LITTLE_ENDIAN");
- UnSet("CPU_BIG_ENDIAN");
- Set("CPU_ALLOW_UNALIGNED");
- Set("CPU_STRUCT_ALIGN" => 4);
- 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) {
- if ($model >= 31 && $gccver >= 3004) { $arch = "athlon64"; }
- elsif ($model >= 6 && $gccver >= 3003) { $arch = "athlon-xp"; }
- else { $arch = "athlon"; }
- }
- } elsif ($vendor eq "GenuineIntel") {
- if ($family >= 15 && $gccver >= 3003) {
- if ($model >= 4) { $arch = "nocona"; }
- elsif ($model >= 3) { $arch = "prescott"; }
- else { $arch = "pentium4"; }
- } elsif ($family == 6 && $gccver >= 3003) {
- if ($model == 15) { $arch = "prescott"; }
- elsif (($model == 9 || $model == 13) && $gccver >= 3004) { $arch = "pentium-m"; }
- elsif ($model >= 7) { $arch = "pentium3"; }
- elsif ($model >= 3) { $arch = "pentium2"; }
- }
- }
-
- # No match on vendor, try the family
- if ($arch eq "") {
- if ($family >= 6) {
- $arch = "i686";
- } elsif ($family >= 3) {
- $arch = "i${family}86";
- }
- }
- Log (($arch ne "") ? "(using /proc/cpuinfo) " : "(don't understand /proc/cpuinfo) ");
- return $arch;
- } else {
- return "default";
- }
- } elsif ($mach eq "amd64") {
- Set("CPU_AMD64");
- Set("CPU_64BIT_POINTERS");
- Set("CPU_LITTLE_ENDIAN");
- UnSet("CPU_BIG_ENDIAN");
- Set("CPU_ALLOW_UNALIGNED");
- Set("CPU_STRUCT_ALIGN" => 8);
- 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";
- }
- } else {
- 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
-Set("CLANG" => "-std=gnu99 -fno-common");
-
-# C optimizations
-Set("COPT" => '-O2');
-if (Get("CPU_ARCH") ne "unknown" && Get("CPU_ARCH") ne "default") {
- Append("COPT", '-march=$(CPU_ARCH)');
-}
-
-# C optimizations for highly exposed code
-Set("COPT2" => '-O3');
-
-# Warnings
-Set("CWARNS" => '-Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline');
-Set("CWARNS_OFF" => '');
-
-# Linker flags
-Set("LOPT" => "");
-
-# Extra libraries
-Set("LIBS" => "");
-
-# Extra flags for compiling and linking shared libraries
-Set("CSHARED" => '-fPIC');
-if (IsSet("CONFIG_LOCAL")) {
- Set("SONAME_PREFIX" => "lib/");
-} else {
- Set("SONAME_PREFIX" => "");
-}
-if (IsSet("CONFIG_DARWIN")) {
- Set("LSHARED" => '-dynamiclib -install_name $(SONAME_PREFIX)$(@F)$(SONAME_SUFFIX) -undefined dynamic_lookup');
-} else {
- Set("LSHARED" => '-shared -Wl,-soname,$(SONAME_PREFIX)$(@F)$(SONAME_SUFFIX)');
-}
-
-# Extra switches depending on GCC version:
-if ($gccver == 3000) {
- Append("COPT" => "-fstrict-aliasing");
-} elsif ($gccver == 3003) {
- Append("CWARNS" => "-Wundef -Wredundant-decls");
- Append("COPT" => "-finline-limit=20000 --param max-inline-insns-auto=1000");
-} elsif ($gccver == 3004) {
- Append("CWARNS" => "-Wundef -Wredundant-decls");
- Append("COPT" => "-finline-limit=2000 --param large-function-insns=5000 --param inline-unit-growth=200 --param large-function-growth=400");
-} elsif ($gccver >= 4000) {
- 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");
- if ($gccver >= 4002) {
- Append("COPT" => "-fgnu89-inline");
- }
-} else {
- Warn "Don't know anything about this GCC version, using default switches.\n";
-}
-
-if (IsSet("CONFIG_DEBUG")) {
- # If debugging:
- Set("DEBUG_ASSERTS");
- Set("DEBUG_DIE_BY_ABORT") if Get("CONFIG_DEBUG") > 1;
- Set("CDEBUG" => "-ggdb");
-} else {
- # If building a release version:
- Append("COPT" => "-fomit-frame-pointer");
- Append("LOPT" => "-s");
-}
-
-if (IsSet("CONFIG_DARWIN")) {
- # gcc-4.0 on Darwin doesn't set this in the gnu99 mode
- Append("CLANG" => "-fnested-functions");
- # Directory hierarchy of the fink project
- Append("LIBS" => "-L/sw/lib");
- Append("COPT" => "-I/sw/include");
- # Fill in some constants not found in the system header files
- Set("SOL_TCP" => 6); # missing in /usr/include/netinet/tcp.h
-}
-
-# Return success
-1;
+++ /dev/null
-# Automatic configuration, installation paths part
-# (c) 2008 Michal Vaner <vorner@ucw.cz>
-# Code taken from autoconf.cfg by:
-# (c) 2005--2008 Martin Mares <mj@ucw.cz>
-# (c) 2006 Robert Spalek <robert@ucw.cz>
-
-Log "Determining installation prefix ... ";
-if (IsSet("CONFIG_LOCAL")) {
- Log "local build\n";
- Set("INSTALL_PREFIX", "");
- Set("INSTALL_USR_PREFIX", "");
- Set("INSTALL_VAR_PREFIX", "");
-} else {
- Set("PREFIX", "/usr/local") unless IsSet("PREFIX");
- my $ipx = Get("PREFIX");
- $ipx =~ s{/$}{};
- Set("INSTALL_PREFIX", "$ipx/");
- my $upx = ($ipx eq "" ? "/usr/" : "$ipx/");
- Set("INSTALL_USR_PREFIX", $upx);
- $upx =~ s{^/usr\b}{/var};
- Set("INSTALL_VAR_PREFIX", $upx);
- Log Get("PREFIX") . "\n";
-}
-
-Set("INSTALL_CONFIG_DIR", '$(INSTALL_PREFIX)$(CONFIG_DIR)');
-Set("INSTALL_BIN_DIR", '$(INSTALL_USR_PREFIX)bin');
-Set("INSTALL_SBIN_DIR", '$(INSTALL_USR_PREFIX)sbin');
-Set("INSTALL_LIB_DIR", '$(INSTALL_USR_PREFIX)lib');
-Set("INSTALL_INCLUDE_DIR", '$(INSTALL_USR_PREFIX)include');
-Set("INSTALL_PKGCONFIG_DIR", '$(INSTALL_USR_PREFIX)lib/pkgconfig');
-Set("INSTALL_SHARE_DIR", '$(INSTALL_USR_PREFIX)share');
-Set("INSTALL_MAN_DIR", '$(INSTALL_USR_PREFIX)share/man');
-Set("INSTALL_LOG_DIR", '$(INSTALL_VAR_PREFIX)log');
-Set("INSTALL_STATE_DIR", '$(INSTALL_VAR_PREFIX)lib');
-Set("INSTALL_RUN_DIR", '$(INSTALL_VAR_PREFIX)run');
-
-# We succeeded
-1;
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
$VERSION = 1.0;
@ISA = qw(Exporter);
- @EXPORT = qw(&Init &Log &Notice &Warn &Fail &IsSet &IsGiven &Set &UnSet &Append &Override &Get &Test &Include &Finish &FindFile &TryFindFile &TryCmd &PkgConfig &TrivConfig);
+ @EXPORT = qw(&Init &Log &Notice &Warn &Fail &IsSet &IsGiven &Set &UnSet &Append &Override &Get &Test &Include &Finish &FindFile &TryFindFile &TryCmd &PkgConfig &TrivConfig &debPrint);
@EXPORT_OK = qw();
%EXPORT_TAGS = ();
}
-our %vars = ();
-our %overriden = ();
+our %vars;
+our %overriden;
+
+sub debPrint() {
+ print "VARS:\n";
+# print "$_: $vars{$_}\n" foreach( keys %vars );
+}
sub Log($) {
print @_;
}
sub Init($$) {
+ print "YYY\n";
my ($srcdir,$defconfig) = @_;
sub usage($) {
my ($dc) = @_;
--- /dev/null
+# Automatic configuration, OS & CPU detection part
+# (c) 2005--2008 Martin Mares <mj@ucw.cz>
+# (c) 2006 Robert Spalek <robert@ucw.cz>
+# (c) 2008 Michal Vaner <vorner@ucw.cz>
+
+### OS ###
+
+package UCW::Configure::Autoconf;
+use UCW::Configure;
+
+Test("OS", "Checking on which OS we run", sub {
+ my $os = `uname`;
+ chomp $os;
+ Fail "Unable to determine OS type" if $? || $os eq "";
+ return $os;
+});
+
+if (Get("OS") eq "Linux") {
+ Set("CONFIG_LINUX");
+} elsif (Get("OS") eq "Darwin") {
+ Set("CONFIG_DARWIN");
+} else {
+ Fail "Don't know how to run on this operating system.";
+}
+
+### Compiler ###
+
+# Default compiler
+Test("CC", "Checking for C compiler", sub { return "gcc"; });
+
+# GCC version
+Test("GCCVER", "Checking for GCC version", sub {
+ my $gcc = Get("CC");
+ my $ver = `$gcc --version | sed '2,\$d; s/^\\(.* \\)*\\([0-9]*\\.[0-9]*\\).*/\\2/'`;
+ chomp $ver;
+ Fail "Unable to determine GCC version" if $? || $ver eq "";
+ return $ver;
+});
+my ($gccmaj, $gccmin) = split(/\./, Get("GCCVER"));
+my $gccver = 1000*$gccmaj + $gccmin;
+$gccver >= 3000 or Fail "GCC older than 3.0 doesn't support C99 well enough.";
+
+### CPU ###
+
+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";
+ }
+});
+
+sub parse_cpuinfo_linux() {
+ open X, "/proc/cpuinfo" || undef;
+ my %pc = ();
+ while (<X>) {
+ chomp;
+ /^$/ && last;
+ /^([^\t]+)\t+:\s*(.*)$/ and $pc{$1}=$2;
+ }
+ close X;
+ return ($pc{'vendor_id'},
+ $pc{'cpu family'},
+ $pc{'model'});
+}
+
+sub parse_cpuinfo_darwin() {
+ @cpu = (`sysctl -n machdep.cpu.vendor`,
+ `sysctl -n machdep.cpu.family`,
+ `sysctl -n machdep.cpu.model`);
+ chomp @cpu;
+ return @cpu;
+}
+
+sub parse_cpuinfo() {
+ my @cpu;
+ 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];
+ $cpu[2] = 0 if !defined $cpu[2];
+ return @cpu;
+}
+
+Test("CPU_ARCH", "Checking for CPU architecture", sub {
+ my $mach = Get("ARCH");
+ my $arch = "";
+ if ($mach eq "i386") {
+ Set("CPU_I386");
+ UnSet("CPU_64BIT_POINTERS");
+ Set("CPU_LITTLE_ENDIAN");
+ UnSet("CPU_BIG_ENDIAN");
+ Set("CPU_ALLOW_UNALIGNED");
+ Set("CPU_STRUCT_ALIGN" => 4);
+ 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) {
+ if ($model >= 31 && $gccver >= 3004) { $arch = "athlon64"; }
+ elsif ($model >= 6 && $gccver >= 3003) { $arch = "athlon-xp"; }
+ else { $arch = "athlon"; }
+ }
+ } elsif ($vendor eq "GenuineIntel") {
+ if ($family >= 15 && $gccver >= 3003) {
+ if ($model >= 4) { $arch = "nocona"; }
+ elsif ($model >= 3) { $arch = "prescott"; }
+ else { $arch = "pentium4"; }
+ } elsif ($family == 6 && $gccver >= 3003) {
+ if ($model == 15) { $arch = "prescott"; }
+ elsif (($model == 9 || $model == 13) && $gccver >= 3004) { $arch = "pentium-m"; }
+ elsif ($model >= 7) { $arch = "pentium3"; }
+ elsif ($model >= 3) { $arch = "pentium2"; }
+ }
+ }
+
+ # No match on vendor, try the family
+ if ($arch eq "") {
+ if ($family >= 6) {
+ $arch = "i686";
+ } elsif ($family >= 3) {
+ $arch = "i${family}86";
+ }
+ }
+ Log (($arch ne "") ? "(using /proc/cpuinfo) " : "(don't understand /proc/cpuinfo) ");
+ return $arch;
+ } else {
+ return "default";
+ }
+ } elsif ($mach eq "amd64") {
+ Set("CPU_AMD64");
+ Set("CPU_64BIT_POINTERS");
+ Set("CPU_LITTLE_ENDIAN");
+ UnSet("CPU_BIG_ENDIAN");
+ Set("CPU_ALLOW_UNALIGNED");
+ Set("CPU_STRUCT_ALIGN" => 8);
+ 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";
+ }
+ } else {
+ 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
+Set("CLANG" => "-std=gnu99 -fno-common");
+
+# C optimizations
+Set("COPT" => '-O2');
+if (Get("CPU_ARCH") ne "unknown" && Get("CPU_ARCH") ne "default") {
+ Append("COPT", '-march=$(CPU_ARCH)');
+}
+
+# C optimizations for highly exposed code
+Set("COPT2" => '-O3');
+
+# Warnings
+Set("CWARNS" => '-Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline');
+Set("CWARNS_OFF" => '');
+
+# Linker flags
+Set("LOPT" => "");
+
+# Extra libraries
+Set("LIBS" => "");
+
+# Extra flags for compiling and linking shared libraries
+Set("CSHARED" => '-fPIC');
+if (IsSet("CONFIG_LOCAL")) {
+ Set("SONAME_PREFIX" => "lib/");
+} else {
+ Set("SONAME_PREFIX" => "");
+}
+if (IsSet("CONFIG_DARWIN")) {
+ Set("LSHARED" => '-dynamiclib -install_name $(SONAME_PREFIX)$(@F)$(SONAME_SUFFIX) -undefined dynamic_lookup');
+} else {
+ Set("LSHARED" => '-shared -Wl,-soname,$(SONAME_PREFIX)$(@F)$(SONAME_SUFFIX)');
+}
+
+# Extra switches depending on GCC version:
+if ($gccver == 3000) {
+ Append("COPT" => "-fstrict-aliasing");
+} elsif ($gccver == 3003) {
+ Append("CWARNS" => "-Wundef -Wredundant-decls");
+ Append("COPT" => "-finline-limit=20000 --param max-inline-insns-auto=1000");
+} elsif ($gccver == 3004) {
+ Append("CWARNS" => "-Wundef -Wredundant-decls");
+ Append("COPT" => "-finline-limit=2000 --param large-function-insns=5000 --param inline-unit-growth=200 --param large-function-growth=400");
+} elsif ($gccver >= 4000) {
+ 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");
+ if ($gccver >= 4002) {
+ Append("COPT" => "-fgnu89-inline");
+ }
+} else {
+ Warn "Don't know anything about this GCC version, using default switches.\n";
+}
+
+if (IsSet("CONFIG_DEBUG")) {
+ # If debugging:
+ Set("DEBUG_ASSERTS");
+ Set("DEBUG_DIE_BY_ABORT") if Get("CONFIG_DEBUG") > 1;
+ Set("CDEBUG" => "-ggdb");
+} else {
+ # If building a release version:
+ Append("COPT" => "-fomit-frame-pointer");
+ Append("LOPT" => "-s");
+}
+
+if (IsSet("CONFIG_DARWIN")) {
+ # gcc-4.0 on Darwin doesn't set this in the gnu99 mode
+ Append("CLANG" => "-fnested-functions");
+ # Directory hierarchy of the fink project
+ Append("LIBS" => "-L/sw/lib");
+ Append("COPT" => "-I/sw/include");
+ # Fill in some constants not found in the system header files
+ Set("SOL_TCP" => 6); # missing in /usr/include/netinet/tcp.h
+}
+
+# Return success
+1;
--- /dev/null
+# Automatic configuration, installation paths part
+# (c) 2008 Michal Vaner <vorner@ucw.cz>
+# Code taken from autoconf.cfg by:
+# (c) 2005--2008 Martin Mares <mj@ucw.cz>
+# (c) 2006 Robert Spalek <robert@ucw.cz>
+
+package UCW::Configure::Paths;
+use UCW::Configure;
+
+Log "Determining installation prefix ... ";
+if (IsSet("CONFIG_LOCAL")) {
+ Log("local build\n");
+ Set("INSTALL_PREFIX", "");
+ Set("INSTALL_USR_PREFIX", "");
+ Set("INSTALL_VAR_PREFIX", "");
+} else {
+ Set("PREFIX", "/usr/local") unless IsSet("PREFIX");
+ my $ipx = Get("PREFIX");
+ $ipx =~ s{/$}{};
+ Set("INSTALL_PREFIX", "$ipx/");
+ my $upx = ($ipx eq "" ? "/usr/" : "$ipx/");
+ Set("INSTALL_USR_PREFIX", $upx);
+ $upx =~ s{^/usr\b}{/var};
+ Set("INSTALL_VAR_PREFIX", $upx);
+ Log(Get("PREFIX") . "\n");
+}
+
+Set("INSTALL_CONFIG_DIR", '$(INSTALL_PREFIX)$(CONFIG_DIR)');
+Set("INSTALL_BIN_DIR", '$(INSTALL_USR_PREFIX)bin');
+Set("INSTALL_SBIN_DIR", '$(INSTALL_USR_PREFIX)sbin');
+Set("INSTALL_LIB_DIR", '$(INSTALL_USR_PREFIX)lib');
+Set("INSTALL_INCLUDE_DIR", '$(INSTALL_USR_PREFIX)include');
+Set("INSTALL_PKGCONFIG_DIR", '$(INSTALL_USR_PREFIX)lib/pkgconfig');
+Set("INSTALL_SHARE_DIR", '$(INSTALL_USR_PREFIX)share');
+Set("INSTALL_MAN_DIR", '$(INSTALL_USR_PREFIX)share/man');
+Set("INSTALL_LOG_DIR", '$(INSTALL_VAR_PREFIX)log');
+Set("INSTALL_STATE_DIR", '$(INSTALL_VAR_PREFIX)lib');
+Set("INSTALL_RUN_DIR", '$(INSTALL_VAR_PREFIX)run');
+
+# We succeeded
+1;
--- /dev/null
+# Automatic configuration, libucw specific part
+# (c) 2008 Michal Vaner <vorner@ucw.cz>
+# Code taken from autoconf.cfg by:
+# (c) 2005--2008 Martin Mares <mj@ucw.cz>
+# (c) 2006 Robert Spalek <robert@ucw.cz>
+
+package UCW::Configure::UCW;
+use UCW::Configure;
+
+# Determine page size
+Test("CPU_PAGE_SIZE", "Determining page size", sub {
+ my $p;
+ if (IsSet("CONFIG_DARWIN")) {
+ $p = `sysctl -n hw.pagesize`;
+ defined $p or Fail "sysctl hw.pagesize failed";
+ } elsif (IsSet("CONFIG_LINUX")) {
+ $p = `getconf PAGE_SIZE`;
+ defined $p or Fail "getconf PAGE_SIZE failed";
+ }
+ chomp $p;
+ return $p;
+});
+
+if (IsSet("CONFIG_LARGE_FILES") && IsSet("CONFIG_LINUX")) {
+ # Use 64-bit versions of file functions
+ Set("CONFIG_LFS");
+}
+
+# Decide how will ucw/partmap.c work
+Set("PARTMAP_IS_MMAP") if IsSet("CPU_64BIT_POINTERS");
+
+# Option for ucw/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
+
+# Remember PKG_CONFIG_PATH used for building, so that it will be propagated to
+# pkg-config's run locally in the makefiles.
+Set("PKG_CONFIG_PATH", $ENV{"PKG_CONFIG_PATH"}) if defined $ENV{"PKG_CONFIG_PATH"};
+
+1;
+++ /dev/null
-# Automatic configuration, libucw specific part
-# (c) 2008 Michal Vaner <vorner@ucw.cz>
-# Code taken from autoconf.cfg by:
-# (c) 2005--2008 Martin Mares <mj@ucw.cz>
-# (c) 2006 Robert Spalek <robert@ucw.cz>
-
-# Determine page size
-Test("CPU_PAGE_SIZE", "Determining page size", sub {
- my $p;
- if (IsSet("CONFIG_DARWIN")) {
- $p = `sysctl -n hw.pagesize`;
- defined $p or Fail "sysctl hw.pagesize failed";
- } elsif (IsSet("CONFIG_LINUX")) {
- $p = `getconf PAGE_SIZE`;
- defined $p or Fail "getconf PAGE_SIZE failed";
- }
- chomp $p;
- return $p;
-});
-
-if (IsSet("CONFIG_LARGE_FILES") && IsSet("CONFIG_LINUX")) {
- # Use 64-bit versions of file functions
- Set("CONFIG_LFS");
-}
-
-# Decide how will ucw/partmap.c work
-Set("PARTMAP_IS_MMAP") if IsSet("CPU_64BIT_POINTERS");
-
-# Option for ucw/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
-
-# Remember PKG_CONFIG_PATH used for building, so that it will be propagated to
-# pkg-config's run locally in the makefiles.
-Set("PKG_CONFIG_PATH", $ENV{"PKG_CONFIG_PATH"}) if defined $ENV{"PKG_CONFIG_PATH"};