updates from Albert Chin.
[Samba.git] / source / configure.in
blob657819cccc958fb433db0273182c79fc6c286f25
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(include/includes.h)
3 AC_CONFIG_HEADER(include/config.h)
5 #################################################
6 # Directory handling stuff to support both the
7 # legacy SAMBA directories and FHS compliant
8 # ones...
9 AC_PREFIX_DEFAULT(/usr/local/samba)
11 AC_ARG_WITH(fhs, 
12 [  --with-fhs              Use FHS-compliant paths (default=no)],
13     codepagedir="\$(DATADIR)/samba/codepages"
14     configdir="${sysconfdir}/samba"
15     lockdir="\${VARDIR}/cache/samba"
16     logfilebase="\${VARDIR}/log/samba"
17     privatedir="\${CONFIGDIR}/private"
18     swatdir="\${DATADIR}/samba/swat",
19     codepagedir="\$(LIBDIR)/codepages"
20     configdir="\$(LIBDIR)"
21     lockdir="\$(VARDIR)/locks"
22     logfilebase="\$(VARDIR)"
23     privatedir="\${prefix}/private"
24     swatdir="\${prefix}/swat")
26 #################################################
27 # set private directory location
28 AC_ARG_WITH(privatedir,
29 [  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
30 [ case "$withval" in
31   yes|no)
32   #
33   # Just in case anybody calls it without argument
34   #
35     AC_MSG_WARN([--with-privatedir called without argument - will use default])
36   ;;
37   * )
38     privatedir="$withval"
39     ;;
40   esac])
42 #################################################
43 # set lock directory location
44 AC_ARG_WITH(lockdir,
45 [  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
46 [ case "$withval" in
47   yes|no)
48   #
49   # Just in case anybody calls it without argument
50   #
51     AC_MSG_WARN([--with-lockdir called without argument - will use default])
52   ;;
53   * )
54     lockdir="$withval"
55     ;;
56   esac])
58 #################################################
59 # set SWAT directory location
60 AC_ARG_WITH(swatdir,
61 [  --with-swatdir=DIR      Where to put SWAT files ($ac_default_prefix/swat)],
62 [ case "$withval" in
63   yes|no)
64   #
65   # Just in case anybody does it
66   #
67     AC_MSG_WARN([--with-swatdir called without argument - will use default])
68   ;;
69   * )
70     swatdir="$withval"
71     ;;
72   esac])
74 #################################################
75 # set configuration directory location
76 AC_ARG_WITH(configdir,
77 [  --with-configdir=DIR    Where to put configuration files (\$libdir)],
78 [ case "$withval" in
79   yes|no)
80   #
81   # Just in case anybody does it
82   #
83     AC_MSG_WARN([--with-configdir called without argument - will use default])
84   ;;
85   * )
86     configdir="$withval"
87     ;;
88   esac])
90 #################################################
91 # set codepage directory location
92 AC_ARG_WITH(codepagedir,
93 [  --with-codepagedir=DIR  Where to put codepage files (\$libdir/codepages)],
94 [ case "$withval" in
95   yes|no)
96   #
97   # Just in case anybody does it
98   #
99     AC_MSG_WARN([--with-codepagedir called without argument - will use default])
100   ;;
101   * )
102     codepagedir="$withval"
103     ;;
104   esac])
107 AC_SUBST(codepagedir)
108 AC_SUBST(configdir)
109 AC_SUBST(lockdir)
110 AC_SUBST(logfilebase)
111 AC_SUBST(privatedir)
112 AC_SUBST(swatdir)
113 AC_SUBST(bindir)
114 AC_SUBST(sbindir)
116 dnl Unique-to-Samba variables we'll be playing with.
117 AC_SUBST(SHELL)
118 AC_SUBST(RUNPROG)
119 AC_SUBST(MPROGS)
120 AC_SUBST(LDSHFLAGS)
121 AC_SUBST(SHLD) 
122 AC_SUBST(HOST_OS)
123 AC_SUBST(PAM_MOD)
124 AC_SUBST(PDBEDIT)
125 AC_SUBST(WRAP)
126 AC_SUBST(WRAP32)
127 AC_SUBST(PICFLAG)
128 AC_SUBST(PICSUFFIX)
129 AC_SUBST(SHLIBEXT)
130 AC_SUBST(BLDSHARED)
131 AC_SUBST(LIBSMBCLIENT_SHARED)
132 AC_SUBST(LIBSMBCLIENT)
134 # compile with optimization and without debugging by default
135 CFLAGS="-O ${CFLAGS}"
137 AC_ARG_ENABLE(debug, 
138 [  --enable-debug          Turn on compiler debugging information (default=no)],
139     [if eval "test x$enable_debug = xyes"; then
140         CFLAGS="${CFLAGS} -g"
141     fi])
145 dnl Checks for programs.
146 AC_PROG_CC
147 AC_PROG_INSTALL
148 AC_PROG_AWK
150 dnl Check if C compiler understands -c and -o at the same time
151 AC_PROG_CC_C_O
152 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
153       BROKEN_CC=
154 else
155       BROKEN_CC=#
157 AC_SUBST(BROKEN_CC)
159 dnl Check if the C compiler understands volatile (it should, being ANSI).
160 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
161     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
162         samba_cv_volatile=yes,samba_cv_volatile=no)])
163 if test x"$samba_cv_volatile" = x"yes"; then
164    AC_DEFINE(HAVE_VOLATILE)
169 AC_CANONICAL_SYSTEM
171 dnl Add #include for broken IRIX header files
172   case "$host_os" in
173         *irix6*) AC_ADD_INCLUDE(<standards.h>)
174         ;;
175 esac
177 AC_VALIDATE_CACHE_SYSTEM_TYPE
180 # Config CPPFLAG settings for strange OS's that must be set
181 # before other tests.
183 case "$host_os" in
184 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
185     *hpux*)
186       AC_PROG_CC_FLAG(Ae)
187       # mmap on HPUX is completely broken...
188       AC_DEFINE(MMAP_BLACKLIST)
189       if test $ac_cv_prog_cc_Ae = yes; then
190         CPPFLAGS="$CPPFLAGS -Ae"
191       fi
193 # Defines needed for HPUX support.
194 # HPUX has bigcrypt but (sometimes?) doesn't use it for
195 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
197       case `uname -r` in
198                         *9*|*10*)
199                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE"
200                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
201                                 ;;
202                         *11*)
203                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE"
204                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
205                                 ;;
206       esac
207       ;;
209 # AIX4.x doesn't even admit to having large
210 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
212     *aix4*)
213           AC_MSG_RESULT([enabling large file support])
214       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
215       ;;    
217 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
218 # to the existance of large files..
219 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
220 # recommendations on large file support, however it makes the
221 # compile work using gcc 2.7 and 2.8, whereas using the Sun
222 # recommendation makes the compile fail on gcc2.7. JRA.
224         *solaris*)
225                 case `uname -r` in
226                         5.0*|5.1*|5.2*|5.3*|5.5*)
227                                 AC_MSG_RESULT([no large file support])
228                                 ;;
229                         5.*)
230                         AC_MSG_RESULT([enabling large file support])
231                         if test "$ac_cv_prog_gcc" = yes; then
232                                 ${CC-cc} -v >conftest.c 2>&1
233                                 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
234                                 rm -fr conftest.c
235                                 case "$ac_cv_gcc_compiler_version_number" in
236                                         *"gcc version 2.6"*|*"gcc version 2.7"*)
237                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
238                                                 ;;
239                                         *)
240                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
241                                                 ;;
242                                 esac
243                         else
244                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
245                         fi
246                         ;;
247                 esac
248                 ;;
250 # Tests needed for SINIX large file support.
252     *sysv4*)
253       if test $host = mips-sni-sysv4 ; then
254         AC_MSG_CHECKING([for LFS support])
255         old_CPPFLAGS="$CPPFLAGS"
256         CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
257         AC_TRY_RUN([
258 #include <unistd.h>
259 main () {
260 #if _LFS64_LARGEFILE == 1
261 exit(0);
262 #else
263 exit(1);
264 #endif
265 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
266         CPPFLAGS="$old_CPPFLAGS"
267         if test x$SINIX_LFS_SUPPORT = xyes ; then
268           CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
269           CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
270           LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
271           LIBS="`getconf LFS64_LIBS` $LIBS"
272         fi
273       AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
274       fi
275     ;;
277 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
279     *linux*)
280         AC_MSG_CHECKING([for LFS support])
281         old_CPPFLAGS="$CPPFLAGS"
282         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
283        AC_TRY_RUN([
284 #include <unistd.h>
285 #include <sys/utsname.h>
286 main() {
287 #if _LFS64_LARGEFILE == 1
288        struct utsname uts;
289        char *release;
290        int major, minor;
292        /* Ensure this is glibc 2.2 or higher */
293 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
294        int libc_major = __GLIBC__;
295        int libc_minor = __GLIBC_MINOR__;
297        if (libc_major < 2)
298               exit(1);
299        if (libc_minor < 2)
300               exit(1);
301 #endif
303        /* Ensure this is kernel 2.4 or higher */
305        uname(&uts);
306        release = uts.release;
307        major = atoi(strsep(&release, "."));
308        minor = atoi(strsep(&release, "."));
310        if (major > 2 || (major == 2 && minor > 3))
311                exit(0);
312        exit(1);
313 #else
314        exit(1);
315 #endif
317 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
318         CPPFLAGS="$old_CPPFLAGS"
319         if test x$LINUX_LFS_SUPPORT = xyes ; then
320           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
321         fi
322        AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
323                 ;;
325     *hurd*)
326         AC_MSG_CHECKING([for LFS support])
327         old_CPPFLAGS="$CPPFLAGS"
328         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
329         AC_TRY_RUN([
330 #include <unistd.h>
331 main () {
332 #if _LFS64_LARGEFILE == 1
333 exit(0);
334 #else
335 exit(1);
336 #endif
337 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
338         CPPFLAGS="$old_CPPFLAGS"
339         if test x$GLIBC_LFS_SUPPORT = xyes ; then
340           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
341         fi
342       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
343     ;;
345 esac
347 AC_INLINE
348 AC_HEADER_STDC
349 AC_HEADER_DIRENT
350 AC_HEADER_TIME
351 AC_HEADER_SYS_WAIT
352 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
353 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
354 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
355 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
356 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
357 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
358 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
359 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h)
362 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
363 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
365 case "$host_os" in
366     *hpux*)
367                 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
368                         ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
369                 if test x"$ac_cv_header_shadow_h" = x"yes"; then
370                    AC_DEFINE(HAVE_SHADOW_H)
371                 fi
372         ;;
373 esac
374 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
375 AC_CHECK_HEADERS(nss.h nss_common.h sys/security.h security/pam_appl.h security/pam_modules.h)
376 AC_CHECK_HEADERS(stropts.h poll.h)
377 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
378 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
380 # For experimental utmp support (lastlog on some BSD-like systems)
381 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
383 # For quotas on Veritas VxFS filesystems
384 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
386 AC_CHECK_SIZEOF(int,cross)
387 AC_CHECK_SIZEOF(long,cross)
388 AC_CHECK_SIZEOF(short,cross)
390 AC_C_CONST
391 AC_C_INLINE
392 AC_C_BIGENDIAN
393 AC_C_CHAR_UNSIGNED
395 AC_TYPE_SIGNAL
396 AC_TYPE_UID_T
397 AC_TYPE_MODE_T
398 AC_TYPE_OFF_T
399 AC_TYPE_SIZE_T
400 AC_TYPE_PID_T
401 AC_STRUCT_ST_RDEV
402 AC_DIRENT_D_OFF
403 AC_CHECK_TYPE(ino_t,unsigned)
404 AC_CHECK_TYPE(loff_t,off_t)
405 AC_CHECK_TYPE(offset_t,loff_t)
406 AC_CHECK_TYPE(ssize_t, int)
407 AC_CHECK_TYPE(wchar_t, unsigned short)
409 ############################################
410 # for cups support we need libcups, and a handful of header files
412 AC_CHECK_LIB(cups,httpConnect)
414 # I wonder if there is a nicer way of doing this?
416 if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
417         AC_CHECK_HEADERS(cups/cups.h cups/language.h)
418         if test x"$ac_cv_header_cups_cups_h" = x"yes"; then
419                 if test x"$ac_cv_header_cups_language_h" = x"yes"; then
420                         AC_DEFINE(HAVE_CUPS)
421                 fi
422         fi
425 ############################################
426 # we need libdl for PAM and the new VFS code
427 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
428         AC_DEFINE(HAVE_LIBDL)])
430 ############################################
431 # check for unix domain sockets
432 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
433     AC_TRY_COMPILE([
434 #include <sys/types.h>
435 #include <stdlib.h>
436 #include <stddef.h>
437 #include <sys/socket.h>
438 #include <sys/un.h>],
440   struct sockaddr_un sunaddr; 
441   sunaddr.sun_family = AF_UNIX;
443         samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
444 if test x"$samba_cv_unixsocket" = x"yes"; then
445    AC_DEFINE(HAVE_UNIXSOCKET)
448 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
449     AC_TRY_COMPILE([
450 #include <sys/types.h>
451 #if STDC_HEADERS
452 #include <stdlib.h>
453 #include <stddef.h>
454 #endif
455 #include <sys/socket.h>],[socklen_t i = 0],
456     samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
457 if test x"$samba_cv_socklen_t" = x"yes"; then
458    AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
461 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
462     AC_TRY_COMPILE([
463 #include <sys/types.h>
464 #if STDC_HEADERS
465 #include <stdlib.h>
466 #include <stddef.h>
467 #endif
468 #include <signal.h>],[sig_atomic_t i = 0],
469         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
470 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
471    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
474 # stupid headers have the functions but no declaration. grrrr.
475 AC_HAVE_DECL(errno, [#include <errno.h>])
476 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
477 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
478 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
479 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
480 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
481 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
483 # and glibc has setresuid under linux but the function does
484 # nothing until kernel 2.1.44! very dumb.
485 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
486     AC_TRY_RUN([#include <errno.h>
487 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
488         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
489 if test x"$samba_cv_have_setresuid" = x"yes"; then
490     AC_DEFINE(HAVE_SETRESUID)
493 # Do the same check for setresguid...
495 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
496     AC_TRY_RUN([#include <unistd.h>
497 #include <errno.h>
498 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
499         samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
500 if test x"$samba_cv_have_setresgid" = x"yes"; then
501     AC_DEFINE(HAVE_SETRESGID)
504 AC_FUNC_MEMCMP
506 ###############################################
507 # Readline included by default unless explicitly asked not to
508 test "${with_readline+set}" != "set" && with_readline=yes
510 # test for where we get readline() from
511 AC_MSG_CHECKING(whether to use readline)
512 AC_ARG_WITH(readline,
513 [  --with-readline[=DIR]   Look for readline include/libs in DIR (default=auto)],
514 [  case "$with_readline" in
515   yes)
516     AC_MSG_RESULT(yes)
518     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
519     AC_CHECK_HEADERS(readline/history.h)
521     AC_CHECK_HEADERS(readline.h readline/readline.h,[
522       for termlib in ncurses curses termcap terminfo termlib; do
523        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
524       done
525       AC_CHECK_LIB(readline, rl_callback_handler_install,
526        [TERMLIBS="-lreadline $TERMLIBS"
527        AC_DEFINE(HAVE_LIBREADLINE)
528        break], [TERMLIBS=], $TERMLIBS)])
529     ;;
530   no)
531     AC_MSG_RESULT(no)
532     ;;
533   *)
534     AC_MSG_RESULT(yes)
536     # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
537     # alternate readline path
538     _ldflags=${LDFLAGS}
539     _cppflags=${CPPFLAGS}
541     # Add additional search path
542     LDFLAGS="-L$with_readline/lib $LDFLAGS"
543     CPPFLAGS="-I$with_readline/include $CPPFLAGS"
545     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
546     AC_CHECK_HEADERS(readline/history.h)
548     AC_CHECK_HEADERS(readline.h readline/readline.h,[
549       for termlib in ncurses curses termcap terminfo termlib; do
550        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
551       done
552       AC_CHECK_LIB(readline, rl_callback_handler_install,
553        [TERMLDFLAGS="-L$with_readline/lib"
554        TERMCPPFLAGS="-I$with_readline/include"
555        CPPFLAGS="-I$with_readline/include $CPPFLAGS"
556        TERMLIBS="-lreadline $TERMLIBS"
557        AC_DEFINE(HAVE_LIBREADLINE)
558        break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
560     LDFLAGS=$_ldflags
561     ;;
562   esac],
563   AC_MSG_RESULT(no)
565 AC_SUBST(TERMLIBS)
566 AC_SUBST(TERMLDFLAGS)
568 # The following test taken from the cvs sources
569 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
570 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
571 # libsocket.so which has a bad implementation of gethostbyname (it
572 # only looks in /etc/hosts), so we only look for -lsocket if we need
573 # it.
574 AC_CHECK_FUNCS(connect)
575 if test x"$ac_cv_func_connect" = x"no"; then
576     case "$LIBS" in
577     *-lnsl*) ;;
578     *) AC_CHECK_LIB(nsl_s, printf) ;;
579     esac
580     case "$LIBS" in
581     *-lnsl*) ;;
582     *) AC_CHECK_LIB(nsl, printf) ;;
583     esac
584     case "$LIBS" in
585     *-lsocket*) ;;
586     *) AC_CHECK_LIB(socket, connect) ;;
587     esac
588     case "$LIBS" in
589     *-linet*) ;;
590     *) AC_CHECK_LIB(inet, connect) ;;
591     esac
592     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
593     dnl has been cached.
594     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
595        test x"$ac_cv_lib_inet_connect" = x"yes"; then
596         # ac_cv_func_connect=yes
597         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
598         AC_DEFINE(HAVE_CONNECT)
599     fi
602 ###############################################
603 # test for where we get get_yp_default_domain() from
604 AC_CHECK_FUNCS(yp_get_default_domain)
605 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
606         AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
607         AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)]) 
610 # Check if we have execl, if not we need to compile smbrun.
611 AC_CHECK_FUNCS(execl)
612 if test x"$ac_cv_func_execl" = x"no"; then
613     RUNPROG="bin/smbrun"
614 else
615     RUNPROG=""
618 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
619 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
620 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
621 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
622 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
623 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
624 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
625 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
626 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
628 # syscall() is needed for smbwrapper.
629 AC_CHECK_FUNCS(syscall)
631 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
632 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
633 AC_CHECK_FUNCS(__getcwd _getcwd)
634 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
635 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
636 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
637 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
638 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
639 AC_CHECK_FUNCS(_write __write _fork __fork)
640 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
641 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
642 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
643 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
644 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
647 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
650 if test x$ac_cv_func_stat64 = xno ; then
651   AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
652   AC_TRY_LINK([
653 #if defined(HAVE_UNISTD_H)
654 #include <unistd.h>
655 #endif
656 #include <sys/stat.h>
657 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
658   AC_MSG_RESULT([$ac_cv_func_stat64])
659   if test x$ac_cv_func_stat64 = xyes ; then
660     AC_DEFINE(HAVE_STAT64)
661   fi
664 if test x$ac_cv_func_lstat64 = xno ; then
665   AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
666   AC_TRY_LINK([
667 #if defined(HAVE_UNISTD_H)
668 #include <unistd.h>
669 #endif
670 #include <sys/stat.h>
671 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
672   AC_MSG_RESULT([$ac_cv_func_lstat64])
673   if test x$ac_cv_func_lstat64 = xyes ; then
674     AC_DEFINE(HAVE_LSTAT64)
675   fi
678 if test x$ac_cv_func_fstat64 = xno ; then
679   AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
680   AC_TRY_LINK([
681 #if defined(HAVE_UNISTD_H)
682 #include <unistd.h>
683 #endif
684 #include <sys/stat.h>
685 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
686   AC_MSG_RESULT([$ac_cv_func_fstat64])
687   if test x$ac_cv_func_fstat64 = xyes ; then
688     AC_DEFINE(HAVE_FSTAT64)
689   fi
693 # If no strcasecmp, check for it in some known places
694 # It is in -lresolv on ReliantUNIX and UnixWare
695 #   -lresolve *must* follow -lnsl for name resolution to work properly
698 if test x$ac_cv_func_strcasecmp = xno ; then
699         AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
700                 AC_DEFINE(HAVE_STRCASECMP))
704 # Check for the functions putprpwnam, set_auth_parameters,
705 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
706 # Needed for OSF1 and HPUX.
709 AC_LIBTESTFUNC(security, putprpwnam)
710 AC_LIBTESTFUNC(sec, putprpwnam)
712 AC_LIBTESTFUNC(security, set_auth_parameters)
713 AC_LIBTESTFUNC(sec, set_auth_parameters)
715 # UnixWare 7.x has its getspnam in -lgen
716 AC_LIBTESTFUNC(gen, getspnam)
718 AC_LIBTESTFUNC(security, getspnam)
719 AC_LIBTESTFUNC(sec, getspnam)
721 AC_LIBTESTFUNC(security, bigcrypt)
722 AC_LIBTESTFUNC(sec, bigcrypt)
724 AC_LIBTESTFUNC(security, getprpwnam)
725 AC_LIBTESTFUNC(sec, getprpwnam)
727 # this bit needs to be modified for each OS that is suported by
728 # smbwrapper. You need to specify how to created a shared library and
729 # how to compile C code to produce PIC object files
731 # these are the defaults, good for lots of systems
732 HOST_OS="$host_os"
733 LDSHFLAGS="-shared"
734 SHLD="\${CC}" 
735 PICFLAG=""
736 PICSUFFIX="po.o"
737 SHLIBEXT="so"
738 # Assume non-shared by default and override below
739 BLDSHARED="false" 
741 # and these are for particular systems
742 case "$host_os" in
743                 *linux*)   AC_DEFINE(LINUX)
744                         BLDSHARED="true"
745                         LDSHFLAGS="-shared"
746                         PICFLAG="-fPIC"
747                 ;;
748                 *solaris*) AC_DEFINE(SUNOS5)
749                                 ;;
750                 *sunos*) AC_DEFINE(SUNOS4)
751                 ;;
752                 *bsd*) LDSHFLAGS="-shared -Bshareable"
753                 ;;
754                 *irix*) AC_DEFINE(IRIX)
755                         case "$host_os" in
756                         *irix6*) AC_DEFINE(IRIX6)
757                         ;;
758                         esac
759                         ATTEMPT_WRAP32_BUILD=yes
760                 ;;
761                 *aix*) AC_DEFINE(AIX)
762                         # AIX is too ugly for now
763                 ;;
764                 *hpux*) AC_DEFINE(HPUX)
765                         SHLIBEXT="sl"
766                         # Use special PIC flags for the native HP-UX compiler.
767                         if test $ac_cv_prog_cc_Ae = yes; then
768                                 LDSHFLAGS="-b"
769                                 PICFLAG="+z"
770                         fi
771                 ;;
772                 *qnx*) AC_DEFINE(QNX);;
773                 *osf*) AC_DEFINE(OSF1);;
774                 *sco*) AC_DEFINE(SCO);;
775                 *next2*) AC_DEFINE(NEXT2);;
776                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
777                 *sysv4*)
778                         case "$host" in
779                                 *-univel-*)     if [ test "$GCC" != yes ]; then
780                                                                         AC_DEFINE(HAVE_MEMSET)
781                                                                 fi
782                                                                 LDSHFLAGS="-G"
783                                 ;;
784                                 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
785                         esac
786                         ;;
787                 *sysv5*)
788                         if [ test "$GCC" != yes ]; then
789                                 AC_DEFINE(HAVE_MEMSET)
790                         fi
791                         LDSHFLAGS="-G"
792                         ;;
793 esac
795 # try to work out how to produce pic code with this compiler
796 AC_PROG_CC_FLAG(fpic)
797 if test $ac_cv_prog_cc_fpic = yes; then
798     PICFLAG="-fpic";
800 if test x$PICFLAG = x; then
801   AC_PROG_CC_FLAG(KPIC)
802   if test $ac_cv_prog_cc_KPIC = yes; then
803     PICFLAG="-KPIC";
804   fi
806 if test x$PICFLAG = x; then
807   AC_PROG_CC_FLAG(Kpic)
808   if test $ac_cv_prog_cc_Kpic = yes; then
809     PICFLAG="-Kpic";
810   fi
813 ################
815 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
816 AC_TRY_RUN([#include <stdio.h>
817 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
818 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
819 if test x"$samba_cv_have_longlong" = x"yes"; then
820     AC_DEFINE(HAVE_LONGLONG)
824 # Check if the compiler supports the LL prefix on long long integers.
825 # AIX needs this.
827 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
828     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
829         samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
830 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
831    AC_DEFINE(COMPILER_SUPPORTS_LL)
834   
835 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
836 AC_TRY_RUN([#include <stdio.h>
837 #include <sys/stat.h>
838 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
839 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
840 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
841     AC_DEFINE(SIZEOF_OFF_T,8)
844 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
845 AC_TRY_RUN([
846 #if defined(HAVE_UNISTD_H)
847 #include <unistd.h>
848 #endif
849 #include <stdio.h>
850 #include <sys/stat.h>
851 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
852 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
853 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
854     AC_DEFINE(HAVE_OFF64_T)
857 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
858 AC_TRY_RUN([#include <stdio.h>
859 #include <sys/stat.h>
860 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
861 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
862 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
863     AC_DEFINE(SIZEOF_INO_T,8)
866 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
867 AC_TRY_RUN([
868 #if defined(HAVE_UNISTD_H)
869 #include <unistd.h>
870 #endif
871 #include <stdio.h>
872 #include <sys/stat.h>
873 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
874 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
875 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
876     AC_DEFINE(HAVE_INO64_T)
879 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
880 AC_TRY_COMPILE([
881 #if defined(HAVE_UNISTD_H)
882 #include <unistd.h>
883 #endif
884 #include <sys/types.h>
885 #include <dirent.h>],
886 [struct dirent64 de;],
887 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
888 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
889     AC_DEFINE(HAVE_STRUCT_DIRENT64)
892 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
893 AC_TRY_RUN([#include <stdio.h>
894 main() { char c; c=250; exit((c > 0)?0:1); }],
895 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
896 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
897     AC_DEFINE(HAVE_UNSIGNED_CHAR)
900 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
901 AC_TRY_COMPILE([#include <sys/types.h>
902 #include <sys/socket.h>
903 #include <netinet/in.h>],
904 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
905 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
906 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
907     AC_DEFINE(HAVE_SOCK_SIN_LEN)
910 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
911 AC_TRY_COMPILE([#include <sys/types.h>
912 #include <dirent.h>
913 void seekdir(DIR *d, long loc) { return; }],[return 0;],
914 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
915 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
916     AC_DEFINE(SEEKDIR_RETURNS_VOID)
919 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
920 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
921 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
922 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
923     AC_DEFINE(HAVE_FILE_MACRO)
926 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
927 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
928 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
929 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
930     AC_DEFINE(HAVE_FUNCTION_MACRO)
933 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
934 AC_TRY_RUN([
935 #include <sys/time.h>
936 #include <unistd.h>
937 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
938            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
939 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
940     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
943 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
944 AC_TRY_RUN([
945 #include <sys/types.h>
946 #include <stdarg.h>
947 void foo(const char *format, ...) { 
948        va_list ap;
949        int len;
950        char buf[5];
952        va_start(ap, format);
953        len = vsnprintf(0, 0, format, ap);
954        va_end(ap);
955        if (len != 5) exit(1);
957        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
959        exit(0);
961 main() { foo("hello"); }
963 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
964 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
965     AC_DEFINE(HAVE_C99_VSNPRINTF)
968 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
969 AC_TRY_RUN([#include <sys/types.h>
970 #include <dirent.h>
971 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
972 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
973 di->d_name[0] == 0) exit(0); exit(1);} ],
974 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
975 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
976     AC_DEFINE(HAVE_BROKEN_READDIR)
979 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
980 AC_TRY_COMPILE([#include <sys/types.h>
981 #include <utime.h>],
982 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
983 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
984 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
985     AC_DEFINE(HAVE_UTIMBUF)
988 dnl  utmp and utmpx come in many flavours
989 dnl  We need to check for many of them
990 dnl  But we don't need to do each and every one, because our code uses
991 dnl  mostly just the utmp (not utmpx) fields.
993 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
995 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
996 AC_TRY_COMPILE([#include <sys/types.h>
997 #include <utmp.h>],
998 [struct utmp ut;  ut.ut_name[0] = 'a';],
999 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
1000 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
1001     AC_DEFINE(HAVE_UT_UT_NAME)
1002 fi 
1004 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
1005 AC_TRY_COMPILE([#include <sys/types.h>
1006 #include <utmp.h>],
1007 [struct utmp ut;  ut.ut_user[0] = 'a';],
1008 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
1009 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
1010     AC_DEFINE(HAVE_UT_UT_USER)
1011 fi 
1013 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
1014 AC_TRY_COMPILE([#include <sys/types.h>
1015 #include <utmp.h>],
1016 [struct utmp ut;  ut.ut_id[0] = 'a';],
1017 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
1018 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
1019     AC_DEFINE(HAVE_UT_UT_ID)
1020 fi 
1022 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
1023 AC_TRY_COMPILE([#include <sys/types.h>
1024 #include <utmp.h>],
1025 [struct utmp ut;  ut.ut_host[0] = 'a';],
1026 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
1027 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
1028     AC_DEFINE(HAVE_UT_UT_HOST)
1029 fi 
1031 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
1032 AC_TRY_COMPILE([#include <sys/types.h>
1033 #include <utmp.h>],
1034 [struct utmp ut;  time_t t; ut.ut_time = t;],
1035 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
1036 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
1037     AC_DEFINE(HAVE_UT_UT_TIME)
1038 fi 
1040 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
1041 AC_TRY_COMPILE([#include <sys/types.h>
1042 #include <utmp.h>],
1043 [struct utmp ut;  struct timeval tv; ut.ut_tv = tv;],
1044 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
1045 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1046     AC_DEFINE(HAVE_UT_UT_TV)
1047 fi 
1049 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1050 AC_TRY_COMPILE([#include <sys/types.h>
1051 #include <utmp.h>],
1052 [struct utmp ut;  ut.ut_type = 0;],
1053 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1054 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1055     AC_DEFINE(HAVE_UT_UT_TYPE)
1056 fi 
1058 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1059 AC_TRY_COMPILE([#include <sys/types.h>
1060 #include <utmp.h>],
1061 [struct utmp ut;  ut.ut_pid = 0;],
1062 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1063 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1064     AC_DEFINE(HAVE_UT_UT_PID)
1065 fi 
1067 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1068 AC_TRY_COMPILE([#include <sys/types.h>
1069 #include <utmp.h>],
1070 [struct utmp ut;  ut.ut_exit.e_exit = 0;],
1071 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1072 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1073     AC_DEFINE(HAVE_UT_UT_EXIT)
1074 fi 
1076 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1077 AC_TRY_COMPILE([#include <sys/types.h>
1078 #include <utmp.h>],
1079 [struct utmp ut;  ut.ut_addr = 0;],
1080 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1081 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1082     AC_DEFINE(HAVE_UT_UT_ADDR)
1083 fi 
1085 if test x$ac_cv_func_pututline = xyes ; then
1086   AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1087   AC_TRY_COMPILE([#include <sys/types.h>
1088 #include <utmp.h>],
1089   [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1090   samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1091   if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1092       AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1093   fi
1096 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1097 AC_TRY_COMPILE([#include <sys/types.h>
1098 #include <utmpx.h>],
1099 [struct utmpx ux;  ux.ut_syslen = 0;],
1100 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1101 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1102     AC_DEFINE(HAVE_UX_UT_SYSLEN)
1103 fi 
1105 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1106 AC_TRY_RUN([
1107 #include <sys/types.h>
1108 #include <fcntl.h>
1109 #ifndef F_GETLEASE
1110 #define F_GETLEASE      1025
1111 #endif
1112 main() {
1113        int fd = open("/dev/null", O_RDONLY);
1114        return fcntl(fd, F_GETLEASE, 0) == -1;
1117 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1118 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1119     AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1122 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1123 AC_TRY_RUN([
1124 #include <sys/types.h>
1125 #include <fcntl.h>
1126 #include <signal.h>
1127 #ifndef F_NOTIFY
1128 #define F_NOTIFY 1026
1129 #endif
1130 main() {
1131         exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0);
1134 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1135 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1136     AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1139 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1140 AC_TRY_RUN([
1141 #include <sys/types.h>
1142 #include <fcntl.h>
1143 #include <signal.h>
1144 #include <sys/file.h>
1145 #ifndef LOCK_MAND
1146 #define LOCK_MAND       32
1147 #define LOCK_READ       64
1148 #endif
1149 main() {
1150         exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1153 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1154 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1155     AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1161 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1162 AC_TRY_COMPILE([#include <sys/types.h>
1163 #include <fcntl.h>],
1164 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1165 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1166 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1167     AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1170 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1171 AC_TRY_RUN([#include <sys/types.h>
1172 #include <sys/capability.h>
1173 main() {
1174  cap_t cap;
1175  if ((cap = cap_get_proc()) == NULL)
1176    exit(1);
1177  cap->cap_effective |= CAP_NETWORK_MGT;
1178  cap->cap_inheritable |= CAP_NETWORK_MGT;
1179  cap_set_proc(cap);
1180  exit(0);
1183 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1184 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1185     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1189 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1190 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1193 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1194 AC_TRY_COMPILE([#include <sys/types.h>
1195 #if defined(HAVE_RPC_RPC_H)
1196 #include <rpc/rpc.h>
1197 #endif],
1198 [int16 testvar;],
1199 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1200 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1201     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1204 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1205 AC_TRY_COMPILE([#include <sys/types.h>
1206 #if defined(HAVE_RPC_RPC_H)
1207 #include <rpc/rpc.h>
1208 #endif],
1209 [uint16 testvar;],
1210 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1211 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1212     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1215 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1216 AC_TRY_COMPILE([#include <sys/types.h>
1217 #if defined(HAVE_RPC_RPC_H)
1218 #include <rpc/rpc.h>
1219 #endif],
1220 [int32 testvar;],
1221 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1222 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1223     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1226 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1227 AC_TRY_COMPILE([#include <sys/types.h>
1228 #if defined(HAVE_RPC_RPC_H)
1229 #include <rpc/rpc.h>
1230 #endif],
1231 [uint32 testvar;],
1232 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1233 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1234     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1238 dnl Some systems (SCO) have a problem including
1239 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1240 dnl as a #define in <prot.h> and as part of an enum
1241 dnl in <rpc/rpc.h>.
1244 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1245 AC_TRY_COMPILE([#include <sys/types.h>
1246 #ifdef HAVE_SYS_SECURITY_H
1247 #include <sys/security.h>
1248 #include <prot.h>
1249 #endif  /* HAVE_SYS_SECURITY_H */
1250 #if defined(HAVE_RPC_RPC_H)
1251 #include <rpc/rpc.h>
1252 #endif],
1253 [int testvar;],
1254 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1255 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1256     AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1259 AC_MSG_CHECKING([for test routines])
1260 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1261            AC_MSG_RESULT(yes),
1262            AC_MSG_ERROR([cant find test code. Aborting config]),
1263            AC_MSG_WARN([cannot run when cross-compiling]))
1265 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1266 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1267            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1268 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1269     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1272 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1273 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1274            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1275 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1276     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1279 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1280 SAVE_CPPFLAGS="$CPPFLAGS"
1281 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
1282 AC_TRY_COMPILE([
1283 #define REPLACE_GETPASS 1
1284 #define NO_CONFIG_H 1
1285 #define main dont_declare_main
1286 #include "${srcdir-.}/lib/getsmbpass.c"
1287 #undef main
1288 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1289 CPPFLAGS="$SAVE_CPPFLAGS"
1291 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1292         AC_DEFINE(REPLACE_GETPASS)
1295 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1296 AC_TRY_RUN([
1297 #include <stdio.h>
1298 #include <sys/types.h>
1299 #include <netinet/in.h>
1300 #ifdef HAVE_ARPA_INET_H
1301 #include <arpa/inet.h>
1302 #endif
1303 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1304 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1305     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
1306 exit(1);}],
1307            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1308 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1309     AC_DEFINE(REPLACE_INET_NTOA)
1312 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1313 AC_TRY_RUN([#include <stdlib.h>
1314 #include <sys/types.h>
1315 #include <sys/stat.h>
1316 #include <unistd.h>
1317 main() { 
1318   struct stat st;
1319   char tpl[20]="/tmp/test.XXXXXX"; 
1320   int fd = mkstemp(tpl); 
1321   if (fd == -1) exit(1);
1322   unlink(tpl);
1323   if (fstat(fd, &st) != 0) exit(1);
1324   if ((st.st_mode & 0777) != 0600) exit(1);
1325   exit(0);
1327 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1328 samba_cv_HAVE_SECURE_MKSTEMP=no,
1329 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1330 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1331     AC_DEFINE(HAVE_SECURE_MKSTEMP)
1334 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1335 AC_TRY_RUN([#include <unistd.h>
1336 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1337 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1338 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1339     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1342 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1343 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1344            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1345 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1346     AC_DEFINE(HAVE_ROOT)
1347 else
1348     AC_MSG_WARN(running as non-root will disable some tests)
1351 ##################
1352 # look for a method of finding the list of network interfaces
1353 iface=no;
1354 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1355 AC_TRY_RUN([
1356 #define HAVE_IFACE_AIX 1
1357 #define AUTOCONF_TEST 1
1358 #include "confdefs.h"
1359 #include "${srcdir-.}/lib/interfaces.c"],
1360            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1361 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1362     iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1365 if test $iface = no; then
1366 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1367 AC_TRY_RUN([
1368 #define HAVE_IFACE_IFCONF 1
1369 #define AUTOCONF_TEST 1
1370 #include "confdefs.h"
1371 #include "${srcdir-.}/lib/interfaces.c"],
1372            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1373 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1374     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1378 if test $iface = no; then
1379 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1380 AC_TRY_RUN([
1381 #define HAVE_IFACE_IFREQ 1
1382 #define AUTOCONF_TEST 1
1383 #include "confdefs.h"
1384 #include "${srcdir-.}/lib/interfaces.c"],
1385            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1386 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1387     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1392 ################################################
1393 # look for a method of setting the effective uid
1394 seteuid=no;
1395 if test $seteuid = no; then
1396 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1397 AC_TRY_RUN([
1398 #define AUTOCONF_TEST 1
1399 #define USE_SETRESUID 1
1400 #include "confdefs.h"
1401 #include "${srcdir-.}/lib/util_sec.c"],
1402            samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1403 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1404     seteuid=yes;AC_DEFINE(USE_SETRESUID)
1409 if test $seteuid = no; then
1410 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1411 AC_TRY_RUN([
1412 #define AUTOCONF_TEST 1
1413 #define USE_SETREUID 1
1414 #include "confdefs.h"
1415 #include "${srcdir-.}/lib/util_sec.c"],
1416            samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1417 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1418     seteuid=yes;AC_DEFINE(USE_SETREUID)
1422 if test $seteuid = no; then
1423 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1424 AC_TRY_RUN([
1425 #define AUTOCONF_TEST 1
1426 #define USE_SETEUID 1
1427 #include "confdefs.h"
1428 #include "${srcdir-.}/lib/util_sec.c"],
1429            samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1430 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1431     seteuid=yes;AC_DEFINE(USE_SETEUID)
1435 if test $seteuid = no; then
1436 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1437 AC_TRY_RUN([
1438 #define AUTOCONF_TEST 1
1439 #define USE_SETUIDX 1
1440 #include "confdefs.h"
1441 #include "${srcdir-.}/lib/util_sec.c"],
1442            samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1443 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1444     seteuid=yes;AC_DEFINE(USE_SETUIDX)
1449 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1450 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1451            samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1452 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1453     AC_DEFINE(HAVE_MMAP)
1456 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1457 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1458            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1459 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1460     AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1463 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1464 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1465            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1466 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1467     AC_DEFINE(HAVE_FCNTL_LOCK)
1470 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1471 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1472            samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1473 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1474     AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1476 else
1479 dnl Don't check for 64 bit fcntl locking if we know that the
1480 dnl glibc2.1 broken check has succeeded.
1481 dnl 
1483   AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1484   AC_TRY_RUN([
1485 #if defined(HAVE_UNISTD_H)
1486 #include <unistd.h>
1487 #endif
1488 #include <stdio.h>
1489 #include <stdlib.h>
1491 #ifdef HAVE_FCNTL_H
1492 #include <fcntl.h>
1493 #endif
1495 #ifdef HAVE_SYS_FCNTL_H
1496 #include <sys/fcntl.h>
1497 #endif
1498 main() { struct flock64 fl64;
1499 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1500 exit(0);
1501 #else
1502 exit(1);
1503 #endif
1505        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1507   if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1508       AC_DEFINE(HAVE_STRUCT_FLOCK64)
1509   fi
1512 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1513 AC_TRY_COMPILE([#include <sys/acl.h>
1514 #if defined(HAVE_RPCSVC_NIS_H)
1515 #include <rpcsvc/nis.h>
1516 #endif],
1517 [return 0;],
1518 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1519 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1520     AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1524 #################################################
1525 # check for smbwrapper support
1526 AC_MSG_CHECKING(whether to use smbwrapper)
1527 AC_ARG_WITH(smbwrapper,
1528 [  --with-smbwrapper       Include SMB wrapper support (default=no)],
1529 [ case "$withval" in
1530   yes)
1531     AC_MSG_RESULT(yes)
1532     AC_DEFINE(WITH_SMBWRAPPER)
1533         WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1535         if test x$ATTEMPT_WRAP32_BUILD = x; then
1536                 WRAP32=""
1537         else
1538                         WRAP32=bin/smbwrapper.32.$SHLIBEXT
1539         fi
1541 # Conditions under which smbwrapper should not be built.
1543         if test x$PICFLAG = x; then
1544            echo No support for PIC code - disabling smbwrapper and smbsh
1545            WRAP=""
1546            WRAP32=""
1547         elif test x$ac_cv_func_syscall = xno; then
1548            AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1549            WRAP=""
1550            WRAP32=""
1551         fi
1552     ;;
1553   *)
1554     AC_MSG_RESULT(no)
1555     ;;
1556   esac ],
1557   AC_MSG_RESULT(no)
1560 #################################################
1561 # check for the AFS filesystem
1562 AC_MSG_CHECKING(whether to use AFS)
1563 AC_ARG_WITH(afs,
1564 [  --with-afs              Include AFS support (default=no)],
1565 [ case "$withval" in
1566   yes)
1567     AC_MSG_RESULT(yes)
1568     AC_DEFINE(WITH_AFS)
1569     ;;
1570   *)
1571     AC_MSG_RESULT(no)
1572     ;;
1573   esac ],
1574   AC_MSG_RESULT(no)
1578 #################################################
1579 # check for the DFS auth system
1580 AC_MSG_CHECKING(whether to use DCE/DFS auth)
1581 AC_ARG_WITH(dfs,
1582 [  --with-dce-dfs          Include DCE/DFS support (default=no)],
1583 [ case "$withval" in
1584   yes)
1585     AC_MSG_RESULT(yes)
1586     AC_DEFINE(WITH_DFS)
1587     ;;
1588   *)
1589     AC_MSG_RESULT(no)
1590     ;;
1591   esac ],
1592   AC_MSG_RESULT(no)
1595 #################################################
1596 # check for Kerberos IV auth system
1597 AC_MSG_CHECKING(whether to use Kerberos IV)
1598 AC_ARG_WITH(krb4,
1599 [  --with-krb4=base-dir    Include Kerberos IV support (default=no)],
1600 [ case "$withval" in
1601   yes)
1602     AC_MSG_RESULT(yes)
1603     AC_DEFINE(KRB4_AUTH)
1604     AC_CHECK_LIB(resolv, dn_expand)
1605     LIBS="$LIBS -lkrb -ldes"
1606     CFLAGS="$CFLAGS -I$withval/include"
1607     LDFLAGS="$LDFLAGS -L$withval/lib"
1608     ;;
1609   *)
1610     AC_MSG_RESULT(no)
1611     ;;
1612   esac ],
1613   AC_MSG_RESULT(no)
1616 #################################################
1617 # check for Kerberos 5 auth system
1618 AC_MSG_CHECKING(whether to use Kerberos 5)
1619 AC_ARG_WITH(krb5,
1620 [  --with-krb5=base-dir    Include Kerberos 5 support (default=no)],
1621 [ case "$withval" in
1622   yes)
1623     AC_MSG_RESULT(yes)
1624     AC_DEFINE(KRB5_AUTH)
1625     LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
1626     CFLAGS="$CFLAGS -I$withval/include"
1627     LDFLAGS="$LDFLAGS -L$withval/lib"
1628     ;;
1629   *)
1630     AC_MSG_RESULT(no)
1631     ;;
1632   esac ],
1633   AC_MSG_RESULT(no)
1636 #################################################
1637 # check for automount support
1638 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1639 AC_ARG_WITH(automount,
1640 [  --with-automount        Include AUTOMOUNT support (default=no)],
1641 [ case "$withval" in
1642   yes)
1643     AC_MSG_RESULT(yes)
1644     AC_DEFINE(WITH_AUTOMOUNT)
1645     ;;
1646   *)
1647     AC_MSG_RESULT(no)
1648     ;;
1649   esac ],
1650   AC_MSG_RESULT(no)
1653 #################################################
1654 # check for smbmount support
1655 AC_MSG_CHECKING(whether to use SMBMOUNT)
1656 AC_ARG_WITH(smbmount,
1657 [  --with-smbmount         Include SMBMOUNT (Linux only) support (default=no)],
1658 [ case "$withval" in
1659   yes)
1660         case "$host_os" in
1661         *linux*)
1662                 AC_MSG_RESULT(yes)
1663                 AC_DEFINE(WITH_SMBMOUNT)
1664                 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1665                 ;;
1666         *)
1667                 AC_MSG_ERROR(not on a linux system!)
1668                 ;;
1669         esac
1670     ;;
1671   *)
1672     AC_MSG_RESULT(no)
1673     MPROGS=
1674     ;;
1675   esac ],
1676   AC_MSG_RESULT(no)
1677   MPROGS=
1681 #################################################
1682 # check for a PAM password database
1683 with_pam_for_crypt=no
1684 AC_MSG_CHECKING(whether to use PAM password database)
1685 AC_ARG_WITH(pam,
1686 [  --with-pam              Include PAM password database support (default=no)],
1687 [ case "$withval" in
1688   yes)
1689     AC_MSG_RESULT(yes)
1690     AC_DEFINE(WITH_PAM)
1691     LIBS="$LIBS -lpam"
1692     with_pam_for_crypt=yes
1693     ;;
1694   *)
1695     AC_MSG_RESULT(no)
1696     ;;
1697   esac ],
1698   AC_MSG_RESULT(no)
1701 # we can't build a pam module if we don't have pam.
1702 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
1704 #################################################
1705 # check for pam_smbpass support
1706 AC_MSG_CHECKING(whether to use pam_smbpass)
1707 AC_ARG_WITH(pam_smbpass,
1708 [  --with-pam_smbpass      Include the smbpass PAM module (default=no)],
1709 [ case "$withval" in
1710   yes)
1711     AC_MSG_RESULT(yes)
1713 # Conditions under which pam_smbpass should not be built.
1715        if test x$PICFLAG = x; then
1716           AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
1717           PAM_MOD=""
1718        elif test x$ac_cv_lib_pam_pam_get_data = xno; then
1719           AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
1720           PAM_MOD=""
1721        else
1722           AC_DEFINE(WITH_PAM_SMBPASS)
1723           PAM_MOD="bin/pam_smbpass.so"
1724        fi
1725     ;;
1726   *)
1727     AC_MSG_RESULT(no)
1728     ;;
1729   esac ],
1730   AC_MSG_RESULT(no)
1734 ###############################################
1735 # test for where we get crypt() from, but only
1736 # if not using PAM
1737 if test $with_pam_for_crypt = no; then
1738 AC_CHECK_FUNCS(crypt)
1739 if test x"$ac_cv_func_crypt" = x"no"; then
1740     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
1741         AC_DEFINE(HAVE_CRYPT)])
1746 ## moved after the check for -lcrypt in order to
1747 ## ensure that the necessary libraries are included
1748 ## check checking for truncated salt.  Wrapped by the
1749 ## $with_pam_for_crypt variable as above   --jerry
1751 if test $with_pam_for_crypt = no; then
1752 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1753 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1754         samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
1755 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1756         AC_DEFINE(HAVE_TRUNCATED_SALT)
1761 ########################################################################################
1763 ## TESTS FOR SAM BACKENDS.  KEEP THESE GROUPED TOGETHER
1765 ########################################################################################
1767 ## set the with_smbpasswd_sam as the default
1768 with_smbpasswd_sam=yes
1772 #################################################
1773 # check for a TDB password database
1774 AC_MSG_CHECKING(whether to use TDB SAM database)
1775 AC_ARG_WITH(tdbsam,
1776 [  --with-tdbsam           Include experimental TDB SAM support (default=no)],
1777 [ case "$withval" in
1778   yes)
1779     AC_MSG_RESULT(yes)
1780     AC_DEFINE(WITH_TDB_SAM)
1781     with_smbpasswd_sam=no
1782     ;;
1783   *)
1784     AC_MSG_RESULT(no)
1785     ;;
1786   esac ],
1787   AC_MSG_RESULT(no)
1790 #################################################
1791 # check for a LDAP password database
1792 AC_MSG_CHECKING(whether to use LDAP SAM database)
1793 AC_ARG_WITH(ldapsam,
1794 [  --with-ldapsam          Include experimental LDAP SAM support (default=no)],
1795 [ case "$withval" in
1796   yes)
1797     AC_MSG_RESULT(yes)
1798     AC_DEFINE(WITH_LDAP_SAM)
1799     LIBS="-lldap -llber -lresolv $LIBS"
1800     with_smbpasswd_sam=no
1801     ;;
1802   *)
1803     AC_MSG_RESULT(no)
1804     ;;
1805   esac ],
1806   AC_MSG_RESULT(no)
1809 #################################################
1810 # check for a NISPLUS password database
1811 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
1812 AC_ARG_WITH(nisplussam,
1813 [  --with-nisplussam       Include NISPLUS SAM support (default=no)],
1814 [ case "$withval" in
1815   yes)
1816     AC_MSG_RESULT(yes)
1817     AC_DEFINE(WITH_NISPLUS_SAM)
1818     with_smbpasswd_sam=no
1819     ;;
1820   *)
1821     AC_MSG_RESULT(no)
1822     ;;
1823   esac ],
1824   AC_MSG_RESULT(no)
1827 ################################################
1828 # This test should come last because the
1829 # smbpasswd SAM is only used if another format
1830 # has not been defined
1831 AC_MSG_CHECKING(whether to use traditional smbpasswd file)
1832 if test $with_smbpasswd_sam = yes; then
1833         AC_MSG_RESULT(yes)
1834         AC_DEFINE(WITH_SMBPASSWD_SAM)
1835         PDBEDIT=""
1836 else
1837         AC_MSG_RESULT(no)
1838         PDBEDIT=bin/pdbedit
1841 ########################################################################################
1843 ## END OF TESTS FOR SAM BACKENDS.  
1845 ########################################################################################
1847 #################################################
1848 # check for a NISPLUS_HOME support 
1849 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
1850 AC_ARG_WITH(nisplus-home,
1851 [  --with-nisplus-home     Include NISPLUS_HOME support (default=no)],
1852 [ case "$withval" in
1853   yes)
1854     AC_MSG_RESULT(yes)
1855     AC_DEFINE(WITH_NISPLUS_HOME)
1856     ;;
1857   *)
1858     AC_MSG_RESULT(no)
1859     ;;
1860   esac ],
1861   AC_MSG_RESULT(no)
1864 #################################################
1865 # check for the secure socket layer
1866 AC_MSG_CHECKING(whether to use SSL)
1867 AC_ARG_WITH(ssl,
1868 [  --with-ssl              Include SSL support (default=no)
1869   --with-sslinc=DIR          Where the SSL includes are (defaults to /usr/local/ssl/include)
1870   --with-ssllib=DIR          Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
1871 [ case "$withval" in
1872   yes)
1873     AC_MSG_RESULT(yes)
1874     AC_DEFINE(WITH_SSL)
1875     withval="/usr/local/ssl"     # default
1877     if test "${with_sslinc+set}" = set; then
1879         withval="$with_sslinc"
1880         case "$withval" in
1881         yes|no)
1882           echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
1883           CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1884         ;;
1885         * )
1886           CFLAGS="-I${withval} $CFLAGS"
1887         ;;
1888         esac
1890     else
1892         CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
1894     fi
1896     if test "${with_ssllib+set}" = set; then
1898         withval="$with_ssllib"
1899         case "$withval" in
1900         yes|no)
1901           echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
1902           LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1903         ;;
1904         * )
1905           LDFLAGS="-L${withval}/lib $LDFLAGS"
1906         ;;
1907         esac
1909     else
1911         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1913     fi
1915     LIBS="-lssl -lcrypto $LIBS"
1917 #    if test ! -d ${withval}; then
1918 #      echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
1919 #      exit 1
1920 #    fi 
1922     CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
1924     ;;
1925   *)
1926     AC_MSG_RESULT(no)
1927     ;;
1928   esac ],
1929   AC_MSG_RESULT(no)
1932 #################################################
1933 # check for syslog logging
1934 AC_MSG_CHECKING(whether to use syslog logging)
1935 AC_ARG_WITH(syslog,
1936 [  --with-syslog           Include experimental SYSLOG support (default=no)],
1937 [ case "$withval" in
1938   yes)
1939     AC_MSG_RESULT(yes)
1940     AC_DEFINE(WITH_SYSLOG)
1941     ;;
1942   *)
1943     AC_MSG_RESULT(no)
1944     ;;
1945   esac ],
1946   AC_MSG_RESULT(no)
1949 #################################################
1950 # check for a shared memory profiling support
1951 AC_MSG_CHECKING(whether to use profiling)
1952 AC_ARG_WITH(profiling-data,
1953 [  --with-profiling-data   Include gathering source code profile information (default=no)],
1954 [ case "$withval" in
1955   yes)
1956     AC_MSG_RESULT(yes)
1957     AC_DEFINE(WITH_PROFILE)
1958     ;;
1959   *)
1960     AC_MSG_RESULT(no)
1961     ;;
1962   esac ],
1963   AC_MSG_RESULT(no)
1967 #################################################
1968 # check for experimental disk-quotas support
1969 QUOTAOBJS=smbd/noquotas.o
1971 AC_MSG_CHECKING(whether to support disk-quotas)
1972 AC_ARG_WITH(quotas,
1973 [  --with-quotas           Include experimental disk-quota support (default=no)],
1974 [ case "$withval" in
1975   yes)
1976     AC_MSG_RESULT(yes)
1977     QUOTAOBJS=smbd/quotas.o
1978     case "$host_os" in
1979       *linux*)
1980         # Check for kernel 2.4.x quota braindamage...
1981         AC_CACHE_CHECK([for linux 2.4.x quota braindamage..],samba_cv_linux_2_4_quota_braindamage, [
1982         AC_TRY_COMPILE([#include <stdio.h>
1983 #include <sys/types.h>
1984 #include <asm/types.h>
1985 #include <linux/quota.h>
1986 #include <mntent.h>
1987 #include <linux/unistd.h>],[struct mem_dqblk D;],
1988         samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
1989 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
1990         AC_DEFINE(LINUX_QUOTAS_2)
1991 else
1992         AC_DEFINE(LINUX_QUOTAS_1)
1994         ;;
1995       *)
1996         ;;
1997     esac
1998     ;;
1999   *)
2000     AC_MSG_RESULT(no)
2001     ;;
2002   esac ],
2003   AC_MSG_RESULT(no)
2005 AC_SUBST(QUOTAOBJS)
2007 #################################################
2008 # check for experimental utmp accounting
2010 AC_MSG_CHECKING(whether to support utmp accounting)
2011 AC_ARG_WITH(utmp,
2012 [  --with-utmp             Include experimental utmp accounting (default=no)],
2013 [ case "$withval" in
2014   yes)
2015     AC_MSG_RESULT(yes)
2016     AC_DEFINE(WITH_UTMP)
2017     ;;
2018   *)
2019     AC_MSG_RESULT(no)
2020     ;;
2021   esac ],
2022   AC_MSG_RESULT(no)
2025 #################################################
2026 # check for MS Dfs support
2028 AC_MSG_CHECKING(whether to support Microsoft Dfs)
2029 AC_ARG_WITH(msdfs,
2030 [  --with-msdfs            Include MS Dfs support (default=no)],
2031 [ case "$withval" in
2032   yes)
2033      AC_MSG_RESULT(yes)
2034      AC_DEFINE(WITH_MSDFS)
2035      ;;
2036   *)
2037     AC_MSG_RESULT(no)
2038     ;;
2039   esac ],
2040   AC_MSG_RESULT(no)
2043 #################################################
2044 # check for Samba VFS support
2046 AC_MSG_CHECKING(whether to support the experimantal Samba vfs)
2047 AC_ARG_WITH(vfs,
2048 [  --with-vfs              Include Samba vfs support (default=no)],
2049 [ case "$withval" in
2050   yes)
2051      AC_MSG_RESULT(yes)
2052      AC_DEFINE(WITH_VFS)
2053      ;;
2054   *)
2055     AC_MSG_RESULT(no)
2056     ;;
2057   esac ],
2058   AC_MSG_RESULT(no)
2062 #################################################
2063 # should we build libsmbclient?
2065 LIBSMBCLIENT_SHARED=
2066 LIBSMBCLIENT=
2067 AC_MSG_CHECKING(whether to build the libsmbclient shared library)
2068 AC_ARG_WITH(libsmbclient,
2069 [  --with-libsmbclient     Build the libsmbclient shared library (default=no)],
2070 [ case "$withval" in
2071   yes)
2072      if test $BLDSHARED = true; then
2073         LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
2074         LIBSMBCLIENT=libsmbclient
2075         AC_MSG_RESULT(yes)
2076      else
2077         AC_MSG_RESULT(no shared library support)
2078      fi
2079      ;;
2080   *)
2081     AC_MSG_RESULT(no)
2082     ;;
2083   esac ],
2084   AC_MSG_RESULT(no)
2087 #################################################
2088 # these tests are taken from the GNU fileutils package
2089 AC_CHECKING(how to get filesystem space usage)
2090 space=no
2092 # Test for statvfs64.
2093 if test $space = no; then
2094   # SVR4
2095   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2096   [AC_TRY_RUN([
2097 #if defined(HAVE_UNISTD_H)
2098 #include <unistd.h>
2099 #endif
2100 #include <sys/types.h>
2101 #include <sys/statvfs.h>
2102   main ()
2103   {
2104     struct statvfs64 fsd;
2105     exit (statvfs64 (".", &fsd));
2106   }],
2107   fu_cv_sys_stat_statvfs64=yes,
2108   fu_cv_sys_stat_statvfs64=no,
2109   fu_cv_sys_stat_statvfs64=cross)])
2110   if test $fu_cv_sys_stat_statvfs64 = yes; then
2111     space=yes
2112     AC_DEFINE(STAT_STATVFS64)
2113   fi
2116 # Perform only the link test since it seems there are no variants of the
2117 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
2118 # because that got a false positive on SCO OSR5.  Adding the declaration
2119 # of a `struct statvfs' causes this test to fail (as it should) on such
2120 # systems.  That system is reported to work fine with STAT_STATFS4 which
2121 # is what it gets when this test fails.
2122 if test $space = no; then
2123   # SVR4
2124   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2125                  [AC_TRY_LINK([#include <sys/types.h>
2126 #include <sys/statvfs.h>],
2127                               [struct statvfs fsd; statvfs (0, &fsd);],
2128                               fu_cv_sys_stat_statvfs=yes,
2129                               fu_cv_sys_stat_statvfs=no)])
2130   if test $fu_cv_sys_stat_statvfs = yes; then
2131     space=yes
2132     AC_DEFINE(STAT_STATVFS)
2133   fi
2136 if test $space = no; then
2137   # DEC Alpha running OSF/1
2138   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2139   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2140   [AC_TRY_RUN([
2141 #include <sys/param.h>
2142 #include <sys/types.h>
2143 #include <sys/mount.h>
2144   main ()
2145   {
2146     struct statfs fsd;
2147     fsd.f_fsize = 0;
2148     exit (statfs (".", &fsd, sizeof (struct statfs)));
2149   }],
2150   fu_cv_sys_stat_statfs3_osf1=yes,
2151   fu_cv_sys_stat_statfs3_osf1=no,
2152   fu_cv_sys_stat_statfs3_osf1=no)])
2153   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2154   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2155     space=yes
2156     AC_DEFINE(STAT_STATFS3_OSF1)
2157   fi
2160 if test $space = no; then
2161 # AIX
2162   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2163 member (AIX, 4.3BSD)])
2164   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2165   [AC_TRY_RUN([
2166 #ifdef HAVE_SYS_PARAM_H
2167 #include <sys/param.h>
2168 #endif
2169 #ifdef HAVE_SYS_MOUNT_H
2170 #include <sys/mount.h>
2171 #endif
2172 #ifdef HAVE_SYS_VFS_H
2173 #include <sys/vfs.h>
2174 #endif
2175   main ()
2176   {
2177   struct statfs fsd;
2178   fsd.f_bsize = 0;
2179   exit (statfs (".", &fsd));
2180   }],
2181   fu_cv_sys_stat_statfs2_bsize=yes,
2182   fu_cv_sys_stat_statfs2_bsize=no,
2183   fu_cv_sys_stat_statfs2_bsize=no)])
2184   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2185   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2186     space=yes
2187     AC_DEFINE(STAT_STATFS2_BSIZE)
2188   fi
2191 if test $space = no; then
2192 # SVR3
2193   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2194   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2195   [AC_TRY_RUN([#include <sys/types.h>
2196 #include <sys/statfs.h>
2197   main ()
2198   {
2199   struct statfs fsd;
2200   exit (statfs (".", &fsd, sizeof fsd, 0));
2201   }],
2202     fu_cv_sys_stat_statfs4=yes,
2203     fu_cv_sys_stat_statfs4=no,
2204     fu_cv_sys_stat_statfs4=no)])
2205   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2206   if test $fu_cv_sys_stat_statfs4 = yes; then
2207     space=yes
2208     AC_DEFINE(STAT_STATFS4)
2209   fi
2212 if test $space = no; then
2213 # 4.4BSD and NetBSD
2214   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2215 member (4.4BSD and NetBSD)])
2216   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2217   [AC_TRY_RUN([#include <sys/types.h>
2218 #ifdef HAVE_SYS_PARAM_H
2219 #include <sys/param.h>
2220 #endif
2221 #ifdef HAVE_SYS_MOUNT_H
2222 #include <sys/mount.h>
2223 #endif
2224   main ()
2225   {
2226   struct statfs fsd;
2227   fsd.f_fsize = 0;
2228   exit (statfs (".", &fsd));
2229   }],
2230   fu_cv_sys_stat_statfs2_fsize=yes,
2231   fu_cv_sys_stat_statfs2_fsize=no,
2232   fu_cv_sys_stat_statfs2_fsize=no)])
2233   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2234   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2235     space=yes
2236     AC_DEFINE(STAT_STATFS2_FSIZE)
2237   fi
2240 if test $space = no; then
2241   # Ultrix
2242   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2243   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2244   [AC_TRY_RUN([#include <sys/types.h>
2245 #ifdef HAVE_SYS_PARAM_H
2246 #include <sys/param.h>
2247 #endif
2248 #ifdef HAVE_SYS_MOUNT_H
2249 #include <sys/mount.h>
2250 #endif
2251 #ifdef HAVE_SYS_FS_TYPES_H
2252 #include <sys/fs_types.h>
2253 #endif
2254   main ()
2255   {
2256   struct fs_data fsd;
2257   /* Ultrix's statfs returns 1 for success,
2258      0 for not mounted, -1 for failure.  */
2259   exit (statfs (".", &fsd) != 1);
2260   }],
2261   fu_cv_sys_stat_fs_data=yes,
2262   fu_cv_sys_stat_fs_data=no,
2263   fu_cv_sys_stat_fs_data=no)])
2264   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2265   if test $fu_cv_sys_stat_fs_data = yes; then
2266     space=yes
2267     AC_DEFINE(STAT_STATFS2_FS_DATA)
2268   fi
2272 # As a gating factor for large file support, in order to
2273 # use <4GB files we must have the following minimal support
2274 # available.
2275 # long long, and a 64 bit off_t or off64_t.
2276 # If we don't have all of these then disable large
2277 # file support.
2279 AC_MSG_CHECKING(checking if large file support can be enabled)
2280 AC_TRY_COMPILE([
2281 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2282 #include <sys/types.h>
2283 #else
2284 __COMPILE_ERROR_
2285 #endif
2287 [int i],
2288 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2289 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2290     AC_MSG_RESULT(yes)
2291     AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2292 else
2293     AC_MSG_RESULT(no)
2296 AC_ARG_WITH(spinlocks, 
2297 [  --with-spinlocks        Use spin locks instead of fcntl locks (default=no)])
2298 if test "x$with_spinlocks" = "xyes"; then
2299     AC_DEFINE(USE_SPINLOCKS)
2301     case "$host_cpu" in
2302         sparc)
2303             AC_DEFINE(SPARC_SPINLOCKS)
2304             ;;
2306         i386|i486|i586|i686)
2307             AC_DEFINE(INTEL_SPINLOCKS)
2308             ;;
2310         mips)
2311             AC_DEFINE(MIPS_SPINLOCKS)
2312             ;;
2314         powerpc)
2315             AC_DEFINE(POWERPC_SPINLOCKS)
2316             ;;
2317     esac
2320 #################################################
2321 # check for ACL support
2323 AC_MSG_CHECKING(whether to support ACLs)
2324 AC_ARG_WITH(acl-support,
2325 [  --with-acl-support      Include ACL support (default=no)],
2326 [ case "$withval" in
2327   yes)
2329                 case "$host_os" in
2330                 *sysv5*)
2331                         AC_MSG_RESULT(Using UnixWare ACLs)
2332                         AC_DEFINE(HAVE_UNIXWARE_ACLS)
2333                         ;;
2334                 *solaris*)
2335                         AC_MSG_RESULT(Using solaris ACLs)
2336                         AC_DEFINE(HAVE_SOLARIS_ACLS)
2337                         ;;
2338                 *irix*)
2339                         AC_MSG_RESULT(Using IRIX ACLs)
2340                         AC_DEFINE(HAVE_IRIX_ACLS)
2341                         ;;
2342                 *aix*)
2343                         AC_MSG_RESULT(Using AIX ACLs)
2344                         AC_DEFINE(HAVE_AIX_ACLS)
2345                         ;;
2346                 *osf*)
2347                         AC_MSG_RESULT(Using Tru64 ACLs)
2348                         AC_DEFINE(HAVE_TRU64_ACLS)
2349                         LIBS="$LIBS -lpacl"
2350                         ;;
2351                 *)
2352                     AC_CHECK_LIB(acl,acl_get_file)
2353                         AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2354                         AC_TRY_LINK([#include <sys/types.h>
2355 #include <sys/acl.h>],
2356 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2357 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2358                         if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2359                             AC_MSG_RESULT(Using posix ACLs)
2360                             AC_DEFINE(HAVE_POSIX_ACLS)
2361                                 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2362                                 AC_TRY_LINK([#include <sys/types.h>
2363 #include <sys/acl.h>],
2364 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2365 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2366                                 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2367                                         AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2368                                 fi
2369                         fi
2370                         ;;
2371                 esac
2372                 ;;
2373   *)
2374     AC_MSG_RESULT(no)
2375         AC_DEFINE(HAVE_NO_ACLS)
2376     ;;
2377   esac ],
2378   AC_DEFINE(HAVE_NO_ACLS)
2379   AC_MSG_RESULT(no)
2382 #################################################
2383 # check for the historical SAMBA installation
2385 if test "x$prefix" = xNONE -a "$sbindir" = "\${exec_prefix}/sbin"; then
2386         # Put all binaries under the /usr/local/samba/bin directory.
2387         sbindir="$bindir"
2390 #################################################
2391 # Check whether winbind is supported on this platform.  If so we need to
2392 # build and install client programs (WINBIND_TARGETS), sbin programs
2393 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2395 AC_MSG_CHECKING(whether to build winbind)
2397 # Initially, the value of $host_os decides whether winbind is supported
2399 case "$host_os" in 
2400         *linux*|*solaris*)
2401                 HAVE_WINBIND=yes
2402                 ;;
2403         *)
2404                 HAVE_WINBIND=no
2405                 winbind_no_reason=", unsupported on $host_os"
2406                 ;;
2407 esac
2409 # Check the setting of --with-winbindd
2411 AC_ARG_WITH(winbind,
2412 [  --with-winbind          Build winbind (default, if supported by OS)],
2414   case "$withval" in
2415         yes)
2416                 HAVE_WINBIND=yes
2417                 ;;
2418         no)
2419                 HAVE_WINBIND=no
2420                 winbind_reason=""
2421                 ;;
2422   esac ],
2425 # We need unix domain sockets for winbind
2427 if test x"$HAVE_WINBIND" = x"yes"; then
2428         if test x"$samba_cv_unixsocket" = x"no"; then
2429                 winbind_no_reason=", no unix domain socket support on $host_os"
2430                 HAVE_WINBIND=no
2431         fi
2434 # Display test results
2436 if test x"$HAVE_WINBIND" = x"yes"; then
2438         AC_MSG_RESULT(yes)
2440         WINBIND_TARGETS="bin/wbinfo"
2441         WINBIND_STARGETS="bin/winbindd"
2442         WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
2444         case "$with_pam" in
2445                 yes)
2446                         WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
2447                 ;;
2448         esac
2449 else
2450         AC_MSG_RESULT(no$winbind_no_reason)
2452         WINBIND_TARGETS=""
2453         WINBIND_STARGETS=""
2454         WINBIND_LTARGETS=""
2455         WINBIND_PAM_TARGETS=""
2458 # Substitution time!
2460 AC_SUBST(WINBIND_TARGETS)
2461 AC_SUBST(WINBIND_STARGETS)
2462 AC_SUBST(WINBIND_LTARGETS)
2463 AC_SUBST(WINBIND_PAM_TARGETS)
2465 #################################################
2466 # final configure stuff
2467 echo "checking configure summary"
2468 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2469            echo "configure OK";,
2470            AC_MSG_ERROR([summary failure. Aborting config]),:)
2472 builddir=`pwd`
2473 AC_SUBST(builddir)
2475 AC_OUTPUT(include/stamp-h Makefile)