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.
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
32 dnl Checks for programs.
37 dnl Check if C compiler understands -c and -o at the same time
39 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
46 dnl Check if the C compiler understands volatile (it should, being ANSI).
47 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
48 AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
49 samba_cv_volatile=yes,samba_cv_volatile=no)])
50 if test x"$samba_cv_volatile" = x"yes"; then
51 AC_DEFINE(HAVE_VOLATILE)
55 #################################################
56 # set codepage directory location
57 AC_ARG_WITH(codepagedir,
58 [ --with-codepagedir=DIR Where to put codepage files (\$libdir/codepages)],
62 # Just in case anybody does it
64 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
67 codepagedir="$withval"
74 dnl Add #include for broken IRIX header files
76 *irix6*) AC_ADD_INCLUDE(<standards.h>)
80 AC_VALIDATE_CACHE_SYSTEM_TYPE
83 # Config CPPFLAG settings for strange OS's that must be set
87 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
90 # mmap on HPUX is completely broken...
91 AC_DEFINE(MMAP_BLACKLIST)
92 if test $ac_cv_prog_cc_Ae = yes; then
93 CPPFLAGS="$CPPFLAGS -Ae"
96 # Defines needed for HPUX support.
97 # HPUX has bigcrypt but (sometimes?) doesn't use it for
98 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
102 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE"
103 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
106 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE"
107 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
112 # AIX4.x doesn't even admit to having large
113 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
116 AC_MSG_RESULT([enabling large file support])
117 CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
120 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
121 # to the existance of large files..
122 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
123 # recommendations on large file support, however it makes the
124 # compile work using gcc 2.7 and 2.8, whereas using the Sun
125 # recommendation makes the compile fail on gcc2.7. JRA.
130 AC_MSG_RESULT([enabling large file support])
131 if test "$ac_cv_prog_gcc" = yes; then
132 ${CC-cc} -v >conftest.c 2>&1
133 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
135 case "$ac_cv_gcc_compiler_version_number" in
136 *"gcc version 2.6"*|*"gcc version 2.7"*)
137 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
140 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
144 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
150 # Tests needed for SINIX large file support.
153 if test $host = mips-sni-sysv4 ; then
154 AC_MSG_CHECKING([for LFS support])
155 old_CPPFLAGS="$CPPFLAGS"
156 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
160 #if _LFS64_LARGEFILE == 1
165 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
166 CPPFLAGS="$old_CPPFLAGS"
167 if test x$SINIX_LFS_SUPPORT = xyes ; then
168 CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
169 CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
170 LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
171 LIBS="`getconf LFS64_LIBS` $LIBS"
173 AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
177 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
180 AC_MSG_CHECKING([for LFS support])
181 old_CPPFLAGS="$CPPFLAGS"
182 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
185 #include <sys/utsname.h>
187 #if _LFS64_LARGEFILE == 1
192 /* Ensure this is glibc 2.2 or higher */
193 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
194 int libc_major = __GLIBC__;
195 int libc_minor = __GLIBC_MINOR__;
203 /* Ensure this is kernel 2.4 or higher */
206 release = uts.release;
207 major = atoi(strsep(&release, "."));
208 minor = atoi(strsep(&release, "."));
210 if (major > 2 || (major == 2 && minor > 3))
217 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
218 CPPFLAGS="$old_CPPFLAGS"
219 if test x$LINUX_LFS_SUPPORT = xyes ; then
220 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
222 AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
226 AC_MSG_CHECKING([for LFS support])
227 old_CPPFLAGS="$CPPFLAGS"
228 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
232 #if _LFS64_LARGEFILE == 1
237 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
238 CPPFLAGS="$old_CPPFLAGS"
239 if test x$GLIBC_LFS_SUPPORT = xyes ; then
240 CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
242 AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
252 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
253 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
254 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
255 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
256 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
257 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
258 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
259 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h)
262 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
263 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
267 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
268 ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
269 if test x"$ac_cv_header_shadow_h" = x"yes"; then
270 AC_DEFINE(HAVE_SHADOW_H)
274 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
275 AC_CHECK_HEADERS(nss.h nss_common.h sys/security.h security/pam_appl.h security/pam_modules.h)
276 AC_CHECK_HEADERS(stropts.h poll.h)
277 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
278 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
280 # For experimental utmp support (lastlog on some BSD-like systems)
281 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
283 # For quotas on Veritas VxFS filesystems
284 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
286 AC_CHECK_SIZEOF(int,cross)
287 AC_CHECK_SIZEOF(long,cross)
288 AC_CHECK_SIZEOF(short,cross)
303 AC_CHECK_TYPE(ino_t,unsigned)
304 AC_CHECK_TYPE(loff_t,off_t)
305 AC_CHECK_TYPE(offset_t,loff_t)
306 AC_CHECK_TYPE(ssize_t, int)
307 AC_CHECK_TYPE(wchar_t, unsigned short)
309 ############################################
310 # for cups support we need libcups, and a handful of header files
312 AC_CHECK_LIB(cups,httpConnect)
314 # I wonder if there is a nicer way of doing this?
316 if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
317 AC_CHECK_HEADERS(cups/cups.h cups/language.h)
318 if x"$ac_cv_header_cups_cups_h" = x"yes"; then
319 if x"$ac_cv_header_cups_language_h" = x"yes"; then
325 ############################################
326 # we need libdl for PAM and the new VFS code
327 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
328 AC_DEFINE(HAVE_LIBDL)])
330 ############################################
331 # check for unix domain sockets
332 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
334 #include <sys/types.h>
337 #include <sys/socket.h>
338 #include <sys/un.h>],
340 struct sockaddr_un sunaddr;
341 sunaddr.sun_family = AF_UNIX;
343 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
344 if test x"$samba_cv_unixsocket" = x"yes"; then
345 AC_DEFINE(HAVE_UNIXSOCKET)
349 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
351 #include <sys/types.h>
356 #include <sys/socket.h>],[socklen_t i = 0],
357 samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
358 if test x"$samba_cv_socklen_t" = x"yes"; then
359 AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
362 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
364 #include <sys/types.h>
369 #include <signal.h>],[sig_atomic_t i = 0],
370 samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
371 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
372 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
375 # stupid headers have the functions but no declaration. grrrr.
376 AC_HAVE_DECL(errno, [#include <errno.h>])
377 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
378 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
379 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
380 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
381 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
382 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
384 # and glibc has setresuid under linux but the function does
385 # nothing until kernel 2.1.44! very dumb.
386 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
387 AC_TRY_RUN([#include <errno.h>
388 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
389 samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
390 if test x"$samba_cv_have_setresuid" = x"yes"; then
391 AC_DEFINE(HAVE_SETRESUID)
394 # Do the same check for setresguid...
396 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
397 AC_TRY_RUN([#include <unistd.h>
399 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
400 samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
401 if test x"$samba_cv_have_setresgid" = x"yes"; then
402 AC_DEFINE(HAVE_SETRESGID)
407 ###############################################
408 # test for where we get crypt() from
409 AC_CHECK_FUNCS(crypt)
410 if test x"$ac_cv_func_crypt" = x"no"; then
411 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
412 AC_DEFINE(HAVE_CRYPT)])
416 ###############################################
417 # Readline included by default unless explicitly asked not to
418 test "${with_readline+set}" != "set" && with_readline=yes
420 # test for where we get readline() from
421 AC_MSG_CHECKING(whether to use readline)
422 AC_ARG_WITH(readline,
423 [ --with-readline[=DIR] Look for readline include/libs in DIR
424 --without-readline Don't include readline support],
425 [ case "$with_readline" in
429 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
430 AC_CHECK_HEADERS(readline/history.h)
432 AC_CHECK_HEADERS(readline.h readline/readline.h,[
433 for termlib in ncurses curses termcap terminfo termlib; do
434 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
436 AC_CHECK_LIB(readline, rl_callback_handler_install,
437 [TERMLIBS="-lreadline $TERMLIBS"
438 AC_DEFINE(HAVE_LIBREADLINE)
439 break], [TERMLIBS=], $TERMLIBS)])
447 # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
448 # alternate readline path
450 _cppflags=${CPPFLAGS}
452 # Add additional search path
453 LDFLAGS="-L$with_readline/lib $LDFLAGS"
454 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
456 AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
457 AC_CHECK_HEADERS(readline/history.h)
459 AC_CHECK_HEADERS(readline.h readline/readline.h,[
460 for termlib in ncurses curses termcap terminfo termlib; do
461 AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
463 AC_CHECK_LIB(readline, rl_callback_handler_install,
464 [TERMLDFLAGS="-L$with_readline/lib"
465 TERMCPPFLAGS="-I$with_readline/include"
466 CPPFLAGS="-I$with_readline/include $CPPFLAGS"
467 TERMLIBS="-lreadline $TERMLIBS"
468 AC_DEFINE(HAVE_LIBREADLINE)
469 break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
477 AC_SUBST(TERMLDFLAGS)
479 # The following test taken from the cvs sources
480 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
481 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
482 # libsocket.so which has a bad implementation of gethostbyname (it
483 # only looks in /etc/hosts), so we only look for -lsocket if we need
485 AC_CHECK_FUNCS(connect)
486 if test x"$ac_cv_func_connect" = x"no"; then
489 *) AC_CHECK_LIB(nsl_s, printf) ;;
493 *) AC_CHECK_LIB(nsl, printf) ;;
497 *) AC_CHECK_LIB(socket, connect) ;;
501 *) AC_CHECK_LIB(inet, connect) ;;
503 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
505 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
506 test x"$ac_cv_lib_inet_connect" = x"yes"; then
507 # ac_cv_func_connect=yes
508 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
509 AC_DEFINE(HAVE_CONNECT)
513 ###############################################
514 # test for where we get get_yp_default_domain() from
515 AC_CHECK_FUNCS(yp_get_default_domain)
516 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
517 AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
518 AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)])
521 # Check if we have execl, if not we need to compile smbrun.
522 AC_CHECK_FUNCS(execl)
523 if test x"$ac_cv_func_execl" = x"no"; then
529 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
530 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
531 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
532 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
533 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
534 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
535 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
536 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
537 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
538 # setbuffer is needed for smbtorture
539 AC_CHECK_FUNCS(setbuffer)
541 # syscall() is needed for smbwrapper.
542 AC_CHECK_FUNCS(syscall)
544 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
545 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
546 AC_CHECK_FUNCS(__getcwd _getcwd)
547 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
548 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
549 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
550 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
551 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
552 AC_CHECK_FUNCS(_write __write _fork __fork)
553 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
554 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
555 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
556 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
557 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
560 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
563 if test x$ac_cv_func_stat64 = xno ; then
564 AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
566 #if defined(HAVE_UNISTD_H)
569 #include <sys/stat.h>
570 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
571 AC_MSG_RESULT([$ac_cv_func_stat64])
572 if test x$ac_cv_func_stat64 = xyes ; then
573 AC_DEFINE(HAVE_STAT64)
577 if test x$ac_cv_func_lstat64 = xno ; then
578 AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
580 #if defined(HAVE_UNISTD_H)
583 #include <sys/stat.h>
584 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
585 AC_MSG_RESULT([$ac_cv_func_lstat64])
586 if test x$ac_cv_func_lstat64 = xyes ; then
587 AC_DEFINE(HAVE_LSTAT64)
591 if test x$ac_cv_func_fstat64 = xno ; then
592 AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
594 #if defined(HAVE_UNISTD_H)
597 #include <sys/stat.h>
598 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
599 AC_MSG_RESULT([$ac_cv_func_fstat64])
600 if test x$ac_cv_func_fstat64 = xyes ; then
601 AC_DEFINE(HAVE_FSTAT64)
606 # If no strcasecmp, check for it in some known places
607 # It is in -lresolv on ReliantUNIX and UnixWare
608 # -lresolve *must* follow -lnsl for name resolution to work properly
611 if test x$ac_cv_func_strcasecmp = xno ; then
612 AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
613 AC_DEFINE(HAVE_STRCASECMP))
617 # Check for the functions putprpwnam, set_auth_parameters,
618 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
619 # Needed for OSF1 and HPUX.
622 AC_LIBTESTFUNC(security, putprpwnam)
623 AC_LIBTESTFUNC(sec, putprpwnam)
625 AC_LIBTESTFUNC(security, set_auth_parameters)
626 AC_LIBTESTFUNC(sec, set_auth_parameters)
628 # UnixWare 7.x has its getspnam in -lgen
629 AC_LIBTESTFUNC(gen, getspnam)
631 AC_LIBTESTFUNC(security, getspnam)
632 AC_LIBTESTFUNC(sec, getspnam)
634 AC_LIBTESTFUNC(security, bigcrypt)
635 AC_LIBTESTFUNC(sec, bigcrypt)
637 AC_LIBTESTFUNC(security, getprpwnam)
638 AC_LIBTESTFUNC(sec, getprpwnam)
640 # this bit needs to be modified for each OS that is suported by
641 # smbwrapper. You need to specify how to created a shared library and
642 # how to compile C code to produce PIC object files
644 # these are the defaults, good for lots of systems
654 # and these are for particular systems
656 *linux*) AC_DEFINE(LINUX)
661 *solaris*) AC_DEFINE(SUNOS5)
663 LDSHFLAGS="-Wl,-h,\$@.so -G"
664 if test "${ac_cv_prog_CC}" = "gcc"; then
672 *sunos*) AC_DEFINE(SUNOS4)
674 LDSHFLAGS="-Wl,-h,\$@ -G"
675 PICFLAG="-KPIC -O2" # Is this correct for SunOS
677 *bsd*) BLDSHARED="true"
678 LDSHFLAGS="-Wl,-soname,\$@ -shared"
681 *irix*) AC_DEFINE(IRIX)
683 *irix6*) AC_DEFINE(IRIX6)
686 ATTEMPT_WRAP32_BUILD=yes
688 LDSHFLAGS="-Wl,-soname,\$@ -shared"
689 if test "${ac_cv_prog_CC}" = "gcc"; then
695 *aix*) AC_DEFINE(AIX)
697 LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
698 PICFLAG="-O2 -qmaxmem=6000"
700 *hpux*) AC_DEFINE(HPUX)
702 # Use special PIC flags for the native HP-UX compiler.
703 if test $ac_cv_prog_cc_Ae = yes; then
705 LDSHFLAGS="-b -z +h \$@"
709 *qnx*) AC_DEFINE(QNX);;
710 *osf*) AC_DEFINE(OSF1)
712 LDSHFLAGS="-Wl,-soname,\$@ -shared"
715 *sco*) AC_DEFINE(SCO);;
716 *unixware*) AC_DEFINE(UNIXWARE)
718 LDSHFLAGS="-Wl,-soname,\$@ -shared"
721 *next2*) AC_DEFINE(NEXT2);;
722 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
725 *-univel-*) if [ test "$GCC" != yes ]; then
726 AC_DEFINE(HAVE_MEMSET)
730 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
734 if [ test "$GCC" != yes ]; then
735 AC_DEFINE(HAVE_MEMSET)
743 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
744 AC_TRY_RUN([#include <stdio.h>
745 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
746 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
747 if test x"$samba_cv_have_longlong" = x"yes"; then
748 AC_DEFINE(HAVE_LONGLONG)
752 # Check if the compiler supports the LL prefix on long long integers.
755 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
756 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
757 samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
758 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
759 AC_DEFINE(COMPILER_SUPPORTS_LL)
763 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
764 AC_TRY_RUN([#include <stdio.h>
765 #include <sys/stat.h>
766 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
767 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
768 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
769 AC_DEFINE(SIZEOF_OFF_T,8)
772 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
774 #if defined(HAVE_UNISTD_H)
778 #include <sys/stat.h>
779 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
780 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
781 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
782 AC_DEFINE(HAVE_OFF64_T)
785 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
786 AC_TRY_RUN([#include <stdio.h>
787 #include <sys/stat.h>
788 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
789 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
790 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
791 AC_DEFINE(SIZEOF_INO_T,8)
794 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
796 #if defined(HAVE_UNISTD_H)
800 #include <sys/stat.h>
801 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
802 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
803 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
804 AC_DEFINE(HAVE_INO64_T)
807 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
809 #if defined(HAVE_UNISTD_H)
812 #include <sys/types.h>
813 #include <dirent.h>],
814 [struct dirent64 de;],
815 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
816 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
817 AC_DEFINE(HAVE_STRUCT_DIRENT64)
820 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
821 AC_TRY_RUN([#include <stdio.h>
822 main() { char c; c=250; exit((c > 0)?0:1); }],
823 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
824 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
825 AC_DEFINE(HAVE_UNSIGNED_CHAR)
828 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
829 AC_TRY_COMPILE([#include <sys/types.h>
830 #include <sys/socket.h>
831 #include <netinet/in.h>],
832 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
833 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
834 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
835 AC_DEFINE(HAVE_SOCK_SIN_LEN)
838 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
839 AC_TRY_COMPILE([#include <sys/types.h>
841 void seekdir(DIR *d, long loc) { return; }],[return 0;],
842 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
843 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
844 AC_DEFINE(SEEKDIR_RETURNS_VOID)
847 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
848 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
849 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
850 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
851 AC_DEFINE(HAVE_FILE_MACRO)
854 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
855 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
856 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
857 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
858 AC_DEFINE(HAVE_FUNCTION_MACRO)
861 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
863 #include <sys/time.h>
865 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
866 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
867 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
868 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
871 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
873 #include <sys/types.h>
875 void foo(const char *format, ...) {
880 va_start(ap, format);
881 len = vsnprintf(0, 0, format, ap);
883 if (len != 5) exit(1);
885 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
889 main() { foo("hello"); }
891 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
892 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
893 AC_DEFINE(HAVE_C99_VSNPRINTF)
896 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
897 AC_TRY_RUN([#include <sys/types.h>
899 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
900 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
901 di->d_name[0] == 0) exit(0); exit(1);} ],
902 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
903 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
904 AC_DEFINE(HAVE_BROKEN_READDIR)
907 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
908 AC_TRY_COMPILE([#include <sys/types.h>
910 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
911 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
912 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
913 AC_DEFINE(HAVE_UTIMBUF)
916 dnl utmp and utmpx come in many flavours
917 dnl We need to check for many of them
918 dnl But we don't need to do each and every one, because our code uses
919 dnl mostly just the utmp (not utmpx) fields.
921 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
923 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
924 AC_TRY_COMPILE([#include <sys/types.h>
926 [struct utmp ut; ut.ut_name[0] = 'a';],
927 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
928 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
929 AC_DEFINE(HAVE_UT_UT_NAME)
932 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
933 AC_TRY_COMPILE([#include <sys/types.h>
935 [struct utmp ut; ut.ut_user[0] = 'a';],
936 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
937 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
938 AC_DEFINE(HAVE_UT_UT_USER)
941 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
942 AC_TRY_COMPILE([#include <sys/types.h>
944 [struct utmp ut; ut.ut_id[0] = 'a';],
945 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
946 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
947 AC_DEFINE(HAVE_UT_UT_ID)
950 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
951 AC_TRY_COMPILE([#include <sys/types.h>
953 [struct utmp ut; ut.ut_host[0] = 'a';],
954 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
955 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
956 AC_DEFINE(HAVE_UT_UT_HOST)
959 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
960 AC_TRY_COMPILE([#include <sys/types.h>
962 [struct utmp ut; time_t t; ut.ut_time = t;],
963 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
964 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
965 AC_DEFINE(HAVE_UT_UT_TIME)
968 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
969 AC_TRY_COMPILE([#include <sys/types.h>
971 [struct utmp ut; struct timeval tv; ut.ut_tv = tv;],
972 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
973 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
974 AC_DEFINE(HAVE_UT_UT_TV)
977 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
978 AC_TRY_COMPILE([#include <sys/types.h>
980 [struct utmp ut; ut.ut_type = 0;],
981 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
982 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
983 AC_DEFINE(HAVE_UT_UT_TYPE)
986 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
987 AC_TRY_COMPILE([#include <sys/types.h>
989 [struct utmp ut; ut.ut_pid = 0;],
990 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
991 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
992 AC_DEFINE(HAVE_UT_UT_PID)
995 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
996 AC_TRY_COMPILE([#include <sys/types.h>
998 [struct utmp ut; ut.ut_exit.e_exit = 0;],
999 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1000 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1001 AC_DEFINE(HAVE_UT_UT_EXIT)
1004 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1005 AC_TRY_COMPILE([#include <sys/types.h>
1007 [struct utmp ut; ut.ut_addr = 0;],
1008 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1009 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1010 AC_DEFINE(HAVE_UT_UT_ADDR)
1013 if test x$ac_cv_func_pututline = xyes ; then
1014 AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1015 AC_TRY_COMPILE([#include <sys/types.h>
1017 [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1018 samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1019 if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1020 AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1024 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1025 AC_TRY_COMPILE([#include <sys/types.h>
1026 #include <utmpx.h>],
1027 [struct utmpx ux; ux.ut_syslen = 0;],
1028 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1029 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1030 AC_DEFINE(HAVE_UX_UT_SYSLEN)
1034 #################################################
1035 # check for libiconv support
1036 AC_MSG_CHECKING(whether to use libiconv)
1037 AC_ARG_WITH(libiconv,
1038 [ --with-libiconv=BASEDIR use libiconv in BASEDIR/lib and BASEDIR/include
1039 --without-libiconv Don't use libiconv library],
1040 [ case "$withval" in
1046 CFLAGS="$CFLAGS -I$withval/include"
1047 LDFLAGS="$LDFLAGS -L$withval/lib"
1048 AC_CHECK_LIB(iconv, iconv_open)
1056 # check for iconv in libc
1057 AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1061 iconv_t cd = iconv_open("ASCII", "UCS-2LE");
1062 if (cd == 0 || cd == (iconv_t)-1) return -1;
1066 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
1067 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1068 AC_DEFINE(HAVE_NATIVE_ICONV)
1072 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1074 #include <sys/types.h>
1077 #define F_GETLEASE 1025
1080 int fd = open("/dev/null", O_RDONLY);
1081 return fcntl(fd, F_GETLEASE, 0) == -1;
1084 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1085 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1086 AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1089 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1091 #include <sys/types.h>
1095 #define F_NOTIFY 1026
1098 exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ? 1 : 0);
1101 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1102 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1103 AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1106 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1108 #include <sys/types.h>
1111 #include <sys/file.h>
1113 #define LOCK_MAND 32
1114 #define LOCK_READ 64
1117 exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1120 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1121 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1122 AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1128 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1129 AC_TRY_COMPILE([#include <sys/types.h>
1130 #include <fcntl.h>],
1131 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1132 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1133 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1134 AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1137 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1138 AC_TRY_RUN([#include <sys/types.h>
1139 #include <sys/capability.h>
1142 if ((cap = cap_get_proc()) == NULL)
1144 cap->cap_effective |= CAP_NETWORK_MGT;
1145 cap->cap_inheritable |= CAP_NETWORK_MGT;
1150 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1151 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1152 AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1156 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1157 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1160 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1161 AC_TRY_COMPILE([#include <sys/types.h>
1162 #if defined(HAVE_RPC_RPC_H)
1163 #include <rpc/rpc.h>
1166 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1167 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1168 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1171 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1172 AC_TRY_COMPILE([#include <sys/types.h>
1173 #if defined(HAVE_RPC_RPC_H)
1174 #include <rpc/rpc.h>
1177 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1178 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1179 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1182 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1183 AC_TRY_COMPILE([#include <sys/types.h>
1184 #if defined(HAVE_RPC_RPC_H)
1185 #include <rpc/rpc.h>
1188 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1189 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1190 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1193 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1194 AC_TRY_COMPILE([#include <sys/types.h>
1195 #if defined(HAVE_RPC_RPC_H)
1196 #include <rpc/rpc.h>
1199 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1200 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1201 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1205 dnl Some systems (SCO) have a problem including
1206 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1207 dnl as a #define in <prot.h> and as part of an enum
1211 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1212 AC_TRY_COMPILE([#include <sys/types.h>
1213 #ifdef HAVE_SYS_SECURITY_H
1214 #include <sys/security.h>
1216 #endif /* HAVE_SYS_SECURITY_H */
1217 #if defined(HAVE_RPC_RPC_H)
1218 #include <rpc/rpc.h>
1221 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1222 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1223 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1226 AC_MSG_CHECKING([for test routines])
1227 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1229 AC_MSG_ERROR([cant find test code. Aborting config]),
1230 AC_MSG_WARN([cannot run when cross-compiling]))
1232 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1233 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1234 samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1235 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1236 AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1239 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1240 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1241 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1242 samba_cv_HAVE_WORKING_AF_LOCAL=no,
1243 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1244 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1246 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1249 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1250 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1251 samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1252 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1253 AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1256 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1257 SAVE_CPPFLAGS="$CPPFLAGS"
1258 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
1260 #define REPLACE_GETPASS 1
1261 #define NO_CONFIG_H 1
1262 #define main dont_declare_main
1263 #include "${srcdir-.}/lib/getsmbpass.c"
1265 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1266 CPPFLAGS="$SAVE_CPPFLAGS"
1268 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1269 AC_DEFINE(REPLACE_GETPASS)
1272 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1275 #include <sys/types.h>
1276 #include <netinet/in.h>
1277 #ifdef HAVE_ARPA_INET_H
1278 #include <arpa/inet.h>
1280 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1281 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1282 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
1284 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1285 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1286 AC_DEFINE(REPLACE_INET_NTOA)
1289 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1290 AC_TRY_RUN([#include <stdlib.h>
1291 #include <sys/types.h>
1292 #include <sys/stat.h>
1296 char tpl[20]="/tmp/test.XXXXXX";
1297 int fd = mkstemp(tpl);
1298 if (fd == -1) exit(1);
1300 if (fstat(fd, &st) != 0) exit(1);
1301 if ((st.st_mode & 0777) != 0600) exit(1);
1304 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1305 samba_cv_HAVE_SECURE_MKSTEMP=no,
1306 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1307 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1308 AC_DEFINE(HAVE_SECURE_MKSTEMP)
1311 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1312 AC_TRY_RUN([#include <unistd.h>
1313 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1314 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1315 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1316 AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1319 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1320 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1321 samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1322 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1323 AC_DEFINE(HAVE_ROOT)
1325 AC_MSG_WARN(running as non-root will disable some tests)
1329 # look for a method of finding the list of network interfaces
1331 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1333 #define HAVE_IFACE_AIX 1
1334 #define AUTOCONF_TEST 1
1335 #include "confdefs.h"
1336 #include "${srcdir-.}/lib/interfaces.c"],
1337 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1338 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1339 iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1342 if test $iface = no; then
1343 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1345 #define HAVE_IFACE_IFCONF 1
1346 #define AUTOCONF_TEST 1
1347 #include "confdefs.h"
1348 #include "${srcdir-.}/lib/interfaces.c"],
1349 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1350 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1351 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1355 if test $iface = no; then
1356 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1358 #define HAVE_IFACE_IFREQ 1
1359 #define AUTOCONF_TEST 1
1360 #include "confdefs.h"
1361 #include "${srcdir-.}/lib/interfaces.c"],
1362 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1363 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1364 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1369 ################################################
1370 # look for a method of setting the effective uid
1372 if test $seteuid = no; then
1373 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1375 #define AUTOCONF_TEST 1
1376 #define USE_SETRESUID 1
1377 #include "confdefs.h"
1378 #include "${srcdir-.}/lib/util_sec.c"],
1379 samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1380 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1381 seteuid=yes;AC_DEFINE(USE_SETRESUID)
1386 if test $seteuid = no; then
1387 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1389 #define AUTOCONF_TEST 1
1390 #define USE_SETREUID 1
1391 #include "confdefs.h"
1392 #include "${srcdir-.}/lib/util_sec.c"],
1393 samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1394 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1395 seteuid=yes;AC_DEFINE(USE_SETREUID)
1399 if test $seteuid = no; then
1400 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1402 #define AUTOCONF_TEST 1
1403 #define USE_SETEUID 1
1404 #include "confdefs.h"
1405 #include "${srcdir-.}/lib/util_sec.c"],
1406 samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1407 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1408 seteuid=yes;AC_DEFINE(USE_SETEUID)
1412 if test $seteuid = no; then
1413 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1415 #define AUTOCONF_TEST 1
1416 #define USE_SETUIDX 1
1417 #include "confdefs.h"
1418 #include "${srcdir-.}/lib/util_sec.c"],
1419 samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1420 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1421 seteuid=yes;AC_DEFINE(USE_SETUIDX)
1426 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1427 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1428 samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1429 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1430 AC_DEFINE(HAVE_MMAP)
1433 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1434 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1435 samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1436 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1437 AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1440 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1441 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1442 samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1443 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1444 AC_DEFINE(HAVE_FCNTL_LOCK)
1447 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1448 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1449 samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1450 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1451 AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1456 dnl Don't check for 64 bit fcntl locking if we know that the
1457 dnl glibc2.1 broken check has succeeded.
1460 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1462 #if defined(HAVE_UNISTD_H)
1472 #ifdef HAVE_SYS_FCNTL_H
1473 #include <sys/fcntl.h>
1475 main() { struct flock64 fl64;
1476 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1482 samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1484 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1485 AC_DEFINE(HAVE_STRUCT_FLOCK64)
1489 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1490 AC_TRY_COMPILE([#include <sys/acl.h>
1491 #if defined(HAVE_RPCSVC_NIS_H)
1492 #include <rpcsvc/nis.h>
1495 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1496 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1497 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1501 #################################################
1502 # check for smbwrapper support
1503 AC_MSG_CHECKING(whether to use smbwrapper)
1504 AC_ARG_WITH(smbwrapper,
1505 [ --with-smbwrapper Include SMB wrapper support
1506 --without-smbwrapper Don't include SMB wrapper support (default)],
1507 [ case "$withval" in
1510 AC_DEFINE(WITH_SMBWRAPPER)
1511 WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1513 if test x$ATTEMPT_WRAP32_BUILD = x; then
1516 WRAP32=bin/smbwrapper.32.$SHLIBEXT
1519 # Conditions under which smbwrapper should not be built.
1521 if test x$PICFLAG = x; then
1522 echo No support for PIC code - disabling smbwrapper and smbsh
1525 elif test x$ac_cv_func_syscall = xno; then
1526 AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1538 #################################################
1539 # check for the AFS filesystem
1540 AC_MSG_CHECKING(whether to use AFS)
1542 [ --with-afs Include AFS support
1543 --without-afs Don't include AFS support (default)],
1544 [ case "$withval" in
1557 #################################################
1558 # check for the DFS auth system
1559 AC_MSG_CHECKING(whether to use DFS auth)
1561 [ --with-dfs Include DFS support
1562 --without-dfs Don't include DFS support (default)],
1563 [ case "$withval" in
1575 #################################################
1576 # check for Kerberos IV auth system
1577 AC_MSG_CHECKING(whether to use Kerberos IV)
1579 [ --with-krb4=base-dir Include Kerberos IV support
1580 --without-krb4 Don't include Kerberos IV support (default)],
1581 [ case "$withval" in
1584 AC_DEFINE(KRB4_AUTH)
1585 AC_CHECK_LIB(resolv, dn_expand)
1586 LIBS="$LIBS -lkrb -ldes"
1587 CFLAGS="$CFLAGS -I$withval/include"
1588 LDFLAGS="$LDFLAGS -L$withval/lib"
1597 #################################################
1598 # check for Kerberos 5 auth system
1599 AC_MSG_CHECKING(whether to use Kerberos 5)
1601 [ --with-krb5=base-dir Include Kerberos 5 support
1602 --without-krb5 Don't include Kerberos 5 support (default)],
1603 [ case "$withval" in
1606 AC_DEFINE(KRB5_AUTH)
1607 LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
1608 CFLAGS="$CFLAGS -I$withval/include"
1609 LDFLAGS="$LDFLAGS -L$withval/lib"
1618 #################################################
1619 # check for automount support
1620 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1621 AC_ARG_WITH(automount,
1622 [ --with-automount Include AUTOMOUNT support
1623 --without-automount Don't include AUTOMOUNT support (default)],
1624 [ case "$withval" in
1627 AC_DEFINE(WITH_AUTOMOUNT)
1636 #################################################
1637 # check for smbmount support
1638 AC_MSG_CHECKING(whether to use SMBMOUNT)
1639 AC_ARG_WITH(smbmount,
1640 [ --with-smbmount Include SMBMOUNT (Linux only) support
1641 --without-smbmount Don't include SMBMOUNT support (default)],
1642 [ case "$withval" in
1645 AC_DEFINE(WITH_SMBMOUNT)
1646 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1658 #################################################
1659 # check for a PAM password database
1660 with_pam_for_crypt=no
1661 AC_MSG_CHECKING(whether to use PAM password database)
1663 [ --with-pam Include PAM password database support
1664 --without-pam Don't include PAM password database support (default)],
1665 [ case "$withval" in
1670 with_pam_for_crypt=yes
1679 # we can't build a pam module if we don't have pam.
1680 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
1682 #################################################
1683 # check for pam_smbpass support
1684 AC_MSG_CHECKING(whether to use pam_smbpass)
1685 AC_ARG_WITH(pam_smbpass,
1686 [ --with-pam_smbpass Include the smbpass PAM module
1687 --without-pam_smbpass Don't include the smbpass PAM module (default)],
1688 [ case "$withval" in
1692 # Conditions under which pam_smbpass should not be built.
1694 if test x$PICFLAG = x; then
1695 AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
1697 elif test x$ac_cv_lib_pam_pam_get_data = xno; then
1698 AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
1701 AC_DEFINE(WITH_PAM_SMBPASS)
1702 PAM_MOD="bin/pam_smbpass.so"
1713 ###############################################
1714 # test for where we get crypt() from, but only
1716 if test $with_pam_for_crypt = no; then
1717 AC_CHECK_FUNCS(crypt)
1718 if test x"$ac_cv_func_crypt" = x"no"; then
1719 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
1720 AC_DEFINE(HAVE_CRYPT)])
1725 ## moved after the check for -lcrypt in order to
1726 ## ensure that the necessary libraries are included
1727 ## check checking for truncated salt. Wrapped by the
1728 ## $with_pam_for_crypt variable as above --jerry
1730 if test $with_pam_for_crypt = no; then
1731 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1732 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1733 samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
1734 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1735 AC_DEFINE(HAVE_TRUNCATED_SALT)
1740 #################################################
1741 # check for a TDB password database
1742 AC_MSG_CHECKING(whether to use TDB password database)
1744 [ --with-tdbsam Include experimental TDB password database
1745 --without-tdbsam Don't include experimental TDB password database (default)],
1746 [ case "$withval" in
1749 AC_DEFINE(WITH_TDBPWD)
1750 # AC_MSG_ERROR([TDB password database not supported in this version.])
1759 #################################################
1760 # check for a LDAP password database
1761 AC_MSG_CHECKING(whether to use LDAP password database)
1763 [ --with-ldap Include LDAP support
1764 --without-ldap Don't include LDAP support (default)],
1765 [ case "$withval" in
1768 AC_DEFINE(WITH_LDAP)
1769 AC_MSG_ERROR([LDAP password database not supported in this version.])
1778 #################################################
1779 # check for a NISPLUS password database
1780 AC_MSG_CHECKING(whether to use NISPLUS password database)
1781 AC_ARG_WITH(nisplus,
1782 [ --with-nisplus Include NISPLUS password database support
1783 --without-nisplus Don't include NISPLUS password database support (default)],
1784 [ case "$withval" in
1787 AC_DEFINE(WITH_NISPLUS)
1796 #################################################
1797 # check for a NISPLUS_HOME support
1798 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
1799 AC_ARG_WITH(nisplus-home,
1800 [ --with-nisplus-home Include NISPLUS_HOME support
1801 --without-nisplus-home Don't include NISPLUS_HOME support (default)],
1802 [ case "$withval" in
1805 AC_DEFINE(WITH_NISPLUS_HOME)
1814 #################################################
1815 # check for the secure socket layer
1816 AC_MSG_CHECKING(whether to use SSL)
1818 [ --with-ssl Include SSL support
1819 --without-ssl Don't include SSL support (default)
1820 --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl)],
1821 [ case "$withval" in
1825 withval="/usr/local/ssl" # default
1827 if test "${with_sslinc+set}" = set; then
1829 withval="$with_sslinc"
1832 echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
1833 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1834 LIBS="-lssl -lcrypto $LIBS"
1835 LDFLAGS="=L/usr/local/ssl/lib $LDFLAGS"
1838 CFLAGS="-I${withval} $CFLAGS"
1839 LIBS="-lssl -lcrypto $LIBS"
1840 LDFLAGS="-L${withval}/lib $LDFLAGS"
1846 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1847 LIBS="-lssl -lcrypto $LIBS"
1848 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1852 if test ! -d ${withval}; then
1853 echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
1857 CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS" # Damn, SSLeay defines its own
1867 #################################################
1868 # check for syslog logging
1869 AC_MSG_CHECKING(whether to use syslog logging)
1871 [ --with-syslog Include experimental SYSLOG support
1872 --without-syslog Don't include SYSLOG support (default)],
1873 [ case "$withval" in
1876 AC_DEFINE(WITH_SYSLOG)
1885 #################################################
1886 # check for a shared memory profiling support
1887 AC_MSG_CHECKING(whether to use profiling)
1888 AC_ARG_WITH(profile,
1889 [ --with-profiling-data Include gathering source code profile information
1890 --without-profiling-data Don't include support for gathering source code profile information (default)],
1891 [ case "$withval" in
1894 AC_DEFINE(WITH_PROFILE)
1904 #################################################
1905 # check for experimental netatalk resource fork support
1906 AC_MSG_CHECKING(whether to support netatalk)
1907 AC_ARG_WITH(netatalk,
1908 [ --with-netatalk Include experimental Netatalk support
1909 --without-netatalk Don't include experimental Netatalk support (default)],
1910 [ case "$withval" in
1913 AC_DEFINE(WITH_NETATALK)
1922 #################################################
1923 # check for experimental disk-quotas support
1924 QUOTAOBJS=smbd/noquotas.o
1926 AC_MSG_CHECKING(whether to support disk-quotas)
1928 [ --with-quotas Include experimental disk-quota support
1929 --without-quotas Don't include experimental disk-quota support (default)],
1930 [ case "$withval" in
1933 QUOTAOBJS=smbd/quotas.o
1943 #################################################
1944 # check for experimental utmp accounting
1946 AC_MSG_CHECKING(whether to support utmp accounting)
1948 [ --with-utmp Include experimental utmp accounting
1949 --without-utmp Don't include experimental utmp accounting (default)],
1950 [ case "$withval" in
1953 AC_DEFINE(WITH_UTMP)
1962 #################################################
1963 # check for MS Dfs support
1965 AC_MSG_CHECKING(whether to support Microsoft Dfs)
1967 [ --with-msdfs Include MS Dfs support
1968 --without-msdfs Don't include MS Dfs support (default)],
1969 [ case "$withval" in
1972 AC_DEFINE(WITH_MSDFS)
1981 #################################################
1982 # set private directory location
1983 AC_ARG_WITH(privatedir,
1984 [ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
1985 [ case "$withval" in
1988 # Just in case anybody calls it without argument
1990 AC_MSG_WARN([--with-privatedir called without argument - will use default])
1991 privatedir='${prefix}/private'
1994 privatedir="$withval"
1997 AC_SUBST(privatedir)],
1998 [privatedir='${prefix}/private'
1999 AC_SUBST(privatedir)]
2002 #################################################
2003 # set lock directory location
2004 AC_ARG_WITH(lockdir,
2005 [ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
2006 [ case "$withval" in
2009 # Just in case anybody calls it without argument
2011 AC_MSG_WARN([--with-lockdir called without argument - will use default])
2012 lockdir='$(VARDIR)/locks'
2019 [lockdir='$(VARDIR)/locks'
2023 #################################################
2024 # set SWAT directory location
2025 AC_ARG_WITH(swatdir,
2026 [ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)],
2027 [ case "$withval" in
2030 # Just in case anybody does it
2032 AC_MSG_WARN([--with-swatdir called without argument - will use default])
2033 swatdir='${prefix}/swat'
2040 [swatdir='${prefix}/swat'
2044 #################################################
2045 # these tests are taken from the GNU fileutils package
2046 AC_CHECKING(how to get filesystem space usage)
2049 # Test for statvfs64.
2050 if test $space = no; then
2052 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2054 #if defined(HAVE_UNISTD_H)
2057 #include <sys/types.h>
2058 #include <sys/statvfs.h>
2061 struct statvfs64 fsd;
2062 exit (statvfs64 (".", &fsd));
2064 fu_cv_sys_stat_statvfs64=yes,
2065 fu_cv_sys_stat_statvfs64=no,
2066 fu_cv_sys_stat_statvfs64=cross)])
2067 if test $fu_cv_sys_stat_statvfs64 = yes; then
2069 AC_DEFINE(STAT_STATVFS64)
2073 # Perform only the link test since it seems there are no variants of the
2074 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
2075 # because that got a false positive on SCO OSR5. Adding the declaration
2076 # of a `struct statvfs' causes this test to fail (as it should) on such
2077 # systems. That system is reported to work fine with STAT_STATFS4 which
2078 # is what it gets when this test fails.
2079 if test $space = no; then
2081 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2082 [AC_TRY_LINK([#include <sys/types.h>
2083 #include <sys/statvfs.h>],
2084 [struct statvfs fsd; statvfs (0, &fsd);],
2085 fu_cv_sys_stat_statvfs=yes,
2086 fu_cv_sys_stat_statvfs=no)])
2087 if test $fu_cv_sys_stat_statvfs = yes; then
2089 AC_DEFINE(STAT_STATVFS)
2093 if test $space = no; then
2094 # DEC Alpha running OSF/1
2095 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2096 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2098 #include <sys/param.h>
2099 #include <sys/types.h>
2100 #include <sys/mount.h>
2105 exit (statfs (".", &fsd, sizeof (struct statfs)));
2107 fu_cv_sys_stat_statfs3_osf1=yes,
2108 fu_cv_sys_stat_statfs3_osf1=no,
2109 fu_cv_sys_stat_statfs3_osf1=no)])
2110 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2111 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2113 AC_DEFINE(STAT_STATFS3_OSF1)
2117 if test $space = no; then
2119 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2120 member (AIX, 4.3BSD)])
2121 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2123 #ifdef HAVE_SYS_PARAM_H
2124 #include <sys/param.h>
2126 #ifdef HAVE_SYS_MOUNT_H
2127 #include <sys/mount.h>
2129 #ifdef HAVE_SYS_VFS_H
2130 #include <sys/vfs.h>
2136 exit (statfs (".", &fsd));
2138 fu_cv_sys_stat_statfs2_bsize=yes,
2139 fu_cv_sys_stat_statfs2_bsize=no,
2140 fu_cv_sys_stat_statfs2_bsize=no)])
2141 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2142 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2144 AC_DEFINE(STAT_STATFS2_BSIZE)
2148 if test $space = no; then
2150 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2151 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2152 [AC_TRY_RUN([#include <sys/types.h>
2153 #include <sys/statfs.h>
2157 exit (statfs (".", &fsd, sizeof fsd, 0));
2159 fu_cv_sys_stat_statfs4=yes,
2160 fu_cv_sys_stat_statfs4=no,
2161 fu_cv_sys_stat_statfs4=no)])
2162 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2163 if test $fu_cv_sys_stat_statfs4 = yes; then
2165 AC_DEFINE(STAT_STATFS4)
2169 if test $space = no; then
2171 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2172 member (4.4BSD and NetBSD)])
2173 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2174 [AC_TRY_RUN([#include <sys/types.h>
2175 #ifdef HAVE_SYS_PARAM_H
2176 #include <sys/param.h>
2178 #ifdef HAVE_SYS_MOUNT_H
2179 #include <sys/mount.h>
2185 exit (statfs (".", &fsd));
2187 fu_cv_sys_stat_statfs2_fsize=yes,
2188 fu_cv_sys_stat_statfs2_fsize=no,
2189 fu_cv_sys_stat_statfs2_fsize=no)])
2190 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2191 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2193 AC_DEFINE(STAT_STATFS2_FSIZE)
2197 if test $space = no; then
2199 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2200 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2201 [AC_TRY_RUN([#include <sys/types.h>
2202 #ifdef HAVE_SYS_PARAM_H
2203 #include <sys/param.h>
2205 #ifdef HAVE_SYS_MOUNT_H
2206 #include <sys/mount.h>
2208 #ifdef HAVE_SYS_FS_TYPES_H
2209 #include <sys/fs_types.h>
2214 /* Ultrix's statfs returns 1 for success,
2215 0 for not mounted, -1 for failure. */
2216 exit (statfs (".", &fsd) != 1);
2218 fu_cv_sys_stat_fs_data=yes,
2219 fu_cv_sys_stat_fs_data=no,
2220 fu_cv_sys_stat_fs_data=no)])
2221 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2222 if test $fu_cv_sys_stat_fs_data = yes; then
2224 AC_DEFINE(STAT_STATFS2_FS_DATA)
2229 # As a gating factor for large file support, in order to
2230 # use <4GB files we must have the following minimal support
2232 # long long, and a 64 bit off_t or off64_t.
2233 # If we don't have all of these then disable large
2236 AC_MSG_CHECKING([if large file support can be enabled])
2238 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2239 #include <sys/types.h>
2245 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2246 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2247 AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2249 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
2251 AC_ARG_WITH(spinlocks, [ --with-spinlocks use spin locks instead of fcntl locks ])
2252 if test "x$with_spinlocks" = "xyes"; then
2253 AC_DEFINE(USE_SPINLOCKS)
2257 AC_DEFINE(SPARC_SPINLOCKS)
2260 i386|i486|i586|i686)
2261 AC_DEFINE(INTEL_SPINLOCKS)
2265 AC_DEFINE(MIPS_SPINLOCKS)
2269 AC_DEFINE(POWERPC_SPINLOCKS)
2274 #################################################
2275 # check for ACL support
2277 AC_MSG_CHECKING(whether to support ACLs)
2278 AC_ARG_WITH(acl-support,
2279 [ --with-acl-support Include ACL support
2280 --without-acl-support Don't include ACL support (default)],
2281 [ case "$withval" in
2286 AC_MSG_RESULT(Using UnixWare ACLs)
2287 AC_DEFINE(HAVE_UNIXWARE_ACLS)
2290 AC_MSG_RESULT(Using solaris ACLs)
2291 AC_DEFINE(HAVE_SOLARIS_ACLS)
2294 AC_MSG_RESULT(Using IRIX ACLs)
2295 AC_DEFINE(HAVE_IRIX_ACLS)
2298 AC_MSG_RESULT(Using AIX ACLs)
2299 AC_DEFINE(HAVE_AIX_ACLS)
2302 AC_MSG_RESULT(Using Tru64 ACLs)
2303 AC_DEFINE(HAVE_TRU64_ACLS)
2307 AC_CHECK_LIB(acl,acl_get_file)
2308 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2309 AC_TRY_LINK([#include <sys/types.h>
2310 #include <sys/acl.h>],
2311 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2312 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2313 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2314 AC_MSG_RESULT(Using posix ACLs)
2315 AC_DEFINE(HAVE_POSIX_ACLS)
2316 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2317 AC_TRY_LINK([#include <sys/types.h>
2318 #include <sys/acl.h>],
2319 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2320 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2321 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2322 AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2330 AC_DEFINE(HAVE_NO_ACLS)
2333 AC_DEFINE(HAVE_NO_ACLS)
2337 #################################################
2338 # Check whether winbind is supported on this platform. If so we need to
2339 # build and install client programs (WINBIND_TARGETS), sbin programs
2340 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2342 AC_MSG_CHECKING(whether to build winbind)
2344 # Initially, the value of $host_os decides whether winbind is supported
2352 winbind_no_reason=", unsupported on $host_os"
2356 # Check the setting of --with-winbindd
2358 AC_ARG_WITH(winbind,
2359 [ --with-winbind Build winbind (default, if supported by OS)
2360 --without-winbind Don't build winbind],
2373 # We need unix domain sockets for winbind
2375 if test x"$HAVE_WINBIND" = x"yes"; then
2376 if test x"$samba_cv_unixsocket" = x"no"; then
2377 winbind_no_reason=", no unix domain socket support on $host_os"
2382 # Display test results
2384 if test x"$HAVE_WINBIND" = x"yes"; then
2388 WINBIND_TARGETS="\$(WINBIND_PROGS)"
2389 WINBIND_STARGETS="\$(WINBIND_SPROGS)"
2390 WINBIND_LTARGETS="\$(WINBIND_LPROGS)"
2394 WINBIND_PAM_PROGS="\$(WINBIND_PAM_PROGS)"
2398 AC_MSG_RESULT(no$winbind_no_reason)
2403 WINBIND_PAM_PROGS=""
2406 # Substitution time!
2408 AC_SUBST(WINBIND_TARGETS)
2409 AC_SUBST(WINBIND_STARGETS)
2410 AC_SUBST(WINBIND_LTARGETS)
2411 AC_SUBST(WINBIND_PAM_PROGS)
2413 #################################################
2414 # final configure stuff
2416 echo "checking configure summary"
2417 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2418 echo "configure OK";,
2419 AC_MSG_ERROR([summary failure. Aborting config]),:)
2424 AC_OUTPUT(include/stamp-h Makefile)