yp_prot.h and ypclnt.h correct: ypprot.h and yp_clnt.h wrong...
[samba.git] / source3 / configure.in
index 6904155a9d83024d1f20c279cfd248738e9cf155..f0befe740041f790b7ca7851f7fb8fe237ab492e 100644 (file)
@@ -1,25 +1,49 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(include/includes.h)
 AC_CONFIG_HEADER(include/config.h)
+# we want to be compatibe with older versions of Samba
+AC_PREFIX_DEFAULT(/usr/local/samba)
+
+dnl Unique-to-Samba variables we'll be playing with.
+AC_SUBST(SHELL)
+AC_SUBST(MPROGS)
+AC_SUBST(LDSHFLAGS)
+AC_SUBST(HOST_OS)
+AC_SUBST(WRAP)
+AC_SUBST(WRAP32)
+AC_SUBST(PICFLAG)
+
+# compile with optimisation and without debugging by default
+CFLAGS=${CFLAGS-"-O"}
 
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
-AC_SUBST(SHELL)
 AC_PROG_AWK
 
 AC_CANONICAL_SYSTEM
+AC_VALIDATE_CACHE_SYSTEM_TYPE
+SAMBA_MAINTAINER_MODE
+
+#
+# Config CPPFLAG settings for strange OS's that must be set
+# before other tests.
+#
 case "$host_os" in
-       *linux*)   AC_DEFINE(LINUX);;
-        *solaris*) AC_DEFINE(SUNOS5);;
-        *sunos*) AC_DEFINE(SUNOS4);;
-        *irix*) AC_DEFINE(IRIX);;
-        *aix*) AC_DEFINE(AIX);;
-        *hpux*) AC_DEFINE(HPUX);;
-        *qnx*) AC_DEFINE(QNX);;
-        *osf1*) AC_DEFINE(OSF1);;
-        *sco*) AC_DEFINE(SCO);;
-        *next2*) AC_DEFINE(NEXT2);;
+# Try to work out if this is the native HPUX compiler that uses the -Ae flag.
+    *hpux*)
+      AC_PROG_CC_FLAG(Ae)
+      if test $ac_cv_prog_cc_Ae = yes; then
+        CPPFLAGS="$CPPFLAGS -Ae"
+      fi
+      ;;
+#
+# AIX4.x is *so* broken. It doesn't even admit to having large
+# files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
+#
+    *aix4*)
+      CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
+      ;;    
 esac
 
 AC_INLINE
@@ -28,19 +52,21 @@ AC_HEADER_DIRENT
 AC_HEADER_TIME
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
-AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
-AC_CHECK_HEADERS(compat.h rpc/types.h rpc/xdr.h rpc/auth.h rpc/clnt.h)
-AC_CHECK_HEADERS(rpcsvc/yp_prot.h rpcsvc/ypclnt.h sys/param.h ctype.h )
+AC_CHECK_HEADERS(sys/param.h ctype.h )
+AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/route.h net/if.h)
+AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h sys/param.h ctype.h )
 AC_CHECK_HEADERS(sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
 AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
 AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
 AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
-AC_CHECK_HEADERS(stropts.h poll.h)
+AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
+AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
+AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
 
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int,cross)
+AC_CHECK_SIZEOF(long,cross)
+AC_CHECK_SIZEOF(short,cross)
 
 AC_C_CONST
 AC_C_INLINE
@@ -54,48 +80,53 @@ AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_TYPE_PID_T
 AC_STRUCT_ST_RDEV
+AC_DIRENT_D_OFF
 AC_CHECK_TYPE(ino_t,unsigned)
+AC_CHECK_TYPE(loff_t,off_t)
+AC_CHECK_TYPE(offset_t,loff_t)
+AC_CHECK_TYPE(ssize_t, int)
 
-echo $ac_n "checking for errno in errno.h... $ac_c"
-AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
-echo yes; AC_DEFINE(HAVE_ERRNO_DECL),
-echo no)
+AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
+    AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
+       samba_cv_errno=yes,samba_cv_have_errno_decl=no)])
+if test x"$samba_cv_errno" = x"yes"; then
+   AC_DEFINE(HAVE_ERRNO_DECL)
+fi
 
 # stupid glibc has the functions but no declaration. grrrr.
