Fix typo in comment.
[samba.git] / source3 / configure.in
index fb2ed2ee730890eba9a91ef3ca824b871ee60b6d..a8ae1c760e359375f3c80968bd5525b6116aac23 100644 (file)
@@ -13,14 +13,15 @@ AC_ARG_WITH(fhs,
 [  --with-fhs              Use FHS-compliant paths (default=no)],
     configdir="${sysconfdir}/samba"
     lockdir="\${VARDIR}/cache/samba"
-    piddir="\$(VARDIR)/run/samba"
+    piddir="\${VARDIR}/run/samba"
     logfilebase="\${VARDIR}/log/samba"
     privatedir="\${CONFIGDIR}/private"
+    libdir="\${prefix}/lib/samba"
     swatdir="\${DATADIR}/samba/swat",
-    configdir="\$(LIBDIR)"
-    logfilebase="\$(VARDIR)"
+    configdir="\${LIBDIR}"
+    logfilebase="\${VARDIR}"
     lockdir="\${VARDIR}/locks"
-    piddir="\$(VARDIR)/locks"
+    piddir="\${VARDIR}/locks"
     privatedir="\${prefix}/private"
     swatdir="\${prefix}/swat")
 
@@ -131,16 +132,10 @@ AC_SUBST(sbindir)
 
 dnl Unique-to-Samba variables we'll be playing with.
 AC_SUBST(SHELL)
-AC_SUBST(RUNPROG)
-AC_SUBST(MPROGS)
 AC_SUBST(LDSHFLAGS)
 AC_SUBST(SONAMEFLAG)
 AC_SUBST(SHLD)
 AC_SUBST(HOST_OS)
-AC_SUBST(PAM_MOD)
-AC_SUBST(WRAP)
-AC_SUBST(WRAP32)
-AC_SUBST(WRAPPROG)
 AC_SUBST(PICFLAG)
 AC_SUBST(PICSUFFIX)
 AC_SUBST(POBAD_CC)
@@ -149,6 +144,11 @@ AC_SUBST(LIBSMBCLIENT_SHARED)
 AC_SUBST(LIBSMBCLIENT)
 AC_SUBST(PRINTLIBS)
 AC_SUBST(AUTHLIBS)
+AC_SUBST(SHLIB_PROGS)
+AC_SUBST(SMBWRAPPER)
+AC_SUBST(EXTRA_BIN_PROGS)
+AC_SUBST(EXTRA_SBIN_PROGS)
+AC_SUBST(EXTRA_ALL_TARGETS)
 
 # compile with optimization and without debugging by default
 CFLAGS="-O ${CFLAGS}"
@@ -191,6 +191,9 @@ AC_PROG_LD_GNU
 dnl needed before AC_TRY_COMPILE
 AC_ISC_POSIX
 
+dnl look for executable suffix
+AC_EXEEXT
+
 dnl Check if C compiler understands -c and -o at the same time
 AC_PROG_CC_C_O
 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
@@ -726,7 +729,7 @@ if test x"$ac_cv_func_connect" = x"no"; then
 fi
 
 ###############################################
-# test for where we get get_yp_default_domain() from
+# test for where we get yp_get_default_domain() from
 AC_CHECK_FUNCS(yp_get_default_domain)
 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
        AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
@@ -736,9 +739,7 @@ fi
 # Check if we have execl, if not we need to compile smbrun.
 AC_CHECK_FUNCS(execl)
 if test x"$ac_cv_func_execl" = x"no"; then
-    RUNPROG="bin/smbrun"
-else
-    RUNPROG=""
+    EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbrun\$(EXEEXT)"
 fi
 
 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
@@ -751,8 +752,8 @@ AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64
 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
 AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm)
-# setbuffer is needed for smbtorture
-AC_CHECK_FUNCS(setbuffer)
+# setbuffer, shmget, shm_open are needed for smbtorture
+AC_CHECK_FUNCS(setbuffer shmget shm_open)
 
 # syscall() is needed for smbwrapper.
 AC_CHECK_FUNCS(syscall)
@@ -872,7 +873,7 @@ case "$host_os" in
                        PICFLAG="-fPIC"
                        SONAMEFLAG="-Wl,-soname="
                        AC_DEFINE(STAT_ST_BLOCKSIZE,512)
-               ;;
+                       ;;
                *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
                        BLDSHARED="true"
                        LDSHFLAGS="-G"
@@ -891,27 +892,28 @@ case "$host_os" in
                                PICSUFFIX="po.o"
                        fi
                        AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
-               ;;
+                       ;;
                *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
                        BLDSHARED="true"
                        LDSHFLAGS="-G"
                        SONAMEFLAG="-Wl,-h,"
                        PICFLAG="-KPIC"   # Is this correct for SunOS
