r20: Add the registry library. Still needs a lot of work,
[samba.git] / source / 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
8 AC_INIT(include/includes.h)
9 AC_CONFIG_HEADER(include/config.h)
10
11 AC_DISABLE_STATIC
12 AC_ENABLE_SHARED
13
14 #################################################
15 # Directory handling stuff to support both the
16 # legacy SAMBA directories and FHS compliant
17 # ones...
18 AC_PREFIX_DEFAULT(/usr/local/samba)
19
20 AC_ARG_WITH(fhs, 
21 [  --with-fhs              Use FHS-compliant paths (default=no)],
22     configdir="${sysconfdir}/samba"
23     lockdir="\${VARDIR}/cache/samba"
24     piddir="\${VARDIR}/run/samba"
25     logfilebase="\${VARDIR}/log/samba"
26     privatedir="\${CONFIGDIR}/private"
27     libdir="\${prefix}/lib/samba"
28     swatdir="\${DATADIR}/samba/swat",
29     configdir="\${LIBDIR}"
30     logfilebase="\${VARDIR}"
31     lockdir="\${VARDIR}/locks"
32     piddir="\${VARDIR}/locks"
33     privatedir="\${prefix}/private"
34     swatdir="\${prefix}/swat")
35
36 #################################################
37 # set private directory location
38 AC_ARG_WITH(privatedir,
39 [  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
40 [ case "$withval" in
41   yes|no)
42   #
43   # Just in case anybody calls it without argument
44   #
45     AC_MSG_WARN([--with-privatedir called without argument - will use default])
46   ;;
47   * )
48     privatedir="$withval"
49     ;;
50   esac])
51
52 #################################################
53 # set lock directory location
54 AC_ARG_WITH(lockdir,
55 [  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
56 [ case "$withval" in
57   yes|no)
58   #
59   # Just in case anybody calls it without argument
60   #
61     AC_MSG_WARN([--with-lockdir called without argument - will use default])
62   ;;
63   * )
64     lockdir="$withval"
65     ;;
66   esac])
67
68 #################################################
69 # set pid directory location
70 AC_ARG_WITH(piddir,
71 [  --with-piddir=DIR       Where to put pid files ($ac_default_prefix/var/locks)],
72 [ case "$withval" in
73   yes|no)
74   #
75   # Just in case anybody calls it without argument
76   #
77     AC_MSG_WARN([--with-piddir called without argument - will use default])
78   ;;
79   * )
80     piddir="$withval"
81     ;;
82   esac])
83
84 #################################################
85 # set configuration directory location
86 AC_ARG_WITH(configdir,
87 [  --with-configdir=DIR    Where to put configuration files (\$libdir)],
88 [ case "$withval" in
89   yes|no)
90   #
91   # Just in case anybody does it
92   #
93     AC_MSG_WARN([--with-configdir called without argument - will use default])
94   ;;
95   * )
96     configdir="$withval"
97     ;;
98   esac])
99
100 #################################################
101 # set log directory location
102 AC_ARG_WITH(logfilebase,
103 [  --with-logfilebase=DIR  Where to put log files (\$(VARDIR))],
104 [ case "$withval" in
105   yes|no)
106   #
107   # Just in case anybody does it
108   #
109     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
110   ;;
111   * )
112     logfilebase="$withval"
113     ;;
114   esac])
115
116 AC_SUBST(configdir)
117 AC_SUBST(lockdir)
118 AC_SUBST(piddir)
119 AC_SUBST(logfilebase)
120 AC_SUBST(privatedir)
121 AC_SUBST(bindir)
122 AC_SUBST(sbindir)
123
124 dnl Unique-to-Samba variables we'll be playing with.
125 AC_SUBST(SHELL)
126 AC_SUBST(LDSHFLAGS)
127 AC_SUBST(SONAMEFLAG)
128 AC_SUBST(SHLD)
129 AC_SUBST(HOST_OS)
130 AC_SUBST(PICFLAG)
131 AC_SUBST(PICSUFFIX)
132 AC_SUBST(POBAD_CC)
133 AC_SUBST(SHLIBEXT)
134 AC_SUBST(INSTALLCLIENTCMD_SH)
135 AC_SUBST(INSTALLCLIENTCMD_A)
136 AC_SUBST(LIBSMBCLIENT_SHARED)
137 AC_SUBST(LIBSMBCLIENT)
138 AC_SUBST(PRINTLIBS)
139 AC_SUBST(AUTHLIBS)
140 AC_SUBST(ACLLIBS)
141 AC_SUBST(SHLIB_PROGS)
142 AC_SUBST(SMBWRAPPER)
143 AC_SUBST(EXTRA_BIN_PROGS)
144 AC_SUBST(EXTRA_SBIN_PROGS)
145 AC_SUBST(EXTRA_ALL_TARGETS)
146
147 AC_ARG_ENABLE(debug, 
148 [  --enable-debug          Turn on compiler debugging information (default=no)],
149     [if eval "test x$enable_debug = xyes"; then
150         CFLAGS="${CFLAGS} -gstabs"
151     fi])
152
153 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
154     [if eval "test x$enable_developer = xyes"; then
155         developer=yes
156         CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
157     fi])
158
159 AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer  Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
160     [if eval "test x$enable_krb5developer = xyes"; then
161         developer=yes
162         CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
163     fi])
164
165 sinclude(build/m4/rewrite.m4)
166
167 dnl exclude these modules 
168 AC_ARG_WITH(exclude-modules,
169 [  --with-exclude-modules=MODULES Comma-seperated list of names of modules to exclude from build],
170 [ if test $withval; then
171         for i in `echo $withval | sed -e's/,/ /g'`
172         do
173                 eval MODULE_$i=NOT
174         done
175 fi ])
176
177 dnl Always built these modules shared
178 AC_ARG_WITH(shared-modules,
179 [  --with-shared-modules=MODULES  Comma-seperated list of names of modules to build shared],
180 [ if test $withval; then
181         for i in `echo $withval | sed -e's/,/ /g'`
182         do
183                 eval MODULE_$i=SHARED
184         done
185 fi ])
186
187 dnl Always built these modules static
188 AC_ARG_WITH(static-modules,
189 [  --with-static-modules=MODULES  Comma-seperated list of names of modules to statically link in],
190 [ if test $withval; then
191         for i in `echo $withval | sed -e's/,/ /g'`
192         do
193                 eval MODULE_$i=STATIC
194         done
195 fi ])
196
197 sinclude(nsswitch/config.m4)
198 sinclude(lib/popt/config.m4)
199 sinclude(lib/iconv.m4)
200 sinclude(lib/basic.m4)
201 sinclude(lib/cmdline/config.m4)
202 sinclude(param/config.m4)
203 sinclude(libcli/config.m4)
204 sinclude(librpc/config.m4)
205 sinclude(libcli/libsmb.m4)
206 sinclude(smbd/process_model.m4)
207 sinclude(smb_server/config.m4)
208 sinclude(auth/config.m4)
209 sinclude(passdb/config.m4)
210 sinclude(ntvfs/config.m4)
211 sinclude(rpc_server/config.m4)
212 sinclude(lib/registry/config.m4)
213 sinclude(torture/config.m4)
214
215 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
216
217 #################################################
218 # do extra things if we are running insure
219
220 if test "${ac_cv_prog_CC}" = "insure"; then
221         CPPFLAGS="$CPPFLAGS -D__INSURE__"
222 fi
223
224 #################################################
225 # final configure stuff
226
227 AC_MSG_CHECKING([configure summary])
228 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
229            AC_MSG_RESULT(yes),
230            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
231            AC_MSG_WARN([cannot run when cross-compiling]))
232
233 builddir=`pwd`
234 AC_SUBST(builddir)
235
236 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
237 LIB_REMOVE_USR_LIB(LDFLAGS)
238 LIB_REMOVE_USR_LIB(LIBS)
239
240 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
241 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
242 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
243
244 AC_OUTPUT(Makefile)