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])
13 # The definition of _GNU_SOURCE potentially causes a change of the value
14 # of _XOPEN_SOURCE. So define it only conditionally.
15 AH_VERBATIM([_XOPEN_SOURCE],
16 [/* Define on UNIX to activate XPG/5 features. */
17 #if !defined(_XOPEN_SOURCE)
18 # define _XOPEN_SOURCE 500
24 # Config CPPFLAG settings for strange OS's that must be set
28 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
31 # mmap on HPUX is completely broken...
32 AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
33 if test $ac_cv_prog_cc_Ae = yes; then
34 CPPFLAGS="$CPPFLAGS -Ae"
38 # VOS may need to have POSIX support and System V compatibility enabled.
45 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
46 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
50 *-D_SYSV*|*-D_SVID_SOURCE*)
53 CPPFLAGS="$CPPFLAGS -D_SYSV"
54 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
64 AC_CHECK_HEADERS(arpa/inet.h sys/select.h fcntl.h sys/fcntl.h sys/time.h)
65 AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h memory.h net/if.h)
66 AC_CHECK_HEADERS(compat.h)
67 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
68 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
69 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
70 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
71 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
72 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
73 AC_CHECK_HEADERS(stdint.h locale.h)
74 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
75 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
76 AC_CHECK_HEADERS(stropts.h)
77 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
78 AC_CHECK_HEADERS(sys/acl.h)
89 AC_CHECK_TYPE(ino_t,unsigned)
90 AC_CHECK_TYPE(loff_t,off_t)
91 AC_CHECK_TYPE(offset_t,loff_t)
92 AC_CHECK_TYPE(ssize_t, int)
93 AC_CHECK_TYPES(intptr_t)
96 ############################################
97 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
98 AC_SEARCH_LIBS(dlopen, [dl], [
99 tmp=$ac_cv_search_dlopen
100 if test "$ac_cv_search_dlopen" = "none required"; then
103 SMB_EXT_LIB(DL, [$tmp])]
105 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
107 ############################################
108 # check for unix domain sockets
109 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
111 #include <sys/types.h>
114 #include <sys/socket.h>
115 #include <sys/un.h>],
117 struct sockaddr_un sunaddr;
118 sunaddr.sun_family = AF_UNIX;
120 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
121 if test x"$samba_cv_unixsocket" = x"yes"; then
122 AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
126 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
128 #include <sys/types.h>
133 #include <sys/socket.h>],[socklen_t i = 0],
134 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
135 if test x"$samba_cv_socklen_t" = x"yes"; then
136 AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
139 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
141 #include <sys/types.h>
146 #include <signal.h>],[sig_atomic_t i = 0],
147 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
148 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
149 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
152 # stupid headers have the functions but no declaration. grrrr.
153 AC_HAVE_DECL(errno, [#include <errno.h>])
154 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
155 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
156 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
157 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
158 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
159 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
163 # The following test taken from the cvs sources
164 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
165 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
166 # libsocket.so which has a bad implementation of gethostbyname (it
167 # only looks in /etc/hosts), so we only look for -lsocket if we need
169 AC_CHECK_FUNCS(connect)
170 if test x"$ac_cv_func_connect" = x"no"; then
173 *) AC_CHECK_LIB(nsl_s, printf) ;;
177 *) AC_CHECK_LIB(nsl, printf) ;;
181 *) AC_CHECK_LIB(socket, connect) ;;
185 *) AC_CHECK_LIB(inet, connect) ;;
187 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
189 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
190 test x"$ac_cv_lib_inet_connect" = x"yes"; then
191 # ac_cv_func_connect=yes
192 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
193 AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
197 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strtoull strtouq strerror chown fchown chmod fchmod chroot link mknod mknod64)
198 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
199 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
200 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
201 AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf realpath)
202 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate)
203 AC_CHECK_FUNCS(setluid getpwanam setlinebuf)
204 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
205 AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm backtrace)
206 AC_CHECK_FUNCS(setbuffer)
208 AC_CHECK_FUNCS(getdents)
209 AC_CHECK_FUNCS(pread pwrite)
211 # needed for lib/charcnv.c
212 AC_CHECK_FUNCS(setlocale)
214 #####################################
215 # we might need the resolv library on some systems
216 AC_CHECK_LIB(resolv, dn_expand)
218 # Assume non-shared by default and override below
221 # these are the defaults, good for lots of systems
231 AC_MSG_CHECKING([ability to build shared libraries])
233 # and these are for particular systems
235 *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
238 DYNEXP="-Wl,--export-dynamic"
240 SONAMEFLAG="-Wl,-soname="
241 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
243 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
247 if test "${GCC}" = "yes"; then
249 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
254 ## ${CFLAGS} added for building 64-bit shared
255 ## libs using Sun's Compiler
256 LDSHFLAGS="-G \${CFLAGS}"
260 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
262 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
266 PICFLAG="-KPIC" # Is this correct for SunOS
267 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
269 *netbsd* | *freebsd*) BLDSHARED="true"
271 DYNEXP="-Wl,--export-dynamic"
272 SONAMEFLAG="-Wl,-soname,"
273 PICFLAG="-fPIC -DPIC"
274 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
276 *openbsd*) BLDSHARED="true"
278 DYNEXP="-Wl,-Bdynamic"
279 SONAMEFLAG="-Wl,-soname,"
281 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
283 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
285 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
288 ATTEMPT_WRAP32_BUILD=yes
290 LDSHFLAGS="-set_version sgi1.0 -shared"
291 SONAMEFLAG="-soname "
293 if test "${GCC}" = "yes"; then
298 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
300 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
302 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
303 DYNEXP="-Wl,-brtl,-bexpall"
305 if test "${GCC}" != "yes"; then
306 ## for funky AIX compiler using strncpy()
307 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
310 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
312 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
314 # Use special PIC flags for the native HP-UX compiler.
315 if test $ac_cv_prog_cc_Ae = yes; then
318 LDSHFLAGS="-B symbolic -b -z"
323 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
325 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
326 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
328 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
331 SONAMEFLAG="-Wl,-soname,"
333 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
335 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
336 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
338 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
341 SONAMEFLAG="-Wl,-soname,"
343 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
345 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
346 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
348 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
349 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
351 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
353 *-univel-*) if [ test "$GCC" != yes ]; then
354 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
359 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
361 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
364 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
365 if [ test "$GCC" != yes ]; then
366 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
369 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
371 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
376 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
379 AC_MSG_RESULT($BLDSHARED)
380 AC_MSG_CHECKING([linker flags for shared libraries])
381 AC_MSG_RESULT([$LDSHFLAGS])
382 AC_MSG_CHECKING([compiler flags for position-independent code])
383 AC_MSG_RESULT([$PICFLAGS])
385 #######################################################
386 # test whether building a shared library actually works
387 if test $BLDSHARED = true; then
388 AC_CACHE_CHECK([whether building shared libraries actually works],
389 [ac_cv_shlib_works],[
391 # try building a trivial shared library
392 if test "$PICSUFFIX" = "po"; then
393 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
394 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
395 ac_cv_shlib_works=yes
397 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
398 mv shlib.$PICSUFFIX shlib.po &&
399 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
400 ac_cv_shlib_works=yes
402 rm -f shlib.so shlib.po
404 if test $ac_cv_shlib_works = no; then
409 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
410 AC_TRY_COMPILE([#include <sys/types.h>
411 #include <sys/socket.h>
412 #include <netinet/in.h>],
413 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
414 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
415 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
416 AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
419 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
420 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
421 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
422 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
423 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
426 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
428 #include <sys/time.h>
430 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
431 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
432 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
433 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
436 AC_CACHE_CHECK([for va_copy],samba_cv_HAVE_VA_COPY,[
437 AC_TRY_LINK([#include <stdarg.h>
438 va_list ap1,ap2;], [va_copy(ap1,ap2);],
439 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
440 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
441 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
444 if test x"$samba_cv_HAVE_VA_COPY" != x"yes"; then
445 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE___VA_COPY,[
446 AC_TRY_LINK([#include <stdarg.h>
447 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
448 samba_cv_HAVE___VA_COPY=yes,samba_cv_HAVE___VA_COPY=no)])
449 if test x"$samba_cv_HAVE___VA_COPY" = x"yes"; then
450 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
454 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
456 #include <sys/types.h>
458 void foo(const char *format, ...) {
463 va_start(ap, format);
464 len = vsnprintf(buf, 0, format, ap);
466 if (len != 5) exit(1);
468 va_start(ap, format);
469 len = vsnprintf(0, 0, format, ap);
471 if (len != 5) exit(1);
473 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
477 main() { foo("hello"); }
479 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
480 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
481 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
484 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
485 AC_TRY_COMPILE([#include <sys/types.h>
487 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
488 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
489 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
490 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
493 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
495 #include <sys/types.h>
498 #define F_GETLEASE 1025
501 int fd = open("/dev/null", O_RDONLY);
502 return fcntl(fd, F_GETLEASE, 0) == -1;
505 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
506 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
507 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
510 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
512 #include <sys/types.h>
516 #define F_NOTIFY 1026
519 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
522 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
523 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
524 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
527 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
529 #include <sys/types.h>
532 #include <sys/file.h>
538 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
541 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
542 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
543 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
549 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
550 AC_TRY_COMPILE([#include <sys/types.h>
552 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
553 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
554 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
555 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
558 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
559 AC_TRY_RUN([#include <sys/types.h>
560 #include <sys/capability.h>
563 if ((cap = cap_get_proc()) == NULL)
565 cap->cap_effective |= CAP_NETWORK_MGT;
566 cap->cap_inheritable |= CAP_NETWORK_MGT;
571 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
572 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
573 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
577 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
578 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncate.c"],
579 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
580 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
581 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
584 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
585 AC_TRY_RUN([#include "${srcdir-.}/build/tests/unixsock.c"],
586 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
587 samba_cv_HAVE_WORKING_AF_LOCAL=no,
588 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
589 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
591 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
594 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
595 AC_TRY_RUN([#include "${srcdir-.}/build/tests/getgroups.c"],
596 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
597 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
598 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
601 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
602 SAVE_CPPFLAGS="$CPPFLAGS"
603 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper"
605 #define REPLACE_GETPASS 1
606 #define NO_CONFIG_H 1
607 #define main dont_declare_main
608 #include "${srcdir-.}/lib/getsmbpass.c"
610 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
611 CPPFLAGS="$SAVE_CPPFLAGS"
613 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
614 AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
617 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
620 #include <sys/types.h>
621 #include <netinet/in.h>
622 #ifdef HAVE_ARPA_INET_H
623 #include <arpa/inet.h>
625 main() { struct in_addr ip; ip.s_addr = 0x12345678;
626 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
627 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
629 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
630 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
631 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
634 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
635 AC_TRY_RUN([#include <stdlib.h>
636 #include <sys/types.h>
637 #include <sys/stat.h>
641 char tpl[20]="/tmp/test.XXXXXX";
642 int fd = mkstemp(tpl);
643 if (fd == -1) exit(1);
645 if (fstat(fd, &st) != 0) exit(1);
646 if ((st.st_mode & 0777) != 0600) exit(1);
649 samba_cv_HAVE_SECURE_MKSTEMP=yes,
650 samba_cv_HAVE_SECURE_MKSTEMP=no,
651 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
652 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
653 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
656 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
657 AC_TRY_RUN([#include <unistd.h>
658 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
659 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
660 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
661 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
665 # look for a method of finding the list of network interfaces
667 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
669 #define HAVE_IFACE_AIX 1
670 #define AUTOCONF_TEST 1
671 #include "confdefs.h"
672 #include "${srcdir-.}/lib/netif/netif.h"
673 #include "${srcdir-.}/lib/netif/netif.c"],
674 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
675 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
676 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
679 if test $iface = no; then
680 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
682 #define HAVE_IFACE_IFCONF 1
683 #define AUTOCONF_TEST 1
684 #include "confdefs.h"
685 #include "${srcdir-.}/lib/netif/netif.h"
686 #include "${srcdir-.}/lib/netif/netif.c"],
687 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
688 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
689 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
693 if test $iface = no; then
694 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
696 #define HAVE_IFACE_IFREQ 1
697 #define AUTOCONF_TEST 1
698 #include "confdefs.h"
699 #include "${srcdir-.}/lib/netif/netif.h"
700 #include "${srcdir-.}/lib/netif/netif.c"],
701 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
702 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
703 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
707 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
708 AC_TRY_RUN([#include "${srcdir-.}/build/tests/shared_mmap.c"],
709 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
710 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
711 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
714 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
715 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncroot.c"],
716 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
717 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
718 AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
721 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
722 AC_TRY_COMPILE([#include <sys/types.h>
723 #include <sys/stat.h>
724 #include <unistd.h>],
725 [struct stat st; st.st_blocks = 0;],
726 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
727 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
728 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
731 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
732 AC_TRY_COMPILE([#include <sys/types.h>
733 #include <sys/stat.h>
734 #include <unistd.h>],
735 [struct stat st; st.st_blksize = 0;],
736 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
737 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
738 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
743 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
745 #ifdef HAVE_SYS_VFS_H
748 #ifdef HAVE_SYS_CAPABILITY_H
749 #include <sys/capability.h>
752 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
753 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
754 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
759 AC_SUBST(SMBD_EXTRA_OBJS)
760 AC_SUBST(SMBD_EXTRA_LIBS)
762 SMB_INCLUDE_M4(libads/config.m4)
764 ###############################################
765 # test for where we get crypt() from
766 AC_SEARCH_LIBS(crypt, [crypt],
767 [test "$ac_cv_search_crypt" = "none required" || AUTHLIBS="-lcrypt $AUTHLIBS"
768 AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
771 ## moved after the check for -lcrypt in order to
772 ## ensure that the necessary libraries are included
773 ## check checking for truncated salt. Wrapped by the
774 ## $with_pam_for_crypt variable as above --jerry
776 if test x"$with_pam_for_crypt" != x"yes"; then
777 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
779 LIBS="$AUTHLIBS $LIBS"
780 AC_TRY_RUN([#include "${srcdir-.}/build/tests/crypttest.c"],
781 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
783 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
784 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
788 #################################################
789 # these tests are taken from the GNU fileutils package
790 AC_CHECKING(how to get filesystem space usage)
793 # Test for statvfs64.
794 if test $space = no; then
796 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
798 #if defined(HAVE_UNISTD_H)
801 #include <sys/types.h>
802 #include <sys/statvfs.h>
805 struct statvfs64 fsd;
806 exit (statvfs64 (".", &fsd));
808 fu_cv_sys_stat_statvfs64=yes,
809 fu_cv_sys_stat_statvfs64=no,
810 fu_cv_sys_stat_statvfs64=cross)])
811 if test $fu_cv_sys_stat_statvfs64 = yes; then
813 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
817 # Perform only the link test since it seems there are no variants of the
818 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
819 # because that got a false positive on SCO OSR5. Adding the declaration
820 # of a `struct statvfs' causes this test to fail (as it should) on such
821 # systems. That system is reported to work fine with STAT_STATFS4 which
822 # is what it gets when this test fails.
823 if test $space = no; then
825 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
826 [AC_TRY_LINK([#include <sys/types.h>
827 #include <sys/statvfs.h>],
828 [struct statvfs fsd; statvfs (0, &fsd);],
829 fu_cv_sys_stat_statvfs=yes,
830 fu_cv_sys_stat_statvfs=no)])
831 if test $fu_cv_sys_stat_statvfs = yes; then
833 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
837 if test $space = no; then
838 # DEC Alpha running OSF/1
839 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
840 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
842 #include <sys/param.h>
843 #include <sys/types.h>
844 #include <sys/mount.h>
849 exit (statfs (".", &fsd, sizeof (struct statfs)));
851 fu_cv_sys_stat_statfs3_osf1=yes,
852 fu_cv_sys_stat_statfs3_osf1=no,
853 fu_cv_sys_stat_statfs3_osf1=no)])
854 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
855 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
857 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
861 if test $space = no; then
863 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
864 member (AIX, 4.3BSD)])
865 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
867 #ifdef HAVE_SYS_PARAM_H
868 #include <sys/param.h>
870 #ifdef HAVE_SYS_MOUNT_H
871 #include <sys/mount.h>
873 #ifdef HAVE_SYS_VFS_H
880 exit (statfs (".", &fsd));
882 fu_cv_sys_stat_statfs2_bsize=yes,
883 fu_cv_sys_stat_statfs2_bsize=no,
884 fu_cv_sys_stat_statfs2_bsize=no)])
885 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
886 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
888 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
892 if test $space = no; then
894 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
895 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
896 [AC_TRY_RUN([#include <sys/types.h>
897 #include <sys/statfs.h>
901 exit (statfs (".", &fsd, sizeof fsd, 0));
903 fu_cv_sys_stat_statfs4=yes,
904 fu_cv_sys_stat_statfs4=no,
905 fu_cv_sys_stat_statfs4=no)])
906 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
907 if test $fu_cv_sys_stat_statfs4 = yes; then
909 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
913 if test $space = no; then
915 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
916 member (4.4BSD and NetBSD)])
917 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
918 [AC_TRY_RUN([#include <sys/types.h>
919 #ifdef HAVE_SYS_PARAM_H
920 #include <sys/param.h>
922 #ifdef HAVE_SYS_MOUNT_H
923 #include <sys/mount.h>
929 exit (statfs (".", &fsd));
931 fu_cv_sys_stat_statfs2_fsize=yes,
932 fu_cv_sys_stat_statfs2_fsize=no,
933 fu_cv_sys_stat_statfs2_fsize=no)])
934 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
935 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
937 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
941 if test $space = no; then
943 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
944 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
945 [AC_TRY_RUN([#include <sys/types.h>
946 #ifdef HAVE_SYS_PARAM_H
947 #include <sys/param.h>
949 #ifdef HAVE_SYS_MOUNT_H
950 #include <sys/mount.h>
952 #ifdef HAVE_SYS_FS_TYPES_H
953 #include <sys/fs_types.h>
958 /* Ultrix's statfs returns 1 for success,
959 0 for not mounted, -1 for failure. */
960 exit (statfs (".", &fsd) != 1);
962 fu_cv_sys_stat_fs_data=yes,
963 fu_cv_sys_stat_fs_data=no,
964 fu_cv_sys_stat_fs_data=no)])
965 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
966 if test $fu_cv_sys_stat_fs_data = yes; then
968 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
974 #######################################
975 # Check for comparison_fn_t
976 AC_CACHE_CHECK([for comparison_fn_t],samba_cv_HAVE_COMPARISON_FN_T,[
979 int list_find(const void *needle,
980 const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn)
985 samba_cv_HAVE_COMPARISON_FN_T=yes,samba_cv_HAVE_COMPARISON_FN_T=no)
987 if test x"$samba_cv_HAVE_COMPARISON_FN_T" = x"yes"; then
988 AC_DEFINE(HAVE_COMPARISON_FN_T,1,[Whether or not we have comparison_fn_t])