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