Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  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.  
  57. #serial 7
  58.  
  59. AC_DEFUN([AX_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 ;
  66.                                 break;
  67.                         fi
  68.                 done ;
  69.         ) ;
  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
  72.                 ifGNUmake='' ;
  73.         else
  74.                 ifGNUmake='#' ;
  75.                 AC_MSG_RESULT("Not found");
  76.         fi
  77.         AC_SUBST(ifGNUmake)
  78. ] )
  79.