[gobject-introspection: 1/2] configure.ac: Don't hardcode the Python C-ext file extension



commit 2d34d90fda8a96a9e37ae5f3fdd6900c6a388bfa
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Thu Jun 21 10:12:50 2018 +0200

    configure.ac: Don't hardcode the Python C-ext file extension
    
    .pyd doesn't work with Python 3 on Windows, ask Python for what file extension
    it expects instead of hardcoding it.

 Makefile-giscanner.am | 6 ++----
 configure.ac          | 3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am
index c144fe54..289585b5 100644
--- a/Makefile-giscanner.am
+++ b/Makefile-giscanner.am
@@ -114,15 +114,13 @@ _giscanner_la_LDFLAGS = \
 
 if OS_WIN32
 # Windows requires Python extension modules to be explicitly
-# linked to libpython. Extension modules are shared libaries
-# (.dll files), but need to be called .pyd for Python to load
-# them as extension modules.
+# linked to libpython.
 _giscanner_la_LIBADD += \
        $(PYTHON_LIBS)
 
 _giscanner_la_LDFLAGS += \
        -no-undefined \
-       -shrext ".pyd"
+       -shrext $(PYTHON_SO)
 endif
 
 _giscanner_la_SOURCES = giscanner/giscannermodule.c
diff --git a/configure.ac b/configure.ac
index fd1347f5..982d9038 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,9 @@ if test "x$os_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 sysconfig, sys; get = sysconfig.get_config_var; 
sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
+AC_SUBST(PYTHON_SO)
+
 dnl Not enabled by default until 3.6 cycle when we can propose mako as
 dnl an external dependency
 AC_ARG_ENABLE(doctool,[  --disable-doctool           disable g-ir-doc-tool ],,enable_doctool=auto)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]