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.hsys/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)
42 AC_CHECK_SIZEOF(short)
56 AC_CHECK_TYPE(ino_t,unsigned)
58 echo $ac_n "checking for errno in errno.h... $ac_c"
59 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
60 echo yes; AC_DEFINE(HAVE_ERRNO_DECL),
63 # stupid glibc has the functions but no declaration. grrrr.
64 echo $ac_n "checking for setresuid declaration $ac_c"
65 AC_TRY_COMPILE([#include <unistd.h>],[int i = setresuid],
66 echo yes; AC_DEFINE(HAVE_SETRESUID_DECL),
69 # and glibc has setresuid under linux but the function does
70 # nothing until kernel 2.1.44! very dumb.
71 echo $ac_n "checking for real setresuid $ac_c"
72 AC_TRY_RUN([#include <errno.h>
73 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
74 echo yes;AC_DEFINE(HAVE_SETRESUID),
80 ###############################################
81 # test for where we get crypt() from
82 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
83 AC_CHECK_LIB(crypt, crypt)
86 if test "$ac_cv_lib_crypt_crypt" = "no" ||
87 test "$ac_cv_lib_crypt_crypt" = ""; then
89 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT),
92 *) AC_CHECK_LIB(crypt, crypt) ;;
94 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
101 ###############################################
102 # test for where we get pam_authenticate() from
103 # might need libdl for this to work
104 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
107 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
108 AC_CHECK_LIB(pam, pam_authenticate)
109 AC_DEFINE(HAVE_PAM_AUTHENTICATE)
111 if test "$ac_cv_lib_pam_pam_authenticate" = "no" ||
112 test "$ac_cv_lib_pam_pam_authenticate" = ""; then
113 # look for pam_authenticate
114 AC_CHECK_FUNC(pam_authenticate, AC_DEFINE(HAVE_PAM_AUTHENTICATE),
117 *) AC_CHECK_LIB(pam, pam_authenticate) ;;
119 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
120 ac_cv_func_pam_authenticate=yes
121 AC_DEFINE(HAVE_PAM_AUTHENTICATE)
125 # The following test taken from the cvs sources
126 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
127 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
128 # libsocket.so which has a bad implementation of gethostbyname (it
129 # only looks in /etc/hosts), so we only look for -lsocket if we need
131 AC_CHECK_FUNC(connect, :,
134 *) AC_CHECK_LIB(nsl_s, printf) ;;
138 *) AC_CHECK_LIB(nsl, printf) ;;
142 *) AC_CHECK_LIB(socket, connect) ;;
146 *) AC_CHECK_LIB(inet, connect) ;;
148 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
150 if test "$ac_cv_lib_socket_connect" = "yes" ||
151 test "$ac_cv_lib_inet_connect" = "yes"; then
152 ac_cv_func_connect=yes
153 AC_DEFINE(HAVE_CONNECT)
157 AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot)
158 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
159 AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid)
160 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
161 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
162 AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate)
163 AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2)
164 AC_CHECK_FUNCS(bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
166 echo $ac_n "checking for long long ... $ac_c"
167 AC_TRY_RUN([#include <stdio.h>
168 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
169 echo yes;AC_DEFINE(HAVE_LONGLONG),
172 echo $ac_n "checking for off64_t ... $ac_c"
173 AC_TRY_RUN([#include <stdio.h>
174 #include <sys/stat.h>
175 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
176 echo yes;AC_DEFINE(HAVE_OFF64_T),
179 echo $ac_n "checking for union semun ... $ac_c"
181 #include <sys/types.h>
184 main() { union semun ss; exit(0); }],
185 echo yes;AC_DEFINE(HAVE_UNION_SEMUN),
188 echo $ac_n "checking for unsigned char ... $ac_c"
189 AC_TRY_RUN([#include <stdio.h>
190 main() { char c; c=250; exit((c > 0)?0:1); }],
191 echo yes;AC_DEFINE(HAVE_UNSIGNED_CHAR),
194 echo $ac_n "checking for sin_len in sock ... $ac_c"
195 AC_TRY_COMPILE([#include <sys/types.h>
196 #include <sys/socket.h>
197 #include <netinet/in.h>],
198 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
199 echo yes;AC_DEFINE(HAVE_SOCK_SIN_LEN),
202 echo $ac_n "checking for __FILE__ macro ... $ac_c"
203 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
204 echo yes;AC_DEFINE(HAVE_FILE_MACRO),
207 echo $ac_n "checking for __FUNCTION__ macro ... $ac_c"
208 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
209 echo yes;AC_DEFINE(HAVE_FUNCTION_MACRO),
212 echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
214 #include <sys/time.h>
216 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
217 echo yes;AC_DEFINE(HAVE_GETTIMEOFDAY_TZ),
221 echo $ac_n "checking for broken readdir ... $ac_c"
222 AC_TRY_RUN([#include <sys/types.h>
224 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
225 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
226 di->d_name[0] == 0) exit(0); exit(1);} ],
227 echo yes - you are using the broken /usr/ucb/cc;AC_DEFINE(HAVE_BROKEN_READDIR),
230 echo $ac_n "checking for utimbuf ... $ac_c"
231 AC_TRY_COMPILE([#include <sys/types.h>
233 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
234 echo yes;AC_DEFINE(HAVE_UTIMBUF),
237 echo $ac_n "checking for ftruncate extend ... $ac_c"
238 AC_TRY_RUN([#include "tests/ftruncate.c"],
239 echo yes;AC_DEFINE(HAVE_FTRUNCATE_EXTEND),
242 echo $ac_n "checking for broken getgroups ... $ac_c"
243 AC_TRY_RUN([#include "tests/getgroups.c"],
244 echo yes;AC_DEFINE(HAVE_BROKEN_GETGROUPS),
248 echo $ac_n "checking for broken inet_ntoa ... $ac_c"
251 #include <sys/types.h>
252 #include <netinet/in.h>
253 #include <arpa/inet.h>
254 main() { struct in_addr ip; ip.s_addr = 0x12345678;
255 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
256 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
258 echo yes;AC_DEFINE(REPLACE_INET_NTOA),
261 echo $ac_n "checking for root ... $ac_c"
262 AC_TRY_RUN([main() { exit(getuid() != 0); }],
263 echo yes;AC_DEFINE(HAVE_ROOT),
264 echo WARNING: running as non-root will disable some tests;)
267 echo $ac_n "checking for netmask ifconf ... $ac_c"
269 #define HAVE_NETMASK_IFCONF 1
271 #include "lib/netmask.c"],
272 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF),
275 if test $netmask = no; then
276 echo $ac_n "checking for netmask ifreq ... $ac_c"
278 #define HAVE_NETMASK_IFREQ 1
280 #include "lib/netmask.c"],
281 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ),
285 if test $netmask = no; then
286 echo $ac_n "checking for netmask AIX ... $ac_c"
288 #define HAVE_NETMASK_AIX 1
290 #include "lib/netmask.c"],
291 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX),
295 echo $ac_n "checking for trapdoor seteuid ... $ac_c"
296 AC_TRY_RUN([#include "tests/trapdoor.c"],
298 echo yes;AC_DEFINE(HAVE_TRAPDOOR_UID))
300 echo $ac_n "checking for shared mmap ... $ac_c"
301 AC_TRY_RUN([#include "tests/shared_mmap.c"],
302 echo yes;AC_DEFINE(HAVE_SHARED_MMAP),
305 echo $ac_n "checking for fcntl locking ... $ac_c"
306 AC_TRY_RUN([#include "tests/fcntl_lock.c"],
307 echo yes;AC_DEFINE(HAVE_FCNTL_LOCK),
310 echo $ac_n "checking for sysv ipc ... $ac_c"
311 AC_TRY_RUN([#include "tests/sysv_ipc.c"],
312 echo yes;AC_DEFINE(HAVE_SYSV_IPC),
315 #################################################
316 # check for the AFS filesystem
317 AC_MSG_CHECKING(whether to use AFS)
319 [ --with-afs Include AFS support
320 --without-afs Don't include AFS support (default)],
334 #################################################
335 # check for the DFS auth system
336 AC_MSG_CHECKING(whether to use DFS auth)
338 [ --with-dfs Include DFS support
339 --without-dfs Don't include DFS support (default)],
352 #################################################
353 # check for automount support
354 AC_MSG_CHECKING(whether to use AUTOMOUNT)
355 AC_ARG_WITH(automount,
356 [ --with-automount Include AUTOMOUNT support
357 --without-automount Don't include AUTOMOUNT support (default)],
361 AC_DEFINE(WITH_AUTOMOUNT)
370 #################################################
371 # check for a LDAP password database
372 AC_MSG_CHECKING(whether to use LDAP password database)
374 [ --with-ldap Include LDAP support
375 --without-ldap Don't include LDAP support (default)],
388 #################################################
389 # check for a NISPLUS password database
390 AC_MSG_CHECKING(whether to use NISPLUS password database)
392 [ --with-nisplus Include NISPLUS password database support
393 --without-nisplus Don't include NISPLUS password database support (default)],
397 AC_DEFINE(WITH_NISPLUS)
406 #################################################
407 # check for a NISPLUS_HOME support
408 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
409 AC_ARG_WITH(nisplus-home,
410 [ --with-nisplus-home Include NISPLUS_HOME support
411 --without-nisplus-home Don't include NISPLUS_HOME support (default)],
415 AC_DEFINE(WITH_NISPLUS_HOME)
424 #################################################
425 # check for the secure socket layer
426 AC_MSG_CHECKING(whether to use SSL)
428 [ --with-ssl Include SSL support
429 --without-ssl Don't include SSL support (default)],
442 #################################################
443 # check for experimental mmap support
444 AC_MSG_CHECKING(whether to use MMAP)
446 [ --with-mmap Include experimental MMAP support
447 --without-mmap Don't include MMAP support (default)],
460 #################################################
461 # check for syslog logging
462 AC_MSG_CHECKING(whether to use syslog logging)
464 [ --with-syslog Include experimental SYSLOG support
465 --without-syslog Don't include SYSLOG support (default)],
469 AC_DEFINE(WITH_SYSLOG)
478 #################################################
479 # check for experimental netatalk resource fork support
480 AC_MSG_CHECKING(whether to support netatalk)
481 AC_ARG_WITH(netatalk,
482 [ --with-netatalk Include experimental Netatalk support
483 --without-netatalk Don't include experimental Netatalk support (default)],
487 AC_DEFINE(WITH_NETATALK)
497 #################################################
498 # these tests are taken from the GNU fileutils package
499 AC_CHECKING(how to get filesystem space usage)
502 # Perform only the link test since it seems there are no variants of the
503 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
504 # because that got a false positive on SCO OSR5. Adding the declaration
505 # of a `struct statvfs' causes this test to fail (as it should) on such
506 # systems. That system is reported to work fine with STAT_STATFS4 which
507 # is what it gets when this test fails.
508 if test $space = no; then
510 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
511 [AC_TRY_LINK([#include <sys/types.h>
512 #include <sys/statvfs.h>],
513 [struct statvfs fsd; statvfs (0, &fsd);],
514 fu_cv_sys_stat_statvfs=yes,
515 fu_cv_sys_stat_statvfs=no)])
516 if test $fu_cv_sys_stat_statvfs = yes; then
518 AC_DEFINE(STAT_STATVFS)
522 if test $space = no; then
523 # DEC Alpha running OSF/1
524 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
525 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
527 #include <sys/param.h>
528 #include <sys/types.h>
529 #include <sys/mount.h>
534 exit (statfs (".", &fsd, sizeof (struct statfs)));
536 fu_cv_sys_stat_statfs3_osf1=yes,
537 fu_cv_sys_stat_statfs3_osf1=no,
538 fu_cv_sys_stat_statfs3_osf1=no)])
539 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
540 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
542 AC_DEFINE(STAT_STATFS3_OSF1)
546 if test $space = no; then
548 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
549 member (AIX, 4.3BSD)])
550 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
552 #ifdef HAVE_SYS_PARAM_H
553 #include <sys/param.h>
555 #ifdef HAVE_SYS_MOUNT_H
556 #include <sys/mount.h>
558 #ifdef HAVE_SYS_VFS_H
565 exit (statfs (".", &fsd));
567 fu_cv_sys_stat_statfs2_bsize=yes,
568 fu_cv_sys_stat_statfs2_bsize=no,
569 fu_cv_sys_stat_statfs2_bsize=no)])
570 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
571 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
573 AC_DEFINE(STAT_STATFS2_BSIZE)
577 if test $space = no; then
579 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
580 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
581 [AC_TRY_RUN([#include <sys/types.h>
582 #include <sys/statfs.h>
586 exit (statfs (".", &fsd, sizeof fsd, 0));
588 fu_cv_sys_stat_statfs4=yes,
589 fu_cv_sys_stat_statfs4=no,
590 fu_cv_sys_stat_statfs4=no)])
591 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
592 if test $fu_cv_sys_stat_statfs4 = yes; then
594 AC_DEFINE(STAT_STATFS4)
598 if test $space = no; then
600 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
601 member (4.4BSD and NetBSD)])
602 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
603 [AC_TRY_RUN([#include <sys/types.h>
604 #ifdef HAVE_SYS_PARAM_H
605 #include <sys/param.h>
607 #ifdef HAVE_SYS_MOUNT_H
608 #include <sys/mount.h>
614 exit (statfs (".", &fsd));
616 fu_cv_sys_stat_statfs2_fsize=yes,
617 fu_cv_sys_stat_statfs2_fsize=no,
618 fu_cv_sys_stat_statfs2_fsize=no)])
619 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
620 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
622 AC_DEFINE(STAT_STATFS2_FSIZE)
626 if test $space = no; then
628 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
629 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
630 [AC_TRY_RUN([#include <sys/types.h>
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_FS_TYPES_H
638 #include <sys/fs_types.h>
643 /* Ultrix's statfs returns 1 for success,
644 0 for not mounted, -1 for failure. */
645 exit (statfs (".", &fsd) != 1);
647 fu_cv_sys_stat_fs_data=yes,
648 fu_cv_sys_stat_fs_data=no,
649 fu_cv_sys_stat_fs_data=no)])
650 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
651 if test $fu_cv_sys_stat_fs_data = yes; then
653 AC_DEFINE(STAT_STATFS2_FS_DATA)
658 AC_OUTPUT(Makefile tests/dummy client/dummy lib/dummy ubiqx/dummy
659 web/dummy param/dummy nmbd/dummy smbd/dummy rpc_server/dummy
660 rpc_parse/dummy script/dummy include/dummy codepages/dummy
661 libsmb/dummy bin/dummy printing/dummy)