1 dnl configure.in for the SASL library
4 dnl $Id: configure.in,v 1.213.2.1 2009/04/27 17:58:25 murch Exp $
6 dnl Copyright (c) 2001 Carnegie Mellon University. All rights reserved.
8 dnl Redistribution and use in source and binary forms, with or without
9 dnl modification, are permitted provided that the following conditions
12 dnl 1. Redistributions of source code must retain the above copyright
13 dnl notice, this list of conditions and the following disclaimer.
15 dnl 2. Redistributions in binary form must reproduce the above copyright
16 dnl notice, this list of conditions and the following disclaimer in
17 dnl the documentation and/or other materials provided with the
20 dnl 3. The name "Carnegie Mellon University" must not be used to
21 dnl endorse or promote products derived from this software without
22 dnl prior written permission. For permission or any other legal
23 dnl details, please contact
24 dnl Office of Technology Transfer
25 dnl Carnegie Mellon University
26 dnl 5000 Forbes Avenue
27 dnl Pittsburgh, PA 15213-3890
28 dnl (412) 268-4387, fax: (412) 268-7395
29 dnl tech-transfer@andrew.cmu.edu
31 dnl 4. Redistributions of any form whatsoever must retain the following
33 dnl \"This product includes software developed by Computing Services
34 dnl at Carnegie Mellon University (http://www.cmu.edu/computing/).\"
36 dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
37 dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38 dnl AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
39 dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
40 dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
41 dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
42 dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
44 AC_INIT(lib/saslint.h)
46 AC_CONFIG_MACRO_DIR([config])
48 dnl use ./config.cache as the default cache file.
49 dnl we require a cache file to successfully configure our build.
50 if test $cache_file = "/dev/null"; then
51 cache_file="./config.cache"
55 AC_CONFIG_AUX_DIR(config)
60 dnl REMINDER: When changing the version number here, please also update
61 dnl the values in win32/include/config.h and include/sasl.h as well.
63 AM_INIT_AUTOMAKE(cyrus-sasl, 2.1.23)
66 # and include our config dir scripts
67 ACLOCAL="$ACLOCAL -I \$(top_srcdir)/config"
71 AC_ARG_ENABLE(cmulocal,
72 [AC_HELP_STRING([--enable-cmulocal],
73 [enable local mods for CMU [[no]]])],
78 [AC_HELP_STRING([--enable-sample],
79 [compile sample code [[yes]]])],
90 dnl check for -R, etc. switch
91 CMU_GUESS_RUNPATH_SWITCH
94 AC_ARG_WITH(staticsasl)
95 if test "$with_staticsasl" = yes; then
101 if test -z "$target"; then
111 if test "$enable_static" = yes; then
112 SASL_STATIC_LIBS=libsasl2.a
117 AC_ARG_ENABLE(staticdlopen, [ --enable-staticdlopen try dynamic plugins when we are a static libsasl [[no]] ],
118 enable_staticdlopen=$enableval,
119 enable_staticdlopen=no)
121 if test "$enable_staticdlopen" = yes; then
122 AC_DEFINE(TRY_DLOPEN_WHEN_STATIC,[],[Should we try to dlopen() plugins while staticly compiled?])
125 if test "$ac_cv_prog_gcc" = yes; then
126 CFLAGS="-Wall -W ${CFLAGS}"
129 AC_ARG_WITH(purecov,[ --with-purecov link with purecov])
130 if test "$with_purecov" = yes; then
131 AC_CHECK_PROGS(PURECOV, purecov)
133 AC_ARG_WITH(purify,[ --with-purify link with purify])
134 if test "$with_purify" = yes; then
135 AC_CHECK_PROGS(PURIFY, purify)
138 AC_ARG_ENABLE(java, [ --enable-java compile Java support [[no]]],
139 enable_java=$enableval, enable_java=no)
140 if test "$enable_java" = yes; then
141 AC_PATH_PROG(JAVAC, javac, no)
142 AC_PATH_PROGS(JAVAH, javah kaffeh, no)
143 AC_CHECK_PROGS(JAVADOC, javadoc, :)
144 if test "$JAVAC" = "no" -o "$JAVAH" = "no"; then
145 AC_WARN([Disabling Java support])
149 # Make distcheck work
154 AM_CONDITIONAL(JAVA, test "$enable_java" = yes)
156 if test "$enable_java" = yes; then
157 AC_MSG_CHECKING([JNI cpp flags])
158 AC_CACHE_VAL(sasl_cv_java_includes,[
159 if test `echo $JAVAH | sed 's,.*/,,'` = "kaffeh"; then
160 sasl_cv_java_includes=-I`echo $JAVAH | sed -e 's,/bin.*,/include/kaffe,'`
162 java_base=`echo $JAVAC | sed 's,/bin.*,'','`
164 AC_ARG_WITH(javabase, [ --with-javabase=PATH set path to find jni.h in [/usr/java/include] ],
168 sasl_cv_java_includes=''
169 for dir in `find ${java_base}/include -follow -type d -print | grep -v green_threads`; do
170 sasl_cv_java_includes="${sasl_cv_java_includes} -I$dir"
174 sasl_cv_java_includes="${sasl_cv_java_includes} -I$javapath/include"])
176 JAVA_INCLUDES=$sasl_cv_java_includes
177 AC_SUBST(JAVA_INCLUDES)
182 JAVAC=`echo "$JAVAC" | sed 's,.*/,,'`
183 JAVAH=`echo "$JAVAH" | sed 's,.*/,,'`
186 AM_CONDITIONAL(SAMPLE, test "$enable_sample" = yes)
188 dnl call before we do the berkeley DB checks
191 dnl we extracted this to config/sasldb.m4
195 # Do we not install the SASL DB man pages?
196 AM_CONDITIONAL(NO_SASL_DB_MANS, test "x$SASL_DB_MANS" = "x")
198 AC_ARG_ENABLE(keep_db_open, [ --enable-keep-db-open keep handle to Berkeley DB open for improved performance [[no]] ],
199 keep_db_open=$enableval,
202 # Disable if Berkeley DB is not used
203 if test "$dblib" != berkeley; then
207 if test "$keep_db_open" = yes; then
208 AC_DEFINE(KEEP_DB_OPEN,[],[Should we keep handle to Berkeley DB open in SASLDB plugin?])
210 AC_MSG_CHECKING(if Berkeley DB handle is kept open in SASLDB)
211 AC_MSG_RESULT($keep_db_open)
213 AC_CHECK_LIB(dl, dlopen, SASL_DL_LIB="-ldl", SASL_DL_LIB="")
214 AC_SUBST(SASL_DL_LIB)
218 AC_ARG_WITH(devrandom, [ --with-devrandom=PATH set the path to /dev/random [[/dev/random]] ],
220 devrandom=/dev/random)
221 AC_MSG_CHECKING(/dev/random to use)
222 AC_MSG_RESULT($devrandom)
223 AC_DEFINE_UNQUOTED(SASL_DEV_RANDOM, "$devrandom", [File to use for source of randomness])
225 dnl Do we need leading underscores on our symbols?
227 AC_CHECK_PROGS(NM, nm)
229 AC_MSG_CHECKING(for underscore before symbols)
230 AC_CACHE_VAL(sasl_cv_uscore,[
231 echo "main(){int i=1;}
232 foo(){int i=6;}" > conftest.c
233 ${CC} -o a.out conftest.c > /dev/null
234 if (${NM} a.out | grep _foo) > /dev/null; then
239 AC_MSG_RESULT($sasl_cv_uscore)
240 rm -f conftest.c a.out
242 if test $sasl_cv_uscore = yes; then
243 if test $ac_cv_lib_dl_dlopen = yes ; then
244 AC_MSG_CHECKING(whether dlsym adds the underscore for us)
245 cmu_save_LIBS="$LIBS"
246 LIBS="$LIBS $SASL_DL_LIB"
247 AC_CACHE_VAL(sasl_cv_dlsym_adds_uscore,AC_TRY_RUN( [
251 main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
252 if(self) { ptr1=dlsym(self,"foo"); ptr2=dlsym(self,"_foo");
253 if(ptr1 && !ptr2) exit(0); } exit(1); }
254 ], [sasl_cv_dlsym_adds_uscore=yes], sasl_cv_dlsym_adds_uscore=no
255 AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, [], [Do we need a leading _ for dlsym?]),
256 AC_MSG_WARN(cross-compiler, we'll do our best)))
257 LIBS="$cmu_save_LIBS"
258 AC_MSG_RESULT($sasl_cv_dlsym_adds_uscore)
262 dnl See if we can provide a default logging function...
263 AC_CHECK_FUNCS(syslog)
265 AC_ARG_WITH(pam, [ --with-pam=DIR use PAM (rooted in DIR) [[yes]] ],
268 if test "$with_pam" != no; then
269 if test -d $with_pam; then
270 CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
271 LDFLAGS="$LDFLAGS -L${with_pam}/lib"
273 AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
274 cmu_save_LIBS="$LIBS"
275 AC_CHECK_FUNC(pam_start, :,
278 #include <sys/types.h>
279 #ifdef HAVE_PAM_PAM_APPL_H
280 #include <pam/pam_appl.h>
282 #ifdef HAVE_SECURITY_PAM_H
283 #include <security/pam_appl.h>
285 const char *service="foo";
286 const char *user="bar";
288 struct pam_conv *conv;
290 baz = pam_start(service, user, conv, &pamh);
294 LIBS="$cmu_save_LIBS $LIBPAM"
297 AC_ARG_WITH(saslauthd, [ --with-saslauthd=DIR enable use of the saslauth daemon using state dir DIR ],
298 with_saslauthd=$withval,
300 if test "$with_saslauthd" != no; then
301 if test "$with_saslauthd" = yes; then
302 with_saslauthd="/var/state/saslauthd"
304 AC_DEFINE(HAVE_SASLAUTHD,[],[Include support for saslauthd?])
305 AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd",
306 [Where do we look for saslauthd's socket?])
308 AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no)
309 AC_MSG_CHECKING(if I should include saslauthd)
310 AC_MSG_RESULT($with_saslauthd)
312 AC_ARG_WITH(authdaemond, [ --with-authdaemond=PATH enable use of authdaemon with default socket=PATH [[yes]] ],
313 with_authdaemon=$withval,
315 if test "$with_authdaemon" != no; then
316 if test "$with_authdaemon" = yes; then
317 with_authdaemon="/dev/null"
319 AC_DEFINE(HAVE_AUTHDAEMON,[],[Include support for Courier's authdaemond?])
320 AC_DEFINE_UNQUOTED(PATH_AUTHDAEMON_SOCKET, "$with_authdaemon",
321 [Where do we look for Courier authdaemond's socket?])
323 AC_MSG_CHECKING(to include Courier authdaemond support)
324 AC_MSG_RESULT($with_authdaemon)
327 [ --with-pwcheck=DIR enable deprecated pwcheck daemon using statedir DIR ],
328 with_pwcheck=$withval,
330 if test "$with_pwcheck" != no; then
331 if test "$with_pwcheck" = yes; then
332 with_pwcheck=/var/pwcheck
334 AC_DEFINE(HAVE_PWCHECK,[],[Include Support for pwcheck daemon?])
335 AC_DEFINE_UNQUOTED(PWCHECKDIR, "$with_pwcheck", [Location of pwcheck socket])
336 AC_CHECK_FUNC(getspnam,PWCHECKMETH="getspnam",PWCHECKMETH="getpwnam")
337 AC_SUBST(PWCHECKMETH)
339 AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no)
340 AC_MSG_CHECKING(if I should include pwcheck)
341 AC_MSG_RESULT($with_pwcheck)
343 AC_ARG_WITH(ipctype, [ --with-ipctype={unix,doors} use ipctype [[unix]] ],
344 with_ipctype=$withval,
346 IPCTYPE=$with_ipctype
349 if test "$with_ipctype" = "doors"; then
351 AC_DEFINE(USE_DOORS,[],[use the doors IPC API for saslauthd?])
355 AC_ARG_ENABLE(alwaystrue, [ --enable-alwaystrue enable the alwaystrue password verifier (discouraged)],
356 enable_alwaystrue=$enableval,
357 enable_alwaystrue=no)
358 if test "$enable_alwaystrue" = yes; then
359 AC_DEFINE(HAVE_ALWAYSTRUE, [], [Enable 'alwaystrue' password verifier?])
361 AC_MSG_CHECKING(if I should include the alwaystrue verifier)
362 AC_MSG_RESULT($enable_alwaystrue)
364 dnl sasl_checkapop support
365 AC_ARG_ENABLE(checkapop, [ --enable-checkapop enable use of sasl_checkapop [[yes]] ],
366 checkapop=$enableval,
369 AC_MSG_CHECKING(if we should enable sasl_checkapop)
370 if test "$checkapop" != no; then
371 AC_MSG_RESULT(enabled)
372 AC_DEFINE(DO_SASL_CHECKAPOP, [], [should we support sasl_checkapop?])
374 AC_MSG_RESULT(disabled)
378 AC_ARG_ENABLE(cram, [ --enable-cram enable CRAM-MD5 authentication [[yes]] ],
382 AC_MSG_CHECKING(CRAM-MD5)
383 if test "$cram" != no; then
384 AC_MSG_RESULT(enabled)
385 SASL_MECHS="$SASL_MECHS libcrammd5.la"
386 if test "$enable_static" = yes; then
387 SASL_STATIC_OBJS="$SASL_STATIC_OBJS cram.o"
388 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/cram.c"
389 AC_DEFINE(STATIC_CRAMMD5, [], [Link CRAM-MD5 Staticly])
392 AC_MSG_RESULT(disabled)
396 AC_MSG_CHECKING(for OpenSSL)
397 AC_MSG_RESULT($with_openssl)
402 AC_ARG_ENABLE(digest, [ --enable-digest enable DIGEST-MD5 authentication [[yes]] ],
406 if test "$digest" != no; then
407 dnl In order to compile digest, we should look for need libdes.
408 if test -d $digest; then
409 CPPFLAGS="$CPPFLAGS -I$digest/include"
410 LDFLAGS="$LDFLAGS -L$digest/lib"
412 if test "$with_des" = no; then
413 AC_WARN(No DES support for DIGEST-MD5)
417 AC_MSG_CHECKING(DIGEST-MD5)
418 if test "$digest" != no; then
419 AC_MSG_RESULT(enabled)
420 SASL_MECHS="$SASL_MECHS libdigestmd5.la"
421 if test "$enable_static" = yes; then
422 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/digestmd5.c"
423 SASL_STATIC_OBJS="$SASL_STATIC_OBJS digestmd5.o"
424 AC_DEFINE(STATIC_DIGESTMD5, [], [Link DIGEST-MD5 Staticly])
427 AC_MSG_RESULT(disabled)
431 AC_ARG_ENABLE(otp, [ --enable-otp enable OTP authentication [[yes]] ],
435 if test "$with_openssl" = no; then
436 AC_WARN([OpenSSL not found -- OTP will be disabled])
441 if test "$otp" != no; then
442 AC_MSG_RESULT(enabled)
443 OTP_LIBS="-lcrypto $LIB_RSAREF"
445 SASL_MECHS="$SASL_MECHS libotp.la"
446 if test "$enable_static" = yes; then
447 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/otp.c"
448 SASL_STATIC_OBJS="$SASL_STATIC_OBJS otp.o"
449 AC_DEFINE(STATIC_OTP, [], [Link OTP Staticly])
453 AC_ARG_WITH(with-opie,[ --with-opie=PATH use OPIE (One Time Passwords in Everything) from PATH],
454 with_opie="${withval}")
458 AC_CHECK_LIB(opie, opiechallenge, [
459 AC_CHECK_HEADER(opie.h, with_opie="yes",
464 if test -d $with_opie; then
465 CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
466 LDFLAGS="${LDFLAGS} -L${with_opie}/lib"
473 AC_MSG_CHECKING(for OPIE)
474 AC_MSG_RESULT($with_opie)
476 if test "$with_opie" != no; then
477 AC_DEFINE(HAVE_OPIE,[],[Use OPIE for server-side OTP?])
478 OTP_LIBS="$OTP_LIBS -lopie"
484 AC_MSG_RESULT(disabled)
488 AC_ARG_ENABLE(srp, [ --enable-srp enable SRP authentication [[no]] ],
492 if test "$with_openssl" = no; then
493 AC_WARN([OpenSSL not found -- SRP will be disabled])
498 if test "$srp" != no; then
499 AC_MSG_RESULT(enabled)
500 SRP_LIBS="-lcrypto $LIB_RSAREF"
502 SASL_MECHS="$SASL_MECHS libsrp.la"
503 if test "$enable_static" = yes; then
504 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/srp.c"
505 SASL_STATIC_OBJS="$SASL_STATIC_OBJS srp.o"
506 AC_DEFINE(STATIC_SRP, [], [Link SRP Staticly])
509 dnl srp_setpass support
510 AC_ARG_ENABLE(srp_setpass, [ --enable-srp-setpass enable setting SRP secrets with saslpasswd [[no]]],
511 srp_setpass=$enableval,
514 AC_MSG_CHECKING(if we should enable setting SRP secrets with saslpasswd)
515 if test "$srp_setpass" != no; then
516 AC_MSG_RESULT(enabled)
517 AC_DEFINE(DO_SRP_SETPASS, [], [should we support setpass() for SRP?])
519 AC_MSG_RESULT(disabled)
524 AC_MSG_RESULT(disabled)
527 dnl Kerberos based Mechanisms
531 if test "$gssapi" != "no"; then
532 AC_DEFINE(STATIC_GSSAPIV2,[],[Link GSSAPI Staticly])
534 if test "$gss_impl" = "mit"; then
537 AC_MSG_CHECKING(to use mutexes aroung GSS calls)
538 AC_ARG_ENABLE(gss_mutexes, [ --enable-gss_mutexes use mutexes around calls to the GSS library],
539 use_gss_mutexes=$enableval,
540 use_gss_mutexes=$mutex_default)
541 if test $use_gss_mutexes = "yes"; then
542 AC_DEFINE(GSS_USE_MUTEXES, [], [should we mutex-wrap calls into the GSS library?])
544 AC_MSG_RESULT($use_gss_mutexes)
551 AC_ARG_ENABLE(anon, [ --enable-anon enable ANONYMOUS authentication [[yes]] ],
555 AC_MSG_CHECKING(ANONYMOUS)
556 if test "$anon" != no; then
557 AC_MSG_RESULT(enabled)
558 SASL_MECHS="$SASL_MECHS libanonymous.la"
559 if test "$enable_static" = yes; then
560 SASL_STATIC_OBJS="$SASL_STATIC_OBJS anonymous.o"
561 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/anonymous.c"
562 AC_DEFINE(STATIC_ANONYMOUS, [], [Link ANONYMOUS Staticly])
565 AC_MSG_RESULT(disabled)
569 AC_ARG_ENABLE(login, [ --enable-login enable unsupported LOGIN authentication [[no]] ],
573 AC_MSG_CHECKING(LOGIN)
574 if test "$login" != no; then
575 AC_MSG_RESULT(enabled)
576 SASL_MECHS="$SASL_MECHS liblogin.la"
577 if test "$enable_static" = yes; then
578 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/login.c"
579 SASL_STATIC_OBJS="$SASL_STATIC_OBJS login.o"
580 AC_DEFINE(STATIC_LOGIN,[],[Link LOGIN Staticly])
583 AC_MSG_RESULT(disabled)
587 AC_ARG_ENABLE(ntlm, [ --enable-ntlm enable unsupported NTLM authentication [[no]] ],
591 if test "$with_openssl" = no; then
592 AC_WARN([OpenSSL not found -- NTLM will be disabled])
596 AC_MSG_CHECKING(NTLM)
597 if test "$ntlm" != no; then
598 AC_MSG_RESULT(enabled)
599 NTLM_LIBS="-lcrypto $LIB_RSAREF"
602 SASL_MECHS="$SASL_MECHS libntlm.la"
603 if test "$enable_static" = yes; then
604 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/ntlm.c"
605 SASL_STATIC_OBJS="$SASL_STATIC_OBJS ntlm.o"
606 AC_DEFINE(STATIC_NTLM,[],[Link NTLM Staticly])
609 AC_MSG_RESULT(disabled)
613 AC_ARG_ENABLE(passdss, [ --enable-passdss enable PASSDSS authentication (experimental) [[no]] ],
617 if test "$with_openssl" = no; then
618 AC_WARN([OpenSSL not found -- PASSDSS will be disabled])
622 AC_MSG_CHECKING(PASSDSS)
623 if test "$passdss" != no; then
624 AC_MSG_RESULT(enabled)
625 PASSDSS_LIBS="-lcrypto $LIB_RSAREF"
626 AC_SUBST(PASSDSS_LIBS)
628 SASL_MECHS="$SASL_MECHS libpassdss.la"
629 if test "$enable_static" = yes; then
630 SASL_STATIC_OBJS="$SASL_STATIC_OBJS passdss.o"
631 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/passdss.c"
632 AC_DEFINE(STATIC_PASSDSS,[],[Link PASSDSS Staticly])
635 AC_MSG_RESULT(disabled)
639 # make the option show up so people don't whine that it is only in the
640 # saslauthd configure script --help
641 AC_ARG_WITH(ldap, [ --with-ldap=DIR use LDAP (in DIR) for saslauthd [no] ],,with_ldap=no)
645 dnl This flag also changes the requirements of --with-mysql and --with-pgsql
647 dnl Desired behavior:
649 dnl doesn't require mysql or postgres if --disable-sql is chosen
650 dnl requires at least one (but not both) if --enable-sql is chosen
652 AC_ARG_ENABLE(sql, [ --enable-sql enable SQL auxprop [[no]] ],
657 if test "$sql" != no; then
658 AC_MSG_RESULT(enabled)
659 SASL_MECHS="$SASL_MECHS libsql.la"
660 if test "$enable_static" = yes; then
661 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/sql.c"
662 SASL_STATIC_OBJS="$SASL_STATIC_OBJS sql.o"
663 AC_DEFINE(STATIC_SQL,[],[Link SQL plugin staticly])
666 AC_MSG_RESULT(disabled)
670 AC_ARG_WITH(mysql, [ --with-mysql=PATH use MySQL from PATH ],
674 # find location of library
675 # presuming if one given then correct
676 if test "${with_mysql}" = "yes"; then
678 for mysqlloc in lib/mysql lib mysql/lib
680 if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then
681 with_mysql="${prefix}"
683 elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then
684 with_mysql="/usr/local"
686 elif test -f /usr/${mysqlloc}/libmysqlclient.a; then
695 case "$with_mysql" in
697 notfound) AC_WARN([MySQL Library not found]); true;;
699 if test -d ${with_mysql}/lib/mysql; then
700 CMU_ADD_LIBPATH_TO(${with_mysql}/lib/mysql, LIB_MYSQL)
701 elif test -d ${with_mysql}/mysql/lib; then
702 CMU_ADD_LIBPATH_TO(${with_mysql}/mysql/lib, LIB_MYSQL)
703 elif test -d ${with_mysql}/lib; then
704 CMU_ADD_LIBPATH_TO(${with_mysql}/lib, LIB_MYSQL)
706 CMU_ADD_LIBPATH_TO(${with_mysql}, LIB_MYSQL)
709 LIB_MYSQL_DIR=$LIB_MYSQL
710 LIB_MYSQL="$LIB_MYSQL -lmysqlclient"
712 if test -d ${with_mysql}/include/mysql; then
713 CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql"
714 elif test -d ${with_mysql}/mysql/include; then
715 CPPFLAGS="${CPPFLAGS} -I${with_mysql}/mysql/include"
716 elif test -d ${with_mysql}/include; then
717 CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include"
719 CPPFLAGS="${CPPFLAGS} -I${with_mysql}"
722 save_LDFLAGS=$LDFLAGS
723 LDFLAGS="$LDFLAGS $LIB_MYSQL_DIR"
724 AC_CHECK_LIB(mysqlclient, mysql_select_db,
725 AC_DEFINE(HAVE_MYSQL, [], [Do we have mysql support?]),
726 [AC_WARN([MySQL library mysqlclient does not work])
728 LDFLAGS=$save_LDFLAGS;;
734 AC_ARG_WITH(pgsql, [ --with-pgsql=PATH use PostgreSQL from PATH ],
738 # find location of library
739 # presuing if one given then correct
740 if test "${with_pgsql}" = "yes"; then
742 for pgsqlloc in lib/pgsql lib pgsql/lib
744 if test -f ${prefix}/${pgsqlloc}/libpq.a; then
745 with_pgsql="${prefix}"
747 elif test -f /usr/local/${pgsqlloc}/libpq.a; then
748 with_pgsql="/usr/local"
750 elif test -f /usr/${pgsqlloc}/libpq.a; then
759 case "$with_pgsql" in
761 notfound) AC_WARN([PostgreSQL Library not found]); true;;
763 if test -d ${with_pgsql}/lib/pgsql; then
764 CMU_ADD_LIBPATH_TO(${with_pgsql}/lib/pgsql, LIB_PGSQL)
765 elif test -d ${with_pgsql}/pgsql/lib; then
766 CMU_ADD_LIBPATH_TO(${with_pgsql}/pgsql/lib, LIB_PGSQL)
767 elif test -d ${with_pgsql}/lib; then
768 CMU_ADD_LIBPATH_TO(${with_pgsql}/lib, LIB_PGSQL)
770 CMU_ADD_LIBPATH_TO(${with_pgsql}, LIB_PGSQL)
773 LIB_PGSQL_DIR=$LIB_PGSQL
774 LIB_PGSQL="$LIB_PGSQL -lpq"
776 if test -d ${with_pgsql}/include/pgsql; then
777 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include/pgsql"
778 elif test -d ${with_pgsql}/pgsql/include; then
779 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/pgsql/include"
780 elif test -d ${with_pgsql}/include; then
781 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include"
783 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}"
787 save_LDFLAGS=$LDFLAGS
788 LDFLAGS="$LDFLAGS $LIB_PGSQL_DIR"
789 AC_CHECK_LIB(pq, PQsetdbLogin, AC_DEFINE(HAVE_PGSQL,[],
790 [Do we have Postgres support?]),
791 [AC_WARN([PostgreSQL Library pq does not work])
793 LDFLAGS=$save_LDFLAGS;;
799 AC_ARG_WITH(sqlite, [ --with-sqlite=PATH use SQLite from PATH ],
800 with_sqlite=$withval,
803 # find location of library
804 # presuing if one given then correct
805 if test "${with_sqlite}" = "yes"; then
809 if test -f ${prefix}/${sqliteloc}/libsqlite.a; then
810 with_sqlite="${prefix}"
812 elif test -f /usr/local/${sqliteloc}/libsqlite.a; then
813 with_sqlite="/usr/local"
815 elif test -f /usr/${sqliteloc}/libsqlite.a; then
824 case "$with_sqlite" in
826 notfound) AC_WARN([SQLite Library not found]); true;;
828 if test -d ${with_sqlite}/lib; then
829 LIB_SQLITE="-L${with_sqlite}/lib -R${with_sqlite}/lib"
831 LIB_SQLITE="-L${with_sqlite} -R${with_sqlite}"
834 LIB_SQLITE_DIR=$LIB_SQLITE
835 LIB_SQLITE="$LIB_SQLITE -lsqlite"
837 if test -d ${with_sqlite}/include; then
838 CPPFLAGS="${CPPFLAGS} -I${with_sqlite}/include"
840 CPPFLAGS="${CPPFLAGS} -I${with_sqlite}"
842 AC_CHECK_LIB(sqlite, sqlite_open, AC_DEFINE(HAVE_SQLITE,[],
843 [Do we have SQLite support?]),
844 [AC_WARN([SQLite Library sqlite does not work])
845 with_sqlite=no], $LIB_SQLITE_DIR);;
850 if test "$sql" = yes -a "$with_pgsql" = no -a "$with_mysql" = no -a "$with_sqlite" = no; then
851 AC_ERROR([--enable-sql chosen but neither Postgres nor MySQL nor SQLite found])
854 if test "$enable_shared" = yes; then
855 AC_DEFINE(DO_DLOPEN,[],[Should we build a shared plugin (via dlopen) library?])
859 AC_ARG_ENABLE(ldapdb, [ --enable-ldapdb enable LDAPDB plugin [no] ],
862 AC_MSG_CHECKING(LDAPDB)
863 if test "$ldapdb" != no; then
864 AC_MSG_RESULT(enabled)
866 if test "$with_ldap" = no; then
867 AC_MSG_ERROR([Cannot enable LDAPDB plugin: You need to specify --with-ldap])
870 save_CPPFLAGS=$CPPFLAGS
871 save_LDFLAGS=$LDFLAGS
873 if test -d $with_ldap; then
874 CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include"
875 CMU_ADD_LIBPATH(${with_ldap}/lib)
878 AC_CHECK_HEADERS(ldap.h lber.h)
880 if test $ac_cv_header_ldap_h = yes -a $ac_cv_header_lber_h = yes; then
883 if test "$cmu_cv_openldap_api" = yes; then
884 AC_CHECK_LIB(ldap, ldap_initialize, [ cmu_link_openldap="-lldap -llber" ], [ cmu_link_openldap=no ],-llber)
888 if test "$cmu_cv_openldap_api" = no -o "$cmu_link_openldap" = no; then
889 AC_MSG_ERROR([Cannot enable LDAPDB plugin: Could not locate OpenLDAP])
893 if test "$cmu_cv_openldap_compat" = no; then
894 AC_MSG_ERROR([Cannot enable LDAPDB plugin: OpenLDAP library located but incompatible])
896 LIB_LDAP=$cmu_link_openldap
899 SASL_MECHS="$SASL_MECHS libldapdb.la"
900 if test "$enable_static" = yes; then
901 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/ldapdb.c"
902 SASL_STATIC_OBJS="$SASL_STATIC_OBJS ldapdb.o"
903 AC_DEFINE(STATIC_LDAPDB,[],[Link ldapdb plugin Staticly])
908 if test "$cmu_cv_openldap_compat" != yes; then
909 CPPFLAGS=$save_CPPFLAGS
910 LDFLAGS=$save_LDFLAGS
913 AC_MSG_RESULT(disabled)
917 AC_SUBST(SASL_STATIC_SRCS)
918 AC_SUBST(SASL_STATIC_OBJS)
919 AC_SUBST(SASL_STATIC_LIBS)
921 AC_ARG_WITH(plugindir, [ --with-plugindir=DIR set the directory where plugins will
922 be found [[/usr/lib/sasl2]] ],
924 plugindir=/usr/lib/sasl2)
925 AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir", [Runtime plugin location])
928 AC_ARG_WITH(configdir, [ --with-configdir=DIR set the directory where config files will
929 be found [/usr/lib/sasl2] ],
931 configdir=$plugindir:/etc/sasl2)
932 AC_DEFINE_UNQUOTED(CONFIGDIR, "$configdir", [Runtime config file location])
935 dnl look for rc4 libraries. we accept the CMU one or one from openSSL
936 AC_ARG_WITH(rc4, [ --with-rc4 use internal rc4 routines [[yes]] ],
940 if test "$with_rc4" != no; then
941 AC_DEFINE(WITH_RC4,[],[Use internal RC4 implementation?])
944 building_for_macosx=no
947 AC_ARG_ENABLE(macos-framework, [ --disable-macos-framework disable building and installing replacement SASL2 Framework for MacOS X-provided SASL Framework [[no]]],building_for_macosx=no,building_for_macosx=yes)
950 AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes)
953 AC_MSG_CHECKING(for dmalloc library)
954 AC_ARG_WITH(dmalloc, [ --with-dmalloc=DIR with DMALLOC support (for test applications) [[no]] ],
955 with_dmalloc=$withval,
960 if test "$with_dmalloc" != "no"; then
961 if test "$with_dmalloc" = "yes"; then
962 with_dmalloc="/usr/local"
965 if test -r "$with_dmalloc/libdmalloc.a"; then
966 DMALLOC_LIBS="$with_dmalloc/libdmalloc.a"
967 AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?])
969 elif test -r "$with_dmalloc/lib/libdmalloc.a"; then
970 DMALLOC_LIBS="$with_dmalloc/lib/libdmalloc.a"
971 AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?])
974 AC_MSG_ERROR(cannot find dmalloc library, please check your installation.)
980 AC_SUBST(DMALLOC_LIBS)
983 AC_MSG_CHECKING(for sfio library)
984 AC_ARG_WITH(sfio, [ --with-sfio=DIR with SFIO support (for smtptest/libsfsasl) [[no]] ],
988 if test "$with_sfio" != "no"; then
989 if test "$with_sfio" = "yes"; then
990 with_sfio="/usr/local"
993 AC_DEFUN([SFIO_INC_CHK],
994 [if test -r "$with_sfio$1/sfio.h"; then SFIO_DIR=$with_sfio;
995 SFIO_INC_DIR=$with_sfio$1])
997 AC_DEFUN([SFIO_LIB_CHK],[
998 str="$SFIO_DIR/$1/libsfio.*"
999 for i in `echo $str`; do
1001 SFIO_LIBDIR=$SFIO_DIR/$1
1008 el[]SFIO_INC_CHK(/include)
1009 el[]SFIO_INC_CHK(/include/sfio)
1012 if test -z "$SFIO_DIR"; then
1013 AC_MSG_ERROR(Cannot find sfio.h, Please check your SFIO installation.)
1017 SFIO_LIB_CHK(lib/sfio)
1019 if test -z "$SFIO_LIBDIR"; then
1020 AC_MSG_ERROR(Cannot find sfio library, Please check your SFIO installation.)
1023 SFIO_INC_FLAGS="-I$SFIO_INC_DIR"
1024 SFIO_LIB_FLAGS="-L$SFIO_LIBDIR -lsfio"
1025 SMTPTEST_PROGRAM="smtptest"
1026 SASL_UTIL_LIBS_EXTRA=libsfsasl2.la
1027 SASL_UTIL_HEADERS_EXTRA=sfsasl.h
1035 SASL_UTIL_LIBS_EXTRA=""
1036 SASL_UTIL_HEADERS_EXTRA=""
1039 AC_SUBST(SFIO_INC_FLAGS)
1040 AC_SUBST(SFIO_LIB_FLAGS)
1041 AC_SUBST(SMTPTEST_PROGRAM)
1042 AC_SUBST(SASL_UTIL_LIBS_EXTRA)
1043 AC_SUBST(SASL_UTIL_HEADERS_EXTRA)
1045 dnl check for getsubopt
1046 sasl_cv_getsubopt=no
1047 AC_CHECK_FUNC(getsubopt, [AC_DEFINE(HAVE_GETSUBOPT,[],
1048 [do we have getsubopt()?])], [sasl_cv_getsubopt=yes])
1049 if test $sasl_cv_getsubopt = yes; then
1050 AC_LIBOBJ(getsubopt)
1051 GETSUBOPT="getsubopt.lo"
1055 dnl Check for snprintf
1058 AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF,[],[Does the system have snprintf()?])], [sasl_cv_snprintf=yes])
1059 AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF,[],[Does the system have vsnprintf()?])], [sasl_cv_snprintf=yes])
1060 if test $sasl_cv_snprintf = yes; then
1062 SNPRINTFOBJS="snprintf.o"
1063 LTSNPRINTFOBJS="snprintf.lo"
1065 AC_SUBST(SNPRINTFOBJS)
1066 AC_SUBST(LTSNPRINTFOBJS)
1068 dnl do we need to link in -lresolv?
1069 AC_CHECK_LIB(resolv, inet_aton)
1071 dnl Check for getaddrinfo
1073 sasl_cv_getaddrinfo=yes
1074 IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror,
1075 [AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo() function?])
1076 sasl_cv_getaddrinfo=no])])
1077 if test $sasl_cv_getaddrinfo = yes; then
1078 AC_LIBOBJ(getaddrinfo)
1079 GETADDRINFOOBJS="getaddrinfo.o"
1080 LTGETADDRINFOOBJS="getaddrinfo.lo"
1082 AC_SUBST(GETADDRINFOOBJS)
1083 AC_SUBST(LTGETADDRINFOOBJS)
1085 dnl Check for getnameinfo
1087 sasl_cv_getnameinfo=no
1088 IPv6_CHECK_FUNC(getnameinfo,
1089 [AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo() function?])], [sasl_cv_getnameinfo=yes])
1090 if test $sasl_cv_getnameinfo = yes; then
1091 AC_LIBOBJ(getnameinfo)
1092 GETNAMEINFOOBJS="getnameinfo.o"
1093 LTGETNAMEINFOOBJS="getnameinfo.lo"
1095 AC_SUBST(GETNAMEINFOOBJS)
1096 AC_SUBST(LTGETNAMEINFOOBJS)
1098 LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
1111 AC_CHECK_HEADERS(des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h)
1113 IPv6_CHECK_SS_FAMILY()
1115 IPv6_CHECK_SOCKLEN_T()
1119 AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48)
1121 if test $enable_cmulocal = yes; then
1122 AC_WARN([enabling CMU local kludges])
1123 AC_DEFINE(KRB4_IGNORE_IP_ADDRESS,[],[Ignore IP Address in Kerberos 4 tickets?])
1124 AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4", [Force a preferred mechanism])
1127 AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [
1128 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have struct sockaddr_stroage?])])
1132 AC_CONFIG_SUBDIRS(saslauthd)
1135 /* acconfig.h - autoheader configuration input */
1137 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
1139 * Redistribution and use in source and binary forms, with or without
1140 * modification, are permitted provided that the following conditions
1143 * 1. Redistributions of source code must retain the above copyright
1144 * notice, this list of conditions and the following disclaimer.
1146 * 2. Redistributions in binary form must reproduce the above copyright
1147 * notice, this list of conditions and the following disclaimer in
1148 * the documentation and/or other materials provided with the
1151 * 3. The name "Carnegie Mellon University" must not be used to
1152 * endorse or promote products derived from this software without
1153 * prior written permission. For permission or any other legal
1154 * details, please contact
1155 * Office of Technology Transfer
1156 * Carnegie Mellon University
1157 * 5000 Forbes Avenue
1158 * Pittsburgh, PA 15213-3890
1159 * (412) 268-4387, fax: (412) 268-7395
1160 * tech-transfer@andrew.cmu.edu
1162 * 4. Redistributions of any form whatsoever must retain the following
1164 * "This product includes software developed by Computing Services
1165 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
1167 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
1168 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1169 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
1170 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1171 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
1172 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
1173 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1183 /* Create a struct iovec if we need one */
1184 #if !defined(_WIN32) && !defined(HAVE_SYS_UIO_H)
1185 /* (win32 is handled in sasl.h) */
1191 #include <sys/types.h>
1192 #include <sys/uio.h>
1195 /* location of the random number generator */
1199 #define DEV_RANDOM SASL_DEV_RANDOM
1201 /* if we've got krb_get_err_txt, we might as well use it;
1202 especially since krb_err_txt isn't in some newer distributions
1203 (MIT Kerb for Mac 4 being a notable example). If we don't have
1204 it, we fall back to the krb_err_txt array */
1205 #ifdef HAVE_KRB_GET_ERR_TEXT
1206 #define get_krb_err_txt krb_get_err_text
1208 #define get_krb_err_txt(X) (krb_err_txt[(X)])
1211 /* Make Solaris happy... */
1212 #ifndef __EXTENSIONS__
1213 #define __EXTENSIONS__
1216 /* Make Linux happy... */
1221 #ifndef HAVE___ATTRIBUTE__
1222 /* Can't use attributes... */
1223 #define __attribute__(foo)
1226 #define SASL_PATH_ENV_VAR "SASL_PATH"
1227 #define SASL_CONF_PATH_ENV_VAR "SASL_CONF_PATH"
1230 #include <sys/types.h>
1231 #include <sys/socket.h>
1234 # ifdef HAVE_SYS_PARAM_H
1235 # include <sys/param.h>
1238 # include <winsock2.h>
1242 #include <netinet/in.h>
1244 #ifndef HAVE_SOCKLEN_T
1245 typedef unsigned int socklen_t;
1246 #endif /* HAVE_SOCKLEN_T */
1248 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
1249 #define _SS_MAXSIZE 128 /* Implementation specific max size */
1250 #define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr))
1252 struct sockaddr_storage {
1253 struct sockaddr ss_sa;
1254 char __ss_pad2[_SS_PADSIZE];
1256 # define ss_family ss_sa.sa_family
1257 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
1260 /* Define it to something that should never appear */
1261 #define AF_INET6 AF_MAX
1264 #ifndef HAVE_GETADDRINFO
1265 #define getaddrinfo sasl_getaddrinfo
1266 #define freeaddrinfo sasl_freeaddrinfo
1267 #define gai_strerror sasl_gai_strerror
1270 #ifndef HAVE_GETNAMEINFO
1271 #define getnameinfo sasl_getnameinfo
1274 #if !defined(HAVE_GETNAMEINFO) || !defined(HAVE_GETADDRINFO)
1278 #ifndef AI_NUMERICHOST /* support glibc 2.0.x */
1279 #define AI_NUMERICHOST 4
1280 #define NI_NUMERICHOST 2
1281 #define NI_NAMEREQD 4
1282 #define NI_NUMERICSERV 8
1285 /* Defined in RFC 1035. max strlen is only 253 due to length bytes. */
1286 #ifndef MAXHOSTNAMELEN
1287 #define MAXHOSTNAMELEN 255
1290 #ifndef HAVE_SYSEXITS_H
1293 #include "sysexits.h"
1296 /* Get the correct time.h */
1297 #if TIME_WITH_SYS_TIME
1298 # include <sys/time.h>
1301 # if HAVE_SYS_TIME_H
1302 # include <sys/time.h>
1308 #ifndef HIER_DELIMITER
1309 #define HIER_DELIMITER '/'
1312 #endif /* CONFIG_H */
1315 AC_CONFIG_HEADERS(config.h)
1326 java/CyrusSasl/Makefile
1329 java/javax/security/Makefile
1330 java/javax/security/auth/Makefile
1331 java/javax/security/auth/callback/Makefile
1335 echo Configuration Complete. Type \'make\' to build.