0
0
mirror of https://github.com/vim/vim.git synced 2025-10-23 08:44:20 -04:00

patch 9.0.1794: autoconf: not correctly detecing include dirs

Problem:  autoconf: not correctly detecing include dirs
Solution: make use of python3 to generate includedirs

configure: Python3: Use sysconfig for -I

It seems better to use tools provided by Python for determining the
include directories, rather than construct them "manually".

Current system is broken when using virtual environments for python
3.11.4.  It used to work before, but now it detects a incorrect value
for `-I`.

It would probably make sense to switch to a similar logic for lib
folders, that is for the `-l` switch.  There are also
`sysconfig.get_config_h_filename()` and
`sysconfig.get_makefile_filename()`, that could replace more Python
specific logic in the current `configure{.ac,}`.

sysconfig provides the necessary tools since Python 2.7.

closes: #12889

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
This commit is contained in:
Illia Bobyr
2023-08-27 18:26:54 +02:00
committed by Christian Brabandt
parent f39842f148
commit 74e1dada41
3 changed files with 44 additions and 6 deletions

View File

@@ -1543,6 +1543,18 @@ if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic";
${vi_cv_path_python3} -c \
"import sys; print(sys.exec_prefix)"` ])
dnl -- python3's include path
AC_CACHE_CHECK(Python's include path,vi_cv_path_python3_include,
[ vi_cv_path_python3_include=`
${vi_cv_path_python3} -c \
"import sysconfig; print(sysconfig.get_path(\"include\"))"` ])
dnl -- python3's platform include path
AC_CACHE_CHECK(Python's include path,vi_cv_path_python3_platinclude,
[ vi_cv_path_python3_platinclude=`
${vi_cv_path_python3} -c \
"import sysconfig; print(sysconfig.get_path(\"platinclude\"))"` ])
dnl -- python3's internal library path
AC_CACHE_VAL(vi_cv_path_python3path,
@@ -1621,10 +1633,10 @@ eof
])
PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
if test "${vi_cv_path_python3_include}" = "${vi_cv_path_python3_platinclude}"; then
PYTHON3_CFLAGS="-I${vi_cv_path_python3_include}"
else
PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
PYTHON3_CFLAGS="-I${vi_cv_path_python3_include} -I${vi_cv_path_python3_platinclude}"
fi
if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then
dnl Define PYTHON3_HOME if --with-python-config-dir was used