4 AC_CONFIG_AUX_DIR(config)
7 dnl Should we enable SASLAUTHd at all?
8 AC_ARG_WITH(saslauthd, [ --with-saslauthd=DIR enable use of the saslauth daemon using state dir DIR ],
9 with_saslauthd=$withval,
11 if test "$with_saslauthd" = yes; then
12 with_saslauthd="/var/state/saslauthd"
14 AC_DEFINE(HAVE_SASLAUTHD,[],[Include support for saslauthd?])
15 AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd",[Location of saslauthd socket])
16 AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no)
18 AM_INIT_AUTOMAKE(saslauthd,2.1.23)
21 dnl Checks for programs.
29 dnl Checks for build foo
31 CMU_GUESS_RUNPATH_SWITCH
33 dnl Checks for libraries.
37 AC_MSG_CHECKING(for OpenSSL)
38 AC_MSG_RESULT($with_openssl)
42 dnl mechanism-related checking
46 if test "$gssapi" != no; then
47 if test "$gss_impl" = "heimdal"; then
48 AC_DEFINE(KRB5_HEIMDAL,[],[Using Heimdal])
50 AC_DEFINE(HAVE_GSSAPI,[],[Include GSSAPI/Kerberos 5 Support])
55 AC_ARG_ENABLE(sia, [ --enable-sia enable SIA authentication [no] ],
59 if test "$sia" != no; then
60 if test -f /etc/sia/matrix.conf; then
61 AC_DEFINE(HAVE_SIA,[],[Include SIA Support])
62 LIB_SIA="-lsecurity -ldb -lm -laud"
64 AC_ERROR([No support for SIA found])
69 AC_ARG_ENABLE(auth-sasldb, [ --enable-auth-sasldb enable experimental SASLdb authentication module [no] ],
70 authsasldb=$enableval,
72 if test "$authsasldb" != no; then
73 if test ! -d "../sasldb"; then
74 echo "ERROR: Cannot build sasldb module outside of the full SASL source tree."
77 AC_DEFINE(AUTH_SASLDB,[],[Include SASLdb Support])
80 SASL_DB_LIB="$SASL_DB_LIB ../sasldb/.libs/libsasldb.al"
83 AC_ARG_ENABLE(httpform, [ --enable-httpform enable HTTP form authentication [[no]] ],
86 if test "$httpform" != no; then
87 AC_DEFINE(HAVE_HTTPFORM,[],[Include HTTP form Support])
90 AC_ARG_WITH(pam, [ --with-pam=DIR use PAM (rooted in DIR) [yes] ],
93 if test "$with_pam" != no; then
94 if test -d $with_pam; then
95 CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
96 LDFLAGS="$LDFLAGS -L${with_pam}/lib"
99 AC_CHECK_LIB(pam, pam_start, [
100 AC_CHECK_HEADER(security/pam_appl.h,,
102 with_pam=no, $SASL_DL_LIB)
103 LIBS="$cmu_save_LIBS"
106 AC_ARG_WITH(ipctype, [ --with-ipctype={unix,doors} use ipctype [unix] ],
107 with_ipctype=$withval,
109 MAIN_COMPAT_OBJ="saslauthd-${with_ipctype}.o"
110 AC_SUBST(MAIN_COMPAT_OBJ)
111 if test "$with_ipctype" = "doors"; then
112 AC_DEFINE(USE_DOORS,[],[Use the doors IPC API])
113 AC_DEFINE(SASLAUTHD_THREADED,[],[Saslauthd runs threaded?])
114 LIBS="$LIBS -ldoor -lpthread"
117 AC_MSG_CHECKING(for PAM support)
118 AC_MSG_RESULT($with_pam)
120 if test "$with_pam" != no; then
121 AC_DEFINE(HAVE_PAM,[],[Support for PAM?])
126 AC_CHECK_LIB(resolv, inet_aton)
128 AC_MSG_CHECKING(to include LDAP support)
129 AC_ARG_WITH(ldap, [ --with-ldap=DIR use LDAP (in DIR) [no] ],
132 AC_MSG_RESULT($with_ldap)
134 if test -d $with_ldap; then
135 CPPFLAGS="$CPPFLAGS -I${with_ldap}/include"
136 CMU_ADD_LIBPATH(${with_ldap}/lib)
140 if test "$with_ldap" != no; then
141 AC_CHECK_LIB(ldap, ldap_initialize, [ AC_DEFINE(HAVE_LDAP,[],[Support for LDAP?])
142 LDAP_LIBS="-lldap -llber"
143 if test "$with_openssl" != "no"; then
144 LDAP_LIBS="$LDAP_LIBS -lcrypto $LIB_RSAREF"
151 dnl Checks for header files.
155 AC_CHECK_HEADERS(crypt.h fcntl.h krb5.h strings.h syslog.h unistd.h sys/time.h sys/uio.h)
157 dnl Checks for typedefs, structures, and compiler characteristics.
161 LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
164 dnl Checks for which function macros exist
165 AC_MSG_CHECKING(whether $CC implements __func__)
166 AC_CACHE_VAL(have_func,
167 [AC_TRY_LINK([#include <stdio.h>],[printf("%s", __func__);],
170 AC_MSG_RESULT($have_func)
171 if test "$have_func" = yes; then
172 AC_DEFINE(HAVE_FUNC,[],[Does the compiler understand __func__])
174 AC_MSG_CHECKING(whether $CC implements __PRETTY_FUNCTION__)
175 AC_CACHE_VAL(have_pretty_function,
176 [AC_TRY_LINK([#include <stdio.h>],[printf("%s", __PRETTY_FUNCTION__);],
177 have_pretty_function=yes,
178 have_pretty_function=no)])
179 AC_MSG_RESULT($have_pretty_function)
180 if test "$have_pretty_function" = yes; then
181 AC_DEFINE(HAVE_PRETTY_FUNCTION,[],[Does compiler understand __PRETTY_FUNCTION__])
183 AC_MSG_CHECKING(whether $CC implements __FUNCTION__)
184 AC_CACHE_VAL(have_function,
185 [AC_TRY_LINK([#include <stdio.h>],[printf("%s", __FUNCTION__);],
188 AC_MSG_RESULT($have_function)
189 if test "$have_function" = yes; then
190 AC_DEFINE(HAVE_FUNCTION,[],[Does compiler understand __FUNCTION__])
195 dnl Checks for library functions.
197 AC_CHECK_FUNCS(gethostname mkdir socket strdup)
198 AC_CHECK_FUNCS(getspnam getuserpw, break)
199 AC_CHECK_FUNCS(strlcat strlcpy)
201 if test $ac_cv_func_getspnam = yes; then
202 AC_MSG_CHECKING(if getpwnam_r/getspnam_r take 5 arguments)
205 #include <sys/types.h>
213 (void) getpwnam_r("bin", &pwbuf, pwdata, sizeof(pwdata), &pw);
216 AC_DEFINE(GETXXNAM_R_5ARG, 1,
217 [Define if your getpwnam_r()/getspnam_r()
218 functions take 5 arguments])],
223 dnl Check for getaddrinfo
225 sasl_cv_getaddrinfo=no
226 IPv6_CHECK_FUNC(getaddrinfo,
227 [AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo() function?])], [sasl_cv_getaddrinfo=yes])
228 if test $sasl_cv_getaddrinfo = yes; then
229 AC_LIBOBJ(getaddrinfo)
232 dnl Check for getnameinfo
234 sasl_cv_getnameinfo=no
235 IPv6_CHECK_FUNC(getnameinfo,
236 [AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo() function?])], [sasl_cv_getnameinfo=yes])
237 if test $sasl_cv_getnameinfo = yes; then
238 AC_LIBOBJ(getnameinfo)
241 IPv6_CHECK_SS_FAMILY()
243 IPv6_CHECK_SOCKLEN_T()
245 AC_EGREP_HEADER(sockaddr_storage, sys/socket.h,
246 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have a sockaddr_storage struct?]))
257 #ifndef HAVE___ATTRIBUTE__
258 /* Can't use attributes... */
259 #define __attribute__(foo)
263 #include <sys/types.h>
264 #include <sys/socket.h>
267 # include <sys/param.h>
269 # include <winsock2.h>
273 #include <netinet/in.h>
275 #ifndef HAVE_SOCKLEN_T
276 typedef unsigned int socklen_t;
277 #endif /* HAVE_SOCKLEN_T */
279 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
280 #define _SS_MAXSIZE 128 /* Implementation specific max size */
281 #define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr))
283 struct sockaddr_storage {
284 struct sockaddr ss_sa;
285 char __ss_pad2[_SS_PADSIZE];
287 # define ss_family ss_sa.sa_family
288 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
291 /* Define it to something that should never appear */
292 #define AF_INET6 AF_MAX
295 /* Create a struct iovec if we need one */
296 #if !defined(HAVE_SYS_UIO_H)
302 #include <sys/types.h>
306 #ifndef HAVE_GETADDRINFO
307 #define getaddrinfo sasl_getaddrinfo
308 #define freeaddrinfo sasl_freeaddrinfo
309 #define getnameinfo sasl_getnameinfo
310 #define gai_strerror sasl_gai_strerror
314 #ifndef AI_NUMERICHOST /* support glibc 2.0.x */
315 #define AI_NUMERICHOST 4
316 #define NI_NUMERICHOST 2
317 #define NI_NAMEREQD 4
318 #define NI_NUMERICSERV 8
321 /* handy string manipulation functions */
323 extern size_t saslauthd_strlcpy(char *dst, const char *src, size_t len);
324 #define strlcpy(x,y,z) saslauthd_strlcpy((x),(y),(z))
327 extern size_t saslauthd_strlcat(char *dst, const char *src, size_t len);
328 #define strlcat(x,y,z) saslauthd_strlcat((x),(y),(z))
334 AC_CONFIG_HEADERS(saslauthd.h)