ax_am_jobserver.m4 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # ===========================================================================
  2. # http://www.gnu.org/software/autoconf-archive/ax_am_jobserver.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_AM_JOBSERVER([default_value])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Enables the use of make's jobserver for the purpose of parallel building
  12. # by passing the -j option to make.
  13. #
  14. # The option --enable-jobserver is added to configure which can accept a
  15. # yes, no, or an integer. The integer is the number of separate jobs to
  16. # allow. If 'yes' is given, then the is assumed to be one more than the
  17. # number of CPUs (determined through AX_COUNT_CPUS). If the value of no is
  18. # given, then the jobserver is disabled. The default value is given by the
  19. # first argument of the macro, or 'yes' if the argument is omitted.
  20. #
  21. # This macro makes use of AX_AM_MACROS, so you must add the following line
  22. #
  23. # @INC_AMINCLUDE@
  24. #
  25. # to your Makefile.am files.
  26. #
  27. # LICENSE
  28. #
  29. # Copyright (c) 2008 Michael Paul Bailey <jinxidoru@byu.net>
  30. #
  31. # Copying and distribution of this file, with or without modification, are
  32. # permitted in any medium without royalty provided the copyright notice
  33. # and this notice are preserved. This file is offered as-is, without any
  34. # warranty.
  35. #serial 7
  36. AC_DEFUN([AX_AM_JOBSERVER], [
  37. AC_REQUIRE([AX_COUNT_CPUS])
  38. AC_REQUIRE([AX_AM_MACROS])
  39. AC_ARG_ENABLE( jobserver,
  40. [ --enable-jobserver@<:@=no/yes/@%:@@:>@ default=m4_ifval([$1],[$1],[yes])
  41. Enable up to @%:@ make jobs
  42. yes: enable one more than CPU count
  43. ],, [enable_jobserver=m4_ifval([$1],[$1],[yes])])
  44. if test "x$enable_jobserver" = "xyes"; then
  45. let enable_jobserver=$CPU_COUNT+1
  46. fi
  47. m4_pattern_allow(AM_MAKEFLAGS)
  48. if test "x$enable_jobserver" != "xno"; then
  49. AC_MSG_NOTICE([added jobserver support to make for $enable_jobserver jobs])
  50. AX_ADD_AM_MACRO( AM_MAKEFLAGS += -j$enable_jobserver )
  51. fi
  52. ])