Mercurial > libpst
annotate m4/ac_python_devel.m4 @ 375:292a0e2817ab stable-0-6-71
prep for fedora build
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 21 Jul 2017 21:13:38 -0700 |
parents | bfc35fd55254 |
children |
rev | line source |
---|---|
226
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 # =========================================================================== |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 # http://www.nongnu.org/autoconf-archive/ac_python_devel.html |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 # =========================================================================== |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 # SYNOPSIS |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 # AC_PYTHON_DEVEL([version]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 # DESCRIPTION |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 # Note: Defines as a precious variable "PYTHON_VERSION". Don't override it |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 # in your configure.ac. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 # This macro checks for Python and tries to get the include path to |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 # 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 # output variables. It also exports $(PYTHON_EXTRA_LIBS) and |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 # $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 # You can search for some particular version of Python by passing a |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 # parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 # note that you *have* to pass also an operator along with the version to |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 # match, and pay special attention to the single quotes surrounding the |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 # version number. Don't use "PYTHON_VERSION" for this: that environment |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 # variable is declared as precious and thus reserved for the end-user. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
26 # This macro should work for all versions of Python >= 2.1.0. As an end |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 # user, you can disable the check for the python version by setting the |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
28 # PYTHON_NOVERSIONCHECK environment variable to something else than the |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 # empty string. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
30 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
31 # If you need to use this macro for an older Python version, please |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
32 # contact the authors. We're always open for feedback. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 # LICENSE |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
35 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 # Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de> |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 # Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca> |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 # Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net> |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 # Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za> |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
40 # Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org> |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 # Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org> |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
42 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 # This program is free software: you can redistribute it and/or modify it |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 # under the terms of the GNU General Public License as published by the |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 # Free Software Foundation, either version 3 of the License, or (at your |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 # option) any later version. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 # This program is distributed in the hope that it will be useful, but |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
49 # WITHOUT ANY WARRANTY; without even the implied warranty of |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
50 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 # Public License for more details. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 # You should have received a copy of the GNU General Public License along |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 # with this program. If not, see <http://www.gnu.org/licenses/>. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
56 # As a special exception, the respective Autoconf Macro's copyright owner |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 # gives unlimited permission to copy, distribute and modify the configure |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
58 # scripts that are the output of Autoconf when processing the Macro. You |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 # need not follow the terms of the GNU General Public License when using |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
60 # or distributing such scripts, even though portions of the text of the |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 # Macro appear in them. The GNU General Public License (GPL) does govern |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 # all other use of the material that constitutes the Autoconf Macro. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 # This special exception to the GPL applies to versions of the Autoconf |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
65 # Macro released by the Autoconf Archive. When you make and distribute a |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
66 # modified version of the Autoconf Macro, you may extend this special |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 # exception to the GPL to apply to your modified version as well. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
68 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 AC_DEFUN([AC_PYTHON_DEVEL],[ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
70 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
71 # Allow the use of a (user set) custom python version |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
72 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
73 AC_ARG_VAR([PYTHON_VERSION],[The installed Python |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
74 version to use, for example '2.3'. This string |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 will be appended to the Python interpreter |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 canonical name.]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
77 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
78 AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
79 if test -z "$PYTHON"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
80 AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
81 PYTHON_VERSION="" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
82 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
83 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
84 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
85 # Check for a version of Python >= 2.1.0 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
86 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
87 AC_MSG_CHECKING([for a version of Python >= '2.1.0']) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
88 ac_supports_python_ver=`$PYTHON -c "import sys; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
89 ver = sys.version.split ()[[0]]; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 print (ver >= '2.1.0')"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 if test "$ac_supports_python_ver" != "True"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
92 if test -z "$PYTHON_NOVERSIONCHECK"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
93 AC_MSG_RESULT([no]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
94 AC_MSG_FAILURE([ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
95 This version of the AC@&t@_PYTHON_DEVEL macro |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
96 doesn't work properly with versions of Python before |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
97 2.1.0. You may need to re-run configure, setting the |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
98 variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
99 PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
100 Moreover, to disable this check, set PYTHON_NOVERSIONCHECK |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
101 to something else than an empty string. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
102 ]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
103 else |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
104 AC_MSG_RESULT([skip at user request]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
105 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
106 else |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
107 AC_MSG_RESULT([yes]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
108 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
109 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
110 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
111 # if the macro parameter ``version'' is set, honour it |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
112 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
113 if test -n "$1"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
114 AC_MSG_CHECKING([for a version of Python $1]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
115 ac_supports_python_ver=`$PYTHON -c "import sys; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
116 ver = sys.version.split ()[[0]]; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
117 print (ver >= $1)"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
118 if test "$ac_supports_python_ver" = "True"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
119 AC_MSG_RESULT([yes]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
120 else |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
121 AC_MSG_RESULT([no]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
122 AC_MSG_ERROR([this package requires Python $1. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
123 If you have it installed, but it isn't the default Python |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
124 interpreter in your system path, please pass the PYTHON_VERSION |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
125 variable to configure. See ``configure --help'' for reference. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
126 ]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
127 PYTHON_VERSION="" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
128 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
129 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
130 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
131 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
132 # Check if you have distutils, else fail |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
133 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
134 AC_MSG_CHECKING([for the distutils Python package]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
135 ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
136 if test -z "$ac_distutils_result"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
137 AC_MSG_RESULT([yes]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
138 else |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
139 AC_MSG_RESULT([no]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
140 AC_MSG_ERROR([cannot import Python module "distutils". |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
141 Please check your Python installation. The error was: |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
142 $ac_distutils_result]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
143 PYTHON_VERSION="" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
144 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
145 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
146 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
147 # Check for Python include path |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
148 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
149 AC_MSG_CHECKING([for Python include path]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
150 if test -z "$PYTHON_CPPFLAGS"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
151 python_path=`$PYTHON -c "import distutils.sysconfig; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
152 print (distutils.sysconfig.get_python_inc ());"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
153 if test -n "${python_path}"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
154 python_path="-I$python_path" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
155 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
156 PYTHON_CPPFLAGS=$python_path |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
157 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
158 AC_MSG_RESULT([$PYTHON_CPPFLAGS]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
159 AC_SUBST([PYTHON_CPPFLAGS]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
160 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
161 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
162 # Check for Python library path |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
163 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
164 AC_MSG_CHECKING([for Python library path]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
165 if test -z "$PYTHON_LDFLAGS"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
166 # (makes two attempts to ensure we've got a version number |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
167 # from the interpreter) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
168 ac_python_version=`cat<<EOD | $PYTHON - |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
169 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
170 # join all versioning strings, on some systems |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
171 # major/minor numbers could be in different list elements |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
172 from distutils.sysconfig import * |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
173 ret = '' |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
174 for e in get_config_vars ('VERSION'): |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
175 if (e != None): |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
176 ret += e |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
177 print (ret) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
178 EOD` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
179 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
180 if test -z "$ac_python_version"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
181 if test -n "$PYTHON_VERSION"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
182 ac_python_version=$PYTHON_VERSION |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
183 else |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
184 ac_python_version=`$PYTHON -c "import sys; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
185 print (sys.version[[:3]])"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
186 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
187 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
188 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
189 # Make the versioning information available to the compiler |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
190 AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"], |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
191 [If available, contains the Python version number currently in use.]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
192 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
193 # First, the library directory: |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
194 ac_python_libdir=`cat<<EOD | $PYTHON - |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
195 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
196 # There should be only one |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
197 import distutils.sysconfig |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
198 for e in distutils.sysconfig.get_config_vars ('LIBDIR'): |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
199 if e != None: |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
200 print (e) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
201 break |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
202 EOD` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
203 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
204 # Before checking for libpythonX.Y, we need to know |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
205 # the extension the OS we're on uses for libraries |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
206 # (we take the first one, if there's more than one fix me!): |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
207 ac_python_soext=`$PYTHON -c \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
208 "import distutils.sysconfig; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
209 print (distutils.sysconfig.get_config_vars('SO')[[0]])"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
210 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
211 # Now, for the library: |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
212 ac_python_soname=`$PYTHON -c \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
213 "import distutils.sysconfig; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
214 print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
215 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
216 # Strip away extension from the end to canonicalize its name: |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
217 ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
218 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
219 # This small piece shamelessly adapted from PostgreSQL python macro; |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
220 # credits goes to momjian, I think. I'd like to put the right name |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
221 # in the credits, if someone can point me in the right direction... ? |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
222 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
223 if test -n "$ac_python_libdir" -a -n "$ac_python_library" \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
224 -a x"$ac_python_library" != x"$ac_python_soname" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
225 then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
226 # use the official shared library |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
227 ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
228 PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
229 else |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
230 # old way: use libpython from python_configdir |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
231 ac_python_libdir=`$PYTHON -c \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
232 "from distutils.sysconfig import get_python_lib as f; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
233 import os; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
234 print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
235 PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
236 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
237 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
238 if test -z "PYTHON_LDFLAGS"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
239 AC_MSG_ERROR([ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
240 Cannot determine location of your Python DSO. Please check it was installed with |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
241 dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
242 ]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
243 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
244 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
245 AC_MSG_RESULT([$PYTHON_LDFLAGS]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
246 AC_SUBST([PYTHON_LDFLAGS]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
247 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
248 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
249 # Check for site packages |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
250 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
251 AC_MSG_CHECKING([for Python site-packages path]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
252 if test -z "$PYTHON_SITE_PKG"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
253 PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
254 print (distutils.sysconfig.get_python_lib(0,0));"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
255 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
256 AC_MSG_RESULT([$PYTHON_SITE_PKG]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
257 AC_SUBST([PYTHON_SITE_PKG]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
258 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
259 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
260 # libraries which must be linked in when embedding |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
261 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
262 AC_MSG_CHECKING(python extra libraries) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
263 if test -z "$PYTHON_EXTRA_LIBS"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
264 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
265 conf = distutils.sysconfig.get_config_var; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
266 print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
267 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
268 AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
269 AC_SUBST(PYTHON_EXTRA_LIBS) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
270 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
271 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
272 # linking flags needed when embedding |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
273 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
274 AC_MSG_CHECKING(python extra linking flags) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
275 if test -z "$PYTHON_EXTRA_LDFLAGS"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
276 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
277 conf = distutils.sysconfig.get_config_var; \ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
278 print (conf('LINKFORSHARED'))"` |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
279 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
280 AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
281 AC_SUBST(PYTHON_EXTRA_LDFLAGS) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
282 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
283 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
284 # final check to see if everything compiles alright |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
285 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
286 AC_MSG_CHECKING([consistency of all components of python development environment]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
287 # save current global flags |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
288 ac_save_LIBS="$LIBS" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
289 ac_save_CPPFLAGS="$CPPFLAGS" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
290 LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
291 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
292 AC_LANG_PUSH([C]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
293 AC_LINK_IFELSE([ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
294 AC_LANG_PROGRAM([[#include <Python.h>]], |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
295 [[Py_Initialize();]]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
296 ],[pythonexists=yes],[pythonexists=no]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
297 AC_LANG_POP([C]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
298 # turn back to default flags |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
299 CPPFLAGS="$ac_save_CPPFLAGS" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
300 LIBS="$ac_save_LIBS" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
301 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
302 AC_MSG_RESULT([$pythonexists]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
303 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
304 if test ! "x$pythonexists" = "xyes"; then |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
305 AC_MSG_FAILURE([ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
306 Could not link test program to Python. Maybe the main Python library has been |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
307 installed in some non-standard library path. If so, pass it to configure, |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
308 via the LDFLAGS environment variable. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
309 Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
310 ============================================================================ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
311 ERROR! |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
312 You probably have to install the development version of the Python package |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
313 for your distribution. The exact name of this package varies among them. |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
314 ============================================================================ |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
315 ]) |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
316 PYTHON_VERSION="" |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
317 fi |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
318 |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
319 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
320 # all done! |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
321 # |
bfc35fd55254
fix python autoconf macros
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
322 ]) |