Merge lp:~tangent-org/libmemcached/1.0-build/ Build: jenkins-Libmemcached-187
[m6w6/libmemcached] / m4 / ax_am_jobserver.m4
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
36 #serial 7
37
38 AC_DEFUN([AX_AM_JOBSERVER], [
39 AC_REQUIRE([AX_COUNT_CPUS])
40 AC_REQUIRE([AX_AM_MACROS])
41 AC_ARG_ENABLE( jobserver,
42 [ --enable-jobserver@<:@=no/yes/@%:@@:>@ default=m4_ifval([$1],[$1],[yes])
43 Enable up to @%:@ make jobs
44 yes: enable one more than CPU count
45 ],, [enable_jobserver=m4_ifval([$1],[$1],[yes])])
46 if test "x$enable_jobserver" = "xyes"; then
47 enable_jobserver=$CPU_COUNT
48 ((enable_jobserver++))
49 fi
50 m4_pattern_allow(AM_MAKEFLAGS)
51 if test "x$enable_jobserver" != "xno"; then
52 AC_MSG_NOTICE([added jobserver support to make for $enable_jobserver jobs])
53 AX_ADD_AM_MACRO( AM_MAKEFLAGS += -j$enable_jobserver )
54 fi
55 ])