]> arthur.barton.de Git - netatalk.git/blob - macros/cnid-backend.m4
- merge branch-netatalk-afp-3x-dev, HEAD was tagged before
[netatalk.git] / macros / cnid-backend.m4
1 AC_DEFUN([AC_NETATALK_CNID], [
2
3     dnl Don't use BDB unless it's needed
4     bdb_required=no
5     compiled_backends=""
6
7     dnl Determine whether or not to use BDB Concurrent Data Store
8     AC_MSG_CHECKING([whether or not to use BDB Concurrent Data Store])
9     AC_ARG_WITH(cnid-cdb-backend,
10         [  --with-cnid-cdb-backend      build CNID with Concurrent BDB Data Store],[
11             if test x"$withval" = x"no"; then
12                 use_cdb_backend=no
13         else
14             use_cdb_backend=yes
15         fi
16     ],[use_cdb_backend=yes]
17     )
18
19     if test $use_cdb_backend = yes; then
20         AC_MSG_RESULT([yes])
21         AC_DEFINE(CNID_BACKEND_CDB, 1, [Define if CNID Concurrent BDB backend should be compiled.])         
22         DEFAULT_CNID_SCHEME=cdb
23         bdb_required=yes
24         compiled_backends="$compiled_backends cdb"
25     else
26         AC_MSG_RESULT([no])
27     fi
28     AM_CONDITIONAL(USE_CDB_BACKEND, test x"$use_cdb_backend" = x"yes")
29
30     dnl Determine whether or not to use Database Daemon CNID backend
31     AC_MSG_CHECKING([whether or not to use Database Daemon CNID backend])
32     AC_ARG_WITH(cnid-dbd-backend,
33     [  --with-cnid-dbd-backend       build CNID with Database Daemon Data Store],
34     [   if test x"$withval" = x"no"; then
35             AC_MSG_RESULT([no])
36             use_dbd_backend=no
37         else
38             use_dbd_backend=yes
39             AC_MSG_RESULT([yes])
40         fi
41     ],[
42         use_dbd_backend=yes
43         AC_MSG_RESULT([yes])
44     ])
45
46     dnl Determine whether or not to use with transaction support in Database Daemon
47     AC_MSG_CHECKING([whether or not to use Database Daemon with transaction support])
48     AC_ARG_WITH(cnid-dbd-txn,
49     [  --with-cnid-dbd-txn           build transaction support for dbd backend],
50     [   if test x"$withval" = x"no"; then
51             AC_MSG_RESULT([no])
52             use_dbd_txn=no
53         else
54             use_dbd_txn=yes
55             AC_MSG_RESULT([yes])
56         fi
57         ],[
58         use_dbd_txn=no
59         AC_MSG_RESULT([no])
60     ])
61
62     if test $use_dbd_txn = yes; then
63         use_dbd_backend=yes
64         AC_DEFINE(CNID_BACKEND_DBD_TXN, 1, [Define if CNID Database Daemon backend has transaction support])
65     else
66         if test x"$use_dbd_backend" = x; then    
67             use_dbd_backend=no
68         fi
69     fi
70
71     if test $use_dbd_backend = yes; then
72         compiled_backends="$compiled_backends dbd"
73         AC_DEFINE(CNID_BACKEND_DBD, 1, [Define if CNID Database Daemon backend should be compiled.])
74         if test x"$DEFAULT_CNID_SCHEME" = x; then
75             DEFAULT_CNID_SCHEME=dbd
76         fi
77         bdb_required=yes
78     fi
79     AM_CONDITIONAL(BUILD_DBD_DAEMON, test x"$use_dbd_backend" = x"yes")
80
81     dnl Determine whether or not to use BDB transactional data store
82     AC_MSG_CHECKING([whether or not to use BDB transactional DB store])
83     AC_ARG_WITH(cnid-db3-backend,
84     [  --with-cnid-db3-backend  build CNID with transactional BDB Data Store],
85         [
86             if test x"$withval" = x"no"; then
87             use_db3_backend=no
88         else
89             use_db3_backend=yes
90         fi
91     ],[
92         use_db3_backend=no
93     ])
94
95     if test x"$use_db3_backend" = x"yes"; then
96         AC_MSG_RESULT([yes])
97         AC_DEFINE(CNID_BACKEND_DB3, 1, [Define if CNID transactional BDB backend should be compiled.])
98         if test x"$DEFAULT_CNID_SCHEME" = x; then
99             DEFAULT_CNID_SCHEME=db3
100         fi
101         compiled_backends="$compiled_backends db3"
102         bdb_required=yes
103     else
104         AC_MSG_RESULT([no])
105     fi
106     AM_CONDITIONAL(USE_DB3_BACKEND, test x"$use_db3_backend" = x"yes")
107
108     dnl Determine whether or not to use LAST DID scheme
109     AC_MSG_CHECKING([whether or not to use LAST DID scheme])
110     AC_ARG_WITH(cnid-last-backend,
111         [  --with-cnid-last-backend     build LAST CNID scheme],
112         [
113         if test x"$withval" = x"no"; then
114             use_last_backend=no
115         else
116             use_last_backend=yes
117         fi
118     ],[
119         use_last_backend=yes
120     ])
121
122     if test $use_last_backend = yes; then
123         AC_MSG_RESULT([yes])
124         AC_DEFINE(CNID_BACKEND_LAST, 1, [Define if CNID LAST scheme backend should be compiled.])
125         if test x"$DEFAULT_CNID_SCHEME" = x; then
126             DEFAULT_CNID_SCHEME=last
127         fi
128         compiled_backends="$compiled_backends last"
129     else
130         AC_MSG_RESULT([no])
131     fi
132
133     dnl Determine whether or not to use HASH DID scheme
134     AC_MSG_CHECKING([whether or not to use HASH DID scheme])
135     AC_ARG_WITH(cnid-hash-backend,
136         [  --with-cnid-hash-backend     build HASH CNID scheme],
137         [
138         if test x"$withval" = x"no"; then
139             use_hash_backend=no
140         else
141             use_hash_backend=yes
142         fi
143     ],[
144         use_hash_backend=no
145     ])
146
147     if test $use_hash_backend = yes; then
148         AC_MSG_RESULT([yes])
149         AC_DEFINE(CNID_BACKEND_HASH, 1, [Define if CNID HASH scheme backend should be compiled.])
150         if test x"$DEFAULT_CNID_SCHEME" = x; then
151             DEFAULT_CNID_SCHEME=hash
152         fi
153         compiled_backends="$compiled_backends hash"
154     else
155         AC_MSG_RESULT([no])
156     fi
157
158     dnl Determine whether or not to use TDB DID scheme
159     AC_MSG_CHECKING([whether or not to use TDB DID scheme])
160     AC_ARG_WITH(cnid-tdb-backend,
161         [  --with-cnid-tdb-backend      build DID CNID scheme],
162     [
163         if test x"$withval" = x"no"; then
164             use_tdb_backend=no
165         else
166             use_tdb_backend=yes
167         fi
168     ],[
169         use_tdb_backend=no
170     ])
171
172     if test $use_tdb_backend = yes; then
173         AC_MSG_RESULT([yes])
174         AC_DEFINE(CNID_BACKEND_TDB, 1, [Define if CNID TDB scheme backend should be compiled.])
175         if test x"$DEFAULT_TDB_SCHEME" = x; then
176             DEFAULT_CNID_SCHEME=tdb
177         fi
178         compiled_backends="$compiled_backends tdb"
179     else
180         AC_MSG_RESULT([no])
181     fi
182
183     dnl Determine whether or not to use MTAB DID scheme
184     AC_MSG_CHECKING([whether or not to use MTAB DID scheme])
185     AC_ARG_WITH(cnid-mtab-backend,
186         [  --with-cnid-mtab-backend     build MTAB CNID scheme],
187     [
188         if test x"$withval" = x"no"; then
189             use_mtab_backend=no
190         else
191             use_mtab_backend=yes
192         fi
193     ],[
194         use_mtab_backend=no
195     ])
196
197     if test $use_mtab_backend = yes; then
198         AC_MSG_RESULT([yes])
199         AC_DEFINE(CNID_BACKEND_MTAB, 1, [Define if CNID MTAB scheme backend should be compiled.])
200         if test x"$DEFAULT_CNID_SCHEME" = x; then
201             DEFAULT_CNID_SCHEME=mtab
202         fi
203         compiled_backends="$compiled_backends mtab"
204     else                
205         AC_MSG_RESULT([no])
206     fi
207
208     dnl Set default DID scheme
209     AC_MSG_CHECKING([default DID scheme])
210     AC_ARG_WITH(cnid-default-backend,
211         [  --with-cnid-default-backend=val      set default DID scheme],
212     [
213         if test x"$withval" = x; then
214             AC_MSG_RESULT([ignored])
215         else
216             DEFAULT_CNID_SCHEME=$withval
217             AC_MSG_RESULT($DEFAULT_CNID_SCHEME)
218         fi
219     ],[
220         AC_MSG_RESULT($DEFAULT_CNID_SCHEME)
221     ])
222
223     if test x"$DEFAULT_CNID_SCHEME" = x; then
224         AC_MSG_ERROR([No DID schemes compiled in ])
225     fi
226
227     AC_MSG_CHECKING([whether default CNID scheme has been activated])
228     found_scheme=no
229     for scheme in $compiled_backends ; do
230         if test x"$scheme" = x"$DEFAULT_CNID_SCHEME"; then      
231             found_scheme=yes
232         fi
233     done
234     if test x"$found_scheme" = x"no"; then
235         AC_MSG_RESULT([no])
236         AC_MSG_ERROR([Specified default CNID scheme $DEFAULT_CNID_SCHEME was not selected for compilation])
237     else
238         AC_MSG_RESULT([yes])
239     fi
240
241     AC_DEFINE_UNQUOTED(DEFAULT_CNID_SCHEME, "$DEFAULT_CNID_SCHEME", [Default CNID scheme to be used])
242     AC_SUBST(DEFAULT_CNID_SCHEME)
243     AC_SUBST(compiled_backends)
244
245     if test "x$bdb_required" = "xyes"; then
246         ifelse([$1], , :, [$1])
247     else
248         ifelse([$2], , :, [$2])     
249     fi
250 ])