r22698: Support using system tdb, when available.
[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],[],[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 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.0, [], [
29         m4_include(lib/talloc/libtalloc.m4)
30         SMB_INCLUDE_MK(lib/talloc/config.mk)
31 ])
32 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= 1.1.0, [], [
33     m4_include(lib/tdb/libtdb.m4)
34     SMB_INCLUDE_MK(lib/tdb/config.mk)
35 ])
36 m4_include(lib/ldb/sqlite3.m4)
37 m4_include(lib/ldb/libldb.m4)
38 m4_include(lib/tls/config.m4)
39 m4_include(lib/events/config.m4)
40
41 dnl m4_include(auth/kerberos/config.m4)
42
43 m4_include(auth/gensec/config.m4)
44 m4_include(smbd/process_model.m4)
45 m4_include(scripting/swig/config.m4)
46 m4_include(ntvfs/posix/config.m4)
47 m4_include(ntvfs/unixuid/config.m4)
48 m4_include(lib/socket_wrapper/config.m4)
49 m4_include(auth/config.m4)
50 m4_include(kdc/config.m4)
51 m4_include(ntvfs/sysdep/config.m4)
52 m4_include(lib/appweb/config.m4)
53 m4_include(nsswitch/config.m4)
54 m4_include(libcli/config.m4)
55
56 #################################################
57 # add *_CFLAGS only for the real build
58 CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
59
60 #################################################
61 # final configure stuff
62
63 AC_MSG_CHECKING([configure summary])
64 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
65            AC_MSG_RESULT(yes),
66            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
67            AC_MSG_WARN([cannot run when cross-compiling]))
68
69 LIBS=`echo $LIBS | sed -e 's/ *//g'`
70 if test x"$LIBS" != x""; then
71         echo "LIBS: $LIBS"
72         AC_MSG_WARN([the global \$LIBS variable contains some libraries!])
73         AC_MSG_WARN([this should not happen, please report to samba-technical@lists.samba.org!])
74         AC_MSG_ERROR([only _EXT macros from aclocal.m4 should be used!])
75 fi
76
77 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
78 LIB_REMOVE_USR_LIB(LDFLAGS)
79 LIB_REMOVE_USR_LIB(LIBS)
80
81 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
82 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
83 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
84
85 AC_SUBST(ac_default_prefix)
86
87 for d in build/smb_build bin include ; do
88     test -d ${builddir}/$d || AS_MKDIR_P(${builddir}/$d)
89 done
90
91 echo "configure: creating build/smb_build/config.pm"
92 cat >build/smb_build/config.pm<<CEOF
93 # config.pm - Autogenerate by configure. DO NOT EDIT!
94
95 package config;
96 require Exporter;
97 @ISA = qw(Exporter);
98 @EXPORT_OK = qw(%enabled %config);
99 use strict;
100
101 use vars qw(%enabled %config);
102
103 %config = (AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
104         AC_Var => '$AC_Var',])
105 );
106
107 $SMB_INFO_ENABLES
108 1;
109 CEOF
110
111 echo "configure: creating config.mk"
112 cat >config.mk<<CEOF
113 # config.mk - Autogenerated by configure, DO NOT EDIT!
114 $SMB_INFO_EXT_LIBS
115 $SMB_INFO_SUBSYSTEMS
116 $SMB_INFO_LIBRARIES
117 CEOF
118
119 AC_OUTPUT_COMMANDS(
120 [
121 test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && (
122         cd $builddir;
123         # NOTE: We *must* use -R so we don't follow symlinks (at least on BSD
124         # systems).
125         test -d heimdal || cp -R $srcdir/heimdal $builddir/
126         test -d heimdal_build || cp -R $srcdir/heimdal_build $builddir/
127         test -d build || builddir="$builddir" \
128                         srcdir="$srcdir" \
129                         $PERL ${srcdir}/script/buildtree.pl
130  )
131
132 $PERL -I${builddir} -I${builddir}/build \
133     -I${srcdir} -I${srcdir}/build \
134     ${srcdir}/build/smb_build/main.pl || exit $?
135 ],
136 [
137 srcdir="$srcdir"
138 builddir="$builddir"
139 PERL="$PERL"
140
141 export PERL
142 export srcdir
143 export builddir
144 ])
145 AC_OUTPUT
146
147 cmp include/config_tmp.h include/config.h >/dev/null 2>&1
148 CMP_RET=$?
149 if test $CMP_RET != 0; then
150         cp include/config_tmp.h include/config.h
151 fi