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