From: Gilles DAVID Date: Fri, 17 Nov 2017 15:28:14 +0000 (+0100) Subject: Update python.m4 macro to fix Python libraries detection with native Python X-Git-Tag: V9_0_0~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8c3b0f3e2734b02eb685e64921bf930611272728;p=modules%2Fkernel.git Update python.m4 macro to fix Python libraries detection with native Python --- diff --git a/salome_adm/unix/config_files/python.m4 b/salome_adm/unix/config_files/python.m4 index bba9fabf5..833f4c90a 100644 --- a/salome_adm/unix/config_files/python.m4 +++ b/salome_adm/unix/config_files/python.m4 @@ -37,25 +37,26 @@ dnl a `module'. AC_DEFUN([CHECK_PYTHON], [ + AC_BEFORE([$0],[AM_PATH_PYTHON]) + AC_REQUIRE([AC_LINKER_OPTIONS])dnl + python_ok=yes AM_PATH_PYTHON([3]) - AC_CHECKING([local Python configuration]) - - AC_REQUIRE([AC_LINKER_OPTIONS])dnl - - PYTHON_PREFIX=`echo $PYTHON | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` - PYTHON_PREFIX=`echo $PYTHON_PREFIX | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` - PYTHONHOME=$PYTHON_PREFIX - - changequote(<<, >>)dnl - PYTHON_ABIFLAGS=`$PYTHON -c "import sys; print(sys.abiflags)"` - changequote([, ])dnl - - AC_SUBST(PYTHON_PREFIX) - AC_SUBST(PYTHONHOME) - AC_SUBST(PYTHON_ABIFLAGS) + AC_MSG_NOTICE([local Python configuration]) + + AC_SUBST([python_bin], + [`basename ${PYTHON}`] ) + + AC_SUBST([PYTHON_ABIFLAGS], + [`${PYTHON} -c "import sys; print (sys.abiflags)"`] ) + + AC_SUBST([PYTHON_PREFIX], + [`${PYTHON} -c "import sys; print (sys.prefix)"`] ) + + AC_SUBST([PYTHONHOME], + [`${PYTHON} -c "import sys; print (sys.prefix)"`] ) PY_MAKEFILE=${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config/Makefile if test ! -f "$PY_MAKEFILE"; then @@ -89,6 +90,11 @@ AC_DEFUN([CHECK_PYTHON], PYTHON_LIB=$PYTHON_LIBS PYTHON_LIBA=${PYTHON_PREFIX}/lib64/python$PYTHON_VERSION/config/libpython$PYTHON_VERSION.a fi + if test "$PY_MAKEFILE" = "${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config-${PYTHON_VERSION}${PYTHON_ABIFLAGS}-${build_cpu}-${build_os}/Makefile" ; then + PYTHON_LIBS="-L${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/config-${PYTHON_VERSION}${PYTHON_ABIFLAGS}-${build_cpu}-${build_os} -lpython${PYTHON_VERSION}${PYTHON_ABIFLAGS}" + PYTHON_LIB=$PYTHON_LIBS + PYTHON_LIBA=${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config-${PYTHON_VERSION}${PYTHON_ABIFLAGS}-${build_cpu}-${build_os}/libpython${PYTHON_VERSION}${PYTHON_ABIFLAGS}.a + fi fi dnl At times (like when building shared libraries) you may want