Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Side by Side Diff: xz/m4/tuklib_cpucores.m4

Issue 2869016: Add an unpatched version of xz, XZ Utils, to /trunk/deps/third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « xz/m4/tuklib_common.m4 ('k') | xz/m4/tuklib_integer.m4 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #
2 # SYNOPSIS
3 #
4 # TUKLIB_CPUCORES
5 #
6 # DESCRIPTION
7 #
8 # Check how to find out the number of available CPU cores in the system.
9 # This information is used by tuklib_cpucores.c.
10 #
11 # Supported methods:
12 # - sysctl(): BSDs, OS/2
13 # - sysconf(): GNU/Linux, Solaris, Tru64, IRIX, AIX, Cygwin
14 # - pstat_getdynamic(): HP-UX
15 #
16 # COPYING
17 #
18 # Author: Lasse Collin
19 #
20 # This file has been put into the public domain.
21 # You can do whatever you want with this file.
22 #
23
24 AC_DEFUN_ONCE([TUKLIB_CPUCORES], [
25 AC_REQUIRE([TUKLIB_COMMON])
26
27 # sys/param.h might be needed by sys/sysctl.h.
28 AC_CHECK_HEADERS([sys/param.h])
29
30 AC_CACHE_CHECK([how to detect the number of available CPU cores],
31 [tuklib_cv_cpucores_method], [
32
33 # Look for sysctl() solution first, because on OS/2, both sysconf()
34 # and sysctl() pass the tests in this file, but only sysctl()
35 # actually works.
36 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
37 #include <sys/types.h>
38 #ifdef HAVE_SYS_PARAM_H
39 # include <sys/param.h>
40 #endif
41 #include <sys/sysctl.h>
42 int
43 main(void)
44 {
45 int name[2] = { CTL_HW, HW_NCPU };
46 int cpus;
47 size_t cpus_size = sizeof(cpus);
48 sysctl(name, 2, &cpus, &cpus_size, NULL, 0);
49 return 0;
50 }
51 ]])], [tuklib_cv_cpucores_method=sysctl], [
52
53 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
54 #include <unistd.h>
55 int
56 main(void)
57 {
58 long i;
59 #ifdef _SC_NPROCESSORS_ONLN
60 /* Many systems using sysconf() */
61 i = sysconf(_SC_NPROCESSORS_ONLN);
62 #else
63 /* IRIX */
64 i = sysconf(_SC_NPROC_ONLN);
65 #endif
66 return 0;
67 }
68 ]])], [tuklib_cv_cpucores_method=sysconf], [
69
70 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
71 #include <sys/param.h>
72 #include <sys/pstat.h>
73
74 int
75 main(void)
76 {
77 struct pst_dynamic pst;
78 pstat_getdynamic(&pst, sizeof(pst), 1, 0);
79 (void)pst.psd_proc_cnt;
80 return 0;
81 }
82 ]])], [tuklib_cv_cpucores_method=pstat_getdynamic], [
83
84 tuklib_cv_cpucores_method=unknown
85 ])])])])
86
87 case $tuklib_cv_cpucores_method in
88 sysctl)
89 AC_DEFINE([TUKLIB_CPUCORES_SYSCTL], [1],
90 [Define to 1 if the number of available CPU cores
91 can be detected with sysctl().])
92 ;;
93 sysconf)
94 AC_DEFINE([TUKLIB_CPUCORES_SYSCONF], [1],
95 [Define to 1 if the number of available CPU cores
96 can be detected with sysconf(_SC_NPROCESSORS_ONLN)
97 or sysconf(_SC_NPROC_ONLN).])
98 ;;
99 pstat_getdynamic)
100 AC_DEFINE([TUKLIB_CPUCORES_PSTAT_GETDYNAMIC], [1],
101 [Define to 1 if the number of available CPU cores
102 can be detected with pstat_getdynamic().])
103 ;;
104 esac
105 ])dnl
OLDNEW
« no previous file with comments | « xz/m4/tuklib_common.m4 ('k') | xz/m4/tuklib_integer.m4 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698