build: autoconf: fix libdir detection
authorRoger Pau Monne <roger.pau@entel.upc.edu>
Thu, 1 Mar 2012 16:59:33 +0000 (16:59 +0000)
committerRoger Pau Monne <roger.pau@entel.upc.edu>
Thu, 1 Mar 2012 16:59:33 +0000 (16:59 +0000)
If user specifies a libdir it is used, if no libdir is specified
configure checks if $exec_prefix/lib64 is a directory and uses that,
if not lib is used.

$prefix is set by passing the command line option or by default when
calling AC_OUTPUT, but since AC_OUTPUT is called at the end, this is
not really helpful, so we have to set $exec_prefix manually to the
correct value, either $prefix if different than NONE or
$ac_default_prefix.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/configure
tools/m4/default_lib.m4

index 39bf1f35a4e62128a8623229842cc1edb1a7f6de..b1bad1323ab9bde3ddb995307944f6fbfa11d37f 100755 (executable)
@@ -3840,7 +3840,6 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
-
 
 
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
@@ -6437,13 +6436,26 @@ $as_echo "yes" >&6; }
 fi
 
 # Check library path
-if test -d "$prefix/lib64"; then :
+if test "\${exec_prefix}/lib" = "$libdir"; then :
+  if test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"; then :
+  exec_prefix=$prefix
+fi
+    if test "$exec_prefix" = "NONE"; then :
+  exec_prefix=$ac_default_prefix
+fi
+    if test -d "${exec_prefix}/lib64"; then :
+
+        LIB_PATH="lib64"
 
-    LIB_PATH="lib64"
+else
+
+        LIB_PATH="lib"
+
+fi
 
 else
 
-    LIB_PATH="lib"
+    LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}"
 
 fi
 
index b551619205db50f9546b0d63f013245da1d1f852..2e986836d84e1f6c99ae18294ca00213ff0ebe26 100644 (file)
@@ -1,8 +1,14 @@
 AC_DEFUN([AX_DEFAULT_LIB],
-[AS_IF([test -d "$prefix/lib64"], [
-    LIB_PATH="lib64"
-],[
-    LIB_PATH="lib"
+[AS_IF([test "\${exec_prefix}/lib" = "$libdir"],
+    [AS_IF([test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"],
+        [exec_prefix=$prefix])
+    AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix=$ac_default_prefix])
+    AS_IF([test -d "${exec_prefix}/lib64"], [
+        LIB_PATH="lib64"
+    ],[
+        LIB_PATH="lib"
+    ])
+], [
+    LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}"
 ])
 AC_SUBST(LIB_PATH)])
-