OpenBSD fixes
[ntk/apt.git] / buildlib / tools.m4
CommitLineData
f43579d1
AL
1AC_DEFUN(ah_HAVE_GETCONF,
2 [AC_ARG_WITH(getconf,
3 [ --with-getconf Enable automagical buildtime configuration],
4 [if test "$withval" = "yes"; then
5 AC_PATH_PROG(GETCONF, getconf)
6 elif test ! "$withval" = "no";then
7 AC_MSG_CHECKING([getconf])
8 AC_MSG_RESULT([$withval])
9 GETCONF=$withval
10 fi],
11 [AC_PATH_PROG(GETCONF, getconf)]
12 )
13 AC_SUBST(GETCONF)
d7bccc73
AL
14])
15
f43579d1
AL
16AC_DEFUN(ah_NUM_CPUS,
17 [AC_REQUIRE([ah_HAVE_GETCONF])
18 AC_MSG_CHECKING([number of cpus])
911a4d76 19 NUM_CPUS=
f43579d1
AL
20 AC_ARG_WITH(cpus,
21 [ --with-cpus The number of cpus to be used for building(see --with-procs, default 1)],
22 [if test "$withval" = "yes"; then
36c62cf8 23 if test ! -z "$GETCONF";then
f43579d1 24 NUM_CPUS=`$GETCONF _NPROCESSORS_ONLN 2>/dev/null`
f43579d1
AL
25 fi
26 elif test ! "$withval" = "no";then
27 NUM_CPUS=$withval
28 fi],
e5d83da5 29 [if test ! -z "$GETCONF";then
f43579d1 30 NUM_CPUS=`$GETCONF _NPROCESSORS_ONLN 2>/dev/null`
97db0057 31 fi]
f43579d1 32 )
911a4d76
AL
33 if test -z "$NUM_CPUS"; then
34 NUM_CPUS=1
35 fi
f43579d1
AL
36 if test $NUM_CPUS = 1 ;then
37 default_PROC_MULTIPLY=1
38 else
39 default_PROC_MULTIPLY=2
40 fi
41 AC_MSG_RESULT([$NUM_CPUS])
42 AC_SUBST(NUM_CPUS)
d7bccc73 43])
f43579d1
AL
44AC_DEFUN(ah_PROC_MULTIPLY,
45 [AC_REQUIRE([ah_NUM_CPUS])
46 AC_MSG_CHECKING([processor multiplier])
47 AC_ARG_WITH(proc-multiply,
48 [ --with-proc-multiply Multiply this * number of cpus for parallel making(default 2).],
49 [if test "$withval" = "yes"; then
50 PROC_MULTIPLY=$default_PROC_MULTIPLY
51 elif test ! "$withval" = "no";then
52 PROC_MULTIPLY=$withval
53 fi],
54 [PROC_MULTIPLY=$default_PROC_MULTIPLY]
55 )
56 AC_MSG_RESULT([$PROC_MULTIPLY])
57 AC_SUBST(PROC_MULTIPLY)
d7bccc73
AL
58])
59
f43579d1
AL
60AC_DEFUN(ah_NUM_PROCS,
61 [AC_REQUIRE([ah_PROC_MULTIPLY])
62 AC_REQUIRE([ah_NUM_CPUS])
63 AC_MSG_CHECKING([number of processes to run during make])
64 AC_ARG_WITH(procs,
65 [ --with-procs The number of processes to run in parallel during make(num_cpus * multiplier).],
66 [if test "$withval" = "yes"; then
6a15675b 67 NUM_PROCS=`expr $NUM_CPUS \* $PROC_MULTIPLY`
f43579d1
AL
68 elif test ! "$withval" = "no";then
69 NUM_PROCS=$withval
70 fi],
6a15675b 71 [NUM_PROCS=`expr $NUM_CPUS \* $PROC_MULTIPLY`]
f43579d1
AL
72 )
73 AC_MSG_RESULT([$NUM_PROCS])
74 AC_SUBST(NUM_PROCS)
d7bccc73 75])