Disable gcc parallel extension if openmp is not available. (#8871)

`<parallel/algorithm>` internally includes the <omp.h> header, which leads to an error
when openmp is not available.
This commit is contained in:
Jiaming Yuan 2023-03-06 22:51:06 +08:00 committed by GitHub
parent 228a46e8ad
commit cad7401783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,8 @@
#include "xgboost/context.h" // Context
// clang with libstdc++ works as well
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__sun) && !defined(sun) && !defined(__APPLE__)
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__sun) && !defined(sun) && \
!defined(__APPLE__) && __has_include(<omp.h>)
#define GCC_HAS_PARALLEL 1
#endif // GLIC_VERSION