make sure to include config.h so that the #ifdef tests work
[Samba.git] / source / configure.in
blobb49f1969097a56301a884bce71c0e10df60a8b39
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(include/includes.h)
3 AC_CONFIG_HEADER(include/config.h)
5 #################################################
6 # Directory handling stuff to support both the
7 # legacy SAMBA directories and FHS compliant
8 # ones...
9 AC_PREFIX_DEFAULT(/usr/local/samba)
11 AC_ARG_WITH(fhs, 
12 [  --with-fhs              Use FHS-compliant paths (default=no)],
13     codepagedir="\$(DATADIR)/samba/codepages"
14     configdir="${sysconfdir}/samba"
15     lockdir="\${VARDIR}/cache/samba"
16     piddir="\$(VARDIR)/run/samba"
17     logfilebase="\${VARDIR}/log/samba"
18     privatedir="\${CONFIGDIR}/private"
19     swatdir="\${DATADIR}/samba/swat",
20     codepagedir="\$(LIBDIR)/codepages"
21     configdir="\$(LIBDIR)"
22     logfilebase="\$(VARDIR)"
23     lockdir="\${VARDIR}/locks"
24     piddir="\$(VARDIR)/locks"
25     privatedir="\${prefix}/private"
26     swatdir="\${prefix}/swat")
28 #################################################
29 # set private directory location
30 AC_ARG_WITH(privatedir,
31 [  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
32 [ case "$withval" in
33   yes|no)
34   #
35   # Just in case anybody calls it without argument
36   #
37     AC_MSG_WARN([--with-privatedir called without argument - will use default])
38   ;;
39   * )
40     privatedir="$withval"
41     ;;
42   esac])
44 #################################################
45 # set lock directory location
46 AC_ARG_WITH(lockdir,
47 [  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
48 [ case "$withval" in
49   yes|no)
50   #
51   # Just in case anybody calls it without argument
52   #
53     AC_MSG_WARN([--with-lockdir called without argument - will use default])
54   ;;
55   * )
56     lockdir="$withval"
57     ;;
58   esac])
60 #################################################
61 # set pid directory location
62 AC_ARG_WITH(piddir,
63 [  --with-piddir=DIR       Where to put pid files ($ac_default_prefix/var/locks)],
64 [ case "$withval" in
65   yes|no)
66   #
67   # Just in case anybody calls it without argument
68   #
69     AC_MSG_WARN([--with-piddir called without argument - will use default])
70   ;;
71   * )
72     piddir="$withval"
73     ;;
74   esac])
76 #################################################
77 # set SWAT directory location
78 AC_ARG_WITH(swatdir,
79 [  --with-swatdir=DIR      Where to put SWAT files ($ac_default_prefix/swat)],
80 [ case "$withval" in
81   yes|no)
82   #
83   # Just in case anybody does it
84   #
85     AC_MSG_WARN([--with-swatdir called without argument - will use default])
86   ;;
87   * )
88     swatdir="$withval"
89     ;;
90   esac])
92 #################################################
93 # set configuration directory location
94 AC_ARG_WITH(configdir,
95 [  --with-configdir=DIR    Where to put configuration files (\$libdir)],
96 [ case "$withval" in
97   yes|no)
98   #
99   # Just in case anybody does it
100   #
101     AC_MSG_WARN([--with-configdir called without argument - will use default])
102   ;;
103   * )
104     configdir="$withval"
105     ;;
106   esac])
108 #################################################
109 # set codepage directory location
110 AC_ARG_WITH(codepagedir,
111 [  --with-codepagedir=DIR  Where to put codepage files (\$libdir/codepages)],
112 [ case "$withval" in
113   yes|no)
114   #
115   # Just in case anybody does it
116   #
117     AC_MSG_WARN([--with-codepagedir called without argument - will use default])
118   ;;
119   * )
120     codepagedir="$withval"
121     ;;
122   esac])
124 #################################################
125 # set log directory location
126 AC_ARG_WITH(logfilebase,
127 [  --with-logfilebase=DIR  Where to put log files (\$(VARDIR))],
128 [ case "$withval" in
129   yes|no)
130   #
131   # Just in case anybody does it
132   #
133     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
134   ;;
135   * )
136     logfilebase="$withval"
137     ;;
138   esac])
140 AC_SUBST(codepagedir)
141 AC_SUBST(configdir)
142 AC_SUBST(lockdir)
143 AC_SUBST(piddir)
144 AC_SUBST(logfilebase)
145 AC_SUBST(privatedir)
146 AC_SUBST(swatdir)
147 AC_SUBST(bindir)
148 AC_SUBST(sbindir)
150 dnl Unique-to-Samba variables we'll be playing with.
151 AC_SUBST(SHELL)
152 AC_SUBST(RUNPROG)
153 AC_SUBST(MPROGS)
154 AC_SUBST(LDSHFLAGS)
155 AC_SUBST(SONAMEFLAG)
156 AC_SUBST(SHLD) 
157 AC_SUBST(HOST_OS)
158 AC_SUBST(PAM_MOD)
159 AC_SUBST(PDBEDIT)
160 AC_SUBST(WRAP)
161 AC_SUBST(WRAP32)
162 AC_SUBST(WRAPPROG)
163 AC_SUBST(PICFLAG)
164 AC_SUBST(PICSUFFIX)
165 AC_SUBST(SHLIBEXT)
166 AC_SUBST(BLDSHARED)
167 AC_SUBST(LIBSMBCLIENT_SHARED)
168 AC_SUBST(LIBSMBCLIENT)
170 # compile with optimization and without debugging by default
171 CFLAGS="-O ${CFLAGS}"
173 AC_ARG_ENABLE(debug, 
174 [  --enable-debug          Turn on compiler debugging information (default=no)],
175     [if eval "test x$enable_debug = xyes"; then
176         CFLAGS="${CFLAGS} -g"
177     fi])
181 dnl Checks for programs.
182 AC_PROG_CC
183 AC_PROG_INSTALL
184 AC_PROG_AWK
185 AC_PATH_PROG(passwd_program, passwd, /bin/passwd)
186 AC_SUBST(passwd_program)
188 dnl Check if C compiler understands -c and -o at the same time
189 AC_PROG_CC_C_O
190 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
191       BROKEN_CC=
192 else
193       BROKEN_CC=#
195 AC_SUBST(BROKEN_CC)
197 dnl Check if the C compiler understands volatile (it should, being ANSI).
198 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
199     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
200         samba_cv_volatile=yes,samba_cv_volatile=no)])
201 if test x"$samba_cv_volatile" = x"yes"; then
202    AC_DEFINE(HAVE_VOLATILE)
207 AC_CANONICAL_SYSTEM
209 dnl Add #include for broken IRIX header files
210   case "$host_os" in
211         *irix6*) AC_ADD_INCLUDE(<standards.h>)
212         ;;
213 esac
215 AC_VALIDATE_CACHE_SYSTEM_TYPE
217 DYNEXP=
220 # Config CPPFLAG settings for strange OS's that must be set
221 # before other tests.
223 case "$host_os" in
224 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
225     *hpux*)
226       AC_PROG_CC_FLAG(Ae)
227       # mmap on HPUX is completely broken...
228       AC_DEFINE(MMAP_BLACKLIST)
229       if test $ac_cv_prog_cc_Ae = yes; then
230         CPPFLAGS="$CPPFLAGS -Ae"
231       fi
233 # Defines needed for HPUX support.
234 # HPUX has bigcrypt but (sometimes?) doesn't use it for
235 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
237       case `uname -r` in
238                         *9*|*10*)
239                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
240                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
241                                 AC_DEFINE(_HPUX_SOURCE)
242                                 AC_DEFINE(_POSIX_SOURCE)
243                                 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
244                                 AC_DEFINE(_MAX_ALIGNMENT,4)
245                                 ;;
246                         *11*)
247                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
248                                 AC_DEFINE(_HPUX_SOURCE)
249                                 AC_DEFINE(_POSIX_SOURCE)
250                                 AC_DEFINE(_LARGEFILE64_SOURCE)
251                                 AC_DEFINE(_ALIGNMENT_REQUIRED,1)
252                                 AC_DEFINE(_MAX_ALIGNMENT,4)
253                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
254                                 ;;
255       esac
256       DYNEXP="-Wl,-E"
257       ;;
261 # CRAY Unicos has broken const handling
262         *unicos*)
263                 AC_MSG_RESULT([disabling const])
264                 CPPFLAGS="$CPPFLAGS -Dconst="
265                 ;;
268 # AIX4.x doesn't even admit to having large
269 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
271     *aix4*)
272           AC_MSG_RESULT([enabling large file support])
273       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
274       AC_DEFINE(_LARGE_FILES)
275       ;;    
277 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
278 # to the existance of large files..
279 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
280 # recommendations on large file support, however it makes the
281 # compile work using gcc 2.7 and 2.8, whereas using the Sun
282 # recommendation makes the compile fail on gcc2.7. JRA.
284         *solaris*)
285                 case `uname -r` in
286                         5.0*|5.1*|5.2*|5.3*|5.5*)
287                                 AC_MSG_RESULT([no large file support])
288                                 ;;
289                         5.*)
290                         AC_MSG_RESULT([enabling large file support])
291                         if test "$ac_cv_prog_gcc" = yes; then
292                                 ${CC-cc} -v >conftest.c 2>&1
293                                 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
294                                 rm -fr conftest.c
295                                 case "$ac_cv_gcc_compiler_version_number" in
296                                         *"gcc version 2.6"*|*"gcc version 2.7"*)
297                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
298                                                 AC_DEFINE(_LARGEFILE64_SOURCE)
299                                                 ;;
300                                         *)
301                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
302                                                 AC_DEFINE(_LARGEFILE64_SOURCE)
303                                                 AC_DEFINE(_FILE_OFFSET_BITS,64)
304                                                 ;;
305                                 esac
306                         else
307                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
308                                 AC_DEFINE(_LARGEFILE64_SOURCE)
309                                 AC_DEFINE(_FILE_OFFSET_BITS,64)
310                         fi
311                         ;;
312                 esac
313                 ;;
315 # Tests needed for SINIX large file support.
317     *sysv4*)
318       if test $host = mips-sni-sysv4 ; then
319         AC_MSG_CHECKING([for LFS support])
320         old_CPPFLAGS="$CPPFLAGS"
321         CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
322         AC_TRY_RUN([
323 #include <unistd.h>
324 main () {
325 #if _LFS64_LARGEFILE == 1
326 exit(0);
327 #else
328 exit(1);
329 #endif
330 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
331         CPPFLAGS="$old_CPPFLAGS"
332         if test x$SINIX_LFS_SUPPORT = xyes ; then
333           CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
334           AC_DEFINE(_LARGEFILE64_SOURCE)
335           CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
336           LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
337           LIBS="`getconf LFS64_LIBS` $LIBS"
338         fi
339       AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
340       fi
341     ;;
343 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
345     *linux*)
346         AC_MSG_CHECKING([for LFS support])
347         old_CPPFLAGS="$CPPFLAGS"
348         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
349        AC_TRY_RUN([
350 #include <unistd.h>
351 #include <sys/utsname.h>
352 main() {
353 #if _LFS64_LARGEFILE == 1
354        struct utsname uts;
355        char *release;
356        int major, minor;
358        /* Ensure this is glibc 2.2 or higher */
359 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
360        int libc_major = __GLIBC__;
361        int libc_minor = __GLIBC_MINOR__;
363        if (libc_major < 2)
364               exit(1);
365        if (libc_minor < 2)
366               exit(1);
367 #endif
369        /* Ensure this is kernel 2.4 or higher */
371        uname(&uts);
372        release = uts.release;
373        major = atoi(strsep(&release, "."));
374        minor = atoi(strsep(&release, "."));
376        if (major > 2 || (major == 2 && minor > 3))
377                exit(0);
378        exit(1);
379 #else
380        exit(1);
381 #endif
383 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
384         CPPFLAGS="$old_CPPFLAGS"
385         if test x$LINUX_LFS_SUPPORT = xyes ; then
386           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
387           AC_DEFINE(_LARGEFILE64_SOURCE)
388           AC_DEFINE(_FILE_OFFSET_BITS,64)
389           AC_DEFINE(_GNU_SOURCE)
390         fi
391        AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
392                 ;;
394     *hurd*)
395         AC_MSG_CHECKING([for LFS support])
396         old_CPPFLAGS="$CPPFLAGS"
397         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
398         AC_TRY_RUN([
399 #include <unistd.h>
400 main () {
401 #if _LFS64_LARGEFILE == 1
402 exit(0);
403 #else
404 exit(1);
405 #endif
406 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
407         CPPFLAGS="$old_CPPFLAGS"
408         if test x$GLIBC_LFS_SUPPORT = xyes ; then
409           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
410           AC_DEFINE(_LARGEFILE64_SOURCE)
411           AC_DEFINE(_GNU_SOURCE)
412         fi
413       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
414     ;;
416 esac
418 AC_INLINE
419 AC_HEADER_STDC
420 AC_HEADER_DIRENT
421 AC_HEADER_TIME
422 AC_HEADER_SYS_WAIT
423 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
424 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
425 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
426 AC_CHECK_HEADERS(stdlib.h string.h strings.h syslog.h sys/file.h)
427 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
428 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h sys/socket.h)
429 AC_CHECK_HEADERS(syslog.h sys/syslog.h sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
430 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
431 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h synch.h pthread.h nsswitch.h)
434 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
435 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
437 case "$host_os" in
438     *hpux*)
439                 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
440                         ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
441                 if test x"$ac_cv_header_shadow_h" = x"yes"; then
442                    AC_DEFINE(HAVE_SHADOW_H)
443                 fi
444         ;;
445 esac
446 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
447 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
448 AC_CHECK_HEADERS(stropts.h poll.h)
449 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
450 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
452 # For experimental utmp support (lastlog on some BSD-like systems)
453 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
455 # For quotas on Veritas VxFS filesystems
456 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
458 # For quotas on Linux XFS filesystems
459 AC_CHECK_HEADERS(linux/xqm.h)
461 AC_CHECK_SIZEOF(int,cross)
462 AC_CHECK_SIZEOF(long,cross)
463 AC_CHECK_SIZEOF(short,cross)
465 AC_C_CONST
466 AC_C_INLINE
467 AC_C_BIGENDIAN
468 AC_C_CHAR_UNSIGNED
470 AC_TYPE_SIGNAL
471 AC_TYPE_UID_T
472 AC_TYPE_MODE_T
473 AC_TYPE_OFF_T
474 AC_TYPE_SIZE_T
475 AC_TYPE_PID_T
476 AC_STRUCT_ST_RDEV
477 AC_DIRENT_D_OFF
478 AC_CHECK_TYPE(ino_t,unsigned)
479 AC_CHECK_TYPE(loff_t,off_t)
480 AC_CHECK_TYPE(offset_t,loff_t)
481 AC_CHECK_TYPE(ssize_t, int)
482 AC_CHECK_TYPE(wchar_t, unsigned short)
484 ############################################
485 # for cups support we need libcups, and a handful of header files
487 AC_ARG_ENABLE(cups,
488 [  --enable-cups           Turn on CUPS support (default=auto)])
490 if test x$enable_cups != xno; then
491         AC_PATH_PROG(CUPS_CONFIG, cups-config)
493         if test "x$CUPS_CONFIG" != x; then
494                 AC_DEFINE(HAVE_CUPS)
495                 CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
496                 LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
497                 LIBS="$LIBS `$CUPS_CONFIG --libs`"
498         fi
501 ############################################
502 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the new VFS code
503 AC_CHECK_FUNCS(dlopen)
504 if test x"$ac_cv_func_dlopen" = x"no"; then
505         AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
506         AC_DEFINE(HAVE_DLOPEN)])
508 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
510 ############################################
511 # check if the compiler can do immediate structures
512 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
513     AC_TRY_COMPILE([
514 #include <stdio.h>],
516         typedef struct {unsigned x;} FOOBAR;
517 #define X_FOOBAR(x) ((FOOBAR) { x })
518 #define FOO_ONE X_FOOBAR(1)
519         FOOBAR f = FOO_ONE;
520         static struct {
521         FOOBAR y;
522         } f2[] = {
523                 {FOO_ONE}
524         };
526         samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
527 if test x"$samba_cv_immediate_structures" = x"yes"; then
528    AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
531 ############################################
532 # check for unix domain sockets
533 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
534     AC_TRY_COMPILE([
535 #include <sys/types.h>
536 #include <stdlib.h>
537 #include <stddef.h>
538 #include <sys/socket.h>
539 #include <sys/un.h>],
541   struct sockaddr_un sunaddr; 
542   sunaddr.sun_family = AF_UNIX;
544         samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
545 if test x"$samba_cv_unixsocket" = x"yes"; then
546    AC_DEFINE(HAVE_UNIXSOCKET)
549 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
550     AC_TRY_COMPILE([
551 #include <sys/types.h>
552 #if STDC_HEADERS
553 #include <stdlib.h>
554 #include <stddef.h>
555 #endif
556 #include <sys/socket.h>],[socklen_t i = 0],
557     samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
558 if test x"$samba_cv_socklen_t" = x"yes"; then
559    AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
562 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
563     AC_TRY_COMPILE([
564 #include <sys/types.h>
565 #if STDC_HEADERS
566 #include <stdlib.h>
567 #include <stddef.h>
568 #endif
569 #include <signal.h>],[sig_atomic_t i = 0],
570         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
571 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
572    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
575 # stupid headers have the functions but no declaration. grrrr.
576 AC_HAVE_DECL(errno, [#include <errno.h>])
577 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
578 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
579 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
580 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
581 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
582 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
584 # and glibc has setresuid under linux but the function does
585 # nothing until kernel 2.1.44! very dumb.
586 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
587     AC_TRY_RUN([#include <errno.h>
588 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
589         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
590 if test x"$samba_cv_have_setresuid" = x"yes"; then
591     AC_DEFINE(HAVE_SETRESUID)
594 # Do the same check for setresguid...
596 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
597     AC_TRY_RUN([#include <unistd.h>
598 #include <errno.h>
599 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
600         samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
601 if test x"$samba_cv_have_setresgid" = x"yes"; then
602     AC_DEFINE(HAVE_SETRESGID)
605 AC_FUNC_MEMCMP
607 ###############################################
608 # Readline included by default unless explicitly asked not to
609 test "${with_readline+set}" != "set" && with_readline=yes
611 # test for where we get readline() from
612 AC_MSG_CHECKING(whether to use readline)
613 AC_ARG_WITH(readline,
614 [  --with-readline[=DIR]   Look for readline include/libs in DIR (default=auto)],
615 [  case "$with_readline" in
616   yes)
617     AC_MSG_RESULT(yes)
619     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
620     AC_CHECK_HEADERS(readline/history.h)
622     AC_CHECK_HEADERS(readline.h readline/readline.h,[
623       for termlib in ncurses curses termcap terminfo termlib; do
624        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
625       done
626       AC_CHECK_LIB(readline, rl_callback_handler_install,
627        [TERMLIBS="-lreadline $TERMLIBS"
628        AC_DEFINE(HAVE_LIBREADLINE)
629        break], [TERMLIBS=], $TERMLIBS)])
630     ;;
631   no)
632     AC_MSG_RESULT(no)
633     ;;
634   *)
635     AC_MSG_RESULT(yes)
637     # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
638     # alternate readline path
639     _ldflags=${LDFLAGS}
640     _cppflags=${CPPFLAGS}
642     # Add additional search path
643     LDFLAGS="-L$with_readline/lib $LDFLAGS"
644     CPPFLAGS="-I$with_readline/include $CPPFLAGS"
646     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
647     AC_CHECK_HEADERS(readline/history.h)
649     AC_CHECK_HEADERS(readline.h readline/readline.h,[
650       for termlib in ncurses curses termcap terminfo termlib; do
651        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
652       done
653       AC_CHECK_LIB(readline, rl_callback_handler_install,
654        [TERMLDFLAGS="-L$with_readline/lib"
655        TERMCPPFLAGS="-I$with_readline/include"
656        CPPFLAGS="-I$with_readline/include $CPPFLAGS"
657        TERMLIBS="-lreadline $TERMLIBS"
658        AC_DEFINE(HAVE_LIBREADLINE)
659        break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
661     LDFLAGS=$_ldflags
662     ;;
663   esac],
664   AC_MSG_RESULT(no)
666 AC_SUBST(TERMLIBS)
667 AC_SUBST(TERMLDFLAGS)
669 # The following test taken from the cvs sources
670 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
671 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
672 # libsocket.so which has a bad implementation of gethostbyname (it
673 # only looks in /etc/hosts), so we only look for -lsocket if we need
674 # it.
675 AC_CHECK_FUNCS(connect)
676 if test x"$ac_cv_func_connect" = x"no"; then
677     case "$LIBS" in
678     *-lnsl*) ;;
679     *) AC_CHECK_LIB(nsl_s, printf) ;;
680     esac
681     case "$LIBS" in
682     *-lnsl*) ;;
683     *) AC_CHECK_LIB(nsl, printf) ;;
684     esac
685     case "$LIBS" in
686     *-lsocket*) ;;
687     *) AC_CHECK_LIB(socket, connect) ;;
688     esac
689     case "$LIBS" in
690     *-linet*) ;;
691     *) AC_CHECK_LIB(inet, connect) ;;
692     esac
693     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
694     dnl has been cached.
695     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
696        test x"$ac_cv_lib_inet_connect" = x"yes"; then
697         # ac_cv_func_connect=yes
698         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
699         AC_DEFINE(HAVE_CONNECT)
700     fi
703 ###############################################
704 # test for where we get get_yp_default_domain() from
705 AC_CHECK_FUNCS(yp_get_default_domain)
706 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
707         AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
708         AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)]) 
711 # Check if we have execl, if not we need to compile smbrun.
712 AC_CHECK_FUNCS(execl)
713 if test x"$ac_cv_func_execl" = x"no"; then
714     RUNPROG="bin/smbrun"
715 else
716     RUNPROG=""
719 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link)
720 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid mknod mknod64)
721 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
722 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
723 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)
724 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
725 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
726 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
727 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
728 AC_CHECK_FUNCS(syslog vsyslog)
730 # syscall() is needed for smbwrapper.
731 AC_CHECK_FUNCS(syscall)
733 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
734 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
735 AC_CHECK_FUNCS(__getcwd _getcwd)
736 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
737 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
738 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
739 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
740 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
741 AC_CHECK_FUNCS(_write __write _fork __fork)
742 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
743 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
744 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
745 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
746 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
749 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
752 if test x$ac_cv_func_stat64 = xno ; then
753   AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
754   AC_TRY_LINK([
755 #if defined(HAVE_UNISTD_H)
756 #include <unistd.h>
757 #endif
758 #include <sys/stat.h>
759 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
760   AC_MSG_RESULT([$ac_cv_func_stat64])
761   if test x$ac_cv_func_stat64 = xyes ; then
762     AC_DEFINE(HAVE_STAT64)
763   fi
766 if test x$ac_cv_func_lstat64 = xno ; then
767   AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
768   AC_TRY_LINK([
769 #if defined(HAVE_UNISTD_H)
770 #include <unistd.h>
771 #endif
772 #include <sys/stat.h>
773 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
774   AC_MSG_RESULT([$ac_cv_func_lstat64])
775   if test x$ac_cv_func_lstat64 = xyes ; then
776     AC_DEFINE(HAVE_LSTAT64)
777   fi
780 if test x$ac_cv_func_fstat64 = xno ; then
781   AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
782   AC_TRY_LINK([
783 #if defined(HAVE_UNISTD_H)
784 #include <unistd.h>
785 #endif
786 #include <sys/stat.h>
787 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
788   AC_MSG_RESULT([$ac_cv_func_fstat64])
789   if test x$ac_cv_func_fstat64 = xyes ; then
790     AC_DEFINE(HAVE_FSTAT64)
791   fi
795 # If no strcasecmp, check for it in some known places
796 # It is in -lresolv on ReliantUNIX and UnixWare
797 #   -lresolve *must* follow -lnsl for name resolution to work properly
800 if test x$ac_cv_func_strcasecmp = xno ; then
801         AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
802                 AC_DEFINE(HAVE_STRCASECMP))
806 # Check for the functions putprpwnam, set_auth_parameters,
807 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
808 # Needed for OSF1 and HPUX.
811 AC_LIBTESTFUNC(security, putprpwnam)
812 AC_LIBTESTFUNC(sec, putprpwnam)
814 AC_LIBTESTFUNC(security, set_auth_parameters)
815 AC_LIBTESTFUNC(sec, set_auth_parameters)
817 # UnixWare 7.x has its getspnam in -lgen
818 AC_LIBTESTFUNC(gen, getspnam)
820 AC_LIBTESTFUNC(security, getspnam)
821 AC_LIBTESTFUNC(sec, getspnam)
823 AC_LIBTESTFUNC(security, bigcrypt)
824 AC_LIBTESTFUNC(sec, bigcrypt)
826 AC_LIBTESTFUNC(security, getprpwnam)
827 AC_LIBTESTFUNC(sec, getprpwnam)
829 # this bit needs to be modified for each OS that is suported by
830 # smbwrapper. You need to specify how to created a shared library and
831 # how to compile C code to produce PIC object files
833 # these are the defaults, good for lots of systems
834 HOST_OS="$host_os"
835 LDSHFLAGS="-shared"
836 SONAMEFLAG="#"
837 SHLD="\${CC}" 
838 PICFLAG=""
839 PICSUFFIX="po.o"
840 SHLIBEXT="so"
841 # Assume non-shared by default and override below
842 BLDSHARED="false" 
843 AC_MSG_CHECKING([ability to build shared libraries])
845 # and these are for particular systems
846 case "$host_os" in
847                 *linux*)   AC_DEFINE(LINUX)
848                         BLDSHARED="true"
849                         LDSHFLAGS="-shared"
850                         DYNEXP="-Wl,--export-dynamic"
851                         PICFLAG="-fPIC"
852                         SONAMEFLAG="-Wl,-soname="
853                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
854                         ;;
855                 *solaris*) AC_DEFINE(SUNOS5)
856                         BLDSHARED="true"
857                         LDSHFLAGS="-G"
858                         SONAMEFLAG="-h "
859                         if test "${GCC}" = "yes"; then
860                                 PICFLAG="-fPIC"
861                                 DYNEXP="-Wl,-E"
862                         else
863                                 PICFLAG="-KPIC"
864                                 ## ${CFLAGS} added for building 64-bit shared 
865                                 ## libs using Sun's Compiler
866                                 LDSHFLAGS="-G \${CFLAGS}"
867                                 POBAD_CC=""
868                                 PICSUFFIX="po.o"
869                         fi
870                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
871                 ;;
872                 *sunos*) AC_DEFINE(SUNOS4)
873                         BLDSHARED="true"
874                         LDSHFLAGS="-G"
875                         SONAMEFLAG="-Wl,-h,"
876                         PICFLAG="-KPIC"   # Is this correct for SunOS
877                 ;;
878                 *bsd*)  BLDSHARED="true"
879                         LDSHFLAGS="-shared"
880                         DYNEXP="-Wl,-Bdynamic"
881                         SONAMEFLAG="-Wl,-soname,"
882                         PICFLAG="-fPIC"
883                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
884                 ;;
885                 *irix*) AC_DEFINE(IRIX)
886                         case "$host_os" in
887                         *irix6*) AC_DEFINE(IRIX6)
888                         ;;
889                         esac
890                         ATTEMPT_WRAP32_BUILD=yes
891                         BLDSHARED="true"
892                         LDSHFLAGS="-set_version sgi1.0 -shared"
893                         SONAMEFLAG="-soname "
894                         SHLD="\${LD}" 
895                         if test "${GCC}" = "yes"; then
896                                 PICFLAG="-fPIC"
897                         else 
898                                 PICFLAG="-KPIC"
899                         fi
900                         AC_DEFINE(STAT_ST_BLOCKSIZE,512)
901                 ;;
902                 *aix*) AC_DEFINE(AIX)
903                         BLDSHARED="true"
904                         LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
905                         DYNEXP="-Wl,-brtl,-bexpall"
906                         if test "${GCC}" = "yes"; then
907                                 PICFLAG="-O2"
908                         else
909                                 PICFLAG="-O2 -qmaxmem=6000"
910                         fi
912                         AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)
913                 ;;
914                 *hpux*) AC_DEFINE(HPUX)
915                         SHLIBEXT="sl"
916                         # Use special PIC flags for the native HP-UX compiler.
917                         if test $ac_cv_prog_cc_Ae = yes; then
918                                 BLDSHARED="true"
919                                 SHLD="/usr/bin/ld"
920                                 LDSHFLAGS="-B symbolic -b -z"
921                                 SONAMEFLAG="+h "
922                                 PICFLAG="+z"
923                         fi
924                         DYNEXP="-Wl,-E"
925                         AC_DEFINE(STAT_ST_BLOCKSIZE,8192)
926                         ;;
927                 *qnx*) AC_DEFINE(QNX);;
928                 *osf*) AC_DEFINE(OSF1)
929                         BLDSHARED="true"
930                         LDSHFLAGS="-shared"
931                         SONAMEFLAG="-Wl,-soname,"
932                         PICFLAG="-fPIC"
933                 ;;
934                 *sco*) AC_DEFINE(SCO);;
935                 *unixware*) AC_DEFINE(UNIXWARE)
936                         BLDSHARED="true"
937                         LDSHFLAGS="-shared"
938                         SONAMEFLAG="-Wl,-soname,"
939                         PICFLAG="-KPIC"
940                 ;;
941                 *next2*) AC_DEFINE(NEXT2);;
942                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
943                 *sysv4*)
944                         case "$host" in
945                                 *-univel-*)     if [ test "$GCC" != yes ]; then
946                                                                         AC_DEFINE(HAVE_MEMSET)
947                                                                 fi
948                                                                 LDSHFLAGS="-G"
949                                                                 DYNEXP="-Bexport"
950                                 ;;
951                                 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
952                         esac
953                         ;;
954                 *sysv5*)
955                         if [ test "$GCC" != yes ]; then
956                                 AC_DEFINE(HAVE_MEMSET)
957                         fi
958                         LDSHFLAGS="-G"
959                         ;;
960 esac
961 AC_SUBST(DYNEXP)
962 AC_MSG_RESULT($BLDSHARED)
963 AC_MSG_CHECKING([linker flags for shared libraries])
964 AC_MSG_RESULT([$LDSHFLAGS])
965 AC_MSG_CHECKING([compiler flags for position-independent code])
966 AC_MSG_RESULT([$PICFLAGS])
968 # try to work out how to produce pic code with this compiler
969 if test x$PICFLAG = x; then
970   AC_PROG_CC_FLAG(fpic)
971   if test $ac_cv_prog_cc_fpic = yes; then
972       PICFLAG="-fpic";
973   fi
975 if test x$PICFLAG = x; then
976   AC_PROG_CC_FLAG(KPIC)
977   if test $ac_cv_prog_cc_KPIC = yes; then
978     PICFLAG="-KPIC";
979   fi
981 if test x$PICFLAG = x; then
982   AC_PROG_CC_FLAG(Kpic)
983   if test $ac_cv_prog_cc_Kpic = yes; then
984     PICFLAG="-Kpic";
985   fi
988 ################
990 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
991 AC_TRY_RUN([#include <stdio.h>
992 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
993 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
994 if test x"$samba_cv_have_longlong" = x"yes"; then
995     AC_DEFINE(HAVE_LONGLONG)
999 # Check if the compiler supports the LL prefix on long long integers.
1000 # AIX needs this.
1002 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
1003     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
1004         samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
1005 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
1006    AC_DEFINE(COMPILER_SUPPORTS_LL)
1009   
1010 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
1011 AC_TRY_RUN([#include <stdio.h>
1012 #include <sys/stat.h>
1013 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
1014 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
1015 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
1016     AC_DEFINE(SIZEOF_OFF_T,8)
1019 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
1020 AC_TRY_RUN([
1021 #if defined(HAVE_UNISTD_H)
1022 #include <unistd.h>
1023 #endif
1024 #include <stdio.h>
1025 #include <sys/stat.h>
1026 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1027 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
1028 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
1029     AC_DEFINE(HAVE_OFF64_T)
1032 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
1033 AC_TRY_RUN([#include <stdio.h>
1034 #include <sys/stat.h>
1035 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
1036 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
1037 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
1038     AC_DEFINE(SIZEOF_INO_T,8)
1041 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
1042 AC_TRY_RUN([
1043 #if defined(HAVE_UNISTD_H)
1044 #include <unistd.h>
1045 #endif
1046 #include <stdio.h>
1047 #include <sys/stat.h>
1048 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1049 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
1050 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
1051     AC_DEFINE(HAVE_INO64_T)
1054 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
1055 AC_TRY_RUN([
1056 #if defined(HAVE_UNISTD_H)
1057 #include <unistd.h>
1058 #endif
1059 #include <stdio.h>
1060 #include <sys/stat.h>
1061 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
1062 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
1063 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
1064     AC_DEFINE(HAVE_DEV64_T)
1067 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
1068 AC_TRY_COMPILE([
1069 #if defined(HAVE_UNISTD_H)
1070 #include <unistd.h>
1071 #endif
1072 #include <sys/types.h>
1073 #include <dirent.h>],
1074 [struct dirent64 de;],
1075 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
1076 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
1077     AC_DEFINE(HAVE_STRUCT_DIRENT64)
1080 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
1081 AC_TRY_RUN([
1082 #if defined(HAVE_UNISTD_H)
1083 #include <unistd.h>
1084 #endif
1085 #include <sys/types.h>
1086 main() { dev_t dev; int i = major(dev); return 0; }],
1087 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
1088 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
1089     AC_DEFINE(HAVE_DEVICE_MAJOR_FN)
1092 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
1093 AC_TRY_RUN([
1094 #if defined(HAVE_UNISTD_H)
1095 #include <unistd.h>
1096 #endif
1097 #include <sys/types.h>
1098 main() { dev_t dev; int i = minor(dev); return 0; }],
1099 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
1100 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
1101     AC_DEFINE(HAVE_DEVICE_MINOR_FN)
1104 AC_CACHE_CHECK([for makedev macro],samba_cv_HAVE_MAKEDEV_FN,[
1105 AC_TRY_RUN([
1106 #if defined(HAVE_UNISTD_H)
1107 #include <unistd.h>
1108 #endif
1109 #include <sys/types.h>
1110 main() { dev_t dev = makedev(1,2); return 0; }],
1111 samba_cv_HAVE_MAKEDEV_FN=yes,samba_cv_HAVE_MAKEDEV_FN=no,samba_cv_HAVE_MAKEDEV_FN=cross)])
1112 if test x"$samba_cv_HAVE_MAKEDEV_FN" = x"yes"; then
1113     AC_DEFINE(MAKEDEV_FN)
1116 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
1117 AC_TRY_RUN([#include <stdio.h>
1118 main() { char c; c=250; exit((c > 0)?0:1); }],
1119 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
1120 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
1121     AC_DEFINE(HAVE_UNSIGNED_CHAR)
1124 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
1125 AC_TRY_COMPILE([#include <sys/types.h>
1126 #include <sys/socket.h>
1127 #include <netinet/in.h>],
1128 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
1129 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
1130 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
1131     AC_DEFINE(HAVE_SOCK_SIN_LEN)
1134 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
1135 AC_TRY_COMPILE([#include <sys/types.h>
1136 #include <dirent.h>
1137 void seekdir(DIR *d, long loc) { return; }],[return 0;],
1138 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
1139 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
1140     AC_DEFINE(SEEKDIR_RETURNS_VOID)
1143 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
1144 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
1145 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
1146 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
1147     AC_DEFINE(HAVE_FILE_MACRO)
1150 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
1151 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
1152 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
1153 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
1154     AC_DEFINE(HAVE_FUNCTION_MACRO)
1157 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
1158 AC_TRY_RUN([
1159 #include <sys/time.h>
1160 #include <unistd.h>
1161 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
1162            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
1163 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
1164     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
1167 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE_VA_COPY,[
1168 AC_TRY_LINK([#include <stdarg.h>
1169 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
1170 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
1171 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
1172     AC_DEFINE(HAVE_VA_COPY)
1175 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
1176 AC_TRY_RUN([
1177 #include <sys/types.h>
1178 #include <stdarg.h>
1179 void foo(const char *format, ...) {
1180         va_list ap;
1181         int len;
1182         char buf[5];
1184         va_start(ap, format);
1185         len = vsnprintf(buf, 0, format, ap);
1186         va_end(ap);
1187         if (len != 5) exit(1);
1189         va_start(ap, format);
1190         len = vsnprintf(0, 0, format, ap);
1191         va_end(ap);
1192         if (len != 5) exit(1);
1194         if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
1196         exit(0);
1198 main() { foo("hello"); }
1200 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
1201 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
1202         AC_DEFINE(HAVE_C99_VSNPRINTF)
1205 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
1206 AC_TRY_RUN([#include <sys/types.h>
1207 #include <dirent.h>
1208 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
1209 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
1210 di->d_name[0] == 0) exit(0); exit(1);} ],
1211 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
1212 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
1213     AC_DEFINE(HAVE_BROKEN_READDIR)
1216 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
1217 AC_TRY_COMPILE([#include <sys/types.h>
1218 #include <utime.h>],
1219 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
1220 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
1221 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
1222     AC_DEFINE(HAVE_UTIMBUF)
1225 dnl  utmp and utmpx come in many flavours
1226 dnl  We need to check for many of them
1227 dnl  But we don't need to do each and every one, because our code uses
1228 dnl  mostly just the utmp (not utmpx) fields.
1230 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
1232 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
1233 AC_TRY_COMPILE([#include <sys/types.h>
1234 #include <utmp.h>],
1235 [struct utmp ut;  ut.ut_name[0] = 'a';],
1236 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
1237 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
1238     AC_DEFINE(HAVE_UT_UT_NAME)
1239 fi 
1241 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
1242 AC_TRY_COMPILE([#include <sys/types.h>
1243 #include <utmp.h>],
1244 [struct utmp ut;  ut.ut_user[0] = 'a';],
1245 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
1246 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
1247     AC_DEFINE(HAVE_UT_UT_USER)
1248 fi 
1250 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
1251 AC_TRY_COMPILE([#include <sys/types.h>
1252 #include <utmp.h>],
1253 [struct utmp ut;  ut.ut_id[0] = 'a';],
1254 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
1255 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
1256     AC_DEFINE(HAVE_UT_UT_ID)
1257 fi 
1259 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
1260 AC_TRY_COMPILE([#include <sys/types.h>
1261 #include <utmp.h>],
1262 [struct utmp ut;  ut.ut_host[0] = 'a';],
1263 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
1264 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
1265     AC_DEFINE(HAVE_UT_UT_HOST)
1266 fi 
1268 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
1269 AC_TRY_COMPILE([#include <sys/types.h>
1270 #include <utmp.h>],
1271 [struct utmp ut;  time_t t; ut.ut_time = t;],
1272 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
1273 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
1274     AC_DEFINE(HAVE_UT_UT_TIME)
1275 fi 
1277 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
1278 AC_TRY_COMPILE([#include <sys/types.h>
1279 #include <utmp.h>],
1280 [struct utmp ut;  struct timeval tv; ut.ut_tv = tv;],
1281 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
1282 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1283     AC_DEFINE(HAVE_UT_UT_TV)
1284 fi 
1286 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1287 AC_TRY_COMPILE([#include <sys/types.h>
1288 #include <utmp.h>],
1289 [struct utmp ut;  ut.ut_type = 0;],
1290 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1291 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1292     AC_DEFINE(HAVE_UT_UT_TYPE)
1293 fi 
1295 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1296 AC_TRY_COMPILE([#include <sys/types.h>
1297 #include <utmp.h>],
1298 [struct utmp ut;  ut.ut_pid = 0;],
1299 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1300 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1301     AC_DEFINE(HAVE_UT_UT_PID)
1302 fi 
1304 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1305 AC_TRY_COMPILE([#include <sys/types.h>
1306 #include <utmp.h>],
1307 [struct utmp ut;  ut.ut_exit.e_exit = 0;],
1308 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1309 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1310     AC_DEFINE(HAVE_UT_UT_EXIT)
1311 fi 
1313 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1314 AC_TRY_COMPILE([#include <sys/types.h>
1315 #include <utmp.h>],
1316 [struct utmp ut;  ut.ut_addr = 0;],
1317 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1318 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1319     AC_DEFINE(HAVE_UT_UT_ADDR)
1320 fi 
1322 if test x$ac_cv_func_pututline = xyes ; then
1323   AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1324   AC_TRY_COMPILE([#include <sys/types.h>
1325 #include <utmp.h>],
1326   [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1327   samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1328   if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1329       AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1330   fi
1333 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1334 AC_TRY_COMPILE([#include <sys/types.h>
1335 #include <utmpx.h>],
1336 [struct utmpx ux;  ux.ut_syslen = 0;],
1337 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1338 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1339     AC_DEFINE(HAVE_UX_UT_SYSLEN)
1340 fi 
1342 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1343 AC_TRY_RUN([
1344 #include <sys/types.h>
1345 #include <fcntl.h>
1346 #ifndef F_GETLEASE
1347 #define F_GETLEASE      1025
1348 #endif
1349 main() {
1350        int fd = open("/dev/null", O_RDONLY);
1351        return fcntl(fd, F_GETLEASE, 0) == -1;
1354 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1355 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1356     AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1359 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1360 AC_TRY_RUN([
1361 #include <sys/types.h>
1362 #include <fcntl.h>
1363 #include <signal.h>
1364 #ifndef F_NOTIFY
1365 #define F_NOTIFY 1026
1366 #endif
1367 main() {
1368         exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0);
1371 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1372 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1373     AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1376 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1377 AC_TRY_RUN([
1378 #include <sys/types.h>
1379 #include <fcntl.h>
1380 #include <signal.h>
1381 #include <sys/file.h>
1382 #ifndef LOCK_MAND
1383 #define LOCK_MAND       32
1384 #define LOCK_READ       64
1385 #endif
1386 main() {
1387         exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1390 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1391 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1392     AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1398 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1399 AC_TRY_COMPILE([#include <sys/types.h>
1400 #include <fcntl.h>],
1401 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1402 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1403 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1404     AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1407 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1408 AC_TRY_RUN([#include <sys/types.h>
1409 #include <sys/capability.h>
1410 main() {
1411  cap_t cap;
1412  if ((cap = cap_get_proc()) == NULL)
1413    exit(1);
1414  cap->cap_effective |= CAP_NETWORK_MGT;
1415  cap->cap_inheritable |= CAP_NETWORK_MGT;
1416  cap_set_proc(cap);
1417  exit(0);
1420 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1421 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1422     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1426 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1427 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1430 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1431 AC_TRY_COMPILE([#include <sys/types.h>
1432 #if defined(HAVE_RPC_RPC_H)
1433 #include <rpc/rpc.h>
1434 #endif],
1435 [int16 testvar;],
1436 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1437 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1438     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1441 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1442 AC_TRY_COMPILE([#include <sys/types.h>
1443 #if defined(HAVE_RPC_RPC_H)
1444 #include <rpc/rpc.h>
1445 #endif],
1446 [uint16 testvar;],
1447 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1448 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1449     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1452 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1453 AC_TRY_COMPILE([#include <sys/types.h>
1454 #if defined(HAVE_RPC_RPC_H)
1455 #include <rpc/rpc.h>
1456 #endif],
1457 [int32 testvar;],
1458 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1459 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1460     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1463 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1464 AC_TRY_COMPILE([#include <sys/types.h>
1465 #if defined(HAVE_RPC_RPC_H)
1466 #include <rpc/rpc.h>
1467 #endif],
1468 [uint32 testvar;],
1469 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1470 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1471     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1475 dnl Some systems (SCO) have a problem including
1476 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1477 dnl as a #define in <prot.h> and as part of an enum
1478 dnl in <rpc/rpc.h>.
1481 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1482 AC_TRY_COMPILE([#include <sys/types.h>
1483 #ifdef HAVE_SYS_SECURITY_H
1484 #include <sys/security.h>
1485 #include <prot.h>
1486 #endif  /* HAVE_SYS_SECURITY_H */
1487 #if defined(HAVE_RPC_RPC_H)
1488 #include <rpc/rpc.h>
1489 #endif],
1490 [int testvar;],
1491 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1492 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1493     AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1496 AC_MSG_CHECKING([for test routines])
1497 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1498            AC_MSG_RESULT(yes),
1499            AC_MSG_ERROR([cant find test code. Aborting config]),
1500            AC_MSG_WARN([cannot run when cross-compiling]))
1502 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1503 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1504            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1505 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1506     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1509 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1510 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1511            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1512 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1513     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1516 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1517 SAVE_CPPFLAGS="$CPPFLAGS"
1518 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt  -I${srcdir-.}/smbwrapper"
1519 AC_TRY_COMPILE([
1520 #define REPLACE_GETPASS 1
1521 #define NO_CONFIG_H 1
1522 #define main dont_declare_main
1523 #include "${srcdir-.}/lib/getsmbpass.c"
1524 #undef main
1525 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1526 CPPFLAGS="$SAVE_CPPFLAGS"
1528 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1529         AC_DEFINE(REPLACE_GETPASS)
1532 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1533 AC_TRY_RUN([
1534 #include <stdio.h>
1535 #include <sys/types.h>
1536 #include <netinet/in.h>
1537 #ifdef HAVE_ARPA_INET_H
1538 #include <arpa/inet.h>
1539 #endif
1540 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1541 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1542     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
1543 exit(1);}],
1544            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1545 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1546     AC_DEFINE(REPLACE_INET_NTOA)
1549 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1550 AC_TRY_RUN([#include <stdlib.h>
1551 #include <sys/types.h>
1552 #include <sys/stat.h>
1553 #include <unistd.h>
1554 main() { 
1555   struct stat st;
1556   char tpl[20]="/tmp/test.XXXXXX"; 
1557   int fd = mkstemp(tpl); 
1558   if (fd == -1) exit(1);
1559   unlink(tpl);
1560   if (fstat(fd, &st) != 0) exit(1);
1561   if ((st.st_mode & 0777) != 0600) exit(1);
1562   exit(0);
1564 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1565 samba_cv_HAVE_SECURE_MKSTEMP=no,
1566 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1567 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1568     AC_DEFINE(HAVE_SECURE_MKSTEMP)
1571 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1572 AC_TRY_RUN([#include <unistd.h>
1573 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1574 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1575 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1576     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1579 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1580 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1581            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1582 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1583     AC_DEFINE(HAVE_ROOT)
1584 else
1585     AC_MSG_WARN(running as non-root will disable some tests)
1588 ##################
1589 # look for a method of finding the list of network interfaces
1590 iface=no;
1591 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1592 AC_TRY_RUN([
1593 #define HAVE_IFACE_AIX 1
1594 #define AUTOCONF_TEST 1
1595 #include "confdefs.h"
1596 #include "${srcdir-.}/lib/interfaces.c"],
1597            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1598 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1599     iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1602 if test $iface = no; then
1603 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1604 AC_TRY_RUN([
1605 #define HAVE_IFACE_IFCONF 1
1606 #define AUTOCONF_TEST 1
1607 #include "confdefs.h"
1608 #include "${srcdir-.}/lib/interfaces.c"],
1609            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1610 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1611     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1615 if test $iface = no; then
1616 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1617 AC_TRY_RUN([
1618 #define HAVE_IFACE_IFREQ 1
1619 #define AUTOCONF_TEST 1
1620 #include "confdefs.h"
1621 #include "${srcdir-.}/lib/interfaces.c"],
1622            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1623 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1624     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1629 ################################################
1630 # look for a method of setting the effective uid
1631 seteuid=no;
1632 if test $seteuid = no; then
1633 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1634 AC_TRY_RUN([
1635 #define AUTOCONF_TEST 1
1636 #define USE_SETRESUID 1
1637 #include "confdefs.h"
1638 #include "${srcdir-.}/lib/util_sec.c"],
1639            samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1640 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1641     seteuid=yes;AC_DEFINE(USE_SETRESUID)
1646 if test $seteuid = no; then
1647 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1648 AC_TRY_RUN([
1649 #define AUTOCONF_TEST 1
1650 #define USE_SETREUID 1
1651 #include "confdefs.h"
1652 #include "${srcdir-.}/lib/util_sec.c"],
1653            samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1654 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1655     seteuid=yes;AC_DEFINE(USE_SETREUID)
1659 if test $seteuid = no; then
1660 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1661 AC_TRY_RUN([
1662 #define AUTOCONF_TEST 1
1663 #define USE_SETEUID 1
1664 #include "confdefs.h"
1665 #include "${srcdir-.}/lib/util_sec.c"],
1666            samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1667 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1668     seteuid=yes;AC_DEFINE(USE_SETEUID)
1672 if test $seteuid = no; then
1673 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1674 AC_TRY_RUN([
1675 #define AUTOCONF_TEST 1
1676 #define USE_SETUIDX 1
1677 #include "confdefs.h"
1678 #include "${srcdir-.}/lib/util_sec.c"],
1679            samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1680 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1681     seteuid=yes;AC_DEFINE(USE_SETUIDX)
1686 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1687 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1688            samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1689 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1690     AC_DEFINE(HAVE_MMAP)
1693 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1694 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1695            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1696 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1697     AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1700 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1701 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1702            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1703 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1704     AC_DEFINE(HAVE_FCNTL_LOCK)
1707 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1708 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1709            samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1710 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1711     AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1713 else
1716 dnl Don't check for 64 bit fcntl locking if we know that the
1717 dnl glibc2.1 broken check has succeeded.
1718 dnl 
1720   AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1721   AC_TRY_RUN([
1722 #if defined(HAVE_UNISTD_H)
1723 #include <unistd.h>
1724 #endif
1725 #include <stdio.h>
1726 #include <stdlib.h>
1728 #ifdef HAVE_FCNTL_H
1729 #include <fcntl.h>
1730 #endif
1732 #ifdef HAVE_SYS_FCNTL_H
1733 #include <sys/fcntl.h>
1734 #endif
1735 main() { struct flock64 fl64;
1736 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1737 exit(0);
1738 #else
1739 exit(1);
1740 #endif
1742        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1744   if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1745       AC_DEFINE(HAVE_STRUCT_FLOCK64)
1746   fi
1749 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
1750 AC_TRY_COMPILE([#include <sys/types.h>
1751 #include <sys/stat.h>
1752 #include <unistd.h>],
1753 [struct stat st;  st.st_blocks = 0;],
1754 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
1755 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
1756     AC_DEFINE(HAVE_STAT_ST_BLOCKS)
1757 fi 
1759 case "$host_os" in
1760 *linux*)
1761 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1762 AC_TRY_COMPILE([
1763 #ifdef HAVE_SYS_VFS_H
1764 #include <sys/vfs.h>
1765 #endif
1766 #ifdef HAVE_SYS_CAPABILITY_H
1767 #include <sys/capability.h>
1768 #endif
1769 ],[int i;],
1770    samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1771 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1772    AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS)
1775 esac
1777 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1778 AC_TRY_COMPILE([#include <sys/acl.h>
1779 #if defined(HAVE_RPCSVC_NIS_H)
1780 #include <rpcsvc/nis.h>
1781 #endif],
1782 [int i;],
1783 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1784 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1785     AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1789 #################################################
1790 # check for smbwrapper support
1791 AC_MSG_CHECKING(whether to use smbwrapper)
1792 AC_ARG_WITH(smbwrapper,
1793 [  --with-smbwrapper       Include SMB wrapper support (default=no)],
1794 [ case "$withval" in
1795   yes)
1796     AC_MSG_RESULT(yes)
1797     AC_DEFINE(WITH_SMBWRAPPER)
1798         WRAPPROG="bin/smbsh"
1799         WRAP="bin/smbwrapper.$SHLIBEXT"
1801         if test x$ATTEMPT_WRAP32_BUILD = x; then
1802                 WRAP32=""
1803         else
1804                         WRAP32=bin/smbwrapper.32.$SHLIBEXT
1805         fi
1807 # Conditions under which smbwrapper should not be built.
1809         if test x$PICFLAG = x; then
1810            echo No support for PIC code - disabling smbwrapper and smbsh
1811            WRAPPROG=""
1812            WRAP=""
1813            WRAP32=""
1814         elif test x$ac_cv_func_syscall = xno; then
1815            AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1816            WRAPPROG=""
1817            WRAP=""
1818            WRAP32=""
1819         fi
1820     ;;
1821   *)
1822     AC_MSG_RESULT(no)
1823     ;;
1824   esac ],
1825   AC_MSG_RESULT(no)
1828 #################################################
1829 # check for the AFS filesystem
1830 AC_MSG_CHECKING(whether to use AFS)
1831 AC_ARG_WITH(afs,
1832 [  --with-afs              Include AFS support (default=no)],
1833 [ case "$withval" in
1834   yes)
1835     AC_MSG_RESULT(yes)
1836     AC_DEFINE(WITH_AFS)
1837     ;;
1838   *)
1839     AC_MSG_RESULT(no)
1840     ;;
1841   esac ],
1842   AC_MSG_RESULT(no)
1846 #################################################
1847 # check for the DFS auth system
1848 AC_MSG_CHECKING(whether to use DCE/DFS auth)
1849 AC_ARG_WITH(dfs,
1850 [  --with-dce-dfs          Include DCE/DFS support (default=no)],
1851 [ case "$withval" in
1852   yes)
1853     AC_MSG_RESULT(yes)
1854     AC_DEFINE(WITH_DFS)
1855     ;;
1856   *)
1857     AC_MSG_RESULT(no)
1858     ;;
1859   esac ],
1860   AC_MSG_RESULT(no)
1863 #################################################
1864 # check for Kerberos IV auth system
1865 AC_MSG_CHECKING(whether to use Kerberos IV)
1866 AC_ARG_WITH(krb4,
1867 [  --with-krb4=base-dir    Include Kerberos IV support (default=no)],
1868 [ case "$withval" in
1869   yes)
1870     AC_MSG_RESULT(yes)
1871     AC_DEFINE(KRB4_AUTH)
1872     AC_CHECK_LIB(resolv, dn_expand)
1873     LIBS="$LIBS -lkrb -ldes"
1874     CFLAGS="$CFLAGS -I$withval/include"
1875     LDFLAGS="$LDFLAGS -L$withval/lib"
1876     ;;
1877   *)
1878     AC_MSG_RESULT(no)
1879     ;;
1880   esac ],
1881   AC_MSG_RESULT(no)
1884 #################################################
1885 # check for Kerberos 5 auth system
1886 AC_MSG_CHECKING(whether to use Kerberos 5)
1887 AC_ARG_WITH(krb5,
1888 [  --with-krb5=base-dir    Include Kerberos 5 support (default=no)],
1889 [ case "$withval" in
1890   yes)
1891     AC_MSG_RESULT(yes)
1892     AC_DEFINE(KRB5_AUTH)
1893     LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
1894     CFLAGS="$CFLAGS -I$withval/include"
1895     LDFLAGS="$LDFLAGS -L$withval/lib"
1896     ;;
1897   *)
1898     AC_MSG_RESULT(no)
1899     ;;
1900   esac ],
1901   AC_MSG_RESULT(no)
1904 #################################################
1905 # check for automount support
1906 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1907 AC_ARG_WITH(automount,
1908 [  --with-automount        Include AUTOMOUNT support (default=no)],
1909 [ case "$withval" in
1910   yes)
1911     AC_MSG_RESULT(yes)
1912     AC_DEFINE(WITH_AUTOMOUNT)
1913     ;;
1914   *)
1915     AC_MSG_RESULT(no)
1916     ;;
1917   esac ],
1918   AC_MSG_RESULT(no)
1921 #################################################
1922 # check for smbmount support
1923 AC_MSG_CHECKING(whether to use SMBMOUNT)
1924 AC_ARG_WITH(smbmount,
1925 [  --with-smbmount         Include SMBMOUNT (Linux only) support (default=no)],
1926 [ case "$withval" in
1927   yes)
1928         case "$host_os" in
1929         *linux*)
1930                 AC_MSG_RESULT(yes)
1931                 AC_DEFINE(WITH_SMBMOUNT)
1932                 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1933                 ;;
1934         *)
1935                 AC_MSG_ERROR(not on a linux system!)
1936                 ;;
1937         esac
1938     ;;
1939   *)
1940     AC_MSG_RESULT(no)
1941     MPROGS=
1942     ;;
1943   esac ],
1944   AC_MSG_RESULT(no)
1945   MPROGS=
1949 #################################################
1950 # check for a PAM password database
1951 with_pam_for_crypt=no
1952 AC_MSG_CHECKING(whether to use PAM password database)
1953 AC_ARG_WITH(pam,
1954 [  --with-pam              Include PAM password database support (default=no)],
1955 [ case "$withval" in
1956   yes)
1957     AC_MSG_RESULT(yes)
1958     AC_DEFINE(WITH_PAM)
1959     LIBS="$LIBS -lpam"
1960     with_pam_for_crypt=yes
1961     ;;
1962   *)
1963     AC_MSG_RESULT(no)
1964     ;;
1965   esac ],
1966   AC_MSG_RESULT(no)
1969 # we can't build a pam module if we don't have pam.
1970 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
1972 #################################################
1973 # check for pam_smbpass support
1974 AC_MSG_CHECKING(whether to use pam_smbpass)
1975 AC_ARG_WITH(pam_smbpass,
1976 [  --with-pam_smbpass      Include the smbpass PAM module (default=no)],
1977 [ case "$withval" in
1978   yes)
1979     AC_MSG_RESULT(yes)
1981 # Conditions under which pam_smbpass should not be built.
1983        if test x$PICFLAG = x; then
1984           AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
1985           PAM_MOD=""
1986        elif test x$ac_cv_lib_pam_pam_get_data = xno; then
1987           AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
1988           PAM_MOD=""
1989        else
1990           AC_DEFINE(WITH_PAM_SMBPASS)
1991           PAM_MOD="bin/pam_smbpass.so"
1992        fi
1993     ;;
1994   *)
1995     AC_MSG_RESULT(no)
1996     ;;
1997   esac ],
1998   AC_MSG_RESULT(no)
2002 ###############################################
2003 # test for where we get crypt() from, but only
2004 # if not using PAM
2005 if test $with_pam_for_crypt = no; then
2006 AC_CHECK_FUNCS(crypt)
2007 if test x"$ac_cv_func_crypt" = x"no"; then
2008     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
2009         AC_DEFINE(HAVE_CRYPT)])
2014 ## moved after the check for -lcrypt in order to
2015 ## ensure that the necessary libraries are included
2016 ## check checking for truncated salt.  Wrapped by the
2017 ## $with_pam_for_crypt variable as above   --jerry
2019 if test $with_pam_for_crypt = no; then
2020 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
2021 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
2022         samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
2023 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
2024         AC_DEFINE(HAVE_TRUNCATED_SALT)
2029 ########################################################################################
2031 ## TESTS FOR SAM BACKENDS.  KEEP THESE GROUPED TOGETHER
2033 ########################################################################################
2035 ## set the with_smbpasswd_sam as the default
2036 with_smbpasswd_sam=yes
2040 #################################################
2041 # check for a TDB password database
2042 AC_MSG_CHECKING(whether to use TDB SAM database)
2043 AC_ARG_WITH(tdbsam,
2044 [  --with-tdbsam           Include experimental TDB SAM support (default=no)],
2045 [ case "$withval" in
2046   yes)
2047     AC_MSG_RESULT(yes)
2048     AC_DEFINE(WITH_TDB_SAM)
2049     with_smbpasswd_sam=no
2050     ;;
2051   *)
2052     AC_MSG_RESULT(no)
2053     ;;
2054   esac ],
2055   AC_MSG_RESULT(no)
2058 #################################################
2059 # check for a LDAP password database
2060 AC_MSG_CHECKING(whether to use LDAP SAM database)
2061 AC_ARG_WITH(ldapsam,
2062 [  --with-ldapsam          Include experimental LDAP SAM support (default=no)],
2063 [ case "$withval" in
2064   yes)
2065     AC_MSG_RESULT(yes)
2066     AC_DEFINE(WITH_LDAP_SAM)
2067     LIBS="-lldap $LIBS"
2068     AC_CHECK_LIB(lber, ber_bvfree, [LIBS="$LIBS -llber"])
2069     LIBS="-lresolv $LIBS"
2070     AC_CHECK_FUNCS(ldap_start_tls_s)
2071     with_smbpasswd_sam=no
2072     ;;
2073   *)
2074     AC_MSG_RESULT(no)
2075     ;;
2076   esac ],
2077   AC_MSG_RESULT(no)
2080 #################################################
2081 # check for a NISPLUS password database
2082 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
2083 AC_ARG_WITH(nisplussam,
2084 [  --with-nisplussam       Include NISPLUS SAM support (default=no)],
2085 [ case "$withval" in
2086   yes)
2087     AC_MSG_RESULT(yes)
2088     AC_DEFINE(WITH_NISPLUS_SAM)
2089     with_smbpasswd_sam=no
2090     ;;
2091   *)
2092     AC_MSG_RESULT(no)
2093     ;;
2094   esac ],
2095   AC_MSG_RESULT(no)
2098 ################################################
2099 # This test should come last because the
2100 # smbpasswd SAM is only used if another format
2101 # has not been defined
2102 AC_MSG_CHECKING(whether to use traditional smbpasswd file)
2103 if test $with_smbpasswd_sam = yes; then
2104         AC_MSG_RESULT(yes)
2105         AC_DEFINE(WITH_SMBPASSWD_SAM)
2106         PDBEDIT=""
2107 else
2108         AC_MSG_RESULT(no)
2109         PDBEDIT=bin/pdbedit
2112 ########################################################################################
2114 ## END OF TESTS FOR SAM BACKENDS.  
2116 ########################################################################################
2118 #################################################
2119 # check for a NISPLUS_HOME support 
2120 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
2121 AC_ARG_WITH(nisplus-home,
2122 [  --with-nisplus-home     Include NISPLUS_HOME support (default=no)],
2123 [ case "$withval" in
2124   yes)
2125     AC_MSG_RESULT(yes)
2126     AC_DEFINE(WITH_NISPLUS_HOME)
2127     ;;
2128   *)
2129     AC_MSG_RESULT(no)
2130     ;;
2131   esac ],
2132   AC_MSG_RESULT(no)
2135 #################################################
2136 # check for the secure socket layer
2137 AC_MSG_CHECKING(whether to use SSL)
2138 AC_ARG_WITH(ssl,
2139 [  --with-ssl              Include SSL support (default=no)
2140   --with-sslinc=DIR          Where the SSL includes are (defaults to /usr/local/ssl/include)
2141   --with-ssllib=DIR          Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
2142 [ case "$withval" in
2143   yes)
2144     AC_MSG_RESULT(yes)
2145     AC_DEFINE(WITH_SSL)
2146     withval="/usr/local/ssl"     # default
2148     if test "${with_sslinc+set}" = set; then
2150         withval="$with_sslinc"
2151         case "$withval" in
2152         yes|no)
2153           echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
2154           CFLAGS="-I/usr/local/ssl/include $CFLAGS"
2155         ;;
2156         * )
2157           CFLAGS="-I${withval} $CFLAGS"
2158         ;;
2159         esac
2161     else
2163         CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
2165     fi
2167     if test "${with_ssllib+set}" = set; then
2169         withval="$with_ssllib"
2170         case "$withval" in
2171         yes|no)
2172           echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
2173           LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
2174         ;;
2175         * )
2176           LDFLAGS="-L${withval}/lib $LDFLAGS"
2177         ;;
2178         esac
2180     else
2182         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
2184     fi
2186     LIBS="-lssl -lcrypto $LIBS"
2188 #    if test ! -d ${withval}; then
2189 #      echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
2190 #      exit 1
2191 #    fi 
2193     CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
2195     ;;
2196   *)
2197     AC_MSG_RESULT(no)
2198     ;;
2199   esac ],
2200   AC_MSG_RESULT(no)
2203 #################################################
2204 # check for syslog logging
2205 AC_MSG_CHECKING(whether to use syslog logging)
2206 AC_ARG_WITH(syslog,
2207 [  --with-syslog           Include experimental SYSLOG support (default=no)],
2208 [ case "$withval" in
2209   yes)
2210     AC_MSG_RESULT(yes)
2211     AC_DEFINE(WITH_SYSLOG)
2212     ;;
2213   *)
2214     AC_MSG_RESULT(no)
2215     ;;
2216   esac ],
2217   AC_MSG_RESULT(no)
2220 #################################################
2221 # check for a shared memory profiling support
2222 AC_MSG_CHECKING(whether to use profiling)
2223 AC_ARG_WITH(profiling-data,
2224 [  --with-profiling-data   Include gathering source code profile information (default=no)],
2225 [ case "$withval" in
2226   yes)
2227     AC_MSG_RESULT(yes)
2228     AC_DEFINE(WITH_PROFILE)
2229     ;;
2230   *)
2231     AC_MSG_RESULT(no)
2232     ;;
2233   esac ],
2234   AC_MSG_RESULT(no)
2238 #################################################
2239 # check for experimental disk-quotas support
2240 QUOTAOBJS=smbd/noquotas.o
2242 AC_MSG_CHECKING(whether to support disk-quotas)
2243 AC_ARG_WITH(quotas,
2244 [  --with-quotas           Include experimental disk-quota support (default=no)],
2245 [ case "$withval" in
2246   yes)
2247     AC_MSG_RESULT(yes)
2248     QUOTAOBJS=smbd/quotas.o
2249     case "$host_os" in
2250       *linux*)
2251         # Check for kernel 2.4.x quota braindamage...
2252         AC_CACHE_CHECK([for linux 2.4.x quota braindamage..],samba_cv_linux_2_4_quota_braindamage, [
2253         AC_TRY_COMPILE([#include <stdio.h>
2254 #include <sys/types.h>
2255 #include <asm/types.h>
2256 #include <linux/quota.h>
2257 #include <mntent.h>
2258 #include <linux/unistd.h>],[struct mem_dqblk D;],
2259         samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
2260 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
2261         AC_DEFINE(LINUX_QUOTAS_2)
2262 else
2263         AC_DEFINE(LINUX_QUOTAS_1)
2265         ;;
2266       *)
2267         ;;
2268     esac
2269     ;;
2270   *)
2271     AC_MSG_RESULT(no)
2272     ;;
2273   esac ],
2274   AC_MSG_RESULT(no)
2276 AC_SUBST(QUOTAOBJS)
2278 #################################################
2279 # check for experimental utmp accounting
2281 AC_MSG_CHECKING(whether to support utmp accounting)
2282 AC_ARG_WITH(utmp,
2283 [  --with-utmp             Include experimental utmp accounting (default=no)],
2284 [ case "$withval" in
2285   yes)
2286     AC_MSG_RESULT(yes)
2287     AC_DEFINE(WITH_UTMP)
2288     ;;
2289   *)
2290     AC_MSG_RESULT(no)
2291     ;;
2292   esac ],
2293   AC_MSG_RESULT(no)
2296 #################################################
2297 # check for MS Dfs support
2299 AC_MSG_CHECKING(whether to support Microsoft Dfs)
2300 AC_ARG_WITH(msdfs,
2301 [  --with-msdfs            Include MS Dfs support (default=no)],
2302 [ case "$withval" in
2303   yes)
2304      AC_MSG_RESULT(yes)
2305      AC_DEFINE(WITH_MSDFS)
2306      ;;
2307   *)
2308     AC_MSG_RESULT(no)
2309     ;;
2310   esac ],
2311   AC_MSG_RESULT(no)
2314 #################################################
2315 # should we build libsmbclient?
2317 LIBSMBCLIENT_SHARED=
2318 LIBSMBCLIENT=
2319 AC_MSG_CHECKING(whether to build the libsmbclient shared library)
2320 AC_ARG_WITH(libsmbclient,
2321 [  --with-libsmbclient     Build the libsmbclient shared library (default=no)],
2322 [ case "$withval" in
2323   yes)
2324      if test $BLDSHARED = true; then
2325         LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
2326         LIBSMBCLIENT=libsmbclient
2327         AC_MSG_RESULT(yes)
2328      else
2329         AC_MSG_RESULT(no shared library support)
2330      fi
2331      ;;
2332   *)
2333     AC_MSG_RESULT(no)
2334     ;;
2335   esac ],
2336   AC_MSG_RESULT(no)
2339 #################################################
2340 # these tests are taken from the GNU fileutils package
2341 AC_CHECKING(how to get filesystem space usage)
2342 space=no
2344 # Test for statvfs64.
2345 if test $space = no; then
2346   # SVR4
2347   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2348   [AC_TRY_RUN([
2349 #if defined(HAVE_UNISTD_H)
2350 #include <unistd.h>
2351 #endif
2352 #include <sys/types.h>
2353 #include <sys/statvfs.h>
2354   main ()
2355   {
2356     struct statvfs64 fsd;
2357     exit (statvfs64 (".", &fsd));
2358   }],
2359   fu_cv_sys_stat_statvfs64=yes,
2360   fu_cv_sys_stat_statvfs64=no,
2361   fu_cv_sys_stat_statvfs64=cross)])
2362   if test $fu_cv_sys_stat_statvfs64 = yes; then
2363     space=yes
2364     AC_DEFINE(STAT_STATVFS64)
2365   fi
2368 # Perform only the link test since it seems there are no variants of the
2369 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
2370 # because that got a false positive on SCO OSR5.  Adding the declaration
2371 # of a `struct statvfs' causes this test to fail (as it should) on such
2372 # systems.  That system is reported to work fine with STAT_STATFS4 which
2373 # is what it gets when this test fails.
2374 if test $space = no; then
2375   # SVR4
2376   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2377                  [AC_TRY_LINK([#include <sys/types.h>
2378 #include <sys/statvfs.h>],
2379                               [struct statvfs fsd; statvfs (0, &fsd);],
2380                               fu_cv_sys_stat_statvfs=yes,
2381                               fu_cv_sys_stat_statvfs=no)])
2382   if test $fu_cv_sys_stat_statvfs = yes; then
2383     space=yes
2384     AC_DEFINE(STAT_STATVFS)
2385   fi
2388 if test $space = no; then
2389   # DEC Alpha running OSF/1
2390   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2391   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2392   [AC_TRY_RUN([
2393 #include <sys/param.h>
2394 #include <sys/types.h>
2395 #include <sys/mount.h>
2396   main ()
2397   {
2398     struct statfs fsd;
2399     fsd.f_fsize = 0;
2400     exit (statfs (".", &fsd, sizeof (struct statfs)));
2401   }],
2402   fu_cv_sys_stat_statfs3_osf1=yes,
2403   fu_cv_sys_stat_statfs3_osf1=no,
2404   fu_cv_sys_stat_statfs3_osf1=no)])
2405   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2406   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2407     space=yes
2408     AC_DEFINE(STAT_STATFS3_OSF1)
2409   fi
2412 if test $space = no; then
2413 # AIX
2414   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2415 member (AIX, 4.3BSD)])
2416   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2417   [AC_TRY_RUN([
2418 #ifdef HAVE_SYS_PARAM_H
2419 #include <sys/param.h>
2420 #endif
2421 #ifdef HAVE_SYS_MOUNT_H
2422 #include <sys/mount.h>
2423 #endif
2424 #ifdef HAVE_SYS_VFS_H
2425 #include <sys/vfs.h>
2426 #endif
2427   main ()
2428   {
2429   struct statfs fsd;
2430   fsd.f_bsize = 0;
2431   exit (statfs (".", &fsd));
2432   }],
2433   fu_cv_sys_stat_statfs2_bsize=yes,
2434   fu_cv_sys_stat_statfs2_bsize=no,
2435   fu_cv_sys_stat_statfs2_bsize=no)])
2436   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2437   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2438     space=yes
2439     AC_DEFINE(STAT_STATFS2_BSIZE)
2440   fi
2443 if test $space = no; then
2444 # SVR3
2445   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2446   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2447   [AC_TRY_RUN([#include <sys/types.h>
2448 #include <sys/statfs.h>
2449   main ()
2450   {
2451   struct statfs fsd;
2452   exit (statfs (".", &fsd, sizeof fsd, 0));
2453   }],
2454     fu_cv_sys_stat_statfs4=yes,
2455     fu_cv_sys_stat_statfs4=no,
2456     fu_cv_sys_stat_statfs4=no)])
2457   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2458   if test $fu_cv_sys_stat_statfs4 = yes; then
2459     space=yes
2460     AC_DEFINE(STAT_STATFS4)
2461   fi
2464 if test $space = no; then
2465 # 4.4BSD and NetBSD
2466   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2467 member (4.4BSD and NetBSD)])
2468   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2469   [AC_TRY_RUN([#include <sys/types.h>
2470 #ifdef HAVE_SYS_PARAM_H
2471 #include <sys/param.h>
2472 #endif
2473 #ifdef HAVE_SYS_MOUNT_H
2474 #include <sys/mount.h>
2475 #endif
2476   main ()
2477   {
2478   struct statfs fsd;
2479   fsd.f_fsize = 0;
2480   exit (statfs (".", &fsd));
2481   }],
2482   fu_cv_sys_stat_statfs2_fsize=yes,
2483   fu_cv_sys_stat_statfs2_fsize=no,
2484   fu_cv_sys_stat_statfs2_fsize=no)])
2485   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2486   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2487     space=yes
2488     AC_DEFINE(STAT_STATFS2_FSIZE)
2489   fi
2492 if test $space = no; then
2493   # Ultrix
2494   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2495   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2496   [AC_TRY_RUN([#include <sys/types.h>
2497 #ifdef HAVE_SYS_PARAM_H
2498 #include <sys/param.h>
2499 #endif
2500 #ifdef HAVE_SYS_MOUNT_H
2501 #include <sys/mount.h>
2502 #endif
2503 #ifdef HAVE_SYS_FS_TYPES_H
2504 #include <sys/fs_types.h>
2505 #endif
2506   main ()
2507   {
2508   struct fs_data fsd;
2509   /* Ultrix's statfs returns 1 for success,
2510      0 for not mounted, -1 for failure.  */
2511   exit (statfs (".", &fsd) != 1);
2512   }],
2513   fu_cv_sys_stat_fs_data=yes,
2514   fu_cv_sys_stat_fs_data=no,
2515   fu_cv_sys_stat_fs_data=no)])
2516   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2517   if test $fu_cv_sys_stat_fs_data = yes; then
2518     space=yes
2519     AC_DEFINE(STAT_STATFS2_FS_DATA)
2520   fi
2524 # As a gating factor for large file support, in order to
2525 # use <4GB files we must have the following minimal support
2526 # available.
2527 # long long, and a 64 bit off_t or off64_t.
2528 # If we don't have all of these then disable large
2529 # file support.
2531 AC_MSG_CHECKING(if large file support can be enabled)
2532 AC_TRY_COMPILE([
2533 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2534 #include <sys/types.h>
2535 #else
2536 __COMPILE_ERROR_
2537 #endif
2539 [int i],
2540 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2541 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2542     AC_MSG_RESULT(yes)
2543     AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2544 else
2545     AC_MSG_RESULT(no)
2548 AC_ARG_WITH(spinlocks, 
2549 [  --with-spinlocks        Use spin locks instead of fcntl locks (default=no)])
2550 if test "x$with_spinlocks" = "xyes"; then
2551     AC_DEFINE(USE_SPINLOCKS)
2553     case "$host_cpu" in
2554         sparc)
2555             AC_DEFINE(SPARC_SPINLOCKS)
2556             ;;
2558         i386|i486|i586|i686)
2559             AC_DEFINE(INTEL_SPINLOCKS)
2560             ;;
2562         mips)
2563             AC_DEFINE(MIPS_SPINLOCKS)
2564             ;;
2566         powerpc)
2567             AC_DEFINE(POWERPC_SPINLOCKS)
2568             ;;
2569     esac
2572 #################################################
2573 # check for ACL support
2575 AC_MSG_CHECKING(whether to support ACLs)
2576 AC_ARG_WITH(acl-support,
2577 [  --with-acl-support      Include ACL support (default=no)],
2578 [ case "$withval" in
2579   yes)
2581                 case "$host_os" in
2582                 *sysv5*)
2583                         AC_MSG_RESULT(Using UnixWare ACLs)
2584                         AC_DEFINE(HAVE_UNIXWARE_ACLS)
2585                         ;;
2586                 *solaris*)
2587                         AC_MSG_RESULT(Using solaris ACLs)
2588                         AC_DEFINE(HAVE_SOLARIS_ACLS)
2589                         ;;
2590                 *hpux*)
2591                         AC_MSG_RESULT(Using HPUX ACLs)
2592                         AC_DEFINE(HAVE_HPUX_ACLS)
2593                         ;;
2594                 *irix*)
2595                         AC_MSG_RESULT(Using IRIX ACLs)
2596                         AC_DEFINE(HAVE_IRIX_ACLS)
2597                         ;;
2598                 *aix*)
2599                         AC_MSG_RESULT(Using AIX ACLs)
2600                         AC_DEFINE(HAVE_AIX_ACLS)
2601                         ;;
2602                 *osf*)
2603                         AC_MSG_RESULT(Using Tru64 ACLs)
2604                         AC_DEFINE(HAVE_TRU64_ACLS)
2605                         LIBS="$LIBS -lpacl"
2606                         ;;
2607                 *)
2608                     AC_CHECK_LIB(acl,acl_get_file)
2609                         AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2610                         AC_TRY_LINK([#include <sys/types.h>
2611 #include <sys/acl.h>],
2612 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2613 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2614                         if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2615                             AC_MSG_RESULT(Using posix ACLs)
2616                             AC_DEFINE(HAVE_POSIX_ACLS)
2617                                 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2618                                 AC_TRY_LINK([#include <sys/types.h>
2619 #include <sys/acl.h>],
2620 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2621 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2622                                 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2623                                         AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2624                                 fi
2625                         fi
2626                         ;;
2627                 esac
2628                 ;;
2629   *)
2630     AC_MSG_RESULT(no)
2631         AC_DEFINE(HAVE_NO_ACLS)
2632     ;;
2633   esac ],
2634   AC_DEFINE(HAVE_NO_ACLS)
2635   AC_MSG_RESULT(no)
2638 #################################################
2639 # check for the historical SAMBA installation
2641 if test "x$prefix" = xNONE -a "$sbindir" = "\${exec_prefix}/sbin"; then
2642         # Put all binaries under the /usr/local/samba/bin directory.
2643         sbindir="$bindir"
2646 #################################################
2647 # Check whether winbind is supported on this platform.  If so we need to
2648 # build and install client programs (WINBIND_TARGETS), sbin programs
2649 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2651 AC_MSG_CHECKING(whether to build winbind)
2653 # Initially, the value of $host_os decides whether winbind is supported
2655 case "$host_os" in 
2656         *linux*|*irix*)
2657                 HAVE_WINBIND=yes
2658                 ;;
2659         *solaris*)
2660                 HAVE_WINBIND=yes
2661                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2662                 WINBIND_NSS_EXTRA_LIBS="-lsocket"
2663                 ;;
2664         *hpux11*)
2665                 HAVE_WINBIND=yes
2666                 WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
2667                ;;
2668         *aix4*)
2669                 HAVE_WINBIND=yes
2670                 ;;
2671         *)
2672                 HAVE_WINBIND=no
2673                 winbind_no_reason=", unsupported on $host_os"
2674                 ;;
2675 esac
2677 # Check the setting of --with-winbindd
2679 AC_ARG_WITH(winbind,
2680 [  --with-winbind          Build winbind (default, if supported by OS)],
2682   case "$withval" in
2683         yes)
2684                 HAVE_WINBIND=yes
2685                 ;;
2686         no)
2687                 HAVE_WINBIND=no
2688                 winbind_reason=""
2689                 ;;
2690   esac ],
2693 # We need unix domain sockets for winbind
2695 if test x"$HAVE_WINBIND" = x"yes"; then
2696         if test x"$samba_cv_unixsocket" = x"no"; then
2697                 winbind_no_reason=", no unix domain socket support on $host_os"
2698                 HAVE_WINBIND=no
2699         fi
2702 # Display test results
2704 if test x"$HAVE_WINBIND" = x"yes"; then
2706         AC_MSG_RESULT(yes)
2708         WINBIND_TARGETS="bin/wbinfo"
2709         WINBIND_STARGETS="bin/winbindd"
2710         case "$host_os" in
2711         *irix*)
2712                 WINBIND_LTARGETS="nsswitch/libns_winbind.so"
2713                 ;;
2714         *)
2715                 WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
2716                 ;;
2717         esac
2720         case "$with_pam" in
2721                 yes)
2722                         WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
2723                 ;;
2724         esac
2725 else
2726         AC_MSG_RESULT(no$winbind_no_reason)
2728         WINBIND_TARGETS=""
2729         WINBIND_STARGETS=""
2730         WINBIND_LTARGETS=""
2731         WINBIND_PAM_TARGETS=""
2734 # Check for FreeBSD problem with getgroups
2735 # It returns EGID too many times in the list of groups
2736 # and causes a security problem
2737 AC_CACHE_CHECK([whether or not getgroups returns EGID too many times],
2738     samba_cv_have_getgroups_too_many_egids,[AC_TRY_RUN([
2739 #include <sys/types.h>
2740 #include <stdio.h>
2742 int main(int argc, char *argv[])
2744   gid_t groups[10];
2745   int n = 10;
2747   n = getgroups(n, &groups);
2748   /* Could actually pass back the number of EGIDs there ... */
2749   exit((n > 1 && groups[0] == getegid() && groups[1] == getegid()) ? 1 : 0);
2751         samba_cv_have_getgroups_too_many_egids=no,samba_cv_have_getgroups_too_many_egids=yes, samba_cv_have_getgroups_too_many_egids=cross)])
2752 if test x"$samba_cv_have_getgroups_too_many_egids" = x"yes"; then
2753     AC_DEFINE(HAVE_GETGROUPS_TOO_MANY_EGIDS)
2756 # Substitution time!
2758 AC_SUBST(WINBIND_TARGETS)
2759 AC_SUBST(WINBIND_STARGETS)
2760 AC_SUBST(WINBIND_LTARGETS)
2761 AC_SUBST(WINBIND_PAM_TARGETS)
2762 AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
2763 AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
2765 # Solaris has some extra fields in struct passwd that need to be
2766 # initialised otherwise nscd crashes.  Unfortunately autoconf < 2.50
2767 # doesn't have the AC_CHECK_MEMBER macro which would be handy for checking
2768 # this.
2770 #AC_CHECK_MEMBER(struct passwd.pw_comment,
2771 #               AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),
2772 #               [#include <pwd.h>])
2774 AC_CACHE_CHECK([whether struct passwd has pw_comment],samba_cv_passwd_pw_comment, [
2775         AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_comment;],
2776         samba_cv_passwd_pw_comment=yes,samba_cv_passwd_pw_comment=no)])
2777 if test x"$samba_cv_passwd_pw_comment" = x"yes"; then
2778         AC_DEFINE(HAVE_PASSWD_PW_COMMENT)
2781 #AC_CHECK_MEMBER(struct passwd.pw_age,
2782 #               AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),
2783 #               [#include <pwd.h>])
2785 AC_CACHE_CHECK([whether struct passwd has pw_age],samba_cv_passwd_pw_age, [
2786         AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_age;],
2787         samba_cv_passwd_pw_age=yes,samba_cv_passwd_pw_age=no)])
2788 if test x"$samba_cv_passwd_pw_age" = x"yes"; then
2789         AC_DEFINE(HAVE_PASSWD_PW_AGE)
2792 #################################################
2793 # Check to see if we should use the included popt
2795 AC_ARG_WITH(included-popt,
2796 [  --with-included-popt    use bundled popt library, not from system],
2798   case "$withval" in
2799         yes)
2800                 INCLUDED_POPT=yes
2801                 ;;
2802         no)
2803                 INCLUDED_POPT=no
2804                 ;;
2805   esac ],
2807 if test x"$INCLUDED_POPT" != x"yes"; then
2808     AC_CHECK_LIB(popt, poptGetContext,
2809                  INCLUDED_POPT=no, INCLUDED_POPT=yes)
2812 AC_MSG_CHECKING(whether to use included popt)
2813 if test x"$INCLUDED_POPT" = x"yes"; then
2814     AC_MSG_RESULT($srcdir/popt)
2815     BUILD_POPT='$(POPT_OBJS)'
2816     FLAGS1="-I$srcdir/popt"
2817 else
2818     AC_MSG_RESULT(no)
2819     LIBS="$LIBS -lpopt"
2821 AC_SUBST(BUILD_POPT)
2822 AC_SUBST(FLAGS1)
2824 #################################################
2825 # final configure stuff
2826 AC_MSG_CHECKING([configure summary])
2827 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2828         AC_MSG_RESULT(yes),
2829         AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
2830         AC_MSG_WARN([cannot run when cross-compiling]))
2832 builddir=`pwd`
2833 AC_SUBST(builddir)
2835 AC_OUTPUT(include/stamp-h Makefile script/findsmb)