-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure.ac
64 lines (57 loc) · 1.94 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
AC_INIT([diseq],[0.4.6])
# 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`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
AC_LANG(C++)
AC_PROG_CPP
GSL_LIBS=`gsl-config --libs`
AS_IF([test "X$GSL_LIBS" != "X"], [
CPPFLAGS="$CPPFLAGS `gsl-config --cflags`"
LIBS="$LIBS `gsl-config --libs`"
AC_MSG_CHECKING([whether libgsl is available])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include "gsl/gsl_multimin.h"]],
[[gsl_vector v;]])],
[AC_MSG_RESULT([yes])
PKG_CPPFLAGS="$PKG_CPPFLAGS -D_DISEQ_HAS_GSL_ `gsl-config --cflags`"
PKG_LIBS="$PKG_LIBS `gsl-config --libs`"],
[AC_MSG_RESULT([no])])
])
AC_CHECK_HEADERS(execution)
AS_IF([test "X$ac_cv_header_execution" = "Xyes"], [
AC_MSG_CHECKING([whether the libtbb is available])
CPPFLAGS="$CPPFLAGS -std=c++17"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include<execution>]],
[[const auto& ex = std::execution::par_unseq;]])],
[AC_MSG_RESULT([yes])
PKG_CPPFLAGS="$PKG_CPPFLAGS -D_DISEQ_HAS_EXECUTION_POLICIES_ -std=c++17"
PKG_LIBS="$PKG_LIBS `pkg-config tbb --libs`"],
[LIBS="$LIBS -ltbb"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include<execution>]],
[[const auto& ex = std::execution::par_unseq;]])],
[AC_MSG_RESULT([yes])
PKG_CPPFLAGS="$PKG_CPPFLAGS -D_DISEQ_HAS_EXECUTION_POLICIES_ -std=c++17"
PKG_LIBS="$PKG_LIBS -ltbb"],
[AC_MSG_RESULT([no])])
])
])
# Write the flags into the src/Makevars file.
AC_SUBST([PKG_CPPFLAGS], ["${PKG_CPPFLAGS}"])
AC_SUBST([PKG_LIBS], ["${PKG_LIBS}"])
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
echo "
--------------------------------------------------
Configuration for ${PACKAGE_NAME} ${PACKAGE_VERSION}
cppflags: ${PKG_CPPFLAGS}
libs: ${PKG_LIBS}
--------------------------------------------------
"