r18129: moved the system includes into libreplace - this gives much more
[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
12 # Configuration rules.
13 m4_include(build/m4/env.m4)
14 m4_include(lib/replace/libreplace.m4)
15 SMB_EXT_LIB(DL, $LIBDL)
16 m4_include(lib/replace/win32/config.m4)
17 m4_include(lib/replace/repdir/config.m4)
18 m4_include(lib/smbreadline/readline.m4)
19 m4_include(build/m4/rewrite.m4)
20 m4_include(heimdal_build/config.m4)
21 m4_include(lib/util/fault.m4)
22 m4_include(lib/util/signal.m4)
23 m4_include(lib/util/util.m4)
24 m4_include(lib/util/fsusage.m4)
25 m4_include(lib/util/xattr.m4)
26 m4_include(lib/util/capability.m4)
27 m4_include(lib/util/time.m4)
28 m4_include(lib/popt/samba.m4)
29 m4_include(lib/charset/config.m4)
30 m4_include(lib/socket/config.m4)
31 m4_include(lib/talloc/libtalloc.m4)
32 m4_include(lib/tdb/libtdb.m4)
33 m4_include(lib/ldb/sqlite3.m4)
34 m4_include(lib/ldb/libldb.m4)
35 m4_include(lib/tls/config.m4)
36 m4_include(lib/events/config.m4)
37
38 dnl disabled until we support external heimdal again
39 dnl m4_include(auth/kerberos/config.m4)
40
41 m4_include(auth/gensec/config.m4)
42 m4_include(smbd/process_model.m4)
43 m4_include(lib/registry/config.m4)
44 m4_include(scripting/swig/config.m4)
45 m4_include(gtk/config.m4)
46 m4_include(ntvfs/posix/config.m4)
47 m4_include(ntvfs/unixuid/config.m4)
48 m4_include(lib/socket_wrapper/config.m4)
49 m4_include(web_server/config.m4)
50 m4_include(auth/config.m4)
51 m4_include(kdc/config.m4)
52 m4_include(ntvfs/sysdep/config.m4)
53 m4_include(lib/appweb/config.m4)
54 m4_include(nsswitch/config.m4)
55 m4_include(libcli/config.m4)
56
57 AC_ARG_ENABLE(dso,
58 [  --enable-dso                 Enable building internal libraries as DSO's (experimental)],
59 [ if test x$enable_dso != xyes; then
60         BLDSHARED=false
61   fi], 
62 [BLDSHARED=false])
63
64 #################################################
65 # add *_CFLAGS only for the real build
66 CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
67
68 #################################################
69 # final configure stuff
70
71 AC_MSG_CHECKING([configure summary])
72 AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
73            AC_MSG_RESULT(yes),
74            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
75            AC_MSG_WARN([cannot run when cross-compiling]))
76
77 LIBS=`echo $LIBS | sed -e 's/ *//g'`
78 if test x"$LIBS" != x""; then
79         echo "LIBS: $LIBS"
80         AC_MSG_WARN([the global \$LIBS variable contains some libraries!])
81         AC_MSG_WARN([this should not happen, please report to samba-technical@lists.samba.org!])
82         AC_MSG_ERROR([only _EXT macros from aclocal.m4 should be used!])
83 fi
84
85 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
86 LIB_REMOVE_USR_LIB(LDFLAGS)
87 LIB_REMOVE_USR_LIB(LIBS)
88
89 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
90 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
91 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
92
93 AC_SUBST(ac_default_prefix)
94
95 echo "configure: creating build/smb_build/config.pm"
96 cat >build/smb_build/config.pm<<CEOF
97 # config.pm - Autogenerate by configure. DO NOT EDIT!
98
99 package config;
100 require Exporter;
101 @ISA = qw(Exporter);
102 @EXPORT_OK = qw(%enabled %config);
103 use strict;
104
105 use vars qw(%enabled %config);
106
107 %config = (AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
108         AC_Var => '$AC_Var',])
109 );
110
111 $SMB_INFO_ENABLES
112 1;
113 CEOF
114
115 echo "configure: creating config.mk"
116 cat >config.mk<<CEOF
117 # config.mk - Autogenerated by configure, DO NOT EDIT!
118 $SMB_INFO_EXT_LIBS
119 $SMB_INFO_SUBSYSTEMS
120 $SMB_INFO_LIBRARIES
121 CEOF
122
123 AC_OUTPUT_COMMANDS(
124 [test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && 
125  (cd $builddir; 
126         test -d heimdal || cp -r $srcdir/heimdal $builddir/
127         test -d heimdal_build || cp -r $srcdir/heimdal_build $builddir/
128         test -d build || samba_builddir="$builddir" samba_srcdir="$srcdir" $PERL $srcdir/script/buildtree.pl
129         test -f $builddir/include/smb.h || cp $srcdir/include/smb.h $builddir/include
130  )
131 $PERL -I${builddir} -I${srcdir} -I${srcdir}/build ${srcdir}/build/smb_build/main.pl || exit $?],[
132 PERL="$PERL";export PERL;export srcdir; export builddir;
133 ])
134 AC_OUTPUT
135
136 cmp include/config_tmp.h include/config.h >/dev/null 2>&1
137 CMP_RET=$?
138 if test $CMP_RET != 0; then
139         cp include/config_tmp.h include/config.h
140 fi