ldb/talloc/tdb: Use manually written pc file.
[ira/wip.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],[],[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 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.1.0,
31         [],
32         [
33                 m4_include(lib/talloc/libtalloc.m4)
34                 SMB_INCLUDE_MK(lib/talloc/config.mk)
35                 AC_OUTPUT(lib/talloc/talloc.pc)
36         ]
37 )
38
39 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= 1.1.0,
40         [],
41         [
42                 m4_include(lib/tdb/libtdb.m4)
43                 SMB_INCLUDE_MK(lib/tdb/config.mk)
44                 AC_OUTPUT(lib/tdb/tdb.pc)
45         ]
46 )
47
48 SMB_INCLUDE_MK(lib/tdb/python.mk) 
49
50 SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb >= 0.9.1,
51         [
52                 SMB_INCLUDE_MK(lib/ldb/ldb_ildap/config.mk)
53                 SMB_INCLUDE_MK(lib/ldb/tools/config.mk)
54                 SMB_SUBSYSTEM(ldb_map, [], [LIBLDB])
55                 AC_OUTPUT(lib/ldb/ldb.pc)
56                 define_ldb_modulesdir=no
57         ],
58         [
59                 # Here we need to do some tricks
60                 # with AC_CONFIG_COMMANDS_PRE
61                 # as that's the deferrs the commands
62                 # to location after $prefix and $exec_prefix
63                 # have usefull values and directly before
64                 # creating config.status.
65                 #
66                 # The 'eval eval echo' trick is used to
67                 # actually get the raw absolute directory
68                 # path as this is needed in config.h
69                 define_ldb_modulesdir=yes
70                 AC_CONFIG_COMMANDS_PRE([
71                 if test x"$define_ldb_modulesdir" = x"yes";then
72                         LDB_MODULESDIR=`eval eval echo ${modulesdir}/ldb`
73                         AC_DEFINE_UNQUOTED(LDB_MODULESDIR, "${LDB_MODULESDIR}" , [ldb Modules directory])
74                 fi
75                 ])
76                 m4_include(lib/ldb/sqlite3.m4)
77                 m4_include(lib/ldb/libldb.m4)
78                 SMB_INCLUDE_MK(lib/ldb/config.mk)
79         ]
80 )
81 SMB_INCLUDE_MK(lib/ldb/python.mk) 
82
83 m4_include(lib/tls/config.m4)
84 m4_include(lib/events/config.m4)
85
86 dnl m4_include(auth/kerberos/config.m4)
87 m4_include(scripting/python/config.m4)
88 m4_include(auth/gensec/config.m4)
89 m4_include(smbd/process_model.m4)
90 m4_include(ntvfs/posix/config.m4)
91 m4_include(ntvfs/unixuid/config.m4)
92 m4_include(lib/socket_wrapper/config.m4)
93 m4_include(lib/nss_wrapper/config.m4)
94 m4_include(auth/config.m4)
95 m4_include(kdc/config.m4)
96 m4_include(ntvfs/sysdep/config.m4)
97 m4_include(lib/appweb/config.m4)
98 m4_include(nsswitch/config.m4)
99
100 #################################################
101 # add *_CFLAGS only for the real build
102 CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
103
104 #################################################
105 # final configure stuff
106
107 AC_MSG_CHECKING([configure summary])
108 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
109            AC_MSG_RESULT(yes),
110            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
111            AC_MSG_WARN([cannot run when cross-compiling]))
112
113 LIBS=`echo $LIBS | sed -e 's/ *//g'`
114 if test x"$LIBS" != x""; then
115         echo "LIBS: $LIBS"
116         AC_MSG_WARN([the global \$LIBS variable contains some libraries!])
117         AC_MSG_WARN([this should not happen, please report to samba-technical@lists.samba.org!])
118         AC_MSG_ERROR([only _EXT macros from aclocal.m4 should be used!])
119 fi
120
121 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
122 LIB_REMOVE_USR_LIB(LDFLAGS)
123 LIB_REMOVE_USR_LIB(LIBS)
124
125 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
126 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
127 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
128
129 AC_SUBST(ac_default_prefix)
130
131 for d in build/smb_build bin include ; do
132     test -d ${builddir}/$d || AS_MKDIR_P(${builddir}/$d)
133 done
134
135 echo "configure: creating build/smb_build/config.pm"
136 cat >build/smb_build/config.pm<<CEOF
137 # config.pm - Autogenerate by configure. DO NOT EDIT!
138
139 package config;
140 require Exporter;
141 @ISA = qw(Exporter);
142 @EXPORT_OK = qw(%enabled %config);
143 use strict;
144
145 use vars qw(%enabled %config);
146
147 %config = (AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
148         AC_Var => '$AC_Var',])
149 );
150
151 $SMB_INFO_ENABLES
152 1;
153 CEOF
154
155 echo "configure: creating config.mk"
156 cat >config.mk<<CEOF
157 # config.mk - Autogenerated by configure, DO NOT EDIT!
158 $SMB_INFO_EXT_LIBS
159 $SMB_INFO_SUBSYSTEMS
160 $SMB_INFO_LIBRARIES
161 CEOF
162
163 AC_OUTPUT_COMMANDS(
164 [
165 test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && (
166         cd $builddir;
167         # NOTE: We *must* use -R so we don't follow symlinks (at least on BSD
168         # systems).
169         test -d heimdal || cp -R $srcdir/heimdal $builddir/
170         test -d heimdal_build || cp -R $srcdir/heimdal_build $builddir/
171         test -d build || builddir="$builddir" \
172                         srcdir="$srcdir" \
173                         $PERL ${srcdir}/script/buildtree.pl
174  )
175
176 $PERL -I${builddir} -I${builddir}/build \
177     -I${srcdir} -I${srcdir}/build \
178     ${srcdir}/build/smb_build/main.pl || exit $?
179 ],
180 [
181 srcdir="$srcdir"
182 builddir="$builddir"
183 PERL="$PERL"
184
185 export PERL
186 export srcdir
187 export builddir
188 ])
189 AC_OUTPUT
190
191 cmp include/config_tmp.h include/config.h >/dev/null 2>&1
192 CMP_RET=$?
193 if test $CMP_RET != 0; then
194         cp include/config_tmp.h include/config.h
195 fi