Spelling fix.
[ira/wip.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 # we want to be compatible with older versions of Samba
5 AC_PREFIX_DEFAULT(/usr/local/samba)
6
7 dnl Unique-to-Samba variables we'll be playing with.
8 AC_SUBST(SHELL)
9 AC_SUBST(RUNPROG)
10 AC_SUBST(MPROGS)
11 AC_SUBST(LDSHFLAGS)
12 AC_SUBST(SHLD)
13 AC_SUBST(HOST_OS)
14 AC_SUBST(PAM_MOD)
15 AC_SUBST(WRAP)
16 AC_SUBST(WRAP32)
17 AC_SUBST(PICFLAG)
18 AC_SUBST(PICSUFFIX)
19 AC_SUBST(POBAD_CC)
20 AC_SUBST(SHLIBEXT)
21 AC_SUBST(LIBSMBCLIENT_SHARED)
22
23 # compile with optimisation and without debugging by default
24 CFLAGS="-O ${CFLAGS}"
25
26 AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]],
27     [if eval "test x$enable_debug = xyes"; then
28         CFLAGS="${CFLAGS} -g"
29     fi])
30
31 AC_ARG_ENABLE(developer, [  --enable-developer      turn on developer warnings and debugging [default=no]],
32     [if eval "test x$enable_developer = xyes"; then
33         CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
34     fi])
35
36 AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc          enable heap debugging [default=no]])
37
38 if test "x$enable_dmalloc" = xyes
39 then
40         AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
41         LIBS="$LIBS -ldmalloc"  
42 fi
43
44 dnl Checks for programs.
45 AC_PROG_CC
46 AC_PROG_INSTALL
47 AC_PROG_AWK
48
49 dnl needed before AC_TRY_COMPILE
50 AC_ISC_POSIX
51
52 dnl Check if C compiler understands -c and -o at the same time
53 AC_PROG_CC_C_O
54 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
55       BROKEN_CC=
56 else
57       BROKEN_CC=#
58 fi
59 AC_SUBST(BROKEN_CC)
60
61 dnl Check if the C compiler understands volatile (it should, being ANSI).
62 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
63     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
64         samba_cv_volatile=yes,samba_cv_volatile=no)])
65 if test x"$samba_cv_volatile" = x"yes"; then
66    AC_DEFINE(HAVE_VOLATILE)
67 fi
68
69
70 AC_CANONICAL_SYSTEM
71
72 dnl Add #include for broken IRIX header files
73   case "$host_os" in
74         *irix6*) AC_ADD_INCLUDE(<standards.h>)
75         ;;
76 esac
77
78 AC_VALIDATE_CACHE_SYSTEM_TYPE
79
80 #
81 # Config CPPFLAG settings for strange OS's that must be set
82 # before other tests.
83 #
84 case "$host_os" in
85 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
86     *hpux*)
87       AC_PROG_CC_FLAG(Ae)
88       # mmap on HPUX is completely broken...
89       AC_DEFINE(MMAP_BLACKLIST)
90       if test $ac_cv_prog_cc_Ae = yes; then
91         CPPFLAGS="$CPPFLAGS -Ae"
92       fi
93 #
94 # Defines needed for HPUX support.
95 # HPUX has bigcrypt but (sometimes?) doesn't use it for
96 # password hashing - hence the USE_BOTH_CRYPT_CALLS define.
97 #
98       case `uname -r` in
99                         *9*|*10*)
100                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE"
101                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
102                                 ;;
103                         *11*)
104                                 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE"
105                                 AC_DEFINE(USE_BOTH_CRYPT_CALLS)
106                                 ;;
107       esac
108       ;;
109
110 #
111 # CRAY Unicos has broken const handling
112        *unicos*)
113           AC_MSG_RESULT([disabling const])
114           CPPFLAGS="$CPPFLAGS -Dconst="
115           ;;
116         
117 #
118 # AIX4.x doesn't even admit to having large
119 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
120 #
121     *aix4*)
122           AC_MSG_RESULT([enabling large file support])
123       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
124       ;;    
125 #
126 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
127 # to the existance of large files..
128 # Note that -D_LARGEFILE64_SOURCE is different from the Sun
129 # recommendations on large file support, however it makes the
130 # compile work using gcc 2.7 and 2.8, whereas using the Sun
131 # recommendation makes the compile fail on gcc2.7. JRA.
132 #
133         *solaris*)
134                 case `uname -r` in
135                         5.0*|5.1*|5.2*|5.3*|5.5*)
136                                 AC_MSG_RESULT([no large file support])
137                                 ;;
138                         5.*)
139                         AC_MSG_RESULT([enabling large file support])
140                         if test "$ac_cv_prog_gcc" = yes; then
141                                 ${CC-cc} -v >conftest.c 2>&1
142                                 ac_cv_gcc_compiler_version_number=`grep 'gcc version' conftest.c`
143                                 rm -fr conftest.c
144                                 case "$ac_cv_gcc_compiler_version_number" in
145                                         *"gcc version 2.6"*|*"gcc version 2.7"*)
146                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
147                                                 ;;
148                                         *)
149                                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
150                                                 ;;
151                                 esac
152                         else
153                                 CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
154                         fi
155                         ;;
156                 esac
157                 ;;
158 #
159 # Tests needed for SINIX large file support.
160 #
161     *sysv4*)
162       if test $host = mips-sni-sysv4 ; then
163         AC_MSG_CHECKING([for LFS support])
164         old_CPPFLAGS="$CPPFLAGS"
165         CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
166         AC_TRY_RUN([
167 #include <unistd.h>
168 main () {
169 #if _LFS64_LARGEFILE == 1
170 exit(0);
171 #else
172 exit(1);
173 #endif
174 }], [SINIX_LFS_SUPPORT=yes], [SINIX_LFS_SUPPORT=no], [SINIX_LFS_SUPPORT=cross])
175         CPPFLAGS="$old_CPPFLAGS"
176         if test x$SINIX_LFS_SUPPORT = xyes ; then
177           CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
178           CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
179           LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
180           LIBS="`getconf LFS64_LIBS` $LIBS"
181         fi
182       AC_MSG_RESULT([$SINIX_LFS_SUPPORT])
183       fi
184     ;;
185
186 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
187 #
188     *linux*)
189         AC_MSG_CHECKING([for LFS support])
190         old_CPPFLAGS="$CPPFLAGS"
191         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
192        AC_TRY_RUN([
193 #include <unistd.h>
194 #include <sys/utsname.h>
195 main() {
196 #if _LFS64_LARGEFILE == 1
197        struct utsname uts;
198        char *release;
199        int major, minor;
200
201        /* Ensure this is glibc 2.2 or higher */
202 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
203        int libc_major = __GLIBC__;
204        int libc_minor = __GLIBC_MINOR__;
205
206        if (libc_major < 2)
207               exit(1);
208        if (libc_minor < 2)
209               exit(1);
210 #endif
211
212        /* Ensure this is kernel 2.4 or higher */
213
214        uname(&uts);
215        release = uts.release;
216        major = atoi(strsep(&release, "."));
217        minor = atoi(strsep(&release, "."));
218
219        if (major > 2 || (major == 2 && minor > 3))
220                exit(0);
221        exit(1);
222 #else
223        exit(1);
224 #endif
225 }
226 ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross])
227         CPPFLAGS="$old_CPPFLAGS"
228         if test x$LINUX_LFS_SUPPORT = xyes ; then
229           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
230         fi
231        AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
232                 ;;
233
234     *hurd*)
235         AC_MSG_CHECKING([for LFS support])
236         old_CPPFLAGS="$CPPFLAGS"
237         CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
238         AC_TRY_RUN([
239 #include <unistd.h>
240 main () {
241 #if _LFS64_LARGEFILE == 1
242 exit(0);
243 #else
244 exit(1);
245 #endif
246 }], [GLIBC_LFS_SUPPORT=yes], [GLIBC_LFS_SUPPORT=no], [GLIBC_LFS_SUPPORT=cross])
247         CPPFLAGS="$old_CPPFLAGS"
248         if test x$GLIBC_LFS_SUPPORT = xyes ; then
249           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
250         fi
251       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
252     ;;
253
254 esac
255
256 AC_INLINE
257 AC_HEADER_STDC
258 AC_HEADER_DIRENT
259 AC_HEADER_TIME
260 AC_HEADER_SYS_WAIT
261 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
262 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
263 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
264 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
265 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
266 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
267 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
268 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h lber.h)
269
270 #
271 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
272 # This causes configure to fail to detect it. Check for shadow separately on HPUX.
273 #
274 case "$host_os" in
275     *hpux*)
276                 AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
277                         ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
278                 if test x"$ac_cv_header_shadow_h" = x"yes"; then
279                    AC_DEFINE(HAVE_SHADOW_H)
280                 fi
281         ;;
282 esac
283 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
284 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
285 AC_CHECK_HEADERS(stropts.h poll.h)
286 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
287 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
288
289 # For experimental utmp support (lastlog on some BSD-like systems)
290 AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
291  
292 # For quotas on Veritas VxFS filesystems
293 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
294
295 # For quotas on Linux XFS filesystems
296 AC_CHECK_HEADERS(linux/xqm.h)
297
298 AC_CHECK_SIZEOF(int,cross)
299 AC_CHECK_SIZEOF(long,cross)
300 AC_CHECK_SIZEOF(short,cross)
301
302 AC_C_CONST
303 AC_C_INLINE
304 AC_C_BIGENDIAN
305 AC_C_CHAR_UNSIGNED
306
307 AC_TYPE_SIGNAL
308 AC_TYPE_UID_T
309 AC_TYPE_MODE_T
310 AC_TYPE_OFF_T
311 AC_TYPE_SIZE_T
312 AC_TYPE_PID_T
313 AC_STRUCT_ST_RDEV
314 AC_DIRENT_D_OFF
315 AC_CHECK_TYPE(ino_t,unsigned)
316 AC_CHECK_TYPE(loff_t,off_t)
317 AC_CHECK_TYPE(offset_t,loff_t)
318 AC_CHECK_TYPE(ssize_t, int)
319 AC_CHECK_TYPE(wchar_t, unsigned short)
320
321 ############################################
322 # for cups support we need libcups, and a handful of header files
323
324 AC_CHECK_LIB(cups,httpConnect)
325
326 # I wonder if there is a nicer way of doing this?
327
328 if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
329         AC_CHECK_HEADERS(cups/cups.h cups/language.h)
330         if test x"$ac_cv_header_cups_cups_h" = x"yes"; then
331                 if test x"$ac_cv_header_cups_language_h" = x"yes"; then
332                         AC_DEFINE(HAVE_CUPS)
333                 fi
334         fi
335 fi
336
337 ############################################
338 # we need libdl for PAM and the new VFS code
339 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
340         AC_DEFINE(HAVE_LIBDL)])
341
342 ############################################
343 # check if the compiler can do immediate structures
344 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
345     AC_TRY_COMPILE([
346 #include <stdio.h>],
347 [
348    #define X_FOOBAR(x) ((FOOBAR) { x })
349    typedef struct {unsigned x;} FOOBAR;
350    FOOBAR f = X_FOOBAR(1);   
351 ],
352         samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
353 if test x"$samba_cv_immediate_structures" = x"yes"; then
354    AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
355 fi
356
357 ############################################
358 # check for unix domain sockets
359 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
360     AC_TRY_COMPILE([
361 #include <sys/types.h>
362 #include <stdlib.h>
363 #include <stddef.h>
364 #include <sys/socket.h>
365 #include <sys/un.h>],
366 [
367   struct sockaddr_un sunaddr; 
368   sunaddr.sun_family = AF_UNIX;
369 ],
370         samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
371 if test x"$samba_cv_unixsocket" = x"yes"; then
372    AC_DEFINE(HAVE_UNIXSOCKET)
373 fi
374
375
376 AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
377     AC_TRY_COMPILE([
378 #include <sys/types.h>
379 #if STDC_HEADERS
380 #include <stdlib.h>
381 #include <stddef.h>
382 #endif
383 #include <sys/socket.h>],[socklen_t i = 0],
384         samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
385 if test x"$samba_cv_socklen_t" = x"yes"; then
386    AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
387 fi
388
389 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
390     AC_TRY_COMPILE([
391 #include <sys/types.h>
392 #if STDC_HEADERS
393 #include <stdlib.h>
394 #include <stddef.h>
395 #endif
396 #include <signal.h>],[sig_atomic_t i = 0],
397         samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
398 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
399    AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
400 fi
401
402 # stupid headers have the functions but no declaration. grrrr.
403 AC_HAVE_DECL(errno, [#include <errno.h>])
404 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
405 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
406 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
407 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
408 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
409 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
410
411 # and glibc has setresuid under linux but the function does
412 # nothing until kernel 2.1.44! very dumb.
413 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
414     AC_TRY_RUN([#include <errno.h>
415 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
416         samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
417 if test x"$samba_cv_have_setresuid" = x"yes"; then
418     AC_DEFINE(HAVE_SETRESUID)
419 fi
420
421 # Do the same check for setresguid...
422 #
423 AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
424     AC_TRY_RUN([#include <unistd.h>
425 #include <errno.h>
426 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
427         samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
428 if test x"$samba_cv_have_setresgid" = x"yes"; then
429     AC_DEFINE(HAVE_SETRESGID)
430 fi
431
432 AC_FUNC_MEMCMP
433
434 ###############################################
435 # test for where we get crypt() from
436 AC_CHECK_FUNCS(crypt)
437 if test x"$ac_cv_func_crypt" = x"no"; then
438     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
439         AC_DEFINE(HAVE_CRYPT)])
440 fi
441
442
443 ###############################################
444 # Readline included by default unless explicitly asked not to
445 test "${with_readline+set}" != "set" && with_readline=yes
446
447 # test for where we get readline() from
448 AC_MSG_CHECKING(whether to use readline)
449 AC_ARG_WITH(readline,
450 [  --with-readline[=DIR]   Look for readline include/libs in DIR (default=auto) ],
451 [  case "$with_readline" in
452   yes)
453     AC_MSG_RESULT(yes)
454
455     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
456     AC_CHECK_HEADERS(readline/history.h)
457
458     AC_CHECK_HEADERS(readline.h readline/readline.h,[
459       for termlib in ncurses curses termcap terminfo termlib; do
460        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
461       done
462       AC_CHECK_LIB(readline, rl_callback_handler_install,
463        [TERMLIBS="-lreadline $TERMLIBS"
464        AC_DEFINE(HAVE_LIBREADLINE)
465        break], [TERMLIBS=], $TERMLIBS)])
466     ;;
467   no)
468     AC_MSG_RESULT(no)
469     ;;
470   *)
471     AC_MSG_RESULT(yes)
472
473     # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
474     # alternate readline path
475     _ldflags=${LDFLAGS}
476     _cppflags=${CPPFLAGS}
477
478     # Add additional search path
479     LDFLAGS="-L$with_readline/lib $LDFLAGS"
480     CPPFLAGS="-I$with_readline/include $CPPFLAGS"
481
482     AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
483     AC_CHECK_HEADERS(readline/history.h)
484
485     AC_CHECK_HEADERS(readline.h readline/readline.h,[
486       for termlib in ncurses curses termcap terminfo termlib; do
487        AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
488       done
489       AC_CHECK_LIB(readline, rl_callback_handler_install,
490        [TERMLDFLAGS="-L$with_readline/lib"
491        TERMCPPFLAGS="-I$with_readline/include"
492        CPPFLAGS="-I$with_readline/include $CPPFLAGS"
493        TERMLIBS="-lreadline $TERMLIBS"
494        AC_DEFINE(HAVE_LIBREADLINE)
495        break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
496
497     LDFLAGS=$_ldflags
498     ;;
499   esac],
500   AC_MSG_RESULT(no)
501 )
502 AC_SUBST(TERMLIBS)
503 AC_SUBST(TERMLDFLAGS)
504
505 # The readline API changed slightly from readline3 to readline4, so
506 # code will generate warnings on one of them unless we have a few
507 # special cases.
508 AC_CHECK_LIB(readline, rl_completion_matches,
509              [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1, 
510                         [Do we have rl_completion_matches?])],
511              [],
512              [$TERMLIBS])
513
514 # The following test taken from the cvs sources
515 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
516 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
517 # libsocket.so which has a bad implementation of gethostbyname (it
518 # only looks in /etc/hosts), so we only look for -lsocket if we need
519 # it.
520 AC_CHECK_FUNCS(connect)
521 if test x"$ac_cv_func_connect" = x"no"; then
522     case "$LIBS" in
523     *-lnsl*) ;;
524     *) AC_CHECK_LIB(nsl_s, printf) ;;
525     esac
526     case "$LIBS" in
527     *-lnsl*) ;;
528     *) AC_CHECK_LIB(nsl, printf) ;;
529     esac
530     case "$LIBS" in
531     *-lsocket*) ;;
532     *) AC_CHECK_LIB(socket, connect) ;;
533     esac
534     case "$LIBS" in
535     *-linet*) ;;
536     *) AC_CHECK_LIB(inet, connect) ;;
537     esac
538     dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
539     dnl has been cached.
540     if test x"$ac_cv_lib_socket_connect" = x"yes" || 
541        test x"$ac_cv_lib_inet_connect" = x"yes"; then
542         # ac_cv_func_connect=yes
543         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
544         AC_DEFINE(HAVE_CONNECT)
545     fi
546 fi
547
548 ###############################################
549 # test for where we get get_yp_default_domain() from
550 AC_CHECK_FUNCS(yp_get_default_domain)
551 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
552         AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
553         AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)]) 
554 fi
555
556 # Check if we have execl, if not we need to compile smbrun.
557 AC_CHECK_FUNCS(execl)
558 if test x"$ac_cv_func_execl" = x"no"; then
559     RUNPROG="bin/smbrun"
560 else
561     RUNPROG=""
562 fi
563
564 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
565 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
566 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
567 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
568 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
569 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
570 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
571 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
572 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
573 AC_CHECK_FUNCS(syslog vsyslog)
574 # setbuffer is needed for smbtorture
575 AC_CHECK_FUNCS(setbuffer)
576
577 # syscall() is needed for smbwrapper.
578 AC_CHECK_FUNCS(syscall)
579
580 AC_CHECK_FUNCS(_dup _dup2 _opendir _readdir _seekdir _telldir _closedir)
581 AC_CHECK_FUNCS(__dup __dup2 __opendir __readdir __seekdir __telldir __closedir)
582 AC_CHECK_FUNCS(__getcwd _getcwd)
583 AC_CHECK_FUNCS(__xstat __fxstat __lxstat)
584 AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat)
585 AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir)
586 AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl)
587 AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read)
588 AC_CHECK_FUNCS(_write __write _fork __fork)
589 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
590 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
591 AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
592 AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
593 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
594
595 #
596 # stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
597 #
598
599 if test x$ac_cv_func_stat64 = xno ; then
600   AC_MSG_CHECKING([for stat64 in <sys/stat.h>])
601   AC_TRY_LINK([
602 #if defined(HAVE_UNISTD_H)
603 #include <unistd.h>
604 #endif
605 #include <sys/stat.h>
606 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
607   AC_MSG_RESULT([$ac_cv_func_stat64])
608   if test x$ac_cv_func_stat64 = xyes ; then
609     AC_DEFINE(HAVE_STAT64)
610   fi
611 fi
612
613 if test x$ac_cv_func_lstat64 = xno ; then
614   AC_MSG_CHECKING([for lstat64 in <sys/stat.h>])
615   AC_TRY_LINK([
616 #if defined(HAVE_UNISTD_H)
617 #include <unistd.h>
618 #endif
619 #include <sys/stat.h>
620 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
621   AC_MSG_RESULT([$ac_cv_func_lstat64])
622   if test x$ac_cv_func_lstat64 = xyes ; then
623     AC_DEFINE(HAVE_LSTAT64)
624   fi
625 fi
626
627 if test x$ac_cv_func_fstat64 = xno ; then
628   AC_MSG_CHECKING([for fstat64 in <sys/stat.h>])
629   AC_TRY_LINK([
630 #if defined(HAVE_UNISTD_H)
631 #include <unistd.h>
632 #endif
633 #include <sys/stat.h>
634 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
635   AC_MSG_RESULT([$ac_cv_func_fstat64])
636   if test x$ac_cv_func_fstat64 = xyes ; then
637     AC_DEFINE(HAVE_FSTAT64)
638   fi
639 fi
640
641 #####################################
642 # we might need the resolv library on some systems
643 AC_CHECK_LIB(resolv, dn_expand)
644
645 #
646 # Check for the functions putprpwnam, set_auth_parameters,
647 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
648 # Needed for OSF1 and HPUX.
649 #
650
651 AC_LIBTESTFUNC(security, putprpwnam)
652 AC_LIBTESTFUNC(sec, putprpwnam)
653
654 AC_LIBTESTFUNC(security, set_auth_parameters)
655 AC_LIBTESTFUNC(sec, set_auth_parameters)
656
657 # UnixWare 7.x has its getspnam in -lgen
658 AC_LIBTESTFUNC(gen, getspnam)
659
660 AC_LIBTESTFUNC(security, getspnam)
661 AC_LIBTESTFUNC(sec, getspnam)
662
663 AC_LIBTESTFUNC(security, bigcrypt)
664 AC_LIBTESTFUNC(sec, bigcrypt)
665
666 AC_LIBTESTFUNC(security, getprpwnam)
667 AC_LIBTESTFUNC(sec, getprpwnam)
668
669 # this bit needs to be modified for each OS that is suported by
670 # smbwrapper. You need to specify how to created a shared library and
671 # how to compile C code to produce PIC object files
672
673 # these are the defaults, good for lots of systems
674 HOST_OS="$host_os"
675 LDSHFLAGS="-shared"
676 SHLD="\${CC}"
677 PICFLAG=""
678 PICSUFFIX="po"
679 POBAD_CC="#"
680 SHLIBEXT="so"
681 # Assume non-shared by default and override below
682 BLDSHARED="false"
683 AC_MSG_CHECKING([ability to build shared libraries])
684
685 # and these are for particular systems
686 case "$host_os" in
687                 *linux*)   AC_DEFINE(LINUX)
688                         BLDSHARED="true"
689                         LDSHFLAGS="-shared" 
690                         PICFLAG="-fPIC"
691                 ;;
692                 *solaris*) AC_DEFINE(SUNOS5)
693                         BLDSHARED="true"
694                         LDSHFLAGS="-h \$@ -G"
695                         if test "${ac_cv_prog_CC}" = "gcc"; then
696                                 PICFLAG="-fPIC"
697                         else
698                                 PICFLAG="-KPIC"
699                                 POBAD_CC=""
700                                 PICSUFFIX="po.o"
701                         fi
702                 ;;
703                 *sunos*) AC_DEFINE(SUNOS4)
704                         BLDSHARED="true"
705                         LDSHFLAGS="-Wl,-h,\$@ -G"
706                         PICFLAG="-KPIC"   # Is this correct for SunOS
707                 ;;
708                 *bsd*)  BLDSHARED="true"
709                         LDSHFLAGS="-Wl,-soname,\$@ -shared"
710                         PICFLAG="-fPIC"
711                 ;;
712                 *irix*) AC_DEFINE(IRIX)
713                         case "$host_os" in
714                         *irix6*) AC_DEFINE(IRIX6)
715                         ;;
716                         esac
717                         ATTEMPT_WRAP32_BUILD=yes
718                         BLDSHARED="true"
719                         LDSHFLAGS="-Wl,-soname,\$@ -shared"
720                         if test "${ac_cv_prog_CC}" = "gcc"; then
721                                 PICFLAG="-fPIC"
722                         else 
723                                 PICFLAG="-KPIC"
724                         fi
725                 ;;
726                 *aix*) AC_DEFINE(AIX)
727                         BLDSHARED="true"
728                         LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
729                         PICFLAG="-O2 -qmaxmem=6000"
730                 ;;
731                 *hpux*) AC_DEFINE(HPUX)
732                         SHLIBEXT="sl"
733                         # Use special PIC flags for the native HP-UX compiler.
734                         if test $ac_cv_prog_cc_Ae = yes; then
735                                 #BLDSHARED="true"
736                                 LDSHFLAGS="-b -z +h \$@"
737                                 PICFLAG="+z"
738                         fi
739                 ;;
740                 *qnx*) AC_DEFINE(QNX);;
741                 *osf*) AC_DEFINE(OSF1)
742                         BLDSHARED="true"
743                         LDSHFLAGS="-Wl,-soname,\$@ -shared"
744                         PICFLAG="-fPIC"
745                 ;;
746                 *sco*) AC_DEFINE(SCO);;
747                 *unixware*) AC_DEFINE(UNIXWARE)
748                         BLDSHARED="true"
749                         LDSHFLAGS="-Wl,-soname,\$@ -shared"
750                         PICFLAG="-KPIC"
751                 ;;
752                 *next2*) AC_DEFINE(NEXT2);;
753                 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
754                 *sysv4*)
755                         case "$host" in
756                                 *-univel-*)     if [ test "$GCC" != yes ]; then
757                                                                         AC_DEFINE(HAVE_MEMSET)
758                                                                 fi
759                                                                 LDSHFLAGS="-G"
760                                 ;;
761                                 *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX);;
762                         esac
763                         ;;
764                 *sysv5*)
765                         if [ test "$GCC" != yes ]; then
766                                 AC_DEFINE(HAVE_MEMSET)
767                         fi
768                         LDSHFLAGS="-G"
769                         ;;
770 esac
771 AC_MSG_RESULT($BLDSHARED)
772 AC_MSG_CHECKING([linker flags for shared libraries])
773 AC_MSG_RESULT([$LDSHFLAGS])
774 AC_MSG_CHECKING([compiler flags for position-independent code])
775 AC_MSG_RESULT([$PICFLAGS])
776
777 #######################################################
778 # test whether building a shared library actually works
779 if test $BLDSHARED = true; then
780 AC_CACHE_CHECK([whether building shared libraries actually works], 
781                [ac_cv_shlib_works],[
782    ac_cv_shlib_works=no
783    # try building a trivial shared library
784    $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c &&
785      $CC $LDSHFLAGS -o shlib.so shlib.po &&
786      ac_cv_shlib_works=yes
787    rm -f shlib.so shlib.po
788 ])
789 if test $ac_cv_shlib_works = no; then
790    BLDSHARED=false
791 fi
792 fi
793
794
795 # this updates our target list if we can build shared libs
796 if test $BLDSHARED = true; then
797    LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
798 else
799    LIBSMBCLIENT_SHARED=
800 fi
801
802 ################
803
804 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
805 AC_TRY_RUN([#include <stdio.h>
806 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
807 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
808 if test x"$samba_cv_have_longlong" = x"yes"; then
809     AC_DEFINE(HAVE_LONGLONG)
810 fi
811
812 #
813 # Check if the compiler supports the LL prefix on long long integers.
814 # AIX needs this.
815
816 AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_ll, [
817     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
818         samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
819 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
820    AC_DEFINE(COMPILER_SUPPORTS_LL)
821 fi
822
823   
824 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
825 AC_TRY_RUN([#include <stdio.h>
826 #include <sys/stat.h>
827 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
828 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
829 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
830     AC_DEFINE(SIZEOF_OFF_T,8)
831 fi
832
833 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
834 AC_TRY_RUN([
835 #if defined(HAVE_UNISTD_H)
836 #include <unistd.h>
837 #endif
838 #include <stdio.h>
839 #include <sys/stat.h>
840 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
841 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
842 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
843     AC_DEFINE(HAVE_OFF64_T)
844 fi
845
846 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
847 AC_TRY_RUN([#include <stdio.h>
848 #include <sys/stat.h>
849 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
850 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
851 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
852     AC_DEFINE(SIZEOF_INO_T,8)
853 fi
854
855 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
856 AC_TRY_RUN([
857 #if defined(HAVE_UNISTD_H)
858 #include <unistd.h>
859 #endif
860 #include <stdio.h>
861 #include <sys/stat.h>
862 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
863 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
864 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
865     AC_DEFINE(HAVE_INO64_T)
866 fi
867
868 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
869 AC_TRY_COMPILE([
870 #if defined(HAVE_UNISTD_H)
871 #include <unistd.h>
872 #endif
873 #include <sys/types.h>
874 #include <dirent.h>],
875 [struct dirent64 de;],
876 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
877 if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
878     AC_DEFINE(HAVE_STRUCT_DIRENT64)
879 fi
880
881 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
882 AC_TRY_RUN([#include <stdio.h>
883 main() { char c; c=250; exit((c > 0)?0:1); }],
884 samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
885 if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
886     AC_DEFINE(HAVE_UNSIGNED_CHAR)
887 fi
888
889 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
890 AC_TRY_COMPILE([#include <sys/types.h>
891 #include <sys/socket.h>
892 #include <netinet/in.h>],
893 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
894 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
895 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
896     AC_DEFINE(HAVE_SOCK_SIN_LEN)
897 fi
898
899 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
900 AC_TRY_COMPILE([#include <sys/types.h>
901 #include <dirent.h>
902 void seekdir(DIR *d, long loc) { return; }],[return 0;],
903 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
904 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
905     AC_DEFINE(SEEKDIR_RETURNS_VOID)
906 fi
907
908 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
909 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
910 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
911 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
912     AC_DEFINE(HAVE_FILE_MACRO)
913 fi
914
915 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
916 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
917 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
918 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
919     AC_DEFINE(HAVE_FUNCTION_MACRO)
920 fi
921
922 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
923 AC_TRY_RUN([
924 #include <sys/time.h>
925 #include <unistd.h>
926 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
927            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
928 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
929     AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
930 fi
931
932 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
933 AC_TRY_RUN([
934 #include <sys/types.h>
935 #include <stdarg.h>
936 void foo(const char *format, ...) { 
937        va_list ap;
938        int len;
939        char buf[5];
940
941        va_start(ap, format);
942        len = vsnprintf(0, 0, format, ap);
943        va_end(ap);
944        if (len != 5) exit(1);
945
946        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
947
948        exit(0);
949 }
950 main() { foo("hello"); }
951 ],
952 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
953 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
954     AC_DEFINE(HAVE_C99_VSNPRINTF)
955 fi
956
957 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
958 AC_TRY_RUN([#include <sys/types.h>
959 #include <dirent.h>
960 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
961 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
962 di->d_name[0] == 0) exit(0); exit(1);} ],
963 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
964 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
965     AC_DEFINE(HAVE_BROKEN_READDIR)
966 fi
967
968 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
969 AC_TRY_COMPILE([#include <sys/types.h>
970 #include <utime.h>],
971 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
972 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
973 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
974     AC_DEFINE(HAVE_UTIMBUF)
975 fi
976
977 dnl  utmp and utmpx come in many flavours
978 dnl  We need to check for many of them
979 dnl  But we don't need to do each and every one, because our code uses
980 dnl  mostly just the utmp (not utmpx) fields.
981
982 AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
983
984 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
985 AC_TRY_COMPILE([#include <sys/types.h>
986 #include <utmp.h>],
987 [struct utmp ut;  ut.ut_name[0] = 'a';],
988 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
989 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
990     AC_DEFINE(HAVE_UT_UT_NAME)
991 fi 
992
993 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
994 AC_TRY_COMPILE([#include <sys/types.h>
995 #include <utmp.h>],
996 [struct utmp ut;  ut.ut_user[0] = 'a';],
997 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
998 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
999     AC_DEFINE(HAVE_UT_UT_USER)
1000 fi 
1001
1002 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
1003 AC_TRY_COMPILE([#include <sys/types.h>
1004 #include <utmp.h>],
1005 [struct utmp ut;  ut.ut_id[0] = 'a';],
1006 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
1007 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
1008     AC_DEFINE(HAVE_UT_UT_ID)
1009 fi 
1010
1011 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
1012 AC_TRY_COMPILE([#include <sys/types.h>
1013 #include <utmp.h>],
1014 [struct utmp ut;  ut.ut_host[0] = 'a';],
1015 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
1016 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
1017     AC_DEFINE(HAVE_UT_UT_HOST)
1018 fi 
1019
1020 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
1021 AC_TRY_COMPILE([#include <sys/types.h>
1022 #include <utmp.h>],
1023 [struct utmp ut;  time_t t; ut.ut_time = t;],
1024 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
1025 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
1026     AC_DEFINE(HAVE_UT_UT_TIME)
1027 fi 
1028
1029 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
1030 AC_TRY_COMPILE([#include <sys/types.h>
1031 #include <utmp.h>],
1032 [struct utmp ut;  struct timeval tv; ut.ut_tv = tv;],
1033 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
1034 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
1035     AC_DEFINE(HAVE_UT_UT_TV)
1036 fi 
1037
1038 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
1039 AC_TRY_COMPILE([#include <sys/types.h>
1040 #include <utmp.h>],
1041 [struct utmp ut;  ut.ut_type = 0;],
1042 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
1043 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
1044     AC_DEFINE(HAVE_UT_UT_TYPE)
1045 fi 
1046
1047 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
1048 AC_TRY_COMPILE([#include <sys/types.h>
1049 #include <utmp.h>],
1050 [struct utmp ut;  ut.ut_pid = 0;],
1051 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
1052 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
1053     AC_DEFINE(HAVE_UT_UT_PID)
1054 fi 
1055
1056 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
1057 AC_TRY_COMPILE([#include <sys/types.h>
1058 #include <utmp.h>],
1059 [struct utmp ut;  ut.ut_exit.e_exit = 0;],
1060 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
1061 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
1062     AC_DEFINE(HAVE_UT_UT_EXIT)
1063 fi 
1064
1065 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
1066 AC_TRY_COMPILE([#include <sys/types.h>
1067 #include <utmp.h>],
1068 [struct utmp ut;  ut.ut_addr = 0;],
1069 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
1070 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
1071     AC_DEFINE(HAVE_UT_UT_ADDR)
1072 fi 
1073
1074 if test x$ac_cv_func_pututline = xyes ; then
1075   AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
1076   AC_TRY_COMPILE([#include <sys/types.h>
1077 #include <utmp.h>],
1078   [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
1079   samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
1080   if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
1081       AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
1082   fi
1083 fi
1084
1085 AC_CACHE_CHECK([for ut_syslen in utmpx],samba_cv_HAVE_UX_UT_SYSLEN,[
1086 AC_TRY_COMPILE([#include <sys/types.h>
1087 #include <utmpx.h>],
1088 [struct utmpx ux;  ux.ut_syslen = 0;],
1089 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
1090 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
1091     AC_DEFINE(HAVE_UX_UT_SYSLEN)
1092 fi 
1093
1094
1095 #################################################
1096 # check for libiconv support
1097 AC_MSG_CHECKING(whether to use libiconv)
1098 AC_ARG_WITH(libiconv,
1099 [  --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
1100 [ case "$withval" in
1101   no)
1102     AC_MSG_RESULT(no)
1103     ;;
1104   *)
1105     AC_MSG_RESULT(yes)
1106     CFLAGS="$CFLAGS -I$withval/include"
1107     LDFLAGS="$LDFLAGS -L$withval/lib"
1108     AC_CHECK_LIB(iconv, iconv_open)
1109     AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}")
1110     ;;
1111   esac ],
1112   AC_MSG_RESULT(no)
1113 )
1114
1115
1116 ############
1117 # check for iconv in libc
1118 AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
1119 AC_TRY_RUN([
1120 #include <iconv.h>
1121 main() {
1122        iconv_t cd = iconv_open("ASCII", "UCS-2LE");
1123        if (cd == 0 || cd == (iconv_t)-1) return -1;
1124        return 0;
1125 }
1126 ],
1127 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
1128 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
1129     AC_DEFINE(HAVE_NATIVE_ICONV)
1130 fi
1131
1132
1133 AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
1134 AC_TRY_RUN([
1135 #include <sys/types.h>
1136 #include <fcntl.h>
1137 #ifndef F_GETLEASE
1138 #define F_GETLEASE      1025
1139 #endif
1140 main() {
1141        int fd = open("/dev/null", O_RDONLY);
1142        return fcntl(fd, F_GETLEASE, 0) == -1;
1143 }
1144 ],
1145 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
1146 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
1147     AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
1148 fi
1149
1150 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
1151 AC_TRY_RUN([
1152 #include <sys/types.h>
1153 #include <fcntl.h>
1154 #include <signal.h>
1155 #ifndef F_NOTIFY
1156 #define F_NOTIFY 1026
1157 #endif
1158 main() {
1159         exit(fcntl(open("/tmp", O_RDONLY), F_NOTIFY, 0) == -1 ?  1 : 0);
1160 }
1161 ],
1162 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
1163 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
1164     AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
1165 fi
1166
1167 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
1168 AC_TRY_RUN([
1169 #include <sys/types.h>
1170 #include <fcntl.h>
1171 #include <signal.h>
1172 #include <sys/file.h>
1173 #ifndef LOCK_MAND
1174 #define LOCK_MAND       32
1175 #define LOCK_READ       64
1176 #endif
1177 main() {
1178         exit(flock(open("/dev/null", O_RDWR), LOCK_MAND|LOCK_READ) != 0);
1179 }
1180 ],
1181 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
1182 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
1183     AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
1184 fi
1185
1186
1187
1188
1189 AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
1190 AC_TRY_COMPILE([#include <sys/types.h>
1191 #include <fcntl.h>],
1192 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
1193 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
1194 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
1195     AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
1196 fi
1197
1198 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
1199 AC_TRY_RUN([#include <sys/types.h>
1200 #include <sys/capability.h>
1201 main() {
1202  cap_t cap;
1203  if ((cap = cap_get_proc()) == NULL)
1204    exit(1);
1205  cap->cap_effective |= CAP_NETWORK_MGT;
1206  cap->cap_inheritable |= CAP_NETWORK_MGT;
1207  cap_set_proc(cap);
1208  exit(0);
1209 }
1210 ],
1211 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
1212 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
1213     AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
1214 fi
1215
1216 #
1217 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
1218 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
1219 #
1220
1221 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
1222 AC_TRY_COMPILE([#include <sys/types.h>
1223 #if defined(HAVE_RPC_RPC_H)
1224 #include <rpc/rpc.h>
1225 #endif],
1226 [int16 testvar;],
1227 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
1228 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
1229     AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
1230 fi
1231
1232 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
1233 AC_TRY_COMPILE([#include <sys/types.h>
1234 #if defined(HAVE_RPC_RPC_H)
1235 #include <rpc/rpc.h>
1236 #endif],
1237 [uint16 testvar;],
1238 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
1239 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
1240     AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
1241 fi
1242
1243 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
1244 AC_TRY_COMPILE([#include <sys/types.h>
1245 #if defined(HAVE_RPC_RPC_H)
1246 #include <rpc/rpc.h>
1247 #endif],
1248 [int32 testvar;],
1249 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
1250 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
1251     AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
1252 fi
1253
1254 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
1255 AC_TRY_COMPILE([#include <sys/types.h>
1256 #if defined(HAVE_RPC_RPC_H)
1257 #include <rpc/rpc.h>
1258 #endif],
1259 [uint32 testvar;],
1260 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
1261 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
1262     AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
1263 fi
1264
1265 dnl
1266 dnl Some systems (SCO) have a problem including
1267 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
1268 dnl as a #define in <prot.h> and as part of an enum
1269 dnl in <rpc/rpc.h>.
1270 dnl
1271
1272 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
1273 AC_TRY_COMPILE([#include <sys/types.h>
1274 #ifdef HAVE_SYS_SECURITY_H
1275 #include <sys/security.h>
1276 #include <prot.h>
1277 #endif  /* HAVE_SYS_SECURITY_H */
1278 #if defined(HAVE_RPC_RPC_H)
1279 #include <rpc/rpc.h>
1280 #endif],
1281 [int testvar;],
1282 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
1283 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
1284     AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
1285 fi
1286
1287 AC_MSG_CHECKING([for test routines])
1288 AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
1289            AC_MSG_RESULT(yes),
1290            AC_MSG_ERROR([cant find test code. Aborting config]),
1291            AC_MSG_WARN([cannot run when cross-compiling]))
1292
1293 AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
1294 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
1295            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
1296 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
1297     AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
1298 fi
1299
1300 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
1301 AC_TRY_RUN([#include "${srcdir-.}/tests/unixsock.c"],
1302            samba_cv_HAVE_WORKING_AF_LOCAL=yes,
1303            samba_cv_HAVE_WORKING_AF_LOCAL=no,
1304            samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
1305 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
1306 then
1307     AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
1308 fi
1309
1310 AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
1311 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
1312            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
1313 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
1314     AC_DEFINE(HAVE_BROKEN_GETGROUPS)
1315 fi
1316
1317 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
1318 SAVE_CPPFLAGS="$CPPFLAGS"
1319 CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
1320 AC_TRY_COMPILE([
1321 #define REPLACE_GETPASS 1
1322 #define NO_CONFIG_H 1
1323 #define main dont_declare_main
1324 #include "${srcdir-.}/lib/getsmbpass.c"
1325 #undef main
1326 ],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no)
1327 CPPFLAGS="$SAVE_CPPFLAGS"
1328 ])
1329 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
1330         AC_DEFINE(REPLACE_GETPASS)
1331 fi
1332
1333 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
1334 AC_TRY_RUN([
1335 #include <stdio.h>
1336 #include <sys/types.h>
1337 #include <netinet/in.h>
1338 #ifdef HAVE_ARPA_INET_H
1339 #include <arpa/inet.h>
1340 #endif
1341 main() { struct in_addr ip; ip.s_addr = 0x12345678;
1342 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
1343     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
1344 exit(1);}],
1345            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
1346 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
1347     AC_DEFINE(REPLACE_INET_NTOA)
1348 fi
1349
1350 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
1351 AC_TRY_RUN([#include <stdlib.h>
1352 #include <sys/types.h>
1353 #include <sys/stat.h>
1354 #include <unistd.h>
1355 main() { 
1356   struct stat st;
1357   char tpl[20]="/tmp/test.XXXXXX"; 
1358   int fd = mkstemp(tpl); 
1359   if (fd == -1) exit(1);
1360   unlink(tpl);
1361   if (fstat(fd, &st) != 0) exit(1);
1362   if ((st.st_mode & 0777) != 0600) exit(1);
1363   exit(0);
1364 }],
1365 samba_cv_HAVE_SECURE_MKSTEMP=yes,
1366 samba_cv_HAVE_SECURE_MKSTEMP=no,
1367 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
1368 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
1369     AC_DEFINE(HAVE_SECURE_MKSTEMP)
1370 fi
1371
1372 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
1373 AC_TRY_RUN([#include <unistd.h>
1374 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
1375 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
1376 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
1377     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
1378 fi
1379
1380 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
1381 AC_TRY_RUN([main() { exit(getuid() != 0); }],
1382            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
1383 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
1384     AC_DEFINE(HAVE_ROOT)
1385 else
1386     AC_MSG_WARN(running as non-root will disable some tests)
1387 fi
1388
1389 ##################
1390 # look for a method of finding the list of network interfaces
1391 iface=no;
1392 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
1393 AC_TRY_RUN([
1394 #define HAVE_IFACE_AIX 1
1395 #define AUTOCONF_TEST 1
1396 #include "confdefs.h"
1397 #include "${srcdir-.}/lib/interfaces.c"],
1398            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
1399 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
1400     iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
1401 fi
1402
1403 if test $iface = no; then
1404 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
1405 AC_TRY_RUN([
1406 #define HAVE_IFACE_IFCONF 1
1407 #define AUTOCONF_TEST 1
1408 #include "confdefs.h"
1409 #include "${srcdir-.}/lib/interfaces.c"],
1410            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
1411 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
1412     iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
1413 fi
1414 fi
1415
1416 if test $iface = no; then
1417 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
1418 AC_TRY_RUN([
1419 #define HAVE_IFACE_IFREQ 1
1420 #define AUTOCONF_TEST 1
1421 #include "confdefs.h"
1422 #include "${srcdir-.}/lib/interfaces.c"],
1423            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
1424 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
1425     iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
1426 fi
1427 fi
1428
1429
1430 ################################################
1431 # look for a method of setting the effective uid
1432 seteuid=no;
1433 if test $seteuid = no; then
1434 AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
1435 AC_TRY_RUN([
1436 #define AUTOCONF_TEST 1
1437 #define USE_SETRESUID 1
1438 #include "confdefs.h"
1439 #include "${srcdir-.}/lib/util_sec.c"],
1440            samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
1441 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
1442     seteuid=yes;AC_DEFINE(USE_SETRESUID)
1443 fi
1444 fi
1445
1446
1447 if test $seteuid = no; then
1448 AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
1449 AC_TRY_RUN([
1450 #define AUTOCONF_TEST 1
1451 #define USE_SETREUID 1
1452 #include "confdefs.h"
1453 #include "${srcdir-.}/lib/util_sec.c"],
1454            samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
1455 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
1456     seteuid=yes;AC_DEFINE(USE_SETREUID)
1457 fi
1458 fi
1459
1460 if test $seteuid = no; then
1461 AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
1462 AC_TRY_RUN([
1463 #define AUTOCONF_TEST 1
1464 #define USE_SETEUID 1
1465 #include "confdefs.h"
1466 #include "${srcdir-.}/lib/util_sec.c"],
1467            samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
1468 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
1469     seteuid=yes;AC_DEFINE(USE_SETEUID)
1470 fi
1471 fi
1472
1473 if test $seteuid = no; then
1474 AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
1475 AC_TRY_RUN([
1476 #define AUTOCONF_TEST 1
1477 #define USE_SETUIDX 1
1478 #include "confdefs.h"
1479 #include "${srcdir-.}/lib/util_sec.c"],
1480            samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
1481 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
1482     seteuid=yes;AC_DEFINE(USE_SETUIDX)
1483 fi
1484 fi
1485
1486
1487 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
1488 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
1489            samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
1490 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
1491     AC_DEFINE(HAVE_MMAP)
1492 fi
1493
1494 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
1495 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
1496            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
1497 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
1498     AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
1499 fi
1500
1501 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
1502 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
1503            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
1504 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
1505     AC_DEFINE(HAVE_FCNTL_LOCK)
1506 fi
1507
1508 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
1509 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
1510            samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
1511 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
1512     AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
1513
1514 else
1515
1516 dnl
1517 dnl Don't check for 64 bit fcntl locking if we know that the
1518 dnl glibc2.1 broken check has succeeded.
1519 dnl 
1520
1521   AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
1522   AC_TRY_RUN([
1523 #if defined(HAVE_UNISTD_H)
1524 #include <unistd.h>
1525 #endif
1526 #include <stdio.h>
1527 #include <stdlib.h>
1528
1529 #ifdef HAVE_FCNTL_H
1530 #include <fcntl.h>
1531 #endif
1532
1533 #ifdef HAVE_SYS_FCNTL_H
1534 #include <sys/fcntl.h>
1535 #endif
1536 main() { struct flock64 fl64;
1537 #if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
1538 exit(0);
1539 #else
1540 exit(1);
1541 #endif
1542 }],
1543        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
1544
1545   if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
1546       AC_DEFINE(HAVE_STRUCT_FLOCK64)
1547   fi
1548 fi
1549
1550
1551 case "$host_os" in
1552 *linux*)
1553 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
1554 AC_TRY_COMPILE([
1555 #ifdef HAVE_SYS_VFS_H
1556 #include <sys/vfs.h>
1557 #endif
1558 #ifdef HAVE_SYS_CAPABILITY_H
1559 #include <sys/capability.h>
1560 #endif
1561 ],[int i;],
1562    samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
1563 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
1564    AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS)
1565 fi
1566 ;;
1567 esac
1568
1569 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
1570 AC_TRY_COMPILE([#include <sys/acl.h>
1571 #if defined(HAVE_RPCSVC_NIS_H)
1572 #include <rpcsvc/nis.h>
1573 #endif],
1574 [int i;],
1575 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
1576 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
1577     AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
1578 fi
1579
1580
1581 #################################################
1582 # check for smbwrapper support
1583 AC_MSG_CHECKING(whether to use smbwrapper)
1584 AC_ARG_WITH(smbwrapper,
1585 [  --with-smbwrapper       Include SMB wrapper support (default=no) ],
1586 [ case "$withval" in
1587   yes)
1588     AC_MSG_RESULT(yes)
1589     AC_DEFINE(WITH_SMBWRAPPER)
1590         WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
1591
1592         if test x$ATTEMPT_WRAP32_BUILD = x; then
1593                 WRAP32=""
1594         else
1595                         WRAP32=bin/smbwrapper.32.$SHLIBEXT
1596         fi
1597
1598 # Conditions under which smbwrapper should not be built.
1599
1600         if test x$PICFLAG = x; then
1601            echo No support for PIC code - disabling smbwrapper and smbsh
1602            WRAP=""
1603            WRAP32=""
1604         elif test x$ac_cv_func_syscall = xno; then
1605            AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
1606            WRAP=""
1607            WRAP32=""
1608         fi
1609     ;;
1610   *)
1611     AC_MSG_RESULT(no)
1612     ;;
1613   esac ],
1614   AC_MSG_RESULT(no)
1615 )
1616
1617 #################################################
1618 # check for AFS clear-text auth support
1619 AC_MSG_CHECKING(whether to use AFS clear-text auth)
1620 AC_ARG_WITH(afs,
1621 [  --with-afs              Include AFS clear-text auth support (default=no) ],
1622 [ case "$withval" in
1623   yes)
1624     AC_MSG_RESULT(yes)
1625     AC_DEFINE(WITH_AFS)
1626     ;;
1627   *)
1628     AC_MSG_RESULT(no)
1629     ;;
1630   esac ],
1631   AC_MSG_RESULT(no)
1632 )
1633
1634
1635 #################################################
1636 # check for the DFS clear-text auth system
1637 AC_MSG_CHECKING(whether to use DFS clear-text auth)
1638 AC_ARG_WITH(dfs,
1639 [  --with-dce-dfs          Include DCE/DFS clear-text auth support (default=no)],
1640 [ case "$withval" in
1641   yes)
1642     AC_MSG_RESULT(yes)
1643     AC_DEFINE(WITH_DFS)
1644     ;;
1645   *)
1646     AC_MSG_RESULT(no)
1647     ;;
1648   esac ],
1649   AC_MSG_RESULT(no)
1650 )
1651
1652
1653 #################################################
1654 # see if this box has the RedHat location for kerberos
1655 AC_MSG_CHECKING(for /usr/kerberos)
1656 if test -d /usr/kerberos; then
1657     LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
1658     CFLAGS="$CFLAGS -I/usr/kerberos/include"
1659     CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1660     AC_MSG_RESULT(yes)
1661 else
1662     AC_MSG_RESULT(no)
1663 fi
1664
1665 #################################################
1666 # check for location of Kerberos 5 install
1667 AC_MSG_CHECKING(for kerberos 5 install path)
1668 AC_ARG_WITH(krb5,
1669 [  --with-krb5=base-dir    Locate Kerberos 5 support (default=/usr)],
1670 [ case "$withval" in
1671   no)
1672     AC_MSG_RESULT(no)
1673     ;;
1674   *)
1675     AC_MSG_RESULT(yes)
1676     LIBS="$LIBS -lkrb5"
1677     CFLAGS="$CFLAGS -I$withval/include"
1678     CPPFLAGS="$CPPFLAGS -I$withval/include"
1679     LDFLAGS="$LDFLAGS -L$withval/lib"
1680     ;;
1681   esac ],
1682   AC_MSG_RESULT(no)
1683 )
1684
1685 # now check for krb5.h. Some systems have the libraries without the headers!
1686 # note that this check is done here to allow for different kerberos
1687 # include paths
1688 AC_CHECK_HEADERS(krb5.h)
1689
1690 # now check for gssapi headers.  This is also done here to allow for
1691 # different kerberos include paths
1692 AC_CHECK_HEADERS(gssapi/gssapi_generic.h gssapi/gssapi.h)
1693
1694 ##################################################################
1695 # we might need the k5crypto and com_err libraries on some systems
1696 AC_CHECK_LIB(com_err, _et_list, [LIBS="$LIBS -lcom_err"])
1697 AC_CHECK_LIB(k5crypto, krb5_encrypt_data, [LIBS="$LIBS -lk5crypto"])
1698 AC_CHECK_LIB(gssapi_krb5, gss_display_status, [LIBS="$LIBS -lgssapi_krb5"])
1699
1700
1701 ########################################################
1702 # now see if we can find the krb5 libs in standard paths
1703 # or as specified above
1704 AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
1705         AC_DEFINE(HAVE_KRB5)])
1706
1707 ########################################################
1708 # now see if we can find the gssapi libs in standard paths
1709 AC_CHECK_LIB(gssapi_krb5, gss_display_status, [AC_DEFINE(HAVE_GSSAPI)])
1710
1711
1712 ##################################################################
1713 # we might need the lber lib on some systems. To avoid link errors
1714 # this test must be before the libldap test
1715 AC_CHECK_LIB(lber, ber_scanf, [LIBS="$LIBS -llber"])
1716
1717 ########################################################
1718 # now see if we can find the ldap libs in standard paths
1719 if test x$have_ldap != xyes; then
1720 AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
1721         AC_DEFINE(HAVE_LDAP)])
1722 fi
1723
1724 #################################################
1725 # check for automount support
1726 AC_MSG_CHECKING(whether to use AUTOMOUNT)
1727 AC_ARG_WITH(automount,
1728 [  --with-automount        Include AUTOMOUNT support (default=no)],
1729 [ case "$withval" in
1730   yes)
1731     AC_MSG_RESULT(yes)
1732     AC_DEFINE(WITH_AUTOMOUNT)
1733     ;;
1734   *)
1735     AC_MSG_RESULT(no)
1736     ;;
1737   esac ],
1738   AC_MSG_RESULT(no)
1739 )
1740
1741 #################################################
1742 # check for smbmount support
1743 AC_MSG_CHECKING(whether to use SMBMOUNT)
1744 AC_ARG_WITH(smbmount,
1745 [  --with-smbmount         Include SMBMOUNT (Linux only) support (default=no)],
1746 [ case "$withval" in
1747   yes)
1748         case "$host_os" in
1749         *linux*)
1750                 AC_MSG_RESULT(yes)
1751                 AC_DEFINE(WITH_SMBMOUNT)
1752                 MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
1753                 ;;
1754         *)
1755                 AC_MSG_ERROR(not on a linux system!)
1756                 ;;
1757         esac
1758     ;;
1759   *)
1760     AC_MSG_RESULT(no)
1761     MPROGS=
1762     ;;
1763   esac ],
1764   AC_MSG_RESULT(no)
1765   MPROGS=
1766 )
1767
1768
1769 #################################################
1770 # check for a PAM clear-text auth, accounts, password and session support
1771 with_pam_for_crypt=no
1772 AC_MSG_CHECKING(whether to use PAM)
1773 AC_ARG_WITH(pam,
1774 [  --with-pam              Include PAM support (default=no)],
1775 [ case "$withval" in
1776   yes)
1777     AC_MSG_RESULT(yes)
1778     AC_DEFINE(WITH_PAM)
1779     LIBS="$LIBS -lpam"
1780     with_pam_for_crypt=yes
1781     ;;
1782   *)
1783     AC_MSG_RESULT(no)
1784     ;;
1785   esac ],
1786   AC_MSG_RESULT(no)
1787 )
1788
1789 # we can't build a pam module if we don't have pam.
1790 AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
1791
1792 #################################################
1793 # check for pam_smbpass support
1794 AC_MSG_CHECKING(whether to use pam_smbpass)
1795 AC_ARG_WITH(pam_smbpass,
1796 [  --with-pam_smbpass      Build a PAM module to allow other applications to use our smbpasswd file (default=no)],
1797 [ case "$withval" in
1798   yes)
1799     AC_MSG_RESULT(yes)
1800
1801 # Conditions under which pam_smbpass should not be built.
1802
1803        if test x$PICFLAG = x; then
1804           AC_MSG_RESULT([No support for PIC code - disabling pam_smbpass])
1805           PAM_MOD=""
1806        elif test x$ac_cv_lib_pam_pam_get_data = xno; then
1807           AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
1808           PAM_MOD=""
1809        else
1810           PAM_MOD="bin/pam_smbpass.so"
1811        fi
1812     ;;
1813   *)
1814     AC_MSG_RESULT(no)
1815     ;;
1816   esac ],
1817   AC_MSG_RESULT(no)
1818 )
1819
1820
1821 ###############################################
1822 # test for where we get crypt() from, but only
1823 # if not using PAM
1824 if test $with_pam_for_crypt = no; then
1825 AC_CHECK_FUNCS(crypt)
1826 if test x"$ac_cv_func_crypt" = x"no"; then
1827     AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
1828         AC_DEFINE(HAVE_CRYPT)])
1829 fi
1830 fi
1831
1832 ##
1833 ## moved after the check for -lcrypt in order to
1834 ## ensure that the necessary libraries are included
1835 ## check checking for truncated salt.  Wrapped by the
1836 ## $with_pam_for_crypt variable as above   --jerry
1837 ##
1838 if test $with_pam_for_crypt = no; then
1839 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
1840 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
1841         samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
1842 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
1843         AC_DEFINE(HAVE_TRUNCATED_SALT)
1844 fi
1845 fi
1846
1847
1848
1849 ########################################################################################
1850 ##
1851 ## TESTS FOR SAM BACKENDS.  KEEP THESE GROUPED TOGETHER
1852 ##
1853 ########################################################################################
1854
1855 ## set the with_smbpasswd_sam as the default
1856 with_smbpasswd_sam=yes
1857
1858
1859 #################################################
1860 # check for a TDB password database
1861 AC_MSG_CHECKING(whether to use TDB SAM database)
1862 AC_ARG_WITH(tdbsam,
1863 [  --with-tdbsam           Include experimental TDB SAM support (default=no)],
1864 [ case "$withval" in
1865   yes)
1866     AC_MSG_RESULT(yes)
1867     AC_DEFINE(WITH_TDB_SAM)
1868     with_smbpasswd_sam=no
1869     ;;
1870   *)
1871     AC_MSG_RESULT(no)
1872     ;;
1873   esac ],
1874   AC_MSG_RESULT(no)
1875 )
1876
1877 #################################################
1878 # check for a LDAP password database
1879 AC_MSG_CHECKING(whether to use LDAP SAM database)
1880 AC_ARG_WITH(ldapsam,
1881 [  --with-ldapsam          Include experimental LDAP SAM support (default=no)],
1882 [ case "$withval" in
1883   yes)
1884     AC_MSG_RESULT(yes)
1885     AC_DEFINE(WITH_LDAP_SAM)
1886     LIBS="-lldap -llber $LIBS"
1887     with_smbpasswd_sam=no
1888     ;;
1889   *)
1890     AC_MSG_RESULT(no)
1891     ;;
1892   esac ],
1893   AC_MSG_RESULT(no)
1894 )
1895
1896 #################################################
1897 # check for a NISPLUS password database
1898 AC_MSG_CHECKING(whether to use NISPLUS SAM database)
1899 AC_ARG_WITH(nisplussam,
1900 [  --with-nisplussam       Include NISPLUS SAM support (default=no)],
1901 [ case "$withval" in
1902   yes)
1903     AC_MSG_RESULT(yes)
1904     AC_DEFINE(WITH_NISPLUS_SAM)
1905     with_smbpasswd_sam=no
1906     ;;
1907   *)
1908     AC_MSG_RESULT(no)
1909     ;;
1910   esac ],
1911   AC_MSG_RESULT(no)
1912 )
1913
1914 ################################################
1915 # This test should come last because the
1916 # smbpasswd SAM is only used if another format
1917 # has not been defined
1918 AC_MSG_CHECKING(whether to use traditional smbpasswd file)
1919 if test $with_smbpasswd_sam = yes; then
1920         AC_MSG_RESULT(yes)
1921         AC_DEFINE(WITH_SMBPASSWD_SAM)
1922 else
1923         AC_MSG_RESULT(no)
1924 fi
1925
1926 ########################################################################################
1927 ##
1928 ## END OF TESTS FOR SAM BACKENDS.  
1929 ##
1930 ########################################################################################
1931
1932 #################################################
1933 # check for a NISPLUS_HOME support 
1934 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
1935 AC_ARG_WITH(nisplus-home,
1936 [  --with-nisplus-home     Include NISPLUS_HOME support (default=no)],
1937 [ case "$withval" in
1938   yes)
1939     AC_MSG_RESULT(yes)
1940     AC_DEFINE(WITH_NISPLUS_HOME)
1941     ;;
1942   *)
1943     AC_MSG_RESULT(no)
1944     ;;
1945   esac ],
1946   AC_MSG_RESULT(no)
1947 )
1948
1949 #################################################
1950 # check for the secure socket layer
1951 AC_MSG_CHECKING(whether to use SSL)
1952 AC_ARG_WITH(ssl,
1953 [  --with-ssl              Include SSL support (default=no)
1954   --with-sslinc=DIR          Where the SSL includes are (defaults to /usr/local/ssl/include)
1955   --with-ssllib=DIR          Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
1956 [ case "$withval" in
1957   yes)
1958     AC_MSG_RESULT(yes)
1959     AC_DEFINE(WITH_SSL)
1960     withval="/usr/local/ssl"     # default
1961
1962     if test "${with_sslinc+set}" = set; then
1963
1964         withval="$with_sslinc"
1965         case "$withval" in
1966         yes|no)
1967           echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
1968           CFLAGS="-I/usr/local/ssl/include $CFLAGS"
1969         ;;
1970         * )
1971           CFLAGS="-I${withval} $CFLAGS"
1972         ;;
1973         esac
1974
1975     else
1976
1977         CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
1978
1979     fi
1980
1981     if test "${with_ssllib+set}" = set; then
1982
1983         withval="$with_ssllib"
1984         case "$withval" in
1985         yes|no)
1986           echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
1987           LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1988         ;;
1989         * )
1990           LDFLAGS="-L${withval}/lib $LDFLAGS"
1991         ;;
1992         esac
1993
1994     else
1995
1996         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
1997
1998     fi
1999
2000     LIBS="-lssl -lcrypto $LIBS"
2001
2002 #    if test ! -d ${withval}; then
2003 #      echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
2004 #      exit 1
2005 #    fi 
2006
2007     CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
2008
2009     ;;
2010   *)
2011     AC_MSG_RESULT(no)
2012     ;;
2013   esac ],
2014   AC_MSG_RESULT(no)
2015 )
2016
2017 #################################################
2018 # check for syslog logging
2019 AC_MSG_CHECKING(whether to use syslog logging)
2020 AC_ARG_WITH(syslog,
2021 [  --with-syslog           Include experimental SYSLOG support (default=no)],
2022 [ case "$withval" in
2023   yes)
2024     AC_MSG_RESULT(yes)
2025     AC_DEFINE(WITH_SYSLOG)
2026     ;;
2027   *)
2028     AC_MSG_RESULT(no)
2029     ;;
2030   esac ],
2031   AC_MSG_RESULT(no)
2032 )
2033
2034 #################################################
2035 # check for a shared memory profiling support
2036 AC_MSG_CHECKING(whether to use profiling)
2037 AC_ARG_WITH(profiling-data,
2038 [  --with-profiling-data   Include gathering source code profile information (default=no)],
2039 [ case "$withval" in
2040   yes)
2041     AC_MSG_RESULT(yes)
2042     AC_DEFINE(WITH_PROFILE)
2043     ;;
2044   *)
2045     AC_MSG_RESULT(no)
2046     ;;
2047   esac ],
2048   AC_MSG_RESULT(no)
2049 )
2050
2051
2052 #################################################
2053 # check for experimental disk-quotas support
2054 QUOTAOBJS=smbd/noquotas.o
2055
2056 AC_MSG_CHECKING(whether to support disk-quotas)
2057 AC_ARG_WITH(quotas,
2058 [  --with-quotas           Include experimental disk-quota support (default=no)],
2059 [ case "$withval" in
2060   yes)
2061     AC_MSG_RESULT(yes)
2062     case "$host_os" in
2063       *linux*)
2064         # Check for kernel 2.4.x quota braindamage...
2065         AC_CACHE_CHECK([for linux 2.4.x quota braindamage..],samba_cv_linux_2_4_quota_braindamage, [
2066         AC_TRY_COMPILE([#include <stdio.h>
2067 #include <sys/types.h>
2068 #include <asm/types.h>
2069 #include <linux/quota.h>
2070 #include <mntent.h>
2071 #include <linux/unistd.h>],[struct mem_dqblk D;],
2072       samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
2073 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
2074         AC_DEFINE(LINUX_QUOTAS_2)
2075 else
2076         AC_DEFINE(LINUX_QUOTAS_1)
2077 fi
2078         ;;
2079       *)
2080         ;;
2081     esac
2082     QUOTAOBJS=smbd/quotas.o
2083     AC_DEFINE(WITH_QUOTAS)
2084     ;;
2085   *)
2086     AC_MSG_RESULT(no)
2087     ;;
2088   esac ],
2089   AC_MSG_RESULT(no)
2090 )
2091 AC_SUBST(QUOTAOBJS)
2092
2093 #################################################
2094 # check for experimental utmp accounting
2095
2096 AC_MSG_CHECKING(whether to support utmp accounting)
2097 AC_ARG_WITH(utmp,
2098 [  --with-utmp             Include experimental utmp accounting (default=no)],
2099 [ case "$withval" in
2100   yes)
2101     AC_MSG_RESULT(yes)
2102     AC_DEFINE(WITH_UTMP)
2103     ;;
2104   *)
2105     AC_MSG_RESULT(no)
2106     ;;
2107   esac ],
2108   AC_MSG_RESULT(no)
2109 )
2110
2111 #################################################
2112 # set private directory location
2113 AC_ARG_WITH(privatedir,
2114 [  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
2115 [ case "$withval" in
2116   yes|no)
2117   #
2118   # Just in case anybody calls it without argument
2119   #
2120     AC_MSG_WARN([--with-privatedir called without argument - will use default])
2121     privatedir='${prefix}/private'
2122   ;;
2123   * )
2124     privatedir="$withval"
2125     ;;
2126   esac
2127   AC_SUBST(privatedir)],
2128   [privatedir='${prefix}/private'
2129    AC_SUBST(privatedir)]
2130 )
2131
2132 #################################################
2133 # set lock directory location
2134 AC_ARG_WITH(lockdir,
2135 [  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
2136 [ case "$withval" in
2137   yes|no)
2138   #
2139   # Just in case anybody calls it without argument
2140   #
2141     AC_MSG_WARN([--with-lockdir called without argument - will use default])
2142     lockdir='$(VARDIR)/locks'
2143   ;;
2144   * )
2145     lockdir="$withval"
2146     ;;
2147   esac
2148   AC_SUBST(lockdir)],
2149   [lockdir='$(VARDIR)/locks'
2150    AC_SUBST(lockdir)]
2151 )
2152
2153 #################################################
2154 # set SWAT directory location
2155 AC_ARG_WITH(swatdir,
2156 [  --with-swatdir=DIR      Where to put SWAT files ($ac_default_prefix/swat)],
2157 [ case "$withval" in
2158   yes|no)
2159   #
2160   # Just in case anybody does it
2161   #
2162     AC_MSG_WARN([--with-swatdir called without argument - will use default])
2163     swatdir='${prefix}/swat'
2164   ;;
2165   * )
2166     swatdir="$withval"
2167     ;;
2168   esac
2169   AC_SUBST(swatdir)],
2170   [swatdir='${prefix}/swat'
2171    AC_SUBST(swatdir)]
2172 )
2173
2174 #################################################
2175 # choose native language(s) of man pages
2176 AC_MSG_CHECKING(chosen man pages' language(s))
2177 AC_ARG_WITH(manpages-langs,
2178 [  --with-manpages-langs={en,ja,pl}  Choose man pages' language(s). (en)],
2179 [ case "$withval" in
2180   yes|no)
2181     AC_MSG_WARN(--with-manpages-langs called without argument - will use default)
2182     manlangs="en"
2183   ;;
2184   *)
2185     manlangs="$withval"
2186   ;;
2187   esac
2188
2189   AC_MSG_RESULT($manlangs)
2190   manlangs=`echo $manlangs | sed "s/,/ /"`   # replacing commas with spaces to produce a list
2191   AC_SUBST(manlangs)],
2192
2193   [manlangs="en"
2194   AC_MSG_RESULT($manlangs)
2195   AC_SUBST(manlangs)]
2196 )
2197
2198 #################################################
2199 # these tests are taken from the GNU fileutils package
2200 AC_CHECKING(how to get filesystem space usage)
2201 space=no
2202
2203 # Test for statvfs64.
2204 if test $space = no; then
2205   # SVR4
2206   AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
2207   [AC_TRY_RUN([
2208 #if defined(HAVE_UNISTD_H)
2209 #include <unistd.h>
2210 #endif
2211 #include <sys/types.h>
2212 #include <sys/statvfs.h>
2213   main ()
2214   {
2215     struct statvfs64 fsd;
2216     exit (statvfs64 (".", &fsd));
2217   }],
2218   fu_cv_sys_stat_statvfs64=yes,
2219   fu_cv_sys_stat_statvfs64=no,
2220   fu_cv_sys_stat_statvfs64=cross)])
2221   if test $fu_cv_sys_stat_statvfs64 = yes; then
2222     space=yes
2223     AC_DEFINE(STAT_STATVFS64)
2224   fi
2225 fi
2226
2227 # Perform only the link test since it seems there are no variants of the
2228 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
2229 # because that got a false positive on SCO OSR5.  Adding the declaration
2230 # of a `struct statvfs' causes this test to fail (as it should) on such
2231 # systems.  That system is reported to work fine with STAT_STATFS4 which
2232 # is what it gets when this test fails.
2233 if test $space = no; then
2234   # SVR4
2235   AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2236                  [AC_TRY_LINK([#include <sys/types.h>
2237 #include <sys/statvfs.h>],
2238                               [struct statvfs fsd; statvfs (0, &fsd);],
2239                               fu_cv_sys_stat_statvfs=yes,
2240                               fu_cv_sys_stat_statvfs=no)])
2241   if test $fu_cv_sys_stat_statvfs = yes; then
2242     space=yes
2243     AC_DEFINE(STAT_STATVFS)
2244   fi
2245 fi
2246
2247 if test $space = no; then
2248   # DEC Alpha running OSF/1
2249   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2250   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2251   [AC_TRY_RUN([
2252 #include <sys/param.h>
2253 #include <sys/types.h>
2254 #include <sys/mount.h>
2255   main ()
2256   {
2257     struct statfs fsd;
2258     fsd.f_fsize = 0;
2259     exit (statfs (".", &fsd, sizeof (struct statfs)));
2260   }],
2261   fu_cv_sys_stat_statfs3_osf1=yes,
2262   fu_cv_sys_stat_statfs3_osf1=no,
2263   fu_cv_sys_stat_statfs3_osf1=no)])
2264   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2265   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2266     space=yes
2267     AC_DEFINE(STAT_STATFS3_OSF1)
2268   fi
2269 fi
2270
2271 if test $space = no; then
2272 # AIX
2273   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2274 member (AIX, 4.3BSD)])
2275   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2276   [AC_TRY_RUN([
2277 #ifdef HAVE_SYS_PARAM_H
2278 #include <sys/param.h>
2279 #endif
2280 #ifdef HAVE_SYS_MOUNT_H
2281 #include <sys/mount.h>
2282 #endif
2283 #ifdef HAVE_SYS_VFS_H
2284 #include <sys/vfs.h>
2285 #endif
2286   main ()
2287   {
2288   struct statfs fsd;
2289   fsd.f_bsize = 0;
2290   exit (statfs (".", &fsd));
2291   }],
2292   fu_cv_sys_stat_statfs2_bsize=yes,
2293   fu_cv_sys_stat_statfs2_bsize=no,
2294   fu_cv_sys_stat_statfs2_bsize=no)])
2295   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2296   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2297     space=yes
2298     AC_DEFINE(STAT_STATFS2_BSIZE)
2299   fi
2300 fi
2301
2302 if test $space = no; then
2303 # SVR3
2304   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2305   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2306   [AC_TRY_RUN([#include <sys/types.h>
2307 #include <sys/statfs.h>
2308   main ()
2309   {
2310   struct statfs fsd;
2311   exit (statfs (".", &fsd, sizeof fsd, 0));
2312   }],
2313     fu_cv_sys_stat_statfs4=yes,
2314     fu_cv_sys_stat_statfs4=no,
2315     fu_cv_sys_stat_statfs4=no)])
2316   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2317   if test $fu_cv_sys_stat_statfs4 = yes; then
2318     space=yes
2319     AC_DEFINE(STAT_STATFS4)
2320   fi
2321 fi
2322
2323 if test $space = no; then
2324 # 4.4BSD and NetBSD
2325   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2326 member (4.4BSD and NetBSD)])
2327   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2328   [AC_TRY_RUN([#include <sys/types.h>
2329 #ifdef HAVE_SYS_PARAM_H
2330 #include <sys/param.h>
2331 #endif
2332 #ifdef HAVE_SYS_MOUNT_H
2333 #include <sys/mount.h>
2334 #endif
2335   main ()
2336   {
2337   struct statfs fsd;
2338   fsd.f_fsize = 0;
2339   exit (statfs (".", &fsd));
2340   }],
2341   fu_cv_sys_stat_statfs2_fsize=yes,
2342   fu_cv_sys_stat_statfs2_fsize=no,
2343   fu_cv_sys_stat_statfs2_fsize=no)])
2344   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2345   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2346     space=yes
2347     AC_DEFINE(STAT_STATFS2_FSIZE)
2348   fi
2349 fi
2350
2351 if test $space = no; then
2352   # Ultrix
2353   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2354   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2355   [AC_TRY_RUN([#include <sys/types.h>
2356 #ifdef HAVE_SYS_PARAM_H
2357 #include <sys/param.h>
2358 #endif
2359 #ifdef HAVE_SYS_MOUNT_H
2360 #include <sys/mount.h>
2361 #endif
2362 #ifdef HAVE_SYS_FS_TYPES_H
2363 #include <sys/fs_types.h>
2364 #endif
2365   main ()
2366   {
2367   struct fs_data fsd;
2368   /* Ultrix's statfs returns 1 for success,
2369      0 for not mounted, -1 for failure.  */
2370   exit (statfs (".", &fsd) != 1);
2371   }],
2372   fu_cv_sys_stat_fs_data=yes,
2373   fu_cv_sys_stat_fs_data=no,
2374   fu_cv_sys_stat_fs_data=no)])
2375   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2376   if test $fu_cv_sys_stat_fs_data = yes; then
2377     space=yes
2378     AC_DEFINE(STAT_STATFS2_FS_DATA)
2379   fi
2380 fi
2381
2382 #
2383 # As a gating factor for large file support, in order to
2384 # use <4GB files we must have the following minimal support
2385 # available.
2386 # long long, and a 64 bit off_t or off64_t.
2387 # If we don't have all of these then disable large
2388 # file support.
2389 #
2390 AC_MSG_CHECKING([if large file support can be enabled])
2391 AC_TRY_COMPILE([
2392 #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
2393 #include <sys/types.h>
2394 #else
2395 __COMPILE_ERROR_
2396 #endif
2397 ],
2398 [int i],
2399 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
2400 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
2401     AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
2402 fi
2403 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
2404
2405 AC_ARG_WITH(spinlocks, 
2406 [  --with-spinlocks        Use spin locks instead of fcntl locks (default=no) ])
2407 if test "x$with_spinlocks" = "xyes"; then
2408     AC_DEFINE(USE_SPINLOCKS)
2409
2410     case "$host_cpu" in
2411         sparc)
2412             AC_DEFINE(SPARC_SPINLOCKS)
2413             ;;
2414
2415         i386|i486|i586|i686)
2416             AC_DEFINE(INTEL_SPINLOCKS)
2417             ;;
2418
2419         mips)
2420             AC_DEFINE(MIPS_SPINLOCKS)
2421             ;;
2422
2423         powerpc)
2424             AC_DEFINE(POWERPC_SPINLOCKS)
2425             ;;
2426     esac
2427 fi
2428
2429 #################################################
2430 # check for ACL support
2431
2432 AC_MSG_CHECKING(whether to support ACLs)
2433 AC_ARG_WITH(acl-support,
2434 [  --with-acl-support      Include ACL support (default=no)],
2435 [ case "$withval" in
2436   yes)
2437
2438         case "$host_os" in
2439         *sysv5*)
2440                 AC_MSG_RESULT(Using UnixWare ACLs)
2441                 AC_DEFINE(HAVE_UNIXWARE_ACLS)
2442                 ;;
2443         *solaris*)
2444                 AC_MSG_RESULT(Using solaris ACLs)
2445                 AC_DEFINE(HAVE_SOLARIS_ACLS)
2446                 ;;
2447         *hpux*)
2448                 AC_MSG_RESULT(Using HPUX ACLs)
2449                 AC_DEFINE(HAVE_HPUX_ACLS)
2450                 ;;
2451         *irix*)
2452                 AC_MSG_RESULT(Using IRIX ACLs)
2453                 AC_DEFINE(HAVE_IRIX_ACLS)
2454                 ;;
2455         *aix*)
2456                 AC_MSG_RESULT(Using AIX ACLs)
2457                 AC_DEFINE(HAVE_AIX_ACLS)
2458                 ;;
2459         *osf*)
2460                 AC_MSG_RESULT(Using Tru64 ACLs)
2461                 AC_DEFINE(HAVE_TRU64_ACLS)
2462                 LIBS="$LIBS -lpacl"
2463                 ;;
2464         *)
2465                 AC_CHECK_LIB(acl,acl_get_file)
2466                 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
2467                 AC_TRY_LINK([#include <sys/types.h>
2468 #include <sys/acl.h>],
2469 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
2470 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
2471                         if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
2472                                 AC_MSG_RESULT(Using posix ACLs)
2473                                 AC_DEFINE(HAVE_POSIX_ACLS)
2474                                 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
2475                                 AC_TRY_LINK([#include <sys/types.h>
2476 #include <sys/acl.h>],
2477 [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
2478 samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
2479                                 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
2480                                         AC_DEFINE(HAVE_ACL_GET_PERM_NP)
2481                                 fi
2482                         fi
2483             ;;
2484         esac
2485         ;;
2486   *)
2487     AC_MSG_RESULT(no)
2488     AC_DEFINE(HAVE_NO_ACLS)
2489     ;;
2490   esac ],
2491   AC_DEFINE(HAVE_NO_ACLS)
2492   AC_MSG_RESULT(no)
2493 )
2494
2495 #################################################
2496 # Check whether winbind is supported on this platform.  If so we need to
2497 # build and install client programs (WINBIND_TARGETS), sbin programs
2498 # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
2499
2500 AC_MSG_CHECKING(whether to build winbind)
2501
2502 # Initially, the value of $host_os decides whether winbind is supported
2503
2504 case "$host_os" in 
2505         *linux*|*solaris*|*irix*)
2506                 HAVE_WINBIND=yes
2507                 ;;
2508         *)
2509                 HAVE_WINBIND=no
2510                 winbind_no_reason=", unsupported on $host_os"
2511                 ;;
2512 esac
2513
2514 # Check the setting of --with-winbindd
2515
2516 AC_ARG_WITH(winbind,
2517 [  --with-winbind          Build winbind (default, if supported by OS)],
2518
2519   case "$withval" in
2520         yes)
2521                 HAVE_WINBIND=yes
2522                 ;;
2523         no)
2524                 HAVE_WINBIND=no
2525                 winbind_reason=""
2526                 ;;
2527   esac ],
2528 )
2529
2530 # We need unix domain sockets for winbind
2531
2532 if test x"$HAVE_WINBIND" = x"yes"; then
2533         if test x"$samba_cv_unixsocket" = x"no"; then
2534                 winbind_no_reason=", no unix domain socket support on $host_os"
2535                 HAVE_WINBIND=no
2536         fi
2537 fi
2538
2539 # Display test results
2540
2541 if test x"$HAVE_WINBIND" = x"yes"; then
2542
2543         AC_MSG_RESULT(yes)
2544
2545         WINBIND_TARGETS="bin/wbinfo"
2546         WINBIND_STARGETS="bin/winbindd"
2547         WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
2548         case "$with_pam" in
2549                 yes)
2550                         WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
2551                 ;;
2552         esac
2553 else
2554         AC_MSG_RESULT(no$winbind_no_reason)
2555
2556         WINBIND_TARGETS=""
2557         WINBIND_STARGETS=""
2558         WINBIND_LTARGETS=""
2559         WINBIND_PAM_PROGS=""
2560 fi
2561
2562 # Substitution time!
2563
2564 AC_SUBST(WINBIND_TARGETS)
2565 AC_SUBST(WINBIND_STARGETS)
2566 AC_SUBST(WINBIND_LTARGETS)
2567 AC_SUBST(WINBIND_PAM_TARGETS)
2568
2569 #################################################
2570 # Check to see if we should use the included popt 
2571
2572 AC_ARG_WITH(included-popt,
2573 [  --with-included-popt    use bundled popt library, not from system],
2574
2575   case "$withval" in
2576         yes)
2577                 INCLUDED_POPT=yes
2578                 ;;
2579         no)
2580                 INCLUDED_POPT=no
2581                 ;;
2582   esac ],
2583 )
2584 if test x"$INCLUDED_POPT" != x"yes"; then
2585     AC_CHECK_LIB(popt, poptGetContext,
2586                  INCLUDED_POPT=no, INCLUDED_POPT=yes)
2587 fi
2588
2589 AC_MSG_CHECKING(whether to use included popt)
2590 if test x"$INCLUDED_POPT" = x"yes"; then
2591     AC_MSG_RESULT($srcdir/popt)
2592     BUILD_POPT='$(POPT_OBJS)'
2593     FLAGS1="-I$srcdir/popt"
2594 else
2595     AC_MSG_RESULT(no)
2596     LIBS="$LIBS -lpopt"
2597 fi
2598 AC_SUBST(BUILD_POPT)
2599 AC_SUBST(FLAGS1)
2600
2601 #################################################
2602 # final configure stuff
2603
2604 echo "checking configure summary"
2605 AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
2606            echo "configure OK";,
2607            AC_MSG_ERROR([summary failure. Aborting config]),:)
2608
2609 builddir=`pwd`
2610 AC_SUBST(builddir)
2611
2612 AC_OUTPUT(include/stamp-h Makefile)
2613
2614 #################################################
2615 # Print very concise instructions on building/use
2616 if test "x$enable_dmalloc" = xyes
2617 then
2618         AC_MSG_RESULT([Note: The dmalloc debug library will be included.])
2619         AC_MSG_RESULT([      Use the \"dmalloc\" command to turn it on.])
2620 fi