]>
Commit | Line | Data |
---|---|---|
5634d1d6 ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.062 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.062 | |
11 | Problem: Python doesn't work properly when installed in another directory | |
12 | than expected. | |
13 | Solution: Figure out home directory in configure and use Py_SetPythonHome() | |
14 | at runtime. (Roland Puntaier) | |
15 | Files: src/configure.in, src/auto/configure, src/if_python.c, | |
16 | src/if_python3.c | |
17 | ||
18 | ||
19 | *** ../vim-7.3.061/src/configure.in 2010-11-03 22:32:18.000000000 +0100 | |
20 | --- src/configure.in 2010-11-16 17:47:36.000000000 +0100 | |
21 | *************** | |
22 | *** 891,899 **** | |
23 | ||
24 | PYTHON_LIBS="${vi_cv_path_python_plibs}" | |
25 | if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then | |
26 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" | |
27 | else | |
28 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" | |
29 | fi | |
30 | PYTHON_SRC="if_python.c" | |
31 | dnl For Mac OSX 10.2 config.o is included in the Python library. | |
32 | --- 891,899 ---- | |
33 | ||
34 | PYTHON_LIBS="${vi_cv_path_python_plibs}" | |
35 | if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then | |
36 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" | |
37 | else | |
38 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" | |
39 | fi | |
40 | PYTHON_SRC="if_python.c" | |
41 | dnl For Mac OSX 10.2 config.o is included in the Python library. | |
42 | *************** | |
43 | *** 905,911 **** | |
44 | if test "${vi_cv_var_python_version}" = "1.4"; then | |
45 | PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" | |
46 | fi | |
47 | ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" | |
48 | ||
49 | dnl On FreeBSD linking with "-pthread" is required to use threads. | |
50 | dnl _THREAD_SAFE must be used for compiling then. | |
51 | --- 905,911 ---- | |
52 | if test "${vi_cv_var_python_version}" = "1.4"; then | |
53 | PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" | |
54 | fi | |
55 | ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" | |
56 | ||
57 | dnl On FreeBSD linking with "-pthread" is required to use threads. | |
58 | dnl _THREAD_SAFE must be used for compiling then. | |
59 | *************** | |
60 | *** 1063,1071 **** | |
61 | ||
62 | PYTHON3_LIBS="${vi_cv_path_python3_plibs}" | |
63 | if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then | |
64 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}" | |
65 | else | |
66 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}" | |
67 | fi | |
68 | PYTHON3_SRC="if_python3.c" | |
69 | dnl For Mac OSX 10.2 config.o is included in the Python library. | |
70 | --- 1063,1071 ---- | |
71 | ||
72 | PYTHON3_LIBS="${vi_cv_path_python3_plibs}" | |
73 | if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then | |
74 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" | |
75 | else | |
76 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" | |
77 | fi | |
78 | PYTHON3_SRC="if_python3.c" | |
79 | dnl For Mac OSX 10.2 config.o is included in the Python library. | |
80 | *************** | |
81 | *** 1143,1151 **** | |
82 | if test "$python_ok" = yes && test "$python3_ok" = yes; then | |
83 | AC_DEFINE(DYNAMIC_PYTHON) | |
84 | AC_DEFINE(DYNAMIC_PYTHON3) | |
85 | ! AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL) | |
86 | cflags_save=$CFLAGS | |
87 | ! CFLAGS="$CFLAGS $PYTHON3_CFLAGS" | |
88 | ldflags_save=$LDFLAGS | |
89 | LDFLAGS="$LDFLAGS -ldl" | |
90 | AC_RUN_IFELSE([ | |
91 | --- 1143,1151 ---- | |
92 | if test "$python_ok" = yes && test "$python3_ok" = yes; then | |
93 | AC_DEFINE(DYNAMIC_PYTHON) | |
94 | AC_DEFINE(DYNAMIC_PYTHON3) | |
95 | ! AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python) | |
96 | cflags_save=$CFLAGS | |
97 | ! CFLAGS="$CFLAGS $PYTHON_CFLAGS" | |
98 | ldflags_save=$LDFLAGS | |
99 | LDFLAGS="$LDFLAGS -ldl" | |
100 | AC_RUN_IFELSE([ | |
101 | *************** | |
102 | *** 1156,1170 **** | |
103 | * Only the first pyhton version used will be switched on. | |
104 | */ | |
105 | ||
106 | ! int no_rtl_global_needed_for(char *python_instsoname) | |
107 | { | |
108 | int needed = 0; | |
109 | void* pylib = dlopen(python_instsoname, RTLD_LAZY); | |
110 | if (pylib != 0) | |
111 | { | |
112 | void (*init)(void) = dlsym(pylib, "Py_Initialize"); | |
113 | int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); | |
114 | void (*final)(void) = dlsym(pylib, "Py_Finalize"); | |
115 | (*init)(); | |
116 | needed = (*simple)("import termios") == -1; | |
117 | (*final)(); | |
118 | --- 1156,1172 ---- | |
119 | * Only the first pyhton version used will be switched on. | |
120 | */ | |
121 | ||
122 | ! int no_rtl_global_needed_for(char *python_instsoname, char *prefix) | |
123 | { | |
124 | int needed = 0; | |
125 | void* pylib = dlopen(python_instsoname, RTLD_LAZY); | |
126 | if (pylib != 0) | |
127 | { | |
128 | + void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); | |
129 | void (*init)(void) = dlsym(pylib, "Py_Initialize"); | |
130 | int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); | |
131 | void (*final)(void) = dlsym(pylib, "Py_Finalize"); | |
132 | + (*pfx)(prefix); | |
133 | (*init)(); | |
134 | needed = (*simple)("import termios") == -1; | |
135 | (*final)(); | |
136 | *************** | |
137 | *** 1176,1188 **** | |
138 | int main(int argc, char** argv) | |
139 | { | |
140 | int not_needed = 0; | |
141 | ! if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0")) | |
142 | not_needed = 1; | |
143 | return !not_needed; | |
144 | }], | |
145 | [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) | |
146 | CFLAGS=$cflags_save | |
147 | LDFLAGS=$ldflags_save | |
148 | PYTHON_SRC="if_python.c" | |
149 | PYTHON_OBJ="objects/if_python.o" | |
150 | PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\"" | |
151 | --- 1178,1237 ---- | |
152 | int main(int argc, char** argv) | |
153 | { | |
154 | int not_needed = 0; | |
155 | ! if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}")) | |
156 | not_needed = 1; | |
157 | return !not_needed; | |
158 | }], | |
159 | [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) | |
160 | + | |
161 | CFLAGS=$cflags_save | |
162 | LDFLAGS=$ldflags_save | |
163 | + | |
164 | + AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3) | |
165 | + cflags_save=$CFLAGS | |
166 | + CFLAGS="$CFLAGS $PYTHON3_CFLAGS" | |
167 | + ldflags_save=$LDFLAGS | |
168 | + LDFLAGS="$LDFLAGS -ldl" | |
169 | + AC_RUN_IFELSE([ | |
170 | + #include <dlfcn.h> | |
171 | + #include <wchar.h> | |
172 | + /* If this program fails, then RTLD_GLOBAL is needed. | |
173 | + * RTLD_GLOBAL will be used and then it is not possible to | |
174 | + * have both python versions enabled in the same vim instance. | |
175 | + * Only the first pyhton version used will be switched on. | |
176 | + */ | |
177 | + | |
178 | + int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) | |
179 | + { | |
180 | + int needed = 0; | |
181 | + void* pylib = dlopen(python_instsoname, RTLD_LAZY); | |
182 | + if (pylib != 0) | |
183 | + { | |
184 | + void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); | |
185 | + void (*init)(void) = dlsym(pylib, "Py_Initialize"); | |
186 | + int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); | |
187 | + void (*final)(void) = dlsym(pylib, "Py_Finalize"); | |
188 | + (*pfx)(prefix); | |
189 | + (*init)(); | |
190 | + needed = (*simple)("import termios") == -1; | |
191 | + (*final)(); | |
192 | + dlclose(pylib); | |
193 | + } | |
194 | + return !needed; | |
195 | + } | |
196 | + | |
197 | + int main(int argc, char** argv) | |
198 | + { | |
199 | + int not_needed = 0; | |
200 | + if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}")) | |
201 | + not_needed = 1; | |
202 | + return !not_needed; | |
203 | + }], | |
204 | + [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) | |
205 | + | |
206 | + CFLAGS=$cflags_save | |
207 | + LDFLAGS=$ldflags_save | |
208 | + | |
209 | PYTHON_SRC="if_python.c" | |
210 | PYTHON_OBJ="objects/if_python.o" | |
211 | PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\"" | |
212 | *** ../vim-7.3.061/src/auto/configure 2010-11-03 22:32:18.000000000 +0100 | |
213 | --- src/auto/configure 2010-11-16 17:47:42.000000000 +0100 | |
214 | *************** | |
215 | *** 5326,5334 **** | |
216 | ||
217 | PYTHON_LIBS="${vi_cv_path_python_plibs}" | |
218 | if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then | |
219 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" | |
220 | else | |
221 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" | |
222 | fi | |
223 | PYTHON_SRC="if_python.c" | |
224 | if test "x$MACOSX" = "xyes"; then | |
225 | --- 5326,5334 ---- | |
226 | ||
227 | PYTHON_LIBS="${vi_cv_path_python_plibs}" | |
228 | if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then | |
229 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" | |
230 | else | |
231 | ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" | |
232 | fi | |
233 | PYTHON_SRC="if_python.c" | |
234 | if test "x$MACOSX" = "xyes"; then | |
235 | *************** | |
236 | *** 5339,5345 **** | |
237 | if test "${vi_cv_var_python_version}" = "1.4"; then | |
238 | PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" | |
239 | fi | |
240 | ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" | |
241 | ||
242 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5 | |
243 | $as_echo_n "checking if -pthread should be used... " >&6; } | |
244 | --- 5339,5345 ---- | |
245 | if test "${vi_cv_var_python_version}" = "1.4"; then | |
246 | PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" | |
247 | fi | |
248 | ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" | |
249 | ||
250 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5 | |
251 | $as_echo_n "checking if -pthread should be used... " >&6; } | |
252 | *************** | |
253 | *** 5601,5609 **** | |
254 | ||
255 | PYTHON3_LIBS="${vi_cv_path_python3_plibs}" | |
256 | if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then | |
257 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}" | |
258 | else | |
259 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}" | |
260 | fi | |
261 | PYTHON3_SRC="if_python3.c" | |
262 | if test "x$MACOSX" = "xyes"; then | |
263 | --- 5601,5609 ---- | |
264 | ||
265 | PYTHON3_LIBS="${vi_cv_path_python3_plibs}" | |
266 | if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then | |
267 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" | |
268 | else | |
269 | ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" | |
270 | fi | |
271 | PYTHON3_SRC="if_python3.c" | |
272 | if test "x$MACOSX" = "xyes"; then | |
273 | *************** | |
274 | *** 5708,5717 **** | |
275 | ||
276 | $as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h | |
277 | ||
278 | ! { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL" >&5 | |
279 | ! $as_echo_n "checking whether we can do without RTLD_GLOBAL... " >&6; } | |
280 | cflags_save=$CFLAGS | |
281 | ! CFLAGS="$CFLAGS $PYTHON3_CFLAGS" | |
282 | ldflags_save=$LDFLAGS | |
283 | LDFLAGS="$LDFLAGS -ldl" | |
284 | if test "$cross_compiling" = yes; then : | |
285 | --- 5708,5717 ---- | |
286 | ||
287 | $as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h | |
288 | ||
289 | ! { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python" >&5 | |
290 | ! $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python... " >&6; } | |
291 | cflags_save=$CFLAGS | |
292 | ! CFLAGS="$CFLAGS $PYTHON_CFLAGS" | |
293 | ldflags_save=$LDFLAGS | |
294 | LDFLAGS="$LDFLAGS -ldl" | |
295 | if test "$cross_compiling" = yes; then : | |
296 | *************** | |
297 | *** 5730,5744 **** | |
298 | * Only the first pyhton version used will be switched on. | |
299 | */ | |
300 | ||
301 | ! int no_rtl_global_needed_for(char *python_instsoname) | |
302 | { | |
303 | int needed = 0; | |
304 | void* pylib = dlopen(python_instsoname, RTLD_LAZY); | |
305 | if (pylib != 0) | |
306 | { | |
307 | void (*init)(void) = dlsym(pylib, "Py_Initialize"); | |
308 | int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); | |
309 | void (*final)(void) = dlsym(pylib, "Py_Finalize"); | |
310 | (*init)(); | |
311 | needed = (*simple)("import termios") == -1; | |
312 | (*final)(); | |
313 | --- 5730,5746 ---- | |
314 | * Only the first pyhton version used will be switched on. | |
315 | */ | |
316 | ||
317 | ! int no_rtl_global_needed_for(char *python_instsoname, char *prefix) | |
318 | { | |
319 | int needed = 0; | |
320 | void* pylib = dlopen(python_instsoname, RTLD_LAZY); | |
321 | if (pylib != 0) | |
322 | { | |
323 | + void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); | |
324 | void (*init)(void) = dlsym(pylib, "Py_Initialize"); | |
325 | int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); | |
326 | void (*final)(void) = dlsym(pylib, "Py_Finalize"); | |
327 | + (*pfx)(prefix); | |
328 | (*init)(); | |
329 | needed = (*simple)("import termios") == -1; | |
330 | (*final)(); | |
331 | *************** | |
332 | *** 5750,5756 **** | |
333 | int main(int argc, char** argv) | |
334 | { | |
335 | int not_needed = 0; | |
336 | ! if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0")) | |
337 | not_needed = 1; | |
338 | return !not_needed; | |
339 | } | |
340 | --- 5752,5758 ---- | |
341 | int main(int argc, char** argv) | |
342 | { | |
343 | int not_needed = 0; | |
344 | ! if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}")) | |
345 | not_needed = 1; | |
346 | return !not_needed; | |
347 | } | |
348 | *************** | |
349 | *** 5767,5774 **** | |
350 | --- 5769,5844 ---- | |
351 | conftest.$ac_objext conftest.beam conftest.$ac_ext | |
352 | fi | |
353 | ||
354 | + | |
355 | CFLAGS=$cflags_save | |
356 | LDFLAGS=$ldflags_save | |
357 | + | |
358 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python3" >&5 | |
359 | + $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python3... " >&6; } | |
360 | + cflags_save=$CFLAGS | |
361 | + CFLAGS="$CFLAGS $PYTHON3_CFLAGS" | |
362 | + ldflags_save=$LDFLAGS | |
363 | + LDFLAGS="$LDFLAGS -ldl" | |
364 | + if test "$cross_compiling" = yes; then : | |
365 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
366 | + $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
367 | + as_fn_error "cannot run test program while cross compiling | |
368 | + See \`config.log' for more details." "$LINENO" 5; } | |
369 | + else | |
370 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
371 | + /* end confdefs.h. */ | |
372 | + | |
373 | + #include <dlfcn.h> | |
374 | + #include <wchar.h> | |
375 | + /* If this program fails, then RTLD_GLOBAL is needed. | |
376 | + * RTLD_GLOBAL will be used and then it is not possible to | |
377 | + * have both python versions enabled in the same vim instance. | |
378 | + * Only the first pyhton version used will be switched on. | |
379 | + */ | |
380 | + | |
381 | + int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) | |
382 | + { | |
383 | + int needed = 0; | |
384 | + void* pylib = dlopen(python_instsoname, RTLD_LAZY); | |
385 | + if (pylib != 0) | |
386 | + { | |
387 | + void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); | |
388 | + void (*init)(void) = dlsym(pylib, "Py_Initialize"); | |
389 | + int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); | |
390 | + void (*final)(void) = dlsym(pylib, "Py_Finalize"); | |
391 | + (*pfx)(prefix); | |
392 | + (*init)(); | |
393 | + needed = (*simple)("import termios") == -1; | |
394 | + (*final)(); | |
395 | + dlclose(pylib); | |
396 | + } | |
397 | + return !needed; | |
398 | + } | |
399 | + | |
400 | + int main(int argc, char** argv) | |
401 | + { | |
402 | + int not_needed = 0; | |
403 | + if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}")) | |
404 | + not_needed = 1; | |
405 | + return !not_needed; | |
406 | + } | |
407 | + _ACEOF | |
408 | + if ac_fn_c_try_run "$LINENO"; then : | |
409 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
410 | + $as_echo "yes" >&6; };$as_echo "#define PY3_NO_RTLD_GLOBAL 1" >>confdefs.h | |
411 | + | |
412 | + else | |
413 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
414 | + $as_echo "no" >&6; } | |
415 | + fi | |
416 | + rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | |
417 | + conftest.$ac_objext conftest.beam conftest.$ac_ext | |
418 | + fi | |
419 | + | |
420 | + | |
421 | + CFLAGS=$cflags_save | |
422 | + LDFLAGS=$ldflags_save | |
423 | + | |
424 | PYTHON_SRC="if_python.c" | |
425 | PYTHON_OBJ="objects/if_python.o" | |
426 | PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\"" | |
427 | *** ../vim-7.3.061/src/if_python.c 2010-10-23 14:02:48.000000000 +0200 | |
428 | --- src/if_python.c 2010-11-16 17:07:00.000000000 +0100 | |
429 | *************** | |
430 | *** 102,108 **** | |
431 | # include <dlfcn.h> | |
432 | # define FARPROC void* | |
433 | # define HINSTANCE void* | |
434 | ! # ifdef PY_NO_RTLD_GLOBAL | |
435 | # define load_dll(n) dlopen((n), RTLD_LAZY) | |
436 | # else | |
437 | # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) | |
438 | --- 102,108 ---- | |
439 | # include <dlfcn.h> | |
440 | # define FARPROC void* | |
441 | # define HINSTANCE void* | |
442 | ! # if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL) | |
443 | # define load_dll(n) dlopen((n), RTLD_LAZY) | |
444 | # else | |
445 | # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) | |
446 | *************** | |
447 | *** 168,173 **** | |
448 | --- 168,174 ---- | |
449 | # define Py_BuildValue dll_Py_BuildValue | |
450 | # define Py_FindMethod dll_Py_FindMethod | |
451 | # define Py_InitModule4 dll_Py_InitModule4 | |
452 | + # define Py_SetPythonHome dll_Py_SetPythonHome | |
453 | # define Py_Initialize dll_Py_Initialize | |
454 | # define Py_Finalize dll_Py_Finalize | |
455 | # define Py_IsInitialized dll_Py_IsInitialized | |
456 | *************** | |
457 | *** 226,231 **** | |
458 | --- 227,233 ---- | |
459 | static PyObject*(*dll_Py_BuildValue)(char *, ...); | |
460 | static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *); | |
461 | static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int); | |
462 | + static void(*dll_Py_SetPythonHome)(char *home); | |
463 | static void(*dll_Py_Initialize)(void); | |
464 | static void(*dll_Py_Finalize)(void); | |
465 | static int(*dll_Py_IsInitialized)(void); | |
466 | *************** | |
467 | *** 310,315 **** | |
468 | --- 312,318 ---- | |
469 | # else | |
470 | {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4}, | |
471 | # endif | |
472 | + {"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome}, | |
473 | {"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize}, | |
474 | {"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize}, | |
475 | {"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized}, | |
476 | *************** | |
477 | *** 349,355 **** | |
478 | { | |
479 | int i; | |
480 | ||
481 | ! #if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON3) | |
482 | /* Can't have Python and Python3 loaded at the same time. | |
483 | * It cause a crash, because RTLD_GLOBAL is needed for | |
484 | * standard C extension libraries of one or both python versions. */ | |
485 | --- 352,358 ---- | |
486 | { | |
487 | int i; | |
488 | ||
489 | ! #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) | |
490 | /* Can't have Python and Python3 loaded at the same time. | |
491 | * It cause a crash, because RTLD_GLOBAL is needed for | |
492 | * standard C extension libraries of one or both python versions. */ | |
493 | *************** | |
494 | *** 543,548 **** | |
495 | --- 546,555 ---- | |
496 | } | |
497 | #endif | |
498 | ||
499 | + #ifdef PYTHON_HOME | |
500 | + Py_SetPythonHome(PYTHON_HOME); | |
501 | + #endif | |
502 | + | |
503 | init_structs(); | |
504 | ||
505 | #if !defined(MACOS) || defined(MACOS_X_UNIX) | |
506 | *** ../vim-7.3.061/src/if_python3.c 2010-10-23 14:02:48.000000000 +0200 | |
507 | --- src/if_python3.c 2010-11-16 17:07:26.000000000 +0100 | |
508 | *************** | |
509 | *** 80,86 **** | |
510 | # include <dlfcn.h> | |
511 | # define FARPROC void* | |
512 | # define HINSTANCE void* | |
513 | ! # ifdef PY_NO_RTLD_GLOBAL | |
514 | # define load_dll(n) dlopen((n), RTLD_LAZY) | |
515 | # else | |
516 | # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) | |
517 | --- 80,86 ---- | |
518 | # include <dlfcn.h> | |
519 | # define FARPROC void* | |
520 | # define HINSTANCE void* | |
521 | ! # if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL) | |
522 | # define load_dll(n) dlopen((n), RTLD_LAZY) | |
523 | # else | |
524 | # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) | |
525 | *************** | |
526 | *** 132,137 **** | |
527 | --- 132,138 ---- | |
528 | # define PyType_Ready py3_PyType_Ready | |
529 | #undef Py_BuildValue | |
530 | # define Py_BuildValue py3_Py_BuildValue | |
531 | + # define Py_SetPythonHome py3_Py_SetPythonHome | |
532 | # define Py_Initialize py3_Py_Initialize | |
533 | # define Py_Finalize py3_Py_Finalize | |
534 | # define Py_IsInitialized py3_Py_IsInitialized | |
535 | *************** | |
536 | *** 170,175 **** | |
537 | --- 171,177 ---- | |
538 | * Pointers for dynamic link | |
539 | */ | |
540 | static int (*py3_PySys_SetArgv)(int, wchar_t **); | |
541 | + static void (*py3_Py_SetPythonHome)(wchar_t *home); | |
542 | static void (*py3_Py_Initialize)(void); | |
543 | static PyObject* (*py3_PyList_New)(Py_ssize_t size); | |
544 | static PyGILState_STATE (*py3_PyGILState_Ensure)(void); | |
545 | *************** | |
546 | *** 254,259 **** | |
547 | --- 256,262 ---- | |
548 | } py3_funcname_table[] = | |
549 | { | |
550 | {"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv}, | |
551 | + {"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome}, | |
552 | {"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize}, | |
553 | {"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple}, | |
554 | {"PyList_New", (PYTHON_PROC*)&py3_PyList_New}, | |
555 | *************** | |
556 | *** 336,342 **** | |
557 | int i; | |
558 | void *ucs_from_string, *ucs_from_string_and_size; | |
559 | ||
560 | ! # if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON) | |
561 | /* Can't have Python and Python3 loaded at the same time. | |
562 | * It cause a crash, because RTLD_GLOBAL is needed for | |
563 | * standard C extension libraries of one or both python versions. */ | |
564 | --- 339,345 ---- | |
565 | int i; | |
566 | void *ucs_from_string, *ucs_from_string_and_size; | |
567 | ||
568 | ! # if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON) | |
569 | /* Can't have Python and Python3 loaded at the same time. | |
570 | * It cause a crash, because RTLD_GLOBAL is needed for | |
571 | * standard C extension libraries of one or both python versions. */ | |
572 | *************** | |
573 | *** 539,544 **** | |
574 | --- 542,552 ---- | |
575 | ||
576 | init_structs(); | |
577 | ||
578 | + | |
579 | + #ifdef PYTHON3_HOME | |
580 | + Py_SetPythonHome(PYTHON3_HOME); | |
581 | + #endif | |
582 | + | |
583 | /* initialise threads */ | |
584 | PyEval_InitThreads(); | |
585 | ||
586 | *** ../vim-7.3.061/src/version.c 2010-11-16 16:25:46.000000000 +0100 | |
587 | --- src/version.c 2010-11-16 17:12:40.000000000 +0100 | |
588 | *************** | |
589 | *** 716,717 **** | |
590 | --- 716,719 ---- | |
591 | { /* Add new patch number below this line */ | |
592 | + /**/ | |
593 | + 62, | |
594 | /**/ | |
595 | ||
596 | -- | |
597 | ARTHUR: CHARGE! | |
598 | [The mighty ARMY charges. Thundering noise of feet. Clatter of coconuts. | |
599 | Shouts etc. Suddenly there is a wail of a siren and a couple of police | |
600 | cars roar round in front of the charging ARMY and the POLICE leap out and | |
601 | stop them. TWO POLICEMAN and the HISTORIAN'S WIFE. Black Marias skid up | |
602 | behind them.] | |
603 | HISTORIAN'S WIFE: They're the ones, I'm sure. | |
604 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
605 | ||
606 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
607 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
608 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
609 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |