Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
build/pkgs/python3/spkg-configure.m4: Do not check sysconfig CPPFLAGS…
Browse files Browse the repository at this point in the history
… so that /usr/bin/python3 is accepted on macOS; reject broken homebrew python3 unless requested explicitly with configgure --with-python=...
  • Loading branch information
mkoeppe committed Jan 8, 2021
1 parent 2c60025 commit ee679bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
24 changes: 17 additions & 7 deletions build/pkgs/python3/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ SAGE_SPKG_CONFIGURE([python3], [
SAGE_CHECK_PYTHON_FOR_VENV([$ac_path_PYTHON3],
MIN_VERSION, LT_VERSION,
$check_modules, [
AS_IF([[conftest_venv/bin/python3 -m sysconfig | grep '^\sw*\(C\|LD\)FLAGS *=.*[" ]-[IL]' ]] [>& AS_MESSAGE_LOG_FD 2>&1 ], [
AC_MSG_WARN([this is a misconfigured Python whose sysconfig compiler/linker flags contain -I or -L options, which may cause wrong versions of libraries to leak into the build of Python packages - see https://trac.sagemath.org/ticket/31132])
])
dnl It is good
ac_cv_path_PYTHON3="$ac_path_PYTHON3"
ac_path_PYTHON3_found=:
Expand All @@ -45,17 +48,24 @@ SAGE_SPKG_CONFIGURE([python3], [
SAGE_CHECK_PYTHON_FOR_VENV([$ac_path_PYTHON3],
MIN_VERSION, LT_VERSION,
$check_modules, [
dnl It is good
ac_cv_path_PYTHON3="$ac_path_PYTHON3"
ac_path_PYTHON3_found=:
AC_MSG_RESULT([yes])
dnl introduction for AC_MSG_RESULT printed by AC_CACHE_CHECK
AC_MSG_CHECKING([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules])
AS_IF([[conftest_venv/bin/python3 -m sysconfig | grep '^\sw*\(C\|LD\)FLAGS *=.*[" ]-[IL]' ]] [>& AS_MESSAGE_LOG_FD 2>&1 ], [
AC_MSG_RESULT([no, this is a misconfigured Python whose sysconfig compiler/linker flags contain -I or -L options, which may cause wrong versions of libraries to leak into the build of Python packages - see https://trac.sagemath.org/ticket/31132; to use it anyway, use ./configure --with-python=$ac_path_PYTHON3])
], [
dnl It is good
ac_cv_path_PYTHON3="$ac_path_PYTHON3"
ac_path_PYTHON3_found=:
AC_MSG_RESULT([yes])
dnl introduction for AC_MSG_RESULT printed by AC_CACHE_CHECK
AC_MSG_CHECKING([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules])
])
])
])
])
])
AS_IF([test -z "$ac_cv_path_PYTHON3"], [sage_spkg_install_python3=yes])
AS_IF([test -z "$ac_cv_path_PYTHON3"], [
AC_MSG_NOTICE([to try to use a different system python, use ./configure --with-python=/path/to/python])
sage_spkg_install_python3=yes
])
m4_popdef([MIN_VERSION])
m4_popdef([LT_VERSION])
])
Expand Down
3 changes: 0 additions & 3 deletions m4/sage_check_python_for_venv.m4
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ setup(name="config_check_distutils_cxx", ext_modules=modules)
exit(0)
EOF
AS_IF([CC="$CC" CXX="$CXX" conftest_venv/bin/python3 conftest.py --verbose build --build-base=conftest.dir >& AS_MESSAGE_LOG_FD 2>&1 ], [
AS_IF([[conftest_venv/bin/python3 -m sysconfig | grep '^\sw*\(C[PX]*\|LD\)FLAGS *=.*[" ]-[IL]' ]] [>& AS_MESSAGE_LOG_FD 2>&1 ], [
AC_MSG_WARN([this is a misconfigured Python whose sysconfig compiler/linker flags contain -I or -L options, which may cause wrong versions of libraries to leak into the build of Python packages - see https://trac.sagemath.org/ticket/31132])
])
COMMANDS_IF_GOOD], [
AC_MSG_RESULT([no, the version is in the supported range, and the modules can be imported, but distutils cannot build a C++ 11 extension])
])
Expand Down

0 comments on commit ee679bd

Please sign in to comment.