summaryrefslogtreecommitdiff
blob: 43e349b68a38f472d39903a91759734ef2e9a433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 750f1489360a34b80f963eddb5af77b1cc51a1c3 Mon Sep 17 00:00:00 2001
From: Pacho Ramos <pacho@condmat1.ciencias.uniovi.es>
Date: Sat, 29 Dec 2012 17:13:05 +0100
Subject: [PATCH 1/2] Speed up python path detection

---
 acinclude.m4 | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index c4996ee..fadbf2c 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -85,14 +85,8 @@ CPPFLAGS="$save_CPPFLAGS"
 
 	# Check for Python library path
         AC_MSG_CHECKING([for Python library path])
-        python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
-        for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
-                python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
-                if test -n "$python_path" ; then
-                        break
-                fi
-        done
-        python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+	[python_path=`$PYTHON -c 'import distutils.sysconfig, os; \
+		print(os.path.sep.join(distutils.sysconfig.get_python_lib(standard_lib=True).split(os.path.sep)[:-1]))'`]
         AC_MSG_RESULT([$python_path])
         if test -z "$python_path" ; then
                 AC_MSG_ERROR([cannot find Python library path])
-- 
1.8.2.1