comparison m4/ax_boost_python.m4 @ 207:17d2d6a7587f

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