-echo $ac_n "checking for setresuid declaration $ac_c"
-AC_TRY_COMPILE([#include <unistd.h>],[int i = setresuid],
-echo yes; AC_DEFINE(HAVE_SETRESUID_DECL),
-echo no)
+AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
+    AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresuid],
+        samba_cv_have_setresuid_decl=yes,samba_cv_have_setresuid_decl=no)])
+if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
+    AC_DEFINE(HAVE_SETRESUID_DECL)
+fi
+
+# stupid glibc has the functions but no declaration. grrrr.
+AC_CACHE_CHECK([for crypt declaration],samba_cv_have_crypt_decl,[
+    AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)crypt],
+        samba_cv_have_crypt_decl=yes,samba_cv_have_crypt_decl=no)])
+if test x"$samba_cv_have_crypt_decl" = x"yes"; then
+    AC_DEFINE(HAVE_CRYPT_DECL)
+fi
 
 # and glibc has setresuid under linux but the function does
 # nothing until kernel 2.1.44! very dumb.
-echo $ac_n "checking for real setresuid $ac_c"
-AC_TRY_RUN([#include <errno.h>
+AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
+    AC_TRY_RUN([#include <errno.h>
 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
-echo yes;AC_DEFINE(HAVE_SETRESUID), 
-echo no)
-
+       samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
+if test x"$samba_cv_have_setresuid" = x"yes"; then
+    AC_DEFINE(HAVE_SETRESUID)
+fi
 
 AC_FUNC_MEMCMP
 
 ###############################################
 # test for where we get crypt() from
-if test "$ac_cv_lib_crypt_crypt" = "yes"; then
-  AC_CHECK_LIB(crypt, crypt)
-  AC_DEFINE(HAVE_CRYPT)
-fi
-if test "$ac_cv_lib_crypt_crypt" = "no" || 
-   test "$ac_cv_lib_crypt_crypt" = ""; then
-# look for crypt 
-AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT), 
-[case "$LIBS" in
-*-lcrypt*) ;;
-*) AC_CHECK_LIB(crypt, crypt) ;;
-esac
-if test "$ac_cv_lib_crypt_crypt" = "yes"; then
-  ac_cv_func_crypt=yes
-  AC_DEFINE(HAVE_CRYPT)
-fi])
+AC_CHECK_FUNCS(crypt)
+if test x"$ac_cv_func_crypt" = x"no"; then
+    AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
+       AC_DEFINE(HAVE_CRYPT)])
 fi
 
 
@@ -103,157 +134,459 @@ fi
 # test for where we get pam_authenticate() from
 # might need libdl for this to work
 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
-  AC_HAVE_LIBRARY(dl)
-fi
-if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
-  AC_CHECK_LIB(pam, pam_authenticate)
-  AC_DEFINE(HAVE_PAM_AUTHENTICATE)
-fi
-if test "$ac_cv_lib_pam_pam_authenticate" = "no" || 
-   test "$ac_cv_lib_pam_pam_authenticate" = ""; then
-# look for pam_authenticate
-AC_CHECK_FUNC(pam_authenticate, AC_DEFINE(HAVE_PAM_AUTHENTICATE), 
-[case "$LIBS" in
-*-lpam*) ;;
-*) AC_CHECK_LIB(pam, pam_authenticate) ;;
-esac
-if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
-  ac_cv_func_pam_authenticate=yes
-  AC_DEFINE(HAVE_PAM_AUTHENTICATE)
-fi])
+  AC_CHECK_LIB(dl,main)
+fi
+AC_CHECK_FUNCS(pam_authenticate)
+if test x"$ac_cv_func_pam_authenticate" = x"no"; then
+    AC_CHECK_LIB(pam, pam_authenticate, [LIBS="$LIBS -lpam"
+       AC_DEFINE(HAVE_PAM_AUTHENTICATE)])
+fi
+
+
+###############################################
+# test for where we get readline() from
+if test "$ac_cv_header_readline_h" = "yes" ||
+   test "$ac_cv_header_readline_readline_h" = "yes"; then
+  AC_CHECK_LIB(readline,readline)
 fi
 
+
 # The following test taken from the cvs sources
 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
 # libsocket.so which has a bad implementation of gethostbyname (it
 # only looks in /etc/hosts), so we only look for -lsocket if we need
 # it.
