[glom] Further clean up AX_BOOST_PYTHON_MURRAYC
- From: Daniel Elstner <daniel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Further clean up AX_BOOST_PYTHON_MURRAYC
- Date: Mon, 12 Apr 2010 16:52:25 +0000 (UTC)
commit 1384e89874ad1f2af5be8acfeecb4cadc97aed26
Author: Daniel Elstner <danielk openismus com>
Date: Mon Apr 12 18:53:00 2010 +0200
Further clean up AX_BOOST_PYTHON_MURRAYC
* macros/ax_boost_python_murrayc.m4: Simplify the logic of the checks
and clean up the Bourne shell code. Also, abort with a fatal error
if the boost::python headers or library could not be found.
ChangeLog | 8 +++
macros/ax_boost_python_murrayc.m4 | 106 ++++++++++++++++--------------------
2 files changed, 55 insertions(+), 59 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7492b4c..06d0b30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-04-12 Daniel Elstner <danielk openismus com>
+
+ Further clean up AX_BOOST_PYTHON_MURRAYC
+
+ * macros/ax_boost_python_murrayc.m4: Simplify the logic of the checks
+ and clean up the Bourne shell code. Also, abort with a fatal error
+ if the boost::python headers or library could not be found.
+
2010-04-12 Murray Cumming <murrayc murrayc com>
Slight AX_BOOST_PYTHON_MURRAYC() cleanup.
diff --git a/macros/ax_boost_python_murrayc.m4 b/macros/ax_boost_python_murrayc.m4
index 920c8c8..cf45c96 100644
--- a/macros/ax_boost_python_murrayc.m4
+++ b/macros/ax_boost_python_murrayc.m4
@@ -51,69 +51,57 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 7
-#With large changes by murrayc
+#serial 20100412
+#With large changes by murrayc and danielk
#Note that this previously said it was checking for the library, but it's techically the both the headers and library that it looks for. murrayc
AC_DEFUN([AX_BOOST_PYTHON_MURRAYC],
[AC_REQUIRE([MM_CHECK_MODULE_PYTHON])dnl
-AC_CACHE_CHECK(whether the Boost::Python headers are available,
-ac_cv_boost_python,
-[AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- CPPFLAGS_SAVE=$CPPFLAGS
- # Hacked to use the output of MM_CHECK_MODULE_PYTHON() instead of the outout of AX_PYTHON, which we don't use. murrayc
- # if test x$PYTHON_INCLUDE_DIR != x; then
- # CPPFLAGS=-I$PYTHON_INCLUDE_DIR $CPPFLAGS
- #fi
- if test x$PYTHON_CPPFLAGS != x; then
- #Note that this expects boost/ to be at some top-level such as /usr/include/
- #We couldn't check for anything else anyway because there's no pkg-config file to tell us where it is
- CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
- fi
- AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
- #include <boost/python/module.hpp>
- using namespace boost::python;
- BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]],
- [[return 0;]]),
- ac_cv_boost_python=yes, ac_cv_boost_python=no)
- AC_LANG_RESTORE
- CPPFLAGS=$CPPFLAGS_SAVE
-])
-if test "$ac_cv_boost_python" = "yes"; then
- AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python headers and library are available])
+AC_LANG_PUSH([C++])
+saved_CPPFLAGS=$CPPFLAGS
+saved_LIBS=$LIBS
+# Note that this requires PYTHON_CPPFLAGS from MM_CHECK_MODULE_PYTHON()
+# Note that this expects boost/ to be at some top-level such as /usr/include/
+# We couldn't check for anything else anyway because there's no pkg-config file to tell us where it is
+CPPFLAGS="$PYTHON_CPPFLAGS $saved_CPPFLAGS"
+AC_CACHE_CHECK([whether the Boost::Python headers are available],
+ [ac_cv_boost_python],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <boost/python/module.hpp>
+using namespace boost::python;
+BOOST_PYTHON_MODULE(test) { (void)0; }
+]], [])],
+ [ac_cv_boost_python=yes], [ac_cv_boost_python=no])])
+
+AS_IF([test "x$ac_cv_boost_python" = xyes],
+[
+ BOOST_PYTHON_LIBS=
ax_python_lib=boost_python
- AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python shared library to use. For instance, --with-boost-python=boost_python-py25. Defaults to boost-python. If you use this then you should probably set PYTHON too, to avoid using multiple python versions.]),
- [if test "x$with_boost_python" != "xno"; then
- ax_python_lib=$with_boost_python
- ax_boost_python_lib=boost_python-$with_boost_python
- fi])
- for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python; do
- #This previously checked for an exit() function in the boost::python library.
- #That was strange and apparently no longer works. murrayc.
- #AC_CHECK_LIB($ax_lib, exit, [BOOST_PYTHON_LIB=$ax_lib break])
- AC_LANG_PUSH([C++])
- #Note that this requires PYTHON_CPPFLAGS and PYTHON_LIBS from MM_CHECK_MODULE_PYTHON()
- SAVED_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
- SAVED_LIBS=$LIBS
- LIBS="$LIBS $PYTHON_LIBS -l$ax_lib"
+ AC_ARG_WITH([boost-python],
+ [AS_HELP_STRING([--with-boost-python],
+ [specify the boost python shared library to use. For instance, --with-boost-python=boost_python-py25. Defaults to boost-python. If you use this then you should probably set PYTHON too, to avoid using multiple python versions.])],
+ [if test "x$with_boost_python" != xno; then
+ ax_python_lib=$with_boost_python
+ ax_boost_python_lib=boost_python-$with_boost_python
+ fi])
+ AC_MSG_CHECKING([for boost::python shared library])
+ for ax_lib in "$ax_python_lib" "$ax_boost_python_lib" boost_python
+ do
+ # Note that this requires PYTHON_LIBS from MM_CHECK_MODULE_PYTHON()
+ LIBS="$saved_LIBS $PYTHON_LIBS -l$ax_lib"
AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([#include <boost/python.hpp>],
- [boost::python::object test_object])],
- #Note that this was previously BOOST_PYTHON_LIB, but I renamed it because people expect *LIBS. murrayc.
- [BOOST_PYTHON_LIBS="-l$ax_lib"])
- LIBS=$SAVED_LIBS
- CPPFLAGS=$SAVED_CPPFLAGS
- AC_LANG_POP([C++])
+ [AC_LANG_PROGRAM([[#include <boost/python.hpp>]], [[boost::python::object test_object;]])],
+ [BOOST_PYTHON_LIBS="-l$ax_lib"; break])
done
- if test x$BOOST_PYTHON_LIBS != x; then
- AC_MSG_RESULT([boost::python shared library found: $BOOST_PYTHON_LIBS])
- fi
- #TODO: Figure out how to do a simple if else:
- if test "x$BOOST_PYTHON_LIBS" = x; then
- AC_MSG_ERROR([boost::python shared library not found])
- fi
- AC_SUBST(BOOST_PYTHON_LIBS)
-fi
-])dnl
+ AS_IF([test "x$BOOST_PYTHON_LIBS" != x], [ax_result=$BOOST_PYTHON_LIBS], [ax_result=])
+ AC_MSG_RESULT([$ax_result])
+])
+CPPFLAGS=$saved_CPPFLAGS
+LIBS=$saved_LIBS
+AC_LANG_POP([C++])
+AS_IF([test "x$ac_cv_boost_python" = xyes && test "x$BOOST_PYTHON_LIBS" != x],
+ [AC_DEFINE([HAVE_BOOST_PYTHON], [1],
+ [define if the Boost::Python headers and library are available])],
+ [AC_MSG_ERROR([[boost::python is required to build $PACKAGE_NAME]])])
+AC_SUBST([BOOST_PYTHON_LIBS])
+])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]