Skip to content

Instantly share code, notes, and snippets.

@wesyoung
Created March 5, 2014 12:56
Show Gist options
  • Save wesyoung/9366653 to your computer and use it in GitHub Desktop.
Save wesyoung/9366653 to your computer and use it in GitHub Desktop.
dnl **************************************************
dnl * Python support *
dnl **************************************************
AC_ARG_WITH(python, AC_HELP_STRING(--with-python@<:@=PATH@:>@, Enable support for python binding @<:@default=auto@:>@),
[python_required=true; if test x$withval = xyes; then with_python="python"; fi], with_python="python")
if test x$with_python != xno; then
AC_PATH_PROG(PYTHON, `basename $with_python`, no, `dirname $with_python`:$PATH)
if test x$PYTHON = xno; then
if test x$python_required = xtrue; then
AC_MSG_ERROR([Could not find $with_python binary])
fi
with_python=no
else
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I`$PYTHON -c 'from distutils.sysconfig import get_python_inc; print get_python_inc()'`"
AC_CHECK_HEADER(Python.h, with_python=yes, with_python=no)
CPPFLAGS="$old_CPPFLAGS"
fi
fi
AM_CONDITIONAL(HAVE_PYTHON, test x$with_python = xyes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment