You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by tr...@apache.org on 2017/10/30 14:58:34 UTC

svn commit: r1813774 - in /subversion/branches/swig-py3: BRANCH-README build/ac-macros/py3c.m4 build/ac-macros/swig.m4

Author: troycurtisjr
Date: Mon Oct 30 14:58:34 2017
New Revision: 1813774

URL: http://svn.apache.org/viewvc?rev=1813774&view=rev
Log:
On branch swig-py3: Remove py3c AC macro's implicit dependency on swig-python.

The py3c library is not necessarily tied to the python swig bindings, so don't
assume so in SVN_PY3C AC macro. Instead, add a check in the swig macro for
py3c library, and gracefully disable just the python bindings instead of
requiring all of swig to be disabled.

* BRANCH-README
  Add a TODO to 'make swig-py' error more meaningful when py3c isn't available.

* build/ac-macros/py3c.m4
  (SVN_PY3C): Remove references to the swig bindings and remove the
  AC_MSG_ERROR, and fix checking of header compilability when prefix method
  is used.

* build/ac-macros/swig.m4
  (SVN_FIND_SWIG): Add a check for the py3c library in the python section and
  if not found, only disable the python bindings instead of all swig bindings.

Modified:
    subversion/branches/swig-py3/BRANCH-README
    subversion/branches/swig-py3/build/ac-macros/py3c.m4
    subversion/branches/swig-py3/build/ac-macros/swig.m4

Modified: subversion/branches/swig-py3/BRANCH-README
URL: http://svn.apache.org/viewvc/subversion/branches/swig-py3/BRANCH-README?rev=1813774&r1=1813773&r2=1813774&view=diff
==============================================================================
--- subversion/branches/swig-py3/BRANCH-README (original)
+++ subversion/branches/swig-py3/BRANCH-README Mon Oct 30 14:58:34 2017
@@ -13,6 +13,9 @@ TODO
 ----
 
 * Ensure Windows builds still work in light of the addition of the py3c library.
+* Make the error more meaningful if the user attempts to build python swig
+  bindings, even if py3c was disabled or not found. Currently the error on
+  makefile builds is "none: command not found", which isn't very descriptive.
 
 
 References:

Modified: subversion/branches/swig-py3/build/ac-macros/py3c.m4
URL: http://svn.apache.org/viewvc/subversion/branches/swig-py3/build/ac-macros/py3c.m4?rev=1813774&r1=1813773&r2=1813774&view=diff
==============================================================================
--- subversion/branches/swig-py3/build/ac-macros/py3c.m4 (original)
+++ subversion/branches/swig-py3/build/ac-macros/py3c.m4 Mon Oct 30 14:58:34 2017
@@ -22,6 +22,10 @@ dnl
 dnl  Check configure options and assign variables related to
 dnl  the py3c library.
 dnl
