[glom/glom-1-28] macros: Update the ax_* boost and python m4 macros.



commit 37faa1625ff0f33d0537df81494809c057dfb49d
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 10 14:55:33 2015 +0200

    macros: Update the ax_* boost and python m4 macros.

 macros/ax_boost_base.m4   |   31 +++++++++++++++++++++--
 macros/ax_boost_python.m4 |   58 ++++++++++++++++++++++++++++++--------------
 macros/ax_python_devel.m4 |    4 +-
 3 files changed, 69 insertions(+), 24 deletions(-)
---
diff --git a/macros/ax_boost_base.m4 b/macros/ax_boost_base.m4
index 57d14fe..f3279f2 100644
--- a/macros/ax_boost_base.m4
+++ b/macros/ax_boost_base.m4
@@ -33,7 +33,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 21
+#serial 26
 
 AC_DEFUN([AX_BOOST_BASE],
 [
@@ -92,8 +92,23 @@ if test "x$want_boost" = "xyes"; then
     libsubdirs="lib"
     ax_arch=`uname -m`
     case $ax_arch in
-      x86_64|ppc64|s390x|sparc64|aarch64)
-        libsubdirs="lib64 lib lib64"
+      x86_64)
+        libsubdirs="lib64 libx32 lib lib64"
+        ;;
+      ppc64|s390x|sparc64|aarch64|ppc64le)
+        libsubdirs="lib64 lib lib64 ppc64le"
+        ;;
+    esac
+
+    dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
+    dnl them priority over the other paths since, if libs are found there, they
+    dnl are almost assuredly the ones desired.
+    AC_REQUIRE([AC_CANONICAL_HOST])
+    libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
+
+    case ${host_cpu} in
+      i?86)
+        libsubdirs="lib/i386-${host_os} $libsubdirs"
         ;;
     esac
 
@@ -158,6 +173,10 @@ if test "x$want_boost" = "xyes"; then
     dnl if we found no boost with system layout we search for boost libraries
     dnl built and installed without the --layout=system option or for a staged(not installed) version
     if test "x$succeeded" != "xyes"; then
+        CPPFLAGS="$CPPFLAGS_SAVED"
+        LDFLAGS="$LDFLAGS_SAVED"
+        BOOST_CPPFLAGS=
+        BOOST_LDFLAGS=
         _version=0
         if test "$ac_boost_path" != ""; then
             if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
@@ -170,6 +189,12 @@ if test "x$want_boost" = "xyes"; then
                     VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
                     BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
                 done
+                dnl if nothing found search for layout used in Windows distributions
+                if test -z "$BOOST_CPPFLAGS"; then
+                    if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
+                        BOOST_CPPFLAGS="-I$ac_boost_path"
+                    fi
+                fi
             fi
         else
             if test "$cross_compiling" != yes; then
diff --git a/macros/ax_boost_python.m4 b/macros/ax_boost_python.m4
index 5c456eb..5a40f61 100644
--- a/macros/ax_boost_python.m4
+++ b/macros/ax_boost_python.m4
@@ -25,7 +25,7 @@
 # LICENSE
 #
 #   Copyright (c) 2008 Michael Tindal
-#   Copyright (c) 2013 Daniel Mullner <muellner math stanford edu>
+#   Copyright (c) 2013 Daniel M"ullner <daniel danifold net>
 #
 #   This program is free software; you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License as published by the
