Skip to content

Commit 4ac5edc

Browse files
committed
Expand macOS detection for OpenMP
1 parent d56d40f commit 4ac5edc

File tree

3 files changed

+52
-16
lines changed

3 files changed

+52
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
include:
17-
- { name: container, os: ubuntu-latest, container: rocker/r2u4ci }
17+
#- { name: container, os: ubuntu-latest, container: rocker/r2u4ci }
1818
- { name: macos, os: macos-latest }
1919
#- { name: ubuntu, os: ubuntu-latest }
2020

@@ -41,14 +41,22 @@ jobs:
4141
LDFLAGS += -lomp
4242
EOF
4343
cat ~/.R/Makevars
44+
echo -n "R CMD config CXX: "; R CMD config CXX
45+
echo -n "R CMD config CPPFLAGS: "; R CMD config CPPFLAGS
46+
echo -n "R CMD config LIBS: "; R CMD config LIBS
47+
echo -n "R CMD config LDFLAGS: "; R CMD config LDFLAGS
48+
echo -n "R CMD config SHLIB_CXXLD: "; R CMD config SHLIB_CXXLD
49+
echo -n "R CMD config SHLIB_CXXLDFLAGS: "; R CMD config SHLIB_CXXLDFLAGS
4450
4551
- name: Configure
4652
run: ./configure; cat src/Makevars
4753

4854
- name: Dependencies
55+
if: ${{ matrix.os == 'ubuntu-latest' }}
4956
run: ./run.sh install_deps
5057

5158
- name: Test
59+
if: ${{ matrix.os == 'ubuntu-latest' }}
5260
run: ./run.sh run_tests
5361

5462
- name: Coverage

configure

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,29 +3283,45 @@ 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; }
3300+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: OpenMP remains on: ${can_use_openmp}" >&5
3301+
printf "%s\n" "$as_me: WARNING: OpenMP remains on: ${can_use_openmp}" >&2;}
32973302
fi
3303+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Compiler is ${CXX}" >&5
3304+
printf "%s\n" "$as_me: WARNING: Compiler is ${CXX}" >&2;}
3305+
#"${CXX}" --version
32983306
else
32993307
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
33003308
printf "%s\n" "not found" >&6; }
33013309
fi
33023310

33033311
if test x"${can_use_openmp}" = x"yes"; then
3304-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP" >&5
3305-
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+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP on macOS" >&5
3314+
printf %s "checking for OpenMP on macOS... " >&6; }
3315+
## if R has ~/.R/Makevars set we might good on macOS
3316+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
3317+
hasOpenMP=$(echo ${allldflags} | grep -- -lomp)
3318+
else
3319+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenMP not on macOS" >&5
3320+
printf %s "checking for OpenMP not on macOS... " >&6; }
3321+
## if R has -fopenmp we should be good (non macOS)
3322+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
3323+
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
3324+
fi
33093325
if test x"${hasOpenMP}" = x""; then
33103326
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: missing" >&5
33113327
printf "%s\n" "missing" >&6; }

configure.ac

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,35 @@ 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])
92+
AC_MSG_WARN([OpenMP remains on: ${can_use_openmp}])
9093
fi
94+
AC_MSG_WARN([Compiler is ${CXX}])
95+
#"${CXX}" --version
9196
else
9297
AC_MSG_RESULT([not found])
9398
fi
9499

95100
if test x"${can_use_openmp}" = x"yes"; then
96-
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+
AC_MSG_CHECKING([for OpenMP on macOS])
103+
## if R has ~/.R/Makevars set we might good on macOS
104+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
105+
hasOpenMP=$(echo ${allldflags} | grep -- -lomp)
106+
else
107+
AC_MSG_CHECKING([for OpenMP not on macOS])
108+
## if R has -fopenmp we should be good (non macOS)
109+
allldflags=$(${R_HOME}/bin/R CMD config --ldflags)
110+
hasOpenMP=$(echo ${allldflags} | grep -- -fopenmp)
111+
fi
100112
if test x"${hasOpenMP}" = x""; then
101113
AC_MSG_RESULT([missing])
102114
arma_have_openmp="#define ARMA_DONT_USE_OPENMP 1"

0 commit comments

Comments
 (0)