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