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