1
# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
3
# Permission to use, copy, modify, and distribute this software for any
4
# purpose with or without fee is hereby granted, provided that the above
5
# copyright notice and this permission notice appear in all copies.
7
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
8
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
10
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
12
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
# PERFORMANCE OF THIS SOFTWARE.
16
# Shorthand. Note quoting: DLZ_DRIVER_DIR expanded in Makefile, not here.
18
dlzdir='${DLZ_DRIVER_DIR}'
21
# Private autoconf macro to simplify configuring drivers:
23
# DLZ_ADD_DRIVER(DEFINE, DRIVER, INCLUDES, LIBS)
26
# DEFINE is FOO (to define -DDLZ_FOO)
27
# DRIVER is dlz_foo_driver (sources without the .c)
28
# INCLUDES is any necessary include definitions
29
# LIBS is any necessary library definitions
31
AC_DEFUN(DLZ_ADD_DRIVER, [
32
USE_DLZ="$USE_DLZ -DDLZ_$1"
35
DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
36
DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
40
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES $3"
44
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS $4"
49
# Check for the various DLZ drivers
53
# Was --with-dlz-postgres specified?
56
AC_MSG_CHECKING(for Postgres DLZ driver)
57
AC_ARG_WITH(dlz_postgres,
58
[ --with-dlz-postgres[=PATH] Build with Postgres DLZ driver [yes|no|path].
59
(Required to use Postgres with DLZ)],
60
use_dlz_postgres="$withval", use_dlz_postgres="no")
62
if test "$use_dlz_postgres" = "yes"
64
# User did not specify a path - guess it
65
# Ask Postgres to tell us where it is
67
AC_PATH_PROGS(PG_CONFIG, pg_config, [not found])
69
if test "$PG_CONFIG" != "not found"
71
use_dlz_postgres=`$PG_CONFIG --includedir`
72
use_dlz_postgres_lib=`$PG_CONFIG --libdir`
76
if test "$use_dlz_postgres" = "yes"
78
# User did not specify path and Postgres didn't say - guess it
80
pgdirs="/usr /usr/local /usr/local/pgsql /usr/pkg"
83
if test -f $d/include/libpq-fe.h
85
use_dlz_postgres=$d/include
86
use_dlz_postgres_lib=$d/lib
92
if test "$use_dlz_postgres" = "yes"
94
# Still no joy, give up
96
AC_MSG_RESULT(not found)
98
[No pg_config and PostgreSQL was not found in any of $pgdirs; use --with-dlz-postgres=/path or put pg_config in your path])
101
case "$use_dlz_postgres" in
106
DLZ_ADD_DRIVER(POSTGRES, dlz_postgres_driver,
107
[-I$use_dlz_postgres],
108
[-L$use_dlz_postgres_lib -lpq])
111
[using PostgreSQL from $use_dlz_postgres_lib and $use_dlz_postgres])
117
# Was --with-dlz-mysql specified?
120
AC_MSG_CHECKING(for MySQL DLZ driver)
121
AC_ARG_WITH(dlz_mysql,
122
[ --with-dlz-mysql[=PATH] Build with MySQL DLZ driver [yes|no|path].
123
(Required to use MySQL with DLZ)],
124
use_dlz_mysql="$withval", use_dlz_mysql="no")
126
if test "$use_dlz_mysql" = "yes"
128
# User did not specify a path - guess it
129
mysqldirs="/usr /usr/local /usr/local/mysql /usr/pkg"
132
if test -f $d/include/mysql/mysql.h
140
if test "$use_dlz_mysql" = "yes"
142
AC_MSG_RESULT(not found)
144
[MySQL was not found in any of $mysqldirs; use --with-dlz-mysql=/path])
147
case "$use_dlz_mysql" in
152
DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
153
[-I$use_dlz_mysql/include/mysql],
154
[-L$use_dlz_mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm])
157
[using mysql from $use_dlz_mysql/lib/mysql and $use_dlz_mysql/include/mysql])
163
# Was --with-dlz-bdb specified?
166
AC_MSG_CHECKING(for Berkeley DB DLZ driver)
168
[ --with-dlz-bdb[=PATH] Build with Berkeley DB DLZ driver [yes|no|path].
169
(Required to use Berkeley DB with DLZ)],
170
use_dlz_bdb="$withval", use_dlz_bdb="no")
172
case "$use_dlz_bdb" in
177
if test "$use_dlz_bdb" = "yes"
179
# User did not specify a path - guess directories
180
bdbdirs="/usr/local /usr/pkg /usr"
181
elif test -d "$use_dlz_bdb"
183
# User specified directory and it exists
184
bdbdirs="$use_dlz_bdb"
186
AC_MSG_RESULT(not found)
187
AC_MSG_ERROR([path $use_dlz_bdb does not exist])
191
# Use path we were given or guessed. This is insanely
192
# complicated because we have to search for a bunch of
193
# platform-specific variations and have to check
194
# separately for include and library directories.
196
# Set both to yes, so we can check them later
202
# Skip nonexistant directories
208
# Check other locations for includes.
209
# Order is important (sigh).
211
bdb_incdirs="/ /db42/ /db41/ /db4/ /db/"
212
for d in $bdb_incdirs
214
if test -f "$dd/include${d}db.h"
216
dlz_bdb_inc="-I$dd/include${d}"
221
# Give up on this directory if we couldn't
222
# find the include subdir
224
if test "$dlz_bdb_inc" = "yes"
229
# Look for libname other than libdb.so.
230
# Order is important (sigh).
232
bdb_libnames="db-4 db42 db-4.2 db41 db-4.1 db"
233
for d in $bdb_libnames
235
if test -f "$dd/lib/lib${d}.so"
237
if test "$dd" != "/usr"
239
dlz_bdb_libs="-L${dd}/lib "
243
dlz_bdb_libs="${dlz_bdb_libs}-l${d}"
248
# If we found both incdir and lib, we're done
249
if test "$dlz_bdb_libs" != "yes"
254
# Otherwise, we're starting over
260
# Done searching, now make sure we got everything.
262
if test "$dlz_bdb_inc" = "yes"
264
AC_MSG_RESULT(not found)
265
AC_MSG_ERROR([could not find Berkeley DB include directory])
268
if test "$dlz_bdb_libs" = "yes"
270
AC_MSG_RESULT(not found)
271
AC_MSG_ERROR([could not find Berkeley DB library])
274
DLZ_ADD_DRIVER(BDB, dlz_bdb_driver dlz_bdbhpt_driver,
275
[$dlz_bdb_inc], [$dlz_bdb_libs])
277
AC_MSG_RESULT([using Berkeley DB: $dlz_bdb_inc $dlz_bdb_libs])
279
AC_CONFIG_FILES([contrib/dlz/bin/dlzbdb/Makefile])
285
# Was --with-dlz-filesystem specified?
288
AC_MSG_CHECKING(for file system DLZ driver)
289
AC_ARG_WITH(dlz_filesystem,
290
[ --with-dlz-filesystem[=PATH] Build with filesystem DLZ driver [yes|no].
291
(Required to use file system driver with DLZ)],
292
use_dlz_filesystem="$withval", use_dlz_filesystem="no")
294
case "$use_dlz_filesystem" in
299
DLZ_ADD_DRIVER(FILESYSTEM, dlz_filesystem_driver)
307
# Was --with-dlz-ldap specified?
310
AC_MSG_CHECKING(for LDAP DLZ driver)
311
AC_ARG_WITH(dlz_ldap,
312
[ --with-dlz-ldap[=PATH] Build with LDAP DLZ driver [yes|no|path].
313
(Required to use LDAP with DLZ)],
314
use_dlz_ldap="$withval", use_dlz_ldap="no")
316
if test "$use_dlz_ldap" = "yes"
318
# User did not specify a path - guess it
319
ldapdirs="/usr /usr/local /usr/pkg"
322
if test -f $d/include/ldap.h
330
if test "$use_dlz_ldap" = "yes"
332
AC_MSG_RESULT(not found)
334
[LDAP headers were not found in any of $ldapdirs; use --with-dlz-ldap=/path])
337
case "$use_dlz_ldap" in
342
DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver,
343
[-I$use_dlz_ldap/include],
344
[-L$use_dlz_ldap/lib -lldap -llber])
347
[using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include])
353
# Was --with-dlz-odbc specified?
356
AC_MSG_CHECKING(for ODBC DLZ driver)
357
AC_ARG_WITH(dlz_odbc,
358
[ --with-dlz-odbc[=PATH] Build with ODBC DLZ driver [yes|no|path].
359
(Required to use ODBC with DLZ)],
360
use_dlz_odbc="$withval", use_dlz_odbc="no")
362
if test "$use_dlz_odbc" = "yes"
364
# User did not specify a path - guess it
365
odbcdirs="/usr /usr/local /usr/pkg"
368
if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
376
case "$use_dlz_odbc" in
381
AC_MSG_RESULT(not found)
383
[ODBC headers were not found in any of $odbcdirs; use --with-dlz-odbc=/path])
386
DLZ_ADD_DRIVER(ODBC, dlz_odbc_driver,
387
[-I$use_dlz_odbc/include],
388
[-L$use_dlz_odbc/lib -lodbc])
390
AC_MSG_RESULT([using ODBC from $use_dlz_odbc])
396
# Was --with-dlz-stub specified?
399
AC_MSG_CHECKING(for stub DLZ driver)
400
AC_ARG_WITH(dlz_stub,
401
[ --with-dlz-stub[=PATH] Build with stub DLZ driver [yes|no].
402
(Required to use stub driver with DLZ)],
403
use_dlz_stub="$withval", use_dlz_stub="no")
405
case "$use_dlz_stub" in
411
DLZ_ADD_DRIVER(STUB, dlz_stub_driver)
418
# Add any additional DLZ drivers here.
421
# Finally, some generic stuff that applies to all drivers, assuming
422
# we're compiling DLZ at all.
424
if test -n "$USE_DLZ"
427
# Where to find DLZ driver header files.
429
DLZ_DRIVER_INCLUDES="-I$dlzdir/include $DLZ_DRIVER_INCLUDES"
432
# Initialization and shutdown wrappers, helper functions.
434
DLZ_DRIVER_SRCS="$dlzdir/dlz_drivers.c $dlzdir/sdlz_helper.c $DLZ_DRIVER_SRCS"
435
DLZ_DRIVER_OBJS="dlz_drivers.$O sdlz_helper.$O $DLZ_DRIVER_OBJS"