[Libreoffice-commits] .: configure.in

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Fri Jul 15 01:15:50 PDT 2011


 configure.in |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

New commits:
commit b71bb50e7ddfe1cbbaa57830f1e7f0ae3a0ecacf
Author: Mike Eberdt <libreme at comcast.net>
Date:   Fri Jul 15 03:15:29 2011 -0500

    Properly determine number of CPUs on FreeBSD

diff --git a/configure.in b/configure.in
index c61685c..9ad2f52 100755
--- a/configure.in
+++ b/configure.in
@@ -8699,16 +8699,25 @@ dnl ===================================================================
 dnl Number of CPUs to use during the build
 dnl ===================================================================
 AC_MSG_CHECKING([for number of processors to use])
-if test "z`uname -s`" = "zDarwin" -o "z`uname -s`" = "zNetBSD" -o "z`uname -s`" = "zOpenBSD"; then
-    BUILD_NCPUS=`sysctl -n hw.ncpu`
-else
-    BUILD_NCPUS=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
-fi
-if test "z$with_num_cpus" != "z"; then
+if test -n "$with_num_cpus"; then
     BUILD_NCPUS=$with_num_cpus
-fi
-if echo "$BUILD_NCPUS" | $EGREP -q '^[[[:space:]]]*0[[[:space:]]]*$' ; then
-    BUILD_NCPUS=1
+else
+    case `uname -s` in
+
+    Darwin|FreeBSD|NetBSD|OpenBSD)
+        BUILD_NCPUS=`sysctl -n hw.ncpu`
+        ;;
+
+    *)
+        BUILD_NCPUS=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
+        ;;
+    esac
+
+    # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
+    # unexpected format, 'wc -l' will have returned 0.
+    if test "$BUILD_NCPUS" -eq 0; then
+        BUILD_NCPUS=1
+    fi
 fi
 AC_MSG_RESULT([$BUILD_NCPUS])
 AC_SUBST(BUILD_NCPUS)


More information about the Libreoffice-commits mailing list