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