acinclude.m4 1.0 KB

123456789101112131415161718192021222324252627282930
  1. ## Add your own autoconf macros here.
  2. ## Find the install dirs for the python installation.
  3. ## By James Henstridge
  4. dnl a macro to check for ability to create python extensions
  5. dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
  6. dnl function also defines PYTHON_INCLUDES
  7. AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
  8. [AC_REQUIRE([AM_PATH_PYTHON])
  9. AC_MSG_CHECKING(for headers required to compile python extensions)
  10. dnl deduce PYTHON_INCLUDES
  11. py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
  12. py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
  13. PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
  14. if test "$py_prefix" != "$py_exec_prefix"; then
  15. PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
  16. fi
  17. AC_SUBST(PYTHON_INCLUDES)
  18. dnl check if the headers exist:
  19. save_CPPFLAGS="$CPPFLAGS"
  20. CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
  21. AC_TRY_CPP([#include <Python.h>],dnl
  22. [AC_MSG_RESULT(found)
  23. $1],dnl
  24. [AC_MSG_RESULT(not found)
  25. $2])
  26. CPPFLAGS="$save_CPPFLAGS"
  27. ])