From 5039f7efcaaedc0f3430f51ca44370512474054e Mon Sep 17 00:00:00 2001 From: nnposter Date: Sat, 7 Sep 2024 02:40:36 +0000 Subject: [PATCH] Add configure test for presence of python setuptools. Close #2915, see #2913 --- configure | 20 ++++++++++++++++---- configure.ac | 16 +++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 5e53a5462..83814555f 100755 --- a/configure +++ b/configure @@ -6520,6 +6520,18 @@ printf "%s\n" "$am_cv_python_pyexecdir" >&6; } +if $HAVE_PYTHON ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python setuptools" >&5 +printf %s "checking for python setuptools... " >&6; } + if $PYTHON -c 'import setuptools' 2>/dev/null ; then + have_setuptools=yes + else + have_setuptools=no + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_setuptools" >&5 +printf "%s\n" "$have_setuptools" >&6; } +fi + NDIFFDIR=ndiff # Do they want Ndiff? @@ -6532,15 +6544,15 @@ else $as_nop with_ndiff=check fi -if $HAVE_PYTHON ; then : ; +if $HAVE_PYTHON && test "$have_setuptools" = "yes" ; then : ; else if test "$with_ndiff" = "check" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Ndiff because Python was not found" >&5 -printf "%s\n" "$as_me: WARNING: Not building Ndiff because Python was not found" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Ndiff because Python with setuptools was not found" >&5 +printf "%s\n" "$as_me: WARNING: Not building Ndiff because Python with setuptools was not found" >&2;} elif test "$with_ndiff" = "yes"; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "--with-ndiff requires Python +as_fn_error $? "--with-ndiff requires Python with setuptools See \`config.log' for more details" "$LINENO" 5; } fi with_ndiff=no diff --git a/configure.ac b/configure.ac index 848907786..6abc148e5 100644 --- a/configure.ac +++ b/configure.ac @@ -233,16 +233,26 @@ CHECK_IPV6_IPPROTO_RAW m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python]) AM_PATH_PYTHON([3], [HAVE_PYTHON=true], [HAVE_PYTHON=false]) +if $HAVE_PYTHON ; then + AC_MSG_CHECKING([for python setuptools]) + if $PYTHON -c 'import setuptools' 2>/dev/null ; then + have_setuptools=yes + else + have_setuptools=no + fi + AC_MSG_RESULT([$have_setuptools]) +fi + NDIFFDIR=ndiff # Do they want Ndiff? AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check]) -if $HAVE_PYTHON ; then : ; +if $HAVE_PYTHON && test "$have_setuptools" = "yes" ; then : ; else if test "$with_ndiff" = "check" ; then - AC_MSG_WARN([Not building Ndiff because Python was not found]) + AC_MSG_WARN([Not building Ndiff because Python with setuptools was not found]) elif test "$with_ndiff" = "yes"; then - AC_MSG_FAILURE([--with-ndiff requires Python]) + AC_MSG_FAILURE([--with-ndiff requires Python with setuptools]) fi with_ndiff=no fi