1 AC_DEFUN([AC_NETATALK_CNID], [
2 dnl Don't use BDB unless it's needed
6 dnl Determine whether or not to use Database Daemon CNID backend
7 AC_MSG_CHECKING([whether or not to use Database Daemon CNID backend])
8 AC_ARG_WITH(cnid-dbd-backend,
9 [ --with-cnid-dbd-backend build CNID with Database Daemon Data Store [[yes]]],
10 [ if test x"$withval" = x"no"; then
22 if test $use_dbd_backend = yes; then
23 compiled_backends="$compiled_backends dbd"
24 AC_DEFINE(CNID_BACKEND_DBD, 1, [Define if CNID Database Daemon backend should be compiled.])
25 if test x"$DEFAULT_CNID_SCHEME" = x; then
26 DEFAULT_CNID_SCHEME=dbd
30 AM_CONDITIONAL(BUILD_DBD_DAEMON, test x"$use_dbd_backend" = x"yes")
32 dnl Determine whether or not to use BDB Concurrent Data Store
33 AC_MSG_CHECKING([whether or not to use BDB Concurrent Data Store])
34 AC_ARG_WITH(cnid-cdb-backend,
35 [ --with-cnid-cdb-backend build CNID with Concurrent BDB Data Store [[no]]],[
36 if test x"$withval" = x"no"; then
46 if test $use_cdb_backend = yes; then
48 AC_DEFINE(CNID_BACKEND_CDB, 1, [Define if CNID Concurrent BDB backend should be compiled.])
49 if test x"$DEFAULT_CNID_SCHEME" = x; then
50 DEFAULT_CNID_SCHEME=cdb
53 compiled_backends="$compiled_backends cdb"
57 AM_CONDITIONAL(USE_CDB_BACKEND, test x"$use_cdb_backend" = x"yes")
59 dnl Determine whether or not to use LAST DID scheme
60 AC_MSG_CHECKING([whether or not to use LAST DID scheme])
61 AC_ARG_WITH(cnid-last-backend,
62 [ --with-cnid-last-backend build LAST CNID scheme [[yes]]],
64 if test x"$withval" = x"no"; then
73 if test $use_last_backend = yes; then
75 AC_DEFINE(CNID_BACKEND_LAST, 1, [Define if CNID LAST scheme backend should be compiled.])
76 if test x"$DEFAULT_CNID_SCHEME" = x; then
77 DEFAULT_CNID_SCHEME=last
79 compiled_backends="$compiled_backends last"
83 AM_CONDITIONAL(USE_LAST_BACKEND, test x"$use_last_backend" = x"yes")
85 dnl Determine whether or not to use TDB DID scheme
86 AC_MSG_CHECKING([whether or not to use TDB DID scheme])
87 AC_ARG_WITH(cnid-tdb-backend,
88 [ --with-cnid-tdb-backend build TDB CNID scheme [[yes]]],
90 if test x"$withval" = x"no"; then
99 if test $use_tdb_backend = yes; then
101 AC_DEFINE(CNID_BACKEND_TDB, 1, [Define if CNID TDB scheme backend should be compiled.])
102 if test x"$DEFAULT_CNID_SCHEME" = x; then
103 DEFAULT_CNID_SCHEME=tdb
105 compiled_backends="$compiled_backends tdb"
109 AM_CONDITIONAL(USE_TDB_BACKEND, test x"$use_tdb_backend" = x"yes")
111 dnl Check for mysql CNID backend
112 AC_ARG_VAR(MYSQL_CFLAGS, [C compiler flags for MySQL, overriding checks])
113 AC_ARG_VAR(MYSQL_LIBS, [linker flags for MySQL, overriding checks])
115 AC_MSG_CHECKING([MySQL library and headers])
118 [AS_HELP_STRING([--with-mysql-config=PATH],[Path to mysql-config binary (default: mysql_config)])],
119 MYSQL_CONFIG=$withval
122 if test -z "$MYSQL_CONFIG" -a -z "$MYSQL_CFLAGS" -a -z "$MYSQL_LIBS" ; then
123 AC_PATH_PROG(MYSQL_CONFIG, mysql_config)
126 if test -x "$MYSQL_CONFIG" ; then
127 AC_MSG_RESULT([$MYSQL_CONFIG])
128 MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
129 MYSQL_LIBS="`$MYSQL_CONFIG --libs`"
130 ac_cv_with_cnid_mysql="yes"
131 elif test -n "$MYSQL_CFLAGS" -a -n "$MYSQL_LIBS" ; then
132 ac_cv_with_cnid_mysql="yes"
135 if test x"$ac_cv_with_cnid_mysql" = x"yes" ; then
136 compiled_backends="$compiled_backends mysql"
137 AC_DEFINE(CNID_BACKEND_MYSQL, 1, [whether the MySQL CNID module is available])
140 AC_SUBST(MYSQL_CFLAGS)
142 AM_CONDITIONAL(USE_MYSQL_BACKEND, test x"$ac_cv_with_cnid_mysql" = x"yes")
144 dnl Set default DID scheme
145 AC_MSG_CHECKING([default DID scheme])
146 AC_ARG_WITH(cnid-default-backend,
147 [ --with-cnid-default-backend=val set default DID scheme [[dbd]]],
149 if test x"$withval" = x; then
150 AC_MSG_RESULT([ignored])
152 DEFAULT_CNID_SCHEME=$withval
153 AC_MSG_RESULT($DEFAULT_CNID_SCHEME)
156 AC_MSG_RESULT($DEFAULT_CNID_SCHEME)
159 if test x"$DEFAULT_CNID_SCHEME" = x; then
160 AC_MSG_ERROR([No DID schemes compiled in ])
163 AC_MSG_CHECKING([whether default CNID scheme has been activated])
165 for scheme in $compiled_backends ; do
166 if test x"$scheme" = x"$DEFAULT_CNID_SCHEME"; then
170 if test x"$found_scheme" = x"no"; then
172 AC_MSG_ERROR([Specified default CNID scheme $DEFAULT_CNID_SCHEME was not selected for compilation])
177 AC_DEFINE_UNQUOTED(DEFAULT_CNID_SCHEME, "$DEFAULT_CNID_SCHEME", [Default CNID scheme to be used])
178 AC_SUBST(DEFAULT_CNID_SCHEME)
179 AC_SUBST(compiled_backends)
181 if test "x$bdb_required" = "xyes"; then
182 ifelse([$1], , :, [$1])
184 ifelse([$2], , :, [$2])