1
0

ax_am_jobserver.m4 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # ===========================================================================
  2. # https://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 8
  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. enable_jobserver=$CPU_COUNT
  46. ((enable_jobserver++))
  47. fi
  48. m4_pattern_allow(AM_MAKEFLAGS)
  49. if test "x$enable_jobserver" != "xno"; then
  50. AC_MSG_NOTICE([added jobserver support to make for $enable_jobserver jobs])
  51. AX_ADD_AM_MACRO( AM_MAKEFLAGS += -j$enable_jobserver )
  52. fi
  53. ])