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])
175 ATTEMPT_WRAP32_BUILD=yes
177 LDSHFLAGS="-set_version sgi1.0 -shared"
178 SONAMEFLAG="-soname "
180 if test "${GCC}" = "yes"; then
185 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
187 *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
189 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
190 DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
192 if test "${GCC}" != "yes"; then
193 ## for funky AIX compiler using strncpy()
194 CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
197 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
199 *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
201 # Use special PIC flags for the native HP-UX compiler.
202 if test $ac_cv_prog_cc_Ae = yes; then
205 LDSHFLAGS="-B symbolic -b -z"
210 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
212 *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
213 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
215 *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
218 SONAMEFLAG="-Wl,-soname,"
220 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
222 *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
223 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
225 *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
228 SONAMEFLAG="-Wl,-soname,"
230 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
232 *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
233 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
235 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
236 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
238 *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
240 *-univel-*) if [ test "$GCC" != yes ]; then
241 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
246 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
248 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
251 *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
252 if [ test "$GCC" != yes ]; then
253 AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
256 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
263 *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
269 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
272 AC_MSG_RESULT($BLDSHARED)
273 AC_MSG_CHECKING([linker flags for shared libraries])
274 AC_MSG_RESULT([$LDSHFLAGS])
275 AC_MSG_CHECKING([compiler flags for position-independent code])
276 AC_MSG_RESULT([$PICFLAGS])
278 #######################################################
279 # test whether building a shared library actually works
280 if test $BLDSHARED = true; then
281 AC_CACHE_CHECK([whether building shared libraries actually works],
282 [ac_cv_shlib_works],[
284 # try building a trivial shared library
285 if test "$PICSUFFIX" = "po"; then
286 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
287 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
288 ac_cv_shlib_works=yes
290 $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
291 mv shlib.$PICSUFFIX shlib.po &&
292 $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
293 ac_cv_shlib_works=yes
295 rm -f shlib.so shlib.po
297 if test $ac_cv_shlib_works = no; then
302 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
304 #include <sys/time.h>
306 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
307 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
308 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
309 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
313 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
314 AC_TRY_COMPILE([#include <sys/types.h>
316 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
317 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
318 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
319 AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
322 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
324 #include <sys/types.h>
327 #define F_GETLEASE 1025
330 int fd = open("/dev/null", O_RDONLY);
331 return fcntl(fd, F_GETLEASE, 0) == -1;
334 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
335 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
336 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
339 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
341 #include <sys/types.h>
345 #define F_NOTIFY 1026
348 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
351 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
352 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
353 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
356 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
358 #include <sys/types.h>
361 #include <sys/file.h>
367 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
370 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
371 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
372 AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
375 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
376 AC_TRY_COMPILE([#include <sys/types.h>
378 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
379 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
380 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
381 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
385 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
386 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncate.c"],
387 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
388 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
389 AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
392 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
393 AC_TRY_RUN([#include <unistd.h>
394 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
395 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
396 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
397 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
400 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
401 AC_TRY_RUN([#include "${srcdir-.}/build/tests/shared_mmap.c"],
402 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
403 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
404 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
407 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
408 AC_TRY_COMPILE([#include <sys/types.h>
409 #include <sys/stat.h>
410 #include <unistd.h>],
411 [struct stat st; st.st_blocks = 0;],
412 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
413 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
414 AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
417 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
418 AC_TRY_COMPILE([#include <sys/types.h>
419 #include <sys/stat.h>
420 #include <unistd.h>],
421 [struct stat st; st.st_blksize = 0;],
422 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
423 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
424 AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
429 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
431 #ifdef HAVE_SYS_VFS_H
434 #ifdef HAVE_SYS_CAPABILITY_H
435 #include <sys/capability.h>
438 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
439 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
440 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
445 AC_CACHE_CHECK([for O_DIRECT flag to open(2)],samba_cv_HAVE_OPEN_O_DIRECT,[
451 [int fd = open("/dev/null", O_DIRECT);],
452 samba_cv_HAVE_OPEN_O_DIRECT=yes,samba_cv_HAVE_OPEN_O_DIRECT=no)])
453 if test x"$samba_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
454 AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT])