3c626ee0d0dc501791894495279f029f967bbf91
[samba.git] / source4 / build / m4 / check_path.m4
1 dnl SMB Build Environment Path Checks
2 dnl -------------------------------------------------------
3 dnl  Copyright (C) Stefan (metze) Metzmacher 2004
4 dnl  Released under the GNU GPL
5 dnl -------------------------------------------------------
6 dnl
7
8 #################################################
9 # Directory handling stuff to support both the
10 # legacy SAMBA directories and FHS compliant
11 # ones...
12 AC_PREFIX_DEFAULT(/usr/local/samba)
13
14 AC_ARG_WITH(fhs, 
15 [  --with-fhs              Use FHS-compliant paths (default=no)],
16     configdir="${sysconfdir}/samba"
17     lockdir="\${localstatedir}/cache/samba"
18     piddir="\${localstatedir}/run/samba"
19     logfilebase="\${localstatedir}/log/samba"
20     privatedir="\${CONFIGDIR}/private"
21     libdir="\${prefix}/lib/samba"
22     swatdir="\${datadir}/samba/swat",
23     configdir="\${LIBDIR}"
24     logfilebase="\${localstatedir}"
25     lockdir="\${localstatedir}/locks"
26     piddir="\${localstatedir}/locks"
27     privatedir="\${prefix}/private"
28     swatdir="\${prefix}/swat")
29
30 #################################################
31 # set private directory location
32 AC_ARG_WITH(privatedir,
33 [  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
34 [ case "$withval" in
35   yes|no)
36   #
37   # Just in case anybody calls it without argument
38   #
39     AC_MSG_WARN([--with-privatedir called without argument - will use default])
40   ;;
41   * )
42     privatedir="$withval"
43     ;;
44   esac])
45
46 #################################################
47 # set lock directory location
48 AC_ARG_WITH(lockdir,
49 [  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
50 [ case "$withval" in
51   yes|no)
52   #
53   # Just in case anybody calls it without argument
54   #
55     AC_MSG_WARN([--with-lockdir called without argument - will use default])
56   ;;
57   * )
58     lockdir="$withval"
59     ;;
60   esac])
61
62 #################################################
63 # set pid directory location
64 AC_ARG_WITH(piddir,
65 [  --with-piddir=DIR       Where to put pid files ($ac_default_prefix/var/locks)],
66 [ case "$withval" in
67   yes|no)
68   #
69   # Just in case anybody calls it without argument
70   #
71     AC_MSG_WARN([--with-piddir called without argument - will use default])
72   ;;
73   * )
74     piddir="$withval"
75     ;;
76   esac])
77
78 #################################################
79 # set configuration directory location
80 AC_ARG_WITH(configdir,
81 [  --with-configdir=DIR    Where to put configuration files (\$libdir)],
82 [ case "$withval" in
83   yes|no)
84   #
85   # Just in case anybody does it
86   #
87     AC_MSG_WARN([--with-configdir called without argument - will use default])
88   ;;
89   * )
90     configdir="$withval"
91     ;;
92   esac])
93
94 #################################################
95 # set log directory location
96 AC_ARG_WITH(logfilebase,
97 [  --with-logfilebase=DIR  Where to put log files (\$(VARDIR))],
98 [ case "$withval" in
99   yes|no)
100   #
101   # Just in case anybody does it
102   #
103     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
104   ;;
105   * )
106     logfilebase="$withval"
107     ;;
108   esac])
109
110
111 #################################################
112 # set swat directory location
113 AC_ARG_WITH(swatdir,
114 [  --with-swatdir=DIR    Where to put configuration files (\$swatdir)],
115 [ case "$withval" in
116   yes|no)
117     AC_MSG_WARN([--with-swatdir called without argument - will use default])
118   ;;
119   * )
120     swatdir="$withval"
121     ;;
122   esac])
123
124 AC_SUBST(configdir)
125 AC_SUBST(lockdir)
126 AC_SUBST(piddir)
127 AC_SUBST(logfilebase)
128 AC_SUBST(privatedir)
129 AC_SUBST(bindir)
130 AC_SUBST(sbindir)
131 AC_SUBST(swatdir)
132
133 #################################################
134 # set prefix for 'make test'
135 selftest_prefix="./"
136 AC_SUBST(selftest_prefix)
137 AC_ARG_WITH(selftest-prefix,
138 [  --with-selftest-prefix=DIR    The prefix where make test will be runned (\$selftest_prefix)],
139 [ case "$withval" in
140   yes|no)
141     AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
142   ;;
143   * )
144     selftest_prefix="$withval"
145     ;;
146   esac])
147
148 developer=no
149 AC_SUBST(developer)
150 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
151     [if test x$enable_developer = xyes; then
152         debug=yes
153         developer=yes
154         DEVELOPER_CFLAGS="-DDEBUG_PASSWORD -DDEVELOPER"
155         if test x"$GCC" = x"yes" ; then
156             AX_CFLAGS_GCC_OPTION(-Wall, DEVELOPER_CFLAGS)
157             AX_CFLAGS_GCC_OPTION(-Wshadow, DEVELOPER_CFLAGS)
158             AX_CFLAGS_GCC_OPTION(-Werror-implicit-function-declaration, DEVELOPER_CFLAGS)
159             AX_CFLAGS_GCC_OPTION(-Wstrict-prototypes, DEVELOPER_CFLAGS)
160             AX_CFLAGS_GCC_OPTION(-Wpointer-arith, DEVELOPER_CFLAGS)
161             AX_CFLAGS_GCC_OPTION(-Wcast-qual, DEVELOPER_CFLAGS)
162             AX_CFLAGS_GCC_OPTION(-Wcast-align, DEVELOPER_CFLAGS)
163             AX_CFLAGS_GCC_OPTION(-Wwrite-strings, DEVELOPER_CFLAGS)
164             AX_CFLAGS_GCC_OPTION(-Wmissing-format-attribute, DEVELOPER_CFLAGS)
165             AX_CFLAGS_GCC_OPTION(-Wformat=2, DEVELOPER_CFLAGS)
166             AX_CFLAGS_GCC_OPTION(-Wno-format-y2k, DEVELOPER_CFLAGS)
167             AX_CFLAGS_GCC_OPTION(-Wno-declaration-after-statement, DEVELOPER_CFLAGS)
168         fi
169     fi])
170
171 debug=no
172 AC_ARG_ENABLE(debug, 
173 [  --enable-debug          Turn on compiler debugging information (default=no)],
174     [if test x$enable_debug = xyes -a x$enable_developer != xyes; then
175         debug=yes
176         CFLAGS="${CFLAGS} -g"
177     fi])
178
179
180 experimental=no
181 AC_ARG_ENABLE(experimental, [  --enable-experimental Turn on experimental features (default=no)],
182     [if eval "test x$enable_experimental = xyes"; then
183         experimental=yes
184     fi])
185
186
187 dnl disable these external libs 
188 AC_ARG_WITH(disable-ext-lib,
189 [  --with-disable-ext-lib=LIB Comma-seperated list of external libraries],
190 [ if test $withval; then
191         for i in `echo $withval | sed -e's/,/ /g'`
192         do
193                 eval SMB_EXT_LIB_$i=NO
194         done
195 fi ])
196
197 dnl exclude these modules 
198 AC_ARG_WITH(exclude-modules,
199 [  --with-exclude-modules=MODULES Comma-seperated list of names of modules to exclude from build],
200 [ if test $withval; then
201         for i in `echo $withval | sed -e's/,/ /g'`
202         do
203                 eval SMB_MODULE_$i=NOT
204         done
205 fi ])
206
207 dnl Always built these modules shared
208 AC_ARG_WITH(shared-modules,
209 [  --with-shared-modules=MODULES  Comma-seperated list of names of modules to build shared],
210 [ if test $withval; then
211         for i in `echo $withval | sed -e's/,/ /g'`
212         do
213                 eval SMB_MODULE_$i=SHARED
214         done
215 fi ])
216
217 dnl Always built these modules static
218 AC_ARG_WITH(static-modules,
219 [  --with-static-modules=MODULES  Comma-seperated list of names of modules to statically link in],
220 [ if test $withval; then
221         for i in `echo $withval | sed -e's/,/ /g'`
222         do
223                 eval SMB_MODULE_$i=STATIC
224         done
225 fi ])