summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/ac_pkg_cython.m467
-rw-r--r--m4/ac_pkg_swig.m4122
-rw-r--r--m4/as-compiler-flag.m44
-rw-r--r--m4/ax_pthread.m4522
-rw-r--r--m4/ax_python_devel.m4 (renamed from m4/ac_python_devel.m4)188
-rw-r--r--m4/ax_swig_enable_cxx.m453
-rw-r--r--m4/cython_python.m47
-rw-r--r--m4/swig_python.m465
8 files changed, 723 insertions, 305 deletions
diff --git a/m4/ac_pkg_cython.m4 b/m4/ac_pkg_cython.m4
new file mode 100644
index 0000000..e0af96a
--- /dev/null
+++ b/m4/ac_pkg_cython.m4
@@ -0,0 +1,67 @@
1
2AC_DEFUN([AC_PROG_CYTHON],[
3 AC_PATH_PROGS([CYTHON],[cython cython3])
4 if test -z "$CYTHON" ; then
5 AC_MSG_WARN([Unable to find 'cython' or 'cython3' program. You should look at https://cython.org or install your distribution specific cython package.])
6 CYTHON=false
7 elif test -n "$1" ; then
8 AC_MSG_CHECKING([for Cython version])
9 [cython_version=`$CYTHON --version 2>&1 | sed 's/Cython version \(.*\)$/\1/g'`]
10 AC_MSG_RESULT([$cython_version])
11
12 # Setup extra version string for parsing
13 [cython_version_stripped=`echo $cython_version | sed 's/\([0-9]\+\)\.\([0-9]\+\)[^\.]*\(\.\([0-9]\+\)\)\?.*/0\1.0\2.0\4/g'`]
14 if test -n "$cython_version" ; then
15 # Calculate the required version number components
16 [required=$1]
17 [required_major=`echo $required | sed 's/[^0-9].*//'`]
18 if test -z "$required_major" ; then
19 [required_major=0]
20 fi
21 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
22 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
23 if test -z "$required_minor" ; then
24 [required_minor=0]
25 fi
26 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
27 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
28 if test -z "$required_patch" ; then
29 [required_patch=0]
30 fi
31
32 # Calculate the available version number components
33 [available=$cython_version_stripped]
34 [available_major=`echo $available | sed 's/[^0-9].*//'`]
35 if test -z "$available_major" ; then
36 [available_major=0]
37 fi
38 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
39 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
40 if test -z "$available_minor" ; then
41 [available_minor=0]
42 fi
43 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
44 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
45 if test -z "$available_patch" ; then
46 [available_patch=0]
47 fi
48
49 if test $available_major -gt $required_major || \
50 ( test $available_major -eq $required_major && \
51 test $available_minor -gt $required_minor ) || \
52 ( test $available_major -eq $required_major && \
53 test $available_minor -eq $required_minor && \
54 test $available_patch -ge $required_patch ) ; then
55
56 AC_MSG_NOTICE([Cython executable is '$CYTHON'])
57 else
58 AC_MSG_WARN([Cython version >= $1 is required. You have $cython_version. You should look at http://www.cython.org])
59 CYTHON='echo "Error: Cython version >= $1 is required. You have '"$cython_version"'. You should look at http://www.cython.org" ; false'
60 fi
61 else
62 AC_MSG_WARN([Unable to determine Cython version])
63 CYTHON=false
64 fi
65 fi
66 AC_SUBST([CYTHON_LIB])
67])
diff --git a/m4/ac_pkg_swig.m4 b/m4/ac_pkg_swig.m4
deleted file mode 100644
index 97244bc..0000000
--- a/m4/ac_pkg_swig.m4
+++ /dev/null
@@ -1,122 +0,0 @@
1# ===========================================================================
2# http://autoconf-archive.cryp.to/ac_pkg_swig.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# AC_PROG_SWIG([major.minor.micro])
8#
9# DESCRIPTION
10#
11# This macro searches for a SWIG installation on your system. If found you
12# should call SWIG via $(SWIG). You can use the optional first argument to
13# check if the version of the available SWIG is greater than or equal to
14# the value of the argument. It should have the format: N[.N[.N]] (N is a
15# number between 0 and 999. Only the first N is mandatory.)
16#
17# If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that
18# the swig package is this version number or higher.
19#
20# In configure.in, use as:
21#
22# AC_PROG_SWIG(1.3.17)
23# SWIG_ENABLE_CXX
24# SWIG_MULTI_MODULE_SUPPORT
25# SWIG_PYTHON
26#
27# LAST MODIFICATION
28#
29# 2008-04-12
30#
31# COPYLEFT
32#
33# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
34# Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
35# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
36# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
37#
38# This program is free software; you can redistribute it and/or modify it
39# under the terms of the GNU General Public License as published by the
40# Free Software Foundation; either version 2 of the License, or (at your
41# option) any later version.
42#
43# This program is distributed in the hope that it will be useful, but
44# WITHOUT ANY WARRANTY; without even the implied warranty of
45# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
46# Public License for more details.
47#
48# You should have received a copy of the GNU General Public License along
49# with this program. If not, see <http://www.gnu.org/licenses/>.
50#
51# As a special exception, the respective Autoconf Macro's copyright owner
52# gives unlimited permission to copy, distribute and modify the configure
53# scripts that are the output of Autoconf when processing the Macro. You
54# need not follow the terms of the GNU General Public License when using
55# or distributing such scripts, even though portions of the text of the
56# Macro appear in them. The GNU General Public License (GPL) does govern
57# all other use of the material that constitutes the Autoconf Macro.
58#
59# This special exception to the GPL applies to versions of the Autoconf
60# Macro released by the Autoconf Macro Archive. When you make and
61# distribute a modified version of the Autoconf Macro, you may extend this
62# special exception to the GPL to apply to your modified version as well.
63
64AC_DEFUN([AC_PROG_SWIG],[
65 AC_PATH_PROG([SWIG],[swig])
66 if test -z "$SWIG" ; then
67 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org] or install your distribution specific swig package.)
68 SWIG=false
69 elif test -n "$1" ; then
70 AC_MSG_CHECKING([for SWIG version])
71 [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
72 AC_MSG_RESULT([$swig_version])
73 if test -n "$swig_version" ; then
74 # Calculate the required version number components
75 [required=$1]
76 [required_major=`echo $required | sed 's/[^0-9].*//'`]
77 if test -z "$required_major" ; then
78 [required_major=0]
79 fi
80 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
81 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
82 if test -z "$required_minor" ; then
83 [required_minor=0]
84 fi
85 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
86 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
87 if test -z "$required_patch" ; then
88 [required_patch=0]
89 fi
90 # Calculate the available version number components
91 [available=$swig_version]
92 [available_major=`echo $available | sed 's/[^0-9].*//'`]
93 if test -z "$available_major" ; then
94 [available_major=0]
95 fi
96 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
97 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
98 if test -z "$available_minor" ; then
99 [available_minor=0]
100 fi
101 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
102 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
103 if test -z "$available_patch" ; then
104 [available_patch=0]
105 fi
106 if test $available_major -ne $required_major \
107 -o $available_minor -ne $required_minor \
108 -o $available_patch -lt $required_patch ; then
109 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
110 SWIG=false
111 else
112 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
113 SWIG_LIB=`$SWIG -swiglib`
114 AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
115 fi
116 else
117 AC_MSG_WARN([cannot determine SWIG version])
118 SWIG=false
119 fi
120 fi
121 AC_SUBST([SWIG_LIB])
122])
diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4
index 0f660cf..baab5d9 100644
--- a/m4/as-compiler-flag.m4
+++ b/m4/as-compiler-flag.m4
@@ -18,7 +18,7 @@ AC_DEFUN([AS_COMPILER_FLAG],
18 save_CFLAGS="$CFLAGS" 18 save_CFLAGS="$CFLAGS"
19 CFLAGS="$CFLAGS $1" 19 CFLAGS="$CFLAGS $1"
20 20
21 AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) 21 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [flag_ok=yes], [flag_ok=no])
22 CFLAGS="$save_CFLAGS" 22 CFLAGS="$save_CFLAGS"
23 23
24 if test "X$flag_ok" = Xyes ; then 24 if test "X$flag_ok" = Xyes ; then
@@ -44,7 +44,7 @@ AC_DEFUN([AS_COMPILER_FLAGS],
44 do 44 do
45 save_CFLAGS="$CFLAGS" 45 save_CFLAGS="$CFLAGS"
46 CFLAGS="$CFLAGS $each" 46 CFLAGS="$CFLAGS $each"
47 AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) 47 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [flag_ok=yes], [flag_ok=no])
48 CFLAGS="$save_CFLAGS" 48 CFLAGS="$save_CFLAGS"
49 49
50 if test "X$flag_ok" = Xyes ; then 50 if test "X$flag_ok" = Xyes ; then
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
new file mode 100644
index 0000000..9f35d13
--- /dev/null
+++ b/m4/ax_pthread.m4
@@ -0,0 +1,522 @@
1# ===========================================================================
2# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
8#
9# DESCRIPTION
10#
11# This macro figures out how to build C programs using POSIX threads. It
12# sets the PTHREAD_LIBS output variable to the threads library and linker
13# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
14# flags that are needed. (The user can also force certain compiler
15# flags/libs to be tested by setting these environment variables.)
16#
17# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
18# needed for multi-threaded programs (defaults to the value of CC
19# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
20# special cc_r/CC_r compiler alias.)
21#
22# NOTE: You are assumed to not only compile your program with these flags,
23# but also to link with them as well. For example, you might link with
24# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
25# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
26#
27# If you are only building threaded programs, you may wish to use these
28# variables in your default LIBS, CFLAGS, and CC:
29#
30# LIBS="$PTHREAD_LIBS $LIBS"
31# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
32# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
33# CC="$PTHREAD_CC"
34# CXX="$PTHREAD_CXX"
35#
36# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
37# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
38# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
39#
40# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
41# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
42# PTHREAD_CFLAGS.
43#
44# ACTION-IF-FOUND is a list of shell commands to run if a threads library
45# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
46# is not found. If ACTION-IF-FOUND is not specified, the default action
47# will define HAVE_PTHREAD.
48#
49# Please let the authors know if this macro fails on any platform, or if
50# you have any other suggestions or comments. This macro was based on work
51# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
52# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
53# Alejandro Forero Cuervo to the autoconf macro repository. We are also
54# grateful for the helpful feedback of numerous users.
55#
56# Updated for Autoconf 2.68 by Daniel Richard G.
57#
58# LICENSE
59#
60# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
61# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
62# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
63#
64# This program is free software: you can redistribute it and/or modify it
65# under the terms of the GNU General Public License as published by the
66# Free Software Foundation, either version 3 of the License, or (at your
67# option) any later version.
68#
69# This program is distributed in the hope that it will be useful, but
70# WITHOUT ANY WARRANTY; without even the implied warranty of
71# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
72# Public License for more details.
73#
74# You should have received a copy of the GNU General Public License along
75# with this program. If not, see <https://www.gnu.org/licenses/>.
76#
77# As a special exception, the respective Autoconf Macro's copyright owner
78# gives unlimited permission to copy, distribute and modify the configure
79# scripts that are the output of Autoconf when processing the Macro. You
80# need not follow the terms of the GNU General Public License when using
81# or distributing such scripts, even though portions of the text of the
82# Macro appear in them. The GNU General Public License (GPL) does govern
83# all other use of the material that constitutes the Autoconf Macro.
84#
85# This special exception to the GPL applies to versions of the Autoconf
86# Macro released by the Autoconf Archive. When you make and distribute a
87# modified version of the Autoconf Macro, you may extend this special
88# exception to the GPL to apply to your modified version as well.
89
90#serial 31
91
92AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
93AC_DEFUN([AX_PTHREAD], [
94AC_REQUIRE([AC_CANONICAL_HOST])
95AC_REQUIRE([AC_PROG_CC])
96AC_REQUIRE([AC_PROG_SED])
97AC_LANG_PUSH([C])
98ax_pthread_ok=no
99
100# We used to check for pthread.h first, but this fails if pthread.h
101# requires special compiler flags (e.g. on Tru64 or Sequent).
102# It gets checked for in the link test anyway.
103
104# First of all, check if the user has set any of the PTHREAD_LIBS,
105# etcetera environment variables, and if threads linking works using
106# them:
107if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
108 ax_pthread_save_CC="$CC"
109 ax_pthread_save_CFLAGS="$CFLAGS"
110 ax_pthread_save_LIBS="$LIBS"
111 AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
112 AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
113 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
114 LIBS="$PTHREAD_LIBS $LIBS"
115 AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
116 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
117 AC_MSG_RESULT([$ax_pthread_ok])
118 if test "x$ax_pthread_ok" = "xno"; then
119 PTHREAD_LIBS=""
120 PTHREAD_CFLAGS=""
121 fi
122 CC="$ax_pthread_save_CC"
123 CFLAGS="$ax_pthread_save_CFLAGS"
124 LIBS="$ax_pthread_save_LIBS"
125fi
126
127# We must check for the threads library under a number of different
128# names; the ordering is very important because some systems
129# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
130# libraries is broken (non-POSIX).
131
132# Create a list of thread flags to try. Items with a "," contain both
133# C compiler flags (before ",") and linker flags (after ","). Other items
134# starting with a "-" are C compiler flags, and remaining items are
135# library names, except for "none" which indicates that we try without
136# any flags at all, and "pthread-config" which is a program returning
137# the flags for the Pth emulation library.
138
139ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
140
141# The ordering *is* (sometimes) important. Some notes on the
142# individual items follow:
143
144# pthreads: AIX (must check this before -lpthread)
145# none: in case threads are in libc; should be tried before -Kthread and
146# other compiler flags to prevent continual compiler warnings
147# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
148# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
149# (Note: HP C rejects this with "bad form for `-t' option")
150# -pthreads: Solaris/gcc (Note: HP C also rejects)
151# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
152# doesn't hurt to check since this sometimes defines pthreads and
153# -D_REENTRANT too), HP C (must be checked before -lpthread, which
154# is present but should not be used directly; and before -mthreads,
155# because the compiler interprets this as "-mt" + "-hreads")
156# -mthreads: Mingw32/gcc, Lynx/gcc
157# pthread: Linux, etcetera
158# --thread-safe: KAI C++
159# pthread-config: use pthread-config program (for GNU Pth library)
160
161case $host_os in
162
163 freebsd*)
164
165 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
166 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
167
168 ax_pthread_flags="-kthread lthread $ax_pthread_flags"
169 ;;
170
171 hpux*)
172
173 # From the cc(1) man page: "[-mt] Sets various -D flags to enable
174 # multi-threading and also sets -lpthread."
175
176 ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
177 ;;
178
179 openedition*)
180
181 # IBM z/OS requires a feature-test macro to be defined in order to
182 # enable POSIX threads at all, so give the user a hint if this is
183 # not set. (We don't define these ourselves, as they can affect
184 # other portions of the system API in unpredictable ways.)
185
186 AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
187 [
188# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
189 AX_PTHREAD_ZOS_MISSING
190# endif
191 ],
192 [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
193 ;;
194
195 solaris*)
196
197 # On Solaris (at least, for some versions), libc contains stubbed
198 # (non-functional) versions of the pthreads routines, so link-based
199 # tests will erroneously succeed. (N.B.: The stubs are missing
200 # pthread_cleanup_push, or rather a function called by this macro,
201 # so we could check for that, but who knows whether they'll stub
202 # that too in a future libc.) So we'll check first for the
203 # standard Solaris way of linking pthreads (-mt -lpthread).
204
205 ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
206 ;;
207esac
208
209# Are we compiling with Clang?
210
211AC_CACHE_CHECK([whether $CC is Clang],
212 [ax_cv_PTHREAD_CLANG],
213 [ax_cv_PTHREAD_CLANG=no
214 # Note that Autoconf sets GCC=yes for Clang as well as GCC
215 if test "x$GCC" = "xyes"; then
216 AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
217 [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
218# if defined(__clang__) && defined(__llvm__)
219 AX_PTHREAD_CC_IS_CLANG
220# endif
221 ],
222 [ax_cv_PTHREAD_CLANG=yes])
223 fi
224 ])
225ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
226
227
228# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
229
230# Note that for GCC and Clang -pthread generally implies -lpthread,
231# except when -nostdlib is passed.
232# This is problematic using libtool to build C++ shared libraries with pthread:
233# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
234# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
235# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
236# To solve this, first try -pthread together with -lpthread for GCC
237
238AS_IF([test "x$GCC" = "xyes"],
239 [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
240
241# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
242
243AS_IF([test "x$ax_pthread_clang" = "xyes"],
244 [ax_pthread_flags="-pthread,-lpthread -pthread"])
245
246
247# The presence of a feature test macro requesting re-entrant function
248# definitions is, on some systems, a strong hint that pthreads support is
249# correctly enabled
250
251case $host_os in
252 darwin* | hpux* | linux* | osf* | solaris*)
253 ax_pthread_check_macro="_REENTRANT"
254 ;;
255
256 aix*)
257 ax_pthread_check_macro="_THREAD_SAFE"
258 ;;
259
260 *)
261 ax_pthread_check_macro="--"
262 ;;
263esac
264AS_IF([test "x$ax_pthread_check_macro" = "x--"],
265 [ax_pthread_check_cond=0],
266 [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
267
268
269if test "x$ax_pthread_ok" = "xno"; then
270for ax_pthread_try_flag in $ax_pthread_flags; do
271
272 case $ax_pthread_try_flag in
273 none)
274 AC_MSG_CHECKING([whether pthreads work without any flags])
275 ;;
276
277 *,*)
278 PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
279 PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
280 AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
281 ;;
282
283 -*)
284 AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
285 PTHREAD_CFLAGS="$ax_pthread_try_flag"
286 ;;
287
288 pthread-config)
289 AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
290 AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
291 PTHREAD_CFLAGS="`pthread-config --cflags`"
292 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
293 ;;
294
295 *)
296 AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
297 PTHREAD_LIBS="-l$ax_pthread_try_flag"
298 ;;
299 esac
300
301 ax_pthread_save_CFLAGS="$CFLAGS"
302 ax_pthread_save_LIBS="$LIBS"
303 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
304 LIBS="$PTHREAD_LIBS $LIBS"
305
306 # Check for various functions. We must include pthread.h,
307 # since some functions may be macros. (On the Sequent, we
308 # need a special flag -Kthread to make this header compile.)
309 # We check for pthread_join because it is in -lpthread on IRIX
310 # while pthread_create is in libc. We check for pthread_attr_init
311 # due to DEC craziness with -lpthreads. We check for
312 # pthread_cleanup_push because it is one of the few pthread
313 # functions on Solaris that doesn't have a non-functional libc stub.
314 # We try pthread_create on general principles.
315
316 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
317# if $ax_pthread_check_cond
318# error "$ax_pthread_check_macro must be defined"
319# endif
320 static void *some_global = NULL;
321 static void routine(void *a)
322 {
323 /* To avoid any unused-parameter or
324 unused-but-set-parameter warning. */
325 some_global = a;
326 }
327 static void *start_routine(void *a) { return a; }],
328 [pthread_t th; pthread_attr_t attr;
329 pthread_create(&th, 0, start_routine, 0);
330 pthread_join(th, 0);
331 pthread_attr_init(&attr);
332 pthread_cleanup_push(routine, 0);
333 pthread_cleanup_pop(0) /* ; */])],
334 [ax_pthread_ok=yes],
335 [])
336
337 CFLAGS="$ax_pthread_save_CFLAGS"
338 LIBS="$ax_pthread_save_LIBS"
339
340 AC_MSG_RESULT([$ax_pthread_ok])
341 AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
342
343 PTHREAD_LIBS=""
344 PTHREAD_CFLAGS=""
345done
346fi
347
348
349# Clang needs special handling, because older versions handle the -pthread
350# option in a rather... idiosyncratic way
351
352if test "x$ax_pthread_clang" = "xyes"; then
353
354 # Clang takes -pthread; it has never supported any other flag
355
356 # (Note 1: This will need to be revisited if a system that Clang
357 # supports has POSIX threads in a separate library. This tends not
358 # to be the way of modern systems, but it's conceivable.)
359
360 # (Note 2: On some systems, notably Darwin, -pthread is not needed
361 # to get POSIX threads support; the API is always present and
362 # active. We could reasonably leave PTHREAD_CFLAGS empty. But
363 # -pthread does define _REENTRANT, and while the Darwin headers
364 # ignore this macro, third-party headers might not.)
365
366 # However, older versions of Clang make a point of warning the user
367 # that, in an invocation where only linking and no compilation is
368 # taking place, the -pthread option has no effect ("argument unused
369 # during compilation"). They expect -pthread to be passed in only
370 # when source code is being compiled.
371 #
372 # Problem is, this is at odds with the way Automake and most other
373 # C build frameworks function, which is that the same flags used in
374 # compilation (CFLAGS) are also used in linking. Many systems
375 # supported by AX_PTHREAD require exactly this for POSIX threads
376 # support, and in fact it is often not straightforward to specify a
377 # flag that is used only in the compilation phase and not in
378 # linking. Such a scenario is extremely rare in practice.
379 #
380 # Even though use of the -pthread flag in linking would only print
381 # a warning, this can be a nuisance for well-run software projects
382 # that build with -Werror. So if the active version of Clang has
383 # this misfeature, we search for an option to squash it.
384
385 AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
386 [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
387 [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
388 # Create an alternate version of $ac_link that compiles and
389 # links in two steps (.c -> .o, .o -> exe) instead of one
390 # (.c -> exe), because the warning occurs only in the second
391 # step
392 ax_pthread_save_ac_link="$ac_link"
393 ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
394 ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
395 ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
396 ax_pthread_save_CFLAGS="$CFLAGS"
397 for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
398 AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
399 CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
400 ac_link="$ax_pthread_save_ac_link"
401 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
402 [ac_link="$ax_pthread_2step_ac_link"
403 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
404 [break])
405 ])
406 done
407 ac_link="$ax_pthread_save_ac_link"
408 CFLAGS="$ax_pthread_save_CFLAGS"
409 AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
410 ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
411 ])
412
413 case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
414 no | unknown) ;;
415 *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
416 esac
417
418fi # $ax_pthread_clang = yes
419
420
421
422# Various other checks:
423if test "x$ax_pthread_ok" = "xyes"; then
424 ax_pthread_save_CFLAGS="$CFLAGS"
425 ax_pthread_save_LIBS="$LIBS"
426 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
427 LIBS="$PTHREAD_LIBS $LIBS"
428
429 # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
430 AC_CACHE_CHECK([for joinable pthread attribute],
431 [ax_cv_PTHREAD_JOINABLE_ATTR],
432 [ax_cv_PTHREAD_JOINABLE_ATTR=unknown
433 for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
434 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
435 [int attr = $ax_pthread_attr; return attr /* ; */])],
436 [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
437 [])
438 done
439 ])
440 AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
441 test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
442 test "x$ax_pthread_joinable_attr_defined" != "xyes"],
443 [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
444 [$ax_cv_PTHREAD_JOINABLE_ATTR],
445 [Define to necessary symbol if this constant
446 uses a non-standard name on your system.])
447 ax_pthread_joinable_attr_defined=yes
448 ])
449
450 AC_CACHE_CHECK([whether more special flags are required for pthreads],
451 [ax_cv_PTHREAD_SPECIAL_FLAGS],
452 [ax_cv_PTHREAD_SPECIAL_FLAGS=no
453 case $host_os in
454 solaris*)
455 ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
456 ;;
457 esac
458 ])
459 AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
460 test "x$ax_pthread_special_flags_added" != "xyes"],
461 [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
462 ax_pthread_special_flags_added=yes])
463
464 AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
465 [ax_cv_PTHREAD_PRIO_INHERIT],
466 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
467 [[int i = PTHREAD_PRIO_INHERIT;
468 return i;]])],
469 [ax_cv_PTHREAD_PRIO_INHERIT=yes],
470 [ax_cv_PTHREAD_PRIO_INHERIT=no])
471 ])
472 AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
473 test "x$ax_pthread_prio_inherit_defined" != "xyes"],
474 [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
475 ax_pthread_prio_inherit_defined=yes
476 ])
477
478 CFLAGS="$ax_pthread_save_CFLAGS"
479 LIBS="$ax_pthread_save_LIBS"
480
481 # More AIX lossage: compile with *_r variant
482 if test "x$GCC" != "xyes"; then
483 case $host_os in
484 aix*)
485 AS_CASE(["x/$CC"],
486 [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
487 [#handle absolute path differently from PATH based program lookup
488 AS_CASE(["x$CC"],
489 [x/*],
490 [
491 AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
492 AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
493 ],
494 [
495 AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
496 AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
497 ]
498 )
499 ])
500 ;;
501 esac
502 fi
503fi
504
505test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
506test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
507
508AC_SUBST([PTHREAD_LIBS])
509AC_SUBST([PTHREAD_CFLAGS])
510AC_SUBST([PTHREAD_CC])
511AC_SUBST([PTHREAD_CXX])
512
513# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
514if test "x$ax_pthread_ok" = "xyes"; then
515 ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
516 :
517else
518 ax_pthread_ok=no
519 $2
520fi
521AC_LANG_POP
522])dnl AX_PTHREAD
diff --git a/m4/ac_python_devel.m4 b/m4/ax_python_devel.m4
index 99ff7d0..44dbd83 100644
--- a/m4/ac_python_devel.m4
+++ b/m4/ax_python_devel.m4
@@ -1,10 +1,10 @@
1# =========================================================================== 1# ===========================================================================
2# http://autoconf-archive.cryp.to/ac_python_devel.html 2# https://www.gnu.org/software/autoconf-archive/ax_python_devel.html
3# =========================================================================== 3# ===========================================================================
4# 4#
5# SYNOPSIS 5# SYNOPSIS
6# 6#
7# AC_PYTHON_DEVEL([version]) 7# AX_PYTHON_DEVEL([version])
8# 8#
9# DESCRIPTION 9# DESCRIPTION
10# 10#
@@ -12,8 +12,8 @@
12# in your configure.ac. 12# in your configure.ac.
13# 13#
14# This macro checks for Python and tries to get the include path to 14# This macro checks for Python and tries to get the include path to
15# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) 15# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output
16# output variables. It also exports $(PYTHON_EXTRA_LIBS) and 16# variables. It also exports $(PYTHON_EXTRA_LIBS) and
17# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. 17# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
18# 18#
19# You can search for some particular version of Python by passing a 19# You can search for some particular version of Python by passing a
@@ -31,18 +31,15 @@
31# If you need to use this macro for an older Python version, please 31# If you need to use this macro for an older Python version, please
32# contact the authors. We're always open for feedback. 32# contact the authors. We're always open for feedback.
33# 33#
34# LAST MODIFICATION 34# LICENSE
35# 35#
36# 2008-04-12 36# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
37# 37# Copyright (c) 2009 Alan W. Irwin
38# COPYLEFT 38# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
39# 39# Copyright (c) 2009 Andrew Collier
40# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de> 40# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
41# Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca> 41# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
42# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net> 42# Copyright (c) 2013 Daniel Mullner <muellner@math.stanford.edu>
43# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
44# Copyright (c) 2008 Matteo Settenvini <matteo@member.fsf.org>
45# Copyright (c) 2008 Horst Knorr <hk_classes@knoda.org>
46# 43#
47# This program is free software: you can redistribute it and/or modify it 44# This program is free software: you can redistribute it and/or modify it
48# under the terms of the GNU General Public License as published by the 45# under the terms of the GNU General Public License as published by the
@@ -55,7 +52,7 @@
55# Public License for more details. 52# Public License for more details.
56# 53#
57# You should have received a copy of the GNU General Public License along 54# You should have received a copy of the GNU General Public License along
58# with this program. If not, see <http://www.gnu.org/licenses/>. 55# with this program. If not, see <https://www.gnu.org/licenses/>.
59# 56#
60# As a special exception, the respective Autoconf Macro's copyright owner 57# As a special exception, the respective Autoconf Macro's copyright owner
61# gives unlimited permission to copy, distribute and modify the configure 58# gives unlimited permission to copy, distribute and modify the configure
@@ -66,11 +63,14 @@
66# all other use of the material that constitutes the Autoconf Macro. 63# all other use of the material that constitutes the Autoconf Macro.
67# 64#
68# This special exception to the GPL applies to versions of the Autoconf 65# This special exception to the GPL applies to versions of the Autoconf
69# Macro released by the Autoconf Macro Archive. When you make and 66# Macro released by the Autoconf Archive. When you make and distribute a
70# distribute a modified version of the Autoconf Macro, you may extend this 67# modified version of the Autoconf Macro, you may extend this special
71# special exception to the GPL to apply to your modified version as well. 68# exception to the GPL to apply to your modified version as well.
69
70#serial 21
72 71
73AC_DEFUN([AC_PYTHON_DEVEL],[ 72AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
73AC_DEFUN([AX_PYTHON_DEVEL],[
74 # 74 #
75 # Allow the use of a (user set) custom python version 75 # Allow the use of a (user set) custom python version
76 # 76 #
@@ -89,9 +89,9 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
89 # Check for a version of Python >= 2.1.0 89 # Check for a version of Python >= 2.1.0
90 # 90 #
91 AC_MSG_CHECKING([for a version of Python >= '2.1.0']) 91 AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
92 ac_supports_python_ver=`$PYTHON -c "import sys, string; \ 92 ac_supports_python_ver=`$PYTHON -c "import sys; \
93 ver = string.split(sys.version)[[0]]; \ 93 ver = sys.version.split ()[[0]]; \
94 print ver >= '2.1.0'"` 94 print (ver >= '2.1.0')"`
95 if test "$ac_supports_python_ver" != "True"; then 95 if test "$ac_supports_python_ver" != "True"; then
96 if test -z "$PYTHON_NOVERSIONCHECK"; then 96 if test -z "$PYTHON_NOVERSIONCHECK"; then
97 AC_MSG_RESULT([no]) 97 AC_MSG_RESULT([no])
@@ -99,7 +99,7 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
99This version of the AC@&t@_PYTHON_DEVEL macro 99This version of the AC@&t@_PYTHON_DEVEL macro
100doesn't work properly with versions of Python before 100doesn't work properly with versions of Python before
1012.1.0. You may need to re-run configure, setting the 1012.1.0. You may need to re-run configure, setting the
102variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, 102variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG,
103PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. 103PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
104Moreover, to disable this check, set PYTHON_NOVERSIONCHECK 104Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
105to something else than an empty string. 105to something else than an empty string.
@@ -116,11 +116,11 @@ to something else than an empty string.
116 # 116 #
117 if test -n "$1"; then 117 if test -n "$1"; then
118 AC_MSG_CHECKING([for a version of Python $1]) 118 AC_MSG_CHECKING([for a version of Python $1])
119 ac_supports_python_ver=`$PYTHON -c "import sys, string; \ 119 ac_supports_python_ver=`$PYTHON -c "import sys; \
120 ver = string.split(sys.version)[[0]]; \ 120 ver = sys.version.split ()[[0]]; \
121 print ver $1"` 121 print (ver $1)"`
122 if test "$ac_supports_python_ver" = "True"; then 122 if test "$ac_supports_python_ver" = "True"; then
123 AC_MSG_RESULT([yes]) 123 AC_MSG_RESULT([yes])
124 else 124 else
125 AC_MSG_RESULT([no]) 125 AC_MSG_RESULT([no])
126 AC_MSG_ERROR([this package requires Python $1. 126 AC_MSG_ERROR([this package requires Python $1.
@@ -137,7 +137,7 @@ variable to configure. See ``configure --help'' for reference.
137 # 137 #
138 AC_MSG_CHECKING([for the distutils Python package]) 138 AC_MSG_CHECKING([for the distutils Python package])
139 ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` 139 ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
140 if test -z "$ac_distutils_result"; then 140 if test $? -eq 0; then
141 AC_MSG_RESULT([yes]) 141 AC_MSG_RESULT([yes])
142 else 142 else
143 AC_MSG_RESULT([no]) 143 AC_MSG_RESULT([no])
@@ -153,9 +153,15 @@ $ac_distutils_result])
153 AC_MSG_CHECKING([for Python include path]) 153 AC_MSG_CHECKING([for Python include path])
154 if test -z "$PYTHON_CPPFLAGS"; then 154 if test -z "$PYTHON_CPPFLAGS"; then
155 python_path=`$PYTHON -c "import distutils.sysconfig; \ 155 python_path=`$PYTHON -c "import distutils.sysconfig; \
156 print distutils.sysconfig.get_python_inc();"` 156 print (distutils.sysconfig.get_python_inc ());"`
157 plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
158 print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
157 if test -n "${python_path}"; then 159 if test -n "${python_path}"; then
158 python_path="-I$python_path" 160 if test "${plat_python_path}" != "${python_path}"; then
161 python_path="-I$python_path -I$plat_python_path"
162 else
163 python_path="-I$python_path"
164 fi
159 fi 165 fi
160 PYTHON_CPPFLAGS=$python_path 166 PYTHON_CPPFLAGS=$python_path
161 fi 167 fi
@@ -166,28 +172,80 @@ $ac_distutils_result])
166 # Check for Python library path 172 # Check for Python library path
167 # 173 #
168 AC_MSG_CHECKING([for Python library path]) 174 AC_MSG_CHECKING([for Python library path])
169 if test -z "$PYTHON_LDFLAGS"; then 175 if test -z "$PYTHON_LIBS"; then
170 # (makes two attempts to ensure we've got a version number 176 # (makes two attempts to ensure we've got a version number
171 # from the interpreter) 177 # from the interpreter)
172 py_version=`$PYTHON -c "from distutils.sysconfig import *; \ 178 ac_python_version=`cat<<EOD | $PYTHON -
173 from string import join; \ 179
174 print join(get_config_vars('VERSION'))"` 180# join all versioning strings, on some systems
175 if test "$py_version" = "[None]"; then 181# major/minor numbers could be in different list elements
182from distutils.sysconfig import *
183e = get_config_var('VERSION')
184if e is not None:
185 print(e)
186EOD`
187
188 if test -z "$ac_python_version"; then
176 if test -n "$PYTHON_VERSION"; then 189 if test -n "$PYTHON_VERSION"; then
177 py_version=$PYTHON_VERSION 190 ac_python_version=$PYTHON_VERSION
178 else 191 else
179 py_version=`$PYTHON -c "import sys; \ 192 ac_python_version=`$PYTHON -c "import sys; \
180 print sys.version[[:3]]"` 193 print (sys.version[[:3]])"`
181 fi 194 fi
182 fi 195 fi
183 196
184 PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ 197 # Make the versioning information available to the compiler
185 from string import join; \ 198 AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
186 print '-L' + get_python_lib(0,1), \ 199 [If available, contains the Python version number currently in use.])
187 '-lpython';"`$py_version 200
201 # First, the library directory:
202 ac_python_libdir=`cat<<EOD | $PYTHON -
203
204# There should be only one
205import distutils.sysconfig
206e = distutils.sysconfig.get_config_var('LIBDIR')
207if e is not None:
208 print (e)
209EOD`
210
211 # Now, for the library:
212 ac_python_library=`cat<<EOD | $PYTHON -
213
214import distutils.sysconfig
215c = distutils.sysconfig.get_config_vars()
216if 'LDVERSION' in c:
217 print ('python'+c[['LDVERSION']])
218else:
219 print ('python'+c[['VERSION']])
220EOD`
221
222 # This small piece shamelessly adapted from PostgreSQL python macro;
223 # credits goes to momjian, I think. I'd like to put the right name
224 # in the credits, if someone can point me in the right direction... ?
225 #
226 if test -n "$ac_python_libdir" -a -n "$ac_python_library"
227 then
228 # use the official shared library
229 ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
230 PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library"
231 else
232 # old way: use libpython from python_configdir
233 ac_python_libdir=`$PYTHON -c \
234 "from distutils.sysconfig import get_python_lib as f; \
235 import os; \
236 print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
237 PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version"
238 fi
239
240 if test -z "PYTHON_LIBS"; then
241 AC_MSG_ERROR([
242 Cannot determine location of your Python DSO. Please check it was installed with
243 dynamic libraries enabled, or try setting PYTHON_LIBS by hand.
244 ])
245 fi
188 fi 246 fi
189 AC_MSG_RESULT([$PYTHON_LDFLAGS]) 247 AC_MSG_RESULT([$PYTHON_LIBS])
190 AC_SUBST([PYTHON_LDFLAGS]) 248 AC_SUBST([PYTHON_LIBS])
191 249
192 # 250 #
193 # Check for site packages 251 # Check for site packages
@@ -195,7 +253,7 @@ $ac_distutils_result])
195 AC_MSG_CHECKING([for Python site-packages path]) 253 AC_MSG_CHECKING([for Python site-packages path])
196 if test -z "$PYTHON_SITE_PKG"; then 254 if test -z "$PYTHON_SITE_PKG"; then
197 PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ 255 PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
198 print distutils.sysconfig.get_python_lib(0,0);"` 256 print (distutils.sysconfig.get_python_lib(0,0));"`
199 fi 257 fi
200 AC_MSG_RESULT([$PYTHON_SITE_PKG]) 258 AC_MSG_RESULT([$PYTHON_SITE_PKG])
201 AC_SUBST([PYTHON_SITE_PKG]) 259 AC_SUBST([PYTHON_SITE_PKG])
@@ -207,7 +265,7 @@ $ac_distutils_result])
207 if test -z "$PYTHON_EXTRA_LIBS"; then 265 if test -z "$PYTHON_EXTRA_LIBS"; then
208 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ 266 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
209 conf = distutils.sysconfig.get_config_var; \ 267 conf = distutils.sysconfig.get_config_var; \
210 print conf('LOCALMODLIBS'), conf('LIBS')"` 268 print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
211 fi 269 fi
212 AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) 270 AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
213 AC_SUBST(PYTHON_EXTRA_LIBS) 271 AC_SUBST(PYTHON_EXTRA_LIBS)
@@ -219,7 +277,7 @@ $ac_distutils_result])
219 if test -z "$PYTHON_EXTRA_LDFLAGS"; then 277 if test -z "$PYTHON_EXTRA_LDFLAGS"; then
220 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ 278 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
221 conf = distutils.sysconfig.get_config_var; \ 279 conf = distutils.sysconfig.get_config_var; \
222 print conf('LINKFORSHARED')"` 280 print (conf('LINKFORSHARED'))"`
223 fi 281 fi
224 AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) 282 AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
225 AC_SUBST(PYTHON_EXTRA_LDFLAGS) 283 AC_SUBST(PYTHON_EXTRA_LDFLAGS)
@@ -228,24 +286,32 @@ $ac_distutils_result])
228 # final check to see if everything compiles alright 286 # final check to see if everything compiles alright
229 # 287 #
230 AC_MSG_CHECKING([consistency of all components of python development environment]) 288 AC_MSG_CHECKING([consistency of all components of python development environment])
231 AC_LANG_PUSH([C])
232 # save current global flags 289 # save current global flags
233 LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" 290 ac_save_LIBS="$LIBS"
291 ac_save_LDFLAGS="$LDFLAGS"
292 ac_save_CPPFLAGS="$CPPFLAGS"
293 LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS $PYTHON_EXTRA_LIBS"
294 LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
234 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" 295 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
235 AC_TRY_LINK([ 296 AC_LANG_PUSH([C])
236 #include <Python.h> 297 AC_LINK_IFELSE([
237 ],[ 298 AC_LANG_PROGRAM([[#include <Python.h>]],
238 Py_Initialize(); 299 [[Py_Initialize();]])
239 ],[pythonexists=yes],[pythonexists=no]) 300 ],[pythonexists=yes],[pythonexists=no])
301 AC_LANG_POP([C])
302 # turn back to default flags
303 CPPFLAGS="$ac_save_CPPFLAGS"
304 LIBS="$ac_save_LIBS"
305 LDFLAGS="$ac_save_LDFLAGS"
240 306
241 AC_MSG_RESULT([$pythonexists]) 307 AC_MSG_RESULT([$pythonexists])
242 308
243 if test ! "$pythonexists" = "yes"; then 309 if test ! "x$pythonexists" = "xyes"; then
244 AC_MSG_ERROR([ 310 AC_MSG_FAILURE([
245 Could not link test program to Python. Maybe the main Python library has been 311 Could not link test program to Python. Maybe the main Python library has been
246 installed in some non-standard library path. If so, pass it to configure, 312 installed in some non-standard library path. If so, pass it to configure,
247 via the LDFLAGS environment variable. 313 via the LIBS environment variable.
248 Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" 314 Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
249 ============================================================================ 315 ============================================================================
250 ERROR! 316 ERROR!
251 You probably have to install the development version of the Python package 317 You probably have to install the development version of the Python package
@@ -254,10 +320,6 @@ $ac_distutils_result])
254 ]) 320 ])
255 PYTHON_VERSION="" 321 PYTHON_VERSION=""
256 fi 322 fi
257 AC_LANG_POP
258 # turn back to default flags
259 CPPFLAGS="$ac_save_CPPFLAGS"
260 LIBS="$ac_save_LIBS"
261 323
262 # 324 #
263 # all done! 325 # all done!
diff --git a/m4/ax_swig_enable_cxx.m4 b/m4/ax_swig_enable_cxx.m4
deleted file mode 100644
index c1eca8c..0000000
--- a/m4/ax_swig_enable_cxx.m4
+++ /dev/null
@@ -1,53 +0,0 @@
1# ===========================================================================
2# http://www.nongnu.org/autoconf-archive/ax_swig_enable_cxx.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# AX_SWIG_ENABLE_CXX
8#
9# DESCRIPTION
10#
11# Enable SWIG C++ support. This affects all invocations of $(SWIG).
12#
13# LICENSE
14#
15# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
16# Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
17# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
18# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
19#
20# This program is free software; you can redistribute it and/or modify it
21# under the terms of the GNU General Public License as published by the
22# Free Software Foundation; either version 2 of the License, or (at your
23# option) any later version.
24#
25# This program is distributed in the hope that it will be useful, but
26# WITHOUT ANY WARRANTY; without even the implied warranty of
27# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
28# Public License for more details.
29#
30# You should have received a copy of the GNU General Public License along
31# with this program. If not, see <http://www.gnu.org/licenses/>.
32#
33# As a special exception, the respective Autoconf Macro's copyright owner
34# gives unlimited permission to copy, distribute and modify the configure
35# scripts that are the output of Autoconf when processing the Macro. You
36# need not follow the terms of the GNU General Public License when using
37# or distributing such scripts, even though portions of the text of the
38# Macro appear in them. The GNU General Public License (GPL) does govern
39# all other use of the material that constitutes the Autoconf Macro.
40#
41# This special exception to the GPL applies to versions of the Autoconf
42# Macro released by the Autoconf Archive. When you make and distribute a
43# modified version of the Autoconf Macro, you may extend this special
44# exception to the GPL to apply to your modified version as well.
45
46AU_ALIAS([SWIG_ENABLE_CXX], [AX_SWIG_ENABLE_CXX])
47AC_DEFUN([AX_SWIG_ENABLE_CXX],[
48 AC_REQUIRE([AC_PROG_SWIG])
49 AC_REQUIRE([AC_PROG_CXX])
50 if test "$SWIG" != "false"; then
51 SWIG="$SWIG -c++"
52 fi
53])
diff --git a/m4/cython_python.m4 b/m4/cython_python.m4
new file mode 100644
index 0000000..5b4a041
--- /dev/null
+++ b/m4/cython_python.m4
@@ -0,0 +1,7 @@
1AC_DEFUN([CYTHON_PYTHON],[
2 AC_REQUIRE([AC_PROG_CYTHON])
3 AC_REQUIRE([AX_PYTHON_DEVEL])
4 test "x$1" != "xno" || cython_shadow=" -noproxy"
5 AC_SUBST([CYTHON_PYTHON_OPT],[-python$cython_shadow])
6 AC_SUBST([CYTHON_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
7])
diff --git a/m4/swig_python.m4 b/m4/swig_python.m4
deleted file mode 100644
index 2496976..0000000
--- a/m4/swig_python.m4
+++ /dev/null
@@ -1,65 +0,0 @@
1# ===========================================================================
2# http://autoconf-archive.cryp.to/swig_python.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# SWIG_PYTHON([use-shadow-classes = {no, yes}])
8#
9# DESCRIPTION
10#
11# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS), and
12# $(SWIG_PYTHON_OPT) output variables.
13#
14# $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate code
15# for Python. Shadow classes are enabled unless the value of the optional
16# first argument is exactly 'no'. If you need multi module support
17# (provided by the SWIG_MULTI_MODULE_SUPPORT macro) use
18# $(SWIG_PYTHON_LIBS) to link against the appropriate library. It contains
19# the SWIG Python runtime library that is needed by the type check system
20# for example.
21#
22# LAST MODIFICATION
23#
24# 2008-04-12
25#
26# COPYLEFT
27#
28# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
29# Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
30# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
31# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
32#
33# This program is free software; you can redistribute it and/or modify it
34# under the terms of the GNU General Public License as published by the
35# Free Software Foundation; either version 2 of the License, or (at your
36# option) any later version.
37#
38# This program is distributed in the hope that it will be useful, but
39# WITHOUT ANY WARRANTY; without even the implied warranty of
40# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
41# Public License for more details.
42#
43# You should have received a copy of the GNU General Public License along
44# with this program. If not, see <http://www.gnu.org/licenses/>.
45#
46# As a special exception, the respective Autoconf Macro's copyright owner
47# gives unlimited permission to copy, distribute and modify the configure
48# scripts that are the output of Autoconf when processing the Macro. You
49# need not follow the terms of the GNU General Public License when using
50# or distributing such scripts, even though portions of the text of the
51# Macro appear in them. The GNU General Public License (GPL) does govern
52# all other use of the material that constitutes the Autoconf Macro.
53#
54# This special exception to the GPL applies to versions of the Autoconf
55# Macro released by the Autoconf Macro Archive. When you make and
56# distribute a modified version of the Autoconf Macro, you may extend this
57# special exception to the GPL to apply to your modified version as well.
58
59AC_DEFUN([SWIG_PYTHON],[
60 AC_REQUIRE([AC_PROG_SWIG])
61 AC_REQUIRE([AC_PYTHON_DEVEL])
62 test "x$1" != "xno" || swig_shadow=" -noproxy"
63 AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow])
64 AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
65])