Traslated some chmod mgs related (for win32 support? not shure)
[midnight-commander.git] / vfs / samba / configure.in
bloba05cf9c7f8942d0ab27ad68ba6dc4c7e3226aeba
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 AC_CONFIG_AUX_DIR(../../config)
5 # we want to be compatibe with older versions of Samba
6 AC_PREFIX_DEFAULT(/usr/local/samba)
8 dnl Unique-to-Samba variables we'll be playing with.
9 AC_SUBST(SHELL)
10 AC_SUBST(MPROGS)
11 AC_SUBST(LDSHFLAGS)
12 AC_SUBST(HOST_OS)
13 AC_SUBST(WRAP)
14 AC_SUBST(WRAP32)
16 # compile with optimisation and without debugging by default
17 CFLAGS=${CFLAGS-"-O"}
19 dnl Checks for programs.
20 AC_PROG_CC
21 AC_PROG_INSTALL
22 AC_PROG_AWK
23 AC_CHECK_TOOL(AR, ar, ar)
25 dnl Check if C compiler understands -c and -o at the same time
26 AC_PROG_CC_C_O
27 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
28       BROKEN_CC=
29 else
30       BROKEN_CC=#
32 AC_SUBST(BROKEN_CC)
34 dnl Check if the C compiler understands volatile (it should, being ANSI).
35 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
36     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
37         samba_cv_volatile=yes,samba_cv_volatile=no)])
38 if test x"$samba_cv_volatile" = x"yes"; then
39    AC_DEFINE(HAVE_VOLATILE)
44 AC_CANONICAL_HOST
45 AC_VALIDATE_CACHE_SYSTEM_TYPE
46 SAMBA_MAINTAINER_MODE
48 AC_INLINE
49 AC_HEADER_STDC
50 AC_HEADER_DIRENT
51 AC_HEADER_TIME
52 AC_HEADER_SYS_WAIT
53 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
54 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
55 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
56 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
57 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h string.h strings.h stdlib.h sys/socket.h)
58 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
59 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
60 AC_CHECK_HEADERS(netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
61 AC_CHECK_HEADERS(sys/security.h security/pam_appl.h)
62 AC_CHECK_HEADERS(stropts.h poll.h sys/capability.h syscall.h sys/syscall.h)
63 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
65 AC_CHECK_SIZEOF(int,cross)
66 AC_CHECK_SIZEOF(long,cross)
67 AC_CHECK_SIZEOF(short,cross)
69 AC_C_CONST
70 AC_C_INLINE
71 AC_C_BIGENDIAN
72 AC_C_CHAR_UNSIGNED
74 AC_TYPE_SIGNAL
75 AC_TYPE_UID_T
76 AC_TYPE_MODE_T
77 AC_TYPE_OFF_T
78 AC_TYPE_SIZE_T
79 AC_TYPE_PID_T
80 AC_STRUCT_ST_RDEV
81 AC_DIRENT_D_OFF
82 AC_CHECK_TYPE(ino_t,unsigned)
83 AC_CHECK_TYPE(loff_t,off_t)
84 AC_CHECK_TYPE(offset_t,off_t)
85 AC_CHECK_TYPE(ssize_t, int)
87 # we need libdl for PAM and the new VFS code
88 AC_CHECK_LIB(dl,main)
90 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
91     AC_TRY_COMPILE([
92 #include <sys/types.h>
93 #if STDC_HEADERS
94 #include <stdlib.h>
95 #include <stddef.h>
96 #endif
97 #include <signal.h>],[sig_atomic_t i = 0],
98         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
99 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
100    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
103 AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
104     AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
105         samba_cv_errno=yes,samba_cv_have_errno=no)])
106 if test x"$samba_cv_errno" = x"yes"; then
107    AC_DEFINE(HAVE_ERRNO_DECL)
110 # stupid glibc has the functions but no declaration. grrrr.
111 AC_CACHE_CHECK([for crypt declaration],samba_cv_have_crypt_decl,[
112     AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)crypt],
113         samba_cv_have_crypt_decl=yes,samba_cv_have_crypt_decl=no)])
114 if test x"$samba_cv_have_crypt_decl" = x"yes"; then
115     AC_DEFINE(HAVE_CRYPT_DECL)
118 AC_FUNC_MEMCMP
120 ###############################################
121 # test for where we get crypt() from
122 AC_CHECK_FUNCS(crypt)
123 if test x"$ac_cv_func_crypt" = x"no"; then
124     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
125         AC_DEFINE(HAVE_CRYPT)])
129 # The following test taken from the cvs sources
130 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
131 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
132 # libsocket.so which has a bad implementation of gethostbyname (it
133 # only looks in /etc/hosts), so we only look for -lsocket if we need
134 # it.
135 AC_CHECK_FUNCS(connect)
136 if test x"$ac_cv_func_connect" = x"no"; then
137     case "$LIBS" in
138     *-lnsl*) ;;
139     *) AC_CHECK_LIB(nsl_s, printf) ;;
140     esac
141     case "$LIBS" in
142     *-lnsl*) ;;
143     *) AC_CHECK_LIB(nsl, printf) ;;
144     esac
145     case "$LIBS" in
146     *-lsocket*) ;;
147     *) AC_CHECK_LIB(socket, connect) ;;
148     esac
149     case "$LIBS" in
150     *-linet*) ;;
151     *) AC_CHECK_LIB(inet, connect) ;;
152     esac
153     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
154     dnl has been cached.
155     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
156        test x"$ac_cv_lib_inet_connect" = x"yes"; then
157         # ac_cv_func_connect=yes
158         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
159         AC_DEFINE(HAVE_CONNECT)
160     fi
163 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod)
164 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
165 AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob strpbrk pipe crypt16 getauthuid)
166 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
167 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf setreuid setregid seteuid setegid)
168 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate)
169 AC_CHECK_FUNCS(atexit grantpt dup2)
170 AC_CHECK_FUNCS(setluid yp_get_default_domain getpwanam)
171 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp)
173 AC_CHECK_FUNCS(getdents)
174 AC_CHECK_FUNCS(llseek)
177 # If no strcasecmp, check for it in some known places
178 # It is in -lresolv on ReliantUNIX and UnixWare
179 #   -lresolve *must* follow -lnsl for name resolution to work properly
182 if test x$ac_cv_func_strcasecmp = xno ; then
183         AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
184                 AC_DEFINE(HAVE_STRCASECMP))
188 # Check for the functions putprpwnam, set_auth_parameters,
189 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
190 # Needed for OSF1 and HPUX.
193 AC_LIBTESTFUNC(security, putprpwnam)
194 AC_LIBTESTFUNC(sec, putprpwnam)
196 AC_LIBTESTFUNC(security, set_auth_parameters)
197 AC_LIBTESTFUNC(sec, set_auth_parameters)
199 AC_LIBTESTFUNC(security, getspnam)
200 AC_LIBTESTFUNC(sec, getspnam)
202 AC_LIBTESTFUNC(security, bigcrypt)
203 AC_LIBTESTFUNC(sec, bigcrypt)
205 AC_LIBTESTFUNC(security, getprpwnam)
206 AC_LIBTESTFUNC(sec, getprpwnam)
208 # this bit needs to be modified for each OS that is suported by
209 # smbwrapper. You need to specify how to created a shared library and
210 # how to compile C code to produce PIC object files
212 # these are the defaults, good for lots of systems
213 HOST_OS="$host_os"
214 LDSHFLAGS="-shared"
216 # and these are for particular systems
217 case "$host_os" in
218                 *linux*)   AC_DEFINE(LINUX);;
219                 *solaris*) AC_DEFINE(SUNOS5)
220                                         LDSHFLAGS="-G"
221                 ;;
222                 *sunos*) AC_DEFINE(SUNOS4)
223                                         LDSHFLAGS=""
224                 ;;
225                 *bsd*) LDSHFLAGS="-shared -Bshareable"
226                 ;;
227                 *irix*) AC_DEFINE(IRIX)
228                         case "$host_os" in
229                         *irix6*) AC_DEFINE(IRIX6)
230                         ;;
231                         esac
232                         ATTEMPT_WRAP32_BUILD=yes
233                 ;;
234                 *aix*) AC_DEFINE(AIX);;
235                 *hpux*) AC_DEFINE(HPUX);;
236                 *qnx*) AC_DEFINE(QNX);;
237                 *osf*) AC_DEFINE(OSF1);;
238                 *sco*) AC_DEFINE(SCO);;
239                 *next2*) AC_DEFINE(NEXT2);;
240                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
241                 *sysv4*)
242                         case "$host" in
243                                 *-univel-*)     if [ test "$GCC" != yes ]; then
244                                                                         AC_DEFINE(HAVE_MEMSET)
245                                                                 fi
246                                                                 LDSHFLAGS="-G"
247                                 ;;
248                                 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
249                         esac
250                         ;;
251                 *sysv5*)
252                         if [ test "$GCC" != yes ]; then
253                                 AC_DEFINE(HAVE_MEMSET)
254                         fi
255                         LDSHFLAGS="-G"
256                         ;;
257 esac
259 ################
261 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
262 AC_TRY_RUN([#include <stdio.h>
263 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
264 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
265 if test x"$samba_cv_have_longlong" = x"yes"; then
266     AC_DEFINE(HAVE_LONGLONG)
269 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
270 AC_TRY_RUN([#include <stdio.h>
271 #include <sys/stat.h>
272 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
273 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
274 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
275     AC_DEFINE(SIZEOF_OFF_T,8)
278 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
279 AC_TRY_RUN([
280 #if defined(HAVE_UNISTD_H)
281 #include <unistd.h>
282 #endif
283 #include <stdio.h>
284 #include <sys/stat.h>
285 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
286 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
287 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
288     AC_DEFINE(HAVE_OFF64_T)
291 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
292 AC_TRY_RUN([#include <stdio.h>
293 #include <sys/stat.h>
294 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
295 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
296 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
297     AC_DEFINE(SIZEOF_INO_T,8)
300 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
301 AC_TRY_RUN([
302 #if defined(HAVE_UNISTD_H)
303 #include <unistd.h>
304 #endif
305 #include <stdio.h>
306 #include <sys/stat.h>
307 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
308 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
309 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
310     AC_DEFINE(HAVE_INO64_T)
313 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
314 AC_TRY_COMPILE([
315 #if defined(HAVE_UNISTD_H)
316 #include <unistd.h>
317 #endif
318 #include <sys/types.h>
319 #include <dirent.h>],
320 [struct dirent64 de;],
321 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
322 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
323     AC_DEFINE(HAVE_STRUCT_DIRENT64)
326 AC_CACHE_CHECK([for union semun],samba_cv_HAVE_UNION_SEMUN,[
327 AC_TRY_RUN([
328 #include <sys/types.h>
329 #include <sys/ipc.h>
330 #include <sys/sem.h>
331 main() { union semun ss; exit(0); }],
332 samba_cv_HAVE_UNION_SEMUN=yes,samba_cv_HAVE_UNION_SEMUN=no,samba_cv_HAVE_UNION_SEMUN=cross)])
333 if test x"$samba_cv_HAVE_UNION_SEMUN" = x"yes"; then
334     AC_DEFINE(HAVE_UNION_SEMUN)
337 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
338 AC_TRY_RUN([#include <stdio.h>
339 main() { char c; c=250; exit((c > 0)?0:1); }],
340 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
341 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
342     AC_DEFINE(HAVE_UNSIGNED_CHAR)
345 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
346 AC_TRY_COMPILE([#include <sys/types.h>
347 #include <sys/socket.h>
348 #include <netinet/in.h>],
349 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
350 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
351 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
352     AC_DEFINE(HAVE_SOCK_SIN_LEN)
355 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
356 AC_TRY_COMPILE([#include <sys/types.h>
357 #include <dirent.h>
358 void seekdir(DIR *d, long loc) { return; }],[return 0;],
359 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
360 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
361     AC_DEFINE(SEEKDIR_RETURNS_VOID)
364 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
365 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
366 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
367 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
368     AC_DEFINE(HAVE_FILE_MACRO)
371 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
372 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
373 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
374 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
375     AC_DEFINE(HAVE_FUNCTION_MACRO)
378 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
379 AC_TRY_RUN([
380 #include <sys/time.h>
381 #include <unistd.h>
382 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
383            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
384 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
385     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
389 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
390 AC_TRY_RUN([#include <sys/types.h>
391 #include <dirent.h>
392 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
393 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
394 di->d_name[0] == 0) exit(0); exit(1);} ],
395 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
396 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
397     AC_DEFINE(HAVE_BROKEN_READDIR)
400 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
401 AC_TRY_COMPILE([#include <sys/types.h>
402 #include <utime.h>],
403 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
404 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
405 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
406     AC_DEFINE(HAVE_UTIMBUF)
409 AC_CACHE_CHECK([for kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS,[
410 AC_TRY_COMPILE([#include <sys/types.h>
411 #include <fcntl.h>],
412 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
413 samba_cv_HAVE_KERNEL_OPLOCKS=yes,samba_cv_HAVE_KERNEL_OPLOCKS=no)])
414 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
415     AC_DEFINE(HAVE_KERNEL_OPLOCKS)
418 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
419 AC_TRY_RUN([#include <sys/types.h>
420 #include <sys/capability.h>
421 main() {
422  cap_t cap;
423  if ((cap = cap_get_proc()) == NULL)
424    exit(1);
425  cap->cap_effective |= CAP_NETWORK_MGT;
426  cap->cap_inheritable |= CAP_NETWORK_MGT;
427  cap_set_proc(cap);
428  exit(0);
431 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
432 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
433     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
437 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
438 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
441 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
442 AC_TRY_COMPILE([#include <sys/types.h>
443 #if defined(HAVE_RPC_RPC_H)
444 #include <rpc/rpc.h>
445 #endif],
446 [int16 testvar;],
447 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
448 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
449     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
452 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
453 AC_TRY_COMPILE([#include <sys/types.h>
454 #if defined(HAVE_RPC_RPC_H)
455 #include <rpc/rpc.h>
456 #endif],
457 [uint16 testvar;],
458 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
459 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
460     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
463 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
464 AC_TRY_COMPILE([#include <sys/types.h>
465 #if defined(HAVE_RPC_RPC_H)
466 #include <rpc/rpc.h>
467 #endif],
468 [int32 testvar;],
469 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
470 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
471     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
474 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
475 AC_TRY_COMPILE([#include <sys/types.h>
476 #if defined(HAVE_RPC_RPC_H)
477 #include <rpc/rpc.h>
478 #endif],
479 [uint32 testvar;],
480 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
481 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
482     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
486 dnl Some systems (SCO) have a problem including
487 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
488 dnl as a #define in <prot.h> and as part of an enum
489 dnl in <rpc/rpc.h>.
492 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
493 AC_TRY_COMPILE([#include <sys/types.h>
494 #ifdef HAVE_SYS_SECURITY_H
495 #include <sys/security.h>
496 #include <prot.h>
497 #endif  /* HAVE_SYS_SECURITY_H */
498 #if defined(HAVE_RPC_RPC_H)
499 #include <rpc/rpc.h>
500 #endif],
501 [int testvar;],
502 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
503 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
504     AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
507 AC_MSG_CHECKING([for test routines])
508 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
509            AC_MSG_RESULT(yes),
510            AC_MSG_ERROR([cant find test code. Aborting config]),
511            AC_MSG_WARN([cannot run when cross-compiling]))
513 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
514 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
515            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
516 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
517     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
520 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
521 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
522            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
523 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
524     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
527 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
528 AC_TRY_RUN([
529 #include <stdio.h>
530 #include <sys/types.h>
531 #include <netinet/in.h>
532 #ifdef HAVE_ARPA_INET_H
533 #include <arpa/inet.h>
534 #endif
535 main() { struct in_addr ip; ip.s_addr = 0x12345678;
536 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
537     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
538 exit(1);}],
539            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
540 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
541     AC_DEFINE(REPLACE_INET_NTOA)
544 netmask=no;
545 AC_CACHE_CHECK([for netmask ifconf],samba_cv_HAVE_NETMASK_IFCONF,[
546 AC_TRY_RUN([
547 #define HAVE_NETMASK_IFCONF 1
548 #define AUTOCONF 1
549 #include "confdefs.h"
550 #include "${srcdir-.}/lib/netmask.c"],
551            samba_cv_HAVE_NETMASK_IFCONF=yes,samba_cv_HAVE_NETMASK_IFCONF=no,samba_cv_HAVE_NETMASK_IFCONF=cross)])
552 if test x"$samba_cv_HAVE_NETMASK_IFCONF" = x"yes"; then
553     netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF)
556 if test $netmask = no; then
557 AC_CACHE_CHECK([for netmask ifreq],samba_cv_HAVE_NETMASK_IFREQ,[
558 AC_TRY_RUN([
559 #define HAVE_NETMASK_IFREQ 1
560 #define AUTOCONF 1
561 #include "confdefs.h"
562 #include "${srcdir-.}/lib/netmask.c"],
563            samba_cv_HAVE_NETMASK_IFREQ=yes,samba_cv_HAVE_NETMASK_IFREQ=no,samba_cv_HAVE_NETMASK_IFREQ=cross)])
564 if test x"$samba_cv_HAVE_NETMASK_IFREQ" = x"yes"; then
565     netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ)
569 if test $netmask = no; then
570 AC_CACHE_CHECK([for netmask AIX],samba_cv_HAVE_NETMASK_AIX,[
571 AC_TRY_RUN([
572 #define HAVE_NETMASK_AIX 1
573 #define AUTOCONF 1
574 #include "confdefs.h"
575 #include "${srcdir-.}/lib/netmask.c"],
576            samba_cv_HAVE_NETMASK_AIX=yes,samba_cv_HAVE_NETMASK_AIX=no,samba_cv_HAVE_NETMASK_AIX=cross)])
577 if test x"$samba_cv_HAVE_NETMASK_AIX" = x"yes"; then
578     netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX)
583 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
584 AC_TRY_COMPILE([#include <sys/acl.h>
585 #if defined(HAVE_RPCSVC_NIS_H)
586 #include <rpcsvc/nis.h>
587 #endif],
588 [return 0;],
589 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
590 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
591     AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
595 #################################################
596 # check for a LDAP password database
597 AC_MSG_CHECKING([whether to use LDAP password database])
598 AC_ARG_WITH(ldap,
599 [  --with-ldap     Include LDAP support
600   --without-ldap  Don't include LDAP support (default)],
601 [ case "$withval" in
602   yes)
603     AC_MSG_RESULT(yes)
604     AC_DEFINE(WITH_LDAP)
605     ;;
606   *)
607     AC_MSG_RESULT(no)
608     ;;
609   esac ],
610   AC_MSG_RESULT(no)
613 #################################################
614 # check for a NISPLUS password database
615 AC_MSG_CHECKING([whether to use NISPLUS password database])
616 AC_ARG_WITH(nisplus,
617 [  --with-nisplus     Include NISPLUS password database support
618   --without-nisplus  Don't include NISPLUS password database support (default)],
619 [ case "$withval" in
620   yes)
621     AC_MSG_RESULT(yes)
622     AC_DEFINE(WITH_NISPLUS)
623     ;;
624   *)
625     AC_MSG_RESULT(no)
626     ;;
627   esac ],
628   AC_MSG_RESULT(no)
631 #################################################
632 # check for a NISPLUS_HOME support 
633 AC_MSG_CHECKING([whether to use NISPLUS_HOME])
634 AC_ARG_WITH(nisplus-home,
635 [  --with-nisplus-home     Include NISPLUS_HOME support
636   --without-nisplus-home  Don't include NISPLUS_HOME support (default)],
637 [ case "$withval" in
638   yes)
639     AC_MSG_RESULT(yes)
640     AC_DEFINE(WITH_NISPLUS_HOME)
641     ;;
642   *)
643     AC_MSG_RESULT(no)
644     ;;
645   esac ],
646   AC_MSG_RESULT(no)
649 #################################################
650 # check for the secure socket layer
651 AC_MSG_CHECKING([whether to use SSL])
652 AC_ARG_WITH(ssl,
653 [  --with-ssl     Include SSL support
654   --without-ssl  Don't include SSL support (default)
655   --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl)],
656 [ case "$withval" in
657   yes)
658     AC_MSG_RESULT(yes)
659     AC_DEFINE(WITH_SSL)
660     withval="/usr/local/ssl"     # default
662     if test "${with_sslinc+set}" = set; then
664         withval="$with_sslinc"
665         case "$withval" in
666         yes|no)
667           AC_MSG_WARN([--with-sslinc called without argument - will use default])
668           CFLAGS="-I/usr/local/ssl/include $CFLAGS"
669           LIBS="-lssl -lcrypto $LIBS"
670           LDFLAGS="=L/usr/local/ssl/lib $LDFLAGS"
671         ;;
672         * )
673           CFLAGS="-I${withval}/include $CFLAGS"
674           LIBS="-lssl -l crypto $LIBS"
675           LDFLAGS="-L${withval}/lib $LDFLAGS"
676         ;;
677         esac
679     else
681         CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
682         LIBS="-lssl -lcrypto $LIBS"
683         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
685     fi
687     if test ! -d ${withval}; then
688       AC_MSG_ERROR([called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config])
689     fi 
691     CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
693     ;;
694   *)
695     AC_MSG_RESULT(no)
696     ;;
697   esac ],
698   AC_MSG_RESULT(no)
702 #################################################
703 # set private directory location
704 AC_ARG_WITH(privatedir,
705 [  --with-privatedir=DIR     Where to put smbpasswd ($ac_default_prefix/private)],
706 [ case "$withval" in
707   yes|no)
708   #
709   # Just in case anybody calls it without argument
710   #
711     AC_MSG_WARN([--with-privatedir called without argument - will use default])
712     privatedir='${prefix}/private'
713   ;;
714   * )
715     privatedir="$withval"
716     ;;
717   esac
718   AC_SUBST(privatedir)],
719   [privatedir='${prefix}/private'
720    AC_SUBST(privatedir)]
723 #################################################
724 # set lock directory location
725 AC_ARG_WITH(lockdir,
726 [  --with-lockdir=DIR     Where to put lock files ($ac_default_prefix/var/locks)],
727 [ case "$withval" in
728   yes|no)
729   #
730   # Just in case anybody calls it without argument
731   #
732     AC_MSG_WARN([--with-lockdir called without argument - will use default])
733     lockdir='$(VARDIR)/locks'
734   ;;
735   * )
736     lockdir="$withval"
737     ;;
738   esac
739   AC_SUBST(lockdir)],
740   [lockdir='$(VARDIR)/locks'
741    AC_SUBST(lockdir)]
744 #################################################
745 # set configuration directory location
746 configdir="\$(LIBDIR)"
747 AC_ARG_WITH(configdir,
748 [  --with-configdir=DIR    Where to put configuration files (\$libdir)],
749 [ case "$withval" in
750   yes|no)
751   #
752   # Just in case anybody does it
753   #
754     AC_MSG_WARN([--with-configdir called without argument - will use default])
755   ;;
756   * )
757     configdir="$withval"
758     ;;
759   esac]
763 #################################################
764 # set codepage directory location
765 codepagedir="\$(LIBDIR)/codepages"
766 AC_ARG_WITH(codepagedir,
767 [  --with-codepagedir=DIR  Where to put codepage files (\$libdir/codepages)],
768 [ case "$withval" in
769   yes|no)
770   #
771   # Just in case anybody does it
772   #
773     AC_MSG_WARN([--with-codepagedir called without argument - will use default])
774   ;;
775   * )
776     codepagedir="$withval"
777     ;;
778   esac])
780 AC_MSG_CHECKING([configure summary])
781 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
782            AC_MSG_RESULT(OK);,
783            AC_MSG_RESULT(failure)
784            AC_MSG_ERROR([Aborting config]),:)
786 builddir=`pwd`
787 AC_SUBST(builddir)
788 AC_SUBST(configdir)
789 AC_SUBST(codepagedir)
791 AC_OUTPUT([include/stamp-h Makefile])