blob: 46b2998a9cb3b09291012bbe5e9f8399bcd49773 [file] [log] [blame] [edit]
--- gimp-2.8.10/configure.ac.orig 2014-02-25 22:03:04.931800000 +0400
+++ gimp-2.8.10/configure.ac 2014-02-25 22:20:04.452800000 +0400
@@ -1805,6 +1805,12 @@
AM_PATH_PYTHON2(python2_required_version,,
[pycheck_error([Python 2 (python2_required_version or newer)], [it])])
AM_CHECK_PYTHON_HEADERS(, [pycheck_error([Python 2 headers], [them])])
+ if test "x$platform_win32" = "xyes"; then
+ AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
+ fi
+
+ PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
+ AC_SUBST(PYTHON_SO)
# Win32 needs all symbols resolved for linking, even for DLLs
# Assume the link library is in $exec_prefix/libs
@@ -1812,11 +1818,8 @@
# not documented so we won't rely on internal implementation
PYLINK_LIBS=
if test "x$platform_win32" = "xyes"; then
- PYBIN_PATH="$py_exec_prefix\pythonw.exe"
- PYTHON_INCLUDES=`echo "$PYTHON_INCLUDES" | sed -e 's/\\\\/\\//g'`
- py_exec_prefix=`echo "$py_exec_prefix" | sed -e 's/\\\\/\\//g'`
- pylibversion=`echo $PYTHON_VERSION | sed -e 's/\\.//'`
- PYLINK_LIBS="-L${py_exec_prefix}/libs -lpython${pylibversion}"
+ PYBIN_PATH="$PYTHON"
+ PYLINK_LIBS="$PYTHON_LIBS"
else
PYBIN_PATH="$PYTHON"
fi
--- gimp-2.10.14/m4macros/pythondev.m4.orig 2014-02-25 22:10:07.300400000 +0400
+++ gimp-2.10.14/m4macros/pythondev.m4 2014-02-25 22:11:52.210400000 +0400
@@ -220,11 +220,14 @@
[AC_REQUIRE([AM_PATH_PYTHON2])
AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES
-py_prefix=`$PYTHON -c "import sys; print(sys.prefix)"`
-py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
-PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
-if test "$py_prefix" != "$py_exec_prefix"; then
- PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+if test "x$PYTHON_INCLUDES" = x; then
+ PYTHON_CONFIG=`which $PYTHON`-config
+ if test -x "$PYTHON_CONFIG"; then
+ PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null`
+ else
+ PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"`
+ PYTHON_INCLUDES="-I$PYTHON_INCLUDES"
+ fi
if test "$PYTHON_PLATFORM" = "win32"; then
dnl Win32 doesn't always have a versioned directory for headers
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include"
@@ -245,3 +245,28 @@
$2])
CPPFLAGS="$save_CPPFLAGS"
])
+
+dnl a macro to check for ability to python
+dnl AM_CHECK_PYTHON_LIBS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl function also defines PYTHON_LIBS
+AC_DEFUN([AM_CHECK_PYTHON_LIBS],
+[AC_REQUIRE([AM_PATH_PYTHON])
+AC_MSG_CHECKING(for libraries required to python)
+dnl deduce PYTHON_LIBS
+py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
+if test "x$PYTHON_LIBS" = x; then
+ PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}"
+fi
+if test "x$PYTHON_LIB_LOC" = x; then
+ PYTHON_LIB_LOC="${py_prefix}/lib"
+fi
+AC_SUBST(PYTHON_LIBS)
+AC_SUBST(PYTHON_LIB_LOC)
+dnl check if the headers exist:
+save_LIBS="$LIBS"
+LIBS="$LIBS $PYTHON_LIBS"
+AC_TRY_LINK_FUNC(Py_Initialize, dnl
+ [LIBS="$save_LIBS"; AC_MSG_RESULT(yes); $1], dnl
+ [LIBS="$save_LIBS"; AC_MSG_RESULT(no); $2])
+
+])