From 61bd143910001aaf610416d7ca56c52c0b081318 Mon Sep 17 00:00:00 2001
From: Kumar Gala <galak@kernel.crashing.org>
Date: Thu, 11 Aug 2011 01:26:33 -0500
Subject: [PATCH] automake: Update for python.m4 to respect libdir

Upstream-Status: Inappropriate [embedded specific]

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

Updated for automake-1.12.6

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>

---
 m4/python.m4 | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/m4/python.m4 b/m4/python.m4
index b2302ba..dbc6954 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -96,12 +96,13 @@ AC_DEFUN([AM_PATH_PYTHON],
     [am_cv_python_version=`$PYTHON -c "import sys; print('%u.%u' % sys.version_info[[:2]])"`])
   AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
 
-  dnl Use the values of $prefix and $exec_prefix for the corresponding
-  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
+  dnl Use the values of $prefix, $libdir and $exec_prefix for the corresponding
+  dnl values of PYTHON_PREFIX PYTHON_LIB_PREFIX, and PYTHON_EXEC_PREFIX.  These are made
   dnl distinct variables so they can be overridden if need be.  However,
   dnl general consensus is that you shouldn't need this ability.
 
   AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
+  AC_SUBST([PYTHON_LIB_PREFIX], ['${libdir}'])
   AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
 
   dnl At times (like when building shared libraries) you may want
@@ -146,14 +147,7 @@ except ImportError:
      else
        am_py_prefix=$prefix
      fi
-     am_cv_python_pythondir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
-    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
-else:
-    from distutils import sysconfig
-    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
-sys.stdout.write(sitedir)"`
+     am_cv_python_pythondir=`echo "$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages"`
      case $am_cv_python_pythondir in
      $am_py_prefix*)
        am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
@@ -163,7 +157,7 @@ sys.stdout.write(sitedir)"`
        case $am_py_prefix in
          /usr|/System*) ;;
          *)
-	  am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
+	  am_cv_python_pythondir=$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages
 	  ;;
        esac
        ;;
@@ -188,14 +182,7 @@ sys.stdout.write(sitedir)"`
      else
        am_py_exec_prefix=$exec_prefix
      fi
-     am_cv_python_pyexecdir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
-    sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
-else:
-    from distutils import sysconfig
-    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
-sys.stdout.write(sitedir)"`
+     am_cv_python_pyexecdir=`echo "$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages"`
      case $am_cv_python_pyexecdir in
      $am_py_exec_prefix*)
        am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
@@ -205,7 +192,7 @@ sys.stdout.write(sitedir)"`
        case $am_py_exec_prefix in
          /usr|/System*) ;;
          *)
-	   am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
+	   am_cv_python_pyexecdir=$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages
 	   ;;
        esac
        ;;