-AC_CHECK_FUNC(connect, :, 
-[case "$LIBS" in
-*-lnsl*) ;;
-*) AC_CHECK_LIB(nsl_s, printf) ;;
-esac
-case "$LIBS" in
-*-lnsl*) ;;
-*) AC_CHECK_LIB(nsl, printf) ;;
-esac
-case "$LIBS" in
-*-lsocket*) ;;
-*) AC_CHECK_LIB(socket, connect) ;;
-esac
-case "$LIBS" in
-*-linet*) ;;
-*) AC_CHECK_LIB(inet, connect) ;;
-esac
-dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
-dnl has been cached.
-if test "$ac_cv_lib_socket_connect" = "yes" || 
-   test "$ac_cv_lib_inet_connect" = "yes"; then
-  ac_cv_func_connect=yes
-  AC_DEFINE(HAVE_CONNECT)
-fi])
+AC_CHECK_FUNCS(connect)
+if test x"$ac_cv_func_connect" = x"no"; then
+    case "$LIBS" in
+    *-lnsl*) ;;
+    *) AC_CHECK_LIB(nsl_s, printf) ;;
+    esac
+    case "$LIBS" in
+    *-lnsl*) ;;
+    *) AC_CHECK_LIB(nsl, printf) ;;
+    esac
+    case "$LIBS" in
+    *-lsocket*) ;;
+    *) AC_CHECK_LIB(socket, connect) ;;
+    esac
+    case "$LIBS" in
+    *-linet*) ;;
+    *) AC_CHECK_LIB(inet, connect) ;;
+    esac
+    dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
+    dnl has been cached.
+    if test x"$ac_cv_lib_socket_connect" = x"yes" || 
+       test x"$ac_cv_lib_inet_connect" = x"yes"; then
+        # ac_cv_func_connect=yes
+        # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
+        AC_DEFINE(HAVE_CONNECT)
+    fi
+fi
 
 
 AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot)
 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
-AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid)
-AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
+AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob strpbrk pipe crypt16 getauthuid)
+AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
-AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64)
+AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64 fopen64)
 AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64)
