URL: https://github.com/SSSD/sssd/pull/819
Author: sumit-bose
 Title: #819: BUILD: fix libpython handling in Python3.8
Action: opened

PR body:
"""
Related to https://pagure.io/SSSD/sssd/issue/4016
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/819/head:pr819
git checkout pr819
From 509a20a15a10fb48e8ee51063e13c945b5102413 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sb...@redhat.com>
Date: Fri, 24 May 2019 17:23:04 +0200
Subject: [PATCH] BUILD: fix libpython handling in Python3.8

Related to https://pagure.io/SSSD/sssd/issue/4016
---
 Makefile.am            |  1 +
 configure.ac           |  1 +
 src/external/python.m4 | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 9614334643..3094b71711 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2258,6 +2258,7 @@ dlopen_tests_CFLAGS = \
     $(CHECK_CFLAGS)
 dlopen_tests_LDADD = \
     $(LIBADD_DL) \
+    $(PYTHON3_EMBED_LIBS) \
     $(CHECK_LIBS)
 
 EXTRA_sysdb_tests_DEPENDENCIES = \
diff --git a/configure.ac b/configure.ac
index e3306524b5..506ed7cb8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -366,6 +366,7 @@ them please use argument --without-python3-bindings when running configure.])])
     AC_SUBST([python3dir], [$pythondir])
     AC_SUBST([PYTHON3_CFLAGS], [$PYTHON_CFLAGS])
     AC_SUBST([PYTHON3_LIBS], [$PYTHON_LIBS])
+    AC_SUBST([PYTHON3_EMBED_LIBS], [$PYTHON_EMBED_LIBS])
     AC_SUBST([PYTHON3_INCLUDES], [$PYTHON_INCLUDES])
     AC_SUBST([PYTHON3_VERSION], [$PYTHON_VERSION])
     AC_SUBST([PYTHON3_PREFIX], [$PYTHON_PREFIX])
diff --git a/src/external/python.m4 b/src/external/python.m4
index be4e3b2e81..0e455ffa11 100644
--- a/src/external/python.m4
+++ b/src/external/python.m4
@@ -18,6 +18,25 @@ path. If you want to build sssd without $1 bindings then specify
     PYTHON_CFLAGS="` $PYTHON_CONFIG --cflags`"
     PYTHON_LIBS="` $PYTHON_CONFIG --libs`"
     PYTHON_INCLUDES="` $PYTHON_CONFIG --includes`"
+    # With python3.8 it is expected that C extension do not link against
+    # libpythonX.Y anymore but only the application loading the extension links
+    # the library. pyhton3.8-config adds a new option --embed for this use
+    # case. See
+    # https://docs.python.org/dev/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
+    # for details. Since the dlopen-test checks the python modules as well we
+    # have to make sure that it links libpythonX.Y.
+    #
+    # To build the Python modules PYTHON_LIBS must be used, python-config will
+    # take care that this does not include libpythonX.Y for Python3.8.
+    #
+    # For dlopen-test PYTHON_EMBED_LIBS must be used. It is either empty or
+    # contains libpythonX.Y and other dependencies if needed.
+
+    PYTHON_EMBED_LIBS=""
+    $PYTHON_CONFIG --libs --embed 1> /dev/null 2> /dev/null
+    if test $? -eq 0; then
+        PYTHON_EMBED_LIBS="` $PYTHON_CONFIG --libs --embed`"
+    fi
 ])
 
 dnl Taken from GNOME sources
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org

Reply via email to