r14999: Remove more unused autoconf code
[samba.git] / source / build / m4 / rewrite.m4
1 dnl Checks for programs.
2 dnl Unique-to-Samba variables we'll be playing with.
3
4 DYNEXP=
5
6 AC_SUBST(SHLIBEXT)
7 AC_SUBST(LDSHFLAGS)
8 AC_SUBST(SONAMEFLAG)
9 AC_SUBST(PICFLAG)
10
11 AC_SYS_LARGEFILE
12
13 #
14 # Config CPPFLAG settings for strange OS's that must be set
15 # before other tests.
16 #
17 case "$host_os" in
18 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
19     *hpux*)    
20       AC_PROG_CC_FLAG(Ae)
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"
25       fi
26     ;;
27 #
28 # VOS may need to have POSIX support and System V compatibility enabled.
29 #
30     *vos*)
31           case "$CPPFLAGS" in
32               *-D_POSIX_C_SOURCE*)
33                 ;;
34           *)
35                 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
36                 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
37                 ;;
38           esac
39           case "$CPPFLAGS" in
40              *-D_SYSV*|*-D_SVID_SOURCE*)
41                 ;;
42              *)
43                 CPPFLAGS="$CPPFLAGS -D_SYSV"
44                 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
45           esac
46     ;;
47
48 esac
49
50
51 AC_HEADER_DIRENT
52 AC_HEADER_TIME
53 AC_HEADER_SYS_WAIT
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)
63
64 AC_CHECK_HEADERS(sys/capability.h)
65
66 AC_CHECK_HEADERS(sys/mount.h, , , [AC_INCLUDES_DEFAULT
67 #ifdef HAVE_SYS_PARAM_H
68 #include <sys/param.h>
69 #endif])
70
71
72 AC_TYPE_SIGNAL
73 AC_TYPE_UID_T
74 AC_TYPE_MODE_T
75 AC_TYPE_OFF_T
76 AC_TYPE_SIZE_T
77 AC_TYPE_PID_T
78 AC_STRUCT_ST_RDEV
79 AC_DIRENT_D_OFF
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)
84
85
86 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
87     AC_TRY_COMPILE([
88 #include <sys/types.h>
89 #if STDC_HEADERS
90 #include <stdlib.h>
91 #include <stddef.h>
92 #endif
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])
97 fi
98
99 AC_FUNC_MEMCMP
100
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)
105
106 AC_SUBST(BLDSHARED)
107 AC_SUBST(BLDMERGED)
108 # Assume non-shared by default and override below
109 BLDSHARED="false"
110 BLDMERGED="true"
111
112 # these are the defaults, good for lots of systems
113 HOST_OS="$host_os"
114 LDSHFLAGS="-shared"
115 SONAMEFLAG="#"
116 SHLD="\${CC}"
117 PICFLAG=""
118 PICSUFFIX="po"
119 POBAD_CC="#"
120 SHLIBEXT="so"
121
122 AC_MSG_CHECKING([ability to build shared libraries])
123
124 # and these are for particular systems
125 case "$host_os" in
126         *linux*)   AC_DEFINE(LINUX,1,[Whether the host os is linux])
127                 BLDSHARED="true"
128                 LDSHFLAGS="-shared" 
129                 DYNEXP="-Wl,--export-dynamic"
130                 PICFLAG="-fPIC"
131                 SONAMEFLAG="-Wl,-soname="
132                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
133                 ;;
134         *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
135                 BLDSHARED="true"
136                 LDSHFLAGS="-G"
137                 SONAMEFLAG="-h "
138                 if test "${GCC}" = "yes"; then
139                         PICFLAG="-fPIC"
140                         if test "${ac_cv_prog_gnu_ld}" = "yes"; then
141                                 DYNEXP="-Wl,-E"
142                         fi
143                 else
144                         PICFLAG="-KPIC"
145                         ## ${CFLAGS} added for building 64-bit shared 
146                         ## libs using Sun's Compiler
147                         LDSHFLAGS="-G \${CFLAGS}"
148                         POBAD_CC=""
149                         PICSUFFIX="po.o"
150                 fi
151                 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
152                 ;;
153         *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
154                 BLDSHARED="true"
155                 LDSHFLAGS="-G"
156                 SONAMEFLAG="-Wl,-h,"
157                 PICFLAG="-KPIC"   # Is this correct for SunOS
158                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
159                 ;;
160         *netbsd* | *freebsd*)  BLDSHARED="true"
161                 LDSHFLAGS="-shared"
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])
166                 ;;
167         *openbsd*)  BLDSHARED="true"
168                 LDSHFLAGS="-shared"
169                 DYNEXP="-Wl,-Bdynamic"
170                 SONAMEFLAG="-Wl,-soname,"
171                 PICFLAG="-fPIC"
172                 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
173                 ;;
174         *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
175                 case "$host_os" in
176                 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
177                 ;;
178                 esac
179                 ATTEMPT_WRAP32_BUILD=yes
180                 BLDSHARED="true"
181                 LDSHFLAGS="-set_version sgi1.0 -shared"
182                 SONAMEFLAG="-soname "
183                 SHLD="\${LD}"
184                 if test "${GCC}" = "yes"; then
185                         PICFLAG="-fPIC"
186                 else 
187                         PICFLAG="-KPIC"
188                 fi
189                 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
190                 ;;
191         *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
192                 BLDSHARED="true"
193                 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
194                 DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
195                 PICFLAG="-O2"
196                 if test "${GCC}" != "yes"; then
197                         ## for funky AIX compiler using strncpy()
198                         CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
199                 fi
200
201                 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
202                 ;;
203         *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
204                 SHLIBEXT="sl"
205                 # Use special PIC flags for the native HP-UX compiler.
206                 if test $ac_cv_prog_cc_Ae = yes; then
207                         BLDSHARED="true"
208                         SHLD="/usr/bin/ld"
209                         LDSHFLAGS="-B symbolic -b -z"
210                         SONAMEFLAG="+h "
211                         PICFLAG="+z"
212                 fi
213                 DYNEXP="-Wl,-E"
214                 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
215                 ;;
216         *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
217                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
218                 ;;
219         *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
220                 BLDSHARED="true"
221                 LDSHFLAGS="-shared"
222                 SONAMEFLAG="-Wl,-soname,"
223                 PICFLAG="-fPIC"
224                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
225                 ;;
226         *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
227                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
228                 ;;
229         *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
230                 BLDSHARED="true"
231                 LDSHFLAGS="-shared"
232                 SONAMEFLAG="-Wl,-soname,"
233                 PICFLAG="-KPIC"
234                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
235                 ;;
236         *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
237                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
238                 ;;
239         *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
240                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
241                 ;;
242         *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
243                 case "$host" in
244                         *-univel-*)     if [ test "$GCC" != yes ]; then
245                                         AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
246                                 fi
247                                 LDSHFLAGS="-G"
248                                         DYNEXP="-Bexport"
249                         ;;
250                         *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
251                 esac
252                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
253                 ;;
254
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])
258                 fi
259                 LDSHFLAGS="-G"
260                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
261                 ;;
262         *-vms)
263                 BLDMERGED="false"
264                 BLDSHARED="false"
265                 LDSHFLAGS=""
266                 ;;
267         *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
268                 BLDSHARED="false"
269                 BLDMERGED="false"
270                 LDSHFLAGS=""
271                 ;;
272         *)
273                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
274                 ;;
275 esac
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])
281
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],[
287    ac_cv_shlib_works=no
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
293    else
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
298    fi
299    rm -f shlib.so shlib.po
300 ])
301 if test $ac_cv_shlib_works = no; then
302    BLDSHARED=false
303 fi
304 fi
305
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])
311 fi
312
313 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
314 AC_TRY_RUN([
315 #include <sys/time.h>
316 #include <unistd.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])
321 fi
322
323
324 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
325 AC_TRY_COMPILE([#include <sys/types.h>
326 #include <utime.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])
331 fi
332
333 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
334 AC_TRY_RUN([
335 #include <sys/types.h>
336 #include <fcntl.h>
337 #ifndef F_GETLEASE
338 #define F_GETLEASE      1025
339 #endif
340 main() {
341        int fd = open("/dev/null", O_RDONLY);
342        return fcntl(fd, F_GETLEASE, 0) == -1;
343 }
344 ],
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])
348 fi
349
350 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
351 AC_TRY_RUN([
352 #include <sys/types.h>
353 #include <fcntl.h>
354 #include <signal.h>
355 #ifndef F_NOTIFY
356 #define F_NOTIFY 1026
357 #endif
358 main() {
359         exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0);
360 }
361 ],
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])
365 fi
366
367 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
368 AC_TRY_RUN([
369 #include <sys/types.h>
370 #include <fcntl.h>
371 #include <signal.h>
372 #include <sys/file.h>
373 #ifndef LOCK_MAND
374 #define LOCK_MAND       32
375 #define LOCK_READ       64
376 #endif
377 main() {
378         exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
379 }
380 ],
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])
384 fi
385
386 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
387 AC_TRY_COMPILE([#include <sys/types.h>
388 #include <fcntl.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])
393 fi
394
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>
398 main() {
399  cap_t cap;
400  if ((cap = cap_get_proc()) == NULL)
401    exit(1);
402  cap->cap_effective |= CAP_NETWORK_MGT;
403  cap->cap_inheritable |= CAP_NETWORK_MGT;
404  cap_set_proc(cap);
405  exit(0);
406 }
407 ],
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])
411 fi
412
413
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])
419 fi
420
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])
426 fi
427
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])
434 fi
435
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])
441 fi
442
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])
451 fi 
452
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])
461 fi
462
463 case "$host_os" in
464 *linux*)
465 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
466 AC_TRY_COMPILE([
467 #ifdef HAVE_SYS_VFS_H
468 #include <sys/vfs.h>
469 #endif
470 #ifdef HAVE_SYS_CAPABILITY_H
471 #include <sys/capability.h>
472 #endif
473 ],[int i;],
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])
477 fi
478 ;;
479 esac
480
481 AC_CACHE_CHECK([for O_DIRECT flag to open(2)],samba_cv_HAVE_OPEN_O_DIRECT,[
482 AC_TRY_COMPILE([
483 #include <unistd.h>
484 #ifdef HAVE_FCNTL_H
485 #include <fcntl.h>
486 #endif],
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])
491 fi 
492
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)