AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ])
AM_PATH_PYTHON([3.0], , [AC_MSG_ERROR(Python3 is not available or is not the default Python interpreter on your system. See the README file to learn how to override your distribution's default Python interpreter.)])
+ AM_PATH_PYTHON_MODULES([PYTHON])
+ # pythondir is the path where extra modules are to be installed
+ pythondir=$PYTHON_PREFIX/$PYTHON_MODULES_PATH
+ # pyexecdir is the path that contains shared objects used by the extra modules
+ pyexecdir=$PYTHON_EXEC_PREFIX/$PYTHON_MODULES_PATH
AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
AS_IF([test -z "$PYTHON_INCLUDE"], [
--- /dev/null
+# python_modules.m4 -- Get the Python modules install path
+#
+# Copyright (C) 2014 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# While extra Python modules are generaly installed in the Python
+# interpreter's "site-packages" directory, Debian prefers using the
+# "dist-packages" nomenclature. This macro uses the interpreter
+# designated by the PYTHON variable to check the interpreter's PATH
+# and sets the PYTHON_MODULES_PATH by taking the prefix into account.
+
+# AM_PATH_PYTHON_MODULES(PYTHON)
+# ---------------------------------------------------------------------------
+AC_DEFUN([AM_PATH_PYTHON_MODULES],
+ [prog="import sys
+for path in sys.path:
+ if path.endswith(\"-packages\"):
+ print(path[[path.find(\"/lib\"):]])
+ break"
+ PYTHON_MODULES_PATH=`${$1} -c "$prog"`])