From: Michal Vaner Date: Sat, 4 Oct 2008 10:17:36 +0000 (+0200) Subject: Split autoconf.cfg X-Git-Tag: holmes-import~227^2~5^2~37 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=09e7fe5641b94148d998a1b620bf694f353cb17b;p=libucw.git Split autoconf.cfg Some programs may want to use the configure & build system from libucw, but not libucw itself. Splitting it allows such programs not detect internal libucw thinks like page sizes. --- diff --git a/free/libs/configure b/free/libs/configure index 3934fef4..a359da28 100755 --- a/free/libs/configure +++ b/free/libs/configure @@ -25,7 +25,9 @@ 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"; Finish(); Log "\nConfigured, run `make' to build everything.\n"; diff --git a/free/libs/examples/internal/configure b/free/libs/examples/internal/configure index 1e93b7ea..034d43d6 100755 --- a/free/libs/examples/internal/configure +++ b/free/libs/examples/internal/configure @@ -25,7 +25,9 @@ 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"; Finish(); Log "\nConfigured, run `make' to build everything.\n"; diff --git a/ucw/autoconf.cfg b/ucw/autoconf.cfg index 854bd7b9..b28be834 100644 --- a/ucw/autoconf.cfg +++ b/ucw/autoconf.cfg @@ -1,38 +1,7 @@ -# Automatic configuration of the UCW Library +# Automatic configuration, OS & CPU detection part # (c) 2005--2008 Martin Mares # (c) 2006 Robert Spalek - -### Installation paths ### - -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'); +# (c) 2008 Michal Vaner ### OS ### @@ -270,46 +239,5 @@ if (IsSet("CONFIG_DARWIN")) { Set("SOL_TCP" => 6); # missing in /usr/include/netinet/tcp.h } -# 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"}; - # Return success 1; diff --git a/ucw/paths.cfg b/ucw/paths.cfg new file mode 100644 index 00000000..199401d6 --- /dev/null +++ b/ucw/paths.cfg @@ -0,0 +1,38 @@ +# Automatic configuration, installation paths part +# (c) 2008 Michal Vaner +# Code taken from autoconf.cfg by: +# (c) 2005--2008 Martin Mares +# (c) 2006 Robert Spalek + +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; diff --git a/ucw/ucw.cfg b/ucw/ucw.cfg new file mode 100644 index 00000000..c79844be --- /dev/null +++ b/ucw/ucw.cfg @@ -0,0 +1,46 @@ +# Automatic configuration, libucw specific part +# (c) 2008 Michal Vaner +# Code taken from autoconf.cfg by: +# (c) 2005--2008 Martin Mares +# (c) 2006 Robert Spalek + +# 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"};