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