1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
4 dnl disabled 2.53 requirement - we do work with 2.52 on suse 7.3 for example
8 AC_INIT(include/includes.h)
9 AC_CONFIG_HEADER(include/config.h)
14 #################################################
15 # Directory handling stuff to support both the
16 # legacy SAMBA directories and FHS compliant
18 AC_PREFIX_DEFAULT(/usr/local/samba)
21 [ --with-fhs Use FHS-compliant paths (default=no)],
22 configdir="${sysconfdir}/samba"
23 lockdir="\${VARDIR}/cache/samba"
24 piddir="\${VARDIR}/run/samba"
25 logfilebase="\${VARDIR}/log/samba"
26 privatedir="\${CONFIGDIR}/private"
27 libdir="\${prefix}/lib/samba"
28 swatdir="\${DATADIR}/samba/swat",
29 configdir="\${LIBDIR}"
30 logfilebase="\${VARDIR}"
31 lockdir="\${VARDIR}/locks"
32 piddir="\${VARDIR}/locks"
33 privatedir="\${prefix}/private"
34 swatdir="\${prefix}/swat")
36 #################################################
37 # set private directory location
38 AC_ARG_WITH(privatedir,
39 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
43 # Just in case anybody calls it without argument
45 AC_MSG_WARN([--with-privatedir called without argument - will use default])
52 #################################################
53 # set lock directory location
55 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
59 # Just in case anybody calls it without argument
61 AC_MSG_WARN([--with-lockdir called without argument - will use default])
68 #################################################
69 # set pid directory location
71 [ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks)],
75 # Just in case anybody calls it without argument
77 AC_MSG_WARN([--with-piddir called without argument - will use default])
84 #################################################
85 # set configuration directory location
86 AC_ARG_WITH(configdir,
87 [ --with-configdir=DIR Where to put configuration files (\$libdir)],
91 # Just in case anybody does it
93 AC_MSG_WARN([--with-configdir called without argument - will use default])
100 #################################################
101 # set log directory location
102 AC_ARG_WITH(logfilebase,
103 [ --with-logfilebase=DIR Where to put log files (\$(VARDIR))],
107 # Just in case anybody does it
109 AC_MSG_WARN([--with-logfilebase called without argument - will use default])
112 logfilebase="$withval"
119 AC_SUBST(logfilebase)
124 dnl Unique-to-Samba variables we'll be playing with.
134 AC_SUBST(INSTALLCLIENTCMD_SH)
135 AC_SUBST(INSTALLCLIENTCMD_A)
136 AC_SUBST(LIBSMBCLIENT_SHARED)
137 AC_SUBST(LIBSMBCLIENT)
141 AC_SUBST(SHLIB_PROGS)
143 AC_SUBST(EXTRA_BIN_PROGS)
144 AC_SUBST(EXTRA_SBIN_PROGS)
145 AC_SUBST(EXTRA_ALL_TARGETS)
148 [ --enable-debug Turn on compiler debugging information (default=no)],
149 [if eval "test x$enable_debug = xyes"; then
150 CFLAGS="${CFLAGS} -gstabs"
153 AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)],
154 [if eval "test x$enable_developer = xyes"; then
156 CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
159 AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
160 [if eval "test x$enable_krb5developer = xyes"; then
162 CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
165 dnl Checks for programs.
168 AC_PATH_PROG(PERL, perl)
170 # compile with optimization and without debugging by default, but
171 # allow people to set their own preference.
172 if test "x$CFLAGS" = x
174 CFLAGS="-O ${CFLAGS}"
177 dnl Check if we use GNU ld
181 dnl needed before AC_TRY_COMPILE
184 dnl look for executable suffix
187 dnl Check if C compiler understands -c and -o at the same time
189 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
196 AC_CACHE_CHECK([that the C compiler can precompile header files],samba_cv_precompiled_headers, [
197 dnl Check whether the compiler can generate precompiled headers
199 if ${CC-cc} conftest.h 2> /dev/null && test -f conftest.h.gch; then
200 samba_cv_precompiled_headers=yes
202 samba_cv_precompiled_headers=no
205 if test x"$samba_cv_precompiled_headers" = x"yes"; then
208 AC_SUBST(PCH_AVAILABLE)
211 dnl Check if the C compiler understands volatile (it should, being ANSI).
212 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
213 AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
214 samba_cv_volatile=yes,samba_cv_volatile=no)])
215 if test x"$samba_cv_volatile" = x"yes"; then
216 AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
222 dnl Add #include for broken IRIX header files
224 *irix6*) AC_ADD_INCLUDE(<standards.h>)
228 AC_VALIDATE_CACHE_SYSTEM_TYPE
233 # Config CPPFLAG settings for strange OS's that must be set
234 # before other tests.
237 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
241 # mmap on HPUX is completely broken...
242 AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
243 if test $ac_cv_prog_cc_Ae = yes; then
244 CPPFLAGS="$CPPFLAGS -Ae"
247 # Defines needed for HPUX support.
248 # HPUX has bigcrypt but (sometimes?) doesn't use it for
249 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
253 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL"
254 AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
255 AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
256 AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
257 AC_DEFINE(_ALIGNMENT_REQUIRED,1,[Required alignment])
258 AC_DEFINE(_MAX_ALIGNMENT,4,[Maximum alignment])
261 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL"
262 AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
263 AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
264 AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
265 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to use large file support])
266 AC_DEFINE(_ALIGNMENT_REQUIRED, 1, [Required alignment])
267 AC_DEFINE(_MAX_ALIGNMENT, 4, [Maximum alignment])
274 # CRAY Unicos has broken const handling
276 AC_MSG_RESULT([disabling const])
277 CPPFLAGS="$CPPFLAGS -Dconst="
281 # AIX4.x doesn't even admit to having large
282 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
285 AC_MSG_RESULT([enabling large file support])
286 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
287 AC_DEFINE(_LARGE_FILES, 1, [Whether to enable large file support])
290 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
291 # to the existance of large files..
292 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
293 # recommendations on large file support, however it makes the
294 # compile work using gcc 2.7 and 2.8, whereas using the Sun
295 # recommendation makes the compile fail on gcc2.7. JRA.
299 5.0*|5.1*|5.2*|5.3*|5.5*)
300 AC_MSG_RESULT([no large file support])
303 AC_MSG_RESULT([enabling large file support])
304 if test "$ac_cv_prog_gcc" = yes; then
305 ${CC-cc} -v >conftest.c 2>&1
306 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
308 case "$ac_cv_gcc_compiler_version_number" in
309 *"gcc version 2.6"*|*"gcc version 2.7"*)
310 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
311 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
314 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
315 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
316 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
320 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
321 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
322 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
328 # VOS may need to have POSIX support and System V compatibility enabled.
335 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=199506L"
336 AC_DEFINE(_POSIX_C_SOURCE, 199506L, [Whether to enable POSIX support])
340 *-D_SYSV*|*-D_SVID_SOURCE*)
343 CPPFLAGS="$CPPFLAGS -D_SYSV"
344 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
348 # Tests needed for SINIX large file support.
351 if test $host = mips-sni-sysv4 ; then
352 AC_MSG_CHECKING([for LFS support])
353 old_CPPFLAGS="$CPPFLAGS"
354 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
358 #if _LFS64_LARGEFILE == 1
363 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
364 CPPFLAGS="$old_CPPFLAGS"
365 if test x$SINIX_LFS_SUPPORT = xyes ; then
366 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
367 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
368 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
369 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
370 LIBS="`getconf LFS64_LIBS` $LIBS"
372 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
376 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
379 AC_MSG_CHECKING([for LFS support])
380 old_CPPFLAGS="$CPPFLAGS"
381 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
384 #include <sys/utsname.h>
388 #if _LFS64_LARGEFILE == 1
393 /* Ensure this is glibc 2.2 or higher */
394 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
395 int libc_major = __GLIBC__;
396 int libc_minor = __GLIBC_MINOR__;
404 /* Ensure this is kernel 2.4 or higher */
407 release = uts.release;
408 major = atoi(strsep(&release, "."));
409 minor = atoi(strsep(&release, "."));
411 if (major > 2 || (major == 2 && minor > 3))
418 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
419 CPPFLAGS="$old_CPPFLAGS"
420 if test x$LINUX_LFS_SUPPORT = xyes ; then
421 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
422 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
423 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
424 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
426 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
430 AC_MSG_CHECKING([for LFS support])
431 old_CPPFLAGS="$CPPFLAGS"
432 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
436 #if _LFS64_LARGEFILE == 1
441 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
442 CPPFLAGS="$old_CPPFLAGS"
443 if test x$GLIBC_LFS_SUPPORT = xyes ; then
444 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
445 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
446 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
448 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
458 AC_CHECK_HEADERS(arpa/inet.h sys/select.h fcntl.h sys/fcntl.h sys/time.h)
459 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
460 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
461 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
462 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
463 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
464 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
465 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
466 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
469 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
470 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
474 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
475 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
476 if test x"$ac_cv_header_shadow_h" = x"yes"; then
477 AC_DEFINE(HAVE_SHADOW_H,1,[Whether we have shadow.h])
481 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
482 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
483 AC_CHECK_HEADERS(stropts.h)
484 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
485 AC_CHECK_HEADERS(sys/acl.h)
487 AC_CHECK_SIZEOF(int,cross)
488 AC_CHECK_SIZEOF(long,cross)
489 AC_CHECK_SIZEOF(short,cross)
504 AC_CHECK_TYPE(ino_t,unsigned)
505 AC_CHECK_TYPE(loff_t,off_t)
506 AC_CHECK_TYPE(offset_t,loff_t)
507 AC_CHECK_TYPE(ssize_t, int)
508 AC_CHECK_TYPE(wchar_t, unsigned short)
509 AC_CHECK_TYPE(uint_t, unsigned int)
511 ############################################
512 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
513 AC_SEARCH_LIBS(dlopen, [dl])
514 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
516 ############################################
517 # check if the compiler can do immediate structures
518 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
522 typedef struct {unsigned x;} FOOBAR;
523 #define X_FOOBAR(x) ((FOOBAR) { x })
524 #define FOO_ONE X_FOOBAR(1)
532 samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
533 if test x"$samba_cv_immediate_structures" = x"yes"; then
534 AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
537 ############################################
538 # check for unix domain sockets
539 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
541 #include <sys/types.h>
544 #include <sys/socket.h>
545 #include <sys/un.h>],
547 struct sockaddr_un sunaddr;
548 sunaddr.sun_family = AF_UNIX;
550 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
551 if test x"$samba_cv_unixsocket" = x"yes"; then
552 AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
556 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
558 #include <sys/types.h>
563 #include <sys/socket.h>],[socklen_t i = 0],
564 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
565 if test x"$samba_cv_socklen_t" = x"yes"; then
566 AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
569 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
571 #include <sys/types.h>
576 #include <signal.h>],[sig_atomic_t i = 0],
577 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
578 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
579 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
582 # stupid headers have the functions but no declaration. grrrr.
583 AC_HAVE_DECL(errno, [#include <errno.h>])
584 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
585 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
586 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
587 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
588 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
589 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
591 # and glibc has setresuid under linux but the function does
592 # nothing until kernel 2.1.44! very dumb.
593 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
594 AC_TRY_RUN([#include <errno.h>
595 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
596 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
597 if test x"$samba_cv_have_setresuid" = x"yes"; then
598 AC_DEFINE(HAVE_SETRESUID,1,[Whether the system has setresuid])
601 # Do the same check for setresguid...
603 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
604 AC_TRY_RUN([#include <unistd.h>
606 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
607 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
608 if test x"$samba_cv_have_setresgid" = x"yes"; then
609 AC_DEFINE(HAVE_SETRESGID,1,[Whether the system has setresgid])
614 ###############################################
615 # Readline included by default unless explicitly asked not to
616 test "${with_readline+set}" != "set" && with_readline=yes
618 # test for where we get readline() from
619 AC_MSG_CHECKING(whether to use readline)
620 AC_ARG_WITH(readline,
621 [ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
622 [ case "$with_readline" in
626 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
627 AC_CHECK_HEADERS(readline/history.h)
629 AC_CHECK_HEADERS(readline.h readline/readline.h,[
630 for termlib in ncurses curses termcap terminfo termlib tinfo; do
631 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
633 AC_CHECK_LIB(readline, rl_callback_handler_install,
634 [TERMLIBS="-lreadline $TERMLIBS"
635 AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
636 break], [TERMLIBS=], $TERMLIBS)])
644 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
645 # alternate readline path
647 _cppflags=${CPPFLAGS}
649 # Add additional search path
650 LDFLAGS="-L$with_readline/lib $LDFLAGS"
651 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
653 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
654 AC_CHECK_HEADERS(readline/history.h)
656 AC_CHECK_HEADERS(readline.h readline/readline.h,[
657 for termlib in ncurses curses termcap terminfo termlib; do
658 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
660 AC_CHECK_LIB(readline, rl_callback_handler_install,
661 [TERMLDFLAGS="-L$with_readline/lib"
662 TERMCPPFLAGS="-I$with_readline/include"
663 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
664 TERMLIBS="-lreadline $TERMLIBS"
665 AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
666 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
674 AC_SUBST(TERMLDFLAGS)
676 # The readline API changed slightly from readline3 to readline4, so
677 # code will generate warnings on one of them unless we have a few
679 AC_CHECK_LIB(readline, rl_completion_matches,
680 [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1,
681 [Do we have rl_completion_matches?])],
685 # The following test taken from the cvs sources
686 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
687 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
688 # libsocket.so which has a bad implementation of gethostbyname (it
689 # only looks in /etc/hosts), so we only look for -lsocket if we need
691 AC_CHECK_FUNCS(connect)
692 if test x"$ac_cv_func_connect" = x"no"; then
695 *) AC_CHECK_LIB(nsl_s, printf) ;;
699 *) AC_CHECK_LIB(nsl, printf) ;;
703 *) AC_CHECK_LIB(socket, connect) ;;
707 *) AC_CHECK_LIB(inet, connect) ;;
709 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
711 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
712 test x"$ac_cv_lib_inet_connect" = x"yes"; then
713 # ac_cv_func_connect=yes
714 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
715 AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
719 ###############################################
720 # test for where we get yp_get_default_domain() from
721 AC_SEARCH_LIBS(yp_get_default_domain, [nsl])
722 AC_CHECK_FUNCS(yp_get_default_domain)
724 # Check if we have execl, if not we need to compile smbrun.
725 AC_CHECK_FUNCS(execl)
726 if test x"$ac_cv_func_execl" = x"no"; then
727 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbrun\$(EXEEXT)"
730 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
731 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
732 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
733 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
734 AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf realpath)
735 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
736 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
737 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
738 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
739 AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm)
740 # setbuffer, shmget, shm_open are needed for smbtorture
741 AC_CHECK_FUNCS(setbuffer shmget shm_open)
743 # syscall() is needed for smbwrapper.
744 AC_CHECK_FUNCS(syscall)
746 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
747 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
748 AC_CHECK_FUNCS(__getcwd _getcwd)
749 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
750 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
751 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
752 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
753 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
754 AC_CHECK_FUNCS(getdirentries _write __write _fork __fork)
755 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
756 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
757 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
758 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
759 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
762 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
765 if test x$ac_cv_func_stat64 = xno ; then
766 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
768 #if defined(HAVE_UNISTD_H)
771 #include <sys/stat.h>
772 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
773 AC_MSG_RESULT([$ac_cv_func_stat64])
774 if test x$ac_cv_func_stat64 = xyes ; then
775 AC_DEFINE(HAVE_STAT64,1,[Whether stat64() is available])
779 if test x$ac_cv_func_lstat64 = xno ; then
780 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
782 #if defined(HAVE_UNISTD_H)
785 #include <sys/stat.h>
786 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
787 AC_MSG_RESULT([$ac_cv_func_lstat64])
788 if test x$ac_cv_func_lstat64 = xyes ; then
789 AC_DEFINE(HAVE_LSTAT64,[Whether lstat64() is available])
793 if test x$ac_cv_func_fstat64 = xno ; then
794 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
796 #if defined(HAVE_UNISTD_H)
799 #include <sys/stat.h>
800 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
801 AC_MSG_RESULT([$ac_cv_func_fstat64])
802 if test x$ac_cv_func_fstat64 = xyes ; then
803 AC_DEFINE(HAVE_FSTAT64,1,[Whether fstat64() is available])
807 #####################################
808 # we might need the resolv library on some systems
809 AC_CHECK_LIB(resolv, dn_expand)
812 # Check for the functions putprpwnam, set_auth_parameters,
813 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
814 # Needed for OSF1 and HPUX.
817 AC_LIBTESTFUNC(security, putprpwnam)
818 AC_LIBTESTFUNC(sec, putprpwnam)
820 AC_LIBTESTFUNC(security, set_auth_parameters)
821 AC_LIBTESTFUNC(sec, set_auth_parameters)
823 # UnixWare 7.x has its getspnam in -lgen
824 AC_LIBTESTFUNC(gen, getspnam)
826 AC_LIBTESTFUNC(security, getspnam)
827 AC_LIBTESTFUNC(sec, getspnam)
829 AC_LIBTESTFUNC(security, bigcrypt)
830 AC_LIBTESTFUNC(sec, bigcrypt)
832 AC_LIBTESTFUNC(security, getprpwnam)
833 AC_LIBTESTFUNC(sec, getprpwnam)
835 # Assume non-shared by default and override below
838 # these are the defaults, good for lots of systems
848 if test "$enable_shared" = "yes"; then
849 # this bit needs to be modified for each OS that is suported by
850 # smbwrapper. You need to specify how to created a shared library and
851 # how to compile C code to produce PIC object files
853 AC_MSG_CHECKING([ability to build shared libraries])
855 # and these are for particular systems
857 *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
860 DYNEXP="-Wl,--export-dynamic"
862 SONAMEFLAG="-Wl,-soname="
863 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
865 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
869 if test "${GCC}" = "yes"; then
871 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
876 ## ${CFLAGS} added for building 64-bit shared
877 ## libs using Sun's Compiler
878 LDSHFLAGS="-G \${CFLAGS}"
882 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
884 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
888 PICFLAG="-KPIC" # Is this correct for SunOS
889 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
891 *netbsd* | *freebsd*) BLDSHARED="true"
893 DYNEXP="-Wl,--export-dynamic"
894 SONAMEFLAG="-Wl,-soname,"
895 PICFLAG="-fPIC -DPIC"
896 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
898 *openbsd*) BLDSHARED="true"
900 DYNEXP="-Wl,-Bdynamic"
901 SONAMEFLAG="-Wl,-soname,"
903 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
905 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
907 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
910 ATTEMPT_WRAP32_BUILD=yes
912 LDSHFLAGS="-set_version sgi1.0 -shared"
913 SONAMEFLAG="-soname "
915 if test "${GCC}" = "yes"; then
920 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
922 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
924 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
925 DYNEXP="-Wl,-brtl,-bexpall"
927 if test "${GCC}" != "yes"; then
928 ## for funky AIX compiler using strncpy()
929 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
932 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
934 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
936 # Use special PIC flags for the native HP-UX compiler.
937 if test $ac_cv_prog_cc_Ae = yes; then
940 LDSHFLAGS="-B symbolic -b -z"
945 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
947 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
948 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
950 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
953 SONAMEFLAG="-Wl,-soname,"
955 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
957 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
958 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
960 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
963 SONAMEFLAG="-Wl,-soname,"
965 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
967 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
968 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
970 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
971 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
973 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
975 *-univel-*) if [ test "$GCC" != yes ]; then
976 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
981 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
983 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
986 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
987 if [ test "$GCC" != yes ]; then
988 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
991 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
993 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
998 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
1002 AC_MSG_RESULT($BLDSHARED)
1003 AC_MSG_CHECKING([linker flags for shared libraries])
1004 AC_MSG_RESULT([$LDSHFLAGS])
1005 AC_MSG_CHECKING([compiler flags for position-independent code])
1006 AC_MSG_RESULT([$PICFLAGS])
1009 #######################################################
1010 # test whether building a shared library actually works
1011 if test $BLDSHARED = true; then
1012 AC_CACHE_CHECK([whether building shared libraries actually works],
1013 [ac_cv_shlib_works],[
1014 ac_cv_shlib_works=no
1015 # try building a trivial shared library
1016 if test "$PICSUFFIX" = "po"; then
1017 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c &&
1018 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
1019 ac_cv_shlib_works=yes
1021 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c &&
1022 mv shlib.$PICSUFFIX shlib.po &&
1023 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
1024 ac_cv_shlib_works=yes
1026 rm -f shlib.so shlib.po
1028 if test $ac_cv_shlib_works = no; then
1035 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
1036 AC_TRY_RUN([#include <stdio.h>
1037 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
1038 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
1039 if test x"$samba_cv_have_longlong" = x"yes"; then
1040 AC_DEFINE(HAVE_LONGLONG,1,[Whether the host supports long long's])
1044 # Check if the compiler supports the LL prefix on long long integers.
1047 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
1048 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
1049 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
1050 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
1051 AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Whether the compiler supports the LL prefix on long long integers])
1055 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
1056 AC_TRY_RUN([#include <stdio.h>
1057 #include <sys/stat.h>
1058 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
1059 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
1060 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
1061 AC_DEFINE(SIZEOF_OFF_T,8,[The size of the 'off_t' type])
1064 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
1066 #if defined(HAVE_UNISTD_H)
1070 #include <sys/stat.h>
1071 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1072 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
1073 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
1074 AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
1077 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
1078 AC_TRY_RUN([#include <stdio.h>
1079 #include <sys/stat.h>
1080 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
1081 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
1082 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
1083 AC_DEFINE(SIZEOF_INO_T,8,[The size of the 'ino_t' type])
1086 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
1088 #if defined(HAVE_UNISTD_H)
1092 #include <sys/stat.h>
1093 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1094 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
1095 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
1096 AC_DEFINE(HAVE_INO64_T,1,[Whether the 'ino64_t' type is available])
1099 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
1101 #if defined(HAVE_UNISTD_H)
1105 #include <sys/stat.h>
1106 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1107 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
1108 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
1109 AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available])
1112 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
1114 #if defined(HAVE_UNISTD_H)
1117 #include <sys/types.h>
1118 #include <dirent.h>],
1119 [struct dirent64 de;],
1120 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
1121 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
1122 AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Whether the 'dirent64' struct is available])
1125 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
1127 #if defined(HAVE_UNISTD_H)
1130 #include <sys/types.h>
1131 main() { dev_t dev; int i = major(dev); return 0; }],
1132 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
1133 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
1134 AC_DEFINE(HAVE_DEVICE_MAJOR_FN,1,[Whether the major macro for dev_t is available])
1137 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
1139 #if defined(HAVE_UNISTD_H)
1142 #include <sys/types.h>
1143 main() { dev_t dev; int i = minor(dev); return 0; }],
1144 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
1145 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
1146 AC_DEFINE(HAVE_DEVICE_MINOR_FN,1,[Whether the minor macro for dev_t is available])
1149 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
1150 AC_TRY_RUN([#include <stdio.h>
1151 main() { char c; c=250; exit((c > 0)?0:1); }],
1152 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
1153 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
1154 AC_DEFINE(HAVE_UNSIGNED_CHAR,1,[Whether the 'unsigned char' type is available])
1157 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
1158 AC_TRY_COMPILE([#include <sys/types.h>
1159 #include <sys/socket.h>
1160 #include <netinet/in.h>],
1161 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
1162 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
1163 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
1164 AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
1167 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
1168 AC_TRY_COMPILE([#include <sys/types.h>
1170 void seekdir(DIR *d, long loc) { return; }],[return 0;],
1171 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
1172 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
1173 AC_DEFINE(SEEKDIR_RETURNS_VOID,1,[Whether seekdir returns void])
1176 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
1177 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
1178 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
1179 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
1180 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
1183 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
1185 #include <sys/time.h>
1187 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
1188 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
1189 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
1190 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
1193 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE_VA_COPY,[
1194 AC_TRY_LINK([#include <stdarg.h>
1195 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
1196 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
1197 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
1198 AC_DEFINE(HAVE_VA_COPY,1,[Whether __va_copy() is available])
1201 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
1203 #include <sys/types.h>
1205 void foo(const char *format, ...) {
1210 va_start(ap, format);
1211 len = vsnprintf(buf, 0, format, ap);
1213 if (len != 5) exit(1);
1215 va_start(ap, format);
1216 len = vsnprintf(0, 0, format, ap);
1218 if (len != 5) exit(1);
1220 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
1224 main() { foo("hello"); }
1226 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
1227 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
1228 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
1231 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
1232 AC_TRY_RUN([#include <sys/types.h>
1234 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
1235 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
1236 di->d_name[0] == 0) exit(0); exit(1);} ],
1237 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
1238 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
1239 AC_DEFINE(HAVE_BROKEN_READDIR,1,[Whether readdir() is broken])
1242 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
1243 AC_TRY_COMPILE([#include <sys/types.h>
1244 #include <utime.h>],
1245 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
1246 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
1247 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
1248 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
1251 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1253 #include <sys/types.h>
1256 #define F_GETLEASE 1025
1259 int fd = open("/dev/null", O_RDONLY);
1260 return fcntl(fd, F_GETLEASE, 0) == -1;
1263 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1264 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1265 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
1268 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1270 #include <sys/types.h>
1274 #define F_NOTIFY 1026
1277 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1280 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1281 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1282 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
1285 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1287 #include <sys/types.h>
1290 #include <sys/file.h>
1292 #define LOCK_MAND 32
1293 #define LOCK_READ 64
1296 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1299 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1300 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1301 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
1307 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1308 AC_TRY_COMPILE([#include <sys/types.h>
1309 #include <fcntl.h>],
1310 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1311 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1312 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1313 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
1316 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1317 AC_TRY_RUN([#include <sys/types.h>
1318 #include <sys/capability.h>
1321 if ((cap = cap_get_proc()) == NULL)
1323 cap->cap_effective |= CAP_NETWORK_MGT;
1324 cap->cap_inheritable |= CAP_NETWORK_MGT;
1329 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1330 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1331 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
1335 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1336 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1339 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1340 AC_TRY_COMPILE([#include <sys/types.h>
1341 #if defined(HAVE_RPC_RPC_H)
1342 #include <rpc/rpc.h>
1345 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1346 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1347 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H,1,[Whether int16 typedef is included by rpc/rpc.h])
1350 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1351 AC_TRY_COMPILE([#include <sys/types.h>
1352 #if defined(HAVE_RPC_RPC_H)
1353 #include <rpc/rpc.h>
1356 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1357 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1358 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H,1,[Whether uint16 typedef is included by rpc/rpc.h])
1361 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1362 AC_TRY_COMPILE([#include <sys/types.h>
1363 #if defined(HAVE_RPC_RPC_H)
1364 #include <rpc/rpc.h>
1367 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1368 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1369 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H,1,[Whether int32 typedef is included by rpc/rpc.h])
1372 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1373 AC_TRY_COMPILE([#include <sys/types.h>
1374 #if defined(HAVE_RPC_RPC_H)
1375 #include <rpc/rpc.h>
1378 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1379 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1380 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H,1,[Whether uint32 typedef is included by rpc/rpc.h])
1384 dnl Some systems (SCO) have a problem including
1385 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1386 dnl as a #define in <prot.h> and as part of an enum
1390 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1391 AC_TRY_COMPILE([#include <sys/types.h>
1392 #ifdef HAVE_SYS_SECURITY_H
1393 #include <sys/security.h>
1395 #endif /* HAVE_SYS_SECURITY_H */
1396 #if defined(HAVE_RPC_RPC_H)
1397 #include <rpc/rpc.h>
1400 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1401 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1402 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT,1,[Whether there is a conflicting AUTH_ERROR define in rpc/rpc.h])
1405 AC_MSG_CHECKING([for test routines])
1406 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1408 AC_MSG_ERROR([cant find test code. Aborting config]),
1409 AC_MSG_WARN([cannot run when cross-compiling]))
1411 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1412 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1413 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1414 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1415 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
1418 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1419 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1420 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1421 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1422 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1423 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1425 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1428 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1429 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1430 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1431 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1432 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
1435 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1436 SAVE_CPPFLAGS="$CPPFLAGS"
1437 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper"
1439 #define REPLACE_GETPASS 1
1440 #define NO_CONFIG_H 1
1441 #define main dont_declare_main
1442 #include "${srcdir-.}/lib/getsmbpass.c"
1444 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1445 CPPFLAGS="$SAVE_CPPFLAGS"
1447 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1448 AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
1451 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1454 #include <sys/types.h>
1455 #include <netinet/in.h>
1456 #ifdef HAVE_ARPA_INET_H
1457 #include <arpa/inet.h>
1459 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1460 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1461 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1463 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1464 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1465 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
1468 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1469 AC_TRY_RUN([#include <stdlib.h>
1470 #include <sys/types.h>
1471 #include <sys/stat.h>
1475 char tpl[20]="/tmp/test.XXXXXX";
1476 int fd = mkstemp(tpl);
1477 if (fd == -1) exit(1);
1479 if (fstat(fd, &st) != 0) exit(1);
1480 if ((st.st_mode & 0777) != 0600) exit(1);
1483 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1484 samba_cv_HAVE_SECURE_MKSTEMP=no,
1485 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1486 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1487 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
1490 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1491 AC_TRY_RUN([#include <unistd.h>
1492 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1493 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1494 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1495 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
1498 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1499 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1500 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1501 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1502 AC_DEFINE(HAVE_ROOT,1,[Whether current user is root])
1504 AC_MSG_WARN(running as non-root will disable some tests)
1508 # look for a method of finding the list of network interfaces
1510 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1512 #define HAVE_IFACE_AIX 1
1513 #define AUTOCONF_TEST 1
1514 #include "confdefs.h"
1515 #include "${srcdir-.}/lib/interfaces.c"],
1516 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1517 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1518 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
1521 if test $iface = no; then
1522 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1524 #define HAVE_IFACE_IFCONF 1
1525 #define AUTOCONF_TEST 1
1526 #include "confdefs.h"
1527 #include "${srcdir-.}/lib/interfaces.c"],
1528 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1529 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1530 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
1534 if test $iface = no; then
1535 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1537 #define HAVE_IFACE_IFREQ 1
1538 #define AUTOCONF_TEST 1
1539 #include "confdefs.h"
1540 #include "${srcdir-.}/lib/interfaces.c"],
1541 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1542 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1543 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
1548 ################################################
1549 # look for a method of setting the effective uid
1551 if test $seteuid = no; then
1552 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1554 #define AUTOCONF_TEST 1
1555 #define USE_SETRESUID 1
1556 #include "confdefs.h"
1557 #include "${srcdir-.}/lib/util_sec.c"],
1558 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1559 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1560 seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
1565 if test $seteuid = no; then
1566 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1568 #define AUTOCONF_TEST 1
1569 #define USE_SETREUID 1
1570 #include "confdefs.h"
1571 #include "${srcdir-.}/lib/util_sec.c"],
1572 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1573 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1574 seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
1578 if test $seteuid = no; then
1579 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1581 #define AUTOCONF_TEST 1
1582 #define USE_SETEUID 1
1583 #include "confdefs.h"
1584 #include "${srcdir-.}/lib/util_sec.c"],
1585 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1586 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1587 seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
1591 if test $seteuid = no; then
1592 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1594 #define AUTOCONF_TEST 1
1595 #define USE_SETUIDX 1
1596 #include "confdefs.h"
1597 #include "${srcdir-.}/lib/util_sec.c"],
1598 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1599 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1600 seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
1605 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1606 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1607 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1608 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1609 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
1612 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1613 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1614 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1615 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1616 AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
1619 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1620 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1621 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1622 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1623 AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available])
1626 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1627 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1628 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1629 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1630 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken])
1635 dnl Don't check for 64 bit fcntl locking if we know that the
1636 dnl glibc2.1 broken check has succeeded.
1639 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1641 #if defined(HAVE_UNISTD_H)
1651 #ifdef HAVE_SYS_FCNTL_H
1652 #include <sys/fcntl.h>
1654 main() { struct flock64 fl64;
1655 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1661 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1663 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1664 AC_DEFINE(HAVE_STRUCT_FLOCK64,1,[Whether the flock64 struct is available])
1668 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
1669 AC_TRY_COMPILE([#include <sys/types.h>
1670 #include <sys/stat.h>
1671 #include <unistd.h>],
1672 [struct stat st; st.st_blocks = 0;],
1673 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
1674 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
1675 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
1678 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
1679 AC_TRY_COMPILE([#include <sys/types.h>
1680 #include <sys/stat.h>
1681 #include <unistd.h>],
1682 [struct stat st; st.st_blksize = 0;],
1683 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
1684 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
1685 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
1690 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1692 #ifdef HAVE_SYS_VFS_H
1693 #include <sys/vfs.h>
1695 #ifdef HAVE_SYS_CAPABILITY_H
1696 #include <sys/capability.h>
1699 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1700 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1701 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
1706 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1707 AC_TRY_COMPILE([#include <sys/acl.h>
1708 #if defined(HAVE_RPCSVC_NIS_H)
1709 #include <rpcsvc/nis.h>
1712 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1713 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1714 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken])
1717 AC_SUBST(SMBD_EXTRA_OBJS)
1718 AC_SUBST(SMBD_EXTRA_LIBS)
1720 sinclude(libads/config.m4)
1721 sinclude(passdb/config.m4)
1723 ###############################################
1724 # test for where we get crypt() from
1725 AC_SEARCH_LIBS(crypt, [crypt],
1726 [test "$ac_cv_search_crypt" = "none required" || AUTHLIBS="-lcrypt $AUTHLIBS"
1727 AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
1730 ## moved after the check for -lcrypt in order to
1731 ## ensure that the necessary libraries are included
1732 ## check checking for truncated salt. Wrapped by the
1733 ## $with_pam_for_crypt variable as above --jerry
1735 if test x"$with_pam_for_crypt" != x"yes"; then
1736 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1738 LIBS="$AUTHLIBS $LIBS"
1739 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1740 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
1741 LIBS="$crypt_LIBS"])
1742 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1743 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
1747 #################################################
1748 # these tests are taken from the GNU fileutils package
1749 AC_CHECKING(how to get filesystem space usage)
1752 # Test for statvfs64.
1753 if test $space = no; then
1755 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
1757 #if defined(HAVE_UNISTD_H)
1760 #include <sys/types.h>
1761 #include <sys/statvfs.h>
1764 struct statvfs64 fsd;
1765 exit (statvfs64 (".", &fsd));
1767 fu_cv_sys_stat_statvfs64=yes,
1768 fu_cv_sys_stat_statvfs64=no,
1769 fu_cv_sys_stat_statvfs64=cross)])
1770 if test $fu_cv_sys_stat_statvfs64 = yes; then
1772 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
1776 # Perform only the link test since it seems there are no variants of the
1777 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
1778 # because that got a false positive on SCO OSR5. Adding the declaration
1779 # of a `struct statvfs' causes this test to fail (as it should) on such
1780 # systems. That system is reported to work fine with STAT_STATFS4 which
1781 # is what it gets when this test fails.
1782 if test $space = no; then
1784 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
1785 [AC_TRY_LINK([#include <sys/types.h>
1786 #include <sys/statvfs.h>],
1787 [struct statvfs fsd; statvfs (0, &fsd);],
1788 fu_cv_sys_stat_statvfs=yes,
1789 fu_cv_sys_stat_statvfs=no)])
1790 if test $fu_cv_sys_stat_statvfs = yes; then
1792 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
1796 if test $space = no; then
1797 # DEC Alpha running OSF/1
1798 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
1799 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
1801 #include <sys/param.h>
1802 #include <sys/types.h>
1803 #include <sys/mount.h>
1808 exit (statfs (".", &fsd, sizeof (struct statfs)));
1810 fu_cv_sys_stat_statfs3_osf1=yes,
1811 fu_cv_sys_stat_statfs3_osf1=no,
1812 fu_cv_sys_stat_statfs3_osf1=no)])
1813 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
1814 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
1816 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
1820 if test $space = no; then
1822 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
1823 member (AIX, 4.3BSD)])
1824 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
1826 #ifdef HAVE_SYS_PARAM_H
1827 #include <sys/param.h>
1829 #ifdef HAVE_SYS_MOUNT_H
1830 #include <sys/mount.h>
1832 #ifdef HAVE_SYS_VFS_H
1833 #include <sys/vfs.h>
1839 exit (statfs (".", &fsd));
1841 fu_cv_sys_stat_statfs2_bsize=yes,
1842 fu_cv_sys_stat_statfs2_bsize=no,
1843 fu_cv_sys_stat_statfs2_bsize=no)])
1844 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
1845 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
1847 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
1851 if test $space = no; then
1853 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
1854 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
1855 [AC_TRY_RUN([#include <sys/types.h>
1856 #include <sys/statfs.h>
1860 exit (statfs (".", &fsd, sizeof fsd, 0));
1862 fu_cv_sys_stat_statfs4=yes,
1863 fu_cv_sys_stat_statfs4=no,
1864 fu_cv_sys_stat_statfs4=no)])
1865 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
1866 if test $fu_cv_sys_stat_statfs4 = yes; then
1868 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
1872 if test $space = no; then
1874 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
1875 member (4.4BSD and NetBSD)])
1876 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
1877 [AC_TRY_RUN([#include <sys/types.h>
1878 #ifdef HAVE_SYS_PARAM_H
1879 #include <sys/param.h>
1881 #ifdef HAVE_SYS_MOUNT_H
1882 #include <sys/mount.h>
1888 exit (statfs (".", &fsd));
1890 fu_cv_sys_stat_statfs2_fsize=yes,
1891 fu_cv_sys_stat_statfs2_fsize=no,
1892 fu_cv_sys_stat_statfs2_fsize=no)])
1893 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
1894 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
1896 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
1900 if test $space = no; then
1902 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1903 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1904 [AC_TRY_RUN([#include <sys/types.h>
1905 #ifdef HAVE_SYS_PARAM_H
1906 #include <sys/param.h>
1908 #ifdef HAVE_SYS_MOUNT_H
1909 #include <sys/mount.h>
1911 #ifdef HAVE_SYS_FS_TYPES_H
1912 #include <sys/fs_types.h>
1917 /* Ultrix's statfs returns 1 for success,
1918 0 for not mounted, -1 for failure. */
1919 exit (statfs (".", &fsd) != 1);
1921 fu_cv_sys_stat_fs_data=yes,
1922 fu_cv_sys_stat_fs_data=no,
1923 fu_cv_sys_stat_fs_data=no)])
1924 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1925 if test $fu_cv_sys_stat_fs_data = yes; then
1927 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
1932 # As a gating factor for large file support, in order to
1933 # use <4GB files we must have the following minimal support
1935 # long long, and a 64 bit off_t or off64_t.
1936 # If we don't have all of these then disable large
1939 AC_MSG_CHECKING([if large file support can be enabled])
1941 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
1942 #include <sys/types.h>
1948 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
1949 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
1950 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT,1,[Whether large file support can be enabled])
1952 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
1954 sinclude(nsswitch/config.m4)
1955 sinclude(popt/config.m4)
1957 dnl exclude these modules
1958 AC_ARG_WITH(exclude-modules,
1959 [ --with-exclude-modules=MODULES Comma-seperated list of names of modules to exclude from build],
1960 [ if test $withval; then
1961 for i in `echo $withval | sed -e's/,/ /g'`
1967 dnl Always built these modules shared
1968 AC_ARG_WITH(shared-modules,
1969 [ --with-shared-modules=MODULES Comma-seperated list of names of modules to build shared],
1970 [ if test $withval; then
1971 for i in `echo $withval | sed -e's/,/ /g'`
1973 eval MODULE_$i=SHARED
1977 dnl Always built these modules static
1978 AC_ARG_WITH(static-modules,
1979 [ --with-static-modules=MODULES Comma-seperated list of names of modules to statically link in],
1980 [ if test $withval; then
1981 for i in `echo $withval | sed -e's/,/ /g'`
1983 eval MODULE_$i=STATIC
1987 sinclude(lib/iconv.m4)
1988 sinclude(smbd/process_model.m4)
1989 sinclude(ntvfs/config.m4)
1990 sinclude(rpc_server/config.m4)
1992 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
1994 #################################################
1995 # do extra things if we are running insure
1997 if test "${ac_cv_prog_CC}" = "insure"; then
1998 CPPFLAGS="$CPPFLAGS -D__INSURE__"
2001 #################################################
2002 # final configure stuff
2004 AC_MSG_CHECKING([configure summary])
2005 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2007 AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
2008 AC_MSG_WARN([cannot run when cross-compiling]))
2013 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
2014 LIB_REMOVE_USR_LIB(LDFLAGS)
2015 LIB_REMOVE_USR_LIB(LIBS)
2017 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
2018 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
2019 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
2021 AC_OUTPUT(include/stamp-h Makefile)