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

Last change on this file since 537 was 488, checked in by Silvan Scherrer, 15 years ago

Samba Server 3.5: added configure changes to configure.in

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