-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
226 lines (196 loc) · 5.79 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
215
216
217
218
219
220
221
222
223
224
225
226
# Copyright (c) 2014 Jerry Lundström <lundstrom.jerry@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AC_PREREQ(2.68)
AC_INIT([libdbo], [0.0.1], [https://github.com/jelu/dbo/issues])
DBO_LIB_VERSION="0:1:0"
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_MKDIR_P
AC_LANG([C])
LT_INIT
AC_SUBST(DBO_LIB_VERSION)
#
# Check for doxygen
#
DX_INIT_DOXYGEN([libdbo])
#
# Check for required/optional libraries
#
AX_PTHREAD([
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
])
AX_CUNIT
#
# Check for not using internal memory management
#
AC_MSG_CHECKING([if using internal memory management])
AC_ARG_WITH([libdbo-mm],
AS_HELP_STRING([--with-libdbo-mm=@<:@yes/no@:>@],
[use libdbo's internal memory management @<:@default=yes@:>@]
),
[
if test "$withval" != "no"; then
AC_DEFINE([USE_LIBDBO_MM], [1],
[Define to 1 if libdbo's internal memory management is used])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
], [
AC_DEFINE([USE_LIBDBO_MM], [1],
[Define to 1 if libdbo's internal memory management is used])
AC_MSG_RESULT([yes])
])
#
# Check for not using internal memory management extra checks
#
AC_MSG_CHECKING([if using internal memory management checks])
AC_ARG_WITH([libdbo-mm-checks],
AS_HELP_STRING([--with-libdbo-mm-checks=@<:@yes/no@:>@],
[use libdbo's internal memory management checks @<:@default=no@:>@]
),
[
if test "$withval" != "yes"; then
AC_DEFINE([USE_LIBDBO_MM_CHECKS], [1],
[Define to 1 if libdbo's internal memory management checks is used])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
], [
AC_MSG_RESULT([no])
])
#
# Check for SQLite3
#
AX_LIB_SQLITE3
if test "$SQLITE3_VERSION" != ""; then
AM_CONDITIONAL(HAVE_SQLITE3, true)
else
AM_CONDITIONAL(HAVE_SQLITE3, false)
fi
#
# Check for MySQL
#
AX_LIB_MYSQL([5.0.0])
if test "$MYSQL_VERSION" != ""; then
AM_CONDITIONAL(HAVE_MYSQL, true)
else
AM_CONDITIONAL(HAVE_MYSQL, false)
fi
TEST_MYSQL=""
TEST_MYSQL_USER=""
TEST_MYSQL_PASS=""
TEST_MYSQL_HOST=""
TEST_MYSQL_PORT="0"
TEST_MYSQL_DB=""
AC_ARG_WITH([mysql-user],
AS_HELP_STRING([--with-mysql-user=@<:@ARG@:>@],
[optionally specify the database user to run tests as]
),
[
if test "$withval" != ""; then
TEST_MYSQL="1"
TEST_MYSQL_USER="$withval"
fi
], [])
AC_ARG_WITH([mysql-pass],
AS_HELP_STRING([--with-mysql-pass=@<:@ARG@:>@],
[optionally specify the database password to run tests with]
),
[
if test "$withval" != ""; then
TEST_MYSQL="1"
TEST_MYSQL_PASS="$withval"
fi
], [])
AC_ARG_WITH([mysql-host],
AS_HELP_STRING([--with-mysql-host=@<:@ARG@:>@],
[optionally specify the database host to run tests on]
),
[
if test "$withval" != ""; then
TEST_MYSQL="1"
TEST_MYSQL_HOST="$withval"
fi
], [])
AC_ARG_WITH([mysql-port],
AS_HELP_STRING([--with-mysql-port=@<:@ARG@:>@],
[optionally specify the database port to run tests on]
),
[
if test "$withval" != ""; then
TEST_MYSQL="1"
TEST_MYSQL_PORT="$withval"
fi
], [])
AC_ARG_WITH([mysql-db],
AS_HELP_STRING([--with-mysql-db=@<:@ARG@:>@],
[optionally specify the database to run tests on]
),
[
if test "$withval" != ""; then
TEST_MYSQL="1"
TEST_MYSQL_DB="$withval"
fi
], [])
if test "$TEST_MYSQL" != ""; then
AC_DEFINE_UNQUOTED(TEST_MYSQL, [1], [Specify if MySQL tests should be run])
AM_CONDITIONAL(TEST_MYSQL, true)
else
AM_CONDITIONAL(TEST_MYSQL, false)
fi
AC_SUBST(TEST_MYSQL_USER)
AC_SUBST(TEST_MYSQL_PASS)
AC_SUBST(TEST_MYSQL_HOST)
AC_SUBST(TEST_MYSQL_PORT)
AC_SUBST(TEST_MYSQL_DB)
AC_DEFINE_UNQUOTED(TEST_MYSQL_USER, ["$TEST_MYSQL_USER"], [For tests])
AC_DEFINE_UNQUOTED(TEST_MYSQL_PASS, ["$TEST_MYSQL_PASS"], [For tests])
AC_DEFINE_UNQUOTED(TEST_MYSQL_HOST, ["$TEST_MYSQL_HOST"], [For tests])
AC_DEFINE_UNQUOTED(TEST_MYSQL_PORT, [$TEST_MYSQL_PORT], [For tests])
AC_DEFINE_UNQUOTED(TEST_MYSQL_PORT_TXT, ["$TEST_MYSQL_PORT"], [For tests])
AC_DEFINE_UNQUOTED(TEST_MYSQL_DB, ["$TEST_MYSQL_DB"], [For tests])
#
# Check for PostgreSQL
#
AX_LIB_POSTGRESQL
#
# Output makefiles
#
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_FILES([
Makefile
doc/Makefile
src/Makefile
test/Makefile
tools/Makefile
])
AC_OUTPUT