|
1 # |
|
2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
|
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 # |
|
5 # This code is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License version 2 only, as |
|
7 # published by the Free Software Foundation. Oracle designates this |
|
8 # particular file as subject to the "Classpath" exception as provided |
|
9 # by Oracle in the LICENSE file that accompanied this code. |
|
10 # |
|
11 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 # version 2 for more details (a copy is included in the LICENSE file that |
|
15 # accompanied this code). |
|
16 # |
|
17 # You should have received a copy of the GNU General Public License version |
|
18 # 2 along with this work; if not, write to the Free Software Foundation, |
|
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 # |
|
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 # or visit www.oracle.com if you need additional information or have any |
|
23 # questions. |
|
24 # |
|
25 |
|
26 AC_DEFUN([CHECK_CORES], |
|
27 [ |
|
28 AC_MSG_CHECKING([for number of cores]) |
|
29 NUM_CORES=1 |
|
30 FOUND_CORES=no |
|
31 |
|
32 if test -f /proc/cpuinfo; then |
|
33 # Looks like a Linux system |
|
34 NUM_CORES=`cat /proc/cpuinfo | grep -c processor` |
|
35 FOUND_CORES=yes |
|
36 fi |
|
37 |
|
38 if test -x /usr/sbin/psrinfo; then |
|
39 # Looks like a Solaris system |
|
40 NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line` |
|
41 FOUND_CORES=yes |
|
42 fi |
|
43 |
|
44 if test -x /usr/sbin/system_profiler; then |
|
45 # Looks like a MacOSX system |
|
46 NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk '{print [$]5}'` |
|
47 FOUND_CORES=yes |
|
48 fi |
|
49 |
|
50 if test "x$build_os" = xwindows; then |
|
51 NUM_CORES=4 |
|
52 fi |
|
53 |
|
54 # For c/c++ code we run twice as many concurrent build |
|
55 # jobs than we have cores, otherwise we will stall on io. |
|
56 CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2` |
|
57 |
|
58 if test "x$FOUND_CORES" = xyes; then |
|
59 AC_MSG_RESULT([$NUM_CORES]) |
|
60 else |
|
61 AC_MSG_RESULT([could not detect number of cores, defaulting to 1!]) |
|
62 fi |
|
63 |
|
64 ]) |
|
65 |
|
66 AC_DEFUN([CHECK_MEMORY_SIZE], |
|
67 [ |
|
68 AC_MSG_CHECKING([for memory size]) |
|
69 # Default to 1024MB |
|
70 MEMORY_SIZE=1024 |
|
71 FOUND_MEM=no |
|
72 |
|
73 if test -f /proc/cpuinfo; then |
|
74 # Looks like a Linux system |
|
75 MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'` |
|
76 MEMORY_SIZE=`expr $MEMORY_SIZE / 1024` |
|
77 FOUND_MEM=yes |
|
78 fi |
|
79 |
|
80 if test -x /usr/sbin/prtconf; then |
|
81 # Looks like a Solaris system |
|
82 MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print [$]3 }'` |
|
83 FOUND_MEM=yes |
|
84 fi |
|
85 |
|
86 if test -x /usr/sbin/system_profiler; then |
|
87 # Looks like a MacOSX system |
|
88 MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print [$]2}'` |
|
89 MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024` |
|
90 FOUND_MEM=yes |
|
91 fi |
|
92 |
|
93 if test "x$build_os" = xwindows; then |
|
94 MEMORY_SIZE=`systeminfo | grep 'Total Physical Memory:' | awk '{ print [$]4 }' | sed 's/,//'` |
|
95 FOUND_MEM=yes |
|
96 fi |
|
97 |
|
98 if test "x$FOUND_MEM" = xyes; then |
|
99 AC_MSG_RESULT([$MEMORY_SIZE MB]) |
|
100 else |
|
101 AC_MSG_RESULT([could not detect memory size defaulting to 1024MB!]) |
|
102 fi |
|
103 ]) |