On Mon, Jan 13, 2020 at 06:31:21PM +0100, Wolfgang Lux wrote: > Hmmm, I guess you tried to include > MAKE_VERSION=`(${GNUMAKE} --version | head -1 | sed -e 's/^[^0-9]*//')` > just verbatim in configure.ac. That doesn't work because the square brackets > act as quote characters in M4 itself. So you need to properly quote the > regular expression like this: > MAKE_VERSION=`(${GNUMAKE} --version | head -1 | sed -e 's/^[[^0-9]]*//')` > You could of course quote the whole code instead: > [MAKE_VERSION=`(${GNUMAKE} --version | head -1 | sed -e 's/^[^0-9]*//')`]
Nice catch! So you just found why is make detection broken in current configure.ac, yet nobody cared :) It could be done like this, with changes which imho improves readability of comparsions. If you disagree, I'll drop those changes before sending v2. Thank you. diff --git a/configure.ac b/configure.ac index ad4b581c..0c765df0 100644 --- a/configure.ac +++ b/configure.ac @@ -1780,40 +1780,26 @@ 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` - +[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_MAJOR=`(echo ${MAKE_VERSION} | sed -e 's/\([0-9][0-9]*\)[^0-9]\([0-9][0-9]*\).*/\1/') 2>&5`] +[MAKE_VERSION_MINOR=`(echo ${MAKE_VERSION} | sed -e 's/\([0-9][0-9]*\)[^0-9]\([0-9][0-9]*\).*/\2/') 2>&5`] +if test -z "${MAKE_VERSION_MAJOR}" -o -z "${MAKE_VERSION_MINOR}" ; then + AC_MSG_WARN([could not parse make version. GNU make >= 3.79 required]) + MAKE_VERSION_MAJOR=0 + MAKE_VERSION_MINOR=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 $MAKE_VERSION_MAJOR -eq 3 -a $MAKE_VERSION_MINOR -lt 79 -o $MAKE_VERSION_MAJOR -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 +1810,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 $MAKE_VERSION_MAJOR -eq 3 -a $MAKE_VERSION_MINOR -lt 81 -o $MAKE_VERSION_MAJOR -lt 3 ; then + MAKE_WITH_INFO_FUNCTION=no +else MAKE_WITH_INFO_FUNCTION=yes fi -- 2.25.0.rc2