1dnl
2dnl Samba3 build environment path checks
3dnl
4dnl Copyright (C) Michael Adam 2008
5dnl
6dnl Released under the GNU General Public License
7dnl http://www.gnu.org/licenses/
8dnl
9
10AC_LIBREPLACE_LOCATION_CHECKS
11
12#################################################
13# Directory handling stuff to support both the
14# legacy SAMBA directories and FHS compliant
15# ones...
16AC_PREFIX_DEFAULT(/usr/local/samba)
17
18rootsbindir="\${SBINDIR}"
19lockdir="\${VARDIR}/locks"
20piddir="\${VARDIR}/locks"
21ncalrpcdir="\${VARDIR}/ncalrpc"
22test "${mandir}" || mandir="\${prefix}/man"
23logfilebase="\${VARDIR}"
24privatedir="\${prefix}/private"
25test "${libdir}" || libdir="\${prefix}/lib"
26modulesdir="${libdir}"
27pammodulesdir="${libdir}/security"
28configdir="${libdir}"
29swatdir="\${prefix}/swat"
30codepagedir="\${MODULESDIR}"
31statedir="\${LOCKDIR}"
32cachedir="\${LOCKDIR}"
33localedir="\${prefix}/share/locale"
34
35AC_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
58AC_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
74AC_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
90AC_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
106AC_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
122AC_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
138AC_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
154AC_ARG_WITH(ncalrpcdir,
155[AS_HELP_STRING([--with-ncalrpcdir=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
170AC_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
186AC_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
202AC_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 shared modules (internal lib) directory location
219AC_ARG_WITH(modulesdir,
220[AS_HELP_STRING([--with-modulesdir=DIR], [Where to put shared modules ($libdir)])],
221[ case "$withval" in
222  yes|no)
223  #
224  # Just in case anybody does it
225  #
226    AC_MSG_WARN([--with-modulesdir without argument - will use default])
227  ;;
228  * )
229    modulesdir="$withval"
230    ;;
231  esac])
232
233#################################################
234# set PAM modules directory location
235AC_ARG_WITH(pammodulesdir,
236[AS_HELP_STRING([--with-pammodulesdir=DIR], [Which directory to use for PAM modules ($ac_default_prefix/$libdir/security)])],
237[ case "$withval" in
238  yes|no)
239  #
240  # Just in case anybody calls it without argument
241  #
242    AC_MSG_WARN([--with-pammodulesdir called without argument - will use default])
243  ;;
244  * )
245    pammodulesdir="$withval"
246    ;;
247  esac])
248
249#################################################
250# set man directory location
251AC_ARG_WITH(mandir,
252[AS_HELP_STRING([--with-mandir=DIR], [Where to put man pages ($mandir)])],
253[ case "$withval" in
254  yes|no)
255  #
256  # Just in case anybody does it
257  #
258    AC_MSG_WARN([--with-mandir without argument - will use default])
259  ;;
260  * )
261    mandir="$withval"
262    ;;
263  esac])
264
265################################################
266# set locale directory location
267AC_ARG_WITH(localedir,
268[AS_HELP_STRING([--with-localedir=DIR],[Where to put po files ($ac_default_prefix/share/locale)])],
269[ case "$withval" in
270  yes|no)
271    #
272    # Just in case anybody does it
273    #
274    AC_MSG_WARN([--with-localedir called without argument - will use default])
275  ;;
276  *)
277  localedir="$withval"
278  ;;
279  esac])
280
281#################################################
282# set codepage directory location
283AC_ARG_WITH(codepagedir,
284[AS_HELP_STRING([--with-codepagedir=DIR], [Where to put codepages ($ac_default_prefix/lib/samba)])],
285[ case "$withval" in
286  yes|no)
287  #
288  # Just in case anybody calls it without argument
289  #
290    AC_MSG_WARN([--with-codepagedir called without argument - will use default])
291  ;;
292  * )
293    codepagedir="$withval"
294    ;;
295  esac])
296
297
298AC_SUBST(configdir)
299AC_SUBST(lockdir)
300AC_SUBST(piddir)
301AC_SUBST(ncalrpcdir)
302AC_SUBST(logfilebase)
303AC_SUBST(privatedir)
304AC_SUBST(swatdir)
305AC_SUBST(bindir)
306AC_SUBST(sbindir)
307AC_SUBST(codepagedir)
308AC_SUBST(statedir)
309AC_SUBST(cachedir)
310AC_SUBST(rootsbindir)
311AC_SUBST(pammodulesdir)
312AC_SUBST(modulesdir)
313AC_SUBST(localedir)
314
315#################################################
316# set prefix for 'make test'
317selftest_prefix="./st"
318AC_SUBST(selftest_prefix)
319AC_ARG_WITH(selftest-prefix,
320[AS_HELP_STRING([--with-selftest-prefix=DIR], [The prefix where make test will be run ($selftest_prefix)])],
321[ case "$withval" in
322  yes|no)
323    AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
324  ;;
325  * )
326    selftest_prefix="$withval"
327    ;;
328  esac
329])
330
331#################################################
332# set shrdir for 'make test'
333selftest_shrdir=""
334AC_SUBST(selftest_shrdir)
335AC_ARG_WITH(selftest-shrdir,
336[AS_HELP_STRING([--with-selftest-shrdir=DIR], [The share directory that make test will be run against ($selftest_shrdir)])],
337[ case "$withval" in
338  yes|no)
339    AC_MSG_WARN([--with-selftest-shrdir called without argument - will use default])
340  ;;
341  * )
342    selftest_shrdir="-s $withval"
343    ;;
344  esac
345])
346
347#################################################
348# set path of samba4's smbtorture
349smbtorture4_path=""
350AC_SUBST(smbtorture4_path)
351smbtorture4_option=""
352AC_SUBST(smbtorture4_option)
353AC_ARG_WITH(smbtorture4_path,
354[AS_HELP_STRING([--with-smbtorture4-path=PATH], [The path to a samba4 smbtorture for make test (none)])],
355[ case "$withval" in
356  yes|no)
357    AC_MSG_ERROR([--with-smbtorture4-path should take a path])
358  ;;
359  * )
360    smbtorture4_path="$withval"
361    if test -z "$smbtorture4_path" -a ! -f $smbtorture4_path; then
362    	AC_MSG_ERROR(['$smbtorture_path' does not  exist!])
363    fi
364    smbtorture4_option="-t $withval"
365  ;;
366 esac
367])
368
369#################################################
370# set custom conf for make test
371selftest_custom_conf=""
372AC_SUBST(selftest_custom_conf)
373AC_ARG_WITH(selftest_custom_conf,
374[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)])],
375[ case "$withval" in
376  yes|no)
377    AC_MSG_ERROR([--with-selftest-custom-conf should take a path])
378  ;;
379  * )
380    selftest_custom_conf="$withval"
381    if test -z "$selftest_custom_conf" -a ! -f $selftest_custom_conf; then
382	AC_MSG_ERROR(['$selftest_custom_conf' does not  exist!])
383    fi
384    selftest_custom_conf="-c $withval"
385  ;;
386 esac
387])
388
389## check for --enable-debug first before checking CFLAGS before
390## so that we don't mix -O and -g
391debug=no
392AC_ARG_ENABLE(debug,
393[AS_HELP_STRING([--enable-debug], [Turn on compiler debugging information (default=no)])],
394    [if eval "test x$enable_debug = xyes"; then
395	debug=yes
396    fi])
397
398AC_SUBST(developer)
399developer=no
400AC_ARG_ENABLE(developer, [AS_HELP_STRING([--enable-developer], [Turn on developer warnings and debugging (default=no)])],
401    [if eval "test x$enable_developer = xyes"; then
402        debug=yes
403        developer=yes
404    fi])
405
406krb5developer=no
407AC_ARG_ENABLE(krb5developer, [AS_HELP_STRING([--enable-krb5developer], [Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)])],
408    [if eval "test x$enable_krb5developer = xyes"; then
409        debug=yes
410        developer=yes
411	krb5_developer=yes
412    fi])
413
414picky_developer=no
415AC_ARG_ENABLE(picky-developer, [AS_HELP_STRING([--enable-picky-developer], [Halt compilation on warnings])],
416    [if eval "test x$enable_picky_developer = xyes"; then
417        debug=yes
418        developer=yes
419        picky_developer=yes
420    fi])
421
422AC_ARG_WITH(cfenc,
423[AS_HELP_STRING([--with-cfenc=HEADERDIR], [Use internal CoreFoundation encoding API for optimization (Mac OS X/Darwin only)])],
424[
425# May be in source $withval/CoreFoundation/StringEncodings.subproj.
426# Should have been in framework $withval/CoreFoundation.framework/Headers.
427for d in \
428    $withval/CoreFoundation/StringEncodings.subproj \
429    $withval/StringEncodings.subproj \
430    $withval/CoreFoundation.framework/Headers \
431    $withval/Headers \
432    $withval
433do
434    if test -r $d/CFStringEncodingConverter.h; then
435        ln -sfh $d include/CoreFoundation
436    fi
437done
438])
439
440