source: trunk/server/source3/configure.in@ 593

Last change on this file since 593 was 590, checked in by Herwig Bauernfeind, 14 years ago

Samba 3.5: Update trunk to 3.5.6

File size: 224.1 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2
3dnl We must use autotools 2.54 or above
4AC_PREREQ(2.54)
5
6AC_INIT([Samba],[3],[samba-technical@samba.org])
7
8AC_CONFIG_SRCDIR([include/includes.h])
9AC_CONFIG_HEADER(include/config.h)
10AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h])
11
12case "$PATH" in
13 */usr/ucb*)
14 AC_MSG_WARN([\$PATH contains /usr/ucb - build errors may follow])
15 ;;
16esac
17
18builddir=`pwd`
19AC_SUBST(builddir)
20
21m4_include(m4/samba_version.m4)
22m4_include(m4/check_path.m4)
23m4_include(pkg.m4)
24
25AC_LIBREPLACE_CC_CHECKS
26
27m4_include(../lib/tevent/libtevent.m4)
28
29LIBTEVENT_OBJ0=""
30for obj in ${TEVENT_OBJ}; do
31 LIBTEVENT_OBJ0="${LIBTEVENT_OBJ0} ${teventdir}/${obj}"
32done
33AC_SUBST(LIBTEVENT_OBJ0)
34LIBS="${LIBS} ${TEVENT_LIBS}"
35
36SAMBA_CPPFLAGS="-Iinclude -I${srcdir-.}/include -I. -I${srcdir-.}"
37SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/replace"
38SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TEVENT_CFLAGS}"
39SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/libaddns"
40SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/librpc"
41SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/.."
42
43SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/popt"
44
45## cleanup the $(srcdir) in the Makefile if we are outside of the tree
46if test "x${srcdir-.}" != "x."; then
47 SAMBA_CPPFLAGS=`echo ${SAMBA_CPPFLAGS} | sed -e "s;${srcdir};\$\(srcdir\);g"`
48fi
49
50dnl Unique-to-Samba variables we'll be playing with.
51AC_SUBST(SAMBA_CPPFLAGS)
52AC_SUBST(SHELL)
53AC_SUBST(LDSHFLAGS)
54AC_SUBST(SONAMEFLAG)
55AC_SUBST(SHLD)
56AC_SUBST(MODULE_EXPORTS)
57AC_SUBST(DSO_EXPORTS)
58AC_SUBST(HOST_OS)
59AC_SUBST(PICFLAG)
60AC_SUBST(PIE_CFLAGS)
61AC_SUBST(PIE_LDFLAGS)
62AC_SUBST(RELRO_LDFLAGS)
63AC_SUBST(SHLIBEXT)
64AC_SUBST(INSTALLLIBCMD_SH)
65AC_SUBST(INSTALLLIBCMD_A)
66AC_SUBST(UNINSTALLLIBCMD_SH)
67AC_SUBST(UNINSTALLLIBCMD_A)
68
69AC_SUBST(INSTALL_LIBWBCLIENT)
70AC_SUBST(UNINSTALL_LIBWBCLIENT)
71AC_SUBST(LIBWBCLIENT_SHARED_TARGET)
72AC_SUBST(LIBWBCLIENT_SHARED)
73AC_SUBST(LIBWBCLIENT_STATIC_TARGET)
74AC_SUBST(LIBWBCLIENT_STATIC)
75AC_SUBST(LIBWBCLIENT_SOVER)
76AC_SUBST(LIBWBCLIENT)
77AC_SUBST(LIBWBCLIENT_LIBS)
78
79AC_SUBST(LIBSAMBAUTIL_SHARED)
80
81AC_SUBST(PRINT_LIBS)
82AC_SUBST(AUTH_LIBS)
83AC_SUBST(ACL_LIBS)
84AC_SUBST(PASSDB_LIBS)
85AC_SUBST(IDMAP_LIBS)
86AC_SUBST(KRB5_LIBS)
87AC_SUBST(UUID_LIBS)
88AC_SUBST(LDAP_LIBS)
89AC_SUBST(GPEXT_LIBS)
90AC_SUBST(PAM_MODULES)
91AC_SUBST(INSTALL_PAM_MODULES)
92AC_SUBST(UNINSTALL_PAM_MODULES)
93AC_SUBST(NSS_MODULES)
94AC_SUBST(EXTRA_BIN_PROGS)
95AC_SUBST(CIFSMOUNT_PROGS)
96AC_SUBST(INSTALL_CIFSMOUNT)
97AC_SUBST(UNINSTALL_CIFSMOUNT)
98AC_SUBST(CIFSUMOUNT_PROGS)
99AC_SUBST(INSTALL_CIFSUMOUNT)
100AC_SUBST(UNINSTALL_CIFSUMOUNT)
101AC_SUBST(CIFSUPCALL_PROGS)
102AC_SUBST(INSTALL_CIFSUPCALL)
103AC_SUBST(UNINSTALL_CIFSUPCALL)
104AC_SUBST(EXTRA_SBIN_PROGS)
105AC_SUBST(EXTRA_ALL_TARGETS)
106AC_SUBST(CONFIG_LIBS)
107AC_SUBST(NSCD_LIBS)
108
109# compile with optimization and without debugging by default, but
110# allow people to set their own preference.
111# do this here since AC_CACHE_CHECK apparently sets the CFLAGS to "-g -O2"
112# if it has no value. This prevent *very* large debug binaries from occurring
113# by default.
114if test "x$debug" = "xyes" ; then
115 CFLAGS="${CFLAGS} -g"
116fi
117if test "x$CFLAGS" = x; then
118 CFLAGS="-O"
119fi
120
121m4_include(../lib/socket_wrapper/config.m4)
122m4_include(../lib/nss_wrapper/config.m4)
123
124m4_include(m4/swat.m4)
125
126# Probe the gcc version for extra CFLAGS. We always stash these in
127# DEVELOPER_CFLAGS, so that you can turn them on and off with a simple
128# Makefile edit, avoiding the need to re-run configure.
129if test x"$ac_cv_prog_gcc" = x"yes" ; then
130 DEVELOPER_CFLAGS="-g -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
131 # Add -Wdeclaration-after-statement if compiler supports it
132 AC_CACHE_CHECK(
133 [that the C compiler understands -Wdeclaration-after-statement],
134 samba_cv_HAVE_Wdeclaration_after_statement, [
135 AC_TRY_RUN_STRICT([
136 int main(void)
137 {
138 return 0;
139 }],[$CFLAGS -Wdeclaration-after-statement],[$CPPFLAGS],[$LDFLAGS],
140 samba_cv_HAVE_Wdeclaration_after_statement=yes,
141 samba_cv_HAVE_Wdeclaration_after_statement=no,
142 samba_cv_HAVE_Wdeclaration_after_statement=cross)
143 ])
144
145 if test x"$samba_cv_HAVE_Wdeclaration_after_statement" = x"yes"; then
146 DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wdeclaration-after-statement"
147 fi
148
149 #-Werror-implicit-function-declaration
150 AC_CACHE_CHECK(
151 [that the C compiler understands -Werror-implicit-function-declaration],
152 samba_cv_HAVE_Werror_implicit_function_declaration, [
153 AC_TRY_RUN_STRICT([
154 int main(void)
155 {
156 return 0;
157 }],[$CFLAGS -Werror-implicit-function-declaration],[$CPPFLAGS],[$LDFLAGS],
158 samba_cv_HAVE_Werror_implicit_function_declaration=yes,
159 samba_cv_HAVE_Werror_implicit_function_declaration=no,
160 samba_cv_HAVE_Werror_implicit_function_declaration=cross)
161 ])
162 if test x"$samba_cv_HAVE_Werror_implicit_function_declaration" = x"yes"; then
163 DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Werror-implicit-function-declaration"
164 fi
165
166 # krb5developer is like developer, except we don't get
167 # -Wstrict-prototypes.
168 if test x"$krb5_developer" != x"$yes" ; then
169 DEVELOPER_CFLAGS="$DEVELOPER_CFLAGS -Wstrict-prototypes"
170 fi
171
172 if test x"$picky_developer" = x"yes"; then
173 DEVELOPER_CFLAGS="$DEVELOPER_CFLAGS -Werror"
174 fi
175fi
176
177#################################################
178# check for a shared memory profiling support
179AC_MSG_CHECKING(whether to use profiling)
180AC_ARG_WITH(profiling-data,
181[AS_HELP_STRING([--with-profiling-data], [Include gathering source code profile information (default=no)])],
182[ case "$withval" in
183 yes)
184 AC_MSG_RESULT(yes)
185 AC_DEFINE(WITH_PROFILE,1,[Whether to use profiling])
186 samba_cv_WITH_PROFILE=yes
187 ;;
188 *)
189 AC_MSG_RESULT(no)
190 samba_cv_WITH_PROFILE=no
191 ;;
192 esac ],
193 AC_MSG_RESULT(no)
194)
195
196dnl Checks for programs.
197merged_build_possible=yes
198
199AC_PROG_INSTALL
200AC_PROG_AWK
201# Check for GNU make
202m4_include(../m4/check_make.m4)
203AC_SAMBA_GNU_MAKE([true], [merged_build_possible=no])
204
205# Check for perl
206m4_include(../m4/check_perl.m4)
207AC_SAMBA_PERL([true], [merged_build_possible=no])
208
209AC_CHECK_TOOL(AR, ar)
210
211dnl Check if we (actually our C compiler!) use GNU ld
212AC_PROG_LD_GNU
213
214dnl Certain versions of GNU ld the default is not to have the
215dnl --allow-shlib-undefined flag defined. This causes a stackload of
216dnl warnings when building modules.
217if test "$ac_cv_prog_gnu_ld" = "yes"; then
218 ac_cv_gnu_ld_version=`$CC -Wl,-v /dev/null 2>/dev/null | head -1`
219 AC_MSG_CHECKING(GNU ld release date)
220 changequote(,)dnl
221 ac_cv_gnu_ld_date=`echo $ac_cv_gnu_ld_version | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
222 changequote([,])dnl
223 AC_MSG_RESULT(${ac_cv_gnu_ld_date})
224 if test -n "$ac_cv_gnu_ld_date"; then
225 if test "$ac_cv_gnu_ld_date" -lt 20030217; then
226 ac_cv_gnu_ld_no_default_allow_shlib_undefined=yes
227 fi
228 if test "$ac_cv_gnu_ld_date" -gt 20030101; then
229 ac_cv_gnu_ld_version_script=yes
230 fi
231 else
232 AC_MSG_CHECKING(GNU ld release version)
233 changequote(,)dnl
234 ac_cv_gnu_ld_vernr=`echo $ac_cv_gnu_ld_version | sed -n 's,^[^0-9]*\([1-9][0-9]*\.[0-9][0-9]*\).*$,\1,p'`
235 ac_cv_gnu_ld_vernr_major=`echo $ac_cv_gnu_ld_vernr | cut -d '.' -f 1`
236 ac_cv_gnu_ld_vernr_minor=`echo $ac_cv_gnu_ld_vernr | cut -d '.' -f 2`
237 changequote([,])dnl
238 AC_MSG_RESULT(${ac_cv_gnu_ld_vernr})
239 AC_MSG_CHECKING(GNU ld release version major)
240 AC_MSG_RESULT(${ac_cv_gnu_ld_vernr_major})
241 AC_MSG_CHECKING(GNU ld release version minor)
242 AC_MSG_RESULT(${ac_cv_gnu_ld_vernr_minor})
243 if test "$ac_cv_gnu_ld_vernr_major" -lt 2 || test "$ac_cv_gnu_ld_vernr_minor" -lt 14; then
244 ac_cv_gnu_ld_no_default_allow_shlib_undefined=yes
245 fi
246 if test "$ac_cv_gnu_ld_vernr_major" -gt 2 || test "$ac_cv_gnu_ld_vernr_major" = 2 && test "$ac_cv_gnu_ld_vernr_minor" -ge 12; then
247 ac_cv_gnu_ld_version_script=yes
248 fi
249 fi
250fi
251
252dnl look for executable suffix
253AC_EXEEXT
254
255dnl Check if C compiler understands -c and -o at the same time
256AC_PROG_CC_C_O
257if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
258 BROKEN_CC=
259else
260 BROKEN_CC=#
261fi
262AC_SUBST(BROKEN_CC)
263
264dnl Check if the C compiler understands -Werror (GNU)
265AC_CACHE_CHECK([that the C compiler understands -Werror],samba_cv_HAVE_Werror, [
266 AC_TRY_RUN_STRICT([
267 int main(void)
268 {
269 return 0;
270 }],[$CFLAGS -Werror],[$CPPFLAGS],[$LDFLAGS],
271 samba_cv_HAVE_Werror=yes,samba_cv_HAVE_Werror=no,samba_cv_HAVE_Werror=cross)])
272if test x"$samba_cv_HAVE_Werror" = x"yes"; then
273 Werror_FLAGS="-Werror"
274else
275dnl Check if the C compiler understands -w2
276AC_CACHE_CHECK([that the C compiler understands -w2],samba_cv_HAVE_w2, [
277 AC_TRY_RUN_STRICT([
278 int main(void)
279 {
280 return 0;
281 }],[$CFLAGS -w2],[$CPPFLAGS],[$LDFLAGS],
282 samba_cv_HAVE_w2=yes,samba_cv_HAVE_w2=no,samba_cv_HAVE_w2=cross)])
283if test x"$samba_cv_HAVE_w2" = x"yes"; then
284 Werror_FLAGS="-w2"
285else
286dnl Check if the C compiler understands -errwarn (Sun)
287AC_CACHE_CHECK([that the C compiler understands -errwarn],samba_cv_HAVE_errwarn, [
288 AC_TRY_RUN_STRICT([
289 int main(void)
290 {
291 return 0;
292 }],[$CFLAGS -errwarn=%all],[$CPPFLAGS],[$LDFLAGS],
293 samba_cv_HAVE_errwarn=yes,samba_cv_HAVE_errwarn=no,samba_cv_HAVE_errwarn=cross)])
294if test x"$samba_cv_HAVE_errwarn" = x"yes"; then
295 Werror_FLAGS="-errwarn=%all"
296else
297dnl Check if the C compiler understands -qhalt (IBM)
298AC_CACHE_CHECK([that the C compiler understands -qhalt],samba_cv_HAVE_qhalt, [
299 AC_TRY_RUN_STRICT([
300 int main(void)
301 {
302 return 0;
303 }],[$CFLAGS -qhalt=w],[$CPPFLAGS],[$LDFLAGS],
304 samba_cv_HAVE_qhalt=yes,samba_cv_HAVE_qhalt=no,samba_cv_HAVE_qhalt=cross)])
305if test x"$samba_cv_HAVE_qhalt" = x"yes"; then
306 Werror_FLAGS="-qhalt=w"
307fi
308fi
309fi
310fi
311
312############################################
313# check if the compiler can handle negative enum values
314# and don't truncate the values to INT_MAX
315# a runtime test is needed here
316AC_SUBST(PIDL_ARGS)
317AC_CACHE_CHECK([that the C compiler understands negative enum values],samba_cv_CC_NEGATIVE_ENUM_VALUES, [
318 AC_TRY_RUN(
319[
320 #include <stdio.h>
321 enum negative_values { NEGATIVE_VALUE = 0xFFFFFFFF };
322 int main(void) {
323 enum negative_values v1 = NEGATIVE_VALUE;
324 unsigned v2 = NEGATIVE_VALUE;
325
326 if (v1 != 0xFFFFFFFF) {
327 printf("%u != 0xFFFFFFFF\n", v1);
328 return 1;
329 }
330 if (v2 != 0xFFFFFFFF) {
331 printf("%u != 0xFFFFFFFF\n", v2);
332 return 1;
333 }
334
335 return 0;
336 }
337],
338 samba_cv_CC_NEGATIVE_ENUM_VALUES=yes,samba_cv__CC_NEGATIVE_ENUM_VALUES=no)])
339if test x"$samba_cv_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then
340 AC_MSG_WARN([using --uint-enums for pidl])
341 PIDL_ARGS="$PIDL_ARGS --uint-enums"
342fi
343
344dnl Figure out the flags to support named structure initializers
345
346LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_ERROR([c99 structure initializer are not supported])])
347
348UNAME_S=`(uname -s) 2>/dev/null` || UNAME_S="unknown"
349AC_MSG_CHECKING(uname -s)
350AC_MSG_RESULT(${UNAME_S})
351
352UNAME_R=`(uname -r) 2>/dev/null` || UNAME_R="unknown"
353AC_MSG_CHECKING(uname -r)
354AC_MSG_RESULT(${UNAME_R})
355
356UNAME_M=`(uname -m) 2>/dev/null` || UNAME_M="unknown"
357AC_MSG_CHECKING(uname -m)
358AC_MSG_RESULT(${UNAME_M})
359
360UNAME_P=`(uname -p) 2>/dev/null` || UNAME_P="unknown"
361AC_MSG_CHECKING(uname -p)
362AC_MSG_RESULT(${UNAME_P})
363
364UNAME_I=`(uname -i) 2>/dev/null` || UNAME_I="unknown"
365AC_MSG_CHECKING(uname -i)
366AC_MSG_RESULT(${UNAME_I})
367
368dnl Add #include for broken IRIX header files
369 case "$host_os" in
370 *irix6*)
371 #TODO add to libreplace
372 if test x"$ac_cv_prog_gcc" != x"yes" ; then
373 dnl Fix sensible defaults for MIPSPro compilers. The
374 dnl error numbers are valid for the 7.3 compilers,
375 dnl hopefully also valid for the 7.4 series.
376 dnl
377 dnl Bugzilla 3801. Force an error on warning 1035
378 dnl so we don't incorrectly detect stdint.h. This
379 dnl warning is emitted for #error directives.
380 CFLAGS="$CFLAGS -diag_error 1035"
381 dnl 1209: Controlling expression is constant
382 dnl 1174: Function foo declared but never referenced
383 dnl 3201: Parameter foo was never referenced
384 CFLAGS="$CFLAGS -woff 1209,1174,3201"
385 fi
386 ;;
387esac
388
389DYNEXP=
390AC_SUBST(DYNEXP)
391LDSHFLAGS_Z_DEFS=
392AC_SUBST(LDSHFLAGS_Z_DEFS)
393LDSHFLAGS_Z_NODEFS=
394AC_SUBST(LDSHFLAGS_Z_NODEFS)
395
396dnl Add modules that have to be built by default here
397dnl These have to be built static:
398default_static_modules="pdb_smbpasswd pdb_tdbsam pdb_wbc_sam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog auth_sam auth_unix auth_winbind auth_wbc auth_server auth_domain auth_builtin auth_netlogond vfs_default nss_info_template"
399
400dnl These are preferably build shared, and static if dlopen() is not available
401default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly"
402
403if test "x$developer" = xyes; then
404 default_static_modules="$default_static_modules rpc_rpcecho pdb_ads"
405 default_shared_modules="$default_shared_modules charset_weird perfcount_test"
406fi
407
408#
409# Config CPPFLAG settings for strange OS's that must be set
410# before other tests. Do NOT invoke AC_CHECK_HEADERS within this
411# case statement; its first reference must be unconditional.
412#
413case "$host_os" in
414 *hpux*)
415#
416# Defines needed for HPUX support.
417# HPUX has bigcrypt but (sometimes?) doesn't use it for
418# password hashing - hence the USE_BOTH_CRYPT_CALLS define.
419#
420 case `uname -r` in
421 *9*|*10*|*11)
422 AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
423 ;;
424 esac
425 ;;
426
427#
428# CRAY Unicos has broken const handling
429 *unicos*)
430 AC_MSG_RESULT([disabling const])
431 CPPFLAGS="$CPPFLAGS -Dconst="
432 ;;
433
434#
435# AIX4.x doesn't even admit to having large
436# files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
437#
438 *aix4*)
439 AC_MSG_RESULT([enabling large file support])
440 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
441 AC_DEFINE(_LARGE_FILES, 1, [Whether to enable large file support])
442 ;;
443#
444# Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
445# to the existance of large files..
446# Note that -D_LARGEFILE64_SOURCE is different from the Sun
447# recommendations on large file support, however it makes the
448# compile work using gcc 2.7 and 2.8, whereas using the Sun
449# recommendation makes the compile fail on gcc2.7. JRA.
450#
451# Solaris uses SYSV printing. Make sure to set that here. --jerry
452#
453 *solaris*)
454 AC_DEFINE(SYSV, 1, [Whether to enable System V compatibility])
455 case `uname -r` in
456 5.0|5.0.*|5.1|5.1.*|5.2|5.2.*|5.3|5.3.*|5.5|5.5.*)
457 AC_MSG_RESULT([no large file support])
458 ;;
459 5.*)
460 AC_MSG_RESULT([enabling large file support])
461 if test "$ac_cv_prog_gcc" = yes; then
462 ${CC-cc} -v >conftest.c 2>&1
463 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
464 rm -fr conftest.c
465 case "$ac_cv_gcc_compiler_version_number" in
466 *"gcc version 2.6"*|*"gcc version 2.7"*)
467 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE -D_REENTRANT"
468 LDFLAGS="$LDFLAGS -lthread"
469 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
470 ;;
471 *)
472 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64"
473 LDFLAGS="$LDFLAGS -lthread"
474 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
475 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
476 ;;
477 esac
478 else
479 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64"
480 LDFLAGS="$LDFLAGS -lthread"
481 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
482 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
483 fi
484 ;;
485 esac
486 ;;
487#
488# IRIX uses SYSV printing. Make sure to set that here
489#
490 *irix*)
491 AC_DEFINE(SYSV, 1, [Whether to enable System V compatibility])
492 ;;
493 *freebsd*|*dragonfly*)
494 AC_DEFINE(FREEBSD, 1, [Whether the host os is FreeBSD])
495 ;;
496#
497# VOS may need to have POSIX support and System V compatibility enabled.
498#
499 *vos*)
500 case "$CPPFLAGS" in
501 *-D_POSIX_C_SOURCE*)
502 ;;
503 *)
504 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
505 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
506 ;;
507 esac
508 case "$CPPFLAGS" in
509 *-D_SYSV*|*-D_SVID_SOURCE*)
510 ;;
511 *)
512 CPPFLAGS="$CPPFLAGS -D_SYSV"
513 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
514 esac
515 ;;
516#
517# Tests needed for SINIX large file support.
518#
519 *sysv4*)
520 if test $host = mips-sni-sysv4 ; then
521 AC_MSG_CHECKING([for LFS support])
522 old_CPPFLAGS="$CPPFLAGS"
523 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
524 AC_TRY_RUN([
525#include <unistd.h>
526main () {
527#if _LFS64_LARGEFILE == 1
528exit(0);
529#else
530exit(1);
531#endif
532}], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
533 CPPFLAGS="$old_CPPFLAGS"
534 if test x$SINIX_LFS_SUPPORT = xyes ; then
535 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
536 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
537 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
538 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
539 LIBS="`getconf LFS64_LIBS` $LIBS"
540 fi
541 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
542 fi
543 ;;
544
545# Systems with LFS support.
546#
547 gnu* | k*bsd*-gnu | kopensolaris*-gnu)
548 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
549 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
550 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
551 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
552 ;;
553
554# Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
555#
556 *linux*)
557 AC_MSG_CHECKING([for LFS support])
558 old_CPPFLAGS="$CPPFLAGS"
559 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
560 AC_TRY_RUN([
561#include <unistd.h>
562#include <sys/utsname.h>
563#include <string.h>
564#include <stdlib.h>
565main() {
566#if _LFS64_LARGEFILE == 1
567 struct utsname uts;
568 char *release;
569 int major, minor;
570
571 /* Ensure this is glibc 2.2 or higher */
572#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
573 int libc_major = __GLIBC__;
574 int libc_minor = __GLIBC_MINOR__;
575
576 if (libc_major < 2)
577 exit(1);
578 if (libc_minor < 2)
579 exit(1);
580#endif
581
582 /* Ensure this is kernel 2.4 or higher */
583
584 uname(&uts);
585 release = strdup(uts.release);
586 major = atoi(strsep(&release, "."));
587 minor = atoi(strsep(&release, "."));
588
589 if (major > 2 || (major == 2 && minor > 3))
590 exit(0);
591 exit(1);
592#else
593 exit(1);
594#endif
595}
596], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
597 CPPFLAGS="$old_CPPFLAGS"
598 if test x$LINUX_LFS_SUPPORT = xyes ; then
599 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
600 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
601 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
602 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
603 fi
604 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
605 ;;
606
607#
608# MacOS X is the *only* system that uses compose character in utf8. This
609# is so horribly broken....
610#
611 *darwin*)
612 AC_DEFINE(BROKEN_UNICODE_COMPOSE_CHARACTERS, 1, [Does this system use unicode compose characters])
613
614# Add a system specific charset module.
615 default_shared_modules="$default_shared_modules charset_macosxfs"
616
617 ;;
618 *hurd*)
619 AC_MSG_CHECKING([for LFS support])
620 old_CPPFLAGS="$CPPFLAGS"
621 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
622 AC_TRY_RUN([
623#include <unistd.h>
624main () {
625#if _LFS64_LARGEFILE == 1
626exit(0);
627#else
628exit(1);
629#endif
630}], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
631 CPPFLAGS="$old_CPPFLAGS"
632 if test x$GLIBC_LFS_SUPPORT = xyes ; then
633 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
634 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
635 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
636 fi
637 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
638 ;;
639 *qnx*)
640 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
641 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
642 ;;
643
644esac
645
646SAVE_CPPFLAGS="${CPPFLAGS}"
647CPPFLAGS="${CPPFLAGS} ${SAMBA_CONFIGURE_CPPFLAGS}"
648
649AC_LIBREPLACE_BROKEN_CHECKS
650AC_CHECK_FUNCS([syslog],[],[AC_MSG_ERROR([Required function not found])])
651AC_LIBREPLACE_NETWORK_CHECKS
652
653CPPFLAGS="${SAVE_CPPFLAGS}"
654
655LIBREPLACE_DIR=`echo ${libreplacedir} | sed -e "s;${srcdir};;" -e "s;^/;;"`
656
657LIBREPLACE_OBJS="${LIBREPLACEOBJ}"
658AC_SUBST(LIBREPLACE_OBJS)
659
660LIBREPLACE_LIBS="${LIBREPLACE_NETWORK_LIBS}"
661AC_SUBST(LIBREPLACE_LIBS)
662
663
664# add -ldl to the global LIBS
665LIBS="${LIBS} ${LIBDL} ${LIBREPLACE_NETWORK_LIBS}"
666AUTH_LIBS="${AUTH_LIBS} ${CRYPT_LIBS}"
667
668
669AC_CHECK_HEADERS(aio.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h rpc/nettype.h)
670AC_CHECK_HEADERS(unistd.h grp.h sys/id.h memory.h alloca.h)
671AC_CHECK_HEADERS(limits.h float.h libintl.h)
672AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/ypclnt.h)
673AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h sys/sysctl.h)
674AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h)
675AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
676AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h)
677AC_CHECK_HEADERS(sys/sysmacros.h)
678AC_CHECK_HEADERS(sys/syslog.h syslog.h)
679AC_CHECK_HEADERS(langinfo.h locale.h)
680AC_CHECK_HEADERS(xfs/libxfs.h)
681AC_CHECK_HEADERS(netgroup.h)
682
683AC_CHECK_HEADERS(rpcsvc/yp_prot.h,,,[[
684#if HAVE_RPC_RPC_H
685#include <rpc/rpc.h>
686#endif
687]])
688
689## These fail to compile on IRIX so just check for their presence
690AC_CHECK_HEADERS(sys/mode.h,,,)
691
692# Look for Darwin headers
693old_CPPFLAGS="$CPPFLAGS"
694CPPFLAGS="-Iinclude $CPPFLAGS"
695AC_CHECK_HEADERS([CoreFoundation/CFStringEncodingConverter.h], [], [AC_CHECK_HEADERS([CFStringEncodingConverter.h])])
696CPPFLAGS="$old_CPPFLAGS"
697
698# In valgrind 1.0.x, it's just valgrind.h. In 1.9.x+ there's a
699# subdirectory of headers.
700AC_CHECK_HEADERS(valgrind.h valgrind/valgrind.h valgrind/memcheck.h)
701
702#
703# HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
704# This causes configure to fail to detect it. Check for shadow separately on HPUX.
705#
706case "$host_os" in
707 *hpux*)
708 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
709 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
710 if test x"$ac_cv_header_shadow_h" = x"yes"; then
711 AC_DEFINE(HAVE_SHADOW_H,1,[Whether we have shadow.h])
712 fi
713 ;;
714esac
715AC_CHECK_HEADERS(shadow.h)
716AC_CHECK_HEADERS(nss.h nss_common.h nsswitch.h ns_api.h sys/security.h)
717AC_CHECK_HEADERS(syscall.h sys/syscall.h)
718
719AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h)
720AC_CHECK_HEADERS(sys/ea.h sys/proplist.h)
721
722AC_CHECK_HEADERS(sys/cdefs.h glob.h)
723
724# For experimental utmp support (lastlog on some BSD-like systems)
725AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
726
727AC_CHECK_SIZEOF(int,cross)
728AC_CHECK_SIZEOF(long,cross)
729AC_CHECK_SIZEOF(long long,cross)
730AC_CHECK_SIZEOF(short,cross)
731
732AC_C_CONST
733AC_C_INLINE
734AC_C_BIGENDIAN
735AC_C_CHAR_UNSIGNED
736
737AC_TYPE_SIGNAL
738AC_TYPE_UID_T
739AC_TYPE_MODE_T
740AC_TYPE_OFF_T
741AC_TYPE_SIZE_T
742AC_TYPE_PID_T
743AC_STRUCT_ST_RDEV
744AC_DIRENT_D_OFF
745AC_CHECK_TYPE(ssize_t, int)
746AC_CHECK_TYPE(wchar_t, unsigned short)
747
748############################################
749# for cups support we need libcups, and a handful of header files
750
751AC_ARG_ENABLE(cups,
752[AS_HELP_STRING([--enable-cups], [Turn on CUPS support (default=auto)])])
753
754if test x$enable_cups != xno; then
755 AC_PATH_PROG(CUPS_CONFIG, cups-config)
756
757 if test "x$CUPS_CONFIG" != x; then
758
759 ac_save_CFLAGS=$CFLAGS
760 ac_save_LDFLAGS=$LDFLAGS
761 ac_save_PRINT_LIBS=$PRINT_LIBS
762 case "$host_os" in
763 *os2*)
764 PRINT_LIBS="$PRINT_LIBS -lcups -pthread"
765 ;;
766 *)
767 CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
768 LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
769 PRINT_LIBS="$PRINT_LIBS -lcups"
770 ;;
771 esac
772 AC_CHECK_HEADERS(cups/cups.h cups/language.h)
773
774 if test x"$ac_cv_header_cups_cups_h" = xyes -a \
775 x"$ac_cv_header_cups_language_h" = xyes; then
776 # try linking with -lcups alone first. That should work unless libcups is
777 # underlinked. With cups-config --libs we pull in unwanted and unneeded
778 # dendencies including thread libraries - use cups-config only if really
779 # required.
780 AC_CHECK_LIB_EXT(cups, ac_save_PRINT_LIBS , httpConnect,
781 [PRINT_LIBS"$ac_save_PRINT_LIBS -lcups"],
782 [AC_MSG_WARN([your cups library doesn't link with -lcups alone, it might be underlinked.]) ;
783 PRINT_LIBS="$ac_save_PRINT_LIBS `$CUPS_CONFIG --libs`"])
784
785 AC_DEFINE(HAVE_CUPS,1,[Whether we have CUPS])
786 samba_cv_HAVE_CUPS=yes
787 AC_CHECK_LIB_EXT(cups, PRINT_LIBS, httpConnectEncrypt)
788 else
789 AC_MSG_WARN([cups-config around but cups-devel not installed])
790 CFLAGS=$ac_save_CFLAGS
791 LDFLAGS=$ac_save_LDFLAGS
792 PRINT_LIBS=$ac_save_PRINT_LIBS
793 fi
794
795 elif test x"$enable_cups" = x"yes"; then
796 AC_MSG_ERROR(Cups support required but cups-config not located. Make sure cups-devel related files are installed.)
797 fi
798fi
799
800AC_ARG_ENABLE(iprint,
801[AS_HELP_STRING([--enable-iprint], [Turn on iPrint support (default=yes if cups is yes)])])
802
803if test x$enable_iprint != xno; then
804 if test x"$samba_cv_HAVE_CUPS" = xyes; then
805 AC_DEFINE(HAVE_IPRINT,1,[Whether we have iPrint])
806 elif test x"$enable_iprint" = x"yes"; then
807 AC_MSG_ERROR(iPrint support required but cups not enabled. Make sure cups-devel related files are installed and that cups is enabled.)
808 fi
809fi
810
811############################################
812# check if the compiler will optimize out function calls
813AC_CACHE_CHECK([if the compiler will optimize out function calls],samba_cv_optimize_out_funcation_calls, [
814 AC_TRY_LINK([
815#include <stdio.h>],
816[
817 if (0) {
818 this_function_does_not_exist();
819 } else {
820 return 1;
821 }
822
823],
824 samba_cv_optimize_out_funcation_calls=yes,samba_cv_optimize_out_funcation_calls=no)])
825if test x"$samba_cv_optimize_out_funcation_calls" = x"yes"; then
826 AC_DEFINE(HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS,1,[Whether the compiler will optimize out function calls])
827fi
828
829#############################################
830# check for fd passing struct via msg_control
831AC_CACHE_CHECK([for fd passing via msg_control],samba_cv_msghdr_msg_control, [
832 AC_TRY_COMPILE([
833#include <sys/types.h>
834#include <stdlib.h>
835#include <stddef.h>
836#include <sys/socket.h>
837#include <sys/un.h>],
838[
839 struct msghdr msg;
840 union {
841 struct cmsghdr cm;
842 char control[CMSG_SPACE(sizeof(int))];
843 } control_un;
844 msg.msg_control = control_un.control;
845 msg.msg_controllen = sizeof(control_un.control);
846],
847 samba_cv_msghdr_msg_control=yes,samba_cv_msghdr_msg_control=no)])
848if test x"$samba_cv_msghdr_msg_control" = x"yes"; then
849 AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL,1,
850 [If we can use msg_control for passing file descriptors])
851fi
852
853#############################################
854# check for fd passing struct via msg_acctrights
855AC_CACHE_CHECK([for fd passing via msg_acctrights],
856 samba_cv_msghdr_msg_acctrights, [
857 AC_TRY_COMPILE([
858#include <sys/types.h>
859#include <stdlib.h>
860#include <stddef.h>
861#include <sys/socket.h>
862#include <sys/un.h>],
863[
864 struct msghdr msg;
865 int fd;
866 msg.msg_acctrights = (caddr_t) &fd;
867 msg.msg_acctrightslen = sizeof(fd);
868],
869 samba_cv_msghdr_msg_acctrights=yes,samba_cv_msghdr_msg_acctrights=no)])
870if test x"$samba_cv_msghdr_msg_acctrights" = x"yes"; then
871 AC_DEFINE(HAVE_MSGHDR_MSG_ACCTRIGHTS,1,
872 [If we can use msg_acctrights for passing file descriptors])
873fi
874
875AC_CHECK_FUNCS(dirfd)
876if test x"$ac_cv_func_dirfd" = x"yes"; then
877 default_shared_modules="$default_shared_modules vfs_syncops vfs_dirsort"
878fi
879
880AC_CACHE_CHECK([for struct sigevent type],samba_cv_struct_sigevent, [
881 AC_TRY_COMPILE([
882#include <sys/types.h>
883#if STDC_HEADERS
884#include <stdlib.h>
885#include <stddef.h>
886#endif
887#include <signal.h>],[struct sigevent s;],
888 samba_cv_struct_sigevent=yes,samba_cv_struct_sigevent=no)])
889if test x"$samba_cv_struct_sigevent" = x"yes"; then
890 AC_DEFINE(HAVE_STRUCT_SIGEVENT,1,[Whether we have the struct sigevent])
891 AC_CHECK_MEMBERS([struct sigevent.sigev_value.sival_ptr,struct sigevent.sigev_value.sigval_ptr], , ,
892 [#include <signal.h>])
893fi
894
895AC_CACHE_CHECK([for struct timespec type],samba_cv_struct_timespec, [
896 AC_TRY_COMPILE([
897#include <sys/types.h>
898#if STDC_HEADERS
899#include <stdlib.h>
900#include <stddef.h>
901#endif
902#if TIME_WITH_SYS_TIME
903# include <sys/time.h>
904# include <time.h>
905#else
906# if HAVE_SYS_TIME_H
907# include <sys/time.h>
908# else
909# include <time.h>
910# endif
911#endif
912],[struct timespec ts;],
913 samba_cv_struct_timespec=yes,samba_cv_struct_timespec=no)])
914if test x"$samba_cv_struct_timespec" = x"yes"; then
915 AC_DEFINE(HAVE_STRUCT_TIMESPEC,1,[Whether we have struct timespec])
916fi
917
918# and glibc has setresuid under linux but the function does
919# nothing until kernel 2.1.44! very dumb.
920AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
921 AC_TRY_RUN([#include <errno.h>
922main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
923 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
924if test x"$samba_cv_have_setresuid" = x"yes"; then
925 AC_DEFINE(HAVE_SETRESUID,1,[Whether the system has setresuid])
926fi
927
928# Do the same check for setresguid...
929#
930AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
931 AC_TRY_RUN([#include <unistd.h>
932#include <errno.h>
933main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
934 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
935if test x"$samba_cv_have_setresgid" = x"yes"; then
936 AC_DEFINE(HAVE_SETRESGID,1,[Whether the system has setresgid])
937fi
938
939AC_FUNC_MEMCMP
940
941###############################################
942# Readline included by default unless explicitly asked not to
943test "${with_readline+set}" != "set" && with_readline=yes
944
945# test for where we get readline() from
946AC_MSG_CHECKING(whether to use readline)
947AC_ARG_WITH(readline,
948[AS_HELP_STRING([--with-readline[=DIR]], [Look for readline include/libs in DIR (default=auto)])],
949[ case "$with_readline" in
950 yes)
951 AC_MSG_RESULT(yes)
952
953 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
954 AC_CHECK_HEADERS(readline/history.h)
955
956 AC_CHECK_HEADERS(readline.h readline/readline.h,[
957 for termlib in ncurses curses termcap terminfo termlib tinfo; do
958 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
959 done
960 AC_CHECK_LIB(readline, rl_callback_handler_install,
961 [TERMLIBS="-lreadline $TERMLIBS"
962 AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
963 break], [TERMLIBS=], $TERMLIBS)])
964 ;;
965 no)
966 AC_MSG_RESULT(no)
967 ;;
968 *)
969 AC_MSG_RESULT(yes)
970
971 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
972 # alternate readline path
973 _ldflags=${LDFLAGS}
974 _cppflags=${CPPFLAGS}
975
976 # Add additional search path
977 LDFLAGS="-L$with_readline/lib $LDFLAGS"
978 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
979
980 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
981 AC_CHECK_HEADERS(readline/history.h)
982
983 AC_CHECK_HEADERS(readline.h readline/readline.h,[
984 for termlib in ncurses curses termcap terminfo termlib; do
985 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
986 done
987 AC_CHECK_LIB(readline, rl_callback_handler_install,
988 [TERMLDFLAGS="-L$with_readline/lib"
989 TERMCPPFLAGS="-I$with_readline/include"
990 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
991 TERMLIBS="-lreadline $TERMLIBS"
992 AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
993 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
994
995 LDFLAGS=$_ldflags
996 ;;
997 esac],
998 AC_MSG_RESULT(no)
999)
1000AC_SUBST(TERMLIBS)
1001AC_SUBST(TERMLDFLAGS)
1002
1003# The readline API changed slightly from readline3 to readline4, so
1004# code will generate warnings on one of them unless we have a few
1005# special cases.
1006AC_CHECK_LIB(readline, rl_completion_matches,
1007 [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1,
1008 [Do we have rl_completion_matches?])],
1009 [],
1010 [$TERMLIBS])
1011
1012# not all readline libs have rl_event_hook or history_list
1013AC_CHECK_DECLS(rl_event_hook, [], [], [#include <readline/readline.h>])
1014AC_CHECK_LIB(readline, history_list,
1015 [AC_DEFINE(HAVE_HISTORY_LIST, 1, [Do we have history_list?])],
1016 [],
1017 [$TERMLIBS])
1018
1019###############################################
1020# test for where we get yp_get_default_domain() from
1021AC_SEARCH_LIBS(yp_get_default_domain, [nsl])
1022AC_CHECK_FUNCS(yp_get_default_domain)
1023
1024# Check if we have execl, if not we need to compile smbrun.
1025AC_CHECK_FUNCS(execl)
1026if test x"$ac_cv_func_execl" = x"no"; then
1027 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbrun\$(EXEEXT)"
1028fi
1029
1030AC_CHECK_FUNCS(getcwd fchown chmod fchmod mknod mknod64)
1031AC_CHECK_FUNCS(strtol)
1032AC_CHECK_FUNCS(strchr chflags)
1033AC_CHECK_FUNCS(getrlimit fsync fdatasync setpgid)
1034AC_CHECK_FUNCS(setsid glob strpbrk crypt16 getauthuid)
1035AC_CHECK_FUNCS(sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
1036AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
1037AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf stat64 fstat64)
1038AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64)
1039AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam)
1040AC_CHECK_FUNCS(opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64)
1041AC_CHECK_FUNCS(getpwent_r)
1042AC_CHECK_FUNCS(getdents64)
1043AC_CHECK_FUNCS(setenv strcasecmp fcvt fcvtl)
1044AC_CHECK_FUNCS(syslog vsyslog timegm)
1045AC_CHECK_FUNCS(setlocale nl_langinfo)
1046AC_CHECK_FUNCS(nanosleep,,[AC_CHECK_LIB_EXT(rt, LIBS, nanosleep)])
1047AC_CHECK_FUNCS(utimensat)
1048AC_CHECK_FUNCS(mlock munlock mlockall munlockall)
1049AC_CHECK_FUNCS(memalign posix_memalign hstrerror)
1050AC_CHECK_HEADERS(sys/mman.h)
1051# setbuffer, shmget, shm_open are needed for smbtorture
1052AC_CHECK_FUNCS(shmget shm_open)
1053AC_CHECK_FUNCS(gettext dgettext)
1054AC_CHECK_FUNCS(bindtextdomain textdomain)
1055AC_CHECK_FUNCS(strupr)
1056
1057# Find a method of generating a stack trace
1058AC_CHECK_HEADERS(execinfo.h libexc.h libunwind.h)
1059# libexecinfo provides backtrace_symbols on FreeBSD
1060AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
1061AC_CHECK_FUNCS(backtrace_symbols)
1062AC_CHECK_LIB(exc, trace_back_stack)
1063
1064# check for sysctlbyname for BSD systems
1065AC_CHECK_FUNCS(sysctlbyname)
1066
1067#############################
1068# check if building with gpfs
1069AC_CHECK_HEADERS(gpfs_gpl.h)
1070if test x"$ac_cv_header_gpfs_gpl_h" = x"yes"; then
1071 AC_DEFINE(HAVE_GPFS,1,[Whether GPFS GPL headers are available])
1072 default_shared_modules="$default_shared_modules vfs_gpfs"
1073fi
1074
1075#############################################
1076# check if building on Isilon OneFS
1077printf "%s" "checking for Isilon OneFS... "
1078save_LIBS="$LIBS"
1079LIBS="$LIBS -lisi_version"
1080AC_TRY_LINK([#include <isi_version/isi_version.h>],
1081 [get_isilon_copyright()],
1082 samba_cv_HAVE_ONEFS=yes,
1083 samba_cv_HAVE_ONEFS=no)
1084echo $samba_cv_HAVE_ONEFS
1085if test x"$samba_cv_HAVE_ONEFS" = x"yes"; then
1086 AC_DEFINE(HAVE_ONEFS,1,[Whether building on Isilon OneFS])
1087 default_shared_modules="$default_shared_modules vfs_onefs vfs_onefs_shadow_copy perfcount_onefs"
1088 default_static_modules="$default_static_modules"
1089 ONEFS_LIBS="-lisi_acl -lisi_ecs -lisi_event -lisi_util"
1090 # Need to also add general libs for oplocks support
1091 save_LIBS="$save_LIBS -lisi_ecs -lisi_event -lisi_util -ldevstat"
1092fi
1093AC_SUBST(ONEFS_LIBS)
1094LIBS="$save_LIBS"
1095
1096# Note that all the libunwind symbols in the API are defined to internal
1097# platform-specific version, so we must include libunwind.h before checking
1098# any of them.
1099AC_MSG_CHECKING([for libunwind])
1100save_LIBS=$LIBS
1101
1102UNWIND_ARCH="unknown"
1103if test x"$UNAME_I" != x"unknown"; then
1104 UNWIND_ARCH="$UNAME_I"
1105elif test x"$UNAME_M" != x"unknown"; then
1106 UNWIND_ARCH="$UNAME_M"
1107elif test x"$UNAME_P" != x"unknown"; then
1108 UNWIND_ARCH="$UNAME_P"
1109fi
1110
1111case "$UNWIND_ARCH" in
1112 unknown)
1113 # This probably won't link without
1114 # the platform-specific libunwind.
1115 LIBS="$LIBS -lunwind"
1116 ;;
1117 i386|i586|i686)
1118 # Add the platform-specific libunwind module.
1119 LIBS="$LIBS -lunwind -lunwind-x86"
1120 ;;
1121 *)
1122 # Add the platform-specific libunwind module.
1123 # based on uname -i, uname -m or uname -p
1124 LIBS="$LIBS -lunwind -lunwind-$UNWIND_ARCH"
1125 ;;
1126esac
1127
1128AC_TRY_LINK(
1129 [
1130#ifdef HAVE_LIBUNWIND_H
1131#include <libunwind.h>
1132#endif
1133 ],
1134 [
1135 unw_context_t ctx; unw_cursor_t cur;
1136 char buf[256]; unw_word_t off;
1137 unw_getcontext(&ctx); unw_init_local(&cur, &ctx);
1138 unw_get_proc_name(&cur, buf, sizeof(buf), &off);
1139 ],
1140 [
1141 AC_MSG_RESULT(yes)
1142 AC_DEFINE(HAVE_LIBUNWIND, 1, [Whether libunwind is available])
1143
1144 # If we have libunwind, test whether we also have libunwind-ptrace
1145 # which would let us unwind arbitrary processes.
1146 save_LIBS=$LIBS
1147 AC_CHECK_HEADERS(libunwind-ptrace.h)
1148 AC_CHECK_LIB(unwind-ptrace, _UPT_create,
1149 [
1150 LIBUNWIND_PTRACE="-lunwind-ptrace";
1151 AC_DEFINE(HAVE_LIBUNWIND_PTRACE, 1,
1152 [Whether libunwind-ptrace.a is available.])
1153 ],
1154 [ LIBUNWIND_PTRACE="" ])
1155
1156 LIBS=$save_LIBS
1157 ],
1158 [
1159 AC_MSG_RESULT(no)
1160 LIBS=$save_LIBS
1161 ])
1162
1163# To use libunwind-ptrace, we also need to make some ptrace system calls.
1164if test x"$LIBUNWIND_PTRACE" != x"" ; then
1165 AC_CHECK_HEADERS(sys/ptrace.h)
1166 AC_MSG_CHECKING([for the Linux ptrace(2) interface])
1167 AC_TRY_LINK(
1168 [
1169#if HAVE_SYS_TYPES_H
1170#include <sys/types.h>
1171#endif
1172#if HAVE_SYS_PTRACE_H
1173#include <sys/ptrace.h>
1174#endif
1175 ],
1176 [
1177 pid_t me = (pid_t)-1;
1178 ptrace(PTRACE_ATTACH, me, 0, 0);
1179 ptrace(PTRACE_DETACH, me, 0, 0);
1180 return 0;
1181 ],
1182 [
1183 AC_MSG_RESULT(yes)
1184 AC_DEFINE(HAVE_LINUX_PTRACE, 1,
1185 [Whether the Linux ptrace(2) interface is available.])
1186 ],
1187 [
1188 AC_MSG_RESULT(no)
1189 LIBUNWIND_PTRACE=""
1190 ])
1191fi
1192
1193AC_SUBST(LIBUNWIND_PTRACE)
1194
1195AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
1196AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
1197AC_CHECK_FUNCS(__getcwd _getcwd)
1198AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
1199AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
1200AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
1201AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
1202AC_CHECK_FUNCS(getdents __getdents _lseek __lseek _read __read)
1203AC_CHECK_FUNCS(getdirentries _write __write _fork __fork)
1204AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
1205AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
1206AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
1207AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
1208AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
1209AC_CHECK_FUNCS(prctl)
1210
1211AC_TRY_COMPILE([
1212#ifdef HAVE_SYS_PRCTL_H
1213#include <sys/prctl.h>
1214#endif
1215],
1216[int i; i = prtcl(0); ],
1217AC_DEFINE(HAVE_PRCTL, 1, [Whether prctl is available]),[])
1218
1219#
1220#
1221#
1222case "$host_os" in
1223 *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
1224 # glibc <= 2.3.2 has a broken getgrouplist
1225 AC_CACHE_CHECK([for good getgrouplist],samba_cv_linux_getgrouplist_ok,[AC_TRY_RUN([
1226#include <unistd.h>
1227#include <sys/utsname.h>
1228main() {
1229 /* glibc up to 2.3 has a broken getgrouplist */
1230#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1231 int libc_major = __GLIBC__;
1232 int libc_minor = __GLIBC_MINOR__;
1233
1234 if (libc_major < 2)
1235 exit(1);
1236 if ((libc_major == 2) && (libc_minor <= 3))
1237 exit(1);
1238#endif
1239 exit(0);
1240}
1241], [samba_cv_linux_getgrouplist_ok=yes],
1242 [samba_cv_linux_getgrouplist_ok=no],
1243 [samba_cv_linux_getgrouplist_ok=cross])])
1244 if test x"$samba_cv_linux_getgrouplist_ok" = x"yes"; then
1245 AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])
1246 fi
1247 ;;
1248 *)
1249 AC_CHECK_FUNCS(getgrouplist)
1250 ;;
1251esac
1252
1253#
1254# stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
1255#
1256
1257if test x$ac_cv_func_stat64 = xno ; then
1258 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
1259 AC_TRY_LINK([
1260#if defined(HAVE_UNISTD_H)
1261#include <unistd.h>
1262#endif
1263#include <sys/stat.h>
1264], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
1265 AC_MSG_RESULT([$ac_cv_func_stat64])
1266 if test x$ac_cv_func_stat64 = xyes ; then
1267 AC_DEFINE(HAVE_STAT64,1,[Whether stat64() is available])
1268 fi
1269fi
1270
1271if test x$ac_cv_func_lstat64 = xno ; then
1272 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
1273 AC_TRY_LINK([
1274#if defined(HAVE_UNISTD_H)
1275#include <unistd.h>
1276#endif
1277#include <sys/stat.h>
1278], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
1279 AC_MSG_RESULT([$ac_cv_func_lstat64])
1280 if test x$ac_cv_func_lstat64 = xyes ; then
1281 AC_DEFINE(HAVE_LSTAT64,[Whether lstat64() is available])
1282 fi
1283fi
1284
1285if test x$ac_cv_func_fstat64 = xno ; then
1286 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
1287 AC_TRY_LINK([
1288#if defined(HAVE_UNISTD_H)
1289#include <unistd.h>
1290#endif
1291#include <sys/stat.h>
1292], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
1293 AC_MSG_RESULT([$ac_cv_func_fstat64])
1294 if test x$ac_cv_func_fstat64 = xyes ; then
1295 AC_DEFINE(HAVE_FSTAT64,1,[Whether fstat64() is available])
1296 fi
1297fi
1298
1299#################################################
1300# Check whether struct stat has timestamps with sub-second resolution.
1301#
1302
1303samba_cv_stat_hires=no
1304AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec], # Linux, Solaris
1305 [samba_cv_stat_hires=yes])
1306AC_CHECK_MEMBERS([struct stat.st_mtimensec], # BSD, if defined _POSIX_SOURCE
1307 [samba_cv_stat_hires=yes])
1308AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec], # BSD, if not defined _POSIX_SOURCE
1309 [samba_cv_stat_hires=yes])
1310AC_CHECK_MEMBERS([struct stat.st_mtime_n], # AIX
1311 [samba_cv_stat_hires=yes])
1312AC_CHECK_MEMBERS([struct stat.st_umtime], # Tru64
1313 [samba_cv_stat_hires=yes])
1314
1315if test x"$samba_cv_stat_hires" = x"yes" ; then
1316 AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1,
1317 [whether struct stat has sub-second timestamps])
1318fi
1319
1320# recent FreeBSD, NetBSD have creation timestamps called birthtime:
1321AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
1322AC_CHECK_MEMBERS([struct stat.st_birthtime], AC_CHECK_MEMBERS([struct stat.st_birthtimensec]))
1323
1324
1325AC_CACHE_CHECK([whether there is DOS flags support in the stat struct], samba_cv_stat_dos_flags,
1326 [
1327 AC_TRY_COMPILE(
1328 [#include <sys/stat.h>],
1329 [
1330 int a = UF_DOS_ARCHIVE;
1331 int h = UF_DOS_HIDDEN;
1332 int r = UF_DOS_RO;
1333 int s = UF_DOS_SYSTEM;
1334 int i = UF_DOS_NOINDEX;
1335 int f = UF_DOS_FLAGS;
1336 ],
1337 samba_cv_stat_dos_flags=yes, samba_cv_stat_dos_flags=no)
1338 ])
1339
1340if test x"$samba_cv_stat_dos_flags" = x"yes" ; then
1341 AC_DEFINE(HAVE_STAT_DOS_FLAGS, 1, [whether there is DOS flags support in the stat struct])
1342fi
1343
1344#####################################
1345# needed for SRV lookups
1346AC_CHECK_LIB(resolv, dn_expand)
1347AC_CHECK_LIB(resolv, _dn_expand)
1348AC_CHECK_LIB(resolv, __dn_expand)
1349
1350#
1351# Check for the functions putprpwnam, set_auth_parameters,
1352# getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
1353# Needed for OSF1 and HPUX.
1354#
1355
1356AC_LIBTESTFUNC(security, putprpwnam)
1357AC_LIBTESTFUNC(sec, putprpwnam)
1358
1359AC_LIBTESTFUNC(security, set_auth_parameters)
1360AC_LIBTESTFUNC(sec, set_auth_parameters)
1361
1362# UnixWare 7.x has its getspnam in -lgen
1363AC_LIBTESTFUNC(gen, getspnam)
1364
1365AC_LIBTESTFUNC(security, getspnam)
1366AC_LIBTESTFUNC(sec, getspnam)
1367
1368AC_LIBTESTFUNC(security, bigcrypt)
1369AC_LIBTESTFUNC(sec, bigcrypt)
1370
1371AC_LIBTESTFUNC(security, getprpwnam)
1372AC_LIBTESTFUNC(sec, getprpwnam)
1373
1374AC_CHECK_FUNCS(strsignal)
1375
1376############################################
1377# Check if we have libattr
1378case "$host_os" in
1379 *osf*)
1380 AC_SEARCH_LIBS(getproplist, [proplist])
1381 AC_CHECK_FUNCS(getproplist fgetproplist setproplist fsetproplist)
1382 AC_CHECK_FUNCS(delproplist fdelproplist add_proplist_entry get_proplist_entry)
1383 AC_CHECK_FUNCS(sizeof_proplist_entry)
1384 ;;
1385 *)
1386 AC_SEARCH_LIBS(getxattr, [attr])
1387 AC_CHECK_FUNCS(getxattr lgetxattr fgetxattr listxattr llistxattr)
1388 AC_CHECK_FUNCS(getea fgetea lgetea listea flistea llistea)
1389 AC_CHECK_FUNCS(removeea fremoveea lremoveea setea fsetea lsetea)
1390 AC_CHECK_FUNCS(flistxattr removexattr lremovexattr fremovexattr)
1391 AC_CHECK_FUNCS(setxattr lsetxattr fsetxattr)
1392 AC_CHECK_FUNCS(attr_get attr_list attr_set attr_remove)
1393 AC_CHECK_FUNCS(attr_getf attr_listf attr_setf attr_removef)
1394 ;;
1395esac
1396
1397########################################################
1398# Check if attropen() is present if this is Solaris
1399case "$host_os" in
1400 *solaris*)
1401 AC_CHECK_FUNCS(attropen)
1402 ;;
1403esac
1404
1405########################################################
1406# Do xattr functions take additional options like on Darwin?
1407if test x"$ac_cv_func_getxattr" = x"yes" ; then
1408 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
1409 old_LIBS=$LIBS
1410 LIBS="$LIBS $ACL_LIBS"
1411 AC_TRY_COMPILE([
1412 #include <sys/types.h>
1413 #if HAVE_ATTR_XATTR_H
1414 #include <attr/xattr.h>
1415 #elif HAVE_SYS_XATTR_H
1416 #include <sys/xattr.h>
1417 #endif
1418 ],[
1419 getxattr(0, 0, 0, 0, 0, 0);
1420 ],
1421 [smb_attr_cv_xattr_add_opt=yes],
1422 [smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
1423 ])
1424 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
1425 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
1426 fi
1427fi
1428
1429# Check if we have extattr
1430case "$host_os" in
1431 *freebsd4* | *dragonfly* )
1432 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
1433 ;;
1434 *)
1435 AC_CHECK_FUNCS(extattr_delete_fd extattr_delete_file extattr_delete_link)
1436 AC_CHECK_FUNCS(extattr_get_fd extattr_get_file extattr_get_link)
1437 AC_CHECK_FUNCS(extattr_list_fd extattr_list_file extattr_list_link)
1438 AC_CHECK_FUNCS(extattr_set_fd extattr_set_file extattr_set_link)
1439 ;;
1440esac
1441
1442AC_DISABLE_STATIC
1443AC_ENABLE_SHARED
1444
1445# Set defaults
1446PIE_CFLAGS=""
1447PIE_LDFLAGS=""
1448AC_ARG_ENABLE(pie, [AS_HELP_STRING([--enable-pie], [Turn on pie support if available (default=yes)])])
1449
1450if test "x$enable_pie" != xno
1451then
1452 AC_CACHE_CHECK(for -pie and -fPIE, samba_cv_fpie,
1453 [
1454 cat > conftest.c <<EOF
1455int foo;
1456int main () { return 0;}
1457EOF
1458 if AC_TRY_COMMAND_NO_STDERR([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fPIE -o conftest conftest.c])
1459 then
1460 samba_cv_fpie=yes
1461 else
1462 samba_cv_fpie=no
1463 fi
1464 rm -f conftest*
1465 ])
1466 if test x"${samba_cv_fpie}" = x"yes"
1467 then
1468 PIE_CFLAGS="-fPIE"
1469 PIE_LDFLAGS="-pie"
1470 fi
1471fi
1472
1473# Set defaults
1474RELRO_LDFLAGS=""
1475AC_ARG_ENABLE(relro, [AS_HELP_STRING([--enable-relro], [Turn on Relocations Read-Only (relro) support if available (default=yes)])])
1476
1477if test "x$enable_relro" != xno
1478then
1479 AC_CACHE_CHECK([for -Wl,-z,relro], samba_cv_relro,
1480 [
1481 cat > conftest.c <<EOF
1482int foo;
1483main () { return 0;}
1484EOF
1485 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Wl,-z,relro -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1486 then
1487 samba_cv_relro=yes
1488 else
1489 samba_cv_relro=no
1490 fi
1491 rm -f conftest*
1492 ])
1493 if test x"${samba_cv_relro}" = x"yes"
1494 then
1495 RELRO_LDFLAGS="-Wl,-z,relro"
1496 fi
1497fi
1498
1499# Set defaults
1500SYMSEXT="syms"
1501AC_SUBST(SYMSEXT)
1502
1503# Assume non-shared by default and override below
1504BLDSHARED="false"
1505
1506# these are the defaults, good for lots of systems
1507HOST_OS="$host_os"
1508LDSHFLAGS="-shared"
1509MODULE_EXPORTS=""
1510SONAMEFLAG="#"
1511SHLD="\${CC} \${CFLAGS}"
1512PICFLAG="${PIE_CFLAGS}"
1513SHLIBEXT="so"
1514DSO_EXPORTS=""
1515
1516# this bit needs to be modified for each OS that supports share libs
1517# You need to specify how to create a shared library and
1518 # how to compile C code to produce PIC object files
1519
1520 AC_MSG_CHECKING([ability to build shared libraries])
1521
1522 # and these are for particular systems
1523 case "$host_os" in
1524 *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
1525 case "$host_os" in
1526 *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux]) ;;
1527 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx]) ;;
1528 esac
1529 BLDSHARED="true"
1530 LDSHFLAGS="-shared -Wl,-Bsymbolic"
1531 if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then
1532 LDSHFLAGS_Z_NODEFS="-Wl,--allow-shlib-undefined"
1533 fi
1534 DYNEXP="-Wl,--export-dynamic"
1535 PICFLAG="-fPIC"
1536 SONAMEFLAG="-Wl,-soname="
1537 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1538 ;;
1539 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
1540 BLDSHARED="true"
1541 if test "${GCC}" = "yes"; then
1542 PICFLAG="-fPIC"
1543 SONAMEFLAG="-Wl,-soname="
1544 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
1545 DYNEXP="-Wl,-E"
1546 fi
1547 LDSHFLAGS="-shared"
1548 else
1549 PICFLAG="-KPIC"
1550 LDSHFLAGS="-G"
1551 fi
1552 if test "$ac_cv_prog_gnu_ld" = "yes"; then
1553 SONAMEFLAG="-Wl,-soname="
1554 else
1555 SONAMEFLAG="-Wl,-h,"
1556 fi
1557 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1558 AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1559 ;;
1560 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
1561 BLDSHARED="true"
1562 LDSHFLAGS="-G"
1563 SONAMEFLAG="-Wl,-h,"
1564 PICFLAG="-KPIC" # Is this correct for SunOS
1565 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1566 AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1567 ;;
1568 *netbsd* | *freebsd* | *dragonfly* )
1569 BLDSHARED="true"
1570 LDSHFLAGS="-shared"
1571 DYNEXP="-Wl,--export-dynamic"
1572 SONAMEFLAG="-Wl,-soname,"
1573 PICFLAG="-fPIC -DPIC"
1574 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1575 AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1576 ;;
1577 *openbsd*) BLDSHARED="true"
1578 LDSHFLAGS="-shared"
1579 DYNEXP="-Wl,-Bdynamic"
1580 SONAMEFLAG="-Wl,-soname,"
1581 PICFLAG="-fPIC"
1582 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1583 AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1584 ;;
1585 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
1586 case "$host_os" in
1587 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
1588 ;;
1589 esac
1590 BLDSHARED="true"
1591 LDSHFLAGS="-Wl,-set_version,sgi1.0 -shared"
1592 SONAMEFLAG="-Wl,-soname,"
1593 if test "${GCC}" = "yes"; then
1594 PICFLAG="-fPIC"
1595 else
1596 PICFLAG="-KPIC"
1597 fi
1598 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1599 ;;
1600 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
1601 BLDSHARED="true"
1602 # use expfull to export underscored symbols
1603 # add rtl to remove /lib/crt0.o warning
1604 LDSHFLAGS="-Wl,-G,-bexpfull,-bbigtoc,-brtl"
1605 DYNEXP="-Wl,-brtl,-bexpfull,-bbigtoc"
1606 PICFLAG="-O2"
1607 # as AIX code is always position independent...
1608 # .po will just create compile warnings, use po.o:
1609 if test "${GCC}" != "yes"; then
1610 ## for funky AIX compiler using strncpy()
1611 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000 -qhalt=e"
1612 fi
1613
1614 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
1615 AC_DEFINE(BROKEN_STRNLEN,1,[Does strnlen work correctly])
1616 AC_DEFINE(BROKEN_STRNDUP,1,[Does strndup work correctly])
1617 ;;
1618 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
1619 # Use special PIC flags for the native HP-UX compiler.
1620 BLDSHARED="true"
1621 SHLD="cc"
1622 LDSHFLAGS="-b -Wl,-B,symbolic,-b,-z"
1623 SONAMEFLAG="-Wl,+h "
1624 PICFLAG="+z"
1625 if test "${GCC}" = "yes"; then
1626 PICFLAG="-fPIC"
1627 else
1628 PICFLAG="+z +ESnolit"
1629 fi
1630 if test "$host_cpu" = "ia64"; then
1631 SHLIBEXT="so"
1632 PICFLAG="+z"
1633 DYNEXP="-Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
1634 else
1635 SHLIBEXT="sl"
1636 DYNEXP="-Wl,-E,+b/usr/local/lib:/usr/lib"
1637 fi
1638 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
1639 AC_DEFINE(POSIX_ACL_NEEDS_MASK,1,[Does a POSIX ACL need a mask element])
1640 ;;
1641 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
1642 BLDSHARED="true"
1643 LDSHFLAGS="-shared"
1644 SONAMEFLAG="-Wl,-soname,"
1645 PICFLAG="-fPIC"
1646 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1647 AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1648 ;;
1649 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
1650 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1651 ;;
1652 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
1653 BLDSHARED="true"
1654 LDSHFLAGS="-shared"
1655 SONAMEFLAG="-Wl,-soname,"
1656 PICFLAG="-KPIC"
1657 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1658 ;;
1659 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
1660 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1661 ;;
1662 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
1663 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1664 ;;
1665 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
1666 case "$host" in
1667 *-univel-*) if [ test "$GCC" != yes ]; then
1668 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
1669 fi
1670 LDSHFLAGS="-G"
1671 DYNEXP="-Bexport"
1672 ;;
1673 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
1674 esac
1675 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1676 ;;
1677
1678 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
1679 if [ test "$GCC" != yes ]; then
1680 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
1681 fi
1682 LDSHFLAGS="-G"
1683 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1684 ;;
1685 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
1686 BLDSHARED="false"
1687 LDSHFLAGS=""
1688 ;;
1689
1690 *darwin*) AC_DEFINE(DARWINOS,1,[Whether the host os is Darwin/MacOSX])
1691 BLDSHARED="true"
1692 LDSHFLAGS="-dynamiclib -flat_namespace -undefined suppress"
1693 CFLAGS="$CFLAGS -fno-common"
1694 SHLD="\${CC}"
1695 SHLIBEXT="dylib"
1696 MODULE_EXPORTS="-exported_symbols_list \$(srcdir)/exports/modules-darwin.syms"
1697 SHLIBEXT="dylib"
1698 # Since gcc doesn't fail on unrecognised options, the
1699 # PIE test incorrectly succeeds. Darwin gcc does not
1700 # actually support the PIE stuff.
1701 PIE_LDFLAGS=
1702 PIE_CFLAGS=
1703 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1704 ;;
1705
1706 *os2*) AC_DEFINE(OS2, 1,[Weather the host os is OS/2])
1707 BLDSHARED="true"
1708 LDSHFLAGS="-ZDll"
1709 SHLIBEXT="dll"
1710 AC_DEFINE(STAT_ST_BLOCKSIZE, 512)
1711 ;;
1712
1713 *)
1714 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1715 ;;
1716 esac
1717
1718if test "$enable_shared" != "yes"; then
1719 BLDSHARED=false
1720fi
1721
1722if test "$enable_shared" = yes -a "${ac_cv_gnu_ld_version_script}" = yes; then
1723 DSO_EXPORTS=\$\(DSO_EXPORTS_CMD\)
1724fi
1725
1726if test x"$BLDSHARED" = x"true" ; then
1727 LDFLAGS="$LDFLAGS -L./bin"
1728fi
1729
1730AC_MSG_RESULT($BLDSHARED)
1731
1732saved_before_as_needed_ldflags="$LDFLAGS"
1733for flags in "-Wl,--as-needed" "-Wl,-z,ignore" "-z ignore" ; do
1734 saved_ldflags="$LDFLAGS"
1735 AC_MSG_CHECKING([if $flags works])
1736 LDFLAGS="$flags $saved_ldflags"
1737 AC_TRY_LINK([],[],
1738 [AC_MSG_RESULT([yes])
1739 LD_AS_NEEDED_FLAG=$flags
1740 ld_as_needed_flag_found=yes],
1741 AC_MSG_RESULT([no]))
1742 LDFLAGS="$LD_AS_NEEDED_FLAG $saved_ldflags"
1743 test x"$ld_as_needed_flag_found" = xyes && break
1744done
1745
1746# check if we have to disable LD_AS_NEEDED_FLAG:
1747# On some systems for a veriety of reasons linking with
1748# -Wl,--as-needed -lreadline -lncurses fails
1749# we have to retest, if these combination is detected before.
1750# Bugzilla #7209
1751
1752if test x$ac_cv_lib_readline_rl_callback_handler_install = xyes ; then
1753 if test x$ld_as_needed_flag_found = xyes ; then
1754 AC_MSG_CHECKING([if $LD_AS_NEEDED_FLAG works with readline])
1755 # try if check no fails
1756 save_LIBS=$LIBS
1757 LIBS="$LIBS $TERMLIBS"
1758 AC_TRY_LINK([], [rl_callback_handler_install();], [AC_MSG_RESULT([yes])],[ AC_MSG_RESULT([no]); LDFLAGS="$saved_before_as_needed_ldflags"])
1759 LIBS="$save_LIBS"
1760 fi
1761fi
1762
1763
1764
1765# for historical reasons almost all linkers don't complain about unresolved
1766# symbols in shared libs. Except for the internal samba modules we want to get
1767# errors when we produce a shared lib with unresolved symbols. On some
1768# platforms unresolved symbols might be intended, so we might have to add
1769# platform specific exceptions here.
1770
1771for flags in "-Wl,-z,defs" "-error_unresolved" "-Wl,-error_unresolved" ; do
1772 saved_ldflags="$LDFLAGS"
1773 AC_MSG_CHECKING([if $flags works])
1774 LDFLAGS="$flags $saved_ldflags"
1775 AC_TRY_LINK([],[],
1776 [AC_MSG_RESULT([yes])
1777 LDSHFLAGS_Z_DEFS=$flags
1778 ldshflags_z_defs_found=yes],
1779 AC_MSG_RESULT([no]))
1780 LDFLAGS=$saved_ldflags
1781 test x"$ldshflags_z_defs_found" = xyes && break
1782done
1783
1784AC_MSG_CHECKING([LDSHFLAGS_Z_DEFS])
1785AC_MSG_RESULT([$LDSHFLAGS_Z_DEFS])
1786AC_MSG_CHECKING([LDFLAGS])
1787AC_MSG_RESULT([$LDFLAGS])
1788AC_MSG_CHECKING([DYNEXP])
1789AC_MSG_RESULT([$DYNEXP])
1790
1791#######################################################
1792# test whether building a shared library actually works
1793if test $BLDSHARED = true; then
1794
1795AC_MSG_CHECKING([SHLD])
1796AC_MSG_RESULT([$SHLD])
1797AC_MSG_CHECKING([LDSHFLAGS])
1798AC_MSG_RESULT([$LDSHFLAGS])
1799
1800AC_MSG_CHECKING([SHLIBEXT])
1801AC_MSG_RESULT([$SHLIBEXT])
1802AC_MSG_CHECKING([SONAMEFLAG])
1803AC_MSG_RESULT([$SONAMEFLAG])
1804
1805AC_MSG_CHECKING([PICFLAG])
1806AC_MSG_RESULT([$PICFLAG])
1807
1808AC_MSG_CHECKING([NSSSONAMEVERSIONSUFFIX])
1809AC_MSG_RESULT([$NSSSONAMEVERSIONSUFFIX])
1810
1811AC_CACHE_CHECK([whether building shared libraries actually works],
1812 [ac_cv_shlib_works],[
1813 # try building a trivial shared library
1814 ac_cv_shlib_works=no
1815 # The $SHLD and $LDSHFLAGS variables may contain references to other
1816 # variables so they need to be eval'ed.
1817 if AC_TRY_COMMAND([$CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.o ${srcdir-.}/../tests/shlib.c 1>&AS_MESSAGE_LOG_FD])
1818 then
1819 if AC_TRY_COMMAND([`eval echo "$SHLD $LDSHFLAGS $PICFLAG"` -o "shlib.$SHLIBEXT" shlib.o 1>&AS_MESSAGE_LOG_FD])
1820 then
1821 ac_cv_shlib_works=yes
1822 fi
1823 fi
1824 rm -f "shlib.$SHLIBEXT" shlib.o
1825
1826])
1827if test $ac_cv_shlib_works = no; then
1828 BLDSHARED=false
1829fi
1830fi
1831
1832if test x"$BLDSHARED" != x"true"; then
1833 LDSHFLAGS="shared-libraries-disabled"
1834 SONAMEFLAG="shared-libraries-disabled"
1835 NSSSONAMEVERSIONSUFFIX="shared-libraries-disabled"
1836 SHLD="shared-libraries-disabled"
1837 PICFLAG="${PIE_CFLAGS}"
1838 SHLIBEXT="shared_libraries_disabled"
1839 merged_build_possible=no
1840fi
1841
1842AC_MSG_CHECKING([used PICFLAG])
1843AC_MSG_RESULT([$PICFLAG])
1844
1845AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension])
1846
1847AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
1848
1849
1850###########################################################
1851#
1852# Configuration of subsystem / libraries
1853#
1854###########################################################
1855
1856INSTALLLIBCMD_SH=:
1857INSTALLLIBCMD_A=:
1858UNINSTALLLIBCMD_SH=:
1859UNINSTALLLIBCMD_A=:
1860
1861if test $BLDSHARED = true; then
1862 INSTALLLIBCMD_SH="\$(INSTALLCMD)"
1863 UNINSTALLLIBCMD_SH="rm -f"
1864fi
1865if test $enable_static = yes; then
1866 INSTALLLIBCMD_A="\$(INSTALLCMD)"
1867 UNINSTALLLIBCMD_A="rm -f"
1868fi
1869
1870#################################################
1871# --disable-shared-libs
1872# can be used to disable the internal use of shared libs altogether
1873# (this only has an effect when building shared libs is enabled)
1874#
1875USESHARED=false
1876AC_SUBST(USESHARED)
1877
1878AC_MSG_CHECKING(whether to use shared libraries internally)
1879AC_ARG_ENABLE([shared-libs],
1880 AS_HELP_STRING([--enable-shared-libs],
1881 [Use shared libraries internally (default=yes)]),
1882 [enable_shared_libs=$enableval],
1883 [enable_shared_libs=yes])
1884
1885if test x"$enable_shared_libs" != x"no" ; then
1886 USESHARED=$BLDSHARED
1887fi
1888
1889AC_MSG_RESULT([$USESHARED])
1890
1891if test x"$enable_shared_libs" = x"yes" -a x"$BLDSHARED" != x"true" ; then
1892 AC_MSG_WARN([--enable-shared-libs: no support for shared libraries])
1893fi
1894
1895#################################################
1896# --with-static-libs=LIBS:
1897# link (internal) libs dynamically or statically?
1898#
1899# If a subsystem is built as a library then this controls whether they are
1900# linked into Samba targets statically or dynamically:
1901#
1902# * If we build the shared library at all, we link dynamically by default.
1903#
1904# * We only link statically if we don't build shared or if the library
1905# appears in the --with-static-libs configure option.
1906#
1907# Example:
1908# --with-static-libs=libtalloc makes use of libtalloc.a instead
1909# of linking the dynamic variant with -ltalloc.
1910#
1911# NOTE: This option only affects libraries that we do not only build
1912# but that samba also links against as libraries (as opposed to linking
1913# the plain object files. - This has to be configured in Makefile.in.
1914# So in particular it does not harm to give invalid or unknown names here.
1915#
1916
1917AC_ARG_WITH([static-libs],
1918 [AS_HELP_STRING([--with-static-libs=LIBS],
1919 [Comma-separated list of names of (internal) libraries to link statically (instead of dynamically)])],
1920 [AS_IF([test $withval],
1921 [for lib in `echo $withval | sed -e 's/,/ /g'` ; do
1922 [lib=`echo $lib | tr '[a-z]' '[A-Z]'`]
1923 eval LINK_$lib=STATIC
1924 done], [])],
1925 [])
1926
1927#
1928# WORKAROUND:
1929# until we have organized other internal subsystems (as util, registry
1930# and smbconf) into shared libraries, we CAN NOT link libnetapi
1931# dynamically to samba programs.
1932#
1933LINK_LIBNETAPI=STATIC
1934
1935LINK_LIBSMBCLIENT=STATIC
1936
1937#
1938# The library versions are hardcoded here
1939# and filled into the LIBFOO_SOVER variable.
1940#
1941# TODO: for talloc and tdb (at least), these should
1942# be extracted from their respective source directories
1943#
1944AC_ARG_ENABLE(external_libtalloc, [AS_HELP_STRING([--enable-external-libtalloc], [Enable external talloc [default=auto]])],
1945[ enable_external_libtalloc=$enableval ], [ enable_external_libtalloc=auto ])
1946
1947if test "x$enable_external_libtalloc" != xno
1948then
1949 PKG_CHECK_MODULES(LIBTALLOC, talloc >= 2.0.1,
1950 [ enable_external_libtalloc=yes ],
1951 [if test x$enable_external_libtalloc = xyes; then
1952 AC_MSG_ERROR([Unable to find libtalloc])
1953 else
1954 enable_external_libtalloc=no
1955 fi
1956 ])
1957fi
1958
1959if test "x$enable_external_libtalloc" = xno
1960then
1961 m4_include(../lib/talloc/libtalloc.m4)
1962 LINK_LIBTALLOC=STATIC
1963 SMB_LIBRARY(talloc, 2)
1964 LIBTALLOC_OBJ0=""
1965 for obj in ${TALLOC_OBJ}; do
1966 LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}"
1967 done
1968 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}"
1969 SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TALLOC_CFLAGS}"
1970 AC_SUBST(LIBTALLOC_OBJ0)
1971
1972 TALLOCTORT="bin/talloctort\$(EXEEXT)"
1973 AC_SUBST(TALLOCTORT)
1974fi
1975
1976
1977AC_ARG_ENABLE(external_libtdb,
1978 [AS_HELP_STRING([--enable-external-libtdb],
1979 [Enable external tdb [default=auto]])],
1980 [ enable_external_libtalloc=$enableval ],
1981 [ enable_external_libtalloc=auto ])
1982
1983if test "x$enable_external_libtdb" != xno
1984then
1985 PKG_CHECK_MODULES(LIBTDB, tdb >= 1.2.1,
1986 [ enable_external_libtdb=yes ],
1987 [
1988 if test x$enable_external_libtdb = xyes; then
1989 AC_MSG_ERROR([Unable to find libtdb])
1990 else
1991 enable_external_libtdb=no
1992 fi
1993 ])
1994fi
1995
1996AC_SUBST(LIBTDB_OBJ0)
1997if test "x$enable_external_libtdb" = xno
1998then
1999 m4_include(../lib/tdb/libtdb.m4)
2000 LINK_LIBTDB=STATIC
2001 SMB_LIBRARY(tdb, 1)
2002 LIBTDB_OBJ0=""
2003 for obj in ${TDB_OBJ}; do
2004 LIBTDB_OBJ0="${LIBTDB_OBJ0} ${tdbdir}/${obj}"
2005 done
2006 AC_SUBST(LIBTDB_OBJ0)
2007 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}"
2008 SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TDB_CFLAGS}"
2009
2010 TDBBACKUP="bin/tdbbackup\$(EXEEXT)"
2011 AC_SUBST(TDBBACKUP)
2012 TDBDUMP="bin/tdbdump\$(EXEEXT)"
2013 AC_SUBST(TDBDUMP)
2014 TDBTOOL="bin/tdbtool\$(EXEEXT)"
2015 AC_SUBST(TDBTOOL)
2016 TDBTORTURE="bin/tdbtorture\$(EXEEXT)"
2017 AC_SUBST(TDBTORTURE)
2018fi
2019
2020SMB_LIBRARY(netapi, 0)
2021SMB_LIBRARY(smbclient, 0)
2022SMB_LIBRARY(smbsharemodes, 0)
2023SMB_LIBRARY(addns, 0, no, [undefined API])
2024
2025
2026
2027################
2028
2029AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
2030AC_TRY_RUN([#include <stdio.h>
2031main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
2032samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
2033if test x"$samba_cv_have_longlong" = x"yes"; then
2034 AC_DEFINE(HAVE_LONGLONG,1,[Whether the host supports long long's])
2035 AC_CHECK_TYPE(intptr_t, unsigned long long)
2036else
2037 AC_CHECK_TYPE(intptr_t, unsigned long)
2038fi
2039
2040#
2041# Check if the compiler supports the LL prefix on long long integers.
2042# AIX needs this.
2043
2044AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
2045 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
2046 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
2047if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
2048 AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Whether the compiler supports the LL prefix on long long integers])
2049fi
2050
2051
2052AC_CACHE_CHECK([for 64 bit time_t],samba_cv_SIZEOF_TIME_T,[
2053AC_TRY_RUN([#include <time.h>
2054main() { exit((sizeof(time_t) == 8) ? 0 : 1); }],
2055samba_cv_SIZEOF_TIME_T=yes,samba_cv_SIZEOF_TIME_T=no,samba_cv_SIZEOF_TIME_T=cross)])
2056if test x"$samba_cv_SIZEOF_TIME_T" = x"yes"; then
2057 AC_DEFINE(SIZEOF_TIME_T,8,[The size of the 'time_t' type])
2058fi
2059
2060AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
2061AC_TRY_RUN([#include <stdio.h>
2062#include <sys/stat.h>
2063main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
2064samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
2065if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
2066 AC_DEFINE(SIZEOF_OFF_T,8,[The size of the 'off_t' type])
2067fi
2068
2069AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
2070AC_TRY_RUN([
2071#if defined(HAVE_UNISTD_H)
2072#include <unistd.h>
2073#endif
2074#include <stdio.h>
2075#include <sys/stat.h>
2076main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
2077samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
2078if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
2079 AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
2080fi
2081
2082AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
2083AC_TRY_RUN([
2084#if defined(HAVE_UNISTD_H)
2085#include <unistd.h>
2086#endif
2087#include <stdio.h>
2088#include <sys/stat.h>
2089main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
2090samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
2091if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
2092 AC_DEFINE(SIZEOF_INO_T,8,[The size of the 'ino_t' type])
2093fi
2094
2095AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
2096AC_TRY_RUN([
2097#if defined(HAVE_UNISTD_H)
2098#include <unistd.h>
2099#endif
2100#include <stdio.h>
2101#include <sys/stat.h>
2102main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
2103samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
2104if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
2105 AC_DEFINE(HAVE_INO64_T,1,[Whether the 'ino64_t' type is available])
2106fi
2107
2108AC_CACHE_CHECK([for 64 bit dev_t],samba_cv_SIZEOF_DEV_T,[
2109AC_TRY_RUN([
2110#if defined(HAVE_UNISTD_H)
2111#include <unistd.h>
2112#endif
2113#include <stdio.h>
2114#include <sys/stat.h>
2115main() { exit((sizeof(dev_t) == 8) ? 0 : 1); }],
2116samba_cv_SIZEOF_DEV_T=yes,samba_cv_SIZEOF_DEV_T=no,samba_cv_SIZEOF_DEV_T=cross)])
2117if test x"$samba_cv_SIZEOF_DEV_T" = x"yes"; then
2118 AC_DEFINE(SIZEOF_DEV_T,8,[The size of the 'dev_t' type])
2119fi
2120
2121AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
2122AC_TRY_RUN([
2123#if defined(HAVE_UNISTD_H)
2124#include <unistd.h>
2125#endif
2126#include <stdio.h>
2127#include <sys/stat.h>
2128main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
2129samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
2130if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
2131 AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available])
2132fi
2133
2134AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIR64,[
2135AC_TRY_COMPILE([
2136#if defined(HAVE_UNISTD_H)
2137#include <unistd.h>
2138#endif
2139#include <sys/types.h>
2140#include <dirent.h>],
2141[DIR64 de;],
2142samba_cv_HAVE_STRUCT_DIR64=yes,samba_cv_HAVE_STRUCT_DIR64=no)])
2143if test x"$samba_cv_HAVE_STRUCT_DIR64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
2144 AC_DEFINE(HAVE_STRUCT_DIR64,1,[Whether the 'DIR64' abstract data type is available])
2145fi
2146
2147AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
2148AC_TRY_COMPILE([
2149#if defined(HAVE_UNISTD_H)
2150#include <unistd.h>
2151#endif
2152#include <sys/types.h>
2153#include <dirent.h>],
2154[struct dirent64 de;],
2155samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
2156if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
2157 AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Whether the 'dirent64' struct is available])
2158fi
2159
2160AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
2161AC_TRY_RUN([
2162#if defined(HAVE_UNISTD_H)
2163#include <unistd.h>
2164#endif
2165#include <sys/types.h>
2166main() { dev_t dev; int i = major(dev); return 0; }],
2167samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
2168if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
2169 AC_DEFINE(HAVE_DEVICE_MAJOR_FN,1,[Whether the major macro for dev_t is available])
2170fi
2171
2172AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
2173AC_TRY_RUN([
2174#if defined(HAVE_UNISTD_H)
2175#include <unistd.h>
2176#endif
2177#include <sys/types.h>
2178main() { dev_t dev; int i = minor(dev); return 0; }],
2179samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
2180if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
2181 AC_DEFINE(HAVE_DEVICE_MINOR_FN,1,[Whether the minor macro for dev_t is available])
2182fi
2183
2184AC_CACHE_CHECK([for makedev macro],samba_cv_HAVE_MAKEDEV,[
2185AC_TRY_RUN([
2186#if defined(HAVE_UNISTD_H)
2187#include <unistd.h>
2188#endif
2189#include <sys/types.h>
2190main() { dev_t dev = makedev(1,2); return 0; }],
2191samba_cv_HAVE_MAKEDEV=yes,samba_cv_HAVE_MAKEDEV=no,samba_cv_HAVE_MAKEDEV=cross)])
2192if test x"$samba_cv_HAVE_MAKEDEV" = x"yes"; then
2193 AC_DEFINE(HAVE_MAKEDEV,1,[Whether the macro for makedev is available])
2194fi
2195
2196AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
2197AC_TRY_RUN([#include <stdio.h>
2198main() { char c; c=250; exit((c > 0)?0:1); }],
2199samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
2200if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
2201 AC_DEFINE(HAVE_UNSIGNED_CHAR,1,[Whether the 'unsigned char' type is available])
2202fi
2203
2204AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
2205AC_TRY_COMPILE([#include <sys/types.h>
2206#include <dirent.h>
2207void seekdir(DIR *d, long loc) { return; }],[return 0;],
2208samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
2209if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
2210 AC_DEFINE(SEEKDIR_RETURNS_VOID,1,[Whether seekdir returns void])
2211fi
2212
2213AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
2214AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
2215samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
2216if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
2217 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
2218fi
2219
2220AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
2221AC_TRY_LINK([
2222#include <sys/time.h>
2223#include <unistd.h>], [struct timeval tv; return gettimeofday(&tv, NULL);],
2224 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,
2225 samba_cv_HAVE_GETTIMEOFDAY_TZ=no)])
2226if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
2227 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday takes a tz argument])
2228fi
2229
2230if test x"$samba_cv_WITH_PROFILE" = x"yes"; then
2231
2232 # On some systems (eg. Linux) librt can pull in libpthread. We
2233 # don't want this to happen because libpthreads changes signal delivery
2234 # semantics in ways we are not prepared for. This breaks Linux oplocks
2235 # which rely on signals.
2236
2237 AC_LIBTESTFUNC(rt, clock_gettime,
2238 [
2239 AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
2240 [Whether clock_gettime is available])
2241 SMB_CHECK_CLOCK_ID(CLOCK_MONOTONIC)
2242 SMB_CHECK_CLOCK_ID(CLOCK_PROCESS_CPUTIME_ID)
2243 SMB_CHECK_CLOCK_ID(CLOCK_REALTIME)
2244 ])
2245
2246fi
2247
2248AC_CACHE_CHECK([for broken readdir name],samba_cv_HAVE_BROKEN_READDIR_NAME,[
2249AC_TRY_RUN([#include <sys/types.h>
2250#include <dirent.h>
2251main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
2252if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
2253di->d_name[0] == 0) exit(0); exit(1);} ],
2254samba_cv_HAVE_BROKEN_READDIR_NAME=yes,samba_cv_HAVE_BROKEN_READDIR_NAME=no,samba_cv_HAVE_BROKEN_READDIR_NAME=cross)])
2255if test x"$samba_cv_HAVE_BROKEN_READDIR_NAME" = x"yes"; then
2256 AC_DEFINE(HAVE_BROKEN_READDIR_NAME,1,[Whether readdir() returns the wrong name offset])
2257fi
2258
2259AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
2260AC_TRY_COMPILE([#include <sys/types.h>
2261#include <utime.h>],
2262[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
2263samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
2264if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
2265 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
2266fi
2267
2268##############
2269# Check utmp details, but only if our OS offers utmp.h
2270if test x"$ac_cv_header_utmp_h" = x"yes"; then
2271dnl utmp and utmpx come in many flavours
2272dnl We need to check for many of them
2273dnl But we don't need to do each and every one, because our code uses
2274dnl mostly just the utmp (not utmpx) fields.
2275
2276AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx getutxent)
2277
2278AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
2279AC_TRY_COMPILE([#include <sys/types.h>
2280#include <utmp.h>],
2281[struct utmp ut; ut.ut_name[0] = 'a';],
2282samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
2283if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
2284 AC_DEFINE(HAVE_UT_UT_NAME,1,[Whether the utmp struct has a property ut_name])
2285fi
2286
2287AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
2288AC_TRY_COMPILE([#include <sys/types.h>
2289#include <utmp.h>],
2290[struct utmp ut; ut.ut_user[0] = 'a';],
2291samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
2292if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
2293 AC_DEFINE(HAVE_UT_UT_USER,1,[Whether the utmp struct has a property ut_user])
2294fi
2295
2296AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
2297AC_TRY_COMPILE([#include <sys/types.h>
2298#include <utmp.h>],
2299[struct utmp ut; ut.ut_id[0] = 'a';],
2300samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
2301if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
2302 AC_DEFINE(HAVE_UT_UT_ID,1,[Whether the utmp struct has a property ut_id])
2303fi
2304
2305AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
2306AC_TRY_COMPILE([#include <sys/types.h>
2307#include <utmp.h>],
2308[struct utmp ut; ut.ut_host[0] = 'a';],
2309samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
2310if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
2311 AC_DEFINE(HAVE_UT_UT_HOST,1,[Whether the utmp struct has a property ut_host])
2312fi
2313
2314AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
2315AC_TRY_COMPILE([#include <sys/types.h>
2316#include <utmp.h>],
2317[struct utmp ut; time_t t; ut.ut_time = t;],
2318samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
2319if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
2320 AC_DEFINE(HAVE_UT_UT_TIME,1,[Whether the utmp struct has a property ut_time])
2321fi
2322
2323AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
2324AC_TRY_COMPILE([#include <sys/types.h>
2325#include <utmp.h>],
2326[struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
2327samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
2328if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
2329 AC_DEFINE(HAVE_UT_UT_TV,1,[Whether the utmp struct has a property ut_tv])
2330fi
2331
2332AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
2333AC_TRY_COMPILE([#include <sys/types.h>
2334#include <utmp.h>],
2335[struct utmp ut; ut.ut_type = 0;],
2336samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
2337if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
2338 AC_DEFINE(HAVE_UT_UT_TYPE,1,[Whether the utmp struct has a property ut_type])
2339fi
2340
2341AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
2342AC_TRY_COMPILE([#include <sys/types.h>
2343#include <utmp.h>],
2344[struct utmp ut; ut.ut_pid = 0;],
2345samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
2346if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
2347 AC_DEFINE(HAVE_UT_UT_PID,1,[Whether the utmp struct has a property ut_pid])
2348fi
2349
2350AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
2351AC_TRY_COMPILE([#include <sys/types.h>
2352#include <utmp.h>],
2353[struct utmp ut; ut.ut_exit.e_exit = 0;],
2354samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
2355if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
2356 AC_DEFINE(HAVE_UT_UT_EXIT,1,[Whether the utmp struct has a property ut_exit])
2357fi
2358
2359dnl Look for the IPv6 varient by preference. Many systems have both.
2360AC_CACHE_CHECK([for ut_addr_v6 in utmp],samba_cv_HAVE_UT_UT_ADDR_V6,[
2361AC_TRY_COMPILE([#include <sys/types.h>
2362#include <utmp.h>],
2363[struct utmp ut; ut.ut_addr_v6[0] = 0;],
2364samba_cv_HAVE_UT_UT_ADDR_V6=yes,samba_cv_HAVE_UT_UT_ADDR_V6=no,samba_cv_HAVE_UT_UT_ADDR_V6=cross)])
2365if test x"$samba_cv_HAVE_UT_UT_ADDR_V6" = x"yes"; then
2366 AC_DEFINE(HAVE_UT_UT_ADDR_V6,1,[Whether the utmp struct has a property ut_addr_v6])
2367fi
2368
2369AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
2370AC_TRY_COMPILE([#include <sys/types.h>
2371#include <utmp.h>],
2372[struct utmp ut; ut.ut_addr = 0;],
2373samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
2374if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
2375 AC_DEFINE(HAVE_UT_UT_ADDR,1,[Whether the utmp struct has a property ut_addr])
2376fi
2377
2378if test x$ac_cv_func_pututline = xyes ; then
2379 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
2380 AC_TRY_COMPILE([#include <sys/types.h>
2381#include <utmp.h>],
2382 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
2383 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
2384 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
2385 AC_DEFINE(PUTUTLINE_RETURNS_UTMP,1,[Whether pututline returns pointer])
2386 fi
2387fi
2388
2389AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
2390AC_TRY_COMPILE([#include <sys/types.h>
2391#include <utmpx.h>],
2392[struct utmpx ux; ux.ut_syslen = 0;],
2393samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
2394if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
2395 AC_DEFINE(HAVE_UX_UT_SYSLEN,1,[Whether the utmpx struct has a property ut_syslen])
2396fi
2397
2398fi
2399# end utmp details
2400
2401
2402ICONV_LOOK_DIRS="/usr /usr/local /sw /opt"
2403AC_ARG_WITH(libiconv,
2404[AS_HELP_STRING([--with-libiconv=BASEDIR], [Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto)])],
2405[
2406 if test "$withval" = "no" ; then
2407 AC_MSG_ERROR([argument to --with-libiconv must be a directory])
2408 else
2409 if test "$withval" != "yes" ; then
2410 ICONV_PATH_SPEC=yes
2411 ICONV_LOOK_DIRS="$withval"
2412 fi
2413 fi
2414])
2415
2416for i in $ICONV_LOOK_DIRS ; do
2417
2418 save_LIBS="$LIBS"
2419 save_LDFLAGS="$LDFLAGS"
2420 save_CPPFLAGS="$CPPFLAGS"
2421
2422 iconv_current_LIBS=""
2423 iconv_current_LDFLAGS=""
2424 iconv_current_CPPFLAGS=""
2425
2426 ICONV_FOUND="no"
2427 unset libext
2428
2429 # This is here to handle -withval stuff for --with-libiconv
2430 # Perhaps we should always add a -L
2431 CPPFLAGS="$save_CPPFLAGS -I$i/include"
2432
2433 # Check lib and lib32 library variants to cater for IRIX ABI-specific
2434 # installation paths. This gets a little tricky since we might have iconv
2435 # in both libiconv and in libc. In this case the jm_ICONV test will always
2436 # succeed when the header is found. To counter this, make sure the
2437 # library directory is there and check the ABI directory first (which
2438 # should be harmless on other systems, but causes tons of linker warnings on
2439 # 64bit Ubuntu systems).
2440 # As the build farm doesn't seem to have any IRIX machines with iconv.h
2441 # installed, I've decided to fix the linker warnings.
2442 # -- Kai
2443 # For IA64 HPUX systems, the libs are located in lib/hpux32 instead of lib.
2444 for l in "lib" "lib32" "lib/hpux32"; do
2445 if test -d "$i/$l" ; then
2446 LDFLAGS="$save_LDFLAGS -L$i/$l"
2447 LIBS=
2448 export LDFLAGS LIBS CPPFLAGS
2449 # Try to find iconv(3)
2450 jm_ICONV($i/$l)
2451 if test x"$ICONV_FOUND" = "xyes" ; then
2452 libext="$l"
2453 break
2454 fi
2455 fi
2456 done
2457
2458 if test x"$ICONV_FOUND" = "xyes" ; then
2459 iconv_current_LDFLAGS="-L$i/$libext"
2460 iconv_current_CPPFLAGS="-I$i/include"
2461
2462 if test x"$jm_cv_lib_iconv" != x; then
2463 iconv_current_LIBS="$LIBS -l$jm_cv_lib_iconv"
2464 else
2465 # We found iconv in libc.
2466 iconv_current_LIBS=""
2467 fi
2468
2469 fi
2470
2471 if test x"$ICONV_FOUND" = "xyes" ; then
2472
2473 LDFLAGS="$save_LDFLAGS $iconv_current_LDFLAGS"
2474 CPPFLAGS="$save_CPPFLAGS $iconv_current_CPPFLAGS"
2475 LIBS="$save_LIBS $iconv_current_LIBS"
2476 export LDFLAGS LIBS CPPFLAGS
2477
2478 default_dos_charset=no
2479 default_display_charset=no
2480 default_unix_charset=no
2481
2482 # check for default dos charset name
2483 for j in CP850 IBM850 ; do
2484 rjs_CHARSET($j)
2485 default_dos_charset="$ICONV_CHARSET"
2486 if test x"$default_dos_charset" = x"$j"; then
2487 break
2488 fi
2489 done
2490
2491 # check for default display charset name
2492 for j in ASCII 646 ; do
2493 rjs_CHARSET($j)
2494 default_display_charset="$ICONV_CHARSET"
2495 if test x"$default_display_charset" = x"$j"; then
2496 break
2497 fi
2498 done
2499
2500 # check for default unix charset name
2501 for j in UTF-8 UTF8 ; do
2502 rjs_CHARSET($j)
2503 default_unix_charset="$ICONV_CHARSET"
2504 if test x"$default_unix_charset" = x"$j"; then
2505 break
2506 fi
2507 done
2508
2509 if test "$default_dos_charset" != "no" -a \
2510 "$default_dos_charset" != "cross" -a \
2511 "$default_display_charset" != "no" -a \
2512 "$default_display_charset" != "cross" -a \
2513 "$default_unix_charset" != "no" -a \
2514 "$default_unix_charset" != "cross"
2515 then
2516 samba_cv_HAVE_NATIVE_ICONV=yes
2517 else
2518 if test "$default_dos_charset" = "cross" -o \
2519 "$default_display_charset" = "cross" -o \
2520 "$default_unix_charset" = "cross"
2521 then
2522 samba_cv_HAVE_NATIVE_ICONV=cross
2523 else
2524 samba_cv_HAVE_NATIVE_ICONV=no
2525 fi
2526 fi
2527
2528 # At this point, we have a libiconv candidate. We know that
2529 # we have the right headers and libraries, but we don't know
2530 # whether it does the conversions we want. We can't test this
2531 # because we are cross-compiling. This is not necessarily a big
2532 # deal, since we can't guarantee that the results we get now will
2533 # match the results we get at runtime anyway.
2534 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"cross" ; then
2535 default_dos_charset="CP850"
2536 default_display_charset="ASCII"
2537 default_unix_charset="UTF-8"
2538 samba_cv_HAVE_NATIVE_ICONV=yes
2539 AC_MSG_WARN(assuming the libiconv in $iconv_current_LDFLAGS can convert)
2540 AC_MSG_WARN([$default_dos_charset, $default_display_charset and $default_unix_charset to UCS-16LE])
2541 fi
2542
2543 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes" ; then
2544
2545 CPPFLAGS=$save_CPPFLAGS
2546 LDFLAGS=$save_LDFLAGS
2547 LIBS=$save_LIBS
2548
2549 if test x"$iconv_current_LIBS" != x; then
2550 LIBS="$LIBS $iconv_current_LIBS"
2551 fi
2552
2553 # Add the flags we need to CPPFLAGS and LDFLAGS
2554 CPPFLAGS="$CPPFLAGS $iconv_current_CPPFLAGS"
2555 LDFLAGS="$LDFLAGS $iconv_current_LDFLAGS"
2556
2557 # Turn the #defines into string literals
2558 default_dos_charset="\"$default_dos_charset\""
2559 default_display_charset="\"$default_display_charset\""
2560 default_unix_charset="\"$default_unix_charset\""
2561
2562 AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
2563 AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,$default_dos_charset,[Default dos charset name])
2564 AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,$default_display_charset,[Default display charset name])
2565 AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,$default_unix_charset,[Default unix charset name])
2566
2567 break
2568 fi
2569
2570 # We didn't find a working iconv, so keep going
2571 fi
2572
2573 # We only need to clean these up here for the next pass through the loop
2574 CPPFLAGS=$save_CPPFLAGS
2575 LDFLAGS=$save_LDFLAGS
2576 LIBS=$save_LIBS
2577 export LDFLAGS LIBS CPPFLAGS
2578done
2579unset libext
2580
2581
2582if test x"$ICONV_FOUND" = x"no" -o x"$samba_cv_HAVE_NATIVE_ICONV" != x"yes" ; then
2583 AC_MSG_WARN([Sufficient support for iconv function was not found.
2584 Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!])
2585 AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,"ASCII",[Default dos charset name])
2586 AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,"ASCII",[Default display charset name])
2587 AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,"UTF8",[Default unix charset name])
2588fi
2589
2590
2591AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
2592AC_TRY_RUN([
2593#include <sys/types.h>
2594#include <fcntl.h>
2595#ifndef F_GETLEASE
2596#define F_GETLEASE 1025
2597#endif
2598main() {
2599 int fd = open("/dev/null", O_RDONLY);
2600 return fcntl(fd, F_GETLEASE, 0) == -1;
2601}
2602],
2603samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
2604if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
2605 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
2606fi
2607
2608AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
2609AC_TRY_RUN([
2610#include <sys/types.h>
2611#include <fcntl.h>
2612#include <signal.h>
2613#ifndef F_NOTIFY
2614#define F_NOTIFY 1026
2615#endif
2616main() {
2617 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
2618}
2619],
2620samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
2621if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
2622 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
2623fi
2624
2625AC_CACHE_CHECK([for inotify support],samba_cv_HAVE_INOTIFY,[
2626AC_CHECK_HEADERS(linux/inotify.h asm/unistd.h sys/inotify.h)
2627AC_CHECK_FUNCS(inotify_init)
2628AC_HAVE_DECL(__NR_inotify_init, [#include <asm/unistd.h>])
2629],
2630samba_cv_HAVE_INOTIFY=yes,
2631samba_cv_HAVE_INOTIFY=no,
2632samba_cv_HAVE_INOTIFY=cross)
2633
2634if test x"$ac_cv_func_inotify_init" = x"yes" -a x"$ac_cv_header_linux_inotify_h" = x"yes"; then
2635 AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel has inotify support])
2636fi
2637
2638#################################################
2639# Check if FAM notifications are available. For FAM info, see
2640# http://oss.sgi.com/projects/fam/
2641# http://savannah.nongnu.org/projects/fam/
2642AC_ARG_ENABLE(fam,
2643[AS_HELP_STRING([--enable-fam], [Turn on FAM support (default=auto)])])
2644
2645if test x$enable_fam != xno; then
2646 AC_CHECK_HEADERS(fam.h, [samba_cv_HAVE_FAM_H=yes], [samba_cv_HAVE_FAM_H=no])
2647 if test x"$samba_cv_HAVE_FAM_H" = x"yes"; then
2648 # On IRIX, libfam requires libC, but other FAM implementations
2649 # might not need it.
2650 AC_CHECK_LIB(fam, FAMOpen2,
2651 [samba_cv_HAVE_LIBFAM=yes; SMB_FAM_LIBS="-lfam"],
2652 [samba_cv_HAVE_LIBFAM=no])
2653
2654 if test x"$samba_cv_HAVE_LIBFAM" = x"no" ; then
2655 samba_fam_xtra=-lC
2656 AC_CHECK_LIB_EXT(fam, samba_fam_xtra, FAMOpen2,
2657 [samba_cv_HAVE_LIBFAM=yes; SMB_FAM_LIBS="-lfam -lC"],
2658 [samba_cv_HAVE_LIBFAM=no])
2659 unset samba_fam_xtra
2660 fi
2661 fi
2662
2663 if test x"$samba_cv_HAVE_LIBFAM" = x"yes" ; then
2664 default_shared_modules="$default_shared_modules vfs_notify_fam"
2665 AC_TRY_COMPILE([#include <fam.h>],
2666 [enum FAMCodes code = FAMChanged;],
2667 AC_DEFINE(HAVE_FAM_H_FAMCODES_TYPEDEF, 1,
2668 [Whether fam.h contains a typedef for enum FAMCodes]),
2669 [])
2670 fi
2671
2672 if test x$enable_fam = xyes && test x"$samba_cv_HAVE_LIBFAM" != xyes ; then
2673 AC_MSG_ERROR(FAM support requested but FAM library not available )
2674 fi
2675fi
2676
2677AC_SUBST(SMB_FAM_LIBS)
2678
2679#################################################
2680# Check for DMAPI interfaces in libdm/libjfsdm/libxsdm
2681
2682SMB_CHECK_DMAPI([], AC_MSG_NOTICE(DMAPI support not present) )
2683
2684# Add TSM SM VFS module only if there are both GPFS and DMAPI support
2685# Theoretically it should work with AIX JFS2 too but this needs testing
2686if test x"$ac_cv_header_gpfs_gpl_h" = x"yes" && test x"$samba_dmapi_libs" != x"" ; then
2687 default_shared_modules="$default_shared_modules vfs_tsmsm"
2688fi
2689
2690AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
2691AC_TRY_RUN([
2692#include <sys/types.h>
2693#include <fcntl.h>
2694#include <signal.h>
2695#include <sys/file.h>
2696#ifndef LOCK_MAND
2697#define LOCK_MAND 32
2698#define LOCK_READ 64
2699#endif
2700main() {
2701 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
2702}
2703],
2704samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
2705if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
2706 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
2707fi
2708
2709
2710AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
2711AC_TRY_COMPILE([#include <sys/types.h>
2712#include <fcntl.h>],
2713[oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
2714samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
2715if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
2716 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
2717fi
2718
2719#################################################
2720# Check for POSIX capability support
2721
2722AC_CHECK_HEADER(sys/capability.h, [samba_cv_HAVE_SYS_CAPABILITY_H=yes;
2723 AC_DEFINE(HAVE_SYS_CAPABILITY_H, 1, Whether sys/capability.h is present)],
2724 [], [])
2725
2726if test x"$samba_cv_HAVE_SYS_CAPABILITY_H" = x"yes"; then
2727
2728 ac_save_LIBS=$LIBS
2729 AC_LIBTESTFUNC(cap, cap_get_proc)
2730
2731 AC_CACHE_CHECK([for POSIX capabilities],
2732 samba_cv_HAVE_POSIX_CAPABILITIES,
2733 [
2734 AC_TRY_RUN([
2735#include <sys/types.h>
2736#include <sys/capability.h>
2737main() {
2738 cap_t cap;
2739 cap_value_t vals[1];
2740 if (!(cap = cap_get_proc()))
2741 exit(1);
2742 vals[0] = CAP_CHOWN;
2743 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
2744 cap_set_proc(cap);
2745 exit(0);
2746}],
2747 samba_cv_HAVE_POSIX_CAPABILITIES=yes,
2748 samba_cv_HAVE_POSIX_CAPABILITIES=no,
2749 samba_cv_HAVE_POSIX_CAPABILITIES=cross)
2750 ])
2751
2752if test x"$samba_cv_HAVE_POSIX_CAPABILITIES" = x"yes"; then
2753 AC_DEFINE(HAVE_POSIX_CAPABILITIES, 1,
2754 [Whether POSIX capabilities are available])
2755else
2756 LIBS=$ac_save_LIBS
2757fi
2758
2759fi
2760
2761#
2762# Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
2763# This is *really* broken but some systems (DEC OSF1) do this.... JRA.
2764#
2765
2766AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
2767AC_TRY_COMPILE([#include <sys/types.h>
2768#if defined(HAVE_RPC_RPC_H)
2769#include <rpc/rpc.h>
2770#endif],
2771[int16 testvar;],
2772samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
2773if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
2774 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H,1,[Whether int16 typedef is included by rpc/rpc.h])
2775fi
2776
2777AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
2778AC_TRY_COMPILE([#include <sys/types.h>
2779#if defined(HAVE_RPC_RPC_H)
2780#include <rpc/rpc.h>
2781#endif],
2782[uint16 testvar;],
2783samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
2784if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
2785 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H,1,[Whether uint16 typedef is included by rpc/rpc.h])
2786fi
2787
2788AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
2789AC_TRY_COMPILE([#include <sys/types.h>
2790#if defined(HAVE_RPC_RPC_H)
2791#include <rpc/rpc.h>
2792#endif],
2793[int32 testvar;],
2794samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
2795if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
2796 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H,1,[Whether int32 typedef is included by rpc/rpc.h])
2797fi
2798
2799AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
2800AC_TRY_COMPILE([#include <sys/types.h>
2801#if defined(HAVE_RPC_RPC_H)
2802#include <rpc/rpc.h>
2803#endif],
2804[uint32 testvar;],
2805samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
2806if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
2807 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H,1,[Whether uint32 typedef is included by rpc/rpc.h])
2808fi
2809
2810dnl
2811dnl Some systems (SCO) have a problem including
2812dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
2813dnl as a #define in <prot.h> and as part of an enum
2814dnl in <rpc/rpc.h>.
2815dnl
2816
2817AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
2818AC_TRY_COMPILE([#include <sys/types.h>
2819#ifdef HAVE_SYS_SECURITY_H
2820#include <sys/security.h>
2821#include <prot.h>
2822#endif /* HAVE_SYS_SECURITY_H */
2823#if defined(HAVE_RPC_RPC_H)
2824#include <rpc/rpc.h>
2825#endif],
2826[int testvar;],
2827samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
2828if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
2829 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT,1,[Whether there is a conflicting AUTH_ERROR define in rpc/rpc.h])
2830fi
2831
2832AC_MSG_CHECKING([for test routines])
2833AC_TRY_RUN([#include "${srcdir-.}/../tests/trivial.c"],
2834 AC_MSG_RESULT(yes),
2835 AC_MSG_ERROR([cant find test code. Aborting config]),
2836 AC_MSG_WARN([cannot run when cross-compiling]))
2837
2838AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
2839AC_TRY_RUN([#include "${srcdir-.}/../tests/ftruncate.c"],
2840 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
2841if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
2842 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
2843fi
2844
2845AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
2846AC_TRY_RUN([#include "${srcdir-.}/../tests/getgroups.c"],
2847 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
2848if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
2849 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
2850fi
2851
2852SMB_CHECK_SYSCONF(_SC_NGROUPS_MAX)
2853SMB_CHECK_SYSCONF(_SC_NPROC_ONLN)
2854SMB_CHECK_SYSCONF(_SC_NPROCESSORS_ONLN)
2855SMB_CHECK_SYSCONF(_SC_PAGESIZE)
2856AC_CHECK_FUNCS(getpagesize)
2857
2858################################################
2859# look for a method of setting the effective uid
2860seteuid=no;
2861
2862if test $seteuid = no; then
2863AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
2864AC_TRY_RUN([
2865#define AUTOCONF_TEST 1
2866#define USE_SETREUID 1
2867#include "confdefs.h"
2868#include "${srcdir-.}/lib/util_sec.c"],
2869 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
2870if test x"$samba_cv_USE_SETREUID" = x"yes"; then
2871 seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
2872fi
2873fi
2874
2875# we check for setresuid second as it conflicts with AIO on Linux.
2876# see http://samba.org/~tridge/junkcode/aio_uid.c
2877if test $seteuid = no; then
2878AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
2879AC_TRY_RUN([
2880#define AUTOCONF_TEST 1
2881#define USE_SETRESUID 1
2882#include "confdefs.h"
2883#include "${srcdir-.}/lib/util_sec.c"],
2884 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
2885if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
2886 seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
2887fi
2888fi
2889
2890if test $seteuid = no; then
2891AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
2892AC_TRY_RUN([
2893#define AUTOCONF_TEST 1
2894#define USE_SETEUID 1
2895#include "confdefs.h"
2896#include "${srcdir-.}/lib/util_sec.c"],
2897 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
2898if test x"$samba_cv_USE_SETEUID" = x"yes"; then
2899 seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
2900fi
2901fi
2902
2903if test $seteuid = no; then
2904AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
2905AC_TRY_RUN([
2906#define AUTOCONF_TEST 1
2907#define USE_SETUIDX 1
2908#include "confdefs.h"
2909#include "${srcdir-.}/lib/util_sec.c"],
2910 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
2911if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
2912 seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
2913fi
2914fi
2915
2916AC_CACHE_CHECK([for the Darwin initgroups system call],
2917 samba_cv_DARWIN_INITGROUPS,
2918 AC_TRY_LINK([
2919#include <sys/syscall.h>
2920#include <unistd.h>
2921 ],
2922 [ syscall(SYS_initgroups, 16, NULL, NULL, 0); ],
2923 samba_cv_DARWIN_INITGROUPS=yes,
2924 samba_cv_DARWIN_INITGROUPS=no)
2925)
2926
2927if test x"$samba_cv_DARWIN_INITGROUPS" = x"yes" ; then
2928 AC_DEFINE(HAVE_DARWIN_INITGROUPS, 1,
2929 [Whether to use the Darwin-specific initgroups system call])
2930fi
2931
2932AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
2933AC_TRY_RUN([#include "${srcdir-.}/../tests/fcntl_lock.c"],
2934 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
2935if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
2936 AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available])
2937fi
2938
2939AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
2940AC_TRY_RUN([#include "${srcdir-.}/../tests/fcntl_lock64.c"],
2941 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
2942if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
2943 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken])
2944
2945else
2946
2947dnl
2948dnl Don't check for 64 bit fcntl locking if we know that the
2949dnl glibc2.1 broken check has succeeded.
2950dnl
2951
2952 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
2953 AC_TRY_RUN([
2954#if defined(HAVE_UNISTD_H)
2955#include <unistd.h>
2956#endif
2957#include <stdio.h>
2958#include <stdlib.h>
2959
2960#ifdef HAVE_FCNTL_H
2961#include <fcntl.h>
2962#endif
2963
2964#ifdef HAVE_SYS_FCNTL_H
2965#include <sys/fcntl.h>
2966#endif
2967main() { struct flock64 fl64;
2968#if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
2969exit(0);
2970#else
2971exit(1);
2972#endif
2973}],
2974 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
2975
2976 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
2977 AC_DEFINE(HAVE_STRUCT_FLOCK64,1,[Whether the flock64 struct is available])
2978 fi
2979fi
2980
2981# glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
2982AC_CACHE_CHECK([for broken posix_fallocate],samba_cv_HAVE_BROKEN_POSIX_FALLOCATE,[
2983AC_TRY_COMPILE([
2984 #define _XOPEN_SOURCE 600
2985 #include <stdlib.h>
2986 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
2987 probably broken posix_fallocate
2988 #endif
2989], [
2990],
2991samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=no,samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=yes)])
2992if test x"$samba_cv_HAVE_BROKEN_POSIX_FALLOCATE" = xyes; then
2993 AC_DEFINE(HAVE_BROKEN_POSIX_FALLOCATE,, Whether we have a broken posix_fallocate)
2994fi
2995
2996
2997AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
2998AC_TRY_COMPILE([#include <sys/types.h>
2999#include <sys/stat.h>
3000#include <unistd.h>],
3001[struct stat st; st.st_blocks = 0;],
3002samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
3003if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
3004 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
3005fi
3006
3007AC_CHECK_TYPES([blksize_t, blkcnt_t], [], [], [[#include <sys/stat.h>]])
3008
3009AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
3010AC_TRY_COMPILE([#include <sys/types.h>
3011#include <sys/stat.h>
3012#include <unistd.h>],
3013[struct stat st; st.st_blksize = 0;],
3014samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
3015if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
3016 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
3017fi
3018
3019AC_CACHE_CHECK([for st_flags in struct stat],
3020 samba_cv_HAVE_STAT_ST_FLAGS,
3021 [
3022 AC_TRY_COMPILE([#include <sys/types.h>
3023#include <sys/stat.h>
3024#include <unistd.h>],
3025 [struct stat st; st.st_flags = 0;],
3026 samba_cv_HAVE_STAT_ST_FLAGS=yes,
3027 samba_cv_HAVE_STAT_ST_FLAGS=no,
3028 samba_cv_HAVE_STAT_ST_FLAGS=cross)
3029 ])
3030
3031if test x"$samba_cv_HAVE_STAT_ST_FLAGS" = x"yes"; then
3032 AC_DEFINE(HAVE_STAT_ST_FLAGS, 1,
3033 [Whether the stat struct has a st_flags member])
3034fi
3035
3036AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
3037AC_TRY_COMPILE([
3038#include <sys/types.h>
3039#include <sys/acl.h>
3040#if defined(HAVE_RPCSVC_NIS_H)
3041#include <rpcsvc/nis.h>
3042#endif],
3043[int i;],
3044samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
3045if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
3046 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken])
3047fi
3048
3049AC_CACHE_CHECK([if the realpath function allows a NULL argument],samba_cv_REALPATH_TAKES_NULL,[
3050AC_TRY_RUN([
3051#include <stdio.h>
3052#include <limits.h>
3053#include <signal.h>
3054
3055void exit_on_core(int ignored) {
3056 exit(1);
3057}
3058
3059main() {
3060 char *newpath;
3061 signal(SIGSEGV, exit_on_core);
3062 newpath = realpath("/tmp", NULL);
3063 exit((newpath != NULL) ? 0 : 1);
3064}
3065],
3066samba_cv_REALPATH_TAKES_NULL=yes,samba_cv_REALPATH_TAKES_NULL=no,samba_cv_REALPATH_TAKES_NULL=cross)])
3067if test x"$samba_cv_REALPATH_TAKES_NULL" = x"yes"; then
3068 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])
3069fi
3070
3071#################################################
3072# check for AFS clear-text auth support
3073samba_cv_WITH_AFS=no
3074AC_MSG_CHECKING(whether to use AFS clear-text auth)
3075AC_ARG_WITH(afs,
3076[AS_HELP_STRING([--with-afs], [Include AFS clear-text auth support (default=no)])],
3077[ case "$withval" in
3078 yes|auto)
3079 AC_MSG_RESULT($withval)
3080 samba_cv_WITH_AFS=$withval
3081 ;;
3082 *)
3083 AC_MSG_RESULT(no)
3084 ;;
3085 esac ],
3086 AC_MSG_RESULT(no)
3087)
3088
3089####################################################
3090# check for Linux-specific AFS fake-kaserver support
3091samba_cv_WITH_FAKE_KASERVER=no
3092AC_MSG_CHECKING(whether to use AFS fake-kaserver)
3093AC_ARG_WITH(fake-kaserver,
3094[AS_HELP_STRING([--with-fake-kaserver], [Include AFS fake-kaserver support (default=no)])],
3095[ case "$withval" in
3096 yes|auto)
3097 AC_MSG_RESULT($withval)
3098 samba_cv_WITH_FAKE_KASERVER=$withval
3099 ;;
3100 *)
3101 AC_MSG_RESULT(no)
3102 ;;
3103 esac ],
3104 AC_MSG_RESULT(no)
3105)
3106
3107#################################################
3108# decide whether we can support WITH_AFS and / or WITH_FAKE_KASERVER
3109if test x"$samba_cv_WITH_AFS" != x"no" ||
3110 test x"$samba_cv_WITH_FAKE_KASERVER" != x"no"; then
3111
3112 # see if this box has the OpenSSL DES libraries
3113 AC_CHECK_LIB( crypto, DES_pcbc_encrypt, LIBS="$LIBS -lcrypto" , [AC_ERROR(OpenSSL library: libcrypto ot found!)] )
3114
3115 # see if this box has the afs-headers in /usr/include/afs
3116 AC_MSG_CHECKING(for /usr/include/afs)
3117 if test -d /usr/include/afs; then
3118 AC_MSG_RESULT(yes)
3119 else
3120 AC_MSG_RESULT(no)
3121 fi
3122
3123 # check for afs.h
3124 have_afs_headers=no
3125 AC_CHECK_HEADERS(afs.h afs/afs.h)
3126 if test x"$ac_cv_header_afs_h" = x"no" && test x"$ac_cv_header_afs_afs_h" = x"no"; then
3127 if test x"$samba_cv_WITH_FAKE_KASERVER" = x"auto" ||
3128 test x"$samba_cv_WITH_AFS" = x"auto"; then
3129 AC_MSG_WARN([AFS cannot be supported without afs.h])
3130 else
3131 AC_MSG_ERROR([AFS cannot be supported without afs.h])
3132 fi
3133 else
3134 have_afs_headers=yes
3135 fi
3136fi
3137
3138FAKE_KASERVER_OBJ=""
3139if test x"$samba_cv_WITH_FAKE_KASERVER" != x"no" && test x"$have_afs_headers" = x"yes"; then
3140 AC_DEFINE(WITH_FAKE_KASERVER,1,[Whether to include AFS fake-kaserver support])
3141 FAKE_KASERVER_OBJ="utils/net_afs.o"
3142fi
3143AC_SUBST(FAKE_KASERVER_OBJ)
3144
3145#################################################
3146# check whether to compile AFS/NT ACL mapping module
3147samba_cv_WITH_VFS_AFSACL=no
3148AC_MSG_CHECKING(whether to use AFS ACL mapping module)
3149AC_ARG_WITH(vfs-afsacl,
3150[AS_HELP_STRING([--with-vfs-afsacl], [Include AFS to NT ACL mapping module (default=no)])],
3151[ case "$withval" in
3152 yes|auto)
3153 AC_MSG_RESULT($withval)
3154 samba_cv_WITH_VFS_AFSACL=yes
3155 ;;
3156 *)
3157 AC_MSG_RESULT(no)
3158 ;;
3159 esac ],
3160 AC_MSG_RESULT(no)
3161)
3162
3163if test x"$samba_cv_WITH_VFS_AFSACL" = x"yes"; then
3164 default_shared_modules="$default_shared_modules vfs_afsacl"
3165fi
3166
3167if test x"$samba_cv_WITH_AFS" != x"no" && test x"$have_afs_headers" = x"yes"; then
3168 AC_DEFINE(WITH_AFS,1,[Whether to include AFS clear-text auth support])
3169fi
3170
3171#################################################
3172# check for the DFS clear-text auth system
3173AC_MSG_CHECKING(whether to use DFS clear-text auth)
3174AC_ARG_WITH(dfs,
3175[AS_HELP_STRING([--with-dce-dfs], [Include DCE/DFS clear-text auth support (default=no)])],
3176[ case "$withval" in
3177 yes)
3178 AC_MSG_RESULT(yes)
3179 AC_DEFINE(WITH_DFS,1,[Whether to include DFS support])
3180 ;;
3181 *)
3182 AC_MSG_RESULT(no)
3183 ;;
3184 esac ],
3185 AC_MSG_RESULT(no)
3186)
3187
3188########################################################
3189# Compile with LDAP support?
3190
3191with_ldap_support=auto
3192AC_MSG_CHECKING([for LDAP support])
3193
3194AC_ARG_WITH(ldap,
3195[AS_HELP_STRING([--with-ldap], [LDAP support (default yes)])],
3196[ case "$withval" in
3197 yes|no)
3198 with_ldap_support=$withval
3199 ;;
3200 esac ])
3201
3202AC_MSG_RESULT($with_ldap_support)
3203
3204SMBLDAP=""
3205AC_SUBST(SMBLDAP)
3206SMBLDAPUTIL=""
3207AC_SUBST(SMBLDAPUTIL)
3208LDBLDAP=""
3209AC_SUBST(LDBLDAP)
3210
3211if test x"$with_ldap_support" != x"no"; then
3212
3213 ##################################################################
3214 # first test for ldap.h and lber.h
3215 # (ldap.h is required for this test)
3216 AC_CHECK_HEADERS(ldap.h lber.h)
3217
3218 if test x"$ac_cv_header_ldap_h" != x"yes"; then
3219 if test x"$with_ldap_support" = x"yes"; then
3220 AC_MSG_ERROR(ldap.h is needed for LDAP support)
3221 else
3222 AC_MSG_WARN(ldap.h is needed for LDAP support)
3223 fi
3224
3225 with_ldap_support=no
3226 fi
3227
3228 ##################################################################
3229 # HP/UX does not have ber_tag_t in lber.h - it must be configured as
3230 # unsigned int in include/includes.h
3231 case $host_os in
3232 *hpux*)
3233 AC_MSG_WARN(ber_tag_t is needed for LDAP support)
3234 AC_MSG_WARN(ber_tag_t must be configured in includes.h for hpux)
3235 with_ldap_support=yes
3236 ;;
3237 *)
3238 AC_CHECK_TYPE(ber_tag_t,,,[#include <lber.h>])
3239 if test x"$ac_cv_type_ber_tag_t" != x"yes"; then
3240 if test x"$with_ldap_support" = x"yes"; then
3241 AC_MSG_ERROR(ber_tag_t is needed for LDAP support)
3242 else
3243 AC_MSG_WARN(ber_tag_t is needed for LDAP support)
3244 fi
3245 with_ldap_support=no
3246 fi
3247 ;;
3248 esac
3249fi
3250
3251if test x"$with_ldap_support" != x"no"; then
3252 ac_save_LIBS=$LIBS
3253
3254 ##################################################################
3255 # we might need the lber lib on some systems. To avoid link errors
3256 # this test must be before the libldap test
3257 AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf)
3258
3259 ########################################################
3260 # If ber_sockbuf_add_io() is available we can add
3261 # SASL wrapping hooks
3262 AC_CHECK_FUNC_EXT(ber_sockbuf_add_io,$LDAP_LIBS)
3263
3264 AC_CACHE_CHECK([for LDAP_OPT_SOCKBUF],samba_cv_HAVE_LDAP_OPT_SOCKBUF,[
3265 AC_TRY_COMPILE([#include <ldap.h>],
3266 [int val = LDAP_OPT_SOCKBUF;],
3267 samba_cv_HAVE_LDAP_OPT_SOCKBUF=yes,
3268 samba_cv_HAVE_LDAP_OPT_SOCKBUF=no)])
3269
3270 if test x"$ac_cv_func_ext_ber_sockbuf_add_io" = x"yes" -a \
3271 x"$samba_cv_HAVE_LDAP_OPT_SOCKBUF" = x"yes"; then
3272 AC_DEFINE(HAVE_LDAP_SASL_WRAPPING, 1, [Support for SASL wrapping])
3273 fi
3274
3275 #######################################################
3276 # if we have LBER_OPT_LOG_PRINT_FN, we can intercept
3277 # ldap logging and print it out in the samba logs
3278 AC_CACHE_CHECK([for LBER_OPT_LOG_PRINT_FN],
3279 samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN,
3280 [AC_TRY_COMPILE([#include <lber.h>],
3281 [int val = LBER_OPT_LOG_PRINT_FN;],
3282 samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN=yes,
3283 samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN=no)])
3284
3285 if test x"$samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN" = x"yes"; then
3286 AC_DEFINE(HAVE_LBER_LOG_PRINT_FN, 1,
3287 [Support for LDAP/LBER logging interception])
3288 fi
3289
3290 ########################################################
3291 # now see if we can find the ldap libs in standard paths
3292 AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
3293
3294 ########################################################
3295 # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
3296 # Check found in pam_ldap 145.
3297 AC_CHECK_FUNC_EXT(ldap_set_rebind_proc,$LDAP_LIBS)
3298
3299 LIBS="$LIBS $LDAP_LIBS"
3300 AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [
3301 AC_TRY_COMPILE([
3302 #include <lber.h>
3303 #include <ldap.h>],
3304 [ldap_set_rebind_proc(0, 0, 0);],
3305 [smb_ldap_cv_ldap_set_rebind_proc=3],
3306 [smb_ldap_cv_ldap_set_rebind_proc=2]
3307 )
3308 ])
3309
3310 AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
3311
3312 AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
3313
3314 if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes"; then
3315 AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
3316 CPPFLAGS="$CPPFLAGS -DLDAP_DEPRECATED"
3317 default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
3318 default_shared_modules="$default_shared_modules";
3319 SMBLDAP="lib/smbldap.o"
3320 SMBLDAPUTIL="lib/smbldap_util.o"
3321 with_ldap_support=yes
3322 AC_MSG_CHECKING(whether LDAP support is used)
3323 AC_MSG_RESULT(yes)
3324 else
3325 if test x"$with_ldap_support" = x"yes"; then
3326 AC_MSG_ERROR(libldap is needed for LDAP support)
3327 else
3328 AC_MSG_WARN(libldap is needed for LDAP support)
3329 fi
3330
3331 LDAP_LIBS=""
3332 with_ldap_support=no
3333 fi
3334 LIBS=$ac_save_LIBS
3335fi
3336
3337
3338#################################################
3339# active directory support
3340
3341with_ads_support=auto
3342AC_MSG_CHECKING([for Active Directory and krb5 support])
3343
3344AC_ARG_WITH(ads,
3345[AS_HELP_STRING([--with-ads], [Active Directory support (default auto)])],
3346[ case "$withval" in
3347 yes|no)
3348 with_ads_support="$withval"
3349 ;;
3350 esac ])
3351
3352AC_MSG_RESULT($with_ads_support)
3353
3354FOUND_KRB5=no
3355KRB5_LIBS=""
3356
3357if test x"$with_ldap_support" != x"yes"; then
3358
3359 if test x"$with_ads_support" = x"yes"; then
3360 AC_MSG_ERROR(Active Directory Support requires LDAP support)
3361 elif test x"$with_ads_support" = x"auto"; then
3362 AC_MSG_WARN(Disabling Active Directory support (requires LDAP support))
3363 with_ads_support=no
3364 fi
3365
3366else
3367
3368 # Check to see whether there is enough LDAP functionality to be able
3369 # to build AD support.
3370
3371# HPUX only has ldap_init; ok, we take care of this in smbldap.c
3372case "$host_os" in
3373 *hpux*)
3374 AC_CHECK_FUNC_EXT(ldap_init,$LDAP_LIBS)
3375
3376 if test x"$ac_cv_func_ext_ldap_init" != x"yes"; then
3377 if test x"$with_ads_support" = x"yes"; then
3378 AC_MSG_ERROR(Active Directory support on HPUX requires ldap_init)
3379 elif test x"$with_ads_support" = x"auto"; then
3380 AC_MSG_WARN(Disabling Active Directory support (requires ldap_init on HPUX))
3381 with_ads_support=no
3382 fi
3383 fi
3384 ;;
3385 *)
3386 AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
3387
3388 if test x"$ac_cv_func_ext_ldap_initialize" != x"yes"; then
3389 if test x"$with_ads_support" = x"yes"; then
3390 AC_MSG_ERROR(Active Directory support requires ldap_initialize)
3391 elif test x"$with_ads_support" = x"auto"; then
3392 AC_MSG_WARN(Disabling Active Directory support (requires ldap_initialize))
3393 with_ads_support=no
3394 fi
3395 fi
3396 ;;
3397esac
3398
3399
3400 AC_CHECK_FUNC_EXT(ldap_add_result_entry,$LDAP_LIBS)
3401
3402 if test x"$ac_cv_func_ext_ldap_add_result_entry" != x"yes"; then
3403 if test x"$with_ads_support" = x"yes"; then
3404 AC_MSG_ERROR(Active Directory support requires ldap_add_result_entry)
3405 elif test x"$with_ads_support" = x"auto"; then
3406 AC_MSG_WARN(Disabling Active Directory support (requires ldap_add_result_entry))
3407 with_ads_support=no
3408 fi
3409 fi
3410
3411fi
3412
3413if test x"$with_ads_support" != x"no"; then
3414
3415 # Do no harm to the values of CFLAGS and LIBS while testing for
3416 # Kerberos support.
3417
3418 if test x$FOUND_KRB5 = x"no"; then
3419 #################################################
3420 # check for location of Kerberos 5 install
3421 AC_MSG_CHECKING(for kerberos 5 install path)
3422 AC_ARG_WITH(krb5,
3423 [AS_HELP_STRING([--with-krb5=base-dir], [Locate Kerberos 5 support (default=/usr)])],
3424 [ case "$withval" in
3425 no)
3426 AC_MSG_RESULT(no krb5-path given)
3427 ;;
3428 yes)
3429 AC_MSG_RESULT(/usr)
3430 FOUND_KRB5=yes
3431 ;;
3432 *)
3433 AC_MSG_RESULT($withval)
3434 KRB5_CFLAGS="-I$withval/include"
3435 KRB5_CPPFLAGS="-I$withval/include"
3436 KRB5_LDFLAGS="-L$withval/lib"
3437 FOUND_KRB5=yes
3438 if test -x "$withval/bin/krb5-config"; then
3439 KRB5CONFIG=$withval/bin/krb5-config
3440 fi
3441 ;;
3442 esac ],
3443 AC_MSG_RESULT(no krb5-path given)
3444 )
3445 fi
3446
3447 #################################################
3448 # check for krb5-config from recent MIT and Heimdal kerberos 5
3449 AC_PATH_PROG(KRB5CONFIG, krb5-config)
3450 AC_MSG_CHECKING(for working krb5-config)
3451 if test -x "$KRB5CONFIG" && $KRB5CONFIG --libs gssapi > /dev/null ; then
3452 ac_save_CFLAGS=$CFLAGS
3453 CFLAGS="";export CFLAGS
3454 ac_save_LDFLAGS=$LDFLAGS
3455 LDFLAGS="";export LDFLAGS
3456 KRB5_LIBS="`$KRB5CONFIG --libs gssapi`"
3457 KRB5_LDFLAGS="`$KRB5CONFIG --libs gssapi | sed s/-lgss.*//`"
3458 KRB5_CFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
3459 KRB5_CPPFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
3460 CFLAGS=$ac_save_CFLAGS;export CFLAGS
3461 LDFLAGS=$ac_save_LDFLAGS;export LDFLAGS
3462 FOUND_KRB5=yes
3463 AC_MSG_RESULT(yes)
3464 else
3465 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
3466 fi
3467
3468 if test x$FOUND_KRB5 = x"no"; then
3469 #################################################
3470 # see if this box has the SuSE location for the heimdal krb implementation
3471 AC_MSG_CHECKING(for /usr/include/heimdal)
3472 if test -d /usr/include/heimdal; then
3473 if test -f /usr/lib/heimdal/lib/libkrb5.a; then
3474 KRB5_CFLAGS="-I/usr/include/heimdal"
3475 KRB5_CPPFLAGS="-I/usr/include/heimdal"
3476 KRB5_LDFLAGS="-L/usr/lib/heimdal/lib"
3477 FOUND_KRB5=yes
3478 AC_MSG_RESULT(yes)
3479 else
3480 KRB5_CFLAGS="-I/usr/include/heimdal"
3481 KRB5_CPPFLAGS="-I/usr/include/heimdal"
3482 FOUND_KRB5=yes
3483 AC_MSG_RESULT(yes)
3484 fi
3485 else
3486 AC_MSG_RESULT(no)
3487 fi
3488 fi
3489
3490 if test x$FOUND_KRB5 = x"no"; then
3491 #################################################
3492 # see if this box has the RedHat location for kerberos
3493 AC_MSG_CHECKING(for /usr/kerberos)
3494 if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
3495 KRB5_LDFLAGS="-L/usr/kerberos/lib"
3496 KRB5_CFLAGS="-I/usr/kerberos/include"
3497 KRB5_CPPFLAGS="-I/usr/kerberos/include"
3498 FOUND_KRB5=yes
3499 AC_MSG_RESULT(yes)
3500 else
3501 AC_MSG_RESULT(no)
3502 fi
3503 fi
3504
3505 if test x$FOUND_KRB5 = x"no"; then
3506 #################################################
3507 # see if this box has the OpenBSD location for heimdal krb5
3508 AC_MSG_CHECKING(for /usr/include/kerberosV)
3509 if test -d /usr/include/kerberosV; then
3510 KRB5_CPPFLAGS="-I/usr/include/kerberosV"
3511 KRB5_LIBS="-lcrypto"
3512 FOUND_KRB5=yes
3513 AC_MSG_RESULT(yes)
3514 else
3515 AC_MSG_RESULT(no)
3516 fi
3517 fi
3518
3519 ac_save_CFLAGS=$CFLAGS
3520 ac_save_CPPFLAGS=$CPPFLAGS
3521 ac_save_LDFLAGS=$LDFLAGS
3522
3523 # remove needless evil rpath stuff as early as possible:
3524 LIB_REMOVE_USR_LIB(KRB5_LIBS)
3525 LIB_REMOVE_USR_LIB(KRB5_LDFLAGS)
3526 CFLAGS="$KRB5_CFLAGS $CFLAGS"
3527 CPPFLAGS="$KRB5_CPPFLAGS $CPPFLAGS"
3528 LDFLAGS="$KRB5_LDFLAGS $LDFLAGS"
3529
3530 KRB5_LIBS="$KRB5_LDFLAGS $KRB5_LIBS"
3531
3532 # now check for krb5.h. Some systems have the libraries without the headers!
3533 # note that this check is done here to allow for different kerberos
3534 # include paths
3535 AC_CHECK_HEADERS(krb5.h)
3536
3537 if test x"$ac_cv_header_krb5_h" = x"no"; then
3538
3539 # Give a warning if AD support was not explicitly requested,
3540 # i.e with_ads_support = auto, otherwise die with an error.
3541
3542 if test x"$with_ads_support" = x"yes"; then
3543 AC_MSG_ERROR([Active Directory cannot be supported without krb5.h])
3544 else
3545 AC_MSG_WARN([Active Directory cannot be supported without krb5.h])
3546 fi
3547
3548 # Turn off AD support and restore CFLAGS and LIBS variables
3549
3550 with_ads_support="no"
3551
3552 CFLAGS=$ac_save_CFLAGS
3553 CPPFLAGS=$ac_save_CPPFLAGS
3554 LDFLAGS=$ac_save_LDFLAGS
3555 fi
3556 AC_CHECK_HEADERS([krb5/locate_plugin.h], [], [],
3557[[#ifdef HAVE_KRB5_H
3558 #include <krb5.h>
3559 #endif
3560]])
3561
3562 if test x"$ac_cv_header_krb5_locate_plugin_h" = x"yes"; then
3563 WINBIND_KRB5_LOCATOR="bin/winbind_krb5_locator.$SHLIBEXT"
3564 if test x"$BLDSHARED" = x"true" ; then
3565 EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS $WINBIND_KRB5_LOCATOR"
3566 fi
3567 fi
3568
3569 # check for new heimdal KRB5_DEPRECATED handling
3570
3571 AC_CACHE_CHECK([for KRB5_DEPRECATED define taking an identifier],
3572 samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER,[
3573 AC_TRY_COMPILE(
3574 [#define KRB5_DEPRECATED 1
3575 #include <krb5.h>],
3576 [],
3577 samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER=yes,
3578 samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER=no)])
3579
3580 if test x"$samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER" = x"yes"; then
3581 AC_DEFINE(HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER, 1,
3582 [Whether to use deprecated krb5 interfaces])
3583 fi
3584fi
3585
3586# Now we have determined whether we really want ADS support
3587use_ads=no
3588if test x"$with_ads_support" != x"no"; then
3589 use_ads=yes
3590 have_gssapi=no
3591 ac_save_LIBS=$LIBS
3592
3593 # now check for gssapi headers. This is also done here to allow for
3594 # different kerberos include paths
3595 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h)
3596
3597 ##################################################################
3598 # we might need the k5crypto and com_err libraries on some systems
3599 AC_CHECK_LIB_EXT(com_err, KRB5_LIBS, _et_list)
3600 AC_CHECK_LIB_EXT(k5crypto, KRB5_LIBS, krb5_encrypt_data)
3601
3602 # Heimdal checks.
3603 AC_CHECK_LIB_EXT(crypto, KRB5_LIBS, des_set_key)
3604 AC_CHECK_LIB_EXT(asn1, KRB5_LIBS, copy_Authenticator)
3605 AC_CHECK_LIB_EXT(roken, KRB5_LIBS, roken_getaddrinfo_hostspec)
3606
3607 # Heimdal checks. On static Heimdal gssapi must be linked before krb5.
3608 AC_CHECK_LIB_EXT(gssapi, KRB5_LIBS, gss_display_status,[],[],have_gssapi=yes)
3609
3610 ########################################################
3611 # now see if we can find the krb5 libs in standard paths
3612 # or as specified above
3613 AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_mk_req_extended)
3614 AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_kt_compare)
3615
3616 ########################################################
3617 # now see if we can find the gssapi libs in standard paths
3618 if test x"$have_gssapi" != x"yes"; then
3619 AC_CHECK_LIB_EXT(gssapi_krb5, KRB5_LIBS,gss_display_status,[],[],have_gssapi=yes)
3620 fi
3621
3622 AC_CHECK_FUNC_EXT(krb5_set_real_time, $KRB5_LIBS)
3623 AC_CHECK_FUNC_EXT(krb5_set_default_in_tkt_etypes, $KRB5_LIBS)
3624 AC_CHECK_FUNC_EXT(krb5_set_default_tgs_enctypes, $KRB5_LIBS)
3625 AC_CHECK_FUNC_EXT(krb5_set_default_tgs_ktypes, $KRB5_LIBS)
3626 AC_CHECK_FUNC_EXT(krb5_principal2salt, $KRB5_LIBS)
3627 AC_CHECK_FUNC_EXT(krb5_use_enctype, $KRB5_LIBS)
3628 AC_CHECK_FUNC_EXT(krb5_string_to_key, $KRB5_LIBS)
3629 AC_CHECK_FUNC_EXT(krb5_get_pw_salt, $KRB5_LIBS)
3630 AC_CHECK_FUNC_EXT(krb5_string_to_key_salt, $KRB5_LIBS)
3631 AC_CHECK_FUNC_EXT(krb5_auth_con_setkey, $KRB5_LIBS)
3632 AC_CHECK_FUNC_EXT(krb5_auth_con_setuseruserkey, $KRB5_LIBS)
3633 AC_CHECK_FUNC_EXT(krb5_locate_kdc, $KRB5_LIBS)
3634 AC_CHECK_FUNC_EXT(krb5_get_permitted_enctypes, $KRB5_LIBS)
3635 AC_CHECK_FUNC_EXT(krb5_get_default_in_tkt_etypes, $KRB5_LIBS)
3636 AC_CHECK_FUNC_EXT(krb5_free_data_contents, $KRB5_LIBS)
3637 AC_CHECK_FUNC_EXT(krb5_principal_get_comp_string, $KRB5_LIBS)
3638 AC_CHECK_FUNC_EXT(krb5_free_unparsed_name, $KRB5_LIBS)
3639 AC_CHECK_FUNC_EXT(krb5_free_keytab_entry_contents, $KRB5_LIBS)
3640 AC_CHECK_FUNC_EXT(krb5_kt_free_entry, $KRB5_LIBS)
3641 AC_CHECK_FUNC_EXT(krb5_krbhst_init, $KRB5_LIBS)
3642 AC_CHECK_FUNC_EXT(krb5_krbhst_get_addrinfo, $KRB5_LIBS)
3643 AC_CHECK_FUNC_EXT(krb5_c_enctype_compare, $KRB5_LIBS)
3644 AC_CHECK_FUNC_EXT(krb5_enctypes_compatible_keys, $KRB5_LIBS)
3645 AC_CHECK_FUNC_EXT(krb5_crypto_init, $KRB5_LIBS)
3646 AC_CHECK_FUNC_EXT(krb5_crypto_destroy, $KRB5_LIBS)
3647 AC_CHECK_FUNC_EXT(krb5_decode_ap_req, $KRB5_LIBS)
3648 AC_CHECK_FUNC_EXT(free_AP_REQ, $KRB5_LIBS)
3649 AC_CHECK_FUNC_EXT(krb5_verify_checksum, $KRB5_LIBS)
3650 AC_CHECK_FUNC_EXT(krb5_c_verify_checksum, $KRB5_LIBS)
3651 AC_CHECK_FUNC_EXT(krb5_principal_compare_any_realm, $KRB5_LIBS)
3652 AC_CHECK_FUNC_EXT(krb5_parse_name_norealm, $KRB5_LIBS)
3653 AC_CHECK_FUNC_EXT(krb5_princ_size, $KRB5_LIBS)
3654 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_set_pac_request, $KRB5_LIBS)
3655 AC_CHECK_FUNC_EXT(krb5_get_renewed_creds, $KRB5_LIBS)
3656 AC_CHECK_FUNC_EXT(krb5_get_kdc_cred, $KRB5_LIBS)
3657 AC_CHECK_FUNC_EXT(krb5_free_error_contents, $KRB5_LIBS)
3658 AC_CHECK_FUNC_EXT(initialize_krb5_error_table, $KRB5_LIBS)
3659 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_alloc, $KRB5_LIBS)
3660 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_free, $KRB5_LIBS)
3661 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_get_error, $KRB5_LIBS)
3662 AC_CHECK_FUNC_EXT(krb5_enctype_to_string, $KRB5_LIBS)
3663 AC_CHECK_FUNC_EXT(krb5_fwd_tgt_creds, $KRB5_LIBS)
3664 AC_CHECK_FUNC_EXT(krb5_auth_con_set_req_cksumtype, $KRB5_LIBS)
3665 AC_CHECK_FUNC_EXT(krb5_get_creds_opt_alloc, $KRB5_LIBS)
3666 AC_CHECK_FUNC_EXT(krb5_get_creds_opt_set_impersonate, $KRB5_LIBS)
3667 AC_CHECK_FUNC_EXT(krb5_get_creds, $KRB5_LIBS)
3668 AC_CHECK_FUNC_EXT(krb5_get_credentials_for_user, $KRB5_LIBS)
3669 AC_CHECK_FUNC_EXT(krb5_get_host_realm, $KRB5_LIBS)
3670 AC_CHECK_FUNC_EXT(krb5_free_host_realm, $KRB5_LIBS)
3671
3672 # MIT krb5 1.8 does not expose this call (yet)
3673 AC_CHECK_DECLS(krb5_get_credentials_for_user, [], [], [#include <krb5.h>])
3674
3675 # MIT krb5 1.7beta3 (in Ubuntu Karmic) does not have this declaration
3676 # but does have the symbol
3677 AC_CHECK_DECLS(krb5_auth_con_set_req_cksumtype, [], [], [#include <krb5.h>])
3678
3679 LIBS="$KRB5_LIBS $LIBS"
3680
3681 AC_CACHE_CHECK(whether krb5_ticket contains kvno and enctype,
3682 smb_krb5_cv_ticket_has_keyinfo,
3683 [
3684 AC_TRY_COMPILE(
3685 [
3686 #include <krb5.h>
3687 ],
3688 [
3689 krb5_ticket ticket;
3690 krb5_kvno kvno;
3691 krb5_enctype enctype;
3692
3693 enctype = ticket.enc_part.enctype;
3694 kvno = ticket.enc_part.kvno;
3695 ],
3696 [ smb_krb5_cv_ticket_has_keyinfo=yes ],
3697 [ smb_krb5_cv_ticket_has_keyinfo=no ])
3698 ])
3699
3700 if test x"$smb_krb5_cv_ticket_has_keyinfo" = x"yes" ; then
3701 AC_DEFINE(KRB5_TICKET_HAS_KEYINFO, 1,
3702 [Whether the krb5_ticket structure contains the kvno and enctype])
3703 fi
3704
3705 AC_CACHE_CHECK(whether krb5_get_init_creds_opt_free takes a context argument,
3706 smb_krb5_cv_creds_opt_free_context,
3707 [
3708 AC_TRY_COMPILE([
3709 #include <krb5.h>],
3710 [
3711 krb5_context ctx;
3712 krb5_get_init_creds_opt *opt = NULL;
3713 krb5_get_init_creds_opt_free(ctx, opt);
3714 ],
3715 [smb_krb5_cv_creds_opt_free_context=yes],
3716 [smb_krb5_cv_creds_opt_free_context=no]
3717 )
3718 ])
3719
3720 if test x"$smb_krb5_cv_creds_opt_free_context" = x"yes" ; then
3721 AC_DEFINE(KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT, 1,
3722 [Whether krb5_get_init_creds_opt_free takes a context argument])
3723 fi
3724
3725 AC_CACHE_CHECK(whether krb5_verify_checksum takes 7 arguments, smb_krb5_cv_verify_checksum, [
3726 AC_TRY_COMPILE([
3727 #include <krb5.h>],
3728 [krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);],
3729 [smb_krb5_cv_verify_checksum=7],
3730 [smb_krb5_cv_verify_checksum=6],
3731 )
3732 ])
3733 AC_DEFINE_UNQUOTED(KRB5_VERIFY_CHECKSUM_ARGS, $smb_krb5_cv_verify_checksum, [Number of arguments to krb5_verify_checksum])
3734
3735 AC_CACHE_CHECK([for checksum in krb5_checksum],
3736 samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM,[
3737 AC_TRY_COMPILE([#include <krb5.h>],
3738 [krb5_checksum cksum; cksum.checksum.length = 0;],
3739 samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM=yes,
3740 samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM=no)])
3741
3742 if test x"$samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM" = x"yes"; then
3743 AC_DEFINE(HAVE_CHECKSUM_IN_KRB5_CHECKSUM,1,
3744 [Whether the krb5_checksum struct has a checksum property])
3745 fi
3746
3747 AC_CACHE_CHECK([for etype in EncryptedData],
3748 samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA,[
3749 AC_TRY_COMPILE([#include <krb5.h>],
3750 [EncryptedData edata; edata.etype = 0;],
3751 samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA=yes,
3752 samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA=no)])
3753
3754 if test x"$samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA" = x"yes"; then
3755 AC_DEFINE(HAVE_ETYPE_IN_ENCRYPTEDDATA,1,
3756 [Whether the EncryptedData struct has a etype property])
3757 fi
3758
3759 AC_CACHE_CHECK([for ticket pointer in krb5_ap_req],
3760 samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ,[
3761 AC_TRY_COMPILE([#include <krb5.h>],
3762 [krb5_ap_req *ap_req; ap_req->ticket = NULL;],
3763 samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ=yes,
3764 samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ=no)])
3765
3766 if test x"$samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ" = x"yes"; then
3767 AC_DEFINE(HAVE_TICKET_POINTER_IN_KRB5_AP_REQ,1,
3768 [Whether the krb5_ap_req struct has a ticket pointer])
3769 fi
3770
3771 AC_CACHE_CHECK([for e_data pointer in krb5_error],
3772 samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR,[
3773 AC_TRY_COMPILE([#include <krb5.h>],
3774 [krb5_error err; err.e_data = NULL;],
3775 samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR=yes,
3776 samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR=no)])
3777
3778 if test x"$samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR" = x"yes"; then
3779 AC_DEFINE(HAVE_E_DATA_POINTER_IN_KRB5_ERROR,1,
3780 [Whether the krb5_error struct has a e_data pointer])
3781 fi
3782
3783 AC_CACHE_CHECK([for krb5_crypto type],
3784 samba_cv_HAVE_KRB5_CRYPTO,[
3785 AC_TRY_COMPILE([#include <krb5.h>],
3786 [krb5_crypto crypto;],
3787 samba_cv_HAVE_KRB5_CRYPTO=yes,
3788 samba_cv_HAVE_KRB5_CRYPTO=no)])
3789
3790 if test x"$samba_cv_HAVE_KRB5_CRYPTO" = x"yes"; then
3791 AC_DEFINE(HAVE_KRB5_CRYPTO,1,
3792 [Whether the type krb5_crypto exists])
3793 fi
3794
3795 AC_CACHE_CHECK([for krb5_encrypt_block type],
3796 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK,[
3797 AC_TRY_COMPILE([#include <krb5.h>],
3798 [krb5_encrypt_block block;],
3799 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK=yes,
3800 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK=no)])
3801
3802 if test x"$samba_cv_HAVE_KRB5_ENCRYPT_BLOCK" = x"yes"; then
3803 AC_DEFINE(HAVE_KRB5_ENCRYPT_BLOCK,1,
3804 [Whether the type krb5_encrypt_block exists])
3805 fi
3806
3807 AC_CACHE_CHECK([for addrtype in krb5_address],
3808 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS,[
3809 AC_TRY_COMPILE([#include <krb5.h>],
3810 [krb5_address kaddr; kaddr.addrtype = ADDRTYPE_INET;],
3811 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=yes,
3812 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=no)])
3813
3814 if test x"$samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS" = x"yes"; then
3815 AC_DEFINE(HAVE_ADDRTYPE_IN_KRB5_ADDRESS,1,
3816 [Whether the krb5_address struct has a addrtype property])
3817 fi
3818
3819 AC_CACHE_CHECK([for addr_type in krb5_address],
3820 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,[
3821 AC_TRY_COMPILE([#include <krb5.h>],
3822 [krb5_address kaddr; kaddr.addr_type = KRB5_ADDRESS_INET;],
3823 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=yes,
3824 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=no)])
3825
3826 if test x"$samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS" = x"yes"; then
3827 AC_DEFINE(HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,1,
3828 [Whether the krb5_address struct has a addr_type property])
3829 fi
3830
3831 AC_CACHE_CHECK([for enc_part2 in krb5_ticket],
3832 samba_cv_HAVE_KRB5_TKT_ENC_PART2,
3833 [AC_TRY_COMPILE([#include <krb5.h>],
3834 [krb5_ticket tkt; tkt.enc_part2->authorization_data[0]->contents = NULL;],
3835 samba_cv_HAVE_KRB5_TKT_ENC_PART2=yes,samba_cv_HAVE_KRB5_TKT_ENC_PART2=no)])
3836
3837 if test x"$samba_cv_HAVE_KRB5_TKT_ENC_PART2" = x"yes"; then
3838 AC_DEFINE(HAVE_KRB5_TKT_ENC_PART2,1,
3839 [Whether the krb5_ticket struct has a enc_part2 property])
3840 fi
3841
3842 AC_CACHE_CHECK([for keyblock in krb5_creds],
3843 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS,[
3844 AC_TRY_COMPILE([#include <krb5.h>],
3845 [krb5_creds creds; krb5_keyblock kb; creds.keyblock = kb;],
3846 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS=yes,
3847 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS=no)])
3848
3849 if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS" = x"yes"; then
3850 AC_DEFINE(HAVE_KRB5_KEYBLOCK_IN_CREDS,1,
3851 [Whether the krb5_creds struct has a keyblock property])
3852 fi
3853
3854 AC_CACHE_CHECK([for session in krb5_creds],
3855 samba_cv_HAVE_KRB5_SESSION_IN_CREDS,[
3856 AC_TRY_COMPILE([#include <krb5.h>],
3857 [krb5_creds creds; krb5_keyblock kb; creds.session = kb;],
3858 samba_cv_HAVE_KRB5_SESSION_IN_CREDS=yes,
3859 samba_cv_HAVE_KRB5_SESSION_IN_CREDS=no)])
3860
3861 if test x"$samba_cv_HAVE_KRB5_SESSION_IN_CREDS" = x"yes"; then
3862 AC_DEFINE(HAVE_KRB5_SESSION_IN_CREDS,1,
3863 [Whether the krb5_creds struct has a session property])
3864 fi
3865
3866 AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
3867 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE,[
3868 AC_TRY_COMPILE([#include <krb5.h>],
3869 [krb5_keyblock key; key.keyvalue.data = NULL;],
3870 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=yes,
3871 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=no)])
3872
3873 if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE" = x"yes"; then
3874 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
3875 [Whether the krb5_keyblock struct has a keyvalue property])
3876 fi
3877
3878 AC_CACHE_CHECK([for ENCTYPE_ARCFOUR_HMAC_MD5],
3879 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,[
3880 AC_TRY_COMPILE([#include <krb5.h>],
3881 [krb5_enctype enctype; enctype = ENCTYPE_ARCFOUR_HMAC_MD5;],
3882 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=yes,
3883 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=no)])
3884 AC_CACHE_CHECK([for KEYTYPE_ARCFOUR_56],
3885 samba_cv_HAVE_KEYTYPE_ARCFOUR_56,[
3886 AC_TRY_COMPILE([#include <krb5.h>],
3887 [krb5_keytype keytype; keytype = KEYTYPE_ARCFOUR_56;],
3888 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=yes,
3889 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=no)])
3890# Heimdals with KEYTYPE_ARCFOUR but not KEYTYPE_ARCFOUR_56 are broken
3891# w.r.t. arcfour and windows, so we must not enable it here
3892 if test x"$samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5" = x"yes" -a\
3893 x"$samba_cv_HAVE_KEYTYPE_ARCFOUR_56" = x"yes"; then
3894 AC_DEFINE(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,1,
3895 [Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type is available])
3896 fi
3897
3898 AC_CACHE_CHECK([for AP_OPTS_USE_SUBKEY],
3899 samba_cv_HAVE_AP_OPTS_USE_SUBKEY,[
3900 AC_TRY_COMPILE([#include <krb5.h>],
3901 [krb5_flags ap_options; ap_options = AP_OPTS_USE_SUBKEY;],
3902 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=yes,
3903 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=no)])
3904
3905 if test x"$samba_cv_HAVE_AP_OPTS_USE_SUBKEY" = x"yes"; then
3906 AC_DEFINE(HAVE_AP_OPTS_USE_SUBKEY,1,
3907 [Whether the AP_OPTS_USE_SUBKEY ap option is available])
3908 fi
3909
3910 AC_CACHE_CHECK([for KV5M_KEYTAB],
3911 samba_cv_HAVE_KV5M_KEYTAB,[
3912 AC_TRY_COMPILE([#include <krb5.h>],
3913 [krb5_keytab_entry entry; entry.magic = KV5M_KEYTAB;],
3914 samba_cv_HAVE_KV5M_KEYTAB=yes,
3915 samba_cv_HAVE_KV5M_KEYTAB=no)])
3916
3917 if test x"$samba_cv_HAVE_KV5M_KEYTAB" = x"yes"; then
3918 AC_DEFINE(HAVE_KV5M_KEYTAB,1,
3919 [Whether the KV5M_KEYTAB option is available])
3920 fi
3921
3922 AC_CACHE_CHECK([for KRB5_KU_OTHER_CKSUM],
3923 samba_cv_HAVE_KRB5_KU_OTHER_CKSUM,[
3924 AC_TRY_COMPILE([#include <krb5.h>],
3925 [krb5_keyusage usage = KRB5_KU_OTHER_CKSUM;],
3926 samba_cv_HAVE_KRB5_KU_OTHER_CKSUM=yes,
3927 samba_cv_HAVE_KRB5_KU_OTHER_CKSUM=no)])
3928
3929 if test x"$samba_cv_HAVE_KRB5_KU_OTHER_CKSUM" = x"yes"; then
3930 AC_DEFINE(HAVE_KRB5_KU_OTHER_CKSUM,1,
3931 [Whether KRB5_KU_OTHER_CKSUM is available])
3932 fi
3933
3934 AC_CACHE_CHECK([for KRB5_KEYUSAGE_APP_DATA_CKSUM],
3935 samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM,[
3936 AC_TRY_COMPILE([#include <krb5.h>],
3937 [krb5_keyusage usage = KRB5_KEYUSAGE_APP_DATA_CKSUM;],
3938 samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM=yes,
3939 samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM=no)])
3940
3941 if test x"$samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM" = x"yes"; then
3942 AC_DEFINE(HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM,1,
3943 [Whether KRB5_KEYUSAGE_APP_DATA_CKSUM is available])
3944 fi
3945
3946 AC_CACHE_CHECK([for the krb5_princ_component macro],
3947 samba_cv_HAVE_KRB5_PRINC_COMPONENT,[
3948 AC_TRY_LINK([#include <krb5.h>],
3949 [const krb5_data *pkdata; krb5_context context; krb5_principal principal; pkdata = krb5_princ_component(context, principal, 0);],
3950 samba_cv_HAVE_KRB5_PRINC_COMPONENT=yes,
3951 samba_cv_HAVE_KRB5_PRINC_COMPONENT=no)])
3952
3953 if test x"$samba_cv_HAVE_KRB5_PRINC_COMPONENT" = x"yes"; then
3954 AC_DEFINE(HAVE_KRB5_PRINC_COMPONENT,1,
3955 [Whether krb5_princ_component is available])
3956 fi
3957
3958 AC_CACHE_CHECK([for key in krb5_keytab_entry],
3959 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY,[
3960 AC_TRY_COMPILE([#include <krb5.h>],
3961 [krb5_keytab_entry entry; krb5_keyblock e; entry.key = e;],
3962 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=yes,
3963 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=no)])
3964
3965 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY" = x"yes"; then
3966 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEY,1,
3967 [Whether krb5_keytab_entry has key member])
3968 fi
3969
3970 AC_CACHE_CHECK([for keyblock in krb5_keytab_entry],
3971 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,[
3972 AC_TRY_COMPILE([#include <krb5.h>],
3973 [krb5_keytab_entry entry; entry.keyblock.keytype = 0;],
3974 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=yes,
3975 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=no)])
3976
3977 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK" = x"yes"; then
3978 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,1,
3979 [Whether krb5_keytab_entry has keyblock member])
3980 fi
3981
3982 AC_CACHE_CHECK([for magic in krb5_address],
3983 samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS,[
3984 AC_TRY_COMPILE([#include <krb5.h>],
3985 [krb5_address addr; addr.magic = 0;],
3986 samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS=yes,
3987 samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS=no)])
3988
3989 if test x"$samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS" = x"yes"; then
3990 AC_DEFINE(HAVE_MAGIC_IN_KRB5_ADDRESS,1,
3991 [Whether the krb5_address struct has a magic property])
3992 fi
3993
3994 AC_CACHE_CHECK([for WRFILE: keytab support],
3995 samba_cv_HAVE_WRFILE_KEYTAB,[
3996 AC_TRY_RUN([
3997#include<krb5.h>
3998 main()
3999 {
4000 krb5_context context;
4001 krb5_keytab keytab;
4002
4003 krb5_init_context(&context);
4004 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
4005 }],
4006 samba_cv_HAVE_WRFILE_KEYTAB=yes,
4007 samba_cv_HAVE_WRFILE_KEYTAB=no)])
4008
4009 if test x"$samba_cv_HAVE_WRFILE_KEYTAB" = x"yes"; then
4010 AC_DEFINE(HAVE_WRFILE_KEYTAB,1,
4011 [Whether the WRFILE:-keytab is supported])
4012 fi
4013
4014 AC_CACHE_CHECK([for krb5_realm type],
4015 samba_cv_HAVE_KRB5_REALM_TYPE,[
4016 AC_TRY_COMPILE([#include <krb5.h>],
4017 [krb5_realm realm;],
4018 samba_cv_HAVE_KRB5_REALM_TYPE=yes,
4019 samba_cv_HAVE_KRB5_REALM_TYPE=no)])
4020
4021 if test x"$samba_cv_HAVE_KRB5_REALM_TYPE" = x"yes"; then
4022 AC_DEFINE(HAVE_KRB5_REALM_TYPE,1,
4023 [Whether the type krb5_realm exists])
4024 fi
4025
4026 AC_CACHE_CHECK([for krb5_princ_realm returns krb5_realm or krb5_data],
4027 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM,[
4028 AC_TRY_COMPILE([#include <krb5.h>],
4029 [
4030 krb5_context context;
4031 krb5_principal principal;
4032 krb5_realm realm; realm = *krb5_princ_realm(context, principal);],
4033 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM=yes,
4034 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM=no)])
4035
4036 if test x"$samba_cv_KRB5_PRINC_REALM_RETURNS_REALM" = x"yes"; then
4037 AC_DEFINE(KRB5_PRINC_REALM_RETURNS_REALM,1,
4038 [Whether krb5_princ_realm returns krb5_realm or krb5_data])
4039 fi
4040
4041 AC_CACHE_CHECK([for krb5_addresses type],
4042 samba_cv_HAVE_KRB5_ADDRESSES,[
4043 AC_TRY_COMPILE([#include <krb5.h>],
4044 [krb5_addresses addr;],
4045 samba_cv_HAVE_KRB5_ADDRESSES=yes,
4046 samba_cv_HAVE_KRB5_ADDRESSES=no)])
4047
4048 if test x"$samba_cv_HAVE_KRB5_ADDRESSES" = x"yes"; then
4049 AC_DEFINE(HAVE_KRB5_ADDRESSES,1,
4050 [Whether the type krb5_addresses type exists])
4051 fi
4052
4053 AC_CACHE_CHECK([whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal],
4054 samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE, [
4055 AC_TRY_COMPILE([#include <krb5.h>],
4056 [
4057 krb5_mk_error(0,0,0);],
4058 samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE=yes,
4059 samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE=no)])
4060
4061 if test x"$samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE" = x"yes"; then
4062 AC_DEFINE(HAVE_SHORT_KRB5_MK_ERROR_INTERFACE,1,
4063 [whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal])
4064 fi
4065
4066 if test x"$ac_cv_func_ext_krb5_enctype_to_string" = x"yes"; then
4067 AC_CACHE_CHECK([for krb5_error_code krb5_enctype_to_string(krb5_context context, krb5_enctype enctype, char **str)],
4068 smb_krb5_cv_enctype_to_string_takes_krb5_context_arg,[
4069 AC_TRY_RUN_STRICT([
4070 #include <stdlib.h>
4071 #include <krb5.h>
4072 int main(void) {
4073 krb5_context context = NULL;
4074 char *str = NULL;
4075 krb5_enctype_to_string(context, 1, &str);
4076 if (str) free (str);
4077 return 0;
4078 }
4079 ],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4080 smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=yes,
4081 smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=no)])
4082
4083 if test x"$smb_krb5_cv_enctype_to_string_takes_krb5_context_arg" = x"yes"; then
4084 AC_DEFINE(HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG,1,
4085 [whether krb5_enctype_to_string takes krb5_context argument])
4086 fi
4087
4088 AC_CACHE_CHECK([for krb5_error_code krb5_enctype_to_string(krb5_enctype enctype, char *str, size_t len)],
4089 smb_krb5_cv_enctype_to_string_takes_size_t_arg,[
4090 AC_TRY_RUN_STRICT([
4091 #include <krb5.h>
4092 int main(void) {
4093 char buf[256];
4094 krb5_enctype_to_string(1, buf, 256);
4095 return 0;
4096 }
4097 ],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4098 smb_krb5_cv_enctype_to_string_takes_size_t_arg=yes,
4099 smb_krb5_cv_enctype_to_string_takes_size_t_arg=no)])
4100
4101 if test x"$smb_krb5_cv_enctype_to_string_takes_size_t_arg" = x"yes"; then
4102 AC_DEFINE(HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG,1,
4103 [whether krb5_enctype_to_string takes size_t argument])
4104 fi
4105 fi
4106
4107 AC_CACHE_CHECK([for krb5_principal_get_realm],
4108 samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM,[
4109 AC_TRY_LINK([#include <krb5.h>],
4110 [krb5_context ctx = NULL; krb5_principal princ = NULL; const char *str = krb5_principal_get_realm(ctx, princ);],
4111 samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM=yes,
4112 samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM=no)])
4113
4114 if test x"$samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM" = x"yes"; then
4115 AC_DEFINE(HAVE_KRB5_PRINCIPAL_GET_REALM,1,
4116 [Whether the function krb5_principal_get_realm is defined])
4117 fi
4118
4119 AC_CACHE_CHECK([for krb5_princ_realm],
4120 samba_cv_HAVE_KRB5_PRINC_REALM,[
4121 AC_TRY_LINK([#include <krb5.h>],
4122 [krb5_context ctx = NULL; krb5_principal princ = NULL; const char *str = krb5_princ_realm(ctx, princ)->data;],
4123 samba_cv_HAVE_KRB5_PRINC_REALM=yes,
4124 samba_cv_HAVE_KRB5_PRINC_REALM=no)])
4125
4126 if test x"$samba_cv_HAVE_KRB5_PRINC_REALM" = x"yes"; then
4127 AC_DEFINE(HAVE_KRB5_PRINC_REALM,1,
4128 [Whether the macro krb5_princ_realm is defined])
4129 fi
4130
4131 #
4132 #
4133 # Now the decisions whether we can support krb5
4134 #
4135 # NOTE: all tests should be done before this block!
4136 #
4137 #
4138 if test x"$ac_cv_lib_ext_krb5_krb5_mk_req_extended" != x"yes"; then
4139 AC_MSG_WARN(krb5_mk_req_extended not found in -lkrb5)
4140 use_ads=no
4141 fi
4142
4143 if test x"$ac_cv_func_ext_krb5_principal2salt" != x"yes" -a \
4144 x"$ac_cv_func_ext_krb5_get_pw_salt" != x"yes"
4145 then
4146 AC_MSG_WARN(no CREATE_KEY_FUNCTIONS detected)
4147 use_ads=no
4148 fi
4149
4150 if test x"$ac_cv_func_ext_krb5_get_permitted_enctypes" != x"yes" -a \
4151 x"$ac_cv_func_ext_krb5_get_default_in_tkt_etypes" != x"yes"
4152 then
4153 AC_MSG_WARN(no GET_ENCTYPES_FUNCTIONS detected)
4154 use_ads=no
4155 fi
4156
4157 if test x"$ac_cv_func_ext_krb5_kt_free_entry" != x"yes" -a \
4158 x"$ac_cv_func_ext_krb5_free_keytab_entry_contents" != x"yes"
4159 then
4160 AC_MSG_WARN(no KT_FREE_FUNCTION detected)
4161 use_ads=no
4162 fi
4163
4164 if test x"$ac_cv_func_ext_krb5_c_verify_checksum" != x"yes" -a \
4165 x"$ac_cv_func_ext_krb5_verify_checksum" != x"yes"
4166 then
4167 AC_MSG_WARN(no KRB5_VERIFY_CHECKSUM_FUNCTION detected)
4168 use_ads=no
4169 fi
4170
4171 if test x"$smb_krb5_cv_ticket_has_keyinfo" != x"yes" ; then
4172
4173 # We only need the following functions if we can't get the enctype
4174 # and kvno out of the ticket directly (ie. on Heimdal).
4175
4176 if test x"$ac_cv_func_ext_free_AP_REQ" != x"yes"
4177 then
4178 AC_MSG_WARN(no KRB5_AP_REQ_FREE_FUNCTION detected)
4179 use_ads=no
4180 fi
4181
4182 if test x"$ac_cv_func_ext_krb5_decode_ap_req" != x"yes"
4183 then
4184 AC_MSG_WARN(no KRB5_AP_REQ_DECODING_FUNCTION detected)
4185 use_ads=no
4186 fi
4187
4188 fi
4189
4190 if test x"$use_ads" = x"yes"; then
4191 AC_DEFINE(WITH_ADS,1,[Whether to include Active Directory support])
4192 AC_DEFINE(HAVE_KRB5,1,[Whether to have KRB5 support])
4193 if test x"$have_gssapi" = x"yes"; then
4194 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available])
4195 fi
4196 else
4197 if test x"$with_ads_support" = x"yes"; then
4198 AC_MSG_ERROR(krb5 libs don't have all features required for Active Directory support)
4199 else
4200 AC_MSG_WARN(krb5 libs don't have all features required for Active Directory support)
4201 fi
4202 AC_REMOVE_DEFINE(HAVE_KRB5_H)
4203 AC_REMOVE_DEFINE(HAVE_GSSAPI_H)
4204 AC_REMOVE_DEFINE(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4205 AC_REMOVE_DEFINE(HAVE_GSSAPI_GSSAPI_H)
4206 KRB5_LIBS=""
4207 with_ads_support=no
4208 fi
4209 AC_MSG_CHECKING(whether Active Directory and krb5 support is used)
4210 AC_MSG_RESULT([$use_ads])
4211
4212LIBS="$ac_save_LIBS"
4213fi
4214
4215if test x"$use_ads" != xyes; then
4216 merged_build_possible=no
4217fi
4218
4219AC_CHECK_LIB_EXT(nscd, NSCD_LIBS, nscd_flush_cache)
4220PASSDB_LIBS="$PASSDB_LIBS $NSCD_LIBS"
4221
4222
4223########################################################
4224# Compile with DNS Updates support?
4225
4226with_dnsupdate_support=no
4227AC_MSG_CHECKING([whether to enable DNS Updates support])
4228
4229AC_ARG_WITH(dnsupdate,
4230[AS_HELP_STRING([--with-dnsupdate], [Enable DNS Updates support (default no)])],
4231[ case "$withval" in
4232 yes|no)
4233 with_dnsupdate_support=$withval
4234 ;;
4235 esac ])
4236
4237AC_MSG_RESULT($with_dnsupdate_support)
4238
4239if test x"$with_dnsupdate_support" != x"no"; then
4240
4241 ################################################################
4242 # first test for Active Directory support being enabled
4243 #if test x"$with_ads_support" = x"no"; then
4244 # AC_MSG_ERROR(Active Directory support is required to enable DNS Update support)
4245 # with_dnsupdate_support=no
4246 #fi
4247 ##################################################################
4248 # then test for uuid.h (necessary to generate unique DNS keynames
4249 # (uuid.h is required for this test)
4250 AC_CHECK_HEADERS(uuid/uuid.h)
4251
4252 if test x"$ac_cv_header_uuid_uuid_h" != x"yes"; then
4253 if test x"$with_dnsupdate_support" = x"yes"; then
4254 AC_MSG_ERROR(uuid.h is needed to enable DNS Updates support)
4255 else
4256 AC_MSG_WARN(uuid.h is needed to enable DNS Updates support)
4257 fi
4258 with_dnsupdate_support=no
4259 fi
4260fi
4261
4262if test x"$with_dnsupdate_support" != x"no"; then
4263
4264 ########################################################
4265 # Now see if we can find the uuid libs in standard paths
4266 # On some systems, the uuid API is in libc, so we have to
4267 # be careful not to insert a spurious -luuid.
4268
4269 UUID_LIBS=""
4270 AC_LIBTESTFUNC(uuid, uuid_generate,
4271 [
4272 case " $LIBS " in
4273 *\ -luuid\ *)
4274 UUID_LIBS="-luuid"
4275 SMB_REMOVE_LIB(uuid)
4276 ;;
4277 esac
4278
4279 with_dnsupdate_support=yes
4280 AC_DEFINE(WITH_DNS_UPDATES,1,[Whether to enable DNS Update support])
4281 ],
4282 [
4283 if test x"$with_dnsupdate_support" = x"yes"; then
4284 AC_MSG_ERROR(libuuid is needed to enable DNS Updates support)
4285 else
4286 AC_MSG_WARN(libuuid is needed to enable DNS Updates support)
4287 fi
4288 with_dnsupdate_support=no
4289 ])
4290fi
4291
4292#################################################
4293# check for automount support
4294AC_MSG_CHECKING(whether to use automount)
4295AC_ARG_WITH(automount,
4296[AS_HELP_STRING([--with-automount], [Include automount support (default=no)])],
4297[ case "$withval" in
4298 yes)
4299 AC_MSG_RESULT(yes)
4300 AC_DEFINE(WITH_AUTOMOUNT,1,[Whether to include automount support])
4301 ;;
4302 *)
4303 AC_MSG_RESULT(no)
4304 ;;
4305 esac ],
4306 AC_MSG_RESULT(no)
4307)
4308
4309#################################################
4310# check for mount- and umount.cifs support
4311CIFSMOUNT_PROGS=""
4312INSTALL_CIFSMOUNT=""
4313UNINSTALL_CIFSMOUNT=""
4314AC_MSG_CHECKING(whether to build mount.cifs)
4315AC_ARG_WITH(cifsmount,
4316[AS_HELP_STRING([--with-cifsmount], [Include mount.cifs (Linux only) support (default=yes)])],
4317[ case "$withval" in
4318 no)
4319 AC_MSG_RESULT(no)
4320 ;;
4321 *)
4322 case "$host_os" in
4323 *linux*)
4324 AC_MSG_RESULT(yes)
4325 AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs])
4326 CIFSMOUNT_PROGS="bin/mount.cifs"
4327 INSTALL_CIFSMOUNT="installcifsmount"
4328 UNINSTALL_CIFSMOUNT="uninstallcifsmount"
4329 ;;
4330 *)
4331 AC_MSG_ERROR(not on a linux system!)
4332 ;;
4333 esac
4334 ;;
4335 esac ],
4336[ case "$host_os" in
4337 *linux*)
4338 AC_MSG_RESULT(yes)
4339 AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs])
4340 CIFSMOUNT_PROGS="bin/mount.cifs"
4341 INSTALL_CIFSMOUNT="installcifsmount"
4342 UNINSTALL_CIFSMOUNT="uninstallcifsmount"
4343 ;;
4344 *)
4345 AC_MSG_RESULT(no)
4346 ;;
4347 esac ]
4348)
4349
4350CIFSUMOUNT_PROGS=""
4351INSTALL_CIFSUMOUNT=""
4352UNINSTALL_CIFSUMOUNT=""
4353AC_MSG_CHECKING(whether to build umount.cifs)
4354AC_ARG_WITH(cifsumount,
4355[AS_HELP_STRING([--with-cifsumount], [Include umount.cifs (Linux only) support (default=no)])],
4356[ case "$withval" in
4357 yes)
4358 case "$host_os" in
4359 *linux*)
4360 AC_MSG_RESULT(yes)
4361 AC_DEFINE(WITH_CIFSUMOUNT,1,[Whether to build umount.cifs])
4362 CIFSUMOUNT_PROGS="bin/umount.cifs"
4363 INSTALL_CIFSUMOUNT="installcifsumount"
4364 UNINSTALL_CIFSUMOUNT="uninstallcifsumount"
4365 ;;
4366 *)
4367 AC_MSG_ERROR(not on a linux system!)
4368 ;;
4369 esac
4370 ;;
4371 *)
4372 AC_MSG_RESULT(no)
4373 ;;
4374 esac ],
4375 AC_MSG_RESULT(no)
4376)
4377
4378#################################################
4379# check for cifs.upcall support
4380AC_CHECK_HEADERS([keyutils.h], [HAVE_KEYUTILS_H=1], [HAVE_KEYUTILS_H=0])
4381CIFSUPCALL_PROGS=""
4382INSTALL_CIFSUPCALL=""
4383UNINSTALL_CIFSUPCALL=""
4384AC_MSG_CHECKING(whether to build cifs.upcall)
4385AC_ARG_WITH(cifsupcall,
4386[AS_HELP_STRING([--with-cifsupcall], [Include cifs.upcall (Linux only) support (default=yes)])],
4387[ case "$withval" in
4388 no)
4389 AC_MSG_RESULT(no)
4390 ;;
4391 *)
4392 case "$host_os" in
4393 *linux*)
4394 if test x"$use_ads" != x"yes"; then
4395 AC_MSG_ERROR(ADS support should be enabled for building cifs.upcall)
4396 elif test x"$HAVE_KEYUTILS_H" != "x1"; then
4397 AC_MSG_ERROR(keyutils package is required for cifs.upcall)
4398 else
4399 AC_MSG_RESULT(yes)
4400 AC_DEFINE(WITH_CIFSUPCALL,1,[whether to build cifs.upcall])
4401 CIFSUPCALL_PROGS="bin/cifs.upcall"
4402 INSTALL_CIFSUPCALL="installcifsupcall"
4403 UNINSTALL_CIFSUPCALL="uninstallcifsupcall"
4404 fi
4405 ;;
4406 *)
4407 AC_MSG_ERROR(not on a linux system!)
4408 ;;
4409 esac
4410 ;;
4411 esac ],
4412[ case "$host_os" in
4413 *linux*)
4414 if test x"$use_ads" != x"yes"; then
4415 AC_MSG_WARN(ADS support should be enabled for building cifs.upcall)
4416 elif test x"$HAVE_KEYUTILS_H" != "x1"; then
4417 AC_MSG_WARN(keyutils package is required for cifs.upcall)
4418 else
4419 AC_MSG_RESULT(yes)
4420 AC_DEFINE(WITH_CIFSUPCALL,1,[whether to build cifs.upcall])
4421 CIFSUPCALL_PROGS="bin/cifs.upcall"
4422 INSTALL_CIFSUPCALL="installcifsupcall"
4423 UNINSTALL_CIFSUPCALL="uninstallcifsupcall"
4424 fi
4425 ;;
4426 *)
4427 AC_MSG_RESULT(no)
4428 ;;
4429 esac ]
4430)
4431
4432
4433#################################################
4434# Check for a PAM clear-text auth, accounts, password
4435# and session support. Most PAM implementations keep their
4436# headers in /usr/include/security. Darwin keeps its in
4437# /usr/include/pam.
4438
4439with_pam_for_crypt=no
4440try_pam=auto
4441AC_MSG_CHECKING(whether to try PAM support)
4442AC_ARG_WITH(pam,
4443[AS_HELP_STRING([--with-pam], [Include PAM support (default=auto)])],
4444[ case "$withval" in
4445 yes|no|auto)
4446 try_pam=$withval
4447 ;;
4448 esac
4449])
4450AC_MSG_RESULT([$try_pam])
4451
4452use_pam=no
4453create_pam_modules=no
4454if test x"${try_pam}" != x"no";then
4455 use_pam=yes
4456 create_pam_modules=yes
4457
4458 # Most systems have PAM headers in /usr/include/security, but Darwin
4459 # has them in /usr/include/pam.
4460 AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
4461 if test x"$ac_cv_header_security_pam_appl_h" != x"yes" -a \
4462 x"$ac_cv_header_pam_pam_appl_h" != x"yes"; then
4463 if test x"${try_pam}" = x"yes";then
4464 AC_MSG_ERROR([--with-pam=yes but pam_appl.h not found])
4465 fi
4466 use_pam=no
4467 create_pam_modules=no
4468 fi
4469
4470 AC_CHECK_LIB_EXT(pam, PAM_LIBS, pam_get_data)
4471 if test x"$ac_cv_lib_ext_pam_pam_get_data" != x"yes"; then
4472 if test x"${try_pam}" = x"yes";then
4473 AC_MSG_ERROR([--with-pam=yes but libpam not found])
4474 fi
4475 use_pam=no
4476 create_pam_modules=no
4477 fi
4478
4479 AC_CHECK_HEADERS(security/pam_modules.h pam/pam_modules.h,,,[[
4480 #if HAVE_SECURITY_PAM_APPL_H
4481 #include <security/pam_appl.h>
4482 #endif
4483 #if HAVE_PAM_PAM_APPL_H
4484 #include <pam/pam_appl.h>
4485 #endif
4486 ]])
4487 if test x"$ac_cv_header_security_pam_modules_h" = x"no" -a \
4488 x"$ac_cv_header_pam_pam_modules_h" = x"no" ; then
4489 if test x"${try_pam}" = x"yes";then
4490 AC_MSG_ERROR([--with-pam=yes but pam_modules.h not found])
4491 fi
4492 create_pam_modules=no
4493 fi
4494
4495 if test x"$use_pam" = x"yes"; then
4496 AC_DEFINE(WITH_PAM,1,[Whether to include PAM support])
4497 AC_DEFINE(HAVE_LIBPAM,1,[Whether libpam is available])
4498 AUTH_LIBS="$AUTH_LIBS $PAM_LIBS"
4499 with_pam_for_crypt=yes
4500
4501 if test x"$create_pam_modules" = x"yes"; then
4502 AC_DEFINE(WITH_PAM_MODULES,1,[Whether to include PAM MODULES support])
4503 # this checks are optional,
4504 # we don't care about the results here
4505 AC_CHECK_HEADERS(security/pam_ext.h security/_pam_macros.h)
4506 AC_CHECK_HEADERS(pam/pam_ext.h pam/_pam_macros.h)
4507 AC_CHECK_FUNC_EXT(pam_vsyslog,$PAM_LIBS)
4508 else
4509 AC_MSG_WARN([PAM support detected but PAM MODULES support is missing])
4510 fi
4511 fi
4512 AC_MSG_CHECKING(whether to use PAM support)
4513 AC_MSG_RESULT([$use_pam])
4514
4515 AC_MSG_CHECKING(whether to have PAM MODULES support)
4516 AC_MSG_RESULT([$create_pam_modules])
4517fi # try_pam != no
4518
4519#################################################
4520# check for PAM_RADIO_TYPE
4521AC_TRY_COMPILE([
4522#if (!defined(LINUX))
4523
4524#define PAM_EXTERN extern
4525#if defined(HAVE_SECURITY_PAM_APPL_H)
4526#include <security/pam_appl.h>
4527#elif defined(HAVE_PAM_PAM_APPL_H)
4528#include <pam/pam_appl.h>
4529#endif
4530
4531#endif
4532
4533#if defined(HAVE_SECURITY_PAM_MODULES_H)
4534#include <security/pam_modules.h>
4535#elif defined(HAVE_PAM_PAM_MODULES_H)
4536#include <pam/pam_modules.h>
4537#endif
4538
4539#if defined(HAVE_SECURITY__PAM_MACROS_H)
4540#include <security/_pam_macros.h>
4541#elif defined(HAVE_PAM__PAM_MACROS_H)
4542#include <pam/_pam_macros.h>
4543#endif
4544
4545#ifdef HAVE_SECURITY_PAM_EXT_H
4546#include <security/pam_ext.h>
4547#endif
4548],
4549[int i; i = PAM_RADIO_TYPE; ],
4550AC_DEFINE(HAVE_PAM_RADIO_TYPE, 1, [Define to 1 if PAM_RADIO_TYPE is available]),[])
4551
4552#################################################
4553# check for pam_smbpass support
4554PAM_MODULES=""
4555INSTALL_PAM_MODULES=""
4556UNINSTALL_PAM_MODULES=""
4557
4558try_pam_smbpass=auto
4559AC_MSG_CHECKING(whether to use pam_smbpass)
4560AC_ARG_WITH(pam_smbpass,
4561[AS_HELP_STRING([--with-pam_smbpass], [Build PAM module for authenticating against passdb backends (default=auto)])],
4562[ case "$withval" in
4563 yes|no|auto)
4564 try_pam_smbpass=$withval
4565 ;;
4566 *)
4567 AC_MSG_ERROR([valid options are yes,no,auto])
4568 ;;
4569 esac
4570])
4571
4572if test x"${try_pam_smbpass}" = xno ; then
4573 use_pam_smbpass=no
4574else
4575 use_pam_smbpass=yes
4576 # Conditions under which pam_smbpass can't be built.
4577 if test x"$BLDSHARED" != xtrue ; then
4578 if test x"${try_pam_smbpass}" = xyes ; then
4579 AC_MSG_ERROR([No support for shared modules])
4580 fi
4581 use_pam_smbpass=no
4582 elif test x"$create_pam_modules" != xyes ; then
4583 if test x"${try_pam_smbpass}" = xyes ; then
4584 AC_MSG_ERROR([No support for PAM MODULES])
4585 fi
4586 use_pam_smbpass=no
4587 fi
4588
4589 if test x"${use_pam_smbpass}" = xyes ; then
4590 PAM_MODULES="pam_smbpass"
4591 INSTALL_PAM_MODULES="installpammodules"
4592 UNINSTALL_PAM_MODULES="uninstallpammodules"
4593 fi
4594fi
4595AC_MSG_RESULT([$use_pam_smbpass])
4596
4597
4598##
4599## moved after the check for -lcrypt in order to
4600## ensure that the necessary libraries are included
4601## check checking for truncated salt. Wrapped by the
4602## $with_pam_for_crypt variable as above --jerry
4603##
4604if test $with_pam_for_crypt = no; then
4605AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
4606crypt_LIBS="$LIBS"
4607LIBS="$AUTH_LIBS $LIBS"
4608AC_TRY_RUN([#include "${srcdir-.}/../tests/crypttest.c"],
4609 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
4610LIBS="$crypt_LIBS"])
4611if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
4612 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
4613fi
4614fi
4615
4616#################################################
4617# check for a NISPLUS_HOME support
4618AC_MSG_CHECKING(whether to use NISPLUS_HOME)
4619AC_ARG_WITH(nisplus-home,
4620[AS_HELP_STRING([--with-nisplus-home], [Include NISPLUS_HOME support (default=no)])],
4621[ case "$withval" in
4622 yes)
4623 AC_MSG_RESULT(yes)
4624 AC_DEFINE(WITH_NISPLUS_HOME,1,[Whether to include nisplus_home support])
4625 ;;
4626 *)
4627 AC_MSG_RESULT(no)
4628 ;;
4629 esac ],
4630 AC_MSG_RESULT(no)
4631)
4632
4633#################################################
4634# check for syslog logging
4635AC_MSG_CHECKING(whether to use syslog logging)
4636AC_ARG_WITH(syslog,
4637[AS_HELP_STRING([--with-syslog], [Include experimental SYSLOG support (default=no)])],
4638[ case "$withval" in
4639 yes)
4640 AC_MSG_RESULT(yes)
4641 AC_DEFINE(WITH_SYSLOG,1,[Whether to include experimental syslog support])
4642 ;;
4643 *)
4644 AC_MSG_RESULT(no)
4645 ;;
4646 esac ],
4647 AC_MSG_RESULT(no)
4648)
4649
4650#################################################
4651# check for custom syslog facility
4652AC_MSG_CHECKING(whether to use a custom syslog facility)
4653AC_ARG_WITH(syslog-facility,
4654[AS_HELP_STRING([--with-syslog-facility], [Use a custom syslog facility (default=none)])],
4655[
4656 if test "$withval" = "no" ; then
4657 AC_MSG_ERROR([argument to --with-syslog-facility must be a string])
4658 else
4659 if test "$withval" != "yes" ; then
4660 syslog_facility="$withval"
4661 AC_DEFINE_UNQUOTED(SYSLOG_FACILITY,$syslog_facility, [syslog facility to log to])
4662 fi
4663 fi
4664])
4665
4666#################################################
4667# check for experimental disk-quotas support
4668
4669samba_cv_WITH_QUOTAS=auto
4670samba_cv_TRY_QUOTAS=no
4671samba_cv_RUN_QUOTA_TESTS=auto
4672samba_cv_WITH_SYS_QUOTAS=auto
4673samba_cv_TRY_SYS_QUOTAS=auto
4674samba_cv_SYSQUOTA_FOUND=no
4675
4676AC_MSG_CHECKING(whether to try disk-quotas support)
4677AC_ARG_WITH(quotas,
4678[AS_HELP_STRING([--with-quotas], [Include disk-quota support (default=no)])],
4679[ case "$withval" in
4680 yes)
4681 AC_MSG_RESULT(yes)
4682 samba_cv_WITH_QUOTAS=yes
4683 samba_cv_TRY_QUOTAS=yes
4684 samba_cv_RUN_QUOTA_TESTS=yes
4685 #set sys quotas to auto in this case
4686 samba_cv_TRY_SYS_QUOTAS=auto
4687 ;;
4688 auto)
4689 AC_MSG_RESULT(auto)
4690 samba_cv_WITH_QUOTAS=auto
4691 samba_cv_TRY_QUOTAS=auto
4692 samba_cv_RUN_QUOTA_TESTS=auto
4693 #set sys quotas to auto in this case
4694 samba_cv_TRY_SYS_QUOTAS=auto
4695 ;;
4696 no)
4697 AC_MSG_RESULT(no)
4698 samba_cv_WITH_QUOTAS=no
4699 samba_cv_TRY_QUOTAS=no
4700 samba_cv_RUN_QUOTA_TESTS=no
4701 ;;
4702 *)
4703 AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
4704 ;;
4705 esac ],
4706 AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
4707)
4708
4709AC_MSG_CHECKING(whether to try the new lib/sysquotas.c interface)
4710AC_ARG_WITH(sys-quotas,
4711[AS_HELP_STRING([--with-sys-quotas], [Include lib/sysquotas.c support (default=auto)])],
4712[ case "$withval" in
4713 yes)
4714 AC_MSG_RESULT(yes)
4715 samba_cv_WITH_SYS_QUOTAS=yes
4716 samba_cv_TRY_SYS_QUOTAS=yes
4717 samba_cv_RUN_QUOTA_TESTS=yes
4718 ;;
4719 auto)
4720 AC_MSG_RESULT(auto)
4721 samba_cv_WITH_SYS_QUOTAS=auto
4722 samba_cv_TRY_SYS_QUOTAS=auto
4723 samba_cv_RUN_QUOTA_TESTS=auto
4724 ;;
4725 no)
4726 AC_MSG_RESULT(no)
4727 samba_cv_WITH_SYS_QUOTAS=no
4728 samba_cv_TRY_SYS_QUOTAS=no
4729 ;;
4730 *)
4731 AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
4732 ;;
4733 esac ],
4734 AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
4735)
4736
4737if test x"$samba_cv_TRY_SYS_QUOTAS" = x"auto"; then
4738AC_MSG_CHECKING(whether to try the lib/sysquotas.c interface on ${host_os})
4739 case "$host_os" in
4740 *linux*)
4741 AC_MSG_RESULT(yes)
4742 samba_cv_TRY_SYS_QUOTAS=yes
4743 samba_cv_RUN_QUOTA_TESTS=yes
4744 ;;
4745 *)
4746 AC_MSG_RESULT(no)
4747 samba_cv_TRY_SYS_QUOTAS=no
4748 ;;
4749 esac
4750fi
4751
4752#############################################
4753# only check for quota stuff if --with-quotas
4754if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then
4755
4756case "$host_os" in
4757 # on linux we didn't need to test we have builtin support
4758 *linux*)
4759 samba_cv_SYSQUOTA_FOUND=yes
4760 AC_DEFINE(HAVE_QUOTACTL_LINUX,1,[Whether Linux quota support is available])
4761 samba_cv_sysquotas_file="lib/sysquotas_linux.c"
4762 AC_MSG_CHECKING(whether to use the lib/sysquotas_linux.c builtin support)
4763 AC_MSG_RESULT(yes)
4764
4765 AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available])
4766 samba_cv_found_xfs_header=yes
4767 AC_MSG_CHECKING(whether to use the lib/sysquotas_xfs.c builtin support)
4768 AC_MSG_RESULT(yes)
4769 ;;
4770 *solaris*)
4771 # need to set this define when using static linking (BUG 1473)
4772 CPPFLAGS="$CPPFLAGS -DSUNOS5"
4773 ;;
4774 *)
4775 ;;
4776esac
4777
4778# some broken header files need this
4779AC_CHECK_HEADER(asm/types.h,[
4780 AC_DEFINE(HAVE_ASM_TYPES_H,1,[check for <asm/types.h>])
4781 AC_ADD_INCLUDE(<asm/types.h>)
4782 ])
4783
4784# For quotas on Veritas VxFS filesystems
4785AC_CHECK_HEADERS(sys/fs/vx_quota.h)
4786
4787# For quotas on Linux XFS filesystems
4788AC_CHECK_HEADERS(linux/dqblk_xfs.h)
4789
4790# For sys/quota.h and linux/quota.h
4791AC_CHECK_HEADERS(sys/quota.h)
4792
4793if test x"$samba_cv_found_xfs_header" != x"yes"; then
4794# if we have xfs quota support <sys/quota.h> (IRIX) we should use it
4795AC_CACHE_CHECK([for XFS QUOTA in <sys/quota.h>],samba_cv_HAVE_SYS_QUOTA_XFS, [
4796AC_TRY_COMPILE([
4797#include "confdefs.h"
4798#ifdef HAVE_SYS_TYPES_H
4799#include <sys/types.h>
4800#endif
4801#ifdef HAVE_ASM_TYPES_H
4802#include <asm/types.h>
4803#endif
4804#include <sys/quota.h>
4805],[int i = Q_XGETQUOTA;],
4806samba_cv_HAVE_SYS_QUOTA_XFS=yes,samba_cv_HAVE_SYS_QUOTA_XFS=no)])
4807if test "$samba_cv_HAVE_SYS_QUOTA_XFS"x = "yes"x; then
4808 samba_cv_found_xfs_header=yes
4809fi
4810fi
4811
4812# if we have struct dqblk .dqb_fsoftlimit instead of .dqb_isoftlimit on IRIX
4813AC_CACHE_CHECK([if struct dqblk has .dqb_fsoftlimit],samba_cv_HAVE_DQB_FSOFTLIMIT, [
4814AC_TRY_COMPILE([
4815#include "confdefs.h"
4816#ifdef HAVE_SYS_QUOTA_H
4817#include <sys/quota.h>
4818#endif
4819],[
4820struct dqblk D;
4821D.dqb_fsoftlimit = 0;],
4822samba_cv_HAVE_DQB_FSOFTLIMIT=yes,samba_cv_HAVE_DQB_FSOFTLIMIT=no)])
4823if test "$samba_cv_HAVE_DQB_FSOFTLIMIT"x = "yes"x; then
4824 AC_DEFINE(HAVE_DQB_FSOFTLIMIT,1,[struct dqblk .dqb_fsoftlimit])
4825fi
4826
4827##################
4828# look for a working quota system
4829
4830if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4831AC_CACHE_CHECK([for long quotactl(int cmd, char *special, qid_t id, caddr_t addr)],samba_cv_HAVE_QUOTACTL_4A,[
4832AC_TRY_RUN_STRICT([
4833#define HAVE_QUOTACTL_4A 1
4834#define AUTOCONF_TEST 1
4835#include "confdefs.h"
4836#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4837 samba_cv_HAVE_QUOTACTL_4A=yes,samba_cv_HAVE_QUOTACTL_4A=no,samba_cv_HAVE_QUOTACTL_4A=cross)])
4838if test x"$samba_cv_HAVE_QUOTACTL_4A" = x"yes"; then
4839 samba_cv_SYSQUOTA_FOUND=yes;
4840 AC_DEFINE(HAVE_QUOTACTL_4A,1,[Whether long quotactl(int cmd, char *special, qid_t id, caddr_t addr) is available])
4841 samba_cv_sysquotas_file="lib/sysquotas_4A.c"
4842fi
4843fi
4844
4845if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4846AC_CACHE_CHECK([for int quotactl(const char *path, int cmd, int id, char *addr)],samba_cv_HAVE_QUOTACTL_4B,[
4847AC_TRY_RUN_STRICT([
4848#define HAVE_QUOTACTL_4B 1
4849#define AUTOCONF_TEST 1
4850#include "confdefs.h"
4851#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4852 samba_cv_HAVE_QUOTACTL_4B=yes,samba_cv_HAVE_QUOTACTL_4B=no,samba_cv_HAVE_QUOTACTL_4B=cross)])
4853if test x"$samba_cv_HAVE_QUOTACTL_4B" = x"yes"; then
4854 echo "int quotactl(const char *path, int cmd, int id, char *addr) is not reworked for the new sys_quota api"
4855 samba_cv_SYSQUOTA_FOUND=yes;
4856 AC_DEFINE(HAVE_QUOTACTL_4B,1,[Whether int quotactl(const char *path, int cmd, int id, char *addr) is available])
4857 samba_cv_sysquotas_file="lib/sysquotas_4B.c"
4858fi
4859fi
4860
4861if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4862AC_CACHE_CHECK([for CRAY int quotactl (char *spec, int request, char *arg)],samba_cv_HAVE_QUOTACTL_3,[
4863AC_TRY_RUN_STRICT([
4864#define HAVE_QUOTACTL_3 1
4865#define AUTOCONF_TEST 1
4866#include "confdefs.h"
4867#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4868 samba_cv_HAVE_QUOTACTL_3=yes,samba_cv_HAVE_QUOTACTL_3=no,samba_cv_HAVE_QUOTACTL_3=cross)])
4869if test x"$samba_cv_HAVE_QUOTACTL_3" = x"yes"; then
4870 echo "CRAY int quotactl (char *spec, int request, char *arg) is NOT reworked for the sys_quota api"
4871 samba_cv_SYSQUOTA_FOUND=yes;
4872 AC_DEFINE(HAVE_QUOTACTL_3,1,[Whether CRAY int quotactl (char *spec, int request, char *arg); is available])
4873 samba_cv_sysquotas_file="lib/sysquotas_3.c"
4874fi
4875fi
4876
4877#################################################
4878# check for mntent.h and struct mntent
4879AC_CHECK_HEADERS(mntent.h)
4880#################################################
4881# check for setmntent,getmntent,endmntent
4882AC_CHECK_FUNCS(setmntent getmntent endmntent)
4883
4884#################################################
4885# check for devnm.h and struct mntent
4886AC_CHECK_HEADERS(devnm.h)
4887#################################################
4888# check for devnm
4889AC_CHECK_FUNCS(devnm)
4890
4891if test x"$samba_cv_WITH_SYS_QUOTAS" = x"yes"; then
4892 if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4893 # if --with-sys-quotas=yes then build it
4894 # you have can use the get/set quota command smb.conf
4895 # options then
4896 samba_cv_SYSQUOTA_FOUND=auto
4897 fi
4898 if test x"$samba_cv_TRY_SYS_QUOTAS" != x"yes"; then
4899 # if --with-sys-quotas=yes then build it
4900 # you have can use the get/set quota command smb.conf
4901 # options then
4902 samba_cv_TRY_SYS_QUOTAS=auto
4903 fi
4904fi
4905
4906if test x"$samba_cv_SYSQUOTA_FOUND" != x"no"; then
4907AC_CACHE_CHECK([whether the sys_quota interface works],samba_cv_SYSQUOTA_WORKS,[
4908SAVE_CPPFLAGS="$CPPFLAGS"
4909CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
4910AC_TRY_COMPILE([
4911#include "confdefs.h"
4912#define NO_PROTO_H 1
4913#define NO_CONFIG_H 1
4914#define HAVE_SYS_QUOTAS 1
4915#include "${srcdir-.}/${samba_cv_sysquotas_file}"
4916#include "${srcdir-.}/lib/sysquotas.c"
4917],[],samba_cv_SYSQUOTA_WORKS=yes,samba_cv_SYSQUOTA_WORKS=no)
4918CPPFLAGS="$SAVE_CPPFLAGS"
4919])
4920if test x"$samba_cv_SYSQUOTA_WORKS" = x"yes"; then
4921AC_MSG_CHECKING(whether to use the new lib/sysquotas.c interface)
4922 if test x"$samba_cv_TRY_SYS_QUOTAS" != x"no"; then
4923 AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
4924 AC_DEFINE(HAVE_SYS_QUOTAS,1,[Whether the new lib/sysquotas.c interface can be used])
4925 samba_cv_WE_USE_SYS_QUOTAS=yes
4926 AC_MSG_RESULT(yes)
4927 else
4928 AC_MSG_RESULT(no)
4929 fi
4930fi
4931fi
4932
4933if test x"$samba_cv_SYSQUOTA_FOUND" != x"no" -a x"$samba_cv_found_xfs_header" = x"yes"; then
4934AC_CACHE_CHECK([whether the sys_quota interface works with XFS],samba_cv_SYSQUOTA_WORKS_XFS,[
4935SAVE_CPPFLAGS="$CPPFLAGS"
4936CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
4937AC_TRY_COMPILE([
4938#include "confdefs.h"
4939#define NO_PROTO_H 1
4940#define NO_CONFIG_H 1
4941#define HAVE_SYS_QUOTAS 1
4942#define HAVE_XFS_QUOTAS 1
4943#include "${srcdir-.}/lib/sysquotas_xfs.c"
4944],[],samba_cv_SYSQUOTA_WORKS_XFS=yes,samba_cv_SYSQUOTA_WORKS_XFS=no)
4945CPPFLAGS="$SAVE_CPPFLAGS"
4946])
4947if test x"$samba_cv_SYSQUOTA_WORKS_XFS" = x"yes"; then
4948 if test x"$samba_cv_WE_USE_SYS_QUOTAS" = x"yes"; then
4949 AC_DEFINE(HAVE_XFS_QUOTAS,1,[Whether xfs quota support is available])
4950 fi
4951fi
4952fi
4953
4954AC_CACHE_CHECK([whether the old quota support works],samba_cv_QUOTA_WORKS,[
4955SAVE_CPPFLAGS="$CPPFLAGS"
4956CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
4957AC_TRY_COMPILE([
4958#include "confdefs.h"
4959#define NO_PROTO_H 1
4960#define NO_CONFIG_H 1
4961#include "${srcdir-.}/smbd/quotas.c"
4962],[],samba_cv_QUOTA_WORKS=yes,samba_cv_QUOTA_WORKS=no)
4963CPPFLAGS="$SAVE_CPPFLAGS"
4964])
4965if test x"$samba_cv_QUOTA_WORKS" = x"yes"; then
4966AC_MSG_CHECKING(whether to use the old quota support)
4967 if test x"$samba_cv_WE_USE_SYS_QUOTAS" != x"yes"; then
4968 if test x"$samba_cv_TRY_QUOTAS" != x"no"; then
4969 AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
4970 AC_MSG_RESULT(yes)
4971 else
4972 AC_MSG_RESULT(no)
4973 fi
4974 else
4975 AC_MSG_RESULT(no)
4976 fi
4977fi
4978
4979####################
4980# End of quota check samba_cv_RUN_QUOTA_TESTS
4981fi
4982
4983#################################################
4984# check for experimental utmp accounting
4985
4986AC_MSG_CHECKING(whether to support utmp accounting)
4987WITH_UTMP=yes
4988AC_ARG_WITH(utmp,
4989[AS_HELP_STRING([--with-utmp], [Include utmp accounting (default, if supported by OS)])],
4990[ case "$withval" in
4991 no)
4992 WITH_UTMP=no
4993 ;;
4994 *)
4995 WITH_UTMP=yes
4996 ;;
4997 esac ],
4998)
4999
5000# utmp requires utmp.h
5001# Note similar check earlier, when checking utmp details.
5002
5003if test x"$WITH_UTMP" = x"yes" -a x"$ac_cv_header_utmp_h" = x"no"; then
5004 utmp_no_reason=", no utmp.h on $host_os"
5005 WITH_UTMP=no
5006fi
5007
5008# Display test results
5009
5010if test x"$WITH_UTMP" = x"yes"; then
5011 AC_MSG_RESULT(yes)
5012 AC_DEFINE(WITH_UTMP,1,[Whether to include experimental utmp accounting])
5013else
5014 AC_MSG_RESULT(no$utmp_no_reason)
5015fi
5016
5017
5018#################################################
5019# these tests are taken from the GNU fileutils package
5020AC_CHECKING(how to get filesystem space usage)
5021space=no
5022
5023# Test for statvfs64.
5024if test $space = no; then
5025 # SVR4
5026 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
5027 [AC_TRY_RUN([
5028#if defined(HAVE_UNISTD_H)
5029#include <unistd.h>
5030#endif
5031#include <sys/types.h>
5032#include <sys/statvfs.h>
5033 main ()
5034 {
5035 struct statvfs64 fsd;
5036 exit (statvfs64 (".", &fsd));
5037 }],
5038 fu_cv_sys_stat_statvfs64=yes,
5039 fu_cv_sys_stat_statvfs64=no,
5040 fu_cv_sys_stat_statvfs64=cross)])
5041 if test $fu_cv_sys_stat_statvfs64 = yes; then
5042 space=yes
5043 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
5044 fi
5045fi
5046
5047# Perform only the link test since it seems there are no variants of the
5048# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
5049# because that got a false positive on SCO OSR5. Adding the declaration
5050# of a `struct statvfs' causes this test to fail (as it should) on such
5051# systems. That system is reported to work fine with STAT_STATFS4 which
5052# is what it gets when this test fails.
5053if test $space = no; then
5054 # SVR4
5055 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
5056 [AC_TRY_LINK([#include <sys/types.h>
5057#include <sys/statvfs.h>],
5058 [struct statvfs fsd; statvfs (0, &fsd);],
5059 fu_cv_sys_stat_statvfs=yes,
5060 fu_cv_sys_stat_statvfs=no)])
5061 if test $fu_cv_sys_stat_statvfs = yes; then
5062 space=yes
5063 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
5064 fi
5065fi
5066
5067# smbd/statvfs.c assumes that statvfs.f_fsid is an integer.
5068# This is not the case on ancient Linux systems.
5069
5070AC_CACHE_CHECK([that statvfs.f_fsid is an integer],samba_cv_fsid_int, [
5071 AC_TRY_COMPILE([#include <sys/types.h>
5072#include <sys/statvfs.h>],[struct statvfs buf; buf.f_fsid = 0],
5073 samba_cv_fsid_int=yes,samba_cv_fsid_int=no)])
5074if test x"$samba_cv_fsid_int" = x"yes"; then
5075 AC_DEFINE(HAVE_FSID_INT, 1, [Whether statvfs.f_fsid is an integer])
5076fi
5077
5078# fsusage.c assumes that statvfs has an f_frsize entry. Some weird
5079# systems use f_bsize.
5080AC_CACHE_CHECK([that statvfs.f_frsize works],samba_cv_frsize, [
5081 AC_TRY_COMPILE([#include <sys/types.h>
5082#include <sys/statvfs.h>],[struct statvfs buf; buf.f_frsize = 0],
5083 samba_cv_frsize=yes,samba_cv_frsize=no)])
5084if test x"$samba_cv_frsize" = x"yes"; then
5085 AC_DEFINE(HAVE_FRSIZE, 1, [Whether statvfs.f_frsize exists])
5086fi
5087
5088# Some systems use f_flag in struct statvfs while others use f_flags
5089AC_CACHE_CHECK([that statvfs.statvfs_f_flag works],samba_cv_statvfs_f_flag, [
5090 AC_TRY_COMPILE([#include <sys/types.h>
5091#include <sys/statvfs.h>],[struct statvfs buf; buf.f_flag = 0],
5092 samba_cv_statvfs_f_flag=yes,samba_cv_statvfs_f_flag=no)])
5093if test x"$samba_cv_statvfs_f_flag" = x"yes"; then
5094 AC_DEFINE(HAVE_STATVFS_F_FLAG, 1, [Whether statvfs.f_flag exists])
5095fi
5096
5097AC_CACHE_CHECK([that statvfs.statvfs_f_flags works],samba_cv_statvfs_f_flags, [
5098 AC_TRY_COMPILE([#include <sys/types.h>
5099#include <sys/statvfs.h>],[struct statvfs buf; buf.f_flags = 0],
5100 samba_cv_statvfs_f_flags=yes,samba_cv_statvfs_f_flags=no)])
5101if test x"$samba_cv_statvfs_f_flags" = x"yes"; then
5102 AC_DEFINE(HAVE_STATVFS_F_FLAGS, 1, [Whether statvfs.f_flags exists])
5103fi
5104
5105if test $space = no; then
5106 # DEC Alpha running OSF/1
5107 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
5108 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
5109 [AC_TRY_RUN([
5110#include <sys/param.h>
5111#include <sys/types.h>
5112#include <sys/mount.h>
5113 main ()
5114 {
5115 struct statfs fsd;
5116 fsd.f_fsize = 0;
5117 exit (statfs (".", &fsd, sizeof (struct statfs)));
5118 }],
5119 fu_cv_sys_stat_statfs3_osf1=yes,
5120 fu_cv_sys_stat_statfs3_osf1=no,
5121 fu_cv_sys_stat_statfs3_osf1=no)])
5122 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
5123 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
5124 space=yes
5125 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
5126 fi
5127fi
5128
5129if test $space = no; then
5130# AIX
5131 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
5132member (AIX, 4.3BSD)])
5133 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
5134 [AC_TRY_RUN([
5135#ifdef HAVE_SYS_PARAM_H
5136#include <sys/param.h>
5137#endif
5138#ifdef HAVE_SYS_MOUNT_H
5139#include <sys/mount.h>
5140#endif
5141#ifdef HAVE_SYS_VFS_H
5142#include <sys/vfs.h>
5143#endif
5144 main ()
5145 {
5146 struct statfs fsd;
5147 fsd.f_bsize = 0;
5148 exit (statfs (".", &fsd));
5149 }],
5150 fu_cv_sys_stat_statfs2_bsize=yes,
5151 fu_cv_sys_stat_statfs2_bsize=no,
5152 fu_cv_sys_stat_statfs2_bsize=no)])
5153 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
5154 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
5155 space=yes
5156 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
5157 fi
5158fi
5159
5160if test $space = no; then
5161# SVR3
5162 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
5163 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
5164 [AC_TRY_RUN([#include <sys/types.h>
5165#include <sys/statfs.h>
5166 main ()
5167 {
5168 struct statfs fsd;
5169 exit (statfs (".", &fsd, sizeof fsd, 0));
5170 }],
5171 fu_cv_sys_stat_statfs4=yes,
5172 fu_cv_sys_stat_statfs4=no,
5173 fu_cv_sys_stat_statfs4=no)])
5174 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
5175 if test $fu_cv_sys_stat_statfs4 = yes; then
5176 space=yes
5177 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
5178 fi
5179fi
5180
5181if test $space = no; then
5182# 4.4BSD and NetBSD
5183 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
5184member (4.4BSD and NetBSD)])
5185 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
5186 [AC_TRY_RUN([#include <sys/types.h>
5187#ifdef HAVE_SYS_PARAM_H
5188#include <sys/param.h>
5189#endif
5190#ifdef HAVE_SYS_MOUNT_H
5191#include <sys/mount.h>
5192#endif
5193 main ()
5194 {
5195 struct statfs fsd;
5196 fsd.f_fsize = 0;
5197 exit (statfs (".", &fsd));
5198 }],
5199 fu_cv_sys_stat_statfs2_fsize=yes,
5200 fu_cv_sys_stat_statfs2_fsize=no,
5201 fu_cv_sys_stat_statfs2_fsize=no)])
5202 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
5203 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
5204 space=yes
5205 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
5206 fi
5207fi
5208
5209if test $space = no; then
5210 # Ultrix
5211 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
5212 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
5213 [AC_TRY_RUN([#include <sys/types.h>
5214#ifdef HAVE_SYS_PARAM_H
5215#include <sys/param.h>
5216#endif
5217#ifdef HAVE_SYS_MOUNT_H
5218#include <sys/mount.h>
5219#endif
5220#ifdef HAVE_SYS_FS_TYPES_H
5221#include <sys/fs_types.h>
5222#endif
5223 main ()
5224 {
5225 struct fs_data fsd;
5226 /* Ultrix's statfs returns 1 for success,
5227 0 for not mounted, -1 for failure. */
5228 exit (statfs (".", &fsd) != 1);
5229 }],
5230 fu_cv_sys_stat_fs_data=yes,
5231 fu_cv_sys_stat_fs_data=no,
5232 fu_cv_sys_stat_fs_data=no)])
5233 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
5234 if test $fu_cv_sys_stat_fs_data = yes; then
5235 space=yes
5236 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
5237 fi
5238fi
5239
5240#
5241# As a gating factor for large file support, in order to
5242# use <4GB files we must have the following minimal support
5243# available.
5244# long long, and a 64 bit off_t or off64_t.
5245# If we don't have all of these then disable large
5246# file support.
5247#
5248AC_MSG_CHECKING([if large file support can be enabled])
5249AC_TRY_COMPILE([
5250#if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
5251#include <sys/types.h>
5252#else
5253__COMPILE_ERROR_
5254#endif
5255],
5256[int i],
5257samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
5258if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
5259 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT,1,[Whether large file support can be enabled])
5260fi
5261AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
5262
5263#################################################
5264# check for cluster extensions
5265
5266CTDB_CFLAGS=""
5267AC_SUBST(CTDB_CFLAGS)
5268AC_ARG_WITH(ctdb,
5269[AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
5270[ case "$withval" in
5271 yes|no)
5272 AC_MSG_WARN([--with-ctdb called without argument])
5273 ;;
5274 *)
5275 CTDB_CPPFLAGS="-I$withval/include"
5276 ;;
5277 esac])
5278
5279SAVED_CPPFLAGS="$CPPFLAGS"
5280CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS} $CTDB_CPPFLAGS"
5281ctdb_broken="missing or broken headers"
5282
5283AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
5284#include "confdefs.h"
5285#define NO_CONFIG_H
5286#include "replace.h"
5287#include "system/wait.h"
5288#include "system/network.h"
5289#define private #error __USED_RESERVED_WORD_private__
5290#include <talloc.h>
5291#include <tdb.h>
5292#include <ctdb.h>
5293])
5294
5295AC_HAVE_DECL(CTDB_CONTROL_TRANS3_COMMIT,[
5296#include "confdefs.h"
5297#define NO_CONFIG_H
5298#include "replace.h"
5299#include "system/wait.h"
5300#include "system/network.h"
5301#include <talloc.h>
5302#include <tdb.h>
5303#include <ctdb.h>
5304#include <ctdb_private.h>
5305])
5306if test x"$ac_cv_have_CTDB_CONTROL_TRANS3_COMMIT_decl" = x"yes"; then
5307 ctdb_broken=no
5308else
5309 ctdb_broken="ctdb transaction support missing or too old"
5310fi
5311
5312# in ctdb 1.0.57 ctdb_control_tcp was temparary renamed to ctdb_tcp_client
5313AC_CHECK_TYPE(struct ctdb_tcp_client,[
5314 AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
5315],,[
5316#include "confdefs.h"
5317#define NO_CONFIG_H
5318#include "replace.h"
5319#include "system/wait.h"
5320#include "system/network.h"
5321#include <talloc.h>
5322#include <tdb.h>
5323#include <ctdb.h>
5324#include <ctdb_private.h>
5325])
5326
5327AC_CHECK_TYPE(struct ctdb_control_tcp,[
5328 AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP],[1],[ctdb ipv4 support])
5329],[
5330 ctdb_broken="missing struct ctdb_control_tcp"
5331],[
5332#include "confdefs.h"
5333#define NO_CONFIG_H
5334#include "replace.h"
5335#include "system/wait.h"
5336#include "system/network.h"
5337#include <talloc.h>
5338#include <tdb.h>
5339#include <ctdb.h>
5340#include <ctdb_private.h>
5341])
5342
5343AC_CHECK_TYPE(struct ctdb_control_tcp_addr,[
5344 AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR],[1],[ctdb ipv6 support])
5345],,[
5346#include "confdefs.h"
5347#define NO_CONFIG_H
5348#include "replace.h"
5349#include "system/wait.h"
5350#include "system/network.h"
5351#include <talloc.h>
5352#include <tdb.h>
5353#include <ctdb.h>
5354#include <ctdb_private.h>
5355])
5356CPPFLAGS="$SAVED_CPPFLAGS"
5357
5358AC_MSG_CHECKING(cluster support)
5359AC_ARG_WITH(cluster-support,
5360[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=auto)])])
5361
5362if test x"$with_cluster_support" = x ; then
5363 with_cluster_support="auto"
5364fi
5365
5366if test x"$ac_cv_header_ctdb_private_h" != x"yes"; then
5367 if test "x$with_cluster_support" = "xyes"; then
5368 AC_MSG_ERROR("ctdb_private.h is required for cluster support")
5369 fi
5370 with_cluster_support=no
5371fi
5372
5373if test x"$ctdb_broken" != x"no"; then
5374 if test "x$with_cluster_support" = "xyes"; then
5375 AC_MSG_ERROR(["cluster support: $ctdb_broken"])
5376 fi
5377 with_cluster_support=no
5378fi
5379
5380if test "x$with_cluster_support" != "xno"; then
5381 AC_DEFINE(CLUSTER_SUPPORT,1,[Whether to enable cluster extensions])
5382 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${CTDB_CPPFLAGS}"
5383 AC_MSG_RESULT(yes)
5384else
5385 AC_MSG_RESULT(no)
5386fi
5387
5388#################################################
5389# check for ACL support
5390
5391AC_MSG_CHECKING(whether to support ACLs)
5392AC_ARG_WITH(acl-support,
5393[AS_HELP_STRING([--with-acl-support], [Include ACL support (default=auto)])],
5394[ case "$withval" in
5395 yes|no)
5396 with_acl_support="$withval"
5397 ;;
5398 esac ])
5399
5400if test x"$with_acl_support" = x ; then
5401 with_acl_support="auto"
5402fi
5403
5404AC_MSG_RESULT($with_acl_support)
5405
5406if test x"$with_acl_support" = x"no"; then
5407 AC_MSG_RESULT(Disabling ACL support)
5408 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
5409else
5410 AC_MSG_NOTICE(checking whether ACL support is available:)
5411 case "$host_os" in
5412 *sysv5*)
5413 AC_MSG_NOTICE(Using UnixWare ACLs)
5414 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
5415 default_static_modules="$default_static_modules vfs_solarisacl"
5416 ;;
5417 *solaris*)
5418 AC_MSG_NOTICE(Using solaris ACLs)
5419 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
5420 ACL_LIBS="$ACL_LIBS -lsec"
5421 default_static_modules="$default_static_modules vfs_solarisacl"
5422 ;;
5423 *hpux*)
5424 AC_MSG_NOTICE(Using HPUX ACLs)
5425 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
5426 default_static_modules="$default_static_modules vfs_hpuxacl"
5427 ;;
5428 *irix*)
5429 AC_MSG_NOTICE(Using IRIX ACLs)
5430 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
5431 default_static_modules="$default_static_modules vfs_irixacl"
5432 ;;
5433 *aix*)
5434 AC_MSG_NOTICE(Using AIX ACLs)
5435 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
5436 default_static_modules="$default_static_modules vfs_aixacl"
5437 ;;
5438 *osf*)
5439 AC_MSG_NOTICE(Using Tru64 ACLs)
5440 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
5441 ACL_LIBS="$ACL_LIBS -lpacl"
5442 default_static_modules="$default_static_modules vfs_tru64acl"
5443 ;;
5444 *darwin*)
5445 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
5446 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
5447 ;;
5448 *)
5449 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
5450 case "$host_os" in
5451 *linux*)
5452 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
5453 ;;
5454 esac
5455 AC_CACHE_CHECK([for POSIX ACL support],samba_cv_HAVE_POSIX_ACLS,[
5456 acl_LIBS=$LIBS
5457 LIBS="$LIBS $ACL_LIBS"
5458 AC_TRY_LINK([
5459 #include <sys/types.h>
5460 #include <sys/acl.h>
5461 ],[
5462 acl_t acl;
5463 int entry_id;
5464 acl_entry_t *entry_p;
5465 return acl_get_entry(acl, entry_id, entry_p);
5466 ],
5467 [samba_cv_HAVE_POSIX_ACLS=yes],
5468 [samba_cv_HAVE_POSIX_ACLS=no])
5469 LIBS=$acl_LIBS
5470 ])
5471 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
5472 AC_MSG_NOTICE(Using posix ACLs)
5473 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
5474 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
5475 acl_LIBS=$LIBS
5476 LIBS="$LIBS $ACL_LIBS"
5477 AC_TRY_LINK([
5478 #include <sys/types.h>
5479 #include <sys/acl.h>
5480 ],[
5481 acl_permset_t permset_d;
5482 acl_perm_t perm;
5483 return acl_get_perm_np(permset_d, perm);
5484 ],
5485 [samba_cv_HAVE_ACL_GET_PERM_NP=yes],
5486 [samba_cv_HAVE_ACL_GET_PERM_NP=no])
5487 LIBS=$acl_LIBS
5488 ])
5489 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
5490 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
5491 fi
5492 default_static_modules="$default_static_modules vfs_posixacl"
5493 else
5494 AC_MSG_NOTICE(ACL support is not avaliable)
5495 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
5496 fi
5497 ;;
5498 esac
5499fi # with_acl_support
5500
5501
5502
5503#################################################
5504# check for AIO support
5505
5506AC_MSG_CHECKING(whether to support asynchronous io)
5507AC_ARG_WITH(aio-support,
5508[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=no)])],
5509[ case "$withval" in
5510 yes)
5511
5512 AC_MSG_RESULT(yes)
5513 case "$host_os" in
5514 *)
5515 AIO_LIBS=$LIBS
5516 AC_CHECK_LIB(rt,aio_read,[AIO_LIBS="$LIBS -lrt"])
5517 AC_CHECK_LIB(aio,aio_read,[AIO_LIBS="$LIBS -laio"])
5518 AC_CACHE_CHECK([for asynchronous io support],samba_cv_HAVE_AIO,[
5519 aio_LIBS=$LIBS
5520 LIBS=$AIO_LIBS
5521 AC_TRY_LINK([#include <sys/types.h>
5522#include <aio.h>],
5523[ struct aiocb a; return aio_read(&a);],
5524samba_cv_HAVE_AIO=yes,samba_cv_HAVE_AIO=no)
5525 LIBS=$aio_LIBS])
5526 AC_CACHE_CHECK([for 64-bit asynchronous io support],samba_cv_HAVE_AIO64,[
5527 aio_LIBS=$LIBS
5528 LIBS=$AIO_LIBS
5529 AC_TRY_LINK([#include <sys/types.h>
5530#include <aio.h>],
5531[ struct aiocb64 a; return aio_read64(&a);],
5532samba_cv_HAVE_AIO64=yes,samba_cv_HAVE_AIO64=no)
5533 LIBS=$aio_LIBS])
5534 if test x"$samba_cv_HAVE_AIO64" = x"yes"; then
5535 AC_DEFINE(HAVE_AIOCB64,1,[Whether 64 bit aio is available])
5536 AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
5537 LIBS=$AIO_LIBS
5538 elif test x"$samba_cv_HAVE_AIO" = x"yes"; then
5539 AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
5540 LIBS=$AIO_LIBS
5541 fi
5542
5543 if test x"$samba_cv_HAVE_AIO" = x"yes"; then
5544 AC_MSG_CHECKING(for aio_read)
5545 AC_LINK_IFELSE([#include <aio.h>
5546int main() { struct aiocb a; return aio_read(&a); }],
5547[AC_DEFINE(HAVE_AIO_READ, 1, [Have aio_read]) AC_MSG_RESULT(yes)],
5548[AC_MSG_RESULT(no)])
5549
5550 AC_MSG_CHECKING(for aio_write)
5551 AC_LINK_IFELSE([#include <aio.h>
5552int main() { struct aiocb a; return aio_write(&a); }],
5553[AC_DEFINE(HAVE_AIO_WRITE, 1, [Have aio_write]) AC_MSG_RESULT(yes)],
5554[AC_MSG_RESULT(no)])
5555
5556 AC_MSG_CHECKING(for aio_fsync)
5557 AC_LINK_IFELSE([#include <aio.h>
5558int main() { struct aiocb a; return aio_fsync(1, &a); }],
5559[AC_DEFINE(HAVE_AIO_FSYNC, 1, [Have aio_fsync]) AC_MSG_RESULT(yes)],
5560[AC_MSG_RESULT(no)])
5561
5562 AC_MSG_CHECKING(for aio_return)
5563 AC_LINK_IFELSE([#include <aio.h>
5564int main() { struct aiocb a; return aio_return(&a); }],
5565[AC_DEFINE(HAVE_AIO_RETURN, 1, [Have aio_return]) AC_MSG_RESULT(yes)],
5566[AC_MSG_RESULT(no)])
5567
5568 AC_MSG_CHECKING(for aio_error)
5569 AC_LINK_IFELSE([#include <aio.h>
5570int main() { struct aiocb a; return aio_error(&a); }],
5571[AC_DEFINE(HAVE_AIO_ERROR, 1, [Have aio_error]) AC_MSG_RESULT(yes)],
5572[AC_MSG_RESULT(no)])
5573
5574 AC_MSG_CHECKING(for aio_cancel)
5575 AC_LINK_IFELSE([#include <aio.h>
5576int main() { struct aiocb a; return aio_cancel(1, &a); }],
5577[AC_DEFINE(HAVE_AIO_CANCEL, 1, [Have aio_cancel]) AC_MSG_RESULT(yes)],
5578[AC_MSG_RESULT(no)])
5579
5580 AC_MSG_CHECKING(for aio_suspend)
5581 AC_LINK_IFELSE([#include <aio.h>
5582int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
5583[AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
5584[AC_MSG_RESULT(no)])
5585 fi
5586
5587 if test x"$samba_cv_HAVE_AIO64" = x"yes"; then
5588 AC_MSG_CHECKING(for aio_read64)
5589 AC_LINK_IFELSE([#include <aio.h>
5590int main() { struct aiocb a; return aio_read64(&a); }],
5591[AC_DEFINE(HAVE_AIO_READ64, 1, [Have aio_read64]) AC_MSG_RESULT(yes)],
5592[AC_MSG_RESULT(no)])
5593
5594 AC_MSG_CHECKING(for aio_write64)
5595 AC_LINK_IFELSE([#include <aio.h>
5596int main() { struct aiocb a; return aio_write64(&a); }],
5597[AC_DEFINE(HAVE_AIO_WRITE64, 1, [Have aio_write64]) AC_MSG_RESULT(yes)],
5598[AC_MSG_RESULT(no)])
5599
5600 AC_MSG_CHECKING(for aio_fsync64)
5601 AC_LINK_IFELSE([#include <aio.h>
5602int main() { struct aiocb a; return aio_fsync64(1, &a); }],
5603[AC_DEFINE(HAVE_AIO_FSYNC64, 1, [Have aio_fsync64]) AC_MSG_RESULT(yes)],
5604[AC_MSG_RESULT(no)])
5605
5606 AC_MSG_CHECKING(for aio_return64)
5607 AC_LINK_IFELSE([#include <aio.h>
5608int main() { struct aiocb a; return aio_return64(&a); }],
5609[AC_DEFINE(HAVE_AIO_RETURN64, 1, [Have aio_return64]) AC_MSG_RESULT(yes)],
5610[AC_MSG_RESULT(no)])
5611
5612 AC_MSG_CHECKING(for aio_error64)
5613 AC_LINK_IFELSE([#include <aio.h>
5614int main() { struct aiocb a; return aio_error64(&a); }],
5615[AC_DEFINE(HAVE_AIO_ERROR64, 1, [Have aio_error64]) AC_MSG_RESULT(yes)],
5616[AC_MSG_RESULT(no)])
5617
5618 AC_MSG_CHECKING(for aio_cancel64)
5619 AC_LINK_IFELSE([#include <aio.h>
5620int main() { struct aiocb a; return aio_cancel64(1, &a); }],
5621[AC_DEFINE(HAVE_AIO_CANCEL64, 1, [Have aio_cancel64]) AC_MSG_RESULT(yes)],
5622[AC_MSG_RESULT(no)])
5623
5624 AC_MSG_CHECKING(for aio_suspend64)
5625 AC_LINK_IFELSE([#include <aio.h>
5626int main() { struct aiocb a; return aio_suspend64(&a, 1, NULL); }],
5627[AC_DEFINE(HAVE_AIO_SUSPEND64, 1, [Have aio_suspend64]) AC_MSG_RESULT(yes)],
5628[AC_MSG_RESULT(no)])
5629 fi
5630 ;;
5631 esac
5632 ;;
5633 *)
5634 AC_MSG_RESULT(no)
5635 AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
5636 ;;
5637 esac ],
5638 AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
5639 AC_MSG_RESULT(no)
5640)
5641
5642if test x"$samba_cv_HAVE_AIO" = x"yes"; then
5643 if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \
5644 x"$samba_cv_msghdr_msg_acctright" = x"yes"; then
5645 default_shared_modules="$default_shared_modules vfs_aio_fork"
5646 fi
5647fi
5648
5649#################################################
5650# check for sendfile support
5651
5652with_sendfile_support=yes
5653AC_MSG_CHECKING(whether to check to support sendfile)
5654AC_ARG_WITH(sendfile-support,
5655[AS_HELP_STRING([--with-sendfile-support], [Check for sendfile support (default=yes)])],
5656[ case "$withval" in
5657 yes)
5658
5659 AC_MSG_RESULT(yes);
5660
5661 case "$host_os" in
5662 *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
5663 AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
5664 AC_TRY_LINK([#include <sys/sendfile.h>],
5665[\
5666int tofd, fromfd;
5667off64_t offset;
5668size_t total;
5669ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
5670],
5671samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
5672
5673 AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[
5674 AC_TRY_LINK([#include <sys/sendfile.h>],
5675[\
5676int tofd, fromfd;
5677off_t offset;
5678size_t total;
5679ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
5680],
5681samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5682
5683# Try and cope with broken Linux sendfile....
5684 AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
5685 AC_TRY_LINK([\
5686#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
5687#undef _FILE_OFFSET_BITS
5688#endif
5689#include <sys/sendfile.h>],
5690[\
5691int tofd, fromfd;
5692off_t offset;
5693size_t total;
5694ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
5695],
5696samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
5697
5698 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
5699 AC_DEFINE(HAVE_SENDFILE64,1,[Whether 64-bit sendfile() is available])
5700 AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
5701 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
5702 elif test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5703 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
5704 AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
5705 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
5706 elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
5707 AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken])
5708 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used])
5709 else
5710 AC_MSG_RESULT(no);
5711 fi
5712
5713 ;;
5714 *freebsd* | *dragonfly* )
5715 AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
5716 AC_TRY_LINK([\
5717#include <sys/types.h>
5718#include <unistd.h>
5719#include <sys/socket.h>
5720#include <sys/uio.h>],
5721[\
5722 int fromfd, tofd, ret, total=0;
5723 off_t offset, nwritten;
5724 struct sf_hdtr hdr;
5725 struct iovec hdtrl;
5726 hdr.headers = &hdtrl;
5727 hdr.hdr_cnt = 1;
5728 hdr.trailers = NULL;
5729 hdr.trl_cnt = 0;
5730 hdtrl.iov_base = NULL;
5731 hdtrl.iov_len = 0;
5732 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
5733],
5734samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5735
5736 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5737 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available])
5738 AC_DEFINE(FREEBSD_SENDFILE_API,1,[Whether the FreeBSD sendfile() API is available])
5739 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
5740 else
5741 AC_MSG_RESULT(no);
5742 fi
5743 ;;
5744
5745 *hpux*)
5746 AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
5747 AC_TRY_LINK([\
5748#include <sys/socket.h>
5749#include <sys/uio.h>],
5750[\
5751 int fromfd, tofd;
5752 size_t total=0;
5753 struct iovec hdtrl[2];
5754 ssize_t nwritten;
5755 off64_t offset;
5756
5757 hdtrl[0].iov_base = 0;
5758 hdtrl[0].iov_len = 0;
5759
5760 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
5761],
5762samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
5763 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
5764 AC_DEFINE(HAVE_SENDFILE64,1,[Whether sendfile64() is available])
5765 AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
5766 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
5767 else
5768 AC_MSG_RESULT(no);
5769 fi
5770
5771 AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[
5772 AC_TRY_LINK([\
5773#include <sys/socket.h>
5774#include <sys/uio.h>],
5775[\
5776 int fromfd, tofd;
5777 size_t total=0;
5778 struct iovec hdtrl[2];
5779 ssize_t nwritten;
5780 off_t offset;
5781
5782 hdtrl[0].iov_base = 0;
5783 hdtrl[0].iov_len = 0;
5784
5785 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
5786],
5787samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5788 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5789 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
5790 AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
5791 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
5792 else
5793 AC_MSG_RESULT(no);
5794 fi
5795 ;;
5796
5797 *solaris*)
5798 AC_CHECK_LIB(sendfile,sendfilev)
5799 AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[
5800 AC_TRY_LINK([\
5801#include <sys/sendfile.h>],
5802[\
5803 int sfvcnt;
5804 size_t xferred;
5805 struct sendfilevec vec[2];
5806 ssize_t nwritten;
5807 int tofd;
5808
5809 sfvcnt = 2;
5810
5811 vec[0].sfv_fd = SFV_FD_SELF;
5812 vec[0].sfv_flag = 0;
5813 vec[0].sfv_off = 0;
5814 vec[0].sfv_len = 0;
5815
5816 vec[1].sfv_fd = 0;
5817 vec[1].sfv_flag = 0;
5818 vec[1].sfv_off = 0;
5819 vec[1].sfv_len = 0;
5820 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
5821],
5822samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
5823
5824 if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then
5825 AC_DEFINE(HAVE_SENDFILEV64,1,[Whether sendfilev64() is available])
5826 AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the soloris sendfile() API is available])
5827 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
5828 else
5829 AC_MSG_RESULT(no);
5830 fi
5831
5832 AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[
5833 AC_TRY_LINK([\
5834#include <sys/sendfile.h>],
5835[\
5836 int sfvcnt;
5837 size_t xferred;
5838 struct sendfilevec vec[2];
5839 ssize_t nwritten;
5840 int tofd;
5841
5842 sfvcnt = 2;
5843
5844 vec[0].sfv_fd = SFV_FD_SELF;
5845 vec[0].sfv_flag = 0;
5846 vec[0].sfv_off = 0;
5847 vec[0].sfv_len = 0;
5848
5849 vec[1].sfv_fd = 0;
5850 vec[1].sfv_flag = 0;
5851 vec[1].sfv_off = 0;
5852 vec[1].sfv_len = 0;
5853 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
5854],
5855samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
5856
5857 if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then
5858 AC_DEFINE(HAVE_SENDFILEV,1,[Whether sendfilev() is available])
5859 AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the solaris sendfile() API is available])
5860 AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support])
5861 else
5862 AC_MSG_RESULT(no);
5863 fi
5864 ;;
5865 *aix*)
5866 AC_CACHE_CHECK([for AIX send_file support],samba_cv_HAVE_SENDFILE,[
5867 AC_TRY_LINK([\
5868#include <sys/socket.h>],
5869[\
5870 int fromfd, tofd;
5871 size_t total=0;
5872 struct sf_parms hdtrl;
5873 ssize_t nwritten;
5874 off64_t offset;
5875
5876 hdtrl.header_data = 0;
5877 hdtrl.header_length = 0;
5878 hdtrl.file_descriptor = fromfd;
5879 hdtrl.file_offset = 0;
5880 hdtrl.file_bytes = 0;
5881 hdtrl.trailer_data = 0;
5882 hdtrl.trailer_length = 0;
5883
5884 nwritten = send_file(&tofd, &hdtrl, 0);
5885],
5886samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5887 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5888 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
5889 AC_DEFINE(AIX_SENDFILE_API,1,[Whether the AIX send_file() API is available])
5890 AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support])
5891 else
5892 AC_MSG_RESULT(no);
5893 fi
5894 ;;
5895 *)
5896 ;;
5897 esac
5898 ;;
5899 *)
5900 AC_MSG_RESULT(no)
5901 ;;
5902 esac ],
5903 AC_MSG_RESULT(yes)
5904)
5905
5906############################################
5907# See if we have the Linux readahead syscall.
5908
5909AC_CACHE_CHECK([for Linux readahead],
5910 samba_cv_HAVE_LINUX_READAHEAD,[
5911 AC_TRY_LINK([
5912#if defined(HAVE_UNISTD_H)
5913#include <unistd.h>
5914#endif
5915#include <fcntl.h>],
5916 [ssize_t err = readahead(0,0,0x80000);],
5917 samba_cv_HAVE_LINUX_READAHEAD=yes,
5918 samba_cv_HAVE_LINUX_READAHEAD=no)])
5919
5920if test x"$samba_cv_HAVE_LINUX_READAHEAD" = x"yes"; then
5921 AC_DEFINE(HAVE_LINUX_READAHEAD,1,
5922 [Whether Linux readahead is available])
5923fi
5924
5925AC_HAVE_DECL(readahead, [#include <fcntl.h>])
5926
5927############################################
5928# See if we have the posix_fadvise syscall.
5929
5930AC_CACHE_CHECK([for posix_fadvise],
5931 samba_cv_HAVE_POSIX_FADVISE,[
5932 AC_TRY_LINK([
5933#if defined(HAVE_UNISTD_H)
5934#include <unistd.h>
5935#endif
5936#include <fcntl.h>],
5937 [ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);],
5938 samba_cv_HAVE_POSIX_FADVISE=yes,
5939 samba_cv_HAVE_POSIX_FADVISE=no)])
5940
5941if test x"$samba_cv_HAVE_POSIX_FADVISE" = x"yes"; then
5942 AC_DEFINE(HAVE_POSIX_FADVISE,1,
5943 [Whether posix_fadvise is available])
5944fi
5945
5946############################################
5947# See if we have the Linux splice syscall.
5948
5949case "$host_os" in
5950*linux*)
5951AC_CACHE_CHECK([for Linux splice],
5952 samba_cv_HAVE_LINUX_SPLICE,[
5953 AC_TRY_LINK([
5954#if defined(HAVE_UNISTD_H)
5955#include <unistd.h>
5956#endif
5957#include <fcntl.h>],
5958 [long ret = splice(0,0,1,0,400,0);],
5959 samba_cv_HAVE_LINUX_SPLICE=yes,
5960 samba_cv_HAVE_LINUX_SPLICE=no)])
5961;;
5962*)
5963samba_cv_HAVE_LINUX_SPLICE=no
5964;;
5965esac
5966
5967if test x"$samba_cv_HAVE_LINUX_SPLICE" = x"yes"; then
5968 AC_DEFINE(HAVE_LINUX_SPLICE,1,
5969 [Whether Linux splice is available])
5970fi
5971
5972AC_HAVE_DECL(splice, [#include <fcntl.h>])
5973
5974############################################
5975# See if we have the a broken readlink syscall.
5976
5977AC_CACHE_CHECK([for a broken readlink syscall],samba_cv_HAVE_BROKEN_READLINK,[
5978AC_TRY_RUN([#include "${srcdir-.}/../tests/readlink.c"],
5979 samba_cv_HAVE_BROKEN_READLINK=no,samba_cv_HAVE_BROKEN_READLINK=yes,samba_cv_HAVE_BROKEN_READLINK=cross)
5980])
5981if test x"$samba_cv_HAVE_BROKEN_READLINK" = x"yes"; then
5982 AC_DEFINE(HAVE_BROKEN_READLINK,1,[Whether the readlink syscall is broken])
5983fi
5984
5985#################################################
5986# Check whether winbind is supported on this platform. If so we need to
5987# build and install client programs, sbin programs and shared libraries
5988
5989AC_MSG_CHECKING(whether to build winbind)
5990
5991# Initially, the value of $host_os decides whether winbind is supported
5992
5993HAVE_WINBIND=yes
5994HAVE_WBCLIENT=no
5995
5996# Define external wbclient library to link against. This disables winbind.
5997# We define this here so --with-winbind can override it.
5998AC_ARG_WITH(wbclient,
5999[AS_HELP_STRING([--with-wbclient], [Use external wbclient (optional)])],
6000[
6001 case "$withval" in
6002 no)
6003 HAVE_WBCLIENT=no
6004 ;;
6005 yes)
6006 HAVE_WBCLIENT=yes
6007 HAVE_WINBIND=no
6008 ;;
6009 *)
6010 HAVE_WBCLIENT=yes
6011 HAVE_WINBIND=no
6012 WBCLIENT_INCLUDES="-I$withval/include"
6013 WBCLIENT_LDFLAGS="-L$withval/lib"
6014 ;;
6015 esac ],
6016)
6017
6018AC_SUBST(WBCLIENT_INCLUDES)
6019AC_SUBST(WBCLIENT_LDFLAGS)
6020AC_SUBST(WBCLIENT_LIBS)
6021
6022
6023# Define the winbind shared library name and any specific linker flags
6024# it needs to be built with.
6025
6026WINBIND_NSS="../nsswitch/libnss_winbind.$SHLIBEXT"
6027WINBIND_WINS_NSS="../nsswitch/libnss_wins.$SHLIBEXT"
6028WINBIND_NSS_LDSHFLAGS=$LDSHFLAGS
6029NSSSONAMEVERSIONSUFFIX=""
6030
6031case "$host_os" in
6032 *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *os2*)
6033 NSSSONAMEVERSIONSUFFIX=".2"
6034 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_linux.o"
6035 ;;
6036 *freebsd[[5-9]]*)
6037 # FreeBSD winbind client is implemented as a wrapper around
6038 # the Linux version.
6039 NSSSONAMEVERSIONSUFFIX=".1"
6040 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_freebsd.o \
6041 ../nsswitch/winbind_nss_linux.o"
6042 WINBIND_NSS="../nsswitch/nss_winbind.$SHLIBEXT"
6043 WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT"
6044 ;;
6045
6046 *netbsd*[[3-9]]*)
6047 # NetBSD winbind client is implemented as a wrapper
6048 # around the Linux version. It needs getpwent_r() to
6049 # indicate libc's use of the correct nsdispatch API.
6050 #
6051 if test x"$ac_cv_func_getpwent_r" = x"yes"; then
6052 WINBIND_NSS_EXTRA_OBJS="\
6053 ../nsswitch/winbind_nss_netbsd.o \
6054 ../nsswitch/winbind_nss_linux.o"
6055 WINBIND_NSS="../nsswitch/nss_winbind.$SHLIBEXT"
6056 WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT"
6057 else
6058 HAVE_WINBIND=no
6059 winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
6060 fi
6061 ;;
6062 *irix*)
6063 # IRIX has differently named shared libraries
6064 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_irix.o"
6065 WINBIND_NSS="../nsswitch/libns_winbind.$SHLIBEXT"
6066 WINBIND_WINS_NSS="../nsswitch/libns_wins.$SHLIBEXT"
6067 ;;
6068 *solaris*)
6069 # Solaris winbind client is implemented as a wrapper around
6070 # the Linux version.
6071 NSSSONAMEVERSIONSUFFIX=".1"
6072 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_solaris.o \
6073 ../nsswitch/winbind_nss_linux.o"
6074 ;;
6075 *hpux11*)
6076 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_solaris.o"
6077 ;;
6078 *aix*)
6079 # AIX has even differently named shared libraries. No
6080 # WINS support has been implemented yet.
6081 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_aix.o"
6082 WINBIND_NSS_LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-ewb_aix_init"
6083 WINBIND_NSS="../nsswitch/WINBIND"
6084 WINBIND_WINS_NSS=""
6085 ;;
6086 *)
6087 HAVE_WINBIND=no
6088 winbind_no_reason=", unsupported on $host_os"
6089 ;;
6090esac
6091
6092# Check the setting of --with-winbind
6093
6094AC_ARG_WITH(winbind,
6095[AS_HELP_STRING([--with-winbind], [Build winbind (default, if supported by OS)])],
6096[
6097 case "$withval" in
6098 yes)
6099 HAVE_WINBIND=yes
6100 HAVE_WBCLIENT=no
6101 ;;
6102 no)
6103 HAVE_WINBIND=no
6104 winbind_reason=""
6105 ;;
6106 esac ],
6107)
6108
6109# We need unix domain sockets for winbind
6110
6111if test x"$HAVE_WINBIND" = x"yes"; then
6112 if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"no"; then
6113 winbind_no_reason=", no unix domain socket support on $host_os"
6114 HAVE_WINBIND=no
6115 fi
6116fi
6117
6118# Display test results
6119
6120if test x"$HAVE_WINBIND" = x"no"; then
6121 WINBIND_NSS=""
6122 WINBIND_WINS_NSS=""
6123fi
6124if test x"$HAVE_WBCLIENT" = x"yes"; then
6125 AC_CHECK_LIB(wbclient, wbcInterfaceDetails,
6126 [LIBWBCLIENT_LIBS="-lwbclient"], AC_MSG_ERROR([Could not find wbclient]), [$WBCLIENT_LDFLAGS])
6127 LIBWBCLIENT_LIBS="$LIBWBCLIENT_LIBS $WBCLIENT_LDFLAGS"
6128 AC_MSG_RESULT(yes)
6129 AC_DEFINE(WITH_WINBIND,1,[Whether to link to wbclient])
6130 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
6131else
6132 if test x"$enable_developer" = x"yes" -a x"$LINK_LIBWBCLIENT" = x"STATIC" ; then
6133 BUILD_LIBWBCLIENT_SHARED=no
6134 else
6135 BUILD_LIBWBCLIENT_SHARED=yes
6136 fi
6137
6138 LIBWBCLIENT_SHARED_TARGET=bin/libwbclient.$SHLIBEXT
6139 LIBWBCLIENT_STATIC_TARGET=bin/libwbclient.a
6140 LIBWBCLIENT_SOVER=0
6141 if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes" -a x"$BUILD_LIBWBCLIENT_SHARED" = x"yes"; then
6142 NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}"
6143 ## Only worry about libwbclient if we have shared
6144 # library support
6145 LIBWBCLIENT_SHARED=$LIBWBCLIENT_SHARED_TARGET
6146 LIBWBCLIENT=libwbclient
6147 INSTALL_LIBWBCLIENT=installlibwbclient
6148 UNINSTALL_LIBWBCLIENT=uninstalllibwbclient
6149 LIBWBCLIENT_LIBS="-lwbclient"
6150 else
6151 LIBWBCLIENT_STATIC=$LIBWBCLIENT_STATIC_TARGET
6152 LIBWBCLIENT_LIBS=$LIBWBCLIENT_STATIC_TARGET
6153 fi
6154fi
6155
6156if test x"$HAVE_WINBIND" = x"yes"; then
6157 AC_MSG_RESULT(yes)
6158 AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
6159
6160 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
6161 EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/winbindd\$(EXEEXT)"
6162 if test $BLDSHARED = true -a x"$create_pam_modules" = x"yes"; then
6163 PAM_MODULES="$PAM_MODULES pam_winbind"
6164 INSTALL_PAM_MODULES="installpammodules"
6165 UNINSTALL_PAM_MODULES="uninstallpammodules"
6166 fi
6167else
6168 AC_MSG_RESULT(no$winbind_no_reason)
6169fi
6170
6171AC_SUBST(WINBIND_NSS)
6172AC_SUBST(WINBIND_WINS_NSS)
6173AC_SUBST(WINBIND_NSS_LDSHFLAGS)
6174AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
6175AC_SUBST(NSSSONAMEVERSIONSUFFIX)
6176
6177AC_SUBST(WINBIND_KRB5_LOCATOR)
6178
6179# Solaris 10 does have new member in nss_XbyY_key
6180AC_CHECK_MEMBER(union nss_XbyY_key.ipnode.af_family,
6181 AC_DEFINE(HAVE_NSS_XBYY_KEY_IPNODE, 1, [Defined if union nss_XbyY_key has ipnode field]),,
6182 [#include <nss_dbdefs.h>])
6183
6184# Solaris has some extra fields in struct passwd that need to be
6185# initialised otherwise nscd crashes.
6186
6187AC_CHECK_MEMBER(struct passwd.pw_comment,
6188 AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),,
6189 [#include <pwd.h>])
6190
6191AC_CHECK_MEMBER(struct passwd.pw_age,
6192 AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),,
6193 [#include <pwd.h>])
6194
6195# AIX 4.3.x and 5.1 do not have as many members in
6196# struct secmethod_table as AIX 5.2
6197AC_CHECK_MEMBERS([struct secmethod_table.method_attrlist], , ,
6198 [#include <usersec.h>])
6199AC_CHECK_MEMBERS([struct secmethod_table.method_version], , ,
6200 [#include <usersec.h>])
6201
6202AC_CACHE_CHECK([for SO_PEERCRED],samba_cv_HAVE_PEERCRED,[
6203AC_TRY_COMPILE([#include <sys/types.h>
6204#include <sys/socket.h>],
6205[struct ucred cred;
6206 socklen_t cred_len;
6207 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);
6208],
6209samba_cv_HAVE_PEERCRED=yes,samba_cv_HAVE_PEERCRED=no,samba_cv_HAVE_PEERCRED=cross)])
6210if test x"$samba_cv_HAVE_PEERCRED" = x"yes"; then
6211 AC_DEFINE(HAVE_PEERCRED,1,[Whether we can use SO_PEERCRED to get socket credentials])
6212fi
6213
6214
6215#################################################
6216# Check to see if we should use the included popt
6217
6218AC_ARG_WITH(included-popt,
6219[AS_HELP_STRING([--with-included-popt], [use bundled popt library, not from system])],
6220[
6221 case "$withval" in
6222 yes)
6223 INCLUDED_POPT=yes
6224 ;;
6225 no)
6226 INCLUDED_POPT=no
6227 ;;
6228 esac ],
6229)
6230if test x"$INCLUDED_POPT" != x"yes"; then
6231 AC_CHECK_LIB(popt, poptGetContext,
6232 INCLUDED_POPT=no, INCLUDED_POPT=yes)
6233fi
6234
6235AC_MSG_CHECKING(whether to use included popt)
6236if test x"$INCLUDED_POPT" = x"yes"; then
6237 AC_MSG_RESULT(yes)
6238 BUILD_POPT='$(POPT_OBJ)'
6239 POPTLIBS='$(POPT_OBJ)'
6240 FLAGS1="-I\$(srcdir)/../lib/popt"
6241else
6242 AC_MSG_RESULT(no)
6243 BUILD_POPT=""
6244 POPTLIBS="-lpopt"
6245fi
6246AC_SUBST(BUILD_POPT)
6247AC_SUBST(POPTLIBS)
6248AC_SUBST(FLAGS1)
6249
6250#################################################
6251# Check if user wants DNS service discovery support
6252
6253AC_ARG_ENABLE(dnssd,
6254[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=no)])])
6255
6256AC_SUBST(DNSSD_LIBS)
6257if test x"$enable_dnssd" = x"yes"; then
6258 have_dnssd_support=yes
6259
6260 AC_CHECK_HEADERS(dns_sd.h)
6261 if test x"$ac_cv_header_dns_sd_h" != x"yes"; then
6262 have_dnssd_support=no
6263 fi
6264
6265 # On Darwin the DNSSD API is in libc, but on other platforms it's
6266 # probably in -ldns_sd
6267 AC_CHECK_FUNCS(DNSServiceRegister)
6268 AC_CHECK_LIB_EXT(dns_sd, DNSSD_LIBS, DNSServiceRegister)
6269 if test x"$ac_cv_func_DNSServiceRegister" != x"yes" -a \
6270 x"$ac_cv_lib_ext_dns_sd_DNSServiceRegister" != x"yes"; then
6271 have_dnssd_support=no
6272 fi
6273
6274 if test x"$have_dnssd_support" = x"yes"; then
6275 AC_DEFINE(WITH_DNSSD_SUPPORT, 1,
6276 [Whether to enable DNS service discovery support])
6277 else
6278 if test x"$enable_dnssd" = x"yes"; then
6279 AC_MSG_ERROR(DNS service discovery support not available)
6280 fi
6281 fi
6282
6283fi
6284
6285#################################################
6286# Check if user wants avahi support
6287
6288AC_ARG_ENABLE(avahi,
6289[AS_HELP_STRING([--enable-avahi], [Enable Avahi support (default=auto)])])
6290
6291if test x"$enable_avahi" != x"no"; then
6292 have_avahi_support=yes
6293
6294 AC_CHECK_HEADERS(avahi-common/watch.h)
6295 if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
6296 have_avahi_support=no
6297 fi
6298
6299 AC_CHECK_HEADERS(avahi-client/client.h)
6300 if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
6301 have_avahi_support=no
6302 fi
6303
6304 save_LIBS="$LIBS"
6305 AC_CHECK_LIB(avahi-client, avahi_client_new,[have_avahi_client_new=yes])
6306 AC_CHECK_LIB(avahi-common, avahi_strerror,[have_avahi_strerror=yes])
6307 LIBS="$save_LIBS"
6308
6309 if test x"$have_avahi_client_new" != x"yes" -o \
6310 x"$have_avahi_strerror" != x"yes" ; then
6311 have_avahi_support=no
6312 fi
6313
6314 if test x"$have_avahi_support" = x"yes"; then
6315 AC_SUBST(AVAHI_LIBS, "-lavahi-client -lavahi-common")
6316 AC_DEFINE(WITH_AVAHI_SUPPORT, 1,
6317 [Whether to enable avahi support])
6318 AC_SUBST(AVAHI_OBJ, "lib/avahi.o smbd/avahi_register.o")
6319 else
6320 if test x"$enable_avahi" = x"yes"; then
6321 AC_MSG_ERROR(avahi support not available)
6322 fi
6323 fi
6324fi
6325
6326
6327#################################################
6328# Set pthread stuff
6329
6330PTHREAD_CFLAGS=error
6331PTHREAD_LDFLAGS=error
6332
6333# If it's error, then the user didn't
6334# define it.
6335if test "x$PTHREAD_LDFLAGS" = xerror; then
6336 AC_CHECK_LIB(pthread, pthread_attr_init, [
6337 PTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
6338 PTHREAD_LDFLAGS="-lpthread" ])
6339fi
6340
6341if test "x$PTHREAD_LDFLAGS" = xerror; then
6342 AC_CHECK_LIB(pthreads, pthread_attr_init, [
6343 PTHREAD_CFLAGS="-D_THREAD_SAFE"
6344 PTHREAD_LDFLAGS="-lpthreads" ])
6345fi
6346
6347if test "x$PTHREAD_LDFLAGS" = xerror; then
6348 AC_CHECK_LIB(c_r, pthread_attr_init, [
6349 PTHREAD_CFLAGS="-D_THREAD_SAFE -pthread"
6350 PTHREAD_LDFLAGS="-pthread" ])
6351fi
6352
6353if test "x$PTHREAD_LDFLAGS" = xerror; then
6354 AC_CHECK_FUNC(pthread_attr_init, [
6355 PTHREAD_CFLAGS="-D_REENTRANT"
6356 PTHREAD_LDFLAGS="-lpthread" ])
6357fi
6358
6359# especially for HP-UX, where the AC_CHECK_FUNC macro fails to test for
6360# pthread_attr_init. On pthread_mutex_lock it works there...
6361if test "x$PTHREAD_LDFLAGS" = xerror; then
6362 AC_CHECK_LIB(pthread, pthread_mutex_lock, [
6363 PTHREAD_CFLAGS="-D_REENTRANT"
6364 PTHREAD_LDFLAGS="-lpthread" ])
6365fi
6366
6367AC_SUBST(PTHREAD_CFLAGS)
6368AC_SUBST(PTHREAD_LDFLAGS)
6369
6370samba_cv_HAVE_PTHREAD=no
6371if test x"$PTHREAD_CFLAGS" != xerror -a x"$PTHREAD_LDFLAGS" != xerror; then
6372 samba_cv_HAVE_PTHREAD=yes
6373 # now check for pthread.h with pthread-correct CFLAGS and LDFLAGS:
6374 ac_save_CFLAGS=$CFLAGS
6375 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
6376 ac_save_LDFLAGS=$LDFLAGS
6377 LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
6378 AC_CHECK_HEADERS(pthread.h)
6379 CFLAGS=$ac_save_CFLAGS
6380 LDFLAGS=$ac_save_LDFLAGS
6381 AC_DEFINE(HAVE_PTHREAD, 1, [Do we have pthreads around?])
6382fi
6383
6384#################################################
6385# Check if user wants pthreadpool support
6386
6387AC_ARG_ENABLE(pthreadpool,
6388[AS_HELP_STRING([--enable-pthreadpool], [Enable pthreads pool helper support (default=no)])])
6389
6390if test x"$enable_pthreadpool" = xyes -a x"$samba_cv_HAVE_PTHREAD" != x"yes"; then
6391 AC_MSG_ERROR([pthreadpool support cannot be enabled when pthread support was found])
6392fi
6393
6394if test x"$enable_pthreadpool" = x"yes" -a x"$samba_cv_HAVE_PTHREAD" = x"yes"; then
6395 LIBS="$LIBS $PTHREAD_LDFLAGS"
6396 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
6397 AC_DEFINE(WITH_PTHREADPOOL, 1, [Whether to include pthreadpool helpers])
6398 AC_SUBST(PTHREADPOOL_OBJ, "lib/pthreadpool.o")
6399fi
6400
6401#################################################
6402# Check to see if we should use the included iniparser
6403
6404AC_ARG_WITH(included-iniparser,
6405[AS_HELP_STRING([--with-included-iniparser], [use bundled iniparser library, not from system])],
6406[
6407 case "$withval" in
6408 yes)
6409 INCLUDED_INIPARSER=yes
6410 ;;
6411 no)
6412 INCLUDED_INIPARSER=no
6413 ;;
6414 esac ],
6415)
6416if test x"$INCLUDED_INIPARSER" != x"yes"; then
6417 AC_CHECK_LIB(iniparser, iniparser_load,
6418 INCLUDED_INIPARSER=no, INCLUDED_INIPARSER=yes)
6419fi
6420
6421AC_MSG_CHECKING(whether to use included iniparser)
6422if test x"$INCLUDED_INIPARSER" = x"yes"; then
6423 AC_MSG_RESULT(yes)
6424 BUILD_INIPARSER='$(INIPARSER_OBJ)'
6425 INIPARSERLIBS=""
6426 FLAGS1="$FLAGS1 -I\$(srcdir)/iniparser/src"
6427else
6428 AC_MSG_RESULT(no)
6429 BUILD_INIPARSER=""
6430 INIPARSERLIBS="-liniparser"
6431fi
6432AC_SUBST(BUILD_INIPARSER)
6433AC_SUBST(INIPARSERLIBS)
6434AC_SUBST(FLAGS1)
6435
6436
6437
6438# Checks for the vfs_fileid module
6439# Start
6440AC_CHECK_FUNC(getmntent)
6441
6442AC_CHECK_HEADERS(sys/statfs.h)
6443
6444AC_MSG_CHECKING([vfs_fileid: checking for statfs() and struct statfs.f_fsid)])
6445AC_CACHE_VAL(vfsfileid_cv_statfs,[
6446 AC_TRY_RUN([
6447 #include <sys/types.h>
6448 #include <sys/statfs.h>
6449 int main(void)
6450 {
6451 struct statfs fsd;
6452 fsid_t fsid = fsd.f_fsid;
6453 return statfs (".", &fsd);
6454 }],
6455 vfsfileid_cv_statfs=yes,
6456 vfsfileid_cv_statfs=no,
6457 vfsfileid_cv_statfs=cross)
6458])
6459AC_MSG_RESULT($vfsfileid_cv_statfs)
6460
6461if test x"$ac_cv_func_getmntent" = x"yes" -a \
6462 x"$vfsfileid_cv_statfs" = x"yes"; then
6463 default_shared_modules="$default_shared_modules vfs_fileid"
6464fi
6465# End
6466# Checks for the vfs_fileid module
6467
6468
6469for i in `echo $default_static_modules | sed -e 's/,/ /g'`
6470do
6471 eval MODULE_DEFAULT_$i=STATIC
6472done
6473
6474for i in `echo $default_shared_modules | sed -e 's/,/ /g'`
6475do
6476 dnl Fall back to static if we cannot build shared libraries
6477 eval MODULE_DEFAULT_$i=STATIC
6478
6479 if test $BLDSHARED = true; then
6480 eval MODULE_DEFAULT_$i=SHARED
6481 fi
6482done
6483
6484dnl Always build these modules static
6485MODULE_rpc_spoolss=STATIC
6486MODULE_rpc_srvsvc=STATIC
6487MODULE_idmap_tdb=STATIC
6488MODULE_idmap_passdb=STATIC
6489MODULE_idmap_nss=STATIC
6490
6491MODULE_nss_info_template=STATIC
6492
6493AC_ARG_WITH(static-modules,
6494[AS_HELP_STRING([--with-static-modules=MODULES], [Comma-separated list of names of modules to statically link in])],
6495[ if test $withval; then
6496 for i in `echo $withval | sed -e 's/,/ /g'`
6497 do
6498 eval MODULE_$i=STATIC
6499 done
6500fi ])
6501
6502AC_ARG_WITH(shared-modules,
6503[AS_HELP_STRING([--with-shared-modules=MODULES], [Comma-separated list of names of modules to build shared])],
6504[ if test $withval; then
6505 for i in `echo $withval | sed -e 's/,/ /g'`
6506 do
6507 eval MODULE_$i=SHARED
6508 done
6509fi ])
6510
6511if test x"$MODULE_DEFAULT_vfs_notify_fam" = xSTATIC -o \
6512 x"$MODULE_vfs_notify_fam" = xSTATIC ; then
6513 SMBD_FAM_LIBS="$SMB_FAM_LIBS"
6514 AC_SUBST(SMBD_FAM_LIBS)
6515fi
6516
6517SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o, "bin/ldapsam.$SHLIBEXT", PDB,
6518 [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
6519SMB_MODULE(pdb_ads, passdb/pdb_ads.o \$(TLDAP_OBJ), "bin/ads.$SHLIBEXT", PDB)
6520SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
6521SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
6522SMB_MODULE(pdb_wbc_sam, passdb/pdb_wbc_sam.o, "bin/wbc_sam.$SHLIBEXT", PDB)
6523SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
6524
6525
6526SMB_MODULE(rpc_lsarpc, \$(RPC_LSA_OBJ), "bin/librpc_lsarpc.$SHLIBEXT", RPC)
6527SMB_MODULE(rpc_winreg, \$(RPC_REG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC)
6528SMB_MODULE(rpc_initshutdown, \$(RPC_INITSHUTDOWN_OBJ), "bin/librpc_initshutdown.$SHLIBEXT", RPC)
6529SMB_MODULE(rpc_dssetup, \$(RPC_DSSETUP_OBJ), "bin/librpc_dssetup.$SHLIBEXT", RPC)
6530SMB_MODULE(rpc_wkssvc, \$(RPC_WKS_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC)
6531SMB_MODULE(rpc_svcctl, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl.$SHLIBEXT", RPC)
6532SMB_MODULE(rpc_ntsvcs, \$(RPC_NTSVCS_OBJ), "bin/librpc_ntsvcs.$SHLIBEXT", RPC)
6533SMB_MODULE(rpc_netlogon, \$(RPC_NETLOG_OBJ), "bin/librpc_NETLOGON.$SHLIBEXT", RPC)
6534SMB_MODULE(rpc_netdfs, \$(RPC_DFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC)
6535SMB_MODULE(rpc_srvsvc, \$(RPC_SVC_OBJ), "bin/librpc_svcsvc.$SHLIBEXT", RPC)
6536SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC)
6537SMB_MODULE(rpc_eventlog, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog.$SHLIBEXT", RPC)
6538SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
6539SMB_MODULE(rpc_rpcecho, \$(RPC_ECHO_OBJ), "bin/librpc_rpcecho.$SHLIBEXT", RPC)
6540SMB_SUBSYSTEM(RPC,smbd/server.o)
6541
6542SMB_MODULE(idmap_ldap, winbindd/idmap_ldap.o, "bin/ldap.$SHLIBEXT", IDMAP)
6543SMB_MODULE(idmap_tdb, winbindd/idmap_tdb.o, "bin/tdb.$SHLIBEXT", IDMAP)
6544SMB_MODULE(idmap_tdb2, winbindd/idmap_tdb2.o, "bin/tdb2.$SHLIBEXT", IDMAP)
6545SMB_MODULE(idmap_passdb, winbindd/idmap_passdb.o, "bin/passdb.$SHLIBEXT", IDMAP)
6546SMB_MODULE(idmap_nss, winbindd/idmap_nss.o, "bin/nss.$SHLIBEXT", IDMAP)
6547SMB_MODULE(idmap_rid, winbindd/idmap_rid.o, "bin/rid.$SHLIBEXT", IDMAP)
6548SMB_MODULE(idmap_ad, winbindd/idmap_ad.o, "bin/ad.$SHLIBEXT", IDMAP)
6549SMB_MODULE(idmap_hash, \$(IDMAP_HASH_OBJ), "bin/hash.$SHLIBEXT", IDMAP)
6550SMB_MODULE(idmap_adex, \$(IDMAP_ADEX_OBJ), "bin/adex.$SHLIBEXT", IDMAP)
6551SMB_SUBSYSTEM(IDMAP, winbindd/idmap.o)
6552
6553SMB_MODULE(nss_info_template, winbindd/nss_info_template.o, "bin/template.$SHLIBEXT", NSS_INFO)
6554SMB_SUBSYSTEM(NSS_INFO, winbindd/nss_info.o)
6555
6556SMB_MODULE(charset_weird, modules/weird.o, "bin/weird.$SHLIBEXT", CHARSET)
6557SMB_MODULE(charset_CP850, modules/CP850.o, "bin/CP850.$SHLIBEXT", CHARSET)
6558SMB_MODULE(charset_CP437, modules/CP437.o, "bin/CP437.$SHLIBEXT", CHARSET)
6559SMB_MODULE(charset_macosxfs, modules/charset_macosxfs.o,"bin/macosxfs.$SHLIBEXT", CHARSET)
6560SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
6561
6562SMB_MODULE(auth_sam, \$(AUTH_SAM_OBJ), "bin/sam.$SHLIBEXT", AUTH)
6563SMB_MODULE(auth_unix, \$(AUTH_UNIX_OBJ), "bin/unix.$SHLIBEXT", AUTH)
6564SMB_MODULE(auth_winbind, \$(AUTH_WINBIND_OBJ), "bin/winbind.$SHLIBEXT", AUTH)
6565SMB_MODULE(auth_wbc, \$(AUTH_WBC_OBJ), "bin/wbc.$SHLIBEXT", AUTH)
6566SMB_MODULE(auth_server, \$(AUTH_SERVER_OBJ), "bin/smbserver.$SHLIBEXT", AUTH)
6567SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
6568SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
6569SMB_MODULE(auth_script, \$(AUTH_SCRIPT_OBJ), "bin/script.$SHLIBEXT", AUTH)
6570SMB_MODULE(auth_netlogond, \$(AUTH_NETLOGOND_OBJ), "bin/netlogond.$SHLIBEXT", AUTH)
6571SMB_SUBSYSTEM(AUTH,auth/auth.o)
6572
6573SMB_MODULE(vfs_default, \$(VFS_DEFAULT_OBJ), "bin/default.$SHLIBEXT", VFS)
6574SMB_MODULE(vfs_recycle, \$(VFS_RECYCLE_OBJ), "bin/recycle.$SHLIBEXT", VFS)
6575SMB_MODULE(vfs_audit, \$(VFS_AUDIT_OBJ), "bin/audit.$SHLIBEXT", VFS)
6576SMB_MODULE(vfs_extd_audit, \$(VFS_EXTD_AUDIT_OBJ), "bin/extd_audit.$SHLIBEXT", VFS)
6577SMB_MODULE(vfs_full_audit, \$(VFS_FULL_AUDIT_OBJ), "bin/full_audit.$SHLIBEXT", VFS)
6578SMB_MODULE(vfs_netatalk, \$(VFS_NETATALK_OBJ), "bin/netatalk.$SHLIBEXT", VFS)
6579SMB_MODULE(vfs_fake_perms, \$(VFS_FAKE_PERMS_OBJ), "bin/fake_perms.$SHLIBEXT", VFS)
6580SMB_MODULE(vfs_default_quota, \$(VFS_DEFAULT_QUOTA_OBJ), "bin/default_quota.$SHLIBEXT", VFS)
6581SMB_MODULE(vfs_readonly, \$(VFS_READONLY_OBJ), "bin/readonly.$SHLIBEXT", VFS)
6582SMB_MODULE(vfs_cap, \$(VFS_CAP_OBJ), "bin/cap.$SHLIBEXT", VFS)
6583SMB_MODULE(vfs_expand_msdfs, \$(VFS_EXPAND_MSDFS_OBJ), "bin/expand_msdfs.$SHLIBEXT", VFS)
6584SMB_MODULE(vfs_shadow_copy, \$(VFS_SHADOW_COPY_OBJ), "bin/shadow_copy.$SHLIBEXT", VFS)
6585SMB_MODULE(vfs_shadow_copy2, \$(VFS_SHADOW_COPY2_OBJ), "bin/shadow_copy2.$SHLIBEXT", VFS)
6586SMB_MODULE(vfs_afsacl, \$(VFS_AFSACL_OBJ), "bin/afsacl.$SHLIBEXT", VFS)
6587SMB_MODULE(vfs_xattr_tdb, \$(VFS_XATTR_TDB_OBJ), "bin/xattr_tdb.$SHLIBEXT", VFS)
6588SMB_MODULE(vfs_posixacl, \$(VFS_POSIXACL_OBJ), "bin/posixacl.$SHLIBEXT", VFS)
6589SMB_MODULE(vfs_aixacl, \$(VFS_AIXACL_OBJ), "bin/aixacl.$SHLIBEXT", VFS)
6590SMB_MODULE(vfs_aixacl2, \$(VFS_AIXACL2_OBJ), "bin/aixacl2.$SHLIBEXT", VFS)
6591SMB_MODULE(vfs_solarisacl, \$(VFS_SOLARISACL_OBJ), "bin/solarisacl.$SHLIBEXT", VFS)
6592SMB_MODULE(vfs_irixacl, \$(VFS_IRIXACL_OBJ), "bin/irixacl.$SHLIBEXT", VFS)
6593SMB_MODULE(vfs_hpuxacl, \$(VFS_HPUXACL_OBJ), "bin/hpuxacl.$SHLIBEXT", VFS)
6594SMB_MODULE(vfs_tru64acl, \$(VFS_TRU64ACL_OBJ), "bin/tru64acl.$SHLIBEXT", VFS)
6595SMB_MODULE(vfs_catia, \$(VFS_CATIA_OBJ), "bin/catia.$SHLIBEXT", VFS)
6596SMB_MODULE(vfs_streams_xattr, \$(VFS_STREAMS_XATTR_OBJ), "bin/streams_xattr.$SHLIBEXT", VFS)
6597SMB_MODULE(vfs_streams_depot, \$(VFS_STREAMS_DEPOT_OBJ), "bin/streams_depot.$SHLIBEXT", VFS)
6598SMB_MODULE(vfs_cacheprime, \$(VFS_CACHEPRIME_OBJ), "bin/cacheprime.$SHLIBEXT", VFS)
6599SMB_MODULE(vfs_prealloc, \$(VFS_PREALLOC_OBJ), "bin/prealloc.$SHLIBEXT", VFS)
6600SMB_MODULE(vfs_commit, \$(VFS_COMMIT_OBJ), "bin/commit.$SHLIBEXT", VFS)
6601SMB_MODULE(vfs_gpfs, \$(VFS_GPFS_OBJ), "bin/gpfs.$SHLIBEXT", VFS)
6602SMB_MODULE(vfs_readahead, \$(VFS_READAHEAD_OBJ), "bin/readahead.$SHLIBEXT", VFS)
6603SMB_MODULE(vfs_tsmsm, \$(VFS_TSMSM_OBJ), "bin/tsmsm.$SHLIBEXT", VFS)
6604SMB_MODULE(vfs_fileid, \$(VFS_FILEID_OBJ), "bin/fileid.$SHLIBEXT", VFS)
6605SMB_MODULE(vfs_aio_fork, \$(VFS_AIO_FORK_OBJ), "bin/aio_fork.$SHLIBEXT", VFS)
6606SMB_MODULE(vfs_preopen, \$(VFS_PREOPEN_OBJ), "bin/preopen.$SHLIBEXT", VFS)
6607SMB_MODULE(vfs_syncops, \$(VFS_SYNCOPS_OBJ), "bin/syncops.$SHLIBEXT", VFS)
6608SMB_MODULE(vfs_zfsacl, \$(VFS_ZFSACL_OBJ), "bin/zfsacl.$SHLIBEXT", VFS)
6609SMB_MODULE(vfs_notify_fam, \$(VFS_NOTIFY_FAM_OBJ), "bin/notify_fam.$SHLIBEXT", VFS)
6610SMB_MODULE(vfs_acl_xattr, \$(VFS_ACL_XATTR_OBJ), "bin/acl_xattr.$SHLIBEXT", VFS)
6611SMB_MODULE(vfs_acl_tdb, \$(VFS_ACL_TDB_OBJ), "bin/acl_tdb.$SHLIBEXT", VFS)
6612SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
6613SMB_MODULE(vfs_onefs, \$(VFS_ONEFS), "bin/onefs.$SHLIBEXT", VFS)
6614SMB_MODULE(vfs_onefs_shadow_copy, \$(VFS_ONEFS_SHADOW_COPY), "bin/onefs_shadow_copy.$SHLIBEXT", VFS)
6615SMB_MODULE(vfs_dirsort, \$(VFS_DIRSORT_OBJ), "bin/dirsort.$SHLIBEXT", VFS)
6616SMB_MODULE(vfs_scannedonly, \$(VFS_SCANNEDONLY_OBJ), "bin/scannedonly.$SHLIBEXT", VFS)
6617
6618SMB_SUBSYSTEM(VFS,smbd/vfs.o)
6619
6620SMB_MODULE(perfcount_onefs, \$(PERFCOUNT_ONEFS), "bin/pc_onefs.$SHLIBEXT", PERFCOUNT)
6621SMB_MODULE(perfcount_test, \$(PERFCOUNT_TEST), "bin/pc_test.$SHLIBEXT", PERFCOUNT)
6622SMB_SUBSYSTEM(PERFCOUNT,smbd/perfcount.o)
6623
6624SMB_MODULE(gpext_registry, libgpo/gpext/registry.o, "bin/registry.$SHLIBEXT", GPEXT)
6625SMB_MODULE(gpext_scripts, libgpo/gpext/scripts.o, "bin/scripts.$SHLIBEXT", GPEXT)
6626SMB_MODULE(gpext_security, libgpo/gpext/security.o, "bin/security.$SHLIBEXT", GPEXT)
6627SMB_SUBSYSTEM(GPEXT, libgpo/gpext/gpext.o)
6628
6629AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
6630
6631#################################################
6632# do extra things if we are running insure
6633
6634if test "${ac_cv_prog_CC}" = "insure"; then
6635 CPPFLAGS="$CPPFLAGS -D__INSURE__"
6636fi
6637
6638#################################################
6639# If run from the build farm, enable NASTY hacks
6640#################################################
6641AC_MSG_CHECKING(whether to enable build farm hacks)
6642if test x"$RUN_FROM_BUILD_FARM" = x"yes"; then
6643 AC_MSG_RESULT(yes)
6644 AC_DEFINE(ENABLE_BUILD_FARM_HACKS, 1, [Defined if running in the build farm])
6645else
6646 AC_MSG_RESULT(no)
6647fi
6648
6649#################################################
6650# check for bad librt/libpthread interactions
6651
6652if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes" -o \
6653 x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes" -o \
6654 x"$samba_cv_HAVE_AIO64" = x"yes" -o \
6655 x"$samba_cv_HAVE_AIO" = x"yes" ; then
6656
6657SMB_IF_RTSIGNAL_BUG(
6658 [
6659 # Have RT_SIGNAL bug, need to check whether the problem will
6660 # affect anything we have configured.
6661
6662 rt_do_error=no
6663 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
6664 if test x"$rt_signal_lease_ok" = x"no" ; then
6665 rt_do_error=yes
6666 fi
6667 fi
6668
6669 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
6670 if test x"$rt_signal_notify_ok" = x"no" ; then
6671 rt_do_error=yes
6672 fi
6673 fi
6674
6675 if test x"$samba_cv_HAVE_AIO64" = x"yes" -o \
6676 x"$samba_cv_HAVE_AIO" = x"yes" ; then
6677 if test x"$rt_signal_aio_ok" = x"no" ; then
6678 rt_do_error=yes
6679 fi
6680 fi
6681
6682 if test x"$rt_do_error" = x"yes" ; then
6683 SMB_IS_LIBPTHREAD_LINKED(
6684 [
6685 cat<<MSG
6686
6687*** On this platforms, linking Samba against pthreads causes problems
6688*** with the oplock and change notification mechanisms. You may be
6689*** using pthreads as a side-effect of using the --with-aio-support
6690*** or --with-profiling-data options. Please remove these and try again.
6691
6692MSG
6693 ],
6694 [
6695 cat<<MSG
6696
6697*** On this platform, the oplock and change notification mechanisms do not
6698*** appear to work. Please report this problem to samba-technical@samba.org
6699*** and attach the config.log file from this directory.
6700
6701MSG
6702 ])
6703 AC_MSG_ERROR(unable to use realtime signals on this platform)
6704 fi
6705 ],
6706 [
6707 # no RT_SIGNAL bug, we are golden
6708 SMB_IS_LIBPTHREAD_LINKED(
6709 [
6710 AC_MSG_WARN(using libpthreads - this may degrade performance)
6711 ])
6712
6713 ],
6714 [
6715 # cross compiling, I hope you know what you are doing
6716 true
6717 ])
6718
6719fi
6720
6721AC_ARG_ENABLE(merged-build,
6722[AS_HELP_STRING([--enable-merged-build], [Build Samba 4 as well])],
6723[ enable_merged_build=$enableval ], [ enable_merged_build=auto ])
6724
6725if test x"$enable_merged_build" = x"yes" -a \
6726 x"$merged_build_possible" = x"no" ; then
6727 AC_MSG_ERROR(Merged build required but not possible)
6728fi
6729
6730m4_include(../lib/zlib/zlib.m4)
6731
6732if test x$enable_merged_build = xauto; then
6733 # Check for python
6734 m4_include(../m4/check_python.m4)
6735 AC_SAMBA_PYTHON_DEVEL([true], [merged_build_possible=no])
6736
6737 AC_MSG_CHECKING([whether it would be possible to do a merged build])
6738 AC_MSG_RESULT([$merged_build_possible])
6739
6740 # Enable merged build automatically if possible, when in developer mode
6741 # Don't enable merged build automatically in 3.4.0.
6742 #if test "x$developer" = xyes; then
6743 # enable_merged_build=$merged_build_possible
6744 #fi
6745fi
6746
6747if test x$enable_merged_build = xyes; then
6748 MERGED_BUILD=1
6749 saved_USESHARED="$USESHARED"
6750 USESHARED="false"
6751 m4_include(samba4.m4)
6752 USESHARED="$saved_USESHARED"
6753fi
6754
6755AC_SUBST(ZLIB_LIBS)
6756AC_SUBST(ZLIB_OBJS)
6757AC_ZLIB([ZLIB_OBJS=""], [
6758 ZLIB_LIBS=""
6759 for o in adler32.o compress.o crc32.o gzio.o uncompr.o \
6760 deflate.o trees.o zutil.o inflate.o infback.o \
6761 inftrees.o inffast.o
6762 do
6763 ZLIB_OBJS="$ZLIB_OBJS ../lib/zlib/$o"
6764 done
6765 CFLAGS="-I../lib/zlib $CFLAGS"
6766])
6767
6768AC_ARG_ENABLE(dmalloc, [AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging [default=no]])])
6769
6770if test "x$enable_dmalloc" = xyes
6771then
6772 AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
6773 AC_DEFINE(DMALLOC_FUNC_CHECK, 1,
6774 [Define to check invariants around some common functions])
6775 LIBS="$LIBS -ldmalloc"
6776fi
6777
6778dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
6779LIB_REMOVE_USR_LIB(LDFLAGS)
6780LIB_REMOVE_USR_LIB(LIBS)
6781
6782dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
6783CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
6784CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
6785
6786#################################################
6787# Display summary of libraries detected
6788
6789AC_MSG_RESULT([Using libraries:])
6790AC_MSG_RESULT([ LIBS = $LIBS])
6791if test x"$with_ads_support" != x"no"; then
6792 AC_MSG_RESULT([ KRB5_LIBS = $KRB5_LIBS])
6793fi
6794if test x"$with_ldap_support" != x"no"; then
6795 AC_MSG_RESULT([ LDAP_LIBS = $LDAP_LIBS])
6796fi
6797if test x"$with_dnsupdate_support" != x"no"; then
6798 AC_MSG_RESULT([ UUID_LIBS = $UUID_LIBS])
6799fi
6800if test x"$have_dnssd_support" != x"no"; then
6801 AC_MSG_RESULT([ DNSSD_LIBS = $DNSSD_LIBS])
6802fi
6803AC_MSG_RESULT([ AUTH_LIBS = $AUTH_LIBS])
6804
6805#################################################
6806# final configure stuff
6807
6808AC_MSG_CHECKING([configure summary])
6809AC_TRY_RUN([#include "${srcdir-.}/../tests/summary.c"],
6810 AC_MSG_RESULT(yes),
6811 AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
6812 AC_MSG_WARN([cannot run when cross-compiling]))
6813
6814dnl Merge in developer cflags from now on
6815AC_SUBST(DEVELOPER_CFLAGS)
6816if test x"$krb5_developer" = x"yes" -o x"$developer" = x"yes" -o x"$picky_developer" = x"yes"; then
6817 CFLAGS="${CFLAGS} \$(DEVELOPER_CFLAGS)"
6818fi
6819
6820# Stuff the smbd-only libraries at the end of the smbd link
6821# path (if we have them).
6822SMBD_LIBS="$samba_dmapi_libs"
6823AC_SUBST(SMBD_LIBS)
6824
6825CFLAGS="${CFLAGS} \$(FLAGS)"
6826
6827if test x$MERGED_BUILD != x1; then
6828 CFLAGS="${CFLAGS} -D_SAMBA_BUILD_=3"
6829else
6830 if test x"$BLDSHARED" = x"true" ; then
6831 LDFLAGS="$LDFLAGS -L./bin"
6832 fi
6833fi
6834
6835AC_SUBST(MAKEFILE)
6836if test x$samba_cv_gnu_make = xyes; then
6837 MAKEFILE=Makefile
6838else
6839 # When we don't have GNU Make, generate a copy of Makefile.in
6840 # that doesn't have the "include " statements but just includes
6841 # the files verbatim.
6842 MAKEFILE=Makefile-noincludes
6843 $PERL ./script/expand-includes.pl Makefile.in > $MAKEFILE.in
6844fi
6845AC_OUTPUT($MAKEFILE
6846 script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh
6847 lib/netapi/examples/Makefile
6848 lib/netapi/tests/Makefile
6849 pkgconfig/smbclient.pc
6850 pkgconfig/wbclient.pc
6851 pkgconfig/netapi.pc
6852 pkgconfig/smbsharemodes.pc
6853 ../examples/libsmbclient/Makefile.internal
6854 )
6855dnl If we had to expand the includes, make tsure the output file is moved back
6856AC_OUTPUT_COMMANDS([
6857if test x$MAKEFILE != Makefile; then
6858 mv $MAKEFILE Makefile
6859fi
6860])
6861
6862#################################################
6863# Print very concise instructions on building/use
6864if test "x$enable_dmalloc" = xyes
6865then
6866 AC_MSG_RESULT([Note: The dmalloc debug library will be included. To turn it on use])
6867 AC_MSG_RESULT([ \$ eval \`dmalloc samba\`.])
6868fi
Note: See TracBrowser for help on using the repository browser.