Skip to content

Commit 49f545a

Browse files
committed
Expand macOS detection for OpenMP
1 parent d56d40f commit 49f545a

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

configure

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,18 +3283,24 @@ rm -rf "${BUILDDIR}"
32833283
printf %s "checking for macOS... " >&6; }
32843284
RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()["sysname"])')
32853285
if test x"${RSysinfoName}" = x"Darwin"; then
3286-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
3287-
printf "%s\n" "found" >&6; }
3286+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found macOS" >&5
3287+
printf "%s\n" "found macOS" >&6; }
32883288
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macOS Apple compiler" >&5
32893289
printf %s "checking for macOS Apple compiler... " >&6; }
32903290
apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm')
32913291
if test x"${apple_compiler}" = x"1"; then
3292-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found" >&5
3293-
printf "%s\n" "found" >&6; }
3292+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found macOS Apple compiler" >&5
3293+
printf "%s\n" "found macOS Apple compiler" >&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 macOS Apple compiler" >&5
3299+
printf "%s\n" "not found macOS Apple compiler" >&6; }
32973300
fi
3301+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Compiler is $CXX" >&5
3302+
printf "%s\n" "$as_me: WARNING: Compiler is $CXX" >&2;}
3303+
# "${CXX}" --version
32983304
else
32993305
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
33003306
printf "%s\n" "not found" >&6; }
@@ -3303,9 +3309,15 @@ fi
33033309
if test x"${can_use_openmp}" = x"yes"; then
33043310
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP" >&5
33053311
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)
3312+
if test x"${RSysinfoName}" = x"Darwin"; then
3313+
## if R has ~/.R/Makevars set we might good on macOS
3314+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
3315+
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
3316+
else
3317+
## if R has -fopenmp we should be good (non macOS)
3318+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
3319+
hasOpenMP=$(echo ${allldflags} | grep -- -lomp)
3320+
fi
33093321
if test x"${hasOpenMP}" = x""; then
33103322
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: missing" >&5
33113323
printf "%s\n" "missing" >&6; }

configure.ac

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,33 @@ rm -rf "${BUILDDIR}"
8080
AC_MSG_CHECKING([for macOS])
8181
RSysinfoName=$("${R_HOME}/bin/Rscript" --vanilla -e 'cat(Sys.info()[["sysname"]])')
8282
if test x"${RSysinfoName}" = x"Darwin"; then
83-
AC_MSG_RESULT([found])
83+
AC_MSG_RESULT([found macOS])
8484
AC_MSG_CHECKING([for macOS Apple compiler])
8585
apple_compiler=$($CXX --version 2>&1 | grep -i -c -e 'apple llvm')
8686
if test x"${apple_compiler}" = x"1"; then
87-
AC_MSG_RESULT([found])
87+
AC_MSG_RESULT([found macOS Apple compiler])
8888
AC_MSG_WARN([OpenMP unavailable and turned off.])
8989
can_use_openmp="no"
90+
else
91+
AC_MSG_RESULT([not found macOS Apple compiler])
9092
fi
93+
AC_MSG_WARN([Compiler is $CXX])
94+
# "${CXX}" --version
9195
else
9296
AC_MSG_RESULT([not found])
9397
fi
9498

9599
if test x"${can_use_openmp}" = x"yes"; then
96100
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)
101+
if test x"${RSysinfoName}" = x"Darwin"; then
102+
## if R has ~/.R/Makevars set we might good on macOS
103+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
104+
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
105+
else
106+
## if R has -fopenmp we should be good (non macOS)
107+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
108+
hasOpenMP=$(echo ${allldflags} | grep -- -lomp)
109+
fi
100110
if test x"${hasOpenMP}" = x""; then
101111
AC_MSG_RESULT([missing])
102112
arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"

0 commit comments

Comments
 (0)