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