r8826: Make configure generate config.mk files (with the external libraries
[sfrench/samba-autobuild/.git] / source4 / 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.h)
11
12 sinclude(build/m4/env.m4)
13 sinclude(build/m4/rewrite.m4)
14 sinclude(lib/replace/win32/config.m4)
15 sinclude(lib/replace/repdir/config.m4)
16 sinclude(heimdal_build/config.m4)
17 sinclude(lib/popt/config.m4)
18 sinclude(lib/iconv.m4)
19 sinclude(lib/socket/config.m4)
20 sinclude(lib/talloc/config.m4)
21 sinclude(lib/tdb/config.m4)
22 sinclude(lib/ldb/sqlite3.m4)
23 sinclude(lib/ldb/config.m4)
24 sinclude(lib/tls/config.m4)
25 sinclude(lib/events/config.m4)
26 sinclude(lib/cmdline/config.m4)
27
28 dnl disabled until we support external heimdal again
29 dnl sinclude(auth/kerberos/config.m4)
30
31 sinclude(auth/gensec/config.m4)
32 sinclude(libcli/config.m4)
33 sinclude(smbd/process_model.m4)
34 sinclude(lib/registry/config.m4)
35 sinclude(scripting/config.m4)
36 sinclude(gtk/config.m4)
37 sinclude(ntvfs/posix/config.m4)
38 sinclude(lib/socket_wrapper/config.m4)
39 sinclude(web_server/config.m4)
40 sinclude(auth/config.m4)
41 sinclude(kdc/config.m4)
42
43 ALLLIBS_LIBS="$LIBS"
44 ALLLIBS_CFLAGS="$CFLAGS"
45 ALLLIBS_CPPFLAGS="$CPPFLAGS"
46 ALLLIBS_LDFLAGS="$LDFLAGS"
47
48 SMB_EXT_LIB_ENABLE(ALLLIBS,YES)
49
50 SMB_EXT_LIB(ALLLIBS,
51                 [${ALLLIBS_LIBS}],
52                 [${ALLLIBS_CFLAGS}],
53                 [${ALLLIBS_CPPFLAGS}],
54                 [${ALLLIBS_LDFLAGS}])
55
56 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
57
58 #################################################
59 # do extra things if we are running insure
60
61 if test "${ac_cv_prog_CC}" = "insure"; then
62         CPPFLAGS="$CPPFLAGS -D__INSURE__"
63 fi
64
65 #################################################
66 # add DEVELOPER_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 builddir=`pwd`
79 AC_SUBST(builddir)
80
81 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
82 LIB_REMOVE_USR_LIB(LDFLAGS)
83 LIB_REMOVE_USR_LIB(LIBS)
84
85 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
86 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
87 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
88
89 echo "configure: creating config.pl"
90 cat >config.pm<<CEOF
91 # config.pm - Autogenerate by configure. DO NOT EDIT!
92
93 package config;
94 use strict;
95
96 use vars qw(%enabled AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [\$AC_Var ]));
97
98 AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
99 \$AC_Var = "$AC_Var";])
100
101 $SMB_INFO_ENABLES
102 CEOF
103
104 echo "configure: creating config.mk"
105 cat >config.mk<<CEOF
106 # config.mk - Autogenerated by configure, DO NOT EDIT!
107 $SMB_INFO_EXT_LIBS
108 $SMB_INFO_SUBSYSTEMS
109 $SMB_INFO_LIBRARIES
110 CEOF
111
112 AC_OUTPUT(Makefile,,[$PERL -Ibuild build/smb_build/main.pl])