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