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