-AC_CHECK_FUNCS(bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
+AC_CHECK_FUNCS(fseek64 ftell64 bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
+AC_CHECK_FUNCS(srandom random srand rand setenv mmap64)
+# syscall() is needed for smbwrapper.
+AC_CHECK_FUNCS(syscall)
+
+AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
+AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
+AC_CHECK_FUNCS(__getcwd _getcwd)
+AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
+AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
+AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
+AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
+AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
+AC_CHECK_FUNCS(_write __write _fork __fork)
+AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
+AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
+AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
+AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
+AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
+
+#
+# Check for the functions putprpwnam, set_auth_parameters,
+# getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
+# Needed for OSF1 and HPUX.
+#
+
+if test x"$ac_cv_func_putprpwnam" = x"no"; then
+    case "$LIBS" in
+    *-lsecurity*) ;;
+    *) AC_CHECK_LIB(security, putprpwnam) ;;
+    esac
+    case "$LIBS" in
+    *-lsec*) ;;
+    *) AC_CHECK_LIB(sec, putprpwnam) ;;
+    esac
+    if test x"$ac_cv_lib_security_putprpwnam" = x"yes" ||
+       test x"$ac_cv_lib_sec_putprpwnam" = x"yes"; then
+        AC_DEFINE(HAVE_PUTPRPWNAM)
+    fi
+fi
+
+if test x"$ac_cv_func_set_auth_parameters" = x"no"; then
+    case "$LIBS" in
+    *-lsecurity*) ;;
+    *) AC_CHECK_LIB(security, set_auth_parameters) ;;
+    esac
+    case "$LIBS" in
+    *-lsec*) ;;
+    *) AC_CHECK_LIB(sec, set_auth_parameters) ;;
+    esac
+    if test x"$ac_cv_lib_security_set_auth_parameters" = x"yes" ||
+       test x"$ac_cv_lib_sec_set_auth_parameters" = x"yes"; then
+        AC_DEFINE(HAVE_SET_AUTH_PARAMETERS)
+    fi
+fi
+
+if test x"$ac_cv_func_getspnam" = x"no"; then
+    case "$LIBS" in
+    *-lsecurity*) ;;
+    *) AC_CHECK_LIB(security, getspnam) ;;
+    esac
+    case "$LIBS" in
+    *-lsec*) ;;
+    *) AC_CHECK_LIB(sec, getspnam) ;;
+    esac
+    if test x"$ac_cv_lib_security_getspnam" = x"yes" ||
+       test x"$ac_cv_lib_sec_getspnam" = x"yes"; then
+        AC_DEFINE(HAVE_GETSPNAM)
+    fi
+fi
+
+if test x"$ac_cv_func_bigcrypt" = x"no"; then
+    case "$LIBS" in
+    *-lsecurity*) ;;
+    *) AC_CHECK_LIB(security, bigcrypt) ;;
+    esac
+    case "$LIBS" in
+    *-lsec*) ;;
+    *) AC_CHECK_LIB(sec, bigcrypt) ;;
+    esac
+    if test x"$ac_cv_lib_security_bigcrypt" = x"yes" ||
+       test x"$ac_cv_lib_sec_bigcrypt" = x"yes"; then
+        AC_DEFINE(HAVE_BIGCRYPT)
+    fi
+fi
+
+if test x"$ac_cv_func_getprpwnam" = x"no"; then
+    case "$LIBS" in
+    *-lsecurity*) ;;
+    *) AC_CHECK_LIB(security, getprpwnam) ;;
+    esac
+    case "$LIBS" in
+    *-lsec*) ;;
+    *) AC_CHECK_LIB(sec, getprpwnam) ;;
+    esac
+    if test x"$ac_cv_lib_security_getprpwnam" = x"yes" ||
+       test x"$ac_cv_lib_sec_getprpwnam" = x"yes"; then
+        AC_DEFINE(HAVE_GETPRPWNAM)
+    fi
+fi
+
+# this bit needs to be modified for each OS that is suported by
+# smbwrapper. You need to specify how to created a shared library and
+# how to compile C code to produce PIC object files
+
+# these are the defaults, good for lots of systems
+HOST_OS="$host_os"
+LDSHFLAGS="-shared"
+
+# and these are for particular systems
+case "$host_os" in
+               *linux*)   AC_DEFINE(LINUX);;
+               *solaris*) AC_DEFINE(SUNOS5)
+                                       LDSHFLAGS="-G"
+               ;;
+               *sunos*) AC_DEFINE(SUNOS4)
+                                       LDSHFLAGS=""
+               ;;
+               *bsd*) LDSHFLAGS="-shared -Bshareable"
+               ;;
+               *irix*) AC_DEFINE(IRIX)
+                       ATTEMPT_WRAP32_BUILD=yes
+               ;;
+               *aix*) AC_DEFINE(AIX);;
+               *hpux*) AC_DEFINE(HPUX);;
+               *qnx*) AC_DEFINE(QNX);;
+               *osf*) AC_DEFINE(OSF1);;
+               *sco*) AC_DEFINE(SCO);;
+               *next2*) AC_DEFINE(NEXT2);;
+               *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
+               *sysv4.2*) AC_CHECK_LIB(resolv, strcasecmp);;
+esac
 
