1 ##### http://autoconf-archive.cryp.to/check_gnu_make.html
9 # This macro searches for a GNU version of make. If a match is found,
10 # the makefile variable `ifGNUmake' is set to the empty string,
11 # otherwise it is set to "#". This is useful for including a special
12 # features in a Makefile, which cannot be handled by other versions
13 # of make. The variable _cv_gnu_make_command is set to the command to
14 # invoke GNU make if it exists, the empty string otherwise.
16 # Here is an example of its use:
18 # Makefile.in might contain:
20 # # A failsafe way of putting a dependency rule into a makefile
22 # $(CC) -MM $(srcdir)/*.c > $(DEPEND)
24 # @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
25 # @ifGNUmake@ include $(DEPEND)
28 # Then configure.in would normally contain:
33 # Then perhaps to cause gnu make to override any other make, we could
34 # do something like this (note that GNU make always looks for
37 # if ! test x$_cv_gnu_make_command = x ; then
38 # mv Makefile GNUmakefile
39 # echo .DEFAULT: > Makefile ;
40 # echo \ $_cv_gnu_make_command \$@ >> Makefile;
43 # Then, if any (well almost any) other make is called, and GNU make
44 # also exists, then the other make wraps the GNU make.
52 # Copyright (c) 2002 John Darrington <j.darrington@elvis.murdoch.edu.au>
54 # Copying and distribution of this file, with or without
55 # modification, are permitted in any medium without royalty provided
56 # the copyright notice and this notice are preserved.
59 [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
60 _cv_gnu_make_command='' ;
61 dnl Search all the common names for GNU make
62 for a in "$MAKE" make gmake gnumake ; do
63 if test -z "$a" ; then continue ; fi ;
64 if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
65 _cv_gnu_make_command=$a ;
70 dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
71 if test "x$_cv_gnu_make_command" != "x" ; then
75 AC_MSG_RESULT("Not found");