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