s3:vfs_acl_tdb: don't leak state_path() to talloc_tos() in acl_tdb_init()
[jra/samba/.git] / source3 / m4 / check_path.m4
1 dnl
2 dnl Samba3 build environment path checks
3 dnl
4 dnl Copyright (C) Michael Adam 2008
5 dnl
6 dnl Released under the GNU General Public License
7 dnl http://www.gnu.org/licenses/
8 dnl
9
10 AC_LIBREPLACE_LOCATION_CHECKS
11
12 #################################################
13 # Directory handling stuff to support both the
14 # legacy SAMBA directories and FHS compliant
15 # ones...
16 AC_PREFIX_DEFAULT(/usr/local/samba)
17
18 rootsbindir="\${SBINDIR}"
19 lockdir="\${VARDIR}/locks"
20 piddir="\${VARDIR}/locks"
21 ncalrpcdir="\${VARDIR}/ncalrpc"
22 test "${mandir}" || mandir="\${prefix}/man"
23 logfilebase="\${VARDIR}"
24 privatedir="\${prefix}/private"
25 test "${libdir}" || libdir="\${prefix}/lib"
26 modulesdir="${libdir}"
27 pammodulesdir="${libdir}/security"
28 configdir="${libdir}"
29 swatdir="\${prefix}/swat"
30 codepagedir="\${MODULESDIR}"
31 statedir="\${LOCKDIR}"
32 cachedir="\${LOCKDIR}"
33 localedir="\${prefix}/share/locale"
34
35 AC_ARG_WITH(fhs,
36 [AS_HELP_STRING([--with-fhs],[Use FHS-compliant paths (default=no)])],
37 [ case "$withval" in
38   yes)
39     lockdir="\${VARDIR}/lib/samba"
40     piddir="\${VARDIR}/run"
41     mandir="\${prefix}/share/man"
42     logfilebase="\${VARDIR}/log/samba"
43     privatedir="\${CONFIGDIR}/private"
44     test "${libdir}" || libdir="\${prefix}/lib"
45     modulesdir="${libdir}/samba"
46     configdir="\${sysconfdir}/samba"
47     swatdir="\${DATADIR}/samba/swat"
48     codepagedir="\${MODULESDIR}"
49     statedir="\${VARDIR}/lib/samba"
50     cachedir="\${VARDIR}/lib/samba"
51     ncalrpcdir="\${VARDIR}/ncalrpc"
52     AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
53     ;;
54   esac])
55
56 #################################################
57 # set private directory location
58 AC_ARG_WITH(privatedir,
59 [AS_HELP_STRING([--with-privatedir=DIR], [Where to put smbpasswd ($ac_default_prefix/private)])],
60 [ case "$withval" in
61   yes|no)
62   #
63   # Just in case anybody calls it without argument
64   #
65     AC_MSG_WARN([--with-privatedir called without argument - will use default])
66   ;;
67   * )
68     privatedir="$withval"
69     ;;
70   esac])
71
72 #################################################
73 # set root sbin directory location
74 AC_ARG_WITH(rootsbindir,
75 [AS_HELP_STRING([--with-rootsbindir=DIR], [Which directory to use for root sbin ($ac_default_prefix/sbin)])],
76 [ case "$withval" in
77   yes|no)
78   #
79   # Just in case anybody calls it without argument
80   #
81     AC_MSG_WARN([--with-rootsbindir called without argument - will use default])
82   ;;
83   * )
84     rootsbindir="$withval"
85     ;;
86   esac])
87
88 #################################################
89 # set lock directory location
90 AC_ARG_WITH(lockdir,
91 [AS_HELP_STRING([--with-lockdir=DIR], [Where to put lock files ($ac_default_prefix/var/locks)])],
92 [ case "$withval" in
93   yes|no)
94   #
95   # Just in case anybody calls it without argument
96   #
97     AC_MSG_WARN([--with-lockdir called without argument - will use default])
98   ;;
99   * )
100     lockdir="$withval"
101     ;;
102   esac])
103
104 #################################################
105 # set state directory location
106 AC_ARG_WITH(statedir,
107 [AS_HELP_STRING([--with-statedir=DIR], [Where to put persistent state files ($ac_default_prefix/var/locks)])],
108 [ case "$withval" in
109   yes|no)
110   #
111   # Just in case anybody calls it without argument
112   #
113     AC_MSG_WARN([--with-statedir called without argument - will use default])
114   ;;
115   * )
116     statedir="$withval"
117     ;;
118   esac])
119
120 #################################################
121 # set cache directory location
122 AC_ARG_WITH(cachedir,
123 [AS_HELP_STRING([--with-cachedir=DIR], [Where to put temporary cache files ($ac_default_prefix/var/locks)])],
124 [ case "$withval" in
125   yes|no)
126   #
127   # Just in case anybody calls it without argument
128   #
129     AC_MSG_WARN([--with-cachedir called without argument - will use default])
130   ;;
131   * )
132     cachedir="$withval"
133     ;;
134   esac])
135
136 #################################################
137 # set pid directory location
138 AC_ARG_WITH(piddir,
139 [AS_HELP_STRING([--with-piddir=DIR], [Where to put pid files ($ac_default_prefix/var/locks)])],
140 [ case "$withval" in
141   yes|no)
142   #
143   # Just in case anybody calls it without argument
144   #
145     AC_MSG_WARN([--with-piddir called without argument - will use default])
146   ;;
147   * )
148     piddir="$withval"
149     ;;
150   esac])
151
152 #################################################
153 # set ncalrpc directory location
154 AC_ARG_WITH(ncalprcdir,
155 [AS_HELP_STRING([--with-ncalprcdir=DIR], [Where to put ncalrpc sockets ($ac_default_prefix/var/ncalrpc)])],
156 [ case "$withval" in
157   yes|no)
158   #
159   # Just in case anybody calls it without argument
160   #
161     AC_MSG_WARN([--with-ncalrpcdir called without argument - will use default])
162   ;;
163   * )
164     ncalrpcdir="$withval"
165     ;;
166   esac])
167
168 #################################################
169 # set SWAT directory location
170 AC_ARG_WITH(swatdir,
171 [AS_HELP_STRING([--with-swatdir=DIR], [Where to put SWAT files ($ac_default_prefix/swat)])],
172 [ case "$withval" in
173   yes|no)
174   #
175   # Just in case anybody does it
176   #
177     AC_MSG_WARN([--with-swatdir called without argument - will use default])
178   ;;
179   * )
180     swatdir="$withval"
181     ;;
182   esac])
183
184 #################################################
185 # set configuration directory location
186 AC_ARG_WITH(configdir,
187 [AS_HELP_STRING([--with-configdir=DIR], [Where to put configuration files ($libdir)])],
188 [ case "$withval" in
189   yes|no)
190   #
191   # Just in case anybody does it
192   #
193     AC_MSG_WARN([--with-configdir called without argument - will use default])
194   ;;
195   * )
196     configdir="$withval"
197     ;;
198   esac])
199
200 #################################################
201 # set log directory location
202 AC_ARG_WITH(logfilebase,
203 [AS_HELP_STRING([--with-logfilebase=DIR], [Where to put log files ($VARDIR)])],
204 [ case "$withval" in
205   yes|no)
206   #
207   # Just in case anybody does it
208   #
209     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
210   ;;
211   * )
212     logfilebase="$withval"
213     ;;
214   esac])
215
216
217 #################################################
218 # set ctdb source directory location
219 AC_ARG_WITH(ctdb,
220 [AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
221 [ case "$withval" in
222   yes|no)
223     AC_MSG_WARN([--with-ctdb called without argument])
224   ;;
225   * )
226     ctdbdir="$withval"
227     ;;
228   esac])
229
230 #################################################
231 # set shared modules (internal lib) directory location
232 AC_ARG_WITH(modulesdir,
233 [AS_HELP_STRING([--with-modulesdir=DIR], [Where to put shared modules ($libdir)])],
234 [ case "$withval" in
235   yes|no)
236   #
237   # Just in case anybody does it
238   #
239     AC_MSG_WARN([--with-modulesdir without argument - will use default])
240   ;;
241   * )
242     modulesdir="$withval"
243     ;;
244   esac])
245
246 #################################################
247 # set PAM modules directory location
248 AC_ARG_WITH(pammodulesdir,
249 [AS_HELP_STRING([--with-pammodulesdir=DIR], [Which directory to use for PAM modules ($ac_default_prefix/$libdir/security)])],
250 [ case "$withval" in
251   yes|no)
252   #
253   # Just in case anybody calls it without argument
254   #
255     AC_MSG_WARN([--with-pammodulesdir called without argument - will use default])
256   ;;
257   * )
258     pammodulesdir="$withval"
259     ;;
260   esac])
261
262 #################################################
263 # set man directory location
264 AC_ARG_WITH(mandir,
265 [AS_HELP_STRING([--with-mandir=DIR], [Where to put man pages ($mandir)])],
266 [ case "$withval" in
267   yes|no)
268   #
269   # Just in case anybody does it
270   #
271     AC_MSG_WARN([--with-mandir without argument - will use default])
272   ;;
273   * )
274     mandir="$withval"
275     ;;
276   esac])
277
278 ################################################
279 # set locale directory location
280 AC_ARG_WITH(localedir,
281 [  --with-localedir=DIR    Where to put po files ($ac_default_prefix/share/locale)],
282 [ case "$withval" in
283   yes|no)
284     #
285     # Just in case anybody does it
286     #
287     AC_MSG_WARN([--with-localedir called without argument - will use default])
288   ;;
289   *)
290   localedir="$withval"
291   ;;
292   esac])
293
294
295 AC_SUBST(configdir)
296 AC_SUBST(lockdir)
297 AC_SUBST(piddir)
298 AC_SUBST(ncalrpcdir)
299 AC_SUBST(logfilebase)
300 AC_SUBST(ctdbdir)
301 AC_SUBST(privatedir)
302 AC_SUBST(swatdir)
303 AC_SUBST(bindir)
304 AC_SUBST(sbindir)
305 AC_SUBST(codepagedir)
306 AC_SUBST(statedir)
307 AC_SUBST(cachedir)
308 AC_SUBST(rootsbindir)
309 AC_SUBST(pammodulesdir)
310 AC_SUBST(modulesdir)
311 AC_SUBST(localedir)
312
313 #################################################
314 # set prefix for 'make test'
315 selftest_prefix="./st"
316 AC_SUBST(selftest_prefix)
317 AC_ARG_WITH(selftest-prefix,
318 [AS_HELP_STRING([--with-selftest-prefix=DIR], [The prefix where make test will be run ($selftest_prefix)])],
319 [ case "$withval" in
320   yes|no)
321     AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
322   ;;
323   * )
324     selftest_prefix="$withval"
325     ;;
326   esac
327 ])
328
329 #################################################
330 # set shrdir for 'make test'
331 selftest_shrdir=""
332 AC_SUBST(selftest_shrdir)
333 AC_ARG_WITH(selftest-shrdir,
334 [AS_HELP_STRING([--with-selftest-shrdir=DIR], [The share directory that make test will be run against ($selftest_shrdir)])],
335 [ case "$withval" in
336   yes|no)
337     AC_MSG_WARN([--with-selftest-shrdir called without argument - will use default])
338   ;;
339   * )
340     selftest_shrdir="$withval"
341     ;;
342   esac
343 ])
344
345 #################################################
346 # set path of samba4's smbtorture
347 smbtorture4_path=""
348 AC_SUBST(smbtorture4_path)
349 AC_ARG_WITH(smbtorture4_path,
350 [AS_HELP_STRING([--with-smbtorture4-path=PATH], [The path to a samba4 smbtorture for make test (none)])],
351 [ case "$withval" in
352   yes|no)
353     AC_MSG_ERROR([--with-smbtorture4-path should take a path])
354   ;;
355   * )
356     smbtorture4_path="$withval"
357     if test -z "$smbtorture4_path" -a ! -f $smbtorture4_path; then
358         AC_MSG_ERROR(['$smbtorture_path' does not  exist!])
359     fi
360   ;;
361  esac
362 ])
363
364 ## check for --enable-debug first before checking CFLAGS before
365 ## so that we don't mix -O and -g
366 debug=no
367 AC_ARG_ENABLE(debug,
368 [AS_HELP_STRING([--enable-debug], [Turn on compiler debugging information (default=no)])],
369     [if eval "test x$enable_debug = xyes"; then
370         debug=yes
371     fi])
372
373 AC_SUBST(developer)
374 developer=no
375 AC_ARG_ENABLE(developer, [AS_HELP_STRING([--enable-developer], [Turn on developer warnings and debugging (default=no)])],
376     [if eval "test x$enable_developer = xyes"; then
377         debug=yes
378         developer=yes
379     fi])
380
381 krb5developer=no
382 AC_ARG_ENABLE(krb5developer, [AS_HELP_STRING([--enable-krb5developer], [Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)])],
383     [if eval "test x$enable_krb5developer = xyes"; then
384         debug=yes
385         developer=yes
386         krb5_developer=yes
387     fi])
388
389 picky_developer=no
390 AC_ARG_ENABLE(picky-developer, [AS_HELP_STRING([--enable-picky-developer], [Halt compilation on warnings])],
391     [if eval "test x$enable_picky_developer = xyes"; then
392         debug=yes
393         developer=yes
394         picky_developer=yes
395     fi])
396
397 AC_ARG_WITH(cfenc,
398 [AS_HELP_STRING([--with-cfenc=HEADERDIR], [Use internal CoreFoundation encoding API for optimization (Mac OS X/Darwin only)])],
399 [
400 # May be in source $withval/CoreFoundation/StringEncodings.subproj.
401 # Should have been in framework $withval/CoreFoundation.framework/Headers.
402 for d in \
403     $withval/CoreFoundation/StringEncodings.subproj \
404     $withval/StringEncodings.subproj \
405     $withval/CoreFoundation.framework/Headers \
406     $withval/Headers \
407     $withval
408 do
409     if test -r $d/CFStringEncodingConverter.h; then
410         ln -sfh $d include/CoreFoundation
411     fi
412 done
413 ])
414