Skip to content

Commit

Permalink
updating configure
Browse files Browse the repository at this point in the history
  • Loading branch information
michellepistner committed May 28, 2024
1 parent 60c70ee commit df34abf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
24 changes: 11 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3249,22 +3249,20 @@ mkdir -p "${BUILDDIR}"
owd=$(pwd)
cd "${BUILDDIR}"

cat <<EOF > test-omp.cpp
# The configure script:
cat > test-omp.cpp <<EOF
#include <omp.h>
int main() {
return omp_get_num_threads();
extern "C" void configtest(int * arg) {
*arg = omp_get_num_threads();
}
EOF

## Execute R CMD SHLIB.
if ${CC} ${CFLAGS} -fopenmp test-omp.cpp >/dev/null 2>&1; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
openmp_already_works="yes"
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
# Without the following you're relying on the GNU/Linux-like behaviour
# w.r.t. undefined symbols (see WRE 1.2.1.1):
cat > Makevars <<EOF
PKG_CXXFLAGS = \$(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = \$(SHLIB_OPENMP_CXXFLAGS)
EOF
R CMD SHLIB test-omp.cpp

## Go back home.
cd "${owd}"
Expand Down
22 changes: 11 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ mkdir -p "${BUILDDIR}"
owd=$(pwd)
cd "${BUILDDIR}"

cat <<EOF > test-omp.cpp
# The configure script:
cat > test-omp.cpp <<EOF
#include <omp.h>
int main() {
return omp_get_num_threads();
extern "C" void configtest(int * arg) {
*arg = omp_get_num_threads();
}
EOF

## Execute R CMD SHLIB.
if ${CC} ${CFLAGS} -fopenmp test-omp.cpp >/dev/null 2>&1; then
AC_MSG_RESULT([yes])
openmp_already_works="yes"
else
AC_MSG_RESULT([no])
fi
# Without the following you're relying on the GNU/Linux-like behaviour
# w.r.t. undefined symbols (see WRE 1.2.1.1):
cat > Makevars <<EOF
PKG_CXXFLAGS = \$(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = \$(SHLIB_OPENMP_CXXFLAGS)
EOF
R CMD SHLIB test-omp.cpp

## Go back home.
cd "${owd}"
Expand Down

0 comments on commit df34abf

Please sign in to comment.