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

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

Samba 3.5: Update trunk to 3.5.8

File size: 224.8 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 if test "${GCC}" = "yes"; then
1646 PICFLAG="-fPIC"
1647 fi
1648 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1649 AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1650 ;;
1651 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
1652 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1653 ;;
1654 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
1655 BLDSHARED="true"
1656 LDSHFLAGS="-shared"
1657 SONAMEFLAG="-Wl,-soname,"
1658 PICFLAG="-KPIC"
1659 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1660 ;;
1661 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
1662 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1663 ;;
1664 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
1665 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1666 ;;
1667 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
1668 case "$host" in
1669 *-univel-*) if [ test "$GCC" != yes ]; then
1670 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
1671 fi
1672 LDSHFLAGS="-G"
1673 DYNEXP="-Bexport"
1674 ;;
1675 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
1676 esac
1677 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1678 ;;
1679
1680 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
1681 if [ test "$GCC" != yes ]; then
1682 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
1683 fi
1684 LDSHFLAGS="-G"
1685 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1686 ;;
1687 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
1688 BLDSHARED="false"
1689 LDSHFLAGS=""
1690 ;;
1691
1692 *darwin*) AC_DEFINE(DARWINOS,1,[Whether the host os is Darwin/MacOSX])
1693 BLDSHARED="true"
1694 LDSHFLAGS="-dynamiclib -flat_namespace -undefined suppress"
1695 CFLAGS="$CFLAGS -fno-common"
1696 SHLD="\${CC}"
1697 SHLIBEXT="dylib"
1698 MODULE_EXPORTS="-exported_symbols_list \$(srcdir)/exports/modules-darwin.syms"
1699 SHLIBEXT="dylib"
1700 # Since gcc doesn't fail on unrecognised options, the
1701 # PIE test incorrectly succeeds. Darwin gcc does not
1702 # actually support the PIE stuff.
1703 PIE_LDFLAGS=
1704 PIE_CFLAGS=
1705 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1706 ;;
1707
1708 *os2*) AC_DEFINE(OS2, 1,[Weather the host os is OS/2])
1709 BLDSHARED="true"
1710 LDSHFLAGS="-ZDll"
1711 SHLIBEXT="dll"
1712 AC_DEFINE(STAT_ST_BLOCKSIZE, 512)
1713 ;;
1714
1715 *)
1716 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1717 ;;
1718 esac
1719
1720if test "$enable_shared" != "yes"; then
1721 BLDSHARED=false
1722fi
1723
1724if test "$enable_shared" = yes -a "${ac_cv_gnu_ld_version_script}" = yes; then
1725 DSO_EXPORTS=\$\(DSO_EXPORTS_CMD\)
1726fi
1727
1728if test x"$BLDSHARED" = x"true" ; then
1729 LDFLAGS="$LDFLAGS -L./bin"
1730fi
1731
1732AC_MSG_RESULT($BLDSHARED)
1733
1734saved_before_as_needed_ldflags="$LDFLAGS"
1735for flags in "-Wl,--as-needed" "-Wl,-z,ignore" "-z ignore" ; do
1736 saved_ldflags="$LDFLAGS"
1737 AC_MSG_CHECKING([if $flags works])
1738 LDFLAGS="$flags $saved_ldflags"
1739 AC_TRY_LINK([],[],
1740 [AC_MSG_RESULT([yes])
1741 LD_AS_NEEDED_FLAG=$flags
1742 ld_as_needed_flag_found=yes],
1743 AC_MSG_RESULT([no]))
1744 LDFLAGS="$LD_AS_NEEDED_FLAG $saved_ldflags"
1745 test x"$ld_as_needed_flag_found" = xyes && break
1746done
1747
1748# check if we have to disable LD_AS_NEEDED_FLAG:
1749# On some systems for a veriety of reasons linking with
1750# -Wl,--as-needed -lreadline -lncurses fails
1751# we have to retest, if these combination is detected before.
1752# Bugzilla #7209
1753
1754if test x$ac_cv_lib_readline_rl_callback_handler_install = xyes ; then
1755 if test x$ld_as_needed_flag_found = xyes ; then
1756 AC_MSG_CHECKING([if $LD_AS_NEEDED_FLAG works with readline])
1757 # try if check no fails
1758 save_LIBS=$LIBS
1759 LIBS="$LIBS $TERMLIBS"
1760 AC_TRY_LINK([], [rl_callback_handler_install();], [AC_MSG_RESULT([yes])],[ AC_MSG_RESULT([no]); LDFLAGS="$saved_before_as_needed_ldflags"])
1761 LIBS="$save_LIBS"
1762 fi
1763fi
1764
1765
1766
1767# for historical reasons almost all linkers don't complain about unresolved
1768# symbols in shared libs. Except for the internal samba modules we want to get
1769# errors when we produce a shared lib with unresolved symbols. On some
1770# platforms unresolved symbols might be intended, so we might have to add
1771# platform specific exceptions here.
1772
1773for flags in "-Wl,-z,defs" "-error_unresolved" "-Wl,-error_unresolved" ; do
1774 saved_ldflags="$LDFLAGS"
1775 AC_MSG_CHECKING([if $flags works])
1776 LDFLAGS="$flags $saved_ldflags"
1777 AC_TRY_LINK([],[],
1778 [AC_MSG_RESULT([yes])
1779 LDSHFLAGS_Z_DEFS=$flags
1780 ldshflags_z_defs_found=yes],
1781 AC_MSG_RESULT([no]))
1782 LDFLAGS=$saved_ldflags
1783 test x"$ldshflags_z_defs_found" = xyes && break
1784done
1785
1786AC_MSG_CHECKING([LDSHFLAGS_Z_DEFS])
1787AC_MSG_RESULT([$LDSHFLAGS_Z_DEFS])
1788AC_MSG_CHECKING([LDFLAGS])
1789AC_MSG_RESULT([$LDFLAGS])
1790AC_MSG_CHECKING([DYNEXP])
1791AC_MSG_RESULT([$DYNEXP])
1792
1793#######################################################
1794# test whether building a shared library actually works
1795if test $BLDSHARED = true; then
1796
1797AC_MSG_CHECKING([SHLD])
1798AC_MSG_RESULT([$SHLD])
1799AC_MSG_CHECKING([LDSHFLAGS])
1800AC_MSG_RESULT([$LDSHFLAGS])
1801
1802AC_MSG_CHECKING([SHLIBEXT])
1803AC_MSG_RESULT([$SHLIBEXT])
1804AC_MSG_CHECKING([SONAMEFLAG])
1805AC_MSG_RESULT([$SONAMEFLAG])
1806
1807AC_MSG_CHECKING([PICFLAG])
1808AC_MSG_RESULT([$PICFLAG])
1809
1810AC_MSG_CHECKING([NSSSONAMEVERSIONSUFFIX])
1811AC_MSG_RESULT([$NSSSONAMEVERSIONSUFFIX])
1812
1813AC_CACHE_CHECK([whether building shared libraries actually works],
1814 [ac_cv_shlib_works],[
1815 # try building a trivial shared library
1816 ac_cv_shlib_works=no
1817 # The $SHLD and $LDSHFLAGS variables may contain references to other
1818 # variables so they need to be eval'ed.
1819 if AC_TRY_COMMAND([$CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.o ${srcdir-.}/../tests/shlib.c 1>&AS_MESSAGE_LOG_FD])
1820 then
1821 if AC_TRY_COMMAND([`eval echo "$SHLD $LDSHFLAGS $PICFLAG"` -o "shlib.$SHLIBEXT" shlib.o 1>&AS_MESSAGE_LOG_FD])
1822 then
1823 ac_cv_shlib_works=yes
1824 fi
1825 fi
1826 rm -f "shlib.$SHLIBEXT" shlib.o
1827
1828])
1829if test $ac_cv_shlib_works = no; then
1830 BLDSHARED=false
1831fi
1832fi
1833
1834if test x"$BLDSHARED" != x"true"; then
1835 LDSHFLAGS="shared-libraries-disabled"
1836 SONAMEFLAG="shared-libraries-disabled"
1837 NSSSONAMEVERSIONSUFFIX="shared-libraries-disabled"
1838 SHLD="shared-libraries-disabled"
1839 PICFLAG="${PIE_CFLAGS}"
1840 SHLIBEXT="shared_libraries_disabled"
1841 merged_build_possible=no
1842fi
1843
1844AC_MSG_CHECKING([used PICFLAG])
1845AC_MSG_RESULT([$PICFLAG])
1846
1847AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension])
1848
1849AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
1850
1851
1852###########################################################
1853#
1854# Configuration of subsystem / libraries
1855#
1856###########################################################
1857
1858INSTALLLIBCMD_SH=:
1859INSTALLLIBCMD_A=:
1860UNINSTALLLIBCMD_SH=:
1861UNINSTALLLIBCMD_A=:
1862
1863if test $BLDSHARED = true; then
1864 INSTALLLIBCMD_SH="\$(INSTALLCMD)"
1865 UNINSTALLLIBCMD_SH="rm -f"
1866fi
1867if test $enable_static = yes; then
1868 INSTALLLIBCMD_A="\$(INSTALLCMD)"
1869 UNINSTALLLIBCMD_A="rm -f"
1870fi
1871
1872#################################################
1873# --disable-shared-libs
1874# can be used to disable the internal use of shared libs altogether
1875# (this only has an effect when building shared libs is enabled)
1876#
1877USESHARED=false
1878AC_SUBST(USESHARED)
1879
1880AC_MSG_CHECKING(whether to use shared libraries internally)
1881AC_ARG_ENABLE([shared-libs],
1882 AS_HELP_STRING([--enable-shared-libs],
1883 [Use shared libraries internally (default=yes)]),
1884 [enable_shared_libs=$enableval],
1885 [enable_shared_libs=yes])
1886
1887if test x"$enable_shared_libs" != x"no" ; then
1888 USESHARED=$BLDSHARED
1889fi
1890
1891AC_MSG_RESULT([$USESHARED])
1892
1893if test x"$enable_shared_libs" = x"yes" -a x"$BLDSHARED" != x"true" ; then
1894 AC_MSG_WARN([--enable-shared-libs: no support for shared libraries])
1895fi
1896
1897#################################################
1898# --with-static-libs=LIBS:
1899# link (internal) libs dynamically or statically?
1900#
1901# If a subsystem is built as a library then this controls whether they are
1902# linked into Samba targets statically or dynamically:
1903#
1904# * If we build the shared library at all, we link dynamically by default.
1905#
1906# * We only link statically if we don't build shared or if the library
1907# appears in the --with-static-libs configure option.
1908#
1909# Example:
1910# --with-static-libs=libtalloc makes use of libtalloc.a instead
1911# of linking the dynamic variant with -ltalloc.
1912#
1913# NOTE: This option only affects libraries that we do not only build
1914# but that samba also links against as libraries (as opposed to linking
1915# the plain object files. - This has to be configured in Makefile.in.
1916# So in particular it does not harm to give invalid or unknown names here.
1917#
1918
1919AC_ARG_WITH([static-libs],
1920 [AS_HELP_STRING([--with-static-libs=LIBS],
1921 [Comma-separated list of names of (internal) libraries to link statically (instead of dynamically)])],
1922 [AS_IF([test $withval],
1923 [for lib in `echo $withval | sed -e 's/,/ /g'` ; do
1924 [lib=`echo $lib | tr '[a-z]' '[A-Z]'`]
1925 eval LINK_$lib=STATIC
1926 done], [])],
1927 [])
1928
1929#
1930# WORKAROUND:
1931# until we have organized other internal subsystems (as util, registry
1932# and smbconf) into shared libraries, we CAN NOT link libnetapi
1933# dynamically to samba programs.
1934#
1935LINK_LIBNETAPI=STATIC
1936
1937LINK_LIBSMBCLIENT=STATIC
1938
1939#
1940# The library versions are hardcoded here
1941# and filled into the LIBFOO_SOVER variable.
1942#
1943# TODO: for talloc and tdb (at least), these should
1944# be extracted from their respective source directories
1945#
1946AC_ARG_ENABLE(external_libtalloc, [AS_HELP_STRING([--enable-external-libtalloc], [Enable external talloc [default=auto]])],
1947[ enable_external_libtalloc=$enableval ], [ enable_external_libtalloc=auto ])
1948
1949if test "x$enable_external_libtalloc" != xno
1950then
1951 PKG_CHECK_MODULES(LIBTALLOC, talloc >= 2.0.1,
1952 [ enable_external_libtalloc=yes ],
1953 [if test x$enable_external_libtalloc = xyes; then
1954 AC_MSG_ERROR([Unable to find libtalloc])
1955 else
1956 enable_external_libtalloc=no
1957 fi
1958 ])
1959fi
1960
1961if test "x$enable_external_libtalloc" = xno
1962then
1963 m4_include(../lib/talloc/libtalloc.m4)
1964 LINK_LIBTALLOC=STATIC
1965 SMB_LIBRARY(talloc, 2)
1966 LIBTALLOC_OBJ0=""
1967 for obj in ${TALLOC_OBJ}; do
1968 LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}"
1969 done
1970 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}"
1971 SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TALLOC_CFLAGS}"
1972 AC_SUBST(LIBTALLOC_OBJ0)
1973
1974 TALLOCTORT="bin/talloctort\$(EXEEXT)"
1975 AC_SUBST(TALLOCTORT)
1976fi
1977
1978
1979AC_ARG_ENABLE(external_libtdb,
1980 [AS_HELP_STRING([--enable-external-libtdb],
1981 [Enable external tdb [default=auto]])],
1982 [ enable_external_libtalloc=$enableval ],
1983 [ enable_external_libtalloc=auto ])
1984
1985if test "x$enable_external_libtdb" != xno
1986then
1987 PKG_CHECK_MODULES(LIBTDB, tdb >= 1.2.1,
1988 [ enable_external_libtdb=yes ],
1989 [
1990 if test x$enable_external_libtdb = xyes; then
1991 AC_MSG_ERROR([Unable to find libtdb])
1992 else
1993 enable_external_libtdb=no
1994 fi
1995 ])
1996fi
1997
1998AC_SUBST(LIBTDB_OBJ0)
1999if test "x$enable_external_libtdb" = xno
2000then
2001 m4_include(../lib/tdb/libtdb.m4)
2002 LINK_LIBTDB=STATIC
2003 SMB_LIBRARY(tdb, 1)
2004 LIBTDB_OBJ0=""
2005 for obj in ${TDB_OBJ}; do
2006 LIBTDB_OBJ0="${LIBTDB_OBJ0} ${tdbdir}/${obj}"
2007 done
2008 AC_SUBST(LIBTDB_OBJ0)
2009 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}"
2010 SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TDB_CFLAGS}"
2011
2012 TDBBACKUP="bin/tdbbackup\$(EXEEXT)"
2013 AC_SUBST(TDBBACKUP)
2014 TDBDUMP="bin/tdbdump\$(EXEEXT)"
2015 AC_SUBST(TDBDUMP)
2016 TDBTOOL="bin/tdbtool\$(EXEEXT)"
2017 AC_SUBST(TDBTOOL)
2018 TDBTORTURE="bin/tdbtorture\$(EXEEXT)"
2019 AC_SUBST(TDBTORTURE)
2020fi
2021
2022SMB_LIBRARY(netapi, 0)
2023SMB_LIBRARY(smbclient, 0)
2024SMB_LIBRARY(smbsharemodes, 0)
2025SMB_LIBRARY(addns, 0, no, [undefined API])
2026
2027
2028
2029################
2030
2031AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
2032AC_TRY_RUN([#include <stdio.h>
2033main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
2034samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
2035if test x"$samba_cv_have_longlong" = x"yes"; then
2036 AC_DEFINE(HAVE_LONGLONG,1,[Whether the host supports long long's])
2037 AC_CHECK_TYPE(intptr_t, unsigned long long)
2038else
2039 AC_CHECK_TYPE(intptr_t, unsigned long)
2040fi
2041
2042#
2043# Check if the compiler supports the LL prefix on long long integers.
2044# AIX needs this.
2045
2046AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
2047 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
2048 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
2049if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
2050 AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Whether the compiler supports the LL prefix on long long integers])
2051fi
2052
2053
2054AC_CACHE_CHECK([for 64 bit time_t],samba_cv_SIZEOF_TIME_T,[
2055AC_TRY_RUN([#include <time.h>
2056main() { exit((sizeof(time_t) == 8) ? 0 : 1); }],
2057samba_cv_SIZEOF_TIME_T=yes,samba_cv_SIZEOF_TIME_T=no,samba_cv_SIZEOF_TIME_T=cross)])
2058if test x"$samba_cv_SIZEOF_TIME_T" = x"yes"; then
2059 AC_DEFINE(SIZEOF_TIME_T,8,[The size of the 'time_t' type])
2060fi
2061
2062AC_CACHE_CHECK([for TIME_T_MAX],samba_cv_TIME_T_MAX,[
2063AC_TRY_RUN([#include <time.h>
2064main() {
2065 struct tm *tm;
2066 if (sizeof(time_t) == 8) {
2067 time_t max_time = 0x7fffffffffffffffll;
2068 tm = gmtime(&max_time);
2069 /* This should fail with 32-bit tm_year. */
2070 if (tm == NULL) {
2071 /* Max time_t that works with 32-bit int tm_year in struct tm. */
2072 max_time = 67768036191676799ll;
2073 tm = gmtime(&max_time);
2074 if (tm) {
2075 exit(0);
2076 }
2077 }
2078 }
2079 exit(1);
2080}],
2081samba_cv_TIME_T_MAX=yes,samba_cv_TIME_T_MAX=no,samba_cv_TIME_T_MAX=cross)])
2082if test x"$samba_cv_TIME_T_MAX" = x"yes"; then
2083 AC_DEFINE(TIME_T_MAX,67768036191676799ll,[The maximum value of the 'time_t' type])
2084fi
2085
2086
2087AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
2088AC_TRY_RUN([#include <stdio.h>
2089#include <sys/stat.h>
2090main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
2091samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
2092if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
2093 AC_DEFINE(SIZEOF_OFF_T,8,[The size of the 'off_t' type])
2094fi
2095
2096AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
2097AC_TRY_RUN([
2098#if defined(HAVE_UNISTD_H)
2099#include <unistd.h>
2100#endif
2101#include <stdio.h>
2102#include <sys/stat.h>
2103main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
2104samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
2105if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
2106 AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
2107fi
2108
2109AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
2110AC_TRY_RUN([
2111#if defined(HAVE_UNISTD_H)
2112#include <unistd.h>
2113#endif
2114#include <stdio.h>
2115#include <sys/stat.h>
2116main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
2117samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
2118if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
2119 AC_DEFINE(SIZEOF_INO_T,8,[The size of the 'ino_t' type])
2120fi
2121
2122AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
2123AC_TRY_RUN([
2124#if defined(HAVE_UNISTD_H)
2125#include <unistd.h>
2126#endif
2127#include <stdio.h>
2128#include <sys/stat.h>
2129main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
2130samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
2131if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
2132 AC_DEFINE(HAVE_INO64_T,1,[Whether the 'ino64_t' type is available])
2133fi
2134
2135AC_CACHE_CHECK([for 64 bit dev_t],samba_cv_SIZEOF_DEV_T,[
2136AC_TRY_RUN([
2137#if defined(HAVE_UNISTD_H)
2138#include <unistd.h>
2139#endif
2140#include <stdio.h>
2141#include <sys/stat.h>
2142main() { exit((sizeof(dev_t) == 8) ? 0 : 1); }],
2143samba_cv_SIZEOF_DEV_T=yes,samba_cv_SIZEOF_DEV_T=no,samba_cv_SIZEOF_DEV_T=cross)])
2144if test x"$samba_cv_SIZEOF_DEV_T" = x"yes"; then
2145 AC_DEFINE(SIZEOF_DEV_T,8,[The size of the 'dev_t' type])
2146fi
2147
2148AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
2149AC_TRY_RUN([
2150#if defined(HAVE_UNISTD_H)
2151#include <unistd.h>
2152#endif
2153#include <stdio.h>
2154#include <sys/stat.h>
2155main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
2156samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
2157if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
2158 AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available])
2159fi
2160
2161AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIR64,[
2162AC_TRY_COMPILE([
2163#if defined(HAVE_UNISTD_H)
2164#include <unistd.h>
2165#endif
2166#include <sys/types.h>
2167#include <dirent.h>],
2168[DIR64 de;],
2169samba_cv_HAVE_STRUCT_DIR64=yes,samba_cv_HAVE_STRUCT_DIR64=no)])
2170if test x"$samba_cv_HAVE_STRUCT_DIR64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
2171 AC_DEFINE(HAVE_STRUCT_DIR64,1,[Whether the 'DIR64' abstract data type is available])
2172fi
2173
2174AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
2175AC_TRY_COMPILE([
2176#if defined(HAVE_UNISTD_H)
2177#include <unistd.h>
2178#endif
2179#include <sys/types.h>
2180#include <dirent.h>],
2181[struct dirent64 de;],
2182samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
2183if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
2184 AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Whether the 'dirent64' struct is available])
2185fi
2186
2187AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
2188AC_TRY_RUN([
2189#if defined(HAVE_UNISTD_H)
2190#include <unistd.h>
2191#endif
2192#include <sys/types.h>
2193main() { dev_t dev; int i = major(dev); return 0; }],
2194samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
2195if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
2196 AC_DEFINE(HAVE_DEVICE_MAJOR_FN,1,[Whether the major macro for dev_t is available])
2197fi
2198
2199AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
2200AC_TRY_RUN([
2201#if defined(HAVE_UNISTD_H)
2202#include <unistd.h>
2203#endif
2204#include <sys/types.h>
2205main() { dev_t dev; int i = minor(dev); return 0; }],
2206samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
2207if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
2208 AC_DEFINE(HAVE_DEVICE_MINOR_FN,1,[Whether the minor macro for dev_t is available])
2209fi
2210
2211AC_CACHE_CHECK([for makedev macro],samba_cv_HAVE_MAKEDEV,[
2212AC_TRY_RUN([
2213#if defined(HAVE_UNISTD_H)
2214#include <unistd.h>
2215#endif
2216#include <sys/types.h>
2217main() { dev_t dev = makedev(1,2); return 0; }],
2218samba_cv_HAVE_MAKEDEV=yes,samba_cv_HAVE_MAKEDEV=no,samba_cv_HAVE_MAKEDEV=cross)])
2219if test x"$samba_cv_HAVE_MAKEDEV" = x"yes"; then
2220 AC_DEFINE(HAVE_MAKEDEV,1,[Whether the macro for makedev is available])
2221fi
2222
2223AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
2224AC_TRY_RUN([#include <stdio.h>
2225main() { char c; c=250; exit((c > 0)?0:1); }],
2226samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
2227if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
2228 AC_DEFINE(HAVE_UNSIGNED_CHAR,1,[Whether the 'unsigned char' type is available])
2229fi
2230
2231AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
2232AC_TRY_COMPILE([#include <sys/types.h>
2233#include <dirent.h>
2234void seekdir(DIR *d, long loc) { return; }],[return 0;],
2235samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
2236if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
2237 AC_DEFINE(SEEKDIR_RETURNS_VOID,1,[Whether seekdir returns void])
2238fi
2239
2240AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
2241AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
2242samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
2243if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
2244 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
2245fi
2246
2247AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
2248AC_TRY_LINK([
2249#include <sys/time.h>
2250#include <unistd.h>], [struct timeval tv; return gettimeofday(&tv, NULL);],
2251 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,
2252 samba_cv_HAVE_GETTIMEOFDAY_TZ=no)])
2253if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
2254 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday takes a tz argument])
2255fi
2256
2257if test x"$samba_cv_WITH_PROFILE" = x"yes"; then
2258
2259 # On some systems (eg. Linux) librt can pull in libpthread. We
2260 # don't want this to happen because libpthreads changes signal delivery
2261 # semantics in ways we are not prepared for. This breaks Linux oplocks
2262 # which rely on signals.
2263
2264 AC_LIBTESTFUNC(rt, clock_gettime,
2265 [
2266 AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
2267 [Whether clock_gettime is available])
2268 SMB_CHECK_CLOCK_ID(CLOCK_MONOTONIC)
2269 SMB_CHECK_CLOCK_ID(CLOCK_PROCESS_CPUTIME_ID)
2270 SMB_CHECK_CLOCK_ID(CLOCK_REALTIME)
2271 ])
2272
2273fi
2274
2275AC_CACHE_CHECK([for broken readdir name],samba_cv_HAVE_BROKEN_READDIR_NAME,[
2276AC_TRY_RUN([#include <sys/types.h>
2277#include <dirent.h>
2278main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
2279if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
2280di->d_name[0] == 0) exit(0); exit(1);} ],
2281samba_cv_HAVE_BROKEN_READDIR_NAME=yes,samba_cv_HAVE_BROKEN_READDIR_NAME=no,samba_cv_HAVE_BROKEN_READDIR_NAME=cross)])
2282if test x"$samba_cv_HAVE_BROKEN_READDIR_NAME" = x"yes"; then
2283 AC_DEFINE(HAVE_BROKEN_READDIR_NAME,1,[Whether readdir() returns the wrong name offset])
2284fi
2285
2286AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
2287AC_TRY_COMPILE([#include <sys/types.h>
2288#include <utime.h>],
2289[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
2290samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
2291if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
2292 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
2293fi
2294
2295##############
2296# Check utmp details, but only if our OS offers utmp.h
2297if test x"$ac_cv_header_utmp_h" = x"yes"; then
2298dnl utmp and utmpx come in many flavours
2299dnl We need to check for many of them
2300dnl But we don't need to do each and every one, because our code uses
2301dnl mostly just the utmp (not utmpx) fields.
2302
2303AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx getutxent)
2304
2305AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
2306AC_TRY_COMPILE([#include <sys/types.h>
2307#include <utmp.h>],
2308[struct utmp ut; ut.ut_name[0] = 'a';],
2309samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
2310if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
2311 AC_DEFINE(HAVE_UT_UT_NAME,1,[Whether the utmp struct has a property ut_name])
2312fi
2313
2314AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
2315AC_TRY_COMPILE([#include <sys/types.h>
2316#include <utmp.h>],
2317[struct utmp ut; ut.ut_user[0] = 'a';],
2318samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
2319if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
2320 AC_DEFINE(HAVE_UT_UT_USER,1,[Whether the utmp struct has a property ut_user])
2321fi
2322
2323AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
2324AC_TRY_COMPILE([#include <sys/types.h>
2325#include <utmp.h>],
2326[struct utmp ut; ut.ut_id[0] = 'a';],
2327samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
2328if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
2329 AC_DEFINE(HAVE_UT_UT_ID,1,[Whether the utmp struct has a property ut_id])
2330fi
2331
2332AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
2333AC_TRY_COMPILE([#include <sys/types.h>
2334#include <utmp.h>],
2335[struct utmp ut; ut.ut_host[0] = 'a';],
2336samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
2337if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
2338 AC_DEFINE(HAVE_UT_UT_HOST,1,[Whether the utmp struct has a property ut_host])
2339fi
2340
2341AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
2342AC_TRY_COMPILE([#include <sys/types.h>
2343#include <utmp.h>],
2344[struct utmp ut; time_t t; ut.ut_time = t;],
2345samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
2346if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
2347 AC_DEFINE(HAVE_UT_UT_TIME,1,[Whether the utmp struct has a property ut_time])
2348fi
2349
2350AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
2351AC_TRY_COMPILE([#include <sys/types.h>
2352#include <utmp.h>],
2353[struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
2354samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
2355if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
2356 AC_DEFINE(HAVE_UT_UT_TV,1,[Whether the utmp struct has a property ut_tv])
2357fi
2358
2359AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
2360AC_TRY_COMPILE([#include <sys/types.h>
2361#include <utmp.h>],
2362[struct utmp ut; ut.ut_type = 0;],
2363samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
2364if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
2365 AC_DEFINE(HAVE_UT_UT_TYPE,1,[Whether the utmp struct has a property ut_type])
2366fi
2367
2368AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
2369AC_TRY_COMPILE([#include <sys/types.h>
2370#include <utmp.h>],
2371[struct utmp ut; ut.ut_pid = 0;],
2372samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
2373if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
2374 AC_DEFINE(HAVE_UT_UT_PID,1,[Whether the utmp struct has a property ut_pid])
2375fi
2376
2377AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
2378AC_TRY_COMPILE([#include <sys/types.h>
2379#include <utmp.h>],
2380[struct utmp ut; ut.ut_exit.e_exit = 0;],
2381samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
2382if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
2383 AC_DEFINE(HAVE_UT_UT_EXIT,1,[Whether the utmp struct has a property ut_exit])
2384fi
2385
2386dnl Look for the IPv6 varient by preference. Many systems have both.
2387AC_CACHE_CHECK([for ut_addr_v6 in utmp],samba_cv_HAVE_UT_UT_ADDR_V6,[
2388AC_TRY_COMPILE([#include <sys/types.h>
2389#include <utmp.h>],
2390[struct utmp ut; ut.ut_addr_v6[0] = 0;],
2391samba_cv_HAVE_UT_UT_ADDR_V6=yes,samba_cv_HAVE_UT_UT_ADDR_V6=no,samba_cv_HAVE_UT_UT_ADDR_V6=cross)])
2392if test x"$samba_cv_HAVE_UT_UT_ADDR_V6" = x"yes"; then
2393 AC_DEFINE(HAVE_UT_UT_ADDR_V6,1,[Whether the utmp struct has a property ut_addr_v6])
2394fi
2395
2396AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
2397AC_TRY_COMPILE([#include <sys/types.h>
2398#include <utmp.h>],
2399[struct utmp ut; ut.ut_addr = 0;],
2400samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
2401if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
2402 AC_DEFINE(HAVE_UT_UT_ADDR,1,[Whether the utmp struct has a property ut_addr])
2403fi
2404
2405if test x$ac_cv_func_pututline = xyes ; then
2406 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
2407 AC_TRY_COMPILE([#include <sys/types.h>
2408#include <utmp.h>],
2409 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
2410 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
2411 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
2412 AC_DEFINE(PUTUTLINE_RETURNS_UTMP,1,[Whether pututline returns pointer])
2413 fi
2414fi
2415
2416AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
2417AC_TRY_COMPILE([#include <sys/types.h>
2418#include <utmpx.h>],
2419[struct utmpx ux; ux.ut_syslen = 0;],
2420samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
2421if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
2422 AC_DEFINE(HAVE_UX_UT_SYSLEN,1,[Whether the utmpx struct has a property ut_syslen])
2423fi
2424
2425fi
2426# end utmp details
2427
2428
2429ICONV_LOOK_DIRS="/usr /usr/local /sw /opt"
2430AC_ARG_WITH(libiconv,
2431[AS_HELP_STRING([--with-libiconv=BASEDIR], [Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto)])],
2432[
2433 if test "$withval" = "no" ; then
2434 AC_MSG_ERROR([argument to --with-libiconv must be a directory])
2435 else
2436 if test "$withval" != "yes" ; then
2437 ICONV_PATH_SPEC=yes
2438 ICONV_LOOK_DIRS="$withval"
2439 fi
2440 fi
2441])
2442
2443for i in $ICONV_LOOK_DIRS ; do
2444
2445 save_LIBS="$LIBS"
2446 save_LDFLAGS="$LDFLAGS"
2447 save_CPPFLAGS="$CPPFLAGS"
2448
2449 iconv_current_LIBS=""
2450 iconv_current_LDFLAGS=""
2451 iconv_current_CPPFLAGS=""
2452
2453 ICONV_FOUND="no"
2454 unset libext
2455
2456 # This is here to handle -withval stuff for --with-libiconv
2457 # Perhaps we should always add a -L
2458 CPPFLAGS="$save_CPPFLAGS -I$i/include"
2459
2460 # Check lib and lib32 library variants to cater for IRIX ABI-specific
2461 # installation paths. This gets a little tricky since we might have iconv
2462 # in both libiconv and in libc. In this case the jm_ICONV test will always
2463 # succeed when the header is found. To counter this, make sure the
2464 # library directory is there and check the ABI directory first (which
2465 # should be harmless on other systems, but causes tons of linker warnings on
2466 # 64bit Ubuntu systems).
2467 # As the build farm doesn't seem to have any IRIX machines with iconv.h
2468 # installed, I've decided to fix the linker warnings.
2469 # -- Kai
2470 # For IA64 HPUX systems, the libs are located in lib/hpux32 instead of lib.
2471 for l in "lib" "lib32" "lib/hpux32"; do
2472 if test -d "$i/$l" ; then
2473 LDFLAGS="$save_LDFLAGS -L$i/$l"
2474 LIBS=
2475 export LDFLAGS LIBS CPPFLAGS
2476 # Try to find iconv(3)
2477 jm_ICONV($i/$l)
2478 if test x"$ICONV_FOUND" = "xyes" ; then
2479 libext="$l"
2480 break
2481 fi
2482 fi
2483 done
2484
2485 if test x"$ICONV_FOUND" = "xyes" ; then
2486 iconv_current_LDFLAGS="-L$i/$libext"
2487 iconv_current_CPPFLAGS="-I$i/include"
2488
2489 if test x"$jm_cv_lib_iconv" != x; then
2490 iconv_current_LIBS="$LIBS -l$jm_cv_lib_iconv"
2491 else
2492 # We found iconv in libc.
2493 iconv_current_LIBS=""
2494 fi
2495
2496 fi
2497
2498 if test x"$ICONV_FOUND" = "xyes" ; then
2499
2500 LDFLAGS="$save_LDFLAGS $iconv_current_LDFLAGS"
2501 CPPFLAGS="$save_CPPFLAGS $iconv_current_CPPFLAGS"
2502 LIBS="$save_LIBS $iconv_current_LIBS"
2503 export LDFLAGS LIBS CPPFLAGS
2504
2505 default_dos_charset=no
2506 default_display_charset=no
2507 default_unix_charset=no
2508
2509 # check for default dos charset name
2510 for j in CP850 IBM850 ; do
2511 rjs_CHARSET($j)
2512 default_dos_charset="$ICONV_CHARSET"
2513 if test x"$default_dos_charset" = x"$j"; then
2514 break
2515 fi
2516 done
2517
2518 # check for default display charset name
2519 for j in ASCII 646 ; do
2520 rjs_CHARSET($j)
2521 default_display_charset="$ICONV_CHARSET"
2522 if test x"$default_display_charset" = x"$j"; then
2523 break
2524 fi
2525 done
2526
2527 # check for default unix charset name
2528 for j in UTF-8 UTF8 ; do
2529 rjs_CHARSET($j)
2530 default_unix_charset="$ICONV_CHARSET"
2531 if test x"$default_unix_charset" = x"$j"; then
2532 break
2533 fi
2534 done
2535
2536 if test "$default_dos_charset" != "no" -a \
2537 "$default_dos_charset" != "cross" -a \
2538 "$default_display_charset" != "no" -a \
2539 "$default_display_charset" != "cross" -a \
2540 "$default_unix_charset" != "no" -a \
2541 "$default_unix_charset" != "cross"
2542 then
2543 samba_cv_HAVE_NATIVE_ICONV=yes
2544 else
2545 if test "$default_dos_charset" = "cross" -o \
2546 "$default_display_charset" = "cross" -o \
2547 "$default_unix_charset" = "cross"
2548 then
2549 samba_cv_HAVE_NATIVE_ICONV=cross
2550 else
2551 samba_cv_HAVE_NATIVE_ICONV=no
2552 fi
2553 fi
2554
2555 # At this point, we have a libiconv candidate. We know that
2556 # we have the right headers and libraries, but we don't know
2557 # whether it does the conversions we want. We can't test this
2558 # because we are cross-compiling. This is not necessarily a big
2559 # deal, since we can't guarantee that the results we get now will
2560 # match the results we get at runtime anyway.
2561 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"cross" ; then
2562 default_dos_charset="CP850"
2563 default_display_charset="ASCII"
2564 default_unix_charset="UTF-8"
2565 samba_cv_HAVE_NATIVE_ICONV=yes
2566 AC_MSG_WARN(assuming the libiconv in $iconv_current_LDFLAGS can convert)
2567 AC_MSG_WARN([$default_dos_charset, $default_display_charset and $default_unix_charset to UCS-16LE])
2568 fi
2569
2570 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes" ; then
2571
2572 CPPFLAGS=$save_CPPFLAGS
2573 LDFLAGS=$save_LDFLAGS
2574 LIBS=$save_LIBS
2575
2576 if test x"$iconv_current_LIBS" != x; then
2577 LIBS="$LIBS $iconv_current_LIBS"
2578 fi
2579
2580 # Add the flags we need to CPPFLAGS and LDFLAGS
2581 CPPFLAGS="$CPPFLAGS $iconv_current_CPPFLAGS"
2582 LDFLAGS="$LDFLAGS $iconv_current_LDFLAGS"
2583
2584 # Turn the #defines into string literals
2585 default_dos_charset="\"$default_dos_charset\""
2586 default_display_charset="\"$default_display_charset\""
2587 default_unix_charset="\"$default_unix_charset\""
2588
2589 AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
2590 AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,$default_dos_charset,[Default dos charset name])
2591 AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,$default_display_charset,[Default display charset name])
2592 AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,$default_unix_charset,[Default unix charset name])
2593
2594 break
2595 fi
2596
2597 # We didn't find a working iconv, so keep going
2598 fi
2599
2600 # We only need to clean these up here for the next pass through the loop
2601 CPPFLAGS=$save_CPPFLAGS
2602 LDFLAGS=$save_LDFLAGS
2603 LIBS=$save_LIBS
2604 export LDFLAGS LIBS CPPFLAGS
2605done
2606unset libext
2607
2608
2609if test x"$ICONV_FOUND" = x"no" -o x"$samba_cv_HAVE_NATIVE_ICONV" != x"yes" ; then
2610 AC_MSG_WARN([Sufficient support for iconv function was not found.
2611 Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!])
2612 AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,"ASCII",[Default dos charset name])
2613 AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,"ASCII",[Default display charset name])
2614 AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,"UTF8",[Default unix charset name])
2615fi
2616
2617
2618AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
2619AC_TRY_RUN([
2620#include <sys/types.h>
2621#include <fcntl.h>
2622#ifndef F_GETLEASE
2623#define F_GETLEASE 1025
2624#endif
2625main() {
2626 int fd = open("/dev/null", O_RDONLY);
2627 return fcntl(fd, F_GETLEASE, 0) == -1;
2628}
2629],
2630samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
2631if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
2632 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
2633fi
2634
2635AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
2636AC_TRY_RUN([
2637#include <sys/types.h>
2638#include <fcntl.h>
2639#include <signal.h>
2640#ifndef F_NOTIFY
2641#define F_NOTIFY 1026
2642#endif
2643main() {
2644 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
2645}
2646],
2647samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
2648if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
2649 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
2650fi
2651
2652AC_CACHE_CHECK([for inotify support],samba_cv_HAVE_INOTIFY,[
2653AC_CHECK_HEADERS(linux/inotify.h asm/unistd.h sys/inotify.h)
2654AC_CHECK_FUNCS(inotify_init)
2655AC_HAVE_DECL(__NR_inotify_init, [#include <asm/unistd.h>])
2656],
2657samba_cv_HAVE_INOTIFY=yes,
2658samba_cv_HAVE_INOTIFY=no,
2659samba_cv_HAVE_INOTIFY=cross)
2660
2661if test x"$ac_cv_func_inotify_init" = x"yes" -a x"$ac_cv_header_linux_inotify_h" = x"yes"; then
2662 AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel has inotify support])
2663fi
2664
2665#################################################
2666# Check if FAM notifications are available. For FAM info, see
2667# http://oss.sgi.com/projects/fam/
2668# http://savannah.nongnu.org/projects/fam/
2669AC_ARG_ENABLE(fam,
2670[AS_HELP_STRING([--enable-fam], [Turn on FAM support (default=auto)])])
2671
2672if test x$enable_fam != xno; then
2673 AC_CHECK_HEADERS(fam.h, [samba_cv_HAVE_FAM_H=yes], [samba_cv_HAVE_FAM_H=no])
2674 if test x"$samba_cv_HAVE_FAM_H" = x"yes"; then
2675 # On IRIX, libfam requires libC, but other FAM implementations
2676 # might not need it.
2677 AC_CHECK_LIB(fam, FAMOpen2,
2678 [samba_cv_HAVE_LIBFAM=yes; SMB_FAM_LIBS="-lfam"],
2679 [samba_cv_HAVE_LIBFAM=no])
2680
2681 if test x"$samba_cv_HAVE_LIBFAM" = x"no" ; then
2682 samba_fam_xtra=-lC
2683 AC_CHECK_LIB_EXT(fam, samba_fam_xtra, FAMOpen2,
2684 [samba_cv_HAVE_LIBFAM=yes; SMB_FAM_LIBS="-lfam -lC"],
2685 [samba_cv_HAVE_LIBFAM=no])
2686 unset samba_fam_xtra
2687 fi
2688 fi
2689
2690 if test x"$samba_cv_HAVE_LIBFAM" = x"yes" ; then
2691 default_shared_modules="$default_shared_modules vfs_notify_fam"
2692 AC_TRY_COMPILE([#include <fam.h>],
2693 [enum FAMCodes code = FAMChanged;],
2694 AC_DEFINE(HAVE_FAM_H_FAMCODES_TYPEDEF, 1,
2695 [Whether fam.h contains a typedef for enum FAMCodes]),
2696 [])
2697 fi
2698
2699 if test x$enable_fam = xyes && test x"$samba_cv_HAVE_LIBFAM" != xyes ; then
2700 AC_MSG_ERROR(FAM support requested but FAM library not available )
2701 fi
2702fi
2703
2704AC_SUBST(SMB_FAM_LIBS)
2705
2706#################################################
2707# Check for DMAPI interfaces in libdm/libjfsdm/libxsdm
2708
2709SMB_CHECK_DMAPI([], AC_MSG_NOTICE(DMAPI support not present) )
2710
2711# Add TSM SM VFS module only if there are both GPFS and DMAPI support
2712# Theoretically it should work with AIX JFS2 too but this needs testing
2713if test x"$ac_cv_header_gpfs_gpl_h" = x"yes" && test x"$samba_dmapi_libs" != x"" ; then
2714 default_shared_modules="$default_shared_modules vfs_tsmsm"
2715fi
2716
2717AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
2718AC_TRY_RUN([
2719#include <sys/types.h>
2720#include <fcntl.h>
2721#include <signal.h>
2722#include <sys/file.h>
2723#ifndef LOCK_MAND
2724#define LOCK_MAND 32
2725#define LOCK_READ 64
2726#endif
2727main() {
2728 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
2729}
2730],
2731samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
2732if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
2733 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
2734fi
2735
2736
2737AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
2738AC_TRY_COMPILE([#include <sys/types.h>
2739#include <fcntl.h>],
2740[oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
2741samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
2742if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
2743 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
2744fi
2745
2746#################################################
2747# Check for POSIX capability support
2748
2749AC_CHECK_HEADER(sys/capability.h, [samba_cv_HAVE_SYS_CAPABILITY_H=yes;
2750 AC_DEFINE(HAVE_SYS_CAPABILITY_H, 1, Whether sys/capability.h is present)],
2751 [], [])
2752
2753if test x"$samba_cv_HAVE_SYS_CAPABILITY_H" = x"yes"; then
2754
2755 ac_save_LIBS=$LIBS
2756 AC_LIBTESTFUNC(cap, cap_get_proc)
2757
2758 AC_CACHE_CHECK([for POSIX capabilities],
2759 samba_cv_HAVE_POSIX_CAPABILITIES,
2760 [
2761 AC_TRY_RUN([
2762#include <sys/types.h>
2763#include <sys/capability.h>
2764main() {
2765 cap_t cap;
2766 cap_value_t vals[1];
2767 if (!(cap = cap_get_proc()))
2768 exit(1);
2769 vals[0] = CAP_CHOWN;
2770 cap_set_flag(cap, CAP_INHERITABLE, 1, vals, CAP_CLEAR);
2771 cap_set_proc(cap);
2772 exit(0);
2773}],
2774 samba_cv_HAVE_POSIX_CAPABILITIES=yes,
2775 samba_cv_HAVE_POSIX_CAPABILITIES=no,
2776 samba_cv_HAVE_POSIX_CAPABILITIES=cross)
2777 ])
2778
2779if test x"$samba_cv_HAVE_POSIX_CAPABILITIES" = x"yes"; then
2780 AC_DEFINE(HAVE_POSIX_CAPABILITIES, 1,
2781 [Whether POSIX capabilities are available])
2782else
2783 LIBS=$ac_save_LIBS
2784fi
2785
2786fi
2787
2788#
2789# Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
2790# This is *really* broken but some systems (DEC OSF1) do this.... JRA.
2791#
2792
2793AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
2794AC_TRY_COMPILE([#include <sys/types.h>
2795#if defined(HAVE_RPC_RPC_H)
2796#include <rpc/rpc.h>
2797#endif],
2798[int16 testvar;],
2799samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
2800if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
2801 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H,1,[Whether int16 typedef is included by rpc/rpc.h])
2802fi
2803
2804AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
2805AC_TRY_COMPILE([#include <sys/types.h>
2806#if defined(HAVE_RPC_RPC_H)
2807#include <rpc/rpc.h>
2808#endif],
2809[uint16 testvar;],
2810samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
2811if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
2812 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H,1,[Whether uint16 typedef is included by rpc/rpc.h])
2813fi
2814
2815AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
2816AC_TRY_COMPILE([#include <sys/types.h>
2817#if defined(HAVE_RPC_RPC_H)
2818#include <rpc/rpc.h>
2819#endif],
2820[int32 testvar;],
2821samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
2822if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
2823 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H,1,[Whether int32 typedef is included by rpc/rpc.h])
2824fi
2825
2826AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
2827AC_TRY_COMPILE([#include <sys/types.h>
2828#if defined(HAVE_RPC_RPC_H)
2829#include <rpc/rpc.h>
2830#endif],
2831[uint32 testvar;],
2832samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
2833if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
2834 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H,1,[Whether uint32 typedef is included by rpc/rpc.h])
2835fi
2836
2837dnl
2838dnl Some systems (SCO) have a problem including
2839dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
2840dnl as a #define in <prot.h> and as part of an enum
2841dnl in <rpc/rpc.h>.
2842dnl
2843
2844AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
2845AC_TRY_COMPILE([#include <sys/types.h>
2846#ifdef HAVE_SYS_SECURITY_H
2847#include <sys/security.h>
2848#include <prot.h>
2849#endif /* HAVE_SYS_SECURITY_H */
2850#if defined(HAVE_RPC_RPC_H)
2851#include <rpc/rpc.h>
2852#endif],
2853[int testvar;],
2854samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
2855if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
2856 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT,1,[Whether there is a conflicting AUTH_ERROR define in rpc/rpc.h])
2857fi
2858
2859AC_MSG_CHECKING([for test routines])
2860AC_TRY_RUN([#include "${srcdir-.}/../tests/trivial.c"],
2861 AC_MSG_RESULT(yes),
2862 AC_MSG_ERROR([cant find test code. Aborting config]),
2863 AC_MSG_WARN([cannot run when cross-compiling]))
2864
2865AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
2866AC_TRY_RUN([#include "${srcdir-.}/../tests/ftruncate.c"],
2867 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
2868if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
2869 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
2870fi
2871
2872AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
2873AC_TRY_RUN([#include "${srcdir-.}/../tests/getgroups.c"],
2874 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
2875if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
2876 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
2877fi
2878
2879SMB_CHECK_SYSCONF(_SC_NGROUPS_MAX)
2880SMB_CHECK_SYSCONF(_SC_NPROC_ONLN)
2881SMB_CHECK_SYSCONF(_SC_NPROCESSORS_ONLN)
2882SMB_CHECK_SYSCONF(_SC_PAGESIZE)
2883AC_CHECK_FUNCS(getpagesize)
2884
2885################################################
2886# look for a method of setting the effective uid
2887seteuid=no;
2888
2889if test $seteuid = no; then
2890AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
2891AC_TRY_RUN([
2892#define AUTOCONF_TEST 1
2893#define USE_SETREUID 1
2894#include "confdefs.h"
2895#include "${srcdir-.}/lib/util_sec.c"],
2896 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
2897if test x"$samba_cv_USE_SETREUID" = x"yes"; then
2898 seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
2899fi
2900fi
2901
2902# we check for setresuid second as it conflicts with AIO on Linux.
2903# see http://samba.org/~tridge/junkcode/aio_uid.c
2904if test $seteuid = no; then
2905AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
2906AC_TRY_RUN([
2907#define AUTOCONF_TEST 1
2908#define USE_SETRESUID 1
2909#include "confdefs.h"
2910#include "${srcdir-.}/lib/util_sec.c"],
2911 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
2912if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
2913 seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
2914fi
2915fi
2916
2917if test $seteuid = no; then
2918AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
2919AC_TRY_RUN([
2920#define AUTOCONF_TEST 1
2921#define USE_SETEUID 1
2922#include "confdefs.h"
2923#include "${srcdir-.}/lib/util_sec.c"],
2924 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
2925if test x"$samba_cv_USE_SETEUID" = x"yes"; then
2926 seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
2927fi
2928fi
2929
2930if test $seteuid = no; then
2931AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
2932AC_TRY_RUN([
2933#define AUTOCONF_TEST 1
2934#define USE_SETUIDX 1
2935#include "confdefs.h"
2936#include "${srcdir-.}/lib/util_sec.c"],
2937 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
2938if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
2939 seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
2940fi
2941fi
2942
2943AC_CACHE_CHECK([for the Darwin initgroups system call],
2944 samba_cv_DARWIN_INITGROUPS,
2945 AC_TRY_LINK([
2946#include <sys/syscall.h>
2947#include <unistd.h>
2948 ],
2949 [ syscall(SYS_initgroups, 16, NULL, NULL, 0); ],
2950 samba_cv_DARWIN_INITGROUPS=yes,
2951 samba_cv_DARWIN_INITGROUPS=no)
2952)
2953
2954if test x"$samba_cv_DARWIN_INITGROUPS" = x"yes" ; then
2955 AC_DEFINE(HAVE_DARWIN_INITGROUPS, 1,
2956 [Whether to use the Darwin-specific initgroups system call])
2957fi
2958
2959AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
2960AC_TRY_RUN([#include "${srcdir-.}/../tests/fcntl_lock.c"],
2961 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
2962if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
2963 AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available])
2964fi
2965
2966AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
2967AC_TRY_RUN([#include "${srcdir-.}/../tests/fcntl_lock64.c"],
2968 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
2969if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
2970 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken])
2971
2972else
2973
2974dnl
2975dnl Don't check for 64 bit fcntl locking if we know that the
2976dnl glibc2.1 broken check has succeeded.
2977dnl
2978
2979 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
2980 AC_TRY_RUN([
2981#if defined(HAVE_UNISTD_H)
2982#include <unistd.h>
2983#endif
2984#include <stdio.h>
2985#include <stdlib.h>
2986
2987#ifdef HAVE_FCNTL_H
2988#include <fcntl.h>
2989#endif
2990
2991#ifdef HAVE_SYS_FCNTL_H
2992#include <sys/fcntl.h>
2993#endif
2994main() { struct flock64 fl64;
2995#if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
2996exit(0);
2997#else
2998exit(1);
2999#endif
3000}],
3001 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
3002
3003 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
3004 AC_DEFINE(HAVE_STRUCT_FLOCK64,1,[Whether the flock64 struct is available])
3005 fi
3006fi
3007
3008# glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
3009AC_CACHE_CHECK([for broken posix_fallocate],samba_cv_HAVE_BROKEN_POSIX_FALLOCATE,[
3010AC_TRY_COMPILE([
3011 #define _XOPEN_SOURCE 600
3012 #include <stdlib.h>
3013 #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
3014 probably broken posix_fallocate
3015 #endif
3016], [
3017],
3018samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=no,samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=yes)])
3019if test x"$samba_cv_HAVE_BROKEN_POSIX_FALLOCATE" = xyes; then
3020 AC_DEFINE(HAVE_BROKEN_POSIX_FALLOCATE,, Whether we have a broken posix_fallocate)
3021fi
3022
3023
3024AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
3025AC_TRY_COMPILE([#include <sys/types.h>
3026#include <sys/stat.h>
3027#include <unistd.h>],
3028[struct stat st; st.st_blocks = 0;],
3029samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
3030if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
3031 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
3032fi
3033
3034AC_CHECK_TYPES([blksize_t, blkcnt_t], [], [], [[#include <sys/stat.h>]])
3035
3036AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
3037AC_TRY_COMPILE([#include <sys/types.h>
3038#include <sys/stat.h>
3039#include <unistd.h>],
3040[struct stat st; st.st_blksize = 0;],
3041samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
3042if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
3043 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
3044fi
3045
3046AC_CACHE_CHECK([for st_flags in struct stat],
3047 samba_cv_HAVE_STAT_ST_FLAGS,
3048 [
3049 AC_TRY_COMPILE([#include <sys/types.h>
3050#include <sys/stat.h>
3051#include <unistd.h>],
3052 [struct stat st; st.st_flags = 0;],
3053 samba_cv_HAVE_STAT_ST_FLAGS=yes,
3054 samba_cv_HAVE_STAT_ST_FLAGS=no,
3055 samba_cv_HAVE_STAT_ST_FLAGS=cross)
3056 ])
3057
3058if test x"$samba_cv_HAVE_STAT_ST_FLAGS" = x"yes"; then
3059 AC_DEFINE(HAVE_STAT_ST_FLAGS, 1,
3060 [Whether the stat struct has a st_flags member])
3061fi
3062
3063AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
3064AC_TRY_COMPILE([
3065#include <sys/types.h>
3066#include <sys/acl.h>
3067#if defined(HAVE_RPCSVC_NIS_H)
3068#include <rpcsvc/nis.h>
3069#endif],
3070[int i;],
3071samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
3072if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
3073 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken])
3074fi
3075
3076AC_CACHE_CHECK([if the realpath function allows a NULL argument],samba_cv_REALPATH_TAKES_NULL,[
3077AC_TRY_RUN([
3078#include <stdio.h>
3079#include <limits.h>
3080#include <signal.h>
3081
3082void exit_on_core(int ignored) {
3083 exit(1);
3084}
3085
3086main() {
3087 char *newpath;
3088 signal(SIGSEGV, exit_on_core);
3089 newpath = realpath("/tmp", NULL);
3090 exit((newpath != NULL) ? 0 : 1);
3091}
3092],
3093samba_cv_REALPATH_TAKES_NULL=yes,samba_cv_REALPATH_TAKES_NULL=no,samba_cv_REALPATH_TAKES_NULL=cross)])
3094if test x"$samba_cv_REALPATH_TAKES_NULL" = x"yes"; then
3095 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])
3096fi
3097
3098#################################################
3099# check for AFS clear-text auth support
3100samba_cv_WITH_AFS=no
3101AC_MSG_CHECKING(whether to use AFS clear-text auth)
3102AC_ARG_WITH(afs,
3103[AS_HELP_STRING([--with-afs], [Include AFS clear-text auth support (default=no)])],
3104[ case "$withval" in
3105 yes|auto)
3106 AC_MSG_RESULT($withval)
3107 samba_cv_WITH_AFS=$withval
3108 ;;
3109 *)
3110 AC_MSG_RESULT(no)
3111 ;;
3112 esac ],
3113 AC_MSG_RESULT(no)
3114)
3115
3116####################################################
3117# check for Linux-specific AFS fake-kaserver support
3118samba_cv_WITH_FAKE_KASERVER=no
3119AC_MSG_CHECKING(whether to use AFS fake-kaserver)
3120AC_ARG_WITH(fake-kaserver,
3121[AS_HELP_STRING([--with-fake-kaserver], [Include AFS fake-kaserver support (default=no)])],
3122[ case "$withval" in
3123 yes|auto)
3124 AC_MSG_RESULT($withval)
3125 samba_cv_WITH_FAKE_KASERVER=$withval
3126 ;;
3127 *)
3128 AC_MSG_RESULT(no)
3129 ;;
3130 esac ],
3131 AC_MSG_RESULT(no)
3132)
3133
3134#################################################
3135# decide whether we can support WITH_AFS and / or WITH_FAKE_KASERVER
3136if test x"$samba_cv_WITH_AFS" != x"no" ||
3137 test x"$samba_cv_WITH_FAKE_KASERVER" != x"no"; then
3138
3139 # see if this box has the OpenSSL DES libraries
3140 AC_CHECK_LIB( crypto, DES_pcbc_encrypt, LIBS="$LIBS -lcrypto" , [AC_ERROR(OpenSSL library: libcrypto ot found!)] )
3141
3142 # see if this box has the afs-headers in /usr/include/afs
3143 AC_MSG_CHECKING(for /usr/include/afs)
3144 if test -d /usr/include/afs; then
3145 AC_MSG_RESULT(yes)
3146 else
3147 AC_MSG_RESULT(no)
3148 fi
3149
3150 # check for afs.h
3151 have_afs_headers=no
3152 AC_CHECK_HEADERS(afs.h afs/afs.h)
3153 if test x"$ac_cv_header_afs_h" = x"no" && test x"$ac_cv_header_afs_afs_h" = x"no"; then
3154 if test x"$samba_cv_WITH_FAKE_KASERVER" = x"auto" ||
3155 test x"$samba_cv_WITH_AFS" = x"auto"; then
3156 AC_MSG_WARN([AFS cannot be supported without afs.h])
3157 else
3158 AC_MSG_ERROR([AFS cannot be supported without afs.h])
3159 fi
3160 else
3161 have_afs_headers=yes
3162 fi
3163fi
3164
3165FAKE_KASERVER_OBJ=""
3166if test x"$samba_cv_WITH_FAKE_KASERVER" != x"no" && test x"$have_afs_headers" = x"yes"; then
3167 AC_DEFINE(WITH_FAKE_KASERVER,1,[Whether to include AFS fake-kaserver support])
3168 FAKE_KASERVER_OBJ="utils/net_afs.o"
3169fi
3170AC_SUBST(FAKE_KASERVER_OBJ)
3171
3172#################################################
3173# check whether to compile AFS/NT ACL mapping module
3174samba_cv_WITH_VFS_AFSACL=no
3175AC_MSG_CHECKING(whether to use AFS ACL mapping module)
3176AC_ARG_WITH(vfs-afsacl,
3177[AS_HELP_STRING([--with-vfs-afsacl], [Include AFS to NT ACL mapping module (default=no)])],
3178[ case "$withval" in
3179 yes|auto)
3180 AC_MSG_RESULT($withval)
3181 samba_cv_WITH_VFS_AFSACL=yes
3182 ;;
3183 *)
3184 AC_MSG_RESULT(no)
3185 ;;
3186 esac ],
3187 AC_MSG_RESULT(no)
3188)
3189
3190if test x"$samba_cv_WITH_VFS_AFSACL" = x"yes"; then
3191 default_shared_modules="$default_shared_modules vfs_afsacl"
3192fi
3193
3194if test x"$samba_cv_WITH_AFS" != x"no" && test x"$have_afs_headers" = x"yes"; then
3195 AC_DEFINE(WITH_AFS,1,[Whether to include AFS clear-text auth support])
3196fi
3197
3198#################################################
3199# check for the DFS clear-text auth system
3200AC_MSG_CHECKING(whether to use DFS clear-text auth)
3201AC_ARG_WITH(dfs,
3202[AS_HELP_STRING([--with-dce-dfs], [Include DCE/DFS clear-text auth support (default=no)])],
3203[ case "$withval" in
3204 yes)
3205 AC_MSG_RESULT(yes)
3206 AC_DEFINE(WITH_DFS,1,[Whether to include DFS support])
3207 ;;
3208 *)
3209 AC_MSG_RESULT(no)
3210 ;;
3211 esac ],
3212 AC_MSG_RESULT(no)
3213)
3214
3215########################################################
3216# Compile with LDAP support?
3217
3218with_ldap_support=auto
3219AC_MSG_CHECKING([for LDAP support])
3220
3221AC_ARG_WITH(ldap,
3222[AS_HELP_STRING([--with-ldap], [LDAP support (default yes)])],
3223[ case "$withval" in
3224 yes|no)
3225 with_ldap_support=$withval
3226 ;;
3227 esac ])
3228
3229AC_MSG_RESULT($with_ldap_support)
3230
3231SMBLDAP=""
3232AC_SUBST(SMBLDAP)
3233SMBLDAPUTIL=""
3234AC_SUBST(SMBLDAPUTIL)
3235LDBLDAP=""
3236AC_SUBST(LDBLDAP)
3237
3238if test x"$with_ldap_support" != x"no"; then
3239
3240 ##################################################################
3241 # first test for ldap.h and lber.h
3242 # (ldap.h is required for this test)
3243 AC_CHECK_HEADERS(ldap.h lber.h)
3244
3245 if test x"$ac_cv_header_ldap_h" != x"yes"; then
3246 if test x"$with_ldap_support" = x"yes"; then
3247 AC_MSG_ERROR(ldap.h is needed for LDAP support)
3248 else
3249 AC_MSG_WARN(ldap.h is needed for LDAP support)
3250 fi
3251
3252 with_ldap_support=no
3253 fi
3254
3255 ##################################################################
3256 # HP/UX does not have ber_tag_t in lber.h - it must be configured as
3257 # unsigned int in include/includes.h
3258 case $host_os in
3259 *hpux*)
3260 AC_MSG_WARN(ber_tag_t is needed for LDAP support)
3261 AC_MSG_WARN(ber_tag_t must be configured in includes.h for hpux)
3262 with_ldap_support=yes
3263 ;;
3264 *)
3265 AC_CHECK_TYPE(ber_tag_t,,,[#include <lber.h>])
3266 if test x"$ac_cv_type_ber_tag_t" != x"yes"; then
3267 if test x"$with_ldap_support" = x"yes"; then
3268 AC_MSG_ERROR(ber_tag_t is needed for LDAP support)
3269 else
3270 AC_MSG_WARN(ber_tag_t is needed for LDAP support)
3271 fi
3272 with_ldap_support=no
3273 fi
3274 ;;
3275 esac
3276fi
3277
3278if test x"$with_ldap_support" != x"no"; then
3279 ac_save_LIBS=$LIBS
3280
3281 ##################################################################
3282 # we might need the lber lib on some systems. To avoid link errors
3283 # this test must be before the libldap test
3284 AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf)
3285
3286 ########################################################
3287 # If ber_sockbuf_add_io() is available we can add
3288 # SASL wrapping hooks
3289 AC_CHECK_FUNC_EXT(ber_sockbuf_add_io,$LDAP_LIBS)
3290
3291 AC_CACHE_CHECK([for LDAP_OPT_SOCKBUF],samba_cv_HAVE_LDAP_OPT_SOCKBUF,[
3292 AC_TRY_COMPILE([#include <ldap.h>],
3293 [int val = LDAP_OPT_SOCKBUF;],
3294 samba_cv_HAVE_LDAP_OPT_SOCKBUF=yes,
3295 samba_cv_HAVE_LDAP_OPT_SOCKBUF=no)])
3296
3297 if test x"$ac_cv_func_ext_ber_sockbuf_add_io" = x"yes" -a \
3298 x"$samba_cv_HAVE_LDAP_OPT_SOCKBUF" = x"yes"; then
3299 AC_DEFINE(HAVE_LDAP_SASL_WRAPPING, 1, [Support for SASL wrapping])
3300 fi
3301
3302 #######################################################
3303 # if we have LBER_OPT_LOG_PRINT_FN, we can intercept
3304 # ldap logging and print it out in the samba logs
3305 AC_CACHE_CHECK([for LBER_OPT_LOG_PRINT_FN],
3306 samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN,
3307 [AC_TRY_COMPILE([#include <lber.h>],
3308 [int val = LBER_OPT_LOG_PRINT_FN;],
3309 samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN=yes,
3310 samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN=no)])
3311
3312 if test x"$samba_cv_HAVE_LBER_OPT_LOG_PRINT_FN" = x"yes"; then
3313 AC_DEFINE(HAVE_LBER_LOG_PRINT_FN, 1,
3314 [Support for LDAP/LBER logging interception])
3315 fi
3316
3317 ########################################################
3318 # now see if we can find the ldap libs in standard paths
3319 AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
3320
3321 ########################################################
3322 # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
3323 # Check found in pam_ldap 145.
3324 AC_CHECK_FUNC_EXT(ldap_set_rebind_proc,$LDAP_LIBS)
3325
3326 LIBS="$LIBS $LDAP_LIBS"
3327 AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [
3328 AC_TRY_COMPILE([
3329 #include <lber.h>
3330 #include <ldap.h>],
3331 [ldap_set_rebind_proc(0, 0, 0);],
3332 [smb_ldap_cv_ldap_set_rebind_proc=3],
3333 [smb_ldap_cv_ldap_set_rebind_proc=2]
3334 )
3335 ])
3336
3337 AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
3338
3339 AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
3340
3341 if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes"; then
3342 AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
3343 CPPFLAGS="$CPPFLAGS -DLDAP_DEPRECATED"
3344 default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
3345 default_shared_modules="$default_shared_modules";
3346 SMBLDAP="lib/smbldap.o"
3347 SMBLDAPUTIL="lib/smbldap_util.o"
3348 with_ldap_support=yes
3349 AC_MSG_CHECKING(whether LDAP support is used)
3350 AC_MSG_RESULT(yes)
3351 else
3352 if test x"$with_ldap_support" = x"yes"; then
3353 AC_MSG_ERROR(libldap is needed for LDAP support)
3354 else
3355 AC_MSG_WARN(libldap is needed for LDAP support)
3356 fi
3357
3358 LDAP_LIBS=""
3359 with_ldap_support=no
3360 fi
3361 LIBS=$ac_save_LIBS
3362fi
3363
3364
3365#################################################
3366# active directory support
3367
3368with_ads_support=auto
3369AC_MSG_CHECKING([for Active Directory and krb5 support])
3370
3371AC_ARG_WITH(ads,
3372[AS_HELP_STRING([--with-ads], [Active Directory support (default auto)])],
3373[ case "$withval" in
3374 yes|no)
3375 with_ads_support="$withval"
3376 ;;
3377 esac ])
3378
3379AC_MSG_RESULT($with_ads_support)
3380
3381FOUND_KRB5=no
3382KRB5_LIBS=""
3383
3384if test x"$with_ldap_support" != x"yes"; then
3385
3386 if test x"$with_ads_support" = x"yes"; then
3387 AC_MSG_ERROR(Active Directory Support requires LDAP support)
3388 elif test x"$with_ads_support" = x"auto"; then
3389 AC_MSG_WARN(Disabling Active Directory support (requires LDAP support))
3390 with_ads_support=no
3391 fi
3392
3393else
3394
3395 # Check to see whether there is enough LDAP functionality to be able
3396 # to build AD support.
3397
3398# HPUX only has ldap_init; ok, we take care of this in smbldap.c
3399case "$host_os" in
3400 *hpux*)
3401 AC_CHECK_FUNC_EXT(ldap_init,$LDAP_LIBS)
3402
3403 if test x"$ac_cv_func_ext_ldap_init" != x"yes"; then
3404 if test x"$with_ads_support" = x"yes"; then
3405 AC_MSG_ERROR(Active Directory support on HPUX requires ldap_init)
3406 elif test x"$with_ads_support" = x"auto"; then
3407 AC_MSG_WARN(Disabling Active Directory support (requires ldap_init on HPUX))
3408 with_ads_support=no
3409 fi
3410 fi
3411 ;;
3412 *)
3413 AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
3414
3415 if test x"$ac_cv_func_ext_ldap_initialize" != x"yes"; then
3416 if test x"$with_ads_support" = x"yes"; then
3417 AC_MSG_ERROR(Active Directory support requires ldap_initialize)
3418 elif test x"$with_ads_support" = x"auto"; then
3419 AC_MSG_WARN(Disabling Active Directory support (requires ldap_initialize))
3420 with_ads_support=no
3421 fi
3422 fi
3423 ;;
3424esac
3425
3426
3427 AC_CHECK_FUNC_EXT(ldap_add_result_entry,$LDAP_LIBS)
3428
3429 if test x"$ac_cv_func_ext_ldap_add_result_entry" != x"yes"; then
3430 if test x"$with_ads_support" = x"yes"; then
3431 AC_MSG_ERROR(Active Directory support requires ldap_add_result_entry)
3432 elif test x"$with_ads_support" = x"auto"; then
3433 AC_MSG_WARN(Disabling Active Directory support (requires ldap_add_result_entry))
3434 with_ads_support=no
3435 fi
3436 fi
3437
3438fi
3439
3440if test x"$with_ads_support" != x"no"; then
3441
3442 # Do no harm to the values of CFLAGS and LIBS while testing for
3443 # Kerberos support.
3444
3445 if test x$FOUND_KRB5 = x"no"; then
3446 #################################################
3447 # check for location of Kerberos 5 install
3448 AC_MSG_CHECKING(for kerberos 5 install path)
3449 AC_ARG_WITH(krb5,
3450 [AS_HELP_STRING([--with-krb5=base-dir], [Locate Kerberos 5 support (default=/usr)])],
3451 [ case "$withval" in
3452 no)
3453 AC_MSG_RESULT(no krb5-path given)
3454 ;;
3455 yes)
3456 AC_MSG_RESULT(/usr)
3457 FOUND_KRB5=yes
3458 ;;
3459 *)
3460 AC_MSG_RESULT($withval)
3461 KRB5_CFLAGS="-I$withval/include"
3462 KRB5_CPPFLAGS="-I$withval/include"
3463 KRB5_LDFLAGS="-L$withval/lib"
3464 FOUND_KRB5=yes
3465 if test -x "$withval/bin/krb5-config"; then
3466 KRB5CONFIG=$withval/bin/krb5-config
3467 fi
3468 ;;
3469 esac ],
3470 AC_MSG_RESULT(no krb5-path given)
3471 )
3472 fi
3473
3474 #################################################
3475 # check for krb5-config from recent MIT and Heimdal kerberos 5
3476 AC_PATH_PROG(KRB5CONFIG, krb5-config)
3477 AC_MSG_CHECKING(for working krb5-config)
3478 if test -x "$KRB5CONFIG" && $KRB5CONFIG --libs gssapi > /dev/null ; then
3479 ac_save_CFLAGS=$CFLAGS
3480 CFLAGS="";export CFLAGS
3481 ac_save_LDFLAGS=$LDFLAGS
3482 LDFLAGS="";export LDFLAGS
3483 KRB5_LIBS="`$KRB5CONFIG --libs gssapi`"
3484 KRB5_LDFLAGS="`$KRB5CONFIG --libs gssapi | sed s/-lgss.*//`"
3485 KRB5_CFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
3486 KRB5_CPPFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
3487 CFLAGS=$ac_save_CFLAGS;export CFLAGS
3488 LDFLAGS=$ac_save_LDFLAGS;export LDFLAGS
3489 FOUND_KRB5=yes
3490 AC_MSG_RESULT(yes)
3491 else
3492 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
3493 fi
3494
3495 if test x$FOUND_KRB5 = x"no"; then
3496 #################################################
3497 # see if this box has the SuSE location for the heimdal krb implementation
3498 AC_MSG_CHECKING(for /usr/include/heimdal)
3499 if test -d /usr/include/heimdal; then
3500 if test -f /usr/lib/heimdal/lib/libkrb5.a; then
3501 KRB5_CFLAGS="-I/usr/include/heimdal"
3502 KRB5_CPPFLAGS="-I/usr/include/heimdal"
3503 KRB5_LDFLAGS="-L/usr/lib/heimdal/lib"
3504 FOUND_KRB5=yes
3505 AC_MSG_RESULT(yes)
3506 else
3507 KRB5_CFLAGS="-I/usr/include/heimdal"
3508 KRB5_CPPFLAGS="-I/usr/include/heimdal"
3509 FOUND_KRB5=yes
3510 AC_MSG_RESULT(yes)
3511 fi
3512 else
3513 AC_MSG_RESULT(no)
3514 fi
3515 fi
3516
3517 if test x$FOUND_KRB5 = x"no"; then
3518 #################################################
3519 # see if this box has the RedHat location for kerberos
3520 AC_MSG_CHECKING(for /usr/kerberos)
3521 if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
3522 KRB5_LDFLAGS="-L/usr/kerberos/lib"
3523 KRB5_CFLAGS="-I/usr/kerberos/include"
3524 KRB5_CPPFLAGS="-I/usr/kerberos/include"
3525 FOUND_KRB5=yes
3526 AC_MSG_RESULT(yes)
3527 else
3528 AC_MSG_RESULT(no)
3529 fi
3530 fi
3531
3532 if test x$FOUND_KRB5 = x"no"; then
3533 #################################################
3534 # see if this box has the OpenBSD location for heimdal krb5
3535 AC_MSG_CHECKING(for /usr/include/kerberosV)
3536 if test -d /usr/include/kerberosV; then
3537 KRB5_CPPFLAGS="-I/usr/include/kerberosV"
3538 KRB5_LIBS="-lcrypto"
3539 FOUND_KRB5=yes
3540 AC_MSG_RESULT(yes)
3541 else
3542 AC_MSG_RESULT(no)
3543 fi
3544 fi
3545
3546 ac_save_CFLAGS=$CFLAGS
3547 ac_save_CPPFLAGS=$CPPFLAGS
3548 ac_save_LDFLAGS=$LDFLAGS
3549
3550 # remove needless evil rpath stuff as early as possible:
3551 LIB_REMOVE_USR_LIB(KRB5_LIBS)
3552 LIB_REMOVE_USR_LIB(KRB5_LDFLAGS)
3553 CFLAGS="$KRB5_CFLAGS $CFLAGS"
3554 CPPFLAGS="$KRB5_CPPFLAGS $CPPFLAGS"
3555 LDFLAGS="$KRB5_LDFLAGS $LDFLAGS"
3556
3557 KRB5_LIBS="$KRB5_LDFLAGS $KRB5_LIBS"
3558
3559 # now check for krb5.h. Some systems have the libraries without the headers!
3560 # note that this check is done here to allow for different kerberos
3561 # include paths
3562 AC_CHECK_HEADERS(krb5.h)
3563
3564 if test x"$ac_cv_header_krb5_h" = x"no"; then
3565
3566 # Give a warning if AD support was not explicitly requested,
3567 # i.e with_ads_support = auto, otherwise die with an error.
3568
3569 if test x"$with_ads_support" = x"yes"; then
3570 AC_MSG_ERROR([Active Directory cannot be supported without krb5.h])
3571 else
3572 AC_MSG_WARN([Active Directory cannot be supported without krb5.h])
3573 fi
3574
3575 # Turn off AD support and restore CFLAGS and LIBS variables
3576
3577 with_ads_support="no"
3578
3579 CFLAGS=$ac_save_CFLAGS
3580 CPPFLAGS=$ac_save_CPPFLAGS
3581 LDFLAGS=$ac_save_LDFLAGS
3582 fi
3583 AC_CHECK_HEADERS([krb5/locate_plugin.h], [], [],
3584[[#ifdef HAVE_KRB5_H
3585 #include <krb5.h>
3586 #endif
3587]])
3588
3589 if test x"$ac_cv_header_krb5_locate_plugin_h" = x"yes"; then
3590 WINBIND_KRB5_LOCATOR="bin/winbind_krb5_locator.$SHLIBEXT"
3591 if test x"$BLDSHARED" = x"true" ; then
3592 EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS $WINBIND_KRB5_LOCATOR"
3593 fi
3594 fi
3595
3596 # check for new heimdal KRB5_DEPRECATED handling
3597
3598 AC_CACHE_CHECK([for KRB5_DEPRECATED define taking an identifier],
3599 samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER,[
3600 AC_TRY_COMPILE(
3601 [#define KRB5_DEPRECATED 1
3602 #include <krb5.h>],
3603 [],
3604 samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER=yes,
3605 samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER=no)])
3606
3607 if test x"$samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER" = x"yes"; then
3608 AC_DEFINE(HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER, 1,
3609 [Whether to use deprecated krb5 interfaces])
3610 fi
3611fi
3612
3613# Now we have determined whether we really want ADS support
3614use_ads=no
3615if test x"$with_ads_support" != x"no"; then
3616 use_ads=yes
3617 have_gssapi=no
3618 ac_save_LIBS=$LIBS
3619
3620 # now check for gssapi headers. This is also done here to allow for
3621 # different kerberos include paths
3622 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h)
3623
3624 ##################################################################
3625 # we might need the k5crypto and com_err libraries on some systems
3626 AC_CHECK_LIB_EXT(com_err, KRB5_LIBS, _et_list)
3627 AC_CHECK_LIB_EXT(k5crypto, KRB5_LIBS, krb5_encrypt_data)
3628
3629 # Heimdal checks.
3630 AC_CHECK_LIB_EXT(crypto, KRB5_LIBS, des_set_key)
3631 AC_CHECK_LIB_EXT(asn1, KRB5_LIBS, copy_Authenticator)
3632 AC_CHECK_LIB_EXT(roken, KRB5_LIBS, roken_getaddrinfo_hostspec)
3633
3634 # Heimdal checks. On static Heimdal gssapi must be linked before krb5.
3635 AC_CHECK_LIB_EXT(gssapi, KRB5_LIBS, gss_display_status,[],[],have_gssapi=yes)
3636
3637 ########################################################
3638 # now see if we can find the krb5 libs in standard paths
3639 # or as specified above
3640 AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_mk_req_extended)
3641 AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_kt_compare)
3642
3643 ########################################################
3644 # now see if we can find the gssapi libs in standard paths
3645 if test x"$have_gssapi" != x"yes"; then
3646 AC_CHECK_LIB_EXT(gssapi_krb5, KRB5_LIBS,gss_display_status,[],[],have_gssapi=yes)
3647 fi
3648
3649 AC_CHECK_FUNC_EXT(krb5_set_real_time, $KRB5_LIBS)
3650 AC_CHECK_FUNC_EXT(krb5_set_default_in_tkt_etypes, $KRB5_LIBS)
3651 AC_CHECK_FUNC_EXT(krb5_set_default_tgs_enctypes, $KRB5_LIBS)
3652 AC_CHECK_FUNC_EXT(krb5_set_default_tgs_ktypes, $KRB5_LIBS)
3653 AC_CHECK_FUNC_EXT(krb5_principal2salt, $KRB5_LIBS)
3654 AC_CHECK_FUNC_EXT(krb5_use_enctype, $KRB5_LIBS)
3655 AC_CHECK_FUNC_EXT(krb5_string_to_key, $KRB5_LIBS)
3656 AC_CHECK_FUNC_EXT(krb5_get_pw_salt, $KRB5_LIBS)
3657 AC_CHECK_FUNC_EXT(krb5_string_to_key_salt, $KRB5_LIBS)
3658 AC_CHECK_FUNC_EXT(krb5_auth_con_setkey, $KRB5_LIBS)
3659 AC_CHECK_FUNC_EXT(krb5_auth_con_setuseruserkey, $KRB5_LIBS)
3660 AC_CHECK_FUNC_EXT(krb5_locate_kdc, $KRB5_LIBS)
3661 AC_CHECK_FUNC_EXT(krb5_get_permitted_enctypes, $KRB5_LIBS)
3662 AC_CHECK_FUNC_EXT(krb5_get_default_in_tkt_etypes, $KRB5_LIBS)
3663 AC_CHECK_FUNC_EXT(krb5_free_data_contents, $KRB5_LIBS)
3664 AC_CHECK_FUNC_EXT(krb5_principal_get_comp_string, $KRB5_LIBS)
3665 AC_CHECK_FUNC_EXT(krb5_free_unparsed_name, $KRB5_LIBS)
3666 AC_CHECK_FUNC_EXT(krb5_free_keytab_entry_contents, $KRB5_LIBS)
3667 AC_CHECK_FUNC_EXT(krb5_kt_free_entry, $KRB5_LIBS)
3668 AC_CHECK_FUNC_EXT(krb5_krbhst_init, $KRB5_LIBS)
3669 AC_CHECK_FUNC_EXT(krb5_krbhst_get_addrinfo, $KRB5_LIBS)
3670 AC_CHECK_FUNC_EXT(krb5_c_enctype_compare, $KRB5_LIBS)
3671 AC_CHECK_FUNC_EXT(krb5_enctypes_compatible_keys, $KRB5_LIBS)
3672 AC_CHECK_FUNC_EXT(krb5_crypto_init, $KRB5_LIBS)
3673 AC_CHECK_FUNC_EXT(krb5_crypto_destroy, $KRB5_LIBS)
3674 AC_CHECK_FUNC_EXT(krb5_decode_ap_req, $KRB5_LIBS)
3675 AC_CHECK_FUNC_EXT(free_AP_REQ, $KRB5_LIBS)
3676 AC_CHECK_FUNC_EXT(krb5_verify_checksum, $KRB5_LIBS)
3677 AC_CHECK_FUNC_EXT(krb5_c_verify_checksum, $KRB5_LIBS)
3678 AC_CHECK_FUNC_EXT(krb5_principal_compare_any_realm, $KRB5_LIBS)
3679 AC_CHECK_FUNC_EXT(krb5_parse_name_norealm, $KRB5_LIBS)
3680 AC_CHECK_FUNC_EXT(krb5_princ_size, $KRB5_LIBS)
3681 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_set_pac_request, $KRB5_LIBS)
3682 AC_CHECK_FUNC_EXT(krb5_get_renewed_creds, $KRB5_LIBS)
3683 AC_CHECK_FUNC_EXT(krb5_get_kdc_cred, $KRB5_LIBS)
3684 AC_CHECK_FUNC_EXT(krb5_free_error_contents, $KRB5_LIBS)
3685 AC_CHECK_FUNC_EXT(initialize_krb5_error_table, $KRB5_LIBS)
3686 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_alloc, $KRB5_LIBS)
3687 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_free, $KRB5_LIBS)
3688 AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_get_error, $KRB5_LIBS)
3689 AC_CHECK_FUNC_EXT(krb5_enctype_to_string, $KRB5_LIBS)
3690 AC_CHECK_FUNC_EXT(krb5_fwd_tgt_creds, $KRB5_LIBS)
3691 AC_CHECK_FUNC_EXT(krb5_auth_con_set_req_cksumtype, $KRB5_LIBS)
3692 AC_CHECK_FUNC_EXT(krb5_get_creds_opt_alloc, $KRB5_LIBS)
3693 AC_CHECK_FUNC_EXT(krb5_get_creds_opt_set_impersonate, $KRB5_LIBS)
3694 AC_CHECK_FUNC_EXT(krb5_get_creds, $KRB5_LIBS)
3695 AC_CHECK_FUNC_EXT(krb5_get_credentials_for_user, $KRB5_LIBS)
3696 AC_CHECK_FUNC_EXT(krb5_get_host_realm, $KRB5_LIBS)
3697 AC_CHECK_FUNC_EXT(krb5_free_host_realm, $KRB5_LIBS)
3698
3699 # MIT krb5 1.8 does not expose this call (yet)
3700 AC_CHECK_DECLS(krb5_get_credentials_for_user, [], [], [#include <krb5.h>])
3701
3702 # MIT krb5 1.7beta3 (in Ubuntu Karmic) does not have this declaration
3703 # but does have the symbol
3704 AC_CHECK_DECLS(krb5_auth_con_set_req_cksumtype, [], [], [#include <krb5.h>])
3705
3706 LIBS="$KRB5_LIBS $LIBS"
3707
3708 AC_CACHE_CHECK(whether krb5_ticket contains kvno and enctype,
3709 smb_krb5_cv_ticket_has_keyinfo,
3710 [
3711 AC_TRY_COMPILE(
3712 [
3713 #include <krb5.h>
3714 ],
3715 [
3716 krb5_ticket ticket;
3717 krb5_kvno kvno;
3718 krb5_enctype enctype;
3719
3720 enctype = ticket.enc_part.enctype;
3721 kvno = ticket.enc_part.kvno;
3722 ],
3723 [ smb_krb5_cv_ticket_has_keyinfo=yes ],
3724 [ smb_krb5_cv_ticket_has_keyinfo=no ])
3725 ])
3726
3727 if test x"$smb_krb5_cv_ticket_has_keyinfo" = x"yes" ; then
3728 AC_DEFINE(KRB5_TICKET_HAS_KEYINFO, 1,
3729 [Whether the krb5_ticket structure contains the kvno and enctype])
3730 fi
3731
3732 AC_CACHE_CHECK(whether krb5_get_init_creds_opt_free takes a context argument,
3733 smb_krb5_cv_creds_opt_free_context,
3734 [
3735 AC_TRY_COMPILE([
3736 #include <krb5.h>],
3737 [
3738 krb5_context ctx;
3739 krb5_get_init_creds_opt *opt = NULL;
3740 krb5_get_init_creds_opt_free(ctx, opt);
3741 ],
3742 [smb_krb5_cv_creds_opt_free_context=yes],
3743 [smb_krb5_cv_creds_opt_free_context=no]
3744 )
3745 ])
3746
3747 if test x"$smb_krb5_cv_creds_opt_free_context" = x"yes" ; then
3748 AC_DEFINE(KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT, 1,
3749 [Whether krb5_get_init_creds_opt_free takes a context argument])
3750 fi
3751
3752 AC_CACHE_CHECK(whether krb5_verify_checksum takes 7 arguments, smb_krb5_cv_verify_checksum, [
3753 AC_TRY_COMPILE([
3754 #include <krb5.h>],
3755 [krb5_verify_checksum(0, 0, 0, 0, 0, 0, 0);],
3756 [smb_krb5_cv_verify_checksum=7],
3757 [smb_krb5_cv_verify_checksum=6],
3758 )
3759 ])
3760 AC_DEFINE_UNQUOTED(KRB5_VERIFY_CHECKSUM_ARGS, $smb_krb5_cv_verify_checksum, [Number of arguments to krb5_verify_checksum])
3761
3762 AC_CACHE_CHECK([for checksum in krb5_checksum],
3763 samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM,[
3764 AC_TRY_COMPILE([#include <krb5.h>],
3765 [krb5_checksum cksum; cksum.checksum.length = 0;],
3766 samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM=yes,
3767 samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM=no)])
3768
3769 if test x"$samba_cv_HAVE_CHECKSUM_IN_KRB5_CHECKSUM" = x"yes"; then
3770 AC_DEFINE(HAVE_CHECKSUM_IN_KRB5_CHECKSUM,1,
3771 [Whether the krb5_checksum struct has a checksum property])
3772 fi
3773
3774 AC_CACHE_CHECK([for etype in EncryptedData],
3775 samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA,[
3776 AC_TRY_COMPILE([#include <krb5.h>],
3777 [EncryptedData edata; edata.etype = 0;],
3778 samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA=yes,
3779 samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA=no)])
3780
3781 if test x"$samba_cv_HAVE_ETYPE_IN_ENCRYPTEDDATA" = x"yes"; then
3782 AC_DEFINE(HAVE_ETYPE_IN_ENCRYPTEDDATA,1,
3783 [Whether the EncryptedData struct has a etype property])
3784 fi
3785
3786 AC_CACHE_CHECK([for ticket pointer in krb5_ap_req],
3787 samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ,[
3788 AC_TRY_COMPILE([#include <krb5.h>],
3789 [krb5_ap_req *ap_req; ap_req->ticket = NULL;],
3790 samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ=yes,
3791 samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ=no)])
3792
3793 if test x"$samba_cv_HAVE_TICKET_POINTER_IN_KRB5_AP_REQ" = x"yes"; then
3794 AC_DEFINE(HAVE_TICKET_POINTER_IN_KRB5_AP_REQ,1,
3795 [Whether the krb5_ap_req struct has a ticket pointer])
3796 fi
3797
3798 AC_CACHE_CHECK([for e_data pointer in krb5_error],
3799 samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR,[
3800 AC_TRY_COMPILE([#include <krb5.h>],
3801 [krb5_error err; err.e_data = NULL;],
3802 samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR=yes,
3803 samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR=no)])
3804
3805 if test x"$samba_cv_HAVE_E_DATA_POINTER_IN_KRB5_ERROR" = x"yes"; then
3806 AC_DEFINE(HAVE_E_DATA_POINTER_IN_KRB5_ERROR,1,
3807 [Whether the krb5_error struct has a e_data pointer])
3808 fi
3809
3810 AC_CACHE_CHECK([for krb5_crypto type],
3811 samba_cv_HAVE_KRB5_CRYPTO,[
3812 AC_TRY_COMPILE([#include <krb5.h>],
3813 [krb5_crypto crypto;],
3814 samba_cv_HAVE_KRB5_CRYPTO=yes,
3815 samba_cv_HAVE_KRB5_CRYPTO=no)])
3816
3817 if test x"$samba_cv_HAVE_KRB5_CRYPTO" = x"yes"; then
3818 AC_DEFINE(HAVE_KRB5_CRYPTO,1,
3819 [Whether the type krb5_crypto exists])
3820 fi
3821
3822 AC_CACHE_CHECK([for krb5_encrypt_block type],
3823 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK,[
3824 AC_TRY_COMPILE([#include <krb5.h>],
3825 [krb5_encrypt_block block;],
3826 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK=yes,
3827 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK=no)])
3828
3829 if test x"$samba_cv_HAVE_KRB5_ENCRYPT_BLOCK" = x"yes"; then
3830 AC_DEFINE(HAVE_KRB5_ENCRYPT_BLOCK,1,
3831 [Whether the type krb5_encrypt_block exists])
3832 fi
3833
3834 AC_CACHE_CHECK([for addrtype in krb5_address],
3835 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS,[
3836 AC_TRY_COMPILE([#include <krb5.h>],
3837 [krb5_address kaddr; kaddr.addrtype = ADDRTYPE_INET;],
3838 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=yes,
3839 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=no)])
3840
3841 if test x"$samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS" = x"yes"; then
3842 AC_DEFINE(HAVE_ADDRTYPE_IN_KRB5_ADDRESS,1,
3843 [Whether the krb5_address struct has a addrtype property])
3844 fi
3845
3846 AC_CACHE_CHECK([for addr_type in krb5_address],
3847 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,[
3848 AC_TRY_COMPILE([#include <krb5.h>],
3849 [krb5_address kaddr; kaddr.addr_type = KRB5_ADDRESS_INET;],
3850 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=yes,
3851 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=no)])
3852
3853 if test x"$samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS" = x"yes"; then
3854 AC_DEFINE(HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,1,
3855 [Whether the krb5_address struct has a addr_type property])
3856 fi
3857
3858 AC_CACHE_CHECK([for enc_part2 in krb5_ticket],
3859 samba_cv_HAVE_KRB5_TKT_ENC_PART2,
3860 [AC_TRY_COMPILE([#include <krb5.h>],
3861 [krb5_ticket tkt; tkt.enc_part2->authorization_data[0]->contents = NULL;],
3862 samba_cv_HAVE_KRB5_TKT_ENC_PART2=yes,samba_cv_HAVE_KRB5_TKT_ENC_PART2=no)])
3863
3864 if test x"$samba_cv_HAVE_KRB5_TKT_ENC_PART2" = x"yes"; then
3865 AC_DEFINE(HAVE_KRB5_TKT_ENC_PART2,1,
3866 [Whether the krb5_ticket struct has a enc_part2 property])
3867 fi
3868
3869 AC_CACHE_CHECK([for keyblock in krb5_creds],
3870 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS,[
3871 AC_TRY_COMPILE([#include <krb5.h>],
3872 [krb5_creds creds; krb5_keyblock kb; creds.keyblock = kb;],
3873 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS=yes,
3874 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS=no)])
3875
3876 if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS" = x"yes"; then
3877 AC_DEFINE(HAVE_KRB5_KEYBLOCK_IN_CREDS,1,
3878 [Whether the krb5_creds struct has a keyblock property])
3879 fi
3880
3881 AC_CACHE_CHECK([for session in krb5_creds],
3882 samba_cv_HAVE_KRB5_SESSION_IN_CREDS,[
3883 AC_TRY_COMPILE([#include <krb5.h>],
3884 [krb5_creds creds; krb5_keyblock kb; creds.session = kb;],
3885 samba_cv_HAVE_KRB5_SESSION_IN_CREDS=yes,
3886 samba_cv_HAVE_KRB5_SESSION_IN_CREDS=no)])
3887
3888 if test x"$samba_cv_HAVE_KRB5_SESSION_IN_CREDS" = x"yes"; then
3889 AC_DEFINE(HAVE_KRB5_SESSION_IN_CREDS,1,
3890 [Whether the krb5_creds struct has a session property])
3891 fi
3892
3893 AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
3894 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE,[
3895 AC_TRY_COMPILE([#include <krb5.h>],
3896 [krb5_keyblock key; key.keyvalue.data = NULL;],
3897 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=yes,
3898 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=no)])
3899
3900 if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE" = x"yes"; then
3901 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
3902 [Whether the krb5_keyblock struct has a keyvalue property])
3903 fi
3904
3905 AC_CACHE_CHECK([for ENCTYPE_ARCFOUR_HMAC_MD5],
3906 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,[
3907 AC_TRY_COMPILE([#include <krb5.h>],
3908 [krb5_enctype enctype; enctype = ENCTYPE_ARCFOUR_HMAC_MD5;],
3909 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=yes,
3910 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=no)])
3911 AC_CACHE_CHECK([for KEYTYPE_ARCFOUR_56],
3912 samba_cv_HAVE_KEYTYPE_ARCFOUR_56,[
3913 AC_TRY_COMPILE([#include <krb5.h>],
3914 [krb5_keytype keytype; keytype = KEYTYPE_ARCFOUR_56;],
3915 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=yes,
3916 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=no)])
3917# Heimdals with KEYTYPE_ARCFOUR but not KEYTYPE_ARCFOUR_56 are broken
3918# w.r.t. arcfour and windows, so we must not enable it here
3919 if test x"$samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5" = x"yes" -a\
3920 x"$samba_cv_HAVE_KEYTYPE_ARCFOUR_56" = x"yes"; then
3921 AC_DEFINE(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,1,
3922 [Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type is available])
3923 fi
3924
3925 AC_CACHE_CHECK([for AP_OPTS_USE_SUBKEY],
3926 samba_cv_HAVE_AP_OPTS_USE_SUBKEY,[
3927 AC_TRY_COMPILE([#include <krb5.h>],
3928 [krb5_flags ap_options; ap_options = AP_OPTS_USE_SUBKEY;],
3929 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=yes,
3930 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=no)])
3931
3932 if test x"$samba_cv_HAVE_AP_OPTS_USE_SUBKEY" = x"yes"; then
3933 AC_DEFINE(HAVE_AP_OPTS_USE_SUBKEY,1,
3934 [Whether the AP_OPTS_USE_SUBKEY ap option is available])
3935 fi
3936
3937 AC_CACHE_CHECK([for KV5M_KEYTAB],
3938 samba_cv_HAVE_KV5M_KEYTAB,[
3939 AC_TRY_COMPILE([#include <krb5.h>],
3940 [krb5_keytab_entry entry; entry.magic = KV5M_KEYTAB;],
3941 samba_cv_HAVE_KV5M_KEYTAB=yes,
3942 samba_cv_HAVE_KV5M_KEYTAB=no)])
3943
3944 if test x"$samba_cv_HAVE_KV5M_KEYTAB" = x"yes"; then
3945 AC_DEFINE(HAVE_KV5M_KEYTAB,1,
3946 [Whether the KV5M_KEYTAB option is available])
3947 fi
3948
3949 AC_CACHE_CHECK([for KRB5_KU_OTHER_CKSUM],
3950 samba_cv_HAVE_KRB5_KU_OTHER_CKSUM,[
3951 AC_TRY_COMPILE([#include <krb5.h>],
3952 [krb5_keyusage usage = KRB5_KU_OTHER_CKSUM;],
3953 samba_cv_HAVE_KRB5_KU_OTHER_CKSUM=yes,
3954 samba_cv_HAVE_KRB5_KU_OTHER_CKSUM=no)])
3955
3956 if test x"$samba_cv_HAVE_KRB5_KU_OTHER_CKSUM" = x"yes"; then
3957 AC_DEFINE(HAVE_KRB5_KU_OTHER_CKSUM,1,
3958 [Whether KRB5_KU_OTHER_CKSUM is available])
3959 fi
3960
3961 AC_CACHE_CHECK([for KRB5_KEYUSAGE_APP_DATA_CKSUM],
3962 samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM,[
3963 AC_TRY_COMPILE([#include <krb5.h>],
3964 [krb5_keyusage usage = KRB5_KEYUSAGE_APP_DATA_CKSUM;],
3965 samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM=yes,
3966 samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM=no)])
3967
3968 if test x"$samba_cv_HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM" = x"yes"; then
3969 AC_DEFINE(HAVE_KRB5_KEYUSAGE_APP_DATA_CKSUM,1,
3970 [Whether KRB5_KEYUSAGE_APP_DATA_CKSUM is available])
3971 fi
3972
3973 AC_CACHE_CHECK([for the krb5_princ_component macro],
3974 samba_cv_HAVE_KRB5_PRINC_COMPONENT,[
3975 AC_TRY_LINK([#include <krb5.h>],
3976 [const krb5_data *pkdata; krb5_context context; krb5_principal principal; pkdata = krb5_princ_component(context, principal, 0);],
3977 samba_cv_HAVE_KRB5_PRINC_COMPONENT=yes,
3978 samba_cv_HAVE_KRB5_PRINC_COMPONENT=no)])
3979
3980 if test x"$samba_cv_HAVE_KRB5_PRINC_COMPONENT" = x"yes"; then
3981 AC_DEFINE(HAVE_KRB5_PRINC_COMPONENT,1,
3982 [Whether krb5_princ_component is available])
3983 fi
3984
3985 AC_CACHE_CHECK([for key in krb5_keytab_entry],
3986 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY,[
3987 AC_TRY_COMPILE([#include <krb5.h>],
3988 [krb5_keytab_entry entry; krb5_keyblock e; entry.key = e;],
3989 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=yes,
3990 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=no)])
3991
3992 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY" = x"yes"; then
3993 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEY,1,
3994 [Whether krb5_keytab_entry has key member])
3995 fi
3996
3997 AC_CACHE_CHECK([for keyblock in krb5_keytab_entry],
3998 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,[
3999 AC_TRY_COMPILE([#include <krb5.h>],
4000 [krb5_keytab_entry entry; entry.keyblock.keytype = 0;],
4001 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=yes,
4002 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=no)])
4003
4004 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK" = x"yes"; then
4005 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,1,
4006 [Whether krb5_keytab_entry has keyblock member])
4007 fi
4008
4009 AC_CACHE_CHECK([for magic in krb5_address],
4010 samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS,[
4011 AC_TRY_COMPILE([#include <krb5.h>],
4012 [krb5_address addr; addr.magic = 0;],
4013 samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS=yes,
4014 samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS=no)])
4015
4016 if test x"$samba_cv_HAVE_MAGIC_IN_KRB5_ADDRESS" = x"yes"; then
4017 AC_DEFINE(HAVE_MAGIC_IN_KRB5_ADDRESS,1,
4018 [Whether the krb5_address struct has a magic property])
4019 fi
4020
4021 AC_CACHE_CHECK([for WRFILE: keytab support],
4022 samba_cv_HAVE_WRFILE_KEYTAB,[
4023 AC_TRY_RUN([
4024#include<krb5.h>
4025 main()
4026 {
4027 krb5_context context;
4028 krb5_keytab keytab;
4029
4030 krb5_init_context(&context);
4031 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
4032 }],
4033 samba_cv_HAVE_WRFILE_KEYTAB=yes,
4034 samba_cv_HAVE_WRFILE_KEYTAB=no)])
4035
4036 if test x"$samba_cv_HAVE_WRFILE_KEYTAB" = x"yes"; then
4037 AC_DEFINE(HAVE_WRFILE_KEYTAB,1,
4038 [Whether the WRFILE:-keytab is supported])
4039 fi
4040
4041 AC_CACHE_CHECK([for krb5_realm type],
4042 samba_cv_HAVE_KRB5_REALM_TYPE,[
4043 AC_TRY_COMPILE([#include <krb5.h>],
4044 [krb5_realm realm;],
4045 samba_cv_HAVE_KRB5_REALM_TYPE=yes,
4046 samba_cv_HAVE_KRB5_REALM_TYPE=no)])
4047
4048 if test x"$samba_cv_HAVE_KRB5_REALM_TYPE" = x"yes"; then
4049 AC_DEFINE(HAVE_KRB5_REALM_TYPE,1,
4050 [Whether the type krb5_realm exists])
4051 fi
4052
4053 AC_CACHE_CHECK([for krb5_princ_realm returns krb5_realm or krb5_data],
4054 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM,[
4055 AC_TRY_COMPILE([#include <krb5.h>],
4056 [
4057 krb5_context context;
4058 krb5_principal principal;
4059 krb5_realm realm; realm = *krb5_princ_realm(context, principal);],
4060 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM=yes,
4061 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM=no)])
4062
4063 if test x"$samba_cv_KRB5_PRINC_REALM_RETURNS_REALM" = x"yes"; then
4064 AC_DEFINE(KRB5_PRINC_REALM_RETURNS_REALM,1,
4065 [Whether krb5_princ_realm returns krb5_realm or krb5_data])
4066 fi
4067
4068 AC_CACHE_CHECK([for krb5_addresses type],
4069 samba_cv_HAVE_KRB5_ADDRESSES,[
4070 AC_TRY_COMPILE([#include <krb5.h>],
4071 [krb5_addresses addr;],
4072 samba_cv_HAVE_KRB5_ADDRESSES=yes,
4073 samba_cv_HAVE_KRB5_ADDRESSES=no)])
4074
4075 if test x"$samba_cv_HAVE_KRB5_ADDRESSES" = x"yes"; then
4076 AC_DEFINE(HAVE_KRB5_ADDRESSES,1,
4077 [Whether the type krb5_addresses type exists])
4078 fi
4079
4080 AC_CACHE_CHECK([whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal],
4081 samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE, [
4082 AC_TRY_COMPILE([#include <krb5.h>],
4083 [
4084 krb5_mk_error(0,0,0);],
4085 samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE=yes,
4086 samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE=no)])
4087
4088 if test x"$samba_cv_HAVE_SHORT_KRB5_MK_ERROR_INTERFACE" = x"yes"; then
4089 AC_DEFINE(HAVE_SHORT_KRB5_MK_ERROR_INTERFACE,1,
4090 [whether krb5_mk_error takes 3 arguments MIT or 9 Heimdal])
4091 fi
4092
4093 if test x"$ac_cv_func_ext_krb5_enctype_to_string" = x"yes"; then
4094 AC_CACHE_CHECK([for krb5_error_code krb5_enctype_to_string(krb5_context context, krb5_enctype enctype, char **str)],
4095 smb_krb5_cv_enctype_to_string_takes_krb5_context_arg,[
4096 AC_TRY_RUN_STRICT([
4097 #include <stdlib.h>
4098 #include <krb5.h>
4099 int main(void) {
4100 krb5_context context = NULL;
4101 char *str = NULL;
4102 krb5_enctype_to_string(context, 1, &str);
4103 if (str) free (str);
4104 return 0;
4105 }
4106 ],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4107 smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=yes,
4108 smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=no)])
4109
4110 if test x"$smb_krb5_cv_enctype_to_string_takes_krb5_context_arg" = x"yes"; then
4111 AC_DEFINE(HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG,1,
4112 [whether krb5_enctype_to_string takes krb5_context argument])
4113 fi
4114
4115 AC_CACHE_CHECK([for krb5_error_code krb5_enctype_to_string(krb5_enctype enctype, char *str, size_t len)],
4116 smb_krb5_cv_enctype_to_string_takes_size_t_arg,[
4117 AC_TRY_RUN_STRICT([
4118 #include <krb5.h>
4119 int main(void) {
4120 char buf[256];
4121 krb5_enctype_to_string(1, buf, 256);
4122 return 0;
4123 }
4124 ],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4125 smb_krb5_cv_enctype_to_string_takes_size_t_arg=yes,
4126 smb_krb5_cv_enctype_to_string_takes_size_t_arg=no)])
4127
4128 if test x"$smb_krb5_cv_enctype_to_string_takes_size_t_arg" = x"yes"; then
4129 AC_DEFINE(HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG,1,
4130 [whether krb5_enctype_to_string takes size_t argument])
4131 fi
4132 fi
4133
4134 AC_CACHE_CHECK([for krb5_principal_get_realm],
4135 samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM,[
4136 AC_TRY_LINK([#include <krb5.h>],
4137 [krb5_context ctx = NULL; krb5_principal princ = NULL; const char *str = krb5_principal_get_realm(ctx, princ);],
4138 samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM=yes,
4139 samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM=no)])
4140
4141 if test x"$samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM" = x"yes"; then
4142 AC_DEFINE(HAVE_KRB5_PRINCIPAL_GET_REALM,1,
4143 [Whether the function krb5_principal_get_realm is defined])
4144 fi
4145
4146 AC_CACHE_CHECK([for krb5_princ_realm],
4147 samba_cv_HAVE_KRB5_PRINC_REALM,[
4148 AC_TRY_LINK([#include <krb5.h>],
4149 [krb5_context ctx = NULL; krb5_principal princ = NULL; const char *str = krb5_princ_realm(ctx, princ)->data;],
4150 samba_cv_HAVE_KRB5_PRINC_REALM=yes,
4151 samba_cv_HAVE_KRB5_PRINC_REALM=no)])
4152
4153 if test x"$samba_cv_HAVE_KRB5_PRINC_REALM" = x"yes"; then
4154 AC_DEFINE(HAVE_KRB5_PRINC_REALM,1,
4155 [Whether the macro krb5_princ_realm is defined])
4156 fi
4157
4158 #
4159 #
4160 # Now the decisions whether we can support krb5
4161 #
4162 # NOTE: all tests should be done before this block!
4163 #
4164 #
4165 if test x"$ac_cv_lib_ext_krb5_krb5_mk_req_extended" != x"yes"; then
4166 AC_MSG_WARN(krb5_mk_req_extended not found in -lkrb5)
4167 use_ads=no
4168 fi
4169
4170 if test x"$ac_cv_func_ext_krb5_principal2salt" != x"yes" -a \
4171 x"$ac_cv_func_ext_krb5_get_pw_salt" != x"yes"
4172 then
4173 AC_MSG_WARN(no CREATE_KEY_FUNCTIONS detected)
4174 use_ads=no
4175 fi
4176
4177 if test x"$ac_cv_func_ext_krb5_get_permitted_enctypes" != x"yes" -a \
4178 x"$ac_cv_func_ext_krb5_get_default_in_tkt_etypes" != x"yes"
4179 then
4180 AC_MSG_WARN(no GET_ENCTYPES_FUNCTIONS detected)
4181 use_ads=no
4182 fi
4183
4184 if test x"$ac_cv_func_ext_krb5_kt_free_entry" != x"yes" -a \
4185 x"$ac_cv_func_ext_krb5_free_keytab_entry_contents" != x"yes"
4186 then
4187 AC_MSG_WARN(no KT_FREE_FUNCTION detected)
4188 use_ads=no
4189 fi
4190
4191 if test x"$ac_cv_func_ext_krb5_c_verify_checksum" != x"yes" -a \
4192 x"$ac_cv_func_ext_krb5_verify_checksum" != x"yes"
4193 then
4194 AC_MSG_WARN(no KRB5_VERIFY_CHECKSUM_FUNCTION detected)
4195 use_ads=no
4196 fi
4197
4198 if test x"$smb_krb5_cv_ticket_has_keyinfo" != x"yes" ; then
4199
4200 # We only need the following functions if we can't get the enctype
4201 # and kvno out of the ticket directly (ie. on Heimdal).
4202
4203 if test x"$ac_cv_func_ext_free_AP_REQ" != x"yes"
4204 then
4205 AC_MSG_WARN(no KRB5_AP_REQ_FREE_FUNCTION detected)
4206 use_ads=no
4207 fi
4208
4209 if test x"$ac_cv_func_ext_krb5_decode_ap_req" != x"yes"
4210 then
4211 AC_MSG_WARN(no KRB5_AP_REQ_DECODING_FUNCTION detected)
4212 use_ads=no
4213 fi
4214
4215 fi
4216
4217 if test x"$use_ads" = x"yes"; then
4218 AC_DEFINE(WITH_ADS,1,[Whether to include Active Directory support])
4219 AC_DEFINE(HAVE_KRB5,1,[Whether to have KRB5 support])
4220 if test x"$have_gssapi" = x"yes"; then
4221 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available])
4222 fi
4223 else
4224 if test x"$with_ads_support" = x"yes"; then
4225 AC_MSG_ERROR(krb5 libs don't have all features required for Active Directory support)
4226 else
4227 AC_MSG_WARN(krb5 libs don't have all features required for Active Directory support)
4228 fi
4229 AC_REMOVE_DEFINE(HAVE_KRB5_H)
4230 AC_REMOVE_DEFINE(HAVE_GSSAPI_H)
4231 AC_REMOVE_DEFINE(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4232 AC_REMOVE_DEFINE(HAVE_GSSAPI_GSSAPI_H)
4233 KRB5_LIBS=""
4234 with_ads_support=no
4235 fi
4236 AC_MSG_CHECKING(whether Active Directory and krb5 support is used)
4237 AC_MSG_RESULT([$use_ads])
4238
4239LIBS="$ac_save_LIBS"
4240fi
4241
4242if test x"$use_ads" != xyes; then
4243 merged_build_possible=no
4244fi
4245
4246AC_CHECK_LIB_EXT(nscd, NSCD_LIBS, nscd_flush_cache)
4247PASSDB_LIBS="$PASSDB_LIBS $NSCD_LIBS"
4248
4249
4250########################################################
4251# Compile with DNS Updates support?
4252
4253with_dnsupdate_support=no
4254AC_MSG_CHECKING([whether to enable DNS Updates support])
4255
4256AC_ARG_WITH(dnsupdate,
4257[AS_HELP_STRING([--with-dnsupdate], [Enable DNS Updates support (default no)])],
4258[ case "$withval" in
4259 yes|no)
4260 with_dnsupdate_support=$withval
4261 ;;
4262 esac ])
4263
4264AC_MSG_RESULT($with_dnsupdate_support)
4265
4266if test x"$with_dnsupdate_support" != x"no"; then
4267
4268 ################################################################
4269 # first test for Active Directory support being enabled
4270 #if test x"$with_ads_support" = x"no"; then
4271 # AC_MSG_ERROR(Active Directory support is required to enable DNS Update support)
4272 # with_dnsupdate_support=no
4273 #fi
4274 ##################################################################
4275 # then test for uuid.h (necessary to generate unique DNS keynames
4276 # (uuid.h is required for this test)
4277 AC_CHECK_HEADERS(uuid/uuid.h)
4278
4279 if test x"$ac_cv_header_uuid_uuid_h" != x"yes"; then
4280 if test x"$with_dnsupdate_support" = x"yes"; then
4281 AC_MSG_ERROR(uuid.h is needed to enable DNS Updates support)
4282 else
4283 AC_MSG_WARN(uuid.h is needed to enable DNS Updates support)
4284 fi
4285 with_dnsupdate_support=no
4286 fi
4287fi
4288
4289if test x"$with_dnsupdate_support" != x"no"; then
4290
4291 ########################################################
4292 # Now see if we can find the uuid libs in standard paths
4293 # On some systems, the uuid API is in libc, so we have to
4294 # be careful not to insert a spurious -luuid.
4295
4296 UUID_LIBS=""
4297 AC_LIBTESTFUNC(uuid, uuid_generate,
4298 [
4299 case " $LIBS " in
4300 *\ -luuid\ *)
4301 UUID_LIBS="-luuid"
4302 SMB_REMOVE_LIB(uuid)
4303 ;;
4304 esac
4305
4306 with_dnsupdate_support=yes
4307 AC_DEFINE(WITH_DNS_UPDATES,1,[Whether to enable DNS Update support])
4308 ],
4309 [
4310 if test x"$with_dnsupdate_support" = x"yes"; then
4311 AC_MSG_ERROR(libuuid is needed to enable DNS Updates support)
4312 else
4313 AC_MSG_WARN(libuuid is needed to enable DNS Updates support)
4314 fi
4315 with_dnsupdate_support=no
4316 ])
4317fi
4318
4319#################################################
4320# check for automount support
4321AC_MSG_CHECKING(whether to use automount)
4322AC_ARG_WITH(automount,
4323[AS_HELP_STRING([--with-automount], [Include automount support (default=no)])],
4324[ case "$withval" in
4325 yes)
4326 AC_MSG_RESULT(yes)
4327 AC_DEFINE(WITH_AUTOMOUNT,1,[Whether to include automount support])
4328 ;;
4329 *)
4330 AC_MSG_RESULT(no)
4331 ;;
4332 esac ],
4333 AC_MSG_RESULT(no)
4334)
4335
4336#################################################
4337# check for mount- and umount.cifs support
4338CIFSMOUNT_PROGS=""
4339INSTALL_CIFSMOUNT=""
4340UNINSTALL_CIFSMOUNT=""
4341AC_MSG_CHECKING(whether to build mount.cifs)
4342AC_ARG_WITH(cifsmount,
4343[AS_HELP_STRING([--with-cifsmount], [Include mount.cifs (Linux only) support (default=yes)])],
4344[ case "$withval" in
4345 no)
4346 AC_MSG_RESULT(no)
4347 ;;
4348 *)
4349 case "$host_os" in
4350 *linux*)
4351 AC_MSG_RESULT(yes)
4352 AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs])
4353 CIFSMOUNT_PROGS="bin/mount.cifs"
4354 INSTALL_CIFSMOUNT="installcifsmount"
4355 UNINSTALL_CIFSMOUNT="uninstallcifsmount"
4356 ;;
4357 *)
4358 AC_MSG_ERROR(not on a linux system!)
4359 ;;
4360 esac
4361 ;;
4362 esac ],
4363[ case "$host_os" in
4364 *linux*)
4365 AC_MSG_RESULT(yes)
4366 AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs])
4367 CIFSMOUNT_PROGS="bin/mount.cifs"
4368 INSTALL_CIFSMOUNT="installcifsmount"
4369 UNINSTALL_CIFSMOUNT="uninstallcifsmount"
4370 ;;
4371 *)
4372 AC_MSG_RESULT(no)
4373 ;;
4374 esac ]
4375)
4376
4377CIFSUMOUNT_PROGS=""
4378INSTALL_CIFSUMOUNT=""
4379UNINSTALL_CIFSUMOUNT=""
4380AC_MSG_CHECKING(whether to build umount.cifs)
4381AC_ARG_WITH(cifsumount,
4382[AS_HELP_STRING([--with-cifsumount], [Include umount.cifs (Linux only) support (default=no)])],
4383[ case "$withval" in
4384 yes)
4385 case "$host_os" in
4386 *linux*)
4387 AC_MSG_RESULT(yes)
4388 AC_DEFINE(WITH_CIFSUMOUNT,1,[Whether to build umount.cifs])
4389 CIFSUMOUNT_PROGS="bin/umount.cifs"
4390 INSTALL_CIFSUMOUNT="installcifsumount"
4391 UNINSTALL_CIFSUMOUNT="uninstallcifsumount"
4392 ;;
4393 *)
4394 AC_MSG_ERROR(not on a linux system!)
4395 ;;
4396 esac
4397 ;;
4398 *)
4399 AC_MSG_RESULT(no)
4400 ;;
4401 esac ],
4402 AC_MSG_RESULT(no)
4403)
4404
4405#################################################
4406# check for cifs.upcall support
4407AC_CHECK_HEADERS([keyutils.h], [HAVE_KEYUTILS_H=1], [HAVE_KEYUTILS_H=0])
4408CIFSUPCALL_PROGS=""
4409INSTALL_CIFSUPCALL=""
4410UNINSTALL_CIFSUPCALL=""
4411AC_MSG_CHECKING(whether to build cifs.upcall)
4412AC_ARG_WITH(cifsupcall,
4413[AS_HELP_STRING([--with-cifsupcall], [Include cifs.upcall (Linux only) support (default=yes)])],
4414[ case "$withval" in
4415 no)
4416 AC_MSG_RESULT(no)
4417 ;;
4418 *)
4419 case "$host_os" in
4420 *linux*)
4421 if test x"$use_ads" != x"yes"; then
4422 AC_MSG_ERROR(ADS support should be enabled for building cifs.upcall)
4423 elif test x"$HAVE_KEYUTILS_H" != "x1"; then
4424 AC_MSG_ERROR(keyutils package is required for cifs.upcall)
4425 else
4426 AC_MSG_RESULT(yes)
4427 AC_DEFINE(WITH_CIFSUPCALL,1,[whether to build cifs.upcall])
4428 CIFSUPCALL_PROGS="bin/cifs.upcall"
4429 INSTALL_CIFSUPCALL="installcifsupcall"
4430 UNINSTALL_CIFSUPCALL="uninstallcifsupcall"
4431 fi
4432 ;;
4433 *)
4434 AC_MSG_ERROR(not on a linux system!)
4435 ;;
4436 esac
4437 ;;
4438 esac ],
4439[ case "$host_os" in
4440 *linux*)
4441 if test x"$use_ads" != x"yes"; then
4442 AC_MSG_WARN(ADS support should be enabled for building cifs.upcall)
4443 elif test x"$HAVE_KEYUTILS_H" != "x1"; then
4444 AC_MSG_WARN(keyutils package is required for cifs.upcall)
4445 else
4446 AC_MSG_RESULT(yes)
4447 AC_DEFINE(WITH_CIFSUPCALL,1,[whether to build cifs.upcall])
4448 CIFSUPCALL_PROGS="bin/cifs.upcall"
4449 INSTALL_CIFSUPCALL="installcifsupcall"
4450 UNINSTALL_CIFSUPCALL="uninstallcifsupcall"
4451 fi
4452 ;;
4453 *)
4454 AC_MSG_RESULT(no)
4455 ;;
4456 esac ]
4457)
4458
4459
4460#################################################
4461# Check for a PAM clear-text auth, accounts, password
4462# and session support. Most PAM implementations keep their
4463# headers in /usr/include/security. Darwin keeps its in
4464# /usr/include/pam.
4465
4466with_pam_for_crypt=no
4467try_pam=auto
4468AC_MSG_CHECKING(whether to try PAM support)
4469AC_ARG_WITH(pam,
4470[AS_HELP_STRING([--with-pam], [Include PAM support (default=auto)])],
4471[ case "$withval" in
4472 yes|no|auto)
4473 try_pam=$withval
4474 ;;
4475 esac
4476])
4477AC_MSG_RESULT([$try_pam])
4478
4479use_pam=no
4480create_pam_modules=no
4481if test x"${try_pam}" != x"no";then
4482 use_pam=yes
4483 create_pam_modules=yes
4484
4485 # Most systems have PAM headers in /usr/include/security, but Darwin
4486 # has them in /usr/include/pam.
4487 AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
4488 if test x"$ac_cv_header_security_pam_appl_h" != x"yes" -a \
4489 x"$ac_cv_header_pam_pam_appl_h" != x"yes"; then
4490 if test x"${try_pam}" = x"yes";then
4491 AC_MSG_ERROR([--with-pam=yes but pam_appl.h not found])
4492 fi
4493 use_pam=no
4494 create_pam_modules=no
4495 fi
4496
4497 AC_CHECK_LIB_EXT(pam, PAM_LIBS, pam_get_data)
4498 if test x"$ac_cv_lib_ext_pam_pam_get_data" != x"yes"; then
4499 if test x"${try_pam}" = x"yes";then
4500 AC_MSG_ERROR([--with-pam=yes but libpam not found])
4501 fi
4502 use_pam=no
4503 create_pam_modules=no
4504 fi
4505
4506 AC_CHECK_HEADERS(security/pam_modules.h pam/pam_modules.h,,,[[
4507 #if HAVE_SECURITY_PAM_APPL_H
4508 #include <security/pam_appl.h>
4509 #endif
4510 #if HAVE_PAM_PAM_APPL_H
4511 #include <pam/pam_appl.h>
4512 #endif
4513 ]])
4514 if test x"$ac_cv_header_security_pam_modules_h" = x"no" -a \
4515 x"$ac_cv_header_pam_pam_modules_h" = x"no" ; then
4516 if test x"${try_pam}" = x"yes";then
4517 AC_MSG_ERROR([--with-pam=yes but pam_modules.h not found])
4518 fi
4519 create_pam_modules=no
4520 fi
4521
4522 if test x"$use_pam" = x"yes"; then
4523 AC_DEFINE(WITH_PAM,1,[Whether to include PAM support])
4524 AC_DEFINE(HAVE_LIBPAM,1,[Whether libpam is available])
4525 AUTH_LIBS="$AUTH_LIBS $PAM_LIBS"
4526 with_pam_for_crypt=yes
4527
4528 if test x"$create_pam_modules" = x"yes"; then
4529 AC_DEFINE(WITH_PAM_MODULES,1,[Whether to include PAM MODULES support])
4530 # this checks are optional,
4531 # we don't care about the results here
4532 AC_CHECK_HEADERS(security/pam_ext.h security/_pam_macros.h)
4533 AC_CHECK_HEADERS(pam/pam_ext.h pam/_pam_macros.h)
4534 AC_CHECK_FUNC_EXT(pam_vsyslog,$PAM_LIBS)
4535 else
4536 AC_MSG_WARN([PAM support detected but PAM MODULES support is missing])
4537 fi
4538 fi
4539 AC_MSG_CHECKING(whether to use PAM support)
4540 AC_MSG_RESULT([$use_pam])
4541
4542 AC_MSG_CHECKING(whether to have PAM MODULES support)
4543 AC_MSG_RESULT([$create_pam_modules])
4544fi # try_pam != no
4545
4546#################################################
4547# check for PAM_RADIO_TYPE
4548AC_TRY_COMPILE([
4549#if (!defined(LINUX))
4550
4551#define PAM_EXTERN extern
4552#if defined(HAVE_SECURITY_PAM_APPL_H)
4553#include <security/pam_appl.h>
4554#elif defined(HAVE_PAM_PAM_APPL_H)
4555#include <pam/pam_appl.h>
4556#endif
4557
4558#endif
4559
4560#if defined(HAVE_SECURITY_PAM_MODULES_H)
4561#include <security/pam_modules.h>
4562#elif defined(HAVE_PAM_PAM_MODULES_H)
4563#include <pam/pam_modules.h>
4564#endif
4565
4566#if defined(HAVE_SECURITY__PAM_MACROS_H)
4567#include <security/_pam_macros.h>
4568#elif defined(HAVE_PAM__PAM_MACROS_H)
4569#include <pam/_pam_macros.h>
4570#endif
4571
4572#ifdef HAVE_SECURITY_PAM_EXT_H
4573#include <security/pam_ext.h>
4574#endif
4575],
4576[int i; i = PAM_RADIO_TYPE; ],
4577AC_DEFINE(HAVE_PAM_RADIO_TYPE, 1, [Define to 1 if PAM_RADIO_TYPE is available]),[])
4578
4579#################################################
4580# check for pam_smbpass support
4581PAM_MODULES=""
4582INSTALL_PAM_MODULES=""
4583UNINSTALL_PAM_MODULES=""
4584
4585try_pam_smbpass=auto
4586AC_MSG_CHECKING(whether to use pam_smbpass)
4587AC_ARG_WITH(pam_smbpass,
4588[AS_HELP_STRING([--with-pam_smbpass], [Build PAM module for authenticating against passdb backends (default=auto)])],
4589[ case "$withval" in
4590 yes|no|auto)
4591 try_pam_smbpass=$withval
4592 ;;
4593 *)
4594 AC_MSG_ERROR([valid options are yes,no,auto])
4595 ;;
4596 esac
4597])
4598
4599if test x"${try_pam_smbpass}" = xno ; then
4600 use_pam_smbpass=no
4601else
4602 use_pam_smbpass=yes
4603 # Conditions under which pam_smbpass can't be built.
4604 if test x"$BLDSHARED" != xtrue ; then
4605 if test x"${try_pam_smbpass}" = xyes ; then
4606 AC_MSG_ERROR([No support for shared modules])
4607 fi
4608 use_pam_smbpass=no
4609 elif test x"$create_pam_modules" != xyes ; then
4610 if test x"${try_pam_smbpass}" = xyes ; then
4611 AC_MSG_ERROR([No support for PAM MODULES])
4612 fi
4613 use_pam_smbpass=no
4614 fi
4615
4616 if test x"${use_pam_smbpass}" = xyes ; then
4617 PAM_MODULES="pam_smbpass"
4618 INSTALL_PAM_MODULES="installpammodules"
4619 UNINSTALL_PAM_MODULES="uninstallpammodules"
4620 fi
4621fi
4622AC_MSG_RESULT([$use_pam_smbpass])
4623
4624
4625##
4626## moved after the check for -lcrypt in order to
4627## ensure that the necessary libraries are included
4628## check checking for truncated salt. Wrapped by the
4629## $with_pam_for_crypt variable as above --jerry
4630##
4631if test $with_pam_for_crypt = no; then
4632AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
4633crypt_LIBS="$LIBS"
4634LIBS="$AUTH_LIBS $LIBS"
4635AC_TRY_RUN([#include "${srcdir-.}/../tests/crypttest.c"],
4636 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
4637LIBS="$crypt_LIBS"])
4638if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
4639 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
4640fi
4641fi
4642
4643#################################################
4644# check for a NISPLUS_HOME support
4645AC_MSG_CHECKING(whether to use NISPLUS_HOME)
4646AC_ARG_WITH(nisplus-home,
4647[AS_HELP_STRING([--with-nisplus-home], [Include NISPLUS_HOME support (default=no)])],
4648[ case "$withval" in
4649 yes)
4650 AC_MSG_RESULT(yes)
4651 AC_DEFINE(WITH_NISPLUS_HOME,1,[Whether to include nisplus_home support])
4652 ;;
4653 *)
4654 AC_MSG_RESULT(no)
4655 ;;
4656 esac ],
4657 AC_MSG_RESULT(no)
4658)
4659
4660#################################################
4661# check for syslog logging
4662AC_MSG_CHECKING(whether to use syslog logging)
4663AC_ARG_WITH(syslog,
4664[AS_HELP_STRING([--with-syslog], [Include experimental SYSLOG support (default=no)])],
4665[ case "$withval" in
4666 yes)
4667 AC_MSG_RESULT(yes)
4668 AC_DEFINE(WITH_SYSLOG,1,[Whether to include experimental syslog support])
4669 ;;
4670 *)
4671 AC_MSG_RESULT(no)
4672 ;;
4673 esac ],
4674 AC_MSG_RESULT(no)
4675)
4676
4677#################################################
4678# check for custom syslog facility
4679AC_MSG_CHECKING(whether to use a custom syslog facility)
4680AC_ARG_WITH(syslog-facility,
4681[AS_HELP_STRING([--with-syslog-facility], [Use a custom syslog facility (default=none)])],
4682[
4683 if test "$withval" = "no" ; then
4684 AC_MSG_ERROR([argument to --with-syslog-facility must be a string])
4685 else
4686 if test "$withval" != "yes" ; then
4687 syslog_facility="$withval"
4688 AC_DEFINE_UNQUOTED(SYSLOG_FACILITY,$syslog_facility, [syslog facility to log to])
4689 fi
4690 fi
4691])
4692
4693#################################################
4694# check for experimental disk-quotas support
4695
4696samba_cv_WITH_QUOTAS=auto
4697samba_cv_TRY_QUOTAS=no
4698samba_cv_RUN_QUOTA_TESTS=auto
4699samba_cv_WITH_SYS_QUOTAS=auto
4700samba_cv_TRY_SYS_QUOTAS=auto
4701samba_cv_SYSQUOTA_FOUND=no
4702
4703AC_MSG_CHECKING(whether to try disk-quotas support)
4704AC_ARG_WITH(quotas,
4705[AS_HELP_STRING([--with-quotas], [Include disk-quota support (default=no)])],
4706[ case "$withval" in
4707 yes)
4708 AC_MSG_RESULT(yes)
4709 samba_cv_WITH_QUOTAS=yes
4710 samba_cv_TRY_QUOTAS=yes
4711 samba_cv_RUN_QUOTA_TESTS=yes
4712 #set sys quotas to auto in this case
4713 samba_cv_TRY_SYS_QUOTAS=auto
4714 ;;
4715 auto)
4716 AC_MSG_RESULT(auto)
4717 samba_cv_WITH_QUOTAS=auto
4718 samba_cv_TRY_QUOTAS=auto
4719 samba_cv_RUN_QUOTA_TESTS=auto
4720 #set sys quotas to auto in this case
4721 samba_cv_TRY_SYS_QUOTAS=auto
4722 ;;
4723 no)
4724 AC_MSG_RESULT(no)
4725 samba_cv_WITH_QUOTAS=no
4726 samba_cv_TRY_QUOTAS=no
4727 samba_cv_RUN_QUOTA_TESTS=no
4728 ;;
4729 *)
4730 AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
4731 ;;
4732 esac ],
4733 AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
4734)
4735
4736AC_MSG_CHECKING(whether to try the new lib/sysquotas.c interface)
4737AC_ARG_WITH(sys-quotas,
4738[AS_HELP_STRING([--with-sys-quotas], [Include lib/sysquotas.c support (default=auto)])],
4739[ case "$withval" in
4740 yes)
4741 AC_MSG_RESULT(yes)
4742 samba_cv_WITH_SYS_QUOTAS=yes
4743 samba_cv_TRY_SYS_QUOTAS=yes
4744 samba_cv_RUN_QUOTA_TESTS=yes
4745 ;;
4746 auto)
4747 AC_MSG_RESULT(auto)
4748 samba_cv_WITH_SYS_QUOTAS=auto
4749 samba_cv_TRY_SYS_QUOTAS=auto
4750 samba_cv_RUN_QUOTA_TESTS=auto
4751 ;;
4752 no)
4753 AC_MSG_RESULT(no)
4754 samba_cv_WITH_SYS_QUOTAS=no
4755 samba_cv_TRY_SYS_QUOTAS=no
4756 ;;
4757 *)
4758 AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
4759 ;;
4760 esac ],
4761 AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
4762)
4763
4764if test x"$samba_cv_TRY_SYS_QUOTAS" = x"auto"; then
4765AC_MSG_CHECKING(whether to try the lib/sysquotas.c interface on ${host_os})
4766 case "$host_os" in
4767 *linux*)
4768 AC_MSG_RESULT(yes)
4769 samba_cv_TRY_SYS_QUOTAS=yes
4770 samba_cv_RUN_QUOTA_TESTS=yes
4771 ;;
4772 *)
4773 AC_MSG_RESULT(no)
4774 samba_cv_TRY_SYS_QUOTAS=no
4775 ;;
4776 esac
4777fi
4778
4779#############################################
4780# only check for quota stuff if --with-quotas
4781if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then
4782
4783case "$host_os" in
4784 # on linux we didn't need to test we have builtin support
4785 *linux*)
4786 samba_cv_SYSQUOTA_FOUND=yes
4787 AC_DEFINE(HAVE_QUOTACTL_LINUX,1,[Whether Linux quota support is available])
4788 samba_cv_sysquotas_file="lib/sysquotas_linux.c"
4789 AC_MSG_CHECKING(whether to use the lib/sysquotas_linux.c builtin support)
4790 AC_MSG_RESULT(yes)
4791
4792 AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available])
4793 samba_cv_found_xfs_header=yes
4794 AC_MSG_CHECKING(whether to use the lib/sysquotas_xfs.c builtin support)
4795 AC_MSG_RESULT(yes)
4796 ;;
4797 *solaris*)
4798 # need to set this define when using static linking (BUG 1473)
4799 CPPFLAGS="$CPPFLAGS -DSUNOS5"
4800 ;;
4801 *)
4802 ;;
4803esac
4804
4805# some broken header files need this
4806AC_CHECK_HEADER(asm/types.h,[
4807 AC_DEFINE(HAVE_ASM_TYPES_H,1,[check for <asm/types.h>])
4808 AC_ADD_INCLUDE(<asm/types.h>)
4809 ])
4810
4811# For quotas on Veritas VxFS filesystems
4812AC_CHECK_HEADERS(sys/fs/vx_quota.h)
4813
4814# For quotas on Linux XFS filesystems
4815AC_CHECK_HEADERS(linux/dqblk_xfs.h)
4816
4817# For sys/quota.h and linux/quota.h
4818AC_CHECK_HEADERS(sys/quota.h)
4819
4820if test x"$samba_cv_found_xfs_header" != x"yes"; then
4821# if we have xfs quota support <sys/quota.h> (IRIX) we should use it
4822AC_CACHE_CHECK([for XFS QUOTA in <sys/quota.h>],samba_cv_HAVE_SYS_QUOTA_XFS, [
4823AC_TRY_COMPILE([
4824#include "confdefs.h"
4825#ifdef HAVE_SYS_TYPES_H
4826#include <sys/types.h>
4827#endif
4828#ifdef HAVE_ASM_TYPES_H
4829#include <asm/types.h>
4830#endif
4831#include <sys/quota.h>
4832],[int i = Q_XGETQUOTA;],
4833samba_cv_HAVE_SYS_QUOTA_XFS=yes,samba_cv_HAVE_SYS_QUOTA_XFS=no)])
4834if test "$samba_cv_HAVE_SYS_QUOTA_XFS"x = "yes"x; then
4835 samba_cv_found_xfs_header=yes
4836fi
4837fi
4838
4839# if we have struct dqblk .dqb_fsoftlimit instead of .dqb_isoftlimit on IRIX
4840AC_CACHE_CHECK([if struct dqblk has .dqb_fsoftlimit],samba_cv_HAVE_DQB_FSOFTLIMIT, [
4841AC_TRY_COMPILE([
4842#include "confdefs.h"
4843#ifdef HAVE_SYS_QUOTA_H
4844#include <sys/quota.h>
4845#endif
4846],[
4847struct dqblk D;
4848D.dqb_fsoftlimit = 0;],
4849samba_cv_HAVE_DQB_FSOFTLIMIT=yes,samba_cv_HAVE_DQB_FSOFTLIMIT=no)])
4850if test "$samba_cv_HAVE_DQB_FSOFTLIMIT"x = "yes"x; then
4851 AC_DEFINE(HAVE_DQB_FSOFTLIMIT,1,[struct dqblk .dqb_fsoftlimit])
4852fi
4853
4854##################
4855# look for a working quota system
4856
4857if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4858AC_CACHE_CHECK([for long quotactl(int cmd, char *special, qid_t id, caddr_t addr)],samba_cv_HAVE_QUOTACTL_4A,[
4859AC_TRY_RUN_STRICT([
4860#define HAVE_QUOTACTL_4A 1
4861#define AUTOCONF_TEST 1
4862#include "confdefs.h"
4863#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4864 samba_cv_HAVE_QUOTACTL_4A=yes,samba_cv_HAVE_QUOTACTL_4A=no,samba_cv_HAVE_QUOTACTL_4A=cross)])
4865if test x"$samba_cv_HAVE_QUOTACTL_4A" = x"yes"; then
4866 samba_cv_SYSQUOTA_FOUND=yes;
4867 AC_DEFINE(HAVE_QUOTACTL_4A,1,[Whether long quotactl(int cmd, char *special, qid_t id, caddr_t addr) is available])
4868 samba_cv_sysquotas_file="lib/sysquotas_4A.c"
4869fi
4870fi
4871
4872if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4873AC_CACHE_CHECK([for int quotactl(const char *path, int cmd, int id, char *addr)],samba_cv_HAVE_QUOTACTL_4B,[
4874AC_TRY_RUN_STRICT([
4875#define HAVE_QUOTACTL_4B 1
4876#define AUTOCONF_TEST 1
4877#include "confdefs.h"
4878#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4879 samba_cv_HAVE_QUOTACTL_4B=yes,samba_cv_HAVE_QUOTACTL_4B=no,samba_cv_HAVE_QUOTACTL_4B=cross)])
4880if test x"$samba_cv_HAVE_QUOTACTL_4B" = x"yes"; then
4881 echo "int quotactl(const char *path, int cmd, int id, char *addr) is not reworked for the new sys_quota api"
4882 samba_cv_SYSQUOTA_FOUND=yes;
4883 AC_DEFINE(HAVE_QUOTACTL_4B,1,[Whether int quotactl(const char *path, int cmd, int id, char *addr) is available])
4884 samba_cv_sysquotas_file="lib/sysquotas_4B.c"
4885fi
4886fi
4887
4888if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4889AC_CACHE_CHECK([for CRAY int quotactl (char *spec, int request, char *arg)],samba_cv_HAVE_QUOTACTL_3,[
4890AC_TRY_RUN_STRICT([
4891#define HAVE_QUOTACTL_3 1
4892#define AUTOCONF_TEST 1
4893#include "confdefs.h"
4894#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
4895 samba_cv_HAVE_QUOTACTL_3=yes,samba_cv_HAVE_QUOTACTL_3=no,samba_cv_HAVE_QUOTACTL_3=cross)])
4896if test x"$samba_cv_HAVE_QUOTACTL_3" = x"yes"; then
4897 echo "CRAY int quotactl (char *spec, int request, char *arg) is NOT reworked for the sys_quota api"
4898 samba_cv_SYSQUOTA_FOUND=yes;
4899 AC_DEFINE(HAVE_QUOTACTL_3,1,[Whether CRAY int quotactl (char *spec, int request, char *arg); is available])
4900 samba_cv_sysquotas_file="lib/sysquotas_3.c"
4901fi
4902fi
4903
4904#################################################
4905# check for mntent.h and struct mntent
4906AC_CHECK_HEADERS(mntent.h)
4907#################################################
4908# check for setmntent,getmntent,endmntent
4909AC_CHECK_FUNCS(setmntent getmntent endmntent)
4910
4911#################################################
4912# check for devnm.h and struct mntent
4913AC_CHECK_HEADERS(devnm.h)
4914#################################################
4915# check for devnm
4916AC_CHECK_FUNCS(devnm)
4917
4918if test x"$samba_cv_WITH_SYS_QUOTAS" = x"yes"; then
4919 if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
4920 # if --with-sys-quotas=yes then build it
4921 # you have can use the get/set quota command smb.conf
4922 # options then
4923 samba_cv_SYSQUOTA_FOUND=auto
4924 fi
4925 if test x"$samba_cv_TRY_SYS_QUOTAS" != x"yes"; then
4926 # if --with-sys-quotas=yes then build it
4927 # you have can use the get/set quota command smb.conf
4928 # options then
4929 samba_cv_TRY_SYS_QUOTAS=auto
4930 fi
4931fi
4932
4933if test x"$samba_cv_SYSQUOTA_FOUND" != x"no"; then
4934AC_CACHE_CHECK([whether the sys_quota interface works],samba_cv_SYSQUOTA_WORKS,[
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#include "${srcdir-.}/${samba_cv_sysquotas_file}"
4943#include "${srcdir-.}/lib/sysquotas.c"
4944],[],samba_cv_SYSQUOTA_WORKS=yes,samba_cv_SYSQUOTA_WORKS=no)
4945CPPFLAGS="$SAVE_CPPFLAGS"
4946])
4947if test x"$samba_cv_SYSQUOTA_WORKS" = x"yes"; then
4948AC_MSG_CHECKING(whether to use the new lib/sysquotas.c interface)
4949 if test x"$samba_cv_TRY_SYS_QUOTAS" != x"no"; then
4950 AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
4951 AC_DEFINE(HAVE_SYS_QUOTAS,1,[Whether the new lib/sysquotas.c interface can be used])
4952 samba_cv_WE_USE_SYS_QUOTAS=yes
4953 AC_MSG_RESULT(yes)
4954 else
4955 AC_MSG_RESULT(no)
4956 fi
4957fi
4958fi
4959
4960if test x"$samba_cv_SYSQUOTA_FOUND" != x"no" -a x"$samba_cv_found_xfs_header" = x"yes"; then
4961AC_CACHE_CHECK([whether the sys_quota interface works with XFS],samba_cv_SYSQUOTA_WORKS_XFS,[
4962SAVE_CPPFLAGS="$CPPFLAGS"
4963CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
4964AC_TRY_COMPILE([
4965#include "confdefs.h"
4966#define NO_PROTO_H 1
4967#define NO_CONFIG_H 1
4968#define HAVE_SYS_QUOTAS 1
4969#define HAVE_XFS_QUOTAS 1
4970#include "${srcdir-.}/lib/sysquotas_xfs.c"
4971],[],samba_cv_SYSQUOTA_WORKS_XFS=yes,samba_cv_SYSQUOTA_WORKS_XFS=no)
4972CPPFLAGS="$SAVE_CPPFLAGS"
4973])
4974if test x"$samba_cv_SYSQUOTA_WORKS_XFS" = x"yes"; then
4975 if test x"$samba_cv_WE_USE_SYS_QUOTAS" = x"yes"; then
4976 AC_DEFINE(HAVE_XFS_QUOTAS,1,[Whether xfs quota support is available])
4977 fi
4978fi
4979fi
4980
4981AC_CACHE_CHECK([whether the old quota support works],samba_cv_QUOTA_WORKS,[
4982SAVE_CPPFLAGS="$CPPFLAGS"
4983CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
4984AC_TRY_COMPILE([
4985#include "confdefs.h"
4986#define NO_PROTO_H 1
4987#define NO_CONFIG_H 1
4988#include "${srcdir-.}/smbd/quotas.c"
4989],[],samba_cv_QUOTA_WORKS=yes,samba_cv_QUOTA_WORKS=no)
4990CPPFLAGS="$SAVE_CPPFLAGS"
4991])
4992if test x"$samba_cv_QUOTA_WORKS" = x"yes"; then
4993AC_MSG_CHECKING(whether to use the old quota support)
4994 if test x"$samba_cv_WE_USE_SYS_QUOTAS" != x"yes"; then
4995 if test x"$samba_cv_TRY_QUOTAS" != x"no"; then
4996 AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
4997 AC_MSG_RESULT(yes)
4998 else
4999 AC_MSG_RESULT(no)
5000 fi
5001 else
5002 AC_MSG_RESULT(no)
5003 fi
5004fi
5005
5006####################
5007# End of quota check samba_cv_RUN_QUOTA_TESTS
5008fi
5009
5010#################################################
5011# check for experimental utmp accounting
5012
5013AC_MSG_CHECKING(whether to support utmp accounting)
5014WITH_UTMP=yes
5015AC_ARG_WITH(utmp,
5016[AS_HELP_STRING([--with-utmp], [Include utmp accounting (default, if supported by OS)])],
5017[ case "$withval" in
5018 no)
5019 WITH_UTMP=no
5020 ;;
5021 *)
5022 WITH_UTMP=yes
5023 ;;
5024 esac ],
5025)
5026
5027# utmp requires utmp.h
5028# Note similar check earlier, when checking utmp details.
5029
5030if test x"$WITH_UTMP" = x"yes" -a x"$ac_cv_header_utmp_h" = x"no"; then
5031 utmp_no_reason=", no utmp.h on $host_os"
5032 WITH_UTMP=no
5033fi
5034
5035# Display test results
5036
5037if test x"$WITH_UTMP" = x"yes"; then
5038 AC_MSG_RESULT(yes)
5039 AC_DEFINE(WITH_UTMP,1,[Whether to include experimental utmp accounting])
5040else
5041 AC_MSG_RESULT(no$utmp_no_reason)
5042fi
5043
5044
5045#################################################
5046# these tests are taken from the GNU fileutils package
5047AC_CHECKING(how to get filesystem space usage)
5048space=no
5049
5050# Test for statvfs64.
5051if test $space = no; then
5052 # SVR4
5053 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
5054 [AC_TRY_RUN([
5055#if defined(HAVE_UNISTD_H)
5056#include <unistd.h>
5057#endif
5058#include <sys/types.h>
5059#include <sys/statvfs.h>
5060 main ()
5061 {
5062 struct statvfs64 fsd;
5063 exit (statvfs64 (".", &fsd));
5064 }],
5065 fu_cv_sys_stat_statvfs64=yes,
5066 fu_cv_sys_stat_statvfs64=no,
5067 fu_cv_sys_stat_statvfs64=cross)])
5068 if test $fu_cv_sys_stat_statvfs64 = yes; then
5069 space=yes
5070 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
5071 fi
5072fi
5073
5074# Perform only the link test since it seems there are no variants of the
5075# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
5076# because that got a false positive on SCO OSR5. Adding the declaration
5077# of a `struct statvfs' causes this test to fail (as it should) on such
5078# systems. That system is reported to work fine with STAT_STATFS4 which
5079# is what it gets when this test fails.
5080if test $space = no; then
5081 # SVR4
5082 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
5083 [AC_TRY_LINK([#include <sys/types.h>
5084#include <sys/statvfs.h>],
5085 [struct statvfs fsd; statvfs (0, &fsd);],
5086 fu_cv_sys_stat_statvfs=yes,
5087 fu_cv_sys_stat_statvfs=no)])
5088 if test $fu_cv_sys_stat_statvfs = yes; then
5089 space=yes
5090 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
5091 fi
5092fi
5093
5094# smbd/statvfs.c assumes that statvfs.f_fsid is an integer.
5095# This is not the case on ancient Linux systems.
5096
5097AC_CACHE_CHECK([that statvfs.f_fsid is an integer],samba_cv_fsid_int, [
5098 AC_TRY_COMPILE([#include <sys/types.h>
5099#include <sys/statvfs.h>],[struct statvfs buf; buf.f_fsid = 0],
5100 samba_cv_fsid_int=yes,samba_cv_fsid_int=no)])
5101if test x"$samba_cv_fsid_int" = x"yes"; then
5102 AC_DEFINE(HAVE_FSID_INT, 1, [Whether statvfs.f_fsid is an integer])
5103fi
5104
5105# fsusage.c assumes that statvfs has an f_frsize entry. Some weird
5106# systems use f_bsize.
5107AC_CACHE_CHECK([that statvfs.f_frsize works],samba_cv_frsize, [
5108 AC_TRY_COMPILE([#include <sys/types.h>
5109#include <sys/statvfs.h>],[struct statvfs buf; buf.f_frsize = 0],
5110 samba_cv_frsize=yes,samba_cv_frsize=no)])
5111if test x"$samba_cv_frsize" = x"yes"; then
5112 AC_DEFINE(HAVE_FRSIZE, 1, [Whether statvfs.f_frsize exists])
5113fi
5114
5115# Some systems use f_flag in struct statvfs while others use f_flags
5116AC_CACHE_CHECK([that statvfs.statvfs_f_flag works],samba_cv_statvfs_f_flag, [
5117 AC_TRY_COMPILE([#include <sys/types.h>
5118#include <sys/statvfs.h>],[struct statvfs buf; buf.f_flag = 0],
5119 samba_cv_statvfs_f_flag=yes,samba_cv_statvfs_f_flag=no)])
5120if test x"$samba_cv_statvfs_f_flag" = x"yes"; then
5121 AC_DEFINE(HAVE_STATVFS_F_FLAG, 1, [Whether statvfs.f_flag exists])
5122fi
5123
5124AC_CACHE_CHECK([that statvfs.statvfs_f_flags works],samba_cv_statvfs_f_flags, [
5125 AC_TRY_COMPILE([#include <sys/types.h>
5126#include <sys/statvfs.h>],[struct statvfs buf; buf.f_flags = 0],
5127 samba_cv_statvfs_f_flags=yes,samba_cv_statvfs_f_flags=no)])
5128if test x"$samba_cv_statvfs_f_flags" = x"yes"; then
5129 AC_DEFINE(HAVE_STATVFS_F_FLAGS, 1, [Whether statvfs.f_flags exists])
5130fi
5131
5132if test $space = no; then
5133 # DEC Alpha running OSF/1
5134 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
5135 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
5136 [AC_TRY_RUN([
5137#include <sys/param.h>
5138#include <sys/types.h>
5139#include <sys/mount.h>
5140 main ()
5141 {
5142 struct statfs fsd;
5143 fsd.f_fsize = 0;
5144 exit (statfs (".", &fsd, sizeof (struct statfs)));
5145 }],
5146 fu_cv_sys_stat_statfs3_osf1=yes,
5147 fu_cv_sys_stat_statfs3_osf1=no,
5148 fu_cv_sys_stat_statfs3_osf1=no)])
5149 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
5150 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
5151 space=yes
5152 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
5153 fi
5154fi
5155
5156if test $space = no; then
5157# AIX
5158 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
5159member (AIX, 4.3BSD)])
5160 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
5161 [AC_TRY_RUN([
5162#ifdef HAVE_SYS_PARAM_H
5163#include <sys/param.h>
5164#endif
5165#ifdef HAVE_SYS_MOUNT_H
5166#include <sys/mount.h>
5167#endif
5168#ifdef HAVE_SYS_VFS_H
5169#include <sys/vfs.h>
5170#endif
5171 main ()
5172 {
5173 struct statfs fsd;
5174 fsd.f_bsize = 0;
5175 exit (statfs (".", &fsd));
5176 }],
5177 fu_cv_sys_stat_statfs2_bsize=yes,
5178 fu_cv_sys_stat_statfs2_bsize=no,
5179 fu_cv_sys_stat_statfs2_bsize=no)])
5180 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
5181 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
5182 space=yes
5183 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
5184 fi
5185fi
5186
5187if test $space = no; then
5188# SVR3
5189 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
5190 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
5191 [AC_TRY_RUN([#include <sys/types.h>
5192#include <sys/statfs.h>
5193 main ()
5194 {
5195 struct statfs fsd;
5196 exit (statfs (".", &fsd, sizeof fsd, 0));
5197 }],
5198 fu_cv_sys_stat_statfs4=yes,
5199 fu_cv_sys_stat_statfs4=no,
5200 fu_cv_sys_stat_statfs4=no)])
5201 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
5202 if test $fu_cv_sys_stat_statfs4 = yes; then
5203 space=yes
5204 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
5205 fi
5206fi
5207
5208if test $space = no; then
5209# 4.4BSD and NetBSD
5210 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
5211member (4.4BSD and NetBSD)])
5212 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
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 main ()
5221 {
5222 struct statfs fsd;
5223 fsd.f_fsize = 0;
5224 exit (statfs (".", &fsd));
5225 }],
5226 fu_cv_sys_stat_statfs2_fsize=yes,
5227 fu_cv_sys_stat_statfs2_fsize=no,
5228 fu_cv_sys_stat_statfs2_fsize=no)])
5229 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
5230 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
5231 space=yes
5232 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
5233 fi
5234fi
5235
5236if test $space = no; then
5237 # Ultrix
5238 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
5239 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
5240 [AC_TRY_RUN([#include <sys/types.h>
5241#ifdef HAVE_SYS_PARAM_H
5242#include <sys/param.h>
5243#endif
5244#ifdef HAVE_SYS_MOUNT_H
5245#include <sys/mount.h>
5246#endif
5247#ifdef HAVE_SYS_FS_TYPES_H
5248#include <sys/fs_types.h>
5249#endif
5250 main ()
5251 {
5252 struct fs_data fsd;
5253 /* Ultrix's statfs returns 1 for success,
5254 0 for not mounted, -1 for failure. */
5255 exit (statfs (".", &fsd) != 1);
5256 }],
5257 fu_cv_sys_stat_fs_data=yes,
5258 fu_cv_sys_stat_fs_data=no,
5259 fu_cv_sys_stat_fs_data=no)])
5260 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
5261 if test $fu_cv_sys_stat_fs_data = yes; then
5262 space=yes
5263 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
5264 fi
5265fi
5266
5267#
5268# As a gating factor for large file support, in order to
5269# use <4GB files we must have the following minimal support
5270# available.
5271# long long, and a 64 bit off_t or off64_t.
5272# If we don't have all of these then disable large
5273# file support.
5274#
5275AC_MSG_CHECKING([if large file support can be enabled])
5276AC_TRY_COMPILE([
5277#if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
5278#include <sys/types.h>
5279#else
5280__COMPILE_ERROR_
5281#endif
5282],
5283[int i],
5284samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
5285if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
5286 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT,1,[Whether large file support can be enabled])
5287fi
5288AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
5289
5290#################################################
5291# check for cluster extensions
5292
5293CTDB_CFLAGS=""
5294AC_SUBST(CTDB_CFLAGS)
5295AC_ARG_WITH(ctdb,
5296[AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
5297[ case "$withval" in
5298 yes|no)
5299 AC_MSG_WARN([--with-ctdb called without argument])
5300 ;;
5301 *)
5302 CTDB_CPPFLAGS="-I$withval/include"
5303 ;;
5304 esac])
5305
5306SAVED_CPPFLAGS="$CPPFLAGS"
5307CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS} $CTDB_CPPFLAGS"
5308ctdb_broken="missing or broken headers"
5309
5310AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
5311#include "confdefs.h"
5312#define NO_CONFIG_H
5313#include "replace.h"
5314#include "system/wait.h"
5315#include "system/network.h"
5316#define private #error __USED_RESERVED_WORD_private__
5317#include <talloc.h>
5318#include <tdb.h>
5319#include <ctdb.h>
5320])
5321
5322AC_HAVE_DECL(CTDB_CONTROL_TRANS3_COMMIT,[
5323#include "confdefs.h"
5324#define NO_CONFIG_H
5325#include "replace.h"
5326#include "system/wait.h"
5327#include "system/network.h"
5328#include <talloc.h>
5329#include <tdb.h>
5330#include <ctdb.h>
5331#include <ctdb_private.h>
5332])
5333if test x"$ac_cv_have_CTDB_CONTROL_TRANS3_COMMIT_decl" = x"yes"; then
5334 ctdb_broken=no
5335else
5336 ctdb_broken="ctdb transaction support missing or too old"
5337fi
5338
5339# in ctdb 1.0.57 ctdb_control_tcp was temparary renamed to ctdb_tcp_client
5340AC_CHECK_TYPE(struct ctdb_tcp_client,[
5341 AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
5342],,[
5343#include "confdefs.h"
5344#define NO_CONFIG_H
5345#include "replace.h"
5346#include "system/wait.h"
5347#include "system/network.h"
5348#include <talloc.h>
5349#include <tdb.h>
5350#include <ctdb.h>
5351#include <ctdb_private.h>
5352])
5353
5354AC_CHECK_TYPE(struct ctdb_control_tcp,[
5355 AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP],[1],[ctdb ipv4 support])
5356],[
5357 ctdb_broken="missing struct ctdb_control_tcp"
5358],[
5359#include "confdefs.h"
5360#define NO_CONFIG_H
5361#include "replace.h"
5362#include "system/wait.h"
5363#include "system/network.h"
5364#include <talloc.h>
5365#include <tdb.h>
5366#include <ctdb.h>
5367#include <ctdb_private.h>
5368])
5369
5370AC_CHECK_TYPE(struct ctdb_control_tcp_addr,[
5371 AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR],[1],[ctdb ipv6 support])
5372],,[
5373#include "confdefs.h"
5374#define NO_CONFIG_H
5375#include "replace.h"
5376#include "system/wait.h"
5377#include "system/network.h"
5378#include <talloc.h>
5379#include <tdb.h>
5380#include <ctdb.h>
5381#include <ctdb_private.h>
5382])
5383CPPFLAGS="$SAVED_CPPFLAGS"
5384
5385AC_MSG_CHECKING(cluster support)
5386AC_ARG_WITH(cluster-support,
5387[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=auto)])])
5388
5389if test x"$with_cluster_support" = x ; then
5390 with_cluster_support="auto"
5391fi
5392
5393if test x"$ac_cv_header_ctdb_private_h" != x"yes"; then
5394 if test "x$with_cluster_support" = "xyes"; then
5395 AC_MSG_ERROR("ctdb_private.h is required for cluster support")
5396 fi
5397 with_cluster_support=no
5398fi
5399
5400if test x"$ctdb_broken" != x"no"; then
5401 if test "x$with_cluster_support" = "xyes"; then
5402 AC_MSG_ERROR(["cluster support: $ctdb_broken"])
5403 fi
5404 with_cluster_support=no
5405fi
5406
5407if test "x$with_cluster_support" != "xno"; then
5408 AC_DEFINE(CLUSTER_SUPPORT,1,[Whether to enable cluster extensions])
5409 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${CTDB_CPPFLAGS}"
5410 AC_MSG_RESULT(yes)
5411else
5412 AC_MSG_RESULT(no)
5413fi
5414
5415#################################################
5416# check for ACL support
5417
5418AC_MSG_CHECKING(whether to support ACLs)
5419AC_ARG_WITH(acl-support,
5420[AS_HELP_STRING([--with-acl-support], [Include ACL support (default=auto)])],
5421[ case "$withval" in
5422 yes|no)
5423 with_acl_support="$withval"
5424 ;;
5425 esac ])
5426
5427if test x"$with_acl_support" = x ; then
5428 with_acl_support="auto"
5429fi
5430
5431AC_MSG_RESULT($with_acl_support)
5432
5433if test x"$with_acl_support" = x"no"; then
5434 AC_MSG_RESULT(Disabling ACL support)
5435 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
5436else
5437 AC_MSG_NOTICE(checking whether ACL support is available:)
5438 case "$host_os" in
5439 *sysv5*)
5440 AC_MSG_NOTICE(Using UnixWare ACLs)
5441 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
5442 default_static_modules="$default_static_modules vfs_solarisacl"
5443 ;;
5444 *solaris*)
5445 AC_MSG_NOTICE(Using solaris ACLs)
5446 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
5447 ACL_LIBS="$ACL_LIBS -lsec"
5448 default_static_modules="$default_static_modules vfs_solarisacl"
5449 ;;
5450 *hpux*)
5451 AC_MSG_NOTICE(Using HPUX ACLs)
5452 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
5453 default_static_modules="$default_static_modules vfs_hpuxacl"
5454 ;;
5455 *irix*)
5456 AC_MSG_NOTICE(Using IRIX ACLs)
5457 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
5458 default_static_modules="$default_static_modules vfs_irixacl"
5459 ;;
5460 *aix*)
5461 AC_MSG_NOTICE(Using AIX ACLs)
5462 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
5463 default_static_modules="$default_static_modules vfs_aixacl"
5464 ;;
5465 *osf*)
5466 AC_MSG_NOTICE(Using Tru64 ACLs)
5467 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
5468 ACL_LIBS="$ACL_LIBS -lpacl"
5469 default_static_modules="$default_static_modules vfs_tru64acl"
5470 ;;
5471 *darwin*)
5472 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
5473 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
5474 ;;
5475 *)
5476 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
5477 case "$host_os" in
5478 *linux*)
5479 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
5480 ;;
5481 esac
5482 AC_CACHE_CHECK([for POSIX ACL support],samba_cv_HAVE_POSIX_ACLS,[
5483 acl_LIBS=$LIBS
5484 LIBS="$LIBS $ACL_LIBS"
5485 AC_TRY_LINK([
5486 #include <sys/types.h>
5487 #include <sys/acl.h>
5488 ],[
5489 acl_t acl;
5490 int entry_id;
5491 acl_entry_t *entry_p;
5492 return acl_get_entry(acl, entry_id, entry_p);
5493 ],
5494 [samba_cv_HAVE_POSIX_ACLS=yes],
5495 [samba_cv_HAVE_POSIX_ACLS=no])
5496 LIBS=$acl_LIBS
5497 ])
5498 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
5499 AC_MSG_NOTICE(Using posix ACLs)
5500 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
5501 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
5502 acl_LIBS=$LIBS
5503 LIBS="$LIBS $ACL_LIBS"
5504 AC_TRY_LINK([
5505 #include <sys/types.h>
5506 #include <sys/acl.h>
5507 ],[
5508 acl_permset_t permset_d;
5509 acl_perm_t perm;
5510 return acl_get_perm_np(permset_d, perm);
5511 ],
5512 [samba_cv_HAVE_ACL_GET_PERM_NP=yes],
5513 [samba_cv_HAVE_ACL_GET_PERM_NP=no])
5514 LIBS=$acl_LIBS
5515 ])
5516 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
5517 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
5518 fi
5519 default_static_modules="$default_static_modules vfs_posixacl"
5520 else
5521 AC_MSG_NOTICE(ACL support is not avaliable)
5522 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
5523 fi
5524 ;;
5525 esac
5526fi # with_acl_support
5527
5528
5529
5530#################################################
5531# check for AIO support
5532
5533AC_MSG_CHECKING(whether to support asynchronous io)
5534AC_ARG_WITH(aio-support,
5535[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=no)])],
5536[ case "$withval" in
5537 yes)
5538
5539 AC_MSG_RESULT(yes)
5540 case "$host_os" in
5541 *)
5542 AIO_LIBS=$LIBS
5543 AC_CHECK_LIB(rt,aio_read,[AIO_LIBS="$LIBS -lrt"])
5544 AC_CHECK_LIB(aio,aio_read,[AIO_LIBS="$LIBS -laio"])
5545 AC_CACHE_CHECK([for asynchronous io support],samba_cv_HAVE_AIO,[
5546 aio_LIBS=$LIBS
5547 LIBS=$AIO_LIBS
5548 AC_TRY_LINK([#include <sys/types.h>
5549#include <aio.h>],
5550[ struct aiocb a; return aio_read(&a);],
5551samba_cv_HAVE_AIO=yes,samba_cv_HAVE_AIO=no)
5552 LIBS=$aio_LIBS])
5553 AC_CACHE_CHECK([for 64-bit asynchronous io support],samba_cv_HAVE_AIO64,[
5554 aio_LIBS=$LIBS
5555 LIBS=$AIO_LIBS
5556 AC_TRY_LINK([#include <sys/types.h>
5557#include <aio.h>],
5558[ struct aiocb64 a; return aio_read64(&a);],
5559samba_cv_HAVE_AIO64=yes,samba_cv_HAVE_AIO64=no)
5560 LIBS=$aio_LIBS])
5561 if test x"$samba_cv_HAVE_AIO64" = x"yes"; then
5562 AC_DEFINE(HAVE_AIOCB64,1,[Whether 64 bit aio is available])
5563 AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
5564 LIBS=$AIO_LIBS
5565 elif test x"$samba_cv_HAVE_AIO" = x"yes"; then
5566 AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
5567 LIBS=$AIO_LIBS
5568 fi
5569
5570 if test x"$samba_cv_HAVE_AIO" = x"yes"; then
5571 AC_MSG_CHECKING(for aio_read)
5572 AC_LINK_IFELSE([#include <aio.h>
5573int main() { struct aiocb a; return aio_read(&a); }],
5574[AC_DEFINE(HAVE_AIO_READ, 1, [Have aio_read]) AC_MSG_RESULT(yes)],
5575[AC_MSG_RESULT(no)])
5576
5577 AC_MSG_CHECKING(for aio_write)
5578 AC_LINK_IFELSE([#include <aio.h>
5579int main() { struct aiocb a; return aio_write(&a); }],
5580[AC_DEFINE(HAVE_AIO_WRITE, 1, [Have aio_write]) AC_MSG_RESULT(yes)],
5581[AC_MSG_RESULT(no)])
5582
5583 AC_MSG_CHECKING(for aio_fsync)
5584 AC_LINK_IFELSE([#include <aio.h>
5585int main() { struct aiocb a; return aio_fsync(1, &a); }],
5586[AC_DEFINE(HAVE_AIO_FSYNC, 1, [Have aio_fsync]) AC_MSG_RESULT(yes)],
5587[AC_MSG_RESULT(no)])
5588
5589 AC_MSG_CHECKING(for aio_return)
5590 AC_LINK_IFELSE([#include <aio.h>
5591int main() { struct aiocb a; return aio_return(&a); }],
5592[AC_DEFINE(HAVE_AIO_RETURN, 1, [Have aio_return]) AC_MSG_RESULT(yes)],
5593[AC_MSG_RESULT(no)])
5594
5595 AC_MSG_CHECKING(for aio_error)
5596 AC_LINK_IFELSE([#include <aio.h>
5597int main() { struct aiocb a; return aio_error(&a); }],
5598[AC_DEFINE(HAVE_AIO_ERROR, 1, [Have aio_error]) AC_MSG_RESULT(yes)],
5599[AC_MSG_RESULT(no)])
5600
5601 AC_MSG_CHECKING(for aio_cancel)
5602 AC_LINK_IFELSE([#include <aio.h>
5603int main() { struct aiocb a; return aio_cancel(1, &a); }],
5604[AC_DEFINE(HAVE_AIO_CANCEL, 1, [Have aio_cancel]) AC_MSG_RESULT(yes)],
5605[AC_MSG_RESULT(no)])
5606
5607 AC_MSG_CHECKING(for aio_suspend)
5608 AC_LINK_IFELSE([#include <aio.h>
5609int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
5610[AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
5611[AC_MSG_RESULT(no)])
5612 fi
5613
5614 if test x"$samba_cv_HAVE_AIO64" = x"yes"; then
5615 AC_MSG_CHECKING(for aio_read64)
5616 AC_LINK_IFELSE([#include <aio.h>
5617int main() { struct aiocb a; return aio_read64(&a); }],
5618[AC_DEFINE(HAVE_AIO_READ64, 1, [Have aio_read64]) AC_MSG_RESULT(yes)],
5619[AC_MSG_RESULT(no)])
5620
5621 AC_MSG_CHECKING(for aio_write64)
5622 AC_LINK_IFELSE([#include <aio.h>
5623int main() { struct aiocb a; return aio_write64(&a); }],
5624[AC_DEFINE(HAVE_AIO_WRITE64, 1, [Have aio_write64]) AC_MSG_RESULT(yes)],
5625[AC_MSG_RESULT(no)])
5626
5627 AC_MSG_CHECKING(for aio_fsync64)
5628 AC_LINK_IFELSE([#include <aio.h>
5629int main() { struct aiocb a; return aio_fsync64(1, &a); }],
5630[AC_DEFINE(HAVE_AIO_FSYNC64, 1, [Have aio_fsync64]) AC_MSG_RESULT(yes)],
5631[AC_MSG_RESULT(no)])
5632
5633 AC_MSG_CHECKING(for aio_return64)
5634 AC_LINK_IFELSE([#include <aio.h>
5635int main() { struct aiocb a; return aio_return64(&a); }],
5636[AC_DEFINE(HAVE_AIO_RETURN64, 1, [Have aio_return64]) AC_MSG_RESULT(yes)],
5637[AC_MSG_RESULT(no)])
5638
5639 AC_MSG_CHECKING(for aio_error64)
5640 AC_LINK_IFELSE([#include <aio.h>
5641int main() { struct aiocb a; return aio_error64(&a); }],
5642[AC_DEFINE(HAVE_AIO_ERROR64, 1, [Have aio_error64]) AC_MSG_RESULT(yes)],
5643[AC_MSG_RESULT(no)])
5644
5645 AC_MSG_CHECKING(for aio_cancel64)
5646 AC_LINK_IFELSE([#include <aio.h>
5647int main() { struct aiocb a; return aio_cancel64(1, &a); }],
5648[AC_DEFINE(HAVE_AIO_CANCEL64, 1, [Have aio_cancel64]) AC_MSG_RESULT(yes)],
5649[AC_MSG_RESULT(no)])
5650
5651 AC_MSG_CHECKING(for aio_suspend64)
5652 AC_LINK_IFELSE([#include <aio.h>
5653int main() { struct aiocb a; return aio_suspend64(&a, 1, NULL); }],
5654[AC_DEFINE(HAVE_AIO_SUSPEND64, 1, [Have aio_suspend64]) AC_MSG_RESULT(yes)],
5655[AC_MSG_RESULT(no)])
5656 fi
5657 ;;
5658 esac
5659 ;;
5660 *)
5661 AC_MSG_RESULT(no)
5662 AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
5663 ;;
5664 esac ],
5665 AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
5666 AC_MSG_RESULT(no)
5667)
5668
5669if test x"$samba_cv_HAVE_AIO" = x"yes"; then
5670 if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \
5671 x"$samba_cv_msghdr_msg_acctright" = x"yes"; then
5672 default_shared_modules="$default_shared_modules vfs_aio_fork"
5673 fi
5674fi
5675
5676#################################################
5677# check for sendfile support
5678
5679with_sendfile_support=yes
5680AC_MSG_CHECKING(whether to check to support sendfile)
5681AC_ARG_WITH(sendfile-support,
5682[AS_HELP_STRING([--with-sendfile-support], [Check for sendfile support (default=yes)])],
5683[ case "$withval" in
5684 yes)
5685
5686 AC_MSG_RESULT(yes);
5687
5688 case "$host_os" in
5689 *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
5690 AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
5691 AC_TRY_LINK([#include <sys/sendfile.h>],
5692[\
5693int tofd, fromfd;
5694off64_t offset;
5695size_t total;
5696ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
5697],
5698samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
5699
5700 AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[
5701 AC_TRY_LINK([#include <sys/sendfile.h>],
5702[\
5703int tofd, fromfd;
5704off_t offset;
5705size_t total;
5706ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
5707],
5708samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5709
5710# Try and cope with broken Linux sendfile....
5711 AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
5712 AC_TRY_LINK([\
5713#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
5714#undef _FILE_OFFSET_BITS
5715#endif
5716#include <sys/sendfile.h>],
5717[\
5718int tofd, fromfd;
5719off_t offset;
5720size_t total;
5721ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
5722],
5723samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
5724
5725 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
5726 AC_DEFINE(HAVE_SENDFILE64,1,[Whether 64-bit sendfile() is available])
5727 AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
5728 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
5729 elif test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5730 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
5731 AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
5732 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
5733 elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
5734 AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken])
5735 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used])
5736 else
5737 AC_MSG_RESULT(no);
5738 fi
5739
5740 ;;
5741 *freebsd* | *dragonfly* )
5742 AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
5743 AC_TRY_LINK([\
5744#include <sys/types.h>
5745#include <unistd.h>
5746#include <sys/socket.h>
5747#include <sys/uio.h>],
5748[\
5749 int fromfd, tofd, ret, total=0;
5750 off_t offset, nwritten;
5751 struct sf_hdtr hdr;
5752 struct iovec hdtrl;
5753 hdr.headers = &hdtrl;
5754 hdr.hdr_cnt = 1;
5755 hdr.trailers = NULL;
5756 hdr.trl_cnt = 0;
5757 hdtrl.iov_base = NULL;
5758 hdtrl.iov_len = 0;
5759 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
5760],
5761samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5762
5763 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5764 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available])
5765 AC_DEFINE(FREEBSD_SENDFILE_API,1,[Whether the FreeBSD 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
5772 *hpux*)
5773 AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
5774 AC_TRY_LINK([\
5775#include <sys/socket.h>
5776#include <sys/uio.h>],
5777[\
5778 int fromfd, tofd;
5779 size_t total=0;
5780 struct iovec hdtrl[2];
5781 ssize_t nwritten;
5782 off64_t offset;
5783
5784 hdtrl[0].iov_base = 0;
5785 hdtrl[0].iov_len = 0;
5786
5787 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
5788],
5789samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
5790 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
5791 AC_DEFINE(HAVE_SENDFILE64,1,[Whether sendfile64() is available])
5792 AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
5793 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
5794 else
5795 AC_MSG_RESULT(no);
5796 fi
5797
5798 AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[
5799 AC_TRY_LINK([\
5800#include <sys/socket.h>
5801#include <sys/uio.h>],
5802[\
5803 int fromfd, tofd;
5804 size_t total=0;
5805 struct iovec hdtrl[2];
5806 ssize_t nwritten;
5807 off_t offset;
5808
5809 hdtrl[0].iov_base = 0;
5810 hdtrl[0].iov_len = 0;
5811
5812 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
5813],
5814samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5815 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5816 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
5817 AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
5818 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
5819 else
5820 AC_MSG_RESULT(no);
5821 fi
5822 ;;
5823
5824 *solaris*)
5825 AC_CHECK_LIB(sendfile,sendfilev)
5826 AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[
5827 AC_TRY_LINK([\
5828#include <sys/sendfile.h>],
5829[\
5830 int sfvcnt;
5831 size_t xferred;
5832 struct sendfilevec vec[2];
5833 ssize_t nwritten;
5834 int tofd;
5835
5836 sfvcnt = 2;
5837
5838 vec[0].sfv_fd = SFV_FD_SELF;
5839 vec[0].sfv_flag = 0;
5840 vec[0].sfv_off = 0;
5841 vec[0].sfv_len = 0;
5842
5843 vec[1].sfv_fd = 0;
5844 vec[1].sfv_flag = 0;
5845 vec[1].sfv_off = 0;
5846 vec[1].sfv_len = 0;
5847 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
5848],
5849samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
5850
5851 if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then
5852 AC_DEFINE(HAVE_SENDFILEV64,1,[Whether sendfilev64() is available])
5853 AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the soloris sendfile() API is available])
5854 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
5855 else
5856 AC_MSG_RESULT(no);
5857 fi
5858
5859 AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[
5860 AC_TRY_LINK([\
5861#include <sys/sendfile.h>],
5862[\
5863 int sfvcnt;
5864 size_t xferred;
5865 struct sendfilevec vec[2];
5866 ssize_t nwritten;
5867 int tofd;
5868
5869 sfvcnt = 2;
5870
5871 vec[0].sfv_fd = SFV_FD_SELF;
5872 vec[0].sfv_flag = 0;
5873 vec[0].sfv_off = 0;
5874 vec[0].sfv_len = 0;
5875
5876 vec[1].sfv_fd = 0;
5877 vec[1].sfv_flag = 0;
5878 vec[1].sfv_off = 0;
5879 vec[1].sfv_len = 0;
5880 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
5881],
5882samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
5883
5884 if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then
5885 AC_DEFINE(HAVE_SENDFILEV,1,[Whether sendfilev() is available])
5886 AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the solaris sendfile() API is available])
5887 AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support])
5888 else
5889 AC_MSG_RESULT(no);
5890 fi
5891 ;;
5892 *aix*)
5893 AC_CACHE_CHECK([for AIX send_file support],samba_cv_HAVE_SENDFILE,[
5894 AC_TRY_LINK([\
5895#include <sys/socket.h>],
5896[\
5897 int fromfd, tofd;
5898 size_t total=0;
5899 struct sf_parms hdtrl;
5900 ssize_t nwritten;
5901 off64_t offset;
5902
5903 hdtrl.header_data = 0;
5904 hdtrl.header_length = 0;
5905 hdtrl.file_descriptor = fromfd;
5906 hdtrl.file_offset = 0;
5907 hdtrl.file_bytes = 0;
5908 hdtrl.trailer_data = 0;
5909 hdtrl.trailer_length = 0;
5910
5911 nwritten = send_file(&tofd, &hdtrl, 0);
5912],
5913samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
5914 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
5915 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
5916 AC_DEFINE(AIX_SENDFILE_API,1,[Whether the AIX send_file() API is available])
5917 AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support])
5918 else
5919 AC_MSG_RESULT(no);
5920 fi
5921 ;;
5922 *)
5923 ;;
5924 esac
5925 ;;
5926 *)
5927 AC_MSG_RESULT(no)
5928 ;;
5929 esac ],
5930 AC_MSG_RESULT(yes)
5931)
5932
5933############################################
5934# See if we have the Linux readahead syscall.
5935
5936AC_CACHE_CHECK([for Linux readahead],
5937 samba_cv_HAVE_LINUX_READAHEAD,[
5938 AC_TRY_LINK([
5939#if defined(HAVE_UNISTD_H)
5940#include <unistd.h>
5941#endif
5942#include <fcntl.h>],
5943 [ssize_t err = readahead(0,0,0x80000);],
5944 samba_cv_HAVE_LINUX_READAHEAD=yes,
5945 samba_cv_HAVE_LINUX_READAHEAD=no)])
5946
5947if test x"$samba_cv_HAVE_LINUX_READAHEAD" = x"yes"; then
5948 AC_DEFINE(HAVE_LINUX_READAHEAD,1,
5949 [Whether Linux readahead is available])
5950fi
5951
5952AC_HAVE_DECL(readahead, [#include <fcntl.h>])
5953
5954############################################
5955# See if we have the posix_fadvise syscall.
5956
5957AC_CACHE_CHECK([for posix_fadvise],
5958 samba_cv_HAVE_POSIX_FADVISE,[
5959 AC_TRY_LINK([
5960#if defined(HAVE_UNISTD_H)
5961#include <unistd.h>
5962#endif
5963#include <fcntl.h>],
5964 [ssize_t err = posix_fadvise(0,0,0x80000,POSIX_FADV_WILLNEED);],
5965 samba_cv_HAVE_POSIX_FADVISE=yes,
5966 samba_cv_HAVE_POSIX_FADVISE=no)])
5967
5968if test x"$samba_cv_HAVE_POSIX_FADVISE" = x"yes"; then
5969 AC_DEFINE(HAVE_POSIX_FADVISE,1,
5970 [Whether posix_fadvise is available])
5971fi
5972
5973############################################
5974# See if we have the Linux splice syscall.
5975
5976case "$host_os" in
5977*linux*)
5978AC_CACHE_CHECK([for Linux splice],
5979 samba_cv_HAVE_LINUX_SPLICE,[
5980 AC_TRY_LINK([
5981#if defined(HAVE_UNISTD_H)
5982#include <unistd.h>
5983#endif
5984#include <fcntl.h>],
5985 [long ret = splice(0,0,1,0,400,0);],
5986 samba_cv_HAVE_LINUX_SPLICE=yes,
5987 samba_cv_HAVE_LINUX_SPLICE=no)])
5988;;
5989*)
5990samba_cv_HAVE_LINUX_SPLICE=no
5991;;
5992esac
5993
5994if test x"$samba_cv_HAVE_LINUX_SPLICE" = x"yes"; then
5995 AC_DEFINE(HAVE_LINUX_SPLICE,1,
5996 [Whether Linux splice is available])
5997fi
5998
5999AC_HAVE_DECL(splice, [#include <fcntl.h>])
6000
6001############################################
6002# See if we have the a broken readlink syscall.
6003
6004AC_CACHE_CHECK([for a broken readlink syscall],samba_cv_HAVE_BROKEN_READLINK,[
6005AC_TRY_RUN([#include "${srcdir-.}/../tests/readlink.c"],
6006 samba_cv_HAVE_BROKEN_READLINK=no,samba_cv_HAVE_BROKEN_READLINK=yes,samba_cv_HAVE_BROKEN_READLINK=cross)
6007])
6008if test x"$samba_cv_HAVE_BROKEN_READLINK" = x"yes"; then
6009 AC_DEFINE(HAVE_BROKEN_READLINK,1,[Whether the readlink syscall is broken])
6010fi
6011
6012#################################################
6013# Check whether winbind is supported on this platform. If so we need to
6014# build and install client programs, sbin programs and shared libraries
6015
6016AC_MSG_CHECKING(whether to build winbind)
6017
6018# Initially, the value of $host_os decides whether winbind is supported
6019
6020HAVE_WINBIND=yes
6021HAVE_WBCLIENT=no
6022
6023# Define external wbclient library to link against. This disables winbind.
6024# We define this here so --with-winbind can override it.
6025AC_ARG_WITH(wbclient,
6026[AS_HELP_STRING([--with-wbclient], [Use external wbclient (optional)])],
6027[
6028 case "$withval" in
6029 no)
6030 HAVE_WBCLIENT=no
6031 ;;
6032 yes)
6033 HAVE_WBCLIENT=yes
6034 HAVE_WINBIND=no
6035 ;;
6036 *)
6037 HAVE_WBCLIENT=yes
6038 HAVE_WINBIND=no
6039 WBCLIENT_INCLUDES="-I$withval/include"
6040 WBCLIENT_LDFLAGS="-L$withval/lib"
6041 ;;
6042 esac ],
6043)
6044
6045AC_SUBST(WBCLIENT_INCLUDES)
6046AC_SUBST(WBCLIENT_LDFLAGS)
6047AC_SUBST(WBCLIENT_LIBS)
6048
6049
6050# Define the winbind shared library name and any specific linker flags
6051# it needs to be built with.
6052
6053WINBIND_NSS="../nsswitch/libnss_winbind.$SHLIBEXT"
6054WINBIND_WINS_NSS="../nsswitch/libnss_wins.$SHLIBEXT"
6055WINBIND_NSS_LDSHFLAGS=$LDSHFLAGS
6056NSSSONAMEVERSIONSUFFIX=""
6057
6058case "$host_os" in
6059 *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *os2*)
6060 NSSSONAMEVERSIONSUFFIX=".2"
6061 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_linux.o"
6062 ;;
6063 *freebsd[[5-9]]*)
6064 # FreeBSD winbind client is implemented as a wrapper around
6065 # the Linux version.
6066 NSSSONAMEVERSIONSUFFIX=".1"
6067 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_freebsd.o \
6068 ../nsswitch/winbind_nss_linux.o"
6069 WINBIND_NSS="../nsswitch/nss_winbind.$SHLIBEXT"
6070 WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT"
6071 ;;
6072
6073 *netbsd*[[3-9]]*)
6074 # NetBSD winbind client is implemented as a wrapper
6075 # around the Linux version. It needs getpwent_r() to
6076 # indicate libc's use of the correct nsdispatch API.
6077 #
6078 if test x"$ac_cv_func_getpwent_r" = x"yes"; then
6079 WINBIND_NSS_EXTRA_OBJS="\
6080 ../nsswitch/winbind_nss_netbsd.o \
6081 ../nsswitch/winbind_nss_linux.o"
6082 WINBIND_NSS="../nsswitch/nss_winbind.$SHLIBEXT"
6083 WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT"
6084 else
6085 HAVE_WINBIND=no
6086 winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
6087 fi
6088 ;;
6089 *irix*)
6090 # IRIX has differently named shared libraries
6091 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_irix.o"
6092 WINBIND_NSS="../nsswitch/libns_winbind.$SHLIBEXT"
6093 WINBIND_WINS_NSS="../nsswitch/libns_wins.$SHLIBEXT"
6094 ;;
6095 *solaris*)
6096 # Solaris winbind client is implemented as a wrapper around
6097 # the Linux version.
6098 NSSSONAMEVERSIONSUFFIX=".1"
6099 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_solaris.o \
6100 ../nsswitch/winbind_nss_linux.o"
6101 ;;
6102 *hpux11*)
6103 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_solaris.o"
6104 ;;
6105 *aix*)
6106 # AIX has even differently named shared libraries. No
6107 # WINS support has been implemented yet.
6108 WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_aix.o"
6109 WINBIND_NSS_LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-ewb_aix_init"
6110 WINBIND_NSS="../nsswitch/WINBIND"
6111 WINBIND_WINS_NSS=""
6112 ;;
6113 *)
6114 HAVE_WINBIND=no
6115 winbind_no_reason=", unsupported on $host_os"
6116 ;;
6117esac
6118
6119# Check the setting of --with-winbind
6120
6121AC_ARG_WITH(winbind,
6122[AS_HELP_STRING([--with-winbind], [Build winbind (default, if supported by OS)])],
6123[
6124 case "$withval" in
6125 yes)
6126 HAVE_WINBIND=yes
6127 HAVE_WBCLIENT=no
6128 ;;
6129 no)
6130 HAVE_WINBIND=no
6131 winbind_reason=""
6132 ;;
6133 esac ],
6134)
6135
6136# We need unix domain sockets for winbind
6137
6138if test x"$HAVE_WINBIND" = x"yes"; then
6139 if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"no"; then
6140 winbind_no_reason=", no unix domain socket support on $host_os"
6141 HAVE_WINBIND=no
6142 fi
6143fi
6144
6145# Display test results
6146
6147if test x"$HAVE_WINBIND" = x"no"; then
6148 WINBIND_NSS=""
6149 WINBIND_WINS_NSS=""
6150fi
6151if test x"$HAVE_WBCLIENT" = x"yes"; then
6152 AC_CHECK_LIB(wbclient, wbcInterfaceDetails,
6153 [LIBWBCLIENT_LIBS="-lwbclient"], AC_MSG_ERROR([Could not find wbclient]), [$WBCLIENT_LDFLAGS])
6154 LIBWBCLIENT_LIBS="$LIBWBCLIENT_LIBS $WBCLIENT_LDFLAGS"
6155 AC_MSG_RESULT(yes)
6156 AC_DEFINE(WITH_WINBIND,1,[Whether to link to wbclient])
6157 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
6158else
6159 if test x"$enable_developer" = x"yes" -a x"$LINK_LIBWBCLIENT" = x"STATIC" ; then
6160 BUILD_LIBWBCLIENT_SHARED=no
6161 else
6162 BUILD_LIBWBCLIENT_SHARED=yes
6163 fi
6164
6165 LIBWBCLIENT_SHARED_TARGET=bin/libwbclient.$SHLIBEXT
6166 LIBWBCLIENT_STATIC_TARGET=bin/libwbclient.a
6167 LIBWBCLIENT_SOVER=0
6168 if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes" -a x"$BUILD_LIBWBCLIENT_SHARED" = x"yes"; then
6169 NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}"
6170 ## Only worry about libwbclient if we have shared
6171 # library support
6172 LIBWBCLIENT_SHARED=$LIBWBCLIENT_SHARED_TARGET
6173 LIBWBCLIENT=libwbclient
6174 INSTALL_LIBWBCLIENT=installlibwbclient
6175 UNINSTALL_LIBWBCLIENT=uninstalllibwbclient
6176 LIBWBCLIENT_LIBS="-lwbclient"
6177 else
6178 LIBWBCLIENT_STATIC=$LIBWBCLIENT_STATIC_TARGET
6179 LIBWBCLIENT_LIBS=$LIBWBCLIENT_STATIC_TARGET
6180 fi
6181fi
6182
6183if test x"$HAVE_WINBIND" = x"yes"; then
6184 AC_MSG_RESULT(yes)
6185 AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
6186
6187 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
6188 EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/winbindd\$(EXEEXT)"
6189 if test $BLDSHARED = true -a x"$create_pam_modules" = x"yes"; then
6190 PAM_MODULES="$PAM_MODULES pam_winbind"
6191 INSTALL_PAM_MODULES="installpammodules"
6192 UNINSTALL_PAM_MODULES="uninstallpammodules"
6193 fi
6194else
6195 AC_MSG_RESULT(no$winbind_no_reason)
6196fi
6197
6198AC_SUBST(WINBIND_NSS)
6199AC_SUBST(WINBIND_WINS_NSS)
6200AC_SUBST(WINBIND_NSS_LDSHFLAGS)
6201AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
6202AC_SUBST(NSSSONAMEVERSIONSUFFIX)
6203
6204AC_SUBST(WINBIND_KRB5_LOCATOR)
6205
6206# Solaris 10 does have new member in nss_XbyY_key
6207AC_CHECK_MEMBER(union nss_XbyY_key.ipnode.af_family,
6208 AC_DEFINE(HAVE_NSS_XBYY_KEY_IPNODE, 1, [Defined if union nss_XbyY_key has ipnode field]),,
6209 [#include <nss_dbdefs.h>])
6210
6211# Solaris has some extra fields in struct passwd that need to be
6212# initialised otherwise nscd crashes.
6213
6214AC_CHECK_MEMBER(struct passwd.pw_comment,
6215 AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),,
6216 [#include <pwd.h>])
6217
6218AC_CHECK_MEMBER(struct passwd.pw_age,
6219 AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),,
6220 [#include <pwd.h>])
6221
6222# AIX 4.3.x and 5.1 do not have as many members in
6223# struct secmethod_table as AIX 5.2
6224AC_CHECK_MEMBERS([struct secmethod_table.method_attrlist], , ,
6225 [#include <usersec.h>])
6226AC_CHECK_MEMBERS([struct secmethod_table.method_version], , ,
6227 [#include <usersec.h>])
6228
6229AC_CACHE_CHECK([for SO_PEERCRED],samba_cv_HAVE_PEERCRED,[
6230AC_TRY_COMPILE([#include <sys/types.h>
6231#include <sys/socket.h>],
6232[struct ucred cred;
6233 socklen_t cred_len;
6234 int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);
6235],
6236samba_cv_HAVE_PEERCRED=yes,samba_cv_HAVE_PEERCRED=no,samba_cv_HAVE_PEERCRED=cross)])
6237if test x"$samba_cv_HAVE_PEERCRED" = x"yes"; then
6238 AC_DEFINE(HAVE_PEERCRED,1,[Whether we can use SO_PEERCRED to get socket credentials])
6239fi
6240
6241
6242#################################################
6243# Check to see if we should use the included popt
6244
6245AC_ARG_WITH(included-popt,
6246[AS_HELP_STRING([--with-included-popt], [use bundled popt library, not from system])],
6247[
6248 case "$withval" in
6249 yes)
6250 INCLUDED_POPT=yes
6251 ;;
6252 no)
6253 INCLUDED_POPT=no
6254 ;;
6255 esac ],
6256)
6257if test x"$INCLUDED_POPT" != x"yes"; then
6258 AC_CHECK_LIB(popt, poptGetContext,
6259 INCLUDED_POPT=no, INCLUDED_POPT=yes)
6260fi
6261
6262AC_MSG_CHECKING(whether to use included popt)
6263if test x"$INCLUDED_POPT" = x"yes"; then
6264 AC_MSG_RESULT(yes)
6265 BUILD_POPT='$(POPT_OBJ)'
6266 POPTLIBS='$(POPT_OBJ)'
6267 FLAGS1="-I\$(srcdir)/../lib/popt"
6268else
6269 AC_MSG_RESULT(no)
6270 BUILD_POPT=""
6271 POPTLIBS="-lpopt"
6272fi
6273AC_SUBST(BUILD_POPT)
6274AC_SUBST(POPTLIBS)
6275AC_SUBST(FLAGS1)
6276
6277#################################################
6278# Check if user wants DNS service discovery support
6279
6280AC_ARG_ENABLE(dnssd,
6281[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=no)])])
6282
6283AC_SUBST(DNSSD_LIBS)
6284if test x"$enable_dnssd" = x"yes"; then
6285 have_dnssd_support=yes
6286
6287 AC_CHECK_HEADERS(dns_sd.h)
6288 if test x"$ac_cv_header_dns_sd_h" != x"yes"; then
6289 have_dnssd_support=no
6290 fi
6291
6292 # On Darwin the DNSSD API is in libc, but on other platforms it's
6293 # probably in -ldns_sd
6294 AC_CHECK_FUNCS(DNSServiceRegister)
6295 AC_CHECK_LIB_EXT(dns_sd, DNSSD_LIBS, DNSServiceRegister)
6296 if test x"$ac_cv_func_DNSServiceRegister" != x"yes" -a \
6297 x"$ac_cv_lib_ext_dns_sd_DNSServiceRegister" != x"yes"; then
6298 have_dnssd_support=no
6299 fi
6300
6301 if test x"$have_dnssd_support" = x"yes"; then
6302 AC_DEFINE(WITH_DNSSD_SUPPORT, 1,
6303 [Whether to enable DNS service discovery support])
6304 else
6305 if test x"$enable_dnssd" = x"yes"; then
6306 AC_MSG_ERROR(DNS service discovery support not available)
6307 fi
6308 fi
6309
6310fi
6311
6312#################################################
6313# Check if user wants avahi support
6314
6315AC_ARG_ENABLE(avahi,
6316[AS_HELP_STRING([--enable-avahi], [Enable Avahi support (default=auto)])])
6317
6318if test x"$enable_avahi" != x"no"; then
6319 have_avahi_support=yes
6320
6321 AC_CHECK_HEADERS(avahi-common/watch.h)
6322 if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
6323 have_avahi_support=no
6324 fi
6325
6326 AC_CHECK_HEADERS(avahi-client/client.h)
6327 if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
6328 have_avahi_support=no
6329 fi
6330
6331 save_LIBS="$LIBS"
6332 AC_CHECK_LIB(avahi-client, avahi_client_new,[have_avahi_client_new=yes])
6333 AC_CHECK_LIB(avahi-common, avahi_strerror,[have_avahi_strerror=yes])
6334 LIBS="$save_LIBS"
6335
6336 if test x"$have_avahi_client_new" != x"yes" -o \
6337 x"$have_avahi_strerror" != x"yes" ; then
6338 have_avahi_support=no
6339 fi
6340
6341 if test x"$have_avahi_support" = x"yes"; then
6342 AC_SUBST(AVAHI_LIBS, "-lavahi-client -lavahi-common")
6343 AC_DEFINE(WITH_AVAHI_SUPPORT, 1,
6344 [Whether to enable avahi support])
6345 AC_SUBST(AVAHI_OBJ, "lib/avahi.o smbd/avahi_register.o")
6346 else
6347 if test x"$enable_avahi" = x"yes"; then
6348 AC_MSG_ERROR(avahi support not available)
6349 fi
6350 fi
6351fi
6352
6353
6354#################################################
6355# Set pthread stuff
6356
6357PTHREAD_CFLAGS=error
6358PTHREAD_LDFLAGS=error
6359
6360# If it's error, then the user didn't
6361# define it.
6362if test "x$PTHREAD_LDFLAGS" = xerror; then
6363 AC_CHECK_LIB(pthread, pthread_attr_init, [
6364 PTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
6365 PTHREAD_LDFLAGS="-lpthread" ])
6366fi
6367
6368if test "x$PTHREAD_LDFLAGS" = xerror; then
6369 AC_CHECK_LIB(pthreads, pthread_attr_init, [
6370 PTHREAD_CFLAGS="-D_THREAD_SAFE"
6371 PTHREAD_LDFLAGS="-lpthreads" ])
6372fi
6373
6374if test "x$PTHREAD_LDFLAGS" = xerror; then
6375 AC_CHECK_LIB(c_r, pthread_attr_init, [
6376 PTHREAD_CFLAGS="-D_THREAD_SAFE -pthread"
6377 PTHREAD_LDFLAGS="-pthread" ])
6378fi
6379
6380if test "x$PTHREAD_LDFLAGS" = xerror; then
6381 AC_CHECK_FUNC(pthread_attr_init, [
6382 PTHREAD_CFLAGS="-D_REENTRANT"
6383 PTHREAD_LDFLAGS="-lpthread" ])
6384fi
6385
6386# especially for HP-UX, where the AC_CHECK_FUNC macro fails to test for
6387# pthread_attr_init. On pthread_mutex_lock it works there...
6388if test "x$PTHREAD_LDFLAGS" = xerror; then
6389 AC_CHECK_LIB(pthread, pthread_mutex_lock, [
6390 PTHREAD_CFLAGS="-D_REENTRANT"
6391 PTHREAD_LDFLAGS="-lpthread" ])
6392fi
6393
6394AC_SUBST(PTHREAD_CFLAGS)
6395AC_SUBST(PTHREAD_LDFLAGS)
6396
6397samba_cv_HAVE_PTHREAD=no
6398if test x"$PTHREAD_CFLAGS" != xerror -a x"$PTHREAD_LDFLAGS" != xerror; then
6399 samba_cv_HAVE_PTHREAD=yes
6400 # now check for pthread.h with pthread-correct CFLAGS and LDFLAGS:
6401 ac_save_CFLAGS=$CFLAGS
6402 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
6403 ac_save_LDFLAGS=$LDFLAGS
6404 LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
6405 AC_CHECK_HEADERS(pthread.h)
6406 CFLAGS=$ac_save_CFLAGS
6407 LDFLAGS=$ac_save_LDFLAGS
6408 AC_DEFINE(HAVE_PTHREAD, 1, [Do we have pthreads around?])
6409fi
6410
6411#################################################
6412# Check if user wants pthreadpool support
6413
6414AC_ARG_ENABLE(pthreadpool,
6415[AS_HELP_STRING([--enable-pthreadpool], [Enable pthreads pool helper support (default=no)])])
6416
6417if test x"$enable_pthreadpool" = xyes -a x"$samba_cv_HAVE_PTHREAD" != x"yes"; then
6418 AC_MSG_ERROR([pthreadpool support cannot be enabled when pthread support was found])
6419fi
6420
6421if test x"$enable_pthreadpool" = x"yes" -a x"$samba_cv_HAVE_PTHREAD" = x"yes"; then
6422 LIBS="$LIBS $PTHREAD_LDFLAGS"
6423 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
6424 AC_DEFINE(WITH_PTHREADPOOL, 1, [Whether to include pthreadpool helpers])
6425 AC_SUBST(PTHREADPOOL_OBJ, "lib/pthreadpool.o")
6426fi
6427
6428#################################################
6429# Check to see if we should use the included iniparser
6430
6431AC_ARG_WITH(included-iniparser,
6432[AS_HELP_STRING([--with-included-iniparser], [use bundled iniparser library, not from system])],
6433[
6434 case "$withval" in
6435 yes)
6436 INCLUDED_INIPARSER=yes
6437 ;;
6438 no)
6439 INCLUDED_INIPARSER=no
6440 ;;
6441 esac ],
6442)
6443if test x"$INCLUDED_INIPARSER" != x"yes"; then
6444 AC_CHECK_LIB(iniparser, iniparser_load,
6445 INCLUDED_INIPARSER=no, INCLUDED_INIPARSER=yes)
6446fi
6447
6448AC_MSG_CHECKING(whether to use included iniparser)
6449if test x"$INCLUDED_INIPARSER" = x"yes"; then
6450 AC_MSG_RESULT(yes)
6451 BUILD_INIPARSER='$(INIPARSER_OBJ)'
6452 INIPARSERLIBS=""
6453 FLAGS1="$FLAGS1 -I\$(srcdir)/iniparser/src"
6454else
6455 AC_MSG_RESULT(no)
6456 BUILD_INIPARSER=""
6457 INIPARSERLIBS="-liniparser"
6458fi
6459AC_SUBST(BUILD_INIPARSER)
6460AC_SUBST(INIPARSERLIBS)
6461AC_SUBST(FLAGS1)
6462
6463
6464
6465# Checks for the vfs_fileid module
6466# Start
6467AC_CHECK_FUNC(getmntent)
6468
6469AC_CHECK_HEADERS(sys/statfs.h)
6470
6471AC_MSG_CHECKING([vfs_fileid: checking for statfs() and struct statfs.f_fsid)])
6472AC_CACHE_VAL(vfsfileid_cv_statfs,[
6473 AC_TRY_RUN([
6474 #include <sys/types.h>
6475 #include <sys/statfs.h>
6476 int main(void)
6477 {
6478 struct statfs fsd;
6479 fsid_t fsid = fsd.f_fsid;
6480 return statfs (".", &fsd);
6481 }],
6482 vfsfileid_cv_statfs=yes,
6483 vfsfileid_cv_statfs=no,
6484 vfsfileid_cv_statfs=cross)
6485])
6486AC_MSG_RESULT($vfsfileid_cv_statfs)
6487
6488if test x"$ac_cv_func_getmntent" = x"yes" -a \
6489 x"$vfsfileid_cv_statfs" = x"yes"; then
6490 default_shared_modules="$default_shared_modules vfs_fileid"
6491fi
6492# End
6493# Checks for the vfs_fileid module
6494
6495
6496for i in `echo $default_static_modules | sed -e 's/,/ /g'`
6497do
6498 eval MODULE_DEFAULT_$i=STATIC
6499done
6500
6501for i in `echo $default_shared_modules | sed -e 's/,/ /g'`
6502do
6503 dnl Fall back to static if we cannot build shared libraries
6504 eval MODULE_DEFAULT_$i=STATIC
6505
6506 if test $BLDSHARED = true; then
6507 eval MODULE_DEFAULT_$i=SHARED
6508 fi
6509done
6510
6511dnl Always build these modules static
6512MODULE_rpc_spoolss=STATIC
6513MODULE_rpc_srvsvc=STATIC
6514MODULE_idmap_tdb=STATIC
6515MODULE_idmap_passdb=STATIC
6516MODULE_idmap_nss=STATIC
6517
6518MODULE_nss_info_template=STATIC
6519
6520AC_ARG_WITH(static-modules,
6521[AS_HELP_STRING([--with-static-modules=MODULES], [Comma-separated list of names of modules to statically link in])],
6522[ if test $withval; then
6523 for i in `echo $withval | sed -e 's/,/ /g'`
6524 do
6525 eval MODULE_$i=STATIC
6526 done
6527fi ])
6528
6529AC_ARG_WITH(shared-modules,
6530[AS_HELP_STRING([--with-shared-modules=MODULES], [Comma-separated list of names of modules to build shared])],
6531[ if test $withval; then
6532 for i in `echo $withval | sed -e 's/,/ /g'`
6533 do
6534 eval MODULE_$i=SHARED
6535 done
6536fi ])
6537
6538if test x"$MODULE_DEFAULT_vfs_notify_fam" = xSTATIC -o \
6539 x"$MODULE_vfs_notify_fam" = xSTATIC ; then
6540 SMBD_FAM_LIBS="$SMB_FAM_LIBS"
6541 AC_SUBST(SMBD_FAM_LIBS)
6542fi
6543
6544SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o, "bin/ldapsam.$SHLIBEXT", PDB,
6545 [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
6546SMB_MODULE(pdb_ads, passdb/pdb_ads.o \$(TLDAP_OBJ), "bin/ads.$SHLIBEXT", PDB)
6547SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
6548SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
6549SMB_MODULE(pdb_wbc_sam, passdb/pdb_wbc_sam.o, "bin/wbc_sam.$SHLIBEXT", PDB)
6550SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
6551
6552
6553SMB_MODULE(rpc_lsarpc, \$(RPC_LSA_OBJ), "bin/librpc_lsarpc.$SHLIBEXT", RPC)
6554SMB_MODULE(rpc_winreg, \$(RPC_REG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC)
6555SMB_MODULE(rpc_initshutdown, \$(RPC_INITSHUTDOWN_OBJ), "bin/librpc_initshutdown.$SHLIBEXT", RPC)
6556SMB_MODULE(rpc_dssetup, \$(RPC_DSSETUP_OBJ), "bin/librpc_dssetup.$SHLIBEXT", RPC)
6557SMB_MODULE(rpc_wkssvc, \$(RPC_WKS_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC)
6558SMB_MODULE(rpc_svcctl, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl.$SHLIBEXT", RPC)
6559SMB_MODULE(rpc_ntsvcs, \$(RPC_NTSVCS_OBJ), "bin/librpc_ntsvcs.$SHLIBEXT", RPC)
6560SMB_MODULE(rpc_netlogon, \$(RPC_NETLOG_OBJ), "bin/librpc_NETLOGON.$SHLIBEXT", RPC)
6561SMB_MODULE(rpc_netdfs, \$(RPC_DFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC)
6562SMB_MODULE(rpc_srvsvc, \$(RPC_SVC_OBJ), "bin/librpc_svcsvc.$SHLIBEXT", RPC)
6563SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC)
6564SMB_MODULE(rpc_eventlog, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog.$SHLIBEXT", RPC)
6565SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
6566SMB_MODULE(rpc_rpcecho, \$(RPC_ECHO_OBJ), "bin/librpc_rpcecho.$SHLIBEXT", RPC)
6567SMB_SUBSYSTEM(RPC,smbd/server.o)
6568
6569SMB_MODULE(idmap_ldap, winbindd/idmap_ldap.o, "bin/ldap.$SHLIBEXT", IDMAP)
6570SMB_MODULE(idmap_tdb, winbindd/idmap_tdb.o, "bin/tdb.$SHLIBEXT", IDMAP)
6571SMB_MODULE(idmap_tdb2, winbindd/idmap_tdb2.o, "bin/tdb2.$SHLIBEXT", IDMAP)
6572SMB_MODULE(idmap_passdb, winbindd/idmap_passdb.o, "bin/passdb.$SHLIBEXT", IDMAP)
6573SMB_MODULE(idmap_nss, winbindd/idmap_nss.o, "bin/nss.$SHLIBEXT", IDMAP)
6574SMB_MODULE(idmap_rid, winbindd/idmap_rid.o, "bin/rid.$SHLIBEXT", IDMAP)
6575SMB_MODULE(idmap_ad, winbindd/idmap_ad.o, "bin/ad.$SHLIBEXT", IDMAP)
6576SMB_MODULE(idmap_hash, \$(IDMAP_HASH_OBJ), "bin/hash.$SHLIBEXT", IDMAP)
6577SMB_MODULE(idmap_adex, \$(IDMAP_ADEX_OBJ), "bin/adex.$SHLIBEXT", IDMAP)
6578SMB_SUBSYSTEM(IDMAP, winbindd/idmap.o)
6579
6580SMB_MODULE(nss_info_template, winbindd/nss_info_template.o, "bin/template.$SHLIBEXT", NSS_INFO)
6581SMB_SUBSYSTEM(NSS_INFO, winbindd/nss_info.o)
6582
6583SMB_MODULE(charset_weird, modules/weird.o, "bin/weird.$SHLIBEXT", CHARSET)
6584SMB_MODULE(charset_CP850, modules/CP850.o, "bin/CP850.$SHLIBEXT", CHARSET)
6585SMB_MODULE(charset_CP437, modules/CP437.o, "bin/CP437.$SHLIBEXT", CHARSET)
6586SMB_MODULE(charset_macosxfs, modules/charset_macosxfs.o,"bin/macosxfs.$SHLIBEXT", CHARSET)
6587SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
6588
6589SMB_MODULE(auth_sam, \$(AUTH_SAM_OBJ), "bin/sam.$SHLIBEXT", AUTH)
6590SMB_MODULE(auth_unix, \$(AUTH_UNIX_OBJ), "bin/unix.$SHLIBEXT", AUTH)
6591SMB_MODULE(auth_winbind, \$(AUTH_WINBIND_OBJ), "bin/winbind.$SHLIBEXT", AUTH)
6592SMB_MODULE(auth_wbc, \$(AUTH_WBC_OBJ), "bin/wbc.$SHLIBEXT", AUTH)
6593SMB_MODULE(auth_server, \$(AUTH_SERVER_OBJ), "bin/smbserver.$SHLIBEXT", AUTH)
6594SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
6595SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
6596SMB_MODULE(auth_script, \$(AUTH_SCRIPT_OBJ), "bin/script.$SHLIBEXT", AUTH)
6597SMB_MODULE(auth_netlogond, \$(AUTH_NETLOGOND_OBJ), "bin/netlogond.$SHLIBEXT", AUTH)
6598SMB_SUBSYSTEM(AUTH,auth/auth.o)
6599
6600SMB_MODULE(vfs_default, \$(VFS_DEFAULT_OBJ), "bin/default.$SHLIBEXT", VFS)
6601SMB_MODULE(vfs_recycle, \$(VFS_RECYCLE_OBJ), "bin/recycle.$SHLIBEXT", VFS)
6602SMB_MODULE(vfs_audit, \$(VFS_AUDIT_OBJ), "bin/audit.$SHLIBEXT", VFS)
6603SMB_MODULE(vfs_extd_audit, \$(VFS_EXTD_AUDIT_OBJ), "bin/extd_audit.$SHLIBEXT", VFS)
6604SMB_MODULE(vfs_full_audit, \$(VFS_FULL_AUDIT_OBJ), "bin/full_audit.$SHLIBEXT", VFS)
6605SMB_MODULE(vfs_netatalk, \$(VFS_NETATALK_OBJ), "bin/netatalk.$SHLIBEXT", VFS)
6606SMB_MODULE(vfs_fake_perms, \$(VFS_FAKE_PERMS_OBJ), "bin/fake_perms.$SHLIBEXT", VFS)
6607SMB_MODULE(vfs_default_quota, \$(VFS_DEFAULT_QUOTA_OBJ), "bin/default_quota.$SHLIBEXT", VFS)
6608SMB_MODULE(vfs_readonly, \$(VFS_READONLY_OBJ), "bin/readonly.$SHLIBEXT", VFS)
6609SMB_MODULE(vfs_cap, \$(VFS_CAP_OBJ), "bin/cap.$SHLIBEXT", VFS)
6610SMB_MODULE(vfs_expand_msdfs, \$(VFS_EXPAND_MSDFS_OBJ), "bin/expand_msdfs.$SHLIBEXT", VFS)
6611SMB_MODULE(vfs_shadow_copy, \$(VFS_SHADOW_COPY_OBJ), "bin/shadow_copy.$SHLIBEXT", VFS)
6612SMB_MODULE(vfs_shadow_copy2, \$(VFS_SHADOW_COPY2_OBJ), "bin/shadow_copy2.$SHLIBEXT", VFS)
6613SMB_MODULE(vfs_afsacl, \$(VFS_AFSACL_OBJ), "bin/afsacl.$SHLIBEXT", VFS)
6614SMB_MODULE(vfs_xattr_tdb, \$(VFS_XATTR_TDB_OBJ), "bin/xattr_tdb.$SHLIBEXT", VFS)
6615SMB_MODULE(vfs_posixacl, \$(VFS_POSIXACL_OBJ), "bin/posixacl.$SHLIBEXT", VFS)
6616SMB_MODULE(vfs_aixacl, \$(VFS_AIXACL_OBJ), "bin/aixacl.$SHLIBEXT", VFS)
6617SMB_MODULE(vfs_aixacl2, \$(VFS_AIXACL2_OBJ), "bin/aixacl2.$SHLIBEXT", VFS)
6618SMB_MODULE(vfs_solarisacl, \$(VFS_SOLARISACL_OBJ), "bin/solarisacl.$SHLIBEXT", VFS)
6619SMB_MODULE(vfs_irixacl, \$(VFS_IRIXACL_OBJ), "bin/irixacl.$SHLIBEXT", VFS)
6620SMB_MODULE(vfs_hpuxacl, \$(VFS_HPUXACL_OBJ), "bin/hpuxacl.$SHLIBEXT", VFS)
6621SMB_MODULE(vfs_tru64acl, \$(VFS_TRU64ACL_OBJ), "bin/tru64acl.$SHLIBEXT", VFS)
6622SMB_MODULE(vfs_catia, \$(VFS_CATIA_OBJ), "bin/catia.$SHLIBEXT", VFS)
6623SMB_MODULE(vfs_streams_xattr, \$(VFS_STREAMS_XATTR_OBJ), "bin/streams_xattr.$SHLIBEXT", VFS)
6624SMB_MODULE(vfs_streams_depot, \$(VFS_STREAMS_DEPOT_OBJ), "bin/streams_depot.$SHLIBEXT", VFS)
6625SMB_MODULE(vfs_cacheprime, \$(VFS_CACHEPRIME_OBJ), "bin/cacheprime.$SHLIBEXT", VFS)
6626SMB_MODULE(vfs_prealloc, \$(VFS_PREALLOC_OBJ), "bin/prealloc.$SHLIBEXT", VFS)
6627SMB_MODULE(vfs_commit, \$(VFS_COMMIT_OBJ), "bin/commit.$SHLIBEXT", VFS)
6628SMB_MODULE(vfs_gpfs, \$(VFS_GPFS_OBJ), "bin/gpfs.$SHLIBEXT", VFS)
6629SMB_MODULE(vfs_readahead, \$(VFS_READAHEAD_OBJ), "bin/readahead.$SHLIBEXT", VFS)
6630SMB_MODULE(vfs_tsmsm, \$(VFS_TSMSM_OBJ), "bin/tsmsm.$SHLIBEXT", VFS)
6631SMB_MODULE(vfs_fileid, \$(VFS_FILEID_OBJ), "bin/fileid.$SHLIBEXT", VFS)
6632SMB_MODULE(vfs_aio_fork, \$(VFS_AIO_FORK_OBJ), "bin/aio_fork.$SHLIBEXT", VFS)
6633SMB_MODULE(vfs_preopen, \$(VFS_PREOPEN_OBJ), "bin/preopen.$SHLIBEXT", VFS)
6634SMB_MODULE(vfs_syncops, \$(VFS_SYNCOPS_OBJ), "bin/syncops.$SHLIBEXT", VFS)
6635SMB_MODULE(vfs_zfsacl, \$(VFS_ZFSACL_OBJ), "bin/zfsacl.$SHLIBEXT", VFS)
6636SMB_MODULE(vfs_notify_fam, \$(VFS_NOTIFY_FAM_OBJ), "bin/notify_fam.$SHLIBEXT", VFS)
6637SMB_MODULE(vfs_acl_xattr, \$(VFS_ACL_XATTR_OBJ), "bin/acl_xattr.$SHLIBEXT", VFS)
6638SMB_MODULE(vfs_acl_tdb, \$(VFS_ACL_TDB_OBJ), "bin/acl_tdb.$SHLIBEXT", VFS)
6639SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
6640SMB_MODULE(vfs_onefs, \$(VFS_ONEFS), "bin/onefs.$SHLIBEXT", VFS)
6641SMB_MODULE(vfs_onefs_shadow_copy, \$(VFS_ONEFS_SHADOW_COPY), "bin/onefs_shadow_copy.$SHLIBEXT", VFS)
6642SMB_MODULE(vfs_dirsort, \$(VFS_DIRSORT_OBJ), "bin/dirsort.$SHLIBEXT", VFS)
6643SMB_MODULE(vfs_scannedonly, \$(VFS_SCANNEDONLY_OBJ), "bin/scannedonly.$SHLIBEXT", VFS)
6644
6645SMB_SUBSYSTEM(VFS,smbd/vfs.o)
6646
6647SMB_MODULE(perfcount_onefs, \$(PERFCOUNT_ONEFS), "bin/pc_onefs.$SHLIBEXT", PERFCOUNT)
6648SMB_MODULE(perfcount_test, \$(PERFCOUNT_TEST), "bin/pc_test.$SHLIBEXT", PERFCOUNT)
6649SMB_SUBSYSTEM(PERFCOUNT,smbd/perfcount.o)
6650
6651SMB_MODULE(gpext_registry, libgpo/gpext/registry.o, "bin/registry.$SHLIBEXT", GPEXT)
6652SMB_MODULE(gpext_scripts, libgpo/gpext/scripts.o, "bin/scripts.$SHLIBEXT", GPEXT)
6653SMB_MODULE(gpext_security, libgpo/gpext/security.o, "bin/security.$SHLIBEXT", GPEXT)
6654SMB_SUBSYSTEM(GPEXT, libgpo/gpext/gpext.o)
6655
6656AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
6657
6658#################################################
6659# do extra things if we are running insure
6660
6661if test "${ac_cv_prog_CC}" = "insure"; then
6662 CPPFLAGS="$CPPFLAGS -D__INSURE__"
6663fi
6664
6665#################################################
6666# If run from the build farm, enable NASTY hacks
6667#################################################
6668AC_MSG_CHECKING(whether to enable build farm hacks)
6669if test x"$RUN_FROM_BUILD_FARM" = x"yes"; then
6670 AC_MSG_RESULT(yes)
6671 AC_DEFINE(ENABLE_BUILD_FARM_HACKS, 1, [Defined if running in the build farm])
6672else
6673 AC_MSG_RESULT(no)
6674fi
6675
6676#################################################
6677# check for bad librt/libpthread interactions
6678
6679if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes" -o \
6680 x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes" -o \
6681 x"$samba_cv_HAVE_AIO64" = x"yes" -o \
6682 x"$samba_cv_HAVE_AIO" = x"yes" ; then
6683
6684SMB_IF_RTSIGNAL_BUG(
6685 [
6686 # Have RT_SIGNAL bug, need to check whether the problem will
6687 # affect anything we have configured.
6688
6689 rt_do_error=no
6690 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
6691 if test x"$rt_signal_lease_ok" = x"no" ; then
6692 rt_do_error=yes
6693 fi
6694 fi
6695
6696 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
6697 if test x"$rt_signal_notify_ok" = x"no" ; then
6698 rt_do_error=yes
6699 fi
6700 fi
6701
6702 if test x"$samba_cv_HAVE_AIO64" = x"yes" -o \
6703 x"$samba_cv_HAVE_AIO" = x"yes" ; then
6704 if test x"$rt_signal_aio_ok" = x"no" ; then
6705 rt_do_error=yes
6706 fi
6707 fi
6708
6709 if test x"$rt_do_error" = x"yes" ; then
6710 SMB_IS_LIBPTHREAD_LINKED(
6711 [
6712 cat<<MSG
6713
6714*** On this platforms, linking Samba against pthreads causes problems
6715*** with the oplock and change notification mechanisms. You may be
6716*** using pthreads as a side-effect of using the --with-aio-support
6717*** or --with-profiling-data options. Please remove these and try again.
6718
6719MSG
6720 ],
6721 [
6722 cat<<MSG
6723
6724*** On this platform, the oplock and change notification mechanisms do not
6725*** appear to work. Please report this problem to samba-technical@samba.org
6726*** and attach the config.log file from this directory.
6727
6728MSG
6729 ])
6730 AC_MSG_ERROR(unable to use realtime signals on this platform)
6731 fi
6732 ],
6733 [
6734 # no RT_SIGNAL bug, we are golden
6735 SMB_IS_LIBPTHREAD_LINKED(
6736 [
6737 AC_MSG_WARN(using libpthreads - this may degrade performance)
6738 ])
6739
6740 ],
6741 [
6742 # cross compiling, I hope you know what you are doing
6743 true
6744 ])
6745
6746fi
6747
6748AC_ARG_ENABLE(merged-build,
6749[AS_HELP_STRING([--enable-merged-build], [Build Samba 4 as well])],
6750[ enable_merged_build=$enableval ], [ enable_merged_build=auto ])
6751
6752if test x"$enable_merged_build" = x"yes" -a \
6753 x"$merged_build_possible" = x"no" ; then
6754 AC_MSG_ERROR(Merged build required but not possible)
6755fi
6756
6757m4_include(../lib/zlib/zlib.m4)
6758
6759if test x$enable_merged_build = xauto; then
6760 # Check for python
6761 m4_include(../m4/check_python.m4)
6762 AC_SAMBA_PYTHON_DEVEL([true], [merged_build_possible=no])
6763
6764 AC_MSG_CHECKING([whether it would be possible to do a merged build])
6765 AC_MSG_RESULT([$merged_build_possible])
6766
6767 # Enable merged build automatically if possible, when in developer mode
6768 # Don't enable merged build automatically in 3.4.0.
6769 #if test "x$developer" = xyes; then
6770 # enable_merged_build=$merged_build_possible
6771 #fi
6772fi
6773
6774if test x$enable_merged_build = xyes; then
6775 MERGED_BUILD=1
6776 saved_USESHARED="$USESHARED"
6777 USESHARED="false"
6778 m4_include(samba4.m4)
6779 USESHARED="$saved_USESHARED"
6780fi
6781
6782AC_SUBST(ZLIB_LIBS)
6783AC_SUBST(ZLIB_OBJS)
6784AC_ZLIB([ZLIB_OBJS=""], [
6785 ZLIB_LIBS=""
6786 for o in adler32.o compress.o crc32.o gzio.o uncompr.o \
6787 deflate.o trees.o zutil.o inflate.o infback.o \
6788 inftrees.o inffast.o
6789 do
6790 ZLIB_OBJS="$ZLIB_OBJS ../lib/zlib/$o"
6791 done
6792 CFLAGS="-I../lib/zlib $CFLAGS"
6793])
6794
6795AC_ARG_ENABLE(dmalloc, [AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging [default=no]])])
6796
6797if test "x$enable_dmalloc" = xyes
6798then
6799 AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
6800 AC_DEFINE(DMALLOC_FUNC_CHECK, 1,
6801 [Define to check invariants around some common functions])
6802 LIBS="$LIBS -ldmalloc"
6803fi
6804
6805dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
6806LIB_REMOVE_USR_LIB(LDFLAGS)
6807LIB_REMOVE_USR_LIB(LIBS)
6808
6809dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
6810CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
6811CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
6812
6813#################################################
6814# Display summary of libraries detected
6815
6816AC_MSG_RESULT([Using libraries:])
6817AC_MSG_RESULT([ LIBS = $LIBS])
6818if test x"$with_ads_support" != x"no"; then
6819 AC_MSG_RESULT([ KRB5_LIBS = $KRB5_LIBS])
6820fi
6821if test x"$with_ldap_support" != x"no"; then
6822 AC_MSG_RESULT([ LDAP_LIBS = $LDAP_LIBS])
6823fi
6824if test x"$with_dnsupdate_support" != x"no"; then
6825 AC_MSG_RESULT([ UUID_LIBS = $UUID_LIBS])
6826fi
6827if test x"$have_dnssd_support" != x"no"; then
6828 AC_MSG_RESULT([ DNSSD_LIBS = $DNSSD_LIBS])
6829fi
6830AC_MSG_RESULT([ AUTH_LIBS = $AUTH_LIBS])
6831
6832#################################################
6833# final configure stuff
6834
6835AC_MSG_CHECKING([configure summary])
6836AC_TRY_RUN([#include "${srcdir-.}/../tests/summary.c"],
6837 AC_MSG_RESULT(yes),
6838 AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
6839 AC_MSG_WARN([cannot run when cross-compiling]))
6840
6841dnl Merge in developer cflags from now on
6842AC_SUBST(DEVELOPER_CFLAGS)
6843if test x"$krb5_developer" = x"yes" -o x"$developer" = x"yes" -o x"$picky_developer" = x"yes"; then
6844 CFLAGS="${CFLAGS} \$(DEVELOPER_CFLAGS)"
6845fi
6846
6847# Stuff the smbd-only libraries at the end of the smbd link
6848# path (if we have them).
6849SMBD_LIBS="$samba_dmapi_libs"
6850AC_SUBST(SMBD_LIBS)
6851
6852CFLAGS="${CFLAGS} \$(FLAGS)"
6853
6854if test x$MERGED_BUILD != x1; then
6855 CFLAGS="${CFLAGS} -D_SAMBA_BUILD_=3"
6856else
6857 if test x"$BLDSHARED" = x"true" ; then
6858 LDFLAGS="$LDFLAGS -L./bin"
6859 fi
6860fi
6861
6862AC_SUBST(MAKEFILE)
6863if test x$samba_cv_gnu_make = xyes; then
6864 MAKEFILE=Makefile
6865else
6866 # When we don't have GNU Make, generate a copy of Makefile.in
6867 # that doesn't have the "include " statements but just includes
6868 # the files verbatim.
6869 MAKEFILE=Makefile-noincludes
6870 $PERL ./script/expand-includes.pl Makefile.in > $MAKEFILE.in
6871fi
6872AC_OUTPUT($MAKEFILE
6873 script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh
6874 lib/netapi/examples/Makefile
6875 lib/netapi/tests/Makefile
6876 pkgconfig/smbclient.pc
6877 pkgconfig/wbclient.pc
6878 pkgconfig/netapi.pc
6879 pkgconfig/smbsharemodes.pc
6880 ../examples/libsmbclient/Makefile.internal
6881 )
6882dnl If we had to expand the includes, make tsure the output file is moved back
6883AC_OUTPUT_COMMANDS([
6884if test x$MAKEFILE != Makefile; then
6885 mv $MAKEFILE Makefile
6886fi
6887])
6888
6889#################################################
6890# Print very concise instructions on building/use
6891if test "x$enable_dmalloc" = xyes
6892then
6893 AC_MSG_RESULT([Note: The dmalloc debug library will be included. To turn it on use])
6894 AC_MSG_RESULT([ \$ eval \`dmalloc samba\`.])
6895fi
Note: See TracBrowser for help on using the repository browser.