1 dnl Checks for programs.
2 dnl Unique-to-Samba variables we'll be playing with.
14 # Config CPPFLAG settings for strange OS's that must be set
18 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
21 # mmap on HPUX is completely broken...
22 AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
23 if test $ac_cv_prog_cc_Ae = yes; then
24 CPPFLAGS="$CPPFLAGS -Ae"
28 # VOS may need to have POSIX support and System V compatibility enabled.
35 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
36 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
40 *-D_SYSV*|*-D_SVID_SOURCE*)
43 CPPFLAGS="$CPPFLAGS -D_SYSV"
44 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
54 AC_CHECK_HEADERS(sys/select.h fcntl.h sys/fcntl.h sys/time.h stdarg.h)
55 AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h compat.h math.h)
56 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
57 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h)
58 AC_CHECK_HEADERS(sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
59 AC_CHECK_HEADERS(fnmatch.h pwd.h sys/termio.h sys/time.h)
60 AC_CHECK_HEADERS(locale.h shadow.h)
61 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h)
62 AC_CHECK_HEADERS(sys/acl.h)
64 AC_CHECK_HEADERS(sys/capability.h)
66 AC_CHECK_HEADERS(sys/mount.h, , , [AC_INCLUDES_DEFAULT
67 #ifdef HAVE_SYS_PARAM_H
68 #include <sys/param.h>
80 AC_CHECK_TYPE(ino_t,unsigned)
81 AC_CHECK_TYPE(loff_t,off_t)
82 AC_CHECK_TYPE(offset_t,loff_t)
83 AC_CHECK_TYPES(long long)
86 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
88 #include <sys/types.h>
93 #include <signal.h>],[sig_atomic_t i = 0],
94 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
95 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
96 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
101 AC_CHECK_FUNCS(setsid pipe crypt16 getauthuid)
102 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction)
103 AC_CHECK_FUNCS(setgroups sysconf getpwanam srandom random srand rand usleep)
104 AC_CHECK_FUNCS(backtrace setbuffer)
108 # Assume non-shared by default and override below
112 # these are the defaults, good for lots of systems
122 AC_MSG_CHECKING([ability to build shared libraries])
124 # and these are for particular systems
126 *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
129 DYNEXP="-Wl,--export-dynamic"
131 SONAMEFLAG="-Wl,-soname="
132 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
134 *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
138 if test "${GCC}" = "yes"; then
140 if test "${ac_cv_prog_gnu_ld}" = "yes"; then
145 ## ${CFLAGS} added for building 64-bit shared
146 ## libs using Sun's Compiler
147 LDSHFLAGS="-G \${CFLAGS}"
151 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
153 *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
157 PICFLAG="-KPIC" # Is this correct for SunOS
158 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
160 *netbsd* | *freebsd*) BLDSHARED="true"
162 DYNEXP="-Wl,--export-dynamic"
163 SONAMEFLAG="-Wl,-soname,"
164 PICFLAG="-fPIC -DPIC"
165 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
167 *openbsd*) BLDSHARED="true"
169 DYNEXP="-Wl,-Bdynamic"
170 SONAMEFLAG="-Wl,-soname,"
172 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
174 *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
176 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
179 ATTEMPT_WRAP32_BUILD=yes
181 LDSHFLAGS="-set_version sgi1.0 -shared"
182 SONAMEFLAG="-soname "
184 if test "${GCC}" = "yes"; then
189 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
191 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
193 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
194 DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
196 if test "${GCC}" != "yes"; then
197 ## for funky AIX compiler using strncpy()
198 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
201 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
203 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
205 # Use special PIC flags for the native HP-UX compiler.
206 if test $ac_cv_prog_cc_Ae = yes; then
209 LDSHFLAGS="-B symbolic -b -z"
214 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
216 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
217 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
219 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
222 SONAMEFLAG="-Wl,-soname,"
224 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
226 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
227 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
229 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
232 SONAMEFLAG="-Wl,-soname,"
234 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
236 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
237 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
239 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
240 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
242 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
244 *-univel-*) if [ test "$GCC" != yes ]; then
245 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
250 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
252 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
255 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
256 if [ test "$GCC" != yes ]; then
257 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
260 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
267 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
273 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
276 AC_MSG_RESULT($BLDSHARED)
277 AC_MSG_CHECKING([linker flags for shared libraries])
278 AC_MSG_RESULT([$LDSHFLAGS])
279 AC_MSG_CHECKING([compiler flags for position-independent code])
280 AC_MSG_RESULT([$PICFLAGS])
282 #######################################################
283 # test whether building a shared library actually works
284 if test $BLDSHARED = true; then
285 AC_CACHE_CHECK([whether building shared libraries actually works],
286 [ac_cv_shlib_works],[
288 # try building a trivial shared library
289 if test "$PICSUFFIX" = "po"; then
290 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
291 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
292 ac_cv_shlib_works=yes
294 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
295 mv shlib.$PICSUFFIX shlib.po &&
296 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
297 ac_cv_shlib_works=yes
299 rm -f shlib.so shlib.po
301 if test $ac_cv_shlib_works = no; then
306 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
307 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
308 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
309 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
310 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
313 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
315 #include <sys/time.h>
317 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
318 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
319 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
320 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
324 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
325 AC_TRY_COMPILE([#include <sys/types.h>
327 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
328 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
329 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
330 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
333 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
335 #include <sys/types.h>
338 #define F_GETLEASE 1025
341 int fd = open("/dev/null", O_RDONLY);
342 return fcntl(fd, F_GETLEASE, 0) == -1;
345 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
346 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
347 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
350 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
352 #include <sys/types.h>
356 #define F_NOTIFY 1026
359 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
362 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
363 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
364 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
367 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
369 #include <sys/types.h>
372 #include <sys/file.h>
378 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
381 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
382 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
383 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
386 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
387 AC_TRY_COMPILE([#include <sys/types.h>
389 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
390 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
391 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
392 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
395 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
396 AC_TRY_RUN([#include <sys/types.h>
397 #include <sys/capability.h>
400 if ((cap = cap_get_proc()) == NULL)
402 cap->cap_effective |= CAP_NETWORK_MGT;
403 cap->cap_inheritable |= CAP_NETWORK_MGT;
408 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
409 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
410 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
414 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
415 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncate.c"],
416 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
417 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
418 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
421 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
422 AC_TRY_RUN([#include "${srcdir-.}/build/tests/getgroups.c"],
423 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
424 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
425 AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
428 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
429 AC_TRY_RUN([#include <unistd.h>
430 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
431 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
432 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
433 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
436 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
437 AC_TRY_RUN([#include "${srcdir-.}/build/tests/shared_mmap.c"],
438 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
439 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
440 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
443 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
444 AC_TRY_COMPILE([#include <sys/types.h>
445 #include <sys/stat.h>
446 #include <unistd.h>],
447 [struct stat st; st.st_blocks = 0;],
448 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
449 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
450 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
453 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
454 AC_TRY_COMPILE([#include <sys/types.h>
455 #include <sys/stat.h>
456 #include <unistd.h>],
457 [struct stat st; st.st_blksize = 0;],
458 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
459 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
460 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
465 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
467 #ifdef HAVE_SYS_VFS_H
470 #ifdef HAVE_SYS_CAPABILITY_H
471 #include <sys/capability.h>
474 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
475 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
476 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
481 AC_CACHE_CHECK([for O_DIRECT flag to open(2)],samba_cv_HAVE_OPEN_O_DIRECT,[
487 [int fd = open("/dev/null", O_DIRECT);],
488 samba_cv_HAVE_OPEN_O_DIRECT=yes,samba_cv_HAVE_OPEN_O_DIRECT=no)])
489 if test x"$samba_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
490 AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT])
493 ###############################################
494 # test for where we get crypt() from
495 AC_CHECK_LIB_EXT(crypt, CRYPT_LIBS, crypt)
496 SMB_EXT_LIB_ENABLE(CRYPT,YES)
497 SMB_EXT_LIB(CRYPT, $CRYPT_LIBS)