+dnl  If configuring via prefix, the ac_cv_python_includes variable needs
+dnl  to be set to the appropriate include configuration to build against
+dnl  the correct Python C interface.
+dnl
 
 AC_DEFUN(SVN_PY3C,
 [
@@ -42,31 +46,42 @@ AC_DEFUN(SVN_PY3C,
   ])
 
   if test "$py3c_skip" = "yes"; then
-    AC_MSG_ERROR([subversion swig python bindings require py3c])
-  fi
-
-  if test -n "$py3c_prefix"; then
-    AC_MSG_NOTICE([py3c library configuration via prefix])
-    save_cppflags="$CPPFLAGS"
-    CPPFLAGS="$CPPFLAGS -I$py3c_prefix/include"
-    AC_CHECK_HEADERS(py3c.h,[
-        py3c_found="yes"
-        SVN_PY3C_INCLUDES="-I$py3c_prefix/include"
-    ])
-    CPPFLAGS="$save_cppflags"
+    AC_MSG_NOTICE([Skipping configure of py3c])
   else
-    SVN_PY3C_PKG_CONFIG()
+    if test -n "$py3c_prefix"; then
+      AC_MSG_NOTICE([py3c library configuration via prefix $py3c_prefix])
 
-    if test "$py3c_found" = "no"; then
-      AC_MSG_NOTICE([py3c library configuration])
-      AC_CHECK_HEADER(py3c.h, [
-        py3c_found="yes"
+      dnl The standard Python headers are required to validate py3c.h
+      if test "$ac_cv_python_includes" = "none"; then
+        AC_MSG_WARN([py3c cannot be used without distutils module])
+      fi
+
+      save_cppflags="$CPPFLAGS"
+      CPPFLAGS="$CPPFLAGS $ac_cv_python_includes -I$py3c_prefix/include"
+      AC_CHECK_HEADERS(py3c.h,[
+          py3c_found="yes"
+          SVN_PY3C_INCLUDES="-I$py3c_prefix/include"
       ])
-    fi
-  fi
+      CPPFLAGS="$save_cppflags"
+    else
+      SVN_PY3C_PKG_CONFIG()
 
-  if test "$py3c_found" = "no"; then
-    AC_MSG_ERROR([subversion swig python bindings require py3c])
+      if test "$py3c_found" = "no"; then
+        AC_MSG_NOTICE([py3c library configuration without pkg-config])
+
+        dnl The standard Python headers are required to validate py3c.h
+        if test "$ac_cv_python_includes" = "none"; then
+          AC_MSG_WARN([py3c cannot be used without distutils module])
+        fi
+
+        save_cppflags="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS $ac_cv_python_includes"
+        AC_CHECK_HEADER(py3c.h, [
+          py3c_found="yes"
+        ])
+        CPPFLAGS="$save_cppflags"
+      fi
+    fi
   fi
 
   AC_SUBST(SVN_PY3C_INCLUDES)

Modified: subversion/branches/swig-py3/build/ac-macros/swig.m4
URL: http://svn.apache.org/viewvc/subversion/branches/swig-py3/build/ac-macros/swig.m4?rev=1813774&r1=1813773&r2=1813774&view=diff
==============================================================================
--- subversion/branches/swig-py3/build/ac-macros/swig.m4 (original)
+++ subversion/branches/swig-py3/build/ac-macros/swig.m4 Mon Oct 30 14:58:34 2017
@@ -113,57 +113,62 @@ AC_DEFUN(SVN_FIND_SWIG,
         AC_MSG_WARN([python bindings cannot be built without distutils module])
       fi
 
-      AC_CACHE_CHECK([for compiling Python extensions], [ac_cv_python_compile],[
-        ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py --compile`"
-      ])
-      SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
-
-      AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
-        ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py --link`"
-      ])
-      SWIG_PY_LINK="$ac_cv_python_link"
-
-      AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
-        ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py --libs`"
-      ])
-      SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
-
-      dnl Sun Forte adds an extra space before substituting APR_INT64_T_FMT
-      dnl gcc-2.95 adds an extra space after substituting APR_INT64_T_FMT
-      dnl thus the egrep patterns have a + in them.
-      SVN_PYCFMT_SAVE_CPPFLAGS="$CPPFLAGS"
-      CPPFLAGS="$CPPFLAGS $SVN_APR_INCLUDES"
-      AC_CACHE_CHECK([for apr_int64_t Python/C API format string],
-                     [svn_cv_pycfmt_apr_int64_t], [
-        if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
-          AC_EGREP_CPP([MaTcHtHiS +\"lld\" +EnDeNd],
-                       [#include <apr.h>
-                        MaTcHtHiS APR_INT64_T_FMT EnDeNd],
-                       [svn_cv_pycfmt_apr_int64_t="L"])
-        fi
-        if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
-          AC_EGREP_CPP([MaTcHtHiS +\"ld\" +EnDeNd],r
-                       [#include <apr.h>
-                        MaTcHtHiS APR_INT64_T_FMT EnDeNd],
-                       [svn_cv_pycfmt_apr_int64_t="l"])
-        fi
+      SVN_PY3C()
+
+      if test "$py3c_found" = "no"; then
+        AC_MSG_WARN([py3c library not found, disabling python swig bindings])
+      else
+        AC_CACHE_CHECK([for compiling Python extensions], [ac_cv_python_compile],[
+          ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py --compile`"
+        ])
+        SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
+
+        AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
+          ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py --link`"
+        ])
+        SWIG_PY_LINK="$ac_cv_python_link"
+
+        AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
+          ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py --libs`"
+        ])
+        SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
+
+        dnl Sun Forte adds an extra space before substituting APR_INT64_T_FMT
+        dnl gcc-2.95 adds an extra space after substituting APR_INT64_T_FMT
+        dnl thus the egrep patterns have a + in them.
+        SVN_PYCFMT_SAVE_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS $SVN_APR_INCLUDES"
+        AC_CACHE_CHECK([for apr_int64_t Python/C API format string],
+                       [svn_cv_pycfmt_apr_int64_t], [
+          if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
+            AC_EGREP_CPP([MaTcHtHiS +\"lld\" +EnDeNd],
+                         [#include <apr.h>
+                          MaTcHtHiS APR_INT64_T_FMT EnDeNd],
+                         [svn_cv_pycfmt_apr_int64_t="L"])
+          fi
+          if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
+            AC_EGREP_CPP([MaTcHtHiS +\"ld\" +EnDeNd],r
+                         [#include <apr.h>
+                          MaTcHtHiS APR_INT64_T_FMT EnDeNd],
+                         [svn_cv_pycfmt_apr_int64_t="l"])
+          fi
+          if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
+            AC_EGREP_CPP([MaTcHtHiS +\"d\" +EnDeNd],
+                         [#include <apr.h>
+                          MaTcHtHiS APR_INT64_T_FMT EnDeNd],
+                         [svn_cv_pycfmt_apr_int64_t="i"])
+          fi
+        ])
+        CPPFLAGS="$SVN_PYCFMT_SAVE_CPPFLAGS"
         if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
-          AC_EGREP_CPP([MaTcHtHiS +\"d\" +EnDeNd],
-                       [#include <apr.h>
-                        MaTcHtHiS APR_INT64_T_FMT EnDeNd],
-                       [svn_cv_pycfmt_apr_int64_t="i"])
+          AC_MSG_ERROR([failed to recognize APR_INT64_T_FMT on this platform])
         fi
-      ])
-      CPPFLAGS="$SVN_PYCFMT_SAVE_CPPFLAGS"
-      if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
-        AC_MSG_ERROR([failed to recognize APR_INT64_T_FMT on this platform])
+        AC_DEFINE_UNQUOTED([SVN_APR_INT64_T_PYCFMT],
+                           ["$svn_cv_pycfmt_apr_int64_t"],
+                           [Define to the Python/C API format character suitable]
+                           [ for apr_int64_t])
       fi
-      AC_DEFINE_UNQUOTED([SVN_APR_INT64_T_PYCFMT],
-                         ["$svn_cv_pycfmt_apr_int64_t"],
-                         [Define to the Python/C API format character suitable]
-                         [ for apr_int64_t])
 
-      SVN_PY3C()
     fi
 
     if test "$PERL" != "none"; then