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 ldap.h lber.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 ICONV_LOCATION=standard
1252 LOOK_DIRS="/usr /usr/local /sw"
1253 AC_ARG_WITH(libiconv,
1254 [ --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
1256 if test "$withval" = "no" ; then
1257 AC_MSG_ERROR(I won't take no for an answer)
1259 if test "$withval" != "yes" ; then
1260 LOOK_DIRS="$withval $LOOK_DIRS"
1266 for i in $LOOK_DIRS ; do
1268 save_LDFLAGS=$LDFLAGS
1269 save_CPPFLAGS=$CPPFLAGS
1270 CPPFLAGS="-I$i/include"
1273 export LDFLAGS LIBS CPPFLAGS
1274 dnl Try to find iconv(3)
1277 CPPFLAGS=$save_CPPFLAGS
1278 if test -n "$ICONV_FOUND" ; then
1279 LDFLAGS=$save_LDFLAGS
1280 LIB_ADD_DIR(LDFLAGS, "$i/lib")
1281 CFLAGS_ADD_DIR(CPPFLAGS, "$i/include")
1282 LIBS="$save_LIBS $LIBS"
1284 export LDFLAGS LIBS CPPFLAGS
1287 LDFLAGS=$save_LDFLAGS
1289 export LDFLAGS LIBS CPPFLAGS
1294 # check for iconv in libc
1295 AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1299 iconv_t cd = iconv_open("ASCII", "UCS-2LE");
1300 if (cd == 0 || cd == (iconv_t)-1) return -1;
1304 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
1305 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1306 AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
1309 if test x"$ICONV_FOUND" = x"no" -o x"$samba_cv_HAVE_NATIVE_ICONV" != x"yes" ; then
1310 AC_MSG_WARN([Sufficient support for iconv function was not found.
1311 Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!])
1315 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1317 #include <sys/types.h>
1320 #define F_GETLEASE 1025
1323 int fd = open("/dev/null", O_RDONLY);
1324 return fcntl(fd, F_GETLEASE, 0) == -1;
1327 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1328 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1329 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
1332 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1334 #include <sys/types.h>
1338 #define F_NOTIFY 1026
1341 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1344 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1345 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1346 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
1349 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1351 #include <sys/types.h>
1354 #include <sys/file.h>
1356 #define LOCK_MAND 32
1357 #define LOCK_READ 64
1360 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1363 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1364 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1365 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
1371 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1372 AC_TRY_COMPILE([#include <sys/types.h>
1373 #include <fcntl.h>],
1374 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1375 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1376 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1377 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
1380 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1381 AC_TRY_RUN([#include <sys/types.h>
1382 #include <sys/capability.h>
1385 if ((cap = cap_get_proc()) == NULL)
1387 cap->cap_effective |= CAP_NETWORK_MGT;
1388 cap->cap_inheritable |= CAP_NETWORK_MGT;
1393 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1394 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1395 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
1399 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1400 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1403 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1404 AC_TRY_COMPILE([#include <sys/types.h>
1405 #if defined(HAVE_RPC_RPC_H)
1406 #include <rpc/rpc.h>
1409 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1410 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1411 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H,1,[Whether int16 typedef is included by rpc/rpc.h])
1414 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1415 AC_TRY_COMPILE([#include <sys/types.h>
1416 #if defined(HAVE_RPC_RPC_H)
1417 #include <rpc/rpc.h>
1420 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1421 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1422 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H,1,[Whether uint16 typedef is included by rpc/rpc.h])
1425 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1426 AC_TRY_COMPILE([#include <sys/types.h>
1427 #if defined(HAVE_RPC_RPC_H)
1428 #include <rpc/rpc.h>
1431 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1432 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1433 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H,1,[Whether int32 typedef is included by rpc/rpc.h])
1436 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1437 AC_TRY_COMPILE([#include <sys/types.h>
1438 #if defined(HAVE_RPC_RPC_H)
1439 #include <rpc/rpc.h>
1442 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1443 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1444 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H,1,[Whether uint32 typedef is included by rpc/rpc.h])
1448 dnl Some systems (SCO) have a problem including
1449 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1450 dnl as a #define in <prot.h> and as part of an enum
1454 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1455 AC_TRY_COMPILE([#include <sys/types.h>
1456 #ifdef HAVE_SYS_SECURITY_H
1457 #include <sys/security.h>
1459 #endif /* HAVE_SYS_SECURITY_H */
1460 #if defined(HAVE_RPC_RPC_H)
1461 #include <rpc/rpc.h>
1464 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1465 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1466 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT,1,[Whether there is a conflicting AUTH_ERROR define in rpc/rpc.h])
1469 AC_MSG_CHECKING([for test routines])
1470 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1472 AC_MSG_ERROR([cant find test code. Aborting config]),
1473 AC_MSG_WARN([cannot run when cross-compiling]))
1475 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1476 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1477 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1478 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1479 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
1482 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1483 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1484 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1485 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1486 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1487 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1489 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1492 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1493 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1494 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1495 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1496 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
1499 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1500 SAVE_CPPFLAGS="$CPPFLAGS"
1501 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper"
1503 #define REPLACE_GETPASS 1
1504 #define NO_CONFIG_H 1
1505 #define main dont_declare_main
1506 #include "${srcdir-.}/lib/getsmbpass.c"
1508 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1509 CPPFLAGS="$SAVE_CPPFLAGS"
1511 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1512 AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
1515 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1518 #include <sys/types.h>
1519 #include <netinet/in.h>
1520 #ifdef HAVE_ARPA_INET_H
1521 #include <arpa/inet.h>
1523 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1524 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1525 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1527 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1528 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1529 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
1532 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1533 AC_TRY_RUN([#include <stdlib.h>
1534 #include <sys/types.h>
1535 #include <sys/stat.h>
1539 char tpl[20]="/tmp/test.XXXXXX";
1540 int fd = mkstemp(tpl);
1541 if (fd == -1) exit(1);
1543 if (fstat(fd, &st) != 0) exit(1);
1544 if ((st.st_mode & 0777) != 0600) exit(1);
1547 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1548 samba_cv_HAVE_SECURE_MKSTEMP=no,
1549 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1550 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1551 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
1554 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1555 AC_TRY_RUN([#include <unistd.h>
1556 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1557 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1558 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1559 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
1562 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1563 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1564 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1565 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1566 AC_DEFINE(HAVE_ROOT,1,[Whether current user is root])
1568 AC_MSG_WARN(running as non-root will disable some tests)
1572 # look for a method of finding the list of network interfaces
1574 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1576 #define HAVE_IFACE_AIX 1
1577 #define AUTOCONF_TEST 1
1578 #include "confdefs.h"
1579 #include "${srcdir-.}/lib/interfaces.c"],
1580 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1581 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1582 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
1585 if test $iface = no; then
1586 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1588 #define HAVE_IFACE_IFCONF 1
1589 #define AUTOCONF_TEST 1
1590 #include "confdefs.h"
1591 #include "${srcdir-.}/lib/interfaces.c"],
1592 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1593 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1594 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
1598 if test $iface = no; then
1599 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1601 #define HAVE_IFACE_IFREQ 1
1602 #define AUTOCONF_TEST 1
1603 #include "confdefs.h"
1604 #include "${srcdir-.}/lib/interfaces.c"],
1605 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1606 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1607 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
1612 ################################################
1613 # look for a method of setting the effective uid
1615 if test $seteuid = no; then
1616 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1618 #define AUTOCONF_TEST 1
1619 #define USE_SETRESUID 1
1620 #include "confdefs.h"
1621 #include "${srcdir-.}/lib/util_sec.c"],
1622 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1623 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1624 seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
1629 if test $seteuid = no; then
1630 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1632 #define AUTOCONF_TEST 1
1633 #define USE_SETREUID 1
1634 #include "confdefs.h"
1635 #include "${srcdir-.}/lib/util_sec.c"],
1636 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1637 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1638 seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
1642 if test $seteuid = no; then
1643 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1645 #define AUTOCONF_TEST 1
1646 #define USE_SETEUID 1
1647 #include "confdefs.h"
1648 #include "${srcdir-.}/lib/util_sec.c"],
1649 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1650 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1651 seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
1655 if test $seteuid = no; then
1656 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1658 #define AUTOCONF_TEST 1
1659 #define USE_SETUIDX 1
1660 #include "confdefs.h"
1661 #include "${srcdir-.}/lib/util_sec.c"],
1662 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1663 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1664 seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
1669 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1670 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1671 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1672 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1673 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
1676 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1677 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1678 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1679 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1680 AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
1683 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1684 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1685 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1686 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1687 AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available])
1690 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1691 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1692 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1693 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1694 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken])
1699 dnl Don't check for 64 bit fcntl locking if we know that the
1700 dnl glibc2.1 broken check has succeeded.
1703 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1705 #if defined(HAVE_UNISTD_H)
1715 #ifdef HAVE_SYS_FCNTL_H
1716 #include <sys/fcntl.h>
1718 main() { struct flock64 fl64;
1719 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1725 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1727 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1728 AC_DEFINE(HAVE_STRUCT_FLOCK64,1,[Whether the flock64 struct is available])
1732 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
1733 AC_TRY_COMPILE([#include <sys/types.h>
1734 #include <sys/stat.h>
1735 #include <unistd.h>],
1736 [struct stat st; st.st_blocks = 0;],
1737 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
1738 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
1739 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
1742 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
1743 AC_TRY_COMPILE([#include <sys/types.h>
1744 #include <sys/stat.h>
1745 #include <unistd.h>],
1746 [struct stat st; st.st_blksize = 0;],
1747 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
1748 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
1749 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
1754 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1756 #ifdef HAVE_SYS_VFS_H
1757 #include <sys/vfs.h>
1759 #ifdef HAVE_SYS_CAPABILITY_H
1760 #include <sys/capability.h>
1763 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1764 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1765 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
1770 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1771 AC_TRY_COMPILE([#include <sys/acl.h>
1772 #if defined(HAVE_RPCSVC_NIS_H)
1773 #include <rpcsvc/nis.h>
1776 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1777 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1778 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken])
1781 #################################################
1782 # check for pthread support
1783 AC_MSG_CHECKING(whether to use pthreads)
1784 AC_ARG_WITH(pthreads,
1785 [ --with-pthreads Include pthreads (default=no) ],
1786 [ case "$withval" in
1789 AC_DEFINE(WITH_PTHREADS,1,[Whether to use pthreads])
1790 SMBD_EXTRA_OBJS="smbd/process_thread.o"
1791 SMBD_EXTRA_LIBS="-lpthread"
1800 AC_SUBST(SMBD_EXTRA_OBJS)
1801 AC_SUBST(SMBD_EXTRA_LIBS)
1803 sinclude(libads/config.m4)
1804 sinclude(passdb/config.m4)
1806 ###############################################
1807 # test for where we get crypt() from
1808 AC_SEARCH_LIBS(crypt, [crypt],
1809 [test "$ac_cv_search_crypt" = "none required" || AUTHLIBS="-lcrypt $AUTHLIBS"
1810 AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
1813 ## moved after the check for -lcrypt in order to
1814 ## ensure that the necessary libraries are included
1815 ## check checking for truncated salt. Wrapped by the
1816 ## $with_pam_for_crypt variable as above --jerry
1818 if test $with_pam_for_crypt = no; then
1819 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1821 LIBS="$AUTHLIBS $LIBS"
1822 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1823 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
1824 LIBS="$crypt_LIBS"])
1825 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1826 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
1830 #################################################
1831 # these tests are taken from the GNU fileutils package
1832 AC_CHECKING(how to get filesystem space usage)
1835 # Test for statvfs64.
1836 if test $space = no; then
1838 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
1840 #if defined(HAVE_UNISTD_H)
1843 #include <sys/types.h>
1844 #include <sys/statvfs.h>
1847 struct statvfs64 fsd;
1848 exit (statvfs64 (".", &fsd));
1850 fu_cv_sys_stat_statvfs64=yes,
1851 fu_cv_sys_stat_statvfs64=no,
1852 fu_cv_sys_stat_statvfs64=cross)])
1853 if test $fu_cv_sys_stat_statvfs64 = yes; then
1855 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
1859 # Perform only the link test since it seems there are no variants of the
1860 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
1861 # because that got a false positive on SCO OSR5. Adding the declaration
1862 # of a `struct statvfs' causes this test to fail (as it should) on such
1863 # systems. That system is reported to work fine with STAT_STATFS4 which
1864 # is what it gets when this test fails.
1865 if test $space = no; then
1867 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
1868 [AC_TRY_LINK([#include <sys/types.h>
1869 #include <sys/statvfs.h>],
1870 [struct statvfs fsd; statvfs (0, &fsd);],
1871 fu_cv_sys_stat_statvfs=yes,
1872 fu_cv_sys_stat_statvfs=no)])
1873 if test $fu_cv_sys_stat_statvfs = yes; then
1875 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
1879 if test $space = no; then
1880 # DEC Alpha running OSF/1
1881 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
1882 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
1884 #include <sys/param.h>
1885 #include <sys/types.h>
1886 #include <sys/mount.h>
1891 exit (statfs (".", &fsd, sizeof (struct statfs)));
1893 fu_cv_sys_stat_statfs3_osf1=yes,
1894 fu_cv_sys_stat_statfs3_osf1=no,
1895 fu_cv_sys_stat_statfs3_osf1=no)])
1896 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
1897 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
1899 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
1903 if test $space = no; then
1905 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
1906 member (AIX, 4.3BSD)])
1907 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
1909 #ifdef HAVE_SYS_PARAM_H
1910 #include <sys/param.h>
1912 #ifdef HAVE_SYS_MOUNT_H
1913 #include <sys/mount.h>
1915 #ifdef HAVE_SYS_VFS_H
1916 #include <sys/vfs.h>
1922 exit (statfs (".", &fsd));
1924 fu_cv_sys_stat_statfs2_bsize=yes,
1925 fu_cv_sys_stat_statfs2_bsize=no,
1926 fu_cv_sys_stat_statfs2_bsize=no)])
1927 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
1928 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
1930 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
1934 if test $space = no; then
1936 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
1937 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
1938 [AC_TRY_RUN([#include <sys/types.h>
1939 #include <sys/statfs.h>
1943 exit (statfs (".", &fsd, sizeof fsd, 0));
1945 fu_cv_sys_stat_statfs4=yes,
1946 fu_cv_sys_stat_statfs4=no,
1947 fu_cv_sys_stat_statfs4=no)])
1948 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
1949 if test $fu_cv_sys_stat_statfs4 = yes; then
1951 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
1955 if test $space = no; then
1957 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
1958 member (4.4BSD and NetBSD)])
1959 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
1960 [AC_TRY_RUN([#include <sys/types.h>
1961 #ifdef HAVE_SYS_PARAM_H
1962 #include <sys/param.h>
1964 #ifdef HAVE_SYS_MOUNT_H
1965 #include <sys/mount.h>
1971 exit (statfs (".", &fsd));
1973 fu_cv_sys_stat_statfs2_fsize=yes,
1974 fu_cv_sys_stat_statfs2_fsize=no,
1975 fu_cv_sys_stat_statfs2_fsize=no)])
1976 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
1977 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
1979 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
1983 if test $space = no; then
1985 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1986 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1987 [AC_TRY_RUN([#include <sys/types.h>
1988 #ifdef HAVE_SYS_PARAM_H
1989 #include <sys/param.h>
1991 #ifdef HAVE_SYS_MOUNT_H
1992 #include <sys/mount.h>
1994 #ifdef HAVE_SYS_FS_TYPES_H
1995 #include <sys/fs_types.h>
2000 /* Ultrix's statfs returns 1 for success,
2001 0 for not mounted, -1 for failure. */
2002 exit (statfs (".", &fsd) != 1);
2004 fu_cv_sys_stat_fs_data=yes,
2005 fu_cv_sys_stat_fs_data=no,
2006 fu_cv_sys_stat_fs_data=no)])
2007 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2008 if test $fu_cv_sys_stat_fs_data = yes; then
2010 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
2015 # As a gating factor for large file support, in order to
2016 # use <4GB files we must have the following minimal support
2018 # long long, and a 64 bit off_t or off64_t.
2019 # If we don't have all of these then disable large
2022 AC_MSG_CHECKING([if large file support can be enabled])
2024 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2025 #include <sys/types.h>
2031 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2032 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2033 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT,1,[Whether large file support can be enabled])
2035 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
2037 sinclude(nsswitch/config.m4)
2038 sinclude(popt/config.m4)
2040 dnl exclude these modules
2041 AC_ARG_WITH(exclude-modules,
2042 [ --with-exclude-modules=MODULES Comma-seperated list of names of modules to exclude from build],
2043 [ if test $withval; then
2044 for i in `echo $withval | sed -e's/,/ /g'`
2050 dnl Always built these modules shared
2051 AC_ARG_WITH(shared-modules,
2052 [ --with-shared-modules=MODULES Comma-seperated list of names of modules to build shared],
2053 [ if test $withval; then
2054 for i in `echo $withval | sed -e's/,/ /g'`
2056 eval MODULE_$i=SHARED
2060 dnl Always built these modules static
2061 AC_ARG_WITH(static-modules,
2062 [ --with-static-modules=MODULES Comma-seperated list of names of modules to statically link in],
2063 [ if test $withval; then
2064 for i in `echo $withval | sed -e's/,/ /g'`
2066 eval MODULE_$i=STATIC
2070 SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
2072 sinclude(ntvfs/config.m4)
2073 sinclude(rpc_server/config.m4)
2075 AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
2077 #################################################
2078 # do extra things if we are running insure
2080 if test "${ac_cv_prog_CC}" = "insure"; then
2081 CPPFLAGS="$CPPFLAGS -D__INSURE__"
2084 #################################################
2085 # final configure stuff
2087 AC_MSG_CHECKING([configure summary])
2088 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2090 AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
2091 AC_MSG_WARN([cannot run when cross-compiling]))
2096 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
2097 LIB_REMOVE_USR_LIB(LDFLAGS)
2098 LIB_REMOVE_USR_LIB(LIBS)
2100 dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
2101 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
2102 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
2104 AC_OUTPUT(include/stamp-h Makefile script/findsmb)