Statistics
| Branch: | Tag: | Revision:

root / config / ax_boost_python.m4 @ 3e4924f2

History | View | Annotate | Download (3.6 kB)

1 2c8ea58e eb
# ===========================================================================
2 2c8ea58e eb
#            http://autoconf-archive.cryp.to/ax_boost_python.html
3 2c8ea58e eb
# ===========================================================================
4 2c8ea58e eb
#
5 2c8ea58e eb
# SYNOPSIS
6 2c8ea58e eb
#
7 2c8ea58e eb
#   AX_BOOST_PYTHON
8 2c8ea58e eb
#
9 2c8ea58e eb
# DESCRIPTION
10 2c8ea58e eb
#
11 2c8ea58e eb
#   This macro checks to see if the Boost.Python library is installed. It
12 2c8ea58e eb
#   also attempts to guess the currect library name using several attempts.
13 2c8ea58e eb
#   It tries to build the library name using a user supplied name or suffix
14 2c8ea58e eb
#   and then just the raw library.
15 2c8ea58e eb
#
16 2c8ea58e eb
#   If the library is found, HAVE_BOOST_PYTHON is defined and
17 2c8ea58e eb
#   BOOST_PYTHON_LIB is set to the name of the library.
18 2c8ea58e eb
#
19 2c8ea58e eb
#   This macro calls AC_SUBST(BOOST_PYTHON_LIB).
20 2c8ea58e eb
#
21 2c8ea58e eb
#   In order to ensure that the Python headers are specified on the include
22 2c8ea58e eb
#   path, this macro requires AX_PYTHON to be called.
23 2c8ea58e eb
#
24 2c8ea58e eb
# LAST MODIFICATION
25 2c8ea58e eb
#
26 2c8ea58e eb
#   2008-04-12
27 2c8ea58e eb
#
28 2c8ea58e eb
# COPYLEFT
29 2c8ea58e eb
#
30 2c8ea58e eb
#   Copyright (c) 2008 Michael Tindal
31 2c8ea58e eb
#
32 2c8ea58e eb
#   This program is free software; you can redistribute it and/or modify it
33 2c8ea58e eb
#   under the terms of the GNU General Public License as published by the
34 2c8ea58e eb
#   Free Software Foundation; either version 2 of the License, or (at your
35 2c8ea58e eb
#   option) any later version.
36 2c8ea58e eb
#
37 2c8ea58e eb
#   This program is distributed in the hope that it will be useful, but
38 2c8ea58e eb
#   WITHOUT ANY WARRANTY; without even the implied warranty of
39 2c8ea58e eb
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
40 2c8ea58e eb
#   Public License for more details.
41 2c8ea58e eb
#
42 2c8ea58e eb
#   You should have received a copy of the GNU General Public License along
43 2c8ea58e eb
#   with this program. If not, see <http://www.gnu.org/licenses/>.
44 2c8ea58e eb
#
45 2c8ea58e eb
#   As a special exception, the respective Autoconf Macro's copyright owner
46 2c8ea58e eb
#   gives unlimited permission to copy, distribute and modify the configure
47 2c8ea58e eb
#   scripts that are the output of Autoconf when processing the Macro. You
48 2c8ea58e eb
#   need not follow the terms of the GNU General Public License when using
49 2c8ea58e eb
#   or distributing such scripts, even though portions of the text of the
50 2c8ea58e eb
#   Macro appear in them. The GNU General Public License (GPL) does govern
51 2c8ea58e eb
#   all other use of the material that constitutes the Autoconf Macro.
52 2c8ea58e eb
#
53 2c8ea58e eb
#   This special exception to the GPL applies to versions of the Autoconf
54 2c8ea58e eb
#   Macro released by the Autoconf Macro Archive. When you make and
55 2c8ea58e eb
#   distribute a modified version of the Autoconf Macro, you may extend this
56 2c8ea58e eb
#   special exception to the GPL to apply to your modified version as well.
57 2c8ea58e eb
58 2c8ea58e eb
AC_DEFUN([AX_BOOST_PYTHON],
59 2c8ea58e eb
[AC_REQUIRE([AX_PYTHON])dnl
60 2c8ea58e eb
AC_CACHE_CHECK(whether the Boost::Python library is available,
61 2c8ea58e eb
ac_cv_boost_python,
62 2c8ea58e eb
[AC_LANG_SAVE
63 2c8ea58e eb
 AC_LANG_CPLUSPLUS
64 2c8ea58e eb
 CPPFLAGS_SAVE=$CPPFLAGS
65 2c8ea58e eb
 if test x$PYTHON_INCLUDE_DIR != x; then
66 2c8ea58e eb
   CPPFLAGS=-I$PYTHON_INCLUDE_DIR $CPPFLAGS
67 2c8ea58e eb
 fi
68 9e22f254 Tom Rondeau
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
69 2c8ea58e eb
 #include <boost/python/module.hpp>
70 2c8ea58e eb
 using namespace boost::python;
71 2c8ea58e eb
 BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]],
72 9e22f254 Tom Rondeau
               [[return 0;]])],
73 9e22f254 Tom Rondeau
               [ac_cv_boost_python=yes, ac_cv_boost_python=no)
74 2c8ea58e eb
 AC_LANG_RESTORE
75 9e22f254 Tom Rondeau
 CPPFLAGS=$CPPFLAGS_SAVE]
76 2c8ea58e eb
])
77 2c8ea58e eb
if test "$ac_cv_boost_python" = "yes"; then
78 2c8ea58e eb
  AC_LANG_PUSH([C++])
79 2c8ea58e eb
  AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python library is available])
80 2c8ea58e eb
  ax_python_lib=boost_python
81 2c8ea58e eb
  AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library or suffix to use]),
82 2c8ea58e eb
  [if test "x$with_boost_python" != "xno"; then
83 2c8ea58e eb
     ax_python_lib=$with_boost_python
84 2c8ea58e eb
     ax_boost_python_lib=boost_python-$with_boost_python
85 2c8ea58e eb
   fi])
86 2c8ea58e eb
  for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python; do
87 2c8ea58e eb
    AC_CHECK_LIB($ax_lib, exit, [BOOST_PYTHON_LIB=$ax_lib break])
88 2c8ea58e eb
  done
89 2c8ea58e eb
  AC_SUBST(BOOST_PYTHON_LIB)
90 2c8ea58e eb
  AC_LANG_POP([C++])
91 2c8ea58e eb
fi
92 2c8ea58e eb
])dnl