-               ;;
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
                *freebsd*)  BLDSHARED="true"
                        LDSHFLAGS="-shared"
                        DYNEXP="-Wl,--export-dynamic"
                        SONAMEFLAG="-Wl,-soname,"
                        PICFLAG="-fPIC -DPIC"
                        AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
-               ;;
+                       ;;
                *openbsd*)  BLDSHARED="true"
                        LDSHFLAGS="-shared"
                        DYNEXP="-Wl,-Bdynamic"
                        SONAMEFLAG="-Wl,-soname,"
                        PICFLAG="-fPIC"
                        AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
-               ;;
+                       ;;
                *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
                        case "$host_os" in
                        *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
@@ -928,7 +930,7 @@ case "$host_os" in
                                PICFLAG="-KPIC"
                        fi
                        AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
-               ;;
+                       ;;
                *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
                        BLDSHARED="true"
                        LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
@@ -940,7 +942,7 @@ case "$host_os" in
                        fi
 
                        AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
-               ;;
+                       ;;
                *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
                        SHLIBEXT="sl"
                        # Use special PIC flags for the native HP-UX compiler.
@@ -953,23 +955,33 @@ case "$host_os" in
                        fi
                        DYNEXP="-Wl,-E"
                        AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
-               ;;
-               *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx]);;
+                       ;;
+               *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
                *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
                        BLDSHARED="true"
                        LDSHFLAGS="-shared"
                        SONAMEFLAG="-Wl,-soname,"
                        PICFLAG="-fPIC"
-               ;;
-               *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix]);;
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
+               *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
                *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
                        BLDSHARED="true"
                        LDSHFLAGS="-shared"
                        SONAMEFLAG="-Wl,-soname,"
                        PICFLAG="-KPIC"
-               ;;
-               *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2]);;
-               *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
+               *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
+               *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
                *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
                        case "$host" in
                                *-univel-*)     if [ test "$GCC" != yes ]; then
@@ -980,14 +992,19 @@ case "$host_os" in
                                ;;
                                *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
                        esac
-               ;;
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
 
                *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
                        if [ test "$GCC" != yes ]; then
                                AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
                        fi
                        LDSHFLAGS="-G"
-               ;;
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
+               *)
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       ;;
 esac
 AC_SUBST(DYNEXP)
 AC_MSG_RESULT($BLDSHARED)
@@ -1171,13 +1188,6 @@ if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
     AC_DEFINE(SEEKDIR_RETURNS_VOID,1,[Whether 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__);],
-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,1,[Whether there is a __FILE__ macro])
-fi
-
 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
@@ -1885,7 +1895,7 @@ AC_ARG_WITH(smbwrapper,
   yes)
     AC_MSG_RESULT(yes)
     AC_DEFINE(WITH_SMBWRAPPER,1,[Whether to include smbwrapper support])
-       WRAPPROG="bin/smbsh"
+       WRAPPROG="bin/smbsh\$(EXEEXT)"
        WRAP="bin/smbwrapper.$SHLIBEXT"
 
        if test x$ATTEMPT_WRAP32_BUILD = x; then
