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 codepagedir="\$(DATADIR)/samba/codepages"
15 configdir="${sysconfdir}/samba"
16 lockdir="\${VARDIR}/cache/samba"
17 piddir="\$(VARDIR)/run/samba"
18 logfilebase="\${VARDIR}/log/samba"
19 privatedir="\${CONFIGDIR}/private"
20 swatdir="\${DATADIR}/samba/swat",
21 codepagedir="\$(LIBDIR)/codepages"
22 configdir="\$(LIBDIR)"
23 logfilebase="\$(VARDIR)"
24 lockdir="\${VARDIR}/locks"
25 piddir="\$(VARDIR)/locks"
26 privatedir="\${prefix}/private"
27 swatdir="\${prefix}/swat")
29 #################################################
30 # set private directory location
31 AC_ARG_WITH(privatedir,
32 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
36 # Just in case anybody calls it without argument
38 AC_MSG_WARN([--with-privatedir called without argument - will use default])
45 #################################################
46 # set lock directory location
48 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
52 # Just in case anybody calls it without argument
54 AC_MSG_WARN([--with-lockdir called without argument - will use default])
61 #################################################
62 # set pid directory location
64 [ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks)],
68 # Just in case anybody calls it without argument
70 AC_MSG_WARN([--with-piddir called without argument - will use default])
77 #################################################
78 # set SWAT directory location
80 [ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)],
84 # Just in case anybody does it
86 AC_MSG_WARN([--with-swatdir called without argument - will use default])
93 #################################################
94 # set configuration directory location
95 AC_ARG_WITH(configdir,
96 [ --with-configdir=DIR Where to put configuration files (\$libdir)],
100 # Just in case anybody does it
102 AC_MSG_WARN([--with-configdir called without argument - will use default])
109 #################################################
110 # set codepage directory location
111 AC_ARG_WITH(codepagedir,
112 [ --with-codepagedir=DIR Where to put codepage files (\$libdir/codepages)],
116 # Just in case anybody does it
118 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
121 codepagedir="$withval"
125 #################################################
126 # set log directory location
127 AC_ARG_WITH(logfilebase,
128 [ --with-logfilebase=DIR Where to put log files (\$(VARDIR))],
132 # Just in case anybody does it
134 AC_MSG_WARN([--with-logfilebase called without argument - will use default])
137 logfilebase="$withval"
141 AC_SUBST(codepagedir)
145 AC_SUBST(logfilebase)
151 dnl Unique-to-Samba variables we'll be playing with.
165 AC_SUBST(LIBSMBCLIENT_SHARED)
167 # compile with optimisation and without debugging by default
168 CFLAGS="-O ${CFLAGS}"
171 [ --enable-debug Turn on compiler debugging information (default=no)],
172 [if eval "test x$enable_debug = xyes"; then
173 CFLAGS="${CFLAGS} -g"
176 AC_ARG_ENABLE(developer, [ --enable-developer turn on developer warnings and debugging [default=no]],
177 [if eval "test x$enable_developer = xyes"; then
178 CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
181 AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer turn on developer warnings and debugging, except -Wstrict-prototypes [default=no]],
182 [if eval "test x$enable_krb5developer = xyes"; then
183 CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
186 AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc enable heap debugging [default=no]])
188 if test "x$enable_dmalloc" = xyes
190 AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
191 AC_DEFINE(DMALLOC_FUNC_CHECK, 1,
192 [Define to check invariants around some common functions])
193 LIBS="$LIBS -ldmalloc"
196 dnl Checks for programs.
201 dnl needed before AC_TRY_COMPILE
204 dnl Check if C compiler understands -c and -o at the same time
206 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
213 dnl Check if the C compiler understands volatile (it should, being ANSI).
214 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
215 AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
216 samba_cv_volatile=yes,samba_cv_volatile=no)])
217 if test x"$samba_cv_volatile" = x"yes"; then
218 AC_DEFINE(HAVE_VOLATILE)
224 dnl Add #include for broken IRIX header files
226 *irix6*) AC_ADD_INCLUDE(<standards.h>)
230 AC_VALIDATE_CACHE_SYSTEM_TYPE
235 # Config CPPFLAG settings for strange OS's that must be set
236 # before other tests.
239 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
243 # mmap on HPUX is completely broken...
244 AC_DEFINE(MMAP_BLACKLIST)
245 if test $ac_cv_prog_cc_Ae = yes; then
246 CPPFLAGS="$CPPFLAGS -Ae"
249 # Defines needed for HPUX support.
250 # HPUX has bigcrypt but (sometimes?) doesn't use it for
251 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
255 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
256 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
257 AC_DEFINE(_HPUX_SOURCE)
258 AC_DEFINE(_POSIX_SOURCE)
259 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
260 AC_DEFINE(_MAX_ALIGNMENT,4)
263 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
264 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
265 AC_DEFINE(_HPUX_SOURCE)
266 AC_DEFINE(_POSIX_SOURCE)
267 AC_DEFINE(_LARGEFILE64_SOURCE)
268 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
269 AC_DEFINE(_MAX_ALIGNMENT,4)
276 # CRAY Unicos has broken const handling
278 AC_MSG_RESULT([disabling const])
279 CPPFLAGS="$CPPFLAGS -Dconst="
283 # AIX4.x doesn't even admit to having large
284 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
287 AC_MSG_RESULT([enabling large file support])
288 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
289 AC_DEFINE(_LARGE_FILES)
292 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
293 # to the existance of large files..
294 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
295 # recommendations on large file support, however it makes the
296 # compile work using gcc 2.7 and 2.8, whereas using the Sun
297 # recommendation makes the compile fail on gcc2.7. JRA.
301 5.0*|5.1*|5.2*|5.3*|5.5*)
302 AC_MSG_RESULT([no large file support])
305 AC_MSG_RESULT([enabling large file support])
306 if test "$ac_cv_prog_gcc" = yes; then
307 ${CC-cc} -v >conftest.c 2>&1
308 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
310 case "$ac_cv_gcc_compiler_version_number" in
311 *"gcc version 2.6"*|*"gcc version 2.7"*)
312 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
313 AC_DEFINE(_LARGEFILE64_SOURCE)
316 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
317 AC_DEFINE(_LARGEFILE64_SOURCE)
318 AC_DEFINE(_FILE_OFFSET_BITS,64)
323 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
324 AC_DEFINE(_LARGEFILE64_SOURCE)
325 AC_DEFINE(_FILE_OFFSET_BITS,64)
331 # Tests needed for SINIX large file support.
334 if test $host = mips-sni-sysv4 ; then
335 AC_MSG_CHECKING([for LFS support])
336 old_CPPFLAGS="$CPPFLAGS"
337 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
341 #if _LFS64_LARGEFILE == 1
346 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
347 CPPFLAGS="$old_CPPFLAGS"
348 if test x$SINIX_LFS_SUPPORT = xyes ; then
349 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
350 AC_DEFINE(_LARGEFILE64_SOURCE)
351 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
352 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
353 LIBS="`getconf LFS64_LIBS` $LIBS"
355 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
359 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
362 AC_MSG_CHECKING([for LFS support])
363 old_CPPFLAGS="$CPPFLAGS"
364 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
367 #include <sys/utsname.h>
369 #if _LFS64_LARGEFILE == 1
374 /* Ensure this is glibc 2.2 or higher */
375 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
376 int libc_major = __GLIBC__;
377 int libc_minor = __GLIBC_MINOR__;
385 /* Ensure this is kernel 2.4 or higher */
388 release = uts.release;
389 major = atoi(strsep(&release, "."));
390 minor = atoi(strsep(&release, "."));
392 if (major > 2 || (major == 2 && minor > 3))
399 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
400 CPPFLAGS="$old_CPPFLAGS"
401 if test x$LINUX_LFS_SUPPORT = xyes ; then
402 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
403 AC_DEFINE(_LARGEFILE64_SOURCE)
404 AC_DEFINE(_FILE_OFFSET_BITS,64)
405 AC_DEFINE(_GNU_SOURCE)
407 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
411 AC_MSG_CHECKING([for LFS support])
412 old_CPPFLAGS="$CPPFLAGS"
413 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
417 #if _LFS64_LARGEFILE == 1
422 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
423 CPPFLAGS="$old_CPPFLAGS"
424 if test x$GLIBC_LFS_SUPPORT = xyes ; then
425 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
426 AC_DEFINE(_LARGEFILE64_SOURCE)
427 AC_DEFINE(_GNU_SOURCE)
429 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
439 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
440 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
441 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
442 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
443 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
444 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
445 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
446 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h lber.h dlfcn.h)
449 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
450 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
454 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
455 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
456 if test x"$ac_cv_header_shadow_h" = x"yes"; then
457 AC_DEFINE(HAVE_SHADOW_H)
461 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
462 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
463 AC_CHECK_HEADERS(stropts.h poll.h)
464 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
465 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
467 # For experimental utmp support (lastlog on some BSD-like systems)
468 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
470 # For quotas on Veritas VxFS filesystems
471 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
473 # For quotas on Linux XFS filesystems
474 AC_CHECK_HEADERS(linux/xqm.h)
476 AC_CHECK_SIZEOF(int,cross)
477 AC_CHECK_SIZEOF(long,cross)
478 AC_CHECK_SIZEOF(short,cross)
493 AC_CHECK_TYPE(ino_t,unsigned)
494 AC_CHECK_TYPE(loff_t,off_t)
495 AC_CHECK_TYPE(offset_t,loff_t)
496 AC_CHECK_TYPE(ssize_t, int)
497 AC_CHECK_TYPE(wchar_t, unsigned short)
499 ############################################
500 # for cups support we need libcups, and a handful of header files
502 AC_CHECK_LIB(cups,httpConnect)
504 # I wonder if there is a nicer way of doing this?
506 if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
507 AC_CHECK_HEADERS(cups/cups.h cups/language.h)
508 if test x"$ac_cv_header_cups_cups_h" = x"yes"; then
509 if test x"$ac_cv_header_cups_language_h" = x"yes"; then
515 ############################################
516 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the new VFS code
517 AC_CHECK_FUNCS(dlopen)
518 if test x"$ac_cv_func_dlopen" = x"no"; then
519 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
520 AC_DEFINE(HAVE_DLOPEN)])
522 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
524 ############################################
525 # check if the compiler can do immediate structures
526 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
530 typedef struct {unsigned x;} FOOBAR;
531 #define X_FOOBAR(x) ((FOOBAR) { x })
532 #define FOO_ONE X_FOOBAR(1)
540 samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
541 if test x"$samba_cv_immediate_structures" = x"yes"; then
542 AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
545 ############################################
546 # check for unix domain sockets
547 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
549 #include <sys/types.h>
552 #include <sys/socket.h>
553 #include <sys/un.h>],
555 struct sockaddr_un sunaddr;
556 sunaddr.sun_family = AF_UNIX;
558 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
559 if test x"$samba_cv_unixsocket" = x"yes"; then
560 AC_DEFINE(HAVE_UNIXSOCKET)
564 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
566 #include <sys/types.h>
571 #include <sys/socket.h>],[socklen_t i = 0],
572 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
573 if test x"$samba_cv_socklen_t" = x"yes"; then
574 AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
577 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
579 #include <sys/types.h>
584 #include <signal.h>],[sig_atomic_t i = 0],
585 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
586 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
587 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
590 # stupid headers have the functions but no declaration. grrrr.
591 AC_HAVE_DECL(errno, [#include <errno.h>])
592 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
593 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
594 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
595 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
596 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
597 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
599 # and glibc has setresuid under linux but the function does
600 # nothing until kernel 2.1.44! very dumb.
601 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
602 AC_TRY_RUN([#include <errno.h>
603 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
604 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
605 if test x"$samba_cv_have_setresuid" = x"yes"; then
606 AC_DEFINE(HAVE_SETRESUID)
609 # Do the same check for setresguid...
611 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
612 AC_TRY_RUN([#include <unistd.h>
614 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
615 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
616 if test x"$samba_cv_have_setresgid" = x"yes"; then
617 AC_DEFINE(HAVE_SETRESGID)
622 ###############################################
623 # test for where we get crypt() from
624 AC_CHECK_FUNCS(crypt)
625 if test x"$ac_cv_func_crypt" = x"no"; then
626 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
627 AC_DEFINE(HAVE_CRYPT)])
631 ###############################################
632 # Readline included by default unless explicitly asked not to
633 test "${with_readline+set}" != "set" && with_readline=yes
635 # test for where we get readline() from
636 AC_MSG_CHECKING(whether to use readline)
637 AC_ARG_WITH(readline,
638 [ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
639 [ case "$with_readline" in
643 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
644 AC_CHECK_HEADERS(readline/history.h)
646 AC_CHECK_HEADERS(readline.h readline/readline.h,[
647 for termlib in ncurses curses termcap terminfo termlib; do
648 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
650 AC_CHECK_LIB(readline, rl_callback_handler_install,
651 [TERMLIBS="-lreadline $TERMLIBS"
652 AC_DEFINE(HAVE_LIBREADLINE)
653 break], [TERMLIBS=], $TERMLIBS)])
661 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
662 # alternate readline path
664 _cppflags=${CPPFLAGS}
666 # Add additional search path
667 LDFLAGS="-L$with_readline/lib $LDFLAGS"
668 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
670 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
671 AC_CHECK_HEADERS(readline/history.h)
673 AC_CHECK_HEADERS(readline.h readline/readline.h,[
674 for termlib in ncurses curses termcap terminfo termlib; do
675 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
677 AC_CHECK_LIB(readline, rl_callback_handler_install,
678 [TERMLDFLAGS="-L$with_readline/lib"
679 TERMCPPFLAGS="-I$with_readline/include"
680 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
681 TERMLIBS="-lreadline $TERMLIBS"
682 AC_DEFINE(HAVE_LIBREADLINE)
683 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
691 AC_SUBST(TERMLDFLAGS)
693 # The readline API changed slightly from readline3 to readline4, so
694 # code will generate warnings on one of them unless we have a few
696 AC_CHECK_LIB(readline, rl_completion_matches,
697 [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1,
698 [Do we have rl_completion_matches?])],
702 # The following test taken from the cvs sources
703 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
704 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
705 # libsocket.so which has a bad implementation of gethostbyname (it
706 # only looks in /etc/hosts), so we only look for -lsocket if we need
708 AC_CHECK_FUNCS(connect)
709 if test x"$ac_cv_func_connect" = x"no"; then
712 *) AC_CHECK_LIB(nsl_s, printf) ;;
716 *) AC_CHECK_LIB(nsl, printf) ;;
720 *) AC_CHECK_LIB(socket, connect) ;;
724 *) AC_CHECK_LIB(inet, connect) ;;
726 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
728 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
729 test x"$ac_cv_lib_inet_connect" = x"yes"; then
730 # ac_cv_func_connect=yes
731 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
732 AC_DEFINE(HAVE_CONNECT)
736 ###############################################
737 # test for where we get get_yp_default_domain() from
738 AC_CHECK_FUNCS(yp_get_default_domain)
739 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
740 AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
741 AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)])
744 # Check if we have execl, if not we need to compile smbrun.
745 AC_CHECK_FUNCS(execl)
746 if test x"$ac_cv_func_execl" = x"no"; then
752 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
753 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
754 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
755 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
756 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)
757 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
758 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
759 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
760 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
761 AC_CHECK_FUNCS(syslog vsyslog)
762 # setbuffer is needed for smbtorture
763 AC_CHECK_FUNCS(setbuffer)
765 # syscall() is needed for smbwrapper.
766 AC_CHECK_FUNCS(syscall)
768 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
769 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
770 AC_CHECK_FUNCS(__getcwd _getcwd)
771 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
772 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
773 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
774 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
775 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
776 AC_CHECK_FUNCS(_write __write _fork __fork)
777 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
778 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
779 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
780 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
781 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
784 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
787 if test x$ac_cv_func_stat64 = xno ; then
788 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
790 #if defined(HAVE_UNISTD_H)
793 #include <sys/stat.h>
794 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
795 AC_MSG_RESULT([$ac_cv_func_stat64])
796 if test x$ac_cv_func_stat64 = xyes ; then
797 AC_DEFINE(HAVE_STAT64)
801 if test x$ac_cv_func_lstat64 = xno ; then
802 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
804 #if defined(HAVE_UNISTD_H)
807 #include <sys/stat.h>
808 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
809 AC_MSG_RESULT([$ac_cv_func_lstat64])
810 if test x$ac_cv_func_lstat64 = xyes ; then
811 AC_DEFINE(HAVE_LSTAT64)
815 if test x$ac_cv_func_fstat64 = xno ; then
816 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
818 #if defined(HAVE_UNISTD_H)
821 #include <sys/stat.h>
822 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
823 AC_MSG_RESULT([$ac_cv_func_fstat64])
824 if test x$ac_cv_func_fstat64 = xyes ; then
825 AC_DEFINE(HAVE_FSTAT64)
829 #####################################
830 # we might need the resolv library on some systems
831 AC_CHECK_LIB(resolv, dn_expand)
834 # Check for the functions putprpwnam, set_auth_parameters,
835 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
836 # Needed for OSF1 and HPUX.
839 AC_LIBTESTFUNC(security, putprpwnam)
840 AC_LIBTESTFUNC(sec, putprpwnam)
842 AC_LIBTESTFUNC(security, set_auth_parameters)
843 AC_LIBTESTFUNC(sec, set_auth_parameters)
845 # UnixWare 7.x has its getspnam in -lgen
846 AC_LIBTESTFUNC(gen, getspnam)
848 AC_LIBTESTFUNC(security, getspnam)
849 AC_LIBTESTFUNC(sec, getspnam)
851 AC_LIBTESTFUNC(security, bigcrypt)
852 AC_LIBTESTFUNC(sec, bigcrypt)
854 AC_LIBTESTFUNC(security, getprpwnam)
855 AC_LIBTESTFUNC(sec, getprpwnam)
857 # this bit needs to be modified for each OS that is suported by
858 # smbwrapper. You need to specify how to created a shared library and
859 # how to compile C code to produce PIC object files
861 # these are the defaults, good for lots of systems
869 # Assume non-shared by default and override below
871 AC_MSG_CHECKING([ability to build shared libraries])
873 # and these are for particular systems
875 *linux*) AC_DEFINE(LINUX)
878 DYNEXP="-Wl,--export-dynamic"
880 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
885 LDSHFLAGS="-h \$@ -G"
886 if test "${GCC}" = "yes"; then
893 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
895 *sunos*) AC_DEFINE(SUNOS4)
897 LDSHFLAGS="-Wl,-h,\$@ -G"
898 PICFLAG="-KPIC" # Is this correct for SunOS
900 *bsd*) BLDSHARED="true"
901 LDSHFLAGS="-Wl,-soname,\$@ -shared"
903 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
905 *irix*) AC_DEFINE(IRIX)
907 *irix6*) AC_DEFINE(IRIX6)
910 ATTEMPT_WRAP32_BUILD=yes
912 LDSHFLAGS="-soname \$@ -shared"
914 if test "${GCC}" = "yes"; then
919 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
921 *aix*) AC_DEFINE(AIX)
923 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
924 PICFLAG="-O2 -qmaxmem=6000"
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 +h \$@"
937 AC_DEFINE(STAT_ST_BLOCKSIZE,8192)
939 *qnx*) AC_DEFINE(QNX);;
940 *osf*) AC_DEFINE(OSF1)
942 LDSHFLAGS="-Wl,-soname,\$@ -shared"
948 *unixware*) AC_DEFINE(UNIXWARE)
950 LDSHFLAGS="-Wl,-soname,\$@ -shared"
953 *next2*) AC_DEFINE(NEXT2);;
954 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
958 if [ test "$GCC" != yes ]; then
959 AC_DEFINE(HAVE_MEMSET)
965 AC_DEFINE(RELIANTUNIX)
971 if [ test "$GCC" != yes ]; then
972 AC_DEFINE(HAVE_MEMSET)
978 AC_MSG_RESULT($BLDSHARED)
979 AC_MSG_CHECKING([linker flags for shared libraries])
980 AC_MSG_RESULT([$LDSHFLAGS])
981 AC_MSG_CHECKING([compiler flags for position-independent code])
982 AC_MSG_RESULT([$PICFLAGS])
984 #######################################################
985 # test whether building a shared library actually works
986 if test $BLDSHARED = true; then
987 AC_CACHE_CHECK([whether building shared libraries actually works],
988 [ac_cv_shlib_works],[
990 # try building a trivial shared library
991 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c &&
992 $CC $CPPFLAGS $CFLAGS $LDSHFLAGS -o shlib.so shlib.po &&
993 ac_cv_shlib_works=yes
994 rm -f shlib.so shlib.po
996 if test $ac_cv_shlib_works = no; then
1002 # this updates our target list if we can build shared libs
1003 if test $BLDSHARED = true; then
1004 LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
1006 LIBSMBCLIENT_SHARED=
1011 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
1012 AC_TRY_RUN([#include <stdio.h>
1013 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
1014 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
1015 if test x"$samba_cv_have_longlong" = x"yes"; then
1016 AC_DEFINE(HAVE_LONGLONG)
1020 # Check if the compiler supports the LL prefix on long long integers.
1023 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
1024 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
1025 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
1026 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
1027 AC_DEFINE(COMPILER_SUPPORTS_LL)
1031 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
1032 AC_TRY_RUN([#include <stdio.h>
1033 #include <sys/stat.h>
1034 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
1035 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
1036 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
1037 AC_DEFINE(SIZEOF_OFF_T,8)
1040 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
1042 #if defined(HAVE_UNISTD_H)
1046 #include <sys/stat.h>
1047 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1048 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
1049 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
1050 AC_DEFINE(HAVE_OFF64_T)
1053 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
1054 AC_TRY_RUN([#include <stdio.h>
1055 #include <sys/stat.h>
1056 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
1057 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
1058 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
1059 AC_DEFINE(SIZEOF_INO_T,8)
1062 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
1064 #if defined(HAVE_UNISTD_H)
1068 #include <sys/stat.h>
1069 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1070 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
1071 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
1072 AC_DEFINE(HAVE_INO64_T)
1075 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
1077 #if defined(HAVE_UNISTD_H)
1081 #include <sys/stat.h>
1082 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1083 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
1084 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
1085 AC_DEFINE(HAVE_DEV64_T)
1088 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
1090 #if defined(HAVE_UNISTD_H)
1093 #include <sys/types.h>
1094 #include <dirent.h>],
1095 [struct dirent64 de;],
1096 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
1097 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
1098 AC_DEFINE(HAVE_STRUCT_DIRENT64)
1101 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
1103 #if defined(HAVE_UNISTD_H)
1106 #include <sys/types.h>
1107 main() { dev_t dev; int i = major(dev); return 0; }],
1108 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
1109 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
1110 AC_DEFINE(HAVE_DEVICE_MAJOR_FN)
1113 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
1115 #if defined(HAVE_UNISTD_H)
1118 #include <sys/types.h>
1119 main() { dev_t dev; int i = minor(dev); return 0; }],
1120 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
1121 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
1122 AC_DEFINE(HAVE_DEVICE_MINOR_FN)
1125 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
1126 AC_TRY_RUN([#include <stdio.h>
1127 main() { char c; c=250; exit((c > 0)?0:1); }],
1128 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
1129 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
1130 AC_DEFINE(HAVE_UNSIGNED_CHAR)
1133 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
1134 AC_TRY_COMPILE([#include <sys/types.h>
1135 #include <sys/socket.h>
1136 #include <netinet/in.h>],
1137 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
1138 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
1139 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
1140 AC_DEFINE(HAVE_SOCK_SIN_LEN)
1143 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
1144 AC_TRY_COMPILE([#include <sys/types.h>
1146 void seekdir(DIR *d, long loc) { return; }],[return 0;],
1147 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
1148 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
1149 AC_DEFINE(SEEKDIR_RETURNS_VOID)
1152 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
1153 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
1154 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
1155 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
1156 AC_DEFINE(HAVE_FILE_MACRO)
1159 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
1160 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
1161 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
1162 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
1163 AC_DEFINE(HAVE_FUNCTION_MACRO)
1166 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
1168 #include <sys/time.h>
1170 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
1171 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
1172 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
1173 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
1176 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
1178 #include <sys/types.h>
1180 void foo(const char *format, ...) {
1185 va_start(ap, format);
1186 len = vsnprintf(buf, 0, format, ap);
1188 if (len != 5) exit(1);
1190 va_start(ap, format);
1191 len = vsnprintf(0, 0, format, ap);
1193 if (len != 5) exit(1);
1195 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
1199 main() { foo("hello"); }
1201 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
1202 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
1203 AC_DEFINE(HAVE_C99_VSNPRINTF)
1206 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
1207 AC_TRY_RUN([#include <sys/types.h>
1209 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
1210 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
1211 di->d_name[0] == 0) exit(0); exit(1);} ],
1212 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
1213 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
1214 AC_DEFINE(HAVE_BROKEN_READDIR)
1217 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
1218 AC_TRY_COMPILE([#include <sys/types.h>
1219 #include <utime.h>],
1220 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
1221 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
1222 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
1223 AC_DEFINE(HAVE_UTIMBUF)
1226 dnl utmp and utmpx come in many flavours
1227 dnl We need to check for many of them
1228 dnl But we don't need to do each and every one, because our code uses
1229 dnl mostly just the utmp (not utmpx) fields.
1231 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
1233 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
1234 AC_TRY_COMPILE([#include <sys/types.h>
1236 [struct utmp ut; ut.ut_name[0] = 'a';],
1237 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
1238 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
1239 AC_DEFINE(HAVE_UT_UT_NAME)
1242 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
1243 AC_TRY_COMPILE([#include <sys/types.h>
1245 [struct utmp ut; ut.ut_user[0] = 'a';],
1246 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
1247 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
1248 AC_DEFINE(HAVE_UT_UT_USER)
1251 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
1252 AC_TRY_COMPILE([#include <sys/types.h>
1254 [struct utmp ut; ut.ut_id[0] = 'a';],
1255 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
1256 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
1257 AC_DEFINE(HAVE_UT_UT_ID)
1260 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
1261 AC_TRY_COMPILE([#include <sys/types.h>
1263 [struct utmp ut; ut.ut_host[0] = 'a';],
1264 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
1265 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
1266 AC_DEFINE(HAVE_UT_UT_HOST)
1269 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
1270 AC_TRY_COMPILE([#include <sys/types.h>
1272 [struct utmp ut; time_t t; ut.ut_time = t;],
1273 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
1274 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
1275 AC_DEFINE(HAVE_UT_UT_TIME)
1278 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
1279 AC_TRY_COMPILE([#include <sys/types.h>
1281 [struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
1282 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
1283 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1284 AC_DEFINE(HAVE_UT_UT_TV)
1287 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1288 AC_TRY_COMPILE([#include <sys/types.h>
1290 [struct utmp ut; ut.ut_type = 0;],
1291 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1292 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1293 AC_DEFINE(HAVE_UT_UT_TYPE)
1296 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1297 AC_TRY_COMPILE([#include <sys/types.h>
1299 [struct utmp ut; ut.ut_pid = 0;],
1300 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1301 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1302 AC_DEFINE(HAVE_UT_UT_PID)
1305 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1306 AC_TRY_COMPILE([#include <sys/types.h>
1308 [struct utmp ut; ut.ut_exit.e_exit = 0;],
1309 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1310 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1311 AC_DEFINE(HAVE_UT_UT_EXIT)
1314 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1315 AC_TRY_COMPILE([#include <sys/types.h>
1317 [struct utmp ut; ut.ut_addr = 0;],
1318 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1319 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1320 AC_DEFINE(HAVE_UT_UT_ADDR)
1323 if test x$ac_cv_func_pututline = xyes ; then
1324 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1325 AC_TRY_COMPILE([#include <sys/types.h>
1327 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1328 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1329 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1330 AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1334 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1335 AC_TRY_COMPILE([#include <sys/types.h>
1336 #include <utmpx.h>],
1337 [struct utmpx ux; ux.ut_syslen = 0;],
1338 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1339 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1340 AC_DEFINE(HAVE_UX_UT_SYSLEN)
1344 #################################################
1345 # check for libiconv support
1346 AC_MSG_CHECKING(whether to use libiconv)
1347 AC_ARG_WITH(libiconv,
1348 [ --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
1349 [ case "$withval" in
1355 CFLAGS="$CFLAGS -I$withval/include"
1356 LDFLAGS="$LDFLAGS -L$withval/lib"
1357 AC_CHECK_LIB(iconv, iconv_open)
1358 AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}")
1366 # check for iconv in libc
1367 AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1371 iconv_t cd = iconv_open("ASCII", "UCS-2LE");
1372 if (cd == 0 || cd == (iconv_t)-1) return -1;
1376 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
1377 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1378 AC_DEFINE(HAVE_NATIVE_ICONV)
1382 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1384 #include <sys/types.h>
1387 #define F_GETLEASE 1025
1390 int fd = open("/dev/null", O_RDONLY);
1391 return fcntl(fd, F_GETLEASE, 0) == -1;
1394 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1395 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1396 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1399 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1401 #include <sys/types.h>
1405 #define F_NOTIFY 1026
1408 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1411 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1412 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1413 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1416 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1418 #include <sys/types.h>
1421 #include <sys/file.h>
1423 #define LOCK_MAND 32
1424 #define LOCK_READ 64
1427 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1430 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1431 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1432 AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1438 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1439 AC_TRY_COMPILE([#include <sys/types.h>
1440 #include <fcntl.h>],
1441 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1442 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1443 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1444 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1447 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1448 AC_TRY_RUN([#include <sys/types.h>
1449 #include <sys/capability.h>
1452 if ((cap = cap_get_proc()) == NULL)
1454 cap->cap_effective |= CAP_NETWORK_MGT;
1455 cap->cap_inheritable |= CAP_NETWORK_MGT;
1460 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1461 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1462 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1466 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1467 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1470 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1471 AC_TRY_COMPILE([#include <sys/types.h>
1472 #if defined(HAVE_RPC_RPC_H)
1473 #include <rpc/rpc.h>
1476 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1477 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1478 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1481 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1482 AC_TRY_COMPILE([#include <sys/types.h>
1483 #if defined(HAVE_RPC_RPC_H)
1484 #include <rpc/rpc.h>
1487 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1488 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1489 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1492 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1493 AC_TRY_COMPILE([#include <sys/types.h>
1494 #if defined(HAVE_RPC_RPC_H)
1495 #include <rpc/rpc.h>
1498 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1499 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1500 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1503 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1504 AC_TRY_COMPILE([#include <sys/types.h>
1505 #if defined(HAVE_RPC_RPC_H)
1506 #include <rpc/rpc.h>
1509 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1510 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1511 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1515 dnl Some systems (SCO) have a problem including
1516 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1517 dnl as a #define in <prot.h> and as part of an enum
1521 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1522 AC_TRY_COMPILE([#include <sys/types.h>
1523 #ifdef HAVE_SYS_SECURITY_H
1524 #include <sys/security.h>
1526 #endif /* HAVE_SYS_SECURITY_H */
1527 #if defined(HAVE_RPC_RPC_H)
1528 #include <rpc/rpc.h>
1531 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1532 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1533 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1536 AC_MSG_CHECKING([for test routines])
1537 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1539 AC_MSG_ERROR([cant find test code. Aborting config]),
1540 AC_MSG_WARN([cannot run when cross-compiling]))
1542 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1543 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1544 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1545 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1546 AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1549 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1550 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1551 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1552 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1553 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1554 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1556 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1559 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1560 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1561 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1562 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1563 AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1566 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1567 SAVE_CPPFLAGS="$CPPFLAGS"
1568 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/popt -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
1570 #define REPLACE_GETPASS 1
1571 #define NO_CONFIG_H 1
1572 #define main dont_declare_main
1573 #include "${srcdir-.}/lib/getsmbpass.c"
1575 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1576 CPPFLAGS="$SAVE_CPPFLAGS"
1578 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1579 AC_DEFINE(REPLACE_GETPASS)
1582 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1585 #include <sys/types.h>
1586 #include <netinet/in.h>
1587 #ifdef HAVE_ARPA_INET_H
1588 #include <arpa/inet.h>
1590 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1591 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1592 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1594 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1595 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1596 AC_DEFINE(REPLACE_INET_NTOA)
1599 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1600 AC_TRY_RUN([#include <stdlib.h>
1601 #include <sys/types.h>
1602 #include <sys/stat.h>
1606 char tpl[20]="/tmp/test.XXXXXX";
1607 int fd = mkstemp(tpl);
1608 if (fd == -1) exit(1);
1610 if (fstat(fd, &st) != 0) exit(1);
1611 if ((st.st_mode & 0777) != 0600) exit(1);
1614 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1615 samba_cv_HAVE_SECURE_MKSTEMP=no,
1616 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1617 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1618 AC_DEFINE(HAVE_SECURE_MKSTEMP)
1621 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1622 AC_TRY_RUN([#include <unistd.h>
1623 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1624 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1625 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1626 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1629 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1630 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1631 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1632 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1633 AC_DEFINE(HAVE_ROOT)
1635 AC_MSG_WARN(running as non-root will disable some tests)
1639 # look for a method of finding the list of network interfaces
1641 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1643 #define HAVE_IFACE_AIX 1
1644 #define AUTOCONF_TEST 1
1645 #include "confdefs.h"
1646 #include "${srcdir-.}/lib/interfaces.c"],
1647 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1648 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1649 iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1652 if test $iface = no; then
1653 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1655 #define HAVE_IFACE_IFCONF 1
1656 #define AUTOCONF_TEST 1
1657 #include "confdefs.h"
1658 #include "${srcdir-.}/lib/interfaces.c"],
1659 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1660 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1661 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1665 if test $iface = no; then
1666 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1668 #define HAVE_IFACE_IFREQ 1
1669 #define AUTOCONF_TEST 1
1670 #include "confdefs.h"
1671 #include "${srcdir-.}/lib/interfaces.c"],
1672 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1673 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1674 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1679 ################################################
1680 # look for a method of setting the effective uid
1682 if test $seteuid = no; then
1683 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1685 #define AUTOCONF_TEST 1
1686 #define USE_SETRESUID 1
1687 #include "confdefs.h"
1688 #include "${srcdir-.}/lib/util_sec.c"],
1689 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1690 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1691 seteuid=yes;AC_DEFINE(USE_SETRESUID)
1696 if test $seteuid = no; then
1697 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1699 #define AUTOCONF_TEST 1
1700 #define USE_SETREUID 1
1701 #include "confdefs.h"
1702 #include "${srcdir-.}/lib/util_sec.c"],
1703 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1704 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1705 seteuid=yes;AC_DEFINE(USE_SETREUID)
1709 if test $seteuid = no; then
1710 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1712 #define AUTOCONF_TEST 1
1713 #define USE_SETEUID 1
1714 #include "confdefs.h"
1715 #include "${srcdir-.}/lib/util_sec.c"],
1716 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1717 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1718 seteuid=yes;AC_DEFINE(USE_SETEUID)
1722 if test $seteuid = no; then
1723 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1725 #define AUTOCONF_TEST 1
1726 #define USE_SETUIDX 1
1727 #include "confdefs.h"
1728 #include "${srcdir-.}/lib/util_sec.c"],
1729 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1730 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1731 seteuid=yes;AC_DEFINE(USE_SETUIDX)
1736 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1737 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1738 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1739 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1740 AC_DEFINE(HAVE_MMAP)
1743 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1744 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1745 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1746 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1747 AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1750 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1751 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1752 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1753 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1754 AC_DEFINE(HAVE_FCNTL_LOCK)
1757 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1758 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1759 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1760 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1761 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1766 dnl Don't check for 64 bit fcntl locking if we know that the
1767 dnl glibc2.1 broken check has succeeded.
1770 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1772 #if defined(HAVE_UNISTD_H)
1782 #ifdef HAVE_SYS_FCNTL_H
1783 #include <sys/fcntl.h>
1785 main() { struct flock64 fl64;
1786 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1792 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1794 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1795 AC_DEFINE(HAVE_STRUCT_FLOCK64)
1799 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
1800 AC_TRY_COMPILE([#include <sys/types.h>
1801 #include <sys/stat.h>
1802 #include <unistd.h>],
1803 [struct stat st; st.st_blocks = 0;],
1804 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
1805 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
1806 AC_DEFINE(HAVE_STAT_ST_BLOCKS)
1811 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1813 #ifdef HAVE_SYS_VFS_H
1814 #include <sys/vfs.h>
1816 #ifdef HAVE_SYS_CAPABILITY_H
1817 #include <sys/capability.h>
1820 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1821 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1822 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS)
1827 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1828 AC_TRY_COMPILE([#include <sys/acl.h>
1829 #if defined(HAVE_RPCSVC_NIS_H)
1830 #include <rpcsvc/nis.h>
1833 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1834 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1835 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1839 #################################################
1840 # check for smbwrapper support
1841 AC_MSG_CHECKING(whether to use smbwrapper)
1842 AC_ARG_WITH(smbwrapper,
1843 [ --with-smbwrapper Include SMB wrapper support (default=no) ],
1844 [ case "$withval" in
1847 AC_DEFINE(WITH_SMBWRAPPER)
1848 WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1850 if test x$ATTEMPT_WRAP32_BUILD = x; then
1853 WRAP32=bin/smbwrapper.32.$SHLIBEXT
1856 # Conditions under which smbwrapper should not be built.
1858 if test x$PICFLAG = x; then
1859 echo No support for PIC code - disabling smbwrapper and smbsh
1862 elif test x$ac_cv_func_syscall = xno; then
1863 AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1875 #################################################
1876 # check for AFS clear-text auth support
1877 AC_MSG_CHECKING(whether to use AFS clear-text auth)
1879 [ --with-afs Include AFS clear-text auth support (default=no) ],
1880 [ case "$withval" in
1893 #################################################
1894 # check for the DFS clear-text auth system
1895 AC_MSG_CHECKING(whether to use DFS clear-text auth)
1897 [ --with-dce-dfs Include DCE/DFS clear-text auth support (default=no)],
1898 [ case "$withval" in
1911 #################################################
1912 # see if this box has the RedHat location for kerberos
1913 AC_MSG_CHECKING(for /usr/kerberos)
1914 if test -d /usr/kerberos; then
1915 LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
1916 CFLAGS="$CFLAGS -I/usr/kerberos/include"
1917 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1923 #################################################
1924 # check for location of Kerberos 5 install
1925 AC_MSG_CHECKING(for kerberos 5 install path)
1927 [ --with-krb5=base-dir Locate Kerberos 5 support (default=/usr)],
1928 [ case "$withval" in
1935 CFLAGS="$CFLAGS -I$withval/include"
1936 CPPFLAGS="$CPPFLAGS -I$withval/include"
1937 LDFLAGS="$LDFLAGS -L$withval/lib"
1943 # now check for krb5.h. Some systems have the libraries without the headers!
1944 # note that this check is done here to allow for different kerberos
1946 AC_CHECK_HEADERS(krb5.h)
1948 # now check for gssapi headers. This is also done here to allow for
1949 # different kerberos include paths
1950 AC_CHECK_HEADERS(gssapi/gssapi_generic.h gssapi/gssapi.h)
1952 ##################################################################
1953 # we might need the k5crypto and com_err libraries on some systems
1954 AC_CHECK_LIB(com_err, _et_list, [LIBS="$LIBS -lcom_err"])
1955 AC_CHECK_LIB(k5crypto, krb5_encrypt_data, [LIBS="$LIBS -lk5crypto"])
1957 ########################################################
1958 # now see if we can find the krb5 libs in standard paths
1959 # or as specified above
1960 AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
1961 AC_DEFINE(HAVE_KRB5)])
1963 ########################################################
1964 # now see if we can find the gssapi libs in standard paths
1965 AC_CHECK_LIB(gssapi_krb5, gss_display_status, [LIBS="$LIBS -lgssapi_krb5";
1966 AC_DEFINE(HAVE_GSSAPI)])
1968 ##################################################################
1969 # we might need the lber lib on some systems. To avoid link errors
1970 # this test must be before the libldap test
1971 AC_CHECK_LIB(lber, ber_scanf, [LIBS="$LIBS -llber"])
1973 ########################################################
1974 # now see if we can find the ldap libs in standard paths
1975 if test x$have_ldap != xyes; then
1976 AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
1977 AC_DEFINE(HAVE_LDAP)])
1980 #################################################
1981 # check for automount support
1982 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1983 AC_ARG_WITH(automount,
1984 [ --with-automount Include AUTOMOUNT support (default=no)],
1985 [ case "$withval" in
1988 AC_DEFINE(WITH_AUTOMOUNT)
1997 #################################################
1998 # check for smbmount support
1999 AC_MSG_CHECKING(whether to use SMBMOUNT)
2000 AC_ARG_WITH(smbmount,
2001 [ --with-smbmount Include SMBMOUNT (Linux only) support (default=no)],
2002 [ case "$withval" in
2007 AC_DEFINE(WITH_SMBMOUNT)
2008 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
2011 AC_MSG_ERROR(not on a linux system!)
2025 #################################################
2026 # check for a PAM clear-text auth, accounts, password and session support
2027 with_pam_for_crypt=no
2028 AC_MSG_CHECKING(whether to use PAM)
2030 [ --with-pam Include PAM support (default=no)],
2031 [ case "$withval" in
2036 with_pam_for_crypt=yes
2045 # we can't build a pam module if we don't have pam.
2046 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
2048 #################################################
2049 # check for pam_smbpass support
2050 AC_MSG_CHECKING(whether to use pam_smbpass)
2051 AC_ARG_WITH(pam_smbpass,
2052 [ --with-pam_smbpass Build a PAM module to allow other applications to use our smbpasswd file (default=no)],
2053 [ case "$withval" in
2057 # Conditions under which pam_smbpass should not be built.
2059 if test x$PICFLAG = x; then
2060 AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
2062 elif test x$ac_cv_lib_pam_pam_get_data = xno; then
2063 AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
2066 PAM_MOD="bin/pam_smbpass.so"
2077 ###############################################
2078 # test for where we get crypt() from, but only
2080 if test $with_pam_for_crypt = no; then
2081 AC_CHECK_FUNCS(crypt)
2082 if test x"$ac_cv_func_crypt" = x"no"; then
2083 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
2084 AC_DEFINE(HAVE_CRYPT)])
2089 ## moved after the check for -lcrypt in order to
2090 ## ensure that the necessary libraries are included
2091 ## check checking for truncated salt. Wrapped by the
2092 ## $with_pam_for_crypt variable as above --jerry
2094 if test $with_pam_for_crypt = no; then
2095 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
2096 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
2097 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
2098 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
2099 AC_DEFINE(HAVE_TRUNCATED_SALT)
2105 ########################################################################################
2107 ## TESTS FOR SAM BACKENDS. KEEP THESE GROUPED TOGETHER
2109 ########################################################################################
2111 #################################################
2112 # check for a TDB password database
2113 AC_MSG_CHECKING(whether to use TDB SAM database)
2115 [ --with-tdbsam Include experimental TDB SAM support (default=no)],
2116 [ case "$withval" in
2119 AC_DEFINE(WITH_TDB_SAM)
2128 #################################################
2129 # check for a LDAP password database
2130 AC_MSG_CHECKING(whether to use LDAP SAM database)
2131 AC_ARG_WITH(ldapsam,
2132 [ --with-ldapsam Include experimental LDAP SAM support (default=no)],
2133 [ case "$withval" in
2136 AC_DEFINE(WITH_LDAP_SAM)
2137 LIBS="-lldap -llber $LIBS"
2146 #################################################
2147 # check for a NISPLUS password database
2148 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
2149 AC_ARG_WITH(nisplussam,
2150 [ --with-nisplussam Include NISPLUS SAM support (default=no)],
2151 [ case "$withval" in
2154 AC_DEFINE(WITH_NISPLUS_SAM)
2163 ########################################################################################
2165 ## END OF TESTS FOR SAM BACKENDS.
2167 ########################################################################################
2169 #################################################
2170 # check for a NISPLUS_HOME support
2171 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
2172 AC_ARG_WITH(nisplus-home,
2173 [ --with-nisplus-home Include NISPLUS_HOME support (default=no)],
2174 [ case "$withval" in
2177 AC_DEFINE(WITH_NISPLUS_HOME)
2186 #################################################
2187 # check for the secure socket layer
2188 AC_MSG_CHECKING(whether to use SSL)
2190 [ --with-ssl Include SSL support (default=no)
2191 --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl/include)
2192 --with-ssllib=DIR Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
2193 [ case "$withval" in
2197 withval="/usr/local/ssl" # default
2199 if test "${with_sslinc+set}" = set; then
2201 withval="$with_sslinc"
2204 echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
2205 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
2208 CFLAGS="-I${withval} $CFLAGS"
2214 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
2218 if test "${with_ssllib+set}" = set; then
2220 withval="$with_ssllib"
2223 echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
2224 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
2227 LDFLAGS="-L${withval}/lib $LDFLAGS"
2233 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
2237 LIBS="-lssl -lcrypto $LIBS"
2239 # if test ! -d ${withval}; then
2240 # echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
2244 CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS" # Damn, SSLeay defines its own
2254 #################################################
2255 # check for syslog logging
2256 AC_MSG_CHECKING(whether to use syslog logging)
2258 [ --with-syslog Include experimental SYSLOG support (default=no)],
2259 [ case "$withval" in
2262 AC_DEFINE(WITH_SYSLOG)
2271 #################################################
2272 # check for a shared memory profiling support
2273 AC_MSG_CHECKING(whether to use profiling)
2274 AC_ARG_WITH(profiling-data,
2275 [ --with-profiling-data Include gathering source code profile information (default=no)],
2276 [ case "$withval" in
2279 AC_DEFINE(WITH_PROFILE)
2289 #################################################
2290 # check for experimental disk-quotas support
2291 QUOTAOBJS=smbd/noquotas.o
2293 AC_MSG_CHECKING(whether to support disk-quotas)
2295 [ --with-quotas Include experimental disk-quota support (default=no)],
2296 [ case "$withval" in
2301 # Check for kernel 2.4.x quota braindamage...
2302 AC_CACHE_CHECK([for linux 2.4.x quota braindamage..],samba_cv_linux_2_4_quota_braindamage, [
2303 AC_TRY_COMPILE([#include <stdio.h>
2304 #include <sys/types.h>
2305 #include <asm/types.h>
2306 #include <linux/quota.h>
2308 #include <linux/unistd.h>],[struct mem_dqblk D;],
2309 samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
2310 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
2311 AC_DEFINE(LINUX_QUOTAS_2)
2313 AC_DEFINE(LINUX_QUOTAS_1)
2319 QUOTAOBJS=smbd/quotas.o
2320 AC_DEFINE(WITH_QUOTAS)
2330 #################################################
2331 # check for experimental utmp accounting
2333 AC_MSG_CHECKING(whether to support utmp accounting)
2335 [ --with-utmp Include experimental utmp accounting (default=no)],
2336 [ case "$withval" in
2339 AC_DEFINE(WITH_UTMP)
2348 #################################################
2349 # set private directory location
2350 AC_ARG_WITH(privatedir,
2351 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
2352 [ case "$withval" in
2355 # Just in case anybody calls it without argument
2357 AC_MSG_WARN([--with-privatedir called without argument - will use default])
2358 privatedir='${prefix}/private'
2361 privatedir="$withval"
2364 AC_SUBST(privatedir)],
2365 [privatedir='${prefix}/private'
2366 AC_SUBST(privatedir)]
2369 #################################################
2370 # set lock directory location
2371 AC_ARG_WITH(lockdir,
2372 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
2373 [ case "$withval" in
2376 # Just in case anybody calls it without argument
2378 AC_MSG_WARN([--with-lockdir called without argument - will use default])
2379 lockdir='$(VARDIR)/locks'
2386 [lockdir='$(VARDIR)/locks'
2390 #################################################
2391 # set SWAT directory location
2392 AC_ARG_WITH(swatdir,
2393 [ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)],
2394 [ case "$withval" in
2397 # Just in case anybody does it
2399 AC_MSG_WARN([--with-swatdir called without argument - will use default])
2400 swatdir='${prefix}/swat'
2407 [swatdir='${prefix}/swat'
2411 #################################################
2412 # choose native language(s) of man pages
2413 AC_MSG_CHECKING(chosen man pages' language(s))
2414 AC_ARG_WITH(manpages-langs,
2415 [ --with-manpages-langs={en,ja,pl} Choose man pages' language(s). (en)],
2416 [ case "$withval" in
2418 AC_MSG_WARN(--with-manpages-langs called without argument - will use default)
2426 AC_MSG_RESULT($manlangs)
2427 manlangs=`echo $manlangs | sed "s/,/ /"` # replacing commas with spaces to produce a list
2428 AC_SUBST(manlangs)],
2431 AC_MSG_RESULT($manlangs)
2435 #################################################
2436 # these tests are taken from the GNU fileutils package
2437 AC_CHECKING(how to get filesystem space usage)
2440 # Test for statvfs64.
2441 if test $space = no; then
2443 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2445 #if defined(HAVE_UNISTD_H)
2448 #include <sys/types.h>
2449 #include <sys/statvfs.h>
2452 struct statvfs64 fsd;
2453 exit (statvfs64 (".", &fsd));
2455 fu_cv_sys_stat_statvfs64=yes,
2456 fu_cv_sys_stat_statvfs64=no,
2457 fu_cv_sys_stat_statvfs64=cross)])
2458 if test $fu_cv_sys_stat_statvfs64 = yes; then
2460 AC_DEFINE(STAT_STATVFS64)
2464 # Perform only the link test since it seems there are no variants of the
2465 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
2466 # because that got a false positive on SCO OSR5. Adding the declaration
2467 # of a `struct statvfs' causes this test to fail (as it should) on such
2468 # systems. That system is reported to work fine with STAT_STATFS4 which
2469 # is what it gets when this test fails.
2470 if test $space = no; then
2472 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2473 [AC_TRY_LINK([#include <sys/types.h>
2474 #include <sys/statvfs.h>],
2475 [struct statvfs fsd; statvfs (0, &fsd);],
2476 fu_cv_sys_stat_statvfs=yes,
2477 fu_cv_sys_stat_statvfs=no)])
2478 if test $fu_cv_sys_stat_statvfs = yes; then
2480 AC_DEFINE(STAT_STATVFS)
2484 if test $space = no; then
2485 # DEC Alpha running OSF/1
2486 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2487 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2489 #include <sys/param.h>
2490 #include <sys/types.h>
2491 #include <sys/mount.h>
2496 exit (statfs (".", &fsd, sizeof (struct statfs)));
2498 fu_cv_sys_stat_statfs3_osf1=yes,
2499 fu_cv_sys_stat_statfs3_osf1=no,
2500 fu_cv_sys_stat_statfs3_osf1=no)])
2501 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2502 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2504 AC_DEFINE(STAT_STATFS3_OSF1)
2508 if test $space = no; then
2510 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2511 member (AIX, 4.3BSD)])
2512 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2514 #ifdef HAVE_SYS_PARAM_H
2515 #include <sys/param.h>
2517 #ifdef HAVE_SYS_MOUNT_H
2518 #include <sys/mount.h>
2520 #ifdef HAVE_SYS_VFS_H
2521 #include <sys/vfs.h>
2527 exit (statfs (".", &fsd));
2529 fu_cv_sys_stat_statfs2_bsize=yes,
2530 fu_cv_sys_stat_statfs2_bsize=no,
2531 fu_cv_sys_stat_statfs2_bsize=no)])
2532 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2533 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2535 AC_DEFINE(STAT_STATFS2_BSIZE)
2539 if test $space = no; then
2541 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2542 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2543 [AC_TRY_RUN([#include <sys/types.h>
2544 #include <sys/statfs.h>
2548 exit (statfs (".", &fsd, sizeof fsd, 0));
2550 fu_cv_sys_stat_statfs4=yes,
2551 fu_cv_sys_stat_statfs4=no,
2552 fu_cv_sys_stat_statfs4=no)])
2553 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2554 if test $fu_cv_sys_stat_statfs4 = yes; then
2556 AC_DEFINE(STAT_STATFS4)
2560 if test $space = no; then
2562 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2563 member (4.4BSD and NetBSD)])
2564 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2565 [AC_TRY_RUN([#include <sys/types.h>
2566 #ifdef HAVE_SYS_PARAM_H
2567 #include <sys/param.h>
2569 #ifdef HAVE_SYS_MOUNT_H
2570 #include <sys/mount.h>
2576 exit (statfs (".", &fsd));
2578 fu_cv_sys_stat_statfs2_fsize=yes,
2579 fu_cv_sys_stat_statfs2_fsize=no,
2580 fu_cv_sys_stat_statfs2_fsize=no)])
2581 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2582 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2584 AC_DEFINE(STAT_STATFS2_FSIZE)
2588 if test $space = no; then
2590 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2591 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2592 [AC_TRY_RUN([#include <sys/types.h>
2593 #ifdef HAVE_SYS_PARAM_H
2594 #include <sys/param.h>
2596 #ifdef HAVE_SYS_MOUNT_H
2597 #include <sys/mount.h>
2599 #ifdef HAVE_SYS_FS_TYPES_H
2600 #include <sys/fs_types.h>
2605 /* Ultrix's statfs returns 1 for success,
2606 0 for not mounted, -1 for failure. */
2607 exit (statfs (".", &fsd) != 1);
2609 fu_cv_sys_stat_fs_data=yes,
2610 fu_cv_sys_stat_fs_data=no,
2611 fu_cv_sys_stat_fs_data=no)])
2612 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2613 if test $fu_cv_sys_stat_fs_data = yes; then
2615 AC_DEFINE(STAT_STATFS2_FS_DATA)
2620 # As a gating factor for large file support, in order to
2621 # use <4GB files we must have the following minimal support
2623 # long long, and a 64 bit off_t or off64_t.
2624 # If we don't have all of these then disable large
2627 AC_MSG_CHECKING([if large file support can be enabled])
2629 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2630 #include <sys/types.h>
2636 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2637 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2638 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2640 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
2642 AC_ARG_WITH(spinlocks,
2643 [ --with-spinlocks Use spin locks instead of fcntl locks (default=no) ])
2644 if test "x$with_spinlocks" = "xyes"; then
2645 AC_DEFINE(USE_SPINLOCKS)
2649 AC_DEFINE(SPARC_SPINLOCKS)
2652 i386|i486|i586|i686)
2653 AC_DEFINE(INTEL_SPINLOCKS)
2657 AC_DEFINE(MIPS_SPINLOCKS)
2661 AC_DEFINE(POWERPC_SPINLOCKS)
2666 #################################################
2667 # check for ACL support
2669 AC_MSG_CHECKING(whether to support ACLs)
2670 AC_ARG_WITH(acl-support,
2671 [ --with-acl-support Include ACL support (default=no)],
2672 [ case "$withval" in
2677 AC_MSG_RESULT(Using UnixWare ACLs)
2678 AC_DEFINE(HAVE_UNIXWARE_ACLS)
2681 AC_MSG_RESULT(Using solaris ACLs)
2682 AC_DEFINE(HAVE_SOLARIS_ACLS)
2685 AC_MSG_RESULT(Using HPUX ACLs)
2686 AC_DEFINE(HAVE_HPUX_ACLS)
2689 AC_MSG_RESULT(Using IRIX ACLs)
2690 AC_DEFINE(HAVE_IRIX_ACLS)
2693 AC_MSG_RESULT(Using AIX ACLs)
2694 AC_DEFINE(HAVE_AIX_ACLS)
2697 AC_MSG_RESULT(Using Tru64 ACLs)
2698 AC_DEFINE(HAVE_TRU64_ACLS)
2702 AC_CHECK_LIB(acl,acl_get_file)
2703 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2704 AC_TRY_LINK([#include <sys/types.h>
2705 #include <sys/acl.h>],
2706 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2707 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2708 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2709 AC_MSG_RESULT(Using posix ACLs)
2710 AC_DEFINE(HAVE_POSIX_ACLS)
2711 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2712 AC_TRY_LINK([#include <sys/types.h>
2713 #include <sys/acl.h>],
2714 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2715 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2716 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2717 AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2725 AC_DEFINE(HAVE_NO_ACLS)
2728 AC_DEFINE(HAVE_NO_ACLS)
2732 #################################################
2733 # Check whether winbind is supported on this platform. If so we need to
2734 # build and install client programs (WINBIND_TARGETS), sbin programs
2735 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2737 AC_MSG_CHECKING(whether to build winbind)
2739 # Initially, the value of $host_os decides whether winbind is supported
2747 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2748 WINBIND_NSS_EXTRA_LIBS="-lsocket"
2752 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2756 winbind_no_reason=", unsupported on $host_os"
2760 # Check the setting of --with-winbindd
2762 AC_ARG_WITH(winbind,
2763 [ --with-winbind Build winbind (default, if supported by OS)],
2776 # We need unix domain sockets for winbind
2778 if test x"$HAVE_WINBIND" = x"yes"; then
2779 if test x"$samba_cv_unixsocket" = x"no"; then
2780 winbind_no_reason=", no unix domain socket support on $host_os"
2785 # Display test results
2790 WINBIND_PAM_PROGS=""
2792 if test x"$HAVE_WINBIND" = x"yes"; then
2795 WINBIND_TARGETS="bin/wbinfo"
2796 WINBIND_STARGETS="bin/winbindd"
2797 if test x"$BLDSHARED" = x"true"; then
2798 WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
2799 if test x"$with_pam" = x"yes"; then
2800 WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
2804 AC_MSG_RESULT(no$winbind_no_reason)
2807 # Substitution time!
2809 AC_SUBST(WINBIND_TARGETS)
2810 AC_SUBST(WINBIND_STARGETS)
2811 AC_SUBST(WINBIND_LTARGETS)
2812 AC_SUBST(WINBIND_PAM_TARGETS)
2813 AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
2814 AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
2816 # Solaris has some extra fields in struct passwd that need to be
2817 # initialised otherwise nscd crashes. Unfortunately autoconf < 2.50
2818 # doesn't have the AC_CHECK_MEMBER macro which would be handy for checking
2821 #AC_CHECK_MEMBER(struct passwd.pw_comment,
2822 # AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),
2823 # [#include <pwd.h>])
2825 AC_CACHE_CHECK([whether struct passwd has pw_comment],samba_cv_passwd_pw_comment, [
2826 AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_comment;],
2827 samba_cv_passwd_pw_comment=yes,samba_cv_passwd_pw_comment=no)])
2828 if test x"$samba_cv_passwd_pw_comment" = x"yes"; then
2829 AC_DEFINE(HAVE_PASSWD_PW_COMMENT)
2832 #AC_CHECK_MEMBER(struct passwd.pw_age,
2833 # AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),
2834 # [#include <pwd.h>])
2836 AC_CACHE_CHECK([whether struct passwd has pw_age],samba_cv_passwd_pw_age, [
2837 AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_age;],
2838 samba_cv_passwd_pw_age=yes,samba_cv_passwd_pw_age=no)])
2839 if test x"$samba_cv_passwd_pw_age" = x"yes"; then
2840 AC_DEFINE(HAVE_PASSWD_PW_AGE)
2843 #################################################
2844 # Check to see if we should use the included popt
2846 AC_ARG_WITH(included-popt,
2847 [ --with-included-popt use bundled popt library, not from system],
2858 if test x"$INCLUDED_POPT" != x"yes"; then
2859 AC_CHECK_LIB(popt, poptGetContext,
2860 INCLUDED_POPT=no, INCLUDED_POPT=yes)
2863 AC_MSG_CHECKING(whether to use included popt)
2864 if test x"$INCLUDED_POPT" = x"yes"; then
2865 AC_MSG_RESULT($srcdir/popt)
2866 BUILD_POPT='$(POPT_OBJS)'
2867 FLAGS1="-I$srcdir/popt"
2872 AC_SUBST(BUILD_POPT)
2875 #################################################
2876 # do extra things if we are running insure
2878 if test "${ac_cv_prog_CC}" = "insure"; then
2879 CPPFLAGS="$CPPFLAGS -D__INSURE__"
2882 #################################################
2883 # final configure stuff
2885 AC_MSG_CHECKING([configure summary])
2886 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2888 AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
2889 AC_MSG_WARN([cannot run when cross-compiling]))
2894 AC_OUTPUT(include/stamp-h Makefile script/findsmb)
2896 #################################################
2897 # Print very concise instructions on building/use
2898 if test "x$enable_dmalloc" = xyes
2900 AC_MSG_RESULT([Note: The dmalloc debug library will be included. To turn it on use])
2901 AC_MSG_RESULT([ \$ eval \`dmalloc samba\`.])