Commit dff4b436 authored by Sebastian Ohlmann's avatar Sebastian Ohlmann
Browse files

Add switch --enable-python to configure.ac

By default, python wrapper is not built, only if this switch is
specified.
parent eafc2a15
...@@ -613,6 +613,7 @@ endif ...@@ -613,6 +613,7 @@ endif
#test_c_cannon@SUFFIX@_CFLAGS = $(test_program_cflags) #test_c_cannon@SUFFIX@_CFLAGS = $(test_program_cflags)
# python wrapper # python wrapper
if WITH_PYTHON
pyelpadir = $(pythondir)/pyelpa pyelpadir = $(pythondir)/pyelpa
pyelpa_PYTHON = python/__init__.py python/distributedmatrix.py pyelpa_PYTHON = python/__init__.py python/distributedmatrix.py
pyelpa_LTLIBRARIES = wrapper.la pyelpa_LTLIBRARIES = wrapper.la
...@@ -623,6 +624,7 @@ wrapper_la_CFLAGS = -I$(PYTHON_INCLUDE) $(AM_CFLAGS) ...@@ -623,6 +624,7 @@ wrapper_la_CFLAGS = -I$(PYTHON_INCLUDE) $(AM_CFLAGS)
python/wrapper.c: python/wrapper.pyx python/wrapper.c: python/wrapper.pyx
cython $< cython $<
endif
# test scripts # test scripts
......
...@@ -1275,21 +1275,39 @@ else ...@@ -1275,21 +1275,39 @@ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
AM_PATH_PYTHON([3.6]) AC_MSG_CHECKING(whether --enable-python is specified)
AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config]) AC_ARG_ENABLE([python],
AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config]) AS_HELP_STRING([--enable-python],
AS_IF([test -z "$PYTHON_INCLUDE"], [ [build and install python wrapper, default no.]),
AS_IF([test -z "$PYTHON_CONFIG"], [ [
AC_PATH_PROGS([PYTHON_CONFIG], if test x"$enableval" = x"yes"; then
[python$PYTHON_VERSION-config python-config], enable_python=yes
[no], else
[`dirname $PYTHON`]) enable_python=no
AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON.])]) fi
]) ],
AC_MSG_CHECKING([python include flags]) [enable_python=no])
PYTHON_INCLUDE=`$PYTHON_CONFIG --includes` AC_MSG_RESULT([${enable_python}])
AC_MSG_RESULT([$PYTHON_INCLUDE]) AM_CONDITIONAL([WITH_PYTHON],[test x"$enable_python" = x"yes"])
]) if test x"${enable_python}" = x"yes"; then
AC_DEFINE([WITH_PYTHON], [1], [build and install python wrapper])
# check for python and dependencies
AM_PATH_PYTHON([3.6])
AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
AS_IF([test -z "$PYTHON_INCLUDE"], [
AS_IF([test -z "$PYTHON_CONFIG"], [
AC_PATH_PROGS([PYTHON_CONFIG],
[python$PYTHON_VERSION-config python-config],
[no],
[`dirname $PYTHON`])
AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON.])])
])
AC_MSG_CHECKING([python include flags])
PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
AC_MSG_RESULT([$PYTHON_INCLUDE])
])
fi
AC_OUTPUT AC_OUTPUT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment