From fc8b67644bada9ea52cbb7c91f53f763ca84f4bb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 1 Feb 2021 10:21:48 -0800 Subject: [PATCH] SAGE_CHECK_PYTHON_FOR_VENV: Rework with less nesting --- m4/sage_check_python_for_venv.m4 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/m4/sage_check_python_for_venv.m4 b/m4/sage_check_python_for_venv.m4 index fa588c2445c..a6da1f84167 100644 --- a/m4/sage_check_python_for_venv.m4 +++ b/m4/sage_check_python_for_venv.m4 @@ -21,23 +21,29 @@ AC_DEFUN([SAGE_CHECK_PYTHON_FOR_VENV], [ dnl m4_define([conftest_venv], [config-venv]) .... for debugging only rm -rf conftest_venv AS_IF(["]PYTHON_EXE[" build/bin/sage-venv conftest_venv && conftest_venv/bin/python3 -c "import ]REQUIRED_MODULES["], [ + AS_VAR_SET([python3_result], [yes]) SAGE_PYTHON_CHECK_DISTUTILS([CC="$CC" CXX="$CXX" conftest_venv/bin/python3], [ SAGE_ARCHFLAGS="unset" - COMMANDS_IF_GOOD ], [ AS_CASE([$host], [*-*-darwin*], [ dnl #31227: Try if setting ARCHFLAGS to empty fixes it SAGE_PYTHON_CHECK_DISTUTILS([CC="$CC" CXX="$CXX" ARCHFLAGS="" conftest_venv/bin/python3], [ SAGE_ARCHFLAGS="" - COMMANDS_IF_GOOD ], [ - AC_MSG_RESULT([no, the version is in the supported range, and the modules can be imported, but $reason (even with ARCHFLAGS set to empty)]) + AS_VAR_SET([python3_result], + ["no, the version is in the supported range, and the modules can be imported, but $reason (even with ARCHFLAGS set to empty)"]) ]) ], [ - AC_MSG_RESULT([no, the version is in the supported range, and the modules can be imported, but $reason]) - ] - ) + AS_VAR_SET([python3_result], + ["no, the version is in the supported range, and the modules can be imported, but $reason"]) + ]) + ]) + AS_VAR_IF([python3_result], [yes], [ + dnl these commands are expected to call AC_MSG_RESULT + COMMANDS_IF_GOOD + ], [ + AC_MSG_RESULT([$python3_result]) ]) ], [ AC_MSG_RESULT([no, the version is in the supported range but cannot import one of the required modules: ]REQUIRED_MODULES)