-
-dnl tl_CHECK_TOOLS -
-dnl do a tl_CHECK_TOOL for multiple tools (like AC_CHECK_PROGS)
-dnl tl_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND
-dnl [, PATH]])
-AC_DEFUN(tl_CHECK_TOOLS,
-[for ac_tool in $2
-do
-tl_CHECK_TOOL($1, [$]ac_tool, [$]ac_tool, , $4)
-test -n "[$]$1" && break
-done
-ifelse([$3], , , [test -n "[$]$1" || $1="$3"
-])])
-
-dnl replace AC_PROG_CC and AC_PROG_CXX
-undefine([AC_PROG_CC])
-define([AC_PROG_CC], [tl_PROG_CC])
-undefine([AC_PROG_CXX])
-define([AC_PROG_CXX], [tl_PROG_CXX])
-
-dnl tl_PROG_CC, tl_PROG_CXX - same as old AC_PROG_CC and AC_PROG_CXX, but
-dnl use AC_CHECK_TOOL/tl_CHECK_TOOLS instead of AC_CHECK_PROG, etc.
-AC_DEFUN(tl_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_PROVIDE([AC_PROG_CC])dnl
-tl_CHECK_TOOL(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_TOOL(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-if test -n "$ac_tool_prefix" -a "`echo $CC | grep '$ac_tool_prefix'`" = "" \
- -a "`echo $CC | grep -- '-b'`" = ""; then
- if test -z "$ac_cv_prog_CC_dir" && $CC -v 2>&1 | grep gcc >/dev/null 2>&1 ; then
- AC_CACHE_CHECK([if $CC -b${ac_tool_dir} works], tl_cv_prog_cc_bhost,[
- old_cc="${CC}"
- CC="${CC} -b${ac_tool_dir}"
- AC_LANG_SAVE
- AC_LANG_C
- AC_TRY_COMPILER([main(){return(0);}], tl_cv_prog_cc_bhost, ac_cv_prog_cc_cross)
- AC_LANG_RESTORE])
- if test $tl_cv_prog_cc_bhost = "yes"; then
- ac_cv_prog_cc_works=yes
- cctest=yes
- else
- CC="${old_cc}"
- fi
- fi
-fi
-
-if test "$cctest" != "yes"; then
- tl_PROG_CC_WORKS
-fi
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
+AC_DEFUN([ah_NUM_CPUS],
+ [AC_MSG_CHECKING([number of cpus])
+ AC_ARG_WITH(cpus,
+ [ --with-cpus The number of cpus to be used for building(see --with-procs, default 1)],
+ [
+ if test "$withval" = "yes"; then
+ ah_GET_GETCONF(NUM_CPUS, SC_NPROCESSORS_ONLN _NPROCESSORS_ONLN, 1)
+ elif test ! "$withval" = "no";then
+ NUM_CPUS=$withval
+ elif test "$withval" = "no";then
+ NUM_CPUS=1
+ fi],
+ [ah_GET_GETCONF(NUM_CPUS, SC_NPROCESSORS_ONLN _NPROCESSORS_ONLN, 1)]
+ )
+ ah_NUM_CPUS_msg="$NUM_CPUS"
+ if test "$NUM_CPUS" = "0"; then
+ # broken getconf, time to bitch.
+ ah_NUM_CPUS_msg="found 0 cpus. Has someone done a lobotomy?"
+ NUM_CPUS=1
+ fi
+ if test $NUM_CPUS = 1 ;then
+ default_PROC_MULTIPLY=1
+ else
+ default_PROC_MULTIPLY=2
+ fi
+ AC_MSG_RESULT([$ah_NUM_CPUS_msg])
+ AC_SUBST(NUM_CPUS)