r141: A number of changes to get things working on FreeBSD and reduce the breakage
[Samba/gebeck_regimport.git] / source4 / configure.in
blob9531da6f469b693dd36a27d1ec795444093ba592
1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
4 dnl disabled 2.53 requirement - we do work with 2.52 on suse 7.3 for example
5 dnl AC_PREREQ(2.53)
8 AC_INIT(include/includes.h)
9 AC_CONFIG_HEADER(include/config.h)
11 AC_DISABLE_STATIC
12 AC_ENABLE_SHARED
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)
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")
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])
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])
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])
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])
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])
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)
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)
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])
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])
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])
165 sinclude(build/m4/rewrite.m4)
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 ])
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 ])
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 ])
197 sinclude(nsswitch/config.m4)
198 sinclude(lib/popt/config.m4)
199 sinclude(lib/iconv.m4)
200 sinclude(lib/basic.m4)
201 sinclude(lib/ldb/config.m4)
202 sinclude(lib/cmdline/config.m4)
203 sinclude(param/config.m4)
204 sinclude(libcli/config.m4)
205 sinclude(librpc/config.m4)
206 sinclude(libcli/libsmb.m4)
207 sinclude(smbd/process_model.m4)
208 sinclude(smb_server/config.m4)
209 sinclude(auth/config.m4)
210 sinclude(passdb/config.m4)
211 sinclude(ntvfs/config.m4)
212 sinclude(rpc_server/config.m4)
213 sinclude(lib/registry/config.m4)
214 sinclude(torture/config.m4)
216 #######################################
217 # Check for comparison_fn_t
218 AC_CACHE_CHECK([for comparison_fn_t],samba_cv_HAVE_COMPARISON_FN_T,[
219 AC_TRY_COMPILE([
220 #include <stdlib.h>
221 int list_find(const void *needle, 
222               const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn)
224         return 1;
226 ],[],
227 samba_cv_HAVE_COMPARISON_FN_T=yes,samba_cv_HAVE_COMPARISON_FN_T=no)
229 if test x"$samba_cv_HAVE_COMPARISON_FN_T" = x"yes"; then
230         AC_DEFINE(HAVE_COMPARISON_FN_T,1,[Whether or not we have comparison_fn_t])
233 ########################################################
234 # Compile with LDAP support?
236 with_ldap_support=auto
237 AC_MSG_CHECKING([for LDAP support])
239 AC_ARG_WITH(ldap,
240 [  --with-ldap             LDAP support (default yes)],
241 [ case "$withval" in
242     yes|no)
243         with_ldap_support=$withval
244         ;;
245   esac ])
247 AC_MSG_RESULT($with_ldap_support)
249 SMBLDAP=""
250 AC_SUBST(SMBLDAP)
251 if test x"$with_ldap_support" != x"no"; then
253   ##################################################################
254   # first test for ldap.h and lber.h
255   # (ldap.h is required for this test)
256   AC_CHECK_HEADERS(ldap.h lber.h)
257   
258   if test x"$ac_cv_header_ldap_h" != x"yes"; then
259         if test x"$with_ldap_support" = x"yes"; then
260          AC_MSG_ERROR(ldap.h is needed for LDAP support)
261         else
262          AC_MSG_WARN(ldap.h is needed for LDAP support)
263         fi
264         
265         with_ldap_support=no
266   fi
269 if test x"$with_ldap_support" != x"no"; then
270   ac_save_LIBS=$LIBS
272   ##################################################################
273   # we might need the lber lib on some systems. To avoid link errors
274   # this test must be before the libldap test
275   AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf)
277   ########################################################
278   # now see if we can find the ldap libs in standard paths
279   AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
281   AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS)
282   
283   ########################################################
284   # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
285   # Check found in pam_ldap 145.
286   AC_CHECK_FUNC_EXT(ldap_set_rebind_proc,$LDAP_LIBS)
288   LIBS="$LIBS $LDAP_LIBS"
289   AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [
290     AC_TRY_COMPILE([
291         #include <lber.h>
292         #include <ldap.h>], 
293         [ldap_set_rebind_proc(0, 0, 0);], 
294         [smb_ldap_cv_ldap_set_rebind_proc=3], 
295         [smb_ldap_cv_ldap_set_rebind_proc=2]
296     ) 
297   ])
298   
299   AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
301   AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS) 
302   
303   if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes" -a x"$ac_cv_func_ext_ldap_domain2hostlist" = x"yes"; then
304     AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
305     default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
306     SMBLDAP="lib/smbldap.o"
307     with_ldap_support=yes
308     AC_MSG_CHECKING(whether LDAP support is used)
309     AC_MSG_RESULT(yes)
310   else
311     if test x"$with_ldap_support" = x"yes"; then
312         AC_MSG_ERROR(libldap is needed for LDAP support)
313     else
314         AC_MSG_WARN(libldap is needed for LDAP support)
315     fi
316     
317     LDAP_LIBS=""
318     with_ldap_support=no
319   fi
320   LIBS=$ac_save_LIBS
323 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
325 #################################################
326 # do extra things if we are running insure
328 if test "${ac_cv_prog_CC}" = "insure"; then
329         CPPFLAGS="$CPPFLAGS -D__INSURE__"
332 #################################################
333 # final configure stuff
335 AC_MSG_CHECKING([configure summary])
336 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
337            AC_MSG_RESULT(yes),
338            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
339            AC_MSG_WARN([cannot run when cross-compiling]))
341 builddir=`pwd`
342 AC_SUBST(builddir)
344 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
345 LIB_REMOVE_USR_LIB(LDFLAGS)
346 LIB_REMOVE_USR_LIB(LIBS)
348 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
349 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
350 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
352 AC_OUTPUT(Makefile)