Fix installation of dcerpc_atsvc and registry as required by samba-gtk.
[jelmer/samba4-debian.git] / source / configure.ac
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([samba],[4],[samba-technical@samba.org])
8
9 AC_CONFIG_SRCDIR([include/includes.h])
10 AC_CONFIG_HEADER(include/config_tmp.h)
11 AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h])
12
13 # Configuration rules.
14 m4_include(build/m4/env.m4)
15 m4_include(lib/replace/samba.m4)
16 m4_include(lib/smbreadline/readline.m4)
17 m4_include(heimdal_build/config.m4)
18 m4_include(lib/util/fault.m4)
19 m4_include(lib/util/signal.m4)
20 m4_include(lib/util/util.m4)
21 m4_include(lib/util/fsusage.m4)
22 m4_include(lib/util/xattr.m4)
23 m4_include(lib/util/capability.m4)
24 m4_include(lib/util/time.m4)
25 m4_include(lib/popt/samba.m4)
26 m4_include(lib/charset/config.m4)
27 m4_include(lib/socket/config.m4)
28 m4_include(nsswitch/nsstest.m4)
29
30 AC_CONFIG_FILES(lib/registry/registry.pc)
31 AC_CONFIG_FILES(librpc/dcerpc.pc)
32 AC_CONFIG_FILES(librpc/ndr.pc)
33 AC_CONFIG_FILES(torture/torture.pc)
34 AC_CONFIG_FILES(auth/gensec/gensec.pc)
35 AC_CONFIG_FILES(param/samba-hostconfig.pc)
36 AC_CONFIG_FILES(librpc/dcerpc_samr.pc)
37 AC_CONFIG_FILES(librpc/dcerpc_atsvc.pc)
38
39 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.2.0,
40         [],
41         [
42                 m4_include(lib/talloc/libtalloc.m4)
43                 SMB_INCLUDE_MK(lib/talloc/config.mk)
44         ]
45 )
46
47 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= 1.1.0,
48         [],
49         [
50                 m4_include(lib/tdb/libtdb.m4)
51                 SMB_INCLUDE_MK(lib/tdb/config.mk)
52         ]
53 )
54
55 SMB_INCLUDE_MK(lib/tdb/python.mk) 
56
57 SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb >= 0.9.1,
58         [
59                 SMB_INCLUDE_MK(lib/ldb/ldb_ildap/config.mk)
60                 SMB_INCLUDE_MK(lib/ldb/tools/config.mk)
61                 SMB_SUBSYSTEM(ldb_map, [], [LIBLDB])
62                 define_ldb_modulesdir=no
63         ],
64         [
65                 # Here we need to do some tricks
66                 # with AC_CONFIG_COMMANDS_PRE
67                 # as that's the deferrs the commands
68                 # to location after $prefix and $exec_prefix
69                 # have usefull values and directly before
70                 # creating config.status.
71                 #
72                 # The 'eval eval echo' trick is used to
73                 # actually get the raw absolute directory
74                 # path as this is needed in config.h
75                 define_ldb_modulesdir=yes
76                 AC_CONFIG_COMMANDS_PRE([
77                 if test x"$define_ldb_modulesdir" = x"yes";then
78                         LDB_MODULESDIR=`eval eval echo ${modulesdir}/ldb`
79                         AC_DEFINE_UNQUOTED(LDB_MODULESDIR, "${LDB_MODULESDIR}" , [ldb Modules directory])
80                 fi
81                 ])
82                 ldbdir=lib/ldb
83                 AC_SUBST(ldbdir)
84                 m4_include(lib/ldb/sqlite3.m4)
85                 m4_include(lib/ldb/libldb.m4)
86                 SMB_INCLUDE_MK(lib/ldb/config.mk)
87                 AC_CONFIG_FILES(lib/ldb/ldb.pc)
88         ]
89 )
90 SMB_INCLUDE_MK(lib/ldb/python.mk) 
91
92 m4_include(lib/tls/config.m4)
93 m4_include(lib/events/config.m4)
94
95 dnl m4_include(auth/kerberos/config.m4)
96 m4_include(scripting/python/config.m4)
97 m4_include(auth/gensec/config.m4)
98 m4_include(smbd/process_model.m4)
99 m4_include(ntvfs/posix/config.m4)
100 m4_include(ntvfs/unixuid/config.m4)
101 m4_include(lib/socket_wrapper/config.m4)
102 m4_include(lib/nss_wrapper/config.m4)
103 m4_include(auth/config.m4)
104 m4_include(kdc/config.m4)
105 m4_include(ntvfs/sysdep/config.m4)
106 m4_include(lib/appweb/config.m4)
107 m4_include(nsswitch/config.m4)
108
109 #################################################
110 # add *_CFLAGS only for the real build
111 CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
112
113 #################################################
114 # final configure stuff
115
116 AC_MSG_CHECKING([configure summary])
117 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
118            AC_MSG_RESULT(yes),
119            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
120            AC_MSG_WARN([cannot run when cross-compiling]))
121
122 LIBS=`echo $LIBS | sed -e 's/ *//g'`
123 if test x"$LIBS" != x""; then
124         echo "LIBS: $LIBS"
125         AC_MSG_WARN([the global \$LIBS variable contains some libraries!])
126         AC_MSG_WARN([this should not happen, please report to samba-technical@lists.samba.org!])
127         AC_MSG_ERROR([only _EXT macros from aclocal.m4 should be used!])
128 fi
129
130 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
131 LIB_REMOVE_USR_LIB(LDFLAGS)
132 LIB_REMOVE_USR_LIB(LIBS)
133
134 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
135 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
136 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
137
138 AC_SUBST(ac_default_prefix)
139
140 for d in build/smb_build bin include ; do
141     test -d ${builddir}/$d || AS_MKDIR_P(${builddir}/$d)
142 done
143
144 AC_SUBST(INTERN_LDFLAGS)
145 AC_SUBST(INSTALL_LINK_FLAGS)
146 if test $USESHARED = "true";
147 then
148         INTERN_LDFLAGS="-L\${builddir}/bin/shared -L\${builddir}/bin/static"
149         INSTALL_LINK_FLAGS="-Wl,-rpath-link,\${builddir}/bin/shared";
150 else
151         INTERN_LDFLAGS="-L\${builddir}/bin/static -L\${builddir}/bin/shared"
152 fi
153
154 builddir_headers=""
155         
156 if test "x$ac_abs_srcdir" != "x$ac_abs_builddir"
157 then
158         builddir_headers="-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib ";
159 fi
160
161 CPPFLAGS="$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $CPPFLAGS"
162
163 echo "configure: creating build/smb_build/config.pm"
164 cat >build/smb_build/config.pm<<CEOF
165 # config.pm - Autogenerate by configure. DO NOT EDIT!
166
167 package config;
168 require Exporter;
169 @ISA = qw(Exporter);
170 @EXPORT_OK = qw(%enabled %config);
171 use strict;
172
173 use vars qw(%enabled %config);
174
175 %config = (AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
176         AC_Var => '$AC_Var',])
177 );
178
179 $SMB_INFO_ENABLES
180 1;
181 CEOF
182
183 echo "configure: creating config.mk"
184 cat >config.mk<<CEOF
185 # config.mk - Autogenerated by configure, DO NOT EDIT!
186 $SMB_INFO_EXT_LIBS
187 $SMB_INFO_SUBSYSTEMS
188 $SMB_INFO_LIBRARIES
189 CEOF
190
191 AC_OUTPUT_COMMANDS(
192 [
193 test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && (
194         cd $builddir;
195         # NOTE: We *must* use -R so we don't follow symlinks (at least on BSD
196         # systems).
197         test -d heimdal || cp -R $srcdir/heimdal $builddir/
198         test -d heimdal_build || cp -R $srcdir/heimdal_build $builddir/
199         test -d build || builddir="$builddir" \
200                         srcdir="$srcdir" \
201                         $PERL ${srcdir}/script/buildtree.pl
202  )
203
204 $PERL -I${builddir} -I${builddir}/build \
205     -I${srcdir} -I${srcdir}/build \
206     ${srcdir}/build/smb_build/main.pl || exit $?
207 ],
208 [
209 srcdir="$srcdir"
210 builddir="$builddir"
211 PERL="$PERL"
212
213 export PERL
214 export srcdir
215 export builddir
216 ])
217 AC_OUTPUT
218
219 cmp include/config_tmp.h include/config.h >/dev/null 2>&1
220 CMP_RET=$?
221 if test $CMP_RET != 0; then
222         cp include/config_tmp.h include/config.h
223 fi
224
225 echo "configure: creating mkconfig.mk"
226 cat >mkconfig.mk<<CEOF
227 # mkconfig.mk - Autogenerated by configure, DO NOT EDIT!
228 AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
229 AC_Var = $AC_Var])
230 $MAKE_SETTINGS
231 CEOF
232
233 if test $USESHARED = true
234 then
235         echo "To run binaries without installing, set the following environment variable:"
236         echo "$ac_cv_LIB_PATH_VAR=$builddir/bin/shared"
237 fi
238
239 echo
240 echo "To build Samba, run $ac_cv_path_MAKE"