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