]> mj.ucw.cz Git - libucw.git/commitdiff
Configure: Partial support for CONFIG_LOCAL and PREFIX.
authorMartin Mares <mj@ucw.cz>
Wed, 25 Jun 2008 13:57:32 +0000 (15:57 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 25 Jun 2008 14:23:36 +0000 (16:23 +0200)
The configure script sets up INSTALL_PREFIX properly, but it is not
used anywhere yet.

Choose soname embedded in the shared libraries differently for a local
and global installation.

lib/autoconf.cfg

index 2bf1798bdef07f9a060f958dab33d7b28859082c..8236265cbaf4d8a530510f78195f8d78205abfe7 100644 (file)
@@ -1,7 +1,21 @@
 # Automatic configuration of the UCW Library
-# (c) 2005--2007 Martin Mares <mj@ucw.cz>
+# (c) 2005--2008 Martin Mares <mj@ucw.cz>
 # (c) 2006 Robert Spalek <robert@ucw.cz>
 
+### Installation prefix ###
+
+Log "Determining installation prefix ... ";
+if (IsSet("CONFIG_LOCAL")) {
+       Log "local build\n";
+       Set("INSTALL_PREFIX", "");
+} else {
+       Set("PREFIX", "/usr/local") unless IsSet("PREFIX");
+       my $ipx = Get("PREFIX");
+       $ipx =~ s{/$}{};
+       Set("INSTALL_PREFIX", "$ipx/");
+       Log Get("PREFIX") . "\n";
+}
+
 ### OS ###
 
 Test("OS", "Checking on which OS we run", sub {
@@ -186,10 +200,15 @@ 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 lib/$(@F) -undefined dynamic_lookup');
+       Set("LSHARED" => '-dynamiclib -install_name $(SONAME_PREFIX)$(@F) -undefined dynamic_lookup');
 } else {
-       Set("LSHARED" => '-shared -Wl,-soname,lib/$(@F)');
+       Set("LSHARED" => '-shared -Wl,-soname,$(SONAME_PREFIX)$(@F)');
 }
 
 # Extra switches depending on GCC version: