-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
110 lines (92 loc) · 2.58 KB
/
configure.ac
File metadata and controls
110 lines (92 loc) · 2.58 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([rleveldb], [0.0.1])
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}" ; then
echo "could not determin R_HOME"
exit 1
fi
AC_LANG([C++])
CXX=`${R_HOME}/bin/R CMD config CXX`
CXXFLAGS=`${R_HOME}/bin/R CMD config CXXFLAGS`
LDFLAGS=`${R_HOME}/bin/R CMD config LDFLAGS`
dnl TODO : windows support
dnl AC_CANONICAL_HOST
# check complier version
AC_CHECK_PROG(CXX_CHECK, [${CXX}], found, missing)
if test "${CXX_CHECK}" = "missing" ; then
AC_MSG_ERROR([unable to find ${CXX}])
exit 1
fi
case "${CXX}" in
g++)
GCC_VERSION=`g++ -dumpversion \
| sed -e 's/\.\(@<:@0-9@:>@@<:@0-9@:>@\)/\1/g' -e 's/\.\(@<:@0-9@:>@\)/0\1/g' -e 's/^@<:@0-9@:>@\{3,4\}$/&00/'`
AC_MSG_CHECKING([for GCC version >= 4.4])
if test ${GCC_VERSION} -gt 40400 ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([GCC is too old])
fi
;;
*)
AC_MSG_ERROR([unsupported C++ complier])
exit 1
;;
esac
# set path for leveldb
AC_ARG_WITH([leveldb_headers],
AC_HELP_STRING([--with-leveldb-headers=PREFIX],
[path to where the headers of leveldb are installed (default=/usr/include)]),
[],
[with_leveldb_headers="/usr/include"])
if test -e ${with_leveldb_headers} ; then
CXXFLAGS="${CXXFLAGS} -I${with_leveldb_headers}"
else
AC_MSG_ERROR([Unable to find ${with_leveldb_headers}])
exit 1
fi
AC_ARG_WITH([leveldb_libs],
AC_HELP_STRING([--with-leveldb-libs=PREFIX],
[path to where the libs of leveldb are installed (default=/usr/lib64)]),
[],
[with_leveldb_libs="/usr/lib64"])
if test -e ${with_leveldb_headers} ; then
LDFLAGS="${LDFLAGS} -L${with_leveldb_libs}"
else
AC_MSG_ERROR([Unable to find ${with_leveldb_libs}])
exit 1
fi
# check for leveldb header
AC_CHECK_HEADER([leveldb/db.h],
[],
[
AC_MSG_ERROR([unable to find leveldb/db.h])
exit 1
])
AC_CHECK_HEADER([leveldb/write_batch.h],
[],
[
AC_MSG_ERROR([unable to find leveldb/write_batch.h])
exit 1
])
# check for leveldb lib
AC_MSG_CHECKING([for libleveldb.so])
LDFLAGS="${LDFLAGS} -lleveldb"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <leveldb/db.h>
#include <leveldb/write_batch.h>
leveldb::DB *d;
leveldb::WriteBatch batch;]])],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
AC_MSG_ERROR([unable to find libleveldb.so])
exit 1
])
AC_SUBST([LEVELDB_INCLUDE], ["-I${with_leveldb_headers}"])
AC_SUBST([LEVELDB_LIBS], ["-L${with_leveldb_libs} -lleveldb"])
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT