annotate m4/ax_boost_python.m4 @ 211:94bde95d7e18

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