Skip to content

Commit 3504c51

Browse files
committed
configure: stronger check for OpenMP
Also, check with no extra parameters first, like we used to.
1 parent ffc4417 commit 3504c51

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

configure

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ fi
7373
# Specifically use schedule(dynamic) to distinguish incompatibilities in OpenMP runtime on macOS, #7318
7474

7575
cat <<EOF > test-omp.c
76-
#include <omp.h>
7776
void test_openmp(int * result) {
7877
int sum = 0;
78+
#ifdef _OPENMP
7979
#pragma omp parallel for reduction(+:sum) num_threads(2) schedule(dynamic)
8080
for (int i = 1; i <= 2; ++i) sum += i;
81+
#endif
8182
*result = sum;
8283
}
8384
EOF
@@ -110,8 +111,8 @@ stopifnot(identical(ans, 3L))
110111

111112
detect_openmp () {
112113
# OpenMP flags provided in environment variables or specified when configuring R? Does -fopenmp work?
113-
test_openmp_variant '$(SHLIB_OPENMP_CFLAGS)' '$(SHLIB_OPENMP_CFLAGS)' \
114-
|| test_openmp_variant "" "" \
114+
test_openmp_variant "" "" \
115+
|| test_openmp_variant '$(SHLIB_OPENMP_CFLAGS)' '$(SHLIB_OPENMP_CFLAGS)' \
115116
|| test_openmp_variant -fopenmp -fopenmp \
116117
&& return
117118

0 commit comments

Comments
 (0)