dnl Copyright (C) 2006-2016 CEA/DEN, EDF R&D 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 dnl @synopsis AC_PYTHON_DEVEL() dnl Checks for Python and tries to get the include path to 'Python.h'. dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output variable. dnl @authors Sebastian Huber , Alan W. Irwin dnl , Rafael Laboissiere and dnl Andrew Collier . dnl AC_DEFUN([CHECK_PYTHON],[ # # should allow for checking of python version here... # AC_REQUIRE([AM_PATH_PYTHON]) case `uname -m` in *64) LIB="64" ;; *) LIB="" ;; esac # Check for Python include path AC_MSG_CHECKING([for Python include path]) python_path=`echo $PYTHON | sed "s,/bin.*$,,"` for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do python_path=`find $i -type f -name Python.h -print | sed "1q"` if test -n "$python_path" ; then break fi done python_path=`echo $python_path | sed "s,/Python.h$,,"` AC_MSG_RESULT([$python_path]) if test -z "$python_path" ; then AC_MSG_ERROR([cannot find Python include path]) fi AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path]) # Check for Python library path AC_MSG_CHECKING([for Python library path]) python_path=`echo $PYTHON | sed "s,/bin.*$,,"` for i in "$python_path/lib${LIB}/python$PYTHON_VERSION/config/" "$python_path/lib${LIB}/python$PYTHON_VERSION/" "$python_path/lib{LIB}/python/config/" "$python_path/lib${LIB}/python/" "$python_path/" ; do python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"` if test -n "$python_path" ; then break fi done python_path=`echo $python_path | sed "s,/libpython.*$,,"` AC_MSG_RESULT([$python_path]) if test -z "$python_path" ; then AC_MSG_ERROR([cannot find Python library path]) fi AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"]) # python_site=`echo $python_path | sed "s/config/site-packages/"` AC_SUBST([PYTHON_SITE_PKG],[$python_site]) # # libraries which must be linked in when embedding # AC_MSG_CHECKING(python extra libraries) PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print(conf('LOCALMODLIBS')+' '+conf('LIBS'))" AC_MSG_RESULT($PYTHON_EXTRA_LIBS)` AC_SUBST(PYTHON_EXTRA_LIBS) ])