Mercurial > libpst
annotate m4/ax_python.m4 @ 402:37cd2aea5d4a
update x_python.m4 to detect python 3.9
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 26 Mar 2020 09:22:43 -0700 |
parents | 3cbda103e0ef |
children |
rev | line source |
---|---|
394
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 # =========================================================================== |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 # https://www.gnu.org/software/autoconf-archive/ax_python.html |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 # =========================================================================== |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 # SYNOPSIS |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 # AX_PYTHON |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 # DESCRIPTION |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 # This macro does a complete Python development environment check. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 # It checks for all known versions. When it finds an executable, it looks |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 # to find the header files and library. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 # It sets PYTHON_BIN to the name of the python executable, |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 # PYTHON_INCLUDE_DIR to the directory holding the header files, and |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 # PYTHON_LIB to the name of the Python library. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 # This macro calls AC_SUBST on PYTHON_BIN (via AC_CHECK_PROG), |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 # PYTHON_INCLUDE_DIR and PYTHON_LIB. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 # LICENSE |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 # Copyright (c) 2008 Michael Tindal |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
26 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 # This program is free software; you can redistribute it and/or modify it |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
28 # under the terms of the GNU General Public License as published by the |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 # Free Software Foundation; either version 2 of the License, or (at your |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
30 # option) any later version. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
31 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
32 # This program is distributed in the hope that it will be useful, but |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 # WITHOUT ANY WARRANTY; without even the implied warranty of |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
35 # Public License for more details. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 # You should have received a copy of the GNU General Public License along |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 # with this program. If not, see <https://www.gnu.org/licenses/>. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
40 # As a special exception, the respective Autoconf Macro's copyright owner |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 # gives unlimited permission to copy, distribute and modify the configure |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
42 # scripts that are the output of Autoconf when processing the Macro. You |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 # need not follow the terms of the GNU General Public License when using |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 # or distributing such scripts, even though portions of the text of the |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 # Macro appear in them. The GNU General Public License (GPL) does govern |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 # all other use of the material that constitutes the Autoconf Macro. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 # |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 # This special exception to the GPL applies to versions of the Autoconf |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
49 # Macro released by the Autoconf Archive. When you make and distribute a |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
50 # modified version of the Autoconf Macro, you may extend this special |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 # exception to the GPL to apply to your modified version as well. |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 #serial 18 |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 AC_DEFUN([AX_PYTHON], |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
56 [AC_MSG_CHECKING(for python build information) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 AC_MSG_RESULT([]) |
402
37cd2aea5d4a
update x_python.m4 to detect python 3.9
Carl Byington <carl@five-ten-sg.com>
parents:
394
diff
changeset
|
58 for python in python3.9 python3.8 python3.7 python3.6 python3.5 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do |
394
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 AC_CHECK_PROGS(PYTHON_BIN, [$python]) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
60 ax_python_bin=$PYTHON_BIN |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 if test x$ax_python_bin != x; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 AC_CHECK_LIB($ax_python_bin, main, ax_python_lib=$ax_python_bin, ax_python_lib=no) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 if test x$ax_python_lib == xno; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 AC_CHECK_LIB(${ax_python_bin}m, main, ax_python_lib=${ax_python_bin}m, ax_python_lib=no) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
65 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
66 if test x$ax_python_lib != xno; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 ax_python_header=`$ax_python_bin -c "from distutils.sysconfig import *; print(get_config_var('CONFINCLUDEPY'))"` |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
68 if test x$ax_python_header != x; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 break; |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
70 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
71 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
72 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
73 done |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
74 if test x$ax_python_bin = x; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 ax_python_bin=no |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
77 if test x$ax_python_header = x; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
78 ax_python_header=no |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
79 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
80 if test x$ax_python_lib = x; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
81 ax_python_lib=no |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
82 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
83 |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
84 AC_MSG_RESULT([ results of the Python check:]) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
85 AC_MSG_RESULT([ Binary: $ax_python_bin]) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
86 AC_MSG_RESULT([ Library: $ax_python_lib]) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
87 AC_MSG_RESULT([ Include Dir: $ax_python_header]) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
88 |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
89 if test x$ax_python_header != xno; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 PYTHON_INCLUDE_DIR=$ax_python_header |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 AC_SUBST(PYTHON_INCLUDE_DIR) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
92 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
93 if test x$ax_python_lib != xno; then |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
94 PYTHON_LIB=$ax_python_lib |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
95 AC_SUBST(PYTHON_LIB) |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
96 fi |
3cbda103e0ef
changes to build on centos 6
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
97 ])dnl |