-echo $ac_n "checking for long long ... $ac_c"
+# try to work out how to produce pic code with this compiler
+PICFLAG=""
+AC_PROG_CC_FLAG(fpic)
+if test $ac_cv_prog_cc_fpic = yes; then
+   PICFLAG="-fpic";
+fi
+if test x$PICFLAG = x; then
+  AC_PROG_CC_FLAG(Kpic)
+  if test $ac_cv_prog_cc_Kpic = yes; then
+    PICFLAG="-Kpic";
+  fi 
+fi
+if test x$PICFLAG = x; then
+  AC_PROG_CC_FLAG(KPIC)
+  if test $ac_cv_prog_cc_KPIC = yes; then
+    PICFLAG="-KPIC";
+  fi 
+fi
+
+################
+
+AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
 AC_TRY_RUN([#include <stdio.h>
 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
-echo yes;AC_DEFINE(HAVE_LONGLONG), 
-echo no)
+samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
+if test x"$samba_cv_have_longlong" = x"yes"; then
+    AC_DEFINE(HAVE_LONGLONG)
+fi
 
-echo $ac_n "checking for 64 bit off_t ... $ac_c"
+AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
 AC_TRY_RUN([#include <stdio.h>
 #include <sys/stat.h>
 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
-echo yes;AC_DEFINE(SIZEOF_OFF_T,8)
-echo no)
+samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
+if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
+    AC_DEFINE(SIZEOF_OFF_T,8)
+fi
 
-echo $ac_n "checking for off64_t ... $ac_c"
+AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
 AC_TRY_RUN([#include <stdio.h>
 #include <sys/stat.h>
 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
-echo yes;AC_DEFINE(HAVE_OFF64_T), 
-echo no)
+samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
+if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
+    AC_DEFINE(HAVE_OFF64_T)
+fi
 
-echo $ac_n "checking for union semun ... $ac_c"
+AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
+AC_TRY_RUN([#include <stdio.h>
+#include <sys/stat.h>
+main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
+samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
+if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
+    AC_DEFINE(SIZEOF_INO_T,8)
+fi
+
+AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
+AC_TRY_RUN([#include <stdio.h>
+#include <sys/stat.h>
+main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
+samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
+if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
+    AC_DEFINE(HAVE_INO64_T)
+fi
+
+AC_CACHE_CHECK([for union semun],samba_cv_HAVE_UNION_SEMUN,[
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
 main() { union semun ss; exit(0); }],
-echo yes;AC_DEFINE(HAVE_UNION_SEMUN), 
-echo no)
+samba_cv_HAVE_UNION_SEMUN=yes,samba_cv_HAVE_UNION_SEMUN=no,samba_cv_HAVE_UNION_SEMUN=cross)])
+if test x"$samba_cv_HAVE_UNION_SEMUN" = x"yes"; then
+    AC_DEFINE(HAVE_UNION_SEMUN)
+fi
 
-echo $ac_n "checking for unsigned char ... $ac_c"
+AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
 AC_TRY_RUN([#include <stdio.h>
 main() { char c; c=250; exit((c > 0)?0:1); }],
-echo yes;AC_DEFINE(HAVE_UNSIGNED_CHAR), 
-echo no)
+samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
+if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
+    AC_DEFINE(HAVE_UNSIGNED_CHAR)
+fi
 
-echo $ac_n "checking for sin_len in sock ... $ac_c"
+AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>],
 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
-echo yes;AC_DEFINE(HAVE_SOCK_SIN_LEN), 
-echo no)
+samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
+if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
+    AC_DEFINE(HAVE_SOCK_SIN_LEN)
+fi
 
-echo $ac_n "checking for __FILE__ macro ... $ac_c"
+AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <dirent.h>
+void seekdir(DIR *d, long loc) { return; }],[return 0;],
+samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
+if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
+    AC_DEFINE(SEEKDIR_RETURNS_VOID)
+fi
+
+AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
-echo yes;AC_DEFINE(HAVE_FILE_MACRO), 
-echo no)
+samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
+if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
+    AC_DEFINE(HAVE_FILE_MACRO)
+fi
 
-echo $ac_n "checking for __FUNCTION__ macro ... $ac_c"
+AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
-echo yes;AC_DEFINE(HAVE_FUNCTION_MACRO), 
-echo no)
+samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
+if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
+    AC_DEFINE(HAVE_FUNCTION_MACRO)
+fi
 
-echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
+AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
 AC_TRY_RUN([
 #include <sys/time.h>
 #include <unistd.h>
 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
-           echo yes;AC_DEFINE(HAVE_GETTIMEOFDAY_TZ),
-          echo no)
+           samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
+if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
+    AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
+fi
 
 
-echo $ac_n "checking for broken readdir ... $ac_c"
+AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
 AC_TRY_RUN([#include <sys/types.h>
 #include <dirent.h>
 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
 di->d_name[0] == 0) exit(0); exit(1);} ],
-echo yes - you are using the broken /usr/ucb/cc;AC_DEFINE(HAVE_BROKEN_READDIR), 
-echo no)
+samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
+if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
+    AC_DEFINE(HAVE_BROKEN_READDIR)
+fi
 
-echo $ac_n "checking for utimbuf ... $ac_c"
+AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <utime.h>],
 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
-echo yes;AC_DEFINE(HAVE_UTIMBUF), 
-echo no)
+samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
+if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
+    AC_DEFINE(HAVE_UTIMBUF)
+fi
+
+AC_CACHE_CHECK([for kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <fcntl.h>],
+[oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
+samba_cv_HAVE_KERNEL_OPLOCKS=yes,samba_cv_HAVE_KERNEL_OPLOCKS=no)])
+if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
+    AC_DEFINE(HAVE_KERNEL_OPLOCKS)
+fi
+
+AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
+AC_TRY_RUN([#include <sys/types.h>
+#include <sys/capability.h>
+main() {
+ cap_t cap;
+ if ((cap = cap_get_proc()) == NULL)
+   exit(1);
+ cap->cap_effective |= CAP_NETWORK_MGT;
+ cap->cap_inheritable |= CAP_NETWORK_MGT;
+ cap_set_proc(cap);
+ exit(0);
+}
+],
+samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
+if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
+    AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
+fi
+
+#
+# Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
+# This is *really* broken but some systems (DEC OSF1) do this.... JRA.
+#
+
+AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif],
+[int16 testvar;],
+samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
+if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
+    AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
+fi
+
+AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif],
+[uint16 testvar;],
+samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
+if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
+    AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
+fi
 
