configure configure.in include/config.h.in include/includes.h
[ira/wip.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
5 dnl Checks for programs.
6 AC_PROG_CC
7 AC_PROG_INSTALL
8 AC_SUBST(SHELL)
9 AC_PROG_AWK
10
11 AC_CANONICAL_SYSTEM
12 case "$host_os" in
13         *linux*)   AC_DEFINE(LINUX);;
14         *solaris*) AC_DEFINE(SUNOS5);;
15         *sunos*) AC_DEFINE(SUNOS4);;
16         *irix*) AC_DEFINE(IRIX);;
17         *aix*) AC_DEFINE(AIX);;
18         *hpux*) AC_DEFINE(HPUX);;
19         *qnx*) AC_DEFINE(QNX);;
20         *osf1*) AC_DEFINE(OSF1);;
21         *sco*) AC_DEFINE(SCO);;
22         *next2*) AC_DEFINE(NEXT2);;
23 esac
24
25 AC_INLINE
26 AC_HEADER_STDC
27 AC_HEADER_DIRENT
28 AC_HEADER_TIME
29 AC_HEADER_SYS_WAIT
30 AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
31 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
32 AC_CHECK_HEADERS(compat.h rpc/types.h rpc/xdr.h rpc/auth.h rpc/clnt.h)
33 AC_CHECK_HEADERS(rpcsvc/yp_prot.h rpcsvc/ypclnt.h sys/param.h ctype.h )
34 AC_CHECK_HEADERS(sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
35 AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
36 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
37 AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
38 AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
39 AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
40 AC_CHECK_HEADERS(readline/history.h)
41
42 AC_CHECK_SIZEOF(int)
43 AC_CHECK_SIZEOF(long)
44 AC_CHECK_SIZEOF(short)
45
46 AC_C_CONST
47 AC_C_INLINE
48 AC_C_BIGENDIAN
49 AC_C_CHAR_UNSIGNED
50
51 AC_TYPE_SIGNAL
52 AC_TYPE_UID_T
53 AC_TYPE_MODE_T
54 AC_TYPE_OFF_T
55 AC_TYPE_SIZE_T
56 AC_TYPE_PID_T
57 AC_STRUCT_ST_RDEV
58 AC_CHECK_TYPE(ino_t,unsigned)
59 AC_CHECK_TYPE(ssize_t, int)
60
61 echo $ac_n "checking for errno in errno.h... $ac_c"
62 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
63 echo yes; AC_DEFINE(HAVE_ERRNO_DECL),
64 echo no)
65
66 # stupid glibc has the functions but no declaration. grrrr.
67 echo $ac_n "checking for setresuid declaration $ac_c"
68 AC_TRY_COMPILE([#include <unistd.h>],[int i = setresuid],
69 echo yes; AC_DEFINE(HAVE_SETRESUID_DECL),
70 echo no)
71
72 # and glibc has setresuid under linux but the function does
73 # nothing until kernel 2.1.44! very dumb.
74 echo $ac_n "checking for real setresuid $ac_c"
75 AC_TRY_RUN([#include <errno.h>
76 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
77 echo yes;AC_DEFINE(HAVE_SETRESUID), 
78 echo no)
79
80
81 AC_FUNC_MEMCMP
82
83 ###############################################
84 # test for where we get crypt() from
85 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
86   AC_CHECK_LIB(crypt, crypt)
87   AC_DEFINE(HAVE_CRYPT)
88 fi
89 if test "$ac_cv_lib_crypt_crypt" = "no" || 
90    test "$ac_cv_lib_crypt_crypt" = ""; then
91 # look for crypt 
92 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT), 
93 [case "$LIBS" in
94 *-lcrypt*) ;;
95 *) AC_CHECK_LIB(crypt, crypt) ;;
96 esac
97 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
98   ac_cv_func_crypt=yes
99   AC_DEFINE(HAVE_CRYPT)
100 fi])
101 fi
102
103
104 ###############################################
105 # test for where we get pam_authenticate() from
106 # might need libdl for this to work
107 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
108   AC_HAVE_LIBRARY(dl)
109 fi
110 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
111   AC_CHECK_LIB(pam, pam_authenticate)
112   AC_DEFINE(HAVE_PAM_AUTHENTICATE)
113 fi
114 if test "$ac_cv_lib_pam_pam_authenticate" = "no" || 
115    test "$ac_cv_lib_pam_pam_authenticate" = ""; then
116 # look for pam_authenticate
117 AC_CHECK_FUNC(pam_authenticate, AC_DEFINE(HAVE_PAM_AUTHENTICATE), 
118 [case "$LIBS" in
119 *-lpam*) ;;
120 *) AC_CHECK_LIB(pam, pam_authenticate) ;;
121 esac
122 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
123   ac_cv_func_pam_authenticate=yes
124   AC_DEFINE(HAVE_PAM_AUTHENTICATE)
125 fi])
126 fi
127
128 ###############################################
129 # test for where we get readline() from
130 if test "$ac_cv_header_readline_h" = "yes" ||
131    test "$ac_cv_header_readline_readline_h" = "yes"; then
132   AC_CHECK_LIB(readline,readline)
133   AC_DEFINE(HAVE_LIBREADLINE)
134 fi
135
136 # The following test taken from the cvs sources
137 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
138 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
139 # libsocket.so which has a bad implementation of gethostbyname (it
140 # only looks in /etc/hosts), so we only look for -lsocket if we need
141 # it.
142 AC_CHECK_FUNC(connect, :, 
143 [case "$LIBS" in
144 *-lnsl*) ;;
145 *) AC_CHECK_LIB(nsl_s, printf) ;;
146 esac
147 case "$LIBS" in
148 *-lnsl*) ;;
149 *) AC_CHECK_LIB(nsl, printf) ;;
150 esac
151 case "$LIBS" in
152 *-lsocket*) ;;
153 *) AC_CHECK_LIB(socket, connect) ;;
154 esac
155 case "$LIBS" in
156 *-linet*) ;;
157 *) AC_CHECK_LIB(inet, connect) ;;
158 esac
159 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
160 dnl has been cached.
161 if test "$ac_cv_lib_socket_connect" = "yes" || 
162    test "$ac_cv_lib_inet_connect" = "yes"; then
163   ac_cv_func_connect=yes
164   AC_DEFINE(HAVE_CONNECT)
165 fi])
166
167
168 AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot)
169 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
170 AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid)
171 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
172 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
173 AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64)
174 AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64)
175 AC_CHECK_FUNCS(fseek64 ftell64 bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
176
177 echo $ac_n "checking for long long ... $ac_c"
178 AC_TRY_RUN([#include <stdio.h>
179 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
180 echo yes;AC_DEFINE(HAVE_LONGLONG), 
181 echo no)
182
183 echo $ac_n "checking for 64 bit off_t ... $ac_c"
184 AC_TRY_RUN([#include <stdio.h>
185 #include <sys/stat.h>
186 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
187 echo yes;AC_DEFINE(SIZEOF_OFF_T,8),
188 echo no)
189
190 echo $ac_n "checking for off64_t ... $ac_c"
191 AC_TRY_RUN([#include <stdio.h>
192 #include <sys/stat.h>
193 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
194 echo yes;AC_DEFINE(HAVE_OFF64_T), 
195 echo no)
196
197 echo $ac_n "checking for 64 bit ino_t ... $ac_c"
198 AC_TRY_RUN([#include <stdio.h>
199 #include <sys/stat.h>
200 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
201 echo yes;AC_DEFINE(SIZEOF_INO_T,8),
202 echo no)
203
204 echo $ac_n "checking for ino64_t ... $ac_c"
205 AC_TRY_RUN([#include <stdio.h>
206 #include <sys/stat.h>
207 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
208 echo yes;AC_DEFINE(HAVE_INO64_T), 
209 echo no)
210
211 echo $ac_n "checking for union semun ... $ac_c"
212 AC_TRY_RUN([
213 #include <sys/types.h>
214 #include <sys/ipc.h>
215 #include <sys/sem.h>
216 main() { union semun ss; exit(0); }],
217 echo yes;AC_DEFINE(HAVE_UNION_SEMUN), 
218 echo no)
219
220 echo $ac_n "checking for unsigned char ... $ac_c"
221 AC_TRY_RUN([#include <stdio.h>
222 main() { char c; c=250; exit((c > 0)?0:1); }],
223 echo yes;AC_DEFINE(HAVE_UNSIGNED_CHAR), 
224 echo no)
225
226 echo $ac_n "checking for sin_len in sock ... $ac_c"
227 AC_TRY_COMPILE([#include <sys/types.h>
228 #include <sys/socket.h>
229 #include <netinet/in.h>],
230 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
231 echo yes;AC_DEFINE(HAVE_SOCK_SIN_LEN), 
232 echo no)
233
234 echo $ac_n "checking for __FILE__ macro ... $ac_c"
235 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
236 echo yes;AC_DEFINE(HAVE_FILE_MACRO), 
237 echo no)
238
239 echo $ac_n "checking for __FUNCTION__ macro ... $ac_c"
240 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
241 echo yes;AC_DEFINE(HAVE_FUNCTION_MACRO), 
242 echo no)
243
244 echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
245 AC_TRY_RUN([
246 #include <sys/time.h>
247 #include <unistd.h>
248 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
249            echo yes;AC_DEFINE(HAVE_GETTIMEOFDAY_TZ),
250            echo no)
251
252
253 echo $ac_n "checking for broken readdir ... $ac_c"
254 AC_TRY_RUN([#include <sys/types.h>
255 #include <dirent.h>
256 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
257 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
258 di->d_name[0] == 0) exit(0); exit(1);} ],
259 echo yes - you are using the broken /usr/ucb/cc;AC_DEFINE(HAVE_BROKEN_READDIR), 
260 echo no)
261
262 echo $ac_n "checking for utimbuf ... $ac_c"
263 AC_TRY_COMPILE([#include <sys/types.h>
264 #include <utime.h>],
265 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
266 echo yes;AC_DEFINE(HAVE_UTIMBUF), 
267 echo no)
268
269
270 echo $ac_n "checking for test routines ... $ac_c"
271 AC_TRY_RUN([#include "tests/trivial.c"],
272            echo yes;,
273            echo ERROR - cant find test code. Aborting config; exit 1)
274
275 echo $ac_n "checking for ftruncate extend ... $ac_c"
276 AC_TRY_RUN([#include "tests/ftruncate.c"],
277            echo yes;AC_DEFINE(HAVE_FTRUNCATE_EXTEND), 
278            echo no)
279
280 echo $ac_n "checking for broken getgroups ... $ac_c"
281 AC_TRY_RUN([#include "tests/getgroups.c"],
282            echo yes;AC_DEFINE(HAVE_BROKEN_GETGROUPS), 
283            echo no)
284
285
286 echo $ac_n "checking for broken inet_ntoa ... $ac_c"
287 AC_TRY_RUN([
288 #include <stdio.h>
289 #include <sys/types.h>
290 #include <netinet/in.h>
291 #include <arpa/inet.h>
292 main() { struct in_addr ip; ip.s_addr = 0x12345678;
293 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
294     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
295 exit(1);}],
296            echo yes;AC_DEFINE(REPLACE_INET_NTOA), 
297            echo no)
298
299 echo $ac_n "checking for root ... $ac_c"
300 AC_TRY_RUN([main() { exit(getuid() != 0); }],
301            echo yes;AC_DEFINE(HAVE_ROOT), 
302            echo WARNING: running as non-root will disable some tests;)
303
304 netmask=no;
305 echo $ac_n "checking for netmask ifconf ... $ac_c"
306 AC_TRY_RUN([
307 #define HAVE_NETMASK_IFCONF 1
308 #define AUTOCONF 1
309 #include "lib/netmask.c"],
310            echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF),
311            echo no)
312
313 if test $netmask = no; then
314 echo $ac_n "checking for netmask ifreq ... $ac_c"
315 AC_TRY_RUN([
316 #define HAVE_NETMASK_IFREQ 1
317 #define AUTOCONF 1
318 #include "lib/netmask.c"],
319            echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ),
320            echo no)
321 fi
322
323 if test $netmask = no; then
324 echo $ac_n "checking for netmask AIX ... $ac_c"
325 AC_TRY_RUN([
326 #define HAVE_NETMASK_AIX 1
327 #define AUTOCONF 1
328 #include "lib/netmask.c"],
329            echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX),
330            echo no)
331 fi
332
333 echo $ac_n "checking for trapdoor seteuid ... $ac_c"
334 AC_TRY_RUN([#include "tests/trapdoor.c"],
335            echo no,
336            echo yes;AC_DEFINE(HAVE_TRAPDOOR_UID))
337
338 echo $ac_n "checking for shared mmap ... $ac_c"
339 AC_TRY_RUN([#include "tests/shared_mmap.c"],
340            echo yes;AC_DEFINE(HAVE_SHARED_MMAP), 
341            echo no)
342
343 echo $ac_n "checking for fcntl locking ... $ac_c"
344 AC_TRY_RUN([#include "tests/fcntl_lock.c"],
345            echo yes;AC_DEFINE(HAVE_FCNTL_LOCK), 
346            echo no)
347
348 echo $ac_n "checking for 64 bit fcntl locking ... $ac_c"
349 AC_TRY_RUN([
350 #include <stdio.h>
351 #include <stdlib.h>
352
353 #ifdef HAVE_FCNTL_H
354 #include <fcntl.h>
355 #endif
356
357 #ifdef HAVE_SYS_FCNTL_H
358 #include <sys/fcntl.h>
359 #endif
360 main() { struct flock64 fl64;
361 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
362 exit(0);
363 #else
364 exit(1);
365 #endif
366 }],
367        echo yes;AC_DEFINE(HAVE_STRUCT_FLOCK64),
368        echo no)
369
370 echo $ac_n "checking for sysv ipc ... $ac_c"
371 AC_TRY_RUN([#include "tests/sysv_ipc.c"],
372            echo yes;AC_DEFINE(HAVE_SYSV_IPC), 
373            echo no)
374
375 #################################################
376 # check for the AFS filesystem
377 AC_MSG_CHECKING(whether to use AFS)
378 AC_ARG_WITH(afs,
379 [  --with-afs     Include AFS support
380   --without-afs  Don't include AFS support (default)],
381 [ case "$withval" in
382   yes)
383     AC_MSG_RESULT(yes)
384     AC_DEFINE(WITH_AFS)
385     ;;
386   *)
387     AC_MSG_RESULT(no)
388     ;;
389   esac ],
390   AC_MSG_RESULT(no)
391 )
392
393
394 #################################################
395 # check for the DFS auth system
396 AC_MSG_CHECKING(whether to use DFS auth)
397 AC_ARG_WITH(dfs,
398 [  --with-dfs     Include DFS support
399   --without-dfs  Don't include DFS support (default)],
400 [ case "$withval" in
401   yes)
402     AC_MSG_RESULT(yes)
403     AC_DEFINE(WITH_DFS)
404     ;;
405   *)
406     AC_MSG_RESULT(no)
407     ;;
408   esac ],
409   AC_MSG_RESULT(no)
410 )
411
412 #################################################
413 # check for automount support
414 AC_MSG_CHECKING(whether to use AUTOMOUNT)
415 AC_ARG_WITH(automount,
416 [  --with-automount     Include AUTOMOUNT support
417   --without-automount  Don't include AUTOMOUNT support (default)],
418 [ case "$withval" in
419   yes)
420     AC_MSG_RESULT(yes)
421     AC_DEFINE(WITH_AUTOMOUNT)
422     ;;
423   *)
424     AC_MSG_RESULT(no)
425     ;;
426   esac ],
427   AC_MSG_RESULT(no)
428 )
429
430 #################################################
431 # check for a LDAP password database
432 AC_MSG_CHECKING(whether to use LDAP password database)
433 AC_ARG_WITH(ldap,
434 [  --with-ldap     Include LDAP support
435   --without-ldap  Don't include LDAP support (default)],
436 [ case "$withval" in
437   yes)
438     AC_MSG_RESULT(yes)
439     AC_DEFINE(WITH_LDAP)
440     ;;
441   *)
442     AC_MSG_RESULT(no)
443     ;;
444   esac ],
445   AC_MSG_RESULT(no)
446 )
447
448 #################################################
449 # check for a NISPLUS password database
450 AC_MSG_CHECKING(whether to use NISPLUS password database)
451 AC_ARG_WITH(nisplus,
452 [  --with-nisplus     Include NISPLUS password database support
453   --without-nisplus  Don't include NISPLUS password database support (default)],
454 [ case "$withval" in
455   yes)
456     AC_MSG_RESULT(yes)
457     AC_DEFINE(WITH_NISPLUS)
458     ;;
459   *)
460     AC_MSG_RESULT(no)
461     ;;
462   esac ],
463   AC_MSG_RESULT(no)
464 )
465
466 #################################################
467 # check for a NISPLUS_HOME support 
468 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
469 AC_ARG_WITH(nisplus-home,
470 [  --with-nisplus-home     Include NISPLUS_HOME support
471   --without-nisplus-home  Don't include NISPLUS_HOME support (default)],
472 [ case "$withval" in
473   yes)
474     AC_MSG_RESULT(yes)
475     AC_DEFINE(WITH_NISPLUS_HOME)
476     ;;
477   *)
478     AC_MSG_RESULT(no)
479     ;;
480   esac ],
481   AC_MSG_RESULT(no)
482 )
483
484 #################################################
485 # check for the secure socket layer
486 AC_MSG_CHECKING(whether to use SSL)
487 AC_ARG_WITH(ssl,
488 [  --with-ssl     Include SSL support
489   --without-ssl  Don't include SSL support (default)],
490 [ case "$withval" in
491   yes)
492     AC_MSG_RESULT(yes)
493     AC_DEFINE(WITH_SSL)
494     ;;
495   *)
496     AC_MSG_RESULT(no)
497     ;;
498   esac ],
499   AC_MSG_RESULT(no)
500 )
501
502 #################################################
503 # check for experimental mmap support
504 AC_MSG_CHECKING(whether to use MMAP)
505 AC_ARG_WITH(mmap,
506 [  --with-mmap     Include experimental MMAP support
507   --without-mmap  Don't include MMAP support (default)],
508 [ case "$withval" in
509   yes)
510     AC_MSG_RESULT(yes)
511     AC_DEFINE(WITH_MMAP)
512     ;;
513   *)
514     AC_MSG_RESULT(no)
515     ;;
516   esac ],
517   AC_MSG_RESULT(no)
518 )
519
520 #################################################
521 # check for syslog logging
522 AC_MSG_CHECKING(whether to use syslog logging)
523 AC_ARG_WITH(syslog,
524 [  --with-syslog     Include experimental SYSLOG support
525   --without-syslog  Don't include SYSLOG support (default)],
526 [ case "$withval" in
527   yes)
528     AC_MSG_RESULT(yes)
529     AC_DEFINE(WITH_SYSLOG)
530     ;;
531   *)
532     AC_MSG_RESULT(no)
533     ;;
534   esac ],
535   AC_MSG_RESULT(no)
536 )
537
538 #################################################
539 # check for experimental netatalk resource fork support
540 AC_MSG_CHECKING(whether to support netatalk)
541 AC_ARG_WITH(netatalk,
542 [  --with-netatalk     Include experimental Netatalk support
543   --without-netatalk  Don't include experimental Netatalk support (default)],
544 [ case "$withval" in
545   yes)
546     AC_MSG_RESULT(yes)
547     AC_DEFINE(WITH_NETATALK)
548     ;;
549   *)
550     AC_MSG_RESULT(no)
551     ;;
552   esac ],
553   AC_MSG_RESULT(no)
554 )
555
556
557 #################################################
558 # these tests are taken from the GNU fileutils package
559 AC_CHECKING(how to get filesystem space usage)
560 space=no
561
562 # Test for statvfs64.
563 if test $space = no; then
564   # SVR4
565   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
566   [AC_TRY_RUN([
567 #include <sys/types.h>
568 #include <sys/statvfs.h>
569   main ()
570   {
571     struct statvfs64 fsd;
572     exit (statfs64 (".", &fsd));
573   }],
574   fu_cv_sys_stat_statvfs64=yes,
575   fu_cv_sys_stat_statvfs64=no)])
576   if test $fu_cv_sys_stat_statvfs64 = yes; then
577     space=yes
578     AC_DEFINE(STAT_STATVFS64)
579   fi
580 fi
581
582 # Perform only the link test since it seems there are no variants of the
583 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
584 # because that got a false positive on SCO OSR5.  Adding the declaration
585 # of a `struct statvfs' causes this test to fail (as it should) on such
586 # systems.  That system is reported to work fine with STAT_STATFS4 which
587 # is what it gets when this test fails.
588 if test $space = no; then
589   # SVR4
590   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
591                  [AC_TRY_LINK([#include <sys/types.h>
592 #include <sys/statvfs.h>],
593                               [struct statvfs fsd; statvfs (0, &fsd);],
594                               fu_cv_sys_stat_statvfs=yes,
595                               fu_cv_sys_stat_statvfs=no)])
596   if test $fu_cv_sys_stat_statvfs = yes; then
597     space=yes
598     AC_DEFINE(STAT_STATVFS)
599   fi
600 fi
601
602 if test $space = no; then
603   # DEC Alpha running OSF/1
604   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
605   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
606   [AC_TRY_RUN([
607 #include <sys/param.h>
608 #include <sys/types.h>
609 #include <sys/mount.h>
610   main ()
611   {
612     struct statfs fsd;
613     fsd.f_fsize = 0;
614     exit (statfs (".", &fsd, sizeof (struct statfs)));
615   }],
616   fu_cv_sys_stat_statfs3_osf1=yes,
617   fu_cv_sys_stat_statfs3_osf1=no,
618   fu_cv_sys_stat_statfs3_osf1=no)])
619   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
620   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
621     space=yes
622     AC_DEFINE(STAT_STATFS3_OSF1)
623   fi
624 fi
625
626 if test $space = no; then
627 # AIX
628   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
629 member (AIX, 4.3BSD)])
630   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
631   [AC_TRY_RUN([
632 #ifdef HAVE_SYS_PARAM_H
633 #include <sys/param.h>
634 #endif
635 #ifdef HAVE_SYS_MOUNT_H
636 #include <sys/mount.h>
637 #endif
638 #ifdef HAVE_SYS_VFS_H
639 #include <sys/vfs.h>
640 #endif
641   main ()
642   {
643   struct statfs fsd;
644   fsd.f_bsize = 0;
645   exit (statfs (".", &fsd));
646   }],
647   fu_cv_sys_stat_statfs2_bsize=yes,
648   fu_cv_sys_stat_statfs2_bsize=no,
649   fu_cv_sys_stat_statfs2_bsize=no)])
650   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
651   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
652     space=yes
653     AC_DEFINE(STAT_STATFS2_BSIZE)
654   fi
655 fi
656
657 if test $space = no; then
658 # SVR3
659   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
660   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
661   [AC_TRY_RUN([#include <sys/types.h>
662 #include <sys/statfs.h>
663   main ()
664   {
665   struct statfs fsd;
666   exit (statfs (".", &fsd, sizeof fsd, 0));
667   }],
668     fu_cv_sys_stat_statfs4=yes,
669     fu_cv_sys_stat_statfs4=no,
670     fu_cv_sys_stat_statfs4=no)])
671   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
672   if test $fu_cv_sys_stat_statfs4 = yes; then
673     space=yes
674     AC_DEFINE(STAT_STATFS4)
675   fi
676 fi
677
678 if test $space = no; then
679 # 4.4BSD and NetBSD
680   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
681 member (4.4BSD and NetBSD)])
682   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
683   [AC_TRY_RUN([#include <sys/types.h>
684 #ifdef HAVE_SYS_PARAM_H
685 #include <sys/param.h>
686 #endif
687 #ifdef HAVE_SYS_MOUNT_H
688 #include <sys/mount.h>
689 #endif
690   main ()
691   {
692   struct statfs fsd;
693   fsd.f_fsize = 0;
694   exit (statfs (".", &fsd));
695   }],
696   fu_cv_sys_stat_statfs2_fsize=yes,
697   fu_cv_sys_stat_statfs2_fsize=no,
698   fu_cv_sys_stat_statfs2_fsize=no)])
699   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
700   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
701     space=yes
702     AC_DEFINE(STAT_STATFS2_FSIZE)
703   fi
704 fi
705
706 if test $space = no; then
707   # Ultrix
708   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
709   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
710   [AC_TRY_RUN([#include <sys/types.h>
711 #ifdef HAVE_SYS_PARAM_H
712 #include <sys/param.h>
713 #endif
714 #ifdef HAVE_SYS_MOUNT_H
715 #include <sys/mount.h>
716 #endif
717 #ifdef HAVE_SYS_FS_TYPES_H
718 #include <sys/fs_types.h>
719 #endif
720   main ()
721   {
722   struct fs_data fsd;
723   /* Ultrix's statfs returns 1 for success,
724      0 for not mounted, -1 for failure.  */
725   exit (statfs (".", &fsd) != 1);
726   }],
727   fu_cv_sys_stat_fs_data=yes,
728   fu_cv_sys_stat_fs_data=no,
729   fu_cv_sys_stat_fs_data=no)])
730   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
731   if test $fu_cv_sys_stat_fs_data = yes; then
732     space=yes
733     AC_DEFINE(STAT_STATFS2_FS_DATA)
734   fi
735 fi
736
737 echo "checking configure summary"
738 AC_TRY_RUN([#include "tests/summary.c"],
739            echo "configure OK";,
740            echo ERROR - summary failure. Aborting config; exit 1)
741
742
743 AC_OUTPUT(Makefile tests/dummy client/dummy lib/dummy ubiqx/dummy
744 web/dummy param/dummy nmbd/dummy smbd/dummy rpc_server/dummy
745 rpc_parse/dummy script/dummy include/dummy codepages/dummy
746 libsmb/dummy bin/dummy printing/dummy)