build: get the SONAME right for installed libraries
[Samba/gebeck_regimport.git] / source4 / configure.ac
blobe5bcc0254b5b43701b1de66dcf34643383aedc4c
1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.54)
6 AC_INIT([samba],[4],[samba-technical@samba.org])
8 AC_CONFIG_SRCDIR([include/includes.h])
9 AC_CONFIG_HEADER(include/config_tmp.h)
10 AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h.])
12 # Configuration rules.
13 m4_include(build/m4/env.m4)
14 m4_include(../lib/replace/samba.m4)
15 m4_include(lib/smbreadline/readline.m4)
16 m4_include(heimdal_build/config.m4)
17 m4_include(../lib/util/fault.m4)
18 m4_include(../lib/util/signal.m4)
19 m4_include(../lib/util/util.m4)
20 m4_include(../lib/util/fsusage.m4)
21 m4_include(../lib/util/xattr.m4)
22 m4_include(../lib/util/capability.m4)
23 m4_include(../lib/util/time.m4)
24 m4_include(../lib/popt/samba.m4)
25 m4_include(../lib/util/charset/config.m4)
26 m4_include(lib/socket/config.m4)
27 m4_include(../lib/zlib/zlib.m4)
28 AC_ZLIB([
29 SMB_EXT_LIB(ZLIB, [${ZLIB_LIBS}])
30 ],[
31 SMB_INCLUDE_MK(lib/zlib.mk)
33 m4_include(../nsswitch/nsstest.m4)
34 m4_include(../pidl/config.m4)
36 AC_CONFIG_FILES(lib/registry/registry.pc)
37 AC_CONFIG_FILES(librpc/dcerpc.pc)
38 AC_CONFIG_FILES(../librpc/ndr.pc)
39 AC_CONFIG_FILES(../librpc/ndr_standard.pc)
40 AC_CONFIG_FILES(../lib/torture/torture.pc)
41 AC_CONFIG_FILES(auth/gensec/gensec.pc)
42 AC_CONFIG_FILES(param/samba-hostconfig.pc)
43 AC_CONFIG_FILES(librpc/dcerpc_samr.pc)
44 AC_CONFIG_FILES(librpc/dcerpc_atsvc.pc)
46 m4_include(min_versions.m4)
48 SMB_INCLUDED_LIB_PKGCONFIG(LIBTALLOC, talloc >= TALLOC_MIN_VERSION, [],
49         [
50                 m4_include(../lib/talloc/libtalloc.m4)
51                 SMB_INCLUDE_MK(../lib/talloc/config.mk)
52         ]
55 SMB_INCLUDED_LIB_PKGCONFIG(LIBTDB, tdb >= TDB_MIN_VERSION,
56         [
57                 AC_MSG_CHECKING([for Python TDB bindings])
58                 if $PYTHON -c "from tdb import open" 2>/dev/null; then
59                         AC_MSG_RESULT(yes)
60                 else
61                         SMB_INCLUDE_MK(../lib/tdb/python.mk) 
62                         AC_MSG_RESULT(no)
63                 fi
64          ],
65         [
66                 m4_include(../lib/tdb/libtdb.m4)
67                 SMB_INCLUDE_MK(../lib/tdb/config.mk)
68                 SMB_INCLUDE_MK(../lib/tdb/python.mk) 
69         ]
72 SMB_INCLUDED_LIB_PKGCONFIG(LIBTEVENT, tevent = TEVENT_REQUIRED_VERSION,
73         [],[m4_include(../lib/tevent/samba.m4)]
76 SMB_INCLUDED_LIB_PKGCONFIG(LIBLDB, ldb = LDB_REQUIRED_VERSION,
77         [
78                 SMB_INCLUDE_MK(lib/ldb/ldb_ildap/config.mk)
79                 SMB_INCLUDE_MK(lib/ldb/tools/config.mk)
80                 define_ldb_modulesdir=no
81                 AC_MSG_CHECKING([for Python LDB bindings])
82                 if $PYTHON -c "import ldb" 2>/dev/null; then
83                         AC_MSG_RESULT(yes)
84                 else
85                         SMB_INCLUDE_MK(lib/ldb/python.mk) 
86                         AC_MSG_RESULT(no)
87                 fi
89         ],
90         [
91                 # Here we need to do some tricks
92                 # with AC_CONFIG_COMMANDS_PRE
93                 # as that's the deferrs the commands
94                 # to location after $prefix and $exec_prefix
95                 # have usefull values and directly before
96                 # creating config.status.
97                 #
98                 # The 'eval eval echo' trick is used to
99                 # actually get the raw absolute directory
100                 # path as this is needed in config.h
101                 define_ldb_modulesdir=yes
102                 AC_CONFIG_COMMANDS_PRE([
103                 if test x"$define_ldb_modulesdir" = x"yes";then
104                         LDB_MODULESDIR=`eval eval echo ${modulesdir}/ldb`
105                         AC_DEFINE_UNQUOTED(LDB_MODULESDIR, "${LDB_MODULESDIR}" , [ldb Modules directory])
106                 fi
107                 ])
108                 ldbdir=lib/ldb
109                 AC_SUBST(ldbdir)
110                 m4_include(lib/ldb/sqlite3.m4)
111                 m4_include(lib/ldb/libldb.m4)
112                 SMB_INCLUDE_MK(lib/ldb/config.mk)
113                 AC_CONFIG_FILES(lib/ldb/ldb.pc)
114                 SMB_INCLUDE_MK(lib/ldb/python.mk) 
115         ])
117 m4_include(lib/tls/config.m4)
118 m4_include(torture/libnetapi/config.m4)
119 m4_include(torture/libsmbclient/config.m4)
121 dnl m4_include(auth/kerberos/config.m4)
122 m4_include(auth/gensec/config.m4)
123 m4_include(smbd/process_model.m4)
124 m4_include(ntvfs/posix/config.m4)
125 m4_include(ntvfs/unixuid/config.m4)
126 m4_include(../lib/socket_wrapper/config.m4)
127 m4_include(../lib/nss_wrapper/config.m4)
128 m4_include(../lib/uid_wrapper/config.m4)
129 dnl nsswitch must be before auth as it sets some variable
130 dnl tested by auth/config.m4, libiiniparser must be even before
131 dnl because nsswitch depend also on it
132 m4_include(../lib/iniparser_build/config.m4)
133 m4_include(../nsswitch/config.m4)
134 m4_include(auth/config.m4)
135 m4_include(kdc/config.m4)
136 m4_include(ntvfs/sysdep/config.m4)
138 #################################################
139 # add *_CFLAGS only for the real build
140 CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
142 #################################################
143 # final configure stuff
145 AC_MSG_CHECKING([configure summary])
146 AC_TRY_RUN([#include "${srcdir-.}/../tests/summary.c"],
147            AC_MSG_RESULT(yes),
148            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
149            AC_MSG_WARN([cannot run when cross-compiling]))
151 LIBS=`echo $LIBS | sed -e 's/ *//g'`
152 if test x"$LIBS" != x""; then
153         echo "LIBS: $LIBS"
154         AC_MSG_WARN([the global \$LIBS variable contains some libraries!])
155         AC_MSG_WARN([this should not happen, please report to samba-technical@lists.samba.org!])
156         AC_MSG_ERROR([only _EXT macros from aclocal.m4 should be used!])
159 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
160 LIB_REMOVE_USR_LIB(LDFLAGS)
161 LIB_REMOVE_USR_LIB(LIBS)
163 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
164 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
165 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
167 AC_SUBST(ac_default_prefix)
169 for d in build/smb_build bin include ; do
170     test -d ${builddir}/$d || AS_MKDIR_P(${builddir}/$d)
171 done
173 AC_SUBST(INTERN_LDFLAGS)
174 AC_SUBST(INSTALL_LINK_FLAGS)
175 if test $USESHARED = "true";
176 then
177         INTERN_LDFLAGS="-L\$(shliboutputdir) -L\${builddir}/bin/static"
178         INSTALL_LINK_FLAGS="-Wl,-rpath-link,\$(shliboutputdir)";
179 else
180         INTERN_LDFLAGS="-L\${builddir}/bin/static -L\$(shliboutputdir)"
183 builddir_headers=""
184         
185 if test "x$ac_abs_srcdir" != "x$ac_abs_builddir"
186 then
187         builddir_headers="-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib ";
190 CPPFLAGS="$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/../lib/replace -I\$(srcdir)/../lib/talloc -I\$(srcdir)/.. -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $CPPFLAGS"
192 SMB_WRITE_PERLVARS(build/smb_build/config.pm)
194 echo "configure: creating config.mk"
195 cat >config.mk<<CEOF
196 # config.mk - Autogenerated by configure, DO NOT EDIT!
197 $SMB_INFO_EXT_LIBS
198 $SMB_INFO_SUBSYSTEMS
199 $SMB_INFO_LIBRARIES
200 CEOF
202 SMB_BUILD_RUN(data.mk)
203 AC_OUTPUT(Makefile)
205 cmp include/config_tmp.h include/config.h >/dev/null 2>&1
206 CMP_RET=$?
207 if test $CMP_RET != 0; then
208         cp include/config_tmp.h include/config.h
211 SMB_WRITE_MAKEVARS(mkconfig.mk)
213 if test $USESHARED = true
214 then
215         echo "To run binaries without installing, set the following environment variable:"
216         echo "$LIB_PATH_VAR=$builddir/bin/shared"
219 echo
220 echo "To build Samba, run $MAKE"