forked from nlmixrdevelopment/nlmixr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
65 lines (51 loc) · 1.75 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
## This is based on https://stat.ethz.ch/pipermail/r-devel/2010-September/058488.html
AC_INIT(nlmixr, 1 , [email protected])
AC_CONFIG_SRCDIR([src/init.c])
# find R home and set CC/CFLAGS
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
RBIN="${R_HOME}/bin/R"
CC=`"${RBIN}" CMD config CC`;
CFLAGS=`"${RBIN}" CMD config CFLAGS`
LIBS="${PKG_LIBS}"
# Checks for programs.
AC_PROG_CC
# Check for OpenMP
AC_OPENMP
# since some systems have broken OMP libraries
# we also check that the actual package will work
ac_pkg_openmp=no
if test -n "${OPENMP_CFLAGS}"; then
AC_MSG_CHECKING([whether OpenMP will work in a package])
AC_LANG_CONFTEST(
[AC_LANG_PROGRAM([[#include <omp.h>]], [[ return omp_get_num_threads (); ]])])
PKG_CFLAGS="${OPENMP_CFLAGS}" PKG_LIBS="${OPENMP_CFLAGS}" "$RBIN" CMD SHLIB conftest.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && "$RBIN" --vanilla -q -e "dyn.load(paste('conftest',.Platform\$dynlib.ext,sep=''))" 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && ac_pkg_openmp=yes
AC_MSG_RESULT([${ac_pkg_openmp}])
fi
# if ${ac_pkg_openmp} = "yes" then we have OMP, otherwise it will be "no"
if test "${ac_pkg_openmp}" = no; then
OPENMP_CFLAGS=''
fi
OPENMP_CXXFLAGS="${OPENMP_CFLAGS}"
CXX14STD=""
ISYSTEM="I"
dnl -- Uncomment when looking for "significant" warnings
if test "${GCC}" = yes; then
ISYSTEM="isystem"
fi
AC_SUBST(OPENMP_CFLAGS)
AC_SUBST(OPENMP_CXXFLAGS)
AC_SUBST(CXX14STD)
AC_SUBST(ISYSTEM)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
${R_HOME}/bin/R CMD BATCH inst/tools/r-stripper/stripper.R
rm stripper.Rout
${R_HOME}/bin/R CMD BATCH inst/tools/workaround.R
rm workaround.Rout
echo --------[[begin src/Makevars]]--------
cat src/Makevars
echo --------[[end src/Makevars]]--------