-echo $ac_n "checking for ftruncate extend ... $ac_c"
-AC_TRY_RUN([#include "tests/ftruncate.c"],
-           echo yes;AC_DEFINE(HAVE_FTRUNCATE_EXTEND), 
-          echo no)
+AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif],
+[int32 testvar;],
+samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
+if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
+    AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
+fi
+
+AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif],
+[uint32 testvar;],
+samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
+if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
+    AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
+fi
 
-echo $ac_n "checking for broken getgroups ... $ac_c"
-AC_TRY_RUN([#include "tests/getgroups.c"],
-           echo yes;AC_DEFINE(HAVE_BROKEN_GETGROUPS), 
-          echo no)
+AC_MSG_CHECKING([for test routines])
+AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
+           AC_MSG_RESULT(yes),
+          AC_MSG_ERROR([cant find test code. Aborting config]),
+          AC_MSG_WARN([cannot run when cross-compiling]))
 
+AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
+AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
+           samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
+if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
+    AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
+fi
 
-echo $ac_n "checking for broken inet_ntoa ... $ac_c"
+AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
+AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
+           samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
+if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
+    AC_DEFINE(HAVE_BROKEN_GETGROUPS)
+fi
+
+AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I${srcdir-.}/include -I${srcdir-.}/ubiqx"
+AC_TRY_COMPILE([
+#define REPLACE_GETPASS 1
+#define NO_CONFIG_H 1
+#define main dont_declare_main
+#include "${srcdir-.}/lib/getsmbpass.c"
+#undef main
+],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
+CPPFLAGS="$SAVE_CPPFLAGS"
+])
+if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
+       AC_DEFINE(REPLACE_GETPASS)
+fi
+
+AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
 AC_TRY_RUN([
 #include <stdio.h>
 #include <sys/types.h>
@@ -263,62 +596,143 @@ main() { struct in_addr ip; ip.s_addr = 0x12345678;
 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
 exit(1);}],
-           echo yes;AC_DEFINE(REPLACE_INET_NTOA), 
-          echo no)
+           samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
+if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
+    AC_DEFINE(REPLACE_INET_NTOA)
+fi
 
-echo $ac_n "checking for root ... $ac_c"
+AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
 AC_TRY_RUN([main() { exit(getuid() != 0); }],
-           echo yes;AC_DEFINE(HAVE_ROOT), 
-          echo WARNING: running as non-root will disable some tests;)
+           samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
+if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
+    AC_DEFINE(HAVE_ROOT)
+else
+    AC_MSG_WARN(running as non-root will disable some tests)
+fi
 
 netmask=no;
-echo $ac_n "checking for netmask ifconf ... $ac_c"
+AC_CACHE_CHECK([for netmask ifconf],samba_cv_HAVE_NETMASK_IFCONF,[
 AC_TRY_RUN([
 #define HAVE_NETMASK_IFCONF 1
 #define AUTOCONF 1
-#include "lib/netmask.c"],
-           echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF),
-          echo no)
+#include "${srcdir-.}/lib/netmask.c"],
+           samba_cv_HAVE_NETMASK_IFCONF=yes,samba_cv_HAVE_NETMASK_IFCONF=no,samba_cv_HAVE_NETMASK_IFCONF=cross)])
+if test x"$samba_cv_HAVE_NETMASK_IFCONF" = x"yes"; then
+    netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF)
+fi
 
 if test $netmask = no; then
-echo $ac_n "checking for netmask ifreq ... $ac_c"
+AC_CACHE_CHECK([for netmask ifreq],samba_cv_HAVE_NETMASK_IFREQ,[
 AC_TRY_RUN([
 #define HAVE_NETMASK_IFREQ 1
 #define AUTOCONF 1
-#include "lib/netmask.c"],
-           echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ),
-          echo no)
+#include "${srcdir-.}/lib/netmask.c"],
+           samba_cv_HAVE_NETMASK_IFREQ=yes,samba_cv_HAVE_NETMASK_IFREQ=no,samba_cv_HAVE_NETMASK_IFREQ=cross)])
+if test x"$samba_cv_HAVE_NETMASK_IFREQ" = x"yes"; then
+    netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ)
+fi
 fi
 
 if test $netmask = no; then
