r5917: First step in using the new cli_credentials structure. This patch
[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_DEFINE([_GNU_SOURCE],[],[Pull in GNU extensions])
12 AC_SYS_LARGEFILE
13
14 #
15 # Config CPPFLAG settings for strange OS's that must be set
16 # before other tests.
17 #
18 case "$host_os" in
19 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
20     *hpux*)    
21       AC_PROG_CC_FLAG(Ae)
22       # mmap on HPUX is completely broken...
23       AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
24       if test $ac_cv_prog_cc_Ae = yes; then
25         CPPFLAGS="$CPPFLAGS -Ae"
26       fi
27     ;;
28 #
29 # VOS may need to have POSIX support and System V compatibility enabled.
30 #
31     *vos*)
32           case "$CPPFLAGS" in
33               *-D_POSIX_C_SOURCE*)
34                 ;;
35           *)
36                 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
37                 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
38                 ;;
39           esac
40           case "$CPPFLAGS" in
41              *-D_SYSV*|*-D_SVID_SOURCE*)
42                 ;;
43              *)
44                 CPPFLAGS="$CPPFLAGS -D_SYSV"
45                 AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
46           esac
47     ;;
48
49 esac
50
51
52 AC_HEADER_DIRENT
53 AC_HEADER_TIME
54 AC_HEADER_SYS_WAIT
55 AC_CHECK_HEADERS(arpa/inet.h sys/select.h fcntl.h sys/fcntl.h sys/time.h)
56 AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h memory.h net/if.h)
57 AC_CHECK_HEADERS(compat.h)
58 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
59 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
60 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
61 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
62 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h)
63 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
64 AC_CHECK_HEADERS(stdint.h locale.h)
65 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
66 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
67 AC_CHECK_HEADERS(stropts.h)
68 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
69 AC_CHECK_HEADERS(sys/acl.h)
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_TYPE(ssize_t, int)
84 AC_CHECK_TYPES(intptr_t)
85
86
87 ############################################
88 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
89 AC_SEARCH_LIBS(dlopen, [dl], [
90                            tmp=$ac_cv_search_dlopen
91                            if test "$ac_cv_search_dlopen" = "none required"; then 
92                                tmp=""
93                            fi
94                            SMB_EXT_LIB(DL, [$tmp])]
95                            )
96 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
97
98 ############################################
99 # check for unix domain sockets
100 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
101     AC_TRY_COMPILE([
102 #include <sys/types.h>
103 #include <stdlib.h>
104 #include <stddef.h>
105 #include <sys/socket.h>
106 #include <sys/un.h>],
107 [
108   struct sockaddr_un sunaddr; 
109   sunaddr.sun_family = AF_UNIX;
110 ],
111         samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
112 if test x"$samba_cv_unixsocket" = x"yes"; then
113    AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
114 fi
115
116
117 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
118     AC_TRY_COMPILE([
119 #include <sys/types.h>
120 #if STDC_HEADERS
121 #include <stdlib.h>
122 #include <stddef.h>
123 #endif
124 #include <sys/socket.h>],[socklen_t i = 0],
125         samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
126 if test x"$samba_cv_socklen_t" = x"yes"; then
127    AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
128 fi
129
130 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
131     AC_TRY_COMPILE([
132 #include <sys/types.h>
133 #if STDC_HEADERS
134 #include <stdlib.h>
135 #include <stddef.h>
136 #endif
137 #include <signal.h>],[sig_atomic_t i = 0],
138         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
139 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
140    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
141 fi
142
143 # stupid headers have the functions but no declaration. grrrr.
144 AC_HAVE_DECL(errno, [#include <errno.h>])
145 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
146 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
147 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
148 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
149 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
150 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
151
152 AC_FUNC_MEMCMP
153
154 # The following test taken from the cvs sources
155 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
156 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
157 # libsocket.so which has a bad implementation of gethostbyname (it
158 # only looks in /etc/hosts), so we only look for -lsocket if we need
159 # it.
160 AC_CHECK_FUNCS(connect)
161 if test x"$ac_cv_func_connect" = x"no"; then
162     case "$LIBS" in
163     *-lnsl*) ;;
164     *) AC_CHECK_LIB(nsl_s, printf) ;;
165     esac
166     case "$LIBS" in
167     *-lnsl*) ;;
168     *) AC_CHECK_LIB(nsl, printf) ;;
169     esac
170     case "$LIBS" in
171     *-lsocket*) ;;
172     *) AC_CHECK_LIB(socket, connect) ;;
173     esac
174     case "$LIBS" in
175     *-linet*) ;;
176     *) AC_CHECK_LIB(inet, connect) ;;
177     esac
178     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
179     dnl has been cached.
180     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
181        test x"$ac_cv_lib_inet_connect" = x"yes"; then
182         # ac_cv_func_connect=yes
183         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
184         AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
185     fi
186 fi
187
188 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strtoull strtouq strerror chown fchown chmod fchmod chroot link mknod mknod64)
189 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
190 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
191 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
192 AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf realpath)
193 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate)
194 AC_CHECK_FUNCS(setluid getpwanam setlinebuf)
195 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
196 AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm backtrace)
197 AC_CHECK_FUNCS(setbuffer)
198
199 AC_CHECK_FUNCS(getdents)
200 AC_CHECK_FUNCS(pread pwrite)
201
202 # needed for lib/charcnv.c
203 AC_CHECK_FUNCS(setlocale)
204
205 #####################################
206 # we might need the resolv library on some systems
207 AC_CHECK_LIB(resolv, dn_expand)
208
209 # Assume non-shared by default and override below
210 BLDSHARED="false"
211
212 # these are the defaults, good for lots of systems
213 HOST_OS="$host_os"
214 LDSHFLAGS="-shared"
215 SONAMEFLAG="#"
216 SHLD="\${CC}"
217 PICFLAG=""
218 PICSUFFIX="po"
219 POBAD_CC="#"
220 SHLIBEXT="so"
221
222 AC_MSG_CHECKING([ability to build shared libraries])
223
224 # and these are for particular systems
225 case "$host_os" in
226         *linux*)   AC_DEFINE(LINUX,1,[Whether the host os is linux])
227                 BLDSHARED="true"
228                 LDSHFLAGS="-shared" 
229                 DYNEXP="-Wl,--export-dynamic"
230                 PICFLAG="-fPIC"
231                 SONAMEFLAG="-Wl,-soname="
232                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
233                 ;;
234         *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
235                 BLDSHARED="true"
236                 LDSHFLAGS="-G"
237                 SONAMEFLAG="-h "
238                 if test "${GCC}" = "yes"; then
239                         PICFLAG="-fPIC"
240                         if test "${ac_cv_prog_gnu_ld}" = "yes"; then
241                                 DYNEXP="-Wl,-E"
242                         fi
243                 else
244                         PICFLAG="-KPIC"
245                         ## ${CFLAGS} added for building 64-bit shared 
246                         ## libs using Sun's Compiler
247                         LDSHFLAGS="-G \${CFLAGS}"
248                         POBAD_CC=""
249                         PICSUFFIX="po.o"
250                 fi
251                 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
252                 ;;
253         *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
254                 BLDSHARED="true"
255                 LDSHFLAGS="-G"
256                 SONAMEFLAG="-Wl,-h,"
257                 PICFLAG="-KPIC"   # Is this correct for SunOS
258                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
259                 ;;
260         *netbsd* | *freebsd*)  BLDSHARED="true"
261                 LDSHFLAGS="-shared"
262                 DYNEXP="-Wl,--export-dynamic"
263                 SONAMEFLAG="-Wl,-soname,"
264                 PICFLAG="-fPIC -DPIC"
265                 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
266                 ;;
267         *openbsd*)  BLDSHARED="true"
268                 LDSHFLAGS="-shared"
269                 DYNEXP="-Wl,-Bdynamic"
270                 SONAMEFLAG="-Wl,-soname,"
271                 PICFLAG="-fPIC"
272                 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
273                 ;;
274         *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
275                 case "$host_os" in
276                 *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
277                 ;;
278                 esac
279                 ATTEMPT_WRAP32_BUILD=yes
280                 BLDSHARED="true"
281                 LDSHFLAGS="-set_version sgi1.0 -shared"
282                 SONAMEFLAG="-soname "
283                 SHLD="\${LD}"
284                 if test "${GCC}" = "yes"; then
285                         PICFLAG="-fPIC"
286                 else 
287                         PICFLAG="-KPIC"
288                 fi
289                 AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
290                 ;;
291         *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
292                 BLDSHARED="true"
293                 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
294                 DYNEXP="-Wl,-brtl,-bexpall"
295                 PICFLAG="-O2"
296                 if test "${GCC}" != "yes"; then
297                         ## for funky AIX compiler using strncpy()
298                         CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
299                 fi
300
301                 AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
302                 ;;
303         *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
304                 SHLIBEXT="sl"
305                 # Use special PIC flags for the native HP-UX compiler.
306                 if test $ac_cv_prog_cc_Ae = yes; then
307                         BLDSHARED="true"
308                         SHLD="/usr/bin/ld"
309                         LDSHFLAGS="-B symbolic -b -z"
310                         SONAMEFLAG="+h "
311                         PICFLAG="+z"
312                 fi
313                 DYNEXP="-Wl,-E"
314                 AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
315                 ;;
316         *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
317                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
318                 ;;
319         *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
320                 BLDSHARED="true"
321                 LDSHFLAGS="-shared"
322                 SONAMEFLAG="-Wl,-soname,"
323                 PICFLAG="-fPIC"
324                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
325                 ;;
326         *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
327                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
328                 ;;
329         *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
330                 BLDSHARED="true"
331                 LDSHFLAGS="-shared"
332                 SONAMEFLAG="-Wl,-soname,"
333                 PICFLAG="-KPIC"
334                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
335                 ;;
336         *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
337                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
338                 ;;
339         *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
340                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
341                 ;;
342         *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
343                 case "$host" in
344                         *-univel-*)     if [ test "$GCC" != yes ]; then
345                                         AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
346                                 fi
347                                 LDSHFLAGS="-G"
348                                         DYNEXP="-Bexport"
349                         ;;
350                         *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
351                 esac
352                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
353                 ;;
354
355         *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
356                 if [ test "$GCC" != yes ]; then
357                         AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
358                 fi
359                 LDSHFLAGS="-G"
360                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
361                 ;;
362         *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
363                 BLDSHARED="false"
364                 LDSHFLAGS=""
365                 ;;
366         *)
367                 AC_DEFINE(STAT_ST_BLOCKSIZE,512)
368                 ;;
369 esac
370 AC_MSG_RESULT($BLDSHARED)
371 AC_MSG_CHECKING([linker flags for shared libraries])
372 AC_MSG_RESULT([$LDSHFLAGS])
373 AC_MSG_CHECKING([compiler flags for position-independent code])
374 AC_MSG_RESULT([$PICFLAGS])
375
376 #######################################################
377 # test whether building a shared library actually works
378 if test $BLDSHARED = true; then
379 AC_CACHE_CHECK([whether building shared libraries actually works], 
380                [ac_cv_shlib_works],[
381    ac_cv_shlib_works=no
382    # try building a trivial shared library
383    if test "$PICSUFFIX" = "po"; then
384      $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
385        $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
386        ac_cv_shlib_works=yes
387    else
388      $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
389        mv shlib.$PICSUFFIX shlib.po &&
390        $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
391        ac_cv_shlib_works=yes
392    fi
393    rm -f shlib.so shlib.po
394 ])
395 if test $ac_cv_shlib_works = no; then
396    BLDSHARED=false
397 fi
398 fi
399
400 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
401 AC_TRY_COMPILE([#include <sys/types.h>
402 #include <sys/socket.h>
403 #include <netinet/in.h>],
404 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
405 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
406 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
407     AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
408 fi
409
410 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
411 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
412 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
413 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
414     AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
415 fi
416
417 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
418 AC_TRY_RUN([
419 #include <sys/time.h>
420 #include <unistd.h>
421 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
422            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
423 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
424     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
425 fi
426
427 AC_CACHE_CHECK([for va_copy],samba_cv_HAVE_VA_COPY,[
428 AC_TRY_LINK([#include <stdarg.h>
429 va_list ap1,ap2;], [va_copy(ap1,ap2);],
430 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
431 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
432     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
433 fi
434
435 if test x"$samba_cv_HAVE_VA_COPY" != x"yes"; then
436 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE___VA_COPY,[
437 AC_TRY_LINK([#include <stdarg.h>
438 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
439 samba_cv_HAVE___VA_COPY=yes,samba_cv_HAVE___VA_COPY=no)])
440 if test x"$samba_cv_HAVE___VA_COPY" = x"yes"; then
441     AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
442 fi
443 fi
444
445 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
446 AC_TRY_RUN([
447 #include <sys/types.h>
448 #include <stdarg.h>
449 void foo(const char *format, ...) { 
450        va_list ap;
451        int len;
452        char buf[5];
453
454        va_start(ap, format);
455        len = vsnprintf(buf, 0, format, ap);
456        va_end(ap);
457        if (len != 5) exit(1);
458
459        va_start(ap, format);
460        len = vsnprintf(0, 0, format, ap);
461        va_end(ap);
462        if (len != 5) exit(1);
463
464        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
465
466        exit(0);
467 }
468 main() { foo("hello"); }
469 ],
470 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
471 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
472     AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
473 fi
474
475 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
476 AC_TRY_COMPILE([#include <sys/types.h>
477 #include <utime.h>],
478 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
479 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
480 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
481     AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
482 fi
483
484 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
485 AC_TRY_RUN([
486 #include <sys/types.h>
487 #include <fcntl.h>
488 #ifndef F_GETLEASE
489 #define F_GETLEASE      1025
490 #endif
491 main() {
492        int fd = open("/dev/null", O_RDONLY);
493        return fcntl(fd, F_GETLEASE, 0) == -1;
494 }
495 ],
496 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
497 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
498     AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
499 fi
500
501 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
502 AC_TRY_RUN([
503 #include <sys/types.h>
504 #include <fcntl.h>
505 #include <signal.h>
506 #ifndef F_NOTIFY
507 #define F_NOTIFY 1026
508 #endif
509 main() {
510         exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0);
511 }
512 ],
513 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
514 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
515     AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
516 fi
517
518 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
519 AC_TRY_RUN([
520 #include <sys/types.h>
521 #include <fcntl.h>
522 #include <signal.h>
523 #include <sys/file.h>
524 #ifndef LOCK_MAND
525 #define LOCK_MAND       32
526 #define LOCK_READ       64
527 #endif
528 main() {
529         exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
530 }
531 ],
532 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
533 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
534     AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
535 fi
536
537
538
539
540 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
541 AC_TRY_COMPILE([#include <sys/types.h>
542 #include <fcntl.h>],
543 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
544 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
545 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
546     AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
547 fi
548
549 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
550 AC_TRY_RUN([#include <sys/types.h>
551 #include <sys/capability.h>
552 main() {
553  cap_t cap;
554  if ((cap = cap_get_proc()) == NULL)
555    exit(1);
556  cap->cap_effective |= CAP_NETWORK_MGT;
557  cap->cap_inheritable |= CAP_NETWORK_MGT;
558  cap_set_proc(cap);
559  exit(0);
560 }
561 ],
562 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
563 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
564     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
565 fi
566
567
568 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
569 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncate.c"],
570            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
571 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
572     AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
573 fi
574
575 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
576 AC_TRY_RUN([#include "${srcdir-.}/build/tests/unixsock.c"],
577            samba_cv_HAVE_WORKING_AF_LOCAL=yes,
578            samba_cv_HAVE_WORKING_AF_LOCAL=no,
579            samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
580 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
581 then
582     AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
583 fi
584
585 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
586 AC_TRY_RUN([#include "${srcdir-.}/build/tests/getgroups.c"],
587            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
588 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
589     AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
590 fi
591
592 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
593 AC_TRY_RUN([
594 #include <stdio.h>
595 #include <sys/types.h>
596 #include <netinet/in.h>
597 #ifdef HAVE_ARPA_INET_H
598 #include <arpa/inet.h>
599 #endif
600 main() { struct in_addr ip; ip.s_addr = 0x12345678;
601 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
602     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
603 exit(1);}],
604            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
605 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
606     AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
607 fi
608
609 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
610 AC_TRY_RUN([#include <stdlib.h>
611 #include <sys/types.h>
612 #include <sys/stat.h>
613 #include <unistd.h>
614 main() { 
615   struct stat st;
616   char tpl[20]="/tmp/test.XXXXXX"; 
617   int fd = mkstemp(tpl); 
618   if (fd == -1) exit(1);
619   unlink(tpl);
620   if (fstat(fd, &st) != 0) exit(1);
621   if ((st.st_mode & 0777) != 0600) exit(1);
622   exit(0);
623 }],
624 samba_cv_HAVE_SECURE_MKSTEMP=yes,
625 samba_cv_HAVE_SECURE_MKSTEMP=no,
626 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
627 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
628     AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
629 fi
630
631 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
632 AC_TRY_RUN([#include <unistd.h>
633 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
634 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
635 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
636     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
637 fi
638
639 ##################
640 # look for a method of finding the list of network interfaces
641 iface=no;
642 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
643 AC_TRY_RUN([
644 #define HAVE_IFACE_AIX 1
645 #define AUTOCONF_TEST 1
646 #include "confdefs.h"
647 #include "${srcdir-.}/lib/netif/netif.h"
648 #include "${srcdir-.}/lib/netif/netif.c"],
649            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
650 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
651     iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
652 fi
653
654 if test $iface = no; then
655 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
656 AC_TRY_RUN([
657 #define HAVE_IFACE_IFCONF 1
658 #define AUTOCONF_TEST 1
659 #include "confdefs.h"
660 #include "${srcdir-.}/lib/netif/netif.h"
661 #include "${srcdir-.}/lib/netif/netif.c"],
662            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
663 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
664     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
665 fi
666 fi
667
668 if test $iface = no; then
669 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
670 AC_TRY_RUN([
671 #define HAVE_IFACE_IFREQ 1
672 #define AUTOCONF_TEST 1
673 #include "confdefs.h"
674 #include "${srcdir-.}/lib/netif/netif.h"
675 #include "${srcdir-.}/lib/netif/netif.c"],
676            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
677 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
678     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
679 fi
680 fi
681
682 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
683 AC_TRY_RUN([#include "${srcdir-.}/build/tests/shared_mmap.c"],
684            samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
685 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
686     AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
687 fi
688
689 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
690 AC_TRY_RUN([#include "${srcdir-.}/build/tests/ftruncroot.c"],
691            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
692 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
693     AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
694 fi
695
696 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
697 AC_TRY_COMPILE([#include <sys/types.h>
698 #include <sys/stat.h>
699 #include <unistd.h>],
700 [struct stat st;  st.st_blocks = 0;],
701 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
702 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
703     AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
704 fi 
705
706 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
707 AC_TRY_COMPILE([#include <sys/types.h>
708 #include <sys/stat.h>
709 #include <unistd.h>],
710 [struct stat st;  st.st_blksize = 0;],
711 samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
712 if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
713     AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
714 fi
715
716 case "$host_os" in
717 *linux*)
718 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
719 AC_TRY_COMPILE([
720 #ifdef HAVE_SYS_VFS_H
721 #include <sys/vfs.h>
722 #endif
723 #ifdef HAVE_SYS_CAPABILITY_H
724 #include <sys/capability.h>
725 #endif
726 ],[int i;],
727    samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
728 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
729    AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
730 fi
731 ;;
732 esac
733
734 AC_SUBST(SMBD_EXTRA_OBJS)
735 AC_SUBST(SMBD_EXTRA_LIBS)
736
737 SMB_INCLUDE_M4(libads/config.m4)
738
739 ###############################################
740 # test for where we get crypt() from
741 AC_SEARCH_LIBS(crypt, [crypt],
742   [test "$ac_cv_search_crypt" = "none required" || AUTHLIBS="-lcrypt $AUTHLIBS"
743   AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
744
745 ##
746 ## moved after the check for -lcrypt in order to
747 ## ensure that the necessary libraries are included
748 ## check checking for truncated salt.  Wrapped by the
749 ## $with_pam_for_crypt variable as above   --jerry
750 ##
751 if test x"$with_pam_for_crypt" != x"yes"; then
752 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
753 crypt_LIBS="$LIBS"
754 LIBS="$AUTHLIBS $LIBS"
755 AC_TRY_RUN([#include "${srcdir-.}/build/tests/crypttest.c"],
756         samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
757 LIBS="$crypt_LIBS"])
758 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
759         AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
760 fi
761 fi
762
763 #################################################
764 # these tests are taken from the GNU fileutils package
765 AC_CHECKING(how to get filesystem space usage)
766 space=no
767
768 # Test for statvfs64.
769 if test $space = no; then
770   # SVR4
771   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
772   [AC_TRY_RUN([
773 #if defined(HAVE_UNISTD_H)
774 #include <unistd.h>
775 #endif
776 #include <sys/types.h>
777 #include <sys/statvfs.h>
778   main ()
779   {
780     struct statvfs64 fsd;
781     exit (statvfs64 (".", &fsd));
782   }],
783   fu_cv_sys_stat_statvfs64=yes,
784   fu_cv_sys_stat_statvfs64=no,
785   fu_cv_sys_stat_statvfs64=cross)])
786   if test $fu_cv_sys_stat_statvfs64 = yes; then
787     space=yes
788     AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
789   fi
790 fi
791
792 # Perform only the link test since it seems there are no variants of the
793 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
794 # because that got a false positive on SCO OSR5.  Adding the declaration
795 # of a `struct statvfs' causes this test to fail (as it should) on such
796 # systems.  That system is reported to work fine with STAT_STATFS4 which
797 # is what it gets when this test fails.
798 if test $space = no; then
799   # SVR4
800   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
801                  [AC_TRY_LINK([#include <sys/types.h>
802 #include <sys/statvfs.h>],
803                               [struct statvfs fsd; statvfs (0, &fsd);],
804                               fu_cv_sys_stat_statvfs=yes,
805                               fu_cv_sys_stat_statvfs=no)])
806   if test $fu_cv_sys_stat_statvfs = yes; then
807     space=yes
808     AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
809   fi
810 fi
811
812 if test $space = no; then
813   # DEC Alpha running OSF/1
814   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
815   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
816   [AC_TRY_RUN([
817 #include <sys/param.h>
818 #include <sys/types.h>
819 #include <sys/mount.h>
820   main ()
821   {
822     struct statfs fsd;
823     fsd.f_fsize = 0;
824     exit (statfs (".", &fsd, sizeof (struct statfs)));
825   }],
826   fu_cv_sys_stat_statfs3_osf1=yes,
827   fu_cv_sys_stat_statfs3_osf1=no,
828   fu_cv_sys_stat_statfs3_osf1=no)])
829   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
830   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
831     space=yes
832     AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
833   fi
834 fi
835
836 if test $space = no; then
837 # AIX
838   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
839 member (AIX, 4.3BSD)])
840   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
841   [AC_TRY_RUN([
842 #ifdef HAVE_SYS_PARAM_H
843 #include <sys/param.h>
844 #endif
845 #ifdef HAVE_SYS_MOUNT_H
846 #include <sys/mount.h>
847 #endif
848 #ifdef HAVE_SYS_VFS_H
849 #include <sys/vfs.h>
850 #endif
851   main ()
852   {
853   struct statfs fsd;
854   fsd.f_bsize = 0;
855   exit (statfs (".", &fsd));
856   }],
857   fu_cv_sys_stat_statfs2_bsize=yes,
858   fu_cv_sys_stat_statfs2_bsize=no,
859   fu_cv_sys_stat_statfs2_bsize=no)])
860   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
861   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
862     space=yes
863     AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
864   fi
865 fi
866
867 if test $space = no; then
868 # SVR3
869   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
870   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
871   [AC_TRY_RUN([#include <sys/types.h>
872 #include <sys/statfs.h>
873   main ()
874   {
875   struct statfs fsd;
876   exit (statfs (".", &fsd, sizeof fsd, 0));
877   }],
878     fu_cv_sys_stat_statfs4=yes,
879     fu_cv_sys_stat_statfs4=no,
880     fu_cv_sys_stat_statfs4=no)])
881   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
882   if test $fu_cv_sys_stat_statfs4 = yes; then
883     space=yes
884     AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
885   fi
886 fi
887
888 if test $space = no; then
889 # 4.4BSD and NetBSD
890   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
891 member (4.4BSD and NetBSD)])
892   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
893   [AC_TRY_RUN([#include <sys/types.h>
894 #ifdef HAVE_SYS_PARAM_H
895 #include <sys/param.h>
896 #endif
897 #ifdef HAVE_SYS_MOUNT_H
898 #include <sys/mount.h>
899 #endif
900   main ()
901   {
902   struct statfs fsd;
903   fsd.f_fsize = 0;
904   exit (statfs (".", &fsd));
905   }],
906   fu_cv_sys_stat_statfs2_fsize=yes,
907   fu_cv_sys_stat_statfs2_fsize=no,
908   fu_cv_sys_stat_statfs2_fsize=no)])
909   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
910   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
911     space=yes
912         AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
913   fi
914 fi
915
916 if test $space = no; then
917   # Ultrix
918   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
919   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
920   [AC_TRY_RUN([#include <sys/types.h>
921 #ifdef HAVE_SYS_PARAM_H
922 #include <sys/param.h>
923 #endif
924 #ifdef HAVE_SYS_MOUNT_H
925 #include <sys/mount.h>
926 #endif
927 #ifdef HAVE_SYS_FS_TYPES_H
928 #include <sys/fs_types.h>
929 #endif
930   main ()
931   {
932   struct fs_data fsd;
933   /* Ultrix's statfs returns 1 for success,
934      0 for not mounted, -1 for failure.  */
935   exit (statfs (".", &fsd) != 1);
936   }],
937   fu_cv_sys_stat_fs_data=yes,
938   fu_cv_sys_stat_fs_data=no,
939   fu_cv_sys_stat_fs_data=no)])
940   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
941   if test $fu_cv_sys_stat_fs_data = yes; then
942     space=yes
943     AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
944   fi
945 fi
946
947
948
949 #######################################
950 # Check for comparison_fn_t
951 AC_CACHE_CHECK([for comparison_fn_t],samba_cv_HAVE_COMPARISON_FN_T,[
952 AC_TRY_COMPILE([
953 #include <stdlib.h>
954 int list_find(const void *needle, 
955               const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn)
956 {
957         return 1;
958 }
959 ],[],
960 samba_cv_HAVE_COMPARISON_FN_T=yes,samba_cv_HAVE_COMPARISON_FN_T=no)
961 ])
962 if test x"$samba_cv_HAVE_COMPARISON_FN_T" = x"yes"; then
963         AC_DEFINE(HAVE_COMPARISON_FN_T,1,[Whether or not we have comparison_fn_t])
964 fi
965