]> SALOME platform Git repositories - tools/configuration.git/commitdiff
Salome HOME
Update python.m4 macro to fix Python libraries detection with native Python
authorGilles DAVID <gilles-g.david@edf.fr>
Fri, 17 Nov 2017 15:28:43 +0000 (16:28 +0100)
committerGilles DAVID <gilles-g.david@edf.fr>
Fri, 17 Nov 2017 15:28:43 +0000 (16:28 +0100)
autotools/m4/python.m4

index bba9fabf59ba2d3ae3721799becb9d65d5b58db4..833f4c90ae227764ca8ca6ebe3da685d5b492ca4 100644 (file)
@@ -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