summaryrefslogtreecommitdiff
path: root/source4/configure.ac
blob: bb0dbf47f11158eaa2be84b746f7b602f21085b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
dnl -*- mode: m4-mode -*-
dnl Process this file with autoconf to produce a configure script.

dnl disabled 2.53 requirement - we do work with 2.52 on suse 7.3 for example
dnl AC_PREREQ(2.53)

AC_INIT([samba],[],[samba-technical@samba.org])

AC_CONFIG_SRCDIR([include/includes.h])
AC_CONFIG_HEADER(include/config_tmp.h)
AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h])

# Configuration rules.
m4_include(build/m4/env.m4)
m4_include(lib/replace/samba.m4)
m4_include(lib/smbreadline/readline.m4)
m4_include(heimdal_build/config.m4)
m4_include(lib/util/fault.m4)
m4_include(lib/util/signal.m4)
m4_include(lib/util/util.m4)
m4_include(lib/util/fsusage.m4)
m4_include(lib/util/xattr.m4)
m4_include(lib/util/capability.m4)
m4_include(lib/util/time.m4)
m4_include(lib/popt/samba.m4)
m4_include(lib/charset/config.m4)
m4_include(lib/socket/config.m4)
m4_include(nsswitch/nsstest.m4)

SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.1.0,
	[],
	[
		m4_include(lib/talloc/libtalloc.m4)
		SMB_INCLUDE_MK(lib/talloc/config.mk)
	]
)

SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= 1.1.0,
	[],
	[
		m4_include(lib/tdb/libtdb.m4)
		SMB_INCLUDE_MK(lib/tdb/config.mk)
	]
)

SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb >= 0.9.1,
	[
		SMB_INCLUDE_MK(lib/ldb/ldb_ildap/config.mk)
		SMB_INCLUDE_MK(lib/ldb/tools/config.mk)
		SMB_SUBSYSTEM(ldb_map, [], [LIBLDB])
		define_ldb_modulesdir=no
	],
	[
		# Here we need to do some tricks
		# with AC_CONFIG_COMMANDS_PRE
		# as that's the deferrs the commands
		# to location after $prefix and $exec_prefix
		# have usefull values and directly before
		# creating config.status.
		#
		# The 'eval eval echo' trick is used to
		# actually get the raw absolute directory
		# path as this is needed in config.h
		define_ldb_modulesdir=yes
		AC_CONFIG_COMMANDS_PRE([
		if test x"$define_ldb_modulesdir" = x"yes";then
			LDB_MODULESDIR=`eval eval echo ${modulesdir}/ldb`
			AC_DEFINE_UNQUOTED(LDB_MODULESDIR, "${LDB_MODULESDIR}" , [ldb Modules directory])
		fi
		])
		m4_include(lib/ldb/sqlite3.m4)
		m4_include(lib/ldb/libldb.m4)
		SMB_INCLUDE_MK(lib/ldb/config.mk)
	]
)

m4_include(lib/tls/config.m4)
m4_include(lib/events/config.m4)

dnl m4_include(auth/kerberos/config.m4)

AC_ARG_VAR([PYTHON_VERSION],[The installed Python
	version to use, for example '2.3'. This string 
	will be appended to the Python interpreter
	canonical name.])

AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
if test -z "$PYTHON"; then
	AC_MSG_ERROR([No python found])
fi

AC_SUBST(PYTHON)

#
# Check for a version of Python >= 2.1.0
#
AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
ac_supports_python_ver=`$PYTHON -c "import sys, string; \
	ver = string.split(sys.version)[[0]]; \
	print ver >= '2.1.0'"`
if test "$ac_supports_python_ver" != "True"; then
	AC_MSG_RESULT([no])
	AC_MSG_ERROR([No recent version of python found])
else 
	AC_MSG_RESULT([yes])
fi

#
# Check if you have distutils, else fail
#
AC_MSG_CHECKING([for the distutils Python package])
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
if test -z "$ac_distutils_result"; then
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
	AC_MSG_ERROR([distutils not available])
fi

#
# Check for Python include path
#
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON_CPPFLAGS"; then
	python_path=`$PYTHON -c "import distutils.sysconfig; \
			print distutils.sysconfig.get_python_inc();"`
	if test -n "${python_path}"; then
		python_path="-I$python_path"
	fi
	PYTHON_CPPFLAGS=$python_path
fi
AC_MSG_RESULT([$PYTHON_CPPFLAGS])
AC_SUBST([PYTHON_CPPFLAGS])

#
# Check for Python library path
#
AC_MSG_CHECKING([for Python library path])
if test -z "$PYTHON_LDFLAGS"; then
	# (makes two attempts to ensure we've got a version number
	# from the interpreter)
	py_version=`$PYTHON -c "from distutils.sysconfig import *; \
		from string import join; \
		print join(get_config_vars('VERSION'))"`
	if test "$py_version" == "[None]"; then
		if test -n "$PYTHON_VERSION"; then
			py_version=$PYTHON_VERSION
		else
			py_version=`$PYTHON -c "import sys; \
				print sys.version[[:3]]"`
		fi
	fi

	PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
		from string import join; \
		print '-L' + get_python_lib(0,1), \
			'-lpython';"`$py_version
