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)
5 dnl Checks for programs.
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);;
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)
44 AC_CHECK_SIZEOF(short)
58 AC_CHECK_TYPE(ino_t,unsigned)
59 AC_CHECK_TYPE(ssize_t, int)
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),
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),
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),
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)
89 if test "$ac_cv_lib_crypt_crypt" = "no" ||
90 test "$ac_cv_lib_crypt_crypt" = ""; then
92 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT),
95 *) AC_CHECK_LIB(crypt, crypt) ;;
97 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
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
110 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
111 AC_CHECK_LIB(pam, pam_authenticate)
112 AC_DEFINE(HAVE_PAM_AUTHENTICATE)
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),
120 *) AC_CHECK_LIB(pam, pam_authenticate) ;;
122 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
123 ac_cv_func_pam_authenticate=yes
124 AC_DEFINE(HAVE_PAM_AUTHENTICATE)
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)
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
141 AC_CHECK_FUNC(connect, :,
144 *) AC_CHECK_LIB(nsl_s, printf) ;;
148 *) AC_CHECK_LIB(nsl, printf) ;;
152 *) AC_CHECK_LIB(socket, connect) ;;
156 *) AC_CHECK_LIB(inet, connect) ;;
158 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
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)
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)
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),
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),
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),
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),
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),
210 echo $ac_n "checking for union semun ... $ac_c"
212 #include <sys/types.h>
215 main() { union semun ss; exit(0); }],
216 echo yes;AC_DEFINE(HAVE_UNION_SEMUN),
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),
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),
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),
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),
243 echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
245 #include <sys/time.h>
247 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
248 echo yes;AC_DEFINE(HAVE_GETTIMEOFDAY_TZ),
252 echo $ac_n "checking for broken readdir ... $ac_c"
253 AC_TRY_RUN([#include <sys/types.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),
261 echo $ac_n "checking for utimbuf ... $ac_c"
262 AC_TRY_COMPILE([#include <sys/types.h>
264 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
265 echo yes;AC_DEFINE(HAVE_UTIMBUF),
269 echo $ac_n "checking for test routines ... $ac_c"
270 AC_TRY_RUN([#include "tests/trivial.c"],
272 echo ERROR - cant find test code. Aborting config; exit 1)
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),
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),
285 echo $ac_n "checking for broken inet_ntoa ... $ac_c"
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); }
295 echo yes;AC_DEFINE(REPLACE_INET_NTOA),
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;)
304 echo $ac_n "checking for netmask ifconf ... $ac_c"
306 #define HAVE_NETMASK_IFCONF 1
308 #include "lib/netmask.c"],
309 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF),
312 if test $netmask = no; then
313 echo $ac_n "checking for netmask ifreq ... $ac_c"
315 #define HAVE_NETMASK_IFREQ 1
317 #include "lib/netmask.c"],
318 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ),
322 if test $netmask = no; then
323 echo $ac_n "checking for netmask AIX ... $ac_c"
325 #define HAVE_NETMASK_AIX 1
327 #include "lib/netmask.c"],
328 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX),
332 echo $ac_n "checking for trapdoor seteuid ... $ac_c"
333 AC_TRY_RUN([#include "tests/trapdoor.c"],
335 echo yes;AC_DEFINE(HAVE_TRAPDOOR_UID))
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),
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),
347 echo $ac_n "checking for 64 bit fcntl locking ... $ac_c"
356 #ifdef HAVE_SYS_FCNTL_H
357 #include <sys/fcntl.h>
359 main() { struct flock64 fl64;
360 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
366 echo yes;AC_DEFINE(HAVE_STRUCT_FLOCK64),
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),
374 #################################################
375 # check for the AFS filesystem
376 AC_MSG_CHECKING(whether to use AFS)
378 [ --with-afs Include AFS support
379 --without-afs Don't include AFS support (default)],
393 #################################################
394 # check for the DFS auth system
395 AC_MSG_CHECKING(whether to use DFS auth)
397 [ --with-dfs Include DFS support
398 --without-dfs Don't include DFS support (default)],
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)],
420 AC_DEFINE(WITH_AUTOMOUNT)
429 #################################################
430 # check for a LDAP password database
431 AC_MSG_CHECKING(whether to use LDAP password database)
433 [ --with-ldap Include LDAP support
434 --without-ldap Don't include LDAP support (default)],
447 #################################################
448 # check for a NISPLUS password database
449 AC_MSG_CHECKING(whether to use NISPLUS password database)
451 [ --with-nisplus Include NISPLUS password database support
452 --without-nisplus Don't include NISPLUS password database support (default)],
456 AC_DEFINE(WITH_NISPLUS)
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)],
474 AC_DEFINE(WITH_NISPLUS_HOME)
483 #################################################
484 # check for the secure socket layer
485 AC_MSG_CHECKING(whether to use SSL)
487 [ --with-ssl Include SSL support
488 --without-ssl Don't include SSL support (default)],
501 #################################################
502 # check for experimental mmap support
503 AC_MSG_CHECKING(whether to use MMAP)
505 [ --with-mmap Include experimental MMAP support
506 --without-mmap Don't include MMAP support (default)],
519 #################################################
520 # check for syslog logging
521 AC_MSG_CHECKING(whether to use syslog logging)
523 [ --with-syslog Include experimental SYSLOG support
524 --without-syslog Don't include SYSLOG support (default)],
528 AC_DEFINE(WITH_SYSLOG)
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)],
546 AC_DEFINE(WITH_NETATALK)
556 #################################################
557 # these tests are taken from the GNU fileutils package
558 AC_CHECKING(how to get filesystem space usage)
561 # Test for statvfs64.
562 if test $space = no; then
564 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
566 #include <sys/types.h>
567 #include <sys/statvfs.h>
570 struct statvfs64 fsd;
571 exit (statfs64 (".", &fsd));
573 fu_cv_sys_stat_statvfs64=yes,
574 fu_cv_sys_stat_statvfs64=no)])
575 if test $fu_cv_sys_stat_statvfs64 = yes; then
577 AC_DEFINE(STAT_STATVFS64)
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
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
597 AC_DEFINE(STAT_STATVFS)
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,
606 #include <sys/param.h>
607 #include <sys/types.h>
608 #include <sys/mount.h>
613 exit (statfs (".", &fsd, sizeof (struct statfs)));
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
621 AC_DEFINE(STAT_STATFS3_OSF1)
625 if test $space = no; then
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,
631 #ifdef HAVE_SYS_PARAM_H
632 #include <sys/param.h>
634 #ifdef HAVE_SYS_MOUNT_H
635 #include <sys/mount.h>
637 #ifdef HAVE_SYS_VFS_H
644 exit (statfs (".", &fsd));
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
652 AC_DEFINE(STAT_STATFS2_BSIZE)
656 if test $space = no; then
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>
665 exit (statfs (".", &fsd, sizeof fsd, 0));
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
673 AC_DEFINE(STAT_STATFS4)
677 if test $space = no; then
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>
686 #ifdef HAVE_SYS_MOUNT_H
687 #include <sys/mount.h>
693 exit (statfs (".", &fsd));
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
701 AC_DEFINE(STAT_STATFS2_FSIZE)
705 if test $space = no; then
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>
713 #ifdef HAVE_SYS_MOUNT_H
714 #include <sys/mount.h>
716 #ifdef HAVE_SYS_FS_TYPES_H
717 #include <sys/fs_types.h>
722 /* Ultrix's statfs returns 1 for success,
723 0 for not mounted, -1 for failure. */
724 exit (statfs (".", &fsd) != 1);
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
732 AC_DEFINE(STAT_STATFS2_FS_DATA)
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)
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)