source: branches/samba-3.5.x/source3/configure.in@ 773

Last change on this file since 773 was 739, checked in by Silvan Scherrer, 13 years ago

Samba Server 3.5: update branche to 3.5.19

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