diff options
author | Pino Toscano <pino@debian.org> | 2012-12-29 22:32:27 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2012-12-29 22:32:27 (GMT) |
commit | e38eb5438151b5accc43e7e5d91f1435a2450f2f (patch) | |
tree | abc0db38fd3b3eece0d139aba2db7234efaa3474 /src | |
parent | 34b46f28c5496def6f8c72bf96bd30830e5477ef (diff) | |
download | Ninja-e38eb5438151b5accc43e7e5d91f1435a2450f2f.zip Ninja-e38eb5438151b5accc43e7e5d91f1435a2450f2f.tar.gz Ninja-e38eb5438151b5accc43e7e5d91f1435a2450f2f.tar.bz2 |
fix build on non-Linux glibc systems
ninja-build does not build on non-Linux archs, such as
GNU/kFreeBSD and GNU/Hurd.
The problem is that the GetProcessorCount() implementation for these
architectures is the sysconf() one, but <unistd.h> has not been
included, causing sysconf() and _SC_NPROCESSORS_ONLN to not be
declared. Another solution (which is the one I chose) is to make use
of the "linux" implementation which uses get_nprocs(), which is a GNU
extension and thus available for anything using GNU libc.
Diffstat (limited to 'src')
-rw-r--r-- | src/util.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.cc b/src/util.cc index 4b2900f..50e3842 100644 --- a/src/util.cc +++ b/src/util.cc @@ -39,7 +39,7 @@ #elif defined(__SVR4) && defined(__sun) #include <unistd.h> #include <sys/loadavg.h> -#elif defined(linux) +#elif defined(linux) || defined(__GLIBC__) #include <sys/sysinfo.h> #endif @@ -295,7 +295,7 @@ string StripAnsiEscapeCodes(const string& in) { return stripped; } -#if defined(linux) +#if defined(linux) || defined(__GLIBC__) int GetProcessorCount() { return get_nprocs(); } |