replace getpass() with getsmbpass() if getsmbpass.c compiles
[tprouty/samba.git] / source3 / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(include/includes.h)
3 AC_CONFIG_HEADER(include/config.h)
4
5 dnl Checks for programs.
6 AC_PROG_CC
7 AC_PROG_INSTALL
8 AC_SUBST(SHELL)
9 AC_PROG_AWK
10
11 AC_CANONICAL_SYSTEM
12 case "$host_os" in
13         *linux*)   AC_DEFINE(LINUX);;
14         *solaris*) AC_DEFINE(SUNOS5);;
15         *sunos*) AC_DEFINE(SUNOS4);;
16         *irix*) AC_DEFINE(IRIX);;
17         *aix*) AC_DEFINE(AIX);;
18         *hpux*) AC_DEFINE(HPUX);;
19         *qnx*) AC_DEFINE(QNX);;
20         *osf1*) AC_DEFINE(OSF1);;
21         *sco*) AC_DEFINE(SCO);;
22         *next2*) AC_DEFINE(NEXT2);;
23 esac
24
25 AC_INLINE
26 AC_HEADER_STDC
27 AC_HEADER_DIRENT
28 AC_HEADER_TIME
29 AC_HEADER_SYS_WAIT
30 AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
31 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
32 AC_CHECK_HEADERS(compat.h rpc/types.h rpc/xdr.h rpc/auth.h rpc/clnt.h)
33 AC_CHECK_HEADERS(rpcsvc/yp_prot.h rpcsvc/ypclnt.h sys/param.h ctype.h )
34 AC_CHECK_HEADERS(sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
35 AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
36 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
37 AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
38 AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
39 AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
40 AC_CHECK_HEADERS(readline/history.h)
41
42 AC_CHECK_SIZEOF(int,cross)
43 AC_CHECK_SIZEOF(long,cross)
44 AC_CHECK_SIZEOF(short,cross)
45
46 AC_C_CONST
47 AC_C_INLINE
48 AC_C_BIGENDIAN
49 AC_C_CHAR_UNSIGNED
50
51 AC_TYPE_SIGNAL
52 AC_TYPE_UID_T
53 AC_TYPE_MODE_T
54 AC_TYPE_OFF_T
55 AC_TYPE_SIZE_T
56 AC_TYPE_PID_T
57 AC_STRUCT_ST_RDEV
58 AC_CHECK_TYPE(ino_t,unsigned)
59 AC_CHECK_TYPE(ssize_t, int)
60
61 AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
62     AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
63         samba_cv_errno=yes,samba_cv_have_errno_decl=no)])
64 if test x"$samba_cv_errno" = x"yes"; then
65    AC_DEFINE(HAVE_ERRNO_DECL)
66 fi
67
68 # stupid glibc has the functions but no declaration. grrrr.
69 AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
70     AC_TRY_COMPILE([#include <unistd.h>],[int i = setresuid],
71         samba_cv_have_setresuid_decl=yes,samba_cv_have_setresuid_decl=no)])
72 if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
73     AC_DEFINE(HAVE_SETRESUID_DECL)
74 fi
75
76 # and glibc has setresuid under linux but the function does
77 # nothing until kernel 2.1.44! very dumb.
78 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
79     AC_TRY_RUN([#include <errno.h>
80 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
81         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
82 if test x"$samba_cv_have_setresuid" = x"yes"; then
83     AC_DEFINE(HAVE_SETRESUID)
84 fi
85
86 AC_FUNC_MEMCMP
87
88 ###############################################
89 # test for where we get crypt() from
90 AC_CHECK_FUNCS(crypt)
91 if test x"$ac_cv_func_crypt" = x"no"; then
92     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
93         AC_DEFINE(HAVE_CRYPT)])
94 fi
95
96
97 ###############################################
98 # test for where we get pam_authenticate() from
99 # might need libdl for this to work
100 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
101   AC_CHECK_LIB(dl,main)
102 fi
103 AC_CHECK_FUNCS(pam_authenticate)
104 if test x"$ac_cv_func_pam_authenticate" = x"no"; then
105     AC_CHECK_LIB(pam, pam_authenticate, [LIBS="$LIBS -lpam"
106         AC_DEFINE(HAVE_PAM_AUTHENTICATE)])
107 fi
108
109
110 ###############################################
111 # test for where we get readline() from
112 if test "$ac_cv_header_readline_h" = "yes" ||
113    test "$ac_cv_header_readline_readline_h" = "yes"; then
114   AC_CHECK_LIB(readline,readline)
115 fi
116
117
118 # The following test taken from the cvs sources
119 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
120 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
121 # libsocket.so which has a bad implementation of gethostbyname (it
122 # only looks in /etc/hosts), so we only look for -lsocket if we need
123 # it.
124 AC_CHECK_FUNCS(connect)
125 if test x"$ac_cv_func_connect" = x"no"; then
126     case "$LIBS" in
127     *-lnsl*) ;;
128     *) AC_CHECK_LIB(nsl_s, printf) ;;
129     esac
130     case "$LIBS" in
131     *-lnsl*) ;;
132     *) AC_CHECK_LIB(nsl, printf) ;;
133     esac
134     case "$LIBS" in
135     *-lsocket*) ;;
136     *) AC_CHECK_LIB(socket, connect) ;;
137     esac
138     case "$LIBS" in
139     *-linet*) ;;
140     *) AC_CHECK_LIB(inet, connect) ;;
141     esac
142     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
143     dnl has been cached.
144     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
145        test x"$ac_cv_lib_inet_connect" = x"yes"; then
146         # ac_cv_func_connect=yes
147         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
148         AC_DEFINE(HAVE_CONNECT)
149     fi
150 fi
151
152
153 AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot)
154 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
155 AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid)
156 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
157 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
158 AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64)
159 AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64)
160 AC_CHECK_FUNCS(fseek64 ftell64 bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
161
162 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
163 AC_TRY_RUN([#include <stdio.h>
164 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
165 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
166 if test x"$samba_cv_have_longlong" = x"yes"; then
167     AC_DEFINE(HAVE_LONGLONG)
168 fi
169
170 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
171 AC_TRY_RUN([#include <stdio.h>
172 #include <sys/stat.h>
173 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
174 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
175 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
176     AC_DEFINE(SIZEOF_OFF_T,8)
177 fi
178
179 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
180 AC_TRY_RUN([#include <stdio.h>
181 #include <sys/stat.h>
182 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
183 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
184 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
185     AC_DEFINE(HAVE_OFF64_T)
186 fi
187
188 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
189 AC_TRY_RUN([#include <stdio.h>
190 #include <sys/stat.h>
191 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
192 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
193 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
194     AC_DEFINE(SIZEOF_INO_T,8)
195 fi
196
197 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
198 AC_TRY_RUN([#include <stdio.h>
199 #include <sys/stat.h>
200 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
201 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
202 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
203     AC_DEFINE(HAVE_INO64_T)
204 fi
205
206 AC_CACHE_CHECK([for union semun],samba_cv_HAVE_UNION_SEMUN,[
207 AC_TRY_RUN([
208 #include <sys/types.h>
209 #include <sys/ipc.h>
210 #include <sys/sem.h>
211 main() { union semun ss; exit(0); }],
212 samba_cv_HAVE_UNION_SEMUN=yes,samba_cv_HAVE_UNION_SEMUN=no,samba_cv_HAVE_UNION_SEMUN=cross)])
213 if test x"$samba_cv_HAVE_UNION_SEMUN" = x"yes"; then
214     AC_DEFINE(HAVE_UNION_SEMUN)
215 fi
216
217 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
218 AC_TRY_RUN([#include <stdio.h>
219 main() { char c; c=250; exit((c > 0)?0:1); }],
220 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
221 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
222     AC_DEFINE(HAVE_UNSIGNED_CHAR)
223 fi
224
225 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
226 AC_TRY_COMPILE([#include <sys/types.h>
227 #include <sys/socket.h>
228 #include <netinet/in.h>],
229 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
230 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
231 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
232     AC_DEFINE(HAVE_SOCK_SIN_LEN)
233 fi
234
235 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
236 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
237 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
238 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
239     AC_DEFINE(HAVE_FILE_MACRO)
240 fi
241
242 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
243 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
244 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
245 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
246     AC_DEFINE(HAVE_FUNCTION_MACRO)
247 fi
248
249 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
250 AC_TRY_RUN([
251 #include <sys/time.h>
252 #include <unistd.h>
253 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
254            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
255 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
256     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
257 fi
258
259
260 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
261 AC_TRY_RUN([#include <sys/types.h>
262 #include <dirent.h>
263 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
264 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
265 di->d_name[0] == 0) exit(0); exit(1);} ],
266 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
267 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
268     AC_DEFINE(HAVE_BROKEN_READDIR)
269 fi
270
271 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
272 AC_TRY_COMPILE([#include <sys/types.h>
273 #include <utime.h>],
274 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
275 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
276 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
277     AC_DEFINE(HAVE_UTIMBUF)
278 fi
279
280
281 AC_MSG_CHECKING([for test routines])
282 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
283            AC_MSG_RESULT(yes),
284            AC_MSG_ERROR([cant find test code. Aborting config]),
285            AC_MSG_WARN([cannot run when cross-compiling]))
286
287 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
288 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
289            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
290 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
291     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
292 fi
293
294 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
295 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
296            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
297 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
298     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
299 fi
300
301 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
302 SAVE_CPPFLAGS="$CPPFLAGS"
303 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/include -I${srcdir-.}/ubiqx"
304 AC_TRY_COMPILE([
305 #define REPLACE_GETPASS 1
306 #define NO_CONFIG_H 1
307 #define main dont_declare_main
308 #include "${srcdir-.}/lib/getsmbpass.c"
309 #undef main
310 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
311 CPPFLAGS="$SAVE_CPPFLAGS"
312 ])
313 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
314         AC_DEFINE(REPLACE_GETPASS)
315 fi
316
317 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
318 AC_TRY_RUN([
319 #include <stdio.h>
320 #include <sys/types.h>
321 #include <netinet/in.h>
322 #include <arpa/inet.h>
323 main() { struct in_addr ip; ip.s_addr = 0x12345678;
324 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
325     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
326 exit(1);}],
327            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
328 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
329     AC_DEFINE(REPLACE_INET_NTOA)
330 fi
331
332 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
333 AC_TRY_RUN([main() { exit(getuid() != 0); }],
334            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
335 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
336     AC_DEFINE(HAVE_ROOT)
337 else
338     AC_MSG_WARN(running as non-root will disable some tests)
339 fi
340
341 netmask=no;
342 AC_CACHE_CHECK([for netmask ifconf],samba_cv_HAVE_NETMASK_IFCONF,[
343 AC_TRY_RUN([
344 #define HAVE_NETMASK_IFCONF 1
345 #define AUTOCONF 1
346 #include "${srcdir-.}/lib/netmask.c"],
347            samba_cv_HAVE_NETMASK_IFCONF=yes,samba_cv_HAVE_NETMASK_IFCONF=no,samba_cv_HAVE_NETMASK_IFCONF=cross)])
348 if test x"$samba_cv_HAVE_NETMASK_IFCONF" = x"yes"; then
349     netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF)
350 fi
351
352 if test $netmask = no; then
353 AC_CACHE_CHECK([for netmask ifreq],samba_cv_HAVE_NETMASK_IFREQ,[
354 AC_TRY_RUN([
355 #define HAVE_NETMASK_IFREQ 1
356 #define AUTOCONF 1
357 #include "${srcdir-.}/lib/netmask.c"],
358            samba_cv_HAVE_NETMASK_IFREQ=yes,samba_cv_HAVE_NETMASK_IFREQ=no,samba_cv_HAVE_NETMASK_IFREQ=cross)])
359 if test x"$samba_cv_HAVE_NETMASK_IFREQ" = x"yes"; then
360     netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ)
361 fi
362 fi
363
364 if test $netmask = no; then
365 AC_CACHE_CHECK([for netmask AIX],samba_cv_HAVE_NETMASK_AIX,[
366 AC_TRY_RUN([
367 #define HAVE_NETMASK_AIX 1
368 #define AUTOCONF 1
369 #include "${srcdir-.}/lib/netmask.c"],
370            samba_cv_HAVE_NETMASK_AIX=yes,samba_cv_HAVE_NETMASK_AIX=no,samba_cv_HAVE_NETMASK_AIX=cross)])
371 if test x"$samba_cv_HAVE_NETMASK_AIX" = x"yes"; then
372     netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX)
373 fi
374 fi
375
376 AC_CACHE_CHECK([for trapdoor seteuid],samba_cv_HAVE_TRAPDOOR_UID,[
377 AC_TRY_RUN([#include "${srcdir-.}/tests/trapdoor.c"],
378            samba_cv_HAVE_TRAPDOOR_UID=no,samba_cv_HAVE_TRAPDOOR_UID=yes,:)])
379 if test x"$samba_cv_HAVE_TRAPDOOR_UID" = x"yes"; then
380     AC_DEFINE(HAVE_TRAPDOOR_UID)
381 fi
382
383 AC_CACHE_CHECK([for shared mmap],samba_cv_HAVE_SHARED_MMAP,[
384 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
385            samba_cv_HAVE_SHARED_MMAP=yes,samba_cv_HAVE_SHARED_MMAP=no,samba_cv_HAVE_SHARED_MMAP=cross)])
386 if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
387     AC_DEFINE(HAVE_SHARED_MMAP)
388 fi
389
390 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
391 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
392            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
393 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
394     AC_DEFINE(HAVE_FCNTL_LOCK)
395 fi
396
397 AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
398 AC_TRY_RUN([
399 #include <stdio.h>
400 #include <stdlib.h>
401
402 #ifdef HAVE_FCNTL_H
403 #include <fcntl.h>
404 #endif
405
406 #ifdef HAVE_SYS_FCNTL_H
407 #include <sys/fcntl.h>
408 #endif
409 main() { struct flock64 fl64;
410 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
411 exit(0);
412 #else
413 exit(1);
414 #endif
415 }],
416        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
417 if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
418     AC_DEFINE(HAVE_STRUCT_FLOCK64)
419 fi
420
421 AC_CACHE_CHECK([for sysv ipc],samba_cv_HAVE_SYSV_IPC,[
422 AC_TRY_RUN([#include "${srcdir-.}/tests/sysv_ipc.c"],
423            samba_cv_HAVE_SYSV_IPC=yes,samba_cv_HAVE_SYSV_IPC=no,samba_cv_HAVE_SYSV_IPC=cross)])
424 if test x"$samba_cv_HAVE_SYSV_IPC" = x"yes"; then
425     AC_DEFINE(HAVE_SYSV_IPC)
426 fi
427
428 #################################################
429 # check for the AFS filesystem
430 AC_MSG_CHECKING(whether to use AFS)
431 AC_ARG_WITH(afs,
432 [  --with-afs     Include AFS support
433   --without-afs  Don't include AFS support (default)],
434 [ case "$withval" in
435   yes)
436     AC_MSG_RESULT(yes)
437     AC_DEFINE(WITH_AFS)
438     ;;
439   *)
440     AC_MSG_RESULT(no)
441     ;;
442   esac ],
443   AC_MSG_RESULT(no)
444 )
445
446
447 #################################################
448 # check for the DFS auth system
449 AC_MSG_CHECKING(whether to use DFS auth)
450 AC_ARG_WITH(dfs,
451 [  --with-dfs     Include DFS support
452   --without-dfs  Don't include DFS support (default)],
453 [ case "$withval" in
454   yes)
455     AC_MSG_RESULT(yes)
456     AC_DEFINE(WITH_DFS)
457     ;;
458   *)
459     AC_MSG_RESULT(no)
460     ;;
461   esac ],
462   AC_MSG_RESULT(no)
463 )
464
465 #################################################
466 # check for automount support
467 AC_MSG_CHECKING(whether to use AUTOMOUNT)
468 AC_ARG_WITH(automount,
469 [  --with-automount     Include AUTOMOUNT support
470   --without-automount  Don't include AUTOMOUNT support (default)],
471 [ case "$withval" in
472   yes)
473     AC_MSG_RESULT(yes)
474     AC_DEFINE(WITH_AUTOMOUNT)
475     ;;
476   *)
477     AC_MSG_RESULT(no)
478     ;;
479   esac ],
480   AC_MSG_RESULT(no)
481 )
482
483 #################################################
484 # check for a LDAP password database
485 AC_MSG_CHECKING(whether to use LDAP password database)
486 AC_ARG_WITH(ldap,
487 [  --with-ldap     Include LDAP support
488   --without-ldap  Don't include LDAP support (default)],
489 [ case "$withval" in
490   yes)
491     AC_MSG_RESULT(yes)
492     AC_DEFINE(WITH_LDAP)
493     ;;
494   *)
495     AC_MSG_RESULT(no)
496     ;;
497   esac ],
498   AC_MSG_RESULT(no)
499 )
500
501 #################################################
502 # check for a NISPLUS password database
503 AC_MSG_CHECKING(whether to use NISPLUS password database)
504 AC_ARG_WITH(nisplus,
505 [  --with-nisplus     Include NISPLUS password database support
506   --without-nisplus  Don't include NISPLUS password database support (default)],
507 [ case "$withval" in
508   yes)
509     AC_MSG_RESULT(yes)
510     AC_DEFINE(WITH_NISPLUS)
511     ;;
512   *)
513     AC_MSG_RESULT(no)
514     ;;
515   esac ],
516   AC_MSG_RESULT(no)
517 )
518
519 #################################################
520 # check for a NISPLUS_HOME support 
521 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
522 AC_ARG_WITH(nisplus-home,
523 [  --with-nisplus-home     Include NISPLUS_HOME support
524   --without-nisplus-home  Don't include NISPLUS_HOME support (default)],
525 [ case "$withval" in
526   yes)
527     AC_MSG_RESULT(yes)
528     AC_DEFINE(WITH_NISPLUS_HOME)
529     ;;
530   *)
531     AC_MSG_RESULT(no)
532     ;;
533   esac ],
534   AC_MSG_RESULT(no)
535 )
536
537 #################################################
538 # check for the secure socket layer
539 AC_MSG_CHECKING(whether to use SSL)
540 AC_ARG_WITH(ssl,
541 [  --with-ssl     Include SSL support
542   --without-ssl  Don't include SSL support (default)],
543 [ case "$withval" in
544   yes)
545     AC_MSG_RESULT(yes)
546     AC_DEFINE(WITH_SSL)
547     ;;
548   *)
549     AC_MSG_RESULT(no)
550     ;;
551   esac ],
552   AC_MSG_RESULT(no)
553 )
554
555 #################################################
556 # check for experimental mmap support
557 AC_MSG_CHECKING(whether to use MMAP)
558 AC_ARG_WITH(mmap,
559 [  --with-mmap     Include experimental MMAP support
560   --without-mmap  Don't include MMAP support (default)],
561 [ case "$withval" in
562   yes)
563     AC_MSG_RESULT(yes)
564     AC_DEFINE(WITH_MMAP)
565     ;;
566   *)
567     AC_MSG_RESULT(no)
568     ;;
569   esac ],
570   AC_MSG_RESULT(no)
571 )
572
573 #################################################
574 # check for syslog logging
575 AC_MSG_CHECKING(whether to use syslog logging)
576 AC_ARG_WITH(syslog,
577 [  --with-syslog     Include experimental SYSLOG support
578   --without-syslog  Don't include SYSLOG support (default)],
579 [ case "$withval" in
580   yes)
581     AC_MSG_RESULT(yes)
582     AC_DEFINE(WITH_SYSLOG)
583     ;;
584   *)
585     AC_MSG_RESULT(no)
586     ;;
587   esac ],
588   AC_MSG_RESULT(no)
589 )
590
591 #################################################
592 # check for experimental netatalk resource fork support
593 AC_MSG_CHECKING(whether to support netatalk)
594 AC_ARG_WITH(netatalk,
595 [  --with-netatalk     Include experimental Netatalk support
596   --without-netatalk  Don't include experimental Netatalk support (default)],
597 [ case "$withval" in
598   yes)
599     AC_MSG_RESULT(yes)
600     AC_DEFINE(WITH_NETATALK)
601     ;;
602   *)
603     AC_MSG_RESULT(no)
604     ;;
605   esac ],
606   AC_MSG_RESULT(no)
607 )
608
609
610 #################################################
611 # these tests are taken from the GNU fileutils package
612 AC_CHECKING(how to get filesystem space usage)
613 space=no
614
615 # Test for statvfs64.
616 if test $space = no; then
617   # SVR4
618   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
619   [AC_TRY_RUN([
620 #include <sys/types.h>
621 #include <sys/statvfs.h>
622   main ()
623   {
624     struct statvfs64 fsd;
625     exit (statfs64 (".", &fsd));
626   }],
627   fu_cv_sys_stat_statvfs64=yes,
628   fu_cv_sys_stat_statvfs64=no,
629   fu_cv_sys_stat_statvfs64=cross)])
630   if test $fu_cv_sys_stat_statvfs64 = yes; then
631     space=yes
632     AC_DEFINE(STAT_STATVFS64)
633   fi
634 fi
635
636 # Perform only the link test since it seems there are no variants of the
637 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
638 # because that got a false positive on SCO OSR5.  Adding the declaration
639 # of a `struct statvfs' causes this test to fail (as it should) on such
640 # systems.  That system is reported to work fine with STAT_STATFS4 which
641 # is what it gets when this test fails.
642 if test $space = no; then
643   # SVR4
644   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
645                  [AC_TRY_LINK([#include <sys/types.h>
646 #include <sys/statvfs.h>],
647                               [struct statvfs fsd; statvfs (0, &fsd);],
648                               fu_cv_sys_stat_statvfs=yes,
649                               fu_cv_sys_stat_statvfs=no)])
650   if test $fu_cv_sys_stat_statvfs = yes; then
651     space=yes
652     AC_DEFINE(STAT_STATVFS)
653   fi
654 fi
655
656 if test $space = no; then
657   # DEC Alpha running OSF/1
658   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
659   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
660   [AC_TRY_RUN([
661 #include <sys/param.h>
662 #include <sys/types.h>
663 #include <sys/mount.h>
664   main ()
665   {
666     struct statfs fsd;
667     fsd.f_fsize = 0;
668     exit (statfs (".", &fsd, sizeof (struct statfs)));
669   }],
670   fu_cv_sys_stat_statfs3_osf1=yes,
671   fu_cv_sys_stat_statfs3_osf1=no,
672   fu_cv_sys_stat_statfs3_osf1=no)])
673   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
674   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
675     space=yes
676     AC_DEFINE(STAT_STATFS3_OSF1)
677   fi
678 fi
679
680 if test $space = no; then
681 # AIX
682   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
683 member (AIX, 4.3BSD)])
684   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
685   [AC_TRY_RUN([
686 #ifdef HAVE_SYS_PARAM_H
687 #include <sys/param.h>
688 #endif
689 #ifdef HAVE_SYS_MOUNT_H
690 #include <sys/mount.h>
691 #endif
692 #ifdef HAVE_SYS_VFS_H
693 #include <sys/vfs.h>
694 #endif
695   main ()
696   {
697   struct statfs fsd;
698   fsd.f_bsize = 0;
699   exit (statfs (".", &fsd));
700   }],
701   fu_cv_sys_stat_statfs2_bsize=yes,
702   fu_cv_sys_stat_statfs2_bsize=no,
703   fu_cv_sys_stat_statfs2_bsize=no)])
704   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
705   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
706     space=yes
707     AC_DEFINE(STAT_STATFS2_BSIZE)
708   fi
709 fi
710
711 if test $space = no; then
712 # SVR3
713   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
714   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
715   [AC_TRY_RUN([#include <sys/types.h>
716 #include <sys/statfs.h>
717   main ()
718   {
719   struct statfs fsd;
720   exit (statfs (".", &fsd, sizeof fsd, 0));
721   }],
722     fu_cv_sys_stat_statfs4=yes,
723     fu_cv_sys_stat_statfs4=no,
724     fu_cv_sys_stat_statfs4=no)])
725   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
726   if test $fu_cv_sys_stat_statfs4 = yes; then
727     space=yes
728     AC_DEFINE(STAT_STATFS4)
729   fi
730 fi
731
732 if test $space = no; then
733 # 4.4BSD and NetBSD
734   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
735 member (4.4BSD and NetBSD)])
736   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
737   [AC_TRY_RUN([#include <sys/types.h>
738 #ifdef HAVE_SYS_PARAM_H
739 #include <sys/param.h>
740 #endif
741 #ifdef HAVE_SYS_MOUNT_H
742 #include <sys/mount.h>
743 #endif
744   main ()
745   {
746   struct statfs fsd;
747   fsd.f_fsize = 0;
748   exit (statfs (".", &fsd));
749   }],
750   fu_cv_sys_stat_statfs2_fsize=yes,
751   fu_cv_sys_stat_statfs2_fsize=no,
752   fu_cv_sys_stat_statfs2_fsize=no)])
753   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
754   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
755     space=yes
756     AC_DEFINE(STAT_STATFS2_FSIZE)
757   fi
758 fi
759
760 if test $space = no; then
761   # Ultrix
762   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
763   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
764   [AC_TRY_RUN([#include <sys/types.h>
765 #ifdef HAVE_SYS_PARAM_H
766 #include <sys/param.h>
767 #endif
768 #ifdef HAVE_SYS_MOUNT_H
769 #include <sys/mount.h>
770 #endif
771 #ifdef HAVE_SYS_FS_TYPES_H
772 #include <sys/fs_types.h>
773 #endif
774   main ()
775   {
776   struct fs_data fsd;
777   /* Ultrix's statfs returns 1 for success,
778      0 for not mounted, -1 for failure.  */
779   exit (statfs (".", &fsd) != 1);
780   }],
781   fu_cv_sys_stat_fs_data=yes,
782   fu_cv_sys_stat_fs_data=no,
783   fu_cv_sys_stat_fs_data=no)])
784   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
785   if test $fu_cv_sys_stat_fs_data = yes; then
786     space=yes
787     AC_DEFINE(STAT_STATFS2_FS_DATA)
788   fi
789 fi
790
791 echo "checking configure summary"
792 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
793            echo "configure OK";,
794            AC_MSG_ERROR([summary failure. Aborting config]),:)
795
796
797 AC_OUTPUT(Makefile tests/dummy client/dummy lib/dummy ubiqx/dummy
798 web/dummy param/dummy nmbd/dummy smbd/dummy rpc_server/dummy
799 rpc_client/dummy rpc_parse/dummy locking/dummy passdb/dummy
800 script/dummy include/dummy codepages/dummy libsmb/dummy bin/dummy
801 utils/dummy printing/dummy include/stamp-h)