]> git.saurik.com Git - apt.git/blame - buildlib/tools.m4
fix: The class 'pkgSourceList' defines member variable with name 'SrcList' also defin...
[apt.git] / buildlib / tools.m4
CommitLineData
46e39c8e 1AC_DEFUN([ah_HAVE_GETCONF],
f43579d1
AL
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
6555ccd6 16dnl ah_GET_CONF(variable, value ..., [default])
46e39c8e 17AC_DEFUN([ah_GET_GETCONF],
f43579d1 18 [AC_REQUIRE([ah_HAVE_GETCONF])
6555ccd6
AL
19 if test ! -z "$GETCONF";then
20 old_args="[$]@"
21 set -- $2
22 while eval test -z \"\$$1\" -a ! -z \"[$]1\";do
23 eval $1=`$GETCONF "[$]1" 2>/dev/null`
24 shift
25 done
26 fi
27 if eval test -z \"\$$1\" -o \"\$$1\" = "-1";then
28 eval $1="$3"
29 fi
30])
46e39c8e 31AC_DEFUN([ah_NUM_CPUS],
6555ccd6 32 [AC_MSG_CHECKING([number of cpus])
f43579d1
AL
33 AC_ARG_WITH(cpus,
34 [ --with-cpus The number of cpus to be used for building(see --with-procs, default 1)],
6555ccd6
AL
35 [
36 if test "$withval" = "yes"; then
37 ah_GET_GETCONF(NUM_CPUS, SC_NPROCESSORS_ONLN _NPROCESSORS_ONLN, 1)
f43579d1
AL
38 elif test ! "$withval" = "no";then
39 NUM_CPUS=$withval
6555ccd6
AL
40 elif test "$withval" = "no";then
41 NUM_CPUS=1
f43579d1 42 fi],
6555ccd6 43 [ah_GET_GETCONF(NUM_CPUS, SC_NPROCESSORS_ONLN _NPROCESSORS_ONLN, 1)]
f43579d1 44 )
6555ccd6
AL
45 ah_NUM_CPUS_msg="$NUM_CPUS"
46 if test "$NUM_CPUS" = "0"; then
47 # broken getconf, time to bitch.
48 ah_NUM_CPUS_msg="found 0 cpus. Has someone done a lobotomy?"
911a4d76
AL
49 NUM_CPUS=1
50 fi
f43579d1
AL
51 if test $NUM_CPUS = 1 ;then
52 default_PROC_MULTIPLY=1
53 else
54 default_PROC_MULTIPLY=2
55 fi
6555ccd6 56 AC_MSG_RESULT([$ah_NUM_CPUS_msg])
f43579d1 57 AC_SUBST(NUM_CPUS)
d7bccc73 58])
46e39c8e 59AC_DEFUN([ah_PROC_MULTIPLY],
f43579d1
AL
60 [AC_REQUIRE([ah_NUM_CPUS])
61 AC_MSG_CHECKING([processor multiplier])
62 AC_ARG_WITH(proc-multiply,
63 [ --with-proc-multiply Multiply this * number of cpus for parallel making(default 2).],
64 [if test "$withval" = "yes"; then
65 PROC_MULTIPLY=$default_PROC_MULTIPLY
66 elif test ! "$withval" = "no";then
67 PROC_MULTIPLY=$withval
68 fi],
69 [PROC_MULTIPLY=$default_PROC_MULTIPLY]
70 )
71 AC_MSG_RESULT([$PROC_MULTIPLY])
72 AC_SUBST(PROC_MULTIPLY)
d7bccc73
AL
73])
74
46e39c8e 75AC_DEFUN([ah_NUM_PROCS],
f43579d1
AL
76 [AC_REQUIRE([ah_PROC_MULTIPLY])
77 AC_REQUIRE([ah_NUM_CPUS])
78 AC_MSG_CHECKING([number of processes to run during make])
79 AC_ARG_WITH(procs,
80 [ --with-procs The number of processes to run in parallel during make(num_cpus * multiplier).],
81 [if test "$withval" = "yes"; then
6a15675b 82 NUM_PROCS=`expr $NUM_CPUS \* $PROC_MULTIPLY`
f43579d1
AL
83 elif test ! "$withval" = "no";then
84 NUM_PROCS=$withval
85 fi],
6a15675b 86 [NUM_PROCS=`expr $NUM_CPUS \* $PROC_MULTIPLY`]
f43579d1
AL
87 )
88 AC_MSG_RESULT([$NUM_PROCS])
89 AC_SUBST(NUM_PROCS)
d7bccc73 90])
a5b7cd82 91
46e39c8e 92AC_DEFUN([ah_GCC3DEP],[
c29a99d7
AL
93 AC_MSG_CHECKING(if $CXX -MD works)
94 touch gcc3dep.cc
95 ${CXX-c++} -MD -o gcc3dep_test.o -c gcc3dep.cc
96 rm -f gcc3dep.cc gcc3dep_test.o
97 if test -e gcc3dep.d; then
98 rm -f gcc3dep.d
99 GCC_MD=input
697bfdb1 100 GCC3DEP=
c29a99d7
AL
101 elif test -e gcc3dep_test.d; then
102 rm -f gcc3dep_test.d
103 GCC_MD=output
104 GCC3DEP=yes
105 else
106 AC_MSG_ERROR(no)
107 fi
108 AC_MSG_RESULT([yes, for $GCC_MD])
109 AC_SUBST(GCC3DEP)
110])