-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
82 lines (65 loc) · 2.31 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
AC_INIT([fCWTr],[0.2.9000])
# Find the compiler and compiler flags used by R.
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
CXX=`"${R_HOME}/bin/R" CMD config CXX`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS` `"${R_HOME}/bin/R" CMD config CXXPICFLAGS`
CPPFLAGS="`"${R_HOME}/bin/R" CMD config CPPFLAGS`"
LDFLAGS="`"${R_HOME}/bin/R" CMD config LDFLAGS`"
AC_LANG(C++)
AC_PROG_CPP
# extra check for macos brew
AC_CHECK_PROG(BREW,brew,yes)
if test "x${BREW}" = xyes; then
# in order for AC_CHECK_HEADER to work
CPPFLAGS="${CPPFLAGS} -I`brew --prefix`/include"
PKG_CPPFLAGS="-I`brew --prefix`/include"
LDFLAGS="${LDFLAGS} -L`brew --prefix`/lib"
PKG_LDFLAGS="-L`brew --prefix`/lib"
fi
# Check for fftw3.h header
AC_CHECK_HEADER([fftw3.h], [
AC_DEFINE([HAVE_FFTW3_H], [1], [Define if you have the fftw3.h header file])
], [
AC_MSG_ERROR([fftw3.h header file not found in: $CPPFLAGS])
])
have_fftw=no
AC_SEARCH_LIBS(
fftwf_free,
fftw3f,
[have_fftw=yes],
[AC_MSG_ERROR([The fftw3 library with single precision support is required. In case fftw is already installed, you might need to enable fftw's single precision support with './configure --enable-type-prefix --enable-float'.])]
)
# Check for omp.h header
AC_CHECK_HEADER([omp.h], [
AC_DEFINE([HAVE_OMP_H], [1], [Define if you have the omp.h header file])
], [
AC_DEFINE([HAVE_OMP_H], [0], [Define if you have the omp.h header file])
])
have_fftw_omp=no
AC_SEARCH_LIBS(
fftwf_plan_with_nthreads,
fftw3f_omp,
[have_fftw_omp=yes],
[AC_MSG_RESULT([The fftw3-omp support not found.])]
)
AC_OPENMP
# Write the flags into the src/Makevars file.
AC_SUBST([PKG_CPPFLAGS], ["${PKG_CPPFLAGS} ${FFTW_CPPFLAGS} ${FFTW_OMP_CPPFLAGS} ${OPENMP_CPPFLAGS}"])
AC_SUBST([PKG_CXXFLAGS], ["${PKG_CXXFLAGS} ${FFTW_CXXFLAGS} ${FFTW_OMP_CXXFLAGS} ${OPENMP_CXXFLAGS}"])
AC_SUBST([PKG_LDFLAGS], ["${PKG_LDFLAGS} ${OPENMP_CXXFLAGS}"])
AC_SUBST([PKG_LIBS], ["${LIBS} ${PKG_LIBS} ${FFTW_LIBS} ${FFTW_OMP_LIBS}"])
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
echo "
--------------------------------------------------
Configuration for ${PACKAGE_NAME} ${PACKAGE_VERSION}
cppflags: ${PKG_CPPFLAGS}
cxxflags: ${PKG_CXXFLAGS}
ldflags: ${PKG_LDFLAGS}
libs: ${PKG_LIBS}
--------------------------------------------------
"