1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(include/includes.h)
4 AC_CONFIG_HEADER(include/config.h)
6 #################################################
7 # Directory handling stuff to support both the
8 # legacy SAMBA directories and FHS compliant
10 AC_PREFIX_DEFAULT(/usr/local/samba)
13 [ --with-fhs Use FHS-compliant paths (default=no)],
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 configdir="\$(LIBDIR)"
21 logfilebase="\$(VARDIR)"
22 lockdir="\${VARDIR}/locks"
23 piddir="\$(VARDIR)/locks"
24 privatedir="\${prefix}/private"
25 swatdir="\${prefix}/swat")
27 #################################################
28 # set private directory location
29 AC_ARG_WITH(privatedir,
30 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
34 # Just in case anybody calls it without argument
36 AC_MSG_WARN([--with-privatedir called without argument - will use default])
43 #################################################
44 # set lock directory location
46 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
50 # Just in case anybody calls it without argument
52 AC_MSG_WARN([--with-lockdir called without argument - will use default])
59 #################################################
60 # set pid directory location
62 [ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks)],
66 # Just in case anybody calls it without argument
68 AC_MSG_WARN([--with-piddir called without argument - will use default])
75 #################################################
76 # set SWAT directory location
78 [ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)],
82 # Just in case anybody does it
84 AC_MSG_WARN([--with-swatdir called without argument - will use default])
91 #################################################
92 # set configuration directory location
93 AC_ARG_WITH(configdir,
94 [ --with-configdir=DIR Where to put configuration files (\$libdir)],
98 # Just in case anybody does it
100 AC_MSG_WARN([--with-configdir called without argument - will use default])
107 #################################################
108 # set log directory location
109 AC_ARG_WITH(logfilebase,
110 [ --with-logfilebase=DIR Where to put log files (\$(VARDIR))],
114 # Just in case anybody does it
116 AC_MSG_WARN([--with-logfilebase called without argument - will use default])
119 logfilebase="$withval"
126 AC_SUBST(logfilebase)
132 dnl Unique-to-Samba variables we'll be playing with.
148 AC_SUBST(LIBSMBCLIENT_SHARED)
149 AC_SUBST(LIBSMBCLIENT)
152 # compile with optimization and without debugging by default
153 CFLAGS="-O ${CFLAGS}"
156 [ --enable-debug Turn on compiler debugging information (default=no)],
157 [if eval "test x$enable_debug = xyes"; then
158 CFLAGS="${CFLAGS} -g"
161 AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)],
162 [if eval "test x$enable_developer = xyes"; then
163 CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
166 AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
167 [if eval "test x$enable_krb5developer = xyes"; then
168 CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
171 AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Enable heap debugging [default=no]])
173 if test "x$enable_dmalloc" = xyes
175 AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
176 AC_DEFINE(DMALLOC_FUNC_CHECK, 1,
177 [Define to check invariants around some common functions])
178 LIBS="$LIBS -ldmalloc"
181 dnl Checks for programs.
186 dnl Check if we use GNU ld
190 dnl needed before AC_TRY_COMPILE
193 dnl Check if C compiler understands -c and -o at the same time
195 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
202 dnl Check if the C compiler understands volatile (it should, being ANSI).
203 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
204 AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
205 samba_cv_volatile=yes,samba_cv_volatile=no)])
206 if test x"$samba_cv_volatile" = x"yes"; then
207 AC_DEFINE(HAVE_VOLATILE)
213 dnl Add #include for broken IRIX header files
215 *irix6*) AC_ADD_INCLUDE(<standards.h>)
219 AC_VALIDATE_CACHE_SYSTEM_TYPE
224 # Config CPPFLAG settings for strange OS's that must be set
225 # before other tests.
228 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
232 # mmap on HPUX is completely broken...
233 AC_DEFINE(MMAP_BLACKLIST)
234 if test $ac_cv_prog_cc_Ae = yes; then
235 CPPFLAGS="$CPPFLAGS -Ae"
238 # Defines needed for HPUX support.
239 # HPUX has bigcrypt but (sometimes?) doesn't use it for
240 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
244 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
245 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
246 AC_DEFINE(_HPUX_SOURCE)
247 AC_DEFINE(_POSIX_SOURCE)
248 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
249 AC_DEFINE(_MAX_ALIGNMENT,4)
252 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
253 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
254 AC_DEFINE(_HPUX_SOURCE)
255 AC_DEFINE(_POSIX_SOURCE)
256 AC_DEFINE(_LARGEFILE64_SOURCE)
257 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
258 AC_DEFINE(_MAX_ALIGNMENT,4)
265 # CRAY Unicos has broken const handling
267 AC_MSG_RESULT([disabling const])
268 CPPFLAGS="$CPPFLAGS -Dconst="
272 # AIX4.x doesn't even admit to having large
273 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
276 AC_MSG_RESULT([enabling large file support])
277 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
278 AC_DEFINE(_LARGE_FILES)
281 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
282 # to the existance of large files..
283 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
284 # recommendations on large file support, however it makes the
285 # compile work using gcc 2.7 and 2.8, whereas using the Sun
286 # recommendation makes the compile fail on gcc2.7. JRA.
290 5.0*|5.1*|5.2*|5.3*|5.5*)
291 AC_MSG_RESULT([no large file support])
294 AC_MSG_RESULT([enabling large file support])
295 if test "$ac_cv_prog_gcc" = yes; then
296 ${CC-cc} -v >conftest.c 2>&1
297 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
299 case "$ac_cv_gcc_compiler_version_number" in
300 *"gcc version 2.6"*|*"gcc version 2.7"*)
301 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
302 AC_DEFINE(_LARGEFILE64_SOURCE)
305 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
306 AC_DEFINE(_LARGEFILE64_SOURCE)
307 AC_DEFINE(_FILE_OFFSET_BITS,64)
311 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
312 AC_DEFINE(_LARGEFILE64_SOURCE)
313 AC_DEFINE(_FILE_OFFSET_BITS,64)
319 # Tests needed for SINIX large file support.
322 if test $host = mips-sni-sysv4 ; then
323 AC_MSG_CHECKING([for LFS support])
324 old_CPPFLAGS="$CPPFLAGS"
325 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
329 #if _LFS64_LARGEFILE == 1
334 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
335 CPPFLAGS="$old_CPPFLAGS"
336 if test x$SINIX_LFS_SUPPORT = xyes ; then
337 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
338 AC_DEFINE(_LARGEFILE64_SOURCE)
339 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
340 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
341 LIBS="`getconf LFS64_LIBS` $LIBS"
343 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
347 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
350 AC_MSG_CHECKING([for LFS support])
351 old_CPPFLAGS="$CPPFLAGS"
352 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
355 #include <sys/utsname.h>
357 #if _LFS64_LARGEFILE == 1
362 /* Ensure this is glibc 2.2 or higher */
363 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
364 int libc_major = __GLIBC__;
365 int libc_minor = __GLIBC_MINOR__;
373 /* Ensure this is kernel 2.4 or higher */
376 release = uts.release;
377 major = atoi(strsep(&release, "."));
378 minor = atoi(strsep(&release, "."));
380 if (major > 2 || (major == 2 && minor > 3))
387 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
388 CPPFLAGS="$old_CPPFLAGS"
389 if test x$LINUX_LFS_SUPPORT = xyes ; then
390 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
391 AC_DEFINE(_LARGEFILE64_SOURCE)
392 AC_DEFINE(_FILE_OFFSET_BITS,64)
393 AC_DEFINE(_GNU_SOURCE)
395 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
399 AC_MSG_CHECKING([for LFS support])
400 old_CPPFLAGS="$CPPFLAGS"
401 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
405 #if _LFS64_LARGEFILE == 1
410 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
411 CPPFLAGS="$old_CPPFLAGS"
412 if test x$GLIBC_LFS_SUPPORT = xyes ; then
413 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
414 AC_DEFINE(_LARGEFILE64_SOURCE)
415 AC_DEFINE(_GNU_SOURCE)
417 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
427 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
428 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
429 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.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 string.h strings.h stdlib.h sys/socket.h)
432 AC_CHECK_HEADERS(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 ldap.h lber.h dlfcn.h)
435 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
438 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
439 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
443 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
444 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
445 if test x"$ac_cv_header_shadow_h" = x"yes"; then
446 AC_DEFINE(HAVE_SHADOW_H)
450 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
451 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
452 AC_CHECK_HEADERS(stropts.h poll.h)
453 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
454 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
456 # For experimental utmp support (lastlog on some BSD-like systems)
457 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
459 # For quotas on Veritas VxFS filesystems
460 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
462 # For quotas on Linux XFS filesystems
463 AC_CHECK_HEADERS(linux/xqm.h)
465 AC_CHECK_SIZEOF(int,cross)
466 AC_CHECK_SIZEOF(long,cross)
467 AC_CHECK_SIZEOF(short,cross)
482 AC_CHECK_TYPE(ino_t,unsigned)
483 AC_CHECK_TYPE(loff_t,off_t)
484 AC_CHECK_TYPE(offset_t,loff_t)
485 AC_CHECK_TYPE(ssize_t, int)
486 AC_CHECK_TYPE(wchar_t, unsigned short)
488 ############################################
489 # for cups support we need libcups, and a handful of header files
492 [ --enable-cups Turn on CUPS support (default=auto)])
494 if test x$enable_cups != xno; then
495 AC_PATH_PROG(CUPS_CONFIG, cups-config)
497 if test "x$CUPS_CONFIG" != x; then
499 CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
500 LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
501 PRINTLIBS="$PRINTLIBS `$CUPS_CONFIG --libs`"
505 ############################################
506 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the new VFS code
507 AC_CHECK_FUNCS(dlopen)
508 if test x"$ac_cv_func_dlopen" = x"no"; then
509 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
510 AC_DEFINE(HAVE_DLOPEN)])
512 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
514 ############################################
515 # check if the compiler can do immediate structures
516 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
520 typedef struct {unsigned x;} FOOBAR;
521 #define X_FOOBAR(x) ((FOOBAR) { x })
522 #define FOO_ONE X_FOOBAR(1)
530 samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
531 if test x"$samba_cv_immediate_structures" = x"yes"; then
532 AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
535 ############################################
536 # check for unix domain sockets
537 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
539 #include <sys/types.h>
542 #include <sys/socket.h>
543 #include <sys/un.h>],
545 struct sockaddr_un sunaddr;
546 sunaddr.sun_family = AF_UNIX;
548 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
549 if test x"$samba_cv_unixsocket" = x"yes"; then
550 AC_DEFINE(HAVE_UNIXSOCKET)
554 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
556 #include <sys/types.h>
561 #include <sys/socket.h>],[socklen_t i = 0],
562 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
563 if test x"$samba_cv_socklen_t" = x"yes"; then
564 AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
567 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
569 #include <sys/types.h>
574 #include <signal.h>],[sig_atomic_t i = 0],
575 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
576 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
577 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
580 # stupid headers have the functions but no declaration. grrrr.
581 AC_HAVE_DECL(errno, [#include <errno.h>])
582 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
583 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
584 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
585 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
586 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
587 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
589 # and glibc has setresuid under linux but the function does
590 # nothing until kernel 2.1.44! very dumb.
591 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
592 AC_TRY_RUN([#include <errno.h>
593 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
594 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
595 if test x"$samba_cv_have_setresuid" = x"yes"; then
596 AC_DEFINE(HAVE_SETRESUID)
599 # Do the same check for setresguid...
601 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
602 AC_TRY_RUN([#include <unistd.h>
604 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
605 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
606 if test x"$samba_cv_have_setresgid" = x"yes"; then
607 AC_DEFINE(HAVE_SETRESGID)
612 ###############################################
613 # test for where we get crypt() from
614 AC_CHECK_FUNCS(crypt)
615 if test x"$ac_cv_func_crypt" = x"no"; then
616 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
617 AC_DEFINE(HAVE_CRYPT)])
621 ###############################################
622 # Readline included by default unless explicitly asked not to
623 test "${with_readline+set}" != "set" && with_readline=yes
625 # test for where we get readline() from
626 AC_MSG_CHECKING(whether to use readline)
627 AC_ARG_WITH(readline,
628 [ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
629 [ case "$with_readline" in
633 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
634 AC_CHECK_HEADERS(readline/history.h)
636 AC_CHECK_HEADERS(readline.h readline/readline.h,[
637 for termlib in ncurses curses termcap terminfo termlib; do
638 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
640 AC_CHECK_LIB(readline, rl_callback_handler_install,
641 [TERMLIBS="-lreadline $TERMLIBS"
642 AC_DEFINE(HAVE_LIBREADLINE)
643 break], [TERMLIBS=], $TERMLIBS)])
651 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
652 # alternate readline path
654 _cppflags=${CPPFLAGS}
656 # Add additional search path
657 LDFLAGS="-L$with_readline/lib $LDFLAGS"
658 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
660 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
661 AC_CHECK_HEADERS(readline/history.h)
663 AC_CHECK_HEADERS(readline.h readline/readline.h,[
664 for termlib in ncurses curses termcap terminfo termlib; do
665 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
667 AC_CHECK_LIB(readline, rl_callback_handler_install,
668 [TERMLDFLAGS="-L$with_readline/lib"
669 TERMCPPFLAGS="-I$with_readline/include"
670 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
671 TERMLIBS="-lreadline $TERMLIBS"
672 AC_DEFINE(HAVE_LIBREADLINE)
673 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
681 AC_SUBST(TERMLDFLAGS)
683 # The readline API changed slightly from readline3 to readline4, so
684 # code will generate warnings on one of them unless we have a few
686 AC_CHECK_LIB(readline, rl_completion_matches,
687 [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1,
688 [Do we have rl_completion_matches?])],
692 # The following test taken from the cvs sources
693 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
694 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
695 # libsocket.so which has a bad implementation of gethostbyname (it
696 # only looks in /etc/hosts), so we only look for -lsocket if we need
698 AC_CHECK_FUNCS(connect)
699 if test x"$ac_cv_func_connect" = x"no"; then
702 *) AC_CHECK_LIB(nsl_s, printf) ;;
706 *) AC_CHECK_LIB(nsl, printf) ;;
710 *) AC_CHECK_LIB(socket, connect) ;;
714 *) AC_CHECK_LIB(inet, connect) ;;
716 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
718 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
719 test x"$ac_cv_lib_inet_connect" = x"yes"; then
720 # ac_cv_func_connect=yes
721 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
722 AC_DEFINE(HAVE_CONNECT)
726 ###############################################
727 # test for where we get get_yp_default_domain() from
728 AC_CHECK_FUNCS(yp_get_default_domain)
729 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
730 AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
731 AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)])
734 # Check if we have execl, if not we need to compile smbrun.
735 AC_CHECK_FUNCS(execl)
736 if test x"$ac_cv_func_execl" = x"no"; then
742 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
743 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
744 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
745 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
746 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)
747 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
748 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
749 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
750 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
751 AC_CHECK_FUNCS(syslog vsyslog getgrouplist)
752 # setbuffer is needed for smbtorture
753 AC_CHECK_FUNCS(setbuffer)
755 # syscall() is needed for smbwrapper.
756 AC_CHECK_FUNCS(syscall)
758 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
759 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
760 AC_CHECK_FUNCS(__getcwd _getcwd)
761 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
762 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
763 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
764 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
765 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
766 AC_CHECK_FUNCS(_write __write _fork __fork)
767 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
768 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
769 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
770 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
771 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
774 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
777 if test x$ac_cv_func_stat64 = xno ; then
778 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
780 #if defined(HAVE_UNISTD_H)
783 #include <sys/stat.h>
784 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
785 AC_MSG_RESULT([$ac_cv_func_stat64])
786 if test x$ac_cv_func_stat64 = xyes ; then
787 AC_DEFINE(HAVE_STAT64)
791 if test x$ac_cv_func_lstat64 = xno ; then
792 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
794 #if defined(HAVE_UNISTD_H)
797 #include <sys/stat.h>
798 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
799 AC_MSG_RESULT([$ac_cv_func_lstat64])
800 if test x$ac_cv_func_lstat64 = xyes ; then
801 AC_DEFINE(HAVE_LSTAT64)
805 if test x$ac_cv_func_fstat64 = xno ; then
806 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
808 #if defined(HAVE_UNISTD_H)
811 #include <sys/stat.h>
812 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
813 AC_MSG_RESULT([$ac_cv_func_fstat64])
814 if test x$ac_cv_func_fstat64 = xyes ; then
815 AC_DEFINE(HAVE_FSTAT64)
819 #####################################
820 # we might need the resolv library on some systems
821 AC_CHECK_LIB(resolv, dn_expand)
824 # Check for the functions putprpwnam, set_auth_parameters,
825 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
826 # Needed for OSF1 and HPUX.
829 AC_LIBTESTFUNC(security, putprpwnam)
830 AC_LIBTESTFUNC(sec, putprpwnam)
832 AC_LIBTESTFUNC(security, set_auth_parameters)
833 AC_LIBTESTFUNC(sec, set_auth_parameters)
835 # UnixWare 7.x has its getspnam in -lgen
836 AC_LIBTESTFUNC(gen, getspnam)
838 AC_LIBTESTFUNC(security, getspnam)
839 AC_LIBTESTFUNC(sec, getspnam)
841 AC_LIBTESTFUNC(security, bigcrypt)
842 AC_LIBTESTFUNC(sec, bigcrypt)
844 AC_LIBTESTFUNC(security, getprpwnam)
845 AC_LIBTESTFUNC(sec, getprpwnam)
847 # this bit needs to be modified for each OS that is suported by
848 # smbwrapper. You need to specify how to created a shared library and
849 # how to compile C code to produce PIC object files
851 # these are the defaults, good for lots of systems
860 # Assume non-shared by default and override below
862 AC_MSG_CHECKING([ability to build shared libraries])
864 # and these are for particular systems
866 *linux*) AC_DEFINE(LINUX)
869 DYNEXP="-Wl,--export-dynamic"
871 SONAMEFLAG="-Wl,-soname="
872 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
874 *solaris*) AC_DEFINE(SUNOS5)
878 if test "${GCC}" = "yes"; then
880 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
885 ## ${CFLAGS} added for building 64-bit shared
886 ## libs using Sun's Compiler
887 LDSHFLAGS="-G \${CFLAGS}"
891 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
893 *sunos*) AC_DEFINE(SUNOS4)
897 PICFLAG="-KPIC" # Is this correct for SunOS
899 *freebsd*) BLDSHARED="true"
901 DYNEXP="-Wl,--export-dynamic"
902 SONAMEFLAG="-Wl,-soname,"
903 PICFLAG="-fPIC -DPIC"
904 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
906 *openbsd*) BLDSHARED="true"
908 DYNEXP="-Wl,-Bdynamic"
909 SONAMEFLAG="-Wl,-soname,"
911 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
913 *irix*) AC_DEFINE(IRIX)
915 *irix6*) AC_DEFINE(IRIX6)
918 ATTEMPT_WRAP32_BUILD=yes
920 LDSHFLAGS="-set_version sgi1.0 -shared"
921 SONAMEFLAG="-soname "
923 if test "${GCC}" = "yes"; then
928 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
930 *aix*) AC_DEFINE(AIX)
932 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
933 DYNEXP="-Wl,-brtl,-bexpall"
935 if test "${GCC}" != "yes"; then
936 ## for funky AIX compiler using strncpy()
937 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
940 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)
942 *hpux*) AC_DEFINE(HPUX)
944 # Use special PIC flags for the native HP-UX compiler.
945 if test $ac_cv_prog_cc_Ae = yes; then
948 LDSHFLAGS="-B symbolic -b -z"
953 AC_DEFINE(STAT_ST_BLOCKSIZE,8192)
955 *qnx*) AC_DEFINE(QNX);;
956 *osf*) AC_DEFINE(OSF1)
959 SONAMEFLAG="-Wl,-soname,"
962 *sco*) AC_DEFINE(SCO);;
963 *unixware*) AC_DEFINE(UNIXWARE)
966 SONAMEFLAG="-Wl,-soname,"
969 *next2*) AC_DEFINE(NEXT2);;
970 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
973 *-univel-*) if [ test "$GCC" != yes ]; then
974 AC_DEFINE(HAVE_MEMSET)
979 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
984 if [ test "$GCC" != yes ]; then
985 AC_DEFINE(HAVE_MEMSET)
991 AC_MSG_RESULT($BLDSHARED)
992 AC_MSG_CHECKING([linker flags for shared libraries])
993 AC_MSG_RESULT([$LDSHFLAGS])
994 AC_MSG_CHECKING([compiler flags for position-independent code])
995 AC_MSG_RESULT([$PICFLAGS])
997 #######################################################
998 # test whether building a shared library actually works
999 if test $BLDSHARED = true; then
1000 AC_CACHE_CHECK([whether building shared libraries actually works],
1001 [ac_cv_shlib_works],[
1002 ac_cv_shlib_works=no
1003 # try building a trivial shared library
1004 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c &&
1005 $CC $CPPFLAGS $CFLAGS $LDSHFLAGS -o shlib.so shlib.po &&
1006 ac_cv_shlib_works=yes
1007 rm -f shlib.so shlib.po
1009 if test $ac_cv_shlib_works = no; then
1015 # this updates our target list if we can build shared libs
1016 if test $BLDSHARED = true; then
1017 LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
1019 LIBSMBCLIENT_SHARED=
1024 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
1025 AC_TRY_RUN([#include <stdio.h>
1026 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
1027 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
1028 if test x"$samba_cv_have_longlong" = x"yes"; then
1029 AC_DEFINE(HAVE_LONGLONG)
1033 # Check if the compiler supports the LL prefix on long long integers.
1036 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
1037 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
1038 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
1039 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
1040 AC_DEFINE(COMPILER_SUPPORTS_LL)
1044 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
1045 AC_TRY_RUN([#include <stdio.h>
1046 #include <sys/stat.h>
1047 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
1048 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
1049 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
1050 AC_DEFINE(SIZEOF_OFF_T,8)
1053 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
1055 #if defined(HAVE_UNISTD_H)
1059 #include <sys/stat.h>
1060 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1061 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
1062 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
1063 AC_DEFINE(HAVE_OFF64_T)
1066 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
1067 AC_TRY_RUN([#include <stdio.h>
1068 #include <sys/stat.h>
1069 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
1070 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
1071 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
1072 AC_DEFINE(SIZEOF_INO_T,8)
1075 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
1077 #if defined(HAVE_UNISTD_H)
1081 #include <sys/stat.h>
1082 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1083 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
1084 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
1085 AC_DEFINE(HAVE_INO64_T)
1088 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
1090 #if defined(HAVE_UNISTD_H)
1094 #include <sys/stat.h>
1095 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1096 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
1097 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
1098 AC_DEFINE(HAVE_DEV64_T)
1101 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
1103 #if defined(HAVE_UNISTD_H)
1106 #include <sys/types.h>
1107 #include <dirent.h>],
1108 [struct dirent64 de;],
1109 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
1110 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
1111 AC_DEFINE(HAVE_STRUCT_DIRENT64)
1114 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
1116 #if defined(HAVE_UNISTD_H)
1119 #include <sys/types.h>
1120 main() { dev_t dev; int i = major(dev); return 0; }],
1121 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
1122 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
1123 AC_DEFINE(HAVE_DEVICE_MAJOR_FN)
1126 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
1128 #if defined(HAVE_UNISTD_H)
1131 #include <sys/types.h>
1132 main() { dev_t dev; int i = minor(dev); return 0; }],
1133 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
1134 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
1135 AC_DEFINE(HAVE_DEVICE_MINOR_FN)
1138 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
1139 AC_TRY_RUN([#include <stdio.h>
1140 main() { char c; c=250; exit((c > 0)?0:1); }],
1141 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
1142 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
1143 AC_DEFINE(HAVE_UNSIGNED_CHAR)
1146 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
1147 AC_TRY_COMPILE([#include <sys/types.h>
1148 #include <sys/socket.h>
1149 #include <netinet/in.h>],
1150 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
1151 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
1152 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
1153 AC_DEFINE(HAVE_SOCK_SIN_LEN)
1156 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
1157 AC_TRY_COMPILE([#include <sys/types.h>
1159 void seekdir(DIR *d, long loc) { return; }],[return 0;],
1160 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
1161 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
1162 AC_DEFINE(SEEKDIR_RETURNS_VOID)
1165 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
1166 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
1167 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
1168 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
1169 AC_DEFINE(HAVE_FILE_MACRO)
1172 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
1173 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
1174 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
1175 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
1176 AC_DEFINE(HAVE_FUNCTION_MACRO)
1179 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
1181 #include <sys/time.h>
1183 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
1184 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
1185 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
1186 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
1189 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE_VA_COPY,[
1190 AC_TRY_LINK([#include <stdarg.h>
1191 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
1192 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
1193 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
1194 AC_DEFINE(HAVE_VA_COPY)
1197 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
1199 #include <sys/types.h>
1201 void foo(const char *format, ...) {
1206 va_start(ap, format);
1207 len = vsnprintf(buf, 0, format, ap);
1209 if (len != 5) exit(1);
1211 va_start(ap, format);
1212 len = vsnprintf(0, 0, format, ap);
1214 if (len != 5) exit(1);
1216 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
1220 main() { foo("hello"); }
1222 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
1223 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
1224 AC_DEFINE(HAVE_C99_VSNPRINTF)
1227 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
1228 AC_TRY_RUN([#include <sys/types.h>
1230 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
1231 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
1232 di->d_name[0] == 0) exit(0); exit(1);} ],
1233 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
1234 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
1235 AC_DEFINE(HAVE_BROKEN_READDIR)
1238 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
1239 AC_TRY_COMPILE([#include <sys/types.h>
1240 #include <utime.h>],
1241 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
1242 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
1243 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
1244 AC_DEFINE(HAVE_UTIMBUF)
1247 dnl utmp and utmpx come in many flavours
1248 dnl We need to check for many of them
1249 dnl But we don't need to do each and every one, because our code uses
1250 dnl mostly just the utmp (not utmpx) fields.
1252 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
1254 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
1255 AC_TRY_COMPILE([#include <sys/types.h>
1257 [struct utmp ut; ut.ut_name[0] = 'a';],
1258 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
1259 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
1260 AC_DEFINE(HAVE_UT_UT_NAME)
1263 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
1264 AC_TRY_COMPILE([#include <sys/types.h>
1266 [struct utmp ut; ut.ut_user[0] = 'a';],
1267 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
1268 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
1269 AC_DEFINE(HAVE_UT_UT_USER)
1272 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
1273 AC_TRY_COMPILE([#include <sys/types.h>
1275 [struct utmp ut; ut.ut_id[0] = 'a';],
1276 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
1277 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
1278 AC_DEFINE(HAVE_UT_UT_ID)
1281 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
1282 AC_TRY_COMPILE([#include <sys/types.h>
1284 [struct utmp ut; ut.ut_host[0] = 'a';],
1285 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
1286 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
1287 AC_DEFINE(HAVE_UT_UT_HOST)
1290 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
1291 AC_TRY_COMPILE([#include <sys/types.h>
1293 [struct utmp ut; time_t t; ut.ut_time = t;],
1294 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
1295 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
1296 AC_DEFINE(HAVE_UT_UT_TIME)
1299 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
1300 AC_TRY_COMPILE([#include <sys/types.h>
1302 [struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
1303 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
1304 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1305 AC_DEFINE(HAVE_UT_UT_TV)
1308 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1309 AC_TRY_COMPILE([#include <sys/types.h>
1311 [struct utmp ut; ut.ut_type = 0;],
1312 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1313 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1314 AC_DEFINE(HAVE_UT_UT_TYPE)
1317 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1318 AC_TRY_COMPILE([#include <sys/types.h>
1320 [struct utmp ut; ut.ut_pid = 0;],
1321 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1322 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1323 AC_DEFINE(HAVE_UT_UT_PID)
1326 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1327 AC_TRY_COMPILE([#include <sys/types.h>
1329 [struct utmp ut; ut.ut_exit.e_exit = 0;],
1330 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1331 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1332 AC_DEFINE(HAVE_UT_UT_EXIT)
1335 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1336 AC_TRY_COMPILE([#include <sys/types.h>
1338 [struct utmp ut; ut.ut_addr = 0;],
1339 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1340 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1341 AC_DEFINE(HAVE_UT_UT_ADDR)
1344 if test x$ac_cv_func_pututline = xyes ; then
1345 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1346 AC_TRY_COMPILE([#include <sys/types.h>
1348 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1349 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1350 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1351 AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1355 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1356 AC_TRY_COMPILE([#include <sys/types.h>
1357 #include <utmpx.h>],
1358 [struct utmpx ux; ux.ut_syslen = 0;],
1359 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1360 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1361 AC_DEFINE(HAVE_UX_UT_SYSLEN)
1365 #################################################
1366 # check for libiconv support
1367 AC_MSG_CHECKING(whether to use libiconv)
1368 AC_ARG_WITH(libiconv,
1369 [ --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
1370 [ case "$withval" in
1376 CFLAGS="$CFLAGS -I$withval/include"
1377 LDFLAGS="$LDFLAGS -L$withval/lib"
1378 AC_CHECK_LIB(iconv, iconv_open)
1379 AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}")
1387 # check for iconv in libc
1388 AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1392 iconv_t cd = iconv_open("ASCII", "UCS-2LE");
1393 if (cd == 0 || cd == (iconv_t)-1) return -1;
1397 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
1398 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1399 AC_DEFINE(HAVE_NATIVE_ICONV)
1403 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1405 #include <sys/types.h>
1408 #define F_GETLEASE 1025
1411 int fd = open("/dev/null", O_RDONLY);
1412 return fcntl(fd, F_GETLEASE, 0) == -1;
1415 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1416 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1417 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1420 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1422 #include <sys/types.h>
1426 #define F_NOTIFY 1026
1429 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1432 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1433 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1434 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1437 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1439 #include <sys/types.h>
1442 #include <sys/file.h>
1444 #define LOCK_MAND 32
1445 #define LOCK_READ 64
1448 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1451 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1452 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1453 AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1459 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1460 AC_TRY_COMPILE([#include <sys/types.h>
1461 #include <fcntl.h>],
1462 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1463 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1464 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1465 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1468 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1469 AC_TRY_RUN([#include <sys/types.h>
1470 #include <sys/capability.h>
1473 if ((cap = cap_get_proc()) == NULL)
1475 cap->cap_effective |= CAP_NETWORK_MGT;
1476 cap->cap_inheritable |= CAP_NETWORK_MGT;
1481 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1482 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1483 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1487 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1488 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1491 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_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_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1498 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1499 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1502 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1503 AC_TRY_COMPILE([#include <sys/types.h>
1504 #if defined(HAVE_RPC_RPC_H)
1505 #include <rpc/rpc.h>
1508 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1509 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1510 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1513 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1514 AC_TRY_COMPILE([#include <sys/types.h>
1515 #if defined(HAVE_RPC_RPC_H)
1516 #include <rpc/rpc.h>
1519 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1520 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1521 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1524 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1525 AC_TRY_COMPILE([#include <sys/types.h>
1526 #if defined(HAVE_RPC_RPC_H)
1527 #include <rpc/rpc.h>
1530 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1531 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1532 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1536 dnl Some systems (SCO) have a problem including
1537 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1538 dnl as a #define in <prot.h> and as part of an enum
1542 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1543 AC_TRY_COMPILE([#include <sys/types.h>
1544 #ifdef HAVE_SYS_SECURITY_H
1545 #include <sys/security.h>
1547 #endif /* HAVE_SYS_SECURITY_H */
1548 #if defined(HAVE_RPC_RPC_H)
1549 #include <rpc/rpc.h>
1552 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1553 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1554 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1557 AC_MSG_CHECKING([for test routines])
1558 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1560 AC_MSG_ERROR([cant find test code. Aborting config]),
1561 AC_MSG_WARN([cannot run when cross-compiling]))
1563 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1564 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1565 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1566 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1567 AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1570 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1571 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1572 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1573 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1574 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1575 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1577 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1580 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1581 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1582 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1583 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1584 AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1587 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1588 SAVE_CPPFLAGS="$CPPFLAGS"
1589 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper"
1591 #define REPLACE_GETPASS 1
1592 #define NO_CONFIG_H 1
1593 #define main dont_declare_main
1594 #include "${srcdir-.}/lib/getsmbpass.c"
1596 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1597 CPPFLAGS="$SAVE_CPPFLAGS"
1599 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1600 AC_DEFINE(REPLACE_GETPASS)
1603 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1606 #include <sys/types.h>
1607 #include <netinet/in.h>
1608 #ifdef HAVE_ARPA_INET_H
1609 #include <arpa/inet.h>
1611 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1612 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1613 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1615 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1616 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1617 AC_DEFINE(REPLACE_INET_NTOA)
1620 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1621 AC_TRY_RUN([#include <stdlib.h>
1622 #include <sys/types.h>
1623 #include <sys/stat.h>
1627 char tpl[20]="/tmp/test.XXXXXX";
1628 int fd = mkstemp(tpl);
1629 if (fd == -1) exit(1);
1631 if (fstat(fd, &st) != 0) exit(1);
1632 if ((st.st_mode & 0777) != 0600) exit(1);
1635 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1636 samba_cv_HAVE_SECURE_MKSTEMP=no,
1637 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1638 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1639 AC_DEFINE(HAVE_SECURE_MKSTEMP)
1642 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1643 AC_TRY_RUN([#include <unistd.h>
1644 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1645 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1646 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1647 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1650 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1651 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1652 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1653 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1654 AC_DEFINE(HAVE_ROOT)
1656 AC_MSG_WARN(running as non-root will disable some tests)
1660 # look for a method of finding the list of network interfaces
1662 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1664 #define HAVE_IFACE_AIX 1
1665 #define AUTOCONF_TEST 1
1666 #include "confdefs.h"
1667 #include "${srcdir-.}/lib/interfaces.c"],
1668 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1669 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1670 iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1673 if test $iface = no; then
1674 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1676 #define HAVE_IFACE_IFCONF 1
1677 #define AUTOCONF_TEST 1
1678 #include "confdefs.h"
1679 #include "${srcdir-.}/lib/interfaces.c"],
1680 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1681 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1682 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1686 if test $iface = no; then
1687 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1689 #define HAVE_IFACE_IFREQ 1
1690 #define AUTOCONF_TEST 1
1691 #include "confdefs.h"
1692 #include "${srcdir-.}/lib/interfaces.c"],
1693 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1694 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1695 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1700 ################################################
1701 # look for a method of setting the effective uid
1703 if test $seteuid = no; then
1704 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1706 #define AUTOCONF_TEST 1
1707 #define USE_SETRESUID 1
1708 #include "confdefs.h"
1709 #include "${srcdir-.}/lib/util_sec.c"],
1710 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1711 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1712 seteuid=yes;AC_DEFINE(USE_SETRESUID)
1717 if test $seteuid = no; then
1718 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1720 #define AUTOCONF_TEST 1
1721 #define USE_SETREUID 1
1722 #include "confdefs.h"
1723 #include "${srcdir-.}/lib/util_sec.c"],
1724 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1725 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1726 seteuid=yes;AC_DEFINE(USE_SETREUID)
1730 if test $seteuid = no; then
1731 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1733 #define AUTOCONF_TEST 1
1734 #define USE_SETEUID 1
1735 #include "confdefs.h"
1736 #include "${srcdir-.}/lib/util_sec.c"],
1737 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1738 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1739 seteuid=yes;AC_DEFINE(USE_SETEUID)
1743 if test $seteuid = no; then
1744 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1746 #define AUTOCONF_TEST 1
1747 #define USE_SETUIDX 1
1748 #include "confdefs.h"
1749 #include "${srcdir-.}/lib/util_sec.c"],
1750 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1751 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1752 seteuid=yes;AC_DEFINE(USE_SETUIDX)
1757 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1758 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1759 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1760 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1761 AC_DEFINE(HAVE_MMAP)
1764 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1765 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1766 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1767 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1768 AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1771 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1772 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1773 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1774 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1775 AC_DEFINE(HAVE_FCNTL_LOCK)
1778 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1779 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1780 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1781 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1782 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1787 dnl Don't check for 64 bit fcntl locking if we know that the
1788 dnl glibc2.1 broken check has succeeded.
1791 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1793 #if defined(HAVE_UNISTD_H)
1803 #ifdef HAVE_SYS_FCNTL_H
1804 #include <sys/fcntl.h>
1806 main() { struct flock64 fl64;
1807 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1813 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1815 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1816 AC_DEFINE(HAVE_STRUCT_FLOCK64)
1820 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
1821 AC_TRY_COMPILE([#include <sys/types.h>
1822 #include <sys/stat.h>
1823 #include <unistd.h>],
1824 [struct stat st; st.st_blocks = 0;],
1825 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
1826 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
1827 AC_DEFINE(HAVE_STAT_ST_BLOCKS)
1830 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
1831 AC_TRY_COMPILE([#include <sys/types.h>
1832 #include <sys/stat.h>
1833 #include <unistd.h>],
1834 [struct stat st; st.st_blksize = 0;],
1835 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
1836 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
1837 AC_DEFINE(HAVE_STAT_ST_BLKSIZE)
1842 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1844 #ifdef HAVE_SYS_VFS_H
1845 #include <sys/vfs.h>
1847 #ifdef HAVE_SYS_CAPABILITY_H
1848 #include <sys/capability.h>
1851 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1852 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1853 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS)
1858 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1859 AC_TRY_COMPILE([#include <sys/acl.h>
1860 #if defined(HAVE_RPCSVC_NIS_H)
1861 #include <rpcsvc/nis.h>
1864 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1865 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1866 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1870 #################################################
1871 # check for smbwrapper support
1872 AC_MSG_CHECKING(whether to use smbwrapper)
1873 AC_ARG_WITH(smbwrapper,
1874 [ --with-smbwrapper Include SMB wrapper support (default=no) ],
1875 [ case "$withval" in
1878 AC_DEFINE(WITH_SMBWRAPPER)
1879 WRAPPROG="bin/smbsh"
1880 WRAP="bin/smbwrapper.$SHLIBEXT"
1882 if test x$ATTEMPT_WRAP32_BUILD = x; then
1885 WRAP32=bin/smbwrapper.32.$SHLIBEXT
1888 # Conditions under which smbwrapper should not be built.
1890 if test x$PICFLAG = x; then
1891 echo No support for PIC code - disabling smbwrapper and smbsh
1895 elif test x$ac_cv_func_syscall = xno; then
1896 AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1909 #################################################
1910 # check for AFS clear-text auth support
1911 AC_MSG_CHECKING(whether to use AFS clear-text auth)
1913 [ --with-afs Include AFS clear-text auth support (default=no) ],
1914 [ case "$withval" in
1927 #################################################
1928 # check for the DFS clear-text auth system
1929 AC_MSG_CHECKING(whether to use DFS clear-text auth)
1931 [ --with-dce-dfs Include DCE/DFS clear-text auth support (default=no)],
1932 [ case "$withval" in
1944 #################################################
1945 # active directory support
1947 with_ads_support=yes
1948 AC_MSG_CHECKING([whether to use Active Directory])
1951 [ --with-ads Active Directory support (default yes)],
1952 [ case "$withval" in
1958 if test x"$with_ads_support" = x"yes"; then
1962 AC_MSG_RESULT($with_ads_support)
1965 if test x"$with_ads_support" = x"yes"; then
1967 #################################################
1968 # check for location of Kerberos 5 install
1969 AC_MSG_CHECKING(for kerberos 5 install path)
1971 [ --with-krb5=base-dir Locate Kerberos 5 support (default=/usr)],
1972 [ case "$withval" in
1979 CFLAGS="$CFLAGS -I$withval/include"
1980 CPPFLAGS="$CPPFLAGS -I$withval/include"
1981 LDFLAGS="$LDFLAGS -L$withval/lib"
1989 if test x$FOUND_KRB5 = x"no"; then
1990 #################################################
1991 # see if this box has the RedHat location for kerberos
1992 AC_MSG_CHECKING(for /usr/kerberos)
1993 if test -d /usr/kerberos; then
1994 LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
1995 CFLAGS="$CFLAGS -I/usr/kerberos/include"
1996 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
2004 # now check for krb5.h. Some systems have the libraries without the headers!
2005 # note that this check is done here to allow for different kerberos
2007 AC_CHECK_HEADERS(krb5.h)
2009 # now check for gssapi headers. This is also done here to allow for
2010 # different kerberos include paths
2011 AC_CHECK_HEADERS(gssapi/gssapi_generic.h gssapi/gssapi.h)
2013 ##################################################################
2014 # we might need the k5crypto and com_err libraries on some systems
2015 AC_CHECK_LIB(com_err, _et_list, [LIBS="$LIBS -lcom_err"])
2016 AC_CHECK_LIB(k5crypto, krb5_encrypt_data, [LIBS="$LIBS -lk5crypto"])
2018 ########################################################
2019 # now see if we can find the krb5 libs in standard paths
2020 # or as specified above
2021 AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
2022 AC_DEFINE(HAVE_KRB5)])
2024 ########################################################
2025 # now see if we can find the gssapi libs in standard paths
2026 AC_CHECK_LIB(gssapi_krb5, gss_display_status, [LIBS="$LIBS -lgssapi_krb5";
2027 AC_DEFINE(HAVE_GSSAPI)])
2030 ########################################################
2031 # Compile with LDAP support?
2033 with_ldap_support=yes
2034 AC_MSG_CHECKING([whether to use LDAP])
2037 [ --with-ldap LDAP support (default yes)],
2038 [ case "$withval" in
2040 with_ldap_support=no
2044 AC_MSG_RESULT($with_ldap_support)
2046 if test x"$with_ldap_support" = x"yes"; then
2048 ##################################################################
2049 # we might need the lber lib on some systems. To avoid link errors
2050 # this test must be before the libldap test
2051 AC_CHECK_LIB(lber, ber_scanf, [LIBS="$LIBS -llber"])
2053 ########################################################
2054 # now see if we can find the ldap libs in standard paths
2055 if test x$have_ldap != xyes; then
2056 AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
2057 AC_DEFINE(HAVE_LDAP)])
2059 ########################################################
2060 # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
2061 # Check found in pam_ldap 145.
2062 AC_CHECK_FUNCS(ldap_set_rebind_proc)
2063 AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, pam_ldap_cv_ldap_set_rebind_proc, [
2066 #include <ldap.h>], [ldap_set_rebind_proc(0, 0, 0);], [pam_ldap_cv_ldap_set_rebind_proc=3], [pam_ldap_cv_ldap_set_rebind_proc=2]) ])
2067 AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $pam_ldap_cv_ldap_set_rebind_proc)
2071 #################################################
2072 # check for automount support
2073 AC_MSG_CHECKING(whether to use AUTOMOUNT)
2074 AC_ARG_WITH(automount,
2075 [ --with-automount Include AUTOMOUNT support (default=no)],
2076 [ case "$withval" in
2079 AC_DEFINE(WITH_AUTOMOUNT)
2088 #################################################
2089 # check for smbmount support
2090 AC_MSG_CHECKING(whether to use SMBMOUNT)
2091 AC_ARG_WITH(smbmount,
2092 [ --with-smbmount Include SMBMOUNT (Linux only) support (default=no)],
2093 [ case "$withval" in
2098 AC_DEFINE(WITH_SMBMOUNT)
2099 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
2102 AC_MSG_ERROR(not on a linux system!)
2116 #################################################
2117 # check for a PAM clear-text auth, accounts, password and session support
2118 with_pam_for_crypt=no
2119 AC_MSG_CHECKING(whether to use PAM)
2121 [ --with-pam Include PAM support (default=no)],
2122 [ case "$withval" in
2127 with_pam_for_crypt=yes
2136 # we can't build a pam module if we don't have pam.
2137 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
2139 #################################################
2140 # check for pam_smbpass support
2141 AC_MSG_CHECKING(whether to use pam_smbpass)
2142 AC_ARG_WITH(pam_smbpass,
2143 [ --with-pam_smbpass Build a PAM module to allow other applications to use our smbpasswd file (default=no)],
2144 [ case "$withval" in
2148 # Conditions under which pam_smbpass should not be built.
2150 if test x$PICFLAG = x; then
2151 AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
2153 elif test x$ac_cv_lib_pam_pam_get_data = xno; then
2154 AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
2157 PAM_MOD="bin/pam_smbpass.so"
2168 ###############################################
2169 # test for where we get crypt() from, but only
2171 if test x"$with_pam_for_crypt" = x"no"; then
2172 AC_CHECK_FUNCS(crypt)
2173 if test x"$ac_cv_func_crypt" = x"no"; then
2174 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
2175 AC_DEFINE(HAVE_CRYPT)])
2180 ## moved after the check for -lcrypt in order to
2181 ## ensure that the necessary libraries are included
2182 ## check checking for truncated salt. Wrapped by the
2183 ## $with_pam_for_crypt variable as above --jerry
2185 if test $with_pam_for_crypt = no; then
2186 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
2187 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
2188 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
2189 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
2190 AC_DEFINE(HAVE_TRUNCATED_SALT)
2194 # New experimental SAM system
2196 AC_MSG_CHECKING([whether to build the new (experimental) SAM database])
2198 [ --with-sam Build new (experimental) SAM database (default=no)],
2199 [ case "$withval" in
2212 ########################################################################################
2214 ## TESTS FOR SAM BACKENDS. KEEP THESE GROUPED TOGETHER
2216 ########################################################################################
2218 #################################################
2219 # check for a LDAP password database configuration backwards compatibility
2220 AC_MSG_CHECKING(whether to use LDAP SAM 2.2 compatible configuration)
2221 AC_ARG_WITH(ldapsam,
2222 [ --with-ldapsam Include LDAP SAM 2.2 compatible configuration (default=no)],
2223 [ case "$withval" in
2226 AC_DEFINE(WITH_LDAP_SAMCONFIG)
2235 #################################################
2236 # check for a TDB password database
2237 AC_MSG_CHECKING(whether to use TDB SAM database)
2239 [ --with-tdbsam Include experimental TDB SAM support (default=no)],
2240 [ case "$withval" in
2243 AC_DEFINE(WITH_TDB_SAM)
2252 #################################################
2253 # check for a NISPLUS password database
2254 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
2255 AC_ARG_WITH(nisplussam,
2256 [ --with-nisplussam Include NISPLUS SAM support (default=no)],
2257 [ case "$withval" in
2260 AC_DEFINE(WITH_NISPLUS_SAM)
2269 ########################################################################################
2271 ## END OF TESTS FOR SAM BACKENDS.
2273 ########################################################################################
2275 #################################################
2276 # check for a NISPLUS_HOME support
2277 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
2278 AC_ARG_WITH(nisplus-home,
2279 [ --with-nisplus-home Include NISPLUS_HOME support (default=no)],
2280 [ case "$withval" in
2283 AC_DEFINE(WITH_NISPLUS_HOME)
2292 #################################################
2293 # check for syslog logging
2294 AC_MSG_CHECKING(whether to use syslog logging)
2296 [ --with-syslog Include experimental SYSLOG support (default=no)],
2297 [ case "$withval" in
2300 AC_DEFINE(WITH_SYSLOG)
2309 #################################################
2310 # check for a shared memory profiling support
2311 AC_MSG_CHECKING(whether to use profiling)
2312 AC_ARG_WITH(profiling-data,
2313 [ --with-profiling-data Include gathering source code profile information (default=no)],
2314 [ case "$withval" in
2317 AC_DEFINE(WITH_PROFILE)
2327 #################################################
2328 # check for experimental disk-quotas support
2329 QUOTAOBJS=smbd/noquotas.o
2331 AC_MSG_CHECKING(whether to support disk-quotas)
2333 [ --with-quotas Include experimental disk-quota support (default=no)],
2334 [ case "$withval" in
2339 # Check for kernel 2.4.x quota braindamage...
2340 AC_CACHE_CHECK([for linux 2.4.x quota braindamage..],samba_cv_linux_2_4_quota_braindamage, [
2341 AC_TRY_COMPILE([#include <stdio.h>
2342 #include <sys/types.h>
2343 #include <asm/types.h>
2344 #include <linux/quota.h>
2346 #include <linux/unistd.h>],[struct mem_dqblk D;],
2347 samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
2348 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
2349 AC_DEFINE(LINUX_QUOTAS_2)
2351 AC_DEFINE(LINUX_QUOTAS_1)
2357 QUOTAOBJS=smbd/quotas.o
2358 AC_DEFINE(WITH_QUOTAS)
2368 #################################################
2369 # check for experimental utmp accounting
2371 AC_MSG_CHECKING(whether to support utmp accounting)
2373 [ --with-utmp Include experimental utmp accounting (default=no)],
2374 [ case "$withval" in
2377 AC_DEFINE(WITH_UTMP)
2386 #################################################
2387 # choose native language(s) of man pages
2388 AC_MSG_CHECKING(chosen man pages' language(s))
2389 AC_ARG_WITH(manpages-langs,
2390 [ --with-manpages-langs={en,ja,pl} Choose man pages' language(s). (en)],
2391 [ case "$withval" in
2393 AC_MSG_WARN(--with-manpages-langs called without argument - will use default)
2401 AC_MSG_RESULT($manlangs)
2402 manlangs=`echo $manlangs | sed "s/,/ /"` # replacing commas with spaces to produce a list
2403 AC_SUBST(manlangs)],
2406 AC_MSG_RESULT($manlangs)
2410 #################################################
2411 # should we build libsmbclient?
2413 LIBSMBCLIENT_SHARED=
2415 AC_MSG_CHECKING(whether to build the libsmbclient shared library)
2416 AC_ARG_WITH(libsmbclient,
2417 [ --with-libsmbclient Build the libsmbclient shared library (default=yes)],
2418 [ case "$withval" in
2423 if test $BLDSHARED = true; then
2424 LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
2425 LIBSMBCLIENT=libsmbclient
2428 AC_MSG_RESULT(no shared library support)
2436 #################################################
2437 # these tests are taken from the GNU fileutils package
2438 AC_CHECKING(how to get filesystem space usage)
2441 # Test for statvfs64.
2442 if test $space = no; then
2444 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2446 #if defined(HAVE_UNISTD_H)
2449 #include <sys/types.h>
2450 #include <sys/statvfs.h>
2453 struct statvfs64 fsd;
2454 exit (statvfs64 (".", &fsd));
2456 fu_cv_sys_stat_statvfs64=yes,
2457 fu_cv_sys_stat_statvfs64=no,
2458 fu_cv_sys_stat_statvfs64=cross)])
2459 if test $fu_cv_sys_stat_statvfs64 = yes; then
2461 AC_DEFINE(STAT_STATVFS64)
2465 # Perform only the link test since it seems there are no variants of the
2466 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
2467 # because that got a false positive on SCO OSR5. Adding the declaration
2468 # of a `struct statvfs' causes this test to fail (as it should) on such
2469 # systems. That system is reported to work fine with STAT_STATFS4 which
2470 # is what it gets when this test fails.
2471 if test $space = no; then
2473 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2474 [AC_TRY_LINK([#include <sys/types.h>
2475 #include <sys/statvfs.h>],
2476 [struct statvfs fsd; statvfs (0, &fsd);],
2477 fu_cv_sys_stat_statvfs=yes,
2478 fu_cv_sys_stat_statvfs=no)])
2479 if test $fu_cv_sys_stat_statvfs = yes; then
2481 AC_DEFINE(STAT_STATVFS)
2485 if test $space = no; then
2486 # DEC Alpha running OSF/1
2487 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2488 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2490 #include <sys/param.h>
2491 #include <sys/types.h>
2492 #include <sys/mount.h>
2497 exit (statfs (".", &fsd, sizeof (struct statfs)));
2499 fu_cv_sys_stat_statfs3_osf1=yes,
2500 fu_cv_sys_stat_statfs3_osf1=no,
2501 fu_cv_sys_stat_statfs3_osf1=no)])
2502 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2503 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2505 AC_DEFINE(STAT_STATFS3_OSF1)
2509 if test $space = no; then
2511 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2512 member (AIX, 4.3BSD)])
2513 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2515 #ifdef HAVE_SYS_PARAM_H
2516 #include <sys/param.h>
2518 #ifdef HAVE_SYS_MOUNT_H
2519 #include <sys/mount.h>
2521 #ifdef HAVE_SYS_VFS_H
2522 #include <sys/vfs.h>
2528 exit (statfs (".", &fsd));
2530 fu_cv_sys_stat_statfs2_bsize=yes,
2531 fu_cv_sys_stat_statfs2_bsize=no,
2532 fu_cv_sys_stat_statfs2_bsize=no)])
2533 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2534 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2536 AC_DEFINE(STAT_STATFS2_BSIZE)
2540 if test $space = no; then
2542 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2543 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2544 [AC_TRY_RUN([#include <sys/types.h>
2545 #include <sys/statfs.h>
2549 exit (statfs (".", &fsd, sizeof fsd, 0));
2551 fu_cv_sys_stat_statfs4=yes,
2552 fu_cv_sys_stat_statfs4=no,
2553 fu_cv_sys_stat_statfs4=no)])
2554 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2555 if test $fu_cv_sys_stat_statfs4 = yes; then
2557 AC_DEFINE(STAT_STATFS4)
2561 if test $space = no; then
2563 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2564 member (4.4BSD and NetBSD)])
2565 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2566 [AC_TRY_RUN([#include <sys/types.h>
2567 #ifdef HAVE_SYS_PARAM_H
2568 #include <sys/param.h>
2570 #ifdef HAVE_SYS_MOUNT_H
2571 #include <sys/mount.h>
2577 exit (statfs (".", &fsd));
2579 fu_cv_sys_stat_statfs2_fsize=yes,
2580 fu_cv_sys_stat_statfs2_fsize=no,
2581 fu_cv_sys_stat_statfs2_fsize=no)])
2582 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2583 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2585 AC_DEFINE(STAT_STATFS2_FSIZE)
2589 if test $space = no; then
2591 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2592 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2593 [AC_TRY_RUN([#include <sys/types.h>
2594 #ifdef HAVE_SYS_PARAM_H
2595 #include <sys/param.h>
2597 #ifdef HAVE_SYS_MOUNT_H
2598 #include <sys/mount.h>
2600 #ifdef HAVE_SYS_FS_TYPES_H
2601 #include <sys/fs_types.h>
2606 /* Ultrix's statfs returns 1 for success,
2607 0 for not mounted, -1 for failure. */
2608 exit (statfs (".", &fsd) != 1);
2610 fu_cv_sys_stat_fs_data=yes,
2611 fu_cv_sys_stat_fs_data=no,
2612 fu_cv_sys_stat_fs_data=no)])
2613 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2614 if test $fu_cv_sys_stat_fs_data = yes; then
2616 AC_DEFINE(STAT_STATFS2_FS_DATA)
2621 # As a gating factor for large file support, in order to
2622 # use <4GB files we must have the following minimal support
2624 # long long, and a 64 bit off_t or off64_t.
2625 # If we don't have all of these then disable large
2628 AC_MSG_CHECKING([if large file support can be enabled])
2630 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2631 #include <sys/types.h>
2637 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2638 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2639 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2641 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
2643 AC_ARG_WITH(spinlocks,
2644 [ --with-spinlocks Use spin locks instead of fcntl locks (default=no) ])
2645 if test "x$with_spinlocks" = "xyes"; then
2646 AC_DEFINE(USE_SPINLOCKS)
2650 AC_DEFINE(SPARC_SPINLOCKS)
2653 i386|i486|i586|i686)
2654 AC_DEFINE(INTEL_SPINLOCKS)
2658 AC_DEFINE(MIPS_SPINLOCKS)
2662 AC_DEFINE(POWERPC_SPINLOCKS)
2667 #################################################
2668 # check for ACL support
2670 AC_MSG_CHECKING(whether to support ACLs)
2671 AC_ARG_WITH(acl-support,
2672 [ --with-acl-support Include ACL support (default=no)],
2673 [ case "$withval" in
2678 AC_MSG_RESULT(Using UnixWare ACLs)
2679 AC_DEFINE(HAVE_UNIXWARE_ACLS)
2682 AC_MSG_RESULT(Using solaris ACLs)
2683 AC_DEFINE(HAVE_SOLARIS_ACLS)
2686 AC_MSG_RESULT(Using HPUX ACLs)
2687 AC_DEFINE(HAVE_HPUX_ACLS)
2690 AC_MSG_RESULT(Using IRIX ACLs)
2691 AC_DEFINE(HAVE_IRIX_ACLS)
2694 AC_MSG_RESULT(Using AIX ACLs)
2695 AC_DEFINE(HAVE_AIX_ACLS)
2698 AC_MSG_RESULT(Using Tru64 ACLs)
2699 AC_DEFINE(HAVE_TRU64_ACLS)
2703 AC_CHECK_LIB(acl,acl_get_file)
2704 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2705 AC_TRY_LINK([#include <sys/types.h>
2706 #include <sys/acl.h>],
2707 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2708 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2709 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2710 AC_MSG_RESULT(Using posix ACLs)
2711 AC_DEFINE(HAVE_POSIX_ACLS)
2712 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2713 AC_TRY_LINK([#include <sys/types.h>
2714 #include <sys/acl.h>],
2715 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2716 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2717 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2718 AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2726 AC_DEFINE(HAVE_NO_ACLS)
2729 AC_DEFINE(HAVE_NO_ACLS)
2733 #################################################
2734 # check for sendfile support
2736 AC_MSG_CHECKING(whether to support sendfile)
2737 AC_ARG_WITH(sendfile-support,
2738 [ --with-sendfile-support Include sendfile support (default=no)],
2739 [ case "$withval" in
2744 AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
2745 AC_TRY_LINK([#include <sys/sendfile.h>],
2750 ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
2752 samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
2754 AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[
2755 AC_TRY_LINK([#include <sys/sendfile.h>],
2760 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
2762 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
2764 # Try and cope with broken Linux sendfile....
2765 AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
2767 #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
2768 #undef _FILE_OFFSET_BITS
2770 #include <sys/sendfile.h>],
2775 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
2777 samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
2779 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
2780 AC_DEFINE(HAVE_SENDFILE64)
2781 AC_DEFINE(LINUX_SENDFILE_API)
2782 AC_DEFINE(WITH_SENDFILE)
2783 elif test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
2784 AC_DEFINE(HAVE_SENDFILE)
2785 AC_DEFINE(LINUX_SENDFILE_API)
2786 AC_DEFINE(WITH_SENDFILE)
2787 elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
2788 AC_DEFINE(LINUX_BROKEN_SENDFILE_API)
2789 AC_DEFINE(WITH_SENDFILE)
2796 AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
2798 #include <sys/types.h>
2799 #include <sys/socket.h>
2800 #include <sys/uio.h>],
2803 off_t offset, nwritten;
2806 hdr->headers = &hdtrl;
2808 hdr->trailers = NULL;
2810 hdtrl.iov_base = NULL;
2812 int ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
2814 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
2816 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
2817 AC_DEFINE(HAVE_SENDFILE)
2818 AC_DEFINE(FREEBSD_SENDFILE_API)
2819 AC_DEFINE(WITH_SENDFILE)
2826 AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
2828 #include <sys/socket.h>
2829 #include <sys/uio.h>],
2833 struct iovec hdtrl[2];
2837 hdtrl[0].iov_base = 0;
2838 hdtrl[0].iov_len = 0;
2840 nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
2842 samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
2843 if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
2844 AC_DEFINE(HAVE_SENDFILE64)
2845 AC_DEFINE(HPUX_SENDFILE_API)
2846 AC_DEFINE(WITH_SENDFILE)
2851 AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[
2853 #include <sys/socket.h>
2854 #include <sys/uio.h>],
2858 struct iovec hdtrl[2];
2862 hdtrl[0].iov_base = 0;
2863 hdtrl[0].iov_len = 0;
2865 nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
2867 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
2868 if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
2869 AC_DEFINE(HAVE_SENDFILE)
2870 AC_DEFINE(HPUX_SENDFILE_API)
2871 AC_DEFINE(WITH_SENDFILE)
2890 #################################################
2891 # Check whether winbind is supported on this platform. If so we need to
2892 # build and install client programs (WINBIND_TARGETS), sbin programs
2893 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2895 AC_MSG_CHECKING(whether to build winbind)
2897 # Initially, the value of $host_os decides whether winbind is supported
2905 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2906 WINBIND_NSS_EXTRA_LIBS="-lsocket"
2910 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2914 winbind_no_reason=", unsupported on $host_os"
2918 # Check the setting of --with-winbindd
2920 AC_ARG_WITH(winbind,
2921 [ --with-winbind Build winbind (default, if supported by OS)],
2934 # We need unix domain sockets for winbind
2936 if test x"$HAVE_WINBIND" = x"yes"; then
2937 if test x"$samba_cv_unixsocket" = x"no"; then
2938 winbind_no_reason=", no unix domain socket support on $host_os"
2943 # Display test results
2948 WINBIND_PAM_PROGS=""
2950 if test x"$HAVE_WINBIND" = x"yes"; then
2952 AC_DEFINE(WITH_WINBIND)
2954 WINBIND_TARGETS="bin/wbinfo"
2955 WINBIND_STARGETS="bin/winbindd"
2956 if test x"$BLDSHARED" = x"true"; then
2957 WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
2958 if test x"$with_pam" = x"yes"; then
2959 WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
2963 AC_MSG_RESULT(no$winbind_no_reason)
2967 # Substitution time!
2969 AC_SUBST(WINBIND_TARGETS)
2970 AC_SUBST(WINBIND_STARGETS)
2971 AC_SUBST(WINBIND_LTARGETS)
2972 AC_SUBST(WINBIND_PAM_TARGETS)
2973 AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
2974 AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
2976 # Solaris has some extra fields in struct passwd that need to be
2977 # initialised otherwise nscd crashes. Unfortunately autoconf < 2.50
2978 # doesn't have the AC_CHECK_MEMBER macro which would be handy for checking
2981 #AC_CHECK_MEMBER(struct passwd.pw_comment,
2982 # AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),
2983 # [#include <pwd.h>])
2985 AC_CACHE_CHECK([whether struct passwd has pw_comment],samba_cv_passwd_pw_comment, [
2986 AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_comment;],
2987 samba_cv_passwd_pw_comment=yes,samba_cv_passwd_pw_comment=no)])
2988 if test x"$samba_cv_passwd_pw_comment" = x"yes"; then
2989 AC_DEFINE(HAVE_PASSWD_PW_COMMENT)
2992 #AC_CHECK_MEMBER(struct passwd.pw_age,
2993 # AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),
2994 # [#include <pwd.h>])
2996 AC_CACHE_CHECK([whether struct passwd has pw_age],samba_cv_passwd_pw_age, [
2997 AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_age;],
2998 samba_cv_passwd_pw_age=yes,samba_cv_passwd_pw_age=no)])
2999 if test x"$samba_cv_passwd_pw_age" = x"yes"; then
3000 AC_DEFINE(HAVE_PASSWD_PW_AGE)
3003 #################################################
3004 # Check to see if we should use the included popt
3006 AC_ARG_WITH(included-popt,
3007 [ --with-included-popt use bundled popt library, not from system],
3018 if test x"$INCLUDED_POPT" != x"yes"; then
3019 AC_CHECK_LIB(popt, poptGetContext,
3020 INCLUDED_POPT=no, INCLUDED_POPT=yes)
3023 AC_MSG_CHECKING(whether to use included popt)
3024 if test x"$INCLUDED_POPT" = x"yes"; then
3026 BUILD_POPT='$(POPT_OBJS)'
3027 FLAGS1="-I$srcdir/popt"
3032 AC_SUBST(BUILD_POPT)
3035 #################################################
3036 # Check if the user wants Python
3038 # At the moment, you can use this to set which Python binary to link
3039 # against. (Libraries built for Python2.2 can't be used by 2.1,
3040 # though they can coexist in different directories.) In the future
3041 # this might make the Python stuff be built by default.
3044 [ --with-python=PYTHONNAME build Python libraries],
3045 [ case "${withval-python}" in
3050 PYTHON=${withval-python}
3055 #################################################
3056 # do extra things if we are running insure
3058 if test "${ac_cv_prog_CC}" = "insure"; then
3059 CPPFLAGS="$CPPFLAGS -D__INSURE__"
3062 #################################################
3063 # final configure stuff
3065 AC_MSG_CHECKING([configure summary])
3066 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
3068 AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
3069 AC_MSG_WARN([cannot run when cross-compiling]))
3074 # I added make files that are outside /source directory.
3075 # I know this is not a good solution, will work out a better
3076 # solution soon. --simo
3077 AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile ../examples/sam/Makefile)
3079 #################################################
3080 # Print very concise instructions on building/use
3081 if test "x$enable_dmalloc" = xyes
3083 AC_MSG_RESULT([Note: The dmalloc debug library will be included. To turn it on use])
3084 AC_MSG_RESULT([ \$ eval \`dmalloc samba\`.])