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 rpcsvc/yp_prot.h rpcsvc/ypclnt.h sys/param.h ctype.h )
33 AC_CHECK_HEADERS(sys/wait.hsys/resource.h sys/ioctl.h sys/mode.h)
34 AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
35 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
36 AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
37 AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
41 AC_CHECK_SIZEOF(short)
55 AC_CHECK_TYPE(ino_t,unsigned)
57 echo $ac_n "checking for errno in errno.h... $ac_c"
58 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
59 echo yes; AC_DEFINE(HAVE_ERRNO_DECL),
62 # stupid glibc has the functions but no declaration. grrrr.
63 echo $ac_n "checking for setresuid declaration $ac_c"
64 AC_TRY_COMPILE([#include <unistd.h>],[int i = setresuid],
65 echo yes; AC_DEFINE(HAVE_SETRESUID_DECL),
68 # and glibc has setresuid under linux but the function does
69 # nothing until kernel 2.1.44! very dumb.
70 echo $ac_n "checking for real setresuid $ac_c"
71 AC_TRY_RUN([#include <errno.h>
72 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
73 echo yes;AC_DEFINE(HAVE_SETRESUID),
79 ###############################################
80 # test for where we get crypt() from
81 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
82 AC_CHECK_LIB(crypt, crypt)
85 if test "$ac_cv_lib_crypt_crypt" = "no" ||
86 test "$ac_cv_lib_crypt_crypt" = ""; then
88 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT),
91 *) AC_CHECK_LIB(crypt, crypt) ;;
93 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
100 ###############################################
101 # test for where we get pam_authenticate() from
102 # might need libdl for this to work
103 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
106 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
107 AC_CHECK_LIB(pam, pam_authenticate)
108 AC_DEFINE(HAVE_PAM_AUTHENTICATE)
110 if test "$ac_cv_lib_pam_pam_authenticate" = "no" ||
111 test "$ac_cv_lib_pam_pam_authenticate" = ""; then
112 # look for pam_authenticate
113 AC_CHECK_FUNC(pam_authenticate, AC_DEFINE(HAVE_PAM_AUTHENTICATE),
116 *) AC_CHECK_LIB(pam, pam_authenticate) ;;
118 if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
119 ac_cv_func_pam_authenticate=yes
120 AC_DEFINE(HAVE_PAM_AUTHENTICATE)
124 # The following test taken from the cvs sources
125 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
126 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
127 # libsocket.so which has a bad implementation of gethostbyname (it
128 # only looks in /etc/hosts), so we only look for -lsocket if we need
130 AC_CHECK_FUNC(connect, :,
133 *) AC_CHECK_LIB(nsl_s, printf) ;;
137 *) AC_CHECK_LIB(nsl, printf) ;;
141 *) AC_CHECK_LIB(socket, connect) ;;
145 *) AC_CHECK_LIB(inet, connect) ;;
147 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
149 if test "$ac_cv_lib_socket_connect" = "yes" ||
150 test "$ac_cv_lib_inet_connect" = "yes"; then
151 ac_cv_func_connect=yes
152 AC_DEFINE(HAVE_CONNECT)
156 AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot)
157 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
158 AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid)
159 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
160 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
161 AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate)
162 AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2)
163 AC_CHECK_FUNCS(bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
165 echo $ac_n "checking for long long ... $ac_c"
166 AC_TRY_RUN([#include <stdio.h>
167 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
168 echo yes;AC_DEFINE(HAVE_LONGLONG),
171 echo $ac_n "checking for off64_t ... $ac_c"
172 AC_TRY_RUN([#include <stdio.h>
173 #include <sys/stat.h>
174 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
175 echo yes;AC_DEFINE(HAVE_OFF64_T),
178 echo $ac_n "checking for union semun ... $ac_c"
180 #include <sys/types.h>
183 main() { union semun ss; exit(0); }],
184 echo yes;AC_DEFINE(HAVE_UNION_SEMUN),
187 echo $ac_n "checking for unsigned char ... $ac_c"
188 AC_TRY_RUN([#include <stdio.h>
189 main() { char c; c=250; exit((c > 0)?0:1); }],
190 echo yes;AC_DEFINE(HAVE_UNSIGNED_CHAR),
193 echo $ac_n "checking for sin_len in sock ... $ac_c"
194 AC_TRY_COMPILE([#include <sys/types.h>
195 #include <sys/socket.h>
196 #include <netinet/in.h>],
197 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
198 echo yes;AC_DEFINE(HAVE_SOCK_SIN_LEN),
201 echo $ac_n "checking for __FILE__ macro ... $ac_c"
202 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
203 echo yes;AC_DEFINE(HAVE_FILE_MACRO),
206 echo $ac_n "checking for __FUNCTION__ macro ... $ac_c"
207 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
208 echo yes;AC_DEFINE(HAVE_FUNCTION_MACRO),
211 echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
213 #include <sys/time.h>
215 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
216 echo yes;AC_DEFINE(HAVE_GETTIMEOFDAY_TZ),
220 echo $ac_n "checking for broken readdir ... $ac_c"
221 AC_TRY_RUN([#include <sys/types.h>
223 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
224 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
225 di->d_name[0] == 0) exit(0); exit(1);} ],
226 echo yes - you are using the broken /usr/ucb/cc;AC_DEFINE(HAVE_BROKEN_READDIR),
229 echo $ac_n "checking for utimbuf ... $ac_c"
230 AC_TRY_COMPILE([#include <sys/types.h>
232 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
233 echo yes;AC_DEFINE(HAVE_UTIMBUF),
236 echo $ac_n "checking for ftruncate extend ... $ac_c"
237 AC_TRY_RUN([#include "tests/ftruncate.c"],
238 echo yes;AC_DEFINE(HAVE_FTRUNCATE_EXTEND),
241 echo $ac_n "checking for broken getgroups ... $ac_c"
242 AC_TRY_RUN([#include "tests/getgroups.c"],
243 echo yes;AC_DEFINE(HAVE_BROKEN_GETGROUPS),
247 echo $ac_n "checking for broken inet_ntoa ... $ac_c"
250 #include <sys/types.h>
251 #include <netinet/in.h>
252 #include <arpa/inet.h>
253 main() { struct in_addr ip; ip.s_addr = 0x12345678;
254 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
255 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
257 echo yes;AC_DEFINE(REPLACE_INET_NTOA),
260 echo $ac_n "checking for root ... $ac_c"
261 AC_TRY_RUN([main() { exit(getuid() != 0); }],
262 echo yes;AC_DEFINE(HAVE_ROOT),
263 echo WARNING: running as non-root will disable some tests;)
266 echo $ac_n "checking for netmask ifconf ... $ac_c"
268 #define HAVE_NETMASK_IFCONF 1
270 #include "lib/netmask.c"],
271 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF),
274 if test $netmask = no; then
275 echo $ac_n "checking for netmask ifreq ... $ac_c"
277 #define HAVE_NETMASK_IFREQ 1
279 #include "lib/netmask.c"],
280 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ),
284 if test $netmask = no; then
285 echo $ac_n "checking for netmask AIX ... $ac_c"
287 #define HAVE_NETMASK_AIX 1
289 #include "lib/netmask.c"],
290 echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX),
294 echo $ac_n "checking for trapdoor seteuid ... $ac_c"
295 AC_TRY_RUN([#include "tests/trapdoor.c"],
297 echo yes;AC_DEFINE(HAVE_TRAPDOOR_UID))
299 echo $ac_n "checking for shared mmap ... $ac_c"
300 AC_TRY_RUN([#include "tests/shared_mmap.c"],
301 echo yes;AC_DEFINE(HAVE_SHARED_MMAP),
304 echo $ac_n "checking for fcntl locking ... $ac_c"
305 AC_TRY_RUN([#include "tests/fcntl_lock.c"],
306 echo yes;AC_DEFINE(HAVE_FCNTL_LOCK),
309 echo $ac_n "checking for sysv ipc ... $ac_c"
310 AC_TRY_RUN([#include "tests/sysv_ipc.c"],
311 echo yes;AC_DEFINE(HAVE_SYSV_IPC),
314 #################################################
315 # check for the AFS filesystem
316 AC_MSG_CHECKING(whether to use AFS)
318 [ --with-afs Include AFS support
319 --without-afs Don't include AFS support (default)],
333 #################################################
334 # check for the DFS auth system
335 AC_MSG_CHECKING(whether to use DFS auth)
337 [ --with-dfs Include DFS support
338 --without-dfs Don't include DFS support (default)],
351 #################################################
352 # check for automount support
353 AC_MSG_CHECKING(whether to use AUTOMOUNT)
354 AC_ARG_WITH(automount,
355 [ --with-automount Include AUTOMOUNT support
356 --without-automount Don't include AUTOMOUNT support (default)],
360 AC_DEFINE(WITH_AUTOMOUNT)
369 #################################################
370 # check for a LDAP password database
371 AC_MSG_CHECKING(whether to use LDAP password database)
373 [ --with-ldap Include LDAP support
374 --without-ldap Don't include LDAP support (default)],
387 #################################################
388 # check for a NISPLUS password database
389 AC_MSG_CHECKING(whether to use NISPLUS password database)
391 [ --with-nisplus Include NISPLUS password database support
392 --without-nisplus Don't include NISPLUS password database support (default)],
396 AC_DEFINE(WITH_NISPLUS)
405 #################################################
406 # check for a NISPLUS_HOME support
407 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
408 AC_ARG_WITH(nisplus-home,
409 [ --with-nisplus-home Include NISPLUS_HOME support
410 --without-nisplus-home Don't include NISPLUS_HOME support (default)],
414 AC_DEFINE(WITH_NISPLUS_HOME)
423 #################################################
424 # check for the secure socket layer
425 AC_MSG_CHECKING(whether to use SSL)
427 [ --with-ssl Include SSL support
428 --without-ssl Don't include SSL support (default)],
441 #################################################
442 # check for experimental mmap support
443 AC_MSG_CHECKING(whether to use MMAP)
445 [ --with-mmap Include experimental MMAP support
446 --without-mmap Don't include MMAP support (default)],
459 #################################################
460 # check for syslog logging
461 AC_MSG_CHECKING(whether to use syslog logging)
463 [ --with-syslog Include experimental SYSLOG support
464 --without-syslog Don't include SYSLOG support (default)],
468 AC_DEFINE(WITH_SYSLOG)
477 #################################################
478 # check for experimental netatalk resource fork support
479 AC_MSG_CHECKING(whether to support netatalk)
480 AC_ARG_WITH(netatalk,
481 [ --with-netatalk Include experimental Netatalk support
482 --without-netatalk Don't include experimental Netatalk support (default)],
486 AC_DEFINE(WITH_NETATALK)
496 #################################################
497 # these tests are taken from the GNU fileutils package
498 AC_CHECKING(how to get filesystem space usage)
501 # Perform only the link test since it seems there are no variants of the
502 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
503 # because that got a false positive on SCO OSR5. Adding the declaration
504 # of a `struct statvfs' causes this test to fail (as it should) on such
505 # systems. That system is reported to work fine with STAT_STATFS4 which
506 # is what it gets when this test fails.
507 if test $space = no; then
509 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
510 [AC_TRY_LINK([#include <sys/types.h>
511 #include <sys/statvfs.h>],
512 [struct statvfs fsd; statvfs (0, &fsd);],
513 fu_cv_sys_stat_statvfs=yes,
514 fu_cv_sys_stat_statvfs=no)])
515 if test $fu_cv_sys_stat_statvfs = yes; then
517 AC_DEFINE(STAT_STATVFS)
521 if test $space = no; then
522 # DEC Alpha running OSF/1
523 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
524 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
526 #include <sys/param.h>
527 #include <sys/types.h>
528 #include <sys/mount.h>
533 exit (statfs (".", &fsd, sizeof (struct statfs)));
535 fu_cv_sys_stat_statfs3_osf1=yes,
536 fu_cv_sys_stat_statfs3_osf1=no,
537 fu_cv_sys_stat_statfs3_osf1=no)])
538 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
539 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
541 AC_DEFINE(STAT_STATFS3_OSF1)
545 if test $space = no; then
547 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
548 member (AIX, 4.3BSD)])
549 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
551 #ifdef HAVE_SYS_PARAM_H
552 #include <sys/param.h>
554 #ifdef HAVE_SYS_MOUNT_H
555 #include <sys/mount.h>
557 #ifdef HAVE_SYS_VFS_H
564 exit (statfs (".", &fsd));
566 fu_cv_sys_stat_statfs2_bsize=yes,
567 fu_cv_sys_stat_statfs2_bsize=no,
568 fu_cv_sys_stat_statfs2_bsize=no)])
569 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
570 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
572 AC_DEFINE(STAT_STATFS2_BSIZE)
576 if test $space = no; then
578 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
579 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
580 [AC_TRY_RUN([#include <sys/types.h>
581 #include <sys/statfs.h>
585 exit (statfs (".", &fsd, sizeof fsd, 0));
587 fu_cv_sys_stat_statfs4=yes,
588 fu_cv_sys_stat_statfs4=no,
589 fu_cv_sys_stat_statfs4=no)])
590 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
591 if test $fu_cv_sys_stat_statfs4 = yes; then
593 AC_DEFINE(STAT_STATFS4)
597 if test $space = no; then
599 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
600 member (4.4BSD and NetBSD)])
601 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
602 [AC_TRY_RUN([#include <sys/types.h>
603 #ifdef HAVE_SYS_PARAM_H
604 #include <sys/param.h>
606 #ifdef HAVE_SYS_MOUNT_H
607 #include <sys/mount.h>
613 exit (statfs (".", &fsd));
615 fu_cv_sys_stat_statfs2_fsize=yes,
616 fu_cv_sys_stat_statfs2_fsize=no,
617 fu_cv_sys_stat_statfs2_fsize=no)])
618 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
619 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
621 AC_DEFINE(STAT_STATFS2_FSIZE)
625 if test $space = no; then
627 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
628 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
629 [AC_TRY_RUN([#include <sys/types.h>
630 #ifdef HAVE_SYS_PARAM_H
631 #include <sys/param.h>
633 #ifdef HAVE_SYS_MOUNT_H
634 #include <sys/mount.h>
636 #ifdef HAVE_SYS_FS_TYPES_H
637 #include <sys/fs_types.h>
642 /* Ultrix's statfs returns 1 for success,
643 0 for not mounted, -1 for failure. */
644 exit (statfs (".", &fsd) != 1);
646 fu_cv_sys_stat_fs_data=yes,
647 fu_cv_sys_stat_fs_data=no,
648 fu_cv_sys_stat_fs_data=no)])
649 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
650 if test $fu_cv_sys_stat_fs_data = yes; then
652 AC_DEFINE(STAT_STATFS2_FS_DATA)
657 AC_OUTPUT(Makefile tests/dummy client/dummy lib/dummy ubiqx/dummy
658 web/dummy param/dummy nmbd/dummy smbd/dummy rpc_server/dummy
659 rpc_parse/dummy script/dummy include/dummy codepages/dummy
660 libsmb/dummy bin/dummy printing/dummy)