Skip to content

Commit 0f1321c

Browse files
committed
Expand macOS detection for OpenMP
1 parent d56d40f commit 0f1321c

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

configure

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,6 +3294,9 @@ printf "%s\n" "found" >&6; }
32943294
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP unavailable and turned off." >&5
32953295
printf "%s\n" "$as_me: WARNING: OpenMP unavailable and turned off." >&2;}
32963296
can_use_openmp="no"
3297+
else
3298+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
3299+
printf "%s\n" "not found" >&6; }
32973300
fi
32983301
else
32993302
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
@@ -3303,9 +3306,15 @@ fi
33033306
if test x"${can_use_openmp}" = x"yes"; then
33043307
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP" >&5
33053308
printf %s "checking for OpenMP... " >&6; }
3306-
## if R has -fopenmp we should be good
3307-
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
3308-
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
3309+
if test x"${RSysinfoName}" = x"Darwin"; then
3310+
## if R has ~/.R/Makevars set we might good on macOS
3311+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
3312+
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
3313+
else
3314+
## if R has -fopenmp we should be good (non macOS)
3315+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
3316+
hasOpenMP=$(echo ${allldflags} | grep -- -lomp)
3317+
fi
33093318
if test x"${hasOpenMP}" = x""; then
33103319
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: missing" >&5
33113320
printf "%s\n" "missing" >&6; }

configure.ac

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,24 @@ if test x"${RSysinfoName}" = x"Darwin"; then
8787
AC_MSG_RESULT([found])
8888
AC_MSG_WARN([OpenMP unavailable and turned off.])
8989
can_use_openmp="no"
90+
else
91+
AC_MSG_RESULT([not found])
9092
fi
9193
else
9294
AC_MSG_RESULT([not found])
9395
fi
9496

9597
if test x"${can_use_openmp}" = x"yes"; then
9698
AC_MSG_CHECKING([for OpenMP])
97-
## if R has -fopenmp we should be good
98-
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
99-
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
99+
if test x"${RSysinfoName}" = x"Darwin"; then
100+
## if R has ~/.R/Makevars set we might good on macOS
101+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
102+
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
103+
else
104+
## if R has -fopenmp we should be good (non macOS)
105+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
106+
hasOpenMP=$(echo ${allldflags} | grep -- -lomp)
107+
fi
100108
if test x"${hasOpenMP}" = x""; then
101109
AC_MSG_RESULT([missing])
102110
arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"

0 commit comments

Comments
 (0)