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)
133 AC_DEFINE(HAVE_LIBREADLINE)
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
142 AC_CHECK_FUNC(connect, :,
145 *) AC_CHECK_LIB(nsl_s, printf) ;;
149 *) AC_CHECK_LIB(nsl, printf) ;;
153 *) AC_CHECK_LIB(socket, connect) ;;
157 *) AC_CHECK_LIB(inet, connect) ;;
159 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
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)
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)
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),
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),
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),
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),
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),
211 echo $ac_n "checking for union semun ... $ac_c"
213 #include <sys/types.h>
216 main() { union semun ss; exit(0); }],
217 echo yes;AC_DEFINE(HAVE_UNION_SEMUN),
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),
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),
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),
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),
244 echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
246 #include <sys/time.h>
248 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
249 echo yes;AC_DEFINE(HAVE_GETTIMEOFDAY_TZ),
253 echo $ac_n "checking for broken readdir ... $ac_c"
254 AC_TRY_RUN([#include <sys/types.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),
262 echo $ac_n "checking for utimbuf ... $ac_c"
263 AC_TRY_COMPILE([#include <sys/types.h>
265 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
266 echo yes;AC_DEFINE(HAVE_UTIMBUF),
270 echo $ac_n "checking for test routines ... $ac_c"
271 AC_TRY_RUN([#include "tests/trivial.c"],
273 echo ERROR - cant find test code. Aborting config; exit 1)
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),
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),
286 echo $ac_n "checking for broken inet_ntoa ... $ac_c"
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); }
296 echo yes;AC_DEFINE(REPLACE_INET_NTOA),
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;)
305 echo $ac_n "checking for netmask ifconf ... $ac_c"
307 #define HAVE_NETMASK_IFCONF 1
309 #include "lib/netmask.c"],
310 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF),
313 if test $netmask = no; then
314 echo $ac_n "checking for netmask ifreq ... $ac_c"
316 #define HAVE_NETMASK_IFREQ 1
318 #include "lib/netmask.c"],
319 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ),
323 if test $netmask = no; then
324 echo $ac_n "checking for netmask AIX ... $ac_c"
326 #define HAVE_NETMASK_AIX 1
328 #include "lib/netmask.c"],
329 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX),
333 echo $ac_n "checking for trapdoor seteuid ... $ac_c"
334 AC_TRY_RUN([#include "tests/trapdoor.c"],
336 echo yes;AC_DEFINE(HAVE_TRAPDOOR_UID))
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),
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),
348 echo $ac_n "checking for 64 bit fcntl locking ... $ac_c"
357 #ifdef HAVE_SYS_FCNTL_H
358 #include <sys/fcntl.h>
360 main() { struct flock64 fl64;
361 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
367 echo yes;AC_DEFINE(HAVE_STRUCT_FLOCK64),
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),
375 #################################################
376 # check for the AFS filesystem
377 AC_MSG_CHECKING(whether to use AFS)
379 [ --with-afs Include AFS support
380 --without-afs Don't include AFS support (default)],
394 #################################################
395 # check for the DFS auth system
396 AC_MSG_CHECKING(whether to use DFS auth)
398 [ --with-dfs Include DFS support
399 --without-dfs Don't include DFS support (default)],
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)],
421 AC_DEFINE(WITH_AUTOMOUNT)
430 #################################################
431 # check for a LDAP password database
432 AC_MSG_CHECKING(whether to use LDAP password database)
434 [ --with-ldap Include LDAP support
435 --without-ldap Don't include LDAP support (default)],
448 #################################################
449 # check for a NISPLUS password database
450 AC_MSG_CHECKING(whether to use NISPLUS password database)
452 [ --with-nisplus Include NISPLUS password database support
453 --without-nisplus Don't include NISPLUS password database support (default)],
457 AC_DEFINE(WITH_NISPLUS)
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)],
475 AC_DEFINE(WITH_NISPLUS_HOME)
484 #################################################
485 # check for the secure socket layer
486 AC_MSG_CHECKING(whether to use SSL)
488 [ --with-ssl Include SSL support
489 --without-ssl Don't include SSL support (default)],
502 #################################################
503 # check for experimental mmap support
504 AC_MSG_CHECKING(whether to use MMAP)
506 [ --with-mmap Include experimental MMAP support
507 --without-mmap Don't include MMAP support (default)],
520 #################################################
521 # check for syslog logging
522 AC_MSG_CHECKING(whether to use syslog logging)
524 [ --with-syslog Include experimental SYSLOG support
525 --without-syslog Don't include SYSLOG support (default)],
529 AC_DEFINE(WITH_SYSLOG)
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)],
547 AC_DEFINE(WITH_NETATALK)
557 #################################################
558 # these tests are taken from the GNU fileutils package
559 AC_CHECKING(how to get filesystem space usage)
562 # Test for statvfs64.
563 if test $space = no; then
565 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
567 #include <sys/types.h>
568 #include <sys/statvfs.h>
571 struct statvfs64 fsd;
572 exit (statfs64 (".", &fsd));
574 fu_cv_sys_stat_statvfs64=yes,
575 fu_cv_sys_stat_statvfs64=no)])
576 if test $fu_cv_sys_stat_statvfs64 = yes; then
578 AC_DEFINE(STAT_STATVFS64)
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
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
598 AC_DEFINE(STAT_STATVFS)
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,
607 #include <sys/param.h>
608 #include <sys/types.h>
609 #include <sys/mount.h>
614 exit (statfs (".", &fsd, sizeof (struct statfs)));
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
622 AC_DEFINE(STAT_STATFS3_OSF1)
626 if test $space = no; then
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,
632 #ifdef HAVE_SYS_PARAM_H
633 #include <sys/param.h>
635 #ifdef HAVE_SYS_MOUNT_H
636 #include <sys/mount.h>
638 #ifdef HAVE_SYS_VFS_H
645 exit (statfs (".", &fsd));
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
653 AC_DEFINE(STAT_STATFS2_BSIZE)
657 if test $space = no; then
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>
666 exit (statfs (".", &fsd, sizeof fsd, 0));
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
674 AC_DEFINE(STAT_STATFS4)
678 if test $space = no; then
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>
687 #ifdef HAVE_SYS_MOUNT_H
688 #include <sys/mount.h>
694 exit (statfs (".", &fsd));
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
702 AC_DEFINE(STAT_STATFS2_FSIZE)
706 if test $space = no; then
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>
714 #ifdef HAVE_SYS_MOUNT_H
715 #include <sys/mount.h>
717 #ifdef HAVE_SYS_FS_TYPES_H
718 #include <sys/fs_types.h>
723 /* Ultrix's statfs returns 1 for success,
724 0 for not mounted, -1 for failure. */
725 exit (statfs (".", &fsd) != 1);
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
733 AC_DEFINE(STAT_STATFS2_FS_DATA)
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)
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)