gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] Fix GNU Make detection


From: Ladislav Michl
Subject: [PATCH 2/3] Fix GNU Make detection
Date: Sun, 12 Jan 2020 19:36:03 +0100

---
 ChangeLog    |  6 ++++++
 configure    | 60 ++++++++++++++++------------------------------------
 configure.ac | 52 +++++++++++++--------------------------------
 3 files changed, 39 insertions(+), 79 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 01eb3de4..b0adb41d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-11  Ladislav Michl <address@hidden>
+
+       * configure:
+       * configure.ac:
+       Fix GNU Make version detection.
+
 2020-01-11  Ladislav Michl <address@hidden>
 
        * configure:
diff --git a/configure b/configure
index ddce99dc..14d52bae 100755
--- a/configure
+++ b/configure
@@ -6767,48 +6767,29 @@ test -n "$GNUMAKE" || GNUMAKE="make"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the GNU Make version" >&5
 $as_echo_n "checking for the GNU Make version... " >&6; }
 
-# To get the make version, take the output of 'make --version', read
-# only the first line (that we expect to be something like "GNU Make
-# 3.81"), and ignore everything up to the first numeric character.
-gs_cv_make_version=`($GNUMAKE --version | head -1 | sed -e 's/^[^0-9]*//') 
2>&5`
-
-# Now check for the major/minor version numbers.
-gs_cv_make_major_version=`(echo ${gs_cv_make_version} | sed -e 
's/\([0-9][0-9]*\)[^0-9]\([0-9][0-9]*\).*/\1/') 2>&5`
-gs_cv_make_minor_version=`(echo ${gs_cv_make_version} | sed -e 
's/\([0-9][0-9]*\)[^0-9]\([0-9][0-9]*\).*/\2/') 2>&5`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: version: 
${gs_cv_make_major_version}.${gs_cv_make_minor_version}" >&5
-$as_echo "version: ${gs_cv_make_major_version}.${gs_cv_make_minor_version}" 
>&6; }
+MAKE_VERSION=`$GNUMAKE --version 2>/dev/null | sed -ne "s/^GNU Make 
\([0-9]\+\.[0-9.]\+\).*$/\1/p"`
+MAJOR_MAKE_VERSION="${MAKE_VERSION%%.*}"
+MINOR_MAKE_VERSION="${MAKE_VERSION#*.}"
+MINOR_MAKE_VERSION="${MINOR_MAKE_VERSION%%.*}"
+if test -z "${MAJOR_MAKE_VERSION}" -o -z "${MINOR_MAKE_VERSION}" ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not parse make 
version. GNU make >= 3.79 required" >&5
+$as_echo "$as_me: WARNING: could not parse make version. GNU make >= 3.79 
required" >&2;}
+  MINOR_MAKE_VERSION=0
+  MAJOR_MAKE_VERSION=0
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE_VERSION" >&5
+$as_echo "$MAKE_VERSION" >&6; }
 
 #--------------------------------------------------------------------
 # Check for GNU Make >= 3.79
 #--------------------------------------------------------------------
-# We want to emit a warning if they are using GNU make < 3.79 as it's
-# no longer supported.  We let them install everything at their own
-# risk though.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU Make >= 3.79" >&5
-$as_echo_n "checking for GNU Make >= 3.79... " >&6; }
-SUPPORTED_MAKE=no
-if test "${gs_cv_make_major_version}" = "3" >&5 2>&5; then
-  if test "${gs_cv_make_minor_version}" -ge "79" >&5 2>&5; then
-    SUPPORTED_MAKE=yes
-  fi
-fi
-
-if test "${gs_cv_make_major_version}" -ge "4" >&5 2>&5; then
-  SUPPORTED_MAKE=yes
-fi
-
-if test "${SUPPORTED_MAKE}" = "yes" >&5 2>&5; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
+if test $MAJOR_MAKE_VERSION -eq 3 -a $MINOR_MAKE_VERSION -lt 79 -o 
$MAJOR_MAKE_VERSION -lt 3 ; then
   # We do not abort mostly because the checks for GNU make might have
   # gone wrong and returned the wrong version, and because GNU make <
   # 3.79.1 probably works anyway (with the exception of parallel
   # building).
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GNU Make >= 3.79.1 is 
recommended!  Older versions are no longer supported.  Continue at your own 
risk." >&5
-$as_echo "$as_me: WARNING: GNU Make >= 3.79.1 is recommended!  Older versions 
are no longer supported.  Continue at your own risk." >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GNU Make >= 3.79.1 
required! Continue at your own risk." >&5
+$as_echo "$as_me: WARNING: GNU Make >= 3.79.1 required! Continue at your own 
risk." >&2;}
 fi
 
 #--------------------------------------------------------------------
@@ -6820,14 +6801,9 @@ $as_echo_n "checking if GNU Make has the info 
function... " >&6; }
 # Things may go wrong (eg, make couldn't be found in one of the
 # previous steps), so by default we assume 'no' here.  If things go
 # wrong, you'll lost some non-essential features.
