diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ac_pkg_cython.m4 | 67 | ||||
-rw-r--r-- | m4/ac_pkg_swig.m4 | 122 | ||||
-rw-r--r-- | m4/ac_python_devel.m4 | 265 | ||||
-rw-r--r-- | m4/as-compiler-flag.m4 | 4 | ||||
-rw-r--r-- | m4/ax_pthread.m4 | 522 | ||||
-rw-r--r-- | m4/ax_python_devel.m4 | 468 | ||||
-rw-r--r-- | m4/ax_swig_enable_cxx.m4 | 53 | ||||
-rw-r--r-- | m4/cython_python.m4 | 7 | ||||
-rw-r--r-- | m4/swig_python.m4 | 65 |
9 files changed, 1066 insertions, 507 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 | |||
2 | AC_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 | |||
64 | AC_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/ac_python_devel.m4 b/m4/ac_python_devel.m4 deleted file mode 100644 index 99ff7d0..0000000 --- a/m4/ac_python_devel.m4 +++ /dev/null | |||
@@ -1,265 +0,0 @@ | |||
1 | # =========================================================================== | ||
2 | # http://autoconf-archive.cryp.to/ac_python_devel.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AC_PYTHON_DEVEL([version]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Note: Defines as a precious variable "PYTHON_VERSION". Don't override it | ||
12 | # in your configure.ac. | ||
13 | # | ||
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) | ||
16 | # output variables. It also exports $(PYTHON_EXTRA_LIBS) and | ||
17 | # $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. | ||
18 | # | ||
19 | # You can search for some particular version of Python by passing a | ||
20 | # parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please | ||
21 | # note that you *have* to pass also an operator along with the version to | ||
22 | # match, and pay special attention to the single quotes surrounding the | ||
23 | # version number. Don't use "PYTHON_VERSION" for this: that environment | ||
24 | # variable is declared as precious and thus reserved for the end-user. | ||
25 | # | ||
26 | # This macro should work for all versions of Python >= 2.1.0. As an end | ||
27 | # user, you can disable the check for the python version by setting the | ||
28 | # PYTHON_NOVERSIONCHECK environment variable to something else than the | ||
29 | # empty string. | ||
30 | # | ||
31 | # If you need to use this macro for an older Python version, please | ||
32 | # contact the authors. We're always open for feedback. | ||
33 | # | ||
34 | # LAST MODIFICATION | ||
35 | # | ||
36 | # 2008-04-12 | ||
37 | # | ||
38 | # COPYLEFT | ||
39 | # | ||
40 | # Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de> | ||
41 | # Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca> | ||
42 | # Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net> | ||
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 | # | ||
47 | # 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 | ||
49 | # Free Software Foundation, either version 3 of the License, or (at your | ||
50 | # option) any later version. | ||
51 | # | ||
52 | # This program is distributed in the hope that it will be useful, but | ||
53 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
54 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
55 | # Public License for more details. | ||
56 | # | ||
57 | # 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/>. | ||
59 | # | ||
60 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
61 | # gives unlimited permission to copy, distribute and modify the configure | ||
62 | # scripts that are the output of Autoconf when processing the Macro. You | ||
63 | # need not follow the terms of the GNU General Public License when using | ||
64 | # or distributing such scripts, even though portions of the text of the | ||
65 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
66 | # all other use of the material that constitutes the Autoconf Macro. | ||
67 | # | ||
68 | # This special exception to the GPL applies to versions of the Autoconf | ||
69 | # Macro released by the Autoconf Macro Archive. When you make and | ||
70 | # distribute a modified version of the Autoconf Macro, you may extend this | ||
71 | # special exception to the GPL to apply to your modified version as well. | ||
72 | |||
73 | AC_DEFUN([AC_PYTHON_DEVEL],[ | ||
74 | # | ||
75 | # Allow the use of a (user set) custom python version | ||
76 | # | ||
77 | AC_ARG_VAR([PYTHON_VERSION],[The installed Python | ||
78 | version to use, for example '2.3'. This string | ||
79 | will be appended to the Python interpreter | ||
80 | canonical name.]) | ||
81 | |||
82 | AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) | ||
83 | if test -z "$PYTHON"; then | ||
84 | AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) | ||
85 | PYTHON_VERSION="" | ||
86 | fi | ||
87 | |||
88 | # | ||
89 | # Check for a version of Python >= 2.1.0 | ||
90 | # | ||
91 | AC_MSG_CHECKING([for a version of Python >= '2.1.0']) | ||
92 | ac_supports_python_ver=`$PYTHON -c "import sys, string; \ | ||
93 | ver = string.split(sys.version)[[0]]; \ | ||
94 | print ver >= '2.1.0'"` | ||
95 | if test "$ac_supports_python_ver" != "True"; then | ||
96 | if test -z "$PYTHON_NOVERSIONCHECK"; then | ||
97 | AC_MSG_RESULT([no]) | ||
98 | AC_MSG_FAILURE([ | ||
99 | This version of the AC@&t@_PYTHON_DEVEL macro | ||
100 | doesn't work properly with versions of Python before | ||
101 | 2.1.0. You may need to re-run configure, setting the | ||
102 | variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, | ||
103 | PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. | ||
104 | Moreover, to disable this check, set PYTHON_NOVERSIONCHECK | ||
105 | to something else than an empty string. | ||
106 | ]) | ||
107 | else | ||
108 | AC_MSG_RESULT([skip at user request]) | ||
109 | fi | ||
110 | else | ||
111 | AC_MSG_RESULT([yes]) | ||
112 | fi | ||
113 | |||
114 | # | ||
115 | # if the macro parameter ``version'' is set, honour it | ||
116 | # | ||
117 | if test -n "$1"; then | ||
118 | AC_MSG_CHECKING([for a version of Python $1]) | ||
119 | ac_supports_python_ver=`$PYTHON -c "import sys, string; \ | ||
120 | ver = string.split(sys.version)[[0]]; \ | ||
121 | print ver $1"` | ||
122 | if test "$ac_supports_python_ver" = "True"; then | ||
123 | AC_MSG_RESULT([yes]) | ||
124 | else | ||
125 | AC_MSG_RESULT([no]) | ||
126 | AC_MSG_ERROR([this package requires Python $1. | ||
127 | If you have it installed, but it isn't the default Python | ||
128 | interpreter in your system path, please pass the PYTHON_VERSION | ||
129 | variable to configure. See ``configure --help'' for reference. | ||
130 | ]) | ||
131 | PYTHON_VERSION="" | ||
132 | fi | ||
133 | fi | ||
134 | |||
135 | # | ||
136 | # Check if you have distutils, else fail | ||
137 | # | ||
138 | AC_MSG_CHECKING([for the distutils Python package]) | ||
139 | ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` | ||
140 | if test -z "$ac_distutils_result"; then | ||
141 | AC_MSG_RESULT([yes]) | ||
142 | else | ||
143 | AC_MSG_RESULT([no]) | ||
144 | AC_MSG_ERROR([cannot import Python module "distutils". | ||
145 | Please check your Python installation. The error was: | ||
146 | $ac_distutils_result]) | ||
147 | PYTHON_VERSION="" | ||
148 | fi | ||
149 | |||
150 | # | ||
151 | # Check for Python include path | ||
152 | # | ||
153 | AC_MSG_CHECKING([for Python include path]) | ||
154 | if test -z "$PYTHON_CPPFLAGS"; then | ||
155 | python_path=`$PYTHON -c "import distutils.sysconfig; \ | ||
156 | print distutils.sysconfig.get_python_inc();"` | ||
157 | if test -n "${python_path}"; then | ||
158 | python_path="-I$python_path" | ||
159 | fi | ||
160 | PYTHON_CPPFLAGS=$python_path | ||
161 | fi | ||
162 | AC_MSG_RESULT([$PYTHON_CPPFLAGS]) | ||
163 | AC_SUBST([PYTHON_CPPFLAGS]) | ||
164 | |||
165 | # | ||
166 | # Check for Python library path | ||
167 | # | ||
168 | AC_MSG_CHECKING([for Python library path]) | ||
169 | if test -z "$PYTHON_LDFLAGS"; then | ||
170 | # (makes two attempts to ensure we've got a version number | ||
171 | # from the interpreter) | ||
172 | py_version=`$PYTHON -c "from distutils.sysconfig import *; \ | ||
173 | from string import join; \ | ||
174 | print join(get_config_vars('VERSION'))"` | ||
175 | if test "$py_version" = "[None]"; then | ||
176 | if test -n "$PYTHON_VERSION"; then | ||
177 | py_version=$PYTHON_VERSION | ||
178 | else | ||
179 | py_version=`$PYTHON -c "import sys; \ | ||
180 | print sys.version[[:3]]"` | ||
181 | fi | ||
182 | fi | ||
183 | |||
184 | PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ | ||
185 | from string import join; \ | ||
186 | print '-L' + get_python_lib(0,1), \ | ||
187 | '-lpython';"`$py_version | ||
188 | fi | ||
189 | AC_MSG_RESULT([$PYTHON_LDFLAGS]) | ||
190 | AC_SUBST([PYTHON_LDFLAGS]) | ||
191 | |||
192 | # | ||
193 | # Check for site packages | ||
194 | # | ||
195 | AC_MSG_CHECKING([for Python site-packages path]) | ||
196 | if test -z "$PYTHON_SITE_PKG"; then | ||
197 | PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ | ||
198 | print distutils.sysconfig.get_python_lib(0,0);"` | ||
199 | fi | ||
200 | AC_MSG_RESULT([$PYTHON_SITE_PKG]) | ||
201 | AC_SUBST([PYTHON_SITE_PKG]) | ||
202 | |||
203 | # | ||
204 | # libraries which must be linked in when embedding | ||
205 | # | ||
206 | AC_MSG_CHECKING(python extra libraries) | ||
207 | if test -z "$PYTHON_EXTRA_LIBS"; then | ||
208 | PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ | ||
209 | conf = distutils.sysconfig.get_config_var; \ | ||
210 | print conf('LOCALMODLIBS'), conf('LIBS')"` | ||
211 | fi | ||
212 | AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) | ||
213 | AC_SUBST(PYTHON_EXTRA_LIBS) | ||
214 | |||
215 | # | ||
216 | # linking flags needed when embedding | ||
217 | # | ||
218 | AC_MSG_CHECKING(python extra linking flags) | ||
219 | if test -z "$PYTHON_EXTRA_LDFLAGS"; then | ||
220 | PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ | ||
221 | conf = distutils.sysconfig.get_config_var; \ | ||
222 | print conf('LINKFORSHARED')"` | ||
223 | fi | ||
224 | AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) | ||
225 | AC_SUBST(PYTHON_EXTRA_LDFLAGS) | ||
226 | |||
227 | # | ||
228 | # final check to see if everything compiles alright | ||
229 | # | ||
230 | AC_MSG_CHECKING([consistency of all components of python development environment]) | ||
231 | AC_LANG_PUSH([C]) | ||
232 | # save current global flags | ||
233 | LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" | ||
234 | CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" | ||
235 | AC_TRY_LINK([ | ||
236 | #include <Python.h> | ||
237 | ],[ | ||
238 | Py_Initialize(); | ||
239 | ],[pythonexists=yes],[pythonexists=no]) | ||
240 | |||
241 | AC_MSG_RESULT([$pythonexists]) | ||
242 | |||
243 | if test ! "$pythonexists" = "yes"; then | ||
244 | AC_MSG_ERROR([ | ||
245 | 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, | ||
247 | via the LDFLAGS environment variable. | ||
248 | Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" | ||
249 | ============================================================================ | ||
250 | ERROR! | ||
251 | You probably have to install the development version of the Python package | ||
252 | for your distribution. The exact name of this package varies among them. | ||
253 | ============================================================================ | ||
254 | ]) | ||
255 | PYTHON_VERSION="" | ||
256 | fi | ||
257 | AC_LANG_POP | ||
258 | # turn back to default flags | ||
259 | CPPFLAGS="$ac_save_CPPFLAGS" | ||
260 | LIBS="$ac_save_LIBS" | ||
261 | |||
262 | # | ||
263 | # all done! | ||
264 | # | ||
265 | ]) | ||
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 | |||
92 | AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) | ||
93 | AC_DEFUN([AX_PTHREAD], [ | ||
94 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
95 | AC_REQUIRE([AC_PROG_CC]) | ||
96 | AC_REQUIRE([AC_PROG_SED]) | ||
97 | AC_LANG_PUSH([C]) | ||
98 | ax_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: | ||
107 | if 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" | ||
125 | fi | ||
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 | |||
139 | ax_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 | |||
161 | case $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 | ;; | ||
207 | esac | ||
208 | |||
209 | # Are we compiling with Clang? | ||
210 | |||
211 | AC_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 | ]) | ||
225 | ax_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 | |||
238 | AS_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 | |||
243 | AS_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 | |||
251 | case $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 | ;; | ||
263 | esac | ||
264 | AS_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 | |||
269 | if test "x$ax_pthread_ok" = "xno"; then | ||
270 | for 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="" | ||
345 | done | ||
346 | fi | ||
347 | |||
348 | |||
349 | # Clang needs special handling, because older versions handle the -pthread | ||
350 | # option in a rather... idiosyncratic way | ||
351 | |||
352 | if 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 | |||
418 | fi # $ax_pthread_clang = yes | ||
419 | |||
420 | |||
421 | |||
422 | # Various other checks: | ||
423 | if 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 | ||
503 | fi | ||
504 | |||
505 | test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" | ||
506 | test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" | ||
507 | |||
508 | AC_SUBST([PTHREAD_LIBS]) | ||
509 | AC_SUBST([PTHREAD_CFLAGS]) | ||
510 | AC_SUBST([PTHREAD_CC]) | ||
511 | AC_SUBST([PTHREAD_CXX]) | ||
512 | |||
513 | # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: | ||
514 | if 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 | : | ||
517 | else | ||
518 | ax_pthread_ok=no | ||
519 | $2 | ||
520 | fi | ||
521 | AC_LANG_POP | ||
522 | ])dnl AX_PTHREAD | ||
diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 new file mode 100644 index 0000000..935056c --- /dev/null +++ b/m4/ax_python_devel.m4 | |||
@@ -0,0 +1,468 @@ | |||
1 | # =========================================================================== | ||
2 | # https://www.gnu.org/software/autoconf-archive/ax_python_devel.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_PYTHON_DEVEL([version[,optional]]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Note: Defines as a precious variable "PYTHON_VERSION". Don't override it | ||
12 | # in your configure.ac. | ||
13 | # | ||
14 | # This macro checks for Python and tries to get the include path to | ||
15 | # 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output | ||
16 | # variables. It also exports $(PYTHON_EXTRA_LIBS) and | ||
17 | # $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. | ||
18 | # | ||
19 | # You can search for some particular version of Python by passing a | ||
20 | # parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please | ||
21 | # note that you *have* to pass also an operator along with the version to | ||
22 | # match, and pay special attention to the single quotes surrounding the | ||
23 | # version number. Don't use "PYTHON_VERSION" for this: that environment | ||
24 | # variable is declared as precious and thus reserved for the end-user. | ||
25 | # | ||
26 | # By default this will fail if it does not detect a development version of | ||
27 | # python. If you want it to continue, set optional to true, like | ||
28 | # AX_PYTHON_DEVEL([], [true]). The ax_python_devel_found variable will be | ||
29 | # "no" if it fails. | ||
30 | # | ||
31 | # This macro should work for all versions of Python >= 2.1.0. As an end | ||
32 | # user, you can disable the check for the python version by setting the | ||
33 | # PYTHON_NOVERSIONCHECK environment variable to something else than the | ||
34 | # empty string. | ||
35 | # | ||
36 | # If you need to use this macro for an older Python version, please | ||
37 | # contact the authors. We're always open for feedback. | ||
38 | # | ||
39 | # LICENSE | ||
40 | # | ||
41 | # Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de> | ||
42 | # Copyright (c) 2009 Alan W. Irwin | ||
43 | # Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net> | ||
44 | # Copyright (c) 2009 Andrew Collier | ||
45 | # Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org> | ||
46 | # Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org> | ||
47 | # Copyright (c) 2013 Daniel Mullner <muellner@math.stanford.edu> | ||
48 | # | ||
49 | # This program is free software: you can redistribute it and/or modify it | ||
50 | # under the terms of the GNU General Public License as published by the | ||
51 | # Free Software Foundation, either version 3 of the License, or (at your | ||
52 | # option) any later version. | ||
53 | # | ||
54 | # This program is distributed in the hope that it will be useful, but | ||
55 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
56 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
57 | # Public License for more details. | ||
58 | # | ||
59 | # You should have received a copy of the GNU General Public License along | ||
60 | # with this program. If not, see <https://www.gnu.org/licenses/>. | ||
61 | # | ||
62 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
63 | # gives unlimited permission to copy, distribute and modify the configure | ||
64 | # scripts that are the output of Autoconf when processing the Macro. You | ||
65 | # need not follow the terms of the GNU General Public License when using | ||
66 | # or distributing such scripts, even though portions of the text of the | ||
67 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
68 | # all other use of the material that constitutes the Autoconf Macro. | ||
69 | # | ||
70 | # This special exception to the GPL applies to versions of the Autoconf | ||
71 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
72 | # modified version of the Autoconf Macro, you may extend this special | ||
73 | # exception to the GPL to apply to your modified version as well. | ||
74 | |||
75 | #serial 37 | ||
76 | |||
77 | AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) | ||
78 | AC_DEFUN([AX_PYTHON_DEVEL],[ | ||
79 | # Get whether it's optional | ||
80 | if test -z "$2"; then | ||
81 | ax_python_devel_optional=false | ||
82 | else | ||
83 | ax_python_devel_optional=$2 | ||
84 | fi | ||
85 | ax_python_devel_found=yes | ||
86 | |||
87 | # | ||
88 | # Allow the use of a (user set) custom python version | ||
89 | # | ||
90 | AC_ARG_VAR([PYTHON_VERSION],[The installed Python | ||
91 | version to use, for example '2.3'. This string | ||
92 | will be appended to the Python interpreter | ||
93 | canonical name.]) | ||
94 | |||
95 | AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) | ||
96 | if test -z "$PYTHON"; then | ||
97 | AC_MSG_WARN([Cannot find python$PYTHON_VERSION in your system path]) | ||
98 | if ! $ax_python_devel_optional; then | ||
99 | AC_MSG_ERROR([Giving up, python development not available]) | ||
100 | fi | ||
101 | ax_python_devel_found=no | ||
102 | PYTHON_VERSION="" | ||
103 | fi | ||
104 | |||
105 | if test $ax_python_devel_found = yes; then | ||
106 | # | ||
107 | # Check for a version of Python >= 2.1.0 | ||
108 | # | ||
109 | AC_MSG_CHECKING([for a version of Python >= '2.1.0']) | ||
110 | ac_supports_python_ver=`$PYTHON -c "import sys; \ | ||
111 | ver = sys.version.split ()[[0]]; \ | ||
112 | print (ver >= '2.1.0')"` | ||
113 | if test "$ac_supports_python_ver" != "True"; then | ||
114 | if test -z "$PYTHON_NOVERSIONCHECK"; then | ||
115 | AC_MSG_RESULT([no]) | ||
116 | AC_MSG_WARN([ | ||
117 | This version of the AC@&t@_PYTHON_DEVEL macro | ||
118 | doesn't work properly with versions of Python before | ||
119 | 2.1.0. You may need to re-run configure, setting the | ||
120 | variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, | ||
121 | PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. | ||
122 | Moreover, to disable this check, set PYTHON_NOVERSIONCHECK | ||
123 | to something else than an empty string. | ||
124 | ]) | ||
125 | if ! $ax_python_devel_optional; then | ||
126 | AC_MSG_FAILURE([Giving up]) | ||
127 | fi | ||
128 | ax_python_devel_found=no | ||
129 | PYTHON_VERSION="" | ||
130 | else | ||
131 | AC_MSG_RESULT([skip at user request]) | ||
132 | fi | ||
133 | else | ||
134 | AC_MSG_RESULT([yes]) | ||
135 | fi | ||
136 | fi | ||
137 | |||
138 | if test $ax_python_devel_found = yes; then | ||
139 | # | ||
140 | # If the macro parameter ``version'' is set, honour it. | ||
141 | # A Python shim class, VPy, is used to implement correct version comparisons via | ||
142 | # string expressions, since e.g. a naive textual ">= 2.7.3" won't work for | ||
143 | # Python 2.7.10 (the ".1" being evaluated as less than ".3"). | ||
144 | # | ||
145 | if test -n "$1"; then | ||
146 | AC_MSG_CHECKING([for a version of Python $1]) | ||
147 | cat << EOF > ax_python_devel_vpy.py | ||
148 | class VPy: | ||
149 | def vtup(self, s): | ||
150 | return tuple(map(int, s.strip().replace("rc", ".").split("."))) | ||
151 | def __init__(self): | ||
152 | import sys | ||
153 | self.vpy = tuple(sys.version_info)[[:3]] | ||
154 | def __eq__(self, s): | ||
155 | return self.vpy == self.vtup(s) | ||
156 | def __ne__(self, s): | ||
157 | return self.vpy != self.vtup(s) | ||
158 | def __lt__(self, s): | ||
159 | return self.vpy < self.vtup(s) | ||
160 | def __gt__(self, s): | ||
161 | return self.vpy > self.vtup(s) | ||
162 | def __le__(self, s): | ||
163 | return self.vpy <= self.vtup(s) | ||
164 | def __ge__(self, s): | ||
165 | return self.vpy >= self.vtup(s) | ||
166 | EOF | ||
167 | ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \ | ||
168 | ver = ax_python_devel_vpy.VPy(); \ | ||
169 | print (ver $1)"` | ||
170 | rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py* | ||
171 | if test "$ac_supports_python_ver" = "True"; then | ||
172 | AC_MSG_RESULT([yes]) | ||
173 | else | ||
174 | AC_MSG_RESULT([no]) | ||
175 | AC_MSG_WARN([this package requires Python $1. | ||
176 | If you have it installed, but it isn't the default Python | ||
177 | interpreter in your system path, please pass the PYTHON_VERSION | ||
178 | variable to configure. See ``configure --help'' for reference. | ||
179 | ]) | ||
180 | if ! $ax_python_devel_optional; then | ||
181 | AC_MSG_ERROR([Giving up]) | ||
182 | fi | ||
183 | ax_python_devel_found=no | ||
184 | PYTHON_VERSION="" | ||
185 | fi | ||
186 | fi | ||
187 | fi | ||
188 | |||
189 | if test $ax_python_devel_found = yes; then | ||
190 | # | ||
191 | # Check if you have distutils, else fail | ||
192 | # | ||
193 | AC_MSG_CHECKING([for the sysconfig Python package]) | ||
194 | ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1` | ||
195 | if test $? -eq 0; then | ||
196 | AC_MSG_RESULT([yes]) | ||
197 | IMPORT_SYSCONFIG="import sysconfig" | ||
198 | else | ||
199 | AC_MSG_RESULT([no]) | ||
200 | |||
201 | AC_MSG_CHECKING([for the distutils Python package]) | ||
202 | ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1` | ||
203 | if test $? -eq 0; then | ||
204 | AC_MSG_RESULT([yes]) | ||
205 | IMPORT_SYSCONFIG="from distutils import sysconfig" | ||
206 | else | ||
207 | AC_MSG_WARN([cannot import Python module "distutils". | ||
208 | Please check your Python installation. The error was: | ||
209 | $ac_sysconfig_result]) | ||
210 | if ! $ax_python_devel_optional; then | ||
211 | AC_MSG_ERROR([Giving up]) | ||
212 | fi | ||
213 | ax_python_devel_found=no | ||
214 | PYTHON_VERSION="" | ||
215 | fi | ||
216 | fi | ||
217 | fi | ||
218 | |||
219 | if test $ax_python_devel_found = yes; then | ||
220 | # | ||
221 | # Check for Python include path | ||
222 | # | ||
223 | AC_MSG_CHECKING([for Python include path]) | ||
224 | if test -z "$PYTHON_CPPFLAGS"; then | ||
225 | if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then | ||
226 | # sysconfig module has different functions | ||
227 | python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
228 | print (sysconfig.get_path ('include'));"` | ||
229 | plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
230 | print (sysconfig.get_path ('platinclude'));"` | ||
231 | else | ||
232 | # old distutils way | ||
233 | python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
234 | print (sysconfig.get_python_inc ());"` | ||
235 | plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
236 | print (sysconfig.get_python_inc (plat_specific=1));"` | ||
237 | fi | ||
238 | if test -n "${python_path}"; then | ||
239 | if test "${plat_python_path}" != "${python_path}"; then | ||
240 | python_path="-I$python_path -I$plat_python_path" | ||
241 | else | ||
242 | python_path="-I$python_path" | ||
243 | fi | ||
244 | fi | ||
245 | PYTHON_CPPFLAGS=$python_path | ||
246 | fi | ||
247 | AC_MSG_RESULT([$PYTHON_CPPFLAGS]) | ||
248 | AC_SUBST([PYTHON_CPPFLAGS]) | ||
249 | |||
250 | # | ||
251 | # Check for Python library path | ||
252 | # | ||
253 | AC_MSG_CHECKING([for Python library path]) | ||
254 | if test -z "$PYTHON_LIBS"; then | ||
255 | # (makes two attempts to ensure we've got a version number | ||
256 | # from the interpreter) | ||
257 | ac_python_version=`cat<<EOD | $PYTHON - | ||
258 | |||
259 | # join all versioning strings, on some systems | ||
260 | # major/minor numbers could be in different list elements | ||
261 | from sysconfig import * | ||
262 | e = get_config_var('VERSION') | ||
263 | if e is not None: | ||
264 | print(e) | ||
265 | EOD` | ||
266 | |||
267 | if test -z "$ac_python_version"; then | ||
268 | if test -n "$PYTHON_VERSION"; then | ||
269 | ac_python_version=$PYTHON_VERSION | ||
270 | else | ||
271 | ac_python_version=`$PYTHON -c "import sys; \ | ||
272 | print ("%d.%d" % sys.version_info[[:2]])"` | ||
273 | fi | ||
274 | fi | ||
275 | |||
276 | # Make the versioning information available to the compiler | ||
277 | AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"], | ||
278 | [If available, contains the Python version number currently in use.]) | ||
279 | |||
280 | # First, the library directory: | ||
281 | ac_python_libdir=`cat<<EOD | $PYTHON - | ||
282 | |||
283 | # There should be only one | ||
284 | $IMPORT_SYSCONFIG | ||
285 | e = sysconfig.get_config_var('LIBDIR') | ||
286 | if e is not None: | ||
287 | print (e) | ||
288 | EOD` | ||
289 | |||
290 | # Now, for the library: | ||
291 | ac_python_library=`cat<<EOD | $PYTHON - | ||
292 | |||
293 | $IMPORT_SYSCONFIG | ||
294 | c = sysconfig.get_config_vars() | ||
295 | if 'LDVERSION' in c: | ||
296 | print ('python'+c[['LDVERSION']]) | ||
297 | else: | ||
298 | print ('python'+c[['VERSION']]) | ||
299 | EOD` | ||
300 | |||
301 | # This small piece shamelessly adapted from PostgreSQL python macro; | ||
302 | # credits goes to momjian, I think. I'd like to put the right name | ||
303 | # in the credits, if someone can point me in the right direction... ? | ||
304 | # | ||
305 | if test -n "$ac_python_libdir" -a -n "$ac_python_library" | ||
306 | then | ||
307 | # use the official shared library | ||
308 | ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"` | ||
309 | PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library" | ||
310 | else | ||
311 | # old way: use libpython from python_configdir | ||
312 | ac_python_libdir=`$PYTHON -c \ | ||
313 | "from sysconfig import get_python_lib as f; \ | ||
314 | import os; \ | ||
315 | print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"` | ||
316 | PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version" | ||
317 | fi | ||
318 | |||
319 | if test -z "$PYTHON_LIBS"; then | ||
320 | AC_MSG_WARN([ | ||
321 | Cannot determine location of your Python DSO. Please check it was installed with | ||
322 | dynamic libraries enabled, or try setting PYTHON_LIBS by hand. | ||
323 | ]) | ||
324 | if ! $ax_python_devel_optional; then | ||
325 | AC_MSG_ERROR([Giving up]) | ||
326 | fi | ||
327 | ax_python_devel_found=no | ||
328 | PYTHON_VERSION="" | ||
329 | fi | ||
330 | fi | ||
331 | fi | ||
332 | |||
333 | if test $ax_python_devel_found = yes; then | ||
334 | AC_MSG_RESULT([$PYTHON_LIBS]) | ||
335 | AC_SUBST([PYTHON_LIBS]) | ||
336 | |||
337 | # | ||
338 | # Check for site packages | ||
339 | # | ||
340 | AC_MSG_CHECKING([for Python site-packages path]) | ||
341 | if test -z "$PYTHON_SITE_PKG"; then | ||
342 | if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then | ||
343 | PYTHON_SITE_PKG=`$PYTHON -c " | ||
344 | $IMPORT_SYSCONFIG; | ||
345 | if hasattr(sysconfig, 'get_default_scheme'): | ||
346 | scheme = sysconfig.get_default_scheme() | ||
347 | else: | ||
348 | scheme = sysconfig._get_default_scheme() | ||
349 | if scheme == 'posix_local': | ||
350 | # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ | ||
351 | scheme = 'posix_prefix' | ||
352 | prefix = '$prefix' | ||
353 | if prefix == 'NONE': | ||
354 | prefix = '$ac_default_prefix' | ||
355 | sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix}) | ||
356 | print(sitedir)"` | ||
357 | else | ||
358 | # distutils.sysconfig way | ||
359 | PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
360 | print (sysconfig.get_python_lib(0,0));"` | ||
361 | fi | ||
362 | fi | ||
363 | AC_MSG_RESULT([$PYTHON_SITE_PKG]) | ||
364 | AC_SUBST([PYTHON_SITE_PKG]) | ||
365 | |||
366 | # | ||
367 | # Check for platform-specific site packages | ||
368 | # | ||
369 | AC_MSG_CHECKING([for Python platform specific site-packages path]) | ||
370 | if test -z "$PYTHON_PLATFORM_SITE_PKG"; then | ||
371 | if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then | ||
372 | PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c " | ||
373 | $IMPORT_SYSCONFIG; | ||
374 | if hasattr(sysconfig, 'get_default_scheme'): | ||
375 | scheme = sysconfig.get_default_scheme() | ||
376 | else: | ||
377 | scheme = sysconfig._get_default_scheme() | ||
378 | if scheme == 'posix_local': | ||
379 | # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ | ||
380 | scheme = 'posix_prefix' | ||
381 | prefix = '$prefix' | ||
382 | if prefix == 'NONE': | ||
383 | prefix = '$ac_default_prefix' | ||
384 | sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix}) | ||
385 | print(sitedir)"` | ||
386 | else | ||
387 | # distutils.sysconfig way | ||
388 | PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
389 | print (sysconfig.get_python_lib(1,0));"` | ||
390 | fi | ||
391 | fi | ||
392 | AC_MSG_RESULT([$PYTHON_PLATFORM_SITE_PKG]) | ||
393 | AC_SUBST([PYTHON_PLATFORM_SITE_PKG]) | ||
394 | |||
395 | # | ||
396 | # libraries which must be linked in when embedding | ||
397 | # | ||
398 | AC_MSG_CHECKING(python extra libraries) | ||
399 | if test -z "$PYTHON_EXTRA_LIBS"; then | ||
400 | PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
401 | conf = sysconfig.get_config_var; \ | ||
402 | print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` | ||
403 | fi | ||
404 | AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) | ||
405 | AC_SUBST(PYTHON_EXTRA_LIBS) | ||
406 | |||
407 | # | ||
408 | # linking flags needed when embedding | ||
409 | # | ||
410 | AC_MSG_CHECKING(python extra linking flags) | ||
411 | if test -z "$PYTHON_EXTRA_LDFLAGS"; then | ||
412 | PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ | ||
413 | conf = sysconfig.get_config_var; \ | ||
414 | print (conf('LINKFORSHARED'))"` | ||
415 | # Hack for macos, it sticks this in here. | ||
416 | PYTHON_EXTRA_LDFLAGS=`echo $PYTHON_EXTRA_LDFLAGS | sed 's/CoreFoundation.*$/CoreFoundation/'` | ||
417 | fi | ||
418 | AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) | ||
419 | AC_SUBST(PYTHON_EXTRA_LDFLAGS) | ||
420 | |||
421 | # | ||
422 | # final check to see if everything compiles alright | ||
423 | # | ||
424 | AC_MSG_CHECKING([consistency of all components of python development environment]) | ||
425 | # save current global flags | ||
426 | ac_save_LIBS="$LIBS" | ||
427 | ac_save_LDFLAGS="$LDFLAGS" | ||
428 | ac_save_CPPFLAGS="$CPPFLAGS" | ||
429 | LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS" | ||
430 | LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS" | ||
431 | CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" | ||
432 | AC_LANG_PUSH([C]) | ||
433 | AC_LINK_IFELSE([ | ||
434 | AC_LANG_PROGRAM([[#include <Python.h>]], | ||
435 | [[Py_Initialize();]]) | ||
436 | ],[pythonexists=yes],[pythonexists=no]) | ||
437 | AC_LANG_POP([C]) | ||
438 | # turn back to default flags | ||
439 | CPPFLAGS="$ac_save_CPPFLAGS" | ||
440 | LIBS="$ac_save_LIBS" | ||
441 | LDFLAGS="$ac_save_LDFLAGS" | ||
442 | |||
443 | AC_MSG_RESULT([$pythonexists]) | ||
444 | |||
445 | if test ! "x$pythonexists" = "xyes"; then | ||
446 | AC_MSG_WARN([ | ||
447 | Could not link test program to Python. Maybe the main Python library has been | ||
448 | installed in some non-standard library path. If so, pass it to configure, | ||
449 | via the LIBS environment variable. | ||
450 | Example: ./configure LIBS="-L/usr/non-standard-path/python/lib" | ||
451 | ============================================================================ | ||
452 | ERROR! | ||
453 | You probably have to install the development version of the Python package | ||
454 | for your distribution. The exact name of this package varies among them. | ||
455 | ============================================================================ | ||
456 | ]) | ||
457 | if ! $ax_python_devel_optional; then | ||
458 | AC_MSG_ERROR([Giving up]) | ||
459 | fi | ||
460 | ax_python_devel_found=no | ||
461 | PYTHON_VERSION="" | ||
462 | fi | ||
463 | fi | ||
464 | |||
465 | # | ||
466 | # all done! | ||
467 | # | ||
468 | ]) | ||
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 | |||
46 | AU_ALIAS([SWIG_ENABLE_CXX], [AX_SWIG_ENABLE_CXX]) | ||
47 | AC_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 @@ | |||
1 | AC_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 | |||
59 | AC_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 | ]) | ||