-echo $ac_n "checking for netmask AIX ... $ac_c"
+AC_CACHE_CHECK([for netmask AIX],samba_cv_HAVE_NETMASK_AIX,[
 AC_TRY_RUN([
 #define HAVE_NETMASK_AIX 1
 #define AUTOCONF 1
-#include "lib/netmask.c"],
-           echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX),
-          echo no)
+#include "${srcdir-.}/lib/netmask.c"],
+           samba_cv_HAVE_NETMASK_AIX=yes,samba_cv_HAVE_NETMASK_AIX=no,samba_cv_HAVE_NETMASK_AIX=cross)])
+if test x"$samba_cv_HAVE_NETMASK_AIX" = x"yes"; then
+    netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX)
+fi
+fi
+
+AC_CACHE_CHECK([for trapdoor seteuid],samba_cv_HAVE_TRAPDOOR_UID,[
+AC_TRY_RUN([#include "${srcdir-.}/tests/trapdoor.c"],
+          samba_cv_HAVE_TRAPDOOR_UID=no,samba_cv_HAVE_TRAPDOOR_UID=yes,:)])
+if test x"$samba_cv_HAVE_TRAPDOOR_UID" = x"yes"; then
+    AC_DEFINE(HAVE_TRAPDOOR_UID)
+fi
+
+AC_CACHE_CHECK([for shared mmap],samba_cv_HAVE_SHARED_MMAP,[
+AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
+           samba_cv_HAVE_SHARED_MMAP=yes,samba_cv_HAVE_SHARED_MMAP=no,samba_cv_HAVE_SHARED_MMAP=cross)])
+if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
+    AC_DEFINE(HAVE_SHARED_MMAP)
+fi
+
+AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
+AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
+           samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
+if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
+    AC_DEFINE(HAVE_FCNTL_LOCK)
 fi
 
