Use VFS operations for file I/O.
[samba.git] / source3 / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(include/includes.h)
3 AC_CONFIG_HEADER(include/config.h)
4 # we want to be compatibe with older versions of Samba
5 AC_PREFIX_DEFAULT(/usr/local/samba)
6
7 dnl Unique-to-Samba variables we'll be playing with.
8 AC_SUBST(SHELL)
9 AC_SUBST(MPROGS)
10 AC_SUBST(LDSHFLAGS)
11 AC_SUBST(HOST_OS)
12 AC_SUBST(WRAP)
13 AC_SUBST(WRAP32)
14 AC_SUBST(PICFLAG)
15
16 # compile with optimisation and without debugging by default
17 CFLAGS=${CFLAGS-"-O"}
18
19 dnl Checks for programs.
20 AC_PROG_CC
21 AC_PROG_INSTALL
22 AC_PROG_AWK
23
24 AC_CANONICAL_SYSTEM
25 AC_VALIDATE_CACHE_SYSTEM_TYPE
26 SAMBA_MAINTAINER_MODE
27
28 #
29 # Config CPPFLAG settings for strange OS's that must be set
30 # before other tests.
31 #
32 case "$host_os" in
33 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
34     *hpux*)
35       AC_PROG_CC_FLAG(Ae)
36       if test $ac_cv_prog_cc_Ae = yes; then
37         CPPFLAGS="$CPPFLAGS -Ae"
38       fi
39       ;;
40 #
41 # AIX4.x is *so* broken. It doesn't even admit to having large
42 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
43 #
44     *aix4*)
45       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
46       ;;    
47 esac
48
49 AC_INLINE
50 AC_HEADER_STDC
51 AC_HEADER_DIRENT
52 AC_HEADER_TIME
53 AC_HEADER_SYS_WAIT
54 AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
55 AC_CHECK_HEADERS(sys/param.h ctype.h )
56 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/route.h net/if.h)
57 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h sys/param.h ctype.h )
58 AC_CHECK_HEADERS(sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h sys/mman.h)
59 AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
60 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
61 AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
62 AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
63 AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
64 AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
65 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h mysql.h)
66
67 AC_CHECK_SIZEOF(int,cross)
68 AC_CHECK_SIZEOF(long,cross)
69 AC_CHECK_SIZEOF(short,cross)
70
71 AC_C_CONST
72 AC_C_INLINE
73 AC_C_BIGENDIAN
74 AC_C_CHAR_UNSIGNED
75
76 AC_TYPE_SIGNAL
77 AC_TYPE_UID_T
78 AC_TYPE_MODE_T
79 AC_TYPE_OFF_T
80 AC_TYPE_SIZE_T
81 AC_TYPE_PID_T
82 AC_STRUCT_ST_RDEV
83 AC_DIRENT_D_OFF
84 AC_CHECK_TYPE(ino_t,unsigned)
85 AC_CHECK_TYPE(loff_t,off_t)
86 AC_CHECK_TYPE(offset_t,loff_t)
87 AC_CHECK_TYPE(ssize_t, int)
88
89 AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
90     AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
91         samba_cv_errno=yes,samba_cv_have_errno_decl=no)])
92 if test x"$samba_cv_errno" = x"yes"; then
93    AC_DEFINE(HAVE_ERRNO_DECL)
94 fi
95
96 # stupid glibc has the functions but no declaration. grrrr.
97 AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
98     AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresuid],
99         samba_cv_have_setresuid_decl=yes,samba_cv_have_setresuid_decl=no)])
100 if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
101     AC_DEFINE(HAVE_SETRESUID_DECL)
102 fi
103
104 # stupid glibc has the functions but no declaration. grrrr.
105 AC_CACHE_CHECK([for crypt declaration],samba_cv_have_crypt_decl,[
106     AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)crypt],
107         samba_cv_have_crypt_decl=yes,samba_cv_have_crypt_decl=no)])
108 if test x"$samba_cv_have_crypt_decl" = x"yes"; then
109     AC_DEFINE(HAVE_CRYPT_DECL)
110 fi
111
112 # and glibc has setresuid under linux but the function does
113 # nothing until kernel 2.1.44! very dumb.
114 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
115     AC_TRY_RUN([#include <errno.h>
116 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
117         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
118 if test x"$samba_cv_have_setresuid" = x"yes"; then
119     AC_DEFINE(HAVE_SETRESUID)
120 fi
121
122 AC_FUNC_MEMCMP
123
124 ###############################################
125 # test for where we get crypt() from
126 AC_CHECK_FUNCS(crypt)
127 if test x"$ac_cv_func_crypt" = x"no"; then
128     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
129         AC_DEFINE(HAVE_CRYPT)])
130 fi
131
132
133 ###############################################
134 # test for where we get pam_authenticate() from
135 # might need libdl for this to work
136 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
137   AC_CHECK_LIB(dl,main)
138 fi
139 AC_CHECK_FUNCS(pam_authenticate)
140 if test x"$ac_cv_func_pam_authenticate" = x"no"; then
141     AC_CHECK_LIB(pam, pam_authenticate, [LIBS="$LIBS -lpam"
142         AC_DEFINE(HAVE_PAM_AUTHENTICATE)])
143 fi
144
145
146 ###############################################
147 # test for where we get readline() from
148 if test "$ac_cv_header_readline_h" = "yes" ||
149    test "$ac_cv_header_readline_readline_h" = "yes"; then
150   AC_CHECK_LIB(readline,readline)
151 fi
152
153
154 # The following test taken from the cvs sources
155 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
156 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
157 # libsocket.so which has a bad implementation of gethostbyname (it
158 # only looks in /etc/hosts), so we only look for -lsocket if we need
159 # it.
160 AC_CHECK_FUNCS(connect)
161 if test x"$ac_cv_func_connect" = x"no"; then
162     case "$LIBS" in
163     *-lnsl*) ;;
164     *) AC_CHECK_LIB(nsl_s, printf) ;;
165     esac
166     case "$LIBS" in
167     *-lnsl*) ;;
168     *) AC_CHECK_LIB(nsl, printf) ;;
169     esac
170     case "$LIBS" in
171     *-lsocket*) ;;
172     *) AC_CHECK_LIB(socket, connect) ;;
173     esac
174     case "$LIBS" in
175     *-linet*) ;;
176     *) AC_CHECK_LIB(inet, connect) ;;
177     esac
178     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
179     dnl has been cached.
180     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
181        test x"$ac_cv_lib_inet_connect" = x"yes"; then
182         # ac_cv_func_connect=yes
183         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
184         AC_DEFINE(HAVE_CONNECT)
185     fi
186 fi
187
188
189 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod chroot)
190 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
191 AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob strpbrk pipe crypt16 getauthuid)
192 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
193 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf)
194 AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64 fopen64)
195 AC_CHECK_FUNCS(atexit grantpt dup2 lseek64 ftruncate64)
196 AC_CHECK_FUNCS(fseek64 ftell64 setluid yp_get_default_domain getpwanam)
197 AC_CHECK_FUNCS(srandom random srand rand setenv mmap64)
198 # syscall() is needed for smbwrapper.
199 AC_CHECK_FUNCS(syscall)
200
201 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
202 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
203 AC_CHECK_FUNCS(__getcwd _getcwd)
204 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
205 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
206 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
207 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
208 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
209 AC_CHECK_FUNCS(_write __write _fork __fork)
210 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
211 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
212 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
213 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
214 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
215
216 #
217 # Check for the functions putprpwnam, set_auth_parameters,
218 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
219 # Needed for OSF1 and HPUX.
220 #
221
222 AC_LIBTESTFUNC(security, putprpwnam)
223 AC_LIBTESTFUNC(sec, putprpwnam)
224
225 AC_LIBTESTFUNC(security, set_auth_parameters)
226 AC_LIBTESTFUNC(sec, set_auth_parameters)
227
228 AC_LIBTESTFUNC(security, getspnam)
229 AC_LIBTESTFUNC(sec, getspnam)
230
231 AC_LIBTESTFUNC(security, bigcrypt)
232 AC_LIBTESTFUNC(sec, bigcrypt)
233
234 AC_LIBTESTFUNC(security, getprpwnam)
235 AC_LIBTESTFUNC(sec, getprpwnam)
236
237 # this bit needs to be modified for each OS that is suported by
238 # smbwrapper. You need to specify how to created a shared library and
239 # how to compile C code to produce PIC object files
240
241 # these are the defaults, good for lots of systems
242 HOST_OS="$host_os"
243 LDSHFLAGS="-shared"
244
245 # and these are for particular systems
246 case "$host_os" in
247                 *linux*)   AC_DEFINE(LINUX);;
248                 *solaris*) AC_DEFINE(SUNOS5)
249                                         LDSHFLAGS="-G"
250                 ;;
251                 *sunos*) AC_DEFINE(SUNOS4)
252                                         LDSHFLAGS=""
253                 ;;
254                 *bsd*) LDSHFLAGS="-shared -Bshareable"
255                 ;;
256                 *irix*) AC_DEFINE(IRIX)
257                         ATTEMPT_WRAP32_BUILD=yes
258                 ;;
259                 *aix*) AC_DEFINE(AIX);;
260                 *hpux*) AC_DEFINE(HPUX);;
261                 *qnx*) AC_DEFINE(QNX);;
262                 *osf*) AC_DEFINE(OSF1);;
263                 *sco*) AC_DEFINE(SCO);;
264                 *next2*) AC_DEFINE(NEXT2);;
265                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
266                 *sysv4.2*) AC_CHECK_LIB(resolv, strcasecmp);;
267 esac
268
269 # try to work out how to produce pic code with this compiler
270 PICFLAG=""
271 AC_PROG_CC_FLAG(fpic)
272 if test $ac_cv_prog_cc_fpic = yes; then
273    PICFLAG="-fpic";
274 fi
275 if test x$PICFLAG = x; then
276   AC_PROG_CC_FLAG(Kpic)
277   if test $ac_cv_prog_cc_Kpic = yes; then
278     PICFLAG="-Kpic";
279   fi 
280 fi
281 if test x$PICFLAG = x; then
282   AC_PROG_CC_FLAG(KPIC)
283   if test $ac_cv_prog_cc_KPIC = yes; then
284     PICFLAG="-KPIC";
285   fi 
286 fi
287
288 ################
289
290 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
291 AC_TRY_RUN([#include <stdio.h>
292 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
293 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
294 if test x"$samba_cv_have_longlong" = x"yes"; then
295     AC_DEFINE(HAVE_LONGLONG)
296 fi
297
298 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
299 AC_TRY_RUN([#include <stdio.h>
300 #include <sys/stat.h>
301 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
302 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
303 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
304     AC_DEFINE(SIZEOF_OFF_T,8)
305 fi
306
307 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
308 AC_TRY_RUN([#include <stdio.h>
309 #include <sys/stat.h>
310 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
311 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
312 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
313     AC_DEFINE(HAVE_OFF64_T)
314 fi
315
316 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
317 AC_TRY_RUN([#include <stdio.h>
318 #include <sys/stat.h>
319 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
320 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
321 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
322     AC_DEFINE(SIZEOF_INO_T,8)
323 fi
324
325 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
326 AC_TRY_RUN([#include <stdio.h>
327 #include <sys/stat.h>
328 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
329 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
330 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
331     AC_DEFINE(HAVE_INO64_T)
332 fi
333
334 AC_CACHE_CHECK([for union semun],samba_cv_HAVE_UNION_SEMUN,[
335 AC_TRY_RUN([
336 #include <sys/types.h>
337 #include <sys/ipc.h>
338 #include <sys/sem.h>
339 main() { union semun ss; exit(0); }],
340 samba_cv_HAVE_UNION_SEMUN=yes,samba_cv_HAVE_UNION_SEMUN=no,samba_cv_HAVE_UNION_SEMUN=cross)])
341 if test x"$samba_cv_HAVE_UNION_SEMUN" = x"yes"; then
342     AC_DEFINE(HAVE_UNION_SEMUN)
343 fi
344
345 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
346 AC_TRY_RUN([#include <stdio.h>
347 main() { char c; c=250; exit((c > 0)?0:1); }],
348 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
349 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
350     AC_DEFINE(HAVE_UNSIGNED_CHAR)
351 fi
352
353 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
354 AC_TRY_COMPILE([#include <sys/types.h>
355 #include <sys/socket.h>
356 #include <netinet/in.h>],
357 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
358 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
359 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
360     AC_DEFINE(HAVE_SOCK_SIN_LEN)
361 fi
362
363 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
364 AC_TRY_COMPILE([#include <sys/types.h>
365 #include <dirent.h>
366 void seekdir(DIR *d, long loc) { return; }],[return 0;],
367 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
368 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
369     AC_DEFINE(SEEKDIR_RETURNS_VOID)
370 fi
371
372 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
373 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
374 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
375 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
376     AC_DEFINE(HAVE_FILE_MACRO)
377 fi
378
379 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
380 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
381 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
382 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
383     AC_DEFINE(HAVE_FUNCTION_MACRO)
384 fi
385
386 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
387 AC_TRY_RUN([
388 #include <sys/time.h>
389 #include <unistd.h>
390 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
391            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
392 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
393     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
394 fi
395
396
397 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
398 AC_TRY_RUN([#include <sys/types.h>
399 #include <dirent.h>
400 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
401 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
402 di->d_name[0] == 0) exit(0); exit(1);} ],
403 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
404 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
405     AC_DEFINE(HAVE_BROKEN_READDIR)
406 fi
407
408 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
409 AC_TRY_COMPILE([#include <sys/types.h>
410 #include <utime.h>],
411 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
412 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
413 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
414     AC_DEFINE(HAVE_UTIMBUF)
415 fi
416
417 AC_CACHE_CHECK([for kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS,[
418 AC_TRY_COMPILE([#include <sys/types.h>
419 #include <fcntl.h>],
420 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
421 samba_cv_HAVE_KERNEL_OPLOCKS=yes,samba_cv_HAVE_KERNEL_OPLOCKS=no)])
422 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
423     AC_DEFINE(HAVE_KERNEL_OPLOCKS)
424 fi
425
426 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
427 AC_TRY_RUN([#include <sys/types.h>
428 #include <sys/capability.h>
429 main() {
430  cap_t cap;
431  if ((cap = cap_get_proc()) == NULL)
432    exit(1);
433  cap->cap_effective |= CAP_NETWORK_MGT;
434  cap->cap_inheritable |= CAP_NETWORK_MGT;
435  cap_set_proc(cap);
436  exit(0);
437 }
438 ],
439 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
440 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
441     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
442 fi
443
444 #
445 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
446 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
447 #
448
449 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
450 AC_TRY_COMPILE([#include <sys/types.h>
451 #if defined(HAVE_RPC_RPC_H)
452 #include <rpc/rpc.h>
453 #endif],
454 [int16 testvar;],
455 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
456 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
457     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
458 fi
459
460 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
461 AC_TRY_COMPILE([#include <sys/types.h>
462 #if defined(HAVE_RPC_RPC_H)
463 #include <rpc/rpc.h>
464 #endif],
465 [uint16 testvar;],
466 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
467 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
468     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
469 fi
470
471 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
472 AC_TRY_COMPILE([#include <sys/types.h>
473 #if defined(HAVE_RPC_RPC_H)
474 #include <rpc/rpc.h>
475 #endif],
476 [int32 testvar;],
477 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
478 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
479     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
480 fi
481
482 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
483 AC_TRY_COMPILE([#include <sys/types.h>
484 #if defined(HAVE_RPC_RPC_H)
485 #include <rpc/rpc.h>
486 #endif],
487 [uint32 testvar;],
488 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
489 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
490     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
491 fi
492
493 AC_MSG_CHECKING([for test routines])
494 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
495            AC_MSG_RESULT(yes),
496            AC_MSG_ERROR([cant find test code. Aborting config]),
497            AC_MSG_WARN([cannot run when cross-compiling]))
498
499 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
500 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
501            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
502 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
503     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
504 fi
505
506 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
507 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
508            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
509 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
510     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
511 fi
512
513 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
514 SAVE_CPPFLAGS="$CPPFLAGS"
515 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/include -I${srcdir-.}/ubiqx"
516 AC_TRY_COMPILE([
517 #define REPLACE_GETPASS 1
518 #define NO_CONFIG_H 1
519 #define main dont_declare_main
520 #include "${srcdir-.}/lib/getsmbpass.c"
521 #undef main
522 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
523 CPPFLAGS="$SAVE_CPPFLAGS"
524 ])
525 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
526         AC_DEFINE(REPLACE_GETPASS)
527 fi
528
529 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
530 AC_TRY_RUN([
531 #include <stdio.h>
532 #include <sys/types.h>
533 #include <netinet/in.h>
534 #include <arpa/inet.h>
535 main() { struct in_addr ip; ip.s_addr = 0x12345678;
536 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
537     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
538 exit(1);}],
539            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
540 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
541     AC_DEFINE(REPLACE_INET_NTOA)
542 fi
543
544 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
545 AC_TRY_RUN([main() { exit(getuid() != 0); }],
546            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
547 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
548     AC_DEFINE(HAVE_ROOT)
549 else
550     AC_MSG_WARN(running as non-root will disable some tests)
551 fi
552
553 netmask=no;
554 AC_CACHE_CHECK([for netmask ifconf],samba_cv_HAVE_NETMASK_IFCONF,[
555 AC_TRY_RUN([
556 #define HAVE_NETMASK_IFCONF 1
557 #define AUTOCONF 1
558 #include "${srcdir-.}/lib/netmask.c"],
559            samba_cv_HAVE_NETMASK_IFCONF=yes,samba_cv_HAVE_NETMASK_IFCONF=no,samba_cv_HAVE_NETMASK_IFCONF=cross)])
560 if test x"$samba_cv_HAVE_NETMASK_IFCONF" = x"yes"; then
561     netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF)
562 fi
563
564 if test $netmask = no; then
565 AC_CACHE_CHECK([for netmask ifreq],samba_cv_HAVE_NETMASK_IFREQ,[
566 AC_TRY_RUN([
567 #define HAVE_NETMASK_IFREQ 1
568 #define AUTOCONF 1
569 #include "${srcdir-.}/lib/netmask.c"],
570            samba_cv_HAVE_NETMASK_IFREQ=yes,samba_cv_HAVE_NETMASK_IFREQ=no,samba_cv_HAVE_NETMASK_IFREQ=cross)])
571 if test x"$samba_cv_HAVE_NETMASK_IFREQ" = x"yes"; then
572     netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ)
573 fi
574 fi
575
576 if test $netmask = no; then
577 AC_CACHE_CHECK([for netmask AIX],samba_cv_HAVE_NETMASK_AIX,[
578 AC_TRY_RUN([
579 #define HAVE_NETMASK_AIX 1
580 #define AUTOCONF 1
581 #include "${srcdir-.}/lib/netmask.c"],
582            samba_cv_HAVE_NETMASK_AIX=yes,samba_cv_HAVE_NETMASK_AIX=no,samba_cv_HAVE_NETMASK_AIX=cross)])
583 if test x"$samba_cv_HAVE_NETMASK_AIX" = x"yes"; then
584     netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX)
585 fi
586 fi
587
588 AC_CACHE_CHECK([for trapdoor seteuid],samba_cv_HAVE_TRAPDOOR_UID,[
589 AC_TRY_RUN([#include "${srcdir-.}/tests/trapdoor.c"],
590            samba_cv_HAVE_TRAPDOOR_UID=no,samba_cv_HAVE_TRAPDOOR_UID=yes,:)])
591 if test x"$samba_cv_HAVE_TRAPDOOR_UID" = x"yes"; then
592     AC_DEFINE(HAVE_TRAPDOOR_UID)
593 fi
594
595 AC_CACHE_CHECK([for shared mmap],samba_cv_HAVE_SHARED_MMAP,[
596 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
597            samba_cv_HAVE_SHARED_MMAP=yes,samba_cv_HAVE_SHARED_MMAP=no,samba_cv_HAVE_SHARED_MMAP=cross)])
598 if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
599     AC_DEFINE(HAVE_SHARED_MMAP)
600 fi
601
602 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
603 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
604            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
605 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
606     AC_DEFINE(HAVE_FCNTL_LOCK)
607 fi
608
609 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
610 AC_TRY_RUN([
611 #include <stdio.h>
612 #include <stdlib.h>
613
614 #ifdef HAVE_FCNTL_H
615 #include <fcntl.h>
616 #endif
617
618 #ifdef HAVE_SYS_FCNTL_H
619 #include <sys/fcntl.h>
620 #endif
621 main() { struct flock64 fl64;
622 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
623 exit(0);
624 #else
625 exit(1);
626 #endif
627 }],
628        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
629 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
630     AC_DEFINE(HAVE_STRUCT_FLOCK64)
631 fi
632
633 AC_CACHE_CHECK([for sysv ipc],samba_cv_HAVE_SYSV_IPC,[
634 AC_TRY_RUN([#include "${srcdir-.}/tests/sysv_ipc.c"],
635            samba_cv_HAVE_SYSV_IPC=yes,samba_cv_HAVE_SYSV_IPC=no,samba_cv_HAVE_SYSV_IPC=cross)])
636 if test x"$samba_cv_HAVE_SYSV_IPC" = x"yes"; then
637     AC_DEFINE(HAVE_SYSV_IPC)
638 fi
639
640 #################################################
641 # check for smbwrapper support
642 AC_MSG_CHECKING(whether to use smbwrapper)
643 AC_ARG_WITH(smbwrapper,
644 [  --with-smbwrapper     Include SMB wrapper support
645   --without-smbwrapper  Don't include SMB wrapper support (default)],
646 [ case "$withval" in
647   yes)
648     AC_MSG_RESULT(yes)
649     AC_DEFINE(WITH_SMBWRAPPER)
650         WRAP="bin/smbsh bin/smbwrapper.so"
651
652         if test x$ATTEMPT_WRAP32_BUILD = x; then
653                 WRAP32=""
654         else
655                         WRAP32=bin/smbwrapper.32.so
656         fi
657
658 # Conditions under which smbwrapper should not be built.
659
660         if test x$PICFLAG = x; then
661            echo No support for PIC code - disabling smbwrapper and smbsh
662            WRAP=""
663            WRAP32=""
664         elif test x$ac_cv_func_syscall = xno; then
665            AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
666            WRAP=""
667            WRAP32=""
668         fi
669     ;;
670   *)
671     AC_MSG_RESULT(no)
672     ;;
673   esac ],
674   AC_MSG_RESULT(no)
675 )
676
677 #################################################
678 # check for the AFS filesystem
679 AC_MSG_CHECKING(whether to use AFS)
680 AC_ARG_WITH(afs,
681 [  --with-afs     Include AFS support
682   --without-afs  Don't include AFS support (default)],
683 [ case "$withval" in
684   yes)
685     AC_MSG_RESULT(yes)
686     AC_DEFINE(WITH_AFS)
687     ;;
688   *)
689     AC_MSG_RESULT(no)
690     ;;
691   esac ],
692   AC_MSG_RESULT(no)
693 )
694
695
696 #################################################
697 # check for the DFS auth system
698 AC_MSG_CHECKING(whether to use DFS auth)
699 AC_ARG_WITH(dfs,
700 [  --with-dfs     Include DFS support
701   --without-dfs  Don't include DFS support (default)],
702 [ case "$withval" in
703   yes)
704     AC_MSG_RESULT(yes)
705     AC_DEFINE(WITH_DFS)
706     ;;
707   *)
708     AC_MSG_RESULT(no)
709     ;;
710   esac ],
711   AC_MSG_RESULT(no)
712 )
713
714 #################################################
715 # check for Kerberos IV auth system
716 AC_MSG_CHECKING(whether to use Kerberos IV)
717 AC_ARG_WITH(krb4,
718 [  --with-krb4=base-dir     Include Kerberos IV support
719   --whithout-krb4          Don't include Kerbers IV support (default)],
720 [   AC_MSG_RESULT(yes)
721     AC_DEFINE(KRB4_AUTH)
722     AC_CHECK_LIB(resolv, dn_expand)
723     LIBS="$LIBS -lkrb -ldes"
724     CFLAGS="$CFLAGS -I$withval/include"
725     LDFLAGS="$LDFLAGS -L$withval/lib"],
726   AC_MSG_RESULT(no)
727 )
728
729 #################################################
730 # check for automount support
731 AC_MSG_CHECKING(whether to use AUTOMOUNT)
732 AC_ARG_WITH(automount,
733 [  --with-automount     Include AUTOMOUNT support
734   --without-automount  Don't include AUTOMOUNT support (default)],
735 [ case "$withval" in
736   yes)
737     AC_MSG_RESULT(yes)
738     AC_DEFINE(WITH_AUTOMOUNT)
739     ;;
740   *)
741     AC_MSG_RESULT(no)
742     ;;
743   esac ],
744   AC_MSG_RESULT(no)
745 )
746
747 #################################################
748 # check for smbmount support
749 AC_MSG_CHECKING(whether to use SMBMOUNT)
750 AC_ARG_WITH(smbmount,
751 [  --with-smbmount     Include SMBMOUNT (Linux only) support
752   --without-smbmount  Don't include SMBMOUNT support (default)],
753 [ case "$withval" in
754   yes)
755     AC_MSG_RESULT(yes)
756     AC_DEFINE(WITH_SMBMOUNT)
757     MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
758     ;;
759   *)
760     AC_MSG_RESULT(no)
761     MPROGS=
762     ;;
763   esac ],
764   AC_MSG_RESULT(no)
765   MPROGS=
766 )
767
768 #################################################
769 # check for a LDAP password database
770 AC_MSG_CHECKING(whether to use LDAP password database)
771 AC_ARG_WITH(ldap,
772 [  --with-ldap     Include LDAP support
773   --without-ldap  Don't include LDAP support (default)],
774 [ case "$withval" in
775   yes)
776     AC_MSG_RESULT(yes)
777     AC_DEFINE(WITH_LDAP)
778     LIBS="$LIBS -lldap -llber"
779     ;;
780   *)
781     AC_MSG_RESULT(no)
782     ;;
783   esac ],
784   AC_MSG_RESULT(no)
785 )
786
787 #################################################
788 # check for a NISPLUS password database
789 AC_MSG_CHECKING(whether to use NISPLUS password database)
790 AC_ARG_WITH(nisplus,
791 [  --with-nisplus     Include NISPLUS password database support
792   --without-nisplus  Don't include NISPLUS password database support (default)],
793 [ case "$withval" in
794   yes)
795     AC_MSG_RESULT(yes)
796     AC_DEFINE(WITH_NISPLUS)
797     ;;
798   *)
799     AC_MSG_RESULT(no)
800     ;;
801   esac ],
802   AC_MSG_RESULT(no)
803 )
804
805 #################################################
806 # check for a NISPLUS_HOME support 
807 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
808 AC_ARG_WITH(nisplus-home,
809 [  --with-nisplus-home     Include NISPLUS_HOME support
810   --without-nisplus-home  Don't include NISPLUS_HOME support (default)],
811 [ case "$withval" in
812   yes)
813     AC_MSG_RESULT(yes)
814     AC_DEFINE(WITH_NISPLUS_HOME)
815     ;;
816   *)
817     AC_MSG_RESULT(no)
818     ;;
819   esac ],
820   AC_MSG_RESULT(no)
821 )
822
823 #################################################
824 # check for the secure socket layer
825 AC_MSG_CHECKING(whether to use SSL)
826 AC_ARG_WITH(ssl,
827 [  --with-ssl     Include SSL support
828   --without-ssl  Don't include SSL support (default)],
829 [ case "$withval" in
830   yes)
831     AC_MSG_RESULT(yes)
832     AC_DEFINE(WITH_SSL)
833     ;;
834   *)
835     AC_MSG_RESULT(no)
836     ;;
837   esac ],
838   AC_MSG_RESULT(no)
839 )
840
841 #################################################
842 # check for experimental mmap support
843 AC_MSG_CHECKING(whether to use MMAP)
844 AC_ARG_WITH(mmap,
845 [  --with-mmap     Include experimental MMAP support
846   --without-mmap  Don't include MMAP support (default)],
847 [ case "$withval" in
848   yes)
849     AC_MSG_RESULT(yes)
850     AC_DEFINE(WITH_MMAP)
851     ;;
852   *)
853     AC_MSG_RESULT(no)
854     ;;
855   esac ],
856   AC_MSG_RESULT(no)
857 )
858
859 #################################################
860 # check for syslog logging
861 AC_MSG_CHECKING(whether to use syslog logging)
862 AC_ARG_WITH(syslog,
863 [  --with-syslog     Include experimental SYSLOG support
864   --without-syslog  Don't include SYSLOG support (default)],
865 [ case "$withval" in
866   yes)
867     AC_MSG_RESULT(yes)
868     AC_DEFINE(WITH_SYSLOG)
869     ;;
870   *)
871     AC_MSG_RESULT(no)
872     ;;
873   esac ],
874   AC_MSG_RESULT(no)
875 )
876
877 #################################################
878 # check for a shared memory profiling support
879 AC_MSG_CHECKING(whether to use profiling)
880 AC_ARG_WITH(profile,
881 [  --with-profile     Include profile support
882   --without-profile  Don't include profile support (default)],
883 [ case "$withval" in
884   yes)
885     AC_MSG_RESULT(yes)
886     AC_DEFINE(WITH_PROFILE)
887     ;;
888   *)
889     AC_MSG_RESULT(no)
890     ;;
891   esac ],
892   AC_MSG_RESULT(no)
893 )
894
895
896 #################################################
897 # check for experimental netatalk resource fork support
898 AC_MSG_CHECKING(whether to support netatalk)
899 AC_ARG_WITH(netatalk,
900 [  --with-netatalk     Include experimental Netatalk support
901   --without-netatalk  Don't include experimental Netatalk support (default)],
902 [ case "$withval" in
903   yes)
904     AC_MSG_RESULT(yes)
905     AC_DEFINE(WITH_NETATALK)
906     ;;
907   *)
908     AC_MSG_RESULT(no)
909     ;;
910   esac ],
911   AC_MSG_RESULT(no)
912 )
913
914 #################################################
915 # check for experimental disk-quotas support
916 QUOTAOBJS=noquotas.o
917
918 AC_MSG_CHECKING(whether to support disk-quotas)
919 AC_ARG_WITH(quotas,
920 [  --with-quotas     Include experimental disk-quota support
921   --without-quotas  Don't include experimental disk-quota support (default)],
922 [ case "$withval" in
923   yes)
924     AC_MSG_RESULT(yes)
925     QUOTAOBJS=quotas.o
926     ;;
927   *)
928     AC_MSG_RESULT(no)
929     ;;
930   esac ],
931   AC_MSG_RESULT(no)
932 )
933 AC_SUBST(QUOTAOBJS)
934
935 #################################################
936 # these tests are taken from the GNU fileutils package
937 AC_CHECKING(how to get filesystem space usage)
938 space=no
939
940 # Test for statvfs64.
941 if test $space = no; then
942   # SVR4
943   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
944   [AC_TRY_RUN([
945 #include <sys/types.h>
946 #include <sys/statvfs.h>
947   main ()
948   {
949     struct statvfs64 fsd;
950     exit (statfs64 (".", &fsd));
951   }],
952   fu_cv_sys_stat_statvfs64=yes,
953   fu_cv_sys_stat_statvfs64=no,
954   fu_cv_sys_stat_statvfs64=cross)])
955   if test $fu_cv_sys_stat_statvfs64 = yes; then
956     space=yes
957     AC_DEFINE(STAT_STATVFS64)
958   fi
959 fi
960
961 # Perform only the link test since it seems there are no variants of the
962 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
963 # because that got a false positive on SCO OSR5.  Adding the declaration
964 # of a `struct statvfs' causes this test to fail (as it should) on such
965 # systems.  That system is reported to work fine with STAT_STATFS4 which
966 # is what it gets when this test fails.
967 if test $space = no; then
968   # SVR4
969   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
970                  [AC_TRY_LINK([#include <sys/types.h>
971 #include <sys/statvfs.h>],
972                               [struct statvfs fsd; statvfs (0, &fsd);],
973                               fu_cv_sys_stat_statvfs=yes,
974                               fu_cv_sys_stat_statvfs=no)])
975   if test $fu_cv_sys_stat_statvfs = yes; then
976     space=yes
977     AC_DEFINE(STAT_STATVFS)
978   fi
979 fi
980
981 if test $space = no; then
982   # DEC Alpha running OSF/1
983   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
984   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
985   [AC_TRY_RUN([
986 #include <sys/param.h>
987 #include <sys/types.h>
988 #include <sys/mount.h>
989   main ()
990   {
991     struct statfs fsd;
992     fsd.f_fsize = 0;
993     exit (statfs (".", &fsd, sizeof (struct statfs)));
994   }],
995   fu_cv_sys_stat_statfs3_osf1=yes,
996   fu_cv_sys_stat_statfs3_osf1=no,
997   fu_cv_sys_stat_statfs3_osf1=no)])
998   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
999   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
1000     space=yes
1001     AC_DEFINE(STAT_STATFS3_OSF1)
1002   fi
1003 fi
1004
1005 if test $space = no; then
1006 # AIX
1007   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
1008 member (AIX, 4.3BSD)])
1009   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
1010   [AC_TRY_RUN([
1011 #ifdef HAVE_SYS_PARAM_H
1012 #include <sys/param.h>
1013 #endif
1014 #ifdef HAVE_SYS_MOUNT_H
1015 #include <sys/mount.h>
1016 #endif
1017 #ifdef HAVE_SYS_VFS_H
1018 #include <sys/vfs.h>
1019 #endif
1020   main ()
1021   {
1022   struct statfs fsd;
1023   fsd.f_bsize = 0;
1024   exit (statfs (".", &fsd));
1025   }],
1026   fu_cv_sys_stat_statfs2_bsize=yes,
1027   fu_cv_sys_stat_statfs2_bsize=no,
1028   fu_cv_sys_stat_statfs2_bsize=no)])
1029   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
1030   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
1031     space=yes
1032     AC_DEFINE(STAT_STATFS2_BSIZE)
1033   fi
1034 fi
1035
1036 if test $space = no; then
1037 # SVR3
1038   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
1039   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
1040   [AC_TRY_RUN([#include <sys/types.h>
1041 #include <sys/statfs.h>
1042   main ()
1043   {
1044   struct statfs fsd;
1045   exit (statfs (".", &fsd, sizeof fsd, 0));
1046   }],
1047     fu_cv_sys_stat_statfs4=yes,
1048     fu_cv_sys_stat_statfs4=no,
1049     fu_cv_sys_stat_statfs4=no)])
1050   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
1051   if test $fu_cv_sys_stat_statfs4 = yes; then
1052     space=yes
1053     AC_DEFINE(STAT_STATFS4)
1054   fi
1055 fi
1056
1057 if test $space = no; then
1058 # 4.4BSD and NetBSD
1059   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
1060 member (4.4BSD and NetBSD)])
1061   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
1062   [AC_TRY_RUN([#include <sys/types.h>
1063 #ifdef HAVE_SYS_PARAM_H
1064 #include <sys/param.h>
1065 #endif
1066 #ifdef HAVE_SYS_MOUNT_H
1067 #include <sys/mount.h>
1068 #endif
1069   main ()
1070   {
1071   struct statfs fsd;
1072   fsd.f_fsize = 0;
1073   exit (statfs (".", &fsd));
1074   }],
1075   fu_cv_sys_stat_statfs2_fsize=yes,
1076   fu_cv_sys_stat_statfs2_fsize=no,
1077   fu_cv_sys_stat_statfs2_fsize=no)])
1078   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
1079   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
1080     space=yes
1081     AC_DEFINE(STAT_STATFS2_FSIZE)
1082   fi
1083 fi
1084
1085 if test $space = no; then
1086   # Ultrix
1087   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1088   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1089   [AC_TRY_RUN([#include <sys/types.h>
1090 #ifdef HAVE_SYS_PARAM_H
1091 #include <sys/param.h>
1092 #endif
1093 #ifdef HAVE_SYS_MOUNT_H
1094 #include <sys/mount.h>
1095 #endif
1096 #ifdef HAVE_SYS_FS_TYPES_H
1097 #include <sys/fs_types.h>
1098 #endif
1099   main ()
1100   {
1101   struct fs_data fsd;
1102   /* Ultrix's statfs returns 1 for success,
1103      0 for not mounted, -1 for failure.  */
1104   exit (statfs (".", &fsd) != 1);
1105   }],
1106   fu_cv_sys_stat_fs_data=yes,
1107   fu_cv_sys_stat_fs_data=no,
1108   fu_cv_sys_stat_fs_data=no)])
1109   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1110   if test $fu_cv_sys_stat_fs_data = yes; then
1111     space=yes
1112     AC_DEFINE(STAT_STATFS2_FS_DATA)
1113   fi
1114 fi
1115
1116 echo "checking configure summary"
1117 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
1118            echo "configure OK";,
1119            AC_MSG_ERROR([summary failure. Aborting config]),:)
1120
1121 builddir=`pwd`
1122 AC_SUBST(builddir)
1123
1124 AC_OUTPUT(include/stamp-h Makefile)