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