-echo $ac_n "checking for trapdoor seteuid ... $ac_c"
-AC_TRY_RUN([#include "tests/trapdoor.c"],
-          echo no,
-           echo yes;AC_DEFINE(HAVE_TRAPDOOR_UID))
+AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
+AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
 
-echo $ac_n "checking for shared mmap ... $ac_c"
-AC_TRY_RUN([#include "tests/shared_mmap.c"],
-           echo yes;AC_DEFINE(HAVE_SHARED_MMAP), 
-          echo no)
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
 
-echo $ac_n "checking for fcntl locking ... $ac_c"
-AC_TRY_RUN([#include "tests/fcntl_lock.c"],
-           echo yes;AC_DEFINE(HAVE_FCNTL_LOCK), 
-          echo no)
+#ifdef HAVE_SYS_FCNTL_H
+#include <sys/fcntl.h>
+#endif
+main() { struct flock64 fl64;
+#if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
+exit(0);
+#else
+exit(1);
+#endif
+}],
+       samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
+if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
+    AC_DEFINE(HAVE_STRUCT_FLOCK64)
+fi
 
-echo $ac_n "checking for sysv ipc ... $ac_c"
-AC_TRY_RUN([#include "tests/sysv_ipc.c"],
-           echo yes;AC_DEFINE(HAVE_SYSV_IPC), 
-          echo no)
+AC_CACHE_CHECK([for sysv ipc],samba_cv_HAVE_SYSV_IPC,[
+AC_TRY_RUN([#include "${srcdir-.}/tests/sysv_ipc.c"],
+           samba_cv_HAVE_SYSV_IPC=yes,samba_cv_HAVE_SYSV_IPC=no,samba_cv_HAVE_SYSV_IPC=cross)])
+if test x"$samba_cv_HAVE_SYSV_IPC" = x"yes"; then
+    AC_DEFINE(HAVE_SYSV_IPC)
+fi
+
+#################################################
+# check for smbwrapper support
+AC_MSG_CHECKING(whether to use smbwrapper)
+AC_ARG_WITH(smbwrapper,
+[  --with-smbwrapper     Include SMB wrapper support
+  --without-smbwrapper  Don't include SMB wrapper support (default)],
+[ case "$withval" in
+  yes)
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(WITH_SMBWRAPPER)
+       WRAP="bin/smbsh bin/smbwrapper.so"
+
+       if test x$ATTEMPT_WRAP32_BUILD = x; then
+               WRAP32=""
+       else
+                       WRAP32=bin/smbwrapper.32.so
+       fi
+
+# Conditions under which smbwrapper should not be built.
+
+       if test x$PICFLAG = x; then
+          echo No support for PIC code - disabling smbwrapper and smbsh
+          WRAP=""
+          WRAP32=""
+       elif test x$ac_cv_func_syscall = xno; then
+          AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
+          WRAP=""
+          WRAP32=""
+       fi
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
 
 #################################################
 # check for the AFS filesystem
@@ -357,6 +771,21 @@ AC_ARG_WITH(dfs,
   AC_MSG_RESULT(no)
 )
 
+#################################################
+# check for Kerberos IV auth system
+AC_MSG_CHECKING(whether to use Kerberos IV)
+AC_ARG_WITH(krb4,
+[  --with-krb4=base-dir     Include Kerberos IV support
+  --whithout-krb4          Don't include Kerbers IV support (default)],
+[   AC_MSG_RESULT(yes)
+    AC_DEFINE(KRB4_AUTH)
+    AC_CHECK_LIB(resolv, dn_expand)
+    LIBS="$LIBS -lkrb -ldes"
+    CFLAGS="$CFLAGS -I$withval/include"
+    LDFLAGS="$LDFLAGS -L$withval/lib"],
+  AC_MSG_RESULT(no)
+)
+
 #################################################
 # check for automount support
 AC_MSG_CHECKING(whether to use AUTOMOUNT)
@@ -375,6 +804,27 @@ AC_ARG_WITH(automount,
   AC_MSG_RESULT(no)
 )
 
+#################################################
+# check for smbmount support
+AC_MSG_CHECKING(whether to use SMBMOUNT)
+AC_ARG_WITH(smbmount,
+[  --with-smbmount     Include SMBMOUNT (Linux only) support
+  --without-smbmount  Don't include SMBMOUNT support (default)],
+[ case "$withval" in
+  yes)
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(WITH_SMBMOUNT)
+    MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+    MPROGS=
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+  MPROGS=
+)
+
 #################################################
 # check for a LDAP password database
 AC_MSG_CHECKING(whether to use LDAP password database)
@@ -501,12 +951,53 @@ AC_ARG_WITH(netatalk,
   AC_MSG_RESULT(no)
 )
 
+#################################################
+# check for experimental disk-quotas support
+QUOTAOBJS=noquotas.o
+
+AC_MSG_CHECKING(whether to support disk-quotas)
+AC_ARG_WITH(quotas,
+[  --with-quotas     Include experimental disk-quota support
+  --without-quotas  Don't include experimental disk-quota support (default)],
+[ case "$withval" in
+  yes)
+    AC_MSG_RESULT(yes)
+    QUOTAOBJS=quotas.o
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+AC_SUBST(QUOTAOBJS)
 
 #################################################
 # these tests are taken from the GNU fileutils package
 AC_CHECKING(how to get filesystem space usage)
 space=no
 
+# Test for statvfs64.
+if test $space = no; then
+  # SVR4
+  AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
+  [AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/statvfs.h>
+  main ()
+  {
+    struct statvfs64 fsd;
+    exit (statfs64 (".", &fsd));
+  }],
+  fu_cv_sys_stat_statvfs64=yes,
+  fu_cv_sys_stat_statvfs64=no,
+  fu_cv_sys_stat_statvfs64=cross)])
+  if test $fu_cv_sys_stat_statvfs64 = yes; then
+    space=yes
+    AC_DEFINE(STAT_STATVFS64)
+  fi
+fi
+
 # Perform only the link test since it seems there are no variants of the
 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
 # because that got a false positive on SCO OSR5.  Adding the declaration
@@ -662,8 +1153,12 @@ if test $space = no; then
   fi
 fi
 
+echo "checking configure summary"
+AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
+           echo "configure OK";,
+          AC_MSG_ERROR([summary failure. Aborting config]),:)
+
+builddir=`pwd`
+AC_SUBST(builddir)
 
-AC_OUTPUT(Makefile tests/dummy client/dummy lib/dummy ubiqx/dummy
-web/dummy param/dummy nmbd/dummy smbd/dummy rpc_server/dummy
-rpc_parse/dummy script/dummy include/dummy codepages/dummy
-libsmb/dummy bin/dummy printing/dummy)
+AC_OUTPUT(include/stamp-h Makefile)