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