-
Notifications
You must be signed in to change notification settings - Fork 79
/
configure.ac
215 lines (170 loc) · 5.85 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# -*- Autoconf -*-
# Process this file with autoconf, et al to produce a configure script.
#
# autoreconf -v -f
# which is just:
# aclocal && autoconf && automake -a -f && ./configure && make
AC_PREREQ([2.13])
AC_INIT([duc], [1.5.0-rc1], [[email protected]])
LIB_CURRENT=1
LIB_REVISION=0
LIB_AGE=0
AC_SUBST(LIB_CURRENT)
AC_SUBST(LIB_REVISION)
AC_SUBST(LIB_AGE)
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_HEADER([config.h])
AC_GNU_SOURCE
AC_SYS_LARGEFILE
AC_SYS_LONG_FILE_NAMES
AC_PROG_CC
PKG_PROG_PKG_CONFIG
AC_CHECK_LIB([m], [main])
AC_CHECK_MEMBERS([struct stat.st_blocks])
#
# Check --disable options
#
AC_ARG_ENABLE(
[cairo],
[AS_HELP_STRING([--disable-cairo], [disable cairo drawing @<:@default=yes@:>@])], ,
[enable_cairo="yes"]
)
AC_ARG_ENABLE(
[opengl],
[AS_HELP_STRING([--enable-opengl], [enable OpenGL drawing @<:@default=no@:>@])], ,
[enable_opengl="no"]
)
AC_ARG_ENABLE(
[ui],
[AS_HELP_STRING([--disable-ui], [disable ncurses ui @<:@default=yes@:>@])], ,
[enable_ui="yes"]
)
AC_ARG_ENABLE(
[x11],
[AS_HELP_STRING([--disable-x11], [disable X11 @<:@default=yes@:>@])], ,
[enable_x11="yes"]
)
AC_ARG_WITH(
[db-backend],
[AS_HELP_STRING([--with-db-backend], [select database backend (tokyocabinet,leveldb,sqlite3,lmdb,kyotocabinet,tkrzw) @<:@default=tkrzw@:>@])], ,
[with_db_backend="tkrzw"]
)
AC_MSG_RESULT([Selected backend ${with_db_backend}])
#
# Check for available libraries
#
case "${with_db_backend}" in
tokyocabinet)
PKG_CHECK_MODULES([TC], [tokyocabinet])
AC_DEFINE([ENABLE_TOKYOCABINET], [1], [Enable tokyocabinet db backend])
;;
tkrzw)
LDFLAGS="$outer_LDFLAGS -ltkrzw"
AC_CHECK_LIB(tkrzw, tkrzw_get_last_status,
[
TKRZW_LIBS="-ltkrzw"
AC_DEFINE([ENABLE_TKRZW], [1], [Enable tkrzw db backend])
], [ AC_MSG_ERROR(Unable to find tkrzw) ])
AC_SUBST([TKRZW_LIBS])
p AC_SUBST([TKRZW_CFLAGS])
;;
leveldb)
AC_CHECK_LIB([leveldb], [leveldb_open])
AC_DEFINE([ENABLE_LEVELDB], [1], [Enable leveldb db backend])
;;
sqlite3)
PKG_CHECK_MODULES([SQLITE3], [sqlite3])
AC_DEFINE([ENABLE_SQLITE], [1], [Enable sqlite3 db backend])
;;
lmdb)
LDFLAGS="$outer_LDFLAGS -llmdb"
AC_CHECK_LIB(lmdb, mdb_env_create,
[
LMDB_LIBS="-llmdb"
AC_DEFINE([ENABLE_LMDB], [1], [Enable lmdb db backend])
], [ AC_MSG_ERROR(Unable to find LMDB) ])
AC_SUBST([LMDB_LIBS])
AC_SUBST([LMDB_CFLAGS])
;;
kyotocabinet)
PKG_CHECK_MODULES([KC], [kyotocabinet])
AC_DEFINE([ENABLE_KYOTOCABINET], [1], [Enable kyotocabinet db backend])
;;
*)
AC_MSG_ERROR([Unsupported db-backend "${with_db_backend}"])
esac
AC_DEFINE_UNQUOTED(DB_BACKEND, ["${with_db_backend}"], [Database backend])
if test "${enable_cairo}" = "yes"; then
PKG_CHECK_MODULES([CAIRO], [cairo],, [AC_MSG_ERROR([
The cairo library was not found, which is needed for graph support. Either install
the cairo development libraries, or compile without graph support (--disable-cairo)
])])
PKG_CHECK_MODULES([PANGO], [pango],, [AC_MSG_ERROR([
The pango library was not found, which is needed for graph support. Either install
the pango development libraries, or compile without graph support (--disable-cairo)
])])
PKG_CHECK_MODULES([PANGOCAIRO], [pangocairo],, [AC_MSG_ERROR([
The pangocairo library was not found, which is needed for graph support. Either install
the pangocairo development libraries, or compile without graph support (--disable-cairo)
])])
AC_DEFINE([ENABLE_CAIRO], [1], [Enable cairo])
fi
if test "${enable_opengl}" = "yes"; then
PKG_CHECK_MODULES([GLFW3], [glfw3],, [AC_MSG_ERROR([
The glfw3 library was not found, which is needed for opengl support. Either install
the glfw3 development libraries, or compile without opengl support (--disable-opengl)
])])
if test "${enable_x11}" = "yes"; then
AC_MSG_ERROR([
Only one graphical user interface can be configured, use --disable-x11 when
using --enable-opengl])
fi
AC_CHECK_LIB([dl], [dlopen])
AC_DEFINE([ENABLE_OPENGL], [1], [Enable opengl])
fi
if test "${enable_ui}" = "yes"; then
AC_DEFINE([ENABLE_UI], [1], [Enable ui])
AC_CHECK_LIB([ncursesw], [tputs],, [
AC_CHECK_LIB([ncurses], [tputs],, [
AC_MSG_ERROR([
The ncurses library was not found, which is needed for ui support. Either install
the ncurses development libraries, or compile without ui support (--disable-ui)
])
])
])
fi
if test "${enable_x11}" = "yes"; then
test "${enable_cairo}" != "yes" && AC_MSG_ERROR([cairo must be enabled for x11])
AC_CHECK_LIB([X11], [XOpenDisplay],, [AC_MSG_ERROR([
The X11 library was not found, which is needed for x11 gui support.
])])
AC_DEFINE([ENABLE_X11], [1], [Enable X11])
fi
AC_CHECK_HEADERS([fcntl.h limits.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h fnmatch.h termios.h])
AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h ncursesw/ncurses.h])
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([dev_t, ino_t])
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_CHECK_FUNCS([floor memset strchr strdup strerror gettimeofday lstat])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AM_CONDITIONAL([ENABLE_CAIRO], [test "$enable_cairo" = "true"])
AM_CONDITIONAL([ENABLE_OPENGL], [test "$enable_opengl" = "true"])
AM_CONDITIONAL([ENABLE_UI], [test "$enable_ui" = "true"])
AM_CONDITIONAL([ENABLE_X11], [test "$enable_x11" = "true"])
AC_MSG_RESULT([
configuration summary:
- Package version: $PACKAGE $VERSION
- Prefix: ${prefix}
- Database backend: ${with_db_backend}
- X11 support: ${enable_x11}
- OpenGL support: ${enable_opengl}
- UI (ncurses) support: ${enable_ui}
- Graph cairo support: ${enable_cairo}
])
# End