1 dnl Checks for programs.
2 dnl Unique-to-Samba variables we'll be playing with.
11 # Config CPPFLAG settings for strange OS's that must be set
15 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
19 # mmap on HPUX is completely broken...
20 AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
21 if test $ac_cv_prog_cc_Ae = yes; then
22 CPPFLAGS="$CPPFLAGS -Ae"
25 # Defines needed for HPUX support.
26 # HPUX has bigcrypt but (sometimes?) doesn't use it for
27 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
31 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL"
32 AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
33 AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
34 AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
35 AC_DEFINE(_ALIGNMENT_REQUIRED,1,[Required alignment])
36 AC_DEFINE(_MAX_ALIGNMENT,4,[Maximum alignment])
39 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4 -DMAX_POSITIVE_LOCK_OFFSET=0x1ffffffffffLL"
40 AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
41 AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
42 AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
43 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to use large file support])
44 AC_DEFINE(_ALIGNMENT_REQUIRED, 1, [Required alignment])
45 AC_DEFINE(_MAX_ALIGNMENT, 4, [Maximum alignment])
52 # CRAY Unicos has broken const handling
54 AC_MSG_RESULT([disabling const])
55 CPPFLAGS="$CPPFLAGS -Dconst="
59 # AIX4.x doesn't even admit to having large
60 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
63 AC_MSG_RESULT([enabling large file support])
64 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
65 AC_DEFINE(_LARGE_FILES, 1, [Whether to enable large file support])
68 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
69 # to the existance of large files..
70 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
71 # recommendations on large file support, however it makes the
72 # compile work using gcc 2.7 and 2.8, whereas using the Sun
73 # recommendation makes the compile fail on gcc2.7. JRA.
77 5.0*|5.1*|5.2*|5.3*|5.5*)
78 AC_MSG_RESULT([no large file support])
81 AC_MSG_RESULT([enabling large file support])
82 if test "$ac_cv_prog_gcc" = yes; then
83 ${CC-cc} -v >conftest.c 2>&1
84 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
86 case "$ac_cv_gcc_compiler_version_number" in
87 *"gcc version 2.6"*|*"gcc version 2.7"*)
88 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
89 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
92 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
93 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
94 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
98 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
99 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
100 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
106 # VOS may need to have POSIX support and System V compatibility enabled.
113 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
114 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
118 *-D_SYSV*|*-D_SVID_SOURCE*)
121 CPPFLAGS="$CPPFLAGS -D_SYSV"
122 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
126 # Tests needed for SINIX large file support.
129 if test $host = mips-sni-sysv4 ; then
130 AC_MSG_CHECKING([for LFS support])
131 old_CPPFLAGS="$CPPFLAGS"
132 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
136 #if _LFS64_LARGEFILE == 1
141 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
142 CPPFLAGS="$old_CPPFLAGS"
143 if test x$SINIX_LFS_SUPPORT = xyes ; then
144 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
145 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
146 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
147 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
148 LIBS="`getconf LFS64_LIBS` $LIBS"
150 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
154 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
157 AC_MSG_CHECKING([for LFS support])
158 old_CPPFLAGS="$CPPFLAGS"
159 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
162 #include <sys/utsname.h>
166 #if _LFS64_LARGEFILE == 1
171 /* Ensure this is glibc 2.2 or higher */
172 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
173 int libc_major = __GLIBC__;
174 int libc_minor = __GLIBC_MINOR__;
182 /* Ensure this is kernel 2.4 or higher */
185 release = uts.release;
186 major = atoi(strsep(&release, "."));
187 minor = atoi(strsep(&release, "."));
189 if (major > 2 || (major == 2 && minor > 3))
196 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
197 CPPFLAGS="$old_CPPFLAGS"
198 if test x$LINUX_LFS_SUPPORT = xyes ; then
199 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
200 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
201 AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
202 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
204 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
208 AC_MSG_CHECKING([for LFS support])
209 old_CPPFLAGS="$CPPFLAGS"
210 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
214 #if _LFS64_LARGEFILE == 1
219 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
220 CPPFLAGS="$old_CPPFLAGS"
221 if test x$GLIBC_LFS_SUPPORT = xyes ; then
222 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
223 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
224 AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
226 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
235 AC_CHECK_HEADERS(arpa/inet.h sys/select.h fcntl.h sys/fcntl.h sys/time.h)
236 AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h memory.h net/if.h)
237 AC_CHECK_HEADERS(compat.h)
238 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
239 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
240 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
241 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
242 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
243 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
246 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
247 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
251 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
252 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
253 if test x"$ac_cv_header_shadow_h" = x"yes"; then
254 AC_DEFINE(HAVE_SHADOW_H,1,[Whether we have shadow.h])
259 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
260 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
261 AC_CHECK_HEADERS(stropts.h)
262 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
263 AC_CHECK_HEADERS(sys/acl.h)
274 AC_CHECK_TYPE(ino_t,unsigned)
275 AC_CHECK_TYPE(loff_t,off_t)
276 AC_CHECK_TYPE(offset_t,loff_t)
277 AC_CHECK_TYPE(ssize_t, int)
280 ############################################
281 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
282 AC_SEARCH_LIBS(dlopen, [dl])
283 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
285 ############################################
286 # check for unix domain sockets
287 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
289 #include <sys/types.h>
292 #include <sys/socket.h>
293 #include <sys/un.h>],
295 struct sockaddr_un sunaddr;
296 sunaddr.sun_family = AF_UNIX;
298 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
299 if test x"$samba_cv_unixsocket" = x"yes"; then
300 AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
304 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
306 #include <sys/types.h>
311 #include <sys/socket.h>],[socklen_t i = 0],
312 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
313 if test x"$samba_cv_socklen_t" = x"yes"; then
314 AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
317 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
319 #include <sys/types.h>
324 #include <signal.h>],[sig_atomic_t i = 0],
325 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
326 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
327 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
330 # stupid headers have the functions but no declaration. grrrr.
331 AC_HAVE_DECL(errno, [#include <errno.h>])
332 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
333 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
334 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
335 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
336 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
337 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
339 # and glibc has setresuid under linux but the function does
340 # nothing until kernel 2.1.44! very dumb.
341 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
342 AC_TRY_RUN([#include <errno.h>
343 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
344 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
345 if test x"$samba_cv_have_setresuid" = x"yes"; then
346 AC_DEFINE(HAVE_SETRESUID,1,[Whether the system has setresuid])
349 # Do the same check for setresguid...
351 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
352 AC_TRY_RUN([#include <unistd.h>
354 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
355 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
356 if test x"$samba_cv_have_setresgid" = x"yes"; then
357 AC_DEFINE(HAVE_SETRESGID,1,[Whether the system has setresgid])
362 # The following test taken from the cvs sources
363 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
364 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
365 # libsocket.so which has a bad implementation of gethostbyname (it
366 # only looks in /etc/hosts), so we only look for -lsocket if we need
368 AC_CHECK_FUNCS(connect)
369 if test x"$ac_cv_func_connect" = x"no"; then
372 *) AC_CHECK_LIB(nsl_s, printf) ;;
376 *) AC_CHECK_LIB(nsl, printf) ;;
380 *) AC_CHECK_LIB(socket, connect) ;;
384 *) AC_CHECK_LIB(inet, connect) ;;
386 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
388 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
389 test x"$ac_cv_lib_inet_connect" = x"yes"; then
390 # ac_cv_func_connect=yes
391 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
392 AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
396 ###############################################
397 # test for where we get yp_get_default_domain() from
398 AC_SEARCH_LIBS(yp_get_default_domain, [nsl])
399 AC_CHECK_FUNCS(yp_get_default_domain)
401 # Check if we have execl, if not we need to compile smbrun.
402 AC_CHECK_FUNCS(execl)
403 if test x"$ac_cv_func_execl" = x"no"; then
404 EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbrun\$(EXEEXT)"
407 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strtoull strtouq strerror chown fchown chmod fchmod chroot link mknod mknod64)
408 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
409 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
410 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
411 AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf realpath)
412 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
413 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
414 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
415 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
416 AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm backtrace)
417 # setbuffer, shmget, shm_open are needed for smbtorture
418 AC_CHECK_FUNCS(setbuffer shmget shm_open)
420 # syscall() is needed for smbwrapper.
421 AC_CHECK_FUNCS(syscall)
423 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
424 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
425 AC_CHECK_FUNCS(__getcwd _getcwd)
426 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
427 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
428 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
429 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
430 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
431 AC_CHECK_FUNCS(getdirentries _write __write _fork __fork)
432 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
433 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
434 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
435 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
436 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
439 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
442 if test x$ac_cv_func_stat64 = xno ; then
443 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
445 #if defined(HAVE_UNISTD_H)
448 #include <sys/stat.h>
449 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
450 AC_MSG_RESULT([$ac_cv_func_stat64])
451 if test x$ac_cv_func_stat64 = xyes ; then
452 AC_DEFINE(HAVE_STAT64,1,[Whether stat64() is available])
456 if test x$ac_cv_func_lstat64 = xno ; then
457 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
459 #if defined(HAVE_UNISTD_H)
462 #include <sys/stat.h>
463 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
464 AC_MSG_RESULT([$ac_cv_func_lstat64])
465 if test x$ac_cv_func_lstat64 = xyes ; then
466 AC_DEFINE(HAVE_LSTAT64,[Whether lstat64() is available])
470 if test x$ac_cv_func_fstat64 = xno ; then
471 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
473 #if defined(HAVE_UNISTD_H)
476 #include <sys/stat.h>
477 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
478 AC_MSG_RESULT([$ac_cv_func_fstat64])
479 if test x$ac_cv_func_fstat64 = xyes ; then
480 AC_DEFINE(HAVE_FSTAT64,1,[Whether fstat64() is available])
484 #####################################
485 # we might need the resolv library on some systems
486 AC_CHECK_LIB(resolv, dn_expand)
489 # Check for the functions putprpwnam, set_auth_parameters,
490 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
491 # Needed for OSF1 and HPUX.
494 AC_LIBTESTFUNC(security, putprpwnam)
495 AC_LIBTESTFUNC(sec, putprpwnam)
497 AC_LIBTESTFUNC(security, set_auth_parameters)
498 AC_LIBTESTFUNC(sec, set_auth_parameters)
500 # UnixWare 7.x has its getspnam in -lgen
501 AC_LIBTESTFUNC(gen, getspnam)
503 AC_LIBTESTFUNC(security, getspnam)
504 AC_LIBTESTFUNC(sec, getspnam)
506 AC_LIBTESTFUNC(security, bigcrypt)
507 AC_LIBTESTFUNC(sec, bigcrypt)
509 AC_LIBTESTFUNC(security, getprpwnam)
510 AC_LIBTESTFUNC(sec, getprpwnam)
512 # Assume non-shared by default and override below
515 # these are the defaults, good for lots of systems
525 AC_MSG_CHECKING([ability to build shared libraries])
527 # and these are for particular systems
529 *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
532 DYNEXP="-Wl,--export-dynamic"
534 SONAMEFLAG="-Wl,-soname="
535 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
537 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
541 if test "${GCC}" = "yes"; then
543 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
548 ## ${CFLAGS} added for building 64-bit shared
549 ## libs using Sun's Compiler
550 LDSHFLAGS="-G \${CFLAGS}"
554 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
556 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
560 PICFLAG="-KPIC" # Is this correct for SunOS
561 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
563 *netbsd* | *freebsd*) BLDSHARED="true"
565 DYNEXP="-Wl,--export-dynamic"
566 SONAMEFLAG="-Wl,-soname,"
567 PICFLAG="-fPIC -DPIC"
568 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
570 *openbsd*) BLDSHARED="true"
572 DYNEXP="-Wl,-Bdynamic"
573 SONAMEFLAG="-Wl,-soname,"
575 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
577 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
579 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
582 ATTEMPT_WRAP32_BUILD=yes
584 LDSHFLAGS="-set_version sgi1.0 -shared"
585 SONAMEFLAG="-soname "
587 if test "${GCC}" = "yes"; then
592 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
594 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
596 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
597 DYNEXP="-Wl,-brtl,-bexpall"
599 if test "${GCC}" != "yes"; then
600 ## for funky AIX compiler using strncpy()
601 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
604 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
606 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
608 # Use special PIC flags for the native HP-UX compiler.
609 if test $ac_cv_prog_cc_Ae = yes; then
612 LDSHFLAGS="-B symbolic -b -z"
617 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
619 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
620 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
622 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
625 SONAMEFLAG="-Wl,-soname,"
627 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
629 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
630 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
632 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
635 SONAMEFLAG="-Wl,-soname,"
637 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
639 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
640 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
642 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
643 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
645 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
647 *-univel-*) if [ test "$GCC" != yes ]; then
648 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
653 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
655 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
658 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
659 if [ test "$GCC" != yes ]; then
660 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
663 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
665 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
670 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
673 AC_MSG_RESULT($BLDSHARED)
674 AC_MSG_CHECKING([linker flags for shared libraries])
675 AC_MSG_RESULT([$LDSHFLAGS])
676 AC_MSG_CHECKING([compiler flags for position-independent code])
677 AC_MSG_RESULT([$PICFLAGS])
679 #######################################################
680 # test whether building a shared library actually works
681 if test $BLDSHARED = true; then
682 AC_CACHE_CHECK([whether building shared libraries actually works],
683 [ac_cv_shlib_works],[
685 # try building a trivial shared library
686 if test "$PICSUFFIX" = "po"; then
687 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
688 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
689 ac_cv_shlib_works=yes
691 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
692 mv shlib.$PICSUFFIX shlib.po &&
693 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
694 ac_cv_shlib_works=yes
696 rm -f shlib.so shlib.po
698 if test $ac_cv_shlib_works = no; then
703 SMB_INFO_BUILD_ENV="$SMB_INFO_BUILD_ENV
704 #############################################
705 # Start Tell the Linker to export all symbols
706 @{\$SMB_BUILD_CTX->{BUILD_ENV}{LD}{DYNEXP}} = str2array(\"$DYNEXP\");
707 # End Tell the Linker to export all symbols
708 #############################################
712 # Check if the compiler supports the LL prefix on long long integers.
715 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
716 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
717 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
718 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
719 AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Whether the compiler supports the LL prefix on long long integers])
723 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
724 AC_TRY_RUN([#include <stdio.h>
725 #include <sys/stat.h>
726 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
727 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
728 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
729 AC_DEFINE(SIZEOF_OFF_T,8,[The size of the 'off_t' type])
732 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
734 #if defined(HAVE_UNISTD_H)
738 #include <sys/stat.h>
739 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
740 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
741 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
742 AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
745 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
746 AC_TRY_RUN([#include <stdio.h>
747 #include <sys/stat.h>
748 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
749 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
750 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
751 AC_DEFINE(SIZEOF_INO_T,8,[The size of the 'ino_t' type])
754 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
756 #if defined(HAVE_UNISTD_H)
760 #include <sys/stat.h>
761 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
762 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
763 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
764 AC_DEFINE(HAVE_INO64_T,1,[Whether the 'ino64_t' type is available])
767 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
769 #if defined(HAVE_UNISTD_H)
773 #include <sys/stat.h>
774 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
775 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
776 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
777 AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available])
780 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
782 #if defined(HAVE_UNISTD_H)
785 #include <sys/types.h>
786 #include <dirent.h>],
787 [struct dirent64 de;],
788 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
789 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
790 AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Whether the 'dirent64' struct is available])
793 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
795 #if defined(HAVE_UNISTD_H)
798 #include <sys/types.h>
799 main() { dev_t dev; int i = major(dev); return 0; }],
800 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
801 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
802 AC_DEFINE(HAVE_DEVICE_MAJOR_FN,1,[Whether the major macro for dev_t is available])
805 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
807 #if defined(HAVE_UNISTD_H)
810 #include <sys/types.h>
811 main() { dev_t dev; int i = minor(dev); return 0; }],
812 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
813 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
814 AC_DEFINE(HAVE_DEVICE_MINOR_FN,1,[Whether the minor macro for dev_t is available])
817 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
818 AC_TRY_RUN([#include <stdio.h>
819 main() { char c; c=250; exit((c > 0)?0:1); }],
820 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
821 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
822 AC_DEFINE(HAVE_UNSIGNED_CHAR,1,[Whether the 'unsigned char' type is available])
825 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
826 AC_TRY_COMPILE([#include <sys/types.h>
827 #include <sys/socket.h>
828 #include <netinet/in.h>],
829 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
830 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
831 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
832 AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
835 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
836 AC_TRY_COMPILE([#include <sys/types.h>
838 void seekdir(DIR *d, long loc) { return; }],[return 0;],
839 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
840 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
841 AC_DEFINE(SEEKDIR_RETURNS_VOID,1,[Whether seekdir returns void])
844 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
845 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
846 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
847 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
848 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
851 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
853 #include <sys/time.h>
855 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
856 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
857 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
858 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
861 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE_VA_COPY,[
862 AC_TRY_LINK([#include <stdarg.h>
863 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
864 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
865 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
866 AC_DEFINE(HAVE_VA_COPY,1,[Whether __va_copy() is available])
869 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
871 #include <sys/types.h>
873 void foo(const char *format, ...) {
878 va_start(ap, format);
879 len = vsnprintf(buf, 0, format, ap);
881 if (len != 5) exit(1);
883 va_start(ap, format);
884 len = vsnprintf(0, 0, format, ap);
886 if (len != 5) exit(1);
888 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
892 main() { foo("hello"); }
894 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
895 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
896 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
899 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
900 AC_TRY_RUN([#include <sys/types.h>
902 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
903 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
904 di->d_name[0] == 0) exit(0); exit(1);} ],
905 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
906 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
907 AC_DEFINE(HAVE_BROKEN_READDIR,1,[Whether readdir() is broken])
910 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
911 AC_TRY_COMPILE([#include <sys/types.h>
913 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
914 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
915 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
916 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
919 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
921 #include <sys/types.h>
924 #define F_GETLEASE 1025
927 int fd = open("/dev/null", O_RDONLY);
928 return fcntl(fd, F_GETLEASE, 0) == -1;
931 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
932 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
933 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
936 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
938 #include <sys/types.h>
942 #define F_NOTIFY 1026
945 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
948 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
949 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
950 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
953 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
955 #include <sys/types.h>
958 #include <sys/file.h>
964 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
967 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
968 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
969 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
975 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
976 AC_TRY_COMPILE([#include <sys/types.h>
978 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
979 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
980 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
981 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
984 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
985 AC_TRY_RUN([#include <sys/types.h>
986 #include <sys/capability.h>
989 if ((cap = cap_get_proc()) == NULL)
991 cap->cap_effective |= CAP_NETWORK_MGT;
992 cap->cap_inheritable |= CAP_NETWORK_MGT;
997 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
998 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
999 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
1003 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1004 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncate.c"],
1005 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1006 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1007 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
1010 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1011 AC_TRY_RUN([#include "${srcdir-.}/build/tests/unixsock.c"],
1012 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1013 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1014 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1015 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1017 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1020 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1021 AC_TRY_RUN([#include "${srcdir-.}/build/tests/getgroups.c"],
1022 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1023 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1024 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
1027 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1028 SAVE_CPPFLAGS="$CPPFLAGS"
1029 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper"
1031 #define REPLACE_GETPASS 1
1032 #define NO_CONFIG_H 1
1033 #define main dont_declare_main
1034 #include "${srcdir-.}/lib/getsmbpass.c"
1036 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1037 CPPFLAGS="$SAVE_CPPFLAGS"
1039 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1040 AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
1043 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1046 #include <sys/types.h>
1047 #include <netinet/in.h>
1048 #ifdef HAVE_ARPA_INET_H
1049 #include <arpa/inet.h>
1051 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1052 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1053 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1055 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1056 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1057 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
1060 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1061 AC_TRY_RUN([#include <stdlib.h>
1062 #include <sys/types.h>
1063 #include <sys/stat.h>
1067 char tpl[20]="/tmp/test.XXXXXX";
1068 int fd = mkstemp(tpl);
1069 if (fd == -1) exit(1);
1071 if (fstat(fd, &st) != 0) exit(1);
1072 if ((st.st_mode & 0777) != 0600) exit(1);
1075 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1076 samba_cv_HAVE_SECURE_MKSTEMP=no,
1077 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1078 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1079 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
1082 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1083 AC_TRY_RUN([#include <unistd.h>
1084 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1085 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1086 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1087 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
1090 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1091 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1092 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1093 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1094 AC_DEFINE(HAVE_ROOT,1,[Whether current user is root])
1096 AC_MSG_WARN(running as non-root will disable some tests)
1100 # look for a method of finding the list of network interfaces
1102 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1104 #define HAVE_IFACE_AIX 1
1105 #define AUTOCONF_TEST 1
1106 #include "confdefs.h"
1107 #include "${srcdir-.}/lib/interfaces.c"],
1108 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1109 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1110 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
1113 if test $iface = no; then
1114 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1116 #define HAVE_IFACE_IFCONF 1
1117 #define AUTOCONF_TEST 1
1118 #include "confdefs.h"
1119 #include "${srcdir-.}/lib/interfaces.c"],
1120 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1121 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1122 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
1126 if test $iface = no; then
1127 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1129 #define HAVE_IFACE_IFREQ 1
1130 #define AUTOCONF_TEST 1
1131 #include "confdefs.h"
1132 #include "${srcdir-.}/lib/interfaces.c"],
1133 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1134 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1135 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
1140 ################################################
1141 # look for a method of setting the effective uid
1143 if test $seteuid = no; then
1144 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1146 #define AUTOCONF_TEST 1
1147 #define USE_SETRESUID 1
1148 #include "confdefs.h"
1149 #include "${srcdir-.}/lib/util_sec.c"],
1150 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1151 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1152 seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
1157 if test $seteuid = no; then
1158 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1160 #define AUTOCONF_TEST 1
1161 #define USE_SETREUID 1
1162 #include "confdefs.h"
1163 #include "${srcdir-.}/lib/util_sec.c"],
1164 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1165 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1166 seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
1170 if test $seteuid = no; then
1171 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1173 #define AUTOCONF_TEST 1
1174 #define USE_SETEUID 1
1175 #include "confdefs.h"
1176 #include "${srcdir-.}/lib/util_sec.c"],
1177 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1178 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1179 seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
1183 if test $seteuid = no; then
1184 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1186 #define AUTOCONF_TEST 1
1187 #define USE_SETUIDX 1
1188 #include "confdefs.h"
1189 #include "${srcdir-.}/lib/util_sec.c"],
1190 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1191 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1192 seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
1197 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1198 AC_TRY_RUN([#include "${srcdir-.}/build/tests/shared_mmap.c"],
1199 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1200 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1201 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
1204 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1205 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncroot.c"],
1206 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1207 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1208 AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
1211 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1212 AC_TRY_RUN([#include "${srcdir-.}/build/tests/fcntl_lock.c"],
1213 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1214 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1215 AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available])
1218 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1219 AC_TRY_RUN([#include "${srcdir-.}/build/tests/fcntl_lock64.c"],
1220 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1221 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1222 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken])
1227 dnl Don't check for 64 bit fcntl locking if we know that the
1228 dnl glibc2.1 broken check has succeeded.
1231 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1233 #if defined(HAVE_UNISTD_H)
1243 #ifdef HAVE_SYS_FCNTL_H
1244 #include <sys/fcntl.h>
1246 main() { struct flock64 fl64;
1247 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1253 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1255 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1256 AC_DEFINE(HAVE_STRUCT_FLOCK64,1,[Whether the flock64 struct is available])
1260 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
1261 AC_TRY_COMPILE([#include <sys/types.h>
1262 #include <sys/stat.h>
1263 #include <unistd.h>],
1264 [struct stat st; st.st_blocks = 0;],
1265 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
1266 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
1267 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
1270 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
1271 AC_TRY_COMPILE([#include <sys/types.h>
1272 #include <sys/stat.h>
1273 #include <unistd.h>],
1274 [struct stat st; st.st_blksize = 0;],
1275 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
1276 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
1277 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
1282 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1284 #ifdef HAVE_SYS_VFS_H
1285 #include <sys/vfs.h>
1287 #ifdef HAVE_SYS_CAPABILITY_H
1288 #include <sys/capability.h>
1291 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1292 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1293 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
1298 AC_SUBST(SMBD_EXTRA_OBJS)
1299 AC_SUBST(SMBD_EXTRA_LIBS)
1301 SMB_INCLUDE_M4(libads/config.m4)
1303 ###############################################
1304 # test for where we get crypt() from
1305 AC_SEARCH_LIBS(crypt, [crypt],
1306 [test "$ac_cv_search_crypt" = "none required" || AUTHLIBS="-lcrypt $AUTHLIBS"
1307 AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
1310 ## moved after the check for -lcrypt in order to
1311 ## ensure that the necessary libraries are included
1312 ## check checking for truncated salt. Wrapped by the
1313 ## $with_pam_for_crypt variable as above --jerry
1315 if test x"$with_pam_for_crypt" != x"yes"; then
1316 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1318 LIBS="$AUTHLIBS $LIBS"
1319 AC_TRY_RUN([#include "${srcdir-.}/build/tests/crypttest.c"],
1320 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
1321 LIBS="$crypt_LIBS"])
1322 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1323 AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
1327 #################################################
1328 # these tests are taken from the GNU fileutils package
1329 AC_CHECKING(how to get filesystem space usage)
1332 # Test for statvfs64.
1333 if test $space = no; then
1335 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
1337 #if defined(HAVE_UNISTD_H)
1340 #include <sys/types.h>
1341 #include <sys/statvfs.h>
1344 struct statvfs64 fsd;
1345 exit (statvfs64 (".", &fsd));
1347 fu_cv_sys_stat_statvfs64=yes,
1348 fu_cv_sys_stat_statvfs64=no,
1349 fu_cv_sys_stat_statvfs64=cross)])
1350 if test $fu_cv_sys_stat_statvfs64 = yes; then
1352 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
1356 # Perform only the link test since it seems there are no variants of the
1357 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
1358 # because that got a false positive on SCO OSR5. Adding the declaration
1359 # of a `struct statvfs' causes this test to fail (as it should) on such
1360 # systems. That system is reported to work fine with STAT_STATFS4 which
1361 # is what it gets when this test fails.
1362 if test $space = no; then
1364 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
1365 [AC_TRY_LINK([#include <sys/types.h>
1366 #include <sys/statvfs.h>],
1367 [struct statvfs fsd; statvfs (0, &fsd);],
1368 fu_cv_sys_stat_statvfs=yes,
1369 fu_cv_sys_stat_statvfs=no)])
1370 if test $fu_cv_sys_stat_statvfs = yes; then
1372 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
1376 if test $space = no; then
1377 # DEC Alpha running OSF/1
1378 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
1379 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
1381 #include <sys/param.h>
1382 #include <sys/types.h>
1383 #include <sys/mount.h>
1388 exit (statfs (".", &fsd, sizeof (struct statfs)));
1390 fu_cv_sys_stat_statfs3_osf1=yes,
1391 fu_cv_sys_stat_statfs3_osf1=no,
1392 fu_cv_sys_stat_statfs3_osf1=no)])
1393 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
1394 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
1396 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
1400 if test $space = no; then
1402 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
1403 member (AIX, 4.3BSD)])
1404 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
1406 #ifdef HAVE_SYS_PARAM_H
1407 #include <sys/param.h>
1409 #ifdef HAVE_SYS_MOUNT_H
1410 #include <sys/mount.h>
1412 #ifdef HAVE_SYS_VFS_H
1413 #include <sys/vfs.h>
1419 exit (statfs (".", &fsd));
1421 fu_cv_sys_stat_statfs2_bsize=yes,
1422 fu_cv_sys_stat_statfs2_bsize=no,
1423 fu_cv_sys_stat_statfs2_bsize=no)])
1424 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
1425 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
1427 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
1431 if test $space = no; then
1433 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
1434 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
1435 [AC_TRY_RUN([#include <sys/types.h>
1436 #include <sys/statfs.h>
1440 exit (statfs (".", &fsd, sizeof fsd, 0));
1442 fu_cv_sys_stat_statfs4=yes,
1443 fu_cv_sys_stat_statfs4=no,
1444 fu_cv_sys_stat_statfs4=no)])
1445 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
1446 if test $fu_cv_sys_stat_statfs4 = yes; then
1448 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
1452 if test $space = no; then
1454 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
1455 member (4.4BSD and NetBSD)])
1456 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
1457 [AC_TRY_RUN([#include <sys/types.h>
1458 #ifdef HAVE_SYS_PARAM_H
1459 #include <sys/param.h>
1461 #ifdef HAVE_SYS_MOUNT_H
1462 #include <sys/mount.h>
1468 exit (statfs (".", &fsd));
1470 fu_cv_sys_stat_statfs2_fsize=yes,
1471 fu_cv_sys_stat_statfs2_fsize=no,
1472 fu_cv_sys_stat_statfs2_fsize=no)])
1473 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
1474 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
1476 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
1480 if test $space = no; then
1482 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1483 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1484 [AC_TRY_RUN([#include <sys/types.h>
1485 #ifdef HAVE_SYS_PARAM_H
1486 #include <sys/param.h>
1488 #ifdef HAVE_SYS_MOUNT_H
1489 #include <sys/mount.h>
1491 #ifdef HAVE_SYS_FS_TYPES_H
1492 #include <sys/fs_types.h>
1497 /* Ultrix's statfs returns 1 for success,
1498 0 for not mounted, -1 for failure. */
1499 exit (statfs (".", &fsd) != 1);
1501 fu_cv_sys_stat_fs_data=yes,
1502 fu_cv_sys_stat_fs_data=no,
1503 fu_cv_sys_stat_fs_data=no)])
1504 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1505 if test $fu_cv_sys_stat_fs_data = yes; then
1507 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
1512 # As a gating factor for large file support, in order to
1513 # use <4GB files we must have the following minimal support
1515 # long long, and a 64 bit off_t or off64_t.
1516 # If we don't have all of these then disable large
1519 AC_MSG_CHECKING([if large file support can be enabled])
1521 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
1522 #include <sys/types.h>
1528 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
1529 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
1530 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT,1,[Whether large file support can be enabled])
1532 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
1534 #######################################
1535 # Check for comparison_fn_t
1536 AC_CACHE_CHECK([for comparison_fn_t],samba_cv_HAVE_COMPARISON_FN_T,[
1539 int list_find(const void *needle,
1540 const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn)
1545 samba_cv_HAVE_COMPARISON_FN_T=yes,samba_cv_HAVE_COMPARISON_FN_T=no)
1547 if test x"$samba_cv_HAVE_COMPARISON_FN_T" = x"yes"; then
1548 AC_DEFINE(HAVE_COMPARISON_FN_T,1,[Whether or not we have comparison_fn_t])