This commit was manufactured by cvs2svn to create tag
[Samba.git] / source / configure.in
blobc6c02ca391ea395b7b7d423b931628bf857b6ae3
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_CPP
24 AC_PROG_INSTALL
25 AC_PROG_AWK
27 dnl Choose what kind of library to build by default
28 dnl AC_DISABLE_SHARED
29 AC_DISABLE_STATIC
31 AC_LIBTOOL_DLOPEN
32 AC_PROG_LIBTOOL
33 AC_SUBST(LIBTOOL_DEPS)
35 dnl Check if C compiler understands -c and -o at the same time
36 AC_PROG_CC_C_O
37 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
38       BROKEN_CC=
39 else
40       BROKEN_CC=#
42 AC_SUBST(BROKEN_CC)
44 dnl Check if the C compiler understands volatile (it should, being ANSI).
45 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
46     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
47         samba_cv_volatile=yes,samba_cv_volatile=no)])
48 if test x"$samba_cv_volatile" = x"yes"; then
49    AC_DEFINE(HAVE_VOLATILE)
54 AC_CANONICAL_SYSTEM
56 dnl Add #include for broken IRIX header files
57   case "$host_os" in
58         *irix*) AC_ADD_INCLUDE(<standards.h>)
59         ;;
60 esac
62 AC_VALIDATE_CACHE_SYSTEM_TYPE
63 SAMBA_MAINTAINER_MODE
66 # Config CPPFLAG settings for strange OS's that must be set
67 # before other tests.
69 case "$host_os" in
70 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
71     *hpux*)
72       AC_PROG_CC_FLAG(Ae)
73       if test $ac_cv_prog_cc_Ae = yes; then
74         CPPFLAGS="$CPPFLAGS -Ae"
75       fi
77 # Defines needed for HPUX support.
78 # HPUX has bigcrypt but (sometimes?) doesn't use it for
79 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
81       case `uname -r` in
82                         *9*|*10*)
83                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE"
84                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
85                                 ;;
86                         *11*)
87                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE"
88                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
89                                 ;;
90       esac
91       ;;
93 # AIX4.x doesn't even admit to having large
94 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
96     *aix4*)
97           AC_MSG_RESULT([enabling large file support])
98       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
99       ;;    
101 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
102 # to the existance of large files..
103 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
104 # recommendations on large file support, however it makes the
105 # compile work using gcc 2.7 and 2.8, whereas using the Sun
106 # recommendation makes the compile fail on gcc2.7. JRA.
108         *solaris*)
109                 case `uname -r` in
110                         5.6*|5.7*)
111                         AC_MSG_RESULT([enabling large file support])
112                         if test "$ac_cv_prog_gcc" = yes; then
113                                 ${CC-cc} -v >conftest.c 2>&1
114                                 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
115                                 rm -fr conftest.c
116                                 case "$ac_cv_gcc_compiler_version_number" in
117                                         *"gcc version 2.6"*|*"gcc version 2.7"*)
118                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
119                                                 ;;
120                                         *)
121                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
122                                                 ;;
123                                 esac
124                         else
125                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
126                         fi
127                         ;;
128                 esac
129                 ;;
131 # Tests needed for SINIX large file support.
133     *sysv4*)
134       if test $host = mips-sni-sysv4 ; then
135         AC_MSG_CHECKING([for LFS support])
136         old_CPPFLAGS="$CPPFLAGS"
137         CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
138         AC_TRY_RUN([
139 #include <unistd.h>
140 main () {
141 #if _LFS64_LARGEFILE == 1
142 exit(0);
143 #else
144 exit(1);
145 #endif
146 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
147         CPPFLAGS="$old_CPPFLAGS"
148         if test x$SINIX_LFS_SUPPORT = xyes ; then
149           CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
150           CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
151           LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
152           LIBS="`getconf LFS64_LIBS` $LIBS"
153         fi
154       AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
155       fi
156     ;;
159 # Tests needed for glibc 2.1 large file support.
161         *linux*)
162                 AC_MSG_RESULT([disabling large file support for glibc2.1 on Linux])     
163                 ;;
164     *hurd*)
165         AC_MSG_CHECKING([for LFS support])
166         old_CPPFLAGS="$CPPFLAGS"
167         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
168         AC_TRY_RUN([
169 #include <unistd.h>
170 main () {
171 #if _LFS64_LARGEFILE == 1
172 exit(0);
173 #else
174 exit(1);
175 #endif
176 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
177         CPPFLAGS="$old_CPPFLAGS"
178         if test x$GLIBC_LFS_SUPPORT = xyes ; then
179           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
180         fi
181       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
182     ;;
184 esac
186 AC_INLINE
187 AC_HEADER_STDC
188 AC_HEADER_DIRENT
189 AC_HEADER_TIME
190 AC_HEADER_SYS_WAIT
191 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
192 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
193 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
194 AC_CHECK_HEADERS(sys/param.h ctype.h sys/un.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
195 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h string.h strings.h stdlib.h sys/socket.h)
196 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
197 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
198 AC_CHECK_HEADERS(getopt.h)
200 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
201 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
203 case "$host_os" in
204     *hpux*)
205                 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
206                         ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
207                 if test x"$ac_cv_header_shadow_h" = x"yes"; then
208                    AC_DEFINE(HAVE_SHADOW_H)
209                 fi
210         ;;
211 esac
212 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
213 AC_CHECK_HEADERS(sys/security.h security/pam_appl.h)
214 AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
215 AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
216 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
218 # For experimental utmp support
219 AC_CHECK_HEADERS(utmp.h utmpx.h)
221 AC_CHECK_SIZEOF(int,cross)
222 AC_CHECK_SIZEOF(long,cross)
223 AC_CHECK_SIZEOF(short,cross)
225 AC_C_CONST
226 AC_C_INLINE
227 AC_C_BIGENDIAN
228 AC_C_CHAR_UNSIGNED
230 AC_TYPE_SIGNAL
231 AC_TYPE_UID_T
232 AC_TYPE_MODE_T
233 AC_TYPE_OFF_T
234 AC_TYPE_SIZE_T
235 AC_TYPE_PID_T
236 AC_STRUCT_ST_RDEV
237 AC_DIRENT_D_OFF
238 AC_CHECK_TYPE(ino_t,unsigned)
239 AC_CHECK_TYPE(loff_t,off_t)
240 AC_CHECK_TYPE(offset_t,loff_t)
241 AC_CHECK_TYPE(ssize_t, int)
242 AC_CHECK_TYPE(wchar_t, unsigned short)
244 # we need libcups for CUPS support...
245 AC_CHECK_LIB(cups,httpConnect)
247 # we need libdl for PAM and the new VFS code
248 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
249         AC_DEFINE(HAVE_LIBDL)])
251 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
252     AC_TRY_COMPILE([
253 #include <sys/types.h>
254 #if STDC_HEADERS
255 #include <stdlib.h>
256 #include <stddef.h>
257 #endif
258 #include <signal.h>],[sig_atomic_t i = 0],
259         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
260 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
261    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
264 AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
265     AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
266         samba_cv_errno=yes,samba_cv_have_errno=no)])
267 if test x"$samba_cv_errno" = x"yes"; then
268    AC_DEFINE(HAVE_ERRNO_DECL)
271 # stupid glibc has the functions but no declaration. grrrr.
272 AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
273     AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresuid],
274         samba_cv_have_setresuid_decl=yes,samba_cv_have_setresuid_decl=no)])
275 if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
276     AC_DEFINE(HAVE_SETRESUID_DECL)
279 # stupid glibc has the functions but no declaration. grrrr.
280 AC_CACHE_CHECK([for setresgid declaration],samba_cv_have_setresgid_decl,[
281     AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresgid],
282         samba_cv_have_setresgid_decl=yes,samba_cv_have_setresgid_decl=no)])
283 if test x"$samba_cv_have_setresgid_decl" = x"yes"; then
284     AC_DEFINE(HAVE_SETRESGID_DECL)
287 # and glibc has setresuid under linux but the function does
288 # nothing until kernel 2.1.44! very dumb.
289 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
290     AC_TRY_RUN([#include <errno.h>
291 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
292         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
293 if test x"$samba_cv_have_setresuid" = x"yes"; then
294     AC_DEFINE(HAVE_SETRESUID)
297 # Do the same check for setresguid...
299 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
300     AC_TRY_RUN([#include <unistd.h>
301 #include <errno.h>
302 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
303         samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
304 if test x"$samba_cv_have_setresgid" = x"yes"; then
305     AC_DEFINE(HAVE_SETRESGID)
308 AC_FUNC_MEMCMP
310 ###############################################
311 # test for where we get crypt() from
312 AC_CHECK_FUNCS(crypt)
313 if test x"$ac_cv_func_crypt" = x"no"; then
314     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
315         AC_DEFINE(HAVE_CRYPT)])
319 ###############################################
320 # test for where we get readline() from
321 if test "$ac_cv_header_readline_h" = "yes" ||
322    test "$ac_cv_header_readline_readline_h" = "yes"; then
323   AC_CHECK_LIB(readline,readline)
326 AC_CACHE_CHECK([for readline],samba_cv_HAVE_READLINE,[
327 AC_TRY_RUN([#include "${srcdir-.}/tests/readline.c"],
328            samba_cv_HAVE_READLINE=yes,samba_cv_HAVE_READLINE=no,samba_cv_HAVE_READLINE=cross)])
329 if test x"$samba_cv_HAVE_READLINE" = x"yes"; then
330     AC_DEFINE(HAVE_READLINE)
334 # The following test taken from the cvs sources
335 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
336 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
337 # libsocket.so which has a bad implementation of gethostbyname (it
338 # only looks in /etc/hosts), so we only look for -lsocket if we need
339 # it.
340 AC_CHECK_FUNCS(connect)
341 if test x"$ac_cv_func_connect" = x"no"; then
342     case "$LIBS" in
343     *-lnsl*) ;;
344     *) AC_CHECK_LIB(nsl_s, printf) ;;
345     esac
346     case "$LIBS" in
347     *-lnsl*) ;;
348     *) AC_CHECK_LIB(nsl, printf) ;;
349     esac
350     case "$LIBS" in
351     *-lsocket*) ;;
352     *) AC_CHECK_LIB(socket, connect) ;;
353     esac
354     case "$LIBS" in
355     *-linet*) ;;
356     *) AC_CHECK_LIB(inet, connect) ;;
357     esac
358     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
359     dnl has been cached.
360     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
361        test x"$ac_cv_lib_inet_connect" = x"yes"; then
362         # ac_cv_func_connect=yes
363         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
364         AC_DEFINE(HAVE_CONNECT)
365     fi
368 # Check if we have execl, if not we need to compile smbrun.
369 AC_CHECK_FUNCS(execl)
370 if test x"$ac_cv_func_execl" = x"no"; then
371     RUNPROG="bin/smbrun"
372 else
373     RUNPROG=""
376 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod chroot)
377 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
378 AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob strpbrk pipe crypt16 getauthuid)
379 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
380 AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf)
381 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
382 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
383 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid yp_get_default_domain getpwanam)
384 AC_CHECK_FUNCS(srandom random srand rand setenv usleep mmap64 strcasecmp fcvt fcvtl)
386 # syscall() is needed for smbwrapper.
387 AC_CHECK_FUNCS(syscall)
389 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
390 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
391 AC_CHECK_FUNCS(__getcwd _getcwd)
392 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
393 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
394 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
395 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
396 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
397 AC_CHECK_FUNCS(_write __write _fork __fork)
398 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
399 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
400 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
401 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
402 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
405 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
408 if test x$ac_cv_func_stat64 = xno ; then
409   AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
410   AC_TRY_LINK([
411 #if defined(HAVE_UNISTD_H)
412 #include <unistd.h>
413 #endif
414 #include <sys/stat.h>
415 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
416   AC_MSG_RESULT([$ac_cv_func_stat64])
417   if test x$ac_cv_func_stat64 = xyes ; then
418     AC_DEFINE(HAVE_STAT64)
419   fi
422 if test x$ac_cv_func_lstat64 = xno ; then
423   AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
424   AC_TRY_LINK([
425 #if defined(HAVE_UNISTD_H)
426 #include <unistd.h>
427 #endif
428 #include <sys/stat.h>
429 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
430   AC_MSG_RESULT([$ac_cv_func_lstat64])
431   if test x$ac_cv_func_lstat64 = xyes ; then
432     AC_DEFINE(HAVE_LSTAT64)
433   fi
436 if test x$ac_cv_func_fstat64 = xno ; then
437   AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
438   AC_TRY_LINK([
439 #if defined(HAVE_UNISTD_H)
440 #include <unistd.h>
441 #endif
442 #include <sys/stat.h>
443 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
444   AC_MSG_RESULT([$ac_cv_func_fstat64])
445   if test x$ac_cv_func_fstat64 = xyes ; then
446     AC_DEFINE(HAVE_FSTAT64)
447   fi
451 # If no strcasecmp, check for it in some known places
452 # It is in -lresolv on ReliantUNIX and UnixWare
453 #   -lresolve *must* follow -lnsl for name resolution to work properly
456 if test x$ac_cv_func_strcasecmp = xno ; then
457         AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
458                 AC_DEFINE(HAVE_STRCASECMP))
462 # Check for the functions putprpwnam, set_auth_parameters,
463 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
464 # Needed for OSF1 and HPUX.
467 AC_LIBTESTFUNC(security, putprpwnam)
468 AC_LIBTESTFUNC(sec, putprpwnam)
470 AC_LIBTESTFUNC(security, set_auth_parameters)
471 AC_LIBTESTFUNC(sec, set_auth_parameters)
473 # UnixWare 7.x has its getspnam in -lgen
474 AC_LIBTESTFUNC(gen, getspnam)
476 AC_LIBTESTFUNC(security, getspnam)
477 AC_LIBTESTFUNC(sec, getspnam)
479 AC_LIBTESTFUNC(security, bigcrypt)
480 AC_LIBTESTFUNC(sec, bigcrypt)
482 AC_LIBTESTFUNC(security, getprpwnam)
483 AC_LIBTESTFUNC(sec, getprpwnam)
485 # this bit needs to be modified for each OS that is suported by
486 # smbwrapper. You need to specify how to created a shared library and
487 # how to compile C code to produce PIC object files
489 # these are the defaults, good for lots of systems
490 HOST_OS="$host_os"
491 LDSHFLAGS="-shared"
492 PICFLAG=""
493 SHLIBEXT="so"
495 # and these are for particular systems
496 case "$host_os" in
497                 *linux*)   AC_DEFINE(LINUX);;
498                 *solaris*) AC_DEFINE(SUNOS5)
499                                         LDSHFLAGS="-G"
500                 ;;
501                 *sunos*) AC_DEFINE(SUNOS4)
502                                         LDSHFLAGS=""
503                 ;;
504                 *bsd*) LDSHFLAGS="-shared -Bshareable"
505                 ;;
506                 *irix*) AC_DEFINE(IRIX)
507                         case "$host_os" in
508                         *irix6*) AC_DEFINE(IRIX6)
509                         ;;
510                         esac
511                         ATTEMPT_WRAP32_BUILD=yes
512                 ;;
513                 *aix*) AC_DEFINE(AIX);;
514                 *hpux*) AC_DEFINE(HPUX)
515                         SHLIBEXT="sl"
516                         # Use special PIC flags for the native HP-UX compiler.
517                         if test $ac_cv_prog_cc_Ae = yes; then
518                                 LDSHFLAGS="-b"
519                                 PICFLAG="+z"
520                         fi
521                 ;;
522                 *qnx*) AC_DEFINE(QNX);;
523                 *osf*) AC_DEFINE(OSF1);;
524                 *sco*) AC_DEFINE(SCO);;
525                 *next2*) AC_DEFINE(NEXT2);;
526                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
527                 *sysv4*)
528                         case "$host" in
529                                 *-univel-*)     if [ test "$GCC" != yes ]; then
530                                                                         AC_DEFINE(HAVE_MEMSET)
531                                                                 fi
532                                                                 LDSHFLAGS="-G"
533                                 ;;
534                                 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
535                         esac
536                         ;;
537                 *sysv5*)
538                         if [ test "$GCC" != yes ]; then
539                                 AC_DEFINE(HAVE_MEMSET)
540                         fi
541                         LDSHFLAGS="-G"
542                         ;;
543 esac
545 # try to work out how to produce pic code with this compiler
546 AC_PROG_CC_FLAG(fpic)
547 if test $ac_cv_prog_cc_fpic = yes; then
548     PICFLAG="-fpic";
550 if test x$PICFLAG = x; then
551   AC_PROG_CC_FLAG(Kpic)
552   if test $ac_cv_prog_cc_Kpic = yes; then
553     PICFLAG="-Kpic";
554   fi
556 if test x$PICFLAG = x; then
557   AC_PROG_CC_FLAG(KPIC)
558   if test $ac_cv_prog_cc_KPIC = yes; then
559     PICFLAG="-KPIC";
560   fi
563 ################
565 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
566 AC_TRY_RUN([#include <stdio.h>
567 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
568 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
569 if test x"$samba_cv_have_longlong" = x"yes"; then
570     AC_DEFINE(HAVE_LONGLONG)
574 # Check if the compiler supports the LL prefix on long long integers.
575 # AIX needs this.
577 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
578     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
579         samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
580 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
581    AC_DEFINE(COMPILER_SUPPORTS_LL)
584   
585 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
586 AC_TRY_RUN([#include <stdio.h>
587 #include <sys/stat.h>
588 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
589 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
590 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
591     AC_DEFINE(SIZEOF_OFF_T,8)
594 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
595 AC_TRY_RUN([
596 #if defined(HAVE_UNISTD_H)
597 #include <unistd.h>
598 #endif
599 #include <stdio.h>
600 #include <sys/stat.h>
601 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
602 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
603 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
604     AC_DEFINE(HAVE_OFF64_T)
607 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
608 AC_TRY_RUN([#include <stdio.h>
609 #include <sys/stat.h>
610 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
611 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
612 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
613     AC_DEFINE(SIZEOF_INO_T,8)
616 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
617 AC_TRY_RUN([
618 #if defined(HAVE_UNISTD_H)
619 #include <unistd.h>
620 #endif
621 #include <stdio.h>
622 #include <sys/stat.h>
623 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
624 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
625 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
626     AC_DEFINE(HAVE_INO64_T)
629 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
630 AC_TRY_COMPILE([
631 #if defined(HAVE_UNISTD_H)
632 #include <unistd.h>
633 #endif
634 #include <sys/types.h>
635 #include <dirent.h>],
636 [struct dirent64 de;],
637 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
638 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
639     AC_DEFINE(HAVE_STRUCT_DIRENT64)
642 AC_CACHE_CHECK([for union semun],samba_cv_HAVE_UNION_SEMUN,[
643 AC_TRY_RUN([
644 #include <sys/types.h>
645 #include <sys/ipc.h>
646 #include <sys/sem.h>
647 main() { union semun ss; exit(0); }],
648 samba_cv_HAVE_UNION_SEMUN=yes,samba_cv_HAVE_UNION_SEMUN=no,samba_cv_HAVE_UNION_SEMUN=cross)])
649 if test x"$samba_cv_HAVE_UNION_SEMUN" = x"yes"; then
650     AC_DEFINE(HAVE_UNION_SEMUN)
653 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
654 AC_TRY_RUN([#include <stdio.h>
655 main() { char c; c=250; exit((c > 0)?0:1); }],
656 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
657 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
658     AC_DEFINE(HAVE_UNSIGNED_CHAR)
661 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
662 AC_TRY_COMPILE([#include <sys/types.h>
663 #include <sys/socket.h>
664 #include <netinet/in.h>],
665 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
666 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
667 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
668     AC_DEFINE(HAVE_SOCK_SIN_LEN)
671 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
672 AC_TRY_COMPILE([#include <sys/types.h>
673 #include <dirent.h>
674 void seekdir(DIR *d, long loc) { return; }],[return 0;],
675 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
676 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
677     AC_DEFINE(SEEKDIR_RETURNS_VOID)
680 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
681 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
682 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
683 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
684     AC_DEFINE(HAVE_FILE_MACRO)
687 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
688 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
689 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
690 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
691     AC_DEFINE(HAVE_FUNCTION_MACRO)
694 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
695 AC_TRY_RUN([
696 #include <sys/time.h>
697 #include <unistd.h>
698 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
699            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
700 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
701     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
705 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
706 AC_TRY_RUN([#include <sys/types.h>
707 #include <dirent.h>
708 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
709 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
710 di->d_name[0] == 0) exit(0); exit(1);} ],
711 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
712 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
713     AC_DEFINE(HAVE_BROKEN_READDIR)
716 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
717 AC_TRY_COMPILE([#include <sys/types.h>
718 #include <utime.h>],
719 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
720 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
721 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
722     AC_DEFINE(HAVE_UTIMBUF)
725 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
726 AC_TRY_COMPILE([#include <utmpx.h>],
727 [struct utmpx ux;  ux.ut_syslen = 0;],
728 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
729 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
730     AC_DEFINE(HAVE_UX_UT_SYSLEN)
731 fi 
733 AC_CACHE_CHECK([for kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS,[
734 AC_TRY_COMPILE([#include <sys/types.h>
735 #include <fcntl.h>],
736 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
737 samba_cv_HAVE_KERNEL_OPLOCKS=yes,samba_cv_HAVE_KERNEL_OPLOCKS=no)])
738 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
739     AC_DEFINE(HAVE_KERNEL_OPLOCKS)
742 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
743 AC_TRY_RUN([#include <sys/types.h>
744 #include <sys/capability.h>
745 main() {
746  cap_t cap;
747  if ((cap = cap_get_proc()) == NULL)
748    exit(1);
749  cap->cap_effective |= CAP_NETWORK_MGT;
750  cap->cap_inheritable |= CAP_NETWORK_MGT;
751  cap_set_proc(cap);
752  exit(0);
755 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
756 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
757     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
761 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
762 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
765 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
766 AC_TRY_COMPILE([#include <sys/types.h>
767 #if defined(HAVE_RPC_RPC_H)
768 #include <rpc/rpc.h>
769 #endif],
770 [int16 testvar;],
771 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
772 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
773     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
776 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
777 AC_TRY_COMPILE([#include <sys/types.h>
778 #if defined(HAVE_RPC_RPC_H)
779 #include <rpc/rpc.h>
780 #endif],
781 [uint16 testvar;],
782 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
783 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
784     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
787 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
788 AC_TRY_COMPILE([#include <sys/types.h>
789 #if defined(HAVE_RPC_RPC_H)
790 #include <rpc/rpc.h>
791 #endif],
792 [int32 testvar;],
793 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
794 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
795     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
798 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
799 AC_TRY_COMPILE([#include <sys/types.h>
800 #if defined(HAVE_RPC_RPC_H)
801 #include <rpc/rpc.h>
802 #endif],
803 [uint32 testvar;],
804 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
805 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
806     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
810 dnl Some systems (SCO) have a problem including
811 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
812 dnl as a #define in <prot.h> and as part of an enum
813 dnl in <rpc/rpc.h>.
816 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
817 AC_TRY_COMPILE([#include <sys/types.h>
818 #ifdef HAVE_SYS_SECURITY_H
819 #include <sys/security.h>
820 #include <prot.h>
821 #endif  /* HAVE_SYS_SECURITY_H */
822 #if defined(HAVE_RPC_RPC_H)
823 #include <rpc/rpc.h>
824 #endif],
825 [int testvar;],
826 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
827 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
828     AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
831 AC_MSG_CHECKING([for test routines])
832 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
833            AC_MSG_RESULT(yes),
834            AC_MSG_ERROR([cant find test code. Aborting config]),
835            AC_MSG_WARN([cannot run when cross-compiling]))
837 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
838 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
839            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
840 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
841     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
844 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
845 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
846            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
847 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
848     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
851 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
852 SAVE_CPPFLAGS="$CPPFLAGS"
853 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
854 AC_TRY_COMPILE([
855 #define REPLACE_GETPASS 1
856 #define NO_CONFIG_H 1
857 #define main dont_declare_main
858 #include "${srcdir-.}/lib/getsmbpass.c"
859 #undef main
860 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
861 CPPFLAGS="$SAVE_CPPFLAGS"
863 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
864         AC_DEFINE(REPLACE_GETPASS)
867 AC_CACHE_CHECK([for working fnmatch],samba_cv_HAVE_FNMATCH,[
868 AC_TRY_RUN([#include <fnmatch.h>
869 main() { exit(fnmatch("*.o", "x.o", FNM_PATHNAME) == 0? 0: 1); }],
870 samba_cv_HAVE_FNMATCH=yes,samba_cv_HAVE_FNMATCH=no,samba_cv_HAVE_FNMATCH=cross)])
871 if test x"$samba_cv_HAVE_FNMATCH" = x"yes"; then
872     AC_DEFINE(HAVE_FNMATCH)
875 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
876 AC_TRY_RUN([
877 #include <stdio.h>
878 #include <sys/types.h>
879 #include <netinet/in.h>
880 #ifdef HAVE_ARPA_INET_H
881 #include <arpa/inet.h>
882 #endif
883 main() { struct in_addr ip; ip.s_addr = 0x12345678;
884 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
885     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
886 exit(1);}],
887            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
888 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
889     AC_DEFINE(REPLACE_INET_NTOA)
892 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
893 AC_TRY_RUN([#include <unistd.h>
894 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
895 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
896 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
897     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
900 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
901 AC_TRY_RUN([main() { exit(getuid() != 0); }],
902            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
903 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
904     AC_DEFINE(HAVE_ROOT)
905 else
906     AC_MSG_WARN(running as non-root will disable some tests)
909 ##################
910 # look for a method of finding the list of network interfaces
911 iface=no;
912 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
913 AC_TRY_RUN([
914 #define HAVE_IFACE_AIX 1
915 #define AUTOCONF_TEST 1
916 #include "confdefs.h"
917 #include "${srcdir-.}/lib/interfaces.c"],
918            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
919 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
920     iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
923 if test $iface = no; then
924 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
925 AC_TRY_RUN([
926 #define HAVE_IFACE_IFCONF 1
927 #define AUTOCONF_TEST 1
928 #include "confdefs.h"
929 #include "${srcdir-.}/lib/interfaces.c"],
930            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
931 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
932     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
936 if test $iface = no; then
937 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
938 AC_TRY_RUN([
939 #define HAVE_IFACE_IFREQ 1
940 #define AUTOCONF_TEST 1
941 #include "confdefs.h"
942 #include "${srcdir-.}/lib/interfaces.c"],
943            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
944 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
945     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
950 ################################################
951 # look for a method of setting the effective uid
952 seteuid=no;
953 if test $seteuid = no; then
954 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
955 AC_TRY_RUN([
956 #define AUTOCONF_TEST 1
957 #define USE_SETRESUID 1
958 #include "confdefs.h"
959 #include "${srcdir-.}/lib/util_sec.c"],
960            samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
961 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
962     seteuid=yes;AC_DEFINE(USE_SETRESUID)
967 if test $seteuid = no; then
968 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
969 AC_TRY_RUN([
970 #define AUTOCONF_TEST 1
971 #define USE_SETREUID 1
972 #include "confdefs.h"
973 #include "${srcdir-.}/lib/util_sec.c"],
974            samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
975 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
976     seteuid=yes;AC_DEFINE(USE_SETREUID)
980 if test $seteuid = no; then
981 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
982 AC_TRY_RUN([
983 #define AUTOCONF_TEST 1
984 #define USE_SETEUID 1
985 #include "confdefs.h"
986 #include "${srcdir-.}/lib/util_sec.c"],
987            samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
988 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
989     seteuid=yes;AC_DEFINE(USE_SETEUID)
993 if test $seteuid = no; then
994 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
995 AC_TRY_RUN([
996 #define AUTOCONF_TEST 1
997 #define USE_SETUIDX 1
998 #include "confdefs.h"
999 #include "${srcdir-.}/lib/util_sec.c"],
1000            samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1001 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1002     seteuid=yes;AC_DEFINE(USE_SETUIDX)
1007 AC_CACHE_CHECK([for shared mmap],samba_cv_HAVE_SHARED_MMAP,[
1008 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1009            samba_cv_HAVE_SHARED_MMAP=yes,samba_cv_HAVE_SHARED_MMAP=no,samba_cv_HAVE_SHARED_MMAP=cross)])
1010 if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
1011     AC_DEFINE(HAVE_SHARED_MMAP)
1012     AC_DEFINE(HAVE_MMAP)
1015 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1016 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1017            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1018 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1019     AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1022 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1023 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1024            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1025 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1026     AC_DEFINE(HAVE_FCNTL_LOCK)
1029 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1030 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1031            samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1032 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1033     AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1035 else
1038 dnl Don't check for 64 bit fcntl locking if we know that the
1039 dnl glibc2.1 broken check has succeeded.
1040 dnl 
1042   AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1043   AC_TRY_RUN([
1044 #if defined(HAVE_UNISTD_H)
1045 #include <unistd.h>
1046 #endif
1047 #include <stdio.h>
1048 #include <stdlib.h>
1050 #ifdef HAVE_FCNTL_H
1051 #include <fcntl.h>
1052 #endif
1054 #ifdef HAVE_SYS_FCNTL_H
1055 #include <sys/fcntl.h>
1056 #endif
1057 main() { struct flock64 fl64;
1058 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1059 exit(0);
1060 #else
1061 exit(1);
1062 #endif
1064        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1066   if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1067       AC_DEFINE(HAVE_STRUCT_FLOCK64)
1068   fi
1071 AC_CACHE_CHECK([for sysv ipc],samba_cv_HAVE_SYSV_IPC,[
1072 AC_TRY_RUN([#include "${srcdir-.}/tests/sysv_ipc.c"],
1073            samba_cv_HAVE_SYSV_IPC=yes,samba_cv_HAVE_SYSV_IPC=no,samba_cv_HAVE_SYSV_IPC=cross)])
1074 if test x"$samba_cv_HAVE_SYSV_IPC" = x"yes"; then
1075     AC_DEFINE(HAVE_SYSV_IPC)
1078 AC_CACHE_CHECK([for IRIX sysv ipc semun problem using gcc],samba_cv_NEED_SGI_SEMUN_HACK,[
1079 AC_TRY_RUN([#include "${srcdir-.}/tests/sgi_sysv_hack.c"],
1080            samba_cv_NEED_SGI_SEMUN_HACK=yes,samba_cv_NEED_SGI_SEMUN_HACK=no,samba_cv_NEED_SGI_SEMUN_HACK=cross)])
1081 if test x"$samba_cv_NEED_SGI_SEMUN_HACK" = x"yes"; then
1082     AC_DEFINE(NEED_SGI_SEMUN_HACK)
1085 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1086 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1087            samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
1088 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1089     AC_DEFINE(HAVE_TRUNCATED_SALT)
1092 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1093 AC_TRY_COMPILE([#include <sys/acl.h>
1094 #if defined(HAVE_RPCSVC_NIS_H)
1095 #include <rpcsvc/nis.h>
1096 #endif],
1097 [return 0;],
1098 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1099 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1100     AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1104 #################################################
1105 # check for smbwrapper support
1106 AC_MSG_CHECKING(whether to use smbwrapper)
1107 AC_ARG_WITH(smbwrapper,
1108 [  --with-smbwrapper     Include SMB wrapper support
1109   --without-smbwrapper  Don't include SMB wrapper support (default)],
1110 [ case "$withval" in
1111   yes)
1112     AC_MSG_RESULT(yes)
1113     AC_DEFINE(WITH_SMBWRAPPER)
1114         WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1116         if test x$ATTEMPT_WRAP32_BUILD = x; then
1117                 WRAP32=""
1118         else
1119                         WRAP32=bin/smbwrapper.32.$SHLIBEXT
1120         fi
1122 # Conditions under which smbwrapper should not be built.
1124         if test x$PICFLAG = x; then
1125            echo No support for PIC code - disabling smbwrapper and smbsh
1126            WRAP=""
1127            WRAP32=""
1128         elif test x$ac_cv_func_syscall = xno; then
1129            AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1130            WRAP=""
1131            WRAP32=""
1132         fi
1133     ;;
1134   *)
1135     AC_MSG_RESULT(no)
1136     ;;
1137   esac ],
1138   AC_MSG_RESULT(no)
1141 #################################################
1142 # check for the AFS filesystem
1143 AC_MSG_CHECKING(whether to use AFS)
1144 AC_ARG_WITH(afs,
1145 [  --with-afs     Include AFS support
1146   --without-afs  Don't include AFS support (default)],
1147 [ case "$withval" in
1148   yes)
1149     AC_MSG_RESULT(yes)
1150     AC_DEFINE(WITH_AFS)
1151     ;;
1152   *)
1153     AC_MSG_RESULT(no)
1154     ;;
1155   esac ],
1156   AC_MSG_RESULT(no)
1159 #################################################
1160 # check for the DFS auth system
1161 AC_MSG_CHECKING(whether to use DFS auth)
1162 AC_ARG_WITH(dfs,
1163 [  --with-dfs     Include DFS support
1164   --without-dfs  Don't include DFS support (default)],
1165 [ case "$withval" in
1166   yes)
1167     AC_MSG_RESULT(yes)
1168     AC_DEFINE(WITH_DFS)
1169     ;;
1170   *)
1171     AC_MSG_RESULT(no)
1172     ;;
1173   esac ],
1174   AC_MSG_RESULT(no)
1177 #################################################
1178 # check for Kerberos IV auth system
1179 AC_MSG_CHECKING(whether to use Kerberos IV)
1180 AC_ARG_WITH(krb4,
1181 [  --with-krb4=base-dir     Include Kerberos IV support
1182   --without-krb4          Don't include Kerberos IV support (default)],
1183 [   AC_MSG_RESULT(yes)
1184     AC_DEFINE(KRB4_AUTH)
1185     AC_CHECK_LIB(resolv, dn_expand)
1186     LIBS="$LIBS -lkrb -ldes"
1187     CFLAGS="$CFLAGS -I$withval/include"
1188     LDFLAGS="$LDFLAGS -L$withval/lib"
1189     AC_CHECK_HEADER(kerberos/krb.h,
1190       AC_CACHE_CHECK([whether both krb.h and kerberos/krb.h can be included],
1191       samba_cv_no_kerberos_inconsistency,[
1192       AC_TRY_COMPILE([#include<kerberos/krb.h>
1193 #include<krb.h>],
1194          [],samba_cv_no_kerberos_inconsistency=yes,samba_cv_no_kerberos_inconsistency=no)
1195     ])
1196     if test x"$samba_cv_no_kerberos_inconsistency" = x"no"; then
1197       AC_CACHE_CHECK([whether a Kerberos define work around is needed],
1198        samba_cv_kerberos_define_workaround,[
1199         AC_TRY_COMPILE([#define _KERBEROS_KRB_H
1200 #include<kerberos/krb.h>
1201 #include<krb.h>],
1202            [],samba_cv_kerberos_define_workaround=yes,samba_cv_kerberos_define_workaround=no)
1203       ])
1204       if test x"$samba_cv_kerberos_define_workaround" = x"yes"; then
1205         AC_DEFINE(USE_KRB4_DEFINE_WORK_AROUND)
1206       fi
1207     fi)],
1208   AC_MSG_RESULT(no)
1211 #################################################
1212 # check for the AFS tickets from srvtabs
1213 AC_MSG_CHECKING(whether to use AFS tickets from srvtabs)
1214 AC_ARG_WITH(srvtab,
1215 [  --with-srvtab[=instance]    Include renewable AFS tickets
1216   --without-srvtab            Don't renewable AFS tickets (default)],
1217 [ case "$withval" in
1218   yes)
1219     AC_MSG_RESULT(yes)
1220     AC_DEFINE(USE_RENEWABLE_AFS_TICKET,"")
1221     LIBS="$LIBS -lkafs"
1222     ;;
1223   no)
1224     AC_MSG_RESULT(no)
1225     ;;
1226   *)
1227     AC_MSG_RESULT(yes using instance $withval)
1228     AC_DEFINE_UNQUOTED(USE_RENEWABLE_AFS_TICKET,$withval)
1229     LIBS="$LIBS -lkafs"
1230     ;;
1231   esac ],
1232   AC_MSG_RESULT(no)
1235 #################################################
1236 # check for Kerberos 5 auth system
1237 AC_MSG_CHECKING(whether to use Kerberos 5)
1238 AC_ARG_WITH(krb5,
1239 [  --with-krb5=base-dir     Include Kerberos 5 support
1240   --without-krb5          Don't include Kerberos 5 support (default)],
1241 [   AC_MSG_RESULT(yes)
1242     AC_DEFINE(KRB5_AUTH)
1243     LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
1244     CFLAGS="$CFLAGS -I$withval/include"
1245     LDFLAGS="$LDFLAGS -L$withval/lib"],
1246   AC_MSG_RESULT(no)
1249 #################################################
1250 # check for automount support
1251 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1252 AC_ARG_WITH(automount,
1253 [  --with-automount     Include AUTOMOUNT support
1254   --without-automount  Don't include AUTOMOUNT support (default)],
1255 [ case "$withval" in
1256   yes)
1257     AC_MSG_RESULT(yes)
1258     AC_DEFINE(WITH_AUTOMOUNT)
1259     ;;
1260   *)
1261     AC_MSG_RESULT(no)
1262     ;;
1263   esac ],
1264   AC_MSG_RESULT(no)
1267 #################################################
1268 # check for smbmount support
1269 AC_MSG_CHECKING(whether to use SMBMOUNT)
1270 AC_ARG_WITH(smbmount,
1271 [  --with-smbmount     Include SMBMOUNT (Linux only) support
1272   --without-smbmount  Don't include SMBMOUNT support (default)],
1273 [ case "$withval" in
1274   yes)
1275     AC_MSG_RESULT(yes)
1276     AC_DEFINE(WITH_SMBMOUNT)
1277     MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1278     ;;
1279   *)
1280     AC_MSG_RESULT(no)
1281     MPROGS=
1282     ;;
1283   esac ],
1284   AC_MSG_RESULT(no)
1285   MPROGS=
1289 #################################################
1290 # check for a PAM password database
1291 AC_MSG_CHECKING(whether to use PAM password database)
1292 AC_ARG_WITH(pam,
1293 [  --with-pam     Include PAM password database support
1294   --without-pam  Don't include PAM password database support (default)],
1295 [ case "$withval" in
1296   yes)
1297     AC_MSG_RESULT(yes)
1298     AC_DEFINE(WITH_PAM)
1299     LIBS="$LIBS -lpam"
1300     ;;
1301   *)
1302     AC_MSG_RESULT(no)
1303     ;;
1304   esac ],
1305   AC_MSG_RESULT(no)
1309 #################################################
1310 # check for a LDAP password database
1311 AC_MSG_CHECKING(whether to use LDAP password database)
1312 AC_ARG_WITH(ldap,
1313 [  --with-ldap     Include LDAP support
1314   --without-ldap  Don't include LDAP support (default)],
1315 [ case "$withval" in
1316   yes)
1317     AC_MSG_RESULT(yes)
1318     AC_DEFINE(WITH_LDAP)
1319     LIBS="$LIBS -lldap -llber"
1320     ;;
1321   *)
1322     AC_MSG_RESULT(no)
1323     ;;
1324   esac ],
1325   AC_MSG_RESULT(no)
1328 #################################################
1329 # check for a LDAP password database
1330 AC_MSG_CHECKING(whether to use LDAP password database)
1331 AC_ARG_WITH(nt5ldap,
1332 [  --with-nt5ldap     Include NT5 LDAP support
1333   --without-nt5ldap  Don't include NT5 LDAP support (default)],
1334 [ case "$withval" in
1335   yes)
1336     AC_MSG_RESULT(yes)
1337     AC_DEFINE(WITH_NT5LDAP)
1338     LIBS="$LIBS -lldap -llber"
1339     ;;
1340   *)
1341     AC_MSG_RESULT(no)
1342     ;;
1343   esac ],
1344   AC_MSG_RESULT(no)
1347 #################################################
1348 # check for a LDAP password database
1349 AC_MSG_CHECKING(whether to use LDAP password database)
1350 AC_ARG_WITH(nt5ldap,
1351 [  --with-nt5ldap     Include NT5 LDAP support
1352   --without-nt5ldap  Don't include NT5 LDAP support (default)],
1353 [ case "$withval" in
1354   yes)
1355     AC_MSG_RESULT(yes)
1356     AC_DEFINE(WITH_NT5LDAP)
1357     LIBS="$LIBS -lldap -llber"
1358     ;;
1359   *)
1360     AC_MSG_RESULT(no)
1361     ;;
1362   esac ],
1363   AC_MSG_RESULT(no)
1366 #################################################
1367 # check for a NISPLUS password database
1368 AC_MSG_CHECKING(whether to use NISPLUS password database)
1369 AC_ARG_WITH(nisplus,
1370 [  --with-nisplus     Include NISPLUS password database support
1371   --without-nisplus  Don't include NISPLUS password database support (default)],
1372 [ case "$withval" in
1373   yes)
1374     AC_MSG_RESULT(yes)
1375     AC_DEFINE(WITH_NISPLUS)
1376     ;;
1377   *)
1378     AC_MSG_RESULT(no)
1379     ;;
1380   esac ],
1381   AC_MSG_RESULT(no)
1384 #################################################
1385 # decide for the default sam-password-database
1386 AC_MSG_CHECKING(which sam password database to use)
1387 AC_ARG_WITH(sam_pwdb,
1388 [  --with-sam-pwdb={passdb,tdb,nt5ldap}
1389                           which password-database to use (passdb)],
1390 [ case "$withval" in
1391   ""|passdb)
1392     SAM_PWDB_LIB='$(SAMRPASSLIB) $(SMBPWLIB)'
1393     sampwlibname="passdb"
1394     ;;
1395   tdb)
1396     SAM_PWDB_LIB='$(SAMRTDBLIB)'
1397     sampwlibname="tdb"
1398     ;;
1399   nt5ldap)
1400     SAM_PWDB_LIB='$(SAMRNT5LDAPLIB)'
1401     sampwlibname="nt5ldap (must also specify --with-nt5ldap)"
1402     ;;
1403   *)
1404     SAM_PWDB_LIB='$(SAMRPASSLIB)'
1405     sampwlibname="passdb (unknown specified!)"
1406     ;;
1407 esac], [
1408   SAM_PWDB_LIB='$(SAMRPASSLIB) $(SMBPWLIB)'
1409   sampwlibname="passdb (default)"
1411 AC_MSG_RESULT($sampwlibname)
1412 AC_SUBST(SAM_PWDB_LIB)
1415 #################################################
1416 # check to use a tdb surs database
1417 AC_MSG_CHECKING(whether to use SURS tdb database)
1418 AC_ARG_WITH(surstdb,
1419 [  --with-surstdb     Use SURS tdb database
1420   --without-surstdb  Don't use SURS tdb database (default)],
1421 [ case "$withval" in
1422   yes)
1423     AC_MSG_RESULT(yes)
1424     AC_DEFINE(WITH_TDBSURS)
1425     ;;
1426   *)
1427     AC_MSG_RESULT(no)
1428     ;;
1429   esac ],
1430   AC_MSG_RESULT(no)
1434 #################################################
1435 # check for a NISPLUS_HOME support 
1436 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
1437 AC_ARG_WITH(nisplus-home,
1438 [  --with-nisplus-home     Include NISPLUS_HOME support
1439   --without-nisplus-home  Don't include NISPLUS_HOME support (default)],
1440 [ case "$withval" in
1441   yes)
1442     AC_MSG_RESULT(yes)
1443     AC_DEFINE(WITH_NISPLUS_HOME)
1444     ;;
1445   *)
1446     AC_MSG_RESULT(no)
1447     ;;
1448   esac ],
1449   AC_MSG_RESULT(no)
1452 #################################################
1453 # check for the secure socket layer
1454 AC_MSG_CHECKING(whether to use SSL)
1455 AC_ARG_WITH(ssl,
1456 [  --with-ssl     Include SSL support
1457   --without-ssl  Don't include SSL support (default)
1458   --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl)],
1459 [ case "$withval" in
1460   yes)
1461     AC_MSG_RESULT(yes)
1462     AC_DEFINE(WITH_SSL)
1463     withval="/usr/local/ssl"     # default
1465     if test "${with_sslinc+set}" = set; then
1467         withval="$with_sslinc"
1468         case "$withval" in
1469         yes|no)
1470           echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
1471           CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1472           LIBS="-lssl -lcrypto $LIBS"
1473           LDFLAGS="=L/usr/local/ssl/lib $LDFLAGS"
1474         ;;
1475         * )
1476           CFLAGS="-I${withval} $CFLAGS"
1477           LIBS="-lssl -lcrypto $LIBS"
1478 #         LDFLAGS="-L${withval}/lib $LDFLAGS"
1479         ;;
1480         esac
1482     else
1484         CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
1485         LIBS="-lssl -lcrypto $LIBS"
1486         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1488     fi
1490     if test ! -d ${withval}; then
1491       echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
1492       exit 1
1493     fi 
1495     CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
1497     ;;
1498   *)
1499     AC_MSG_RESULT(no)
1500     ;;
1501   esac ],
1502   AC_MSG_RESULT(no)
1505 #################################################
1506 # check for syslog logging
1507 AC_MSG_CHECKING(whether to use syslog logging)
1508 AC_ARG_WITH(syslog,
1509 [  --with-syslog     Include experimental SYSLOG support
1510   --without-syslog  Don't include SYSLOG support (default)],
1511 [ case "$withval" in
1512   yes)
1513     AC_MSG_RESULT(yes)
1514     AC_DEFINE(WITH_SYSLOG)
1515     ;;
1516   *)
1517     AC_MSG_RESULT(no)
1518     ;;
1519   esac ],
1520   AC_MSG_RESULT(no)
1523 #################################################
1524 # check for a shared memory profiling support
1525 AC_MSG_CHECKING(whether to use profiling)
1526 AC_ARG_WITH(profile,
1527 [  --with-profile     Include profile support
1528   --without-profile  Don't include profile support (default)],
1529 [ case "$withval" in
1530   yes)
1531     AC_MSG_RESULT(yes)
1532     AC_DEFINE(WITH_PROFILE)
1533     ;;
1534   *)
1535     AC_MSG_RESULT(no)
1536     ;;
1537   esac ],
1538   AC_MSG_RESULT(no)
1542 #################################################
1543 # check for experimental netatalk resource fork support
1544 AC_MSG_CHECKING(whether to support netatalk)
1545 AC_ARG_WITH(netatalk,
1546 [  --with-netatalk     Include experimental Netatalk support
1547   --without-netatalk  Don't include experimental Netatalk support (default)],
1548 [ case "$withval" in
1549   yes)
1550     AC_MSG_RESULT(yes)
1551     AC_DEFINE(WITH_NETATALK)
1552     ;;
1553   *)
1554     AC_MSG_RESULT(no)
1555     ;;
1556   esac ],
1557   AC_MSG_RESULT(no)
1560 #################################################
1561 # check for experimental disk-quotas support
1562 QUOTAOBJS=noquotas.o
1564 AC_MSG_CHECKING(whether to support disk-quotas)
1565 AC_ARG_WITH(quotas,
1566 [  --with-quotas     Include experimental disk-quota support
1567   --without-quotas  Don't include experimental disk-quota support (default)],
1568 [ case "$withval" in
1569   yes)
1570     AC_MSG_RESULT(yes)
1571     QUOTAOBJS=quotas.o
1572     ;;
1573   *)
1574     AC_MSG_RESULT(no)
1575     ;;
1576   esac ],
1577   AC_MSG_RESULT(no)
1579 AC_SUBST(QUOTAOBJS)
1581 #################################################
1582 # check for experimental utmp accounting
1584 AC_MSG_CHECKING(whether to support utmp accounting)
1585 AC_ARG_WITH(utmp,
1586 [  --with-utmp     Include experimental utmp accounting
1587   --without-utmp  Don't include experimental utmp accounting (default)],
1588 [ case "$withval" in
1589   yes)
1590     AC_MSG_RESULT(yes)
1591     AC_DEFINE(WITH_UTMP)
1592     ;;
1593   *)
1594     AC_MSG_RESULT(no)
1595     ;;
1596   esac ],
1597   AC_MSG_RESULT(no)
1600 #################################################
1601 # check for MS Dfs support
1603 AC_MSG_CHECKING(whether to support MS Dfs)
1604 AC_ARG_WITH(msdfs,
1605 [  --with-msdfs         Include MS Dfs support
1606   --without-msdfs       Don't include MS Dfs support (default)],
1607 [ case "$withval" in
1608   yes)
1609      AC_MSG_RESULT(yes)
1610      AC_DEFINE(MS_DFS)
1611      ;;
1612   *)
1613     AC_MSG_RESULT(no)
1614     ;;
1615   esac ],
1616   AC_MSG_RESULT(no)
1619 #################################################
1620 # set samba configuration directory location
1622 if test "$sysconfdir" = '${prefix}/etc'
1623 then
1624   # default sysconfdir, decide on prefix
1625   case "$prefix" in
1626     *samba*|NONE)
1627       # if the prefix already contains the word samba,
1628       # we don't need to use a subdir for smb.conf
1629       sambaconfdir='${sysconfdir}'
1630       ;;
1631     *)
1632       # otherwise, we use a separate dir
1633       sambaconfdir='${sysconfdir}/samba'
1634       ;;
1635   esac
1636 else
1637   # sysconfdir given, use that directly
1638   sambaconfdir='${sysconfdir}'
1640 AC_ARG_WITH(sambaconfdir,
1641 [  --with-sambaconfdir=DIR  Where to put smb.conf etc. ($ac_default_prefix/lib)],
1642 [ case "$withval" in
1643   yes)
1644     # Just --with-sambaconfdir, use the new default
1645     # (which has already been "calculated"
1646     ;;
1647   no)
1648     # --without-sambaconfdir, use old default
1649     sambaconfdir='${LIBDIR}'
1650     ;;
1651   * )
1652     sambaconfdir="$withval"
1653     ;;
1654   esac
1655   ],
1656 [ # No --with(out)-sambaconfdir, use old version for some time.
1657   if test "$sysconfdir" = '${prefix}/etc'
1658   then
1659     # sysconfdir not given
1660     sambaconfdir='${LIBDIR}']
1661   fi
1663 AC_SUBST(sambaconfdir)
1665 #################################################
1666 # set private directory location
1667 AC_ARG_WITH(privatedir,
1668 [  --with-privatedir=DIR     Where to put smbpasswd ($ac_default_prefix/private)],
1669 [ case "$withval" in
1670   yes|no)
1671   #
1672   # Just in case anybody calls it without argument
1673   #
1674     AC_MSG_WARN([--with-privatedir called without argument - will use default])
1675     privatedir='${prefix}/private'
1676   ;;
1677   * )
1678     privatedir="$withval"
1679     ;;
1680   esac
1681   AC_SUBST(privatedir)],
1682   [privatedir='${prefix}/private'
1683    AC_SUBST(privatedir)]
1686 #################################################
1687 # set lock directory location
1688 AC_ARG_WITH(lockdir,
1689 [  --with-lockdir=DIR     Where to put lock files ($ac_default_prefix/var/locks)],
1690 [ case "$withval" in
1691   yes|no)
1692   #
1693   # Just in case anybody calls it without argument
1694   #
1695     AC_MSG_WARN([--with-lockdir called without argument - will use default])
1696     lockdir='${VARDIR}/locks'
1697   ;;
1698   * )
1699     lockdir="$withval"
1700     ;;
1701   esac
1702   AC_SUBST(lockdir)],
1703   [lockdir='${VARDIR}/locks'
1704    AC_SUBST(lockdir)]
1707 #################################################
1708 # set SWAT directory location
1709 AC_ARG_WITH(swatdir,
1710 [  --with-swatdir=DIR     Where to put SWAT files ($ac_default_prefix/swat)],
1711 [ case "$withval" in
1712   yes|no)
1713   #
1714   # Just in case anybody does it
1715   #
1716     AC_MSG_WARN([--with-swatdir called without argument - will use default])
1717     swatdir='${prefix}/swat'
1718   ;;
1719   * )
1720     swatdir="$withval"
1721     ;;
1722   esac
1723   AC_SUBST(swatdir)],
1724   [swatdir='${prefix}/swat'
1725    AC_SUBST(swatdir)]
1728 #################################################
1729 # these tests are taken from the GNU fileutils package
1730 AC_CHECKING(how to get filesystem space usage)
1731 space=no
1733 # Test for statvfs64.
1734 if test $space = no; then
1735   # SVR4
1736   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
1737   [AC_TRY_RUN([
1738 #if defined(HAVE_UNISTD_H)
1739 #include <unistd.h>
1740 #endif
1741 #include <sys/types.h>
1742 #include <sys/statvfs.h>
1743   main ()
1744   {
1745     struct statvfs64 fsd;
1746     exit (statvfs64 (".", &fsd));
1747   }],
1748   fu_cv_sys_stat_statvfs64=yes,
1749   fu_cv_sys_stat_statvfs64=no,
1750   fu_cv_sys_stat_statvfs64=cross)])
1751   if test $fu_cv_sys_stat_statvfs64 = yes; then
1752     space=yes
1753     AC_DEFINE(STAT_STATVFS64)
1754   fi
1757 # Perform only the link test since it seems there are no variants of the
1758 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
1759 # because that got a false positive on SCO OSR5.  Adding the declaration
1760 # of a `struct statvfs' causes this test to fail (as it should) on such
1761 # systems.  That system is reported to work fine with STAT_STATFS4 which
1762 # is what it gets when this test fails.
1763 if test $space = no; then
1764   # SVR4
1765   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
1766                  [AC_TRY_LINK([#include <sys/types.h>
1767 #include <sys/statvfs.h>],
1768                               [struct statvfs fsd; statvfs (0, &fsd);],
1769                               fu_cv_sys_stat_statvfs=yes,
1770                               fu_cv_sys_stat_statvfs=no)])
1771   if test $fu_cv_sys_stat_statvfs = yes; then
1772     space=yes
1773     AC_DEFINE(STAT_STATVFS)
1774   fi
1777 if test $space = no; then
1778   # DEC Alpha running OSF/1
1779   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
1780   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
1781   [AC_TRY_RUN([
1782 #include <sys/param.h>
1783 #include <sys/types.h>
1784 #include <sys/mount.h>
1785   main ()
1786   {
1787     struct statfs fsd;
1788     fsd.f_fsize = 0;
1789     exit (statfs (".", &fsd, sizeof (struct statfs)));
1790   }],
1791   fu_cv_sys_stat_statfs3_osf1=yes,
1792   fu_cv_sys_stat_statfs3_osf1=no,
1793   fu_cv_sys_stat_statfs3_osf1=no)])
1794   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
1795   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
1796     space=yes
1797     AC_DEFINE(STAT_STATFS3_OSF1)
1798   fi
1801 if test $space = no; then
1802 # AIX
1803   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
1804 member (AIX, 4.3BSD)])
1805   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
1806   [AC_TRY_RUN([
1807 #ifdef HAVE_SYS_PARAM_H
1808 #include <sys/param.h>
1809 #endif
1810 #ifdef HAVE_SYS_MOUNT_H
1811 #include <sys/mount.h>
1812 #endif
1813 #ifdef HAVE_SYS_VFS_H
1814 #include <sys/vfs.h>
1815 #endif
1816   main ()
1817   {
1818   struct statfs fsd;
1819   fsd.f_bsize = 0;
1820   exit (statfs (".", &fsd));
1821   }],
1822   fu_cv_sys_stat_statfs2_bsize=yes,
1823   fu_cv_sys_stat_statfs2_bsize=no,
1824   fu_cv_sys_stat_statfs2_bsize=no)])
1825   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
1826   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
1827     space=yes
1828     AC_DEFINE(STAT_STATFS2_BSIZE)
1829   fi
1832 if test $space = no; then
1833 # SVR3
1834   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
1835   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
1836   [AC_TRY_RUN([#include <sys/types.h>
1837 #include <sys/statfs.h>
1838   main ()
1839   {
1840   struct statfs fsd;
1841   exit (statfs (".", &fsd, sizeof fsd, 0));
1842   }],
1843     fu_cv_sys_stat_statfs4=yes,
1844     fu_cv_sys_stat_statfs4=no,
1845     fu_cv_sys_stat_statfs4=no)])
1846   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
1847   if test $fu_cv_sys_stat_statfs4 = yes; then
1848     space=yes
1849     AC_DEFINE(STAT_STATFS4)
1850   fi
1853 if test $space = no; then
1854 # 4.4BSD and NetBSD
1855   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
1856 member (4.4BSD and NetBSD)])
1857   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
1858   [AC_TRY_RUN([#include <sys/types.h>
1859 #ifdef HAVE_SYS_PARAM_H
1860 #include <sys/param.h>
1861 #endif
1862 #ifdef HAVE_SYS_MOUNT_H
1863 #include <sys/mount.h>
1864 #endif
1865   main ()
1866   {
1867   struct statfs fsd;
1868   fsd.f_fsize = 0;
1869   exit (statfs (".", &fsd));
1870   }],
1871   fu_cv_sys_stat_statfs2_fsize=yes,
1872   fu_cv_sys_stat_statfs2_fsize=no,
1873   fu_cv_sys_stat_statfs2_fsize=no)])
1874   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
1875   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
1876     space=yes
1877     AC_DEFINE(STAT_STATFS2_FSIZE)
1878   fi
1881 if test $space = no; then
1882   # Ultrix
1883   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1884   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1885   [AC_TRY_RUN([#include <sys/types.h>
1886 #ifdef HAVE_SYS_PARAM_H
1887 #include <sys/param.h>
1888 #endif
1889 #ifdef HAVE_SYS_MOUNT_H
1890 #include <sys/mount.h>
1891 #endif
1892 #ifdef HAVE_SYS_FS_TYPES_H
1893 #include <sys/fs_types.h>
1894 #endif
1895   main ()
1896   {
1897   struct fs_data fsd;
1898   /* Ultrix's statfs returns 1 for success,
1899      0 for not mounted, -1 for failure.  */
1900   exit (statfs (".", &fsd) != 1);
1901   }],
1902   fu_cv_sys_stat_fs_data=yes,
1903   fu_cv_sys_stat_fs_data=no,
1904   fu_cv_sys_stat_fs_data=no)])
1905   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1906   if test $fu_cv_sys_stat_fs_data = yes; then
1907     space=yes
1908     AC_DEFINE(STAT_STATFS2_FS_DATA)
1909   fi
1913 # As a gating factor for large file support, in order to
1914 # use <4GB files we must have the following minimal support
1915 # available.
1916 # long long, and a 64 bit off_t or off64_t.
1917 # If we don't have all of these then disable large
1918 # file support.
1920 echo "checking if large file support can be enabled"
1921 AC_TRY_COMPILE([
1922 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
1923 #include <sys/types.h>
1924 #else
1925 __COMPILE_ERROR_
1926 #endif
1928 [int i],
1929 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
1930 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
1931     echo "yes"
1932     AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
1933 else
1934     echo "no"
1937 echo "checking configure summary"
1938 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
1939            echo "configure OK";,
1940            AC_MSG_ERROR([summary failure. Aborting config]),:)
1942 builddir=`pwd`
1943 AC_SUBST(builddir)
1945 AC_OUTPUT([include/stamp-h Makefile script/samba-init.d],
1947 case " $CONFIG_FILES " in
1948   *" script/samba-init.d "*) chmod +x script/samba-init.d
1949 esac
1952 echo ""
1953 echo "prefix       : $prefix"
1954 echo "exec_prefix  : $exec_prefix"
1955 echo "bindir       : $bindir"
1956 echo "sbindir      : $sbindir"
1957 echo "libdir       : $libdir"
1958 echo "vardir       : $localstatedir"
1959 echo "sysconfdir   : $sysconfdir"
1960 echo ""
1961 echo "sambaconfdir : $sambaconfdir"
1962 echo "privatedir   : $privatedir"
1963 echo "lockdir      : $lockdir"
1964 echo "swatdir      : $swatdir"
1965 echo ""