From d026d7dcfb01de3eda1da2e45d23224619ba79e2 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 17 Oct 2017 00:45:27 +0200 Subject: [PATCH] Fix build for non-linux architectures but still glibc-based MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exampls of these are gnu/kfreebsd and gnu/hurd, both available as unofficial Debian ports. They don't define __linux__ (as they are non-linux…) but still define __GLIBC__, so check on that. Signed-off-by: Mattia Rizzolo --- modules/core/src/parallel.cpp | 4 ++-- modules/core/src/system.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp index 81a16a8bd290..8ead5162de4d 100644 --- a/modules/core/src/parallel.cpp +++ b/modules/core/src/parallel.cpp @@ -52,7 +52,7 @@ #undef abs #endif -#if defined __linux__ || defined __APPLE__ +#if defined __linux__ || defined __APPLE__ || defined __GLIBC__ #include #include #include @@ -672,7 +672,7 @@ int cv::getNumberOfCPUs(void) #elif defined __ANDROID__ static int ncpus = getNumberOfCPUsImpl(); return ncpus; -#elif defined __linux__ +#elif defined __linux__ || defined __GLIBC__ return (int)sysconf( _SC_NPROCESSORS_ONLN ); #elif defined __APPLE__ int numCPU=0; diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index ca811a027702..5894dfb7beff 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -215,7 +215,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix) #include "omp.h" #endif -#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __FreeBSD__ || defined __HAIKU__ +#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __FreeBSD__ || defined __GLIBC__ || defined __HAIKU__ #include #include #include