1 dnl -------------------------------------------------------- -*- autoconf -*-
2 dnl Licensed to the Apache Software Foundation (ASF) under one or more
3 dnl contributor license agreements. See the NOTICE file distributed with
4 dnl this work for additional information regarding copyright ownership.
5 dnl The ASF licenses this file to You under the Apache License, Version 2.0
6 dnl (the "License"); you may not use this file except in compliance with
7 dnl the License. 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], [
28 old_cppflags="$CPPFLAGS"
29 old_ldflags="$LDFLAGS"
31 AC_ARG_WITH([pgsql], APR_HELP_STRING([--with-pgsql=DIR], [specify PostgreSQL location]),
33 if test "$withval" = "yes"; then
34 AC_PATH_PROG([PGSQL_CONFIG],[pg_config])
35 if test "x$PGSQL_CONFIG" != 'x'; then
36 pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
37 pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
38 pgsql_LIBS="`$PGSQL_CONFIG --libs`"
40 APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
41 APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
42 APR_ADDTO(LIBS, [$pgsql_LIBS])
45 AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
46 if test "$apu_have_pgsql" = "0"; then
47 AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
49 if test "$apu_have_pgsql" != "0" && test "x$PGSQL_CONFIG" != 'x'; then
50 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
52 elif test "$withval" = "no"; then
55 AC_PATH_PROG([PGSQL_CONFIG],[pg_config],,[$withval/bin])
56 if test "x$PGSQL_CONFIG" != 'x'; then
57 pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
58 pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
59 pgsql_LIBS="`$PGSQL_CONFIG --libs`"
61 pgsql_CPPFLAGS="-I$withval/include"
62 pgsql_LDFLAGS="-L$withval/lib "
65 APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
66 APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
67 APR_ADDTO(LIBS, [$pgsql_LIBS])
69 AC_MSG_NOTICE(checking for pgsql in $withval)
70 AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
71 if test "$apu_have_pgsql" != "1"; then
72 AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
74 if test "$apu_have_pgsql" != "0"; then
75 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
79 AC_PATH_PROG([PGSQL_CONFIG],[pg_config])
80 if test "x$PGSQL_CONFIG" != 'x'; then
81 pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
82 pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
83 pgsql_LIBS="`$PGSQL_CONFIG --libs`"
85 APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
86 APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
87 APR_ADDTO(LIBS, [$pgsql_LIBS])
90 AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
91 if test "$apu_have_pgsql" = "0"; then
92 AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
94 if test "$apu_have_pgsql" != "0" && test "x$PGSQL_CONFIG" != 'x'; then
95 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
98 AC_SUBST(apu_have_pgsql)
99 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
100 dnl we know the library is there.
101 if test "$apu_have_pgsql" = "1"; then
102 LDADD_dbd_pgsql="$pgsql_LDFLAGS -lpq $pgsql_LIBS"
104 AC_SUBST(LDADD_dbd_pgsql)
107 CPPFLAGS="$old_cppflags"
108 LDFLAGS="$old_ldflags"
111 AC_DEFUN([APU_CHECK_DBD_MYSQL], [
115 old_cppflags="$CPPFLAGS"
116 old_ldflags="$LDFLAGS"
118 AC_ARG_WITH([mysql], APR_HELP_STRING([--with-mysql=DIR], [enable MySQL DBD driver]),
120 if test "$withval" = "yes"; then
121 AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
122 if test "x$MYSQL_CONFIG" != 'x'; then
123 mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
124 mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
125 mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
127 APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
128 APR_ADDTO(LIBS, [$mysql_LIBS])
131 AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
132 if test "$apu_have_mysql" = "0"; then
133 AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
135 if test "$apu_have_mysql" != "0" && test "x$MYSQL_CONFIG" != 'x'; then
136 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
138 elif test "$withval" = "no"; then
141 AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
142 if test "x$MYSQL_CONFIG" != 'x'; then
143 mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
144 mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
145 mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
147 mysql_CPPFLAGS="-I$withval/include"
148 mysql_LDFLAGS="-L$withval/lib "
151 APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
152 APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
153 APR_ADDTO(LIBS, [$mysql_LIBS])
155 AC_MSG_NOTICE(checking for mysql in $withval)
156 AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
158 if test "$apu_have_mysql" != "1"; then
159 AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
161 if test "$apu_have_mysql" != "0"; then
162 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
167 AC_SUBST(apu_have_mysql)
169 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
170 dnl we know the library is there.
171 if test "$apu_have_mysql" = "1"; then
172 LDADD_dbd_mysql="$mysql_LDFLAGS -lmysqlclient_r $mysql_LIBS"
174 AC_SUBST(LDADD_dbd_mysql)
177 CPPFLAGS="$old_cppflags"
178 LDFLAGS="$old_ldflags"
181 AC_DEFUN([APU_CHECK_DBD_SQLITE3], [
185 old_cppflags="$CPPFLAGS"
186 old_ldflags="$LDFLAGS"
188 AC_ARG_WITH([sqlite3], APR_HELP_STRING([--with-sqlite3=DIR], [enable sqlite3 DBD driver]),
190 if test "$withval" = "yes"; then
191 AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
192 elif test "$withval" = "no"; then
195 sqlite3_CPPFLAGS="-I$withval/include"
196 sqlite3_LDFLAGS="-L$withval/lib "
198 APR_ADDTO(CPPFLAGS, [$sqlite3_CPPFLAGS])
199 APR_ADDTO(LDFLAGS, [$sqlite3_LDFLAGS])
201 AC_MSG_NOTICE(checking for sqlite3 in $withval)
202 AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
203 if test "$apu_have_sqlite3" != "0"; then
204 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include])
208 AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
211 AC_SUBST(apu_have_sqlite3)
213 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
214 dnl we know the library is there.
215 if test "$apu_have_sqlite3" = "1"; then
216 LDADD_dbd_sqlite3="$sqlite3_LDFLAGS -lsqlite3"
218 AC_SUBST(LDADD_dbd_sqlite3)
221 CPPFLAGS="$old_cppflags"
222 LDFLAGS="$old_ldflags"
225 AC_DEFUN([APU_CHECK_DBD_SQLITE2], [
229 old_cppflags="$CPPFLAGS"
230 old_ldflags="$LDFLAGS"
232 AC_ARG_WITH([sqlite2], APR_HELP_STRING([--with-sqlite2=DIR], [enable sqlite2 DBD driver]),
234 if test "$withval" = "yes"; then
235 AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
236 elif test "$withval" = "no"; then
239 sqlite2_CPPFLAGS="-I$withval/include"
240 sqlite2_LDFLAGS="-L$withval/lib "
242 APR_ADDTO(CPPFLAGS, [$sqlite2_CPPFLAGS])
243 APR_ADDTO(LDFLAGS, [$sqlite2_LDFLAGS])
245 AC_MSG_NOTICE(checking for sqlite2 in $withval)
246 AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
247 if test "$apu_have_sqlite2" != "0"; then
248 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include])
252 AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
255 AC_SUBST(apu_have_sqlite2)
257 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
258 dnl we know the library is there.
259 if test "$apu_have_sqlite2" = "1"; then
260 LDADD_dbd_sqlite2="$sqlite2_LDFLAGS -lsqlite"
262 AC_SUBST(LDADD_dbd_sqlite2)
265 CPPFLAGS="$old_cppflags"
266 LDFLAGS="$old_ldflags"
269 AC_DEFUN([APU_CHECK_DBD_ORACLE], [
273 old_cppflags="$CPPFLAGS"
274 old_ldflags="$LDFLAGS"
276 AC_ARG_WITH([oracle-include],
277 APR_HELP_STRING([--with-oracle-include=DIR], [path to Oracle include files]))
278 AC_ARG_WITH([oracle],
279 APR_HELP_STRING([--with-oracle=DIR], [enable Oracle DBD driver; giving ORACLE_HOME as DIR]),
281 if test "$withval" = "yes"; then
282 if test -n "$with_oracle_include"; then
283 oracle_CPPFLAGS="$CPPFLAGS -I$with_oracle_include"
284 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$with_oracle_include])
287 APR_ADDTO(CPPFLAGS, [$oracle_CPPFLAGS])
289 AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
290 unset ac_cv_lib_clntsh_OCIEnvCreate
291 oracle_LIBS="-lnnz10"
292 APR_ADDTO(LIBS, [$oracle_LIBS])
293 AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1])
295 elif test "$withval" = "no"; then
298 if test -n "$with_oracle_include"; then
299 oracle_CPPFLAGS="$CPPFLAGS -I$with_oracle_include"
300 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$with_oracle_include])
302 oracle_CPPFLAGS="-I$withval/rdbms/demo -I$withval/rdbms/public"
304 oracle_LDFLAGS="-L$withval/lib "
306 APR_ADDTO(CPPFLAGS, [$oracle_CPPFLAGS])
307 APR_ADDTO(LDFLAGS, [$oracle_LDFLAGS])
309 AC_MSG_NOTICE(checking for oracle in $withval)
310 AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
311 unset ac_cv_lib_clntsh_OCIEnvCreate
312 oracle_LIBS="-lnnz10"
313 APR_ADDTO(LIBS, [$oracle_LIBS])
314 AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1])
316 if test "$apu_have_oracle" != "0"; then
317 oracle_LDFLAGS="$oracle_LDFLAGS -R$withval/lib"
318 if test -z "$with_oracle_include"; then
319 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/rdbms/demo])
320 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/rdbms/public])
326 AC_SUBST(apu_have_oracle)
328 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
329 dnl we know the library is there.
330 if test "$apu_have_oracle" = "1"; then
331 LDADD_dbd_oracle="$oracle_LDFLAGS -lclntsh $oracle_LIBS"
333 AC_SUBST(LDADD_dbd_oracle)
336 CPPFLAGS="$old_cppflags"
337 LDFLAGS="$old_ldflags"
341 AC_DEFUN([APU_CHECK_DBD_FREETDS], [
345 old_cppflags="$CPPFLAGS"
346 old_ldflags="$LDFLAGS"
348 AC_ARG_WITH([freetds],
349 APR_HELP_STRING([--with-freetds=DIR], [specify FreeTDS location]),
351 if test "$withval" = "yes"; then
352 AC_CHECK_HEADERS(sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1]))
353 elif test "$withval" = "no"; then
356 sybdb_CPPFLAGS="-I$withval/include"
357 sybdb_LDFLAGS="-L$withval/lib "
359 APR_ADDTO(CPPFLAGS, [$sybdb_CPPFLAGS])
360 APR_ADDTO(LDFLAGS, [$sybdb_LDFLAGS])
362 AC_MSG_NOTICE(checking for freetds in $withval)
363 AC_CHECK_HEADERS(sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1]))
364 if test "$apu_have_freetds" != "0"; then
365 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include])
369 AC_CHECK_HEADERS(sybdb.h, AC_CHECK_LIB(sybdb, tdsdbopen, [apu_have_freetds=1]))
372 AC_SUBST(apu_have_freetds)
374 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
375 dnl we know the library is there.
376 if test "$apu_have_freetds" = "1"; then
377 LDADD_dbd_freetds="$sybdb_LDFLAGS -lsybdb"
378 dnl Erm, I needed pcreposix, but I think that dependency has gone
379 dnl from the current code
380 dnl LDADD_dbd_freetds="$LDADD_dbd_freetds -lsybdb -lpcreposix"
382 AC_SUBST(LDADD_dbd_freetds)
385 CPPFLAGS="$old_cppflags"
386 LDFLAGS="$old_ldflags"
390 AC_DEFUN([APU_CHECK_DBD_ODBC], [
394 old_cppflags="$CPPFLAGS"
395 old_ldflags="$LDFLAGS"
397 AC_ARG_WITH([odbc], APR_HELP_STRING([--with-odbc=DIR], [specify ODBC location]),
399 if test "$withval" = "yes"; then
400 AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
401 if test "x$ODBC_CONFIG" != 'x'; then
402 odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
403 odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
404 odbc_LIBS="`$ODBC_CONFIG --libs`"
406 APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
407 APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
408 APR_ADDTO(LIBS, [$odbc_LIBS])
411 AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
412 if test "$apu_have_odbc" = "0"; then
413 AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
415 if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
416 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
418 elif test "$withval" = "no"; then
421 AC_PATH_PROG([ODBC_CONFIG],[odbc_config],,[$withval/bin])
422 if test "x$ODBC_CONFIG" != 'x'; then
423 odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
424 odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
425 odbc_LIBS="`$ODBC_CONFIG --libs`"
427 odbc_CPPFLAGS="-I$withval/include"
428 odbc_LDFLAGS="-L$withval/lib "
431 APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
432 APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
433 APR_ADDTO(LIBS, [$odbc_LIBS])
435 AC_MSG_NOTICE(checking for odbc in $withval)
436 AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
437 if test "$apu_have_odbc" = "0"; then
438 AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
440 if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
441 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
445 AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
446 if test "x$ODBC_CONFIG" != 'x'; then
447 odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
448 odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
449 odbc_LIBS="`$ODBC_CONFIG --libs`"
451 APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
452 APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
453 APR_ADDTO(LIBS, [$odbc_LIBS])
456 AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
457 if test "$apu_have_odbc" = "0"; then
458 AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
460 if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
461 APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
464 AC_SUBST(apu_have_odbc)
465 dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
466 dnl we know the library is there.
467 if test "$apu_have_odbc" = "1"; then
468 LDADD_dbd_odbc="$odbc_LDFLAGS -lodbc $odbc_LIBS"
470 AC_SUBST(LDADD_dbd_odbc)
473 CPPFLAGS="$old_cppflags"
474 LDFLAGS="$old_ldflags"