Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / samba / source / configure.in
blob79f43d5815966022d98839efce33c638c78bcd95
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 # we want to be compatibe with older versions of Samba
6 AC_PREFIX_DEFAULT(/usr/local/samba)
8 dnl Unique-to-Samba variables we'll be playing with.
9 AC_SUBST(SHELL)
10 AC_SUBST(RUNPROG)
11 AC_SUBST(MPROGS)
12 AC_SUBST(LDSHFLAGS)
13 AC_SUBST(HOST_OS)
14 AC_SUBST(WRAP)
15 AC_SUBST(WRAP32)
16 AC_SUBST(PICFLAG)
17 AC_SUBST(SHLIBEXT)
19 # compile with optimisation and without debugging by default
20 CFLAGS=${CFLAGS-"-O"}
22 dnl Checks for programs.
23 AC_PROG_CC
24 AC_PROG_INSTALL
25 AC_PROG_AWK
27 dnl Check if C compiler understands -c and -o at the same time
28 AC_PROG_CC_C_O
29 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
30       BROKEN_CC=
31 else
32       BROKEN_CC=#
34 AC_SUBST(BROKEN_CC)
36 dnl Check if the C compiler understands volatile (it should, being ANSI).
37 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
38     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
39         samba_cv_volatile=yes,samba_cv_volatile=no)])
40 if test x"$samba_cv_volatile" = x"yes"; then
41    AC_DEFINE(HAVE_VOLATILE)
46 AC_CANONICAL_SYSTEM
48 dnl Add #include for broken IRIX header files
49   case "$host_os" in
50         *irix*) AC_ADD_INCLUDE(<standards.h>)
51         ;;
52 esac
54 AC_VALIDATE_CACHE_SYSTEM_TYPE
55 SAMBA_MAINTAINER_MODE
58 # Config CPPFLAG settings for strange OS's that must be set
59 # before other tests.
61 case "$host_os" in
62 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
63     *hpux*)
64       AC_PROG_CC_FLAG(Ae)
65       if test $ac_cv_prog_cc_Ae = yes; then
66         CPPFLAGS="$CPPFLAGS -Ae"
67       fi
69 # Defines needed for HPUX support.
70 # HPUX has bigcrypt but (sometimes?) doesn't use it for
71 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
73       case `uname -r` in
74                         *9*|*10*)
75                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE"
76                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
77                                 ;;
78                         *11*)
79                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE"
80                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
81                                 ;;
82       esac
83       ;;
85 # AIX4.x doesn't even admit to having large
86 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
88     *aix4*)
89           AC_MSG_RESULT([enabling large file support])
90       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
91       ;;    
93 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
94 # to the existance of large files..
95 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
96 # recommendations on large file support, however it makes the
97 # compile work using gcc 2.7 and 2.8, whereas using the Sun
98 # recommendation makes the compile fail on gcc2.7. JRA.
100         *solaris*)
101                 case `uname -r` in
102                         5.6*|5.7*)
103                         AC_MSG_RESULT([enabling large file support])
104                         if test "$ac_cv_prog_gcc" = yes; then
105                                 ${CC-cc} -v >conftest.c 2>&1
106                                 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
107                                 rm -fr conftest.c
108                                 case "$ac_cv_gcc_compiler_version_number" in
109                                         *"gcc version 2.6"*|*"gcc version 2.7"*)
110                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
111                                                 ;;
112                                         *)
113                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
114                                                 ;;
115                                 esac
116                         else
117                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
118                         fi
119                         ;;
120                 esac
121                 ;;
123 # Tests needed for SINIX large file support.
125     *sysv4*)
126       if test $host = mips-sni-sysv4 ; then
127         AC_MSG_CHECKING([for LFS support])
128         old_CPPFLAGS="$CPPFLAGS"
129         CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
130         AC_TRY_RUN([
131 #include <unistd.h>
132 main () {
133 #if _LFS64_LARGEFILE == 1
134 exit(0);
135 #else
136 exit(1);
137 #endif
138 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
139         CPPFLAGS="$old_CPPFLAGS"
140         if test x$SINIX_LFS_SUPPORT = xyes ; then
141           CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
142           CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
143           LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
144           LIBS="`getconf LFS64_LIBS` $LIBS"
145         fi
146       AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
147       fi
148     ;;
151 # Tests needed for glibc 2.1 large file support.
153         *linux*)
154                 AC_MSG_RESULT([disabling large file support for glibc2.1 on Linux])     
155                 ;;
156     *hurd*)
157         AC_MSG_CHECKING([for LFS support])
158         old_CPPFLAGS="$CPPFLAGS"
159         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
160         AC_TRY_RUN([
161 #include <unistd.h>
162 main () {
163 #if _LFS64_LARGEFILE == 1
164 exit(0);
165 #else
166 exit(1);
167 #endif
168 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
169         CPPFLAGS="$old_CPPFLAGS"
170         if test x$GLIBC_LFS_SUPPORT = xyes ; then
171           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
172         fi
173       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
174     ;;
176 esac
178 AC_INLINE
179 AC_HEADER_STDC
180 AC_HEADER_DIRENT
181 AC_HEADER_TIME
182 AC_HEADER_SYS_WAIT
183 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
184 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
185 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
186 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
187 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h string.h strings.h stdlib.h sys/socket.h)
188 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
189 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
191 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
192 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
194 case "$host_os" in
195     *hpux*)
196                 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
197                         ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
198                 if test x"$ac_cv_header_shadow_h" = x"yes"; then
199                    AC_DEFINE(HAVE_SHADOW_H)
200                 fi
201         ;;
202 esac
203 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
204 AC_CHECK_HEADERS(sys/security.h security/pam_appl.h)
205 AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
206 AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
207 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
209 # For experimental utmp support
210 AC_CHECK_HEADERS(utmp.h utmpx.h)
212 # For quotas on Veritas VxFS filesystems
213 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
215 AC_CHECK_SIZEOF(int,cross)
216 AC_CHECK_SIZEOF(long,cross)
217 AC_CHECK_SIZEOF(short,cross)
219 AC_C_CONST
220 AC_C_INLINE
221 AC_C_BIGENDIAN
222 AC_C_CHAR_UNSIGNED
224 AC_TYPE_SIGNAL
225 AC_TYPE_UID_T
226 AC_TYPE_MODE_T
227 AC_TYPE_OFF_T
228 AC_TYPE_SIZE_T
229 AC_TYPE_PID_T
230 AC_STRUCT_ST_RDEV
231 AC_DIRENT_D_OFF
232 AC_CHECK_TYPE(ino_t,unsigned)
233 AC_CHECK_TYPE(loff_t,off_t)
234 AC_CHECK_TYPE(offset_t,loff_t)
235 AC_CHECK_TYPE(ssize_t, int)
237 # we need libcups for CUPS support...
238 AC_CHECK_LIB(cups,httpConnect)
240 # we need libdl for PAM and the new VFS code
241 AC_CHECK_LIB(dl,main)
243 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
244     AC_TRY_COMPILE([
245 #include <sys/types.h>
246 #if STDC_HEADERS
247 #include <stdlib.h>
248 #include <stddef.h>
249 #endif
250 #include <signal.h>],[sig_atomic_t i = 0],
251         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
252 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
253    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
256 AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
257     AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
258         samba_cv_errno=yes,samba_cv_have_errno=no)])
259 if test x"$samba_cv_errno" = x"yes"; then
260    AC_DEFINE(HAVE_ERRNO_DECL)
263 # stupid glibc has the functions but no declaration. grrrr.
264 AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
265     AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresuid],
266         samba_cv_have_setresuid_decl=yes,samba_cv_have_setresuid_decl=no)])
267 if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
268     AC_DEFINE(HAVE_SETRESUID_DECL)
271 # stupid glibc has the functions but no declaration. grrrr.
272 AC_CACHE_CHECK([for setresgid declaration],samba_cv_have_setresgid_decl,[
273     AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresgid],
274         samba_cv_have_setresgid_decl=yes,samba_cv_have_setresgid_decl=no)])
275 if test x"$samba_cv_have_setresgid_decl" = x"yes"; then
276     AC_DEFINE(HAVE_SETRESGID_DECL)
279 # and glibc has setresuid under linux but the function does
280 # nothing until kernel 2.1.44! very dumb.
281 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
282     AC_TRY_RUN([#include <errno.h>
283 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
284         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
285 if test x"$samba_cv_have_setresuid" = x"yes"; then
286     AC_DEFINE(HAVE_SETRESUID)
289 # Do the same check for setresguid...
291 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
292     AC_TRY_RUN([#include <unistd.h>
293 #include <errno.h>
294 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
295         samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
296 if test x"$samba_cv_have_setresgid" = x"yes"; then
297     AC_DEFINE(HAVE_SETRESGID)
300 AC_FUNC_MEMCMP
302 ###############################################
303 # test for where we get crypt() from
304 AC_CHECK_FUNCS(crypt)
305 if test x"$ac_cv_func_crypt" = x"no"; then
306     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
307         AC_DEFINE(HAVE_CRYPT)])
311 ###############################################
312 # test for where we get readline() from
313 if test "$ac_cv_header_readline_h" = "yes" ||
314    test "$ac_cv_header_readline_readline_h" = "yes"; then
315   AC_CHECK_LIB(readline,readline)
319 # The following test taken from the cvs sources
320 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
321 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
322 # libsocket.so which has a bad implementation of gethostbyname (it
323 # only looks in /etc/hosts), so we only look for -lsocket if we need
324 # it.
325 AC_CHECK_FUNCS(connect)
326 if test x"$ac_cv_func_connect" = x"no"; then
327     case "$LIBS" in
328     *-lnsl*) ;;
329     *) AC_CHECK_LIB(nsl_s, printf) ;;
330     esac
331     case "$LIBS" in
332     *-lnsl*) ;;
333     *) AC_CHECK_LIB(nsl, printf) ;;
334     esac
335     case "$LIBS" in
336     *-lsocket*) ;;
337     *) AC_CHECK_LIB(socket, connect) ;;
338     esac
339     case "$LIBS" in
340     *-linet*) ;;
341     *) AC_CHECK_LIB(inet, connect) ;;
342     esac
343     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
344     dnl has been cached.
345     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
346        test x"$ac_cv_lib_inet_connect" = x"yes"; then
347         # ac_cv_func_connect=yes
348         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
349         AC_DEFINE(HAVE_CONNECT)
350     fi
353 # Check if we have execl, if not we need to compile smbrun.
354 AC_CHECK_FUNCS(execl)
355 if test x"$ac_cv_func_execl" = x"no"; then
356     RUNPROG="bin/smbrun"
357 else
358     RUNPROG=""
361 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod chroot)
362 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
363 AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob strpbrk pipe crypt16 getauthuid)
364 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
365 AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf)
366 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
367 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
368 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid yp_get_default_domain getpwanam)
369 AC_CHECK_FUNCS(srandom random srand rand setenv usleep mmap64 strcasecmp fcvt fcvtl)
371 # syscall() is needed for smbwrapper.
372 AC_CHECK_FUNCS(syscall)
374 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
375 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
376 AC_CHECK_FUNCS(__getcwd _getcwd)
377 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
378 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
379 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
380 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
381 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
382 AC_CHECK_FUNCS(_write __write _fork __fork)
383 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
384 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
385 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
386 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
387 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
390 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
393 if test x$ac_cv_func_stat64 = xno ; then
394   AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
395   AC_TRY_LINK([
396 #if defined(HAVE_UNISTD_H)
397 #include <unistd.h>
398 #endif
399 #include <sys/stat.h>
400 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
401   AC_MSG_RESULT([$ac_cv_func_stat64])
402   if test x$ac_cv_func_stat64 = xyes ; then
403     AC_DEFINE(HAVE_STAT64)
404   fi
407 if test x$ac_cv_func_lstat64 = xno ; then
408   AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
409   AC_TRY_LINK([
410 #if defined(HAVE_UNISTD_H)
411 #include <unistd.h>
412 #endif
413 #include <sys/stat.h>
414 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
415   AC_MSG_RESULT([$ac_cv_func_lstat64])
416   if test x$ac_cv_func_lstat64 = xyes ; then
417     AC_DEFINE(HAVE_LSTAT64)
418   fi
421 if test x$ac_cv_func_fstat64 = xno ; then
422   AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
423   AC_TRY_LINK([
424 #if defined(HAVE_UNISTD_H)
425 #include <unistd.h>
426 #endif
427 #include <sys/stat.h>
428 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
429   AC_MSG_RESULT([$ac_cv_func_fstat64])
430   if test x$ac_cv_func_fstat64 = xyes ; then
431     AC_DEFINE(HAVE_FSTAT64)
432   fi
436 # If no strcasecmp, check for it in some known places
437 # It is in -lresolv on ReliantUNIX and UnixWare
438 #   -lresolve *must* follow -lnsl for name resolution to work properly
441 if test x$ac_cv_func_strcasecmp = xno ; then
442         AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
443                 AC_DEFINE(HAVE_STRCASECMP))
447 # Check for the functions putprpwnam, set_auth_parameters,
448 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
449 # Needed for OSF1 and HPUX.
452 AC_LIBTESTFUNC(security, putprpwnam)
453 AC_LIBTESTFUNC(sec, putprpwnam)
455 AC_LIBTESTFUNC(security, set_auth_parameters)
456 AC_LIBTESTFUNC(sec, set_auth_parameters)
458 # UnixWare 7.x has its getspnam in -lgen
459 AC_LIBTESTFUNC(gen, getspnam)
461 AC_LIBTESTFUNC(security, getspnam)
462 AC_LIBTESTFUNC(sec, getspnam)
464 AC_LIBTESTFUNC(security, bigcrypt)
465 AC_LIBTESTFUNC(sec, bigcrypt)
467 AC_LIBTESTFUNC(security, getprpwnam)
468 AC_LIBTESTFUNC(sec, getprpwnam)
470 # this bit needs to be modified for each OS that is suported by
471 # smbwrapper. You need to specify how to created a shared library and
472 # how to compile C code to produce PIC object files
474 # these are the defaults, good for lots of systems
475 HOST_OS="$host_os"
476 LDSHFLAGS="-shared"
477 PICFLAG=""
478 SHLIBEXT="so"
480 # and these are for particular systems
481 case "$host_os" in
482                 *linux*)   AC_DEFINE(LINUX);;
483                 *solaris*) AC_DEFINE(SUNOS5)
484                                         LDSHFLAGS="-G"
485                 ;;
486                 *sunos*) AC_DEFINE(SUNOS4)
487                                         LDSHFLAGS=""
488                 ;;
489                 *bsd*) LDSHFLAGS="-shared -Bshareable"
490                 ;;
491                 *irix*) AC_DEFINE(IRIX)
492                         case "$host_os" in
493                         *irix6*) AC_DEFINE(IRIX6)
494                         ;;
495                         esac
496                         ATTEMPT_WRAP32_BUILD=yes
497                 ;;
498                 *aix*) AC_DEFINE(AIX);;
499                 *hpux*) AC_DEFINE(HPUX)
500                         SHLIBEXT="sl"
501                         # Use special PIC flags for the native HP-UX compiler.
502                         if test $ac_cv_prog_cc_Ae = yes; then
503                                 LDSHFLAGS="-b"
504                                 PICFLAG="+z"
505                         fi
506                 ;;
507                 *qnx*) AC_DEFINE(QNX);;
508                 *osf*) AC_DEFINE(OSF1);;
509                 *sco*) AC_DEFINE(SCO);;
510                 *next2*) AC_DEFINE(NEXT2);;
511                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
512                 *sysv4*)
513                         case "$host" in
514                                 *-univel-*)     if [ test "$GCC" != yes ]; then
515                                                                         AC_DEFINE(HAVE_MEMSET)
516                                                                 fi
517                                                                 LDSHFLAGS="-G"
518                                 ;;
519                                 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
520                         esac
521                         ;;
522                 *sysv5*)
523                         if [ test "$GCC" != yes ]; then
524                                 AC_DEFINE(HAVE_MEMSET)
525                         fi
526                         LDSHFLAGS="-G"
527                         ;;
528 esac
530 # try to work out how to produce pic code with this compiler
531 AC_PROG_CC_FLAG(fpic)
532 if test $ac_cv_prog_cc_fpic = yes; then
533     PICFLAG="-fpic";
535 if test x$PICFLAG = x; then
536   AC_PROG_CC_FLAG(Kpic)
537   if test $ac_cv_prog_cc_Kpic = yes; then
538     PICFLAG="-Kpic";
539   fi
541 if test x$PICFLAG = x; then
542   AC_PROG_CC_FLAG(KPIC)
543   if test $ac_cv_prog_cc_KPIC = yes; then
544     PICFLAG="-KPIC";
545   fi
548 ################
550 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
551 AC_TRY_RUN([#include <stdio.h>
552 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
553 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
554 if test x"$samba_cv_have_longlong" = x"yes"; then
555     AC_DEFINE(HAVE_LONGLONG)
559 # Check if the compiler supports the LL prefix on long long integers.
560 # AIX needs this.
562 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
563     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
564         samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
565 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
566    AC_DEFINE(COMPILER_SUPPORTS_LL)
569   
570 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
571 AC_TRY_RUN([#include <stdio.h>
572 #include <sys/stat.h>
573 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
574 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
575 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
576     AC_DEFINE(SIZEOF_OFF_T,8)
579 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
580 AC_TRY_RUN([
581 #if defined(HAVE_UNISTD_H)
582 #include <unistd.h>
583 #endif
584 #include <stdio.h>
585 #include <sys/stat.h>
586 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
587 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
588 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
589     AC_DEFINE(HAVE_OFF64_T)
592 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
593 AC_TRY_RUN([#include <stdio.h>
594 #include <sys/stat.h>
595 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
596 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
597 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
598     AC_DEFINE(SIZEOF_INO_T,8)
601 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
602 AC_TRY_RUN([
603 #if defined(HAVE_UNISTD_H)
604 #include <unistd.h>
605 #endif
606 #include <stdio.h>
607 #include <sys/stat.h>
608 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
609 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
610 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
611     AC_DEFINE(HAVE_INO64_T)
614 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
615 AC_TRY_COMPILE([
616 #if defined(HAVE_UNISTD_H)
617 #include <unistd.h>
618 #endif
619 #include <sys/types.h>
620 #include <dirent.h>],
621 [struct dirent64 de;],
622 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
623 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
624     AC_DEFINE(HAVE_STRUCT_DIRENT64)
627 AC_CACHE_CHECK([for union semun],samba_cv_HAVE_UNION_SEMUN,[
628 AC_TRY_RUN([
629 #include <sys/types.h>
630 #include <sys/ipc.h>
631 #include <sys/sem.h>
632 main() { union semun ss; exit(0); }],
633 samba_cv_HAVE_UNION_SEMUN=yes,samba_cv_HAVE_UNION_SEMUN=no,samba_cv_HAVE_UNION_SEMUN=cross)])
634 if test x"$samba_cv_HAVE_UNION_SEMUN" = x"yes"; then
635     AC_DEFINE(HAVE_UNION_SEMUN)
638 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
639 AC_TRY_RUN([#include <stdio.h>
640 main() { char c; c=250; exit((c > 0)?0:1); }],
641 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
642 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
643     AC_DEFINE(HAVE_UNSIGNED_CHAR)
646 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
647 AC_TRY_COMPILE([#include <sys/types.h>
648 #include <sys/socket.h>
649 #include <netinet/in.h>],
650 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
651 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
652 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
653     AC_DEFINE(HAVE_SOCK_SIN_LEN)
656 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
657 AC_TRY_COMPILE([#include <sys/types.h>
658 #include <dirent.h>
659 void seekdir(DIR *d, long loc) { return; }],[return 0;],
660 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
661 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
662     AC_DEFINE(SEEKDIR_RETURNS_VOID)
665 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
666 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
667 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
668 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
669     AC_DEFINE(HAVE_FILE_MACRO)
672 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
673 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
674 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
675 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
676     AC_DEFINE(HAVE_FUNCTION_MACRO)
679 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
680 AC_TRY_RUN([
681 #include <sys/time.h>
682 #include <unistd.h>
683 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
684            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
685 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
686     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
690 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
691 AC_TRY_RUN([#include <sys/types.h>
692 #include <dirent.h>
693 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
694 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
695 di->d_name[0] == 0) exit(0); exit(1);} ],
696 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
697 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
698     AC_DEFINE(HAVE_BROKEN_READDIR)
701 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
702 AC_TRY_COMPILE([#include <sys/types.h>
703 #include <utime.h>],
704 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
705 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
706 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
707     AC_DEFINE(HAVE_UTIMBUF)
710 dnl  utmp and utmpx come in many flavours
711 dnl  We need to check for many of them
712 dnl  But we don't need to do each and every one, because our code uses
713 dnl  mostly just the utmp (not utmpx) fields.
715 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
716 AC_TRY_COMPILE([#include <utmp.h>],
717 [struct utmp ut;  ut.ut_name[0] = 'a';],
718 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
719 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
720     AC_DEFINE(HAVE_UT_UT_NAME)
721 fi 
723 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
724 AC_TRY_COMPILE([#include <utmp.h>],
725 [struct utmp ut;  ut.ut_user[0] = 'a';],
726 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
727 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
728     AC_DEFINE(HAVE_UT_UT_USER)
729 fi 
731 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
732 AC_TRY_COMPILE([#include <utmp.h>],
733 [struct utmp ut;  ut.ut_id[0] = 'a';],
734 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
735 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
736     AC_DEFINE(HAVE_UT_UT_ID)
737 fi 
739 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
740 AC_TRY_COMPILE([#include <utmp.h>],
741 [struct utmp ut;  ut.ut_host[0] = 'a';],
742 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
743 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
744     AC_DEFINE(HAVE_UT_UT_HOST)
745 fi 
747 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
748 AC_TRY_COMPILE([#include <utmp.h>],
749 [struct utmp ut;  time_t t; ut.ut_time = t;],
750 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
751 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
752     AC_DEFINE(HAVE_UT_UT_TIME)
753 fi 
755 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
756 AC_TRY_COMPILE([#include <utmp.h>],
757 [struct utmp ut;  struct timeval tv; ut.ut_tv = tv;],
758 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
759 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
760     AC_DEFINE(HAVE_UT_UT_TV)
761 fi 
763 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
764 AC_TRY_COMPILE([#include <utmpx.h>],
765 [struct utmpx ux;  ux.ut_syslen = 0;],
766 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
767 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
768     AC_DEFINE(HAVE_UX_UT_SYSLEN)
769 fi 
771 AC_CACHE_CHECK([for kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS,[
772 AC_TRY_COMPILE([#include <sys/types.h>
773 #include <fcntl.h>],
774 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
775 samba_cv_HAVE_KERNEL_OPLOCKS=yes,samba_cv_HAVE_KERNEL_OPLOCKS=no)])
776 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
777     AC_DEFINE(HAVE_KERNEL_OPLOCKS)
780 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
781 AC_TRY_RUN([#include <sys/types.h>
782 #include <sys/capability.h>
783 main() {
784  cap_t cap;
785  if ((cap = cap_get_proc()) == NULL)
786    exit(1);
787  cap->cap_effective |= CAP_NETWORK_MGT;
788  cap->cap_inheritable |= CAP_NETWORK_MGT;
789  cap_set_proc(cap);
790  exit(0);
793 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
794 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
795     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
799 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
800 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
803 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
804 AC_TRY_COMPILE([#include <sys/types.h>
805 #if defined(HAVE_RPC_RPC_H)
806 #include <rpc/rpc.h>
807 #endif],
808 [int16 testvar;],
809 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
810 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
811     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
814 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
815 AC_TRY_COMPILE([#include <sys/types.h>
816 #if defined(HAVE_RPC_RPC_H)
817 #include <rpc/rpc.h>
818 #endif],
819 [uint16 testvar;],
820 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
821 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
822     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
825 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
826 AC_TRY_COMPILE([#include <sys/types.h>
827 #if defined(HAVE_RPC_RPC_H)
828 #include <rpc/rpc.h>
829 #endif],
830 [int32 testvar;],
831 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
832 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
833     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
836 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
837 AC_TRY_COMPILE([#include <sys/types.h>
838 #if defined(HAVE_RPC_RPC_H)
839 #include <rpc/rpc.h>
840 #endif],
841 [uint32 testvar;],
842 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
843 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
844     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
848 dnl Some systems (SCO) have a problem including
849 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
850 dnl as a #define in <prot.h> and as part of an enum
851 dnl in <rpc/rpc.h>.
854 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
855 AC_TRY_COMPILE([#include <sys/types.h>
856 #ifdef HAVE_SYS_SECURITY_H
857 #include <sys/security.h>
858 #include <prot.h>
859 #endif  /* HAVE_SYS_SECURITY_H */
860 #if defined(HAVE_RPC_RPC_H)
861 #include <rpc/rpc.h>
862 #endif],
863 [int testvar;],
864 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
865 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
866     AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
869 AC_MSG_CHECKING([for test routines])
870 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
871            AC_MSG_RESULT(yes),
872            AC_MSG_ERROR([cant find test code. Aborting config]),
873            AC_MSG_WARN([cannot run when cross-compiling]))
875 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
876 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
877            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
878 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
879     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
882 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
883 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
884            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
885 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
886     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
889 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
890 SAVE_CPPFLAGS="$CPPFLAGS"
891 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
892 AC_TRY_COMPILE([
893 #define REPLACE_GETPASS 1
894 #define NO_CONFIG_H 1
895 #define main dont_declare_main
896 #include "${srcdir-.}/lib/getsmbpass.c"
897 #undef main
898 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
899 CPPFLAGS="$SAVE_CPPFLAGS"
901 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
902         AC_DEFINE(REPLACE_GETPASS)
905 AC_CACHE_CHECK([for working fnmatch],samba_cv_HAVE_FNMATCH,[
906 AC_TRY_RUN([#include <fnmatch.h>
907 main() { exit(fnmatch("*.o", "x.o", FNM_PATHNAME) == 0? 0: 1); }],
908 samba_cv_HAVE_FNMATCH=yes,samba_cv_HAVE_FNMATCH=no,samba_cv_HAVE_FNMATCH=cross)])
909 if test x"$samba_cv_HAVE_FNMATCH" = x"yes"; then
910     AC_DEFINE(HAVE_FNMATCH)
913 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
914 AC_TRY_RUN([#include <stdlib.h>
915 #include <sys/types.h>
916 #include <sys/stat.h>
917 #include <unistd.h>
918 main() { 
919   struct stat st;
920   char tpl[20]="/tmp/test.XXXXXX"; 
921   int fd = mkstemp(tpl); 
922   if (fd == -1) exit(1);
923   unlink(tpl);
924   if (fstat(fd, &st) != 0) exit(1);
925   if ((st.st_mode & 0777) != 0600) exit(1);
926   exit(0);
928 samba_cv_HAVE_SECURE_MKSTEMP=yes,
929 samba_cv_HAVE_SECURE_MKSTEMP=no,
930 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
931 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
932     AC_DEFINE(HAVE_SECURE_MKSTEMP)
935 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
936 AC_TRY_RUN([
937 #include <stdio.h>
938 #include <sys/types.h>
939 #include <netinet/in.h>
940 #ifdef HAVE_ARPA_INET_H
941 #include <arpa/inet.h>
942 #endif
943 main() { struct in_addr ip; ip.s_addr = 0x12345678;
944 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
945     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
946 exit(1);}],
947            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
948 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
949     AC_DEFINE(REPLACE_INET_NTOA)
952 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
953 AC_TRY_RUN([#include <unistd.h>
954 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
955 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
956 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
957     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
960 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
961 AC_TRY_RUN([main() { exit(getuid() != 0); }],
962            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
963 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
964     AC_DEFINE(HAVE_ROOT)
965 else
966     AC_MSG_WARN(running as non-root will disable some tests)
969 ##################
970 # look for a method of finding the list of network interfaces
971 iface=no;
972 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
973 AC_TRY_RUN([
974 #define HAVE_IFACE_AIX 1
975 #define AUTOCONF_TEST 1
976 #include "confdefs.h"
977 #include "${srcdir-.}/lib/interfaces.c"],
978            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
979 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
980     iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
983 if test $iface = no; then
984 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
985 AC_TRY_RUN([
986 #define HAVE_IFACE_IFCONF 1
987 #define AUTOCONF_TEST 1
988 #include "confdefs.h"
989 #include "${srcdir-.}/lib/interfaces.c"],
990            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
991 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
992     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
996 if test $iface = no; then
997 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
998 AC_TRY_RUN([
999 #define HAVE_IFACE_IFREQ 1
1000 #define AUTOCONF_TEST 1
1001 #include "confdefs.h"
1002 #include "${srcdir-.}/lib/interfaces.c"],
1003            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1004 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1005     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1010 ################################################
1011 # look for a method of setting the effective uid
1012 seteuid=no;
1013 if test $seteuid = no; then
1014 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1015 AC_TRY_RUN([
1016 #define AUTOCONF_TEST 1
1017 #define USE_SETRESUID 1
1018 #include "confdefs.h"
1019 #include "${srcdir-.}/lib/util_sec.c"],
1020            samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1021 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1022     seteuid=yes;AC_DEFINE(USE_SETRESUID)
1027 if test $seteuid = no; then
1028 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1029 AC_TRY_RUN([
1030 #define AUTOCONF_TEST 1
1031 #define USE_SETREUID 1
1032 #include "confdefs.h"
1033 #include "${srcdir-.}/lib/util_sec.c"],
1034            samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1035 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1036     seteuid=yes;AC_DEFINE(USE_SETREUID)
1040 if test $seteuid = no; then
1041 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1042 AC_TRY_RUN([
1043 #define AUTOCONF_TEST 1
1044 #define USE_SETEUID 1
1045 #include "confdefs.h"
1046 #include "${srcdir-.}/lib/util_sec.c"],
1047            samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1048 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1049     seteuid=yes;AC_DEFINE(USE_SETEUID)
1053 if test $seteuid = no; then
1054 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1055 AC_TRY_RUN([
1056 #define AUTOCONF_TEST 1
1057 #define USE_SETUIDX 1
1058 #include "confdefs.h"
1059 #include "${srcdir-.}/lib/util_sec.c"],
1060            samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1061 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1062     seteuid=yes;AC_DEFINE(USE_SETUIDX)
1067 AC_CACHE_CHECK([for shared mmap],samba_cv_HAVE_SHARED_MMAP,[
1068 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1069            samba_cv_HAVE_SHARED_MMAP=yes,samba_cv_HAVE_SHARED_MMAP=no,samba_cv_HAVE_SHARED_MMAP=cross)])
1070 if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
1071     AC_DEFINE(HAVE_SHARED_MMAP)
1072     AC_DEFINE(HAVE_MMAP)
1075 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1076 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1077            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1078 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1079     AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1082 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1083 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1084            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1085 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1086     AC_DEFINE(HAVE_FCNTL_LOCK)
1089 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1090 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1091            samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1092 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1093     AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1095 else
1098 dnl Don't check for 64 bit fcntl locking if we know that the
1099 dnl glibc2.1 broken check has succeeded.
1100 dnl 
1102   AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1103   AC_TRY_RUN([
1104 #if defined(HAVE_UNISTD_H)
1105 #include <unistd.h>
1106 #endif
1107 #include <stdio.h>
1108 #include <stdlib.h>
1110 #ifdef HAVE_FCNTL_H
1111 #include <fcntl.h>
1112 #endif
1114 #ifdef HAVE_SYS_FCNTL_H
1115 #include <sys/fcntl.h>
1116 #endif
1117 main() { struct flock64 fl64;
1118 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1119 exit(0);
1120 #else
1121 exit(1);
1122 #endif
1124        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1126   if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1127       AC_DEFINE(HAVE_STRUCT_FLOCK64)
1128   fi
1131 AC_CACHE_CHECK([for sysv ipc],samba_cv_HAVE_SYSV_IPC,[
1132 AC_TRY_RUN([#include "${srcdir-.}/tests/sysv_ipc.c"],
1133            samba_cv_HAVE_SYSV_IPC=yes,samba_cv_HAVE_SYSV_IPC=no,samba_cv_HAVE_SYSV_IPC=cross)])
1134 if test x"$samba_cv_HAVE_SYSV_IPC" = x"yes"; then
1135     AC_DEFINE(HAVE_SYSV_IPC)
1138 AC_CACHE_CHECK([for IRIX sysv ipc semun problem using gcc],samba_cv_NEED_SGI_SEMUN_HACK,[
1139 AC_TRY_RUN([#include "${srcdir-.}/tests/sgi_sysv_hack.c"],
1140            samba_cv_NEED_SGI_SEMUN_HACK=yes,samba_cv_NEED_SGI_SEMUN_HACK=no,samba_cv_NEED_SGI_SEMUN_HACK=cross)])
1141 if test x"$samba_cv_NEED_SGI_SEMUN_HACK" = x"yes"; then
1142     AC_DEFINE(NEED_SGI_SEMUN_HACK)
1145 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1146 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1147            samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
1148 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1149     AC_DEFINE(HAVE_TRUNCATED_SALT)
1152 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1153 AC_TRY_COMPILE([#include <sys/acl.h>
1154 #if defined(HAVE_RPCSVC_NIS_H)
1155 #include <rpcsvc/nis.h>
1156 #endif],
1157 [return 0;],
1158 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1159 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1160     AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1164 #################################################
1165 # check for smbwrapper support
1166 AC_MSG_CHECKING(whether to use smbwrapper)
1167 AC_ARG_WITH(smbwrapper,
1168 [  --with-smbwrapper     Include SMB wrapper support
1169   --without-smbwrapper  Don't include SMB wrapper support (default)],
1170 [ case "$withval" in
1171   yes)
1172     AC_MSG_RESULT(yes)
1173     AC_DEFINE(WITH_SMBWRAPPER)
1174         WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1176         if test x$ATTEMPT_WRAP32_BUILD = x; then
1177                 WRAP32=""
1178         else
1179                         WRAP32=bin/smbwrapper.32.$SHLIBEXT
1180         fi
1182 # Conditions under which smbwrapper should not be built.
1184         if test x$PICFLAG = x; then
1185            echo No support for PIC code - disabling smbwrapper and smbsh
1186            WRAP=""
1187            WRAP32=""
1188         elif test x$ac_cv_func_syscall = xno; then
1189            AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1190            WRAP=""
1191            WRAP32=""
1192         fi
1193     ;;
1194   *)
1195     AC_MSG_RESULT(no)
1196     ;;
1197   esac ],
1198   AC_MSG_RESULT(no)
1201 #################################################
1202 # check for the AFS filesystem
1203 AC_MSG_CHECKING(whether to use AFS)
1204 AC_ARG_WITH(afs,
1205 [  --with-afs     Include AFS support
1206   --without-afs  Don't include AFS support (default)],
1207 [ case "$withval" in
1208   yes)
1209     AC_MSG_RESULT(yes)
1210     AC_DEFINE(WITH_AFS)
1211     ;;
1212   *)
1213     AC_MSG_RESULT(no)
1214     ;;
1215   esac ],
1216   AC_MSG_RESULT(no)
1220 #################################################
1221 # check for the DFS auth system
1222 AC_MSG_CHECKING(whether to use DFS auth)
1223 AC_ARG_WITH(dfs,
1224 [  --with-dfs     Include DFS support
1225   --without-dfs  Don't include DFS support (default)],
1226 [ case "$withval" in
1227   yes)
1228     AC_MSG_RESULT(yes)
1229     AC_DEFINE(WITH_DFS)
1230     ;;
1231   *)
1232     AC_MSG_RESULT(no)
1233     ;;
1234   esac ],
1235   AC_MSG_RESULT(no)
1238 #################################################
1239 # check for Kerberos IV auth system
1240 AC_MSG_CHECKING(whether to use Kerberos IV)
1241 AC_ARG_WITH(krb4,
1242 [  --with-krb4=base-dir     Include Kerberos IV support
1243   --without-krb4          Don't include Kerberos IV support (default)],
1244 [   AC_MSG_RESULT(yes)
1245     AC_DEFINE(KRB4_AUTH)
1246     AC_CHECK_LIB(resolv, dn_expand)
1247     LIBS="$LIBS -lkrb -ldes"
1248     CFLAGS="$CFLAGS -I$withval/include"
1249     LDFLAGS="$LDFLAGS -L$withval/lib"],
1250   AC_MSG_RESULT(no)
1253 #################################################
1254 # check for Kerberos 5 auth system
1255 AC_MSG_CHECKING(whether to use Kerberos 5)
1256 AC_ARG_WITH(krb5,
1257 [  --with-krb5=base-dir     Include Kerberos 5 support
1258   --without-krb5          Don't include Kerberos 5 support (default)],
1259 [   AC_MSG_RESULT(yes)
1260     AC_DEFINE(KRB5_AUTH)
1261     LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
1262     CFLAGS="$CFLAGS -I$withval/include"
1263     LDFLAGS="$LDFLAGS -L$withval/lib"],
1264   AC_MSG_RESULT(no)
1267 #################################################
1268 # check for automount support
1269 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1270 AC_ARG_WITH(automount,
1271 [  --with-automount     Include AUTOMOUNT support
1272   --without-automount  Don't include AUTOMOUNT support (default)],
1273 [ case "$withval" in
1274   yes)
1275     AC_MSG_RESULT(yes)
1276     AC_DEFINE(WITH_AUTOMOUNT)
1277     ;;
1278   *)
1279     AC_MSG_RESULT(no)
1280     ;;
1281   esac ],
1282   AC_MSG_RESULT(no)
1285 #################################################
1286 # check for smbmount support
1287 AC_MSG_CHECKING(whether to use SMBMOUNT)
1288 AC_ARG_WITH(smbmount,
1289 [  --with-smbmount     Include SMBMOUNT (Linux only) support
1290   --without-smbmount  Don't include SMBMOUNT support (default)],
1291 [ case "$withval" in
1292   yes)
1293     AC_MSG_RESULT(yes)
1294     AC_DEFINE(WITH_SMBMOUNT)
1295     MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1296     ;;
1297   *)
1298     AC_MSG_RESULT(no)
1299     MPROGS=
1300     ;;
1301   esac ],
1302   AC_MSG_RESULT(no)
1303   MPROGS=
1307 #################################################
1308 # check for a PAM password database
1309 AC_MSG_CHECKING(whether to use PAM password database)
1310 AC_ARG_WITH(pam,
1311 [  --with-pam     Include PAM password database support
1312   --without-pam  Don't include PAM password database support (default)],
1313 [ case "$withval" in
1314   yes)
1315     AC_MSG_RESULT(yes)
1316     AC_DEFINE(WITH_PAM)
1317     LIBS="$LIBS -lpam"
1318     ;;
1319   *)
1320     AC_MSG_RESULT(no)
1321     ;;
1322   esac ],
1323   AC_MSG_RESULT(no)
1327 #################################################
1328 # check for a LDAP password database
1329 AC_MSG_CHECKING(whether to use LDAP password database)
1330 AC_ARG_WITH(ldap,
1331 [  --with-ldap     Include LDAP support
1332   --without-ldap  Don't include LDAP support (default)],
1333 [ case "$withval" in
1334   yes)
1335     AC_MSG_RESULT(yes)
1336     AC_DEFINE(WITH_LDAP)
1337     AC_MSG_ERROR([LDAP password database not supported in this version.])
1338     ;;
1339   *)
1340     AC_MSG_RESULT(no)
1341     ;;
1342   esac ],
1343   AC_MSG_RESULT(no)
1346 #################################################
1347 # check for a NISPLUS password database
1348 AC_MSG_CHECKING(whether to use NISPLUS password database)
1349 AC_ARG_WITH(nisplus,
1350 [  --with-nisplus     Include NISPLUS password database support
1351   --without-nisplus  Don't include NISPLUS password database support (default)],
1352 [ case "$withval" in
1353   yes)
1354     AC_MSG_RESULT(yes)
1355     AC_DEFINE(WITH_NISPLUS)
1356     ;;
1357   *)
1358     AC_MSG_RESULT(no)
1359     ;;
1360   esac ],
1361   AC_MSG_RESULT(no)
1364 #################################################
1365 # check for a NISPLUS_HOME support 
1366 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
1367 AC_ARG_WITH(nisplus-home,
1368 [  --with-nisplus-home     Include NISPLUS_HOME support
1369   --without-nisplus-home  Don't include NISPLUS_HOME support (default)],
1370 [ case "$withval" in
1371   yes)
1372     AC_MSG_RESULT(yes)
1373     AC_DEFINE(WITH_NISPLUS_HOME)
1374     ;;
1375   *)
1376     AC_MSG_RESULT(no)
1377     ;;
1378   esac ],
1379   AC_MSG_RESULT(no)
1382 #################################################
1383 # check for the secure socket layer
1384 AC_MSG_CHECKING(whether to use SSL)
1385 AC_ARG_WITH(ssl,
1386 [  --with-ssl     Include SSL support
1387   --without-ssl  Don't include SSL support (default)
1388   --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl)],
1389 [ case "$withval" in
1390   yes)
1391     AC_MSG_RESULT(yes)
1392     AC_DEFINE(WITH_SSL)
1393     withval="/usr/local/ssl"     # default
1395     if test "${with_sslinc+set}" = set; then
1397         withval="$with_sslinc"
1398         case "$withval" in
1399         yes|no)
1400           echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
1401           CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1402           LIBS="-lssl -lcrypto $LIBS"
1403           LDFLAGS="=L/usr/local/ssl/lib $LDFLAGS"
1404         ;;
1405         * )
1406           CFLAGS="-I${withval}/include $CFLAGS"
1407           LIBS="-lssl -lcrypto $LIBS"
1408           LDFLAGS="-L${withval}/lib $LDFLAGS"
1409         ;;
1410         esac
1412     else
1414         CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
1415         LIBS="-lssl -lcrypto $LIBS"
1416         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1418     fi
1420     if test ! -d ${withval}; then
1421       echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
1422       exit 1
1423     fi 
1425     CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
1427     ;;
1428   *)
1429     AC_MSG_RESULT(no)
1430     ;;
1431   esac ],
1432   AC_MSG_RESULT(no)
1435 #################################################
1436 # check for syslog logging
1437 AC_MSG_CHECKING(whether to use syslog logging)
1438 AC_ARG_WITH(syslog,
1439 [  --with-syslog     Include experimental SYSLOG support
1440   --without-syslog  Don't include SYSLOG support (default)],
1441 [ case "$withval" in
1442   yes)
1443     AC_MSG_RESULT(yes)
1444     AC_DEFINE(WITH_SYSLOG)
1445     ;;
1446   *)
1447     AC_MSG_RESULT(no)
1448     ;;
1449   esac ],
1450   AC_MSG_RESULT(no)
1453 #################################################
1454 # check for a shared memory profiling support
1455 AC_MSG_CHECKING(whether to use profiling)
1456 AC_ARG_WITH(profile,
1457 [  --with-profile     Include profile support
1458   --without-profile  Don't include profile support (default)],
1459 [ case "$withval" in
1460   yes)
1461     AC_MSG_RESULT(yes)
1462     AC_DEFINE(WITH_PROFILE)
1463     ;;
1464   *)
1465     AC_MSG_RESULT(no)
1466     ;;
1467   esac ],
1468   AC_MSG_RESULT(no)
1472 #################################################
1473 # check for experimental netatalk resource fork support
1474 AC_MSG_CHECKING(whether to support netatalk)
1475 AC_ARG_WITH(netatalk,
1476 [  --with-netatalk     Include experimental Netatalk support
1477   --without-netatalk  Don't include experimental Netatalk support (default)],
1478 [ case "$withval" in
1479   yes)
1480     AC_MSG_RESULT(yes)
1481     AC_DEFINE(WITH_NETATALK)
1482     ;;
1483   *)
1484     AC_MSG_RESULT(no)
1485     ;;
1486   esac ],
1487   AC_MSG_RESULT(no)
1490 #################################################
1491 # check for experimental disk-quotas support
1492 QUOTAOBJS=noquotas.o
1494 AC_MSG_CHECKING(whether to support disk-quotas)
1495 AC_ARG_WITH(quotas,
1496 [  --with-quotas     Include experimental disk-quota support
1497   --without-quotas  Don't include experimental disk-quota support (default)],
1498 [ case "$withval" in
1499   yes)
1500     AC_MSG_RESULT(yes)
1501     QUOTAOBJS=quotas.o
1502     ;;
1503   *)
1504     AC_MSG_RESULT(no)
1505     ;;
1506   esac ],
1507   AC_MSG_RESULT(no)
1509 AC_SUBST(QUOTAOBJS)
1511 #################################################
1512 # check for experimental utmp accounting
1514 AC_MSG_CHECKING(whether to support utmp accounting)
1515 AC_ARG_WITH(utmp,
1516 [  --with-utmp     Include experimental utmp accounting
1517   --without-utmp  Don't include experimental utmp accounting (default)],
1518 [ case "$withval" in
1519   yes)
1520     AC_MSG_RESULT(yes)
1521     AC_DEFINE(WITH_UTMP)
1522     ;;
1523   *)
1524     AC_MSG_RESULT(no)
1525     ;;
1526   esac ],
1527   AC_MSG_RESULT(no)
1530 #################################################
1531 # set private directory location
1532 AC_ARG_WITH(privatedir,
1533 [  --with-privatedir=DIR     Where to put smbpasswd ($ac_default_prefix/private)],
1534 [ case "$withval" in
1535   yes|no)
1536   #
1537   # Just in case anybody calls it without argument
1538   #
1539     AC_MSG_WARN([--with-privatedir called without argument - will use default])
1540     privatedir='${prefix}/private'
1541   ;;
1542   * )
1543     privatedir="$withval"
1544     ;;
1545   esac
1546   AC_SUBST(privatedir)],
1547   [privatedir='${prefix}/private'
1548    AC_SUBST(privatedir)]
1551 #################################################
1552 # set lock directory location
1553 AC_ARG_WITH(lockdir,
1554 [  --with-lockdir=DIR     Where to put lock files ($ac_default_prefix/var/locks)],
1555 [ case "$withval" in
1556   yes|no)
1557   #
1558   # Just in case anybody calls it without argument
1559   #
1560     AC_MSG_WARN([--with-lockdir called without argument - will use default])
1561     lockdir='$(VARDIR)/locks'
1562   ;;
1563   * )
1564     lockdir="$withval"
1565     ;;
1566   esac
1567   AC_SUBST(lockdir)],
1568   [lockdir='$(VARDIR)/locks'
1569    AC_SUBST(lockdir)]
1572 #################################################
1573 # set SWAT directory location
1574 AC_ARG_WITH(swatdir,
1575 [  --with-swatdir=DIR     Where to put SWAT files ($ac_default_prefix/swat)],
1576 [ case "$withval" in
1577   yes|no)
1578   #
1579   # Just in case anybody does it
1580   #
1581     AC_MSG_WARN([--with-swatdir called without argument - will use default])
1582     swatdir='${prefix}/swat'
1583   ;;
1584   * )
1585     swatdir="$withval"
1586     ;;
1587   esac
1588   AC_SUBST(swatdir)],
1589   [swatdir='${prefix}/swat'
1590    AC_SUBST(swatdir)]
1593 ################################################
1594 # include Using Samba O'Reilly book
1595 AC_MSG_CHECKING(whether to install Using Samba book)
1596 AC_ARG_WITH(sambabook,
1597 [  --with-sambabook=DIR  Where to put Using Samba book ($ac_default_prefix/swat/using_samba) (default)
1598   --without-sambabook   Don't install Using Samba book],
1599 [ case "$withval" in
1600   yes)
1601     AC_MSG_WARN([--with-sambabook called without argument - will use default])
1602     sambabook="${prefix}/swat/using_samba"
1603     AC_MSG_RESULT(install in $sambabook)
1604   ;;
1605   no)
1606     AC_MSG_RESULT(no)
1607   ;;
1608   *)
1609     AC_MSG_RESULT(install in $withval)
1610     sambabook="$withval"
1611     ;;
1612   esac
1613   AC_SUBST(sambabook)],
1614   [sambabook='${prefix}/swat/using_samba'
1615    AC_SUBST(sambabook)
1616    AC_MSG_RESULT($sambabook)]
1619 #################################################
1620 # these tests are taken from the GNU fileutils package
1621 AC_CHECKING(how to get filesystem space usage)
1622 space=no
1624 # Test for statvfs64.
1625 if test $space = no; then
1626   # SVR4
1627   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
1628   [AC_TRY_RUN([
1629 #if defined(HAVE_UNISTD_H)
1630 #include <unistd.h>
1631 #endif
1632 #include <sys/types.h>
1633 #include <sys/statvfs.h>
1634   main ()
1635   {
1636     struct statvfs64 fsd;
1637     exit (statvfs64 (".", &fsd));
1638   }],
1639   fu_cv_sys_stat_statvfs64=yes,
1640   fu_cv_sys_stat_statvfs64=no,
1641   fu_cv_sys_stat_statvfs64=cross)])
1642   if test $fu_cv_sys_stat_statvfs64 = yes; then
1643     space=yes
1644     AC_DEFINE(STAT_STATVFS64)
1645   fi
1648 # Perform only the link test since it seems there are no variants of the
1649 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
1650 # because that got a false positive on SCO OSR5.  Adding the declaration
1651 # of a `struct statvfs' causes this test to fail (as it should) on such
1652 # systems.  That system is reported to work fine with STAT_STATFS4 which
1653 # is what it gets when this test fails.
1654 if test $space = no; then
1655   # SVR4
1656   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
1657                  [AC_TRY_LINK([#include <sys/types.h>
1658 #include <sys/statvfs.h>],
1659                               [struct statvfs fsd; statvfs (0, &fsd);],
1660                               fu_cv_sys_stat_statvfs=yes,
1661                               fu_cv_sys_stat_statvfs=no)])
1662   if test $fu_cv_sys_stat_statvfs = yes; then
1663     space=yes
1664     AC_DEFINE(STAT_STATVFS)
1665   fi
1668 if test $space = no; then
1669   # DEC Alpha running OSF/1
1670   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
1671   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
1672   [AC_TRY_RUN([
1673 #include <sys/param.h>
1674 #include <sys/types.h>
1675 #include <sys/mount.h>
1676   main ()
1677   {
1678     struct statfs fsd;
1679     fsd.f_fsize = 0;
1680     exit (statfs (".", &fsd, sizeof (struct statfs)));
1681   }],
1682   fu_cv_sys_stat_statfs3_osf1=yes,
1683   fu_cv_sys_stat_statfs3_osf1=no,
1684   fu_cv_sys_stat_statfs3_osf1=no)])
1685   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
1686   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
1687     space=yes
1688     AC_DEFINE(STAT_STATFS3_OSF1)
1689   fi
1692 if test $space = no; then
1693 # AIX
1694   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
1695 member (AIX, 4.3BSD)])
1696   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
1697   [AC_TRY_RUN([
1698 #ifdef HAVE_SYS_PARAM_H
1699 #include <sys/param.h>
1700 #endif
1701 #ifdef HAVE_SYS_MOUNT_H
1702 #include <sys/mount.h>
1703 #endif
1704 #ifdef HAVE_SYS_VFS_H
1705 #include <sys/vfs.h>
1706 #endif
1707   main ()
1708   {
1709   struct statfs fsd;
1710   fsd.f_bsize = 0;
1711   exit (statfs (".", &fsd));
1712   }],
1713   fu_cv_sys_stat_statfs2_bsize=yes,
1714   fu_cv_sys_stat_statfs2_bsize=no,
1715   fu_cv_sys_stat_statfs2_bsize=no)])
1716   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
1717   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
1718     space=yes
1719     AC_DEFINE(STAT_STATFS2_BSIZE)
1720   fi
1723 if test $space = no; then
1724 # SVR3
1725   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
1726   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
1727   [AC_TRY_RUN([#include <sys/types.h>
1728 #include <sys/statfs.h>
1729   main ()
1730   {
1731   struct statfs fsd;
1732   exit (statfs (".", &fsd, sizeof fsd, 0));
1733   }],
1734     fu_cv_sys_stat_statfs4=yes,
1735     fu_cv_sys_stat_statfs4=no,
1736     fu_cv_sys_stat_statfs4=no)])
1737   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
1738   if test $fu_cv_sys_stat_statfs4 = yes; then
1739     space=yes
1740     AC_DEFINE(STAT_STATFS4)
1741   fi
1744 if test $space = no; then
1745 # 4.4BSD and NetBSD
1746   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
1747 member (4.4BSD and NetBSD)])
1748   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
1749   [AC_TRY_RUN([#include <sys/types.h>
1750 #ifdef HAVE_SYS_PARAM_H
1751 #include <sys/param.h>
1752 #endif
1753 #ifdef HAVE_SYS_MOUNT_H
1754 #include <sys/mount.h>
1755 #endif
1756   main ()
1757   {
1758   struct statfs fsd;
1759   fsd.f_fsize = 0;
1760   exit (statfs (".", &fsd));
1761   }],
1762   fu_cv_sys_stat_statfs2_fsize=yes,
1763   fu_cv_sys_stat_statfs2_fsize=no,
1764   fu_cv_sys_stat_statfs2_fsize=no)])
1765   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
1766   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
1767     space=yes
1768     AC_DEFINE(STAT_STATFS2_FSIZE)
1769   fi
1772 if test $space = no; then
1773   # Ultrix
1774   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1775   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1776   [AC_TRY_RUN([#include <sys/types.h>
1777 #ifdef HAVE_SYS_PARAM_H
1778 #include <sys/param.h>
1779 #endif
1780 #ifdef HAVE_SYS_MOUNT_H
1781 #include <sys/mount.h>
1782 #endif
1783 #ifdef HAVE_SYS_FS_TYPES_H
1784 #include <sys/fs_types.h>
1785 #endif
1786   main ()
1787   {
1788   struct fs_data fsd;
1789   /* Ultrix's statfs returns 1 for success,
1790      0 for not mounted, -1 for failure.  */
1791   exit (statfs (".", &fsd) != 1);
1792   }],
1793   fu_cv_sys_stat_fs_data=yes,
1794   fu_cv_sys_stat_fs_data=no,
1795   fu_cv_sys_stat_fs_data=no)])
1796   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1797   if test $fu_cv_sys_stat_fs_data = yes; then
1798     space=yes
1799     AC_DEFINE(STAT_STATFS2_FS_DATA)
1800   fi
1804 # As a gating factor for large file support, in order to
1805 # use <4GB files we must have the following minimal support
1806 # available.
1807 # long long, and a 64 bit off_t or off64_t.
1808 # If we don't have all of these then disable large
1809 # file support.
1811 echo "checking if large file support can be enabled"
1812 AC_TRY_COMPILE([
1813 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
1814 #include <sys/types.h>
1815 #else
1816 __COMPILE_ERROR_
1817 #endif
1819 [int i],
1820 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
1821 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
1822     echo "yes"
1823     AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
1824 else
1825     echo "no"
1828 echo "checking configure summary"
1829 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
1830            echo "configure OK";,
1831            AC_MSG_ERROR([summary failure. Aborting config]),:)
1833 builddir=`pwd`
1834 AC_SUBST(builddir)
1836 AC_OUTPUT(include/stamp-h Makefile)