fi		
AC_MSG_RESULT([$PYTHON_LDFLAGS])
AC_SUBST([PYTHON_LDFLAGS])

#
# Check for site packages
#
AC_MSG_CHECKING([for Python site-packages path])
if test -z "$PYTHON_SITE_PKG"; then
	PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
			print distutils.sysconfig.get_python_lib(0,0);"`
fi
AC_MSG_RESULT([$PYTHON_SITE_PKG])
AC_SUBST([PYTHON_SITE_PKG])

#
# libraries which must be linked in when embedding
#
AC_MSG_CHECKING(python extra libraries)
if test -z "$PYTHON_EXTRA_LIBS"; then
   PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
			conf = distutils.sysconfig.get_config_var; \
			print conf('LOCALMODLIBS'), conf('LIBS')"`
fi
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
AC_SUBST(PYTHON_EXTRA_LIBS)

#
# linking flags needed when embedding
#
AC_MSG_CHECKING(python extra linking flags)
if test -z "$PYTHON_EXTRA_LDFLAGS"; then
	PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
		conf = distutils.sysconfig.get_config_var; \
		print conf('LINKFORSHARED')"`
fi
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
AC_SUBST(PYTHON_EXTRA_LDFLAGS)

SMB_EXT_LIB(LIBPYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CPPFLAGS])
SMB_ENABLE(LIBPYTHON)

m4_include(auth/gensec/config.m4)
m4_include(smbd/process_model.m4)
m4_include(ntvfs/posix/config.m4)
m4_include(ntvfs/unixuid/config.m4)
m4_include(lib/socket_wrapper/config.m4)
m4_include(lib/nss_wrapper/config.m4)
m4_include(auth/config.m4)
m4_include(kdc/config.m4)
m4_include(ntvfs/sysdep/config.m4)
m4_include(lib/appweb/config.m4)
m4_include(nsswitch/config.m4)
m4_include(libcli/config.m4)

#################################################
# add *_CFLAGS only for the real build
CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"

#################################################
# final configure stuff

AC_MSG_CHECKING([configure summary])
AC_TRY_RUN([#include "${srcdir-.}/build/tests/summary.c"],
           AC_MSG_RESULT(yes),
	   AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
	   AC_MSG_WARN([cannot run when cross-compiling]))

LIBS=`echo $LIBS | sed -e 's/ *//g'`
if test x"$LIBS" != x""; then
	echo "LIBS: $LIBS"
	AC_MSG_WARN([the global \$LIBS variable contains some libraries!])
	AC_MSG_WARN([this should not happen, please report to samba-technical@lists.samba.org!])
	AC_MSG_ERROR([only _EXT macros from aclocal.m4 should be used!])
fi

dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
LIB_REMOVE_USR_LIB(LDFLAGS)
LIB_REMOVE_USR_LIB(LIBS)

dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)

AC_SUBST(ac_default_prefix)

for d in build/smb_build bin include ; do
    test -d ${builddir}/$d || AS_MKDIR_P(${builddir}/$d)
done

echo "configure: creating build/smb_build/config.pm"
cat >build/smb_build/config.pm<<CEOF
# config.pm - Autogenerate by configure. DO NOT EDIT!

package config;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(%enabled %config);
use strict;

use vars qw(%enabled %config);

%config = (AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
	AC_Var => '$AC_Var',])
);

$SMB_INFO_ENABLES
1;
CEOF

echo "configure: creating config.mk"
cat >config.mk<<CEOF
# config.mk - Autogenerated by configure, DO NOT EDIT!
$SMB_INFO_EXT_LIBS
$SMB_INFO_SUBSYSTEMS
$SMB_INFO_LIBRARIES
CEOF

AC_OUTPUT_COMMANDS(
[
test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && (
	cd $builddir;
	# NOTE: We *must* use -R so we don't follow symlinks (at least on BSD
	# systems).
	test -d heimdal || cp -R $srcdir/heimdal $builddir/
	test -d heimdal_build || cp -R $srcdir/heimdal_build $builddir/
	test -d build || builddir="$builddir" \
			srcdir="$srcdir" \
			$PERL ${srcdir}/script/buildtree.pl
 )

$PERL -I${builddir} -I${builddir}/build \
    -I${srcdir} -I${srcdir}/build \
    ${srcdir}/build/smb_build/main.pl || exit $?
],
[
srcdir="$srcdir"
builddir="$builddir"
PERL="$PERL"

export PERL
export srcdir
export builddir
])
AC_OUTPUT

cmp include/config_tmp.h include/config.h >/dev/null 2>&1
CMP_RET=$?
if test $CMP_RET != 0; then
	cp include/config_tmp.h include/config.h
fi