r15: syncing for 3.0.3pre2
[Samba.git] / source / configure.in
blob59b1d062f63e477e413538f88a5fef5ab0311988
1 dnl Process this file with autoconf to produce a configure script.
3 dnl We must use autotools 2.53 or above
4 AC_PREREQ(2.53)
5 AC_INIT(include/includes.h)
6 AC_CONFIG_HEADER(include/config.h)
8 AC_DISABLE_STATIC
9 AC_ENABLE_SHARED
11 #################################################
12 # Directory handling stuff to support both the
13 # legacy SAMBA directories and FHS compliant
14 # ones...
15 AC_PREFIX_DEFAULT(/usr/local/samba)
17 lockdir="\${VARDIR}/locks"
18 piddir="\${VARDIR}/locks"
19 mandir="\${prefix}/man"
20 logfilebase="\${VARDIR}"
21 privatedir="\${prefix}/private"
22 libdir="\${prefix}/lib"
23 configdir="\${LIBDIR}"
24 swatdir="\${prefix}/swat"
26 AC_ARG_WITH(fhs, 
27 [  --with-fhs              Use FHS-compliant paths (default=no)],
28 [ case "$withval" in
29   yes)
30     lockdir="\${VARDIR}/lib/samba"
31     piddir="\${VARDIR}/run"
32     mandir="\${prefix}/share/man"
33     logfilebase="\${VARDIR}/log/samba"
34     privatedir="\${CONFIGDIR}/private"
35     libdir="\${prefix}/lib/samba"
36     configdir="${sysconfdir}/samba"
37     swatdir="\${DATADIR}/samba/swat"
38     ;;
39   esac])
41 #################################################
42 # set private directory location
43 AC_ARG_WITH(privatedir,
44 [  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
45 [ case "$withval" in
46   yes|no)
47   #
48   # Just in case anybody calls it without argument
49   #
50     AC_MSG_WARN([--with-privatedir called without argument - will use default])
51   ;;
52   * )
53     privatedir="$withval"
54     ;;
55   esac])
57 #################################################
58 # set lock directory location
59 AC_ARG_WITH(lockdir,
60 [  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
61 [ case "$withval" in
62   yes|no)
63   #
64   # Just in case anybody calls it without argument
65   #
66     AC_MSG_WARN([--with-lockdir called without argument - will use default])
67   ;;
68   * )
69     lockdir="$withval"
70     ;;
71   esac])
73 #################################################
74 # set pid directory location
75 AC_ARG_WITH(piddir,
76 [  --with-piddir=DIR       Where to put pid files ($ac_default_prefix/var/locks)],
77 [ case "$withval" in
78   yes|no)
79   #
80   # Just in case anybody calls it without argument
81   #
82     AC_MSG_WARN([--with-piddir called without argument - will use default])
83   ;;
84   * )
85     piddir="$withval"
86     ;;
87   esac])
89 #################################################
90 # set SWAT directory location
91 AC_ARG_WITH(swatdir,
92 [  --with-swatdir=DIR      Where to put SWAT files ($ac_default_prefix/swat)],
93 [ case "$withval" in
94   yes|no)
95   #
96   # Just in case anybody does it
97   #
98     AC_MSG_WARN([--with-swatdir called without argument - will use default])
99   ;;
100   * )
101     swatdir="$withval"
102     ;;
103   esac])
105 #################################################
106 # set configuration directory location
107 AC_ARG_WITH(configdir,
108 [  --with-configdir=DIR    Where to put configuration files ($libdir)],
109 [ case "$withval" in
110   yes|no)
111   #
112   # Just in case anybody does it
113   #
114     AC_MSG_WARN([--with-configdir called without argument - will use default])
115   ;;
116   * )
117     configdir="$withval"
118     ;;
119   esac])
121 #################################################
122 # set log directory location
123 AC_ARG_WITH(logfilebase,
124 [  --with-logfilebase=DIR  Where to put log files ($VARDIR)],
125 [ case "$withval" in
126   yes|no)
127   #
128   # Just in case anybody does it
129   #
130     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
131   ;;
132   * )
133     logfilebase="$withval"
134     ;;
135   esac])
137 #################################################
138 # set lib directory location
139 AC_ARG_WITH(libdir,
140 [  --with-libdir=DIR       Where to put libdir ($libdir)],
141 [ case "$withval" in
142   yes|no)
143   #
144   # Just in case anybody does it
145   #
146     AC_MSG_WARN([--with-libdir without argument - will use default])
147   ;;
148   * )
149     libdir="$withval"
150     ;;
151   esac])
153 #################################################
154 # set lib directory location
155 AC_ARG_WITH(mandir,
156 [  --with-mandir=DIR       Where to put man pages ($mandir)],
157 [ case "$withval" in
158   yes|no)
159   #
160   # Just in case anybody does it
161   #
162     AC_MSG_WARN([--with-mandir without argument - will use default])
163   ;;
164   * )
165     mandir="$withval"
166     ;;
167   esac])
169 AC_ARG_WITH(cfenc,
170 [  --with-cfenc=HEADERDIR  Use internal CoreFoundation encoding API
171                           for optimization (Mac OS X/Darwin only)],
173 # May be in source $withval/CoreFoundation/StringEncodings.subproj.
174 # Should have been in framework $withval/CoreFoundation.framework/Headers.
175 for d in \
176     $withval/CoreFoundation/StringEncodings.subproj \
177     $withval/StringEncodings.subproj \
178     $withval/CoreFoundation.framework/Headers \
179     $withval/Headers \
180     $withval
182     if test -r $d/CFStringEncodingConverter.h; then
183         ln -sfh $d include/CoreFoundation
184     fi
185 done
188 AC_SUBST(configdir)
189 AC_SUBST(lockdir)
190 AC_SUBST(piddir)
191 AC_SUBST(logfilebase)
192 AC_SUBST(privatedir)
193 AC_SUBST(swatdir)
194 AC_SUBST(bindir)
195 AC_SUBST(sbindir)
197 dnl Unique-to-Samba variables we'll be playing with.
198 AC_SUBST(SHELL)
199 AC_SUBST(LDSHFLAGS)
200 AC_SUBST(SONAMEFLAG)
201 AC_SUBST(SHLD)
202 AC_SUBST(HOST_OS)
203 AC_SUBST(PICFLAGS)
204 AC_SUBST(PICSUFFIX)
205 AC_SUBST(SHLIBEXT)
206 AC_SUBST(INSTALLCLIENT)
207 AC_SUBST(INSTALLCLIENTCMD_SH)
208 AC_SUBST(INSTALLCLIENTCMD_A)
209 AC_SUBST(LIBSMBCLIENT_SHARED)
210 AC_SUBST(LIBSMBCLIENT)
211 AC_SUBST(PRINT_LIBS)
212 AC_SUBST(AUTH_LIBS)
213 AC_SUBST(ACL_LIBS)
214 AC_SUBST(PASSDB_LIBS)
215 AC_SUBST(IDMAP_LIBS)
216 AC_SUBST(KRB5_LIBS)
217 AC_SUBST(LDAP_LIBS)
218 AC_SUBST(SHLIB_PROGS)
219 AC_SUBST(SMBWRAPPER)
220 AC_SUBST(EXTRA_BIN_PROGS)
221 AC_SUBST(EXTRA_SBIN_PROGS)
222 AC_SUBST(EXTRA_ALL_TARGETS)
224 AC_ARG_ENABLE(debug, 
225 [  --enable-debug          Turn on compiler debugging information (default=no)],
226     [if eval "test x$enable_debug = xyes"; then
227         CFLAGS="${CFLAGS} -g"
228     fi])
230 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
231     [if eval "test x$enable_developer = xyes"; then
232         developer=yes
233         CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
234     fi])
236 AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer  Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
237     [if eval "test x$enable_krb5developer = xyes"; then
238         developer=yes
239         CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
240     fi])
242 AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc        Enable heap debugging [default=no]])
244 if test "x$enable_dmalloc" = xyes
245 then
246         AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
247         AC_DEFINE(DMALLOC_FUNC_CHECK, 1, 
248                   [Define to check invariants around some common functions])
249         LIBS="$LIBS -ldmalloc"  
252 dnl Checks for programs.
255 ## for some reason this macro resets the CFLAGS
256 ## so save and restore
258 OLD_CFLAGS=${CFLAGS}
259 AC_PROG_CC
260 CFLAGS=${OLD_CFLAGS}
262 OLD_CFLAGS=${CFLAGS}
263 AC_PROG_CPP
264 CFLAGS=${OLD_CFLAGS}
266 AC_PROG_INSTALL
267 AC_PROG_AWK
268 AC_PATH_PROG(PERL, perl)
270 AC_CHECK_TOOL(AR, ar)
272 # compile with optimization and without debugging by default, but
273 # allow people to set their own preference.
274 if test "x$CFLAGS" = x
275 then
276   CFLAGS="-O ${CFLAGS}"
279 dnl Check if we use GNU ld
280 LD=ld
281 AC_PROG_LD_GNU
283 dnl needed before AC_TRY_COMPILE
284 AC_ISC_POSIX
286 dnl look for executable suffix
287 AC_EXEEXT
289 dnl Check if C compiler understands -c and -o at the same time
290 AC_PROG_CC_C_O
291 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
292       BROKEN_CC=
293 else
294       BROKEN_CC=#
296 AC_SUBST(BROKEN_CC)
298 dnl Check if the C compiler understands -Werror
299 AC_CACHE_CHECK([that the C compiler understands -Werror],samba_cv_HAVE_Werror, [
300  AC_TRY_RUN_STRICT([
301   int main(void)
302   {
303         return 0;
304   }],[-Werror],[$CPPFLAGS],[$LDFLAGS],
305   samba_cv_HAVE_Werror=yes,samba_cv_HAVE_Werror=no,samba_cv_HAVE_Werror=cross)])
306 if test x"$samba_cv_HAVE_Werror" = x"yes"; then
307    Werror_FLAGS="-Werror"
308 else 
309 dnl Check if the C compiler understands -w2
310 AC_CACHE_CHECK([that the C compiler understands -w2],samba_cv_HAVE_w2, [
311  AC_TRY_RUN_STRICT([
312   int main(void)
313   {
314         return 0;
315   }],[-w2],[$CPPFLAGS],[$LDFLAGS],
316   samba_cv_HAVE_w2=yes,samba_cv_HAVE_w2=no,samba_cv_HAVE_w2=cross)])
317 if test x"$samba_cv_HAVE_w2" = x"yes"; then
318    Werror_FLAGS="-w2"
322 dnl Check if the C compiler understands volatile (it should, being ANSI).
323 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
324     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
325         samba_cv_volatile=yes,samba_cv_volatile=no)])
326 if test x"$samba_cv_volatile" = x"yes"; then
327    AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
330 UNAME_S=`(uname -s) 2>/dev/null` || UNAME_S="unknown"
331 AC_MSG_CHECKING(uname -s)
332 AC_MSG_RESULT(${UNAME_S})
334 UNAME_R=`(uname -r) 2>/dev/null` || UNAME_R="unknown"
335 AC_MSG_CHECKING(uname -r)
336 AC_MSG_RESULT(${UNAME_R})
338 UNAME_M=`(uname -m) 2>/dev/null` || UNAME_M="unknown"
339 AC_MSG_CHECKING(uname -m)
340 AC_MSG_RESULT(${UNAME_M})
342 UNAME_P=`(uname -p) 2>/dev/null` || UNAME_P="unknown"
343 AC_MSG_CHECKING(uname -p)
344 AC_MSG_RESULT(${UNAME_P})
346 AC_CANONICAL_SYSTEM
348 dnl Add #include for broken IRIX header files
349   case "$host_os" in
350         *irix6*) AC_ADD_INCLUDE(<standards.h>)
351         ;;
352 esac
354 AC_VALIDATE_CACHE_SYSTEM_TYPE
356 DYNEXP=
358 dnl Add modules that have to be built by default here
359 dnl These have to be built static:
360 default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_reg rpc_lsa_ds rpc_wks rpc_net rpc_dfs rpc_srv rpc_spoolss auth_rhosts auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin"
362 dnl These are preferably build shared, and static if dlopen() is not available
363 default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs charset_CP850 charset_CP437"
365 if test "x$developer" = xyes; then
366    default_static_modules="$default_static_modules rpc_echo"
367    default_shared_modules="$default_shared_modules charset_weird"
371 # Config CPPFLAG settings for strange OS's that must be set
372 # before other tests.
374 case "$host_os" in
375 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
376     *hpux*)
377     
378       AC_PROG_CC_FLAG(Ae)
379       # mmap on HPUX is completely broken...
380       AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
381       if test $ac_cv_prog_cc_Ae = yes; then
382         CPPFLAGS="$CPPFLAGS -Ae"
383       fi
385 # Defines needed for HPUX support.
386 # HPUX has bigcrypt but (sometimes?) doesn't use it for
387 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
389       case `uname -r` in
390                         *9*|*10*)
391                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL"
392                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
393                                 AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
394                                 AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
395                                 AC_DEFINE(_ALIGNMENT_REQUIRED,1,[Required alignment])
396                                 AC_DEFINE(_MAX_ALIGNMENT,4,[Maximum alignment])
397                                 ;;
398                         *11*)
399                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL"
400                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
401                                 AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
402                                 AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
403                                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to use large file support])
404                                 AC_DEFINE(_ALIGNMENT_REQUIRED, 1, [Required alignment])
405                                 AC_DEFINE(_MAX_ALIGNMENT, 4, [Maximum alignment])
406                                 ;;
407       esac
408       DYNEXP="-Wl,-E"
409       ;;
412 # CRAY Unicos has broken const handling
413        *unicos*)
414           AC_MSG_RESULT([disabling const])
415           CPPFLAGS="$CPPFLAGS -Dconst="
416           ;;
417         
419 # AIX4.x doesn't even admit to having large
420 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
422     *aix4*)
423           AC_MSG_RESULT([enabling large file support])
424       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
425           AC_DEFINE(_LARGE_FILES, 1, [Whether to enable large file support])
426       ;;    
428 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
429 # to the existance of large files..
430 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
431 # recommendations on large file support, however it makes the
432 # compile work using gcc 2.7 and 2.8, whereas using the Sun
433 # recommendation makes the compile fail on gcc2.7. JRA.
435 # Solaris uses SYSV printing.  Make sure to set that here.  --jerry
437         *solaris*)
438                 AC_DEFINE(SYSV, 1, [Whether to enable System V compatibility])
439                 case `uname -r` in
440                         5.0*|5.1*|5.2*|5.3*|5.5*)
441                                 AC_MSG_RESULT([no large file support])
442                                 ;;
443                         5.*)
444                         AC_MSG_RESULT([enabling large file support])
445                         if test "$ac_cv_prog_gcc" = yes; then
446                                 ${CC-cc} -v >conftest.c 2>&1
447                                 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
448                                 rm -fr conftest.c
449                                 case "$ac_cv_gcc_compiler_version_number" in
450                                         *"gcc version 2.6"*|*"gcc version 2.7"*)
451                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
452                                                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
453                                                 ;;
454                                         *)
455                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
456                                                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
457                                                 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
458                                                 ;;
459                                 esac
460                         else
461                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
462                                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
463                                 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
464                         fi
465                         ;;
466                 esac
467                 ;;
469 # IRIX uses SYSV printing.  Make sure to set that here
471         *irix*)
472                 AC_DEFINE(SYSV, 1, [Whether to enable System V compatibility])
473                 ;;
474         *freebsd*)
475                 AC_DEFINE(FREEBSD, 1, [Whether the host os is FreeBSD])
476                 ;;
478 # VOS may need to have POSIX support and System V compatibility enabled.
480     *vos*)
481     case "$CPPFLAGS" in
482           *-D_POSIX_C_SOURCE*)
483                 ;;
484           *)
485                 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=199506L"
486                 AC_DEFINE(_POSIX_C_SOURCE, 199506L, [Whether to enable POSIX support])
487                 ;;
488     esac
489     case "$CPPFLAGS" in
490           *-D_SYSV*|*-D_SVID_SOURCE*)
491                 ;;
492           *)
493                 CPPFLAGS="$CPPFLAGS -D_SYSV"
494                 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
495     esac
496     ;;
498 # Tests needed for SINIX large file support.
500     *sysv4*)
501       if test $host = mips-sni-sysv4 ; then
502         AC_MSG_CHECKING([for LFS support])
503         old_CPPFLAGS="$CPPFLAGS"
504         CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
505         AC_TRY_RUN([
506 #include <unistd.h>
507 main () {
508 #if _LFS64_LARGEFILE == 1
509 exit(0);
510 #else
511 exit(1);
512 #endif
513 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
514         CPPFLAGS="$old_CPPFLAGS"
515         if test x$SINIX_LFS_SUPPORT = xyes ; then
516           CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
517                   AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
518           CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
519           LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
520           LIBS="`getconf LFS64_LIBS` $LIBS"
521         fi
522       AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
523       fi
524     ;;
526 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
528     *linux*)
529         AC_MSG_CHECKING([for LFS support])
530         old_CPPFLAGS="$CPPFLAGS"
531         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
532        AC_TRY_RUN([
533 #include <unistd.h>
534 #include <sys/utsname.h>
535 #include <string.h>
536 #include <stdlib.h>
537 main() {
538 #if _LFS64_LARGEFILE == 1
539        struct utsname uts;
540        char *release;
541        int major, minor;
543        /* Ensure this is glibc 2.2 or higher */
544 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
545        int libc_major = __GLIBC__;
546        int libc_minor = __GLIBC_MINOR__;
548        if (libc_major < 2)
549               exit(1);
550        if (libc_minor < 2)
551               exit(1);
552 #endif
554        /* Ensure this is kernel 2.4 or higher */
556        uname(&uts);
557        release = strdup(uts.release);
558        major = atoi(strsep(&release, "."));
559        minor = atoi(strsep(&release, "."));
561        if (major > 2 || (major == 2 && minor > 3))
562                exit(0);
563        exit(1);
564 #else
565        exit(1);
566 #endif
568 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
569         CPPFLAGS="$old_CPPFLAGS"
570         if test x$LINUX_LFS_SUPPORT = xyes ; then
571                 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
572                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
573                 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
574                 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
575         fi
576         AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
577         ;;
580 # MacOS X is the *only* system that uses compose character in utf8. This
581 # is so horribly broken....
583     *darwin*)
584                 AC_DEFINE(BROKEN_UNICODE_COMPOSE_CHARACTERS, 1, [Does this system use unicode compose characters])
585 # Add Fink directories for various packages, like dlcompat.
586 # Note: iconv does that explicitly below, but other packages
587 # don't.
588                 CPPFLAGS="$CPPFLAGS -I/sw/include"
589                 LDFLAGS="$LDFLAGS -L/sw/lib"
591 # If we have dlsym_prepend_underscore (from Fink's dlcompat),
592 # use that instead of plain dlsym.
594                 AC_CHECK_LIB(dl,dlopen)
595                 AC_CHECK_FUNCS(dlsym_prepend_underscore,[CPPFLAGS="$CPPFLAGS -Ddlsym=dlsym_prepend_underscore"])
597 #Add a system specific charset module.
599                 default_shared_modules="$default_shared_modules charset_macosxfs"
600                 old_CPPFLAGS="$CPPFLAGS"
601                 CPPFLAGS="-Iinclude $CPPFLAGS" 
602                 AC_CHECK_HEADERS([CoreFoundation/CFStringEncodingConverter.h], [], [AC_CHECK_HEADERS([CFStringEncodingConverter.h])])
603                 CPPFLAGS="$old_CPPFLAGS"
604                 ;;
605     *hurd*)
606         AC_MSG_CHECKING([for LFS support])
607         old_CPPFLAGS="$CPPFLAGS"
608         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
609         AC_TRY_RUN([
610 #include <unistd.h>
611 main () {
612 #if _LFS64_LARGEFILE == 1
613 exit(0);
614 #else
615 exit(1);
616 #endif
617 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
618         CPPFLAGS="$old_CPPFLAGS"
619         if test x$GLIBC_LFS_SUPPORT = xyes ; then
620           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
621                   AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
622           AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
623         fi
624       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
625     ;;
627 esac
629 AC_INLINE
630 AC_HEADER_STDC
631 AC_HEADER_DIRENT
632 AC_HEADER_TIME
633 AC_HEADER_SYS_WAIT
634 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
635 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
636 AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
637 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
638 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
639 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
640 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
641 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
642 AC_CHECK_HEADERS(sys/syslog.h syslog.h execinfo.h)
643 AC_CHECK_HEADERS(langinfo.h locale.h)
645 # In valgrind 1.0.x, it's just valgrind.h.  In 1.9.x+ there's a
646 # subdirectory of headers.
647 AC_CHECK_HEADERS(valgrind.h valgrind/valgrind.h valgrind/memcheck.h)
650 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
651 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
653 case "$host_os" in
654     *hpux*)
655                 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
656                         ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
657                 if test x"$ac_cv_header_shadow_h" = x"yes"; then
658                    AC_DEFINE(HAVE_SHADOW_H,1,[Whether we have shadow.h])
659                 fi
660         ;;
661 esac
662 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
663 AC_CHECK_HEADERS(nss.h nss_common.h nsswitch.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
664 AC_CHECK_HEADERS(stropts.h poll.h)
665 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
666 AC_CHECK_HEADERS(sys/acl.h sys/attributes.h attr/xattr.h sys/xattr.h sys/cdefs.h glob.h)
668 # For experimental utmp support (lastlog on some BSD-like systems)
669 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
671 AC_CHECK_SIZEOF(int,cross)
672 AC_CHECK_SIZEOF(long,cross)
673 AC_CHECK_SIZEOF(short,cross)
675 AC_C_CONST
676 AC_C_INLINE
677 AC_C_BIGENDIAN
678 AC_C_CHAR_UNSIGNED
680 AC_TYPE_SIGNAL
681 AC_TYPE_UID_T
682 AC_TYPE_MODE_T
683 AC_TYPE_OFF_T
684 AC_TYPE_SIZE_T
685 AC_TYPE_PID_T
686 AC_STRUCT_ST_RDEV
687 AC_DIRENT_D_OFF
688 AC_CHECK_TYPE(ino_t,unsigned)
689 AC_CHECK_TYPE(loff_t,off_t)
690 AC_CHECK_TYPE(offset_t,loff_t)
691 AC_CHECK_TYPE(ssize_t, int)
692 AC_CHECK_TYPE(wchar_t, unsigned short)
694 ############################################
695 # for cups support we need libcups, and a handful of header files
697 AC_ARG_ENABLE(cups,
698 [  --enable-cups           Turn on CUPS support (default=auto)])
700 if test x$enable_cups != xno; then
701         AC_PATH_PROG(CUPS_CONFIG, cups-config)
703         if test "x$CUPS_CONFIG" != x; then
704                         AC_DEFINE(HAVE_CUPS,1,[Whether we have CUPS])
705                 CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
706                 LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
707                 PRINT_LIBS="$PRINT_LIBS `$CUPS_CONFIG --libs`"
708         fi
711 ############################################
712 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
713 AC_SEARCH_LIBS(dlopen, [dl])
714 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
716 ############################################
717 # check if the compiler can do immediate structures
718 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
719     AC_TRY_COMPILE([
720 #include <stdio.h>],
722    typedef struct {unsigned x;} FOOBAR;
723    #define X_FOOBAR(x) ((FOOBAR) { x })
724    #define FOO_ONE X_FOOBAR(1)
725    FOOBAR f = FOO_ONE;   
726    static struct {
727         FOOBAR y; 
728         } f2[] = {
729                 {FOO_ONE}
730         };   
732         samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
733 if test x"$samba_cv_immediate_structures" = x"yes"; then
734    AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
737 ############################################
738 # check if the compiler can do immediate structures
739 AC_CACHE_CHECK([if the compiler will optimize out function calls],samba_cv_optimize_out_funcation_calls, [
740     AC_TRY_LINK([
741 #include <stdio.h>],
743                 if (0) {
744                    this_function_does_not_exist();
745                 } else {
746                   return 1;
747                 }
750         samba_cv_optimize_out_funcation_calls=yes,samba_cv_optimize_out_funcation_calls=no)])
751 if test x"$samba_cv_optimize_out_funcation_calls" = x"yes"; then
752    AC_DEFINE(HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS,1,[Whether the compiler will optimize out function calls])
755 ############################################
756 # check for unix domain sockets
757 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
758     AC_TRY_COMPILE([
759 #include <sys/types.h>
760 #include <stdlib.h>
761 #include <stddef.h>
762 #include <sys/socket.h>
763 #include <sys/un.h>],
765   struct sockaddr_un sunaddr; 
766   sunaddr.sun_family = AF_UNIX;
768         samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
769 if test x"$samba_cv_unixsocket" = x"yes"; then
770    AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
774 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
775     AC_TRY_COMPILE([
776 #include <sys/types.h>
777 #if STDC_HEADERS
778 #include <stdlib.h>
779 #include <stddef.h>
780 #endif
781 #include <sys/socket.h>],[socklen_t i = 0],
782         samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
783 if test x"$samba_cv_socklen_t" = x"yes"; then
784    AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
787 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
788     AC_TRY_COMPILE([
789 #include <sys/types.h>
790 #if STDC_HEADERS
791 #include <stdlib.h>
792 #include <stddef.h>
793 #endif
794 #include <signal.h>],[sig_atomic_t i = 0],
795         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
796 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
797    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
800 # stupid headers have the functions but no declaration. grrrr.
801 AC_HAVE_DECL(errno, [#include <errno.h>])
802 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
803 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
804 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
805 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
806 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
807 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
809 # and glibc has setresuid under linux but the function does
810 # nothing until kernel 2.1.44! very dumb.
811 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
812     AC_TRY_RUN([#include <errno.h>
813 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
814         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
815 if test x"$samba_cv_have_setresuid" = x"yes"; then
816     AC_DEFINE(HAVE_SETRESUID,1,[Whether the system has setresuid])
819 # Do the same check for setresguid...
821 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
822     AC_TRY_RUN([#include <unistd.h>
823 #include <errno.h>
824 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
825         samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
826 if test x"$samba_cv_have_setresgid" = x"yes"; then
827     AC_DEFINE(HAVE_SETRESGID,1,[Whether the system has setresgid])
830 AC_FUNC_MEMCMP
832 ###############################################
833 # Readline included by default unless explicitly asked not to
834 test "${with_readline+set}" != "set" && with_readline=yes
836 # test for where we get readline() from
837 AC_MSG_CHECKING(whether to use readline)
838 AC_ARG_WITH(readline,
839 [  --with-readline[=DIR]     Look for readline include/libs in DIR (default=auto) ],
840 [  case "$with_readline" in
841   yes)
842     AC_MSG_RESULT(yes)
844     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
845     AC_CHECK_HEADERS(readline/history.h)
847     AC_CHECK_HEADERS(readline.h readline/readline.h,[
848       for termlib in ncurses curses termcap terminfo termlib tinfo; do
849        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
850       done
851       AC_CHECK_LIB(readline, rl_callback_handler_install,
852        [TERMLIBS="-lreadline $TERMLIBS"
853        AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
854        break], [TERMLIBS=], $TERMLIBS)])
855     ;;
856   no)
857     AC_MSG_RESULT(no)
858     ;;
859   *)
860     AC_MSG_RESULT(yes)
862     # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
863     # alternate readline path
864     _ldflags=${LDFLAGS}
865     _cppflags=${CPPFLAGS}
867     # Add additional search path
868     LDFLAGS="-L$with_readline/lib $LDFLAGS"
869     CPPFLAGS="-I$with_readline/include $CPPFLAGS"
871     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
872     AC_CHECK_HEADERS(readline/history.h)
874     AC_CHECK_HEADERS(readline.h readline/readline.h,[
875       for termlib in ncurses curses termcap terminfo termlib; do
876        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
877       done
878       AC_CHECK_LIB(readline, rl_callback_handler_install,
879        [TERMLDFLAGS="-L$with_readline/lib"
880        TERMCPPFLAGS="-I$with_readline/include"
881        CPPFLAGS="-I$with_readline/include $CPPFLAGS"
882        TERMLIBS="-lreadline $TERMLIBS"
883        AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
884        break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
886     LDFLAGS=$_ldflags
887     ;;
888   esac],
889   AC_MSG_RESULT(no)
891 AC_SUBST(TERMLIBS)
892 AC_SUBST(TERMLDFLAGS)
894 # The readline API changed slightly from readline3 to readline4, so
895 # code will generate warnings on one of them unless we have a few
896 # special cases.
897 AC_CHECK_LIB(readline, rl_completion_matches,
898              [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1, 
899                         [Do we have rl_completion_matches?])],
900              [],
901              [$TERMLIBS])
903 # The following test taken from the cvs sources
904 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
905 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
906 # libsocket.so which has a bad implementation of gethostbyname (it
907 # only looks in /etc/hosts), so we only look for -lsocket if we need
908 # it.
909 AC_CHECK_FUNCS(connect)
910 if test x"$ac_cv_func_connect" = x"no"; then
911     case "$LIBS" in
912     *-lnsl*) ;;
913     *) AC_CHECK_LIB(nsl_s, printf) ;;
914     esac
915     case "$LIBS" in
916     *-lnsl*) ;;
917     *) AC_CHECK_LIB(nsl, printf) ;;
918     esac
919     case "$LIBS" in
920     *-lsocket*) ;;
921     *) AC_CHECK_LIB(socket, connect) ;;
922     esac
923     case "$LIBS" in
924     *-linet*) ;;
925     *) AC_CHECK_LIB(inet, connect) ;;
926     esac
927     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
928     dnl has been cached.
929     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
930        test x"$ac_cv_lib_inet_connect" = x"yes"; then
931         # ac_cv_func_connect=yes
932         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
933         AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
934     fi
937 ###############################################
938 # test for where we get yp_get_default_domain() from
939 AC_SEARCH_LIBS(yp_get_default_domain, [nsl])
940 AC_CHECK_FUNCS(yp_get_default_domain)
942 # Check if we have execl, if not we need to compile smbrun.
943 AC_CHECK_FUNCS(execl)
944 if test x"$ac_cv_func_execl" = x"no"; then
945     EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbrun\$(EXEEXT)"
948 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
949 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
950 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
951 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
952 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)
953 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
954 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
955 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
956 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
957 AC_CHECK_FUNCS(syslog vsyslog timegm)
958 AC_CHECK_FUNCS(setlocale nl_langinfo)
959 # setbuffer, shmget, shm_open are needed for smbtorture
960 AC_CHECK_FUNCS(setbuffer shmget shm_open backtrace_symbols)
961 AC_CHECK_HEADERS(libexc.h)
962 AC_CHECK_LIB(exc, trace_back_stack)
964 # syscall() is needed for smbwrapper.
965 AC_CHECK_FUNCS(syscall)
967 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
968 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
969 AC_CHECK_FUNCS(__getcwd _getcwd)
970 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
971 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
972 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
973 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
974 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
975 AC_CHECK_FUNCS(getdirentries _write __write _fork __fork)
976 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
977 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
978 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
979 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
980 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
985 case "$host_os" in
986     *linux*)
987        # glibc <= 2.3.2 has a broken getgrouplist
988        AC_TRY_RUN([
989 #include <unistd.h>
990 #include <sys/utsname.h>
991 main() {
992        /* glibc up to 2.3 has a broken getgrouplist */
993 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
994        int libc_major = __GLIBC__;
995        int libc_minor = __GLIBC_MINOR__;
997        if (libc_major < 2)
998               exit(1);
999        if ((libc_major == 2) && (libc_minor <= 3))
1000               exit(1);
1001 #endif
1002        exit(0);
1004 ], [linux_getgrouplist_ok=yes], [linux_getgrouplist_ok=no])
1005        if test x"$linux_getgrouplist_ok" = x"yes"; then
1006           AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])
1007        fi
1008        ;;
1009     *)
1010        AC_CHECK_FUNCS(getgrouplist)
1011        ;;
1012 esac
1015 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
1018 if test x$ac_cv_func_stat64 = xno ; then
1019   AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
1020   AC_TRY_LINK([
1021 #if defined(HAVE_UNISTD_H)
1022 #include <unistd.h>
1023 #endif
1024 #include <sys/stat.h>
1025 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
1026   AC_MSG_RESULT([$ac_cv_func_stat64])
1027   if test x$ac_cv_func_stat64 = xyes ; then
1028     AC_DEFINE(HAVE_STAT64,1,[Whether stat64() is available])
1029   fi
1032 if test x$ac_cv_func_lstat64 = xno ; then
1033   AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
1034   AC_TRY_LINK([
1035 #if defined(HAVE_UNISTD_H)
1036 #include <unistd.h>
1037 #endif
1038 #include <sys/stat.h>
1039 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
1040   AC_MSG_RESULT([$ac_cv_func_lstat64])
1041   if test x$ac_cv_func_lstat64 = xyes ; then
1042     AC_DEFINE(HAVE_LSTAT64,[Whether lstat64() is available])
1043   fi
1046 if test x$ac_cv_func_fstat64 = xno ; then
1047   AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
1048   AC_TRY_LINK([
1049 #if defined(HAVE_UNISTD_H)
1050 #include <unistd.h>
1051 #endif
1052 #include <sys/stat.h>
1053 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
1054   AC_MSG_RESULT([$ac_cv_func_fstat64])
1055   if test x$ac_cv_func_fstat64 = xyes ; then
1056     AC_DEFINE(HAVE_FSTAT64,1,[Whether fstat64() is available])
1057   fi
1060 #####################################
1061 # we might need the resolv library on some systems
1062 AC_CHECK_LIB(resolv, dn_expand)
1065 # Check for the functions putprpwnam, set_auth_parameters,
1066 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
1067 # Needed for OSF1 and HPUX.
1070 AC_LIBTESTFUNC(security, putprpwnam)
1071 AC_LIBTESTFUNC(sec, putprpwnam)
1073 AC_LIBTESTFUNC(security, set_auth_parameters)
1074 AC_LIBTESTFUNC(sec, set_auth_parameters)
1076 # UnixWare 7.x has its getspnam in -lgen
1077 AC_LIBTESTFUNC(gen, getspnam)
1079 AC_LIBTESTFUNC(security, getspnam)
1080 AC_LIBTESTFUNC(sec, getspnam)
1082 AC_LIBTESTFUNC(security, bigcrypt)
1083 AC_LIBTESTFUNC(sec, bigcrypt)
1085 AC_LIBTESTFUNC(security, getprpwnam)
1086 AC_LIBTESTFUNC(sec, getprpwnam)
1088 ############################################
1089 # Check if we have libattr
1090 AC_SEARCH_LIBS(getxattr, [attr])
1091 AC_CHECK_FUNCS(getxattr lgetxattr fgetxattr listxattr llistxattr)
1092 AC_CHECK_FUNCS(flistxattr removexattr lremovexattr fremovexattr)
1093 AC_CHECK_FUNCS(setxattr lsetxattr fsetxattr)
1094 AC_CHECK_FUNCS(attr_get attr_list attr_set attr_remove)
1095 AC_CHECK_FUNCS(attr_getf attr_listf attr_setf attr_removef)
1097 # Assume non-shared by default and override below
1098 BLDSHARED="false"
1100 # these are the defaults, good for lots of systems
1101 HOST_OS="$host_os"
1102 LDSHFLAGS="-shared"
1103 SONAMEFLAG="#"
1104 SHLD="\${CC} \${CFLAGS}"
1105 PICFLAGS=""
1106 PICSUFFIX="po"
1107 SHLIBEXT="so"
1109 if test "$enable_shared" = "yes"; then
1110   # this bit needs to be modified for each OS that is suported by
1111   # smbwrapper. You need to specify how to created a shared library and
1112   # how to compile C code to produce PIC object files
1114   AC_MSG_CHECKING([ability to build shared libraries])
1116   # and these are for particular systems
1117   case "$host_os" in
1118                 *linux*)   AC_DEFINE(LINUX,1,[Whether the host os is linux])
1119                         BLDSHARED="true"
1120                         LDSHFLAGS="-shared" 
1121                         DYNEXP="-Wl,--export-dynamic"
1122                         PICFLAGS="-fPIC"
1123                         SONAMEFLAG="-Wl,-soname="
1124                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1125                         ;;
1126                 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
1127                         BLDSHARED="true"
1128                         LDSHFLAGS="-G"
1129                         SONAMEFLAG="-h "
1130                         if test "${GCC}" = "yes"; then
1131                                 PICFLAGS="-fPIC"
1132                                 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
1133                                         DYNEXP="-Wl,-E"
1134                                 fi
1135                         else
1136                                 PICFLAGS="-KPIC"
1137                                 ## ${CFLAGS} added for building 64-bit shared 
1138                                 ## libs using Sun's Compiler
1139                                 LDSHFLAGS="-G \${CFLAGS}"
1140                                 PICSUFFIX="po.o"
1141                         fi
1142                         AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1143                         AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1144                         ;;
1145                 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
1146                         BLDSHARED="true"
1147                         LDSHFLAGS="-G"
1148                         SONAMEFLAG="-Wl,-h,"
1149                         PICFLAGS="-KPIC"   # Is this correct for SunOS
1150                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1151                         AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1152                         ;;
1153                 *netbsd* | *freebsd*)  BLDSHARED="true"
1154                         LDSHFLAGS="-shared"
1155                         DYNEXP="-Wl,--export-dynamic"
1156                         SONAMEFLAG="-Wl,-soname,"
1157                         PICFLAGS="-fPIC -DPIC"
1158                         AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1159                         AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1160                         ;;
1161                 *openbsd*)  BLDSHARED="true"
1162                         LDSHFLAGS="-shared"
1163                         DYNEXP="-Wl,-Bdynamic"
1164                         SONAMEFLAG="-Wl,-soname,"
1165                         PICFLAGS="-fPIC"
1166                         AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1167                         AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1168                         ;;
1169                 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
1170                         case "$host_os" in
1171                         *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
1172                         ;;
1173                         esac
1174                         BLDSHARED="true"
1175                         LDSHFLAGS="-set_version sgi1.0 -shared"
1176                         SONAMEFLAG="-soname "
1177                         SHLD="\${LD}"
1178                         if test "${GCC}" = "yes"; then
1179                                 PICFLAGS="-fPIC"
1180                         else 
1181                                 PICFLAGS="-KPIC"
1182                         fi
1183                         AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
1184                         ;;
1185                 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
1186                         BLDSHARED="true"
1187                         LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
1188                         DYNEXP="-Wl,-brtl,-bexpall"
1189                         PICFLAGS="-O2"
1190                         if test "${GCC}" != "yes"; then
1191                                 ## for funky AIX compiler using strncpy()
1192                                 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
1193                         fi
1195                         AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
1196                         ;;
1197                 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
1198                         SHLIBEXT="sl"
1199                         # Use special PIC flags for the native HP-UX compiler.
1200                         if test $ac_cv_prog_cc_Ae = yes; then
1201                                 BLDSHARED="true"
1202                                 SHLD="/usr/bin/ld"
1203                                 LDSHFLAGS="-B symbolic -b -z"
1204                                 SONAMEFLAG="+h "
1205                                 PICFLAGS="+z"
1206                         elif test "${GCC}" = "yes"; then
1207                                 PICFLAGS="-fPIC"
1208                         fi
1209                         DYNEXP="-Wl,-E"
1210                         AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
1211                         AC_DEFINE(POSIX_ACL_NEEDS_MASK,1,[Does a POSIX ACL need a mask element])
1212                         ;;
1213                 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
1214                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1215                         ;;
1216                 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
1217                         BLDSHARED="true"
1218                         LDSHFLAGS="-shared"
1219                         SONAMEFLAG="-Wl,-soname,"
1220                         PICFLAGS="-fPIC"
1221                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1222                         AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly])
1223                         ;;
1224                 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
1225                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1226                         ;;
1227                 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
1228                         BLDSHARED="true"
1229                         LDSHFLAGS="-shared"
1230                         SONAMEFLAG="-Wl,-soname,"
1231                         PICFLAGS="-KPIC"
1232                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1233                         ;;
1234                 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
1235                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1236                         ;;
1237                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
1238                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1239                         ;;
1240                 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
1241                         case "$host" in
1242                                 *-univel-*)     if [ test "$GCC" != yes ]; then
1243                                                 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
1244                                         fi
1245                                         LDSHFLAGS="-G"
1246                                         DYNEXP="-Bexport"
1247                                 ;;
1248                                 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
1249                         esac
1250                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1251                         ;;
1253                 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
1254                         if [ test "$GCC" != yes ]; then
1255                                 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
1256                         fi
1257                         LDSHFLAGS="-G"
1258                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1259                         ;;
1260                 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
1261                         BLDSHARED="false"
1262                         LDSHFLAGS=""
1263                         ;;
1265                 *darwin*)   AC_DEFINE(DARWINOS,1,[Whether the host os is Darwin/MacOSX])
1266                         BLDSHARED="true"
1267                         LDSHFLAGS="-bundle -flat_namespace -undefined suppress"
1268                         SHLIBEXT="dylib"
1269                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1270                         ;;
1272                 *)
1273                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1274                         ;;
1275   esac
1276   AC_SUBST(DYNEXP)
1277   AC_MSG_RESULT($BLDSHARED)
1278   AC_MSG_CHECKING([linker flags for shared libraries])
1279   AC_MSG_RESULT([$LDSHFLAGS])
1280   AC_MSG_CHECKING([compiler flags for position-independent code])
1281   AC_MSG_RESULT([$PICFLAGS])
1284 #######################################################
1285 # test whether building a shared library actually works
1286 if test $BLDSHARED = true; then
1287 AC_CACHE_CHECK([whether building shared libraries actually works], 
1288                [ac_cv_shlib_works],[
1289    ac_cv_shlib_works=no
1290    # try building a trivial shared library
1291    $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o \
1292         shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c && \
1293         $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" \
1294         shlib.$PICSUFFIX && \
1295         ac_cv_shlib_works=yes
1296    rm -f "shlib.$SHLIBEXT" shlib.$PICSUFFIX
1298 if test $ac_cv_shlib_works = no; then
1299    BLDSHARED=false
1303 ################
1305 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
1306 AC_TRY_RUN([#include <stdio.h>
1307 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
1308 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
1309 if test x"$samba_cv_have_longlong" = x"yes"; then
1310     AC_DEFINE(HAVE_LONGLONG,1,[Whether the host supports long long's])
1314 # Check if the compiler supports the LL prefix on long long integers.
1315 # AIX needs this.
1317 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
1318     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
1319         samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
1320 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
1321    AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Whether the compiler supports the LL prefix on long long integers])
1324   
1325 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
1326 AC_TRY_RUN([#include <stdio.h>
1327 #include <sys/stat.h>
1328 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
1329 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
1330 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
1331     AC_DEFINE(SIZEOF_OFF_T,8,[The size of the 'off_t' type])
1334 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
1335 AC_TRY_RUN([
1336 #if defined(HAVE_UNISTD_H)
1337 #include <unistd.h>
1338 #endif
1339 #include <stdio.h>
1340 #include <sys/stat.h>
1341 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1342 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
1343 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
1344     AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
1347 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
1348 AC_TRY_RUN([#include <stdio.h>
1349 #include <sys/stat.h>
1350 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
1351 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
1352 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
1353     AC_DEFINE(SIZEOF_INO_T,8,[The size of the 'ino_t' type])
1356 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
1357 AC_TRY_RUN([
1358 #if defined(HAVE_UNISTD_H)
1359 #include <unistd.h>
1360 #endif
1361 #include <stdio.h>
1362 #include <sys/stat.h>
1363 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1364 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
1365 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
1366     AC_DEFINE(HAVE_INO64_T,1,[Whether the 'ino64_t' type is available])
1369 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
1370 AC_TRY_RUN([
1371 #if defined(HAVE_UNISTD_H)
1372 #include <unistd.h>
1373 #endif
1374 #include <stdio.h>
1375 #include <sys/stat.h>
1376 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1377 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
1378 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
1379     AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available])
1382 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
1383 AC_TRY_COMPILE([
1384 #if defined(HAVE_UNISTD_H)
1385 #include <unistd.h>
1386 #endif
1387 #include <sys/types.h>
1388 #include <dirent.h>],
1389 [struct dirent64 de;],
1390 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
1391 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
1392     AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Whether the 'dirent64' struct is available])
1395 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
1396 AC_TRY_RUN([
1397 #if defined(HAVE_UNISTD_H)
1398 #include <unistd.h>
1399 #endif
1400 #include <sys/types.h>
1401 main() { dev_t dev; int i = major(dev); return 0; }],
1402 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
1403 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
1404     AC_DEFINE(HAVE_DEVICE_MAJOR_FN,1,[Whether the major macro for dev_t is available])
1407 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
1408 AC_TRY_RUN([
1409 #if defined(HAVE_UNISTD_H)
1410 #include <unistd.h>
1411 #endif
1412 #include <sys/types.h>
1413 main() { dev_t dev; int i = minor(dev); return 0; }],
1414 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
1415 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
1416     AC_DEFINE(HAVE_DEVICE_MINOR_FN,1,[Whether the minor macro for dev_t is available])
1419 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
1420 AC_TRY_RUN([#include <stdio.h>
1421 main() { char c; c=250; exit((c > 0)?0:1); }],
1422 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
1423 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
1424     AC_DEFINE(HAVE_UNSIGNED_CHAR,1,[Whether the 'unsigned char' type is available])
1427 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
1428 AC_TRY_COMPILE([#include <sys/types.h>
1429 #include <sys/socket.h>
1430 #include <netinet/in.h>],
1431 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
1432 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
1433 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
1434     AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
1437 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
1438 AC_TRY_COMPILE([#include <sys/types.h>
1439 #include <dirent.h>
1440 void seekdir(DIR *d, long loc) { return; }],[return 0;],
1441 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
1442 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
1443     AC_DEFINE(SEEKDIR_RETURNS_VOID,1,[Whether seekdir returns void])
1446 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
1447 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
1448 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
1449 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
1450     AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
1453 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
1454 AC_TRY_RUN([
1455 #include <sys/time.h>
1456 #include <unistd.h>
1457 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
1458            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
1459 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
1460     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
1463 AC_CACHE_CHECK([for va_copy],samba_cv_HAVE_VA_COPY,[
1464 AC_TRY_LINK([#include <stdarg.h>
1465 va_list ap1,ap2;], [va_copy(ap1,ap2);],
1466 samba_cv_HAVE_VA_COPY=yes,
1467 samba_cv_HAVE_VA_COPY=no)])
1468 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
1469     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
1470 else
1471     AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE___VA_COPY,[
1472     AC_TRY_LINK([#include <stdarg.h>
1473     va_list ap1,ap2;], [__va_copy(ap1,ap2);],
1474     samba_cv_HAVE___VA_COPY=yes,
1475     samba_cv_HAVE___VA_COPY=no)])
1476     if test x"$samba_cv_HAVE___VA_COPY" = x"yes"; then
1477         AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
1478     fi
1481 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
1482 AC_TRY_RUN([
1483 #include <sys/types.h>
1484 #include <stdarg.h>
1485 void foo(const char *format, ...) { 
1486        va_list ap;
1487        int len;
1488        char buf[5];
1490        va_start(ap, format);
1491        len = vsnprintf(buf, 0, format, ap);
1492        va_end(ap);
1493        if (len != 5) exit(1);
1495        va_start(ap, format);
1496        len = vsnprintf(0, 0, format, ap);
1497        va_end(ap);
1498        if (len != 5) exit(1);
1500        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
1502        exit(0);
1504 main() { foo("hello"); }
1506 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
1507 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
1508     AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
1511 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
1512 AC_TRY_RUN([#include <sys/types.h>
1513 #include <dirent.h>
1514 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
1515 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
1516 di->d_name[0] == 0) exit(0); exit(1);} ],
1517 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
1518 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
1519     AC_DEFINE(HAVE_BROKEN_READDIR,1,[Whether readdir() is broken])
1522 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
1523 AC_TRY_COMPILE([#include <sys/types.h>
1524 #include <utime.h>],
1525 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
1526 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
1527 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
1528     AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
1531 ##############
1532 # Check utmp details, but only if our OS offers utmp.h
1533 if test x"$ac_cv_header_utmp_h" = x"yes"; then
1534 dnl  utmp and utmpx come in many flavours
1535 dnl  We need to check for many of them
1536 dnl  But we don't need to do each and every one, because our code uses
1537 dnl  mostly just the utmp (not utmpx) fields.
1539 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
1541 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
1542 AC_TRY_COMPILE([#include <sys/types.h>
1543 #include <utmp.h>],
1544 [struct utmp ut;  ut.ut_name[0] = 'a';],
1545 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
1546 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
1547     AC_DEFINE(HAVE_UT_UT_NAME,1,[Whether the utmp struct has a property ut_name])
1548 fi 
1550 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
1551 AC_TRY_COMPILE([#include <sys/types.h>
1552 #include <utmp.h>],
1553 [struct utmp ut;  ut.ut_user[0] = 'a';],
1554 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
1555 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
1556     AC_DEFINE(HAVE_UT_UT_USER,1,[Whether the utmp struct has a property ut_user])
1557 fi 
1559 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
1560 AC_TRY_COMPILE([#include <sys/types.h>
1561 #include <utmp.h>],
1562 [struct utmp ut;  ut.ut_id[0] = 'a';],
1563 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
1564 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
1565     AC_DEFINE(HAVE_UT_UT_ID,1,[Whether the utmp struct has a property ut_id])
1566 fi 
1568 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
1569 AC_TRY_COMPILE([#include <sys/types.h>
1570 #include <utmp.h>],
1571 [struct utmp ut;  ut.ut_host[0] = 'a';],
1572 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
1573 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
1574     AC_DEFINE(HAVE_UT_UT_HOST,1,[Whether the utmp struct has a property ut_host])
1575 fi 
1577 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
1578 AC_TRY_COMPILE([#include <sys/types.h>
1579 #include <utmp.h>],
1580 [struct utmp ut;  time_t t; ut.ut_time = t;],
1581 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
1582 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
1583     AC_DEFINE(HAVE_UT_UT_TIME,1,[Whether the utmp struct has a property ut_time])
1584 fi 
1586 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
1587 AC_TRY_COMPILE([#include <sys/types.h>
1588 #include <utmp.h>],
1589 [struct utmp ut;  struct timeval tv; ut.ut_tv = tv;],
1590 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
1591 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1592     AC_DEFINE(HAVE_UT_UT_TV,1,[Whether the utmp struct has a property ut_tv])
1593 fi 
1595 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1596 AC_TRY_COMPILE([#include <sys/types.h>
1597 #include <utmp.h>],
1598 [struct utmp ut;  ut.ut_type = 0;],
1599 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1600 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1601     AC_DEFINE(HAVE_UT_UT_TYPE,1,[Whether the utmp struct has a property ut_type])
1602 fi 
1604 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1605 AC_TRY_COMPILE([#include <sys/types.h>
1606 #include <utmp.h>],
1607 [struct utmp ut;  ut.ut_pid = 0;],
1608 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1609 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1610     AC_DEFINE(HAVE_UT_UT_PID,1,[Whether the utmp struct has a property ut_pid])
1611 fi 
1613 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1614 AC_TRY_COMPILE([#include <sys/types.h>
1615 #include <utmp.h>],
1616 [struct utmp ut;  ut.ut_exit.e_exit = 0;],
1617 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1618 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1619     AC_DEFINE(HAVE_UT_UT_EXIT,1,[Whether the utmp struct has a property ut_exit])
1620 fi 
1622 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1623 AC_TRY_COMPILE([#include <sys/types.h>
1624 #include <utmp.h>],
1625 [struct utmp ut;  ut.ut_addr = 0;],
1626 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1627 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1628     AC_DEFINE(HAVE_UT_UT_ADDR,1,[Whether the utmp struct has a property ut_addr])
1629 fi 
1631 if test x$ac_cv_func_pututline = xyes ; then
1632   AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1633   AC_TRY_COMPILE([#include <sys/types.h>
1634 #include <utmp.h>],
1635   [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1636   samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1637   if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1638       AC_DEFINE(PUTUTLINE_RETURNS_UTMP,1,[Whether pututline returns pointer])
1639   fi
1642 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1643 AC_TRY_COMPILE([#include <sys/types.h>
1644 #include <utmpx.h>],
1645 [struct utmpx ux;  ux.ut_syslen = 0;],
1646 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1647 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1648     AC_DEFINE(HAVE_UX_UT_SYSLEN,1,[Whether the utmpx struct has a property ut_syslen])
1649 fi 
1652 # end utmp details
1655 ICONV_LOCATION=standard
1656 LOOK_DIRS="/usr /usr/local /sw"
1657 AC_ARG_WITH(libiconv,
1658 [  --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
1660   if test "$withval" = "no" ; then
1661     AC_MSG_ERROR([argument to --with-libiconv must be a directory])
1662   else
1663      if test "$withval" != "yes" ; then
1664         ICONV_PATH_SPEC=yes
1665         LOOK_DIRS="$withval"
1666      fi
1667   fi
1670 ICONV_FOUND="no"
1671 for i in $LOOK_DIRS ; do
1672     save_LIBS=$LIBS
1673     save_LDFLAGS=$LDFLAGS
1674     save_CPPFLAGS=$CPPFLAGS
1675     CPPFLAGS="$CPPFLAGS -I$i/include"
1676 dnl This is here to handle -withval stuff for --with-libiconv
1677 dnl Perhaps we should always add a -L
1678     LDFLAGS="$LDFLAGS -L$i/lib"
1679     LIBS=
1680     export LDFLAGS LIBS CPPFLAGS
1681 dnl Try to find iconv(3)
1682     jm_ICONV($i)
1684     if test "$ICONV_FOUND" = yes; then
1685         LDFLAGS=$save_LDFLAGS
1686         LIB_ADD_DIR(LDFLAGS, "$i/lib")
1687         CFLAGS_ADD_DIR(CPPFLAGS, "$i/include")
1688         LIBS="$save_LIBS"
1689         ICONV_LOCATION=$i
1690         export LDFLAGS LIBS CPPFLAGS
1691 dnl Now, check for a working iconv ... we want to do it here because
1692 dnl there might be a working iconv further down the list of LOOK_DIRS
1694         ############
1695         # check for iconv in libc
1696         ic_save_LIBS="$LIBS"
1697         if test x"$ICONV_PATH_SPEC" = "xyes" ; then
1698            LIBS="$LIBS -L$ICONV_LOCATION/lib"
1699         fi
1700         if test x"$jm_cv_lib_iconv" != x; then
1701            LIBS="$LIBS -l$jm_cv_lib_iconv"
1702         fi
1703 dnl        AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1704         default_dos_charset=no
1705         default_display_charset=no
1706         default_unix_charset=no
1708         # check for default dos charset name
1709         for j in CP850 IBM850 ; do
1710             rjs_CHARSET($j)
1711             if test x"$ICONV_CHARSET" = x"$j"; then
1712                 default_dos_charset="\"$j\""
1713                 break
1714             fi
1715         done
1716         # check for default display charset name
1717         for j in ASCII 646 ; do
1718             rjs_CHARSET($j)
1719             if test x"$ICONV_CHARSET" = x"$j"; then
1720                 default_display_charset="\"$j\""
1721                 break
1722             fi
1723         done
1724         # check for default unix charset name
1725         for j in UTF-8 UTF8 ; do
1726             rjs_CHARSET($j)
1727             if test x"$ICONV_CHARSET" = x"$j"; then
1728                 default_unix_charset="\"$j\""
1729                 break
1730             fi
1731         done
1732         
1733         if test "$default_dos_charset" != "no" -a \
1734                 "$default_dos_charset" != "cross" -a \
1735                 "$default_display_charset" != "no" -a \ 
1736                 "$default_display_charset" != "cross" -a \
1737                 "$default_unix_charset" != "no" -a \
1738                 "$default_unix_charset" != "cross"
1739         then
1740                 samba_cv_HAVE_NATIVE_ICONV=yes
1741         else if test "$default_dos_charset" = "cross" -o \
1742                      "$default_display_charset" = "cross" -o \
1743                      "$default_unix_charset" = "cross"
1744         then
1745                 samba_cv_HAVE_NATIVE_ICONV=cross
1746         else
1747                 samba_cv_HAVE_NATIVE_ICONV=no
1748         fi
1749         fi
1750 dnl ])
1752         LIBS="$ic_save_LIBS"
1753         if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1754            CPPFLAGS=$save_CPPFLAGS
1755            LDFLAGS=$save_LDFLAGS
1756            LIBS=$save_LIBS
1757            if test x"$jm_cv_lib_iconv" != x; then
1758               LIBS="$LIBS -l$jm_cv_lib_iconv"
1759            fi
1760            dnl Add the flags we need to CPPFLAGS and LDFLAGS
1761            CFLAGS_ADD_DIR(CPPFLAGS, "$i/include")
1762            LIB_ADD_DIR(LDFLAGS, "$i/lib")
1763            export CPPFLAGS
1764            AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
1765            AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,$default_dos_charset,[Default dos charset name])
1766            AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,$default_display_charset,[Default display charset name])
1767            AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,$default_unix_charset,[Default unix charset name])
1768            break
1769         fi
1770 dnl We didn't find a working iconv, so keep going
1771     fi
1772 dnl We only need to clean these up here for the next pass through the loop
1773     CPPFLAGS=$save_CPPFLAGS
1774     LDFLAGS=$save_LDFLAGS
1775     LIBS=$save_LIBS
1776     export LDFLAGS LIBS CPPFLAGS
1777 done
1780 if test x"$ICONV_FOUND" = x"no" -o x"$samba_cv_HAVE_NATIVE_ICONV" != x"yes" ; then
1781     AC_MSG_WARN([Sufficient support for iconv function was not found. 
1782     Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!])
1783    AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,"ASCII",[Default dos charset name])
1784    AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,"ASCII",[Default display charset name])
1785    AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,"UTF8",[Default unix charset name])
1789 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1790 AC_TRY_RUN([
1791 #include <sys/types.h>
1792 #include <fcntl.h>
1793 #ifndef F_GETLEASE
1794 #define F_GETLEASE      1025
1795 #endif
1796 main() {
1797        int fd = open("/dev/null", O_RDONLY);
1798        return fcntl(fd, F_GETLEASE, 0) == -1;
1801 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1802 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1803     AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
1806 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1807 AC_TRY_RUN([
1808 #include <sys/types.h>
1809 #include <fcntl.h>
1810 #include <signal.h>
1811 #ifndef F_NOTIFY
1812 #define F_NOTIFY 1026
1813 #endif
1814 main() {
1815         exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0);
1818 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1819 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1820     AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
1823 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1824 AC_TRY_RUN([
1825 #include <sys/types.h>
1826 #include <fcntl.h>
1827 #include <signal.h>
1828 #include <sys/file.h>
1829 #ifndef LOCK_MAND
1830 #define LOCK_MAND       32
1831 #define LOCK_READ       64
1832 #endif
1833 main() {
1834         exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1837 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1838 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1839     AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
1845 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1846 AC_TRY_COMPILE([#include <sys/types.h>
1847 #include <fcntl.h>],
1848 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1849 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1850 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1851     AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
1854 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1855 AC_TRY_RUN([#include <sys/types.h>
1856 #include <sys/capability.h>
1857 main() {
1858  cap_t cap;
1859  if ((cap = cap_get_proc()) == NULL)
1860    exit(1);
1861  cap->cap_effective |= CAP_NETWORK_MGT;
1862  cap->cap_inheritable |= CAP_NETWORK_MGT;
1863  cap_set_proc(cap);
1864  exit(0);
1867 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1868 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1869     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
1873 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1874 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1877 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1878 AC_TRY_COMPILE([#include <sys/types.h>
1879 #if defined(HAVE_RPC_RPC_H)
1880 #include <rpc/rpc.h>
1881 #endif],
1882 [int16 testvar;],
1883 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1884 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1885     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H,1,[Whether int16 typedef is included by rpc/rpc.h])
1888 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1889 AC_TRY_COMPILE([#include <sys/types.h>
1890 #if defined(HAVE_RPC_RPC_H)
1891 #include <rpc/rpc.h>
1892 #endif],
1893 [uint16 testvar;],
1894 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1895 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1896     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H,1,[Whether uint16 typedef is included by rpc/rpc.h])
1899 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1900 AC_TRY_COMPILE([#include <sys/types.h>
1901 #if defined(HAVE_RPC_RPC_H)
1902 #include <rpc/rpc.h>
1903 #endif],
1904 [int32 testvar;],
1905 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1906 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1907     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H,1,[Whether int32 typedef is included by rpc/rpc.h])
1910 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1911 AC_TRY_COMPILE([#include <sys/types.h>
1912 #if defined(HAVE_RPC_RPC_H)
1913 #include <rpc/rpc.h>
1914 #endif],
1915 [uint32 testvar;],
1916 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1917 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1918     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H,1,[Whether uint32 typedef is included by rpc/rpc.h])
1922 dnl Some systems (SCO) have a problem including
1923 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1924 dnl as a #define in <prot.h> and as part of an enum
1925 dnl in <rpc/rpc.h>.
1928 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1929 AC_TRY_COMPILE([#include <sys/types.h>
1930 #ifdef HAVE_SYS_SECURITY_H
1931 #include <sys/security.h>
1932 #include <prot.h>
1933 #endif  /* HAVE_SYS_SECURITY_H */
1934 #if defined(HAVE_RPC_RPC_H)
1935 #include <rpc/rpc.h>
1936 #endif],
1937 [int testvar;],
1938 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1939 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1940     AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT,1,[Whether there is a conflicting AUTH_ERROR define in rpc/rpc.h])
1943 AC_MSG_CHECKING([for test routines])
1944 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1945            AC_MSG_RESULT(yes),
1946            AC_MSG_ERROR([cant find test code. Aborting config]),
1947            AC_MSG_WARN([cannot run when cross-compiling]))
1949 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1950 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1951            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1952 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1953     AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
1956 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1957 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1958            samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1959            samba_cv_HAVE_WORKING_AF_LOCAL=no,
1960            samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1961 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1962 then
1963     AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1966 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1967 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1968            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1969 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1970     AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
1973 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1974 SAVE_CPPFLAGS="$CPPFLAGS"
1975 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt  -I${srcdir-.}/smbwrapper"
1976 AC_TRY_COMPILE([
1977 #define REPLACE_GETPASS 1
1978 #define NO_PROTO_H 1
1979 #define NO_CONFIG_H 1
1980 #define main dont_declare_main
1981 #include "${srcdir-.}/lib/getsmbpass.c"
1982 #undef main
1983 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1984 CPPFLAGS="$SAVE_CPPFLAGS"
1986 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1987         AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
1990 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1991 AC_TRY_RUN([
1992 #include <stdio.h>
1993 #include <sys/types.h>
1994 #include <netinet/in.h>
1995 #ifdef HAVE_ARPA_INET_H
1996 #include <arpa/inet.h>
1997 #endif
1998 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1999 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
2000     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
2001 exit(1);}],
2002            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
2003 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
2004     AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
2007 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
2008 AC_TRY_RUN([#include <stdlib.h>
2009 #include <sys/types.h>
2010 #include <sys/stat.h>
2011 #include <unistd.h>
2012 main() { 
2013   struct stat st;
2014   char tpl[20]="/tmp/test.XXXXXX"; 
2015   int fd = mkstemp(tpl); 
2016   if (fd == -1) exit(1);
2017   unlink(tpl);
2018   if (fstat(fd, &st) != 0) exit(1);
2019   if ((st.st_mode & 0777) != 0600) exit(1);
2020   exit(0);
2022 samba_cv_HAVE_SECURE_MKSTEMP=yes,
2023 samba_cv_HAVE_SECURE_MKSTEMP=no,
2024 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
2025 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
2026     AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
2029 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
2030 AC_TRY_RUN([#include <unistd.h>
2031 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
2032 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
2033 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
2034     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
2037 AC_CACHE_CHECK([for sysconf(_SC_NPROC_ONLN)],samba_cv_SYSCONF_SC_NPROC_ONLN,[
2038 AC_TRY_RUN([#include <unistd.h>
2039 main() { exit(sysconf(_SC_NPROC_ONLN) == -1 ? 1 : 0); }],
2040 samba_cv_SYSCONF_SC_NPROC_ONLN=yes,samba_cv_SYSCONF_SC_NPROC_ONLN=no,samba_cv_SYSCONF_SC_NPROC_ONLN=cross)])
2041 if test x"$samba_cv_SYSCONF_SC_NPROC_ONLN" = x"yes"; then
2042     AC_DEFINE(SYSCONF_SC_NPROC_ONLN,1,[Whether sysconf(_SC_NPROC_ONLN) is available])
2045 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
2046 AC_TRY_RUN([main() { exit(getuid() != 0); }],
2047            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
2048 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
2049     AC_DEFINE(HAVE_ROOT,1,[Whether current user is root])
2050 else
2051     AC_MSG_WARN(running as non-root will disable some tests)
2054 ##################
2055 # look for a method of finding the list of network interfaces
2056 iface=no;
2057 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
2058 AC_TRY_RUN([
2059 #define HAVE_IFACE_AIX 1
2060 #define AUTOCONF_TEST 1
2061 #include "confdefs.h"
2062 #include "${srcdir-.}/lib/interfaces.c"],
2063            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
2064 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
2065     iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
2068 if test $iface = no; then
2069 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
2070 AC_TRY_RUN([
2071 #define HAVE_IFACE_IFCONF 1
2072 #define AUTOCONF_TEST 1
2073 #include "confdefs.h"
2074 #include "${srcdir-.}/lib/interfaces.c"],
2075            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
2076 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
2077     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
2081 if test $iface = no; then
2082 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
2083 AC_TRY_RUN([
2084 #define HAVE_IFACE_IFREQ 1
2085 #define AUTOCONF_TEST 1
2086 #include "confdefs.h"
2087 #include "${srcdir-.}/lib/interfaces.c"],
2088            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
2089 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
2090     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
2095 ################################################
2096 # look for a method of setting the effective uid
2097 seteuid=no;
2098 if test $seteuid = no; then
2099 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
2100 AC_TRY_RUN([
2101 #define AUTOCONF_TEST 1
2102 #define USE_SETRESUID 1
2103 #include "confdefs.h"
2104 #include "${srcdir-.}/lib/util_sec.c"],
2105            samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
2106 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
2107     seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
2112 if test $seteuid = no; then
2113 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
2114 AC_TRY_RUN([
2115 #define AUTOCONF_TEST 1
2116 #define USE_SETREUID 1
2117 #include "confdefs.h"
2118 #include "${srcdir-.}/lib/util_sec.c"],
2119            samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
2120 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
2121     seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
2125 if test $seteuid = no; then
2126 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
2127 AC_TRY_RUN([
2128 #define AUTOCONF_TEST 1
2129 #define USE_SETEUID 1
2130 #include "confdefs.h"
2131 #include "${srcdir-.}/lib/util_sec.c"],
2132            samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
2133 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
2134     seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
2138 if test $seteuid = no; then
2139 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
2140 AC_TRY_RUN([
2141 #define AUTOCONF_TEST 1
2142 #define USE_SETUIDX 1
2143 #include "confdefs.h"
2144 #include "${srcdir-.}/lib/util_sec.c"],
2145            samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
2146 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
2147     seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
2152 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
2153 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
2154            samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
2155 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
2156     AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
2159 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
2160 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
2161            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
2162 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
2163     AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
2166 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
2167 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
2168            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
2169 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
2170     AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available])
2173 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
2174 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
2175            samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
2176 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
2177     AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken])
2179 else
2182 dnl Don't check for 64 bit fcntl locking if we know that the
2183 dnl glibc2.1 broken check has succeeded.
2184 dnl 
2186   AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
2187   AC_TRY_RUN([
2188 #if defined(HAVE_UNISTD_H)
2189 #include <unistd.h>
2190 #endif
2191 #include <stdio.h>
2192 #include <stdlib.h>
2194 #ifdef HAVE_FCNTL_H
2195 #include <fcntl.h>
2196 #endif
2198 #ifdef HAVE_SYS_FCNTL_H
2199 #include <sys/fcntl.h>
2200 #endif
2201 main() { struct flock64 fl64;
2202 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
2203 exit(0);
2204 #else
2205 exit(1);
2206 #endif
2208        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
2210   if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
2211       AC_DEFINE(HAVE_STRUCT_FLOCK64,1,[Whether the flock64 struct is available])
2212   fi
2215 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
2216 AC_TRY_COMPILE([#include <sys/types.h>
2217 #include <sys/stat.h>
2218 #include <unistd.h>],
2219 [struct stat st;  st.st_blocks = 0;],
2220 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
2221 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
2222     AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
2223 fi 
2225 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
2226 AC_TRY_COMPILE([#include <sys/types.h>
2227 #include <sys/stat.h>
2228 #include <unistd.h>],
2229 [struct stat st;  st.st_blksize = 0;],
2230 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
2231 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
2232     AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
2235 case "$host_os" in
2236 *linux*)
2237 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
2238 AC_TRY_COMPILE([
2239 #ifdef HAVE_SYS_VFS_H
2240 #include <sys/vfs.h>
2241 #endif
2242 #ifdef HAVE_SYS_CAPABILITY_H
2243 #include <sys/capability.h>
2244 #endif
2245 ],[int i;],
2246    samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
2247 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
2248    AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
2251 esac
2253 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
2254 AC_TRY_COMPILE([
2255 #include <sys/types.h>
2256 #include <sys/acl.h>
2257 #if defined(HAVE_RPCSVC_NIS_H)
2258 #include <rpcsvc/nis.h>
2259 #endif],
2260 [int i;],
2261 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
2262 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
2263         AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken])
2267 #################################################
2268 # check for smbwrapper support
2269 AC_MSG_CHECKING(whether to use smbwrapper)
2270 AC_ARG_WITH(smbwrapper,
2271 [  --with-smbwrapper       Include SMB wrapper support (default=no) ],
2272 [ case "$withval" in
2273   yes)
2274     AC_MSG_RESULT(yes)
2275     AC_DEFINE(WITH_SMBWRAPPER,1,[Whether to include smbwrapper support])
2276         WRAPPROG="bin/smbsh\$(EXEEXT)"
2277         WRAP="bin/smbwrapper.$SHLIBEXT"
2279 # Conditions under which smbwrapper should not be built.
2281         if test x$PICFLAGS = x; then
2282            echo No support for PIC code - disabling smbwrapper and smbsh
2283            WRAPPROG=""
2284            WRAP=""
2285         elif test x$ac_cv_func_syscall = xno; then
2286            AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
2287            WRAPPROG=""
2288            WRAP=""
2289         fi
2290         EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS $WRAPPROG $WRAP"
2291         SMBWRAPPER="$WRAPPROG $WRAP"
2292     ;;
2293   *)
2294     AC_MSG_RESULT(no)
2295     ;;
2296   esac ],
2297   AC_MSG_RESULT(no)
2300 #################################################
2301 # check for AFS clear-text auth support
2302 samba_cv_WITH_AFS=no
2303 AC_MSG_CHECKING(whether to use AFS clear-text auth)
2304 AC_ARG_WITH(afs,
2305 [  --with-afs              Include AFS clear-text auth support (default=no) ],
2306 [ case "$withval" in
2307   yes|auto)
2308     AC_MSG_RESULT($withval)
2309     samba_cv_WITH_AFS=$withval
2310     ;;
2311   *)
2312     AC_MSG_RESULT(no)
2313     ;;
2314   esac ],
2315   AC_MSG_RESULT(no)
2318 ####################################################
2319 # check for Linux-specific AFS fake-kaserver support
2320 samba_cv_WITH_FAKE_KASERVER=no
2321 AC_MSG_CHECKING(whether to use AFS fake-kaserver)
2322 AC_ARG_WITH(fake-kaserver,
2323 [  --with-fake-kaserver    Include AFS fake-kaserver support (default=no) ],
2324 [ case "$withval" in
2325   yes|auto)
2326     AC_MSG_RESULT($withval)
2327     samba_cv_WITH_FAKE_KASERVER=$withval
2328     ;;
2329   *)
2330     AC_MSG_RESULT(no)
2331     ;;
2332   esac ],
2333   AC_MSG_RESULT(no)
2336 #################################################
2337 # decide whether we can support WITH_AFS and / or WITH_FAKE_KASERVER
2338 if test x"$samba_cv_WITH_AFS" != x"no" ||
2339    test x"$samba_cv_WITH_FAKE_KASERVER" != x"no"; then
2341     # see if this box has the afs-headers in /usr/include/afs
2342     AC_MSG_CHECKING(for /usr/include/afs)
2343     if test -d /usr/include/afs; then
2344           CFLAGS="$CFLAGS -I/usr/include/afs"
2345           CPPFLAGS="$CPPFLAGS -I/usr/include/afs"
2346           AC_MSG_RESULT(yes)
2347     else
2348       AC_MSG_RESULT(no)
2349     fi
2350    
2351     # check for afs.h
2352     have_afs_headers=no
2353     AC_CHECK_HEADERS(afs.h afs/afs.h)
2354     if test x"$ac_cv_header_afs_h" = x"no" && test x"$ac_cv_header_afs_afs_h" = x"no"; then
2355         if test x"$samba_cv_WITH_FAKE_KASERVER" = x"auto" ||
2356            test x"$samba_cv_WITH_AFS" = x"auto"; then
2357                 AC_MSG_WARN([AFS cannot be supported without afs.h])
2358         else
2359                 AC_MSG_ERROR([AFS cannot be supported without afs.h])
2360         fi
2361     else
2362         have_afs_headers=yes
2363     fi
2366 if test x"$samba_cv_WITH_FAKE_KASERVER" != x"no" && test x"$have_afs_headers" == x"yes"; then
2367     AC_DEFINE(WITH_FAKE_KASERVER,1,[Whether to include AFS fake-kaserver support])
2369         
2370 if test x"$samba_cv_WITH_AFS" != x"no" && test x"$have_afs_headers" = x"yes"; then
2371     AC_DEFINE(WITH_AFS,1,[Whether to include AFS clear-text auth support])
2374 #################################################
2375 # check for the DFS clear-text auth system
2376 AC_MSG_CHECKING(whether to use DFS clear-text auth)
2377 AC_ARG_WITH(dfs,
2378 [  --with-dce-dfs          Include DCE/DFS clear-text auth support (default=no)],
2379 [ case "$withval" in
2380   yes)
2381     AC_MSG_RESULT(yes)
2382     AC_DEFINE(WITH_DFS,1,[Whether to include DFS support])
2383     ;;
2384   *)
2385     AC_MSG_RESULT(no)
2386     ;;
2387   esac ],
2388   AC_MSG_RESULT(no)
2391 ########################################################
2392 # Compile with LDAP support?
2394 with_ldap_support=auto
2395 AC_MSG_CHECKING([for LDAP support])
2397 AC_ARG_WITH(ldap,
2398 [  --with-ldap             LDAP support (default yes)],
2399 [ case "$withval" in
2400     yes|no)
2401         with_ldap_support=$withval
2402         ;;
2403   esac ])
2405 AC_MSG_RESULT($with_ldap_support)
2407 SMBLDAP=""
2408 AC_SUBST(SMBLDAP)
2409 if test x"$with_ldap_support" != x"no"; then
2411   ##################################################################
2412   # first test for ldap.h and lber.h
2413   # (ldap.h is required for this test)
2414   AC_CHECK_HEADERS(ldap.h lber.h)
2415   
2416   if test x"$ac_cv_header_ldap_h" != x"yes"; then
2417         if test x"$with_ldap_support" = x"yes"; then
2418          AC_MSG_ERROR(ldap.h is needed for LDAP support)
2419         else
2420          AC_MSG_WARN(ldap.h is needed for LDAP support)
2421         fi
2422         
2423         with_ldap_support=no
2424   fi
2427 if test x"$with_ldap_support" != x"no"; then
2428   ac_save_LIBS=$LIBS
2430   ##################################################################
2431   # we might need the lber lib on some systems. To avoid link errors
2432   # this test must be before the libldap test
2433   AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf)
2435   ########################################################
2436   # now see if we can find the ldap libs in standard paths
2437   AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
2439   AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS)
2440   
2441   ########################################################
2442   # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
2443   # Check found in pam_ldap 145.
2444   AC_CHECK_FUNC_EXT(ldap_set_rebind_proc,$LDAP_LIBS)
2446   LIBS="$LIBS $LDAP_LIBS"
2447   AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [
2448     AC_TRY_COMPILE([
2449         #include <lber.h>
2450         #include <ldap.h>], 
2451         [ldap_set_rebind_proc(0, 0, 0);], 
2452         [smb_ldap_cv_ldap_set_rebind_proc=3], 
2453         [smb_ldap_cv_ldap_set_rebind_proc=2]
2454     ) 
2455   ])
2456   
2457   AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
2459   AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS) 
2460   
2461   if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes" -a x"$ac_cv_func_ext_ldap_domain2hostlist" = x"yes"; then
2462     AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
2463     default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
2464     SMBLDAP="lib/smbldap.o"
2465     with_ldap_support=yes
2466     AC_MSG_CHECKING(whether LDAP support is used)
2467     AC_MSG_RESULT(yes)
2468   else
2469     if test x"$with_ldap_support" = x"yes"; then
2470         AC_MSG_ERROR(libldap is needed for LDAP support)
2471     else
2472         AC_MSG_WARN(libldap is needed for LDAP support)
2473     fi
2474     
2475     LDAP_LIBS=""
2476     with_ldap_support=no
2477   fi
2478   LIBS=$ac_save_LIBS
2482 #################################################
2483 # active directory support
2485 with_ads_support=auto
2486 AC_MSG_CHECKING([for Active Directory and krb5 support])
2488 AC_ARG_WITH(ads,
2489 [  --with-ads              Active Directory support (default auto)],
2490 [ case "$withval" in
2491     yes|no)
2492         with_ads_support="$withval"
2493         ;;
2494   esac ])
2496 AC_MSG_RESULT($with_ads_support)
2498 FOUND_KRB5=no
2499 KRB5_LIBS=""
2501 if test x"$with_ldap_support" != x"yes"; then
2502     if test x"$with_ads_support" = x"yes"; then
2503         AC_MSG_ERROR(Active Directory Support requires LDAP support)
2504     elif test x"$with_ads_support" != x"no"; then
2505         AC_MSG_WARN(Active Directory Support requires LDAP support)
2506     fi
2507     with_ads_support=no
2510 if test x"$with_ads_support" != x"no"; then
2512   # Do no harm to the values of CFLAGS and LIBS while testing for
2513   # Kerberos support.
2515   #################################################
2516   # check for krb5-config from recent MIT and Heimdal kerberos 5
2517   AC_PATH_PROG(KRB5_CONFIG, krb5-config)
2518   AC_MSG_CHECKING(for working krb5-config)
2519   if test -x "$KRB5_CONFIG"; then
2520     ac_save_CFLAGS=$CFLAGS
2521     CFLAGS="";export CFLAGS
2522     ac_save_LDFLAGS=$LDFLAGS
2523     LDFLAGS="";export LDFLAGS
2524     KRB5_LIBS="`$KRB5_CONFIG --libs gssapi`"
2525     KRB5_CFLAGS="`$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`" 
2526     KRB5_CPPFLAGS="`$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`"
2527     CFLAGS=$ac_save_CFLAGS;export CFLAGS
2528     LDFLAGS=$ac_save_LDFLAGS;export LDFLAGS
2529     FOUND_KRB5=yes
2530     AC_MSG_RESULT(yes)
2531   else
2532     AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
2533   fi
2534   
2535   if test x$FOUND_KRB5 = x"no"; then
2536     #################################################
2537     # check for location of Kerberos 5 install
2538     AC_MSG_CHECKING(for kerberos 5 install path)
2539     AC_ARG_WITH(krb5,
2540     [  --with-krb5=base-dir    Locate Kerberos 5 support (default=/usr)],
2541     [ case "$withval" in
2542       no)
2543         AC_MSG_RESULT(no krb5-path given)
2544         ;;
2545       yes)
2546         AC_MSG_RESULT(/usr)
2547         FOUND_KRB5=yes
2548         ;;
2549       *)
2550         AC_MSG_RESULT($withval)
2551         KRB5_CFLAGS="-I$withval/include"
2552         KRB5_CPPFLAGS="-I$withval/include"
2553         KRB5_LDFLAGS="-L$withval/lib"
2554         FOUND_KRB5=yes
2555         ;;
2556       esac ],
2557       AC_MSG_RESULT(no krb5-path given)
2558     )
2559   fi
2561   if test x$FOUND_KRB5 = x"no"; then
2562     #################################################
2563     # see if this box has the SuSE location for the heimdal krb implementation
2564     AC_MSG_CHECKING(for /usr/include/heimdal)
2565     if test -d /usr/include/heimdal; then
2566       if test -f /usr/lib/heimdal/lib/libkrb5.a; then
2567           KRB5_CFLAGS="-I/usr/include/heimdal"
2568           KRB5_CPPFLAGS="-I/usr/include/heimdal"
2569           KRB5_LDFLAGS="-L/usr/lib/heimdal/lib"
2570           AC_MSG_RESULT(yes)
2571       else
2572           KRB5_CFLAGS="-I/usr/include/heimdal"
2573           KRB5_CPPFLAGS="-I/usr/include/heimdal"
2574           AC_MSG_RESULT(yes)
2575       fi
2576     else
2577       AC_MSG_RESULT(no)
2578     fi
2579   fi
2581   if test x$FOUND_KRB5 = x"no"; then
2582     #################################################
2583     # see if this box has the RedHat location for kerberos
2584     AC_MSG_CHECKING(for /usr/kerberos)
2585     if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
2586       KRB5_LDFLAGS="-L/usr/kerberos/lib"
2587       KRB5_CFLAGS="-I/usr/kerberos/include"
2588       KRB5_CPPFLAGS="-I/usr/kerberos/include"
2589       AC_MSG_RESULT(yes)
2590     else
2591       AC_MSG_RESULT(no)
2592     fi
2593   fi
2595   ac_save_CFLAGS=$CFLAGS
2596   ac_save_CPPFLAGS=$CPPFLAGS
2597   ac_save_LDFLAGS=$LDFLAGS
2599   CFLAGS="$CFLAGS $KRB5_CFLAGS"
2600   CPPFLAGS="$CPPFLAGS $KRB5_CPPFLAGS"
2601   LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
2603   KRB5_LIBS="$KRB5_LDFLAGS $KRB5_LIBS"
2605   # now check for krb5.h. Some systems have the libraries without the headers!
2606   # note that this check is done here to allow for different kerberos
2607   # include paths
2608   AC_CHECK_HEADERS(krb5.h)
2610   if test x"$ac_cv_header_krb5_h" = x"no"; then
2612     # Give a warning if AD support was not explicitly requested,
2613     # i.e with_ads_support = auto, otherwise die with an error.
2615     if test x"$with_ads_support" = x"yes"; then
2616       AC_MSG_ERROR([Active Directory cannot be supported without krb5.h])
2617     else
2618       AC_MSG_WARN([Active Directory cannot be supported without krb5.h])
2619     fi
2621     # Turn off AD support and restore CFLAGS and LIBS variables
2623     with_ads_support="no"
2624     
2625     CFLAGS=$ac_save_CFLAGS
2626     CPPFLAGS=$ac_save_CPPFLAGS
2627     LDFLAGS=$ac_save_LDFLAGS
2628   fi
2631 # Now we have determined whether we really want ADS support
2633 if test x"$with_ads_support" != x"no"; then
2634   ac_save_LIBS=$LIBS
2636   # now check for gssapi headers.  This is also done here to allow for
2637   # different kerberos include paths
2638   AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h)
2640   ##################################################################
2641   # we might need the k5crypto and com_err libraries on some systems
2642   AC_CHECK_LIB_EXT(com_err, KRB5_LIBS, _et_list)
2643   AC_CHECK_LIB_EXT(k5crypto, KRB5_LIBS, krb5_encrypt_data)
2645   # Heimdal checks.
2646   AC_CHECK_LIB_EXT(crypto, KRB5_LIBS, des_set_key)
2647   AC_CHECK_LIB_EXT(asn1, KRB5_LIBS, copy_Authenticator)
2648   AC_CHECK_LIB_EXT(roken, KRB5_LIBS, roken_getaddrinfo_hostspec)
2650   # Heimdal checks. On static Heimdal gssapi must be linked before krb5.
2651   AC_CHECK_LIB_EXT(gssapi, KRB5_LIBS, gss_display_status,[],[],
2652                                 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available]))
2654   ########################################################
2655   # now see if we can find the krb5 libs in standard paths
2656   # or as specified above
2657   AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_mk_req_extended)
2659   ########################################################
2660   # now see if we can find the gssapi libs in standard paths
2661   AC_CHECK_LIB_EXT(gssapi_krb5, KRB5_LIBS,gss_display_status,[],[],
2662             AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available]))
2664   AC_CHECK_FUNC_EXT(krb5_set_real_time, $KRB5_LIBS)
2665   AC_CHECK_FUNC_EXT(krb5_set_default_in_tkt_etypes, $KRB5_LIBS)
2666   AC_CHECK_FUNC_EXT(krb5_set_default_tgs_ktypes, $KRB5_LIBS)
2667   AC_CHECK_FUNC_EXT(krb5_principal2salt, $KRB5_LIBS)
2668   AC_CHECK_FUNC_EXT(krb5_use_enctype, $KRB5_LIBS)
2669   AC_CHECK_FUNC_EXT(krb5_string_to_key, $KRB5_LIBS) 
2670   AC_CHECK_FUNC_EXT(krb5_get_pw_salt, $KRB5_LIBS)
2671   AC_CHECK_FUNC_EXT(krb5_string_to_key_salt, $KRB5_LIBS) 
2672   AC_CHECK_FUNC_EXT(krb5_auth_con_setkey, $KRB5_LIBS)
2673   AC_CHECK_FUNC_EXT(krb5_auth_con_setuseruserkey, $KRB5_LIBS) 
2674   AC_CHECK_FUNC_EXT(krb5_locate_kdc, $KRB5_LIBS)
2675   AC_CHECK_FUNC_EXT(krb5_get_permitted_enctypes, $KRB5_LIBS) 
2676   AC_CHECK_FUNC_EXT(krb5_get_default_in_tkt_etypes, $KRB5_LIBS) 
2677   AC_CHECK_FUNC_EXT(krb5_free_ktypes, $KRB5_LIBS)
2678   AC_CHECK_FUNC_EXT(krb5_free_data_contents, $KRB5_LIBS)
2679   AC_CHECK_FUNC_EXT(krb5_principal_get_comp_string, $KRB5_LIBS)
2681   LIBS="$LIBS $KRB5_LIBS"
2682   
2683   AC_CACHE_CHECK([for addrtype in krb5_address],
2684                 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS,[
2685     AC_TRY_COMPILE([#include <krb5.h>],
2686       [krb5_address kaddr; kaddr.addrtype = ADDRTYPE_INET;],
2687       samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=yes,
2688       samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=no)])
2690   if test x"$samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS" = x"yes"; then
2691     AC_DEFINE(HAVE_ADDRTYPE_IN_KRB5_ADDRESS,1,
2692                [Whether the krb5_address struct has a addrtype property])
2693   fi
2695   AC_CACHE_CHECK([for addr_type in krb5_address],
2696                  samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,[
2697     AC_TRY_COMPILE([#include <krb5.h>],
2698       [krb5_address kaddr; kaddr.addr_type = KRB5_ADDRESS_INET;],
2699       samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=yes,
2700       samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=no)])
2702   if test x"$samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS" = x"yes"; then
2703     AC_DEFINE(HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,1,
2704               [Whether the krb5_address struct has a addr_type property])
2705   fi
2707   AC_CACHE_CHECK([for enc_part2 in krb5_ticket], 
2708                  samba_cv_HAVE_KRB5_TKT_ENC_PART2,
2709                  [AC_TRY_COMPILE([#include <krb5.h>],
2710     [krb5_ticket tkt; tkt.enc_part2->authorization_data[0]->contents = NULL;],
2711     samba_cv_HAVE_KRB5_TKT_ENC_PART2=yes,samba_cv_HAVE_KRB5_TKT_ENC_PART2=no)])
2713   if test x"$samba_cv_HAVE_KRB5_TKT_ENC_PART2" = x"yes"; then
2714     AC_DEFINE(HAVE_KRB5_TKT_ENC_PART2,1,
2715               [Whether the krb5_ticket struct has a enc_part2 property])
2716   fi
2718   AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
2719                  samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE,[
2720     AC_TRY_COMPILE([#include <krb5.h>],
2721       [krb5_keyblock key; key.keyvalue.data = NULL;],
2722       samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=yes,
2723       samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=no)])
2725   if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE" = x"yes"; then
2726     AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
2727               [Whether the krb5_keyblock struct has a keyvalue property])
2728   fi
2730   AC_CACHE_CHECK([for ENCTYPE_ARCFOUR_HMAC_MD5],
2731                  samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,[
2732     AC_TRY_COMPILE([#include <krb5.h>],
2733       [krb5_enctype enctype; enctype = ENCTYPE_ARCFOUR_HMAC_MD5;],
2734       samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=yes,
2735       samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=no)])
2736   AC_CACHE_CHECK([for KEYTYPE_ARCFOUR_56],
2737                  samba_cv_HAVE_KEYTYPE_ARCFOUR_56,[
2738     AC_TRY_COMPILE([#include <krb5.h>],
2739       [krb5_keytype keytype; keytype = KEYTYPE_ARCFOUR_56;],
2740       samba_cv_HAVE_KEYTYPE_ARCFOUR_56=yes,
2741       samba_cv_HAVE_KEYTYPE_ARCFOUR_56=no)])
2742 # Heimdals with KEYTYPE_ARCFOUR but not KEYTYPE_ARCFOUR_56 are broken
2743 # w.r.t. arcfour and windows, so we must not enable it here
2744   if test x"$samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5" = x"yes" -a\
2745           x"$samba_cv_HAVE_KEYTYPE_ARCFOUR_56" = x"yes"; then
2746     AC_DEFINE(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,1,
2747               [Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type is available])
2748   fi
2750   AC_CACHE_CHECK([for AP_OPTS_USE_SUBKEY],
2751                  samba_cv_HAVE_AP_OPTS_USE_SUBKEY,[
2752     AC_TRY_COMPILE([#include <krb5.h>],
2753       [krb5_flags ap_options; ap_options = AP_OPTS_USE_SUBKEY;],
2754       samba_cv_HAVE_AP_OPTS_USE_SUBKEY=yes,
2755       samba_cv_HAVE_AP_OPTS_USE_SUBKEY=no)])
2757   if test x"$samba_cv_HAVE_AP_OPTS_USE_SUBKEY" = x"yes"; then
2758     AC_DEFINE(HAVE_AP_OPTS_USE_SUBKEY,1,
2759               [Whether the AP_OPTS_USE_SUBKEY ap option is available])
2760   fi
2762   AC_CACHE_CHECK([for the krb5_princ_component macro],
2763                 samba_cv_HAVE_KRB5_PRINC_COMPONENT,[
2764     AC_TRY_LINK([#include <krb5.h>],
2765       [const krb5_data *pkdata; krb5_context context; krb5_principal principal; pkdata = krb5_princ_component(context, principal, 0);],
2766       samba_cv_HAVE_KRB5_PRINC_COMPONENT=yes,
2767       samba_cv_HAVE_KRB5_PRINC_COMPONENT=no)])
2769   if test x"$samba_cv_HAVE_KRB5_PRINC_COMPONENT" = x"yes"; then
2770     AC_DEFINE(HAVE_KRB5_PRINC_COMPONENT,1,
2771                [Whether krb5_princ_component is available])
2772   fi
2774   AC_CACHE_CHECK([for key in krb5_keytab_entry],
2775                  samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY,[
2776     AC_TRY_COMPILE([#include <krb5.h>],
2777       [krb5_keytab_entry entry; krb5_keyblock e; entry.key = e;],
2778       samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=yes,
2779       samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=no)])
2781   if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY" = x"yes"; then
2782     AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEY,1,
2783               [Whether krb5_keytab_entry has key member])
2784   fi
2786   AC_CACHE_CHECK([for keyblock in krb5_keytab_entry],
2787                  samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,[
2788     AC_TRY_COMPILE([#include <krb5.h>],
2789       [krb5_keytab_entry entry; entry.keyblock.keytype = 0;],
2790       samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=yes,
2791       samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=no)])
2793   if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK" = x"yes"; then
2794     AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,1,
2795               [Whether krb5_keytab_entry has keyblock member])
2796   fi
2798   if test x"$ac_cv_lib_ext_krb5_krb5_mk_req_extended" = x"yes"; then
2799     AC_DEFINE(HAVE_KRB5,1,[Whether to have KRB5 support])
2800     AC_DEFINE(WITH_ADS,1,[Whether to include Active Directory support])
2801     AC_MSG_CHECKING(whether Active Directory and krb5 support is used)
2802     AC_MSG_RESULT(yes)
2803   else
2804     if test x"$with_ads_support" = x"yes"; then
2805         AC_MSG_ERROR(libkrb5 is needed for Active Directory support)
2806     else
2807         AC_MSG_WARN(libkrb5 is needed for Active Directory support)
2808     fi
2809     KRB5_LIBS=""
2810     with_ads_support=no 
2811   fi
2812   LIBS="$ac_save_LIBS"
2815 ########################################################
2816 # Compile experimental passdb backends?
2817 # (pdb_xml, pdb_mysql, pdb_pgsql)
2818 AC_MSG_CHECKING(whether to build experimental passdb libraries)
2819 AC_ARG_WITH(expsam,
2820 [  --with-expsam=<list>    Include experimental passdb libraries (default=no)]
2821 [                          Valid choices include (comma separated list): ]
2822 [                              xml, mysql & pgsql],
2823 [ expsam_pdb_modules=`echo "$withval" | sed 's/,/ /g'`
2824   if test "z$expsam_pdb_modules" = "zyes"; then
2825     expsam_pdb_modules="xml mysql pgsql"
2826   fi
2827   AC_MSG_RESULT($expsam_pdb_modules)
2828   for i in $expsam_pdb_modules
2829   do 
2830     case "$i" in
2831     xml|all|yes)
2832       ## pdb_xml
2833           AM_PATH_XML2([2.0.0],[default_shared_modules="$default_shared_modules pdb_xml"],[AC_MSG_ERROR([Can't find XML libraries while XML support is requested])])
2834       CFLAGS="$CFLAGS $XML_CFLAGS"
2835       ;;
2836     mysql|all|yes)
2837       ## pdb_mysql
2838           AM_PATH_MYSQL([default_shared_modules="$default_shared_modules pdb_mysql"],[AC_MSG_ERROR([Can't find MySQL libraries while MySQL support is requested])])
2839       CFLAGS="$CFLAGS $MYSQL_CFLAGS"
2840       ;;
2841      pgsql|all|yes)
2842       ## pdb_pgsql
2843       AM_PATH_PGSQL([default_shared_modules="$default_shared_modules pdb_pgsql"],[])
2844       CFLAGS="$CFLAGS $PGSQL_CFLAGS"
2845       ;;
2846     no)
2847       ;;
2848     *)
2849       echo "Unknown module name \"$i\"!  Exiting..."
2850       exit 1
2851       ;;
2852     esac
2853   done ],
2854   AC_MSG_RESULT(no)
2857 #################################################
2858 # check for automount support
2859 AC_MSG_CHECKING(whether to use automount)
2860 AC_ARG_WITH(automount,
2861 [  --with-automount        Include automount support (default=no)],
2862 [ case "$withval" in
2863   yes)
2864     AC_MSG_RESULT(yes)
2865     AC_DEFINE(WITH_AUTOMOUNT,1,[Whether to include automount support])
2866     ;;
2867   *)
2868     AC_MSG_RESULT(no)
2869     ;;
2870   esac ],
2871   AC_MSG_RESULT(no)
2874 #################################################
2875 # check for smbmount support
2876 AC_MSG_CHECKING(whether to use smbmount)
2877 AC_ARG_WITH(smbmount,
2878 [  --with-smbmount         Include smbmount (Linux only) support (default=no)],
2879 [ case "$withval" in
2880   yes)
2881         case "$host_os" in
2882         *linux*)
2883                 AC_MSG_RESULT(yes)
2884                 AC_DEFINE(WITH_SMBMOUNT,1,[Whether to build smbmount])
2885                 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbmount bin/smbmnt bin/smbumount"
2886                 ;;
2887         *)
2888                 AC_MSG_ERROR(not on a linux system!)
2889                 ;;
2890         esac
2891     ;;
2892   *)
2893     AC_MSG_RESULT(no)
2894     ;;
2895   esac ],
2896   AC_MSG_RESULT(no)
2900 #################################################
2901 # check for a PAM clear-text auth, accounts, password and session support
2902 with_pam_for_crypt=no
2903 AC_MSG_CHECKING(whether to use PAM)
2904 AC_ARG_WITH(pam,
2905 [  --with-pam              Include PAM support (default=no)],
2906 [ case "$withval" in
2907   yes)
2908     AC_MSG_RESULT(yes)
2909     if test x"$ac_cv_header_security_pam_appl_h" = x"no"; then
2910        if test x"$ac_cv_header_security_pam_modules_h" = x"no"; then
2911           if test x"$ac_cv_header_security__pam_macros_h" = x"no"; then
2912              AC_MSG_ERROR(--with-pam specified but no PAM headers found)
2913           fi
2914        fi
2915     fi
2916     AC_DEFINE(WITH_PAM,1,[Whether to include PAM support])
2917     AUTH_LIBS="$AUTH_LIBS -lpam"
2918     with_pam_for_crypt=yes
2919     ;;
2920   *)
2921     AC_MSG_RESULT(no)
2922     ;;
2923   esac ],
2924   AC_MSG_RESULT(no)
2927 # we can't build a pam module if we don't have pam.
2928 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM,1,[Whether libpam is available])])
2930 #################################################
2931 # check for pam_smbpass support
2932 AC_MSG_CHECKING(whether to use pam_smbpass)
2933 AC_ARG_WITH(pam_smbpass,
2934 [  --with-pam_smbpass      Build PAM module for authenticating against passdb backends (default=no)],
2935 [ case "$withval" in
2936   yes)
2937     AC_MSG_RESULT(yes)
2939        # Conditions under which pam_smbpass should not be built.
2941        if test x$PICFLAGS = x; then
2942           AC_MSG_ERROR([No support for PIC code])
2943        elif test x"$ac_cv_header_security_pam_appl_h" = x"no"; then
2944           AC_MSG_ERROR([No security/pam_appl.h found])
2945        elif test x$ac_cv_lib_pam_pam_get_data = xno; then
2946           AC_MSG_ERROR([No libpam found])
2947        else
2948           AUTH_LIBS="$AUTH_LIBS -lpam"
2949           SHLIB_PROGS="$SHLIB_PROGS bin/pam_smbpass.$SHLIBEXT"
2950        fi
2951     ;;
2952   *)
2953     AC_MSG_RESULT(no)
2954     ;;
2955   esac ],
2956   AC_MSG_RESULT(no)
2960 ###############################################
2961 # test for where we get crypt() from
2962 AC_SEARCH_LIBS(crypt, [crypt],
2963   [test "$ac_cv_search_crypt" = "none required" || AUTH_LIBS="-lcrypt $AUTH_LIBS"
2964   AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
2967 ## moved after the check for -lcrypt in order to
2968 ## ensure that the necessary libraries are included
2969 ## check checking for truncated salt.  Wrapped by the
2970 ## $with_pam_for_crypt variable as above   --jerry
2972 if test $with_pam_for_crypt = no; then
2973 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
2974 crypt_LIBS="$LIBS"
2975 LIBS="$AUTH_LIBS $LIBS"
2976 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
2977         samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
2978 LIBS="$crypt_LIBS"])
2979 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
2980         AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
2985 dictpath="/usr/lib/cracklib_dict"
2986 with_cracklib=yes
2987 ###############################################
2988 # test for where we get FaciestCheck from
2989 AC_MSG_CHECKING(where to use cracklib from (default=$dictpath))
2990 AC_ARG_WITH(cracklib,
2991 [  --with-cracklib[=DIR]     Look for cracklib dictionary in this location ],
2992 [  case "$withval" in
2993   yes)
2994     AC_MSG_RESULT(${dictpath})
2995     ;;
2996   no)
2997     AC_MSG_RESULT(no)
2998       dictpath=""
2999     ;;
3000   *)
3001       dictpath="$withval"
3002     AC_MSG_RESULT(${dictpath})
3003     ;;
3004   esac ],
3005   dictpath=""
3006   AC_MSG_RESULT(no)
3009 if test x$dictpath != x""; then
3010      AC_SEARCH_LIBS(FascistCheck, [crack],
3011                     [test "$ac_cv_search_crack" = "none required" || samba_cv_found_crack="yes"
3012                     AC_DEFINE(HAVE_CRACK,1,[Whether the system has the FaciestCheck function from cracklib])])
3014      crack_saved_libs=$LIBS;
3016      if test x$samba_cv_found_crack=x"yes"; then
3017         AC_SEARCH_LIBS(CRACKLIB_DICTPATH, [crypt],
3018             AC_DEFINE(HAVE_CRACKLIB_DICTPATH, 1, [Whether we have given a CRACKLIB_DICTPATH in our headers])
3019         )
3021         AC_DEFINE_UNQUOTED(SAMBA_CRACKLIB_DICTPATH, "$dictpath", [Where the cracklib dictionay is])
3022         AC_MSG_CHECKING(Whether we have a working cracklib)
3023         AC_TRY_RUN([
3024                 #include "${srcdir-.}/tests/crack.c"],
3025               AC_MSG_RESULT(yes)
3026               AC_DEFINE(HAVE_WORKING_CRACKLIB,1,[Whether we have a working cracklib])
3027               AUTH_LIBS="-lcrack $AUTH_LIBS",
3029               AC_MSG_RESULT(no)
3030               AC_MSG_WARN(cracklib exists - but does not function correctly),
3032               AC_MSG_RESULT(no)
3033               AC_MSG_WARN(cannot test-run when cross-compiling)
3034               )
3035     else
3036         AC_MSG_CHECKING(Whether we have cracklib)
3037         AC_MSG_RESULT(no)
3038     fi
3039     LIBS=$crack_saved_libs
3042 ########################################################################################
3044 ## TESTS FOR SAM BACKENDS.  KEEP THESE GROUPED TOGETHER
3046 ########################################################################################
3048 #################################################
3049 # check for a LDAP password database configuration backwards compatibility
3050 AC_MSG_CHECKING(whether to use LDAP SAM 2.2 compatible configuration)
3051 AC_ARG_WITH(ldapsam,
3052 [  --with-ldapsam          Include LDAP SAM 2.2 compatible configuration (default=no)],
3053 [ case "$withval" in
3054   yes)
3055     AC_MSG_RESULT(yes)
3056     AC_DEFINE(WITH_LDAP_SAMCONFIG,1,[Whether to include 2.2 compatible LDAP SAM configuration])
3057     ;;
3058   *)
3059     AC_MSG_RESULT(no)
3060     ;;
3061   esac ],
3062   AC_MSG_RESULT(no)
3065 ########################################################################################
3067 ## END OF TESTS FOR SAM BACKENDS.  
3069 ########################################################################################
3071 #################################################
3072 # check for a NISPLUS_HOME support 
3073 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
3074 AC_ARG_WITH(nisplus-home,
3075 [  --with-nisplus-home     Include NISPLUS_HOME support (default=no)],
3076 [ case "$withval" in
3077   yes)
3078     AC_MSG_RESULT(yes)
3079     AC_DEFINE(WITH_NISPLUS_HOME,1,[Whether to include nisplus_home support])
3080     ;;
3081   *)
3082     AC_MSG_RESULT(no)
3083     ;;
3084   esac ],
3085   AC_MSG_RESULT(no)
3088 #################################################
3089 # check for syslog logging
3090 AC_MSG_CHECKING(whether to use syslog logging)
3091 AC_ARG_WITH(syslog,
3092 [  --with-syslog           Include experimental SYSLOG support (default=no)],
3093 [ case "$withval" in
3094   yes)
3095     AC_MSG_RESULT(yes)
3096     AC_DEFINE(WITH_SYSLOG,1,[Whether to include experimental syslog support])
3097     ;;
3098   *)
3099     AC_MSG_RESULT(no)
3100     ;;
3101   esac ],
3102   AC_MSG_RESULT(no)
3105 #################################################
3106 # check for a shared memory profiling support
3107 AC_MSG_CHECKING(whether to use profiling)
3108 AC_ARG_WITH(profiling-data,
3109 [  --with-profiling-data   Include gathering source code profile information (default=no)],
3110 [ case "$withval" in
3111   yes)
3112     AC_MSG_RESULT(yes)
3113     AC_DEFINE(WITH_PROFILE,1,[Whether to use profiling])
3114     ;;
3115   *)
3116     AC_MSG_RESULT(no)
3117     ;;
3118   esac ],
3119   AC_MSG_RESULT(no)
3123 #################################################
3124 # check for experimental disk-quotas support
3126 samba_cv_WITH_QUOTAS=auto
3127 samba_cv_TRY_QUOTAS=no
3128 samba_cv_RUN_QUOTA_TESTS=auto
3129 samba_cv_WITH_SYS_QUOTAS=auto
3130 samba_cv_TRY_SYS_QUOTAS=no
3131 samba_cv_SYSQUOTA_FOUND=no;
3133 AC_MSG_CHECKING(whether to try disk-quotas support)
3134 AC_ARG_WITH(quotas,
3135 [  --with-quotas           Include disk-quota support (default=no)],
3136 [ case "$withval" in
3137   yes)
3138     AC_MSG_RESULT(yes)
3139     samba_cv_WITH_QUOTAS=yes
3140     samba_cv_TRY_QUOTAS=yes
3141     samba_cv_RUN_QUOTA_TESTS=yes
3142     #set sys quotas to auto in this case
3143     samba_cv_TRY_SYS_QUOTAS=auto
3144     ;;
3145   auto)
3146     AC_MSG_RESULT(auto)
3147     samba_cv_WITH_QUOTAS=auto
3148     samba_cv_TRY_QUOTAS=auto
3149     samba_cv_RUN_QUOTA_TESTS=auto
3150     #set sys quotas to auto in this case
3151     samba_cv_TRY_SYS_QUOTAS=auto
3152     ;;
3153   no)
3154     AC_MSG_RESULT(no)
3155     samba_cv_WITH_QUOTAS=no
3156     samba_cv_TRY_QUOTAS=no
3157     samba_cv_RUN_QUOTA_TESTS=no
3158     ;;
3159   *)
3160     AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
3161     ;;
3162   esac ],
3163   AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
3166 AC_MSG_CHECKING(whether to try the new lib/sysquotas.c interface)
3167 AC_ARG_WITH(sys-quotas,
3168 [  --with-sys-quotas       Include lib/sysquotas.c support (default=auto)],
3169 [ case "$withval" in
3170   yes)
3171     AC_MSG_RESULT(yes)
3172     samba_cv_WITH_SYS_QUOTAS=yes
3173     samba_cv_TRY_SYS_QUOTAS=yes
3174     samba_cv_RUN_QUOTA_TESTS=yes
3175     ;;
3176   auto)
3177     AC_MSG_RESULT(auto)
3178     samba_cv_WITH_SYS_QUOTAS=auto
3179     samba_cv_TRY_SYS_QUOTAS=auto
3180     samba_cv_RUN_QUOTA_TESTS=auto
3181     ;;
3182   no)
3183     AC_MSG_RESULT(no)
3184     samba_cv_WITH_SYS_QUOTAS=no
3185     samba_cv_TRY_SYS_QUOTAS=no
3186     ;;
3187   *)
3188     AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
3189     ;;
3190   esac ],
3191   AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
3194 if test x"$samba_cv_TRY_SYS_QUOTAS" = x"auto"; then
3195 AC_MSG_CHECKING(whether to try the lib/sysquotas.c interface on ${host_os})
3196   case "$host_os" in
3197         *linux*)
3198             AC_MSG_RESULT(yes)
3199             samba_cv_TRY_SYS_QUOTAS=yes
3200             samba_cv_RUN_QUOTA_TESTS=yes
3201             samba_cv_SYSQUOTA_FOUND=yes
3202             AC_DEFINE(HAVE_QUOTACTL_LINUX,1,[Whether Linux quota support is available])
3203             samba_cv_sysquotas_file="lib/sysquotas_linux.c"
3204             AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available])
3205             samba_cv_found_xfs_header=yes
3206             ;;
3207         *)
3208             AC_MSG_RESULT(no)
3209             samba_cv_TRY_SYS_QUOTAS=no
3210             ;;
3211   esac
3214 #############################################
3215 # only check for quota stuff if --with-quotas
3216 if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then
3218 # some broken header files need this
3219 AC_CHECK_HEADER(asm/types.h,[
3220             AC_DEFINE(HAVE_ASM_TYPES_H,1,[check for <asm/types.h>])
3221             AC_ADD_INCLUDE(<asm/types.h>)
3222             ])
3224 # For quotas on Veritas VxFS filesystems
3225 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
3227 # For sys/quota.h and linux/quota.h
3228 AC_CHECK_HEADERS(sys/quota.h)
3230 if test x"$samba_cv_found_xfs_header" != x"yes"; then
3231 # if we have xfs quota support <sys/quota.h> (IRIX) we should use it
3232 AC_CACHE_CHECK([for XFS QUOTA in <sys/quota.h>],samba_cv_HAVE_SYS_QUOTA_XFS, [
3233 AC_TRY_COMPILE([
3234 #include "confdefs.h"
3235 #ifdef HAVE_SYS_TYPES_H
3236 #include <sys/types.h>
3237 #endif
3238 #ifdef HAVE_ASM_TYPES_H
3239 #include <asm/types.h>
3240 #endif
3241 #include <sys/quota.h>
3242 ],[int i = Q_XGETQUOTA;],
3243 samba_cv_HAVE_SYS_QUOTA_XFS=yes,samba_cv_HAVE_SYS_QUOTA_XFS=no)])
3244 if test "$samba_cv_HAVE_SYS_QUOTA_XFS"x = "yes"x; then
3245         samba_cv_found_xfs_header=yes
3249 # if we have struct dqblk .dqb_fsoftlimit instead of .dqb_isoftlimit on IRIX 
3250 AC_CACHE_CHECK([if struct dqblk has .dqb_fsoftlimit],samba_cv_HAVE_DQB_FSOFTLIMIT, [
3251 AC_TRY_COMPILE([
3252 #include "confdefs.h"
3253 #ifdef HAVE_SYS_QUOTA_H
3254 #include <sys/quota.h>
3255 #endif
3257 struct dqblk D;
3258 D.dqb_fsoftlimit = 0;],
3259 samba_cv_HAVE_DQB_FSOFTLIMIT=yes,samba_cv_HAVE_DQB_FSOFTLIMIT=no)])
3260 if test "$samba_cv_HAVE_DQB_FSOFTLIMIT"x = "yes"x; then
3261         AC_DEFINE(HAVE_DQB_FSOFTLIMIT,1,[struct dqblk .dqb_fsoftlimit])
3264 ##################
3265 # look for a working quota system
3267 if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
3268 AC_CACHE_CHECK([for long quotactl(int cmd, char *special, qid_t id, caddr_t addr)],samba_cv_HAVE_QUOTACTL_4A,[
3269 AC_TRY_RUN_STRICT([
3270 #define HAVE_QUOTACTL_4A 1
3271 #define AUTOCONF_TEST 1
3272 #include "confdefs.h"
3273 #include "${srcdir-.}/tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
3274            samba_cv_HAVE_QUOTACTL_4A=yes,samba_cv_HAVE_QUOTACTL_4A=no,samba_cv_HAVE_QUOTACTL_4A=cross)])
3275 if test x"$samba_cv_HAVE_QUOTACTL_4A" = x"yes"; then
3276     samba_cv_SYSQUOTA_FOUND=yes;
3277     AC_DEFINE(HAVE_QUOTACTL_4A,1,[Whether long quotactl(int cmd, char *special, qid_t id, caddr_t addr) is available])
3278     samba_cv_sysquotas_file="lib/sysquotas_4A.c"
3282 if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
3283 AC_CACHE_CHECK([for int quotactl(const char *path, int cmd, int id, char *addr)],samba_cv_HAVE_QUOTACTL_4B,[
3284 AC_TRY_RUN_STRICT([
3285 #define HAVE_QUOTACTL_4B 1
3286 #define AUTOCONF_TEST 1
3287 #include "confdefs.h"
3288 #include "${srcdir-.}/tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
3289            samba_cv_HAVE_QUOTACTL_4B=yes,samba_cv_HAVE_QUOTACTL_4B=no,samba_cv_HAVE_QUOTACTL_4B=cross)])
3290 if test x"$samba_cv_HAVE_QUOTACTL_4B" = x"yes"; then
3291     echo "int quotactl(const char *path, int cmd, int id, char *addr) is not reworked for the new sys_quota api"
3292     samba_cv_SYSQUOTA_FOUND=yes;
3293     AC_DEFINE(HAVE_QUOTACTL_4B,1,[Whether int quotactl(const char *path, int cmd, int id, char *addr) is available])
3294     samba_cv_sysquotas_file="lib/sysquotas_4B.c"
3298 if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
3299 AC_CACHE_CHECK([for CRAY int quotactl (char *spec, int request, char *arg)],samba_cv_HAVE_QUOTACTL_3,[
3300 AC_TRY_RUN_STRICT([
3301 #define HAVE_QUOTACTL_3 1
3302 #define AUTOCONF_TEST 1
3303 #include "confdefs.h"
3304 #include "${srcdir-.}/tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
3305            samba_cv_HAVE_QUOTACTL_3=yes,samba_cv_HAVE_QUOTACTL_3=no,samba_cv_HAVE_QUOTACTL_3=cross)])
3306 if test x"$samba_cv_HAVE_QUOTACTL_3" = x"yes"; then
3307     echo "CRAY int quotactl (char *spec, int request, char *arg) is NOT reworked for the sys_quota api"
3308     samba_cv_SYSQUOTA_FOUND=yes;
3309     AC_DEFINE(HAVE_QUOTACTL_3,1,[Whether CRAY int quotactl (char *spec, int request, char *arg); is available])
3310     samba_cv_sysquotas_file="lib/sysquotas_3.c"
3314 #################################################
3315 # check for mntent.h and struct mntent
3316 AC_CHECK_HEADERS(mntent.h)
3317 #################################################
3318 # check for setmntent,getmntent,endmntent
3319 AC_CHECK_FUNCS(setmntent getmntent endmntent)
3321 #################################################
3322 # check for devnm.h and struct mntent
3323 AC_CHECK_HEADERS(devnm.h)
3324 #################################################
3325 # check for devnm
3326 AC_CHECK_FUNCS(devnm)
3328 if test x"$samba_cv_WITH_SYS_QUOTAS" = x"yes"; then
3329     if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
3330         # if --with-sys-quotas=yes then build it 
3331         # you have can use the get/set quota command smb.conf
3332         # options then
3333         samba_cv_SYSQUOTA_FOUND=auto
3334     fi
3335     if test x"$samba_cv_TRY_SYS_QUOTAS" != x"yes"; then
3336         # if --with-sys-quotas=yes then build it 
3337         # you have can use the get/set quota command smb.conf
3338         # options then
3339         samba_cv_TRY_SYS_QUOTAS=auto
3340     fi
3343 if test x"$samba_cv_SYSQUOTA_FOUND" != x"no"; then
3344 AC_CACHE_CHECK([whether the sys_quota interface works],samba_cv_SYSQUOTA_WORKS,[
3345 SAVE_CPPFLAGS="$CPPFLAGS"
3346 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I. -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt  -I${srcdir-.}/smbwrapper -I${srcdir-.}/nsswitch"
3347 AC_TRY_COMPILE([
3348 #include "confdefs.h"
3349 #define NO_PROTO_H 1
3350 #define NO_CONFIG_H 1
3351 #define HAVE_SYS_QUOTAS 1
3352 #include "${srcdir-.}/${samba_cv_sysquotas_file}"
3353 #include "${srcdir-.}/lib/sysquotas.c"
3354 ],[],samba_cv_SYSQUOTA_WORKS=yes,samba_cv_SYSQUOTA_WORKS=no)
3355 CPPFLAGS="$SAVE_CPPFLAGS"
3357 if test x"$samba_cv_SYSQUOTA_WORKS" = x"yes"; then
3358 AC_MSG_CHECKING(whether to use the new lib/sysquotas.c interface)
3359     if test x"$samba_cv_TRY_SYS_QUOTAS" != x"no"; then 
3360         AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
3361         AC_DEFINE(HAVE_SYS_QUOTAS,1,[Whether the new lib/sysquotas.c interface can be used])
3362         samba_cv_WE_USE_SYS_QUOTAS=yes
3363         AC_MSG_RESULT(yes)
3364     else
3365         AC_MSG_RESULT(no)
3366     fi
3370 if test x"$samba_cv_SYSQUOTA_FOUND" != x"no" -a x"$samba_cv_found_xfs_header" = x"yes"; then
3371 AC_CACHE_CHECK([whether the sys_quota interface works with XFS],samba_cv_SYSQUOTA_WORKS_XFS,[
3372 SAVE_CPPFLAGS="$CPPFLAGS"
3373 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I. -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt  -I${srcdir-.}/smbwrapper -I${srcdir-.}/nsswitch"
3374 AC_TRY_COMPILE([
3375 #include "confdefs.h"
3376 #define NO_PROTO_H 1
3377 #define NO_CONFIG_H 1
3378 #define HAVE_SYS_QUOTAS 1
3379 #define HAVE_XFS_QUOTAS 1
3380 #include "${srcdir-.}/lib/sysquotas_xfs.c"
3381 ],[],samba_cv_SYSQUOTA_WORKS_XFS=yes,samba_cv_SYSQUOTA_WORKS_XFS=no)
3382 CPPFLAGS="$SAVE_CPPFLAGS"
3384 if test x"$samba_cv_SYSQUOTA_WORKS_XFS" = x"yes"; then
3385     if test x"$samba_cv_WE_USE_SYS_QUOTAS" = x"yes"; then
3386         AC_DEFINE(HAVE_XFS_QUOTAS,1,[Whether xfs quota support is available])
3387     fi
3391 AC_CACHE_CHECK([whether the old quota support works],samba_cv_QUOTA_WORKS,[
3392 SAVE_CPPFLAGS="$CPPFLAGS"
3393 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I. -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt  -I${srcdir-.}/smbwrapper -I${srcdir-.}/nsswitch"
3394 AC_TRY_COMPILE([
3395 #include "confdefs.h"
3396 #define NO_PROTO_H 1
3397 #define NO_CONFIG_H 1
3398 #include "${srcdir-.}/smbd/quotas.c"
3399 ],[],samba_cv_QUOTA_WORKS=yes,samba_cv_QUOTA_WORKS=no)
3400 CPPFLAGS="$SAVE_CPPFLAGS"
3402 if test x"$samba_cv_QUOTA_WORKS" = x"yes"; then
3403 AC_MSG_CHECKING(whether to use the old quota support)
3404     if test x"$samba_cv_WE_USE_SYS_QUOTAS" != x"yes"; then
3405       if test x"$samba_cv_TRY_QUOTAS" != x"no"; then
3406         AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
3407         AC_MSG_RESULT(yes)
3408       else
3409         AC_MSG_RESULT(no)
3410       fi
3411     else
3412       AC_MSG_RESULT(no)
3413     fi
3416 ####################
3417 # End of quota check samba_cv_RUN_QUOTA_TESTS
3420 #################################################
3421 # check for experimental utmp accounting
3423 AC_MSG_CHECKING(whether to support utmp accounting)
3424 WITH_UTMP=yes
3425 AC_ARG_WITH(utmp,
3426 [  --with-utmp             Include utmp accounting (default, if supported by OS)],
3427 [ case "$withval" in
3428   no)
3429                 WITH_UTMP=no
3430                 ;;
3431   *)
3432                 WITH_UTMP=yes
3433                 ;;
3434   esac ],
3437 # utmp requires utmp.h
3438 # Note similar check earlier, when checking utmp details.
3440 if test x"$WITH_UTMP" = x"yes" -a x"$ac_cv_header_utmp_h" = x"no"; then
3441         utmp_no_reason=", no utmp.h on $host_os"
3442         WITH_UTMP=no
3445 # Display test results
3447 if test x"$WITH_UTMP" = x"yes"; then
3448         AC_MSG_RESULT(yes)
3449         AC_DEFINE(WITH_UTMP,1,[Whether to include experimental utmp accounting])
3450 else
3451         AC_MSG_RESULT(no$utmp_no_reason)
3454 #################################################
3455 # choose native language(s) of man pages
3456 AC_MSG_CHECKING(chosen man pages' language(s))
3457 AC_ARG_WITH(manpages-langs,
3458 [  --with-manpages-langs={en,ja,pl}  Choose man pages' language(s). (en)],
3459 [ case "$withval" in
3460   yes|no)
3461     AC_MSG_WARN(--with-manpages-langs called without argument - will use default)
3462     manlangs="en"
3463   ;;
3464   *)
3465     manlangs="$withval"
3466   ;;
3467   esac
3469   AC_MSG_RESULT($manlangs)
3470   manlangs=`echo $manlangs | sed "s/,/ /g"`   # replacing commas with spaces to produce a list
3471   AC_SUBST(manlangs)],
3473   [manlangs="en"
3474   AC_MSG_RESULT($manlangs)
3475   AC_SUBST(manlangs)]
3478 #################################################
3479 # should we build libsmbclient?
3481 INSTALLCLIENTCMD_SH=:
3482 INSTALLCLIENTCMD_A=:
3483 INSTALLCLIENT=
3484 LIBSMBCLIENT_SHARED=
3485 LIBSMBCLIENT=
3486 AC_MSG_CHECKING(whether to build the libsmbclient shared library)
3487 AC_ARG_WITH(libsmbclient,
3488 [  --with-libsmbclient     Build the libsmbclient shared library (default=yes if shared libs supported)],
3489 [ case "$withval" in
3490   no) 
3491      AC_MSG_RESULT(no)
3492      ;;
3493   *)
3494      if test $BLDSHARED = true; then
3495         INSTALLCLIENTCMD_SH="\$(INSTALLCMD)"
3496         ## build the static version of libsmbclient as well
3497         INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
3498         LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
3499         LIBSMBCLIENT=libsmbclient
3500         AC_MSG_RESULT(yes)
3501      else
3502         enable_static=yes
3503         AC_MSG_RESULT(no shared library support -- will supply static library)
3504      fi
3505      if test $enable_static = yes; then
3506         INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
3507         LIBSMBCLIENT=libsmbclient
3508      fi
3509      INSTALLCLIENT=installclientlib
3510      ;;
3511   esac ],
3513 # if unspecified, default is to built it iff possible.
3514   if test $BLDSHARED = true; then
3515      INSTALLCLIENTCMD_SH="\$(INSTALLCMD)"
3516      LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
3517      LIBSMBCLIENT=libsmbclient
3518      AC_MSG_RESULT(yes)
3519    else
3520      enable_static=yes
3521      AC_MSG_RESULT(no shared library support -- will supply static library)
3522    fi
3523    if test $enable_static = yes; then
3524      INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
3525      LIBSMBCLIENT=libsmbclient
3526   fi]
3527   INSTALLCLIENT=installclientlib
3531 #################################################
3532 # these tests are taken from the GNU fileutils package
3533 AC_CHECKING(how to get filesystem space usage)
3534 space=no
3536 # Test for statvfs64.
3537 if test $space = no; then
3538   # SVR4
3539   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
3540   [AC_TRY_RUN([
3541 #if defined(HAVE_UNISTD_H)
3542 #include <unistd.h>
3543 #endif
3544 #include <sys/types.h>
3545 #include <sys/statvfs.h>
3546   main ()
3547   {
3548     struct statvfs64 fsd;
3549     exit (statvfs64 (".", &fsd));
3550   }],
3551   fu_cv_sys_stat_statvfs64=yes,
3552   fu_cv_sys_stat_statvfs64=no,
3553   fu_cv_sys_stat_statvfs64=cross)])
3554   if test $fu_cv_sys_stat_statvfs64 = yes; then
3555     space=yes
3556     AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
3557   fi
3560 # Perform only the link test since it seems there are no variants of the
3561 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
3562 # because that got a false positive on SCO OSR5.  Adding the declaration
3563 # of a `struct statvfs' causes this test to fail (as it should) on such
3564 # systems.  That system is reported to work fine with STAT_STATFS4 which
3565 # is what it gets when this test fails.
3566 if test $space = no; then
3567   # SVR4
3568   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
3569                  [AC_TRY_LINK([#include <sys/types.h>
3570 #include <sys/statvfs.h>],
3571                               [struct statvfs fsd; statvfs (0, &fsd);],
3572                               fu_cv_sys_stat_statvfs=yes,
3573                               fu_cv_sys_stat_statvfs=no)])
3574   if test $fu_cv_sys_stat_statvfs = yes; then
3575     space=yes
3576     AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
3577   fi
3580 if test $space = no; then
3581   # DEC Alpha running OSF/1
3582   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
3583   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
3584   [AC_TRY_RUN([
3585 #include <sys/param.h>
3586 #include <sys/types.h>
3587 #include <sys/mount.h>
3588   main ()
3589   {
3590     struct statfs fsd;
3591     fsd.f_fsize = 0;
3592     exit (statfs (".", &fsd, sizeof (struct statfs)));
3593   }],
3594   fu_cv_sys_stat_statfs3_osf1=yes,
3595   fu_cv_sys_stat_statfs3_osf1=no,
3596   fu_cv_sys_stat_statfs3_osf1=no)])
3597   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
3598   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
3599     space=yes
3600     AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
3601   fi
3604 if test $space = no; then
3605 # AIX
3606   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
3607 member (AIX, 4.3BSD)])
3608   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
3609   [AC_TRY_RUN([
3610 #ifdef HAVE_SYS_PARAM_H
3611 #include <sys/param.h>
3612 #endif
3613 #ifdef HAVE_SYS_MOUNT_H
3614 #include <sys/mount.h>
3615 #endif
3616 #ifdef HAVE_SYS_VFS_H
3617 #include <sys/vfs.h>
3618 #endif
3619   main ()
3620   {
3621   struct statfs fsd;
3622   fsd.f_bsize = 0;
3623   exit (statfs (".", &fsd));
3624   }],
3625   fu_cv_sys_stat_statfs2_bsize=yes,
3626   fu_cv_sys_stat_statfs2_bsize=no,
3627   fu_cv_sys_stat_statfs2_bsize=no)])
3628   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
3629   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
3630     space=yes
3631     AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
3632   fi
3635 if test $space = no; then
3636 # SVR3
3637   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
3638   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
3639   [AC_TRY_RUN([#include <sys/types.h>
3640 #include <sys/statfs.h>
3641   main ()
3642   {
3643   struct statfs fsd;
3644   exit (statfs (".", &fsd, sizeof fsd, 0));
3645   }],
3646     fu_cv_sys_stat_statfs4=yes,
3647     fu_cv_sys_stat_statfs4=no,
3648     fu_cv_sys_stat_statfs4=no)])
3649   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
3650   if test $fu_cv_sys_stat_statfs4 = yes; then
3651     space=yes
3652     AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
3653   fi
3656 if test $space = no; then
3657 # 4.4BSD and NetBSD
3658   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
3659 member (4.4BSD and NetBSD)])
3660   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
3661   [AC_TRY_RUN([#include <sys/types.h>
3662 #ifdef HAVE_SYS_PARAM_H
3663 #include <sys/param.h>
3664 #endif
3665 #ifdef HAVE_SYS_MOUNT_H
3666 #include <sys/mount.h>
3667 #endif
3668   main ()
3669   {
3670   struct statfs fsd;
3671   fsd.f_fsize = 0;
3672   exit (statfs (".", &fsd));
3673   }],
3674   fu_cv_sys_stat_statfs2_fsize=yes,
3675   fu_cv_sys_stat_statfs2_fsize=no,
3676   fu_cv_sys_stat_statfs2_fsize=no)])
3677   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
3678   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
3679     space=yes
3680         AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
3681   fi
3684 if test $space = no; then
3685   # Ultrix
3686   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
3687   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
3688   [AC_TRY_RUN([#include <sys/types.h>
3689 #ifdef HAVE_SYS_PARAM_H
3690 #include <sys/param.h>
3691 #endif
3692 #ifdef HAVE_SYS_MOUNT_H
3693 #include <sys/mount.h>
3694 #endif
3695 #ifdef HAVE_SYS_FS_TYPES_H
3696 #include <sys/fs_types.h>
3697 #endif
3698   main ()
3699   {
3700   struct fs_data fsd;
3701   /* Ultrix's statfs returns 1 for success,
3702      0 for not mounted, -1 for failure.  */
3703   exit (statfs (".", &fsd) != 1);
3704   }],
3705   fu_cv_sys_stat_fs_data=yes,
3706   fu_cv_sys_stat_fs_data=no,
3707   fu_cv_sys_stat_fs_data=no)])
3708   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
3709   if test $fu_cv_sys_stat_fs_data = yes; then
3710     space=yes
3711     AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
3712   fi
3716 # As a gating factor for large file support, in order to
3717 # use <4GB files we must have the following minimal support
3718 # available.
3719 # long long, and a 64 bit off_t or off64_t.
3720 # If we don't have all of these then disable large
3721 # file support.
3723 AC_MSG_CHECKING([if large file support can be enabled])
3724 AC_TRY_COMPILE([
3725 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
3726 #include <sys/types.h>
3727 #else
3728 __COMPILE_ERROR_
3729 #endif
3731 [int i],
3732 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
3733 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
3734         AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT,1,[Whether large file support can be enabled])
3736 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
3738 AC_ARG_WITH(spinlocks, 
3739 [  --with-spinlocks        Use spin locks instead of fcntl locks (default=no) ])
3740 if test "x$with_spinlocks" = "xyes"; then
3741     AC_DEFINE(USE_SPINLOCKS,1,[Whether to use spin locks instead of fcntl locks])
3743     case "$host_cpu" in
3744         sparc)
3745             AC_DEFINE(SPARC_SPINLOCKS,1,[Whether to use sparc spinlocks])
3746             ;;
3748         i386|i486|i586|i686)
3749             AC_DEFINE(INTEL_SPINLOCKS,1,[Whether to use intel spinlocks])
3750             ;;
3752         mips)
3753             AC_DEFINE(MIPS_SPINLOCKS,1,[Whether to use mips spinlocks])
3754             ;;
3756         powerpc)
3757             AC_DEFINE(POWERPC_SPINLOCKS,1,[Whether to use powerpc spinlocks])
3758             ;;
3759     esac
3762 #################################################
3763 # check for ACL support
3765 AC_MSG_CHECKING(whether to support ACLs)
3766 AC_ARG_WITH(acl-support,
3767 [  --with-acl-support      Include ACL support (default=no)],
3768 [ case "$withval" in
3769   yes)
3771         case "$host_os" in
3772         *sysv5*)
3773                 AC_MSG_RESULT(Using UnixWare ACLs)
3774                 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
3775                 ;;
3776         *solaris*)
3777                 AC_MSG_RESULT(Using solaris ACLs)
3778                 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
3779                 ;;
3780         *hpux*)
3781                 AC_MSG_RESULT(Using HPUX ACLs)
3782                 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
3783                 ;;
3784         *irix*)
3785                 AC_MSG_RESULT(Using IRIX ACLs)
3786                 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
3787                 ;;
3788         *aix*)
3789                 AC_MSG_RESULT(Using AIX ACLs)
3790                 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
3791                 ;;
3792         *osf*)
3793                 AC_MSG_RESULT(Using Tru64 ACLs)
3794                 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
3795                 ACL_LIBS="$ACL_LIBS -lpacl"
3796                 ;;
3797         *freebsd5*)
3798                 AC_MSG_RESULT(Using FreeBSD posix ACLs)
3799                 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether FreeBSD POSIX ACLs are available])
3800                 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
3801                 ;;
3802         *linux*)
3803                 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
3804                 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
3805                 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
3806                 acl_LIBS=$LIBS
3807                 LIBS="$LIBS -lacl"
3808                 AC_TRY_LINK([#include <sys/types.h>
3809 #include <sys/acl.h>],
3810 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
3811 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)
3812                 LIBS=$acl_LIBS])
3813                         if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
3814                                 AC_MSG_RESULT(Using posix ACLs)
3815                                 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
3816                                 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
3817                                 acl_LIBS=$LIBS
3818                                 LIBS="$LIBS -lacl"
3819                                 AC_TRY_LINK([#include <sys/types.h>
3820 #include <sys/acl.h>],
3821 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
3822 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)
3823                                 LIBS=$acl_LIBS])
3824                                 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
3825                                         AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
3826                                 fi
3827                         fi
3828             ;;
3829          *)
3830                 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
3831                 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
3832                 acl_LIBS=$LIBS
3833                 LIBS="$LIBS -lacl"
3834                 AC_TRY_LINK([#include <sys/types.h>
3835 #include <sys/acl.h>],
3836 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
3837 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)
3838                 LIBS=$acl_LIBS])
3839                         if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
3840                                 AC_MSG_RESULT(Using posix ACLs)
3841                                 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
3842                                 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
3843                                 acl_LIBS=$LIBS
3844                                 LIBS="$LIBS -lacl"
3845                                 AC_TRY_LINK([#include <sys/types.h>
3846 #include <sys/acl.h>],
3847 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
3848 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)
3849                                 LIBS=$acl_LIBS])
3850                                 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
3851                                         AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
3852                                 fi
3853                         fi
3854             ;;
3855         esac
3856         ;;
3857   *)
3858     AC_MSG_RESULT(no)
3859     AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
3860     ;;
3861   esac ],
3862   AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
3863   AC_MSG_RESULT(no)
3866 #################################################
3867 # check for sendfile support
3869 with_sendfile_support=yes
3870 AC_MSG_CHECKING(whether to check to support sendfile)
3871 AC_ARG_WITH(sendfile-support,
3872 [  --with-sendfile-support Check for sendfile support (default=yes)],
3873 [ case "$withval" in
3874   yes)
3876         AC_MSG_RESULT(yes);
3878         case "$host_os" in
3879         *linux*)
3880                 AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
3881                 AC_TRY_LINK([#include <sys/sendfile.h>],
3883 int tofd, fromfd;
3884 off64_t offset;
3885 size_t total;
3886 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
3888 samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
3890                 AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[
3891                 AC_TRY_LINK([#include <sys/sendfile.h>],
3893 int tofd, fromfd;
3894 off_t offset;
3895 size_t total;
3896 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
3898 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
3900 # Try and cope with broken Linux sendfile....
3901                 AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
3902                 AC_TRY_LINK([\
3903 #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
3904 #undef _FILE_OFFSET_BITS
3905 #endif
3906 #include <sys/sendfile.h>],
3908 int tofd, fromfd;
3909 off_t offset;
3910 size_t total;
3911 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
3913 samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
3915         if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
3916                 AC_DEFINE(HAVE_SENDFILE64,1,[Whether 64-bit sendfile() is available])
3917                 AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
3918                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
3919         elif test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
3920                 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
3921                 AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
3922                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
3923         elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
3924                 AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken])
3925                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used])
3926         else
3927                 AC_MSG_RESULT(no);
3928         fi
3930         ;;
3931         *freebsd*)
3932                 AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
3933                 AC_TRY_LINK([\
3934 #include <sys/types.h>
3935 #include <unistd.h>
3936 #include <sys/socket.h>
3937 #include <sys/uio.h>],
3939         int fromfd, tofd, ret, total=0;
3940         off_t offset, nwritten;
3941         struct sf_hdtr hdr;
3942         struct iovec hdtrl;
3943         hdr.headers = &hdtrl;
3944         hdr.hdr_cnt = 1;
3945         hdr.trailers = NULL;
3946         hdr.trl_cnt = 0;
3947         hdtrl.iov_base = NULL;
3948         hdtrl.iov_len = 0;
3949         ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
3951 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
3953         if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
3954                 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available])
3955                 AC_DEFINE(FREEBSD_SENDFILE_API,1,[Whether the FreeBSD sendfile() API is available])
3956                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
3957         else
3958                 AC_MSG_RESULT(no);
3959         fi
3960         ;;
3962         *hpux*)
3963                 AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
3964                 AC_TRY_LINK([\
3965 #include <sys/socket.h>
3966 #include <sys/uio.h>],
3968         int fromfd, tofd;
3969         size_t total=0;
3970         struct iovec hdtrl[2];
3971         ssize_t nwritten;
3972         off64_t offset;
3974         hdtrl[0].iov_base = 0;
3975         hdtrl[0].iov_len = 0;
3977         nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
3979 samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
3980         if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
3981                 AC_DEFINE(HAVE_SENDFILE64,1,[Whether sendfile64() is available])
3982                 AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
3983                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
3984         else
3985                 AC_MSG_RESULT(no);
3986         fi
3988                 AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[
3989                 AC_TRY_LINK([\
3990 #include <sys/socket.h>
3991 #include <sys/uio.h>],
3993         int fromfd, tofd;
3994         size_t total=0;
3995         struct iovec hdtrl[2];
3996         ssize_t nwritten;
3997         off_t offset;
3999         hdtrl[0].iov_base = 0;
4000         hdtrl[0].iov_len = 0;
4002         nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
4004 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
4005         if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
4006                 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
4007                 AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
4008                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
4009         else
4010                 AC_MSG_RESULT(no);
4011         fi
4012         ;;
4014         *solaris*)
4015                 AC_CHECK_LIB(sendfile,sendfilev)
4016                 AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[
4017                 AC_TRY_LINK([\
4018 #include <sys/sendfile.h>],
4020         int sfvcnt;
4021         size_t xferred;
4022         struct sendfilevec vec[2];
4023         ssize_t nwritten;
4024         int tofd;
4026         sfvcnt = 2;
4028         vec[0].sfv_fd = SFV_FD_SELF;
4029         vec[0].sfv_flag = 0;
4030         vec[0].sfv_off = 0;
4031         vec[0].sfv_len = 0;
4033         vec[1].sfv_fd = 0;
4034         vec[1].sfv_flag = 0;
4035         vec[1].sfv_off = 0;
4036         vec[1].sfv_len = 0;
4037         nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
4039 samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
4041         if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then
4042                 AC_DEFINE(HAVE_SENDFILEV64,1,[Whether sendfilev64() is available])
4043                 AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the soloris sendfile() API is available])
4044                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
4045         else
4046                 AC_MSG_RESULT(no);
4047         fi
4049                 AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[
4050                 AC_TRY_LINK([\
4051 #include <sys/sendfile.h>],
4053         int sfvcnt;
4054         size_t xferred;
4055         struct sendfilevec vec[2];
4056         ssize_t nwritten;
4057         int tofd;
4059         sfvcnt = 2;
4061         vec[0].sfv_fd = SFV_FD_SELF;
4062         vec[0].sfv_flag = 0;
4063         vec[0].sfv_off = 0;
4064         vec[0].sfv_len = 0;
4066         vec[1].sfv_fd = 0;
4067         vec[1].sfv_flag = 0;
4068         vec[1].sfv_off = 0;
4069         vec[1].sfv_len = 0;
4070         nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
4072 samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
4074         if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then
4075                 AC_DEFINE(HAVE_SENDFILEV,1,[Whether sendfilev() is available])
4076                 AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the solaris sendfile() API is available])
4077                 AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support])
4078         else
4079                 AC_MSG_RESULT(no);
4080         fi
4081         ;;
4083         *)
4084         ;;
4085         esac
4086         ;;
4087   *)
4088     AC_MSG_RESULT(no)
4089     ;;
4090   esac ],
4091   AC_MSG_RESULT(yes)
4095 #################################################
4096 # Check whether winbind is supported on this platform.  If so we need to
4097 # build and install client programs, sbin programs and shared libraries
4099 AC_MSG_CHECKING(whether to build winbind)
4101 # Initially, the value of $host_os decides whether winbind is supported
4103 HAVE_WINBIND=yes
4105 # Define the winbind shared library name and any specific linker flags
4106 # it needs to be built with.
4108 WINBIND_NSS="nsswitch/libnss_winbind.$SHLIBEXT"
4109 WINBIND_WINS_NSS="nsswitch/libnss_wins.$SHLIBEXT"
4110 WINBIND_NSS_LDSHFLAGS=$LDSHFLAGS
4112 case "$host_os" in
4113         *linux*)
4114                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_linux.o"
4115                 ;;
4116         *freebsd5*)
4117                 # FreeBSD winbind client is implemented as a wrapper around
4118                 # the Linux version.
4119                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_freebsd.o \
4120                     nsswitch/winbind_nss_linux.o"
4121                 ;;
4122         *irix*)
4123                 # IRIX has differently named shared libraries
4124                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_irix.o"
4125                 WINBIND_NSS="nsswitch/libns_winbind.$SHLIBEXT"
4126                 WINBIND_WINS_NSS="nsswitch/libns_wins.$SHLIBEXT"
4127                 ;;
4128         *solaris*)
4129                 # Solaris winbind client is implemented as a wrapper around
4130                 # the Linux version.
4131                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o \
4132                     nsswitch/winbind_nss_linux.o"
4133                 WINBIND_NSS_EXTRA_LIBS="-lsocket"
4134                 ;;
4135         *hpux11*)
4136                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
4137                 ;;
4138         *aix*)
4139                 # AIX has even differently named shared libraries.  No
4140                 # WINS support has been implemented yet.
4141                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_aix.o"
4142                 WINBIND_NSS_LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-ewb_aix_init"
4143                 WINBIND_NSS="nsswitch/WINBIND"
4144                 WINBIND_WINS_NSS=""
4145                 ;;
4146         *)
4147                 HAVE_WINBIND=no
4148                 winbind_no_reason=", unsupported on $host_os"
4149                 ;;
4150 esac
4152 AC_SUBST(WINBIND_NSS)
4153 AC_SUBST(WINBIND_WINS_NSS)
4154 AC_SUBST(WINBIND_NSS_LDSHFLAGS)
4155 AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
4156 AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
4158 # Check the setting of --with-winbindd
4160 AC_ARG_WITH(winbind,
4161 [  --with-winbind          Build winbind (default, if supported by OS)],
4163   case "$withval" in
4164         yes)
4165                 HAVE_WINBIND=yes
4166                 ;;
4167         no)
4168                 HAVE_WINBIND=no
4169                 winbind_reason=""
4170                 ;;
4171   esac ],
4174 # We need unix domain sockets for winbind
4176 if test x"$HAVE_WINBIND" = x"yes"; then
4177         if test x"$samba_cv_unixsocket" = x"no"; then
4178                 winbind_no_reason=", no unix domain socket support on $host_os"
4179                 HAVE_WINBIND=no
4180         fi
4183 # Display test results
4185 if test x"$HAVE_WINBIND" = x"yes"; then
4186         AC_MSG_RESULT(yes)
4187         AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
4189         EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
4190         EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/winbindd\$(EXEEXT)"
4191         if test x"$BLDSHARED" = x"true"; then
4192                 SHLIB_PROGS="$SHLIB_PROGS $WINBIND_NSS $WINBIND_WINS_NSS"
4194                 if test x"$with_pam" = x"yes"; then
4195                         SHLIB_PROGS="$SHLIB_PROGS nsswitch/pam_winbind.$SHLIBEXT"
4196                 fi
4197         fi
4198 else
4199         AC_MSG_RESULT(no$winbind_no_reason)
4202 # Solaris has some extra fields in struct passwd that need to be
4203 # initialised otherwise nscd crashes.  
4205 AC_CHECK_MEMBER(struct passwd.pw_comment,
4206                 AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),,
4207                 [#include <pwd.h>])
4209 AC_CHECK_MEMBER(struct passwd.pw_age,
4210                 AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),,
4211                 [#include <pwd.h>])
4213 #################################################
4214 # Check to see if we should use the included popt 
4216 AC_ARG_WITH(included-popt,
4217 [  --with-included-popt    use bundled popt library, not from system],
4219   case "$withval" in
4220         yes)
4221                 INCLUDED_POPT=yes
4222                 ;;
4223         no)
4224                 INCLUDED_POPT=no
4225                 ;;
4226   esac ],
4228 if test x"$INCLUDED_POPT" != x"yes"; then
4229     AC_CHECK_LIB(popt, poptGetContext,
4230                  INCLUDED_POPT=no, INCLUDED_POPT=yes)
4233 AC_MSG_CHECKING(whether to use included popt)
4234 if test x"$INCLUDED_POPT" = x"yes"; then
4235     AC_MSG_RESULT(yes)
4236     BUILD_POPT='$(POPT_OBJS)'
4237         POPTLIBS='$(POPT_OBJS)'
4238     FLAGS1="-I$srcdir/popt"
4239 else
4240     AC_MSG_RESULT(no)
4241         BUILD_POPT=""
4242     POPTLIBS="-lpopt"
4244 AC_SUBST(BUILD_POPT)
4245 AC_SUBST(POPTLIBS)
4246 AC_SUBST(FLAGS1)
4248 #################################################
4249 # Check if the user wants Python
4251 # At the moment, you can use this to set which Python binary to link
4252 # against.  (Libraries built for Python2.2 can't be used by 2.1,
4253 # though they can coexist in different directories.)  In the future
4254 # this might make the Python stuff be built by default.
4256 # Defaulting python breaks the clean target if python isn't installed
4258 PYTHON=
4260 AC_ARG_WITH(python,
4261 [  --with-python=PYTHONNAME  build Python libraries],
4262 [ case "${withval-python}" in
4263   yes)
4264         PYTHON=python
4265         EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS python_ext"
4266         ;;
4267   no)
4268         PYTHON=
4269         ;;
4270   *)
4271         PYTHON=${withval-python}
4272         ;;
4273   esac ])
4274 AC_SUBST(PYTHON)
4276 for i in `echo $default_static_modules | sed -e's/,/ /g'`
4278         eval MODULE_DEFAULT_$i=STATIC
4279 done
4281 for i in `echo $default_shared_modules | sed -e's/,/ /g'`
4283         dnl Fall back to static if dlopen() is not available
4284         eval MODULE_DEFAULT_$i=STATIC
4286         if test x"$ac_cv_func_dlopen" = xyes; then
4287                 eval MODULE_DEFAULT_$i=SHARED
4288         fi
4289 done
4291 dnl Always built these modules static
4292 MODULE_pdb_guest=STATIC
4293 MODULE_rpc_spoolss=STATIC
4294 MODULE_rpc_srv=STATIC
4295 MODULE_idmap_tdb=STATIC
4297 AC_ARG_WITH(static-modules,
4298 [  --with-static-modules=MODULES  Comma-seperated list of names of modules to statically link in],
4299 [ if test $withval; then
4300         for i in `echo $withval | sed -e's/,/ /g'`
4301         do
4302                 eval MODULE_$i=STATIC
4303         done
4304 fi ])
4306 AC_ARG_WITH(shared-modules,
4307 [  --with-shared-modules=MODULES  Comma-seperated list of names of modules to build shared],
4308 [ if test $withval; then
4309         for i in `echo $withval | sed -e's/,/ /g'`
4310         do
4311                         eval MODULE_$i=SHARED
4312         done
4313 fi ])
4315 ###########################################################################
4316 ## contributed pdb_modules
4318 SMB_MODULE(pdb_xml, passdb/pdb_xml.o, "bin/xml.$SHLIBEXT", PDB,
4319                   [ PASSDB_LIBS="$PASSDB_LIBS $XML_LIBS" ] )
4320 SMB_MODULE(pdb_mysql, passdb/pdb_mysql.o, "bin/mysql.$SHLIBEXT", PDB, 
4321                    [ PASSDB_LIBS="$PASSDB_LIBS $MYSQL_LIBS" ]   )
4322 SMB_MODULE(pdb_pgsql, passdb/pdb_pgsql.o, "bin/pgsql.$SHLIBEXT", PDB, 
4323                    [ PASSDB_LIBS="$PASSDB_LIBS $PGSQL_LIBS" ]   )
4325 ## end of contributed pdb_modules
4326 ###########################################################################
4328 SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o, "bin/ldapsam.$SHLIBEXT", PDB, 
4329                    [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
4330 SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
4331 SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
4332 SMB_MODULE(pdb_guest, passdb/pdb_guest.o, "bin/guest.$SHLIBEXT", PDB)
4333 SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
4335 SMB_MODULE(rpc_lsa, \$(RPC_LSA_OBJ), "bin/librpc_lsarpc.$SHLIBEXT", RPC)
4336 SMB_MODULE(rpc_reg, \$(RPC_REG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC)
4337 SMB_MODULE(rpc_lsa_ds, \$(RPC_LSA_DS_OBJ), "bin/librpc_lsa_ds.$SHLIBEXT", RPC)
4338 SMB_MODULE(rpc_wks, \$(RPC_WKS_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC)
4339 SMB_MODULE(rpc_net, \$(RPC_NETLOG_OBJ), "bin/librpc_NETLOGON.$SHLIBEXT", RPC)
4340 SMB_MODULE(rpc_dfs, \$(RPC_DFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC)
4341 SMB_MODULE(rpc_srv, \$(RPC_SVC_OBJ), "bin/librpc_srvsvc.$SHLIBEXT", RPC)
4342 SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC)
4343 SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
4344 SMB_MODULE(rpc_echo, \$(RPC_ECHO_OBJ), "bin/librpc_echo.$SHLIBEXT", RPC)
4345 SMB_SUBSYSTEM(RPC,smbd/server.o)
4347 SMB_MODULE(idmap_ldap, sam/idmap_ldap.o, "bin/idmap_ldap.$SHLIBEXT", IDMAP)
4348 SMB_MODULE(idmap_tdb, sam/idmap_tdb.o, "bin/idmap_tdb.$SHLIBEXT", IDMAP)
4349 SMB_SUBSYSTEM(IDMAP,sam/idmap.o)
4351 SMB_MODULE(charset_weird, modules/weird.o, "bin/weird.$SHLIBEXT", CHARSET)
4352 SMB_MODULE(charset_CP850, modules/CP850.o, "bin/CP850.$SHLIBEXT", CHARSET)
4353 SMB_MODULE(charset_CP437, modules/CP437.o, "bin/CP437.$SHLIBEXT", CHARSET)
4354 SMB_MODULE(charset_macosxfs, modules/charset_macosxfs.o,"bin/macosxfs.$SHLIBEXT", CHARSET)
4355 SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
4357 SMB_MODULE(auth_rhosts, \$(AUTH_RHOSTS_OBJ), "bin/rhosts.$SHLIBEXT", AUTH)
4358 SMB_MODULE(auth_sam, \$(AUTH_SAM_OBJ), "bin/sam.$SHLIBEXT", AUTH)
4359 SMB_MODULE(auth_unix, \$(AUTH_UNIX_OBJ), "bin/unix.$SHLIBEXT", AUTH)
4360 SMB_MODULE(auth_winbind, \$(AUTH_WINBIND_OBJ), "bin/winbind.$SHLIBEXT", AUTH)
4361 SMB_MODULE(auth_server, \$(AUTH_SERVER_OBJ), "bin/smbserver.$SHLIBEXT", AUTH)
4362 SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
4363 SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
4364 SMB_SUBSYSTEM(AUTH,auth/auth.o)
4366 SMB_MODULE(vfs_recycle, \$(VFS_RECYCLE_OBJ), "bin/recycle.$SHLIBEXT", VFS)
4367 SMB_MODULE(vfs_audit, \$(VFS_AUDIT_OBJ), "bin/audit.$SHLIBEXT", VFS)
4368 SMB_MODULE(vfs_extd_audit, \$(VFS_EXTD_AUDIT_OBJ), "bin/extd_audit.$SHLIBEXT", VFS)
4369 SMB_MODULE(vfs_netatalk, \$(VFS_NETATALK_OBJ), "bin/netatalk.$SHLIBEXT", VFS)
4370 SMB_MODULE(vfs_fake_perms, \$(VFS_FAKE_PERMS_OBJ), "bin/fake_perms.$SHLIBEXT", VFS)
4371 SMB_MODULE(vfs_default_quota, \$(VFS_DEFAULT_QUOTA_OBJ), "bin/default_quota.$SHLIBEXT", VFS)
4372 SMB_MODULE(vfs_readonly, \$(VFS_READONLY_OBJ), "bin/readonly.$SHLIBEXT", VFS)
4373 SMB_MODULE(vfs_cap, \$(VFS_CAP_OBJ), "bin/cap.$SHLIBEXT", VFS)
4374 SMB_MODULE(vfs_expand_msdfs, \$(VFS_EXPAND_MSDFS_OBJ), "bin/expand_msdfs.$SHLIBEXT", VFS)
4375 SMB_SUBSYSTEM(VFS,smbd/vfs.o)
4377 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
4379 #################################################
4380 # do extra things if we are running insure
4382 if test "${ac_cv_prog_CC}" = "insure"; then
4383         CPPFLAGS="$CPPFLAGS -D__INSURE__"
4386 #################################################
4387 # Display summary of libraries detected
4389 AC_MSG_RESULT([Using libraries:])
4390 AC_MSG_RESULT([    LIBS = $LIBS])
4391 if test x"$with_ads_support" != x"no"; then
4392    AC_MSG_RESULT([    KRB5_LIBS = $KRB5_LIBS])
4394 if test x"$with_ldap_support" != x"no"; then
4395    AC_MSG_RESULT([    LDAP_LIBS = $LDAP_LIBS])
4397 AC_MSG_RESULT([    AUTH_LIBS = $AUTH_LIBS])
4399 #################################################
4400 # final configure stuff
4402 AC_MSG_CHECKING([configure summary])
4403 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
4404            AC_MSG_RESULT(yes),
4405            AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
4406            AC_MSG_WARN([cannot run when cross-compiling]))
4408 builddir=`pwd`
4409 AC_SUBST(builddir)
4411 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
4412 LIB_REMOVE_USR_LIB(LDFLAGS)
4413 LIB_REMOVE_USR_LIB(LIBS)
4415 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
4416 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
4417 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
4419 AC_OUTPUT(include/stamp-h Makefile script/findsmb smbadduser script/gen-8bit-gap.sh)
4421 #################################################
4422 # Print very concise instructions on building/use
4423 if test "x$enable_dmalloc" = xyes
4424 then
4425         AC_MSG_RESULT([Note: The dmalloc debug library will be included.  To turn it on use])
4426         AC_MSG_RESULT([      \$ eval \`dmalloc samba\`.])