1dnl configure.ac for the SASL library 2dnl Rob Siemborski 3dnl Rob Earhart 4dnl $Id: configure.ac,v 1.224 2011/09/22 14:44:15 mel Exp $ 5dnl 6dnl Copyright (c) 2001 Carnegie Mellon University. All rights reserved. 7dnl 8dnl Redistribution and use in source and binary forms, with or without 9dnl modification, are permitted provided that the following conditions 10dnl are met: 11dnl 12dnl 1. Redistributions of source code must retain the above copyright 13dnl notice, this list of conditions and the following disclaimer. 14dnl 15dnl 2. Redistributions in binary form must reproduce the above copyright 16dnl notice, this list of conditions and the following disclaimer in 17dnl the documentation and/or other materials provided with the 18dnl distribution. 19dnl 20dnl 3. The name "Carnegie Mellon University" must not be used to 21dnl endorse or promote products derived from this software without 22dnl prior written permission. For permission or any other legal 23dnl details, please contact 24dnl Office of Technology Transfer 25dnl Carnegie Mellon University 26dnl 5000 Forbes Avenue 27dnl Pittsburgh, PA 15213-3890 28dnl (412) 268-4387, fax: (412) 268-7395 29dnl tech-transfer@andrew.cmu.edu 30dnl 31dnl 4. Redistributions of any form whatsoever must retain the following 32dnl acknowledgment: 33dnl \"This product includes software developed by Computing Services 34dnl at Carnegie Mellon University (http://www.cmu.edu/computing/).\" 35dnl 36dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 37dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 38dnl AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 39dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 40dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 41dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 42dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 43dnl 44 45AC_PREREQ([2.69]) 46 47dnl 48dnl REMINDER: When changing the version number here, please also update 49dnl the values in win32/include/config.h and include/sasl.h as well. 50dnl 51AC_INIT([cyrus-sasl],[2.1.28],[https://github.com/cyrusimap/cyrus-sasl/issues],[cyrus-sasl],[https://www.cyrusimap.org]) 52 53AC_CONFIG_MACRO_DIR([m4]) 54 55dnl use ./config.cache as the default cache file. 56dnl we require a cache file to successfully configure our build. 57if test $cache_file = "/dev/null"; then 58cache_file="./config.cache" 59AC_CACHE_LOAD 60fi 61 62AC_CONFIG_AUX_DIR(config) 63AC_CANONICAL_HOST 64AC_CANONICAL_TARGET 65 66AM_INIT_AUTOMAKE([1.11 tar-ustar dist-bzip2 foreign -Wno-portability subdir-objects]) 67 68DIRS="" 69 70AC_ARG_ENABLE(cmulocal, 71 [AS_HELP_STRING([--enable-cmulocal],[enable local mods for CMU [[no]]])], 72 [], 73 enable_cmulocal=no) 74 75AC_ARG_ENABLE(sample, 76 [AS_HELP_STRING([--enable-sample],[compile sample code [[yes]]])], 77 [], 78 enable_sample=yes) 79 80AC_ARG_ENABLE(obsolete_cram_attr, 81 [AS_HELP_STRING([--enable-obsolete_cram_attr],[enable support for cmusaslsecretCRAM-MD5 auxprop property [[yes]]])], 82 enable_obsolete_cram_attr=$enableval, 83 enable_obsolete_cram_attr=yes) 84 85AC_ARG_ENABLE(obsolete_digest_attr, 86 [AS_HELP_STRING([--enable-obsolete_digest_attr],[enable support for cmusaslsecretDIGEST-MD5 auxprop property [[yes]]])], 87 enable_obsolete_digest_attr=$enableval, 88 enable_obsolete_digest_attr=yes) 89 90AC_PROG_CC 91AX_PROG_CC_FOR_BUILD 92AC_PROG_CPP 93AC_PROG_AWK 94AC_PROG_LN_S 95AC_PROG_MAKE_SET 96AC_PROG_INSTALL 97AC_USE_SYSTEM_EXTENSIONS 98 99dnl check for -R, etc. switch 100CMU_GUESS_RUNPATH_SWITCH 101 102dnl xxx compatibility 103AC_ARG_WITH(staticsasl) 104if test "$with_staticsasl" = yes; then 105 enable_shared=yes 106 enable_static=yes 107fi 108 109save_target=$target 110if test -z "$target"; then 111 target="NONE" 112fi 113 114# new libtool 115AC_DISABLE_STATIC([]) 116LT_INIT 117 118target=$save_target 119 120if test "$enable_static" = yes; then 121 SASL_STATIC_LIB=libsasl2.a 122else 123 SASL_STATIC_LIB= 124fi 125AC_SUBST(SASL_STATIC_LIB) 126SASL_STATIC_LIBS= 127 128AC_ARG_ENABLE(staticdlopen, [ --enable-staticdlopen try dynamic plugins when we are a static libsasl [[no]] ], 129 enable_staticdlopen=$enableval, 130 enable_staticdlopen=no) 131 132if test "$enable_staticdlopen" = yes; then 133 AC_DEFINE(TRY_DLOPEN_WHEN_STATIC,[],[Should we try to dlopen() plugins while statically compiled?]) 134fi 135 136if test "$ac_cv_c_compiler_gnu" = yes; then 137 CFLAGS="-Wall -W ${CFLAGS}" 138fi 139 140AC_ARG_WITH(purecov,[ --with-purecov link with purecov]) 141if test "$with_purecov" = yes; then 142 AC_CHECK_PROGS(PURECOV, purecov) 143fi 144AC_ARG_WITH(purify,[ --with-purify link with purify]) 145if test "$with_purify" = yes; then 146 AC_CHECK_PROGS(PURIFY, purify) 147fi 148 149AM_CONDITIONAL(SAMPLE, test "$enable_sample" = yes) 150 151dnl call before we do the berkeley DB checks 152CMU_SOCKETS 153 154dnl we extracted this to config/sasldb.m4 155SASL_DB_PATH_CHECK() 156SASL_DB_CHECK() 157 158# Do we not install the SASL DB man pages? 159AM_CONDITIONAL(NO_SASL_DB_MANS, test "x$SASL_DB_MANS" = "x") 160 161AC_ARG_ENABLE(keep_db_open, [ --enable-keep-db-open keep handle to DB open for improved performance [[no]] ], 162 keep_db_open=$enableval, 163 keep_db_open=no) 164 165# Disable if Berkeley DB and LMDB are not used 166if test "$dblib" != berkeley -a "$dblib" != lmdb; then 167 keep_db_open=no 168fi 169 170if test "$keep_db_open" = yes; then 171 AC_DEFINE(KEEP_DB_OPEN,[],[Should we keep handle to DB open in SASLDB plugin?]) 172fi 173AC_MSG_CHECKING(if DB handle is kept open in SASLDB) 174AC_MSG_RESULT($keep_db_open) 175 176AC_CHECK_LIB(dl, dlopen, SASL_DL_LIB="-ldl", SASL_DL_LIB="") 177AC_SUBST(SASL_DL_LIB) 178 179dnl /dev/random ? 180 181AC_ARG_WITH(devrandom, [ --with-devrandom=PATH set the path to pseudo random number generator [[/dev/urandom]] ], 182 devrandom=$withval, 183 devrandom=/dev/urandom) 184AC_MSG_CHECKING(PRNG to use) 185AC_MSG_RESULT($devrandom) 186AC_DEFINE_UNQUOTED(SASL_DEV_RANDOM, "$devrandom", [File to use for source of randomness]) 187 188dnl Do we need leading underscores on our symbols? 189 190AC_CHECK_PROGS(NM, nm) 191 192AC_MSG_CHECKING(for underscore before symbols) 193AC_CACHE_VAL(sasl_cv_uscore,[ 194 echo "int main(){int i=1; return 0;} 195 void foo(){int i=6;}" > conftest.c 196 ${CC} -o a.out conftest.c > /dev/null 197 if (${NM} a.out | grep _foo) > /dev/null; then 198 sasl_cv_uscore=yes 199 else 200 sasl_cv_uscore=no 201 fi]) 202AC_MSG_RESULT($sasl_cv_uscore) 203rm -f conftest.c a.out 204 205if test $sasl_cv_uscore = yes; then 206 if test $ac_cv_lib_dl_dlopen = yes ; then 207 AC_MSG_CHECKING(whether dlsym adds the underscore for us) 208 cmu_save_LIBS="$LIBS" 209 LIBS="$LIBS $SASL_DL_LIB" 210 AC_CACHE_VAL([sasl_cv_dlsym_adds_uscore], 211 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 212#include <dlfcn.h> 213#include <stdio.h> 214#include <stdlib.h> 215void foo() { int i=0;} 216int main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY); 217 if(self) { ptr1=dlsym(self,"foo"); ptr2=dlsym(self,"_foo"); 218 if(ptr1 && !ptr2) exit(0); } exit(1); } 219]])],[sasl_cv_dlsym_adds_uscore=yes],[sasl_cv_dlsym_adds_uscore=no],[AC_MSG_WARN(cross-compiler, we'll do our best)])]) 220 LIBS="$cmu_save_LIBS" 221 AC_MSG_RESULT($sasl_cv_dlsym_adds_uscore) 222 223 if test "$sasl_cv_dlsym_adds_uscore" = no; then 224 AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, [], [Do we need a leading _ for dlsym?]) 225 fi 226 fi 227fi 228 229dnl See if we can provide a default logging function... 230AC_CHECK_FUNCS(syslog) 231 232AC_ARG_WITH(saslauthd, [ --with-saslauthd=DIR enable use of the saslauth daemon using state dir DIR ], 233 with_saslauthd=$withval, 234 with_saslauthd=yes) 235if test "$with_saslauthd" != no; then 236 if test "$with_saslauthd" = yes; then 237 with_saslauthd="/var/state/saslauthd" 238 fi 239 AC_DEFINE(HAVE_SASLAUTHD,[],[Include support for saslauthd?]) 240 AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd", 241 [Where do we look for saslauthd's socket?]) 242fi 243AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no) 244AC_MSG_CHECKING(if I should include saslauthd) 245AC_MSG_RESULT($with_saslauthd) 246 247AC_ARG_WITH(authdaemond, [ --with-authdaemond=PATH enable use of authdaemon with default socket=PATH [[yes]] ], 248 with_authdaemon=$withval, 249 with_authdaemon=yes) 250if test "$with_authdaemon" != no; then 251 if test "$with_authdaemon" = yes; then 252 with_authdaemon="/dev/null" 253 fi 254 AC_DEFINE(HAVE_AUTHDAEMON,[],[Include support for Courier's authdaemond?]) 255 AC_DEFINE_UNQUOTED(PATH_AUTHDAEMON_SOCKET, "$with_authdaemon", 256 [Where do we look for Courier authdaemond's socket?]) 257fi 258AC_MSG_CHECKING(to include Courier authdaemond support) 259AC_MSG_RESULT($with_authdaemon) 260 261AC_ARG_WITH(pwcheck, 262[ --with-pwcheck=DIR enable deprecated pwcheck daemon using statedir DIR ], 263 with_pwcheck=$withval, 264 with_pwcheck=no) 265if test "$with_pwcheck" != no; then 266 if test "$with_pwcheck" = yes; then 267 with_pwcheck=/var/pwcheck 268 fi 269 AC_DEFINE(HAVE_PWCHECK,[],[Include Support for pwcheck daemon?]) 270 AC_DEFINE_UNQUOTED(PWCHECKDIR, "$with_pwcheck", [Location of pwcheck socket]) 271 AC_CHECK_FUNC(getspnam,PWCHECKMETH="getspnam",PWCHECKMETH="getpwnam") 272 AC_SUBST(PWCHECKMETH) 273fi 274AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no) 275AC_MSG_CHECKING(if I should include pwcheck) 276AC_MSG_RESULT($with_pwcheck) 277 278AC_ARG_WITH(ipctype, [ --with-ipctype={unix,doors} use ipctype [[unix]] ], 279 with_ipctype=$withval, 280 with_ipctype="unix") 281IPCTYPE=$with_ipctype 282AC_SUBST(IPCTYPE) 283LIB_DOOR= 284if test "$with_ipctype" = "doors"; then 285 LIB_DOOR="-ldoor" 286 AC_DEFINE(USE_DOORS,[],[use the doors IPC API for saslauthd?]) 287fi 288AC_SUBST(LIB_DOOR) 289 290AC_ARG_ENABLE(alwaystrue, [ --enable-alwaystrue enable the alwaystrue password verifier (discouraged)], 291 enable_alwaystrue=$enableval, 292 enable_alwaystrue=no) 293if test "$enable_alwaystrue" = yes; then 294 AC_DEFINE(HAVE_ALWAYSTRUE, [], [Enable 'alwaystrue' password verifier?]) 295fi 296AC_MSG_CHECKING(if I should include the alwaystrue verifier) 297AC_MSG_RESULT($enable_alwaystrue) 298 299dnl sasl_checkapop support 300AC_ARG_ENABLE(checkapop, [ --enable-checkapop enable use of sasl_checkapop [[yes]] ], 301 checkapop=$enableval, 302 checkapop=yes) 303 304AC_MSG_CHECKING(if we should enable sasl_checkapop) 305if test "$checkapop" != no; then 306 AC_MSG_RESULT(enabled) 307 AC_DEFINE(DO_SASL_CHECKAPOP, [], [should we support sasl_checkapop?]) 308else 309 AC_MSG_RESULT(disabled) 310fi 311 312dnl CRAM-MD5 313AC_ARG_ENABLE(cram, [ --enable-cram enable CRAM-MD5 authentication [[yes]] ], 314 cram=$enableval, 315 cram=yes) 316 317AC_MSG_CHECKING(CRAM-MD5) 318if test "$cram" != no; then 319 AC_MSG_RESULT(enabled) 320 SASL_MECHS="$SASL_MECHS libcrammd5.la" 321 if test "$enable_obsolete_cram_attr" = yes; then 322 CPPFLAGS="$CPPFLAGS -DOBSOLETE_CRAM_ATTR=1" 323 fi 324 if test "$enable_static" = yes; then 325 SASL_STATIC_OBJS="$SASL_STATIC_OBJS cram.o" 326 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/cram.c" 327 AC_DEFINE(STATIC_CRAMMD5, [], [Link CRAM-MD5 Statically]) 328 fi 329else 330 AC_MSG_RESULT(disabled) 331fi 332 333CMU_HAVE_OPENSSL 334AC_MSG_CHECKING(for OpenSSL) 335AC_MSG_RESULT($with_openssl) 336 337SASL_DES_CHK 338 339dnl DIGEST-MD5 340AC_ARG_ENABLE(digest, [ --enable-digest enable DIGEST-MD5 authentication [[yes]] ], 341 digest=$enableval, 342 digest=yes) 343 344if test "$digest" != no; then 345 dnl In order to compile digest, we should look for need libdes. 346 if test -d $digest; then 347 CPPFLAGS="$CPPFLAGS -I$digest/include" 348 LDFLAGS="$LDFLAGS -L$digest/lib" 349 fi 350 if test "$with_des" = no; then 351 AC_MSG_WARN(No DES support for DIGEST-MD5) 352 fi 353fi 354 355AC_MSG_CHECKING(DIGEST-MD5) 356if test "$digest" != no; then 357 AC_MSG_RESULT(enabled) 358 SASL_MECHS="$SASL_MECHS libdigestmd5.la" 359 if test "$enable_obsolete_digest_attr" = yes; then 360 CPPFLAGS="$CPPFLAGS -DOBSOLETE_DIGEST_ATTR=1" 361 fi 362 if test "$enable_static" = yes; then 363 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/digestmd5.c" 364 SASL_STATIC_OBJS="$SASL_STATIC_OBJS digestmd5.o" 365 SASL_STATIC_LIBS="$SASL_STATIC_LIBS $LIB_DES" 366 AC_DEFINE(STATIC_DIGESTMD5, [], [Link DIGEST-MD5 Statically]) 367 fi 368else 369 AC_MSG_RESULT(disabled) 370fi 371 372dnl SCRAM 373AC_ARG_ENABLE(scram, [ --enable-scram enable SCRAM authentication [[yes]] ], 374 scram=$enableval, 375 scram=yes) 376 377if test "$with_openssl" = no; then 378 AC_MSG_WARN(OpenSSL not found -- SCRAM will be disabled) 379 scram=no 380fi 381 382AC_MSG_CHECKING(SCRAM) 383if test "$scram" != no; then 384 AC_MSG_RESULT(enabled) 385 SCRAM_LIBS="-lcrypto $LIB_RSAREF" 386 387 SASL_MECHS="$SASL_MECHS libscram.la" 388 if test "$enable_static" = yes; then 389 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/scram.c" 390 SASL_STATIC_OBJS="$SASL_STATIC_OBJS scram.o" 391 AC_DEFINE(STATIC_SCRAM, [], [Link SCRAM Statically]) 392 fi 393 394 AC_SUBST(SCRAM_LIBS) 395else 396 AC_MSG_RESULT(disabled) 397fi 398 399dnl OTP 400AC_ARG_ENABLE(otp, [ --enable-otp enable OTP authentication [[yes]] ], 401 otp=$enableval, 402 otp=yes) 403 404if test "$with_openssl" = no; then 405 AC_MSG_WARN(OpenSSL not found -- OTP will be disabled) 406 otp=no 407fi 408 409AC_MSG_CHECKING(OTP) 410if test "$otp" != no; then 411 AC_MSG_RESULT(enabled) 412 OTP_LIBS="-lcrypto $LIB_RSAREF" 413 414 SASL_MECHS="$SASL_MECHS libotp.la" 415 if test "$enable_static" = yes; then 416 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/otp.c" 417 SASL_STATIC_OBJS="$SASL_STATIC_OBJS otp.o" 418 AC_DEFINE(STATIC_OTP, [], [Link OTP Statically]) 419 fi 420 421 dnl Test for OPIE 422 AC_ARG_WITH(opie, AS_HELP_STRING([--with-opie=PATH],[use OPIE (One Time Passwords in Everything) from PATH])) 423 424 case "$with_opie" in 425 ""|yes) 426 AC_CHECK_LIB(opie, opiechallenge, [ 427 AC_CHECK_HEADER(opie.h, with_opie="yes", 428 with_opie="no")], 429 with_opie="no") 430 ;; 431 *) 432 if test -d $with_opie; then 433 CPPFLAGS="${CPPFLAGS} -I${with_opie}/include" 434 LDFLAGS="${LDFLAGS} -L${with_opie}/lib" 435 else 436 with_opie="no" 437 fi 438 ;; 439 esac 440 441 AC_MSG_CHECKING(for OPIE) 442 AC_MSG_RESULT($with_opie) 443 444 if test "$with_opie" != no; then 445 AC_DEFINE(HAVE_OPIE,[],[Use OPIE for server-side OTP?]) 446 OTP_LIBS="$OTP_LIBS -lopie" 447 fi 448 449 AC_SUBST(OTP_LIBS) 450 451else 452 AC_MSG_RESULT(disabled) 453fi 454 455dnl SRP 456AC_ARG_ENABLE(srp, [ --enable-srp enable SRP authentication [[no]] ], 457 srp=$enableval, 458 srp=no) 459 460if test "$with_openssl" = no; then 461 AC_MSG_WARN(OpenSSL not found -- SRP will be disabled) 462 srp=no 463fi 464 465AC_MSG_CHECKING(SRP) 466if test "$srp" != no; then 467 AC_MSG_RESULT(enabled) 468 SRP_LIBS="-lcrypto $LIB_RSAREF" 469 470 SASL_MECHS="$SASL_MECHS libsrp.la" 471 if test "$enable_static" = yes; then 472 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/srp.c" 473 SASL_STATIC_OBJS="$SASL_STATIC_OBJS srp.o" 474 AC_DEFINE(STATIC_SRP, [], [Link SRP Statically]) 475 fi 476 477dnl srp_setpass support 478 AC_ARG_ENABLE(srp_setpass, [ --enable-srp-setpass enable setting SRP secrets with saslpasswd [[no]]], 479 srp_setpass=$enableval, 480 srp_setpass=no) 481 482 AC_MSG_CHECKING(if we should enable setting SRP secrets with saslpasswd) 483 if test "$srp_setpass" != no; then 484 AC_MSG_RESULT(enabled) 485 AC_DEFINE(DO_SRP_SETPASS, [], [should we support setpass() for SRP?]) 486 else 487 AC_MSG_RESULT(disabled) 488 fi 489 490 AC_SUBST(SRP_LIBS) 491else 492 AC_MSG_RESULT(disabled) 493fi 494 495dnl Kerberos based Mechanisms 496SASL_KERBEROS_V4_CHK 497SASL_GSSAPI_CHK 498 499if test "$gssapi" != "no"; then 500 AC_DEFINE(STATIC_GSSAPIV2,[],[Link GSSAPI Statically]) 501 AC_DEFINE(HAVE_GSSAPI,[],[Include GSSAPI/Kerberos 5 Support]) 502 503 mutex_default="no" 504 if test "$gss_impl" = "mit"; then 505 mutex_default="yes" 506 elif test "$gss_impl" = "heimdal"; then 507 AC_DEFINE(KRB5_HEIMDAL,[],[Using Heimdal]) 508 fi 509 510 AC_MSG_CHECKING(to use mutexes aroung GSS calls) 511 AC_ARG_ENABLE(gss_mutexes, [ --enable-gss_mutexes use mutexes around calls to the GSS library], 512 use_gss_mutexes=$enableval, 513 use_gss_mutexes=$mutex_default) 514 if test $use_gss_mutexes = "yes"; then 515 AC_DEFINE(GSS_USE_MUTEXES, [], [should we mutex-wrap calls into the GSS library?]) 516 fi 517 AC_MSG_RESULT($use_gss_mutexes) 518fi 519 520SASL2_CRYPT_CHK 521 522AC_ARG_ENABLE(sia, [ --enable-sia enable SIA authentication [no] ], 523 sia=$enableval, 524 sia=no) 525LIB_SIA="" 526if test "$sia" != no; then 527 if test -f /etc/sia/matrix.conf; then 528 AC_DEFINE(HAVE_SIA,[],[Include SIA Support]) 529 LIB_SIA="-lsecurity -ldb -lm -laud" 530 else 531 AC_MSG_ERROR([No support for SIA found]) 532 fi 533fi 534AC_SUBST(LIB_SIA) 535 536AC_ARG_ENABLE(auth-sasldb, [ --enable-auth-sasldb enable experimental SASLdb authentication module [no] ], 537 authsasldb=$enableval, 538 authsasldb=no) 539if test "$authsasldb" != no; then 540 AC_DEFINE(AUTH_SASLDB,[],[Include SASLdb Support]) 541 SASL_DB_PATH_CHECK() 542 SASL_DB_CHECK() 543fi 544AM_CONDITIONAL(AUTH_SASLDB, test "$authsasldb" != no) 545 546AC_ARG_ENABLE(httpform, [ --enable-httpform enable HTTP form authentication [[no]] ], 547 httpform=$enableval, 548 httpform=no) 549if test "$httpform" != no; then 550 AC_DEFINE(HAVE_HTTPFORM,[],[Include HTTP form Support]) 551fi 552 553AC_ARG_WITH(pam, AS_HELP_STRING([--with-pam=DIR],[use PAM (rooted in DIR) [yes]]),, 554 with_pam=yes) 555if test "$with_pam" != no; then 556 if test -d $with_pam; then 557 CPPFLAGS="$CPPFLAGS -I${with_pam}/include" 558 LDFLAGS="$LDFLAGS -L${with_pam}/lib" 559 fi 560 cmu_save_LIBS="$LIBS" 561 AC_CHECK_LIB(pam, pam_start, [ 562 AC_CHECK_HEADER(security/pam_appl.h,, 563 with_pam=no)], 564 with_pam=no, $SASL_DL_LIB) 565 LIBS="$cmu_save_LIBS" 566fi 567 568AC_MSG_CHECKING(for PAM support) 569AC_MSG_RESULT($with_pam) 570LIB_PAM="" 571if test "$with_pam" != no; then 572 AC_DEFINE(HAVE_PAM,[],[Support for PAM?]) 573 LIB_PAM="-lpam" 574fi 575AC_SUBST(LIB_PAM) 576 577dnl PLAIN 578SASL_PLAIN_CHK 579 580dnl ANONYMOUS 581AC_ARG_ENABLE(anon, [ --enable-anon enable ANONYMOUS authentication [[yes]] ], 582 anon=$enableval, 583 anon=yes) 584 585AC_MSG_CHECKING(ANONYMOUS) 586if test "$anon" != no; then 587 AC_MSG_RESULT(enabled) 588 SASL_MECHS="$SASL_MECHS libanonymous.la" 589 if test "$enable_static" = yes; then 590 SASL_STATIC_OBJS="$SASL_STATIC_OBJS anonymous.o" 591 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/anonymous.c" 592 AC_DEFINE(STATIC_ANONYMOUS, [], [Link ANONYMOUS Statically]) 593 fi 594else 595 AC_MSG_RESULT(disabled) 596fi 597 598dnl LOGIN 599AC_ARG_ENABLE(login, [ --enable-login enable unsupported LOGIN authentication [[no]] ], 600 login=$enableval, 601 login=no) 602 603AC_MSG_CHECKING(LOGIN) 604if test "$login" != no; then 605 AC_MSG_RESULT(enabled) 606 SASL_MECHS="$SASL_MECHS liblogin.la" 607 if test "$enable_static" = yes; then 608 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/login.c" 609 SASL_STATIC_OBJS="$SASL_STATIC_OBJS login.o" 610 AC_DEFINE(STATIC_LOGIN,[],[Link LOGIN Statically]) 611 fi 612else 613 AC_MSG_RESULT(disabled) 614fi 615 616dnl NTLM 617AC_ARG_ENABLE(ntlm, [ --enable-ntlm enable unsupported NTLM authentication [[no]] ], 618 ntlm=$enableval, 619 ntlm=no) 620 621if test "$with_openssl" = no; then 622 AC_MSG_WARN(OpenSSL not found -- NTLM will be disabled) 623 ntlm=no 624fi 625 626AC_MSG_CHECKING(NTLM) 627if test "$ntlm" != no; then 628 AC_MSG_RESULT(enabled) 629 NTLM_LIBS="-lcrypto $LIB_RSAREF" 630 AC_SUBST(NTLM_LIBS) 631 632 SASL_MECHS="$SASL_MECHS libntlm.la" 633 if test "$enable_static" = yes; then 634 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/ntlm.c" 635 SASL_STATIC_OBJS="$SASL_STATIC_OBJS ntlm.o" 636 AC_DEFINE(STATIC_NTLM,[],[Link NTLM Statically]) 637 fi 638else 639 AC_MSG_RESULT(disabled) 640fi 641 642dnl PASSDSS 643AC_ARG_ENABLE(passdss, [ --enable-passdss enable PASSDSS authentication (experimental) [[no]] ], 644 passdss=$enableval, 645 passdss=no) 646 647if test "$with_openssl" = no; then 648 AC_MSG_WARN(OpenSSL not found -- PASSDSS will be disabled) 649 passdss=no 650fi 651 652AC_MSG_CHECKING(PASSDSS) 653if test "$passdss" != no; then 654 AC_MSG_RESULT(enabled) 655 PASSDSS_LIBS="-lcrypto $LIB_RSAREF" 656 AC_SUBST(PASSDSS_LIBS) 657 658 SASL_MECHS="$SASL_MECHS libpassdss.la" 659 if test "$enable_static" = yes; then 660 SASL_STATIC_OBJS="$SASL_STATIC_OBJS passdss.o" 661 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/passdss.c" 662 AC_DEFINE(STATIC_PASSDSS,[],[Link PASSDSS Statically]) 663 fi 664else 665 AC_MSG_RESULT(disabled) 666fi 667 668 669AC_MSG_CHECKING(to include LDAP support) 670AC_ARG_WITH(ldap, [ --with-ldap=DIR use LDAP (in DIR) for saslauthd [no] ], 671 with_ldap=$withval, 672 with_ldap=no) 673AC_MSG_RESULT($with_ldap) 674 675if test -d $with_ldap; then 676 CPPFLAGS="$CPPFLAGS -I${with_ldap}/include" 677 CMU_ADD_LIBPATH(${with_ldap}/lib) 678fi 679 680LDAP_LIBS="" 681if test "$with_ldap" != no; then 682 AC_CHECK_LIB(ldap, ldap_initialize, [ AC_DEFINE(HAVE_LDAP,[],[Support for LDAP?]) 683 LDAP_LIBS="-lldap -llber" 684 if test "$with_openssl" != "no"; then 685 LDAP_LIBS="$LDAP_LIBS -lcrypto $LIB_RSAREF" 686 fi],,-llber) 687fi 688AC_SUBST(LDAP_LIBS) 689 690 691dnl SQL 692dnl This flag also changes the requirements of --with-mysql and --with-pgsql 693dnl 694dnl Desired behavior: 695dnl 696dnl doesn't require mysql or postgres if --disable-sql is chosen 697dnl requires at least one (but not both) if --enable-sql is chosen 698 699AC_ARG_ENABLE(sql, [ --enable-sql enable SQL auxprop [[no]] ], 700 sql=$enableval, 701 sql=no) 702 703AC_MSG_CHECKING(SQL) 704if test "$sql" != no; then 705 AC_MSG_RESULT(enabled) 706 SASL_MECHS="$SASL_MECHS libsql.la" 707 if test "$enable_static" = yes; then 708 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/sql.c" 709 SASL_STATIC_OBJS="$SASL_STATIC_OBJS sql.o" 710 AC_DEFINE(STATIC_SQL,[],[Link SQL plugin statically]) 711 fi 712else 713 AC_MSG_RESULT(disabled) 714fi 715 716dnl MySQL 717AC_ARG_WITH(mysql, [ --with-mysql=PATH use MySQL from PATH ], 718 with_mysql=$withval, 719 with_mysql=$sql) 720 721# find location of library 722# presuming if one given then correct 723if test "${with_mysql}" = "yes"; then 724 with_mysql=notfound 725 for mysqlloc in lib/mysql lib mysql/lib 726 do 727 if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then 728 with_mysql="${prefix}" 729 break 730 elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then 731 with_mysql="/usr/local" 732 break 733 elif test -f /usr/${mysqlloc}/libmysqlclient.a; then 734 with_mysql="/usr" 735 break 736 fi 737 done 738fi 739 740LIB_MYSQL="" 741 742case "$with_mysql" in 743 no) true;; 744 notfound) 745 save_LDFLAGS=$LDFLAGS 746 LIB_MYSQL=`mysql_config --libs` 747 LIB_MYSQL="-lmysqlclient" 748 LDFLAGS="$LDFLAGS $LIB_MYSQL" 749 # CPPFLAGS="${CPPFLAGS} `mysql_config --include`" 750 AC_CHECK_LIB(mysqlclient, mysql_select_db, 751 AC_DEFINE(HAVE_MYSQL, [], [Do we have mysql support?]), 752 [AC_MSG_WARN(MySQL library mysqlclient does not work) 753 with_mysql=no]) 754 LDFLAGS=$save_LDFLAGS 755 ;; 756 *) 757 if test -d ${with_mysql}/lib/mysql; then 758 CMU_ADD_LIBPATH_TO(${with_mysql}/lib/mysql, LIB_MYSQL) 759 elif test -d ${with_mysql}/mysql/lib; then 760 CMU_ADD_LIBPATH_TO(${with_mysql}/mysql/lib, LIB_MYSQL) 761 elif test -d ${with_mysql}/lib; then 762 CMU_ADD_LIBPATH_TO(${with_mysql}/lib, LIB_MYSQL) 763 else 764 CMU_ADD_LIBPATH_TO(${with_mysql}, LIB_MYSQL) 765 fi 766 767 LIB_MYSQL_DIR=$LIB_MYSQL 768 LIB_MYSQL="$LIB_MYSQL -lmysqlclient" 769 770 if test -d ${with_mysql}/include/mysql; then 771 CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql" 772 elif test -d ${with_mysql}/mysql/include; then 773 CPPFLAGS="${CPPFLAGS} -I${with_mysql}/mysql/include" 774 elif test -d ${with_mysql}/include; then 775 CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include" 776 elif test -d ${prefix}/include/mysql; then 777 CPPFLAGS="${CPPFLAGS} -I${prefix}/include/mysql" 778 else 779 CPPFLAGS="${CPPFLAGS} -I${with_mysql}" 780 fi 781 782 save_LDFLAGS=$LDFLAGS 783 LDFLAGS="$LDFLAGS $LIB_MYSQL_DIR" 784 AC_CHECK_LIB(mysqlclient, mysql_select_db, 785 AC_DEFINE(HAVE_MYSQL, [], [Do we have mysql support?]), 786 [AC_MSG_WARN(MySQL library mysqlclient does not work) 787 with_mysql=no]) 788 LDFLAGS=$save_LDFLAGS;; 789 790esac 791AC_SUBST(LIB_MYSQL) 792 793dnl PgSQL 794AC_ARG_WITH(pgsql, [ --with-pgsql=PATH use PostgreSQL from PATH ], 795 with_pgsql=$withval, 796 with_pgsql=$sql) 797 798# find location of library 799# presuing if one given then correct 800if test "${with_pgsql}" = "yes"; then 801 with_pgsql=notfound 802 for pgsqlloc in lib/pgsql lib pgsql/lib 803 do 804 if test -f ${prefix}/${pgsqlloc}/libpq.a; then 805 with_pgsql="${prefix}" 806 break 807 elif test -f /usr/local/${pgsqlloc}/libpq.a; then 808 with_pgsql="/usr/local" 809 break 810 elif test -f /usr/${pgsqlloc}/libpq.a; then 811 with_pgsql="/usr" 812 break 813 fi 814 done 815fi 816 817LIB_PGSQL="" 818 819case "$with_pgsql" in 820 no) true;; 821 notfound) 822 LIB_PGSQL="-lpq" 823 # CPPFLAGS="${CPPFLAGS} -I`pg_config --includedir`" 824 save_LDFLAGS=$LDFLAGS 825 LDFLAGS="$LDFLAGS $LIB_PGSQL" 826 AC_CHECK_LIB(pq, PQsetdbLogin, AC_DEFINE(HAVE_PGSQL,[], 827 [Do we have Postgres support?]), 828 [AC_MSG_WARN(PostgreSQL Library pq does not work) 829 with_pgsql=no]) 830 LDFLAGS=$save_LDFLAGS 831 ;; 832 *) 833 if test -d ${with_pgsql}/lib/pgsql; then 834 CMU_ADD_LIBPATH_TO(${with_pgsql}/lib/pgsql, LIB_PGSQL) 835 elif test -d ${with_pgsql}/pgsql/lib; then 836 CMU_ADD_LIBPATH_TO(${with_pgsql}/pgsql/lib, LIB_PGSQL) 837 elif test -d ${with_pgsql}/lib; then 838 CMU_ADD_LIBPATH_TO(${with_pgsql}/lib, LIB_PGSQL) 839 else 840 CMU_ADD_LIBPATH_TO(${with_pgsql}, LIB_PGSQL) 841 fi 842 843 LIB_PGSQL_DIR=$LIB_PGSQL 844 LIB_PGSQL="$LIB_PGSQL -lpq" 845 846 if test -d ${with_pgsql}/include/pgsql; then 847 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include/pgsql" 848 elif test -d ${with_pgsql}/pgsql/include; then 849 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/pgsql/include" 850 elif test -d ${with_pgsql}/include; then 851 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include" 852 elif test -d ${prefix}/include; then 853 CPPFLAGS="${CPPFLAGS} -I${prefix}/include" 854 else 855 CPPFLAGS="${CPPFLAGS} -I${with_pgsql}" 856 fi 857 858 859 save_LDFLAGS=$LDFLAGS 860 LDFLAGS="$LDFLAGS $LIB_PGSQL_DIR" 861 AC_CHECK_LIB(pq, PQsetdbLogin, AC_DEFINE(HAVE_PGSQL,[], 862 [Do we have Postgres support?]), 863 [AC_MSG_WARN(PostgreSQL Library pq does not work) 864 with_pgsql=no]) 865 LDFLAGS=$save_LDFLAGS;; 866 867esac 868AC_SUBST(LIB_PGSQL) 869 870dnl SQLite 871AC_ARG_WITH(sqlite, [ --with-sqlite=PATH use SQLite from PATH ], 872 with_sqlite=$withval, 873 with_sqlite=$sql) 874 875# find location of library 876# presuing if one given then correct 877if test "${with_sqlite}" = "yes"; then 878 with_sqlite=notfound 879 for sqliteloc in lib 880 do 881 if test -f ${prefix}/${sqliteloc}/libsqlite.a; then 882 with_sqlite="${prefix}" 883 break 884 elif test -f /usr/local/${sqliteloc}/libsqlite.a; then 885 with_sqlite="/usr/local" 886 break 887 elif test -f /usr/${sqliteloc}/libsqlite.a; then 888 with_sqlite="/usr" 889 break 890 fi 891 done 892fi 893 894LIB_SQLITE="" 895 896case "$with_sqlite" in 897 no) true;; 898 notfound) AC_MSG_WARN(SQLite Library not found); true;; 899 *) 900 if test -d ${with_sqlite}/lib; then 901 CMU_ADD_LIBPATH_TO(${with_sqlite}/lib, LIB_SQLITE) 902 else 903 CMU_ADD_LIBPATH_TO(${with_sqlite}, LIB_SQLITE) 904 fi 905 906 LIB_SQLITE_DIR=$LIB_SQLITE 907 LIB_SQLITE="$LIB_SQLITE -lsqlite" 908 909 if test -d ${with_sqlite}/include; then 910 CPPFLAGS="${CPPFLAGS} -I${with_sqlite}/include" 911 else 912 CPPFLAGS="${CPPFLAGS} -I${with_sqlite}" 913 fi 914 AC_CHECK_LIB(sqlite, sqlite_open, AC_DEFINE(HAVE_SQLITE,[], 915 [Do we have SQLite support?]), 916 [AC_MSG_WARN(SQLite Library sqlite does not work) 917 with_sqlite=no], $LIB_SQLITE_DIR);; 918 919esac 920AC_SUBST(LIB_SQLITE) 921 922dnl SQLite3 923AC_ARG_WITH(sqlite3, [ --with-sqlite3=PATH use SQLite3 from PATH ], 924 with_sqlite3=$withval, 925 with_sqlite3=$sql) 926 927# find location of library 928# we assume that if one given then it is correct 929if test "${with_sqlite3}" = "yes"; then 930 with_sqlite3=notfound 931 for sqlite3loc in lib 932 do 933 if test -f ${prefix}/${sqlite3loc}/libsqlite3.a; then 934 with_sqlite3="${prefix}" 935 break 936 elif test -f /usr/local/${sqlite3loc}/libsqlite3.a; then 937 with_sqlite3="/usr/local" 938 break 939 elif test -f /usr/${sqlite3loc}/libsqlite3.a; then 940 with_sqlite3="/usr" 941 break 942 fi 943 done 944fi 945 946LIB_SQLITE3="" 947 948case "$with_sqlite3" in 949 no) true;; 950 notfound) AC_MSG_WARN(SQLite3 Library not found); true;; 951 *) 952 if test -d ${with_sqlite3}/lib; then 953 CMU_ADD_LIBPATH_TO(${with_sqlite3}/lib, LIB_SQLITE3) 954 else 955 CMU_ADD_LIBPATH_TO(${with_sqlite3}, LIB_SQLITE3) 956 fi 957 958 LIB_SQLITE3_DIR=$LIB_SQLITE3 959 LIB_SQLITE3="$LIB_SQLITE3 -lsqlite3" 960 961 if test -d ${with_sqlite3}/include; then 962 CPPFLAGS="${CPPFLAGS} -I${with_sqlite3}/include" 963 else 964 CPPFLAGS="${CPPFLAGS} -I${with_sqlite3}" 965 fi 966 AC_CHECK_LIB(sqlite3, sqlite3_open, AC_DEFINE(HAVE_SQLITE3,[], 967 [Do we have SQLite3 support?]), 968 [AC_MSG_WARN(SQLite3 Library sqlite3 does not work) 969 with_sqlite3=no], $LIB_SQLITE3_DIR);; 970 971esac 972AC_SUBST(LIB_SQLITE3) 973 974if test "$sql" = yes -a "$with_pgsql" = no -a "$with_mysql" = no -a "$with_sqlite" = no -a "$with_sqlite3" = no; then 975 AC_MSG_ERROR([--enable-sql chosen but neither Postgres nor MySQL nor SQLite nor SQLite3 found]) 976fi 977 978if test "$enable_shared" = yes; then 979 AC_DEFINE(DO_DLOPEN,[],[Should we build a shared plugin (via dlopen) library?]) 980fi 981 982dnl LDAPDB 983AC_ARG_ENABLE(ldapdb, [ --enable-ldapdb enable LDAPDB plugin [no] ], 984 ldapdb=$enableval, 985 ldapdb=no) 986AC_MSG_CHECKING(LDAPDB) 987if test "$ldapdb" != no; then 988 AC_MSG_RESULT(enabled) 989 990 if test "$with_ldap" = no; then 991 AC_MSG_ERROR([Cannot enable LDAPDB plugin: You need to specify --with-ldap]) 992 fi 993 994 save_CPPFLAGS=$CPPFLAGS 995 save_LDFLAGS=$LDFLAGS 996 997 if test -d $with_ldap; then 998 CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include" 999 CMU_ADD_LIBPATH(${with_ldap}/lib) 1000 fi 1001 1002 AC_CHECK_HEADERS(ldap.h lber.h) 1003 1004 if test $ac_cv_header_ldap_h = yes -a $ac_cv_header_lber_h = yes; then 1005 CMU_OPENLDAP_API 1006 1007 if test "$cmu_cv_openldap_api" = yes; then 1008 AC_CHECK_LIB(ldap, ldap_initialize, [ cmu_link_openldap="-lldap -llber" ], [ cmu_link_openldap=no ],-llber) 1009 fi 1010 fi 1011 1012 if test "$cmu_cv_openldap_api" = no -o "$cmu_link_openldap" = no; then 1013 AC_MSG_ERROR([Cannot enable LDAPDB plugin: Could not locate OpenLDAP]) 1014 else 1015 CMU_OPENLDAP_COMPAT 1016 1017 if test "$cmu_cv_openldap_compat" = no; then 1018 AC_MSG_ERROR([Cannot enable LDAPDB plugin: OpenLDAP library located but incompatible]) 1019 else 1020 LIB_LDAP=$cmu_link_openldap 1021 AC_SUBST(LIB_LDAP) 1022 1023 SASL_MECHS="$SASL_MECHS libldapdb.la" 1024 if test "$enable_static" = yes; then 1025 SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/ldapdb.c" 1026 SASL_STATIC_OBJS="$SASL_STATIC_OBJS ldapdb.o" 1027 AC_DEFINE(STATIC_LDAPDB,[],[Link ldapdb plugin Statically]) 1028 fi 1029 fi 1030 fi 1031 1032 if test "$cmu_cv_openldap_compat" != yes; then 1033 CPPFLAGS=$save_CPPFLAGS 1034 LDFLAGS=$save_LDFLAGS 1035 fi 1036else 1037 AC_MSG_RESULT(disabled) 1038fi 1039 1040AC_SUBST(SASL_MECHS) 1041AC_SUBST(SASL_STATIC_SRCS) 1042AC_SUBST(SASL_STATIC_OBJS) 1043AC_SUBST(SASL_STATIC_LIBS) 1044 1045AC_ARG_WITH(plugindir, [ --with-plugindir=DIR set the directory where plugins will 1046 be found [[LIBDIR/sasl2]] ], 1047 plugindir=$withval, 1048 plugindir='${libdir}/sasl2') 1049AC_SUBST(plugindir) 1050 1051AC_ARG_WITH(configdir, [ --with-configdir=DIR set the directory where config files will 1052 be found [PLUGINDIR:SYSCONFDIR/sasl2] ], 1053 configdir=$withval, 1054 configdir='${plugindir}:${sysconfdir}/sasl2') 1055AC_SUBST(configdir) 1056 1057AC_ARG_WITH(rc4, [ --with-rc4 use rc4 routines [[yes]] ], 1058 with_rc4=$withval, 1059 with_rc4=yes) 1060 1061if test "$with_rc4" != no; then 1062 AC_DEFINE(WITH_RC4,[],[Use RC4]) 1063fi 1064 1065building_for_macosx=no 1066case "$host_os" in 1067 darwin*) 1068AC_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) 1069 ;; 1070esac 1071AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes) 1072AM_CONDITIONAL(WINDOWS, test "$host_os" = "mingw32") 1073 1074dnl dmalloc tests 1075AC_MSG_CHECKING(for dmalloc library) 1076AC_ARG_WITH(dmalloc, [ --with-dmalloc=DIR with DMALLOC support (for test applications) [[no]] ], 1077 with_dmalloc=$withval, 1078 with_dmalloc=no) 1079 1080DMALLOC_LIBS="" 1081 1082if test "$with_dmalloc" != "no"; then 1083 if test "$with_dmalloc" = "yes"; then 1084 with_dmalloc="/usr/local" 1085 fi 1086 1087 if test -r "$with_dmalloc/libdmalloc.a"; then 1088 DMALLOC_LIBS="$with_dmalloc/libdmalloc.a" 1089 AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?]) 1090 AC_MSG_RESULT(yes) 1091 elif test -r "$with_dmalloc/lib/libdmalloc.a"; then 1092 DMALLOC_LIBS="$with_dmalloc/lib/libdmalloc.a" 1093 AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?]) 1094 AC_MSG_RESULT(yes) 1095 else 1096 AC_MSG_ERROR(cannot find dmalloc library, please check your installation.) 1097 fi 1098else 1099 AC_MSG_RESULT(no) 1100fi 1101 1102AC_SUBST(DMALLOC_LIBS) 1103 1104dnl sfio tests 1105AC_MSG_CHECKING(for sfio library) 1106AC_ARG_WITH(sfio, [ --with-sfio=DIR with SFIO support (for smtptest/libsfsasl) [[no]] ], 1107 with_sfio=$withval, 1108 with_sfio=no) 1109 1110if test "$with_sfio" != "no"; then 1111 if test "$with_sfio" = "yes"; then 1112 with_sfio="/usr/local" 1113 fi 1114 1115 AC_DEFUN([SFIO_INC_CHK], 1116 [if test -r "$with_sfio$1/sfio.h"; then SFIO_DIR=$with_sfio; 1117 SFIO_INC_DIR=$with_sfio$1]) 1118 1119 AC_DEFUN([SFIO_LIB_CHK],[ 1120 str="$SFIO_DIR/$1/libsfio.*" 1121 for i in `echo $str`; do 1122 if test -r $i; then 1123 SFIO_LIBDIR=$SFIO_DIR/$1 1124 break 2 1125 fi 1126 done 1127 ]) 1128 1129 SFIO_INC_CHK() 1130 el[]SFIO_INC_CHK(/include) 1131 el[]SFIO_INC_CHK(/include/sfio) 1132 fi 1133 1134 if test -z "$SFIO_DIR"; then 1135 AC_MSG_ERROR(Cannot find sfio.h, Please check your SFIO installation.) 1136 fi 1137 1138 SFIO_LIB_CHK(lib) 1139 SFIO_LIB_CHK(lib/sfio) 1140 1141 if test -z "$SFIO_LIBDIR"; then 1142 AC_MSG_ERROR(Cannot find sfio library, Please check your SFIO installation.) 1143 fi 1144 1145 SFIO_INC_FLAGS="-I$SFIO_INC_DIR" 1146 SFIO_LIB_FLAGS="-L$SFIO_LIBDIR -lsfio" 1147 SMTPTEST_PROGRAM="smtptest" 1148 SASL_UTIL_LIBS_EXTRA=libsfsasl2.la 1149 SASL_UTIL_HEADERS_EXTRA=sfsasl.h 1150 1151 AC_MSG_RESULT(yes) 1152else 1153 AC_MSG_RESULT(no) 1154 SFIO_INC_FLAGS="" 1155 SFIO_LIB_FLAGS="" 1156 SMTPTEST_PROGRAM="" 1157 SASL_UTIL_LIBS_EXTRA="" 1158 SASL_UTIL_HEADERS_EXTRA="" 1159fi 1160 1161AC_SUBST(SFIO_INC_FLAGS) 1162AC_SUBST(SFIO_LIB_FLAGS) 1163AC_SUBST(SMTPTEST_PROGRAM) 1164AC_SUBST(SASL_UTIL_LIBS_EXTRA) 1165AC_SUBST(SASL_UTIL_HEADERS_EXTRA) 1166 1167dnl check for getsubopt 1168sasl_cv_getsubopt=no 1169AC_CHECK_FUNC(getsubopt, [AC_DEFINE(HAVE_GETSUBOPT,[], 1170 [do we have getsubopt()?])], [sasl_cv_getsubopt=yes]) 1171if test $sasl_cv_getsubopt = yes; then 1172 AC_LIBOBJ(getsubopt) 1173 GETSUBOPT="getsubopt.lo" 1174fi 1175AC_SUBST(GETSUBOPT) 1176 1177dnl Check for snprintf 1178sasl_cv_snprintf=no 1179SNPRINTFOBJS="" 1180LTSNPRINTFOBJS="" 1181AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF,[],[Does the system have snprintf()?])], [sasl_cv_snprintf=yes]) 1182AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF,[],[Does the system have vsnprintf()?])], [sasl_cv_snprintf=yes]) 1183if test $sasl_cv_snprintf = yes; then 1184 AC_LIBOBJ(snprintf) 1185 SNPRINTFOBJS="snprintf.o" 1186 LTSNPRINTFOBJS="snprintf.lo" 1187fi 1188AC_SUBST(SNPRINTFOBJS) 1189AC_SUBST(LTSNPRINTFOBJS) 1190 1191dnl do we need to link in -lresolv? 1192AC_CHECK_LIB(resolv, inet_aton) 1193 1194dnl Check for getaddrinfo 1195GETADDRINFOOBJS="" 1196sasl_cv_getaddrinfo=yes 1197IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror, 1198 [AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo() function?]) 1199 sasl_cv_getaddrinfo=no])]) 1200if test $sasl_cv_getaddrinfo = yes; then 1201 AC_LIBOBJ(getaddrinfo) 1202 GETADDRINFOOBJS="getaddrinfo.o" 1203 LTGETADDRINFOOBJS="getaddrinfo.lo" 1204fi 1205AC_SUBST(GETADDRINFOOBJS) 1206AC_SUBST(LTGETADDRINFOOBJS) 1207 1208dnl Check for getnameinfo 1209GETNAMEINFOOBJS="" 1210sasl_cv_getnameinfo=no 1211IPv6_CHECK_FUNC(getnameinfo, 1212 [AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo() function?])], [sasl_cv_getnameinfo=yes]) 1213if test $sasl_cv_getnameinfo = yes; then 1214 AC_LIBOBJ(getnameinfo) 1215 GETNAMEINFOOBJS="getnameinfo.o" 1216 LTGETNAMEINFOOBJS="getnameinfo.lo" 1217fi 1218AC_SUBST(GETNAMEINFOOBJS) 1219AC_SUBST(LTGETNAMEINFOOBJS) 1220 1221LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` 1222AM_CONDITIONAL(BUILD_LIBOBJ, test "$LTLIBOBJS" != "") 1223AC_SUBST(LTLIBOBJS) 1224 1225AC_C_CONST 1226AC_C_INLINE 1227AC_TYPE_MODE_T 1228AC_TYPE_PID_T 1229 1230AC_CHECK_HEADERS_ONCE([sys/time.h]) 1231 1232AC_HEADER_DIRENT 1233AC_HEADER_SYS_WAIT 1234AC_CHECK_HEADERS(crypt.h 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 krb5.h) 1235 1236IPv6_CHECK_SS_FAMILY() 1237IPv6_CHECK_SA_LEN() 1238IPv6_CHECK_SOCKLEN_T() 1239 1240#AC_FUNC_MEMCMP 1241#AC_FUNC_VPRINTF 1242AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy memmem mkdir select socket strchr strdup strerror strspn strstr strtol jrand48 getpassphrase asprintf strlcat strlcpy) 1243 1244if test $ac_cv_func_getspnam = yes; then 1245 AC_MSG_CHECKING(if getpwnam_r/getspnam_r take 5 arguments) 1246 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1247#include <sys/types.h> 1248#include <pwd.h> 1249#include <shadow.h> 1250 ]], [[ 1251struct passwd *pw; 1252struct passwd pwbuf; 1253char pwdata[512]; 1254(void) getpwnam_r("bin", &pwbuf, pwdata, sizeof(pwdata), &pw); 1255 ]])],[AC_MSG_RESULT(yes) 1256 AC_DEFINE(GETXXNAM_R_5ARG, 1, 1257 [Define if your getpwnam_r()/getspnam_r() 1258 functions take 5 arguments])],[AC_MSG_RESULT(no) 1259 ]) 1260fi 1261 1262if test $enable_cmulocal = yes; then 1263 AC_MSG_WARN(enabling CMU local kludges) 1264 AC_DEFINE(KRB4_IGNORE_IP_ADDRESS,[],[Ignore IP Address in Kerberos 4 tickets?]) 1265 AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4", [Force a preferred mechanism]) 1266fi 1267 1268AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [ 1269 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have struct sockaddr_stroage?])]) 1270 1271AC_SUBST(DIRS) 1272 1273dnl documentation generation (sphinx, perl2rst) 1274AC_ARG_VAR(SPHINX_BUILD, [Location of sphinx-build]) 1275AC_ARG_WITH([sphinx-build], 1276 AS_HELP_STRING([with-sphinx-build=(yes|no|PATH)], [Look for sphinx-build in PATH]), 1277 [with_sphinx_build=$withval], 1278 [with_sphinx_build=yes]) 1279AS_CASE([$with_sphinx_build], 1280 [yes], [AC_PATH_PROG(SPHINX_BUILD, sphinx-build)], 1281 [no], [SPHINX_BUILD=''], 1282 [*], [AC_PATH_PROG(SPHINX_BUILD, sphinx-build, [], [$with_sphinx_build])]) 1283AS_IF([test -z "$SPHINX_BUILD"], 1284 [AC_MSG_WARN([No sphinx-build, won't be able to regenerate docs])]) 1285AC_SUBST([SPHINX_BUILD]) 1286AX_PROG_PERL_MODULES([Pod::POM::View::Restructured],[have_ppvr=yes],[AC_MSG_WARN([No Pod::POM::View::Restructured, won't be able to regenerate docs])]) 1287AM_CONDITIONAL([HAVE_SPHINX_BUILD], [ test -n "$SPHINX_BUILD" -a x"$have_ppvr" = xyes]) 1288 1289 1290AH_TOP([ 1291/* acconfig.h - autoheader configuration input */ 1292/* 1293 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved. 1294 * 1295 * Redistribution and use in source and binary forms, with or without 1296 * modification, are permitted provided that the following conditions 1297 * are met: 1298 * 1299 * 1. Redistributions of source code must retain the above copyright 1300 * notice, this list of conditions and the following disclaimer. 1301 * 1302 * 2. Redistributions in binary form must reproduce the above copyright 1303 * notice, this list of conditions and the following disclaimer in 1304 * the documentation and/or other materials provided with the 1305 * distribution. 1306 * 1307 * 3. The name "Carnegie Mellon University" must not be used to 1308 * endorse or promote products derived from this software without 1309 * prior written permission. For permission or any other legal 1310 * details, please contact 1311 * Office of Technology Transfer 1312 * Carnegie Mellon University 1313 * 5000 Forbes Avenue 1314 * Pittsburgh, PA 15213-3890 1315 * (412) 268-4387, fax: (412) 268-7395 1316 * tech-transfer@andrew.cmu.edu 1317 * 1318 * 4. Redistributions of any form whatsoever must retain the following 1319 * acknowledgment: 1320 * "This product includes software developed by Computing Services 1321 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 1322 * 1323 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 1324 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 1325 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 1326 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1327 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 1328 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 1329 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1330 */ 1331 1332#ifndef CONFIG_H 1333#define CONFIG_H 1334]) 1335 1336AH_BOTTOM([ 1337 1338#define RETSIGTYPE void 1339 1340/* Create a struct iovec if we need one */ 1341#if !defined(_WIN32) 1342#if !defined(HAVE_SYS_UIO_H) 1343/* (win32 is handled in sasl.h) */ 1344struct iovec { 1345 char *iov_base; 1346 long iov_len; 1347}; 1348#else 1349#include <sys/types.h> 1350#include <sys/uio.h> 1351#endif 1352#endif 1353 1354/* location of the random number generator */ 1355#ifdef DEV_RANDOM 1356#undef DEV_RANDOM 1357#endif 1358#define DEV_RANDOM SASL_DEV_RANDOM 1359 1360/* if we've got krb_get_err_txt, we might as well use it; 1361 especially since krb_err_txt isn't in some newer distributions 1362 (MIT Kerb for Mac 4 being a notable example). If we don't have 1363 it, we fall back to the krb_err_txt array */ 1364#ifdef HAVE_KRB_GET_ERR_TEXT 1365#define get_krb_err_txt krb_get_err_text 1366#else 1367#define get_krb_err_txt(X) (krb_err_txt[(X)]) 1368#endif 1369 1370/* Make Solaris happy... */ 1371#ifndef __EXTENSIONS__ 1372#define __EXTENSIONS__ 1373#endif 1374 1375/* Make Linux happy... */ 1376#ifndef _GNU_SOURCE 1377#define _GNU_SOURCE 1378#endif 1379 1380#define SASL_PATH_ENV_VAR "SASL_PATH" 1381#define SASL_CONF_PATH_ENV_VAR "SASL_CONF_PATH" 1382 1383#include <stdlib.h> 1384#include <sys/types.h> 1385#ifndef WIN32 1386# include <sys/socket.h> 1387# include <netdb.h> 1388# include <netinet/in.h> 1389# ifdef HAVE_SYS_PARAM_H 1390# include <sys/param.h> 1391# endif 1392#else /* WIN32 */ 1393# include <winsock2.h> 1394#endif /* WIN32 */ 1395#include <string.h> 1396 1397#ifndef HAVE_SOCKLEN_T 1398typedef unsigned int socklen_t; 1399#endif /* HAVE_SOCKLEN_T */ 1400 1401#if !defined(HAVE_STRUCT_SOCKADDR_STORAGE) && !defined(WIN32) 1402#define _SS_MAXSIZE 128 /* Implementation specific max size */ 1403#define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) 1404 1405struct sockaddr_storage { 1406 struct sockaddr ss_sa; 1407 char __ss_pad2[_SS_PADSIZE]; 1408}; 1409# define ss_family ss_sa.sa_family 1410#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ 1411 1412#ifndef AF_INET6 1413/* Define it to something that should never appear */ 1414#define AF_INET6 AF_MAX 1415#endif 1416 1417#ifndef HAVE_GETADDRINFO 1418#define getaddrinfo sasl_getaddrinfo 1419#define freeaddrinfo sasl_freeaddrinfo 1420#define gai_strerror sasl_gai_strerror 1421#endif 1422 1423#ifndef HAVE_GETNAMEINFO 1424#define getnameinfo sasl_getnameinfo 1425#endif 1426 1427#if !defined(HAVE_GETNAMEINFO) || !defined(HAVE_GETADDRINFO) 1428#include "gai.h" 1429#endif 1430 1431#ifndef AI_NUMERICHOST /* support glibc 2.0.x */ 1432#define AI_NUMERICHOST 4 1433#define NI_NUMERICHOST 2 1434#define NI_NAMEREQD 4 1435#define NI_NUMERICSERV 8 1436#endif 1437 1438#ifndef HAVE_SYSEXITS_H 1439#include "exits.h" 1440#else 1441#include "sysexits.h" 1442#endif 1443 1444/* Get the correct time.h */ 1445#if TIME_WITH_SYS_TIME 1446# include <sys/time.h> 1447# include <time.h> 1448#else 1449# if HAVE_SYS_TIME_H 1450# include <sys/time.h> 1451# else 1452# include <time.h> 1453# endif 1454#endif 1455 1456#ifndef HIER_DELIMITER 1457#define HIER_DELIMITER '/' 1458#endif 1459 1460#ifdef WIN32 1461#define SASL_ROOT_KEY "SOFTWARE\\Carnegie Mellon\\Project Cyrus\\SASL Library" 1462#define SASL_PLUGIN_PATH_ATTR "SearchPath" 1463#define SASL_CONF_PATH_ATTR "ConfFile" 1464 1465#include <windows.h> 1466inline static unsigned int sleep(unsigned int seconds) { 1467 Sleep(seconds * 1000); 1468 return 0; 1469} 1470#endif 1471 1472/* handy string manipulation functions */ 1473#ifndef HAVE_STRLCPY 1474extern size_t saslauthd_strlcpy(char *dst, const char *src, size_t len); 1475#define strlcpy(x,y,z) saslauthd_strlcpy((x),(y),(z)) 1476#endif 1477#ifndef HAVE_STRLCAT 1478extern size_t saslauthd_strlcat(char *dst, const char *src, size_t len); 1479#define strlcat(x,y,z) saslauthd_strlcat((x),(y),(z)) 1480#endif 1481#ifndef HAVE_ASPRINTF 1482extern int asprintf(char **str, const char *fmt, ...); 1483#endif 1484 1485#endif /* CONFIG_H */ 1486]) 1487 1488AH_BOTTOM([#if defined __GNUC__ && __GNUC__ > 6 1489 #define GCC_FALLTHROUGH __attribute__((fallthrough)); 1490#else 1491 #define GCC_FALLTHROUGH /* fall through */ 1492#endif 1493]) 1494 1495AC_CONFIG_HEADERS(config.h) 1496 1497AC_CONFIG_FILES([Makefile 1498libsasl2.pc 1499include/Makefile 1500saslauthd/Makefile 1501sasldb/Makefile 1502common/Makefile 1503plugins/Makefile 1504lib/Makefile 1505utils/Makefile 1506sample/Makefile 1507pwcheck/Makefile]) 1508AC_OUTPUT 1509 1510AC_MSG_NOTICE([ 1511 1512cyrus-sasl - $VERSION 1513 1514• Prefix: $prefix 1515• Plugins: $SASL_MECHS 1516 1517Now type 'make' to build $PACKAGE 1518]) 1519