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