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.
#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
return stripped;
}
-#if defined(linux)
+#if defined(linux) || defined(__GLIBC__)
int GetProcessorCount() {
return get_nprocs();
}