[beast: 1/14] BUILD: check for python-dev and python >= 2.7



commit e2d98f59fa6f398f9e2d395ef33c60fe68af9ba2
Author: Tim Janik <timj gnu org>
Date:   Tue Nov 24 13:39:53 2015 +0100

    BUILD: check for python-dev and python >= 2.7
    
    Signed-off-by: Tim Janik <timj gnu org>

 configure.ac |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 39c36a5..3fae9e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -631,10 +631,27 @@ else
 fi
 AC_SUBST(DEFINE__FILE_DIR__)
 
-MC_ASSERT_PROG(PYTHON, python2.7)
-if test -z "$PYTHON" || $PYTHON -c "import sys; sys.exit (sys.hexversion >= 0x2070500)" 2>/dev/null ; then
-  AC_MSG_ERROR([failed to detect python (version >= 2.7.5)])
-fi
+dnl # MC_PYTHON_REQUIREMENTS() - python checks
+AC_DEFUN([MC_PYTHON_REQUIREMENTS],
+[
+  PYTHON_REQUIRED=2.7
+  AM_PATH_PYTHON($PYTHON_REQUIRED)
+  dnl # AC_REQUIRE([AC_PYTHON_DEVEL]) # AC_PYTHON_DEVEL is usually provided by autoconf-archive
+  AC_PYTHON_DEVEL([>= $PYTHON_REQUIRED])
+  AC_MSG_CHECKING([for working Python extension compilation])
+  PYTHON_CPPFLAGS="$PYTHON_CPPFLAGS -fno-strict-aliasing" # needed by Python headers
+  saved_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS -Wall -Werror"     # verify sane Python module builds
+  AC_TRY_COMPILE([#include <Python.h>], [Py_InitModule(0,0);], py_build=ok, py_build=failed)
+  CPPFLAGS="$saved_CPPFLAGS"
+  AC_MSG_RESULT($py_build)
+  if test "$py_build" != "ok" ; then
+    AC_MSG_ERROR([failed to build extension against Python (>=$PYTHON_REQUIRED) headers])
+  fi
+  if test -z "$PYTHON" || $PYTHON -c "import sys; sys.exit (sys.hexversion >= 0x2070500)" 2>/dev/null ; then
+    AC_MSG_ERROR([failed to detect python (version >= 2.7.5)])
+  fi
+])
 
 AC_MSG_CHECKING(whether source dir equals build dir)
 TEST_SRCDIR=`cd $srcdir ; /bin/pwd`
@@ -664,6 +681,7 @@ MC_BSE_REQUIREMENTS
 MC_ASOUND_CHECK
 MC_BSESCM_REQUIREMENTS
 MC_BSE_SNDDEV_CHECK
+MC_PYTHON_REQUIREMENTS
 MC_GXK_REQUIREMENTS
 MC_BEAST_REQUIREMENTS
 MC_SUIDMAIN_REQUIREMENTS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]