7539da429014d1d8b3d18813addd481e58d2527e
[ira/wip.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 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} -g"
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} -g -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} -g -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 SMB_INCLUDE_M4(lib/popt/config.m4)
209 SMB_INCLUDE_M4(lib/iconv.m4)
210 SMB_INCLUDE_M4(lib/basic.m4)
211 SMB_INCLUDE_M4(lib/tdb/config.m4)
212 SMB_INCLUDE_M4(lib/ldb/config.m4)
213 SMB_INCLUDE_M4(lib/cmdline/config.m4)
214 SMB_INCLUDE_M4(param/config.m4)
215 SMB_INCLUDE_M4(libcli/config.m4)
216 SMB_INCLUDE_M4(librpc/config.m4)
217 SMB_INCLUDE_M4(libcli/libsmb.m4)
218 SMB_INCLUDE_M4(smbd/process_model.m4)
219 SMB_INCLUDE_M4(smb_server/config.m4)
220 SMB_INCLUDE_M4(auth/config.m4)
221 SMB_INCLUDE_M4(ntvfs/config.m4)
222 SMB_INCLUDE_M4(rpc_server/config.m4)
223 SMB_INCLUDE_M4(lib/registry/config.m4)
224 SMB_INCLUDE_M4(torture/config.m4)
225 SMB_INCLUDE_M4(scripting/config.m4)
226 SMB_INCLUDE_M4(client/config.m4)
227 SMB_INCLUDE_M4(utils/config.m4)
228 SMB_INCLUDE_M4(smbd/config.m4)
229
230 ALLLIBS_LIBS="$LIBS"
231 ALLLIBS_CFLAGS="$CFLAGS"
232 ALLLIBS_CPPFLAGS="$CPPFLAGS"
233 ALLLIBS_LDFLAGS="$LDFLAGS"
234
235 SMB_EXT_LIB_ENABLE(ALLLIBS,YES)
236
237 SMB_EXT_LIB(ALLLIBS,
238                 [${ALLLIBS_LIBS}],
239                 [${ALLLIBS_CFLAGS}],
240                 [${ALLLIBS_CPPFLAGS}],
241                 [${ALLLIBS_LDFLAGS}])
242
243 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
244
245 #################################################
246 # do extra things if we are running insure
247
248 if test "${ac_cv_prog_CC}" = "insure"; then
249         CPPFLAGS="$CPPFLAGS -D__INSURE__"
250 fi
251
252 #################################################
253 # final configure stuff
254
255 AC_MSG_CHECKING([configure summary])
256 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
257            AC_MSG_RESULT(yes),
258            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
259            AC_MSG_WARN([cannot run when cross-compiling]))
260
261 builddir=`pwd`
262 AC_SUBST(builddir)
263
264 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
265 LIB_REMOVE_USR_LIB(LDFLAGS)
266 LIB_REMOVE_USR_LIB(LIBS)
267
268 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
269 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
270 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
271
272 SMB_AC_OUTPUT(Makefile)