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