@@ -53,39 +53,59 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 18
+#serial 20
 
 AC_DEFUN([AX_BOOST_PYTHON],
 [AC_REQUIRE([AX_PYTHON_DEVEL])dnl
+AC_REQUIRE([AX_BOOST_BASE])dnl
+AC_LANG_PUSH([C++])
+ax_boost_python_save_CPPFLAGS="$CPPFLAGS"
+ax_boost_python_save_LDFLAGS="$LDFLAGS"
+ax_boost_python_save_LIBS="$LIBS"
+if test "x$PYTHON_CPPFLAGS" != "x"; then
+  CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
+fi
+if test "x$PYTHON_LDFLAGS" != "x"; then
+  LDFLAGS="$PYTHON_LDFLAGS $LDFLAGS"
+fi
+if test "x$BOOST_CPPFLAGS" != "x"; then
+  CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
+fi
+if test "x$BOOST_LDFLAGS" != "x"; then
+  LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
+fi
 AC_CACHE_CHECK(whether the Boost::Python library is available,
 ac_cv_boost_python,
-[AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- CPPFLAGS_SAVE="$CPPFLAGS"
- if test x$PYTHON_CPPFLAGS != x; then
-   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"
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <boost/python/module.hpp>
+BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]], [])],
+    ac_cv_boost_python=yes, ac_cv_boost_python=no)
 ])
 if test "$ac_cv_boost_python" = "yes"; then
   AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python library is available])
   ax_python_lib=boost_python
   AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify yes/no or the boost python 
library or suffix to use]),
-  [if test "x$with_boost_python" != "xno"; then
+  [if test "x$with_boost_python" != "xno" -a "x$with_boost_python" != "xyes"; then
      ax_python_lib=$with_boost_python
      ax_boost_python_lib=boost_python-$with_boost_python
    fi])
   BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
-  for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python `ls $BOOSTLIBDIR/libboost_python*.so* 
$BOOSTLIBDIR/libboost_python*.dylib* $BOOSTLIBDIR/libboost_python*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 
's;^lib\(boost_python.*\)\.so.*$;\1;' -e 's;^lib\(boost_python.*\)\.dylib.*$;\1;' -e 
's;^lib\(boost_python.*\)\.a.*$;\1;' `; do
-    AC_CHECK_LIB($ax_lib, exit, [BOOST_PYTHON_LIB=$ax_lib break], , [$PYTHON_LDFLAGS])
+  for ax_lib in $ax_python_lib $ax_boost_python_lib `ls $BOOSTLIBDIR/libboost_python*.so* 
$BOOSTLIBDIR/libboost_python*.dylib* $BOOSTLIBDIR/libboost_python*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 
's;^lib\(boost_python.*\)\.so.*$;\1;' -e 's;^lib\(boost_python.*\)\.dylib.*$;\1;' -e 
's;^lib\(boost_python.*\)\.a.*$;\1;' ` boost_python boost_python3; do
+    AS_VAR_PUSHDEF([ax_Lib], [ax_cv_lib_$ax_lib''_BOOST_PYTHON_MODULE])dnl
+    AC_CACHE_CHECK([whether $ax_lib is the correct library], [ax_Lib],
+    [LIBS="-l$ax_lib $ax_boost_python_save_LIBS"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <boost/python/module.hpp>
+BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]], [])],
+        [AS_VAR_SET([ax_Lib], [yes])],
+        [AS_VAR_SET([ax_Lib], [no])])])
+    AS_VAR_IF([ax_Lib], [yes], [BOOST_PYTHON_LIB=$ax_lib break], [])
+    AS_VAR_POPDEF([ax_Lib])dnl
   done
   AC_SUBST(BOOST_PYTHON_LIB)
 fi
+CPPFLAGS="$ax_boost_python_save_CPPFLAGS"
+LDFLAGS="$ax_boost_python_save_LDFLAGS"
+LIBS="$ax_boost_python_save_LIBS"
+AC_LANG_POP([C++])
 ])dnl
diff --git a/macros/ax_python_devel.m4 b/macros/ax_python_devel.m4
index cf2163c..59a2ff0 100644
--- a/macros/ax_python_devel.m4
+++ b/macros/ax_python_devel.m4
@@ -67,7 +67,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 16
+#serial 17
 
 AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
 AC_DEFUN([AX_PYTHON_DEVEL],[
@@ -265,7 +265,7 @@ EOD`
        if test -z "$PYTHON_EXTRA_LIBS"; then
           PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
                 conf = distutils.sysconfig.get_config_var; \
-                print (conf('LIBS'))"`
+                print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
        fi
        AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
        AC_SUBST(PYTHON_EXTRA_LIBS)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]