Skip to content

Commit

Permalink
[Template merge] start requiring gnu make
Browse files Browse the repository at this point in the history
  • Loading branch information
flammie committed Feb 20, 2025
1 parent 7f3277f commit d12946c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
17 changes: 14 additions & 3 deletions m4/ax_check_gnu_make.m4
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html
# https://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_GNU_MAKE()
# AX_CHECK_GNU_MAKE([run-if-true],[run-if-false])
#
# DESCRIPTION
#
Expand All @@ -13,13 +13,19 @@
# * The makefile variable `ifGNUmake' is set to the empty string, otherwise
# it is set to "#". This is useful for including a special features in a
# Makefile, which cannot be handled by other versions of make.
# * The makefile variable `ifnGNUmake' is set to #, otherwise
# it is set to the empty string. This is useful for including a special
# features in a Makefile, which can be handled
# by other versions of make or to specify else like clause.
# * The variable `_cv_gnu_make_command` is set to the command to invoke
# GNU make if it exists, the empty string otherwise.
# * The variable `ax_cv_gnu_make_command` is set to the command to invoke
# GNU make by copying `_cv_gnu_make_command`, otherwise it is unset.
# * If GNU Make is found, its version is extracted from the output of
# `make --version` as the last field of a record of space-separated
# columns and saved into the variable `ax_check_gnu_make_version`.
# * Additionally if GNU Make is found, run shell code run-if-true
# else run shell code run-if-false.
#
# Here is an example of its use:
#
Expand All @@ -31,6 +37,8 @@
#
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
# @ifGNUmake@ include $(DEPEND)
# @ifGNUmake@ else
# fallback code
# @ifGNUmake@ endif
#
# Then configure.in would normally contain:
Expand Down Expand Up @@ -61,7 +69,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.

#serial 8
#serial 12

AC_DEFUN([AX_CHECK_GNU_MAKE],dnl
[AC_PROG_AWK
Expand All @@ -79,6 +87,9 @@ dnl Search all the common names for GNU make
done ;])
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])])
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])])
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])])
AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1])
AC_SUBST([ifGNUmake])
AC_SUBST([ifnGNUmake])
])
45 changes: 22 additions & 23 deletions m4/giella-macros.m4
Original file line number Diff line number Diff line change
Expand Up @@ -274,31 +274,24 @@ AM_CONDITIONAL([CAN_MERGE], [test "x$can_merge" != xno ])
AC_CANONICAL_HOST
# Check for which host we are on and setup a few things
# specifically based on the host
# This is the minimum GNU Make version required (except on OSX):
# This is the minimum GNU Make version required
_GNU_make_min_version=m4_default([$1], [3.82])
# Then we check against different hosts:
case $host_os in
darwin* )
# Do nothing for mac: the included make is fine
true
;;
*)
# Default Case: in all other cases check that we are using GNU make
# and that it is new enough:
AX_CHECK_GNU_MAKE()
AC_MSG_CHECKING([whether GNU make is at least $_GNU_make_min_version])
AX_COMPARE_VERSION([$ax_check_gnu_make_version], [ge],
[$_GNU_make_min_version],
[
AC_MSG_RESULT([yes])
# Reset the MAKE variable, to ensure we're using GNU make:
MAKE=$_cv_gnu_make_command
],
[AC_MSG_ERROR([GNU Make too old ($ax_check_gnu_make_version), please install at least $_GNU_make_min_version])
])
;;
esac
AX_CHECK_GNU_MAKE(,
[AC_MSG_WARN([GNU make will be required])])
AC_MSG_CHECKING([whether GNU make is at least $_GNU_make_min_version])
AX_COMPARE_VERSION([$ax_check_gnu_make_version], [ge],
[$_GNU_make_min_version],
[
AC_MSG_RESULT([yes])
# Reset the MAKE variable, to ensure we're using GNU make:
MAKE=$_cv_gnu_make_command
],
[AC_MSG_RESULT([no])
AC_MSG_WARN([GNU Make too old ($ax_check_gnu_make_version), please install at least $_GNU_make_min_version])
gt_need_gnu_make=yes
])
################ END of GNU Make check ################
# We need special treatment of Java paths in Cygwin:
Expand Down Expand Up @@ -1108,6 +1101,12 @@ cd ..
git clone git@github.com:giellalt/$gt_SHARED_FAILS
cd $gt_SHARED_FAILS
./autogen.sh && ./configure && make])])
AS_IF([test "x$gt_need_gnu_make" = xyes],
[AC_MSG_WARN([GNU make will be required to build giellalt from now on (Feb 2025):
if you are using a MacOS do:
sudo brew install make
see https://github.com/giellalt/giella-core/issues/79 for background and further instructions])])
]) # gt_PRINT_FOOTER
# vim: set ft=config:

0 comments on commit d12946c

Please sign in to comment.