You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.8 KiB

  1. # ===========================================================================
  2. # http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_GNU_MAKE()
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro searches for a GNU version of make. If a match is found, the
  12. # makefile variable `ifGNUmake' is set to the empty string, otherwise it
  13. # is set to "#". This is useful for including a special features in a
  14. # Makefile, which cannot be handled by other versions of make. The
  15. # variable _cv_gnu_make_command is set to the command to invoke GNU make
  16. # if it exists, the empty string otherwise.
  17. #
  18. # Here is an example of its use:
  19. #
  20. # Makefile.in might contain:
  21. #
  22. # # A failsafe way of putting a dependency rule into a makefile
  23. # $(DEPEND):
  24. # $(CC) -MM $(srcdir)/*.c > $(DEPEND)
  25. #
  26. # @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
  27. # @ifGNUmake@ include $(DEPEND)
  28. # @ifGNUmake@ endif
  29. #
  30. # Then configure.in would normally contain:
  31. #
  32. # AX_CHECK_GNU_MAKE()
  33. # AC_OUTPUT(Makefile)
  34. #
  35. # Then perhaps to cause gnu make to override any other make, we could do
  36. # something like this (note that GNU make always looks for GNUmakefile
  37. # first):
  38. #
  39. # if ! test x$_cv_gnu_make_command = x ; then
  40. # mv Makefile GNUmakefile
  41. # echo .DEFAULT: > Makefile ;
  42. # echo \ $_cv_gnu_make_command \$@ >> Makefile;
  43. # fi
  44. #
  45. # Then, if any (well almost any) other make is called, and GNU make also
  46. # exists, then the other make wraps the GNU make.
  47. #
  48. # LICENSE
  49. #
  50. # Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
  51. #
  52. # Copying and distribution of this file, with or without modification, are
  53. # permitted in any medium without royalty provided the copyright notice
  54. # and this notice are preserved. This file is offered as-is, without any
  55. # warranty.
  56. #serial 7
  57. AC_DEFUN([AX_CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
  58. _cv_gnu_make_command='' ;
  59. dnl Search all the common names for GNU make
  60. for a in "$MAKE" make gmake gnumake ; do
  61. if test -z "$a" ; then continue ; fi ;
  62. if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
  63. _cv_gnu_make_command=$a ;
  64. break;
  65. fi
  66. done ;
  67. ) ;
  68. dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
  69. if test "x$_cv_gnu_make_command" != "x" ; then
  70. ifGNUmake='' ;
  71. else
  72. ifGNUmake='#' ;
  73. AC_MSG_RESULT("Not found");
  74. fi
  75. AC_SUBST(ifGNUmake)
  76. ] )