-MAKE_WITH_INFO_FUNCTION=no
-if test "${gs_cv_make_major_version}" = "3" >&5 2>&5; then
-  if test "${gs_cv_make_minor_version}" -ge "81" >&5 2>&5; then
-    MAKE_WITH_INFO_FUNCTION=yes
-  fi
-fi
-
-if test "${gs_cv_make_major_version}" -ge "4" >&5 2>&5; then
+if test $MAJOR_MAKE_VERSION -eq 3 -a $MINOR_MAKE_VERSION -lt 81 -o 
$MAJOR_MAKE_VERSION -lt 3 ; then
+  MAKE_WITH_INFO_FUNCTION=no
+else
   MAKE_WITH_INFO_FUNCTION=yes
 fi
 
diff --git a/configure.ac b/configure.ac
index ad4b581c..d470527e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1777,43 +1777,26 @@ AC_SUBST(GNUMAKE)
 # that contains an info command).
 AC_MSG_CHECKING(for the GNU Make version)
 
-# To get the make version, take the output of 'make --version', read
-# only the first line (that we expect to be something like "GNU Make
-# 3.81"), and ignore everything up to the first numeric character.
-gs_cv_make_version=`($GNUMAKE --version | head -1 | sed -e 's/^[[^0-9]]*//') 
2>&5`
-
-# Now check for the major/minor version numbers.
-gs_cv_make_major_version=`(echo ${gs_cv_make_version} | sed -e 
's/\([[0-9]][[0-9]]*\)[[^0-9]]\([[0-9]][[0-9]]*\).*/\1/') 2>&5`
-gs_cv_make_minor_version=`(echo ${gs_cv_make_version} | sed -e 
's/\([[0-9]][[0-9]]*\)[[^0-9]]\([[0-9]][[0-9]]*\).*/\2/') 2>&5`
-AC_MSG_RESULT(version: ${gs_cv_make_major_version}.${gs_cv_make_minor_version})
+MAKE_VERSION=`$GNUMAKE --version 2>/dev/null | sed -ne "s/^GNU Make 
\([[0-9]]\+\.[[0-9.]]\+\).*$/\1/p"`
+MAJOR_MAKE_VERSION="${MAKE_VERSION%%.*}"
+MINOR_MAKE_VERSION="${MAKE_VERSION#*.}"
+MINOR_MAKE_VERSION="${MINOR_MAKE_VERSION%%.*}"
+if test -z "${MAJOR_MAKE_VERSION}" -o -z "${MINOR_MAKE_VERSION}" ; then
+  AC_MSG_WARN([could not parse make version. GNU make >= 3.79 required])
+  MINOR_MAKE_VERSION=0
+  MAJOR_MAKE_VERSION=0
+fi
+AC_MSG_RESULT([$MAKE_VERSION])
 
 #--------------------------------------------------------------------
 # Check for GNU Make >= 3.79
 #--------------------------------------------------------------------
-# We want to emit a warning if they are using GNU make < 3.79 as it's
-# no longer supported.  We let them install everything at their own
-# risk though.
-AC_MSG_CHECKING(for GNU Make >= 3.79)
-SUPPORTED_MAKE=no
-if test "${gs_cv_make_major_version}" = "3" >&5 2>&5; then
-  if test "${gs_cv_make_minor_version}" -ge "79" >&5 2>&5; then
-    SUPPORTED_MAKE=yes
-  fi
-fi
-
-if test "${gs_cv_make_major_version}" -ge "4" >&5 2>&5; then
-  SUPPORTED_MAKE=yes
-fi
-
-if test "${SUPPORTED_MAKE}" = "yes" >&5 2>&5; then
-  AC_MSG_RESULT(yes)
-else
+if test $MAJOR_MAKE_VERSION -eq 3 -a $MINOR_MAKE_VERSION -lt 79 -o 
$MAJOR_MAKE_VERSION -lt 3 ; then
   # We do not abort mostly because the checks for GNU make might have
   # gone wrong and returned the wrong version, and because GNU make <
   # 3.79.1 probably works anyway (with the exception of parallel
   # building).
-  AC_MSG_RESULT(no)
-  AC_MSG_WARN(GNU Make >= 3.79.1 is recommended!  Older versions are no longer 
supported.  Continue at your own risk.)
+  AC_MSG_WARN([GNU Make >= 3.79.1 required! Continue at your own risk.])
 fi
 
 #--------------------------------------------------------------------
@@ -1824,14 +1807,9 @@ AC_MSG_CHECKING(if GNU Make has the info function)
 # Things may go wrong (eg, make couldn't be found in one of the
 # previous steps), so by default we assume 'no' here.  If things go
 # wrong, you'll lost some non-essential features.
-MAKE_WITH_INFO_FUNCTION=no
-if test "${gs_cv_make_major_version}" = "3" >&5 2>&5; then
-  if test "${gs_cv_make_minor_version}" -ge "81" >&5 2>&5; then
-    MAKE_WITH_INFO_FUNCTION=yes
-  fi
-fi
-
-if test "${gs_cv_make_major_version}" -ge "4" >&5 2>&5; then
+if test $MAJOR_MAKE_VERSION -eq 3 -a $MINOR_MAKE_VERSION -lt 81 -o 
$MAJOR_MAKE_VERSION -lt 3 ; then
+  MAKE_WITH_INFO_FUNCTION=no
+else
   MAKE_WITH_INFO_FUNCTION=yes
 fi
 
-- 
2.25.0.rc2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]