@@ -1907,6 +1917,8 @@ AC_ARG_WITH(smbwrapper,
           WRAP=""
           WRAP32=""
        fi
+       EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS $WRAPPROG $WRAP $WRAP32"
+       SMBWRAPPER="$WRAPPROG $WRAP $WRAP32"
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2105,9 +2117,9 @@ AC_SUBST(MODULE_XML)
 
 #################################################
 # check for automount support
-AC_MSG_CHECKING(whether to use AUTOMOUNT)
+AC_MSG_CHECKING(whether to use automount)
 AC_ARG_WITH(automount,
-[  --with-automount        Include AUTOMOUNT support (default=no)],
+[  --with-automount        Include automount support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -2122,16 +2134,16 @@ AC_ARG_WITH(automount,
 
 #################################################
 # check for smbmount support
-AC_MSG_CHECKING(whether to use SMBMOUNT)
+AC_MSG_CHECKING(whether to use smbmount)
 AC_ARG_WITH(smbmount,
-[  --with-smbmount         Include SMBMOUNT (Linux only) support (default=no)],
+[  --with-smbmount         Include smbmount (Linux only) support (default=no)],
 [ case "$withval" in
   yes)
        case "$host_os" in
        *linux*)
                AC_MSG_RESULT(yes)
                AC_DEFINE(WITH_SMBMOUNT,1,[Whether to build smbmount])
-               MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
+               EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbmount bin/smbmnt bin/smbumount"
                ;;
        *)
                AC_MSG_ERROR(not on a linux system!)
@@ -2140,11 +2152,9 @@ AC_ARG_WITH(smbmount,
     ;;
   *)
     AC_MSG_RESULT(no)
-    MPROGS=
     ;;
   esac ],
   AC_MSG_RESULT(no)
-  MPROGS=
 )
 
 
@@ -2184,12 +2194,10 @@ AC_ARG_WITH(pam_smbpass,
 
        if test x$PICFLAG = x; then
           AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
-          PAM_MOD=""
        elif test x$ac_cv_lib_pam_pam_get_data = xno; then
           AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
-          PAM_MOD=""
        else
-          PAM_MOD="bin/pam_smbpass.so"
+          SHLIB_PROGS="$SHLIB_PROGS bin/pam_smbpass.so"
        fi
     ;;
   *)
@@ -2837,20 +2845,21 @@ samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)]
                AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
                AC_TRY_LINK([\
 #include <sys/types.h>
+#include <unistd.h>
 #include <sys/socket.h>
 #include <sys/uio.h>],
 [\
-       int fromfd, tofd;
+       int fromfd, tofd, ret, total=0;
        off_t offset, nwritten;
        struct sf_hdtr hdr;
        struct iovec hdtrl;
-       hdr->headers = &hdtrl;
-       hdr->hdr_cnt = 1;
-       hdr->trailers = NULL;
-       hdr->trl_cnt = 0;
+       hdr.headers = &hdtrl;
+       hdr.hdr_cnt = 1;
+       hdr.trailers = NULL;
+       hdr.trl_cnt = 0;
        hdtrl.iov_base = NULL;
        hdtrl.iov_len = 0;
-       int ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
+       ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
 ],
 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
 
@@ -2998,8 +3007,7 @@ samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
 
 #################################################
 # Check whether winbind is supported on this platform.  If so we need to
-# build and install client programs (WINBIND_TARGETS), sbin programs
-# (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
+# build and install client programs, sbin programs and shared libraries
 
 AC_MSG_CHECKING(whether to build winbind)
 
@@ -3024,6 +3032,9 @@ case "$host_os" in
                ;;
 esac
 
+AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
+AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
+
 # Check the setting of --with-winbindd
 
 AC_ARG_WITH(winbind,
@@ -3051,37 +3062,22 @@ fi
 
 # Display test results
 
-WINBIND_TARGETS=""
-WINBIND_STARGETS=""
-WINBIND_LTARGETS=""
-WINBIND_PAM_PROGS=""
-
 if test x"$HAVE_WINBIND" = x"yes"; then
         AC_MSG_RESULT(yes)
        AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
 
-       WINBIND_TARGETS="bin/wbinfo"
-       WINBIND_STARGETS="bin/winbindd"
+       EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
+       EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/winbindd\$(EXEEXT)"
         if test x"$BLDSHARED" = x"true"; then
-               WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
+               SHLIB_PROGS="$SHLIB_PROGS nsswitch/libnss_winbind.so"
                if test x"$with_pam" = x"yes"; then
-                       WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
+                       SHLIB_PROGS="$SHLIB_PROGS nsswitch/pam_winbind.so"
                fi
        fi
 else
         AC_MSG_RESULT(no$winbind_no_reason)
 fi
 
-
-# Substitution time!
-
-AC_SUBST(WINBIND_TARGETS)
-AC_SUBST(WINBIND_STARGETS)
-AC_SUBST(WINBIND_LTARGETS)
-AC_SUBST(WINBIND_PAM_TARGETS)
-AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
-AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
-
 # Solaris has some extra fields in struct passwd that need to be
 # initialised otherwise nscd crashes.  Unfortunately autoconf < 2.50
 # doesn't have the AC_CHECK_MEMBER macro which would be handy for checking
@@ -3149,18 +3145,16 @@ AC_SUBST(FLAGS1)
 # though they can coexist in different directories.)  In the future
 # this might make the Python stuff be built by default.
 
-# If you don't specify --with-python, we assume "python" anyhow,
-# because the extensions are not built until you specifically "make
-# python_ext".  --without-python turns them off.  Perhaps in the
-# future --with-python should make them automatically built by make
-# all.
+# Defaulting python breaks the clean target if python isn't installed
 
-PYTHON=python
+PYTHON=
 
 AC_ARG_WITH(python,
 [  --with-python=PYTHONNAME  build Python libraries],
 [ case "${withval-python}" in
   yes)
+       PYTHON=python
+       EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS python_ext"
        ;;
   no)
        PYTHON=
@@ -3190,10 +3184,7 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
 builddir=`pwd`
 AC_SUBST(builddir)
 
-# I added make files that are outside /source directory.
-# I know this is not a good solution, will work out a better
-# solution soon.                       --simo
-AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/sam/Makefile)
+AC_OUTPUT(include/stamp-h Makefile script/findsmb)
 
 #################################################
 # Print very concise instructions on building/use