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