1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(include/includes.h)
4 AC_CONFIG_HEADER(include/config.h)
5 AC_CONFIG_AUX_DIR(../../config)
6 # we want to be compatibe with older versions of Samba
7 AC_PREFIX_DEFAULT(/usr/local/samba)
10 dnl Unique-to-Samba variables we'll be playing with.
18 # compile with optimization and without debugging by default
21 dnl Checks for programs.
25 AC_CHECK_TOOL(AR, ar, ar)
27 dnl Check if C compiler understands -c and -o at the same time
29 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
37 AC_VALIDATE_CACHE_SYSTEM_TYPE
45 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
46 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
47 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
48 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
49 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h string.h strings.h stdlib.h sys/socket.h)
50 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
51 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
52 AC_CHECK_HEADERS(netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
53 AC_CHECK_HEADERS(sys/security.h security/pam_appl.h)
54 AC_CHECK_HEADERS(stropts.h poll.h syscall.h sys/syscall.h)
55 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
59 AC_CHECK_SIZEOF(short)
60 AC_CHECK_SIZEOF(off_t)
61 AC_CHECK_SIZEOF(ino_t)
74 AC_CHECK_TYPE(ino_t,unsigned)
75 AC_CHECK_TYPE(loff_t,off_t)
76 AC_CHECK_TYPE(offset_t,off_t)
77 AC_CHECK_TYPE(ssize_t, int)
79 # we need libdl for PAM and the new VFS code
82 AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
83 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
84 samba_cv_errno=yes,samba_cv_have_errno=no)])
85 if test x"$samba_cv_errno" = x"yes"; then
86 AC_DEFINE(HAVE_ERRNO_DECL, 1, [Define if errno is declared])
89 # stupid glibc has the functions but no declaration. grrrr.
90 AC_CACHE_CHECK([for crypt declaration],samba_cv_have_crypt_decl,[
91 AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)crypt],
92 samba_cv_have_crypt_decl=yes,samba_cv_have_crypt_decl=no)])
93 if test x"$samba_cv_have_crypt_decl" = x"yes"; then
94 AC_DEFINE(HAVE_CRYPT_DECL, 1, [Define if crypt() is declared])
99 ###############################################
100 # test for where we get crypt() from
101 AC_CHECK_FUNCS(crypt)
102 if test x"$ac_cv_func_crypt" = x"no"; then
103 AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
104 AC_DEFINE(HAVE_CRYPT)])
108 # The following test taken from the cvs sources
109 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
110 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
111 # libsocket.so which has a bad implementation of gethostbyname (it
112 # only looks in /etc/hosts), so we only look for -lsocket if we need
114 AC_CHECK_FUNCS(connect)
115 if test x"$ac_cv_func_connect" = x"no"; then
118 *) AC_CHECK_LIB(nsl_s, printf) ;;
122 *) AC_CHECK_LIB(nsl, printf) ;;
126 *) AC_CHECK_LIB(socket, connect) ;;
130 *) AC_CHECK_LIB(inet, connect) ;;
132 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
134 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
135 test x"$ac_cv_lib_inet_connect" = x"yes"; then
136 # ac_cv_func_connect=yes
137 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
138 AC_DEFINE(HAVE_CONNECT)
142 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod)
143 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
144 AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob pipe crypt16 getauthuid)
145 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
146 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf)
147 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate)
148 AC_CHECK_FUNCS(grantpt dup2 yp_get_default_domain getpwanam)
149 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp)
151 AC_CHECK_FUNCS(getdents)
152 AC_CHECK_FUNCS(llseek)
155 # If no strcasecmp, check for it in some known places
156 # It is in -lresolv on ReliantUNIX and UnixWare
157 # -lresolve *must* follow -lnsl for name resolution to work properly
160 if test x$ac_cv_func_strcasecmp = xno ; then
161 AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
162 AC_DEFINE(HAVE_STRCASECMP))
166 # Check for the functions putprpwnam, set_auth_parameters,
167 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
168 # Needed for OSF1 and HPUX.
171 AC_LIBTESTFUNC(security, putprpwnam)
172 AC_LIBTESTFUNC(sec, putprpwnam)
174 AC_LIBTESTFUNC(security, set_auth_parameters)
175 AC_LIBTESTFUNC(sec, set_auth_parameters)
177 AC_LIBTESTFUNC(security, getspnam)
178 AC_LIBTESTFUNC(sec, getspnam)
180 AC_LIBTESTFUNC(security, bigcrypt)
181 AC_LIBTESTFUNC(sec, bigcrypt)
183 AC_LIBTESTFUNC(security, getprpwnam)
184 AC_LIBTESTFUNC(sec, getprpwnam)
186 # this bit needs to be modified for each OS that is suported by
187 # smbwrapper. You need to specify how to created a shared library and
188 # how to compile C code to produce PIC object files
190 # these are the defaults, good for lots of systems
194 # and these are for particular systems
196 *linux*) AC_DEFINE(LINUX, 1, [Define on Linux]);;
197 *solaris*) AC_DEFINE(SUNOS5, 1, [Define on SunOS 5 (Solaris)])
200 *sunos*) AC_DEFINE(SUNOS4, 1, [Define on SunOS 4])
203 *bsd*) LDSHFLAGS="-shared -Bshareable"
205 *irix*) AC_DEFINE(IRIX, 1, [Define on IRIX])
207 *irix6*) AC_DEFINE(IRIX6, 1, [Define on IRIX 6])
210 ATTEMPT_WRAP32_BUILD=yes
212 *aix*) AC_DEFINE(AIX, 1, [Define on AIX]);;
213 *hpux*) AC_DEFINE(HPUX, 1, [Define on HP-UX]);;
214 *qnx*) AC_DEFINE(QNX, 1, [Define on QNX]);;
215 *osf*) AC_DEFINE(OSF1, 1, [Define on OSF1]);;
216 *sco*) AC_DEFINE(SCO, 1, [Define on SCO]);;
217 *next2*) AC_DEFINE(NEXT2, 1, [Define on NeXT 2]);;
218 *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
221 *-univel-*) if [ test "$GCC" != yes ]; then
222 AC_DEFINE(HAVE_MEMSET)
229 if [ test "$GCC" != yes ]; then
230 AC_DEFINE(HAVE_MEMSET)
238 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
239 AC_TRY_RUN([#include <stdio.h>
240 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
241 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
242 if test x"$samba_cv_have_longlong" = x"yes"; then
243 AC_DEFINE(HAVE_LONGLONG, 1, [Define if long long is usable])
246 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
247 AC_TRY_COMPILE([#include <sys/types.h>
248 #include <sys/socket.h>
249 #include <netinet/in.h>],
250 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
251 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
252 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
253 AC_DEFINE(HAVE_SOCK_SIN_LEN, 1, [Define if struct sockaddr_in has sin_len field])
256 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
257 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
258 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
259 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
260 AC_DEFINE(HAVE_FILE_MACRO, 1, [Define if __FILE__ macro is supported])
263 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
264 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
265 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
266 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
267 AC_DEFINE(HAVE_FUNCTION_MACRO, 1, [Define if __FUNCTION__ macro is supported])
270 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
272 #include <sys/time.h>
274 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
275 samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
276 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
277 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define if gettimeofday takes tz argument])
281 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
282 AC_TRY_RUN([#include <sys/types.h>
284 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
285 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
286 di->d_name[0] == 0) exit(0); exit(1);} ],
287 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
288 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
289 AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define if readdir() is broken])
292 AC_CACHE_CHECK([for kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS,[
293 AC_TRY_COMPILE([#include <sys/types.h>
295 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
296 samba_cv_HAVE_KERNEL_OPLOCKS=yes,samba_cv_HAVE_KERNEL_OPLOCKS=no)])
297 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
298 AC_DEFINE(HAVE_KERNEL_OPLOCKS, 1, [Define to use kernel oplock capabilities])
302 # Check for int16, uint16, int32 and uint32 in rpc/types.h included from rpc/rpc.h
303 # This is *really* broken but some systems (DEC OSF1) do this.... JRA.
306 AC_CACHE_CHECK([for int16 typedef included by rpc/rpc.h],samba_cv_HAVE_INT16_FROM_RPC_RPC_H,[
307 AC_TRY_COMPILE([#include <sys/types.h>
308 #if defined(HAVE_RPC_RPC_H)
312 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
313 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
314 AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H, 1, [Define if rpc/rpc.h defines int16])
317 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
318 AC_TRY_COMPILE([#include <sys/types.h>
319 #if defined(HAVE_RPC_RPC_H)
323 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
324 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
325 AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H, 1, [Define if rpc/rpc.h defines uint16])
328 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
329 AC_TRY_COMPILE([#include <sys/types.h>
330 #if defined(HAVE_RPC_RPC_H)
334 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
335 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
336 AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H, 1, [Define if rpc/rpc.h defines int32])
339 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
340 AC_TRY_COMPILE([#include <sys/types.h>
341 #if defined(HAVE_RPC_RPC_H)
345 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
346 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
347 AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H, 1, [Define if rpc/rpc.h defines uint32])
351 dnl Some systems (SCO) have a problem including
352 dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
353 dnl as a #define in <prot.h> and as part of an enum
357 AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
358 AC_TRY_COMPILE([#include <sys/types.h>
359 #ifdef HAVE_SYS_SECURITY_H
360 #include <sys/security.h>
362 #endif /* HAVE_SYS_SECURITY_H */
363 #if defined(HAVE_RPC_RPC_H)
367 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
368 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
369 AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT, 1, [Define if rpc/rpc.h defines AUTH_ERROR])
373 AC_CACHE_CHECK([for netmask ifconf],samba_cv_HAVE_NETMASK_IFCONF,[
375 #define HAVE_NETMASK_IFCONF 1
377 #include "confdefs.h"
378 #include "${srcdir-.}/lib/netmask.c"],
379 samba_cv_HAVE_NETMASK_IFCONF=yes,samba_cv_HAVE_NETMASK_IFCONF=no,samba_cv_HAVE_NETMASK_IFCONF=cross)])
380 if test x"$samba_cv_HAVE_NETMASK_IFCONF" = x"yes"; then
381 netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF, 1, [Define to use IFCONF style netmask])
384 if test $netmask = no; then
385 AC_CACHE_CHECK([for netmask ifreq],samba_cv_HAVE_NETMASK_IFREQ,[
387 #define HAVE_NETMASK_IFREQ 1
389 #include "confdefs.h"
390 #include "${srcdir-.}/lib/netmask.c"],
391 samba_cv_HAVE_NETMASK_IFREQ=yes,samba_cv_HAVE_NETMASK_IFREQ=no,samba_cv_HAVE_NETMASK_IFREQ=cross)])
392 if test x"$samba_cv_HAVE_NETMASK_IFREQ" = x"yes"; then
393 netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ, 1, [Define to use IFREQ style netmask])
397 if test $netmask = no; then
398 AC_CACHE_CHECK([for netmask AIX],samba_cv_HAVE_NETMASK_AIX,[
400 #define HAVE_NETMASK_AIX 1
402 #include "confdefs.h"
403 #include "${srcdir-.}/lib/netmask.c"],
404 samba_cv_HAVE_NETMASK_AIX=yes,samba_cv_HAVE_NETMASK_AIX=no,samba_cv_HAVE_NETMASK_AIX=cross)])
405 if test x"$samba_cv_HAVE_NETMASK_AIX" = x"yes"; then
406 netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX, 1, [Define to use AIX style netmask])
411 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
412 AC_TRY_COMPILE([#include <sys/acl.h>
413 #if defined(HAVE_RPCSVC_NIS_H)
414 #include <rpcsvc/nis.h>
417 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
418 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
419 AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES, 1,
420 [Define if sys/acl.h and rpcsvc/nis.h cannot be included together])
424 #################################################
425 # check for a LDAP password database
426 AC_MSG_CHECKING([whether to use LDAP password database])
428 [ --with-ldap Include LDAP support
429 --without-ldap Don't include LDAP support (default)],
433 AC_DEFINE(WITH_LDAP, 1, [Define to enable LDAP support])
442 #################################################
443 # check for a NISPLUS password database
444 AC_MSG_CHECKING([whether to use NISPLUS password database])
446 [ --with-nisplus Include NISPLUS password database support
447 --without-nisplus Don't include NISPLUS password database support (default)],
451 AC_DEFINE(WITH_NISPLUS, 1, [Define to enable NIS+ support])
460 #################################################
461 # check for a NISPLUS_HOME support
462 AC_MSG_CHECKING([whether to use NISPLUS_HOME])
463 AC_ARG_WITH(nisplus-home,
464 [ --with-nisplus-home Include NISPLUS_HOME support
465 --without-nisplus-home Don't include NISPLUS_HOME support (default)],
469 AC_DEFINE(WITH_NISPLUS_HOME, 1, [Define to support NISPLUS_HOME variable])
478 #################################################
479 # check for the secure socket layer
480 AC_MSG_CHECKING([whether to use SSL])
482 [ --with-ssl Include SSL support
483 --without-ssl Don't include SSL support (default)
484 --with-sslinc=DIR Where the SSL includes are (defaults to /usr/local/ssl)],
488 AC_DEFINE(WITH_SSL, 1, [Define to enable SSL support])
489 withval="/usr/local/ssl" # default
491 if test "${with_sslinc+set}" = set; then
493 withval="$with_sslinc"
496 AC_MSG_WARN([--with-sslinc called without argument - will use default])
497 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
498 LIBS="-lssl -lcrypto $LIBS"
499 LDFLAGS="=L/usr/local/ssl/lib $LDFLAGS"
502 CFLAGS="-I${withval}/include $CFLAGS"
503 LIBS="-lssl -l crypto $LIBS"
504 LDFLAGS="-L${withval}/lib $LDFLAGS"
510 CFLAGS="-I/usr/local/ssl/include $CFLAGS"
511 LIBS="-lssl -lcrypto $LIBS"
512 LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
516 if test ! -d ${withval}; then
517 AC_MSG_ERROR([called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config])
520 CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS" # Damn, SSLeay defines its own
531 #################################################
532 # set configuration directory location
533 configdir="\$(LIBDIR)"
534 AC_ARG_WITH(configdir,
535 [ --with-configdir=DIR Where to put configuration files (\$libdir)],
539 # Just in case anybody does it
541 AC_MSG_WARN([--with-configdir called without argument - will use default])
550 #################################################
551 # set codepage directory location
552 codepagedir="\$(LIBDIR)/codepages"
553 AC_ARG_WITH(codepagedir,
554 [ --with-codepagedir=DIR Where to put codepage files (\$libdir/codepages)],
558 # Just in case anybody does it
560 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
563 codepagedir="$withval"
567 AC_MSG_CHECKING([configure summary])
573 #if !(defined(HAVE_NETMASK_IFCONF) || defined(HAVE_NETMASK_IFREQ) || defined(HAVE_NETMASK_AIX))
574 printf("WARNING: No automated netmask determination - use an interfaces line\n");
577 #if !((defined(HAVE_RANDOM) || defined(HAVE_RAND)) && (defined(HAVE_SRANDOM) || defined(HAVE_SRAND)))
578 printf("ERROR: No random or srandom routine!\n");
586 AC_MSG_RESULT(failure)
587 AC_MSG_ERROR([Aborting config]),:)
592 AC_SUBST(codepagedir)
594 AC_OUTPUT([include/stamp-h Makefile])