Skip to content

Commit

Permalink
Adjust configure.ac script to detect whether pybind11 is provided by …
Browse files Browse the repository at this point in the history
…the system. Fall back to use the one shipped with the sources if nothing is found.
  • Loading branch information
codereader committed Aug 18, 2017
1 parent ae30c1c commit 87d6297
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
21 changes: 17 additions & 4 deletions configure.ac
Expand Up @@ -187,15 +187,28 @@ then
# pybind11.h is including Python.h, need to help it find the Python.h header
CPPFLAGS="$USER_CPPFLAGS $PYTHON_CPPFLAGS $PYBIND11_CPPFLAGS"

AC_CHECK_HEADER([pybind11/pybind11.h], [],
[AC_MSG_ERROR([Missing pybind11.h, please install the pybind11 package for your system. \
If there's no pybind11 package for your distribution, please download it from the pybind11 \
website and specify the path to the include folder using --with-pybind11=/path/to/pybind11/include])])
AC_MSG_NOTICE([Checking for pybind11 headers...])
found_local_pybind11=no

# Check for a system-provided pybind11, otherwise fall back on
# the pybind11 headers we ship in the libs/pybind folder
AC_CHECK_HEADER([pybind11/pybind11.h], [found_local_pybind11=yes], [found_local_pybind11=no])

if test "$found_local_pybind11" = 'yes'
then
AC_MSG_NOTICE([Using the system-provided pybind11 headers])
else
AC_MSG_NOTICE([Using the pybind11 headers shipped with the sources])
fi

AM_CONDITIONAL([SYSTEM_HAS_PYBIND11], [test "$found_local_pybind11" = 'yes'])

script_module='script'
AC_SUBST([script_module])
AC_SUBST([PYTHON_CPPFLAGS])
AC_SUBST([PYTHON_LIBS])
AC_SUBST([PYBIND11_CPPFLAGS])
AC_SUBST([SYSTEM_HAS_PYBIND11]) # Used by Makefile.am in plugins/script/
fi
fi

Expand Down
6 changes: 6 additions & 0 deletions plugins/script/Makefile.am
@@ -1,3 +1,9 @@

# If system doesn't provide pybind11, fall back to the pybind11 headers we ship in the libs/pybind folder
if !SYSTEM_HAS_PYBIND11
PYBIND11_CPPFLAGS += -I$(top_srcdir)/libs/pybind
endif

AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs \
$(XML_CFLAGS) \
$(PYTHON_CPPFLAGS) \
Expand Down

0 comments on commit 87d6297

Please sign in to comment.