1 ##### http://autoconf-archive.cryp.to/ax_boost_python.html
9 # This macro checks to see if the Boost.Python library is installed.
10 # It also attempts to guess the currect library name using several
11 # attempts. It tries to build the library name using a user supplied
12 # name or suffix and then just the raw library.
14 # If the library is found, HAVE_BOOST_PYTHON is defined and
15 # BOOST_PYTHON_LIB is set to the name of the library.
17 # This macro calls AC_SUBST(BOOST_PYTHON_LIB).
19 # In order to ensure that the Python headers are specified on the
20 # include path, this macro requires AX_PYTHON to be called.
28 # Copyright (c) 2005 Michael Tindal <mtindal@paradoxpoint.com>
30 # This program is free software; you can redistribute it and/or
31 # modify it under the terms of the GNU General Public License as
32 # published by the Free Software Foundation; either version 2 of the
33 # License, or (at your option) any later version.
35 # This program is distributed in the hope that it will be useful, but
36 # WITHOUT ANY WARRANTY; without even the implied warranty of
37 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38 # General Public License for more details.
40 # You should have received a copy of the GNU General Public License
41 # along with this program; if not, write to the Free Software
42 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
45 # As a special exception, the respective Autoconf Macro's copyright
46 # owner gives unlimited permission to copy, distribute and modify the
47 # configure scripts that are the output of Autoconf when processing
48 # the Macro. You need not follow the terms of the GNU General Public
49 # License when using or distributing such scripts, even though
50 # portions of the text of the Macro appear in them. The GNU General
51 # Public License (GPL) does govern all other use of the material that
52 # constitutes the Autoconf Macro.
54 # This special exception to the GPL applies to versions of the
55 # Autoconf Macro released by the Autoconf Macro Archive. When you
56 # make and distribute a modified version of the Autoconf Macro, you
57 # may extend this special exception to the GPL to apply to your
58 # modified version as well.
60 AC_DEFUN([AX_BOOST_PYTHON],
61 [AC_REQUIRE([AX_PYTHON])dnl
62 AC_CACHE_CHECK(whether the Boost::Python library is available,
66 CPPFLAGS_SAVE=$CPPFLAGS
67 if test x$PYTHON_INCLUDE_DIR != x; then
68 CPPFLAGS=-I$PYTHON_INCLUDE_DIR $CPPFLAGS
70 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
71 #include <boost/python/module.hpp>
72 using namespace boost::python;
73 BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]],
75 ac_cv_boost_python=yes, ac_cv_boost_python=no)
77 CPPFLAGS=$CPPFLAGS_SAVE
79 if test "$ac_cv_boost_python" = "yes"; then
80 AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python library is available])
81 ax_python_lib=boost_python
82 AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library or suffix to use]),
83 [if test "x$with_boost_python" != "xno"; then
84 ax_python_lib=$with_boost_python
85 ax_boost_python_lib=boost_python-$with_boost_python
87 for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python; do
88 AC_CHECK_LIB($ax_lib, main, [BOOST_PYTHON_LIB=$ax_lib break])
90 AC_SUBST(BOOST_PYTHON_LIB)