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])
15 # Config CPPFLAG settings for strange OS's that must be set
19 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
22 # mmap on HPUX is completely broken...
23 AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
24 if test $ac_cv_prog_cc_Ae = yes; then
25 CPPFLAGS="$CPPFLAGS -Ae"
29 # VOS may need to have POSIX support and System V compatibility enabled.
36 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
37 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
41 *-D_SYSV*|*-D_SVID_SOURCE*)
44 CPPFLAGS="$CPPFLAGS -D_SYSV"
45 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
55 AC_CHECK_HEADERS(sys/select.h fcntl.h sys/fcntl.h sys/time.h)
56 AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h memory.h)
57 AC_CHECK_HEADERS(compat.h math.h)
58 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
59 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h)
60 AC_CHECK_HEADERS(sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
61 AC_CHECK_HEADERS(fnmatch.h pwd.h sys/termio.h sys/time.h sys/statfs.h sys/statvfs.h stdarg.h)
62 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
63 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
64 AC_CHECK_HEADERS(stdint.h inttypes.h locale.h)
65 AC_CHECK_HEADERS(shadow.h)
66 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h)
67 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
68 AC_CHECK_HEADERS(sys/acl.h)
70 AC_CHECK_HEADERS(sys/mount.h, , , [AC_INCLUDES_DEFAULT
71 #ifdef HAVE_SYS_PARAM_H
72 #include <sys/param.h>
84 AC_CHECK_TYPE(ino_t,unsigned)
85 AC_CHECK_TYPE(loff_t,off_t)
86 AC_CHECK_TYPE(offset_t,loff_t)
87 AC_CHECK_TYPES(ssize_t)
88 AC_CHECK_TYPES(intptr_t)
89 AC_CHECK_TYPES(long long)
92 ############################################
93 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
94 AC_SEARCH_LIBS_EXT(dlopen, [dl], DL_LIBS)
95 SMB_EXT_LIB(DL,[${DL_LIBS}],[${DL_CFLAGS}],[${DL_CPPFLAGS}],[${DL_LDFLAGS}])
96 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
98 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
100 #include <sys/types.h>
105 #include <signal.h>],[sig_atomic_t i = 0],
106 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
107 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
108 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
111 # stupid headers have the functions but no declaration. grrrr.
112 AC_HAVE_DECL(errno, [#include <errno.h>])
113 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
114 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
115 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
116 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
117 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
118 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
122 AC_CHECK_FUNCS(dlopen dlsym dlerror waitpid getcwd strdup strndup strnlen strerror chroot)
123 AC_CHECK_FUNCS(bzero memset strlcpy strlcat)
124 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid pipe crypt16 getauthuid)
125 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
126 AC_CHECK_FUNCS(initgroups)
127 AC_CHECK_FUNCS(setgroups sysconf mktime rename ftruncate chsize)
128 AC_CHECK_FUNCS(getpwanam setlinebuf)
129 AC_CHECK_FUNCS(srandom random srand rand setenv usleep)
130 AC_CHECK_FUNCS(syslog vsyslog timegm backtrace)
131 AC_CHECK_FUNCS(setbuffer)
133 AC_CHECK_FUNCS(pread pwrite)
135 # Assume non-shared by default and override below
138 # these are the defaults, good for lots of systems
148 AC_MSG_CHECKING([ability to build shared libraries])
150 # and these are for particular systems
152 *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
155 DYNEXP="-Wl,--export-dynamic"
157 SONAMEFLAG="-Wl,-soname="
158 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
160 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
164 if test "${GCC}" = "yes"; then
166 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
171 ## ${CFLAGS} added for building 64-bit shared
172 ## libs using Sun's Compiler
173 LDSHFLAGS="-G \${CFLAGS}"
177 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
179 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
183 PICFLAG="-KPIC" # Is this correct for SunOS
184 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
186 *netbsd* | *freebsd*) BLDSHARED="true"
188 DYNEXP="-Wl,--export-dynamic"
189 SONAMEFLAG="-Wl,-soname,"
190 PICFLAG="-fPIC -DPIC"
191 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
193 *openbsd*) BLDSHARED="true"
195 DYNEXP="-Wl,-Bdynamic"
196 SONAMEFLAG="-Wl,-soname,"
198 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
200 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
202 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
205 ATTEMPT_WRAP32_BUILD=yes
207 LDSHFLAGS="-set_version sgi1.0 -shared"
208 SONAMEFLAG="-soname "
210 if test "${GCC}" = "yes"; then
215 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
217 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
219 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
220 DYNEXP="-Wl,-brtl,-bexpall"
222 if test "${GCC}" != "yes"; then
223 ## for funky AIX compiler using strncpy()
224 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
227 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
229 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
231 # Use special PIC flags for the native HP-UX compiler.
232 if test $ac_cv_prog_cc_Ae = yes; then
235 LDSHFLAGS="-B symbolic -b -z"
240 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
242 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
243 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
245 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
248 SONAMEFLAG="-Wl,-soname,"
250 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
252 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
253 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
255 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
258 SONAMEFLAG="-Wl,-soname,"
260 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
262 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
263 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
265 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
266 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
268 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
270 *-univel-*) if [ test "$GCC" != yes ]; then
271 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
276 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
278 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
281 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
282 if [ test "$GCC" != yes ]; then
283 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
286 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
288 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
293 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
296 AC_MSG_RESULT($BLDSHARED)
297 AC_MSG_CHECKING([linker flags for shared libraries])
298 AC_MSG_RESULT([$LDSHFLAGS])
299 AC_MSG_CHECKING([compiler flags for position-independent code])
300 AC_MSG_RESULT([$PICFLAGS])
302 #######################################################
303 # test whether building a shared library actually works
304 if test $BLDSHARED = true; then
305 AC_CACHE_CHECK([whether building shared libraries actually works],
306 [ac_cv_shlib_works],[
308 # try building a trivial shared library
309 if test "$PICSUFFIX" = "po"; then
310 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
311 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
312 ac_cv_shlib_works=yes
314 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
315 mv shlib.$PICSUFFIX shlib.po &&
316 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
317 ac_cv_shlib_works=yes
319 rm -f shlib.so shlib.po
321 if test $ac_cv_shlib_works = no; then
326 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
327 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
328 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
329 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
330 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
333 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
335 #include <sys/time.h>
337 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
338 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
339 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
340 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
343 AC_CACHE_CHECK([for va_copy],samba_cv_HAVE_VA_COPY,[
344 AC_TRY_LINK([#include <stdarg.h>
345 va_list ap1,ap2;], [va_copy(ap1,ap2);],
346 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
347 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
348 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
351 if test x"$samba_cv_HAVE_VA_COPY" != x"yes"; then
352 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE___VA_COPY,[
353 AC_TRY_LINK([#include <stdarg.h>
354 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
355 samba_cv_HAVE___VA_COPY=yes,samba_cv_HAVE___VA_COPY=no)])
356 if test x"$samba_cv_HAVE___VA_COPY" = x"yes"; then
357 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
361 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
363 #include <sys/types.h>
365 void foo(const char *format, ...) {
369 long long l = 1234567890;
372 va_start(ap, format);
373 len = vsnprintf(buf, 0, format, ap);
375 if (len != 5) exit(1);
377 va_start(ap, format);
378 len = vsnprintf(0, 0, format, ap);
380 if (len != 5) exit(1);
382 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
384 if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(1);
388 main() { foo("hello"); }
390 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
391 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
392 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
395 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
396 AC_TRY_COMPILE([#include <sys/types.h>
398 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
399 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
400 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
401 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
404 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
406 #include <sys/types.h>
409 #define F_GETLEASE 1025
412 int fd = open("/dev/null", O_RDONLY);
413 return fcntl(fd, F_GETLEASE, 0) == -1;
416 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
417 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
418 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
421 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
423 #include <sys/types.h>
427 #define F_NOTIFY 1026
430 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
433 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
434 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
435 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
438 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
440 #include <sys/types.h>
443 #include <sys/file.h>
449 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
452 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
453 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
454 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
460 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
461 AC_TRY_COMPILE([#include <sys/types.h>
463 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
464 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
465 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
466 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
469 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
470 AC_TRY_RUN([#include <sys/types.h>
471 #include <sys/capability.h>
474 if ((cap = cap_get_proc()) == NULL)
476 cap->cap_effective |= CAP_NETWORK_MGT;
477 cap->cap_inheritable |= CAP_NETWORK_MGT;
482 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
483 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
484 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
488 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
489 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncate.c"],
490 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
491 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
492 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
495 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
496 AC_TRY_RUN([#include "${srcdir-.}/build/tests/getgroups.c"],
497 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
498 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
499 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
502 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
503 AC_TRY_RUN([#include <stdlib.h>
504 #include <sys/types.h>
505 #include <sys/stat.h>
509 char tpl[20]="/tmp/test.XXXXXX";
510 int fd = mkstemp(tpl);
511 if (fd == -1) exit(1);
513 if (fstat(fd, &st) != 0) exit(1);
514 if ((st.st_mode & 0777) != 0600) exit(1);
517 samba_cv_HAVE_SECURE_MKSTEMP=yes,
518 samba_cv_HAVE_SECURE_MKSTEMP=no,
519 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
520 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
521 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
524 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
525 AC_TRY_RUN([#include <unistd.h>
526 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
527 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
528 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
529 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
532 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
533 AC_TRY_RUN([#include "${srcdir-.}/build/tests/shared_mmap.c"],
534 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
535 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
536 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
539 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
540 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncroot.c"],
541 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
542 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
543 AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
546 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
547 AC_TRY_COMPILE([#include <sys/types.h>
548 #include <sys/stat.h>
549 #include <unistd.h>],
550 [struct stat st; st.st_blocks = 0;],
551 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
552 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
553 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
556 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
557 AC_TRY_COMPILE([#include <sys/types.h>
558 #include <sys/stat.h>
559 #include <unistd.h>],
560 [struct stat st; st.st_blksize = 0;],
561 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
562 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
563 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
568 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
570 #ifdef HAVE_SYS_VFS_H
573 #ifdef HAVE_SYS_CAPABILITY_H
574 #include <sys/capability.h>
577 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
578 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
579 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
584 AC_SUBST(SMBD_EXTRA_OBJS)
585 AC_SUBST(SMBD_EXTRA_LIBS)
587 ###############################################
588 # test for where we get crypt() from
589 AC_CHECK_LIB_EXT(crypt, CRYPT_LIBS, crypt)
590 SMB_EXT_LIB_ENABLE(CRYPT,YES)
591 SMB_EXT_LIB(CRYPT, $CRYPT_LIBS)
594 ## moved after the check for -lcrypt in order to
595 ## ensure that the necessary libraries are included
596 ## check checking for truncated salt. Wrapped by the
597 ## $with_pam_for_crypt variable as above --jerry
599 if test x"$with_pam_for_crypt" != x"yes"; then
600 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
602 LIBS="$AUTHLIBS $LIBS"
603 AC_TRY_RUN([#include "${srcdir-.}/build/tests/crypttest.c"],
604 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
606 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
607 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
611 #################################################
612 # these tests are taken from the GNU fileutils package
613 AC_CHECKING(how to get filesystem space usage)
616 # Test for statvfs64.
617 if test $space = no; then
619 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
621 #if defined(HAVE_UNISTD_H)
624 #include <sys/types.h>
625 #include <sys/statvfs.h>
628 struct statvfs64 fsd;
629 exit (statvfs64 (".", &fsd));
631 fu_cv_sys_stat_statvfs64=yes,
632 fu_cv_sys_stat_statvfs64=no,
633 fu_cv_sys_stat_statvfs64=cross)])
634 if test $fu_cv_sys_stat_statvfs64 = yes; then
636 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
640 # Perform only the link test since it seems there are no variants of the
641 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
642 # because that got a false positive on SCO OSR5. Adding the declaration
643 # of a `struct statvfs' causes this test to fail (as it should) on such
644 # systems. That system is reported to work fine with STAT_STATFS4 which
645 # is what it gets when this test fails.
646 if test $space = no; then
648 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
649 [AC_TRY_LINK([#include <sys/types.h>
650 #include <sys/statvfs.h>],
651 [struct statvfs fsd; statvfs (0, &fsd);],
652 fu_cv_sys_stat_statvfs=yes,
653 fu_cv_sys_stat_statvfs=no)])
654 if test $fu_cv_sys_stat_statvfs = yes; then
656 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
660 if test $space = no; then
661 # DEC Alpha running OSF/1
662 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
663 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
665 #include <sys/param.h>
666 #include <sys/types.h>
667 #include <sys/mount.h>
672 exit (statfs (".", &fsd, sizeof (struct statfs)));
674 fu_cv_sys_stat_statfs3_osf1=yes,
675 fu_cv_sys_stat_statfs3_osf1=no,
676 fu_cv_sys_stat_statfs3_osf1=no)])
677 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
678 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
680 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
684 if test $space = no; then
686 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
687 member (AIX, 4.3BSD)])
688 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
690 #ifdef HAVE_SYS_PARAM_H
691 #include <sys/param.h>
693 #ifdef HAVE_SYS_MOUNT_H
694 #include <sys/mount.h>
696 #ifdef HAVE_SYS_VFS_H
703 exit (statfs (".", &fsd));
705 fu_cv_sys_stat_statfs2_bsize=yes,
706 fu_cv_sys_stat_statfs2_bsize=no,
707 fu_cv_sys_stat_statfs2_bsize=no)])
708 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
709 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
711 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
715 if test $space = no; then
717 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
718 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
719 [AC_TRY_RUN([#include <sys/types.h>
720 #include <sys/statfs.h>
724 exit (statfs (".", &fsd, sizeof fsd, 0));
726 fu_cv_sys_stat_statfs4=yes,
727 fu_cv_sys_stat_statfs4=no,
728 fu_cv_sys_stat_statfs4=no)])
729 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
730 if test $fu_cv_sys_stat_statfs4 = yes; then
732 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
736 if test $space = no; then
738 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
739 member (4.4BSD and NetBSD)])
740 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
741 [AC_TRY_RUN([#include <sys/types.h>
742 #ifdef HAVE_SYS_PARAM_H
743 #include <sys/param.h>
745 #ifdef HAVE_SYS_MOUNT_H
746 #include <sys/mount.h>
752 exit (statfs (".", &fsd));
754 fu_cv_sys_stat_statfs2_fsize=yes,
755 fu_cv_sys_stat_statfs2_fsize=no,
756 fu_cv_sys_stat_statfs2_fsize=no)])
757 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
758 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
760 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
764 if test $space = no; then
766 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
767 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
768 [AC_TRY_RUN([#include <sys/types.h>
769 #ifdef HAVE_SYS_PARAM_H
770 #include <sys/param.h>
772 #ifdef HAVE_SYS_MOUNT_H
773 #include <sys/mount.h>
775 #ifdef HAVE_SYS_FS_TYPES_H
776 #include <sys/fs_types.h>
781 /* Ultrix's statfs returns 1 for success,
782 0 for not mounted, -1 for failure. */
783 exit (statfs (".", &fsd) != 1);
785 fu_cv_sys_stat_fs_data=yes,
786 fu_cv_sys_stat_fs_data=no,
787 fu_cv_sys_stat_fs_data=no)])
788 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
789 if test $fu_cv_sys_stat_fs_data = yes; then
791 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
797 #######################################
798 # Check for comparison_fn_t
799 AC_CACHE_CHECK([for comparison_fn_t],samba_cv_HAVE_COMPARISON_FN_T,[
802 int list_find(const void *needle,
803 const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn)
808 samba_cv_HAVE_COMPARISON_FN_T=yes,samba_cv_HAVE_COMPARISON_FN_T=no)
810 if test x"$samba_cv_HAVE_COMPARISON_FN_T" = x"yes"; then
811 AC_DEFINE(HAVE_COMPARISON_FN_T,1,[Whether or not we have comparison_fn_t])