1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(include/includes.h)
3 AC_CONFIG_HEADER(include/config.h)
5 #################################################
6 # Directory handling stuff to support both the
7 # legacy SAMBA directories and FHS compliant
9 AC_PREFIX_DEFAULT(/usr/local/samba)
12 [ --with-fhs Use FHS-compliant paths (default=no)],
13 codepagedir="\$(DATADIR)/samba/codepages"
14 configdir="${sysconfdir}/samba"
15 lockdir="\${VARDIR}/cache/samba"
16 piddir="\$(VARDIR)/run/samba"
17 logfilebase="\${VARDIR}/log/samba"
18 privatedir="\${CONFIGDIR}/private"
19 swatdir="\${DATADIR}/samba/swat",
20 codepagedir="\$(LIBDIR)/codepages"
21 configdir="\$(LIBDIR)"
22 logfilebase="\$(VARDIR)"
23 lockdir="\${VARDIR}/locks"
24 piddir="\$(VARDIR)/locks"
25 privatedir="\${prefix}/private"
26 swatdir="\${prefix}/swat")
28 #################################################
29 # set private directory location
30 AC_ARG_WITH(privatedir,
31 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
35 # Just in case anybody calls it without argument
37 AC_MSG_WARN([--with-privatedir called without argument - will use default])
44 #################################################
45 # set lock directory location
47 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
51 # Just in case anybody calls it without argument
53 AC_MSG_WARN([--with-lockdir called without argument - will use default])
60 #################################################
61 # set pid directory location
63 [ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks)],
67 # Just in case anybody calls it without argument
69 AC_MSG_WARN([--with-piddir called without argument - will use default])
76 #################################################
77 # set SWAT directory location
79 [ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)],
83 # Just in case anybody does it
85 AC_MSG_WARN([--with-swatdir called without argument - will use default])
92 #################################################
93 # set configuration directory location
94 AC_ARG_WITH(configdir,
95 [ --with-configdir=DIR Where to put configuration files (\$libdir)],
99 # Just in case anybody does it
101 AC_MSG_WARN([--with-configdir called without argument - will use default])
108 #################################################
109 # set codepage directory location
110 AC_ARG_WITH(codepagedir,
111 [ --with-codepagedir=DIR Where to put codepage files (\$libdir/codepages)],
115 # Just in case anybody does it
117 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
120 codepagedir="$withval"
124 #################################################
125 # set log directory location
126 AC_ARG_WITH(logfilebase,
127 [ --with-logfilebase=DIR Where to put log files (\$(VARDIR))],
131 # Just in case anybody does it
133 AC_MSG_WARN([--with-logfilebase called without argument - will use default])
136 logfilebase="$withval"
140 AC_SUBST(codepagedir)
144 AC_SUBST(logfilebase)
150 dnl Unique-to-Samba variables we'll be playing with.
167 AC_SUBST(LIBSMBCLIENT_SHARED)
168 AC_SUBST(LIBSMBCLIENT)
170 # compile with optimization and without debugging by default
171 CFLAGS="-O ${CFLAGS}"
174 [ --enable-debug Turn on compiler debugging information (default=no)],
175 [if eval "test x$enable_debug = xyes"; then
176 CFLAGS="${CFLAGS} -g"
181 dnl Checks for programs.
185 dnl Check if we use GNU ld
188 AC_PATH_PROG(passwd_program, passwd, /bin/passwd)
189 AC_SUBST(passwd_program)
191 dnl Check if C compiler understands -c and -o at the same time
193 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
200 dnl Check if the C compiler understands volatile (it should, being ANSI).
201 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
202 AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
203 samba_cv_volatile=yes,samba_cv_volatile=no)])
204 if test x"$samba_cv_volatile" = x"yes"; then
205 AC_DEFINE(HAVE_VOLATILE)
212 dnl Add #include for broken IRIX header files
214 *irix6*) AC_ADD_INCLUDE(<standards.h>)
218 AC_VALIDATE_CACHE_SYSTEM_TYPE
223 # Config CPPFLAG settings for strange OS's that must be set
224 # before other tests.
227 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
230 # mmap on HPUX is completely broken...
231 AC_DEFINE(MMAP_BLACKLIST)
232 if test $ac_cv_prog_cc_Ae = yes; then
233 CPPFLAGS="$CPPFLAGS -Ae"
236 # Defines needed for HPUX support.
237 # HPUX has bigcrypt but (sometimes?) doesn't use it for
238 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
242 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
243 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
244 AC_DEFINE(_HPUX_SOURCE)
245 AC_DEFINE(_POSIX_SOURCE)
246 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
247 AC_DEFINE(_MAX_ALIGNMENT,4)
250 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
251 AC_DEFINE(_HPUX_SOURCE)
252 AC_DEFINE(_POSIX_SOURCE)
253 AC_DEFINE(_LARGEFILE64_SOURCE)
254 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
255 AC_DEFINE(_MAX_ALIGNMENT,4)
256 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
264 # CRAY Unicos has broken const handling
266 AC_MSG_RESULT([disabling const])
267 CPPFLAGS="$CPPFLAGS -Dconst="
271 # AIX4.x doesn't even admit to having large
272 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
275 AC_MSG_RESULT([enabling large file support])
276 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
277 AC_DEFINE(_LARGE_FILES)
280 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
281 # to the existance of large files..
282 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
283 # recommendations on large file support, however it makes the
284 # compile work using gcc 2.7 and 2.8, whereas using the Sun
285 # recommendation makes the compile fail on gcc2.7. JRA.
289 5.0*|5.1*|5.2*|5.3*|5.5*)
290 AC_MSG_RESULT([no large file support])
293 AC_MSG_RESULT([enabling large file support])
294 if test "$ac_cv_prog_gcc" = yes; then
295 ${CC-cc} -v >conftest.c 2>&1
296 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
298 case "$ac_cv_gcc_compiler_version_number" in
299 *"gcc version 2.6"*|*"gcc version 2.7"*)
300 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
301 AC_DEFINE(_LARGEFILE64_SOURCE)
304 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
305 AC_DEFINE(_LARGEFILE64_SOURCE)
306 AC_DEFINE(_FILE_OFFSET_BITS,64)
310 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
311 AC_DEFINE(_LARGEFILE64_SOURCE)
312 AC_DEFINE(_FILE_OFFSET_BITS,64)
318 # Tests needed for SINIX large file support.
321 if test $host = mips-sni-sysv4 ; then
322 AC_MSG_CHECKING([for LFS support])
323 old_CPPFLAGS="$CPPFLAGS"
324 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
328 #if _LFS64_LARGEFILE == 1
333 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
334 CPPFLAGS="$old_CPPFLAGS"
335 if test x$SINIX_LFS_SUPPORT = xyes ; then
336 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
337 AC_DEFINE(_LARGEFILE64_SOURCE)
338 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
339 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
340 LIBS="`getconf LFS64_LIBS` $LIBS"
342 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
346 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
349 AC_MSG_CHECKING([for LFS support])
350 old_CPPFLAGS="$CPPFLAGS"
351 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
354 #include <sys/utsname.h>
356 #if _LFS64_LARGEFILE == 1
361 /* Ensure this is glibc 2.2 or higher */
362 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
363 int libc_major = __GLIBC__;
364 int libc_minor = __GLIBC_MINOR__;
372 /* Ensure this is kernel 2.4 or higher */
375 release = uts.release;
376 major = atoi(strsep(&release, "."));
377 minor = atoi(strsep(&release, "."));
379 if (major > 2 || (major == 2 && minor > 3))
386 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
387 CPPFLAGS="$old_CPPFLAGS"
388 if test x$LINUX_LFS_SUPPORT = xyes ; then
389 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
390 AC_DEFINE(_LARGEFILE64_SOURCE)
391 AC_DEFINE(_FILE_OFFSET_BITS,64)
392 AC_DEFINE(_GNU_SOURCE)
394 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
398 AC_MSG_CHECKING([for LFS support])
399 old_CPPFLAGS="$CPPFLAGS"
400 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
404 #if _LFS64_LARGEFILE == 1
409 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
410 CPPFLAGS="$old_CPPFLAGS"
411 if test x$GLIBC_LFS_SUPPORT = xyes ; then
412 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
413 AC_DEFINE(_LARGEFILE64_SOURCE)
414 AC_DEFINE(_GNU_SOURCE)
416 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
426 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
427 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
428 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
429 AC_CHECK_HEADERS(stdlib.h string.h strings.h syslog.h sys/file.h)
430 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
431 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h sys/socket.h)
432 AC_CHECK_HEADERS(syslog.h sys/syslog.h sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
433 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
434 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h synch.h pthread.h nsswitch.h)
437 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
438 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
442 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
443 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
444 if test x"$ac_cv_header_shadow_h" = x"yes"; then
445 AC_DEFINE(HAVE_SHADOW_H)
449 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
450 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
451 AC_CHECK_HEADERS(stropts.h poll.h)
452 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
453 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
455 # For experimental utmp support (lastlog on some BSD-like systems)
456 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
458 # For quotas on Veritas VxFS filesystems
459 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
461 # For quotas on Linux XFS filesystems
462 AC_CHECK_HEADERS(linux/xqm.h)
464 AC_CHECK_SIZEOF(int,cross)
465 AC_CHECK_SIZEOF(long,cross)
466 AC_CHECK_SIZEOF(short,cross)
481 AC_CHECK_TYPE(ino_t,unsigned)
482 AC_CHECK_TYPE(loff_t,off_t)
483 AC_CHECK_TYPE(offset_t,loff_t)
484 AC_CHECK_TYPE(ssize_t, int)
485 AC_CHECK_TYPE(wchar_t, unsigned short)
487 ############################################
488 # for cups support we need libcups, and a handful of header files
491 [ --enable-cups Turn on CUPS support (default=auto)])
493 if test x$enable_cups != xno; then
494 AC_PATH_PROG(CUPS_CONFIG, cups-config)
496 if test "x$CUPS_CONFIG" != x; then
498 CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
499 LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
500 LIBS="$LIBS `$CUPS_CONFIG --libs`"
504 ############################################
505 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the new VFS code
506 AC_CHECK_FUNCS(dlopen)
507 if test x"$ac_cv_func_dlopen" = x"no"; then
508 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
509 AC_DEFINE(HAVE_DLOPEN)])
511 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
513 ############################################
514 # check if the compiler can do immediate structures
515 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
519 typedef struct {unsigned x;} FOOBAR;
520 #define X_FOOBAR(x) ((FOOBAR) { x })
521 #define FOO_ONE X_FOOBAR(1)
529 samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
530 if test x"$samba_cv_immediate_structures" = x"yes"; then
531 AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
534 ############################################
535 # check for unix domain sockets
536 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
538 #include <sys/types.h>
541 #include <sys/socket.h>
542 #include <sys/un.h>],
544 struct sockaddr_un sunaddr;
545 sunaddr.sun_family = AF_UNIX;
547 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
548 if test x"$samba_cv_unixsocket" = x"yes"; then
549 AC_DEFINE(HAVE_UNIXSOCKET)
552 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
554 #include <sys/types.h>
559 #include <sys/socket.h>],[socklen_t i = 0],
560 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
561 if test x"$samba_cv_socklen_t" = x"yes"; then
562 AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
565 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
567 #include <sys/types.h>
572 #include <signal.h>],[sig_atomic_t i = 0],
573 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
574 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
575 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
578 # stupid headers have the functions but no declaration. grrrr.
579 AC_HAVE_DECL(errno, [#include <errno.h>])
580 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
581 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
582 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
583 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
584 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
585 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
587 # and glibc has setresuid under linux but the function does
588 # nothing until kernel 2.1.44! very dumb.
589 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
590 AC_TRY_RUN([#include <errno.h>
591 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
592 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
593 if test x"$samba_cv_have_setresuid" = x"yes"; then
594 AC_DEFINE(HAVE_SETRESUID)
597 # Do the same check for setresguid...
599 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
600 AC_TRY_RUN([#include <unistd.h>
602 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
603 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
604 if test x"$samba_cv_have_setresgid" = x"yes"; then
605 AC_DEFINE(HAVE_SETRESGID)
610 ###############################################
611 # Readline included by default unless explicitly asked not to
612 test "${with_readline+set}" != "set" && with_readline=yes
614 # test for where we get readline() from
615 AC_MSG_CHECKING(whether to use readline)
616 AC_ARG_WITH(readline,
617 [ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto)],
618 [ case "$with_readline" in
622 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
623 AC_CHECK_HEADERS(readline/history.h)
625 AC_CHECK_HEADERS(readline.h readline/readline.h,[
626 for termlib in ncurses curses termcap terminfo termlib; do
627 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
629 AC_CHECK_LIB(readline, rl_callback_handler_install,
630 [TERMLIBS="-lreadline $TERMLIBS"
631 AC_DEFINE(HAVE_LIBREADLINE)
632 break], [TERMLIBS=], $TERMLIBS)])
640 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
641 # alternate readline path
643 _cppflags=${CPPFLAGS}
645 # Add additional search path
646 LDFLAGS="-L$with_readline/lib $LDFLAGS"
647 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
649 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
650 AC_CHECK_HEADERS(readline/history.h)
652 AC_CHECK_HEADERS(readline.h readline/readline.h,[
653 for termlib in ncurses curses termcap terminfo termlib; do
654 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
656 AC_CHECK_LIB(readline, rl_callback_handler_install,
657 [TERMLDFLAGS="-L$with_readline/lib"
658 TERMCPPFLAGS="-I$with_readline/include"
659 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
660 TERMLIBS="-lreadline $TERMLIBS"
661 AC_DEFINE(HAVE_LIBREADLINE)
662 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
670 AC_SUBST(TERMLDFLAGS)
672 # The following test taken from the cvs sources
673 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
674 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
675 # libsocket.so which has a bad implementation of gethostbyname (it
676 # only looks in /etc/hosts), so we only look for -lsocket if we need
678 AC_CHECK_FUNCS(connect)
679 if test x"$ac_cv_func_connect" = x"no"; then
682 *) AC_CHECK_LIB(nsl_s, printf) ;;
686 *) AC_CHECK_LIB(nsl, printf) ;;
690 *) AC_CHECK_LIB(socket, connect) ;;
694 *) AC_CHECK_LIB(inet, connect) ;;
696 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
698 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
699 test x"$ac_cv_lib_inet_connect" = x"yes"; then
700 # ac_cv_func_connect=yes
701 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
702 AC_DEFINE(HAVE_CONNECT)
706 ###############################################
707 # test for where we get get_yp_default_domain() from
708 AC_CHECK_FUNCS(yp_get_default_domain)
709 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
710 AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
711 AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)])
714 # Check if we have execl, if not we need to compile smbrun.
715 AC_CHECK_FUNCS(execl)
716 if test x"$ac_cv_func_execl" = x"no"; then
722 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link)
723 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid mknod mknod64)
724 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
725 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
726 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)
727 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
728 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
729 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
730 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
731 AC_CHECK_FUNCS(syslog vsyslog)
733 # syscall() is needed for smbwrapper.
734 AC_CHECK_FUNCS(syscall)
736 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
737 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
738 AC_CHECK_FUNCS(__getcwd _getcwd)
739 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
740 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
741 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
742 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
743 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
744 AC_CHECK_FUNCS(_write __write _fork __fork)
745 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
746 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
747 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
748 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
749 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
752 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
755 if test x$ac_cv_func_stat64 = xno ; then
756 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
758 #if defined(HAVE_UNISTD_H)
761 #include <sys/stat.h>
762 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
763 AC_MSG_RESULT([$ac_cv_func_stat64])
764 if test x$ac_cv_func_stat64 = xyes ; then
765 AC_DEFINE(HAVE_STAT64)
769 if test x$ac_cv_func_lstat64 = xno ; then
770 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
772 #if defined(HAVE_UNISTD_H)
775 #include <sys/stat.h>
776 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
777 AC_MSG_RESULT([$ac_cv_func_lstat64])
778 if test x$ac_cv_func_lstat64 = xyes ; then
779 AC_DEFINE(HAVE_LSTAT64)
783 if test x$ac_cv_func_fstat64 = xno ; then
784 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
786 #if defined(HAVE_UNISTD_H)
789 #include <sys/stat.h>
790 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
791 AC_MSG_RESULT([$ac_cv_func_fstat64])
792 if test x$ac_cv_func_fstat64 = xyes ; then
793 AC_DEFINE(HAVE_FSTAT64)
798 # If no strcasecmp, check for it in some known places
799 # It is in -lresolv on ReliantUNIX and UnixWare
800 # -lresolve *must* follow -lnsl for name resolution to work properly
803 if test x$ac_cv_func_strcasecmp = xno ; then
804 AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
805 AC_DEFINE(HAVE_STRCASECMP))
809 # Check for the functions putprpwnam, set_auth_parameters,
810 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
811 # Needed for OSF1 and HPUX.
814 AC_LIBTESTFUNC(security, putprpwnam)
815 AC_LIBTESTFUNC(sec, putprpwnam)
817 AC_LIBTESTFUNC(security, set_auth_parameters)
818 AC_LIBTESTFUNC(sec, set_auth_parameters)
820 # UnixWare 7.x has its getspnam in -lgen
821 AC_LIBTESTFUNC(gen, getspnam)
823 AC_LIBTESTFUNC(security, getspnam)
824 AC_LIBTESTFUNC(sec, getspnam)
826 AC_LIBTESTFUNC(security, bigcrypt)
827 AC_LIBTESTFUNC(sec, bigcrypt)
829 AC_LIBTESTFUNC(security, getprpwnam)
830 AC_LIBTESTFUNC(sec, getprpwnam)
832 # this bit needs to be modified for each OS that is suported by
833 # smbwrapper. You need to specify how to created a shared library and
834 # how to compile C code to produce PIC object files
836 # these are the defaults, good for lots of systems
844 # Assume non-shared by default and override below
846 AC_MSG_CHECKING([ability to build shared libraries])
848 # and these are for particular systems
850 *linux*) AC_DEFINE(LINUX)
853 DYNEXP="-Wl,--export-dynamic"
855 SONAMEFLAG="-Wl,-soname="
856 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
858 *solaris*) AC_DEFINE(SUNOS5)
862 if test "${GCC}" = "yes"; then
864 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
869 ## ${CFLAGS} added for building 64-bit shared
870 ## libs using Sun's Compiler
871 LDSHFLAGS="-G \${CFLAGS}"
875 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
877 *sunos*) AC_DEFINE(SUNOS4)
881 PICFLAG="-KPIC" # Is this correct for SunOS
882 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
884 *freebsd*) BLDSHARED="true"
886 DYNEXP="-Wl,--export-dynamic"
887 SONAMEFLAG="-Wl,-soname,"
888 PICFLAG="-fPIC -DPIC"
889 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
891 *openbsd*) BLDSHARED="true"
893 DYNEXP="-Wl,-Bdynamic"
894 SONAMEFLAG="-Wl,-soname,"
896 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
898 *irix*) AC_DEFINE(IRIX)
900 *irix6*) AC_DEFINE(IRIX6)
903 ATTEMPT_WRAP32_BUILD=yes
905 LDSHFLAGS="-set_version sgi1.0 -shared"
906 SONAMEFLAG="-soname "
908 if test "${GCC}" = "yes"; then
913 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
915 *aix*) AC_DEFINE(AIX)
917 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
918 DYNEXP="-Wl,-brtl,-bexpall"
920 if test "${GCC}" != "yes"; then
921 ## for funky AIX compiler using strncpy()
922 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
925 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)
927 *hpux*) AC_DEFINE(HPUX)
929 # Use special PIC flags for the native HP-UX compiler.
930 if test $ac_cv_prog_cc_Ae = yes; then
933 LDSHFLAGS="-B symbolic -b -z"
938 AC_DEFINE(STAT_ST_BLOCKSIZE,8192)
940 *qnx*) AC_DEFINE(QNX)
941 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
943 *osf*) AC_DEFINE(OSF1)
946 SONAMEFLAG="-Wl,-soname,"
948 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
950 *sco*) AC_DEFINE(SCO)
951 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
953 *unixware*) AC_DEFINE(UNIXWARE)
956 SONAMEFLAG="-Wl,-soname,"
958 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
960 *next2*) AC_DEFINE(NEXT2)
961 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
963 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
964 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
968 *-univel-*) if [ test "$GCC" != yes ]; then
969 AC_DEFINE(HAVE_MEMSET)
974 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
976 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
979 if [ test "$GCC" != yes ]; then
980 AC_DEFINE(HAVE_MEMSET)
983 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
986 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
990 AC_MSG_RESULT($BLDSHARED)
991 AC_MSG_CHECKING([linker flags for shared libraries])
992 AC_MSG_RESULT([$LDSHFLAGS])
993 AC_MSG_CHECKING([compiler flags for position-independent code])
994 AC_MSG_RESULT([$PICFLAGS])
996 # try to work out how to produce pic code with this compiler
997 if test x$PICFLAG = x; then
998 AC_PROG_CC_FLAG(fpic)
999 if test $ac_cv_prog_cc_fpic = yes; then
1003 if test x$PICFLAG = x; then
1004 AC_PROG_CC_FLAG(KPIC)
1005 if test $ac_cv_prog_cc_KPIC = yes; then
1009 if test x$PICFLAG = x; then
1010 AC_PROG_CC_FLAG(Kpic)
1011 if test $ac_cv_prog_cc_Kpic = yes; then
1018 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
1019 AC_TRY_RUN([#include <stdio.h>
1020 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
1021 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
1022 if test x"$samba_cv_have_longlong" = x"yes"; then
1023 AC_DEFINE(HAVE_LONGLONG)
1027 # Check if the compiler supports the LL prefix on long long integers.
1030 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
1031 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
1032 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
1033 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
1034 AC_DEFINE(COMPILER_SUPPORTS_LL)
1038 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
1039 AC_TRY_RUN([#include <stdio.h>
1040 #include <sys/stat.h>
1041 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
1042 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
1043 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
1044 AC_DEFINE(SIZEOF_OFF_T,8)
1047 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
1049 #if defined(HAVE_UNISTD_H)
1053 #include <sys/stat.h>
1054 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1055 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
1056 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
1057 AC_DEFINE(HAVE_OFF64_T)
1060 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
1061 AC_TRY_RUN([#include <stdio.h>
1062 #include <sys/stat.h>
1063 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
1064 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
1065 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
1066 AC_DEFINE(SIZEOF_INO_T,8)
1069 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
1071 #if defined(HAVE_UNISTD_H)
1075 #include <sys/stat.h>
1076 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1077 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
1078 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
1079 AC_DEFINE(HAVE_INO64_T)
1082 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
1084 #if defined(HAVE_UNISTD_H)
1088 #include <sys/stat.h>
1089 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1090 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
1091 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
1092 AC_DEFINE(HAVE_DEV64_T)
1095 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
1097 #if defined(HAVE_UNISTD_H)
1100 #include <sys/types.h>
1101 #include <dirent.h>],
1102 [struct dirent64 de;],
1103 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
1104 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
1105 AC_DEFINE(HAVE_STRUCT_DIRENT64)
1108 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
1110 #if defined(HAVE_UNISTD_H)
1113 #include <sys/types.h>
1114 main() { dev_t dev; int i = major(dev); return 0; }],
1115 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
1116 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
1117 AC_DEFINE(HAVE_DEVICE_MAJOR_FN)
1120 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
1122 #if defined(HAVE_UNISTD_H)
1125 #include <sys/types.h>
1126 main() { dev_t dev; int i = minor(dev); return 0; }],
1127 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
1128 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
1129 AC_DEFINE(HAVE_DEVICE_MINOR_FN)
1132 AC_CACHE_CHECK([for makedev macro],samba_cv_HAVE_MAKEDEV_FN,[
1134 #if defined(HAVE_UNISTD_H)
1137 #include <sys/types.h>
1138 main() { dev_t dev = makedev(1,2); return 0; }],
1139 samba_cv_HAVE_MAKEDEV_FN=yes,samba_cv_HAVE_MAKEDEV_FN=no,samba_cv_HAVE_MAKEDEV_FN=cross)])
1140 if test x"$samba_cv_HAVE_MAKEDEV_FN" = x"yes"; then
1141 AC_DEFINE(MAKEDEV_FN)
1144 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
1145 AC_TRY_RUN([#include <stdio.h>
1146 main() { char c; c=250; exit((c > 0)?0:1); }],
1147 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
1148 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
1149 AC_DEFINE(HAVE_UNSIGNED_CHAR)
1152 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
1153 AC_TRY_COMPILE([#include <sys/types.h>
1154 #include <sys/socket.h>
1155 #include <netinet/in.h>],
1156 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
1157 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
1158 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
1159 AC_DEFINE(HAVE_SOCK_SIN_LEN)
1162 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
1163 AC_TRY_COMPILE([#include <sys/types.h>
1165 void seekdir(DIR *d, long loc) { return; }],[return 0;],
1166 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
1167 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
1168 AC_DEFINE(SEEKDIR_RETURNS_VOID)
1171 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
1172 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
1173 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
1174 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
1175 AC_DEFINE(HAVE_FILE_MACRO)
1178 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
1179 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
1180 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
1181 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
1182 AC_DEFINE(HAVE_FUNCTION_MACRO)
1185 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
1187 #include <sys/time.h>
1189 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
1190 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
1191 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
1192 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
1195 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE_VA_COPY,[
1196 AC_TRY_LINK([#include <stdarg.h>
1197 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
1198 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
1199 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
1200 AC_DEFINE(HAVE_VA_COPY)
1203 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
1205 #include <sys/types.h>
1207 void foo(const char *format, ...) {
1212 va_start(ap, format);
1213 len = vsnprintf(buf, 0, format, ap);
1215 if (len != 5) exit(1);
1217 va_start(ap, format);
1218 len = vsnprintf(0, 0, format, ap);
1220 if (len != 5) exit(1);
1222 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
1226 main() { foo("hello"); }
1228 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
1229 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
1230 AC_DEFINE(HAVE_C99_VSNPRINTF)
1233 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
1234 AC_TRY_RUN([#include <sys/types.h>
1236 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
1237 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
1238 di->d_name[0] == 0) exit(0); exit(1);} ],
1239 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
1240 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
1241 AC_DEFINE(HAVE_BROKEN_READDIR)
1244 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
1245 AC_TRY_COMPILE([#include <sys/types.h>
1246 #include <utime.h>],
1247 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
1248 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
1249 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
1250 AC_DEFINE(HAVE_UTIMBUF)
1253 dnl utmp and utmpx come in many flavours
1254 dnl We need to check for many of them
1255 dnl But we don't need to do each and every one, because our code uses
1256 dnl mostly just the utmp (not utmpx) fields.
1258 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
1260 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
1261 AC_TRY_COMPILE([#include <sys/types.h>
1263 [struct utmp ut; ut.ut_name[0] = 'a';],
1264 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
1265 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
1266 AC_DEFINE(HAVE_UT_UT_NAME)
1269 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
1270 AC_TRY_COMPILE([#include <sys/types.h>
1272 [struct utmp ut; ut.ut_user[0] = 'a';],
1273 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
1274 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
1275 AC_DEFINE(HAVE_UT_UT_USER)
1278 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
1279 AC_TRY_COMPILE([#include <sys/types.h>
1281 [struct utmp ut; ut.ut_id[0] = 'a';],
1282 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
1283 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
1284 AC_DEFINE(HAVE_UT_UT_ID)
1287 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
1288 AC_TRY_COMPILE([#include <sys/types.h>
1290 [struct utmp ut; ut.ut_host[0] = 'a';],
1291 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
1292 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
1293 AC_DEFINE(HAVE_UT_UT_HOST)
1296 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
1297 AC_TRY_COMPILE([#include <sys/types.h>
1299 [struct utmp ut; time_t t; ut.ut_time = t;],
1300 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
1301 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
1302 AC_DEFINE(HAVE_UT_UT_TIME)
1305 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
1306 AC_TRY_COMPILE([#include <sys/types.h>
1308 [struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
1309 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
1310 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1311 AC_DEFINE(HAVE_UT_UT_TV)
1314 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1315 AC_TRY_COMPILE([#include <sys/types.h>
1317 [struct utmp ut; ut.ut_type = 0;],
1318 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1319 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1320 AC_DEFINE(HAVE_UT_UT_TYPE)
1323 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1324 AC_TRY_COMPILE([#include <sys/types.h>
1326 [struct utmp ut; ut.ut_pid = 0;],
1327 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1328 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1329 AC_DEFINE(HAVE_UT_UT_PID)
1332 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1333 AC_TRY_COMPILE([#include <sys/types.h>
1335 [struct utmp ut; ut.ut_exit.e_exit = 0;],
1336 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1337 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1338 AC_DEFINE(HAVE_UT_UT_EXIT)
1341 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1342 AC_TRY_COMPILE([#include <sys/types.h>
1344 [struct utmp ut; ut.ut_addr = 0;],
1345 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1346 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1347 AC_DEFINE(HAVE_UT_UT_ADDR)
1350 if test x$ac_cv_func_pututline = xyes ; then
1351 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1352 AC_TRY_COMPILE([#include <sys/types.h>
1354 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1355 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1356 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1357 AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1361 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1362 AC_TRY_COMPILE([#include <sys/types.h>
1363 #include <utmpx.h>],
1364 [struct utmpx ux; ux.ut_syslen = 0;],
1365 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1366 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1367 AC_DEFINE(HAVE_UX_UT_SYSLEN)
1370 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1372 #include <sys/types.h>
1375 #define F_GETLEASE 1025
1378 int fd = open("/dev/null", O_RDONLY);
1379 return fcntl(fd, F_GETLEASE, 0) == -1;
1382 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1383 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1384 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1387 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1389 #include <sys/types.h>
1393 #define F_NOTIFY 1026
1396 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1399 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1400 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes" && test x"$target_cpu" != x"s390"; then
1401 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1404 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1406 #include <sys/types.h>
1409 #include <sys/file.h>
1411 #define LOCK_MAND 32
1412 #define LOCK_READ 64
1415 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1418 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1419 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1420 AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1426 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1427 AC_TRY_COMPILE([#include <sys/types.h>
1428 #include <fcntl.h>],
1429 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1430 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1431 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1432 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1435 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1436 AC_TRY_RUN([#include <sys/types.h>
1437 #include <sys/capability.h>
1440 if ((cap = cap_get_proc()) == NULL)
1442 cap->cap_effective |= CAP_NETWORK_MGT;
1443 cap->cap_inheritable |= CAP_NETWORK_MGT;
1448 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1449 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1450 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1454 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1455 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1458 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1459 AC_TRY_COMPILE([#include <sys/types.h>
1460 #if defined(HAVE_RPC_RPC_H)
1461 #include <rpc/rpc.h>
1464 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1465 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1466 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1469 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1470 AC_TRY_COMPILE([#include <sys/types.h>
1471 #if defined(HAVE_RPC_RPC_H)
1472 #include <rpc/rpc.h>
1475 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1476 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1477 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1480 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1481 AC_TRY_COMPILE([#include <sys/types.h>
1482 #if defined(HAVE_RPC_RPC_H)
1483 #include <rpc/rpc.h>
1486 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1487 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1488 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1491 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1492 AC_TRY_COMPILE([#include <sys/types.h>
1493 #if defined(HAVE_RPC_RPC_H)
1494 #include <rpc/rpc.h>
1497 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1498 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1499 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1503 dnl Some systems (SCO) have a problem including
1504 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1505 dnl as a #define in <prot.h> and as part of an enum
1509 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1510 AC_TRY_COMPILE([#include <sys/types.h>
1511 #ifdef HAVE_SYS_SECURITY_H
1512 #include <sys/security.h>
1514 #endif /* HAVE_SYS_SECURITY_H */
1515 #if defined(HAVE_RPC_RPC_H)
1516 #include <rpc/rpc.h>
1519 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1520 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1521 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1524 AC_MSG_CHECKING([for test routines])
1525 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1527 AC_MSG_ERROR([cant find test code. Aborting config]),
1528 AC_MSG_WARN([cannot run when cross-compiling]))
1530 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1531 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1532 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1533 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1534 AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1537 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1538 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1539 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1540 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1541 AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1544 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1545 SAVE_CPPFLAGS="$CPPFLAGS"
1546 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper"
1548 #define REPLACE_GETPASS 1
1549 #define NO_CONFIG_H 1
1550 #define main dont_declare_main
1551 #include "${srcdir-.}/lib/getsmbpass.c"
1553 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1554 CPPFLAGS="$SAVE_CPPFLAGS"
1556 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1557 AC_DEFINE(REPLACE_GETPASS)
1560 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1563 #include <sys/types.h>
1564 #include <netinet/in.h>
1565 #ifdef HAVE_ARPA_INET_H
1566 #include <arpa/inet.h>
1568 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1569 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1570 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1572 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1573 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1574 AC_DEFINE(REPLACE_INET_NTOA)
1577 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1578 AC_TRY_RUN([#include <stdlib.h>
1579 #include <sys/types.h>
1580 #include <sys/stat.h>
1584 char tpl[20]="/tmp/test.XXXXXX";
1585 int fd = mkstemp(tpl);
1586 if (fd == -1) exit(1);
1588 if (fstat(fd, &st) != 0) exit(1);
1589 if ((st.st_mode & 0777) != 0600) exit(1);
1592 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1593 samba_cv_HAVE_SECURE_MKSTEMP=no,
1594 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1595 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1596 AC_DEFINE(HAVE_SECURE_MKSTEMP)
1599 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1600 AC_TRY_RUN([#include <unistd.h>
1601 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1602 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1603 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1604 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1607 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1608 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1609 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1610 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1611 AC_DEFINE(HAVE_ROOT)
1613 AC_MSG_WARN(running as non-root will disable some tests)
1617 # look for a method of finding the list of network interfaces
1619 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1621 #define HAVE_IFACE_AIX 1
1622 #define AUTOCONF_TEST 1
1623 #include "confdefs.h"
1624 #include "${srcdir-.}/lib/interfaces.c"],
1625 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1626 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1627 iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1630 if test $iface = no; then
1631 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1633 #define HAVE_IFACE_IFCONF 1
1634 #define AUTOCONF_TEST 1
1635 #include "confdefs.h"
1636 #include "${srcdir-.}/lib/interfaces.c"],
1637 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1638 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1639 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1643 if test $iface = no; then
1644 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1646 #define HAVE_IFACE_IFREQ 1
1647 #define AUTOCONF_TEST 1
1648 #include "confdefs.h"
1649 #include "${srcdir-.}/lib/interfaces.c"],
1650 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1651 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1652 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1657 ################################################
1658 # look for a method of setting the effective uid
1660 if test $seteuid = no; then
1661 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1663 #define AUTOCONF_TEST 1
1664 #define USE_SETRESUID 1
1665 #include "confdefs.h"
1666 #include "${srcdir-.}/lib/util_sec.c"],
1667 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1668 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1669 seteuid=yes;AC_DEFINE(USE_SETRESUID)
1674 if test $seteuid = no; then
1675 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1677 #define AUTOCONF_TEST 1
1678 #define USE_SETREUID 1
1679 #include "confdefs.h"
1680 #include "${srcdir-.}/lib/util_sec.c"],
1681 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1682 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1683 seteuid=yes;AC_DEFINE(USE_SETREUID)
1687 if test $seteuid = no; then
1688 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1690 #define AUTOCONF_TEST 1
1691 #define USE_SETEUID 1
1692 #include "confdefs.h"
1693 #include "${srcdir-.}/lib/util_sec.c"],
1694 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1695 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1696 seteuid=yes;AC_DEFINE(USE_SETEUID)
1700 if test $seteuid = no; then
1701 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1703 #define AUTOCONF_TEST 1
1704 #define USE_SETUIDX 1
1705 #include "confdefs.h"
1706 #include "${srcdir-.}/lib/util_sec.c"],
1707 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1708 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1709 seteuid=yes;AC_DEFINE(USE_SETUIDX)
1714 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1715 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1716 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1717 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1718 AC_DEFINE(HAVE_MMAP)
1721 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1722 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1723 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1724 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1725 AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1728 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1729 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1730 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1731 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1732 AC_DEFINE(HAVE_FCNTL_LOCK)
1735 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1736 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1737 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1738 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1739 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1744 dnl Don't check for 64 bit fcntl locking if we know that the
1745 dnl glibc2.1 broken check has succeeded.
1748 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1750 #if defined(HAVE_UNISTD_H)
1760 #ifdef HAVE_SYS_FCNTL_H
1761 #include <sys/fcntl.h>
1763 main() { struct flock64 fl64;
1764 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1770 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1772 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1773 AC_DEFINE(HAVE_STRUCT_FLOCK64)
1777 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
1778 AC_TRY_COMPILE([#include <sys/types.h>
1779 #include <sys/stat.h>
1780 #include <unistd.h>],
1781 [struct stat st; st.st_blocks = 0;],
1782 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
1783 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
1784 AC_DEFINE(HAVE_STAT_ST_BLOCKS)
1787 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
1788 AC_TRY_COMPILE([#include <sys/types.h>
1789 #include <sys/stat.h>
1790 #include <unistd.h>],
1791 [struct stat st; st.st_blksize = 0;],
1792 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
1793 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
1794 AC_DEFINE(HAVE_STAT_ST_BLKSIZE)
1799 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1801 #ifdef HAVE_SYS_VFS_H
1802 #include <sys/vfs.h>
1804 #ifdef HAVE_SYS_CAPABILITY_H
1805 #include <sys/capability.h>
1808 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1809 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1810 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS)
1815 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1816 AC_TRY_COMPILE([#include <sys/acl.h>
1817 #if defined(HAVE_RPCSVC_NIS_H)
1818 #include <rpcsvc/nis.h>
1821 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1822 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1823 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1827 #################################################
1828 # check for smbwrapper support
1829 AC_MSG_CHECKING(whether to use smbwrapper)
1830 AC_ARG_WITH(smbwrapper,
1831 [ --with-smbwrapper Include SMB wrapper support (default=no)],
1832 [ case "$withval" in
1835 AC_DEFINE(WITH_SMBWRAPPER)
1836 WRAPPROG="bin/smbsh"
1837 WRAP="bin/smbwrapper.$SHLIBEXT"
1839 if test x$ATTEMPT_WRAP32_BUILD = x; then
1842 WRAP32=bin/smbwrapper.32.$SHLIBEXT
1845 # Conditions under which smbwrapper should not be built.
1847 if test x$PICFLAG = x; then
1848 echo No support for PIC code - disabling smbwrapper and smbsh
1852 elif test x$ac_cv_func_syscall = xno; then
1853 AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1866 #################################################
1867 # check for the AFS filesystem
1868 AC_MSG_CHECKING(whether to use AFS)
1870 [ --with-afs Include AFS support (default=no)],
1871 [ case "$withval" in
1884 #################################################
1885 # check for the DFS auth system
1886 AC_MSG_CHECKING(whether to use DCE/DFS auth)
1888 [ --with-dce-dfs Include DCE/DFS support (default=no)],
1889 [ case "$withval" in
1901 #################################################
1902 # check for Kerberos IV auth system
1903 AC_MSG_CHECKING(whether to use Kerberos IV)
1905 [ --with-krb4=base-dir Include Kerberos IV support (default=no)],
1906 [ case "$withval" in
1909 AC_DEFINE(KRB4_AUTH)
1910 AC_CHECK_LIB(resolv, dn_expand)
1911 LIBS="$LIBS -lkrb -ldes"
1912 CFLAGS="$CFLAGS -I$withval/include"
1913 LDFLAGS="$LDFLAGS -L$withval/lib"
1922 #################################################
1923 # check for Kerberos 5 auth system
1924 AC_MSG_CHECKING(whether to use Kerberos 5)
1926 [ --with-krb5=base-dir Include Kerberos 5 support (default=no)],
1927 [ case "$withval" in
1930 AC_DEFINE(KRB5_AUTH)
1931 LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
1932 CFLAGS="$CFLAGS -I$withval/include"
1933 LDFLAGS="$LDFLAGS -L$withval/lib"
1942 #################################################
1943 # check for automount support
1944 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1945 AC_ARG_WITH(automount,
1946 [ --with-automount Include AUTOMOUNT support (default=no)],
1947 [ case "$withval" in
1950 AC_DEFINE(WITH_AUTOMOUNT)
1959 #################################################
1960 # check for smbmount support
1961 AC_MSG_CHECKING(whether to use SMBMOUNT)
1962 AC_ARG_WITH(smbmount,
1963 [ --with-smbmount Include SMBMOUNT (Linux only) support (default=no)],
1964 [ case "$withval" in
1969 AC_DEFINE(WITH_SMBMOUNT)
1970 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1973 AC_MSG_ERROR(not on a linux system!)
1987 #################################################
1988 # check for a PAM password database
1989 with_pam_for_crypt=no
1990 AC_MSG_CHECKING(whether to use PAM password database)
1992 [ --with-pam Include PAM password database support (default=no)],
1993 [ case "$withval" in
1998 with_pam_for_crypt=yes
2007 # we can't build a pam module if we don't have pam.
2008 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
2010 #################################################
2011 # check for pam_smbpass support
2012 AC_MSG_CHECKING(whether to use pam_smbpass)
2013 AC_ARG_WITH(pam_smbpass,
2014 [ --with-pam_smbpass Include the smbpass PAM module (default=no)],
2015 [ case "$withval" in
2019 # Conditions under which pam_smbpass should not be built.
2021 if test x$PICFLAG = x; then
2022 AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
2024 elif test x$ac_cv_lib_pam_pam_get_data = xno; then
2025 AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
2028 AC_DEFINE(WITH_PAM_SMBPASS)
2029 PAM_MOD="bin/pam_smbpass.so"
2040 ###############################################
2041 # test for where we get crypt() from, but only
2043 if test $with_pam_for_crypt = no; then
2044 AC_CHECK_FUNCS(crypt)
2045 if test x"$ac_cv_func_crypt" = x"no"; then
2046 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
2047 AC_DEFINE(HAVE_CRYPT)])
2052 ## moved after the check for -lcrypt in order to
2053 ## ensure that the necessary libraries are included
2054 ## check checking for truncated salt. Wrapped by the
2055 ## $with_pam_for_crypt variable as above --jerry
2057 if test $with_pam_for_crypt = no; then
2058 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
2059 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
2060 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
2061 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
2062 AC_DEFINE(HAVE_TRUNCATED_SALT)
2067 ########################################################################################
2069 ## TESTS FOR SAM BACKENDS. KEEP THESE GROUPED TOGETHER
2071 ########################################################################################
2073 ## set the with_smbpasswd_sam as the default
2074 with_smbpasswd_sam=yes
2078 #################################################
2079 # check for a TDB password database
2080 AC_MSG_CHECKING(whether to use TDB SAM database)
2082 [ --with-tdbsam Include experimental TDB SAM support (default=no)],
2083 [ case "$withval" in
2086 AC_DEFINE(WITH_TDB_SAM)
2087 with_smbpasswd_sam=no
2096 #################################################
2097 # check for a LDAP password database
2098 AC_MSG_CHECKING(whether to use LDAP SAM database)
2099 AC_ARG_WITH(ldapsam,
2100 [ --with-ldapsam Include experimental LDAP SAM support (default=no)],
2101 [ case "$withval" in
2104 AC_DEFINE(WITH_LDAP_SAM)
2106 AC_CHECK_LIB(lber, ber_bvfree, [LDAPLIBS="$LDAPLIBS -llber"])
2107 ## remove -lresolv as this should be included by the -lsasl dependency
2108 ## in the OpenLDAP clients. By not requiring it specifically, we avoid
2109 ## issues on platforms that don't have it
2110 LDAPLIBS="$LDAPLIBS"
2111 old_LDFLAGS="$LDFLAGS"
2112 LDFLAGS="$LDFLAGS $LDAPLIBS"
2113 AC_CHECK_FUNCS(ldap_start_tls_s)
2114 LDFLAGS="$old_LDFLAGS"
2115 with_smbpasswd_sam=no
2125 #################################################
2126 # check for a NISPLUS password database
2127 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
2128 AC_ARG_WITH(nisplussam,
2129 [ --with-nisplussam Include NISPLUS SAM support (default=no)],
2130 [ case "$withval" in
2133 AC_DEFINE(WITH_NISPLUS_SAM)
2134 with_smbpasswd_sam=no
2143 ################################################
2144 # This test should come last because the
2145 # smbpasswd SAM is only used if another format
2146 # has not been defined
2147 AC_MSG_CHECKING(whether to use traditional smbpasswd file)
2148 if test $with_smbpasswd_sam = yes; then
2150 AC_DEFINE(WITH_SMBPASSWD_SAM)
2157 ########################################################################################
2159 ## END OF TESTS FOR SAM BACKENDS.
2161 ########################################################################################
2163 #################################################
2164 # check for a NISPLUS_HOME support
2165 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
2166 AC_ARG_WITH(nisplus-home,
2167 [ --with-nisplus-home Include NISPLUS_HOME support (default=no)],
2168 [ case "$withval" in
2171 AC_DEFINE(WITH_NISPLUS_HOME)
2180 #################################################
2181 # check for the secure socket layer
2182 AC_MSG_CHECKING(whether to use SSL)
2184 [ --with-ssl Include SSL support (default=no)
2185 --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl/include)
2186 --with-ssllib=DIR Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
2187 [ case "$withval" in
2191 withval="/usr/local/ssl" # default
2193 if test "${with_sslinc+set}" = set; then
2195 withval="$with_sslinc"
2198 echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
2199 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
2202 CFLAGS="-I${withval} $CFLAGS"
2208 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
2212 if test "${with_ssllib+set}" = set; then
2214 withval="$with_ssllib"
2217 echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
2218 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
2221 LDFLAGS="-L${withval}/lib $LDFLAGS"
2227 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
2231 LIBS="-lssl -lcrypto $LIBS"
2233 # if test ! -d ${withval}; then
2234 # echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
2238 CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS" # Damn, SSLeay defines its own
2248 #################################################
2249 # check for syslog logging
2250 AC_MSG_CHECKING(whether to use syslog logging)
2252 [ --with-syslog Include experimental SYSLOG support (default=no)],
2253 [ case "$withval" in
2256 AC_DEFINE(WITH_SYSLOG)
2265 #################################################
2266 # check for a shared memory profiling support
2267 AC_MSG_CHECKING(whether to use profiling)
2268 AC_ARG_WITH(profiling-data,
2269 [ --with-profiling-data Include gathering source code profile information (default=no)],
2270 [ case "$withval" in
2273 AC_DEFINE(WITH_PROFILE)
2283 #################################################
2284 # check for experimental disk-quotas support
2285 QUOTAOBJS=smbd/noquotas.o
2287 AC_MSG_CHECKING(whether to support disk-quotas)
2289 [ --with-quotas Include experimental disk-quota support (default=no)],
2290 [ case "$withval" in
2293 QUOTAOBJS=smbd/quotas.o
2303 #################################################
2304 # check for experimental utmp accounting
2306 AC_MSG_CHECKING(whether to support utmp accounting)
2308 [ --with-utmp Include experimental utmp accounting (default=no)],
2309 [ case "$withval" in
2312 AC_DEFINE(WITH_UTMP)
2321 #################################################
2322 # check for MS Dfs support
2324 AC_MSG_CHECKING(whether to support Microsoft Dfs)
2326 [ --with-msdfs Include MS Dfs support (default=no)],
2327 [ case "$withval" in
2330 AC_DEFINE(WITH_MSDFS)
2339 #################################################
2340 # should we build libsmbclient?
2342 LIBSMBCLIENT_SHARED=
2344 AC_MSG_CHECKING(whether to build the libsmbclient shared library)
2345 AC_ARG_WITH(libsmbclient,
2346 [ --with-libsmbclient Build the libsmbclient shared library (default=no)],
2347 [ case "$withval" in
2349 if test $BLDSHARED = true; then
2350 LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
2351 LIBSMBCLIENT=libsmbclient
2354 AC_MSG_RESULT(no shared library support)
2364 #################################################
2365 # these tests are taken from the GNU fileutils package
2366 AC_CHECKING(how to get filesystem space usage)
2369 # Test for statvfs64.
2370 if test $space = no; then
2372 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2374 #if defined(HAVE_UNISTD_H)
2377 #include <sys/types.h>
2378 #include <sys/statvfs.h>
2381 struct statvfs64 fsd;
2382 exit (statvfs64 (".", &fsd));
2384 fu_cv_sys_stat_statvfs64=yes,
2385 fu_cv_sys_stat_statvfs64=no,
2386 fu_cv_sys_stat_statvfs64=cross)])
2387 if test $fu_cv_sys_stat_statvfs64 = yes; then
2389 AC_DEFINE(STAT_STATVFS64)
2393 # Perform only the link test since it seems there are no variants of the
2394 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
2395 # because that got a false positive on SCO OSR5. Adding the declaration
2396 # of a `struct statvfs' causes this test to fail (as it should) on such
2397 # systems. That system is reported to work fine with STAT_STATFS4 which
2398 # is what it gets when this test fails.
2399 if test $space = no; then
2401 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2402 [AC_TRY_LINK([#include <sys/types.h>
2403 #include <sys/statvfs.h>],
2404 [struct statvfs fsd; statvfs (0, &fsd);],
2405 fu_cv_sys_stat_statvfs=yes,
2406 fu_cv_sys_stat_statvfs=no)])
2407 if test $fu_cv_sys_stat_statvfs = yes; then
2409 AC_DEFINE(STAT_STATVFS)
2413 if test $space = no; then
2414 # DEC Alpha running OSF/1
2415 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2416 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2418 #include <sys/param.h>
2419 #include <sys/types.h>
2420 #include <sys/mount.h>
2425 exit (statfs (".", &fsd, sizeof (struct statfs)));
2427 fu_cv_sys_stat_statfs3_osf1=yes,
2428 fu_cv_sys_stat_statfs3_osf1=no,
2429 fu_cv_sys_stat_statfs3_osf1=no)])
2430 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2431 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2433 AC_DEFINE(STAT_STATFS3_OSF1)
2437 if test $space = no; then
2439 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2440 member (AIX, 4.3BSD)])
2441 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2443 #ifdef HAVE_SYS_PARAM_H
2444 #include <sys/param.h>
2446 #ifdef HAVE_SYS_MOUNT_H
2447 #include <sys/mount.h>
2449 #ifdef HAVE_SYS_VFS_H
2450 #include <sys/vfs.h>
2456 exit (statfs (".", &fsd));
2458 fu_cv_sys_stat_statfs2_bsize=yes,
2459 fu_cv_sys_stat_statfs2_bsize=no,
2460 fu_cv_sys_stat_statfs2_bsize=no)])
2461 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2462 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2464 AC_DEFINE(STAT_STATFS2_BSIZE)
2468 if test $space = no; then
2470 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2471 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2472 [AC_TRY_RUN([#include <sys/types.h>
2473 #include <sys/statfs.h>
2477 exit (statfs (".", &fsd, sizeof fsd, 0));
2479 fu_cv_sys_stat_statfs4=yes,
2480 fu_cv_sys_stat_statfs4=no,
2481 fu_cv_sys_stat_statfs4=no)])
2482 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2483 if test $fu_cv_sys_stat_statfs4 = yes; then
2485 AC_DEFINE(STAT_STATFS4)
2489 if test $space = no; then
2491 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2492 member (4.4BSD and NetBSD)])
2493 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2494 [AC_TRY_RUN([#include <sys/types.h>
2495 #ifdef HAVE_SYS_PARAM_H
2496 #include <sys/param.h>
2498 #ifdef HAVE_SYS_MOUNT_H
2499 #include <sys/mount.h>
2505 exit (statfs (".", &fsd));
2507 fu_cv_sys_stat_statfs2_fsize=yes,
2508 fu_cv_sys_stat_statfs2_fsize=no,
2509 fu_cv_sys_stat_statfs2_fsize=no)])
2510 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2511 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2513 AC_DEFINE(STAT_STATFS2_FSIZE)
2517 if test $space = no; then
2519 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2520 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2521 [AC_TRY_RUN([#include <sys/types.h>
2522 #ifdef HAVE_SYS_PARAM_H
2523 #include <sys/param.h>
2525 #ifdef HAVE_SYS_MOUNT_H
2526 #include <sys/mount.h>
2528 #ifdef HAVE_SYS_FS_TYPES_H
2529 #include <sys/fs_types.h>
2534 /* Ultrix's statfs returns 1 for success,
2535 0 for not mounted, -1 for failure. */
2536 exit (statfs (".", &fsd) != 1);
2538 fu_cv_sys_stat_fs_data=yes,
2539 fu_cv_sys_stat_fs_data=no,
2540 fu_cv_sys_stat_fs_data=no)])
2541 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2542 if test $fu_cv_sys_stat_fs_data = yes; then
2544 AC_DEFINE(STAT_STATFS2_FS_DATA)
2549 # As a gating factor for large file support, in order to
2550 # use <4GB files we must have the following minimal support
2552 # long long, and a 64 bit off_t or off64_t.
2553 # If we don't have all of these then disable large
2556 AC_MSG_CHECKING(if large file support can be enabled)
2558 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2559 #include <sys/types.h>
2565 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2566 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2568 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2573 AC_ARG_WITH(spinlocks,
2574 [ --with-spinlocks Use spin locks instead of fcntl locks (default=no)])
2575 if test "x$with_spinlocks" = "xyes"; then
2576 AC_DEFINE(USE_SPINLOCKS)
2580 AC_DEFINE(SPARC_SPINLOCKS)
2583 i386|i486|i586|i686)
2584 AC_DEFINE(INTEL_SPINLOCKS)
2588 AC_DEFINE(MIPS_SPINLOCKS)
2592 AC_DEFINE(POWERPC_SPINLOCKS)
2597 #################################################
2598 # check for ACL support
2600 AC_MSG_CHECKING(whether to support ACLs)
2601 AC_ARG_WITH(acl-support,
2602 [ --with-acl-support Include ACL support (default=no)],
2603 [ case "$withval" in
2608 AC_MSG_RESULT(Using UnixWare ACLs)
2609 AC_DEFINE(HAVE_UNIXWARE_ACLS)
2612 AC_MSG_RESULT(Using solaris ACLs)
2613 AC_DEFINE(HAVE_SOLARIS_ACLS)
2616 AC_MSG_RESULT(Using HPUX ACLs)
2617 AC_DEFINE(HAVE_HPUX_ACLS)
2620 AC_MSG_RESULT(Using IRIX ACLs)
2621 AC_DEFINE(HAVE_IRIX_ACLS)
2624 AC_MSG_RESULT(Using AIX ACLs)
2625 AC_DEFINE(HAVE_AIX_ACLS)
2628 AC_MSG_RESULT(Using Tru64 ACLs)
2629 AC_DEFINE(HAVE_TRU64_ACLS)
2633 AC_CHECK_LIB(acl,acl_get_file)
2634 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2635 AC_TRY_LINK([#include <sys/types.h>
2636 #include <sys/acl.h>],
2637 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2638 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2639 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2640 AC_MSG_RESULT(Using posix ACLs)
2641 AC_DEFINE(HAVE_POSIX_ACLS)
2642 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2643 AC_TRY_LINK([#include <sys/types.h>
2644 #include <sys/acl.h>],
2645 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2646 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2647 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2648 AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2656 AC_DEFINE(HAVE_NO_ACLS)
2659 AC_DEFINE(HAVE_NO_ACLS)
2663 #################################################
2664 # check for the historical SAMBA installation
2666 if test "x$prefix" = xNONE -a "$sbindir" = "\${exec_prefix}/sbin"; then
2667 # Put all binaries under the /usr/local/samba/bin directory.
2671 #################################################
2672 # check for sendfile support
2674 AC_MSG_CHECKING(whether to check for support sendfile)
2675 AC_ARG_WITH(sendfile-support,
2676 [ --with-sendfile-support Check for sendfile support (default=no)],
2677 [ case "$withval" in
2684 AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
2685 AC_TRY_LINK([#include <sys/sendfile.h>],
2690 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
2692 samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
2694 AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[
2695 AC_TRY_LINK([#include <sys/sendfile.h>],
2700 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
2702 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
2704 # Try and cope with broken Linux sendfile....
2705 AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
2707 #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
2708 #undef _FILE_OFFSET_BITS
2710 #include <sys/sendfile.h>],
2715 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
2717 samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
2719 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
2720 AC_DEFINE(HAVE_SENDFILE64)
2721 AC_DEFINE(LINUX_SENDFILE_API)
2722 AC_DEFINE(WITH_SENDFILE)
2723 elif test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
2724 AC_DEFINE(HAVE_SENDFILE)
2725 AC_DEFINE(LINUX_SENDFILE_API)
2726 AC_DEFINE(WITH_SENDFILE)
2727 elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
2728 AC_DEFINE(LINUX_BROKEN_SENDFILE_API)
2729 AC_DEFINE(WITH_SENDFILE)
2736 AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
2738 #include <sys/types.h>
2739 #include <sys/socket.h>
2740 #include <sys/uio.h>],
2742 #define NULL (void *)0
2743 int fromfd, tofd, ret, total;
2744 off_t offset, nwritten;
2746 struct iovec *headers;
2748 struct iovec *trailers;
2752 hdr.headers = &hdtrl;
2754 hdr.trailers = NULL;
2756 hdtrl.iov_base = NULL;
2758 ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
2760 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
2762 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
2763 AC_DEFINE(HAVE_SENDFILE)
2764 AC_DEFINE(FREEBSD_SENDFILE_API)
2765 AC_DEFINE(WITH_SENDFILE)
2772 AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
2774 #include <sys/socket.h>
2775 #include <sys/uio.h>],
2779 struct iovec hdtrl[2];
2783 hdtrl[0].iov_base = 0;
2784 hdtrl[0].iov_len = 0;
2786 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
2788 samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
2789 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
2790 AC_DEFINE(HAVE_SENDFILE64)
2791 AC_DEFINE(HPUX_SENDFILE_API)
2792 AC_DEFINE(WITH_SENDFILE)
2797 AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[
2799 #include <sys/socket.h>
2800 #include <sys/uio.h>],
2804 struct iovec hdtrl[2];
2808 hdtrl[0].iov_base = 0;
2809 hdtrl[0].iov_len = 0;
2811 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
2813 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
2814 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
2815 AC_DEFINE(HAVE_SENDFILE)
2816 AC_DEFINE(HPUX_SENDFILE_API)
2817 AC_DEFINE(WITH_SENDFILE)
2824 LIBS="$LIBS -lsendfile"
2825 AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[
2827 #include <sys/sendfile.h>],
2831 struct sendfilevec vec[2];
2837 vec[0].sfv_fd = SFV_FD_SELF;
2838 vec[0].sfv_flag = 0;
2843 vec[1].sfv_flag = 0;
2846 nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
2848 samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
2850 if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then
2851 AC_DEFINE(HAVE_SENDFILEV64)
2852 AC_DEFINE(SOLARIS_SENDFILE_API)
2853 AC_DEFINE(WITH_SENDFILE)
2858 AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[
2860 #include <sys/sendfile.h>],
2864 struct sendfilevec vec[2];
2870 vec[0].sfv_fd = SFV_FD_SELF;
2871 vec[0].sfv_flag = 0;
2876 vec[1].sfv_flag = 0;
2879 nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
2881 samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
2883 if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then
2884 AC_DEFINE(HAVE_SENDFILEV)
2885 AC_DEFINE(SOLARIS_SENDFILE_API)
2886 AC_DEFINE(WITH_SENDFILE)
2903 #################################################
2904 # Check whether winbind is supported on this platform. If so we need to
2905 # build and install client programs (WINBIND_TARGETS), sbin programs
2906 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2908 AC_MSG_CHECKING(whether to build winbind)
2910 # Initially, the value of $host_os decides whether winbind is supported
2918 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2919 WINBIND_NSS_EXTRA_LIBS="-lsocket"
2923 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2930 winbind_no_reason=", unsupported on $host_os"
2934 # Check the setting of --with-winbindd
2936 AC_ARG_WITH(winbind,
2937 [ --with-winbind Build winbind (default, if supported by OS)],
2950 # We need unix domain sockets for winbind
2952 if test x"$HAVE_WINBIND" = x"yes"; then
2953 if test x"$samba_cv_unixsocket" = x"no"; then
2954 winbind_no_reason=", no unix domain socket support on $host_os"
2959 # Display test results
2961 if test x"$HAVE_WINBIND" = x"yes"; then
2965 AC_MSG_CHECKING(whether to enable winbind auth challenge/response code)
2966 AC_ARG_WITH(winbind-auth-challenge,
2967 [ --with-winbind-auth-challenge Enable winbindd_pam_auth_crap() functionality (default no)],
2971 AC_DEFINE(WITH_WINBIND_AUTH_CRAP)
2981 # Check for FreeBSD problem with getgroups
2983 WINBIND_TARGETS="bin/wbinfo"
2984 WINBIND_STARGETS="bin/winbindd"
2987 WINBIND_LTARGETS="nsswitch/libns_winbind.so"
2990 WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
2997 WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
3001 # Check for Horrible winbindd ldap hack.
3003 AC_MSG_CHECKING(whether to enable winbind ldap hack)
3004 AC_ARG_WITH(winbind-ldap-hack,
3005 [ --with-winbind-ldap-hack Enable winbindd_ldap_hack() functionality (default no)],
3009 AC_DEFINE(WITH_HORRIBLE_LDAP_NATIVE_MODE_HACK)
3010 LIBS="$LIBS -lldap";
3021 AC_MSG_RESULT(no$winbind_no_reason)
3026 WINBIND_PAM_TARGETS=""
3030 # Check for FreeBSD problem with getgroups
3031 # It returns EGID too many times in the list of groups
3032 # and causes a security problem
3033 AC_CACHE_CHECK([whether or not getgroups returns EGID too many times],
3034 samba_cv_have_getgroups_too_many_egids,[AC_TRY_RUN([
3035 #include <sys/types.h>
3038 int main(int argc, char *argv[])
3043 n = getgroups(n, &groups);
3044 /* Could actually pass back the number of EGIDs there ... */
3045 exit((n > 1 && groups[0] == getegid() && groups[1] == getegid()) ? 1 : 0);
3047 samba_cv_have_getgroups_too_many_egids=no,samba_cv_have_getgroups_too_many_egids=yes, samba_cv_have_getgroups_too_many_egids=cross)])
3048 if test x"$samba_cv_have_getgroups_too_many_egids" = x"yes"; then
3049 AC_DEFINE(HAVE_GETGROUPS_TOO_MANY_EGIDS)
3052 # Substitution time!
3054 AC_SUBST(WINBIND_TARGETS)
3055 AC_SUBST(WINBIND_STARGETS)
3056 AC_SUBST(WINBIND_LTARGETS)
3057 AC_SUBST(WINBIND_PAM_TARGETS)
3058 AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
3059 AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
3061 # Solaris has some extra fields in struct passwd that need to be
3062 # initialised otherwise nscd crashes. Unfortunately autoconf < 2.50
3063 # doesn't have the AC_CHECK_MEMBER macro which would be handy for checking
3066 #AC_CHECK_MEMBER(struct passwd.pw_comment,
3067 # AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),
3068 # [#include <pwd.h>])
3070 AC_CACHE_CHECK([whether struct passwd has pw_comment],samba_cv_passwd_pw_comment, [
3071 AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_comment;],
3072 samba_cv_passwd_pw_comment=yes,samba_cv_passwd_pw_comment=no)])
3073 if test x"$samba_cv_passwd_pw_comment" = x"yes"; then
3074 AC_DEFINE(HAVE_PASSWD_PW_COMMENT)
3077 #AC_CHECK_MEMBER(struct passwd.pw_age,
3078 # AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),
3079 # [#include <pwd.h>])
3081 AC_CACHE_CHECK([whether struct passwd has pw_age],samba_cv_passwd_pw_age, [
3082 AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_age;],
3083 samba_cv_passwd_pw_age=yes,samba_cv_passwd_pw_age=no)])
3084 if test x"$samba_cv_passwd_pw_age" = x"yes"; then
3085 AC_DEFINE(HAVE_PASSWD_PW_AGE)
3088 #################################################
3089 # Check to see if we should use the included popt
3091 AC_ARG_WITH(included-popt,
3092 [ --with-included-popt use bundled popt library, not from system],
3103 if test x"$INCLUDED_POPT" != x"yes"; then
3104 AC_CHECK_LIB(popt, poptGetContext,
3105 INCLUDED_POPT=no, INCLUDED_POPT=yes)
3108 AC_MSG_CHECKING(whether to use included popt)
3109 if test x"$INCLUDED_POPT" = x"yes"; then
3110 AC_MSG_RESULT($srcdir/popt)
3111 BUILD_POPT='$(POPT_OBJS)'
3112 FLAGS1="-I$srcdir/popt"
3117 AC_SUBST(BUILD_POPT)
3120 #################################################
3121 # final configure stuff
3122 AC_MSG_CHECKING([configure summary])
3123 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
3125 AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
3126 AC_MSG_WARN([cannot run when cross-compiling]))
3131 AC_OUTPUT(include/stamp-h Makefile script/findsmb)