ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/vendor/apache/subversion/1.8.17/build/ac-macros/swig.m4
Revision: 9598
Committed: Sun Oct 1 19:41:23 2017 UTC (6 years, 7 months ago) by laffer1
File size: 11795 byte(s)
Log Message:
subversion 1.8.17

File Contents

# Content
1 dnl ===================================================================
2 dnl Licensed to the Apache Software Foundation (ASF) under one
3 dnl or more contributor license agreements. See the NOTICE file
4 dnl distributed with this work for additional information
5 dnl regarding copyright ownership. The ASF licenses this file
6 dnl to you under the Apache License, Version 2.0 (the
7 dnl "License"); you may not use this file except in compliance
8 dnl with the License. You may obtain a copy of the License at
9 dnl
10 dnl http://www.apache.org/licenses/LICENSE-2.0
11 dnl
12 dnl Unless required by applicable law or agreed to in writing,
13 dnl software distributed under the License is distributed on an
14 dnl "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 dnl KIND, either express or implied. See the License for the
16 dnl specific language governing permissions and limitations
17 dnl under the License.
18 dnl ===================================================================
19 dnl
20 dnl check to see if SWIG is current enough.
21 dnl
22 dnl if it is, then check to see if we have the correct version of python.
23 dnl
24 dnl if we do, then set up the appropriate SWIG_ variables to build the
25 dnl python bindings.
26
27 AC_DEFUN(SVN_CHECK_SWIG,
28 [
29 AC_ARG_WITH(swig,
30 AS_HELP_STRING([--with-swig=PATH],
31 [Try to use 'PATH/bin/swig' to build the
32 swig bindings. If PATH is not specified,
33 look for a 'swig' binary in your PATH.]),
34 [
35 case "$withval" in
36 "no")
37 SWIG_SUITABLE=no
38 SVN_FIND_SWIG(no)
39 ;;
40 "yes")
41 SVN_FIND_SWIG(check)
42 ;;
43 *)
44 SVN_FIND_SWIG($withval)
45 ;;
46 esac
47 ],
48 [
49 SVN_FIND_SWIG(check)
50 ])
51 ])
52
53 AC_DEFUN(SVN_FIND_SWIG,
54 [
55 where=$1
56
57 if test $where = no; then
58 SWIG=none
59 elif test $where = check; then
60 AC_PATH_PROG(SWIG, swig, none)
61 else
62 if test -f "$where"; then
63 SWIG="$where"
64 else
65 SWIG="$where/bin/swig"
66 fi
67 if test ! -f "$SWIG" || test ! -x "$SWIG"; then
68 AC_MSG_ERROR([Could not find swig binary at $SWIG])
69 fi
70 fi
71
72 if test "$SWIG" != "none"; then
73 AC_MSG_CHECKING([swig version])
74 SWIG_VERSION_RAW="`$SWIG -version 2>&1 | \
75 $SED -ne 's/^.*Version \(.*\)$/\1/p'`"
76 # We want the version as an integer so we can test against
77 # which version we're using. SWIG doesn't provide this
78 # to us so we have to come up with it on our own.
79 # The major is passed straight through,
80 # the minor is zero padded to two places,
81 # and the patch level is zero padded to three places.
82 # e.g. 1.3.24 becomes 103024
83 SWIG_VERSION="`echo \"$SWIG_VERSION_RAW\" | \
84 $SED -e 's/[[^0-9\.]].*$//' \
85 -e 's/\.\([[0-9]]\)$/.0\1/' \
86 -e 's/\.\([[0-9]][[0-9]]\)$/.0\1/' \
87 -e 's/\.\([[0-9]]\)\./0\1/; s/\.//g;'`"
88 AC_MSG_RESULT([$SWIG_VERSION_RAW])
89 # If you change the required swig version number, don't forget to update:
90 # subversion/bindings/swig/INSTALL
91 # packages/rpm/redhat-8+/subversion.spec
92 # packages/rpm/redhat-7.x/subversion.spec
93 # packages/rpm/rhel-3/subversion.spec
94 # packages/rpm/rhel-4/subversion.spec
95 if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024"; then
96 SWIG_SUITABLE=yes
97 else
98 SWIG_SUITABLE=no
99 AC_MSG_WARN([Detected SWIG version $SWIG_VERSION_RAW])
100 AC_MSG_WARN([Subversion requires SWIG 1.3.24 or later])
101 fi
102 fi
103
104 SWIG_PY_COMPILE="none"
105 SWIG_PY_LINK="none"
106 if test "$PYTHON" != "none"; then
107 AC_MSG_NOTICE([Configuring python swig binding])
108
109 AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[
110 ac_cv_python_includes="`$PYTHON ${abs_srcdir}/build/get-py-info.py --includes`"
111 ])
112 SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) $ac_cv_python_includes"
113
114 if test "$ac_cv_python_includes" = "none"; then
115 AC_MSG_WARN([python bindings cannot be built without distutils module])
116 fi
117
118 AC_CACHE_CHECK([for compiling Python extensions], [ac_cv_python_compile],[
119 ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py --compile`"
120 ])
121 SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
122
123 AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
124 ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py --link`"
125 ])
126 SWIG_PY_LINK="$ac_cv_python_link"
127
128 AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
129 ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py --libs`"
130 ])
131 SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
132
133 dnl Sun Forte adds an extra space before substituting APR_INT64_T_FMT
134 dnl gcc-2.95 adds an extra space after substituting APR_INT64_T_FMT
135 dnl thus the egrep patterns have a + in them.
136 SVN_PYCFMT_SAVE_CPPFLAGS="$CPPFLAGS"
137 CPPFLAGS="$CPPFLAGS $SVN_APR_INCLUDES"
138 AC_CACHE_CHECK([for apr_int64_t Python/C API format string],
139 [svn_cv_pycfmt_apr_int64_t], [
140 if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
141 AC_EGREP_CPP([MaTcHtHiS +\"lld\" +EnDeNd],
142 [#include <apr.h>
143 MaTcHtHiS APR_INT64_T_FMT EnDeNd],
144 [svn_cv_pycfmt_apr_int64_t="L"])
145 fi
146 if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
147 AC_EGREP_CPP([MaTcHtHiS +\"ld\" +EnDeNd],r
148 [#include <apr.h>
149 MaTcHtHiS APR_INT64_T_FMT EnDeNd],
150 [svn_cv_pycfmt_apr_int64_t="l"])
151 fi
152 if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
153 AC_EGREP_CPP([MaTcHtHiS +\"d\" +EnDeNd],
154 [#include <apr.h>
155 MaTcHtHiS APR_INT64_T_FMT EnDeNd],
156 [svn_cv_pycfmt_apr_int64_t="i"])
157 fi
158 ])
159 CPPFLAGS="$SVN_PYCFMT_SAVE_CPPFLAGS"
160 if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
161 AC_MSG_ERROR([failed to recognize APR_INT64_T_FMT on this platform])
162 fi
163 AC_DEFINE_UNQUOTED([SVN_APR_INT64_T_PYCFMT],
164 ["$svn_cv_pycfmt_apr_int64_t"],
165 [Define to the Python/C API format character suitable]
166 [ for apr_int64_t])
167 fi
168
169 if test "$PERL" != "none"; then
170 AC_MSG_CHECKING([perl version])
171 dnl Note that the q() bit is there to avoid unbalanced brackets
172 dnl which m4 really doesn't like.
173 PERL_VERSION="`$PERL -e 'q([[); print $]] * 1000000,$/;'`"
174 AC_MSG_RESULT([$PERL_VERSION])
175 if test "$PERL_VERSION" -ge "5008000"; then
176 SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$PERL -MExtUtils::Embed -e ccopts`"
177 else
178 AC_MSG_WARN([perl bindings require perl 5.8.0 or newer.])
179 fi
180 fi
181
182 SWIG_RB_COMPILE="none"
183 SWIG_RB_LINK="none"
184 if test "$RUBY" != "none"; then
185 rbconfig="$RUBY -rrbconfig -e "
186
187 for var_name in arch archdir CC LDSHARED DLEXT LIBS LIBRUBYARG \
188 rubyhdrdir rubyarchhdrdir sitedir sitelibdir sitearchdir libdir
189 do
190 rbconfig_tmp=`$rbconfig "print RbConfig::CONFIG@<:@'$var_name'@:>@"`
191 eval "rbconfig_$var_name=\"$rbconfig_tmp\""
192 done
193
194 AC_MSG_NOTICE([Configuring Ruby SWIG binding])
195
196 AC_CACHE_CHECK([for Ruby include path], [svn_cv_ruby_includes],[
197 if test -d "$rbconfig_rubyhdrdir"; then
198 dnl Ruby >=1.9
199 svn_cv_ruby_includes="-I. -I$rbconfig_rubyhdrdir -I$rbconfig_rubyhdrdir/ruby -I$rbconfig_rubyhdrdir/ruby/backward"
200 if test -d "$rbconfig_rubyarchhdrdir"; then
201 dnl Ruby >=2.0
202 svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyarchhdrdir"
203 else
204 svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyhdrdir/$rbconfig_arch"
205 fi
206 else
207 dnl Ruby 1.8
208 svn_cv_ruby_includes="-I. -I$rbconfig_archdir"
209 fi
210 ])
211 SWIG_RB_INCLUDES="\$(SWIG_INCLUDES) $svn_cv_ruby_includes"
212
213 AC_CACHE_CHECK([how to compile Ruby extensions], [svn_cv_ruby_compile],[
214 svn_cv_ruby_compile="$rbconfig_CC $CFLAGS"
215 ])
216 SWIG_RB_COMPILE="$svn_cv_ruby_compile"
217 SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-ansi])
218 SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c89])
219 SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c90])
220 dnl FIXME: Check that the compiler for Ruby actually supports this flag
221 SWIG_RB_COMPILE="$SWIG_RB_COMPILE -Wno-int-to-pointer-cast"
222
223 AC_CACHE_CHECK([how to link Ruby extensions], [svn_cv_ruby_link],[
224 svn_cv_ruby_link="`$RUBY -e 'ARGV.shift; print ARGV.join(%q( ))' \
225 $rbconfig_LDSHARED`"
226 svn_cv_ruby_link="$rbconfig_CC $svn_cv_ruby_link"
227 svn_cv_ruby_link="$svn_cv_ruby_link -shrext .$rbconfig_DLEXT"
228 ])
229 SWIG_RB_LINK="$svn_cv_ruby_link"
230
231 AC_CACHE_CHECK([how to link Ruby libraries], [ac_cv_ruby_libs], [
232 ac_cv_ruby_libs="$rbconfig_LIBRUBYARG $rbconfig_LIBS"
233 ])
234 SWIG_RB_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_ruby_libs)`"
235
236 AC_MSG_CHECKING([for rb_errinfo])
237 old_CFLAGS="$CFLAGS"
238 old_LIBS="$LIBS"
239 CFLAGS="$CFLAGS $svn_cv_ruby_includes"
240 SVN_STRIP_FLAG([CFLAGS], [-ansi])
241 SVN_STRIP_FLAG([CFLAGS], [-std=c89])
242 SVN_STRIP_FLAG([CFLAGS], [-std=c90])
243 LIBS="$SWIG_RB_LIBS"
244 AC_LINK_IFELSE([AC_LANG_SOURCE([[
245 #include <ruby.h>
246 int main()
247 {rb_errinfo();}]])], have_rb_errinfo="yes", have_rb_errinfo="no")
248 if test "$have_rb_errinfo" = "yes"; then
249 AC_MSG_RESULT([yes])
250 AC_DEFINE([HAVE_RB_ERRINFO], [1],
251 [Define to 1 if you have the `rb_errinfo' function.])
252 else
253 AC_MSG_RESULT([no])
254 fi
255 CFLAGS="$old_CFLAGS"
256 LIBS="$old_LIBS"
257
258 AC_CACHE_VAL([svn_cv_ruby_sitedir],[
259 svn_cv_ruby_sitedir="$rbconfig_sitedir"
260 ])
261 AC_ARG_WITH([ruby-sitedir],
262 AS_HELP_STRING([--with-ruby-sitedir=SITEDIR],
263 [install Ruby bindings in SITEDIR
264 (default is same as ruby's one)]),
265 [svn_ruby_installdir="$withval"],
266 [svn_ruby_installdir="$svn_cv_ruby_sitedir"])
267
268 AC_MSG_CHECKING([where to install Ruby scripts])
269 AC_CACHE_VAL([svn_cv_ruby_sitedir_libsuffix],[
270 svn_cv_ruby_sitedir_libsuffix="`echo "$rbconfig_sitelibdir" | \
271 $SED -e "s,^$rbconfig_sitedir,,"`"
272 ])
273 SWIG_RB_SITE_LIB_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_libsuffix}"
274 AC_MSG_RESULT([$SWIG_RB_SITE_LIB_DIR])
275
276 AC_MSG_CHECKING([where to install Ruby extensions])
277 AC_CACHE_VAL([svn_cv_ruby_sitedir_archsuffix],[
278 svn_cv_ruby_sitedir_archsuffix="`echo "$rbconfig_sitearchdir" | \
279 $SED -e "s,^$rbconfig_sitedir,,"`"
280 ])
281 SWIG_RB_SITE_ARCH_DIR="${svn_ruby_installdir}${svn_cv_ruby_sitedir_archsuffix}"
282 AC_MSG_RESULT([$SWIG_RB_SITE_ARCH_DIR])
283
284 AC_MSG_CHECKING([how to use output level for Ruby bindings tests])
285 AC_CACHE_VAL([svn_cv_ruby_test_verbose],[
286 svn_cv_ruby_test_verbose="normal"
287 ])
288 AC_ARG_WITH([ruby-test-verbose],
289 AS_HELP_STRING([--with-ruby-test-verbose=LEVEL],
290 [how to use output level for Ruby bindings tests
291 (default is normal)]),
292 [svn_ruby_test_verbose="$withval"],
293 [svn_ruby_test_verbose="$svn_cv_ruby_test_verbose"])
294 SWIG_RB_TEST_VERBOSE="$svn_ruby_test_verbose"
295 AC_MSG_RESULT([$SWIG_RB_TEST_VERBOSE])
296 fi
297 AC_SUBST(SWIG)
298 AC_SUBST(SWIG_PY_INCLUDES)
299 AC_SUBST(SWIG_PY_COMPILE)
300 AC_SUBST(SWIG_PY_LINK)
301 AC_SUBST(SWIG_PY_LIBS)
302 AC_SUBST(SWIG_PL_INCLUDES)
303 AC_SUBST(SWIG_RB_LINK)
304 AC_SUBST(SWIG_RB_LIBS)
305 AC_SUBST(SWIG_RB_INCLUDES)
306 AC_SUBST(SWIG_RB_COMPILE)
307 AC_SUBST(SWIG_RB_SITE_LIB_DIR)
308 AC_SUBST(SWIG_RB_SITE_ARCH_DIR)
309 AC_SUBST(SWIG_RB_TEST_VERBOSE)
310 ])