From 3d65b710e82d9566813b40587fc237996b4a5213 Mon Sep 17 00:00:00 2001 From: lhausamm <loic_hausammann@hotmail.com> Date: Thu, 16 Nov 2017 10:12:44 +0100 Subject: [PATCH] Add configure option --with-python --- configure.ac | 32 ++++++++++++++++++++++++++++++++ src/Makefile.am | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bb535b82cb..03783f01ba 100644 --- a/configure.ac +++ b/configure.ac @@ -78,6 +78,38 @@ if test "$enable_ipo" = "yes"; then fi fi +# Compiling with Python wrapper +AC_ARG_WITH([python], + [AS_HELP_STRING([--with-python=PATH], + [Root directory of python3] + )], + [], + [with_python="no"] +) + +have_python="no" +if test "x$with_python" != "xno"; then + if test "x$with_python" != "xyes" -a "x$with_python" != "x"; then + PYTHON_INCS="-I$with_python/include/python3.6m/" + else + PYTHON_INCS="" + fi + + OLD_CPPFLAGS="$CPPFLAGS" + + CPPFLAGS="$CPPFLAGS $PYTHON_INCS" + + have_python="yes" + AC_SUBST([PYTHON_INCS]) + AC_CHECK_HEADER( + Python.h, + AC_DEFINE([SWIFT_PYTHON_WRAPPER],1,[Enable the python wrapper]), + AC_MSG_ERROR(something is wrong with the python library! PYTHON_INCS=$PYTHON_INCS) + ) + CPPFLAGS="$OLD_CPPFLAGS" +fi + + # Check for MPI. Need to do this before characterising the compiler (C99 mode), # as this changes the compiler. # We should consider using AX_PROG_CC_MPI to replace AC_PROG_CC when compiling diff --git a/src/Makefile.am b/src/Makefile.am index 7fc5981ebd..42c30883e1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Add the debug flag to the whole thing -AM_CFLAGS = $(HDF5_CPPFLAGS) +AM_CFLAGS = $(HDF5_CPPFLAGS) $(PYTHON_INCS) # Assign a "safe" version number AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) -version-info 0:0:0 -- GitLab