source: branches/samba-3.0/source/configure.in@ 157

Last change on this file since 157 was 140, checked in by Paul Smedley, 17 years ago

Update branch to 3.0.31 release

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