matthew chapman's ldap code, to date. plus docs!
[samba.git] / source3 / configure.in
index 998479cadb11d5f9b6be6d27f155ae98ff60b05e..be76b4d6de7520a0f380dfcc98fcc4e17fd10cd4 100644 (file)
@@ -1,51 +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 Checks for programs.
-AC_PROG_CC
-AC_PROG_INSTALL
+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_PROG_AWK
 
 AC_CANONICAL_SYSTEM
 AC_VALIDATE_CACHE_SYSTEM_TYPE
 SAMBA_MAINTAINER_MODE
 
-
-
-# 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
-PICFLAG="-fpic"
-HOST_OS="$host_os"
-LDSHFLAGS="-shared"
-
-# and these are for particular systems
+#
+# 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)
-                   LDSHFLAGS="-G";;
-        *sunos*) AC_DEFINE(SUNOS4)
-                LDSHFLAGS=""
-               ;;
-        *irix*) AC_DEFINE(IRIX)
-               WRAP32=smbwrapper/smbwrapper.32.so
-               PICFLAG="-KPIC"
-               ;;
-        *aix*) AC_DEFINE(AIX);;
-        *hpux*) AC_DEFINE(HPUX);;
-        *qnx*) AC_DEFINE(QNX);;
-        *osf*) 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
@@ -54,9 +52,9 @@ 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)
@@ -64,7 +62,7 @@ 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 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)
+AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
 
 AC_CHECK_SIZEOF(int,cross)
 AC_CHECK_SIZEOF(long,cross)
@@ -97,12 +95,20 @@ fi
 
 # stupid glibc has the functions but no declaration. grrrr.
 AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
-    AC_TRY_COMPILE([#include <unistd.h>],[int i = setresuid],
+    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.
 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
@@ -180,15 +186,17 @@ if test x"$ac_cv_func_connect" = x"no"; then
 fi
 
 
-AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot)
+AC_CHECK_FUNCS(waitpid getcwd strdup strtoul 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(initgroups select rdchk getgrnam pathconf putprpwnam)
-AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64)
-AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64)
-AC_CHECK_FUNCS(fseek64 ftell64 bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
-AC_CHECK_FUNCS(srandom random srand rand setenv)
+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)
+AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64 fopen64)
+AC_CHECK_FUNCS(atexit grantpt dup2 lseek64 ftruncate64)
+AC_CHECK_FUNCS(fseek64 ftell64 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)
@@ -205,6 +213,80 @@ 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.
+#
+
+AC_LIBTESTFUNC(security, putprpwnam)
+AC_LIBTESTFUNC(sec, putprpwnam)
+
+AC_LIBTESTFUNC(security, set_auth_parameters)
+AC_LIBTESTFUNC(sec, set_auth_parameters)
+
+AC_LIBTESTFUNC(security, getspnam)
+AC_LIBTESTFUNC(sec, getspnam)
+
+AC_LIBTESTFUNC(security, bigcrypt)
+AC_LIBTESTFUNC(sec, bigcrypt)
+
+AC_LIBTESTFUNC(security, getprpwnam)
+AC_LIBTESTFUNC(sec, getprpwnam)
+
+# 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
+
+# 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); }],
@@ -359,6 +441,55 @@ 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
+
+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
+
 AC_MSG_CHECKING([for test routines])
 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
            AC_MSG_RESULT(yes),
@@ -506,6 +637,43 @@ 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
 AC_MSG_CHECKING(whether to use AFS)
@@ -607,6 +775,7 @@ AC_ARG_WITH(ldap,
   yes)
     AC_MSG_RESULT(yes)
     AC_DEFINE(WITH_LDAP)
+    LIBS="$LIBS -lldap -llber"
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -723,6 +892,26 @@ 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