-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.ac
89 lines (74 loc) · 2.61 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
83
84
85
86
87
88
89
AC_INIT([genomicsdb],[0.0.2])
# Only MacOS and Linux platforms are supported
AC_CHECK_PROG([UNAME], [uname], [yes], [no])
AS_IF([test "$UNAME" = "no"],
[AC_MSG_ERROR([Only MacOS and Linux platforms are supported])])
AC_MSG_CHECKING([for OS platform])
OS_PLATFORM=`uname -s`
case "${OS_PLATFORM}" in
Linux*)
BUILD_PLATFORM=Linux
;;
Darwin*)
BUILD_PLATFORM=Darwin
;;
*)
AC_MSG_ERROR([Only MacOS and Linux platforms are supported])
;;
esac
AC_MSG_RESULT([$BUILD_PLATFORM])
# find R home and set FLAGS
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
RBIN="${R_HOME}/bin/R"
CPPFLAGS=`"${RBIN}" CMD config CPPFLAGS`
CXX11STD=`"${RBIN}" CMD config CXX11STD`
CXXFLAGS=`"${RBIN}" CMD config CXX11FLAGS`
AC_LANG(C++)
AC_REQUIRE_CPP
AC_PROG_CXX
echo "GENOMCICSDB_HOME=${GENOMICSDB_HOME}"
# Default values
AC_SUBST([GENOMICSDB_INSTALL_PATH], ${GENOMICSDB_HOME})
AC_SUBST([GENOMICSDB_LIBS], "-ltiledbgenomicsdb")
# Allow for overrides
AC_ARG_WITH([genomicsdb],
AS_HELP_STRING([--with-genomicsdb=[DIR]],[GenomicsDB root install path [PREFIX]]),
[GENOMICSDB_INSTALL_PATH="${with_genomicsdb}"],
[])
GENOMICSDB_LIBS="${GENOMICSDB_LIBS} -Wl,-rpath,${GENOMICSDB_INSTALL_PATH}/lib"
# Check existence of GENOMICSDB_INSTALL_PATH
AS_IF([test "unset$GENOMICSDB_INSTALL_PATH" = "unset"],
[AC_MSG_ERROR([GenomicsDB installation not found.
Invoke with either \$GENOMICSDB_HOME env set to the installation path or
by explicitly specifying the path with the --with-genomicsdb argument])])
# Sanity check installation
AC_CHECK_FILES([${GENOMICSDB_INSTALL_PATH}/include/genomicsdb.h],
[],
[AC_MSG_ERROR([GenomicsDB include files not found])])
# Try compiling with GenomicsDB headers
CPPFLAGS="${CPPFLAGS} ${CXX11STD} ${CXXFLAGS} -I${GENOMICSDB_INSTALL_PATH}/include"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <genomicsdb.h>]], [[]])],[],[AC_MSG_ERROR([unable to compile with genomicsdb.h])])
# Check GenomicsDB installation
LDFLAGS="${LD_FLAGS} -L${GENOMICSDB_INSTALL_PATH}/lib"
LIBS="${LIBS} -ltiledbgenomicsdb"
AC_MSG_CHECKING([whether genomicsdb works])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <genomicsdb.h>
int main() {
if (genomicsdb::version().size() > 0)
return 0;
else
return -1;
}]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([GenomicsDB installation at ${GENOMICSDB_INSTALL_PATH} is not functional])])
# create and report output
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
echo
echo "Final src/Makevars"
cat src/Makevars