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 # we want to be compatibe with older versions of Samba
5 AC_PREFIX_DEFAULT(/usr/local/samba)
7 dnl Unique-to-Samba variables we'll be playing with.
16 # compile with optimisation and without debugging by default
19 dnl Checks for programs.
25 AC_VALIDATE_CACHE_SYSTEM_TYPE
29 # Config CPPFLAG settings for strange OS's that must be set
33 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
36 if test $ac_cv_prog_cc_Ae = yes; then
37 CPPFLAGS="$CPPFLAGS -Ae"
41 # AIX4.x is *so* broken. It doesn't even admit to having large
42 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
45 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
54 AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
55 AC_CHECK_HEADERS(sys/param.h ctype.h )
56 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/route.h net/if.h)
57 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h sys/param.h ctype.h )
58 AC_CHECK_HEADERS(sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h sys/mman.h)
59 AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
60 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
61 AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
62 AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
63 AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
64 AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
65 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
67 AC_CHECK_SIZEOF(int,cross)
68 AC_CHECK_SIZEOF(long,cross)
69 AC_CHECK_SIZEOF(short,cross)
84 AC_CHECK_TYPE(ino_t,unsigned)
85 AC_CHECK_TYPE(loff_t,off_t)
86 AC_CHECK_TYPE(offset_t,loff_t)
87 AC_CHECK_TYPE(ssize_t, int)
89 AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
90 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
91 samba_cv_errno=yes,samba_cv_have_errno_decl=no)])
92 if test x"$samba_cv_errno" = x"yes"; then
93 AC_DEFINE(HAVE_ERRNO_DECL)
96 # stupid glibc has the functions but no declaration. grrrr.
97 AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
98 AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresuid],
99 samba_cv_have_setresuid_decl=yes,samba_cv_have_setresuid_decl=no)])
100 if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
101 AC_DEFINE(HAVE_SETRESUID_DECL)
104 # stupid glibc has the functions but no declaration. grrrr.
105 AC_CACHE_CHECK([for crypt declaration],samba_cv_have_crypt_decl,[
106 AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)crypt],
107 samba_cv_have_crypt_decl=yes,samba_cv_have_crypt_decl=no)])
108 if test x"$samba_cv_have_crypt_decl" = x"yes"; then
109 AC_DEFINE(HAVE_CRYPT_DECL)
112 # and glibc has setresuid under linux but the function does
113 # nothing until kernel 2.1.44! very dumb.
114 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
115 AC_TRY_RUN([#include <errno.h>
116 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
117 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
118 if test x"$samba_cv_have_setresuid" = x"yes"; then
119 AC_DEFINE(HAVE_SETRESUID)
124 ###############################################
125 # test for where we get crypt() from
126 AC_CHECK_FUNCS(crypt)
127 if test x"$ac_cv_func_crypt" = x"no"; then
128 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
129 AC_DEFINE(HAVE_CRYPT)])
133 ###############################################
134 # test for where we get pam_authenticate() from
135 # might need libdl for this to work
136 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
137 AC_CHECK_LIB(dl,main)
139 AC_CHECK_FUNCS(pam_authenticate)
140 if test x"$ac_cv_func_pam_authenticate" = x"no"; then
141 AC_CHECK_LIB(pam, pam_authenticate, [LIBS="$LIBS -lpam"
142 AC_DEFINE(HAVE_PAM_AUTHENTICATE)])
146 ###############################################
147 # test for where we get readline() from
148 if test "$ac_cv_header_readline_h" = "yes" ||
149 test "$ac_cv_header_readline_readline_h" = "yes"; then
150 AC_CHECK_LIB(readline,readline)
154 # The following test taken from the cvs sources
155 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
156 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
157 # libsocket.so which has a bad implementation of gethostbyname (it
158 # only looks in /etc/hosts), so we only look for -lsocket if we need
160 AC_CHECK_FUNCS(connect)
161 if test x"$ac_cv_func_connect" = x"no"; then
164 *) AC_CHECK_LIB(nsl_s, printf) ;;
168 *) AC_CHECK_LIB(nsl, printf) ;;
172 *) AC_CHECK_LIB(socket, connect) ;;
176 *) AC_CHECK_LIB(inet, connect) ;;
178 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
180 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
181 test x"$ac_cv_lib_inet_connect" = x"yes"; then
182 # ac_cv_func_connect=yes
183 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
184 AC_DEFINE(HAVE_CONNECT)
189 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod chroot)
190 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
191 AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob strpbrk pipe crypt16 getauthuid)
192 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
193 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf)
194 AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64 fopen64)
195 AC_CHECK_FUNCS(atexit grantpt dup2 lseek64 ftruncate64)
196 AC_CHECK_FUNCS(fseek64 ftell64 setluid yp_get_default_domain getpwanam)
197 AC_CHECK_FUNCS(srandom random srand rand setenv mmap64)
198 # syscall() is needed for smbwrapper.
199 AC_CHECK_FUNCS(syscall)
201 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
202 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
203 AC_CHECK_FUNCS(__getcwd _getcwd)
204 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
205 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
206 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
207 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
208 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
209 AC_CHECK_FUNCS(_write __write _fork __fork)
210 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
211 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
212 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
213 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
214 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
217 # Check for the functions putprpwnam, set_auth_parameters,
218 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
219 # Needed for OSF1 and HPUX.
222 AC_LIBTESTFUNC(security, putprpwnam)
223 AC_LIBTESTFUNC(sec, putprpwnam)
225 AC_LIBTESTFUNC(security, set_auth_parameters)
226 AC_LIBTESTFUNC(sec, set_auth_parameters)
228 AC_LIBTESTFUNC(security, getspnam)
229 AC_LIBTESTFUNC(sec, getspnam)
231 AC_LIBTESTFUNC(security, bigcrypt)
232 AC_LIBTESTFUNC(sec, bigcrypt)
234 AC_LIBTESTFUNC(security, getprpwnam)
235 AC_LIBTESTFUNC(sec, getprpwnam)
237 # this bit needs to be modified for each OS that is suported by
238 # smbwrapper. You need to specify how to created a shared library and
239 # how to compile C code to produce PIC object files
241 # these are the defaults, good for lots of systems
245 # and these are for particular systems
247 *linux*) AC_DEFINE(LINUX);;
248 *solaris*) AC_DEFINE(SUNOS5)
251 *sunos*) AC_DEFINE(SUNOS4)
254 *bsd*) LDSHFLAGS="-shared -Bshareable"
256 *irix*) AC_DEFINE(IRIX)
257 ATTEMPT_WRAP32_BUILD=yes
259 *aix*) AC_DEFINE(AIX);;
260 *hpux*) AC_DEFINE(HPUX);;
261 *qnx*) AC_DEFINE(QNX);;
262 *osf*) AC_DEFINE(OSF1);;
263 *sco*) AC_DEFINE(SCO);;
264 *next2*) AC_DEFINE(NEXT2);;
265 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
266 *sysv4.2*) AC_CHECK_LIB(resolv, strcasecmp);;
269 # try to work out how to produce pic code with this compiler
271 AC_PROG_CC_FLAG(fpic)
272 if test $ac_cv_prog_cc_fpic = yes; then
275 if test x$PICFLAG = x; then
276 AC_PROG_CC_FLAG(Kpic)
277 if test $ac_cv_prog_cc_Kpic = yes; then
281 if test x$PICFLAG = x; then
282 AC_PROG_CC_FLAG(KPIC)
283 if test $ac_cv_prog_cc_KPIC = yes; then
290 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
291 AC_TRY_RUN([#include <stdio.h>
292 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
293 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
294 if test x"$samba_cv_have_longlong" = x"yes"; then
295 AC_DEFINE(HAVE_LONGLONG)
298 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
299 AC_TRY_RUN([#include <stdio.h>
300 #include <sys/stat.h>
301 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
302 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
303 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
304 AC_DEFINE(SIZEOF_OFF_T,8)
307 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
308 AC_TRY_RUN([#include <stdio.h>
309 #include <sys/stat.h>
310 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
311 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
312 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
313 AC_DEFINE(HAVE_OFF64_T)
316 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
317 AC_TRY_RUN([#include <stdio.h>
318 #include <sys/stat.h>
319 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
320 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
321 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
322 AC_DEFINE(SIZEOF_INO_T,8)
325 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
326 AC_TRY_RUN([#include <stdio.h>
327 #include <sys/stat.h>
328 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
329 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
330 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
331 AC_DEFINE(HAVE_INO64_T)
334 AC_CACHE_CHECK([for union semun],samba_cv_HAVE_UNION_SEMUN,[
336 #include <sys/types.h>
339 main() { union semun ss; exit(0); }],
340 samba_cv_HAVE_UNION_SEMUN=yes,samba_cv_HAVE_UNION_SEMUN=no,samba_cv_HAVE_UNION_SEMUN=cross)])
341 if test x"$samba_cv_HAVE_UNION_SEMUN" = x"yes"; then
342 AC_DEFINE(HAVE_UNION_SEMUN)
345 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
346 AC_TRY_RUN([#include <stdio.h>
347 main() { char c; c=250; exit((c > 0)?0:1); }],
348 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
349 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
350 AC_DEFINE(HAVE_UNSIGNED_CHAR)
353 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
354 AC_TRY_COMPILE([#include <sys/types.h>
355 #include <sys/socket.h>
356 #include <netinet/in.h>],
357 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
358 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
359 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
360 AC_DEFINE(HAVE_SOCK_SIN_LEN)
363 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
364 AC_TRY_COMPILE([#include <sys/types.h>
366 void seekdir(DIR *d, long loc) { return; }],[return 0;],
367 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
368 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
369 AC_DEFINE(SEEKDIR_RETURNS_VOID)
372 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
373 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
374 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
375 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
376 AC_DEFINE(HAVE_FILE_MACRO)
379 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
380 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
381 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
382 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
383 AC_DEFINE(HAVE_FUNCTION_MACRO)
386 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
388 #include <sys/time.h>
390 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
391 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
392 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
393 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
397 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
398 AC_TRY_RUN([#include <sys/types.h>
400 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
401 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
402 di->d_name[0] == 0) exit(0); exit(1);} ],
403 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
404 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
405 AC_DEFINE(HAVE_BROKEN_READDIR)
408 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
409 AC_TRY_COMPILE([#include <sys/types.h>
411 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
412 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
413 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
414 AC_DEFINE(HAVE_UTIMBUF)
417 AC_CACHE_CHECK([for kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS,[
418 AC_TRY_COMPILE([#include <sys/types.h>
420 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
421 samba_cv_HAVE_KERNEL_OPLOCKS=yes,samba_cv_HAVE_KERNEL_OPLOCKS=no)])
422 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
423 AC_DEFINE(HAVE_KERNEL_OPLOCKS)
426 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
427 AC_TRY_RUN([#include <sys/types.h>
428 #include <sys/capability.h>
431 if ((cap = cap_get_proc()) == NULL)
433 cap->cap_effective |= CAP_NETWORK_MGT;
434 cap->cap_inheritable |= CAP_NETWORK_MGT;
439 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
440 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
441 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
445 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
446 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
449 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
450 AC_TRY_COMPILE([#include <sys/types.h>
451 #if defined(HAVE_RPC_RPC_H)
455 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
456 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
457 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
460 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
461 AC_TRY_COMPILE([#include <sys/types.h>
462 #if defined(HAVE_RPC_RPC_H)
466 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
467 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
468 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
471 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
472 AC_TRY_COMPILE([#include <sys/types.h>
473 #if defined(HAVE_RPC_RPC_H)
477 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
478 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
479 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
482 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
483 AC_TRY_COMPILE([#include <sys/types.h>
484 #if defined(HAVE_RPC_RPC_H)
488 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
489 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
490 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
493 AC_MSG_CHECKING([for test routines])
494 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
496 AC_MSG_ERROR([cant find test code. Aborting config]),
497 AC_MSG_WARN([cannot run when cross-compiling]))
499 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
500 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
501 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
502 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
503 AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
506 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
507 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
508 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
509 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
510 AC_DEFINE(HAVE_BROKEN_GETGROUPS)
513 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
514 SAVE_CPPFLAGS="$CPPFLAGS"
515 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/include -I${srcdir-.}/ubiqx"
517 #define REPLACE_GETPASS 1
518 #define NO_CONFIG_H 1
519 #define main dont_declare_main
520 #include "${srcdir-.}/lib/getsmbpass.c"
522 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
523 CPPFLAGS="$SAVE_CPPFLAGS"
525 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
526 AC_DEFINE(REPLACE_GETPASS)
529 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
532 #include <sys/types.h>
533 #include <netinet/in.h>
534 #include <arpa/inet.h>
535 main() { struct in_addr ip; ip.s_addr = 0x12345678;
536 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
537 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
539 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
540 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
541 AC_DEFINE(REPLACE_INET_NTOA)
544 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
545 AC_TRY_RUN([main() { exit(getuid() != 0); }],
546 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
547 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
550 AC_MSG_WARN(running as non-root will disable some tests)
554 AC_CACHE_CHECK([for netmask ifconf],samba_cv_HAVE_NETMASK_IFCONF,[
556 #define HAVE_NETMASK_IFCONF 1
558 #include "${srcdir-.}/lib/netmask.c"],
559 samba_cv_HAVE_NETMASK_IFCONF=yes,samba_cv_HAVE_NETMASK_IFCONF=no,samba_cv_HAVE_NETMASK_IFCONF=cross)])
560 if test x"$samba_cv_HAVE_NETMASK_IFCONF" = x"yes"; then
561 netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF)
564 if test $netmask = no; then
565 AC_CACHE_CHECK([for netmask ifreq],samba_cv_HAVE_NETMASK_IFREQ,[
567 #define HAVE_NETMASK_IFREQ 1
569 #include "${srcdir-.}/lib/netmask.c"],
570 samba_cv_HAVE_NETMASK_IFREQ=yes,samba_cv_HAVE_NETMASK_IFREQ=no,samba_cv_HAVE_NETMASK_IFREQ=cross)])
571 if test x"$samba_cv_HAVE_NETMASK_IFREQ" = x"yes"; then
572 netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ)
576 if test $netmask = no; then
577 AC_CACHE_CHECK([for netmask AIX],samba_cv_HAVE_NETMASK_AIX,[
579 #define HAVE_NETMASK_AIX 1
581 #include "${srcdir-.}/lib/netmask.c"],
582 samba_cv_HAVE_NETMASK_AIX=yes,samba_cv_HAVE_NETMASK_AIX=no,samba_cv_HAVE_NETMASK_AIX=cross)])
583 if test x"$samba_cv_HAVE_NETMASK_AIX" = x"yes"; then
584 netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX)
588 AC_CACHE_CHECK([for trapdoor seteuid],samba_cv_HAVE_TRAPDOOR_UID,[
589 AC_TRY_RUN([#include "${srcdir-.}/tests/trapdoor.c"],
590 samba_cv_HAVE_TRAPDOOR_UID=no,samba_cv_HAVE_TRAPDOOR_UID=yes,:)])
591 if test x"$samba_cv_HAVE_TRAPDOOR_UID" = x"yes"; then
592 AC_DEFINE(HAVE_TRAPDOOR_UID)
595 AC_CACHE_CHECK([for shared mmap],samba_cv_HAVE_SHARED_MMAP,[
596 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
597 samba_cv_HAVE_SHARED_MMAP=yes,samba_cv_HAVE_SHARED_MMAP=no,samba_cv_HAVE_SHARED_MMAP=cross)])
598 if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
599 AC_DEFINE(HAVE_SHARED_MMAP)
602 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
603 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
604 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
605 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
606 AC_DEFINE(HAVE_FCNTL_LOCK)
609 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
618 #ifdef HAVE_SYS_FCNTL_H
619 #include <sys/fcntl.h>
621 main() { struct flock64 fl64;
622 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
628 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
629 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
630 AC_DEFINE(HAVE_STRUCT_FLOCK64)
633 AC_CACHE_CHECK([for sysv ipc],samba_cv_HAVE_SYSV_IPC,[
634 AC_TRY_RUN([#include "${srcdir-.}/tests/sysv_ipc.c"],
635 samba_cv_HAVE_SYSV_IPC=yes,samba_cv_HAVE_SYSV_IPC=no,samba_cv_HAVE_SYSV_IPC=cross)])
636 if test x"$samba_cv_HAVE_SYSV_IPC" = x"yes"; then
637 AC_DEFINE(HAVE_SYSV_IPC)
640 #################################################
641 # check for smbwrapper support
642 AC_MSG_CHECKING(whether to use smbwrapper)
643 AC_ARG_WITH(smbwrapper,
644 [ --with-smbwrapper Include SMB wrapper support
645 --without-smbwrapper Don't include SMB wrapper support (default)],
649 AC_DEFINE(WITH_SMBWRAPPER)
650 WRAP="bin/smbsh bin/smbwrapper.so"
652 if test x$ATTEMPT_WRAP32_BUILD = x; then
655 WRAP32=bin/smbwrapper.32.so
658 # Conditions under which smbwrapper should not be built.
660 if test x$PICFLAG = x; then
661 echo No support for PIC code - disabling smbwrapper and smbsh
664 elif test x$ac_cv_func_syscall = xno; then
665 AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
677 #################################################
678 # check for the AFS filesystem
679 AC_MSG_CHECKING(whether to use AFS)
681 [ --with-afs Include AFS support
682 --without-afs Don't include AFS support (default)],
696 #################################################
697 # check for the DFS auth system
698 AC_MSG_CHECKING(whether to use DFS auth)
700 [ --with-dfs Include DFS support
701 --without-dfs Don't include DFS support (default)],
714 #################################################
715 # check for Kerberos IV auth system
716 AC_MSG_CHECKING(whether to use Kerberos IV)
718 [ --with-krb4=base-dir Include Kerberos IV support
719 --whithout-krb4 Don't include Kerbers IV support (default)],
722 AC_CHECK_LIB(resolv, dn_expand)
723 LIBS="$LIBS -lkrb -ldes"
724 CFLAGS="$CFLAGS -I$withval/include"
725 LDFLAGS="$LDFLAGS -L$withval/lib"],
729 #################################################
730 # check for automount support
731 AC_MSG_CHECKING(whether to use AUTOMOUNT)
732 AC_ARG_WITH(automount,
733 [ --with-automount Include AUTOMOUNT support
734 --without-automount Don't include AUTOMOUNT support (default)],
738 AC_DEFINE(WITH_AUTOMOUNT)
747 #################################################
748 # check for smbmount support
749 AC_MSG_CHECKING(whether to use SMBMOUNT)
750 AC_ARG_WITH(smbmount,
751 [ --with-smbmount Include SMBMOUNT (Linux only) support
752 --without-smbmount Don't include SMBMOUNT support (default)],
756 AC_DEFINE(WITH_SMBMOUNT)
757 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
768 #################################################
769 # check for a LDAP password database
770 AC_MSG_CHECKING(whether to use LDAP password database)
772 [ --with-ldap Include LDAP support
773 --without-ldap Don't include LDAP support (default)],
778 LIBS="$LIBS -lldap -llber"
787 #################################################
788 # check for a NISPLUS password database
789 AC_MSG_CHECKING(whether to use NISPLUS password database)
791 [ --with-nisplus Include NISPLUS password database support
792 --without-nisplus Don't include NISPLUS password database support (default)],
796 AC_DEFINE(WITH_NISPLUS)
805 #################################################
806 # check for a NISPLUS_HOME support
807 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
808 AC_ARG_WITH(nisplus-home,
809 [ --with-nisplus-home Include NISPLUS_HOME support
810 --without-nisplus-home Don't include NISPLUS_HOME support (default)],
814 AC_DEFINE(WITH_NISPLUS_HOME)
823 #################################################
824 # check for the secure socket layer
825 AC_MSG_CHECKING(whether to use SSL)
827 [ --with-ssl Include SSL support
828 --without-ssl Don't include SSL support (default)],
841 #################################################
842 # check for experimental mmap support
843 AC_MSG_CHECKING(whether to use MMAP)
845 [ --with-mmap Include experimental MMAP support
846 --without-mmap Don't include MMAP support (default)],
859 #################################################
860 # check for syslog logging
861 AC_MSG_CHECKING(whether to use syslog logging)
863 [ --with-syslog Include experimental SYSLOG support
864 --without-syslog Don't include SYSLOG support (default)],
868 AC_DEFINE(WITH_SYSLOG)
877 #################################################
878 # check for experimental netatalk resource fork support
879 AC_MSG_CHECKING(whether to support netatalk)
880 AC_ARG_WITH(netatalk,
881 [ --with-netatalk Include experimental Netatalk support
882 --without-netatalk Don't include experimental Netatalk support (default)],
886 AC_DEFINE(WITH_NETATALK)
895 #################################################
896 # check for experimental disk-quotas support
899 AC_MSG_CHECKING(whether to support disk-quotas)
901 [ --with-quotas Include experimental disk-quota support
902 --without-quotas Don't include experimental disk-quota support (default)],
916 #################################################
917 # these tests are taken from the GNU fileutils package
918 AC_CHECKING(how to get filesystem space usage)
921 # Test for statvfs64.
922 if test $space = no; then
924 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
926 #include <sys/types.h>
927 #include <sys/statvfs.h>
930 struct statvfs64 fsd;
931 exit (statfs64 (".", &fsd));
933 fu_cv_sys_stat_statvfs64=yes,
934 fu_cv_sys_stat_statvfs64=no,
935 fu_cv_sys_stat_statvfs64=cross)])
936 if test $fu_cv_sys_stat_statvfs64 = yes; then
938 AC_DEFINE(STAT_STATVFS64)
942 # Perform only the link test since it seems there are no variants of the
943 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
944 # because that got a false positive on SCO OSR5. Adding the declaration
945 # of a `struct statvfs' causes this test to fail (as it should) on such
946 # systems. That system is reported to work fine with STAT_STATFS4 which
947 # is what it gets when this test fails.
948 if test $space = no; then
950 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
951 [AC_TRY_LINK([#include <sys/types.h>
952 #include <sys/statvfs.h>],
953 [struct statvfs fsd; statvfs (0, &fsd);],
954 fu_cv_sys_stat_statvfs=yes,
955 fu_cv_sys_stat_statvfs=no)])
956 if test $fu_cv_sys_stat_statvfs = yes; then
958 AC_DEFINE(STAT_STATVFS)
962 if test $space = no; then
963 # DEC Alpha running OSF/1
964 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
965 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
967 #include <sys/param.h>
968 #include <sys/types.h>
969 #include <sys/mount.h>
974 exit (statfs (".", &fsd, sizeof (struct statfs)));
976 fu_cv_sys_stat_statfs3_osf1=yes,
977 fu_cv_sys_stat_statfs3_osf1=no,
978 fu_cv_sys_stat_statfs3_osf1=no)])
979 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
980 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
982 AC_DEFINE(STAT_STATFS3_OSF1)
986 if test $space = no; then
988 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
989 member (AIX, 4.3BSD)])
990 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
992 #ifdef HAVE_SYS_PARAM_H
993 #include <sys/param.h>
995 #ifdef HAVE_SYS_MOUNT_H
996 #include <sys/mount.h>
998 #ifdef HAVE_SYS_VFS_H
1005 exit (statfs (".", &fsd));
1007 fu_cv_sys_stat_statfs2_bsize=yes,
1008 fu_cv_sys_stat_statfs2_bsize=no,
1009 fu_cv_sys_stat_statfs2_bsize=no)])
1010 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
1011 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
1013 AC_DEFINE(STAT_STATFS2_BSIZE)
1017 if test $space = no; then
1019 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
1020 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
1021 [AC_TRY_RUN([#include <sys/types.h>
1022 #include <sys/statfs.h>
1026 exit (statfs (".", &fsd, sizeof fsd, 0));
1028 fu_cv_sys_stat_statfs4=yes,
1029 fu_cv_sys_stat_statfs4=no,
1030 fu_cv_sys_stat_statfs4=no)])
1031 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
1032 if test $fu_cv_sys_stat_statfs4 = yes; then
1034 AC_DEFINE(STAT_STATFS4)
1038 if test $space = no; then
1040 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
1041 member (4.4BSD and NetBSD)])
1042 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
1043 [AC_TRY_RUN([#include <sys/types.h>
1044 #ifdef HAVE_SYS_PARAM_H
1045 #include <sys/param.h>
1047 #ifdef HAVE_SYS_MOUNT_H
1048 #include <sys/mount.h>
1054 exit (statfs (".", &fsd));
1056 fu_cv_sys_stat_statfs2_fsize=yes,
1057 fu_cv_sys_stat_statfs2_fsize=no,
1058 fu_cv_sys_stat_statfs2_fsize=no)])
1059 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
1060 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
1062 AC_DEFINE(STAT_STATFS2_FSIZE)
1066 if test $space = no; then
1068 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1069 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1070 [AC_TRY_RUN([#include <sys/types.h>
1071 #ifdef HAVE_SYS_PARAM_H
1072 #include <sys/param.h>
1074 #ifdef HAVE_SYS_MOUNT_H
1075 #include <sys/mount.h>
1077 #ifdef HAVE_SYS_FS_TYPES_H
1078 #include <sys/fs_types.h>
1083 /* Ultrix's statfs returns 1 for success,
1084 0 for not mounted, -1 for failure. */
1085 exit (statfs (".", &fsd) != 1);
1087 fu_cv_sys_stat_fs_data=yes,
1088 fu_cv_sys_stat_fs_data=no,
1089 fu_cv_sys_stat_fs_data=no)])
1090 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1091 if test $fu_cv_sys_stat_fs_data = yes; then
1093 AC_DEFINE(STAT_STATFS2_FS_DATA)
1097 echo "checking configure summary"
1098 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
1099 echo "configure OK";,
1100 AC_MSG_ERROR([summary failure. Aborting config]),:)
1105 AC_OUTPUT(include/stamp-h Makefile)