r726: fix the build: libcli/raw/clirewrite.o is gone:-)
[ira/wip.git] / source4 / configure.in
1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
3
4 dnl disabled 2.53 requirement - we do work with 2.52 on suse 7.3 for example
5 dnl AC_PREREQ(2.53)
6
7 AC_INIT(include/includes.h)
8 AC_CONFIG_HEADER(include/config.h)
9
10 AC_DISABLE_STATIC
11 AC_ENABLE_SHARED
12
13 SMB_VERSION_STRING=`cat include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
14 echo "SAMBA VERSION: ${SMB_VERSION_STRING}"
15
16 #################################################
17 # Directory handling stuff to support both the
18 # legacy SAMBA directories and FHS compliant
19 # ones...
20 AC_PREFIX_DEFAULT(/usr/local/samba)
21
22 AC_ARG_WITH(fhs, 
23 [  --with-fhs              Use FHS-compliant paths (default=no)],
24     configdir="${sysconfdir}/samba"
25     lockdir="\${VARDIR}/cache/samba"
26     piddir="\${VARDIR}/run/samba"
27     logfilebase="\${VARDIR}/log/samba"
28     privatedir="\${CONFIGDIR}/private"
29     libdir="\${prefix}/lib/samba"
30     swatdir="\${DATADIR}/samba/swat",
31     configdir="\${LIBDIR}"
32     logfilebase="\${VARDIR}"
33     lockdir="\${VARDIR}/locks"
34     piddir="\${VARDIR}/locks"
35     privatedir="\${prefix}/private"
36     swatdir="\${prefix}/swat")
37
38 #################################################
39 # set private directory location
40 AC_ARG_WITH(privatedir,
41 [  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
42 [ case "$withval" in
43   yes|no)
44   #
45   # Just in case anybody calls it without argument
46   #
47     AC_MSG_WARN([--with-privatedir called without argument - will use default])
48   ;;
49   * )
50     privatedir="$withval"
51     ;;
52   esac])
53
54 #################################################
55 # set lock directory location
56 AC_ARG_WITH(lockdir,
57 [  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
58 [ case "$withval" in
59   yes|no)
60   #
61   # Just in case anybody calls it without argument
62   #
63     AC_MSG_WARN([--with-lockdir called without argument - will use default])
64   ;;
65   * )
66     lockdir="$withval"
67     ;;
68   esac])
69
70 #################################################
71 # set pid directory location
72 AC_ARG_WITH(piddir,
73 [  --with-piddir=DIR       Where to put pid files ($ac_default_prefix/var/locks)],
74 [ case "$withval" in
75   yes|no)
76   #
77   # Just in case anybody calls it without argument
78   #
79     AC_MSG_WARN([--with-piddir called without argument - will use default])
80   ;;
81   * )
82     piddir="$withval"
83     ;;
84   esac])
85
86 #################################################
87 # set configuration directory location
88 AC_ARG_WITH(configdir,
89 [  --with-configdir=DIR    Where to put configuration files (\$libdir)],
90 [ case "$withval" in
91   yes|no)
92   #
93   # Just in case anybody does it
94   #
95     AC_MSG_WARN([--with-configdir called without argument - will use default])
96   ;;
97   * )
98     configdir="$withval"
99     ;;
100   esac])
101
102 #################################################
103 # set log directory location
104 AC_ARG_WITH(logfilebase,
105 [  --with-logfilebase=DIR  Where to put log files (\$(VARDIR))],
106 [ case "$withval" in
107   yes|no)
108   #
109   # Just in case anybody does it
110   #
111     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
112   ;;
113   * )
114     logfilebase="$withval"
115     ;;
116   esac])
117
118 AC_SUBST(configdir)
119 AC_SUBST(lockdir)
120 AC_SUBST(piddir)
121 AC_SUBST(logfilebase)
122 AC_SUBST(privatedir)
123 AC_SUBST(bindir)
124 AC_SUBST(sbindir)
125
126 dnl Unique-to-Samba variables we'll be playing with.
127 AC_SUBST(SHELL)
128 AC_SUBST(LDSHFLAGS)
129 AC_SUBST(SONAMEFLAG)
130 AC_SUBST(SHLD)
131 AC_SUBST(HOST_OS)
132 AC_SUBST(PICFLAG)
133 AC_SUBST(PICSUFFIX)
134 AC_SUBST(POBAD_CC)
135 AC_SUBST(SHLIBEXT)
136 AC_SUBST(INSTALLCLIENTCMD_SH)
137 AC_SUBST(INSTALLCLIENTCMD_A)
138 AC_SUBST(LIBSMBCLIENT_SHARED)
139 AC_SUBST(LIBSMBCLIENT)
140 AC_SUBST(PRINTLIBS)
141 AC_SUBST(AUTHLIBS)
142 AC_SUBST(ACLLIBS)
143 AC_SUBST(SHLIB_PROGS)
144 AC_SUBST(SMBWRAPPER)
145 AC_SUBST(EXTRA_BIN_PROGS)
146 AC_SUBST(EXTRA_SBIN_PROGS)
147 AC_SUBST(EXTRA_ALL_TARGETS)
148
149 debug=no
150 AC_ARG_ENABLE(debug, 
151 [  --enable-debug          Turn on compiler debugging information (default=no)],
152     [if eval "test x$enable_debug = xyes"; then
153         debug=yes
154         CFLAGS="${CFLAGS} -gstabs"
155     fi])
156
157 developer=no
158 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
159     [if eval "test x$enable_developer = xyes"; then
160         developer=yes
161         CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
162     fi])
163
164 AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer  Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
165     [if eval "test x$enable_krb5developer = xyes"; then
166         developer=yes
167         CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
168     fi])
169
170 experimental=no
171 AC_ARG_ENABLE(experimental, [  --enable-experimental Turn on experimental features (default=no)],
172     [if eval "test x$enable_experimental = xyes"; then
173         experimental=yes
174     fi])
175
176 sinclude(build/m4/rewrite.m4)
177
178 dnl exclude these modules 
179 AC_ARG_WITH(exclude-modules,
180 [  --with-exclude-modules=MODULES Comma-seperated list of names of modules to exclude from build],
181 [ if test $withval; then
182         for i in `echo $withval | sed -e's/,/ /g'`
183         do
184                 eval SMB_MODULE_$i=NOT
185         done
186 fi ])
187
188 dnl Always built these modules shared
189 AC_ARG_WITH(shared-modules,
190 [  --with-shared-modules=MODULES  Comma-seperated list of names of modules to build shared],
191 [ if test $withval; then
192         for i in `echo $withval | sed -e's/,/ /g'`
193         do
194                 eval SMB_MODULE_$i=SHARED
195         done
196 fi ])
197
198 dnl Always built these modules static
199 AC_ARG_WITH(static-modules,
200 [  --with-static-modules=MODULES  Comma-seperated list of names of modules to statically link in],
201 [ if test $withval; then
202         for i in `echo $withval | sed -e's/,/ /g'`
203         do
204                 eval SMB_MODULE_$i=STATIC
205         done
206 fi ])
207
208 sinclude(nsswitch/config.m4)
209 sinclude(lib/popt/config.m4)
210 sinclude(lib/iconv.m4)
211 sinclude(lib/basic.m4)
212 sinclude(lib/ldb/config.m4)
213 sinclude(lib/cmdline/config.m4)
214 sinclude(param/config.m4)
215 sinclude(libcli/config.m4)
216 sinclude(librpc/config.m4)
217 sinclude(libcli/libsmb.m4)
218 sinclude(smbd/process_model.m4)
219 sinclude(smb_server/config.m4)
220 sinclude(auth/config.m4)
221 sinclude(ntvfs/config.m4)
222 sinclude(rpc_server/config.m4)
223 sinclude(lib/registry/config.m4)
224 sinclude(torture/config.m4)
225 sinclude(scripting/config.m4)
226
227 ALLLIBS_LIBS="$LIBS"
228 ALLLIBS_CFLAGS="$CFLAGS"
229 ALLLIBS_CPPFLAGS="$CPPFLAGS"
230 ALLLIBS_LDFLAGS="$LDFLAGS"
231
232 SMB_EXT_LIB_ENABLE(ALLLIBS,YES)
233
234 SMB_EXT_LIB(ALLLIBS,
235                 [${ALLLIBS_LIBS}],
236                 [${ALLLIBS_CFLAGS}],
237                 [${ALLLIBS_CPPFLAGS}],
238                 [${ALLLIBS_LDFLAGS}])
239
240 SMB_BINARY(smbd, [ALL], [SBIN],
241         [smbd/server.o
242         smbd/process.o
243         lib/server_mutex.o
244         smbd/build_options.o
245         smbd/rewrite.o],
246         [],
247         [PROCESS_MODEL SMB AUTH NTVFS DCERPC LIBBASIC CONFIG LIBCMDLINE LIBSMB REGISTRY])
248
249 SMB_BINARY(smbclient, [ALL], [BIN], 
250         [client/client.o
251         client/clitar.o],
252         [],
253         [LIBSMB CONFIG LIBBASIC LIBCMDLINE])
254
255 SMB_BINARY(ndrdump, [ALL], [BIN],
256         [utils/ndrdump.o],
257         [],
258         [LIBSMB CONFIG LIBBASIC LIBCMDLINE])
259
260 SMB_BINARY(gentest, [ALL], [BIN],
261         [torture/gentest.o
262         torture/torture_util.o],
263         [],
264         [LIBSMB CONFIG LIBBASIC LIBCMDLINE])
265
266 SMB_BINARY(masktest, [ALL], [BIN], 
267         [torture/masktest.o],
268         [],
269         [LIBSMB CONFIG LIBBASIC LIBCMDLINE])
270
271 SMB_BINARY(locktest, [ALL], [BIN],
272         [torture/locktest.o],
273         [],
274         [LIBSMB CONFIG LIBBASIC LIBCMDLINE])
275
276 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
277
278 #################################################
279 # do extra things if we are running insure
280
281 if test "${ac_cv_prog_CC}" = "insure"; then
282         CPPFLAGS="$CPPFLAGS -D__INSURE__"
283 fi
284
285 #################################################
286 # final configure stuff
287
288 AC_MSG_CHECKING([configure summary])
289 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
290            AC_MSG_RESULT(yes),
291            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
292            AC_MSG_WARN([cannot run when cross-compiling]))
293
294 builddir=`pwd`
295 AC_SUBST(builddir)
296
297 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
298 LIB_REMOVE_USR_LIB(LDFLAGS)
299 LIB_REMOVE_USR_LIB(LIBS)
300
301 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
302 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
303 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
304
305 SMB_AC_OUTPUT(Makefile)