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