s3: Fix uninitialized memory read in talloc_free()
[Samba.git] / source3 / m4 / check_path.m4
blob65db076ee61a00ed2cd856821b8d775ba60b8329
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
10 AC_LIBREPLACE_LOCATION_CHECKS
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)
18 rootsbindir="\${SBINDIR}"
19 lockdir="\${VARDIR}/locks"
20 piddir="\${VARDIR}/locks"
21 ncalrpcdir="\${VARDIR}/ncalrpc"
22 nmbdsocketdir="\${VARDIR}/nmbd"
23 test "${mandir}" || mandir="\${prefix}/man"
24 logfilebase="\${VARDIR}"
25 privatedir="\${prefix}/private"
26 test "${libdir}" || libdir="\${prefix}/lib"
27 modulesdir="${libdir}"
28 pammodulesdir="${libdir}/security"
29 configdir="${libdir}"
30 swatdir="\${prefix}/swat"
31 codepagedir="\${MODULESDIR}"
32 statedir="\${LOCKDIR}"
33 cachedir="\${LOCKDIR}"
34 localedir="\${prefix}/share/locale"
36 AC_ARG_WITH(fhs,
37 [AS_HELP_STRING([--with-fhs],[Use FHS-compliant paths (default=no)])],
38 [ case "$withval" in
39   yes)
40     lockdir="\${VARDIR}/lib/samba"
41     piddir="\${VARDIR}/run"
42     mandir="\${prefix}/share/man"
43     logfilebase="\${VARDIR}/log/samba"
44     privatedir="\${CONFIGDIR}/private"
45     test "${libdir}" || libdir="\${prefix}/lib"
46     modulesdir="${libdir}/samba"
47     configdir="\${sysconfdir}/samba"
48     swatdir="\${DATADIR}/samba/swat"
49     codepagedir="\${MODULESDIR}"
50     statedir="\${VARDIR}/lib/samba"
51     cachedir="\${VARDIR}/lib/samba"
52     ncalrpcdir="\${VARDIR}/ncalrpc"
53     AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
54     ;;
55   esac])
57 #################################################
58 # set private directory location
59 AC_ARG_WITH(privatedir,
60 [AS_HELP_STRING([--with-privatedir=DIR], [Where to put smbpasswd ($ac_default_prefix/private)])],
61 [ case "$withval" in
62   yes|no)
63   #
64   # Just in case anybody calls it without argument
65   #
66     AC_MSG_WARN([--with-privatedir called without argument - will use default])
67   ;;
68   * )
69     privatedir="$withval"
70     ;;
71   esac])
73 #################################################
74 # set root sbin directory location
75 AC_ARG_WITH(rootsbindir,
76 [AS_HELP_STRING([--with-rootsbindir=DIR], [Which directory to use for root sbin ($ac_default_prefix/sbin)])],
77 [ case "$withval" in
78   yes|no)
79   #
80   # Just in case anybody calls it without argument
81   #
82     AC_MSG_WARN([--with-rootsbindir called without argument - will use default])
83   ;;
84   * )
85     rootsbindir="$withval"
86     ;;
87   esac])
89 #################################################
90 # set lock directory location
91 AC_ARG_WITH(lockdir,
92 [AS_HELP_STRING([--with-lockdir=DIR], [Where to put lock files ($ac_default_prefix/var/locks)])],
93 [ case "$withval" in
94   yes|no)
95   #
96   # Just in case anybody calls it without argument
97   #
98     AC_MSG_WARN([--with-lockdir called without argument - will use default])
99   ;;
100   * )
101     lockdir="$withval"
102     ;;
103   esac])
105 #################################################
106 # set state directory location
107 AC_ARG_WITH(statedir,
108 [AS_HELP_STRING([--with-statedir=DIR], [Where to put persistent state files ($ac_default_prefix/var/locks)])],
109 [ case "$withval" in
110   yes|no)
111   #
112   # Just in case anybody calls it without argument
113   #
114     AC_MSG_WARN([--with-statedir called without argument - will use default])
115   ;;
116   * )
117     statedir="$withval"
118     ;;
119   esac])
121 #################################################
122 # set cache directory location
123 AC_ARG_WITH(cachedir,
124 [AS_HELP_STRING([--with-cachedir=DIR], [Where to put temporary cache files ($ac_default_prefix/var/locks)])],
125 [ case "$withval" in
126   yes|no)
127   #
128   # Just in case anybody calls it without argument
129   #
130     AC_MSG_WARN([--with-cachedir called without argument - will use default])
131   ;;
132   * )
133     cachedir="$withval"
134     ;;
135   esac])
137 #################################################
138 # set pid directory location
139 AC_ARG_WITH(piddir,
140 [AS_HELP_STRING([--with-piddir=DIR], [Where to put pid files ($ac_default_prefix/var/locks)])],
141 [ case "$withval" in
142   yes|no)
143   #
144   # Just in case anybody calls it without argument
145   #
146     AC_MSG_WARN([--with-piddir called without argument - will use default])
147   ;;
148   * )
149     piddir="$withval"
150     ;;
151   esac])
153 #################################################
154 # set ncalrpc directory location
155 AC_ARG_WITH(ncalrpcdir,
156 [AS_HELP_STRING([--with-ncalrpcdir=DIR], [Where to put ncalrpc sockets ($ac_default_prefix/var/ncalrpc)])],
157 [ case "$withval" in
158   yes|no)
159   #
160   # Just in case anybody calls it without argument
161   #
162     AC_MSG_WARN([--with-ncalrpcdir called without argument - will use default])
163   ;;
164   * )
165     ncalrpcdir="$withval"
166     ;;
167   esac])
169 #################################################
170 # set nmbd socket directory location
171 AC_ARG_WITH(nmbdsocketdir,
172 [AS_HELP_STRING([--with-nmbdsocketdir=DIR], [Where to put the nmbd socket directory ($ac_default_prefix/var/nmbd)])],
173 [ case "$withval" in
174   yes|no)
175   #
176   # Just in case anybody calls it without argument
177   #
178     AC_MSG_WARN([--with-nmbdsocketdir called without argument - will use default])
179   ;;
180   * )
181     nmbdsocketdir="$withval"
182     ;;
183   esac])
185 #################################################
186 # set SWAT directory location
187 AC_ARG_WITH(swatdir,
188 [AS_HELP_STRING([--with-swatdir=DIR], [Where to put SWAT files ($ac_default_prefix/swat)])],
189 [ case "$withval" in
190   yes|no)
191   #
192   # Just in case anybody does it
193   #
194     AC_MSG_WARN([--with-swatdir called without argument - will use default])
195   ;;
196   * )
197     swatdir="$withval"
198     ;;
199   esac])
201 #################################################
202 # set configuration directory location
203 AC_ARG_WITH(configdir,
204 [AS_HELP_STRING([--with-configdir=DIR], [Where to put configuration files ($libdir)])],
205 [ case "$withval" in
206   yes|no)
207   #
208   # Just in case anybody does it
209   #
210     AC_MSG_WARN([--with-configdir called without argument - will use default])
211   ;;
212   * )
213     configdir="$withval"
214     ;;
215   esac])
217 #################################################
218 # set log directory location
219 AC_ARG_WITH(logfilebase,
220 [AS_HELP_STRING([--with-logfilebase=DIR], [Where to put log files ($VARDIR)])],
221 [ case "$withval" in
222   yes|no)
223   #
224   # Just in case anybody does it
225   #
226     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
227   ;;
228   * )
229     logfilebase="$withval"
230     ;;
231   esac])
234 #################################################
235 # set shared modules (internal lib) directory location
236 AC_ARG_WITH(modulesdir,
237 [AS_HELP_STRING([--with-modulesdir=DIR], [Where to put shared modules ($libdir)])],
238 [ case "$withval" in
239   yes|no)
240   #
241   # Just in case anybody does it
242   #
243     AC_MSG_WARN([--with-modulesdir without argument - will use default])
244   ;;
245   * )
246     modulesdir="$withval"
247     ;;
248   esac])
250 #################################################
251 # set PAM modules directory location
252 AC_ARG_WITH(pammodulesdir,
253 [AS_HELP_STRING([--with-pammodulesdir=DIR], [Which directory to use for PAM modules ($ac_default_prefix/$libdir/security)])],
254 [ case "$withval" in
255   yes|no)
256   #
257   # Just in case anybody calls it without argument
258   #
259     AC_MSG_WARN([--with-pammodulesdir called without argument - will use default])
260   ;;
261   * )
262     pammodulesdir="$withval"
263     ;;
264   esac])
266 #################################################
267 # set man directory location
268 AC_ARG_WITH(mandir,
269 [AS_HELP_STRING([--with-mandir=DIR], [Where to put man pages ($mandir)])],
270 [ case "$withval" in
271   yes|no)
272   #
273   # Just in case anybody does it
274   #
275     AC_MSG_WARN([--with-mandir without argument - will use default])
276   ;;
277   * )
278     mandir="$withval"
279     ;;
280   esac])
282 ################################################
283 # set locale directory location
284 AC_ARG_WITH(localedir,
285 [AS_HELP_STRING([--with-localedir=DIR],[Where to put po files ($ac_default_prefix/share/locale)])],
286 [ case "$withval" in
287   yes|no)
288     #
289     # Just in case anybody does it
290     #
291     AC_MSG_WARN([--with-localedir called without argument - will use default])
292   ;;
293   *)
294   localedir="$withval"
295   ;;
296   esac])
298 #################################################
299 # set codepage directory location
300 AC_ARG_WITH(codepagedir,
301 [AS_HELP_STRING([--with-codepagedir=DIR], [Where to put codepages ($ac_default_prefix/lib/samba)])],
302 [ case "$withval" in
303   yes|no)
304   #
305   # Just in case anybody calls it without argument
306   #
307     AC_MSG_WARN([--with-codepagedir called without argument - will use default])
308   ;;
309   * )
310     codepagedir="$withval"
311     ;;
312   esac])
315 AC_SUBST(configdir)
316 AC_SUBST(lockdir)
317 AC_SUBST(piddir)
318 AC_SUBST(nmbdsocketdir)
319 AC_SUBST(ncalrpcdir)
320 AC_SUBST(logfilebase)
321 AC_SUBST(privatedir)
322 AC_SUBST(swatdir)
323 AC_SUBST(bindir)
324 AC_SUBST(sbindir)
325 AC_SUBST(codepagedir)
326 AC_SUBST(statedir)
327 AC_SUBST(cachedir)
328 AC_SUBST(rootsbindir)
329 AC_SUBST(pammodulesdir)
330 AC_SUBST(modulesdir)
331 AC_SUBST(localedir)
333 #################################################
334 # set prefix for 'make test'
335 selftest_prefix="./st"
336 AC_SUBST(selftest_prefix)
337 AC_ARG_WITH(selftest-prefix,
338 [AS_HELP_STRING([--with-selftest-prefix=DIR], [The prefix where make test will be run ($selftest_prefix)])],
339 [ case "$withval" in
340   yes|no)
341     AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
342   ;;
343   * )
344     selftest_prefix="$withval"
345     ;;
346   esac
349 #################################################
350 # set shrdir for 'make test'
351 selftest_shrdir=""
352 AC_SUBST(selftest_shrdir)
353 AC_ARG_WITH(selftest-shrdir,
354 [AS_HELP_STRING([--with-selftest-shrdir=DIR], [The share directory that make test will be run against ($selftest_shrdir)])],
355 [ case "$withval" in
356   yes|no)
357     AC_MSG_WARN([--with-selftest-shrdir called without argument - will use default])
358   ;;
359   * )
360     selftest_shrdir="-s $withval"
361     ;;
362   esac
365 #################################################
366 # set path of samba4's smbtorture
367 smbtorture4_path=""
368 AC_SUBST(smbtorture4_path)
369 smbtorture4_option=""
370 AC_SUBST(smbtorture4_option)
371 AC_ARG_WITH(smbtorture4_path,
372 [AS_HELP_STRING([--with-smbtorture4-path=PATH], [The path to a samba4 smbtorture for make test (none)])],
373 [ case "$withval" in
374   yes|no)
375     AC_MSG_ERROR([--with-smbtorture4-path should take a path])
376   ;;
377   * )
378     smbtorture4_path="$withval"
379     if test -z "$smbtorture4_path" -a ! -f $smbtorture4_path; then
380         AC_MSG_ERROR(['$smbtorture_path' does not  exist!])
381     fi
382     smbtorture4_option="-t $withval"
383   ;;
384  esac
387 #################################################
388 # set custom conf for make test
389 selftest_custom_conf=""
390 AC_SUBST(selftest_custom_conf)
391 AC_ARG_WITH(selftest_custom_conf,
392 [AS_HELP_STRING([--with-selftest-custom-conf=PATH], [An optional custom smb.conf that is included in the server smb.conf during make test(none)])],
393 [ case "$withval" in
394   yes|no)
395     AC_MSG_ERROR([--with-selftest-custom-conf should take a path])
396   ;;
397   * )
398     selftest_custom_conf="$withval"
399     if test -z "$selftest_custom_conf" -a ! -f $selftest_custom_conf; then
400         AC_MSG_ERROR(['$selftest_custom_conf' does not  exist!])
401     fi
402     selftest_custom_conf="-c $withval"
403   ;;
404  esac
407 ## check for --enable-debug first before checking CFLAGS before
408 ## so that we don't mix -O and -g
409 debug=no
410 AC_ARG_ENABLE(debug,
411 [AS_HELP_STRING([--enable-debug], [Turn on compiler debugging information (default=no)])],
412     [if eval "test x$enable_debug = xyes"; then
413         debug=yes
414     fi])
416 AC_SUBST(developer)
417 developer=no
418 AC_ARG_ENABLE(developer, [AS_HELP_STRING([--enable-developer], [Turn on developer warnings and debugging (default=no)])],
419     [if eval "test x$enable_developer = xyes"; then
420         debug=yes
421         developer=yes
422     fi])
424 krb5developer=no
425 AC_ARG_ENABLE(krb5developer, [AS_HELP_STRING([--enable-krb5developer], [Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)])],
426     [if eval "test x$enable_krb5developer = xyes"; then
427         debug=yes
428         developer=yes
429         krb5_developer=yes
430     fi])
432 picky_developer=no
433 AC_ARG_ENABLE(picky-developer, [AS_HELP_STRING([--enable-picky-developer], [Halt compilation on warnings])],
434     [if eval "test x$enable_picky_developer = xyes"; then
435         debug=yes
436         developer=yes
437         picky_developer=yes
438     fi])
440 AC_ARG_WITH(cfenc,
441 [AS_HELP_STRING([--with-cfenc=HEADERDIR], [Use internal CoreFoundation encoding API for optimization (Mac OS X/Darwin only)])],
443 # May be in source $withval/CoreFoundation/StringEncodings.subproj.
444 # Should have been in framework $withval/CoreFoundation.framework/Headers.
445 for d in \
446     $withval/CoreFoundation/StringEncodings.subproj \
447     $withval/StringEncodings.subproj \
448     $withval/CoreFoundation.framework/Headers \
449     $withval/Headers \
450     $withval
452     if test -r $d/CFStringEncodingConverter.h; then
453         ln -sfh $d include/CoreFoundation
454     fi
455 done