s3: Remove some pointless uses of string_sid_talloc
[ira/wip.git] / source3 / samba4.m4
1 AC_SUBST(BLDSHARED)
2 smbtorture4_path="bin/smbtorture4"
3 smbtorture4_option="-t bin/smbtorture4"
4 m4_include(build/m4/public.m4)
5
6 m4_include(../m4/check_python.m4)
7
8 AC_SAMBA_PYTHON_DEVEL([
9 SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS])
10 SMB_ENABLE(EXT_LIB_PYTHON,YES)
11 SMB_ENABLE(LIBPYTHON,YES)
12 ],[
13 AC_MSG_ERROR([Python not found. Please install Python 2.x and its development headers/libraries.])
14 ])
15
16 AC_MSG_CHECKING(python library directory)
17 pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1, 0, '\\${prefix}')"`
18 AC_MSG_RESULT($pythondir)
19
20 AC_SUBST(pythondir)
21
22 SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL} ${CRYPT_LIBS}])
23 SMB_ENABLE(LIBREPLACE_EXT)
24
25 SMB_EXT_LIB(LIBREPLACE_NETWORK, [${LIBREPLACE_NETWORK_LIBS}])
26 SMB_ENABLE(LIBREPLACE_NETWORK)
27
28 SMB_SUBSYSTEM(LIBREPLACE,
29         [${LIBREPLACE_OBJS}],
30         [LIBREPLACE_EXT LIBREPLACE_NETWORK],
31         [-I../lib/replace])
32
33 LIBREPLACE_HOSTCC_OBJS=`echo ${LIBREPLACE_OBJS} |sed -e 's/\.o/\.ho/g'`
34
35 SMB_SUBSYSTEM(LIBREPLACE_HOSTCC,
36         [${LIBREPLACE_HOSTCC_OBJS}],
37         [],
38         [-I../lib/replace])
39
40 m4_include(lib/smbreadline/readline.m4)
41 m4_include(heimdal_build/internal.m4)
42 m4_include(../lib/util/fault.m4)
43 m4_include(../lib/util/signal.m4)
44 m4_include(../lib/util/util.m4)
45 m4_include(../lib/util/fsusage.m4)
46 m4_include(../lib/util/xattr.m4)
47 m4_include(../lib/util/capability.m4)
48 m4_include(../lib/util/time.m4)
49 m4_include(../lib/popt/samba.m4)
50 m4_include(../lib/util/charset/config.m4)
51 m4_include(lib/socket/config.m4)
52 m4_include(../nsswitch/nsstest.m4)
53 m4_include(../pidl/config.m4)
54 AC_ZLIB([
55 SMB_EXT_LIB(ZLIB, [${ZLIB_LIBS}])
56 ],[
57 SMB_INCLUDE_MK(lib/zlib.mk)
58 ])
59
60
61 AC_CONFIG_FILES(../source4/lib/registry/registry.pc)
62 AC_CONFIG_FILES(../source4/librpc/dcerpc.pc)
63 AC_CONFIG_FILES(../librpc/ndr.pc)
64 AC_CONFIG_FILES(../lib/torture/torture.pc)
65 AC_CONFIG_FILES(../source4/auth/gensec/gensec.pc)
66 AC_CONFIG_FILES(../source4/param/samba-hostconfig.pc)
67 AC_CONFIG_FILES(../source4/librpc/dcerpc_samr.pc)
68 AC_CONFIG_FILES(../source4/librpc/dcerpc_atsvc.pc)
69
70 m4_include(../source4/min_versions.m4)
71
72 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= TALLOC_MIN_VERSION,
73         [],
74         [
75                 SMB_INCLUDE_MK(../lib/talloc/config.mk)
76         ]
77 )
78 # Tallocdir isn't always set by the Samba3 c
79 tallocdir=../lib/talloc
80 AC_SUBST(tallocdir)
81 CFLAGS="$CFLAGS -I../lib/talloc"
82
83 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= TDB_MIN_VERSION,
84         [],
85         [
86                 m4_include(../lib/tdb/libtdb.m4)
87                 SMB_INCLUDE_MK(../lib/tdb/config.mk)
88         ]
89 )
90
91 SMB_INCLUDE_MK(../lib/tdb/python.mk) 
92
93 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTEVENT, tevent = TEVENT_REQUIRED_VERSION,
94         [],[m4_include(../lib/tevent/samba.m4)]
95 )
96
97 SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb = LDB_REQUIRED_VERSION,
98         [
99                 SMB_INCLUDE_MK(lib/ldb/ldb_ildap/config.mk)
100                 SMB_INCLUDE_MK(lib/ldb/tools/config.mk)
101                 define_ldb_modulesdir=no
102         ],
103         [
104                 # Here we need to do some tricks
105                 # with AC_CONFIG_COMMANDS_PRE
106                 # as that's the deferrs the commands
107                 # to location after $prefix and $exec_prefix
108                 # have usefull values and directly before
109                 # creating config.status.
110                 #
111                 # The 'eval eval echo' trick is used to
112                 # actually get the raw absolute directory
113                 # path as this is needed in config.h
114                 define_ldb_modulesdir=yes
115                 AC_CONFIG_COMMANDS_PRE([
116                 if test x"$define_ldb_modulesdir" = x"yes";then
117                         LDB_MODULESDIR=`eval eval echo ${modulesdir}/ldb`
118                         AC_DEFINE_UNQUOTED(LDB_MODULESDIR, "${LDB_MODULESDIR}" , [ldb Modules directory])
119                 fi
120                 ])
121                 ldbdir="\$(abspath \$(srcdir)/../source4/lib/ldb)"
122                 AC_SUBST(ldbdir)
123                 m4_include(lib/ldb/sqlite3.m4)
124                 m4_include(lib/ldb/libldb.m4)
125                 SMB_INCLUDE_MK(lib/ldb/config.mk)
126                 AC_CONFIG_FILES(../source4/lib/ldb/ldb.pc)
127         ]
128 )
129 SMB_INCLUDE_MK(lib/ldb/python.mk) 
130
131 # Not sure why we need this..
132 SMB_ENABLE(swig_ldb,YES)
133
134 # Don't build wbinfo twice
135 SMB_ENABLE(wbinfo, NO)
136
137 m4_include(lib/tls/config.m4)
138 m4_include(torture/libnetapi/config.m4)
139 m4_include(torture/libsmbclient/config.m4)
140
141 dnl m4_include(auth/kerberos/config.m4)
142 m4_include(auth/gensec/config.m4)
143 m4_include(smbd/process_model.m4)
144 m4_include(ntvfs/posix/config.m4)
145 m4_include(ntvfs/unixuid/config.m4)
146 m4_include(auth/config.m4)
147 m4_include(kdc/config.m4)
148 m4_include(ntvfs/sysdep/config.m4)
149 m4_include(../nsswitch/config.m4)
150
151 AC_SUBST(INTERN_LDFLAGS)
152 AC_SUBST(INSTALL_LINK_FLAGS)
153 if test $USESHARED = "true";
154 then
155         INTERN_LDFLAGS="-L\$(shliboutputdir) -L\${builddir}/bin/static"
156         INSTALL_LINK_FLAGS="-Wl,-rpath-link,\$(shliboutputdir)";
157 else
158         INTERN_LDFLAGS="-L\${builddir}/bin/static -L\$(shliboutputdir)"
159 fi
160
161 dnl Samba 4 files
162 AC_SUBST(LD)
163 AC_LIBREPLACE_SHLD_FLAGS
164 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
165 LIB_REMOVE_USR_LIB(LDFLAGS)
166 LIB_REMOVE_USR_LIB(LIBS)
167 LIB_REMOVE_USR_LIB(KRB5_LIBS)
168
169 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
170 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
171 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
172 SMB_WRITE_MAKEVARS(samba4-config.mk, [prefix exec_prefix CPPFLAGS LDSHFLAGS POPT_OBJ CFLAGS TALLOC_OBJ POPT_LIBS srcdir builddir])
173                  
174 oldbuilddir="$builddir"
175 builddir="$builddir/../source4"
176 oldsrcdir="$srcdir"
177 srcdir="$srcdir/../source4"
178 AC_SUBST(srcdir)
179 AC_SUBST(builddir)
180 SMB_WRITE_PERLVARS(../source4/build/smb_build/config.pm)
181 builddir="$oldbuilddir"
182 srcdir="$oldsrcdir"
183
184 echo "configure: creating ../source4/config.mk"
185 cat >../source4/config.mk<<CEOF
186 # config.mk - Autogenerated by configure, DO NOT EDIT!
187 $SMB_INFO_EXT_LIBS
188 $SMB_INFO_SUBSYSTEMS
189 $SMB_INFO_LIBRARIES
190 CEOF
191
192 AC_OUTPUT_COMMANDS([
193 cd ${srcdir}/../source4
194 $PERL -I${builddir} -I${builddir}/build \
195     -I. -Ibuild \
196     build/smb_build/main.pl --output=../source3/samba4-data.mk main.mk || exit $?
197 cd ../source3
198 ],[
199 srcdir="$srcdir"
200 builddir="$builddir"
201 PERL="$PERL"
202
203 export PERL
204 export srcdir
205 export builddir
206 ])
207
208 AC_CONFIG_COMMANDS([Makefile-samba4], [
209 echo "include samba4.mk" >> ${builddir}/Makefile
210 ])
211