Merge branch 'master' of ssh://git.samba.org/data/git/samba into regsrv
[amitay/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
34 AC_ARG_WITH(fhs,
35 [AS_HELP_STRING([--with-fhs],[Use FHS-compliant paths (default=no)])],
36 [ case "$withval" in
37   yes)
38     lockdir="\${VARDIR}/lib/samba"
39     piddir="\${VARDIR}/run"
40     mandir="\${prefix}/share/man"
41     logfilebase="\${VARDIR}/log/samba"
42     privatedir="\${CONFIGDIR}/private"
43     test "${libdir}" || libdir="\${prefix}/lib"
44     modulesdir="${libdir}/samba"
45     configdir="\${sysconfdir}/samba"
46     swatdir="\${DATADIR}/samba/swat"
47     codepagedir="\${MODULESDIR}"
48     statedir="\${VARDIR}/lib/samba"
49     cachedir="\${VARDIR}/lib/samba"
50     ncalrpcdir="\${VARDIR}/ncalrpc"
51     AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
52     ;;
53   esac])
54
55 #################################################
56 # set private directory location
57 AC_ARG_WITH(privatedir,
58 [AS_HELP_STRING([--with-privatedir=DIR], [Where to put smbpasswd ($ac_default_prefix/private)])],
59 [ case "$withval" in
60   yes|no)
61   #
62   # Just in case anybody calls it without argument
63   #
64     AC_MSG_WARN([--with-privatedir called without argument - will use default])
65   ;;
66   * )
67     privatedir="$withval"
68     ;;
69   esac])
70
71 #################################################
72 # set root sbin directory location
73 AC_ARG_WITH(rootsbindir,
74 [AS_HELP_STRING([--with-rootsbindir=DIR], [Which directory to use for root sbin ($ac_default_prefix/sbin)])],
75 [ case "$withval" in
76   yes|no)
77   #
78   # Just in case anybody calls it without argument
79   #
80     AC_MSG_WARN([--with-rootsbindir called without argument - will use default])
81   ;;
82   * )
83     rootsbindir="$withval"
84     ;;
85   esac])
86
87 #################################################
88 # set lock directory location
89 AC_ARG_WITH(lockdir,
90 [AS_HELP_STRING([--with-lockdir=DIR], [Where to put lock files ($ac_default_prefix/var/locks)])],
91 [ case "$withval" in
92   yes|no)
93   #
94   # Just in case anybody calls it without argument
95   #
96     AC_MSG_WARN([--with-lockdir called without argument - will use default])
97   ;;
98   * )
99     lockdir="$withval"
100     ;;
101   esac])
102
103 #################################################
104 # set pid directory location
105 AC_ARG_WITH(piddir,
106 [AS_HELP_STRING([--with-piddir=DIR], [Where to put pid files ($ac_default_prefix/var/locks)])],
107 [ case "$withval" in
108   yes|no)
109   #
110   # Just in case anybody calls it without argument
111   #
112     AC_MSG_WARN([--with-piddir called without argument - will use default])
113   ;;
114   * )
115     piddir="$withval"
116     ;;
117   esac])
118
119 #################################################
120 # set ncalrpc directory location
121 AC_ARG_WITH(ncalprcdir,
122 [AS_HELP_STRING([--with-ncalprcdir=DIR], [Where to put ncalrpc sockets ($ac_default_prefix/var/ncalrpc)])],
123 [ case "$withval" in
124   yes|no)
125   #
126   # Just in case anybody calls it without argument
127   #
128     AC_MSG_WARN([--with-ncalrpcdir called without argument - will use default])
129   ;;
130   * )
131     ncalrpcdir="$withval"
132     ;;
133   esac])
134
135 #################################################
136 # set SWAT directory location
137 AC_ARG_WITH(swatdir,
138 [AS_HELP_STRING([--with-swatdir=DIR], [Where to put SWAT files ($ac_default_prefix/swat)])],
139 [ case "$withval" in
140   yes|no)
141   #
142   # Just in case anybody does it
143   #
144     AC_MSG_WARN([--with-swatdir called without argument - will use default])
145   ;;
146   * )
147     swatdir="$withval"
148     ;;
149   esac])
150
151 #################################################
152 # set configuration directory location
153 AC_ARG_WITH(configdir,
154 [AS_HELP_STRING([--with-configdir=DIR], [Where to put configuration files ($libdir)])],
155 [ case "$withval" in
156   yes|no)
157   #
158   # Just in case anybody does it
159   #
160     AC_MSG_WARN([--with-configdir called without argument - will use default])
161   ;;
162   * )
163     configdir="$withval"
164     ;;
165   esac])
166
167 #################################################
168 # set log directory location
169 AC_ARG_WITH(logfilebase,
170 [AS_HELP_STRING([--with-logfilebase=DIR], [Where to put log files ($VARDIR)])],
171 [ case "$withval" in
172   yes|no)
173   #
174   # Just in case anybody does it
175   #
176     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
177   ;;
178   * )
179     logfilebase="$withval"
180     ;;
181   esac])
182
183
184 #################################################
185 # set ctdb source directory location
186 AC_ARG_WITH(ctdb,
187 [AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
188 [ case "$withval" in
189   yes|no)
190     AC_MSG_WARN([--with-ctdb called without argument])
191   ;;
192   * )
193     ctdbdir="$withval"
194     ;;
195   esac])
196
197 #################################################
198 # set shared modules (internal lib) directory location
199 AC_ARG_WITH(modulesdir,
200 [AS_HELP_STRING([--with-modulesdir=DIR], [Where to put shared modules ($libdir)])],
201 [ case "$withval" in
202   yes|no)
203   #
204   # Just in case anybody does it
205   #
206     AC_MSG_WARN([--with-modulesdir without argument - will use default])
207   ;;
208   * )
209     modulesdir="$withval"
210     ;;
211   esac])
212
213 #################################################
214 # set PAM modules directory location
215 AC_ARG_WITH(pammodulesdir,
216 [AS_HELP_STRING([--with-pammodulesdir=DIR], [Which directory to use for PAM modules ($ac_default_prefix/$libdir/security)])],
217 [ case "$withval" in
218   yes|no)
219   #
220   # Just in case anybody calls it without argument
221   #
222     AC_MSG_WARN([--with-pammodulesdir called without argument - will use default])
223   ;;
224   * )
225     pammodulesdir="$withval"
226     ;;
227   esac])
228
229 #################################################
230 # set man directory location
231 AC_ARG_WITH(mandir,
232 [AS_HELP_STRING([--with-mandir=DIR], [Where to put man pages ($mandir)])],
233 [ case "$withval" in
234   yes|no)
235   #
236   # Just in case anybody does it
237   #
238     AC_MSG_WARN([--with-mandir without argument - will use default])
239   ;;
240   * )
241     mandir="$withval"
242     ;;
243   esac])
244
245 AC_SUBST(configdir)
246 AC_SUBST(lockdir)
247 AC_SUBST(piddir)
248 AC_SUBST(ncalrpcdir)
249 AC_SUBST(logfilebase)
250 AC_SUBST(ctdbdir)
251 AC_SUBST(privatedir)
252 AC_SUBST(swatdir)
253 AC_SUBST(bindir)
254 AC_SUBST(sbindir)
255 AC_SUBST(codepagedir)
256 AC_SUBST(statedir)
257 AC_SUBST(cachedir)
258 AC_SUBST(rootsbindir)
259 AC_SUBST(pammodulesdir)
260 AC_SUBST(modulesdir)
261
262 #################################################
263 # set prefix for 'make test'
264 selftest_prefix="./st"
265 AC_SUBST(selftest_prefix)
266 AC_ARG_WITH(selftest-prefix,
267 [AS_HELP_STRING([--with-selftest-prefix=DIR], [The prefix where make test will be run ($selftest_prefix)])],
268 [ case "$withval" in
269   yes|no)
270     AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
271   ;;
272   * )
273     selftest_prefix="$withval"
274     ;;
275   esac
276 ])
277
278 #################################################
279 # set path of samba4's smbtorture
280 smbtorture4_path=""
281 AC_SUBST(smbtorture4_path)
282 AC_ARG_WITH(smbtorture4_path,
283 [AS_HELP_STRING([--with-smbtorture4-path=PATH], [The path to a samba4 smbtorture for make test (none)])],
284 [ case "$withval" in
285   yes|no)
286     AC_MSG_ERROR([--with-smbtorture4-path should take a path])
287   ;;
288   * )
289     smbtorture4_path="$withval"
290     if test -z "$smbtorture4_path" -a ! -f $smbtorture4_path; then
291         AC_MSG_ERROR(['$smbtorture_path' does not  exist!])
292     fi
293   ;;
294  esac
295 ])
296
297 ## check for --enable-debug first before checking CFLAGS before
298 ## so that we don't mix -O and -g
299 debug=no
300 AC_ARG_ENABLE(debug,
301 [AS_HELP_STRING([--enable-debug], [Turn on compiler debugging information (default=no)])],
302     [if eval "test x$enable_debug = xyes"; then
303         debug=yes
304     fi])
305
306 developer=no
307 AC_ARG_ENABLE(developer, [AS_HELP_STRING([--enable-developer], [Turn on developer warnings and debugging (default=no)])],
308     [if eval "test x$enable_developer = xyes"; then
309         debug=yes
310         developer=yes
311     fi])
312
313 krb5developer=no
314 AC_ARG_ENABLE(krb5developer, [AS_HELP_STRING([--enable-krb5developer], [Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)])],
315     [if eval "test x$enable_krb5developer = xyes"; then
316         debug=yes
317         developer=yes
318         krb5_developer=yes
319     fi])
320
321 picky_developer=no
322 AC_ARG_ENABLE(picky-developer, [AS_HELP_STRING([--enable-picky-developer], [Halt compilation on warnings])],
323     [if eval "test x$enable_picky_developer = xyes"; then
324         debug=yes
325         developer=yes
326         picky_developer=yes
327     fi])
328
329 AC_ARG_WITH(cfenc,
330 [AS_HELP_STRING([--with-cfenc=HEADERDIR], [Use internal CoreFoundation encoding API for optimization (Mac OS X/Darwin only)])],
331 [
332 # May be in source $withval/CoreFoundation/StringEncodings.subproj.
333 # Should have been in framework $withval/CoreFoundation.framework/Headers.
334 for d in \
335     $withval/CoreFoundation/StringEncodings.subproj \
336     $withval/StringEncodings.subproj \
337     $withval/CoreFoundation.framework/Headers \
338     $withval/Headers \
339     $withval
340 do
341     if test -r $d/CFStringEncodingConverter.h; then
342         ln -sfh $d include/CoreFoundation
343     fi
344 done
345 ])
346