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.
21 AC_SUBST(LIBSMBCLIENT_SHARED)
23 # compile with optimisation and without debugging by default
26 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
27 [if eval "test x$enable_debug = xyes"; then
31 AC_ARG_ENABLE(developer, [ --enable-developer turn on developer warnings and debugging [default=no]],
32 [if eval "test x$enable_developer = xyes"; then
33 CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
36 dnl Checks for programs.
41 dnl needed before AC_TRY_COMPILE
44 dnl Check if C compiler understands -c and -o at the same time
46 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
53 dnl Check if the C compiler understands volatile (it should, being ANSI).
54 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
55 AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
56 samba_cv_volatile=yes,samba_cv_volatile=no)])
57 if test x"$samba_cv_volatile" = x"yes"; then
58 AC_DEFINE(HAVE_VOLATILE)
64 dnl Add #include for broken IRIX header files
66 *irix6*) AC_ADD_INCLUDE(<standards.h>)
70 AC_VALIDATE_CACHE_SYSTEM_TYPE
73 # Config CPPFLAG settings for strange OS's that must be set
77 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
80 # mmap on HPUX is completely broken...
81 AC_DEFINE(MMAP_BLACKLIST)
82 if test $ac_cv_prog_cc_Ae = yes; then
83 CPPFLAGS="$CPPFLAGS -Ae"
86 # Defines needed for HPUX support.
87 # HPUX has bigcrypt but (sometimes?) doesn't use it for
88 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
92 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE"
93 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
96 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE"
97 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
102 # AIX4.x doesn't even admit to having large
103 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
106 AC_MSG_RESULT([enabling large file support])
107 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
110 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
111 # to the existance of large files..
112 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
113 # recommendations on large file support, however it makes the
114 # compile work using gcc 2.7 and 2.8, whereas using the Sun
115 # recommendation makes the compile fail on gcc2.7. JRA.
119 5.0*|5.1*|5.2*|5.3*|5.5*)
120 AC_MSG_RESULT([no large file support])
123 AC_MSG_RESULT([enabling large file support])
124 if test "$ac_cv_prog_gcc" = yes; then
125 ${CC-cc} -v >conftest.c 2>&1
126 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
128 case "$ac_cv_gcc_compiler_version_number" in
129 *"gcc version 2.6"*|*"gcc version 2.7"*)
130 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
133 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
137 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
143 # Tests needed for SINIX large file support.
146 if test $host = mips-sni-sysv4 ; then
147 AC_MSG_CHECKING([for LFS support])
148 old_CPPFLAGS="$CPPFLAGS"
149 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
153 #if _LFS64_LARGEFILE == 1
158 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
159 CPPFLAGS="$old_CPPFLAGS"
160 if test x$SINIX_LFS_SUPPORT = xyes ; then
161 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
162 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
163 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
164 LIBS="`getconf LFS64_LIBS` $LIBS"
166 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
170 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
173 AC_MSG_CHECKING([for LFS support])
174 old_CPPFLAGS="$CPPFLAGS"
175 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
178 #include <sys/utsname.h>
180 #if _LFS64_LARGEFILE == 1
185 /* Ensure this is glibc 2.2 or higher */
186 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
187 int libc_major = __GLIBC__;
188 int libc_minor = __GLIBC_MINOR__;
196 /* Ensure this is kernel 2.4 or higher */
199 release = uts.release;
200 major = atoi(strsep(&release, "."));
201 minor = atoi(strsep(&release, "."));
203 if (major > 2 || (major == 2 && minor > 3))
210 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
211 CPPFLAGS="$old_CPPFLAGS"
212 if test x$LINUX_LFS_SUPPORT = xyes ; then
213 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
215 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
219 AC_MSG_CHECKING([for LFS support])
220 old_CPPFLAGS="$CPPFLAGS"
221 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
225 #if _LFS64_LARGEFILE == 1
230 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
231 CPPFLAGS="$old_CPPFLAGS"
232 if test x$GLIBC_LFS_SUPPORT = xyes ; then
233 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
235 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
245 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
246 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
247 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
248 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
249 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
250 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
251 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
252 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h)
255 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
256 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
260 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
261 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
262 if test x"$ac_cv_header_shadow_h" = x"yes"; then
263 AC_DEFINE(HAVE_SHADOW_H)
267 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
268 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
269 AC_CHECK_HEADERS(stropts.h poll.h)
270 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
271 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
273 # For experimental utmp support (lastlog on some BSD-like systems)
274 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
276 # For quotas on Veritas VxFS filesystems
277 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
279 # For quotas on Linux XFS filesystems
280 AC_CHECK_HEADERS(linux/xqm.h)
282 AC_CHECK_SIZEOF(int,cross)
283 AC_CHECK_SIZEOF(long,cross)
284 AC_CHECK_SIZEOF(short,cross)
299 AC_CHECK_TYPE(ino_t,unsigned)
300 AC_CHECK_TYPE(loff_t,off_t)
301 AC_CHECK_TYPE(offset_t,loff_t)
302 AC_CHECK_TYPE(ssize_t, int)
303 AC_CHECK_TYPE(wchar_t, unsigned short)
305 ############################################
306 # for cups support we need libcups, and a handful of header files
308 AC_CHECK_LIB(cups,httpConnect)
310 # I wonder if there is a nicer way of doing this?
312 if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
313 AC_CHECK_HEADERS(cups/cups.h cups/language.h)
314 if test x"$ac_cv_header_cups_cups_h" = x"yes"; then
315 if test x"$ac_cv_header_cups_language_h" = x"yes"; then
321 ############################################
322 # we need libdl for PAM and the new VFS code
323 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
324 AC_DEFINE(HAVE_LIBDL)])
326 ############################################
327 # check if the compiler can do immediate structures
328 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
332 #define X_FOOBAR(x) ((FOOBAR) { x })
333 typedef struct {unsigned x;} FOOBAR;
334 FOOBAR f = X_FOOBAR(1);
336 samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
337 if test x"$samba_cv_immediate_structures" = x"yes"; then
338 AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
341 ############################################
342 # check for unix domain sockets
343 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
345 #include <sys/types.h>
348 #include <sys/socket.h>
349 #include <sys/un.h>],
351 struct sockaddr_un sunaddr;
352 sunaddr.sun_family = AF_UNIX;
354 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
355 if test x"$samba_cv_unixsocket" = x"yes"; then
356 AC_DEFINE(HAVE_UNIXSOCKET)
360 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
362 #include <sys/types.h>
367 #include <sys/socket.h>],[socklen_t i = 0],
368 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
369 if test x"$samba_cv_socklen_t" = x"yes"; then
370 AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
373 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
375 #include <sys/types.h>
380 #include <signal.h>],[sig_atomic_t i = 0],
381 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
382 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
383 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
386 # stupid headers have the functions but no declaration. grrrr.
387 AC_HAVE_DECL(errno, [#include <errno.h>])
388 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
389 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
390 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
391 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
392 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
393 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
395 # and glibc has setresuid under linux but the function does
396 # nothing until kernel 2.1.44! very dumb.
397 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
398 AC_TRY_RUN([#include <errno.h>
399 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
400 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
401 if test x"$samba_cv_have_setresuid" = x"yes"; then
402 AC_DEFINE(HAVE_SETRESUID)
405 # Do the same check for setresguid...
407 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
408 AC_TRY_RUN([#include <unistd.h>
410 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
411 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
412 if test x"$samba_cv_have_setresgid" = x"yes"; then
413 AC_DEFINE(HAVE_SETRESGID)
418 ###############################################
419 # test for where we get crypt() from
420 AC_CHECK_FUNCS(crypt)
421 if test x"$ac_cv_func_crypt" = x"no"; then
422 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
423 AC_DEFINE(HAVE_CRYPT)])
427 ###############################################
428 # Readline included by default unless explicitly asked not to
429 test "${with_readline+set}" != "set" && with_readline=yes
431 # test for where we get readline() from
432 AC_MSG_CHECKING(whether to use readline)
433 AC_ARG_WITH(readline,
434 [ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
435 [ case "$with_readline" in
439 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
440 AC_CHECK_HEADERS(readline/history.h)
442 AC_CHECK_HEADERS(readline.h readline/readline.h,[
443 for termlib in ncurses curses termcap terminfo termlib; do
444 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
446 AC_CHECK_LIB(readline, rl_callback_handler_install,
447 [TERMLIBS="-lreadline $TERMLIBS"
448 AC_DEFINE(HAVE_LIBREADLINE)
449 break], [TERMLIBS=], $TERMLIBS)])
457 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
458 # alternate readline path
460 _cppflags=${CPPFLAGS}
462 # Add additional search path
463 LDFLAGS="-L$with_readline/lib $LDFLAGS"
464 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
466 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
467 AC_CHECK_HEADERS(readline/history.h)
469 AC_CHECK_HEADERS(readline.h readline/readline.h,[
470 for termlib in ncurses curses termcap terminfo termlib; do
471 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
473 AC_CHECK_LIB(readline, rl_callback_handler_install,
474 [TERMLDFLAGS="-L$with_readline/lib"
475 TERMCPPFLAGS="-I$with_readline/include"
476 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
477 TERMLIBS="-lreadline $TERMLIBS"
478 AC_DEFINE(HAVE_LIBREADLINE)
479 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
487 AC_SUBST(TERMLDFLAGS)
489 # The readline API changed slightly from readline3 to readline4, so
490 # code will generate warnings on one of them unless we have a few
492 AC_CHECK_LIB(readline, rl_completion_matches,
493 [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1,
494 [Do we have rl_completion_matches?])],
498 # The following test taken from the cvs sources
499 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
500 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
501 # libsocket.so which has a bad implementation of gethostbyname (it
502 # only looks in /etc/hosts), so we only look for -lsocket if we need
504 AC_CHECK_FUNCS(connect)
505 if test x"$ac_cv_func_connect" = x"no"; then
508 *) AC_CHECK_LIB(nsl_s, printf) ;;
512 *) AC_CHECK_LIB(nsl, printf) ;;
516 *) AC_CHECK_LIB(socket, connect) ;;
520 *) AC_CHECK_LIB(inet, connect) ;;
522 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
524 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
525 test x"$ac_cv_lib_inet_connect" = x"yes"; then
526 # ac_cv_func_connect=yes
527 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
528 AC_DEFINE(HAVE_CONNECT)
532 ###############################################
533 # test for where we get get_yp_default_domain() from
534 AC_CHECK_FUNCS(yp_get_default_domain)
535 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
536 AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
537 AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)])
540 # Check if we have execl, if not we need to compile smbrun.
541 AC_CHECK_FUNCS(execl)
542 if test x"$ac_cv_func_execl" = x"no"; then
548 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
549 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat)
550 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
551 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
552 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
553 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
554 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
555 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
556 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
557 # setbuffer is needed for smbtorture
558 AC_CHECK_FUNCS(setbuffer)
560 # syscall() is needed for smbwrapper.
561 AC_CHECK_FUNCS(syscall)
563 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
564 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
565 AC_CHECK_FUNCS(__getcwd _getcwd)
566 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
567 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
568 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
569 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
570 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
571 AC_CHECK_FUNCS(_write __write _fork __fork)
572 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
573 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
574 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
575 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
576 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
579 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
582 if test x$ac_cv_func_stat64 = xno ; then
583 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
585 #if defined(HAVE_UNISTD_H)
588 #include <sys/stat.h>
589 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
590 AC_MSG_RESULT([$ac_cv_func_stat64])
591 if test x$ac_cv_func_stat64 = xyes ; then
592 AC_DEFINE(HAVE_STAT64)
596 if test x$ac_cv_func_lstat64 = xno ; then
597 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
599 #if defined(HAVE_UNISTD_H)
602 #include <sys/stat.h>
603 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
604 AC_MSG_RESULT([$ac_cv_func_lstat64])
605 if test x$ac_cv_func_lstat64 = xyes ; then
606 AC_DEFINE(HAVE_LSTAT64)
610 if test x$ac_cv_func_fstat64 = xno ; then
611 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
613 #if defined(HAVE_UNISTD_H)
616 #include <sys/stat.h>
617 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
618 AC_MSG_RESULT([$ac_cv_func_fstat64])
619 if test x$ac_cv_func_fstat64 = xyes ; then
620 AC_DEFINE(HAVE_FSTAT64)
624 #####################################
625 # we might need the resolv library on some systems
626 AC_CHECK_LIB(resolv, dn_expand)
629 # Check for the functions putprpwnam, set_auth_parameters,
630 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
631 # Needed for OSF1 and HPUX.
634 AC_LIBTESTFUNC(security, putprpwnam)
635 AC_LIBTESTFUNC(sec, putprpwnam)
637 AC_LIBTESTFUNC(security, set_auth_parameters)
638 AC_LIBTESTFUNC(sec, set_auth_parameters)
640 # UnixWare 7.x has its getspnam in -lgen
641 AC_LIBTESTFUNC(gen, getspnam)
643 AC_LIBTESTFUNC(security, getspnam)
644 AC_LIBTESTFUNC(sec, getspnam)
646 AC_LIBTESTFUNC(security, bigcrypt)
647 AC_LIBTESTFUNC(sec, bigcrypt)
649 AC_LIBTESTFUNC(security, getprpwnam)
650 AC_LIBTESTFUNC(sec, getprpwnam)
652 # this bit needs to be modified for each OS that is suported by
653 # smbwrapper. You need to specify how to created a shared library and
654 # how to compile C code to produce PIC object files
656 # these are the defaults, good for lots of systems
664 # Assume non-shared by default and override below
666 AC_MSG_CHECKING([ability to build shared libraries])
668 # and these are for particular systems
670 *linux*) AC_DEFINE(LINUX)
675 *solaris*) AC_DEFINE(SUNOS5)
677 LDSHFLAGS="-Wl,-h,\$@.so -G"
678 if test "${ac_cv_prog_CC}" = "gcc"; then
686 *sunos*) AC_DEFINE(SUNOS4)
688 LDSHFLAGS="-Wl,-h,\$@ -G"
689 PICFLAG="-KPIC" # Is this correct for SunOS
691 *bsd*) BLDSHARED="true"
692 LDSHFLAGS="-Wl,-soname,\$@ -shared"
695 *irix*) AC_DEFINE(IRIX)
697 *irix6*) AC_DEFINE(IRIX6)
700 ATTEMPT_WRAP32_BUILD=yes
702 LDSHFLAGS="-Wl,-soname,\$@ -shared"
703 if test "${ac_cv_prog_CC}" = "gcc"; then
709 *aix*) AC_DEFINE(AIX)
711 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
712 PICFLAG="-O2 -qmaxmem=6000"
714 *hpux*) AC_DEFINE(HPUX)
716 # Use special PIC flags for the native HP-UX compiler.
717 if test $ac_cv_prog_cc_Ae = yes; then
719 LDSHFLAGS="-b -z +h \$@"
723 *qnx*) AC_DEFINE(QNX);;
724 *osf*) AC_DEFINE(OSF1)
726 LDSHFLAGS="-Wl,-soname,\$@ -shared"
729 *sco*) AC_DEFINE(SCO);;
730 *unixware*) AC_DEFINE(UNIXWARE)
732 LDSHFLAGS="-Wl,-soname,\$@ -shared"
735 *next2*) AC_DEFINE(NEXT2);;
736 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
739 *-univel-*) if [ test "$GCC" != yes ]; then
740 AC_DEFINE(HAVE_MEMSET)
744 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
748 if [ test "$GCC" != yes ]; then
749 AC_DEFINE(HAVE_MEMSET)
754 AC_MSG_RESULT($BLDSHARED)
755 AC_MSG_CHECKING([linker flags for shared libraries])
756 AC_MSG_RESULT([$LDSHFLAGS])
757 AC_MSG_CHECKING([compiler flags for position-independent code])
758 AC_MSG_RESULT([$PICFLAGS])
760 # this updates our target list if we can build shared libs
761 if test $BLDSHARED = true; then
762 LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
769 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
770 AC_TRY_RUN([#include <stdio.h>
771 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
772 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
773 if test x"$samba_cv_have_longlong" = x"yes"; then
774 AC_DEFINE(HAVE_LONGLONG)
778 # Check if the compiler supports the LL prefix on long long integers.
781 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
782 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
783 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
784 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
785 AC_DEFINE(COMPILER_SUPPORTS_LL)
789 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
790 AC_TRY_RUN([#include <stdio.h>
791 #include <sys/stat.h>
792 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
793 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
794 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
795 AC_DEFINE(SIZEOF_OFF_T,8)
798 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
800 #if defined(HAVE_UNISTD_H)
804 #include <sys/stat.h>
805 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
806 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
807 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
808 AC_DEFINE(HAVE_OFF64_T)
811 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
812 AC_TRY_RUN([#include <stdio.h>
813 #include <sys/stat.h>
814 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
815 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
816 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
817 AC_DEFINE(SIZEOF_INO_T,8)
820 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
822 #if defined(HAVE_UNISTD_H)
826 #include <sys/stat.h>
827 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
828 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
829 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
830 AC_DEFINE(HAVE_INO64_T)
833 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
835 #if defined(HAVE_UNISTD_H)
838 #include <sys/types.h>
839 #include <dirent.h>],
840 [struct dirent64 de;],
841 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
842 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
843 AC_DEFINE(HAVE_STRUCT_DIRENT64)
846 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
847 AC_TRY_RUN([#include <stdio.h>
848 main() { char c; c=250; exit((c > 0)?0:1); }],
849 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
850 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
851 AC_DEFINE(HAVE_UNSIGNED_CHAR)
854 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
855 AC_TRY_COMPILE([#include <sys/types.h>
856 #include <sys/socket.h>
857 #include <netinet/in.h>],
858 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
859 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
860 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
861 AC_DEFINE(HAVE_SOCK_SIN_LEN)
864 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
865 AC_TRY_COMPILE([#include <sys/types.h>
867 void seekdir(DIR *d, long loc) { return; }],[return 0;],
868 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
869 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
870 AC_DEFINE(SEEKDIR_RETURNS_VOID)
873 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
874 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
875 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
876 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
877 AC_DEFINE(HAVE_FILE_MACRO)
880 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
881 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
882 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
883 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
884 AC_DEFINE(HAVE_FUNCTION_MACRO)
887 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
889 #include <sys/time.h>
891 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
892 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
893 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
894 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
897 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
899 #include <sys/types.h>
901 void foo(const char *format, ...) {
906 va_start(ap, format);
907 len = vsnprintf(0, 0, format, ap);
909 if (len != 5) exit(1);
911 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
915 main() { foo("hello"); }
917 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
918 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
919 AC_DEFINE(HAVE_C99_VSNPRINTF)
922 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
923 AC_TRY_RUN([#include <sys/types.h>
925 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
926 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
927 di->d_name[0] == 0) exit(0); exit(1);} ],
928 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
929 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
930 AC_DEFINE(HAVE_BROKEN_READDIR)
933 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
934 AC_TRY_COMPILE([#include <sys/types.h>
936 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
937 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
938 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
939 AC_DEFINE(HAVE_UTIMBUF)
942 dnl utmp and utmpx come in many flavours
943 dnl We need to check for many of them
944 dnl But we don't need to do each and every one, because our code uses
945 dnl mostly just the utmp (not utmpx) fields.
947 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
949 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
950 AC_TRY_COMPILE([#include <sys/types.h>
952 [struct utmp ut; ut.ut_name[0] = 'a';],
953 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
954 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
955 AC_DEFINE(HAVE_UT_UT_NAME)
958 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
959 AC_TRY_COMPILE([#include <sys/types.h>
961 [struct utmp ut; ut.ut_user[0] = 'a';],
962 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
963 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
964 AC_DEFINE(HAVE_UT_UT_USER)
967 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
968 AC_TRY_COMPILE([#include <sys/types.h>
970 [struct utmp ut; ut.ut_id[0] = 'a';],
971 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
972 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
973 AC_DEFINE(HAVE_UT_UT_ID)
976 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
977 AC_TRY_COMPILE([#include <sys/types.h>
979 [struct utmp ut; ut.ut_host[0] = 'a';],
980 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
981 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
982 AC_DEFINE(HAVE_UT_UT_HOST)
985 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
986 AC_TRY_COMPILE([#include <sys/types.h>
988 [struct utmp ut; time_t t; ut.ut_time = t;],
989 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
990 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
991 AC_DEFINE(HAVE_UT_UT_TIME)
994 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
995 AC_TRY_COMPILE([#include <sys/types.h>
997 [struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
998 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
999 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1000 AC_DEFINE(HAVE_UT_UT_TV)
1003 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1004 AC_TRY_COMPILE([#include <sys/types.h>
1006 [struct utmp ut; ut.ut_type = 0;],
1007 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1008 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1009 AC_DEFINE(HAVE_UT_UT_TYPE)
1012 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1013 AC_TRY_COMPILE([#include <sys/types.h>
1015 [struct utmp ut; ut.ut_pid = 0;],
1016 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1017 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1018 AC_DEFINE(HAVE_UT_UT_PID)
1021 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1022 AC_TRY_COMPILE([#include <sys/types.h>
1024 [struct utmp ut; ut.ut_exit.e_exit = 0;],
1025 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1026 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1027 AC_DEFINE(HAVE_UT_UT_EXIT)
1030 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1031 AC_TRY_COMPILE([#include <sys/types.h>
1033 [struct utmp ut; ut.ut_addr = 0;],
1034 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1035 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1036 AC_DEFINE(HAVE_UT_UT_ADDR)
1039 if test x$ac_cv_func_pututline = xyes ; then
1040 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1041 AC_TRY_COMPILE([#include <sys/types.h>
1043 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1044 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1045 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1046 AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1050 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1051 AC_TRY_COMPILE([#include <sys/types.h>
1052 #include <utmpx.h>],
1053 [struct utmpx ux; ux.ut_syslen = 0;],
1054 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1055 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1056 AC_DEFINE(HAVE_UX_UT_SYSLEN)
1060 #################################################
1061 # check for libiconv support
1062 AC_MSG_CHECKING(whether to use libiconv)
1063 AC_ARG_WITH(libiconv,
1064 [ --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
1065 [ case "$withval" in
1071 CFLAGS="$CFLAGS -I$withval/include"
1072 LDFLAGS="$LDFLAGS -L$withval/lib"
1073 AC_CHECK_LIB(iconv, iconv_open)
1074 AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}")
1082 # check for iconv in libc
1083 AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1087 iconv_t cd = iconv_open("ASCII", "UCS-2LE");
1088 if (cd == 0 || cd == (iconv_t)-1) return -1;
1092 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
1093 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1094 AC_DEFINE(HAVE_NATIVE_ICONV)
1098 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1100 #include <sys/types.h>
1103 #define F_GETLEASE 1025
1106 int fd = open("/dev/null", O_RDONLY);
1107 return fcntl(fd, F_GETLEASE, 0) == -1;
1110 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1111 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1112 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1115 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1117 #include <sys/types.h>
1121 #define F_NOTIFY 1026
1124 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1127 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1128 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1129 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1132 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1134 #include <sys/types.h>
1137 #include <sys/file.h>
1139 #define LOCK_MAND 32
1140 #define LOCK_READ 64
1143 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1146 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1147 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1148 AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1154 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1155 AC_TRY_COMPILE([#include <sys/types.h>
1156 #include <fcntl.h>],
1157 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1158 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1159 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1160 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1163 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1164 AC_TRY_RUN([#include <sys/types.h>
1165 #include <sys/capability.h>
1168 if ((cap = cap_get_proc()) == NULL)
1170 cap->cap_effective |= CAP_NETWORK_MGT;
1171 cap->cap_inheritable |= CAP_NETWORK_MGT;
1176 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1177 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1178 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1182 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1183 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1186 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1187 AC_TRY_COMPILE([#include <sys/types.h>
1188 #if defined(HAVE_RPC_RPC_H)
1189 #include <rpc/rpc.h>
1192 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1193 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1194 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1197 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1198 AC_TRY_COMPILE([#include <sys/types.h>
1199 #if defined(HAVE_RPC_RPC_H)
1200 #include <rpc/rpc.h>
1203 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1204 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1205 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1208 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1209 AC_TRY_COMPILE([#include <sys/types.h>
1210 #if defined(HAVE_RPC_RPC_H)
1211 #include <rpc/rpc.h>
1214 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1215 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1216 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1219 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1220 AC_TRY_COMPILE([#include <sys/types.h>
1221 #if defined(HAVE_RPC_RPC_H)
1222 #include <rpc/rpc.h>
1225 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1226 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1227 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1231 dnl Some systems (SCO) have a problem including
1232 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1233 dnl as a #define in <prot.h> and as part of an enum
1237 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1238 AC_TRY_COMPILE([#include <sys/types.h>
1239 #ifdef HAVE_SYS_SECURITY_H
1240 #include <sys/security.h>
1242 #endif /* HAVE_SYS_SECURITY_H */
1243 #if defined(HAVE_RPC_RPC_H)
1244 #include <rpc/rpc.h>
1247 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1248 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1249 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1252 AC_MSG_CHECKING([for test routines])
1253 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1255 AC_MSG_ERROR([cant find test code. Aborting config]),
1256 AC_MSG_WARN([cannot run when cross-compiling]))
1258 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1259 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1260 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1261 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1262 AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1265 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1266 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1267 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1268 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1269 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1270 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1272 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1275 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1276 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1277 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1278 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1279 AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1282 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1283 SAVE_CPPFLAGS="$CPPFLAGS"
1284 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
1286 #define REPLACE_GETPASS 1
1287 #define NO_CONFIG_H 1
1288 #define main dont_declare_main
1289 #include "${srcdir-.}/lib/getsmbpass.c"
1291 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1292 CPPFLAGS="$SAVE_CPPFLAGS"
1294 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1295 AC_DEFINE(REPLACE_GETPASS)
1298 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1301 #include <sys/types.h>
1302 #include <netinet/in.h>
1303 #ifdef HAVE_ARPA_INET_H
1304 #include <arpa/inet.h>
1306 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1307 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1308 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1310 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1311 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1312 AC_DEFINE(REPLACE_INET_NTOA)
1315 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1316 AC_TRY_RUN([#include <stdlib.h>
1317 #include <sys/types.h>
1318 #include <sys/stat.h>
1322 char tpl[20]="/tmp/test.XXXXXX";
1323 int fd = mkstemp(tpl);
1324 if (fd == -1) exit(1);
1326 if (fstat(fd, &st) != 0) exit(1);
1327 if ((st.st_mode & 0777) != 0600) exit(1);
1330 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1331 samba_cv_HAVE_SECURE_MKSTEMP=no,
1332 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1333 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1334 AC_DEFINE(HAVE_SECURE_MKSTEMP)
1337 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1338 AC_TRY_RUN([#include <unistd.h>
1339 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1340 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1341 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1342 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1345 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1346 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1347 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1348 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1349 AC_DEFINE(HAVE_ROOT)
1351 AC_MSG_WARN(running as non-root will disable some tests)
1355 # look for a method of finding the list of network interfaces
1357 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1359 #define HAVE_IFACE_AIX 1
1360 #define AUTOCONF_TEST 1
1361 #include "confdefs.h"
1362 #include "${srcdir-.}/lib/interfaces.c"],
1363 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1364 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1365 iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1368 if test $iface = no; then
1369 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1371 #define HAVE_IFACE_IFCONF 1
1372 #define AUTOCONF_TEST 1
1373 #include "confdefs.h"
1374 #include "${srcdir-.}/lib/interfaces.c"],
1375 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1376 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1377 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1381 if test $iface = no; then
1382 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1384 #define HAVE_IFACE_IFREQ 1
1385 #define AUTOCONF_TEST 1
1386 #include "confdefs.h"
1387 #include "${srcdir-.}/lib/interfaces.c"],
1388 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1389 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1390 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1395 ################################################
1396 # look for a method of setting the effective uid
1398 if test $seteuid = no; then
1399 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1401 #define AUTOCONF_TEST 1
1402 #define USE_SETRESUID 1
1403 #include "confdefs.h"
1404 #include "${srcdir-.}/lib/util_sec.c"],
1405 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1406 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1407 seteuid=yes;AC_DEFINE(USE_SETRESUID)
1412 if test $seteuid = no; then
1413 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1415 #define AUTOCONF_TEST 1
1416 #define USE_SETREUID 1
1417 #include "confdefs.h"
1418 #include "${srcdir-.}/lib/util_sec.c"],
1419 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1420 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1421 seteuid=yes;AC_DEFINE(USE_SETREUID)
1425 if test $seteuid = no; then
1426 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1428 #define AUTOCONF_TEST 1
1429 #define USE_SETEUID 1
1430 #include "confdefs.h"
1431 #include "${srcdir-.}/lib/util_sec.c"],
1432 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1433 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1434 seteuid=yes;AC_DEFINE(USE_SETEUID)
1438 if test $seteuid = no; then
1439 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1441 #define AUTOCONF_TEST 1
1442 #define USE_SETUIDX 1
1443 #include "confdefs.h"
1444 #include "${srcdir-.}/lib/util_sec.c"],
1445 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1446 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1447 seteuid=yes;AC_DEFINE(USE_SETUIDX)
1452 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1453 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1454 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1455 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1456 AC_DEFINE(HAVE_MMAP)
1459 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1460 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1461 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1462 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1463 AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1466 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1467 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1468 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1469 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1470 AC_DEFINE(HAVE_FCNTL_LOCK)
1473 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1474 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1475 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1476 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1477 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1482 dnl Don't check for 64 bit fcntl locking if we know that the
1483 dnl glibc2.1 broken check has succeeded.
1486 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1488 #if defined(HAVE_UNISTD_H)
1498 #ifdef HAVE_SYS_FCNTL_H
1499 #include <sys/fcntl.h>
1501 main() { struct flock64 fl64;
1502 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1508 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1510 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1511 AC_DEFINE(HAVE_STRUCT_FLOCK64)
1518 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1520 #ifdef HAVE_SYS_VFS_H
1521 #include <sys/vfs.h>
1523 #ifdef HAVE_SYS_CAPABILITY_H
1524 #include <sys/capability.h>
1527 samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1528 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1529 AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS)
1534 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1535 AC_TRY_COMPILE([#include <sys/acl.h>
1536 #if defined(HAVE_RPCSVC_NIS_H)
1537 #include <rpcsvc/nis.h>
1540 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1541 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1542 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1546 #################################################
1547 # check for smbwrapper support
1548 AC_MSG_CHECKING(whether to use smbwrapper)
1549 AC_ARG_WITH(smbwrapper,
1550 [ --with-smbwrapper Include SMB wrapper support (default=no) ],
1551 [ case "$withval" in
1554 AC_DEFINE(WITH_SMBWRAPPER)
1555 WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1557 if test x$ATTEMPT_WRAP32_BUILD = x; then
1560 WRAP32=bin/smbwrapper.32.$SHLIBEXT
1563 # Conditions under which smbwrapper should not be built.
1565 if test x$PICFLAG = x; then
1566 echo No support for PIC code - disabling smbwrapper and smbsh
1569 elif test x$ac_cv_func_syscall = xno; then
1570 AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1582 #################################################
1583 # check for AFS clear-text auth support
1584 AC_MSG_CHECKING(whether to use AFS clear-text auth)
1586 [ --with-afs Include AFS clear-text auth support (default=no) ],
1587 [ case "$withval" in
1600 #################################################
1601 # check for the DFS clear-text auth system
1602 AC_MSG_CHECKING(whether to use DFS clear-text auth)
1604 [ --with-dce-dfs Include DCE/DFS clear-text auth support (default=no)],
1605 [ case "$withval" in
1618 #################################################
1619 # see if this box has the RedHat location for kerberos
1620 AC_MSG_CHECKING(for /usr/kerberos)
1621 if test -d /usr/kerberos; then
1622 LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
1623 CFLAGS="$CFLAGS -I/usr/kerberos/include"
1624 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1630 #################################################
1631 # check for location of Kerberos 5 install
1632 AC_MSG_CHECKING(for kerberos 5 install path)
1634 [ --with-krb5=base-dir Locate Kerberos 5 support (default=/usr)],
1635 [ case "$withval" in
1642 CFLAGS="$CFLAGS -I$withval/include"
1643 CPPFLAGS="$CPPFLAGS -I$withval/include"
1644 LDFLAGS="$LDFLAGS -L$withval/lib"
1650 # now check for krb5.h. Some systems have the libraries without the headers!
1651 # note that this check is done here to allow for different kerberos
1653 AC_CHECK_HEADERS(krb5.h)
1655 # now check for gssapi headers. This is also done here to allow for
1656 # different kerberos include paths
1657 AC_CHECK_HEADERS(gssapi/gssapi_generic.h gssapi/gssapi.h)
1659 ##################################################################
1660 # we might need the k5crypto and com_err libraries on some systems
1661 AC_CHECK_LIB(com_err, _et_list, [LIBS="$LIBS -lcom_err"])
1662 AC_CHECK_LIB(k5crypto, krb5_encrypt_data, [LIBS="$LIBS -lk5crypto"])
1663 AC_CHECK_LIB(gssapi_krb5, gss_import_name, [LIBS="$LIBS -lgssapi_krb5"])
1666 ########################################################
1667 # now see if we can find the krb5 libs in standard paths
1668 # or as specified above
1669 AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
1670 AC_DEFINE(HAVE_KRB5)])
1673 ##################################################################
1674 # we might need the lber lib on some systems. To avoid link errors
1675 # this test must be before the libldap test
1676 AC_CHECK_LIB(lber, ber_scanf, [LIBS="$LIBS -llber"])
1678 ########################################################
1679 # now see if we can find the ldap libs in standard paths
1680 if test x$have_ldap != xyes; then
1681 AC_CHECK_LIB(ldap, ldap_open, [LIBS="$LIBS -lldap";
1682 AC_DEFINE(HAVE_LDAP)])
1686 #################################################
1687 # check for automount support
1688 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1689 AC_ARG_WITH(automount,
1690 [ --with-automount Include AUTOMOUNT support (default=no)],
1691 [ case "$withval" in
1694 AC_DEFINE(WITH_AUTOMOUNT)
1703 #################################################
1704 # check for smbmount support
1705 AC_MSG_CHECKING(whether to use SMBMOUNT)
1706 AC_ARG_WITH(smbmount,
1707 [ --with-smbmount Include SMBMOUNT (Linux only) support (default=no)],
1708 [ case "$withval" in
1713 AC_DEFINE(WITH_SMBMOUNT)
1714 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1717 AC_MSG_ERROR(not on a linux system!)
1731 #################################################
1732 # check for a PAM clear-text auth, accounts, password and session support
1733 with_pam_for_crypt=no
1734 AC_MSG_CHECKING(whether to use PAM)
1736 [ --with-pam Include PAM support (default=no)],
1737 [ case "$withval" in
1742 with_pam_for_crypt=yes
1751 # we can't build a pam module if we don't have pam.
1752 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
1754 #################################################
1755 # check for pam_smbpass support
1756 AC_MSG_CHECKING(whether to use pam_smbpass)
1757 AC_ARG_WITH(pam_smbpass,
1758 [ --with-pam_smbpass Build a PAM module to allow other applications to use our smbpasswd file (default=no)],
1759 [ case "$withval" in
1763 # Conditions under which pam_smbpass should not be built.
1765 if test x$PICFLAG = x; then
1766 AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
1768 elif test x$ac_cv_lib_pam_pam_get_data = xno; then
1769 AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
1772 PAM_MOD="bin/pam_smbpass.so"
1783 ###############################################
1784 # test for where we get crypt() from, but only
1786 if test $with_pam_for_crypt = no; then
1787 AC_CHECK_FUNCS(crypt)
1788 if test x"$ac_cv_func_crypt" = x"no"; then
1789 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
1790 AC_DEFINE(HAVE_CRYPT)])
1795 ## moved after the check for -lcrypt in order to
1796 ## ensure that the necessary libraries are included
1797 ## check checking for truncated salt. Wrapped by the
1798 ## $with_pam_for_crypt variable as above --jerry
1800 if test $with_pam_for_crypt = no; then
1801 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1802 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1803 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
1804 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1805 AC_DEFINE(HAVE_TRUNCATED_SALT)
1811 ########################################################################################
1813 ## TESTS FOR SAM BACKENDS. KEEP THESE GROUPED TOGETHER
1815 ########################################################################################
1817 ## set the with_smbpasswd_sam as the default
1818 with_smbpasswd_sam=yes
1821 #################################################
1822 # check for a TDB password database
1823 AC_MSG_CHECKING(whether to use TDB SAM database)
1825 [ --with-tdbsam Include experimental TDB SAM support (default=no)],
1826 [ case "$withval" in
1829 AC_DEFINE(WITH_TDB_SAM)
1830 with_smbpasswd_sam=no
1839 #################################################
1840 # check for a LDAP password database
1841 AC_MSG_CHECKING(whether to use LDAP SAM database)
1842 AC_ARG_WITH(ldapsam,
1843 [ --with-ldapsam Include experimental LDAP SAM support (default=no)],
1844 [ case "$withval" in
1847 AC_DEFINE(WITH_LDAP_SAM)
1848 LIBS="-lldap -llber $LIBS"
1849 with_smbpasswd_sam=no
1858 #################################################
1859 # check for a NISPLUS password database
1860 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
1861 AC_ARG_WITH(nisplussam,
1862 [ --with-nisplussam Include NISPLUS SAM support (default=no)],
1863 [ case "$withval" in
1866 AC_DEFINE(WITH_NISPLUS_SAM)
1867 with_smbpasswd_sam=no
1876 ################################################
1877 # This test should come last because the
1878 # smbpasswd SAM is only used if another format
1879 # has not been defined
1880 AC_MSG_CHECKING(whether to use traditional smbpasswd file)
1881 if test $with_smbpasswd_sam = yes; then
1883 AC_DEFINE(WITH_SMBPASSWD_SAM)
1888 ########################################################################################
1890 ## END OF TESTS FOR SAM BACKENDS.
1892 ########################################################################################
1894 #################################################
1895 # check for a NISPLUS_HOME support
1896 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
1897 AC_ARG_WITH(nisplus-home,
1898 [ --with-nisplus-home Include NISPLUS_HOME support (default=no)],
1899 [ case "$withval" in
1902 AC_DEFINE(WITH_NISPLUS_HOME)
1911 #################################################
1912 # check for the secure socket layer
1913 AC_MSG_CHECKING(whether to use SSL)
1915 [ --with-ssl Include SSL support (default=no)
1916 --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl/include)
1917 --with-ssllib=DIR Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
1918 [ case "$withval" in
1922 withval="/usr/local/ssl" # default
1924 if test "${with_sslinc+set}" = set; then
1926 withval="$with_sslinc"
1929 echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
1930 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1933 CFLAGS="-I${withval} $CFLAGS"
1939 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1943 if test "${with_ssllib+set}" = set; then
1945 withval="$with_ssllib"
1948 echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
1949 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1952 LDFLAGS="-L${withval}/lib $LDFLAGS"
1958 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1962 LIBS="-lssl -lcrypto $LIBS"
1964 # if test ! -d ${withval}; then
1965 # echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
1969 CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS" # Damn, SSLeay defines its own
1979 #################################################
1980 # check for syslog logging
1981 AC_MSG_CHECKING(whether to use syslog logging)
1983 [ --with-syslog Include experimental SYSLOG support (default=no)],
1984 [ case "$withval" in
1987 AC_DEFINE(WITH_SYSLOG)
1996 #################################################
1997 # check for a shared memory profiling support
1998 AC_MSG_CHECKING(whether to use profiling)
1999 AC_ARG_WITH(profiling-data,
2000 [ --with-profiling-data Include gathering source code profile information (default=no)],
2001 [ case "$withval" in
2004 AC_DEFINE(WITH_PROFILE)
2014 #################################################
2015 # check for experimental disk-quotas support
2016 QUOTAOBJS=smbd/noquotas.o
2018 AC_MSG_CHECKING(whether to support disk-quotas)
2020 [ --with-quotas Include experimental disk-quota support (default=no)],
2021 [ case "$withval" in
2026 # Check for kernel 2.4.x quota braindamage...
2027 AC_CACHE_CHECK([for linux 2.4.x quota braindamage..],samba_cv_linux_2_4_quota_braindamage, [
2028 AC_TRY_COMPILE([#include <stdio.h>
2029 #include <sys/types.h>
2030 #include <asm/types.h>
2031 #include <linux/quota.h>
2033 #include <linux/unistd.h>],[struct mem_dqblk D;],
2034 samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
2035 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
2036 AC_DEFINE(LINUX_QUOTAS_2)
2038 AC_DEFINE(LINUX_QUOTAS_1)
2044 QUOTAOBJS=smbd/quotas.o
2045 AC_DEFINE(WITH_QUOTAS)
2055 #################################################
2056 # check for experimental utmp accounting
2058 AC_MSG_CHECKING(whether to support utmp accounting)
2060 [ --with-utmp Include experimental utmp accounting (default=no)],
2061 [ case "$withval" in
2064 AC_DEFINE(WITH_UTMP)
2073 #################################################
2074 # set private directory location
2075 AC_ARG_WITH(privatedir,
2076 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
2077 [ case "$withval" in
2080 # Just in case anybody calls it without argument
2082 AC_MSG_WARN([--with-privatedir called without argument - will use default])
2083 privatedir='${prefix}/private'
2086 privatedir="$withval"
2089 AC_SUBST(privatedir)],
2090 [privatedir='${prefix}/private'
2091 AC_SUBST(privatedir)]
2094 #################################################
2095 # set lock directory location
2096 AC_ARG_WITH(lockdir,
2097 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
2098 [ case "$withval" in
2101 # Just in case anybody calls it without argument
2103 AC_MSG_WARN([--with-lockdir called without argument - will use default])
2104 lockdir='$(VARDIR)/locks'
2111 [lockdir='$(VARDIR)/locks'
2115 #################################################
2116 # set SWAT directory location
2117 AC_ARG_WITH(swatdir,
2118 [ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)],
2119 [ case "$withval" in
2122 # Just in case anybody does it
2124 AC_MSG_WARN([--with-swatdir called without argument - will use default])
2125 swatdir='${prefix}/swat'
2132 [swatdir='${prefix}/swat'
2136 #################################################
2137 # choose native language(s) of man pages
2138 AC_MSG_CHECKING(chosen man pages' language(s))
2139 AC_ARG_WITH(manpages-langs,
2140 [ --with-manpages-langs={en,ja,pl} Choose man pages' language(s). (en)],
2141 [ case "$withval" in
2143 AC_MSG_WARN(--with-manpages-langs called without argument - will use default)
2151 AC_MSG_RESULT($manlangs)
2152 manlangs=`echo $manlangs | sed "s/,/ /"` # replacing commas with spaces to produce a list
2153 AC_SUBST(manlangs)],
2156 AC_MSG_RESULT($manlangs)
2160 #################################################
2161 # these tests are taken from the GNU fileutils package
2162 AC_CHECKING(how to get filesystem space usage)
2165 # Test for statvfs64.
2166 if test $space = no; then
2168 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2170 #if defined(HAVE_UNISTD_H)
2173 #include <sys/types.h>
2174 #include <sys/statvfs.h>
2177 struct statvfs64 fsd;
2178 exit (statvfs64 (".", &fsd));
2180 fu_cv_sys_stat_statvfs64=yes,
2181 fu_cv_sys_stat_statvfs64=no,
2182 fu_cv_sys_stat_statvfs64=cross)])
2183 if test $fu_cv_sys_stat_statvfs64 = yes; then
2185 AC_DEFINE(STAT_STATVFS64)
2189 # Perform only the link test since it seems there are no variants of the
2190 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
2191 # because that got a false positive on SCO OSR5. Adding the declaration
2192 # of a `struct statvfs' causes this test to fail (as it should) on such
2193 # systems. That system is reported to work fine with STAT_STATFS4 which
2194 # is what it gets when this test fails.
2195 if test $space = no; then
2197 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2198 [AC_TRY_LINK([#include <sys/types.h>
2199 #include <sys/statvfs.h>],
2200 [struct statvfs fsd; statvfs (0, &fsd);],
2201 fu_cv_sys_stat_statvfs=yes,
2202 fu_cv_sys_stat_statvfs=no)])
2203 if test $fu_cv_sys_stat_statvfs = yes; then
2205 AC_DEFINE(STAT_STATVFS)
2209 if test $space = no; then
2210 # DEC Alpha running OSF/1
2211 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2212 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2214 #include <sys/param.h>
2215 #include <sys/types.h>
2216 #include <sys/mount.h>
2221 exit (statfs (".", &fsd, sizeof (struct statfs)));
2223 fu_cv_sys_stat_statfs3_osf1=yes,
2224 fu_cv_sys_stat_statfs3_osf1=no,
2225 fu_cv_sys_stat_statfs3_osf1=no)])
2226 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2227 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2229 AC_DEFINE(STAT_STATFS3_OSF1)
2233 if test $space = no; then
2235 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2236 member (AIX, 4.3BSD)])
2237 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2239 #ifdef HAVE_SYS_PARAM_H
2240 #include <sys/param.h>
2242 #ifdef HAVE_SYS_MOUNT_H
2243 #include <sys/mount.h>
2245 #ifdef HAVE_SYS_VFS_H
2246 #include <sys/vfs.h>
2252 exit (statfs (".", &fsd));
2254 fu_cv_sys_stat_statfs2_bsize=yes,
2255 fu_cv_sys_stat_statfs2_bsize=no,
2256 fu_cv_sys_stat_statfs2_bsize=no)])
2257 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2258 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2260 AC_DEFINE(STAT_STATFS2_BSIZE)
2264 if test $space = no; then
2266 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2267 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2268 [AC_TRY_RUN([#include <sys/types.h>
2269 #include <sys/statfs.h>
2273 exit (statfs (".", &fsd, sizeof fsd, 0));
2275 fu_cv_sys_stat_statfs4=yes,
2276 fu_cv_sys_stat_statfs4=no,
2277 fu_cv_sys_stat_statfs4=no)])
2278 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2279 if test $fu_cv_sys_stat_statfs4 = yes; then
2281 AC_DEFINE(STAT_STATFS4)
2285 if test $space = no; then
2287 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2288 member (4.4BSD and NetBSD)])
2289 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2290 [AC_TRY_RUN([#include <sys/types.h>
2291 #ifdef HAVE_SYS_PARAM_H
2292 #include <sys/param.h>
2294 #ifdef HAVE_SYS_MOUNT_H
2295 #include <sys/mount.h>
2301 exit (statfs (".", &fsd));
2303 fu_cv_sys_stat_statfs2_fsize=yes,
2304 fu_cv_sys_stat_statfs2_fsize=no,
2305 fu_cv_sys_stat_statfs2_fsize=no)])
2306 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2307 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2309 AC_DEFINE(STAT_STATFS2_FSIZE)
2313 if test $space = no; then
2315 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2316 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2317 [AC_TRY_RUN([#include <sys/types.h>
2318 #ifdef HAVE_SYS_PARAM_H
2319 #include <sys/param.h>
2321 #ifdef HAVE_SYS_MOUNT_H
2322 #include <sys/mount.h>
2324 #ifdef HAVE_SYS_FS_TYPES_H
2325 #include <sys/fs_types.h>
2330 /* Ultrix's statfs returns 1 for success,
2331 0 for not mounted, -1 for failure. */
2332 exit (statfs (".", &fsd) != 1);
2334 fu_cv_sys_stat_fs_data=yes,
2335 fu_cv_sys_stat_fs_data=no,
2336 fu_cv_sys_stat_fs_data=no)])
2337 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2338 if test $fu_cv_sys_stat_fs_data = yes; then
2340 AC_DEFINE(STAT_STATFS2_FS_DATA)
2345 # As a gating factor for large file support, in order to
2346 # use <4GB files we must have the following minimal support
2348 # long long, and a 64 bit off_t or off64_t.
2349 # If we don't have all of these then disable large
2352 AC_MSG_CHECKING([if large file support can be enabled])
2354 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2355 #include <sys/types.h>
2361 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2362 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2363 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2365 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
2367 AC_ARG_WITH(spinlocks,
2368 [ --with-spinlocks Use spin locks instead of fcntl locks (default=no) ])
2369 if test "x$with_spinlocks" = "xyes"; then
2370 AC_DEFINE(USE_SPINLOCKS)
2374 AC_DEFINE(SPARC_SPINLOCKS)
2377 i386|i486|i586|i686)
2378 AC_DEFINE(INTEL_SPINLOCKS)
2382 AC_DEFINE(MIPS_SPINLOCKS)
2386 AC_DEFINE(POWERPC_SPINLOCKS)
2391 #################################################
2392 # check for ACL support
2394 AC_MSG_CHECKING(whether to support ACLs)
2395 AC_ARG_WITH(acl-support,
2396 [ --with-acl-support Include ACL support (default=no)],
2397 [ case "$withval" in
2402 AC_MSG_RESULT(Using UnixWare ACLs)
2403 AC_DEFINE(HAVE_UNIXWARE_ACLS)
2406 AC_MSG_RESULT(Using solaris ACLs)
2407 AC_DEFINE(HAVE_SOLARIS_ACLS)
2410 AC_MSG_RESULT(Using IRIX ACLs)
2411 AC_DEFINE(HAVE_IRIX_ACLS)
2414 AC_MSG_RESULT(Using AIX ACLs)
2415 AC_DEFINE(HAVE_AIX_ACLS)
2418 AC_MSG_RESULT(Using Tru64 ACLs)
2419 AC_DEFINE(HAVE_TRU64_ACLS)
2423 AC_CHECK_LIB(acl,acl_get_file)
2424 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2425 AC_TRY_LINK([#include <sys/types.h>
2426 #include <sys/acl.h>],
2427 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2428 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2429 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2430 AC_MSG_RESULT(Using posix ACLs)
2431 AC_DEFINE(HAVE_POSIX_ACLS)
2432 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2433 AC_TRY_LINK([#include <sys/types.h>
2434 #include <sys/acl.h>],
2435 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2436 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2437 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2438 AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2446 AC_DEFINE(HAVE_NO_ACLS)
2449 AC_DEFINE(HAVE_NO_ACLS)
2453 #################################################
2454 # Check whether winbind is supported on this platform. If so we need to
2455 # build and install client programs (WINBIND_TARGETS), sbin programs
2456 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2458 AC_MSG_CHECKING(whether to build winbind)
2460 # Initially, the value of $host_os decides whether winbind is supported
2468 winbind_no_reason=", unsupported on $host_os"
2472 # Check the setting of --with-winbindd
2474 AC_ARG_WITH(winbind,
2475 [ --with-winbind Build winbind (default, if supported by OS)],
2488 # We need unix domain sockets for winbind
2490 if test x"$HAVE_WINBIND" = x"yes"; then
2491 if test x"$samba_cv_unixsocket" = x"no"; then
2492 winbind_no_reason=", no unix domain socket support on $host_os"
2497 # Display test results
2499 if test x"$HAVE_WINBIND" = x"yes"; then
2503 WINBIND_TARGETS="bin/wbinfo"
2504 WINBIND_STARGETS="bin/winbindd"
2505 WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
2508 WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
2512 AC_MSG_RESULT(no$winbind_no_reason)
2517 WINBIND_PAM_PROGS=""
2520 # Substitution time!
2522 AC_SUBST(WINBIND_TARGETS)
2523 AC_SUBST(WINBIND_STARGETS)
2524 AC_SUBST(WINBIND_LTARGETS)
2525 AC_SUBST(WINBIND_PAM_TARGETS)
2527 #################################################
2528 # Check to see if we should use the included popt
2530 AC_ARG_WITH(included-popt,
2531 [ --with-included-popt use bundled popt library, not from system],
2542 if test x"$INCLUDED_POPT" != x"yes"; then
2543 AC_CHECK_LIB(popt, poptGetContext,
2544 INCLUDED_POPT=no, INCLUDED_POPT=yes)
2547 AC_MSG_CHECKING(whether to use included popt)
2548 if test x"$INCLUDED_POPT" = x"yes"; then
2549 AC_MSG_RESULT($srcdir/popt)
2550 BUILD_POPT='$(POPT_OBJS)'
2551 FLAGS1="-I$srcdir/popt"
2556 AC_SUBST(BUILD_POPT)
2559 #################################################
2560 # final configure stuff
2562 echo "checking configure summary"
2563 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2564 echo "configure OK";,
2565 AC_MSG_ERROR([summary failure. Aborting config]),:)
2570 AC_OUTPUT(include/stamp-h Makefile)