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