1 dnl Checks for programs.
2 dnl Unique-to-Samba variables we'll be playing with.
11 AC_DEFINE([_GNU_SOURCE],[],[Pull in GNU extensions])
17 # Config CPPFLAG settings for strange OS's that must be set
21 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
24 # mmap on HPUX is completely broken...
25 AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
26 if test $ac_cv_prog_cc_Ae = yes; then
27 CPPFLAGS="$CPPFLAGS -Ae"
31 # VOS may need to have POSIX support and System V compatibility enabled.
38 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
39 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
43 *-D_SYSV*|*-D_SVID_SOURCE*)
46 CPPFLAGS="$CPPFLAGS -D_SYSV"
47 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
57 AC_CHECK_HEADERS(arpa/inet.h sys/select.h fcntl.h sys/fcntl.h sys/time.h)
58 AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h memory.h net/if.h)
59 AC_CHECK_HEADERS(compat.h math.h)
60 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
61 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
62 AC_CHECK_HEADERS(sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
63 AC_CHECK_HEADERS(fnmatch.h pwd.h sys/termio.h sys/time.h sys/statfs.h sys/statvfs.h stdarg.h sys/sockio.h)
64 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
65 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
66 AC_CHECK_HEADERS(stdint.h inttypes.h locale.h)
67 AC_CHECK_HEADERS(shadow.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
68 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h)
69 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
70 AC_CHECK_HEADERS(sys/acl.h)
72 AC_CHECK_HEADERS(sys/mount.h, , , [AC_INCLUDES_DEFAULT
73 #ifdef HAVE_SYS_PARAM_H
74 #include <sys/param.h>
86 AC_CHECK_TYPE(ino_t,unsigned)
87 AC_CHECK_TYPE(loff_t,off_t)
88 AC_CHECK_TYPE(offset_t,loff_t)
89 AC_CHECK_TYPES(ssize_t)
90 AC_CHECK_TYPES(intptr_t)
91 AC_CHECK_TYPES(long long)
94 ############################################
95 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
96 AC_SEARCH_LIBS(dlopen, [dl], [
97 tmp=$ac_cv_search_dlopen
98 if test "$ac_cv_search_dlopen" = "none required"; then
101 SMB_EXT_LIB(DL, [$tmp])]
103 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
105 ############################################
106 # check for unix domain sockets
107 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
109 #include <sys/types.h>
112 #include <sys/socket.h>
113 #include <sys/un.h>],
115 struct sockaddr_un sunaddr;
116 sunaddr.sun_family = AF_UNIX;
118 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
119 if test x"$samba_cv_unixsocket" = x"yes"; then
120 AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
124 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
126 #include <sys/types.h>
131 #include <sys/socket.h>],[socklen_t i = 0],
132 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
133 if test x"$samba_cv_socklen_t" = x"yes"; then
134 AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
137 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
139 #include <sys/types.h>
144 #include <signal.h>],[sig_atomic_t i = 0],
145 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
146 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
147 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
150 # stupid headers have the functions but no declaration. grrrr.
151 AC_HAVE_DECL(errno, [#include <errno.h>])
152 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
153 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
154 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
155 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
156 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
157 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
161 # The following test taken from the cvs sources
162 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
163 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
164 # libsocket.so which has a bad implementation of gethostbyname (it
165 # only looks in /etc/hosts), so we only look for -lsocket if we need
167 AC_CHECK_FUNCS(connect)
168 if test x"$ac_cv_func_connect" = x"no"; then
171 *) AC_CHECK_LIB(nsl_s, printf) ;;
175 *) AC_CHECK_LIB(nsl, printf) ;;
179 *) AC_CHECK_LIB(socket, connect) ;;
183 *) AC_CHECK_LIB(inet, connect) ;;
185 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
187 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
188 test x"$ac_cv_lib_inet_connect" = x"yes"; then
189 # ac_cv_func_connect=yes
190 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
191 AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
195 AC_CHECK_FUNCS(dlopen dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strtoull strtouq strerror chroot)
196 AC_CHECK_FUNCS(bzero memset strlcpy strlcat)
197 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid pipe crypt16 getauthuid)
198 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
199 AC_CHECK_FUNCS(initgroups)
200 AC_CHECK_FUNCS(setgroups sysconf mktime rename ftruncate chsize)
201 AC_CHECK_FUNCS(getpwanam setlinebuf)
202 AC_CHECK_FUNCS(srandom random srand rand setenv usleep)
203 AC_CHECK_FUNCS(syslog vsyslog timegm backtrace)
204 AC_CHECK_FUNCS(setbuffer)
206 AC_CHECK_FUNCS(pread pwrite)
208 #####################################
209 # we might need the resolv library on some systems
210 AC_CHECK_LIB(resolv, dn_expand)
212 # Assume non-shared by default and override below
215 # these are the defaults, good for lots of systems
225 AC_MSG_CHECKING([ability to build shared libraries])
227 # and these are for particular systems
229 *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
232 DYNEXP="-Wl,--export-dynamic"
234 SONAMEFLAG="-Wl,-soname="
235 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
237 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
241 if test "${GCC}" = "yes"; then
243 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
248 ## ${CFLAGS} added for building 64-bit shared
249 ## libs using Sun's Compiler
250 LDSHFLAGS="-G \${CFLAGS}"
254 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
256 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
260 PICFLAG="-KPIC" # Is this correct for SunOS
261 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
263 *netbsd* | *freebsd*) BLDSHARED="true"
265 DYNEXP="-Wl,--export-dynamic"
266 SONAMEFLAG="-Wl,-soname,"
267 PICFLAG="-fPIC -DPIC"
268 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
270 *openbsd*) BLDSHARED="true"
272 DYNEXP="-Wl,-Bdynamic"
273 SONAMEFLAG="-Wl,-soname,"
275 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
277 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
279 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
282 ATTEMPT_WRAP32_BUILD=yes
284 LDSHFLAGS="-set_version sgi1.0 -shared"
285 SONAMEFLAG="-soname "
287 if test "${GCC}" = "yes"; then
292 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
294 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
296 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
297 DYNEXP="-Wl,-brtl,-bexpall"
299 if test "${GCC}" != "yes"; then
300 ## for funky AIX compiler using strncpy()
301 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
304 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
306 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
308 # Use special PIC flags for the native HP-UX compiler.
309 if test $ac_cv_prog_cc_Ae = yes; then
312 LDSHFLAGS="-B symbolic -b -z"
317 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
319 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
320 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
322 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
325 SONAMEFLAG="-Wl,-soname,"
327 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
329 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
330 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
332 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
335 SONAMEFLAG="-Wl,-soname,"
337 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
339 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
340 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
342 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
343 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
345 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
347 *-univel-*) if [ test "$GCC" != yes ]; then
348 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
353 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
355 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
358 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
359 if [ test "$GCC" != yes ]; then
360 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
363 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
365 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
370 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
373 AC_MSG_RESULT($BLDSHARED)
374 AC_MSG_CHECKING([linker flags for shared libraries])
375 AC_MSG_RESULT([$LDSHFLAGS])
376 AC_MSG_CHECKING([compiler flags for position-independent code])
377 AC_MSG_RESULT([$PICFLAGS])
379 #######################################################
380 # test whether building a shared library actually works
381 if test $BLDSHARED = true; then
382 AC_CACHE_CHECK([whether building shared libraries actually works],
383 [ac_cv_shlib_works],[
385 # try building a trivial shared library
386 if test "$PICSUFFIX" = "po"; then
387 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
388 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
389 ac_cv_shlib_works=yes
391 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
392 mv shlib.$PICSUFFIX shlib.po &&
393 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
394 ac_cv_shlib_works=yes
396 rm -f shlib.so shlib.po
398 if test $ac_cv_shlib_works = no; then
403 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
404 AC_TRY_COMPILE([#include <sys/types.h>
405 #include <sys/socket.h>
406 #include <netinet/in.h>],
407 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
408 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
409 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
410 AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
413 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
414 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
415 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
416 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
417 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
420 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
422 #include <sys/time.h>
424 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
425 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
426 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
427 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
430 AC_CACHE_CHECK([for va_copy],samba_cv_HAVE_VA_COPY,[
431 AC_TRY_LINK([#include <stdarg.h>
432 va_list ap1,ap2;], [va_copy(ap1,ap2);],
433 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
434 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
435 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
438 if test x"$samba_cv_HAVE_VA_COPY" != x"yes"; then
439 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE___VA_COPY,[
440 AC_TRY_LINK([#include <stdarg.h>
441 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
442 samba_cv_HAVE___VA_COPY=yes,samba_cv_HAVE___VA_COPY=no)])
443 if test x"$samba_cv_HAVE___VA_COPY" = x"yes"; then
444 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
448 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
450 #include <sys/types.h>
452 void foo(const char *format, ...) {
456 long long l = 1234567890;
459 va_start(ap, format);
460 len = vsnprintf(buf, 0, format, ap);
462 if (len != 5) exit(1);
464 va_start(ap, format);
465 len = vsnprintf(0, 0, format, ap);
467 if (len != 5) exit(1);
469 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
471 if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(1);
475 main() { foo("hello"); }
477 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
478 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
479 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
482 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
483 AC_TRY_COMPILE([#include <sys/types.h>
485 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
486 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
487 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
488 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
491 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
493 #include <sys/types.h>
496 #define F_GETLEASE 1025
499 int fd = open("/dev/null", O_RDONLY);
500 return fcntl(fd, F_GETLEASE, 0) == -1;
503 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
504 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
505 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
508 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
510 #include <sys/types.h>
514 #define F_NOTIFY 1026
517 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
520 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
521 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
522 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
525 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
527 #include <sys/types.h>
530 #include <sys/file.h>
536 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
539 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
540 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
541 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
547 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
548 AC_TRY_COMPILE([#include <sys/types.h>
550 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
551 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
552 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
553 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
556 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
557 AC_TRY_RUN([#include <sys/types.h>
558 #include <sys/capability.h>
561 if ((cap = cap_get_proc()) == NULL)
563 cap->cap_effective |= CAP_NETWORK_MGT;
564 cap->cap_inheritable |= CAP_NETWORK_MGT;
569 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
570 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
571 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
575 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
576 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncate.c"],
577 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
578 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
579 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
582 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
583 AC_TRY_RUN([#include "${srcdir-.}/build/tests/unixsock.c"],
584 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
585 samba_cv_HAVE_WORKING_AF_LOCAL=no,
586 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
587 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
589 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
592 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
593 AC_TRY_RUN([#include "${srcdir-.}/build/tests/getgroups.c"],
594 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
595 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
596 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
599 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
602 #include <sys/types.h>
603 #include <netinet/in.h>
604 #ifdef HAVE_ARPA_INET_H
605 #include <arpa/inet.h>
607 main() { struct in_addr ip; ip.s_addr = 0x12345678;
608 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
609 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
611 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
612 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
613 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
616 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
617 AC_TRY_RUN([#include <stdlib.h>
618 #include <sys/types.h>
619 #include <sys/stat.h>
623 char tpl[20]="/tmp/test.XXXXXX";
624 int fd = mkstemp(tpl);
625 if (fd == -1) exit(1);
627 if (fstat(fd, &st) != 0) exit(1);
628 if ((st.st_mode & 0777) != 0600) exit(1);
631 samba_cv_HAVE_SECURE_MKSTEMP=yes,
632 samba_cv_HAVE_SECURE_MKSTEMP=no,
633 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
634 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
635 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
638 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
639 AC_TRY_RUN([#include <unistd.h>
640 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
641 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
642 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
643 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
647 # look for a method of finding the list of network interfaces
649 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
651 #define HAVE_IFACE_AIX 1
652 #define AUTOCONF_TEST 1
653 #include "confdefs.h"
654 #include "${srcdir-.}/lib/netif/netif.c"],
655 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
656 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
657 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
660 if test $iface = no; then
661 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
663 #define HAVE_IFACE_IFCONF 1
664 #define AUTOCONF_TEST 1
665 #include "confdefs.h"
666 #include "${srcdir-.}/lib/netif/netif.c"],
667 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
668 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
669 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
673 if test $iface = no; then
674 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
676 #define HAVE_IFACE_IFREQ 1
677 #define AUTOCONF_TEST 1
678 #include "confdefs.h"
679 #include "${srcdir-.}/lib/netif/netif.c"],
680 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
681 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
682 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
686 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
687 AC_TRY_RUN([#include "${srcdir-.}/build/tests/shared_mmap.c"],
688 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
689 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
690 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
693 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
694 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncroot.c"],
695 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
696 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
697 AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
700 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
701 AC_TRY_COMPILE([#include <sys/types.h>
702 #include <sys/stat.h>
703 #include <unistd.h>],
704 [struct stat st; st.st_blocks = 0;],
705 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
706 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
707 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
710 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
711 AC_TRY_COMPILE([#include <sys/types.h>
712 #include <sys/stat.h>
713 #include <unistd.h>],
714 [struct stat st; st.st_blksize = 0;],
715 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
716 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
717 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
722 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
724 #ifdef HAVE_SYS_VFS_H
727 #ifdef HAVE_SYS_CAPABILITY_H
728 #include <sys/capability.h>
731 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
732 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
733 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
738 AC_SUBST(SMBD_EXTRA_OBJS)
739 AC_SUBST(SMBD_EXTRA_LIBS)
741 ###############################################
742 # test for where we get crypt() from
743 AC_CHECK_LIB_EXT(crypt, CRYPT_LIBS, crypt)
744 SMB_EXT_LIB_ENABLE(CRYPT,YES)
745 SMB_EXT_LIB(CRYPT, $CRYPT_LIBS)
748 ## moved after the check for -lcrypt in order to
749 ## ensure that the necessary libraries are included
750 ## check checking for truncated salt. Wrapped by the
751 ## $with_pam_for_crypt variable as above --jerry
753 if test x"$with_pam_for_crypt" != x"yes"; then
754 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
756 LIBS="$AUTHLIBS $LIBS"
757 AC_TRY_RUN([#include "${srcdir-.}/build/tests/crypttest.c"],
758 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
760 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
761 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
765 #################################################
766 # these tests are taken from the GNU fileutils package
767 AC_CHECKING(how to get filesystem space usage)
770 # Test for statvfs64.
771 if test $space = no; then
773 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
775 #if defined(HAVE_UNISTD_H)
778 #include <sys/types.h>
779 #include <sys/statvfs.h>
782 struct statvfs64 fsd;
783 exit (statvfs64 (".", &fsd));
785 fu_cv_sys_stat_statvfs64=yes,
786 fu_cv_sys_stat_statvfs64=no,
787 fu_cv_sys_stat_statvfs64=cross)])
788 if test $fu_cv_sys_stat_statvfs64 = yes; then
790 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
794 # Perform only the link test since it seems there are no variants of the
795 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
796 # because that got a false positive on SCO OSR5. Adding the declaration
797 # of a `struct statvfs' causes this test to fail (as it should) on such
798 # systems. That system is reported to work fine with STAT_STATFS4 which
799 # is what it gets when this test fails.
800 if test $space = no; then
802 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
803 [AC_TRY_LINK([#include <sys/types.h>
804 #include <sys/statvfs.h>],
805 [struct statvfs fsd; statvfs (0, &fsd);],
806 fu_cv_sys_stat_statvfs=yes,
807 fu_cv_sys_stat_statvfs=no)])
808 if test $fu_cv_sys_stat_statvfs = yes; then
810 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
814 if test $space = no; then
815 # DEC Alpha running OSF/1
816 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
817 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
819 #include <sys/param.h>
820 #include <sys/types.h>
821 #include <sys/mount.h>
826 exit (statfs (".", &fsd, sizeof (struct statfs)));
828 fu_cv_sys_stat_statfs3_osf1=yes,
829 fu_cv_sys_stat_statfs3_osf1=no,
830 fu_cv_sys_stat_statfs3_osf1=no)])
831 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
832 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
834 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
838 if test $space = no; then
840 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
841 member (AIX, 4.3BSD)])
842 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
844 #ifdef HAVE_SYS_PARAM_H
845 #include <sys/param.h>
847 #ifdef HAVE_SYS_MOUNT_H
848 #include <sys/mount.h>
850 #ifdef HAVE_SYS_VFS_H
857 exit (statfs (".", &fsd));
859 fu_cv_sys_stat_statfs2_bsize=yes,
860 fu_cv_sys_stat_statfs2_bsize=no,
861 fu_cv_sys_stat_statfs2_bsize=no)])
862 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
863 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
865 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
869 if test $space = no; then
871 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
872 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
873 [AC_TRY_RUN([#include <sys/types.h>
874 #include <sys/statfs.h>
878 exit (statfs (".", &fsd, sizeof fsd, 0));
880 fu_cv_sys_stat_statfs4=yes,
881 fu_cv_sys_stat_statfs4=no,
882 fu_cv_sys_stat_statfs4=no)])
883 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
884 if test $fu_cv_sys_stat_statfs4 = yes; then
886 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
890 if test $space = no; then
892 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
893 member (4.4BSD and NetBSD)])
894 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
895 [AC_TRY_RUN([#include <sys/types.h>
896 #ifdef HAVE_SYS_PARAM_H
897 #include <sys/param.h>
899 #ifdef HAVE_SYS_MOUNT_H
900 #include <sys/mount.h>
906 exit (statfs (".", &fsd));
908 fu_cv_sys_stat_statfs2_fsize=yes,
909 fu_cv_sys_stat_statfs2_fsize=no,
910 fu_cv_sys_stat_statfs2_fsize=no)])
911 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
912 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
914 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
918 if test $space = no; then
920 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
921 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
922 [AC_TRY_RUN([#include <sys/types.h>
923 #ifdef HAVE_SYS_PARAM_H
924 #include <sys/param.h>
926 #ifdef HAVE_SYS_MOUNT_H
927 #include <sys/mount.h>
929 #ifdef HAVE_SYS_FS_TYPES_H
930 #include <sys/fs_types.h>
935 /* Ultrix's statfs returns 1 for success,
936 0 for not mounted, -1 for failure. */
937 exit (statfs (".", &fsd) != 1);
939 fu_cv_sys_stat_fs_data=yes,
940 fu_cv_sys_stat_fs_data=no,
941 fu_cv_sys_stat_fs_data=no)])
942 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
943 if test $fu_cv_sys_stat_fs_data = yes; then
945 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
951 #######################################
952 # Check for comparison_fn_t
953 AC_CACHE_CHECK([for comparison_fn_t],samba_cv_HAVE_COMPARISON_FN_T,[
956 int list_find(const void *needle,
957 const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn)
962 samba_cv_HAVE_COMPARISON_FN_T=yes,samba_cv_HAVE_COMPARISON_FN_T=no)
964 if test x"$samba_cv_HAVE_COMPARISON_FN_T" = x"yes"; then
965 AC_DEFINE(HAVE_COMPARISON_FN_T,1,[Whether or not we have comparison_fn_t])