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