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

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

Samba 3.5: Update trunk to 3.5.9

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