1 dnl -------------------------------------------------------- -*- autoconf -*-
2 dnl Copyright 2005 The Apache Software Foundation or its licensors, as
5 dnl Licensed under the Apache License, Version 2.0 (the "License");
6 dnl you may not use this file except in compliance with the License.
7 dnl You may obtain a copy of the License at
9 dnl http://www.apache.org/licenses/LICENSE-2.0
11 dnl Unless required by applicable law or agreed to in writing, software
12 dnl distributed under the License is distributed on an "AS IS" BASIS,
13 dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 dnl See the License for the specific language governing permissions and
15 dnl limitations under the License.
22 dnl APU_CHECK_DBD: compile backends for apr_dbd.
24 AC_DEFUN([APU_CHECK_DBD], [
27 AC_ARG_WITH([pgsql], [
28 --with-pgsql=DIR specify PostgreSQL location
31 if test "$withval" = "yes"; then
32 AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
33 if test "$apu_have_pgsql" == "0"; then
34 AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
36 elif test "$withval" = "no"; then
39 old_cppflags="$CPPFLAGS"
40 old_ldflags="$LDFLAGS"
42 pgsql_CPPFLAGS="-I$withval/include"
43 pgsql_LDFLAGS="-L$withval/lib "
45 APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
46 APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
48 AC_MSG_NOTICE(checking for pgsql in $withval)
49 AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
50 if test "$apu_have_pgsql" != "0"; then
51 APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
52 APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
54 if test "$apu_have_pgsql" != "1"; then
55 AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
56 if test "$apu_have_pgsql" != "0"; then
57 APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/postgresql])
58 APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
62 CPPFLAGS="$old_cppflags"
63 LDFLAGS="$old_ldflags"
67 AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
69 AC_SUBST(apu_have_pgsql)
70 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
71 dnl we know the library is there.
72 if test "$apu_have_pgsql" = "1"; then
73 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lpq])
74 APR_ADDTO(APRUTIL_LIBS,[-lpq])
78 AC_DEFUN([APU_CHECK_DBD_MYSQL], [
81 AC_ARG_WITH([mysql], [
82 --with-mysql=DIR **** SEE INSTALL.MySQL ****
85 if test "$withval" = "yes"; then
86 old_cppflags="$CPPFLAGS"
87 old_ldflags="$LDFLAGS"
89 AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
90 if test "x$MYSQL_CONFIG" != 'x'; then
91 mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
92 mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
94 APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
95 APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
98 AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
99 if test "$apu_have_mysql" == "0"; then
100 AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
102 if test "x$MYSQL_CONFIG" != 'x'; then
103 APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
104 APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
108 CPPFLAGS="$old_cppflags"
109 LDFLAGS="$old_ldflags"
110 elif test "$withval" = "no"; then
113 old_cppflags="$CPPFLAGS"
114 old_ldflags="$LDFLAGS"
116 AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
117 if test "x$MYSQL_CONFIG" != 'x'; then
118 mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
119 mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
121 mysql_CPPFLAGS="-I$withval/include"
122 mysql_LDFLAGS="-L$withval/lib "
125 APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
126 APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
128 AC_MSG_NOTICE(checking for mysql in $withval)
129 AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
130 if test "$apu_have_mysql" != "0"; then
131 APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
132 APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
135 if test "$apu_have_mysql" != "1"; then
136 AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
137 if test "$apu_have_mysql" != "0"; then
138 APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/mysql])
139 APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
143 CPPFLAGS="$old_cppflags"
144 LDFLAGS="$old_ldflags"
149 old_cppflags="$CPPFLAGS"
150 old_ldflags="$LDFLAGS"
152 AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
153 if test "x$MYSQL_CONFIG" != 'x'; then
154 mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
155 mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
157 APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
158 APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
161 AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
163 if test "$apu_have_mysql" != "0"; then
164 if test "x$MYSQL_CONFIG" != 'x'; then
165 APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
166 APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
170 CPPFLAGS="$old_cppflags"
171 LDFLAGS="$old_ldflags"
174 AC_SUBST(apu_have_mysql)
176 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
177 dnl we know the library is there.
178 if test "$apu_have_mysql" = "1"; then
179 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lmysqlclient_r])
180 APR_ADDTO(APRUTIL_LIBS,[-lmysqlclient_r])
184 AC_DEFUN([APU_CHECK_DBD_SQLITE3], [
187 AC_ARG_WITH([sqlite3], [
191 if test "$withval" = "yes"; then
192 AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
193 elif test "$withval" = "no"; then
196 old_cppflags="$CPPFLAGS"
197 old_ldflags="$LDFLAGS"
199 sqlite3_CPPFLAGS="-I$withval/include"
200 sqlite3_LDFLAGS="-L$withval/lib "
202 APR_ADDTO(CPPFLAGS, [$sqlite3_CPPFLAGS])
203 APR_ADDTO(LDFLAGS, [$sqlite3_LDFLAGS])
205 AC_MSG_NOTICE(checking for sqlite3 in $withval)
206 AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
207 if test "$apu_have_sqlite3" != "0"; then
208 APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
209 APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
212 CPPFLAGS="$old_cppflags"
213 LDFLAGS="$old_ldflags"
217 AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
220 AC_SUBST(apu_have_sqlite3)
222 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
223 dnl we know the library is there.
224 if test "$apu_have_sqlite3" = "1"; then
225 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lsqlite3])
226 APR_ADDTO(APRUTIL_LIBS,[-lsqlite3])
230 AC_DEFUN([APU_CHECK_DBD_SQLITE2], [
233 AC_ARG_WITH([sqlite2], [
237 if test "$withval" = "yes"; then
238 AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
239 elif test "$withval" = "no"; then
242 old_cppflags="$CPPFLAGS"
243 old_ldflags="$LDFLAGS"
245 sqlite2_CPPFLAGS="-I$withval/include"
246 sqlite2_LDFLAGS="-L$withval/lib "
248 APR_ADDTO(CPPFLAGS, [$sqlite2_CPPFLAGS])
249 APR_ADDTO(LDFLAGS, [$sqlite2_LDFLAGS])
251 AC_MSG_NOTICE(checking for sqlite2 in $withval)
252 AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
253 if test "$apu_have_sqlite2" != "0"; then
254 APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
255 APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
258 CPPFLAGS="$old_cppflags"
259 LDFLAGS="$old_ldflags"
263 AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
266 AC_SUBST(apu_have_sqlite2)
268 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
269 dnl we know the library is there.
270 if test "$apu_have_sqlite2" = "1"; then
271 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lsqlite])
272 APR_ADDTO(APRUTIL_LIBS,[-lsqlite])
276 AC_DEFUN([APU_CHECK_DBD_ORACLE], [
279 AC_ARG_WITH([oracle], [
280 --with-oracle=DIR specify ORACLE_HOME location
283 if test "$withval" = "yes"; then
284 AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1]))
285 elif test "$withval" = "no"; then
288 old_cppflags="$CPPFLAGS"
289 old_ldflags="$LDFLAGS"
291 oracle_CPPFLAGS="-I$withval/rdbms/demo -I$withval/rdbms/public"
292 oracle_LDFLAGS="-L$withval/lib "
294 APR_ADDTO(CPPFLAGS, [$oracle_CPPFLAGS])
295 APR_ADDTO(LDFLAGS, [$oracle_LDFLAGS])
297 AC_MSG_NOTICE(checking for oracle in $withval)
298 AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1]))
299 if test "$apu_have_oracle" != "0"; then
300 APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
301 APR_ADDTO(APRUTIL_LDFLAGS, [-R$withval/lib])
302 APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/rdbms/demo])
303 APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/rdbms/public])
306 CPPFLAGS="$old_cppflags"
307 LDFLAGS="$old_ldflags"
311 AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1]))
314 AC_SUBST(apu_have_oracle)
316 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
317 dnl we know the library is there.
318 if test "$apu_have_oracle" = "1"; then
319 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lclntsh])
320 APR_ADDTO(APRUTIL_LIBS,[-lclntsh])