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