]> mj.ucw.cz Git - libucw.git/commitdiff
Split autoconf.cfg
authorMichal Vaner <vorner@ucw.cz>
Sat, 4 Oct 2008 10:17:36 +0000 (12:17 +0200)
committerMichal Vaner <vorner@ucw.cz>
Wed, 8 Oct 2008 12:54:29 +0000 (14:54 +0200)
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.

free/libs/configure
free/libs/examples/internal/configure
ucw/autoconf.cfg
ucw/paths.cfg [new file with mode: 0644]
ucw/ucw.cfg [new file with mode: 0644]

index 3934fef4c34dba3cf7993a1f341629ec3fa101cb..a359da281800638055b798e531eeb050949d8a83 100755 (executable)
@@ -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";
index 1e93b7eabdff0c36ef762516df2b983c07c028ff..034d43d62d020c47ad30caa74c008eab4058a269 100755 (executable)
@@ -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";
index 854bd7b9cbd4917fcdf3f1f0047f51192131597e..b28be8341a65c211b84ba08e950d82e173af3efa 100644 (file)
@@ -1,38 +1,7 @@
-# Automatic configuration of the UCW Library
+# Automatic configuration, OS & CPU detection part
 # (c) 2005--2008 Martin Mares <mj@ucw.cz>
 # (c) 2006 Robert Spalek <robert@ucw.cz>
-
-### 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 <vorner@ucw.cz>
 
 ### 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 (file)
index 0000000..199401d
--- /dev/null
@@ -0,0 +1,38 @@
+# 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;
diff --git a/ucw/ucw.cfg b/ucw/ucw.cfg
new file mode 100644 (file)
index 0000000..c79844b
--- /dev/null
@@ -0,0 +1,46 @@
+# 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"};