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