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)
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 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 AC_CHECK_SIZEOF(int,cross)
280 AC_CHECK_SIZEOF(long,cross)
281 AC_CHECK_SIZEOF(short,cross)
296 AC_CHECK_TYPE(ino_t,unsigned)
297 AC_CHECK_TYPE(loff_t,off_t)
298 AC_CHECK_TYPE(offset_t,loff_t)
299 AC_CHECK_TYPE(ssize_t, int)
300 AC_CHECK_TYPE(wchar_t, unsigned short)
302 ############################################
303 # for cups support we need libcups, and a handful of header files
305 AC_CHECK_LIB(cups,httpConnect)
307 # I wonder if there is a nicer way of doing this?
309 if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
310 AC_CHECK_HEADERS(cups/cups.h cups/language.h)
311 if test x"$ac_cv_header_cups_cups_h" = x"yes"; then
312 if test x"$ac_cv_header_cups_language_h" = x"yes"; then
318 ############################################
319 # we need libdl for PAM and the new VFS code
320 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
321 AC_DEFINE(HAVE_LIBDL)])
323 ############################################
324 # we need kerberos 5 for w2k ADS authentication
325 AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
326 AC_DEFINE(HAVE_KRB5)])
329 ############################################
330 # check if the compiler can do immediate structures
331 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
335 #define X_FOOBAR(x) ((FOOBAR) { x })
336 typedef struct {unsigned x;} FOOBAR;
337 FOOBAR f = X_FOOBAR(1);
339 samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
340 if test x"$samba_cv_immediate_structures" = x"yes"; then
341 AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
344 ############################################
345 # check for unix domain sockets
346 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
348 #include <sys/types.h>
351 #include <sys/socket.h>
352 #include <sys/un.h>],
354 struct sockaddr_un sunaddr;
355 sunaddr.sun_family = AF_UNIX;
357 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
358 if test x"$samba_cv_unixsocket" = x"yes"; then
359 AC_DEFINE(HAVE_UNIXSOCKET)
363 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
365 #include <sys/types.h>
370 #include <sys/socket.h>],[socklen_t i = 0],
371 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
372 if test x"$samba_cv_socklen_t" = x"yes"; then
373 AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
376 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
378 #include <sys/types.h>
383 #include <signal.h>],[sig_atomic_t i = 0],
384 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
385 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
386 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
389 # stupid headers have the functions but no declaration. grrrr.
390 AC_HAVE_DECL(errno, [#include <errno.h>])
391 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
392 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
393 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
394 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
395 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
396 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
398 # and glibc has setresuid under linux but the function does
399 # nothing until kernel 2.1.44! very dumb.
400 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
401 AC_TRY_RUN([#include <errno.h>
402 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
403 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
404 if test x"$samba_cv_have_setresuid" = x"yes"; then
405 AC_DEFINE(HAVE_SETRESUID)
408 # Do the same check for setresguid...
410 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
411 AC_TRY_RUN([#include <unistd.h>
413 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
414 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
415 if test x"$samba_cv_have_setresgid" = x"yes"; then
416 AC_DEFINE(HAVE_SETRESGID)
421 ###############################################
422 # test for where we get crypt() from
423 AC_CHECK_FUNCS(crypt)
424 if test x"$ac_cv_func_crypt" = x"no"; then
425 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
426 AC_DEFINE(HAVE_CRYPT)])
430 ###############################################
431 # Readline included by default unless explicitly asked not to
432 test "${with_readline+set}" != "set" && with_readline=yes
434 # test for where we get readline() from
435 AC_MSG_CHECKING(whether to use readline)
436 AC_ARG_WITH(readline,
437 [ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
438 [ case "$with_readline" in
442 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
443 AC_CHECK_HEADERS(readline/history.h)
445 AC_CHECK_HEADERS(readline.h readline/readline.h,[
446 for termlib in ncurses curses termcap terminfo termlib; do
447 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
449 AC_CHECK_LIB(readline, rl_callback_handler_install,
450 [TERMLIBS="-lreadline $TERMLIBS"
451 AC_DEFINE(HAVE_LIBREADLINE)
452 break], [TERMLIBS=], $TERMLIBS)])
460 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
461 # alternate readline path
463 _cppflags=${CPPFLAGS}
465 # Add additional search path
466 LDFLAGS="-L$with_readline/lib $LDFLAGS"
467 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
469 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
470 AC_CHECK_HEADERS(readline/history.h)
472 AC_CHECK_HEADERS(readline.h readline/readline.h,[
473 for termlib in ncurses curses termcap terminfo termlib; do
474 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
476 AC_CHECK_LIB(readline, rl_callback_handler_install,
477 [TERMLDFLAGS="-L$with_readline/lib"
478 TERMCPPFLAGS="-I$with_readline/include"
479 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
480 TERMLIBS="-lreadline $TERMLIBS"
481 AC_DEFINE(HAVE_LIBREADLINE)
482 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
490 AC_SUBST(TERMLDFLAGS)
492 # The following test taken from the cvs sources
493 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
494 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
495 # libsocket.so which has a bad implementation of gethostbyname (it
496 # only looks in /etc/hosts), so we only look for -lsocket if we need
498 AC_CHECK_FUNCS(connect)
499 if test x"$ac_cv_func_connect" = x"no"; then
502 *) AC_CHECK_LIB(nsl_s, printf) ;;
506 *) AC_CHECK_LIB(nsl, printf) ;;
510 *) AC_CHECK_LIB(socket, connect) ;;
514 *) AC_CHECK_LIB(inet, connect) ;;
516 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
518 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
519 test x"$ac_cv_lib_inet_connect" = x"yes"; then
520 # ac_cv_func_connect=yes
521 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
522 AC_DEFINE(HAVE_CONNECT)
526 ###############################################
527 # test for where we get get_yp_default_domain() from
528 AC_CHECK_FUNCS(yp_get_default_domain)
529 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
530 AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
531 AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)])
534 # Check if we have execl, if not we need to compile smbrun.
535 AC_CHECK_FUNCS(execl)
536 if test x"$ac_cv_func_execl" = x"no"; then
542 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
543 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
544 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
545 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
546 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
547 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
548 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
549 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
550 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
551 # setbuffer is needed for smbtorture
552 AC_CHECK_FUNCS(setbuffer)
554 # syscall() is needed for smbwrapper.
555 AC_CHECK_FUNCS(syscall)
557 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
558 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
559 AC_CHECK_FUNCS(__getcwd _getcwd)
560 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
561 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
562 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
563 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
564 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
565 AC_CHECK_FUNCS(_write __write _fork __fork)
566 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
567 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
568 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
569 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
570 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
573 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
576 if test x$ac_cv_func_stat64 = xno ; then
577 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
579 #if defined(HAVE_UNISTD_H)
582 #include <sys/stat.h>
583 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
584 AC_MSG_RESULT([$ac_cv_func_stat64])
585 if test x$ac_cv_func_stat64 = xyes ; then
586 AC_DEFINE(HAVE_STAT64)
590 if test x$ac_cv_func_lstat64 = xno ; then
591 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
593 #if defined(HAVE_UNISTD_H)
596 #include <sys/stat.h>
597 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
598 AC_MSG_RESULT([$ac_cv_func_lstat64])
599 if test x$ac_cv_func_lstat64 = xyes ; then
600 AC_DEFINE(HAVE_LSTAT64)
604 if test x$ac_cv_func_fstat64 = xno ; then
605 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
607 #if defined(HAVE_UNISTD_H)
610 #include <sys/stat.h>
611 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
612 AC_MSG_RESULT([$ac_cv_func_fstat64])
613 if test x$ac_cv_func_fstat64 = xyes ; then
614 AC_DEFINE(HAVE_FSTAT64)
619 # If no strcasecmp, check for it in some known places
620 # It is in -lresolv on ReliantUNIX and UnixWare
621 # -lresolve *must* follow -lnsl for name resolution to work properly
624 if test x$ac_cv_func_strcasecmp = xno ; then
625 AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
626 AC_DEFINE(HAVE_STRCASECMP))
630 # Check for the functions putprpwnam, set_auth_parameters,
631 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
632 # Needed for OSF1 and HPUX.
635 AC_LIBTESTFUNC(security, putprpwnam)
636 AC_LIBTESTFUNC(sec, putprpwnam)
638 AC_LIBTESTFUNC(security, set_auth_parameters)
639 AC_LIBTESTFUNC(sec, set_auth_parameters)
641 # UnixWare 7.x has its getspnam in -lgen
642 AC_LIBTESTFUNC(gen, getspnam)
644 AC_LIBTESTFUNC(security, getspnam)
645 AC_LIBTESTFUNC(sec, getspnam)
647 AC_LIBTESTFUNC(security, bigcrypt)
648 AC_LIBTESTFUNC(sec, bigcrypt)
650 AC_LIBTESTFUNC(security, getprpwnam)
651 AC_LIBTESTFUNC(sec, getprpwnam)
653 # this bit needs to be modified for each OS that is suported by
654 # smbwrapper. You need to specify how to created a shared library and
655 # how to compile C code to produce PIC object files
657 # these are the defaults, good for lots of systems
667 # and these are for particular systems
669 *linux*) AC_DEFINE(LINUX)
674 *solaris*) AC_DEFINE(SUNOS5)
676 LDSHFLAGS="-Wl,-h,\$@.so -G"
677 if test "${ac_cv_prog_CC}" = "gcc"; then
685 *sunos*) AC_DEFINE(SUNOS4)
687 LDSHFLAGS="-Wl,-h,\$@ -G"
688 PICFLAG="-KPIC" # Is this correct for SunOS
690 *bsd*) BLDSHARED="true"
691 LDSHFLAGS="-Wl,-soname,\$@ -shared"
694 *irix*) AC_DEFINE(IRIX)
696 *irix6*) AC_DEFINE(IRIX6)
699 ATTEMPT_WRAP32_BUILD=yes
701 LDSHFLAGS="-Wl,-soname,\$@ -shared"
702 if test "${ac_cv_prog_CC}" = "gcc"; then
708 *aix*) AC_DEFINE(AIX)
710 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
711 PICFLAG="-O2 -qmaxmem=6000"
713 *hpux*) AC_DEFINE(HPUX)
715 # Use special PIC flags for the native HP-UX compiler.
716 if test $ac_cv_prog_cc_Ae = yes; then
718 LDSHFLAGS="-b -z +h \$@"
722 *qnx*) AC_DEFINE(QNX);;
723 *osf*) AC_DEFINE(OSF1)
725 LDSHFLAGS="-Wl,-soname,\$@ -shared"
728 *sco*) AC_DEFINE(SCO);;
729 *unixware*) AC_DEFINE(UNIXWARE)
731 LDSHFLAGS="-Wl,-soname,\$@ -shared"
734 *next2*) AC_DEFINE(NEXT2);;
735 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
738 *-univel-*) if [ test "$GCC" != yes ]; then
739 AC_DEFINE(HAVE_MEMSET)
743 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
747 if [ test "$GCC" != yes ]; then
748 AC_DEFINE(HAVE_MEMSET)
754 # this updates our target list if we can build shared libs
755 if test $BLDSHARED = true; then
756 LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
763 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
764 AC_TRY_RUN([#include <stdio.h>
765 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
766 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
767 if test x"$samba_cv_have_longlong" = x"yes"; then
768 AC_DEFINE(HAVE_LONGLONG)
772 # Check if the compiler supports the LL prefix on long long integers.
775 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
776 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
777 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
778 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
779 AC_DEFINE(COMPILER_SUPPORTS_LL)
783 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
784 AC_TRY_RUN([#include <stdio.h>
785 #include <sys/stat.h>
786 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
787 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
788 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
789 AC_DEFINE(SIZEOF_OFF_T,8)
792 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
794 #if defined(HAVE_UNISTD_H)
798 #include <sys/stat.h>
799 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
800 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
801 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
802 AC_DEFINE(HAVE_OFF64_T)
805 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
806 AC_TRY_RUN([#include <stdio.h>
807 #include <sys/stat.h>
808 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
809 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
810 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
811 AC_DEFINE(SIZEOF_INO_T,8)
814 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
816 #if defined(HAVE_UNISTD_H)
820 #include <sys/stat.h>
821 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
822 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
823 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
824 AC_DEFINE(HAVE_INO64_T)
827 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
829 #if defined(HAVE_UNISTD_H)
832 #include <sys/types.h>
833 #include <dirent.h>],
834 [struct dirent64 de;],
835 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
836 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
837 AC_DEFINE(HAVE_STRUCT_DIRENT64)
840 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
841 AC_TRY_RUN([#include <stdio.h>
842 main() { char c; c=250; exit((c > 0)?0:1); }],
843 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
844 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
845 AC_DEFINE(HAVE_UNSIGNED_CHAR)
848 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
849 AC_TRY_COMPILE([#include <sys/types.h>
850 #include <sys/socket.h>
851 #include <netinet/in.h>],
852 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
853 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
854 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
855 AC_DEFINE(HAVE_SOCK_SIN_LEN)
858 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
859 AC_TRY_COMPILE([#include <sys/types.h>
861 void seekdir(DIR *d, long loc) { return; }],[return 0;],
862 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
863 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
864 AC_DEFINE(SEEKDIR_RETURNS_VOID)
867 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
868 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
869 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
870 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
871 AC_DEFINE(HAVE_FILE_MACRO)
874 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
875 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
876 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
877 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
878 AC_DEFINE(HAVE_FUNCTION_MACRO)
881 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
883 #include <sys/time.h>
885 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
886 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
887 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
888 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
891 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
893 #include <sys/types.h>
895 void foo(const char *format, ...) {
900 va_start(ap, format);
901 len = vsnprintf(0, 0, format, ap);
903 if (len != 5) exit(1);
905 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
909 main() { foo("hello"); }
911 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
912 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
913 AC_DEFINE(HAVE_C99_VSNPRINTF)
916 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
917 AC_TRY_RUN([#include <sys/types.h>
919 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
920 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
921 di->d_name[0] == 0) exit(0); exit(1);} ],
922 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
923 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
924 AC_DEFINE(HAVE_BROKEN_READDIR)
927 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
928 AC_TRY_COMPILE([#include <sys/types.h>
930 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
931 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
932 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
933 AC_DEFINE(HAVE_UTIMBUF)
936 dnl utmp and utmpx come in many flavours
937 dnl We need to check for many of them
938 dnl But we don't need to do each and every one, because our code uses
939 dnl mostly just the utmp (not utmpx) fields.
941 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
943 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
944 AC_TRY_COMPILE([#include <sys/types.h>
946 [struct utmp ut; ut.ut_name[0] = 'a';],
947 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
948 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
949 AC_DEFINE(HAVE_UT_UT_NAME)
952 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
953 AC_TRY_COMPILE([#include <sys/types.h>
955 [struct utmp ut; ut.ut_user[0] = 'a';],
956 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
957 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
958 AC_DEFINE(HAVE_UT_UT_USER)
961 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
962 AC_TRY_COMPILE([#include <sys/types.h>
964 [struct utmp ut; ut.ut_id[0] = 'a';],
965 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
966 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
967 AC_DEFINE(HAVE_UT_UT_ID)
970 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
971 AC_TRY_COMPILE([#include <sys/types.h>
973 [struct utmp ut; ut.ut_host[0] = 'a';],
974 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
975 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
976 AC_DEFINE(HAVE_UT_UT_HOST)
979 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
980 AC_TRY_COMPILE([#include <sys/types.h>
982 [struct utmp ut; time_t t; ut.ut_time = t;],
983 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
984 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
985 AC_DEFINE(HAVE_UT_UT_TIME)
988 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
989 AC_TRY_COMPILE([#include <sys/types.h>
991 [struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
992 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
993 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
994 AC_DEFINE(HAVE_UT_UT_TV)
997 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
998 AC_TRY_COMPILE([#include <sys/types.h>
1000 [struct utmp ut; ut.ut_type = 0;],
1001 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1002 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1003 AC_DEFINE(HAVE_UT_UT_TYPE)
1006 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1007 AC_TRY_COMPILE([#include <sys/types.h>
1009 [struct utmp ut; ut.ut_pid = 0;],
1010 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1011 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1012 AC_DEFINE(HAVE_UT_UT_PID)
1015 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1016 AC_TRY_COMPILE([#include <sys/types.h>
1018 [struct utmp ut; ut.ut_exit.e_exit = 0;],
1019 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1020 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1021 AC_DEFINE(HAVE_UT_UT_EXIT)
1024 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1025 AC_TRY_COMPILE([#include <sys/types.h>
1027 [struct utmp ut; ut.ut_addr = 0;],
1028 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1029 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1030 AC_DEFINE(HAVE_UT_UT_ADDR)
1033 if test x$ac_cv_func_pututline = xyes ; then
1034 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1035 AC_TRY_COMPILE([#include <sys/types.h>
1037 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1038 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1039 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1040 AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1044 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1045 AC_TRY_COMPILE([#include <sys/types.h>
1046 #include <utmpx.h>],
1047 [struct utmpx ux; ux.ut_syslen = 0;],
1048 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1049 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1050 AC_DEFINE(HAVE_UX_UT_SYSLEN)
1054 #################################################
1055 # check for libiconv support
1056 AC_MSG_CHECKING(whether to use libiconv)
1057 AC_ARG_WITH(libiconv,
1058 [ --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
1059 [ case "$withval" in
1065 CFLAGS="$CFLAGS -I$withval/include"
1066 LDFLAGS="$LDFLAGS -L$withval/lib"
1067 AC_CHECK_LIB(iconv, iconv_open)
1068 AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}")
1076 # check for iconv in libc
1077 AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1081 iconv_t cd = iconv_open("ASCII", "UCS-2LE");
1082 if (cd == 0 || cd == (iconv_t)-1) return -1;
1086 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
1087 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1088 AC_DEFINE(HAVE_NATIVE_ICONV)
1092 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1094 #include <sys/types.h>
1097 #define F_GETLEASE 1025
1100 int fd = open("/dev/null", O_RDONLY);
1101 return fcntl(fd, F_GETLEASE, 0) == -1;
1104 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1105 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1106 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1109 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1111 #include <sys/types.h>
1115 #define F_NOTIFY 1026
1118 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1121 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1122 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1123 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1126 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1128 #include <sys/types.h>
1131 #include <sys/file.h>
1133 #define LOCK_MAND 32
1134 #define LOCK_READ 64
1137 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1140 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1141 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1142 AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1148 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1149 AC_TRY_COMPILE([#include <sys/types.h>
1150 #include <fcntl.h>],
1151 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1152 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1153 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1154 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1157 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1158 AC_TRY_RUN([#include <sys/types.h>
1159 #include <sys/capability.h>
1162 if ((cap = cap_get_proc()) == NULL)
1164 cap->cap_effective |= CAP_NETWORK_MGT;
1165 cap->cap_inheritable |= CAP_NETWORK_MGT;
1170 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1171 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1172 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1176 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1177 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1180 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1181 AC_TRY_COMPILE([#include <sys/types.h>
1182 #if defined(HAVE_RPC_RPC_H)
1183 #include <rpc/rpc.h>
1186 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1187 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1188 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1191 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1192 AC_TRY_COMPILE([#include <sys/types.h>
1193 #if defined(HAVE_RPC_RPC_H)
1194 #include <rpc/rpc.h>
1197 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1198 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1199 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1202 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1203 AC_TRY_COMPILE([#include <sys/types.h>
1204 #if defined(HAVE_RPC_RPC_H)
1205 #include <rpc/rpc.h>
1208 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1209 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1210 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1213 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1214 AC_TRY_COMPILE([#include <sys/types.h>
1215 #if defined(HAVE_RPC_RPC_H)
1216 #include <rpc/rpc.h>
1219 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1220 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1221 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1225 dnl Some systems (SCO) have a problem including
1226 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1227 dnl as a #define in <prot.h> and as part of an enum
1231 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1232 AC_TRY_COMPILE([#include <sys/types.h>
1233 #ifdef HAVE_SYS_SECURITY_H
1234 #include <sys/security.h>
1236 #endif /* HAVE_SYS_SECURITY_H */
1237 #if defined(HAVE_RPC_RPC_H)
1238 #include <rpc/rpc.h>
1241 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1242 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1243 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1246 AC_MSG_CHECKING([for test routines])
1247 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1249 AC_MSG_ERROR([cant find test code. Aborting config]),
1250 AC_MSG_WARN([cannot run when cross-compiling]))
1252 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1253 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1254 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1255 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1256 AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1259 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1260 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1261 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1262 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1263 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1264 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1266 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1269 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1270 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1271 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1272 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1273 AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1276 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1277 SAVE_CPPFLAGS="$CPPFLAGS"
1278 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
1280 #define REPLACE_GETPASS 1
1281 #define NO_CONFIG_H 1
1282 #define main dont_declare_main
1283 #include "${srcdir-.}/lib/getsmbpass.c"
1285 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1286 CPPFLAGS="$SAVE_CPPFLAGS"
1288 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1289 AC_DEFINE(REPLACE_GETPASS)
1292 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1295 #include <sys/types.h>
1296 #include <netinet/in.h>
1297 #ifdef HAVE_ARPA_INET_H
1298 #include <arpa/inet.h>
1300 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1301 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1302 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1304 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1305 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1306 AC_DEFINE(REPLACE_INET_NTOA)
1309 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1310 AC_TRY_RUN([#include <stdlib.h>
1311 #include <sys/types.h>
1312 #include <sys/stat.h>
1316 char tpl[20]="/tmp/test.XXXXXX";
1317 int fd = mkstemp(tpl);
1318 if (fd == -1) exit(1);
1320 if (fstat(fd, &st) != 0) exit(1);
1321 if ((st.st_mode & 0777) != 0600) exit(1);
1324 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1325 samba_cv_HAVE_SECURE_MKSTEMP=no,
1326 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1327 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1328 AC_DEFINE(HAVE_SECURE_MKSTEMP)
1331 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1332 AC_TRY_RUN([#include <unistd.h>
1333 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1334 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1335 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1336 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1339 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1340 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1341 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1342 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1343 AC_DEFINE(HAVE_ROOT)
1345 AC_MSG_WARN(running as non-root will disable some tests)
1349 # look for a method of finding the list of network interfaces
1351 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1353 #define HAVE_IFACE_AIX 1
1354 #define AUTOCONF_TEST 1
1355 #include "confdefs.h"
1356 #include "${srcdir-.}/lib/interfaces.c"],
1357 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1358 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1359 iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1362 if test $iface = no; then
1363 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1365 #define HAVE_IFACE_IFCONF 1
1366 #define AUTOCONF_TEST 1
1367 #include "confdefs.h"
1368 #include "${srcdir-.}/lib/interfaces.c"],
1369 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1370 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1371 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1375 if test $iface = no; then
1376 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1378 #define HAVE_IFACE_IFREQ 1
1379 #define AUTOCONF_TEST 1
1380 #include "confdefs.h"
1381 #include "${srcdir-.}/lib/interfaces.c"],
1382 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1383 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1384 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1389 ################################################
1390 # look for a method of setting the effective uid
1392 if test $seteuid = no; then
1393 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1395 #define AUTOCONF_TEST 1
1396 #define USE_SETRESUID 1
1397 #include "confdefs.h"
1398 #include "${srcdir-.}/lib/util_sec.c"],
1399 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1400 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1401 seteuid=yes;AC_DEFINE(USE_SETRESUID)
1406 if test $seteuid = no; then
1407 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1409 #define AUTOCONF_TEST 1
1410 #define USE_SETREUID 1
1411 #include "confdefs.h"
1412 #include "${srcdir-.}/lib/util_sec.c"],
1413 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1414 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1415 seteuid=yes;AC_DEFINE(USE_SETREUID)
1419 if test $seteuid = no; then
1420 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1422 #define AUTOCONF_TEST 1
1423 #define USE_SETEUID 1
1424 #include "confdefs.h"
1425 #include "${srcdir-.}/lib/util_sec.c"],
1426 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1427 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1428 seteuid=yes;AC_DEFINE(USE_SETEUID)
1432 if test $seteuid = no; then
1433 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1435 #define AUTOCONF_TEST 1
1436 #define USE_SETUIDX 1
1437 #include "confdefs.h"
1438 #include "${srcdir-.}/lib/util_sec.c"],
1439 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1440 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1441 seteuid=yes;AC_DEFINE(USE_SETUIDX)
1446 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1447 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1448 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1449 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1450 AC_DEFINE(HAVE_MMAP)
1453 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1454 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1455 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1456 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1457 AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1460 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1461 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1462 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1463 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1464 AC_DEFINE(HAVE_FCNTL_LOCK)
1467 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1468 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1469 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1470 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1471 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1476 dnl Don't check for 64 bit fcntl locking if we know that the
1477 dnl glibc2.1 broken check has succeeded.
1480 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1482 #if defined(HAVE_UNISTD_H)
1492 #ifdef HAVE_SYS_FCNTL_H
1493 #include <sys/fcntl.h>
1495 main() { struct flock64 fl64;
1496 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1502 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1504 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1505 AC_DEFINE(HAVE_STRUCT_FLOCK64)
1509 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1510 AC_TRY_COMPILE([#include <sys/acl.h>
1511 #if defined(HAVE_RPCSVC_NIS_H)
1512 #include <rpcsvc/nis.h>
1515 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1516 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1517 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1521 #################################################
1522 # check for smbwrapper support
1523 AC_MSG_CHECKING(whether to use smbwrapper)
1524 AC_ARG_WITH(smbwrapper,
1525 [ --with-smbwrapper Include SMB wrapper support (default=no) ],
1526 [ case "$withval" in
1529 AC_DEFINE(WITH_SMBWRAPPER)
1530 WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1532 if test x$ATTEMPT_WRAP32_BUILD = x; then
1535 WRAP32=bin/smbwrapper.32.$SHLIBEXT
1538 # Conditions under which smbwrapper should not be built.
1540 if test x$PICFLAG = x; then
1541 echo No support for PIC code - disabling smbwrapper and smbsh
1544 elif test x$ac_cv_func_syscall = xno; then
1545 AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1557 #################################################
1558 # check for the AFS filesystem
1559 AC_MSG_CHECKING(whether to use AFS)
1561 [ --with-afs Include AFS support (default=no) ],
1562 [ case "$withval" in
1575 #################################################
1576 # check for the DFS auth system
1577 AC_MSG_CHECKING(whether to use DFS auth)
1579 [ --with-dce-dfs Include DCE/DFS support (default=no)],
1580 [ case "$withval" in
1592 #################################################
1593 # check for Kerberos IV auth system
1594 AC_MSG_CHECKING(whether to use Kerberos IV)
1596 [ --with-krb4=base-dir Include Kerberos IV support (default=no)],
1597 [ case "$withval" in
1600 AC_DEFINE(KRB4_AUTH)
1601 AC_CHECK_LIB(resolv, dn_expand)
1602 LIBS="$LIBS -lkrb -ldes"
1603 CFLAGS="$CFLAGS -I$withval/include"
1604 LDFLAGS="$LDFLAGS -L$withval/lib"
1605 AC_DEFINE_UNQUOTED(KRB4_DIR, ${withval})
1614 #################################################
1615 # check for location of Kerberos 5 install
1616 AC_MSG_CHECKING(for kerberos 5 install)
1618 [ --with-krb5=base-dir Include Kerberos 5 support (default=no)],
1619 [ case "$withval" in
1625 AC_DEFINE(KRB5_AUTH)
1627 CFLAGS="$CFLAGS -I$withval/include"
1628 LDFLAGS="$LDFLAGS -L$withval/lib"
1629 AC_DEFINE(HAVE_KRB5)
1630 AC_DEFINE_UNQUOTED(KRB5_DIR,${withval})
1636 #################################################
1637 # check for automount support
1638 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1639 AC_ARG_WITH(automount,
1640 [ --with-automount Include AUTOMOUNT support (default=no)],
1641 [ case "$withval" in
1644 AC_DEFINE(WITH_AUTOMOUNT)
1653 #################################################
1654 # check for smbmount support
1655 AC_MSG_CHECKING(whether to use SMBMOUNT)
1656 AC_ARG_WITH(smbmount,
1657 [ --with-smbmount Include SMBMOUNT (Linux only) support (default=no)],
1658 [ case "$withval" in
1663 AC_DEFINE(WITH_SMBMOUNT)
1664 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1667 AC_MSG_ERROR(not on a linux system!)
1681 #################################################
1682 # check for a PAM password database
1683 with_pam_for_crypt=no
1684 AC_MSG_CHECKING(whether to use PAM password database)
1686 [ --with-pam Include PAM password database support (default=no)],
1687 [ case "$withval" in
1692 with_pam_for_crypt=yes
1701 # we can't build a pam module if we don't have pam.
1702 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
1704 #################################################
1705 # check for pam_smbpass support
1706 AC_MSG_CHECKING(whether to use pam_smbpass)
1707 AC_ARG_WITH(pam_smbpass,
1708 [ --with-pam_smbpass Build a PAM module to allow other applications to use our smbpasswd file (default=no)],
1709 [ case "$withval" in
1713 # Conditions under which pam_smbpass should not be built.
1715 if test x$PICFLAG = x; then
1716 AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
1718 elif test x$ac_cv_lib_pam_pam_get_data = xno; then
1719 AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
1722 PAM_MOD="bin/pam_smbpass.so"
1733 ###############################################
1734 # test for where we get crypt() from, but only
1736 if test $with_pam_for_crypt = no; then
1737 AC_CHECK_FUNCS(crypt)
1738 if test x"$ac_cv_func_crypt" = x"no"; then
1739 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
1740 AC_DEFINE(HAVE_CRYPT)])
1745 ## moved after the check for -lcrypt in order to
1746 ## ensure that the necessary libraries are included
1747 ## check checking for truncated salt. Wrapped by the
1748 ## $with_pam_for_crypt variable as above --jerry
1750 if test $with_pam_for_crypt = no; then
1751 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1752 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1753 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
1754 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1755 AC_DEFINE(HAVE_TRUNCATED_SALT)
1761 ########################################################################################
1763 ## TESTS FOR SAM BACKENDS. KEEP THESE GROUPED TOGETHER
1765 ########################################################################################
1767 ## set the with_smbpasswd_sam as the default
1768 with_smbpasswd_sam=yes
1771 #################################################
1772 # check for a TDB password database
1773 AC_MSG_CHECKING(whether to use TDB SAM database)
1775 [ --with-tdbsam Include experimental TDB SAM support (default=no)],
1776 [ case "$withval" in
1779 AC_DEFINE(WITH_TDB_SAM)
1780 with_smbpasswd_sam=no
1789 #################################################
1790 # check for a LDAP password database
1791 AC_MSG_CHECKING(whether to use LDAP SAM database)
1792 AC_ARG_WITH(ldapsam,
1793 [ --with-ldapsam Include experimental LDAP SAM support (default=no)],
1794 [ case "$withval" in
1797 AC_DEFINE(WITH_LDAP_SAM)
1798 LIBS="-lldap -llber -lresolv $LIBS"
1799 with_smbpasswd_sam=no
1808 #################################################
1809 # check for a NISPLUS password database
1810 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
1811 AC_ARG_WITH(nisplussam,
1812 [ --with-nisplussam Include NISPLUS SAM support (default=no)],
1813 [ case "$withval" in
1816 AC_DEFINE(WITH_NISPLUS_SAM)
1817 with_smbpasswd_sam=no
1826 ################################################
1827 # This test should come last because the
1828 # smbpasswd SAM is only used if another format
1829 # has not been defined
1830 AC_MSG_CHECKING(whether to use traditional smbpasswd file)
1831 if test $with_smbpasswd_sam = yes; then
1833 AC_DEFINE(WITH_SMBPASSWD_SAM)
1838 ########################################################################################
1840 ## END OF TESTS FOR SAM BACKENDS.
1842 ########################################################################################
1844 #################################################
1845 # check for a NISPLUS_HOME support
1846 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
1847 AC_ARG_WITH(nisplus-home,
1848 [ --with-nisplus-home Include NISPLUS_HOME support (default=no)],
1849 [ case "$withval" in
1852 AC_DEFINE(WITH_NISPLUS_HOME)
1861 #################################################
1862 # check for the secure socket layer
1863 AC_MSG_CHECKING(whether to use SSL)
1865 [ --with-ssl Include SSL support (default=no)
1866 --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl/include)
1867 --with-ssllib=DIR Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
1868 [ case "$withval" in
1872 withval="/usr/local/ssl" # default
1874 if test "${with_sslinc+set}" = set; then
1876 withval="$with_sslinc"
1879 echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
1880 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1883 CFLAGS="-I${withval} $CFLAGS"
1889 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1893 if test "${with_ssllib+set}" = set; then
1895 withval="$with_ssllib"
1898 echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
1899 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1902 LDFLAGS="-L${withval}/lib $LDFLAGS"
1908 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1912 LIBS="-lssl -lcrypto $LIBS"
1914 # if test ! -d ${withval}; then
1915 # echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
1919 CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS" # Damn, SSLeay defines its own
1929 #################################################
1930 # check for syslog logging
1931 AC_MSG_CHECKING(whether to use syslog logging)
1933 [ --with-syslog Include experimental SYSLOG support (default=no)],
1934 [ case "$withval" in
1937 AC_DEFINE(WITH_SYSLOG)
1946 #################################################
1947 # check for a shared memory profiling support
1948 AC_MSG_CHECKING(whether to use profiling)
1949 AC_ARG_WITH(profiling-data,
1950 [ --with-profiling-data Include gathering source code profile information (default=no)],
1951 [ case "$withval" in
1954 AC_DEFINE(WITH_PROFILE)
1964 #################################################
1965 # check for experimental disk-quotas support
1966 QUOTAOBJS=smbd/noquotas.o
1968 AC_MSG_CHECKING(whether to support disk-quotas)
1970 [ --with-quotas Include experimental disk-quota support (default=no)],
1971 [ case "$withval" in
1976 # Check for kernel 2.4.x quota braindamage...
1977 AC_CACHE_CHECK([for linux 2.4.x quota braindamage..],samba_cv_linux_2_4_quota_braindamage, [
1978 AC_TRY_COMPILE([#include <stdio.h>
1979 #include <sys/types.h>
1980 #include <asm/types.h>
1981 #include <linux/quota.h>
1983 #include <linux/unistd.h>],[struct mem_dqblk D;],
1984 samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
1985 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
1986 AC_DEFINE(LINUX_QUOTAS_2)
1988 AC_DEFINE(LINUX_QUOTAS_1)
1994 QUOTAOBJS=smbd/quotas.o
1995 AC_DEFINE(WITH_QUOTAS)
2005 #################################################
2006 # check for experimental utmp accounting
2008 AC_MSG_CHECKING(whether to support utmp accounting)
2010 [ --with-utmp Include experimental utmp accounting (default=no)],
2011 [ case "$withval" in
2014 AC_DEFINE(WITH_UTMP)
2023 #################################################
2024 # set private directory location
2025 AC_ARG_WITH(privatedir,
2026 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
2027 [ case "$withval" in
2030 # Just in case anybody calls it without argument
2032 AC_MSG_WARN([--with-privatedir called without argument - will use default])
2033 privatedir='${prefix}/private'
2036 privatedir="$withval"
2039 AC_SUBST(privatedir)],
2040 [privatedir='${prefix}/private'
2041 AC_SUBST(privatedir)]
2044 #################################################
2045 # set lock directory location
2046 AC_ARG_WITH(lockdir,
2047 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
2048 [ case "$withval" in
2051 # Just in case anybody calls it without argument
2053 AC_MSG_WARN([--with-lockdir called without argument - will use default])
2054 lockdir='$(VARDIR)/locks'
2061 [lockdir='$(VARDIR)/locks'
2065 #################################################
2066 # set SWAT directory location
2067 AC_ARG_WITH(swatdir,
2068 [ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)],
2069 [ case "$withval" in
2072 # Just in case anybody does it
2074 AC_MSG_WARN([--with-swatdir called without argument - will use default])
2075 swatdir='${prefix}/swat'
2082 [swatdir='${prefix}/swat'
2086 #################################################
2087 # check for i18n'ed SWAT compiling
2088 AC_MSG_CHECKING(whether to use i18n'ed SWAT)
2089 AC_ARG_WITH(i18n-swat,
2090 [ --with-i18n-swat Use i18n'ed SWAT
2091 --without-i18n-swat Don't use i18n'ed SWAT (default)],
2092 [ case "$withval" in
2095 AC_DEFINE(I18N_SWAT)
2103 AC_SUBST(i18n_swat) ],
2106 AC_SUBST(i18n_swat) ]
2109 #################################################
2110 # set SWAT default language for old web browsers.
2111 AC_MSG_CHECKING(whether to use default SWAT language)
2112 AC_ARG_WITH(swat-def-lang,
2113 [ --with-swat-def-lang=LN default SWAT language for old web browsers (empty)],
2115 default_pref_lang=""
2118 AC_MSG_WARN([--with-swat-def-lang called without argument - will use default])
2124 default_pref_lang="$withval"
2125 AC_MSG_RESULT($withval)
2128 AC_DEFINE_UNQUOTED(I18N_DEFAULT_PREF_LANG, "$default_pref_lang")
2131 default_pref_lang=""
2133 AC_DEFINE_UNQUOTED(I18N_DEFAULT_PREF_LANG, "$default_pref_lang")
2137 #################################################
2138 # choose native language(s) of man pages
2139 AC_MSG_CHECKING(chosen man pages' language(s))
2140 AC_ARG_WITH(manpages-langs,
2141 [ --with-manpages-langs={en,ja,pl} Choose man pages' language(s). (en)],
2142 [ case "$withval" in
2144 AC_MSG_WARN(--with-manpages-langs called without argument - will use default)
2152 AC_MSG_RESULT($manlangs)
2153 manlangs=`echo $manlangs | sed "s/,/ /"` # replacing commas with spaces to produce a list
2154 AC_SUBST(manlangs)],
2157 AC_MSG_RESULT($manlangs)
2161 #################################################
2162 # these tests are taken from the GNU fileutils package
2163 AC_CHECKING(how to get filesystem space usage)
2166 # Test for statvfs64.
2167 if test $space = no; then
2169 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2171 #if defined(HAVE_UNISTD_H)
2174 #include <sys/types.h>
2175 #include <sys/statvfs.h>
2178 struct statvfs64 fsd;
2179 exit (statvfs64 (".", &fsd));
2181 fu_cv_sys_stat_statvfs64=yes,
2182 fu_cv_sys_stat_statvfs64=no,
2183 fu_cv_sys_stat_statvfs64=cross)])
2184 if test $fu_cv_sys_stat_statvfs64 = yes; then
2186 AC_DEFINE(STAT_STATVFS64)
2190 # Perform only the link test since it seems there are no variants of the
2191 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
2192 # because that got a false positive on SCO OSR5. Adding the declaration
2193 # of a `struct statvfs' causes this test to fail (as it should) on such
2194 # systems. That system is reported to work fine with STAT_STATFS4 which
2195 # is what it gets when this test fails.
2196 if test $space = no; then
2198 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2199 [AC_TRY_LINK([#include <sys/types.h>
2200 #include <sys/statvfs.h>],
2201 [struct statvfs fsd; statvfs (0, &fsd);],
2202 fu_cv_sys_stat_statvfs=yes,
2203 fu_cv_sys_stat_statvfs=no)])
2204 if test $fu_cv_sys_stat_statvfs = yes; then
2206 AC_DEFINE(STAT_STATVFS)
2210 if test $space = no; then
2211 # DEC Alpha running OSF/1
2212 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2213 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2215 #include <sys/param.h>
2216 #include <sys/types.h>
2217 #include <sys/mount.h>
2222 exit (statfs (".", &fsd, sizeof (struct statfs)));
2224 fu_cv_sys_stat_statfs3_osf1=yes,
2225 fu_cv_sys_stat_statfs3_osf1=no,
2226 fu_cv_sys_stat_statfs3_osf1=no)])
2227 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2228 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2230 AC_DEFINE(STAT_STATFS3_OSF1)
2234 if test $space = no; then
2236 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2237 member (AIX, 4.3BSD)])
2238 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2240 #ifdef HAVE_SYS_PARAM_H
2241 #include <sys/param.h>
2243 #ifdef HAVE_SYS_MOUNT_H
2244 #include <sys/mount.h>
2246 #ifdef HAVE_SYS_VFS_H
2247 #include <sys/vfs.h>
2253 exit (statfs (".", &fsd));
2255 fu_cv_sys_stat_statfs2_bsize=yes,
2256 fu_cv_sys_stat_statfs2_bsize=no,
2257 fu_cv_sys_stat_statfs2_bsize=no)])
2258 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2259 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2261 AC_DEFINE(STAT_STATFS2_BSIZE)
2265 if test $space = no; then
2267 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2268 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2269 [AC_TRY_RUN([#include <sys/types.h>
2270 #include <sys/statfs.h>
2274 exit (statfs (".", &fsd, sizeof fsd, 0));
2276 fu_cv_sys_stat_statfs4=yes,
2277 fu_cv_sys_stat_statfs4=no,
2278 fu_cv_sys_stat_statfs4=no)])
2279 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2280 if test $fu_cv_sys_stat_statfs4 = yes; then
2282 AC_DEFINE(STAT_STATFS4)
2286 if test $space = no; then
2288 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2289 member (4.4BSD and NetBSD)])
2290 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2291 [AC_TRY_RUN([#include <sys/types.h>
2292 #ifdef HAVE_SYS_PARAM_H
2293 #include <sys/param.h>
2295 #ifdef HAVE_SYS_MOUNT_H
2296 #include <sys/mount.h>
2302 exit (statfs (".", &fsd));
2304 fu_cv_sys_stat_statfs2_fsize=yes,
2305 fu_cv_sys_stat_statfs2_fsize=no,
2306 fu_cv_sys_stat_statfs2_fsize=no)])
2307 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2308 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2310 AC_DEFINE(STAT_STATFS2_FSIZE)
2314 if test $space = no; then
2316 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2317 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2318 [AC_TRY_RUN([#include <sys/types.h>
2319 #ifdef HAVE_SYS_PARAM_H
2320 #include <sys/param.h>
2322 #ifdef HAVE_SYS_MOUNT_H
2323 #include <sys/mount.h>
2325 #ifdef HAVE_SYS_FS_TYPES_H
2326 #include <sys/fs_types.h>
2331 /* Ultrix's statfs returns 1 for success,
2332 0 for not mounted, -1 for failure. */
2333 exit (statfs (".", &fsd) != 1);
2335 fu_cv_sys_stat_fs_data=yes,
2336 fu_cv_sys_stat_fs_data=no,
2337 fu_cv_sys_stat_fs_data=no)])
2338 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2339 if test $fu_cv_sys_stat_fs_data = yes; then
2341 AC_DEFINE(STAT_STATFS2_FS_DATA)
2346 # As a gating factor for large file support, in order to
2347 # use <4GB files we must have the following minimal support
2349 # long long, and a 64 bit off_t or off64_t.
2350 # If we don't have all of these then disable large
2353 AC_MSG_CHECKING([if large file support can be enabled])
2355 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2356 #include <sys/types.h>
2362 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2363 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2364 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2366 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
2368 AC_ARG_WITH(spinlocks,
2369 [ --with-spinlocks Use spin locks instead of fcntl locks (default=no) ])
2370 if test "x$with_spinlocks" = "xyes"; then
2371 AC_DEFINE(USE_SPINLOCKS)
2375 AC_DEFINE(SPARC_SPINLOCKS)
2378 i386|i486|i586|i686)
2379 AC_DEFINE(INTEL_SPINLOCKS)
2383 AC_DEFINE(MIPS_SPINLOCKS)
2387 AC_DEFINE(POWERPC_SPINLOCKS)
2392 #################################################
2393 # check for ACL support
2395 AC_MSG_CHECKING(whether to support ACLs)
2396 AC_ARG_WITH(acl-support,
2397 [ --with-acl-support Include ACL support (default=no)],
2398 [ case "$withval" in
2403 AC_MSG_RESULT(Using UnixWare ACLs)
2404 AC_DEFINE(HAVE_UNIXWARE_ACLS)
2407 AC_MSG_RESULT(Using solaris ACLs)
2408 AC_DEFINE(HAVE_SOLARIS_ACLS)
2411 AC_MSG_RESULT(Using IRIX ACLs)
2412 AC_DEFINE(HAVE_IRIX_ACLS)
2415 AC_MSG_RESULT(Using AIX ACLs)
2416 AC_DEFINE(HAVE_AIX_ACLS)
2419 AC_MSG_RESULT(Using Tru64 ACLs)
2420 AC_DEFINE(HAVE_TRU64_ACLS)
2424 AC_CHECK_LIB(acl,acl_get_file)
2425 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2426 AC_TRY_LINK([#include <sys/types.h>
2427 #include <sys/acl.h>],
2428 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2429 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2430 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2431 AC_MSG_RESULT(Using posix ACLs)
2432 AC_DEFINE(HAVE_POSIX_ACLS)
2433 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2434 AC_TRY_LINK([#include <sys/types.h>
2435 #include <sys/acl.h>],
2436 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2437 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2438 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2439 AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2447 AC_DEFINE(HAVE_NO_ACLS)
2450 AC_DEFINE(HAVE_NO_ACLS)
2454 #################################################
2455 # Check whether winbind is supported on this platform. If so we need to
2456 # build and install client programs (WINBIND_TARGETS), sbin programs
2457 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2459 AC_MSG_CHECKING(whether to build winbind)
2461 # Initially, the value of $host_os decides whether winbind is supported
2469 winbind_no_reason=", unsupported on $host_os"
2473 # Check the setting of --with-winbindd
2475 AC_ARG_WITH(winbind,
2476 [ --with-winbind Build winbind (default, if supported by OS)],
2489 # We need unix domain sockets for winbind
2491 if test x"$HAVE_WINBIND" = x"yes"; then
2492 if test x"$samba_cv_unixsocket" = x"no"; then
2493 winbind_no_reason=", no unix domain socket support on $host_os"
2498 # Display test results
2500 if test x"$HAVE_WINBIND" = x"yes"; then
2504 WINBIND_TARGETS="\$(WINBIND_PROGS)"
2505 WINBIND_STARGETS="\$(WINBIND_SPROGS)"
2506 WINBIND_LTARGETS="\$(WINBIND_LPROGS)"
2509 WINBIND_PAM_PROGS="\$(WINBIND_PAM_PROGS)"
2513 AC_MSG_RESULT(no$winbind_no_reason)
2518 WINBIND_PAM_PROGS=""
2521 # Substitution time!
2523 AC_SUBST(WINBIND_TARGETS)
2524 AC_SUBST(WINBIND_STARGETS)
2525 AC_SUBST(WINBIND_LTARGETS)
2526 AC_SUBST(WINBIND_PAM_PROGS)
2528 #################################################
2529 # final configure stuff
2531 echo "checking configure summary"
2532 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2533 echo "configure OK";,
2534 AC_MSG_ERROR([summary failure. Aborting config]),:)
2539 AC_OUTPUT(include/stamp-h Makefile)