Salome HOME
[PY3] Fix m4 macro for python 3
[modules/kernel.git] / salome_adm / unix / config_files / python.m4
index 0f3e0cf8415fd06efb75e76bb5cd2179c36e4abe..fc21aa35b86dae5835842728bab659ba20c2a18b 100644 (file)
@@ -1,24 +1,25 @@
-dnl  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-dnl  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-dnl 
-dnl  This library is free software; you can redistribute it and/or 
-dnl  modify it under the terms of the GNU Lesser General Public 
-dnl  License as published by the Free Software Foundation; either 
-dnl  version 2.1 of the License. 
-dnl 
-dnl  This library is distributed in the hope that it will be useful, 
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-dnl  Lesser General Public License for more details. 
-dnl 
-dnl  You should have received a copy of the GNU Lesser General Public 
-dnl  License along with this library; if not, write to the Free Software 
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-dnl 
-dnl  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+dnl Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 dnl
+dnl Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
 dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
 ## ------------------------
 ## Python file handling
 ## From Andrew Dalke
@@ -58,11 +59,20 @@ AC_DEFUN([CHECK_PYTHON],
   AC_SUBST(PYTHONHOME)
 
   changequote(<<, >>)dnl
-  PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+  PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[:3])"`
   changequote([, ])dnl
   AC_SUBST(PYTHON_VERSION)
 
   PY_MAKEFILE=${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config/Makefile
+  if test ! -f "$PY_MAKEFILE"; then
+    # For Ubuntu >= 13.04
+    PY_MAKEFILE=${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config-${build_cpu}-${build_os}/Makefile
+  fi
+  if test ! -f "$PY_MAKEFILE"; then
+    if test "${build_cpu::6}" = "x86_64" ; then
+      PY_MAKEFILE=${PYTHON_PREFIX}/lib64/python$PYTHON_VERSION/config/Makefile
+    fi
+  fi
   if test ! -f "$PY_MAKEFILE"; then
      AC_MSG_WARN([*** Couldn't find ${PY_MAKEFILE}.  Maybe you are
 *** missing the development portion of the python installation])
@@ -76,12 +86,19 @@ AC_DEFUN([CHECK_PYTHON],
   PYTHON_LIBS="-L${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
   PYTHON_LIB=$PYTHON_LIBS
   PYTHON_LIBA=${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config/libpython$PYTHON_VERSION.a
+  if test "${build_cpu::6}" = "x86_64" ; then
+    if test "$PY_MAKEFILE" = "${PYTHON_PREFIX}/lib64/python$PYTHON_VERSION/config/Makefile" ; then
+      PYTHON_LIBS="-L${PYTHON_PREFIX}/lib64/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
+      PYTHON_LIB=$PYTHON_LIBS
+      PYTHON_LIBA=${PYTHON_PREFIX}/lib64/python$PYTHON_VERSION/config/libpython$PYTHON_VERSION.a
+    fi
+  fi
 
   dnl At times (like when building shared libraries) you may want
   dnl to know which OS Python thinks this is.
 
   AC_SUBST(PYTHON_PLATFORM)
-  PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
+  PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
 
   AC_SUBST(PYTHON_SITE)
   AC_ARG_WITH(python-site,