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