1dnl Process this file with autoconf to produce a configure script. 2dnl 3dnl 4dnl Copyright 1998 - 2021 Double Precision, Inc. See COPYING for 5dnl distribution information. 6 7AC_PREREQ(2.63) 8AC_INIT([courier-authlib],[0.71.4],[courier-users@lists.sourceforge.net]) 9 10AC_CONFIG_SRCDIR([courierauth.h]) 11 12AM_INIT_AUTOMAKE 13AC_CONFIG_HEADERS([courier_auth_config.h]) 14>confdefs.h # Kill PACKAGE_ macros 15 16LPATH="$PATH:/usr/local/bin" 17 18dnl Checks for programs. 19AC_PROG_AWK 20AC_PROG_CC 21AC_PROG_CC_C99 22AC_PROG_CXX 23AC_PROG_CPP 24AC_PROG_INSTALL 25AC_PROG_LN_S 26AC_PROG_SYSCONFTOOL 27LT_INIT(dlopen) 28LTDL_INIT 29AC_SUBST(LTDLINCL) 30AC_SUBST(LIBLTDL) 31AC_PATH_PROGS(PERL, perl5 perl, perl, $LPATH) 32AC_PATH_PROGS(COURIERCONFIG, courier-config, courier-config, $LPATH) 33 34AC_CHECK_HEADER(ltdl.h, [ : ], 35 AC_MSG_ERROR([Unable to find ltdl.h. Please install Libtool's ltdl library])) 36 37if test "$PERL" = "perl" 38then 39 AC_MSG_ERROR(Perl is required) 40fi 41 42test "x$prefix" = xNONE && prefix=$ac_default_prefix 43test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' 44eval "prefix=$prefix" 45eval "exec_prefix=$exec_prefix" 46eval "sysconfdir=$sysconfdir" 47eval "bindir=$bindir" 48eval "sbindir=$sbindir" 49eval "localstatedir=$localstatedir" 50eval "libexecdir=$libexecdir" 51eval "datarootdir=$datarootdir" 52eval "datedir=$datadir" 53 54AC_PATH_PROGS(EXPECT, expect, expect, $LPATH) 55 56if test "$EXPECT" = "expect" 57then 58 AC_MSG_WARN(-----------------------------------------------------) 59 AC_MSG_WARN(expect not found - will not be able to change passwds) 60 AC_MSG_WARN(in webmail) 61 AC_MSG_WARN(-----------------------------------------------------) 62 sleep 5 63else 64 AC_DEFINE_UNQUOTED(HAVE_EXPECT, 1, [ Whether expect(1) is installed ]) 65fi 66 67AC_PATH_PROGS(PASSWD, passwd, passwd, $LPATH) 68AC_SUBST(PASSWD) 69 70if test "$GCC" = "yes" 71then 72 CFLAGS="$CFLAGS -Wall" 73 CXXFLAGS="$CXXFLAGS -Wall" 74fi 75 76CFLAGS="$CFLAGS -Ilibs -I${srcdir}/libs" 77CXXFLAGS="$CXXFLAGS -Ilibs -I${srcdir}/libs" 78 79AC_MSG_CHECKING(whether -lm is needed for linking) 80 81OLDLIBS="$LIBS" 82LIBS="$LIBS -lm" 83AC_TRY_LINK([ 84], [ 85], 86 AC_MSG_RESULT(yes) 87 LIBM="-lm", 88 AC_MSG_RESULT(no)) 89LIBS="$OLDLIBS" 90 91AC_ARG_WITH(pkgconfdir, 92[ --with-pkgconfdir=d Install config files in directory ], 93 [pkgconfdir="$withval"], 94 [pkgconfdir="$sysconfdir/authlib"]) 95 96saveLIBS="$LIBS" 97NETLIBS="" 98USENSL=no 99 100LIBS="$OLDLIBS -lsocket" 101 102AC_TRY_LINK([ 103#include <sys/types.h> 104#include <sys/socket.h> 105], [ 106(void)socket(0, 0, 0); 107], [ 108 NETLIBS="-lsocket" 109], 110[ 111 112LIBS="$saveLIBS -lsocket -lnsl" 113 114AC_TRY_LINK([ 115#include <sys/types.h> 116#include <sys/socket.h> 117], [ 118(void)socket(0, 0, 0); 119], [ 120 NETLIBS="-lsocket -lnsl" 121 USENSL=yes 122], [ 123 124LIBS="$saveLIBS -lsocket" 125 126AC_TRY_LINK([ 127#include <sys/types.h> 128#include <sys/socket.h> 129], [ 130(void)connect(0, 0, 0); 131], [ 132 NETLIBS="-lsocket" 133], 134[ 135 136LIBS="$saveLIBS -lsocket -lnsl" 137AC_TRY_LINK([ 138#include <sys/types.h> 139#include <sys/socket.h> 140], [ 141(void)connect(0, 0, 0); 142], [ 143 NETLIBS="-lsocket -lnsl" 144 USENSL=yes 145], 146[ 147]) 148]) 149]) 150]) 151 152if test $USENSL != yes; then 153 LIBS="$saveLIBS $NETLIBS" 154 AC_TRY_LINK_FUNC(inet_addr, [ : ], 155 [ 156 AC_CHECK_LIB(nsl,inet_addr,result=yes,result=no) 157 if test $result = yes; then 158 NETLIBS="$NETLIBS -lnsl" 159 fi 160 ]) 161fi 162 163LIBS="$saveLIBS" 164AC_SUBST(NETLIBS) 165 166AX_COURIER_UNICODE_VERSION(2.1) 167 168dnl ######################################################################### 169 170dnl Prepare authuserdb module if userdb library is available 171 172dnl ######################################################################### 173 174 175AC_ARG_WITH(db, [ --with-db=gdbm Use the GDBM library. 176 --with-db=db Use the libdb.a library.], 177 db="$withval", needs_withdb=1) 178 179case "$db" in 180gdbm) 181 ;; 182db) 183 ;; 184"") 185 ;; 186*) 187 AC_MSG_ERROR(Invalid --with-db option.) 188 ;; 189esac 190 191saveLIBS="$LIBS" 192 193if test "$db" != "db" 194then 195 AC_CHECK_LIB(gdbm, gdbm_open, 196 [ LIBGDBM=-lgdbm ; LIBS="-lgdbm $LIBS" ]) 197 AC_CHECK_FUNC(gdbm_open, [ HAVE_GDBM=y ]) 198fi 199 200LIBS="$saveLIBS" 201 202if test "$db" != "gdbm" 203then 204 AC_CHECK_LIB(db, dbopen, [ LIBDB=-ldb ; LIBS="-ldb $LIBS" ], 205 [ AC_CHECK_LIB(db, db_open, [ LIBDB=-ldb ; LIBS="-ldb $LIBS"], 206 [ AC_CHECK_LIB(db, db_env_create, 207 [ LIBDB=-ldb; LIBS="-ldb $LIBS"]) ] 208 )]) 209 210 AC_CHECK_FUNC(dbopen, HAVE_BDB=1) 211 AC_CHECK_FUNC(db_open, HAVE_BDB=1) 212 AC_CHECK_FUNC(db_env_create, HAVE_BDB=1) 213fi 214 215LIBS="$saveLIBS" 216 217if test "$HAVE_GDBM$HAVE_BDB" = "" 218then 219 AC_MSG_ERROR(Cannot find either the gdbm or the db library.) 220fi 221 222USE_GDBM=0 223USE_DB=0 224 225if test "$HAVE_GDBM" = "y" 226then 227 LIBDB="" 228 USE_GDBM=1 229 if test "$needs_withdb" = 1 230 then 231 ac_configure_args="$ac_configure_args --with-db=gdbm" 232 fi 233 dblibrary=libs/gdbmobj/libgdbmobj.la 234else 235 LIBGDBM="" 236 USE_DB=1 237 if test "$needs_withdb" = 1 238 then 239 ac_configure_args="$ac_configure_args --with-db=db" 240 fi 241 dblibrary=libs/bdbobj/libbdbobj.la 242fi 243 244AC_SUBST(USE_GDBM) 245AC_SUBST(USE_DB) 246 247AC_ARG_WITH(authuserdb, 248[ --without-authuserdb Do not include the authuserdb module ], 249 doauthuserdb="$withval", 250 doauthuserdb="no" 251 if test -d ${srcdir}/userdb 252 then 253 doauthuserdb="yes" 254 fi) 255 256if test "$doauthuserdb" = "no" 257then 258 AUTHUSERDB="" 259else 260 AUTHUSERDB="authuserdb" 261 LIBAUTHUSERDB="libauthuserdb.la" 262 263fi 264 265AC_ARG_WITH(makedatprog, [ ], [ : ], 266 [ 267 ac_configure_args="$ac_configure_args --with-makedatprog=$libexecdir/courier-authlib/makedatprog" 268 ]) 269 270cat >dbobj.config <<EOF 271LIBDB=$LIBDB 272LIBGDBM=$LIBGDBM 273dblibrary=$dblibrary 274EOF 275 276AC_SUBST(USE_GDBM) 277AC_SUBST(USE_DB) 278 279AC_SUBST(dblibrary) 280AC_SUBST(LIBGDBM) 281AC_SUBST(LIBDB) 282AC_SUBST(LIBAUTHUSERDB) 283 284userdb="$pkgconfdir/userdb" 285AC_ARG_WITH(userdb, [], [ userdb="$withval" ], [ac_configure_args="$ac_configure_args '--with-userdb=$userdb'"]) 286 287AC_DEFINE_UNQUOTED(USERDB,"$userdb", [ Location of the userdb database ]) 288AC_SUBST(userdb) 289 290dnl Checks for header files. 291dnl 292dnl Because autoconf sets macros for C preprocessor where 293dnl AC_CHECK_HEADERS appears first, the first AC_CHECK_HEADERS 294dnl must not place in conditional level but top level. 295dnl This is a dummy AC_CHECK_HEADERS for it. 296dnl 297AC_CHECK_HEADERS(stdio.h) 298 299dnl ######################################################################### 300 301dnl Prepare authpam module if libpam is available. 302 303dnl ######################################################################### 304 305AC_ARG_WITH(authpam, 306[ --without-authpam Do not include the authpam module ], 307 doauthpam="$withval") 308 309AC_CHECK_HEADERS(security/pam_appl.h Pam/pam_appl.h) 310if test "$doauthpam" = "no" 311then 312 LIBDL="" 313else 314 saveLIBS="$LIBS" 315 LIBDL="" 316 AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ]) 317 LIBS="$saveLIBS" 318 319 AC_CHECK_LIB(pam, pam_start, 320 [ HAVE_PAM=1 321 LIBS="-lpam $LIBDL $LIBS" 322 AC_CHECK_FUNCS(pam_setcred)], 323 324 HAVE_PAM=0, 325 $LIBDL) 326 LIBS="$saveLIBS" 327fi 328AC_SUBST(LIBDL) 329 330LIBAUTHPAM="" 331if test "$HAVE_PAM" = 1 332then 333 LIBAUTHPAM=libauthpam.la 334fi 335 336AC_ARG_WITH(authpam-libraries, 337[ --with-authpam-libraries="libs" Link 'libs' with authpam, this may be 338 required for FreeBSD 3.3], 339 authpamcrypt="$withval") 340 341AUTHPAMCRYPT="$authpamcrypt" 342AC_SUBST(AUTHPAMCRYPT) 343AC_SUBST(LIBAUTHPAM) 344 345dnl ######################################################################### 346 347dnl Prepare authldap module if ldap functions are available. 348 349dnl ######################################################################### 350 351AC_ARG_WITH(authldap, 352[ --without-authldap Do not include the authldap module ], 353 doauthldap="$withval", 354 doauthldap="yes") 355 356AC_CHECK_HEADERS(lber.h) 357AC_CHECK_HEADERS(ldap.h) 358AC_CHECK_HEADERS(netinet/in.h) 359 360if test "$doauthldap" = "no" 361then 362 HAVE_LDAP=0 363else 364 saveLIBS="$LIBS" 365 LIBS="$NETLIBS $LIBS" 366 LDAPLIBS="" 367 368 AC_MSG_CHECKING(whether -lresolv is needed for res_query) 369 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 370#include <sys/types.h> 371#if HAVE_NETINET_IN_H 372#include <netinet/in.h> 373#endif 374#include <resolv.h> 375 376void (*func)()= (void (*)())res_query; 377], 378 [ (*func)(); ])], 379 AC_MSG_RESULT(no), 380 [ 381 LIBS="-lresolv $LIBS" 382 383 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 384#include <sys/types.h> 385#if HAVE_NETINET_IN_H 386#include <netinet/in.h> 387#endif 388#include <resolv.h> 389 390void (*func)()= (void (*)())res_query; 391], 392 [ (*func)(); ])], [ 393 LDAPLIBS="-lresolv $LDAPLIBS" 394 HAVE_LDAP=1 395 AC_MSG_RESULT(yes) 396 ], 397 AC_MSG_ERROR(Cannot find function res_query)) 398 ]) 399 400 AC_CHECK_LIB(lber, ber_scanf, 401 [ LDAPLIBS="-llber $LDAPLIBS" LIBS="-llber $LIBS" ]) 402 AC_CHECK_LIB(ldap, ldap_open, 403 [ LDAPLIBS="-lldap $LDAPLIBS" ; LIBS="-lldap $LIBS" ]) 404 AC_CHECK_FUNC(ldap_search_st, HAVE_LDAP=1, HAVE_LDAP=0) 405 AC_CHECK_FUNC(ldap_start_tls_s, HAVE_LDAP_TLS=1, HAVE_LDAP_TLS=0) 406 AC_CHECK_FUNC(ldap_result2error, HAVE_LDAP_RESULT2ERROR=1, HAVE_LDAP_RESULT2ERROR=0) 407 AC_CHECK_FUNC(ldap_parse_result, HAVE_LDAP_PARSE_RESULT=1, HAVE_LDAP_PARSE_RESULT=0) 408 LIBS="$saveLIBS" 409fi 410 411AC_ARG_WITH(authldaprc, 412[ --with-authldaprc=filename Expect to find authldaprc here ], 413 authldaprc="$withval", 414 authldaprc="$pkgconfdir/authldaprc") 415AC_SUBST(authldaprc) 416 417LIBAUTHLDAP="" 418if test "$HAVE_LDAP" = 1 419then 420 LIBAUTHLDAP="libauthldap.la" 421else 422 authldaprc="" 423fi 424AC_SUBST(LDAPLIBS) 425AC_SUBST(LIBAUTHLDAP) 426 427AM_CONDITIONAL(HAVE_LDAP, test "$HAVE_LDAP" = 1) 428AC_DEFINE_UNQUOTED(HAVE_LDAP_TLS,$HAVE_LDAP_TLS, 429 [ Whether we have ldap_start_tls_s ]) 430AC_DEFINE_UNQUOTED(HAVE_LDAP_RESULT2ERROR, $HAVE_LDAP_RESULT2ERROR, 431 [ Whether we have ldap_result2error() function ]) 432AC_DEFINE_UNQUOTED(HAVE_LDAP_PARSE_RESULT, $HAVE_LDAP_PARSE_RESULT, 433 [ Whether we have ldap_parse_result() function]) 434dnl ######################################################################### 435 436dnl Prepare authpwd module 437 438dnl ######################################################################### 439 440AC_ARG_WITH(authpwd, 441[ --without-authpwd Do not include the authpwd module ], 442 doauthpwd="$withval", 443 doauthpwd="yes" 444 test "$HAVE_PAM" = 1 && doauthpwd="no" 445 test "$HAVE_LDAP" = 1 && doauthpwd="no" 446 ) 447 448HAVE_PWD=1 449if test "$doauthpwd" = "no" 450then 451 HAVE_PWD=0 452fi 453AC_CHECK_FUNCS(endpwent) 454 455dnl ######################################################################### 456 457dnl Prepare authshadow module if shadow functions are available. 458 459dnl ######################################################################### 460 461AC_ARG_WITH(authshadow, 462[ --without-authshadow Do not include the authshadow module ], 463 doauthshadow="$withval", 464 doauthshadow="yes" 465 test "$HAVE_PAM" = 1 && doauthshadow="no" 466 test "$HAVE_LDAP" = 1 && doauthshadow="no") 467 468AC_CHECK_HEADERS(shadow.h) 469saveLIBS="$LIBS" 470SHADOWLIBS="" 471AC_CHECK_LIB(shadow, getspent, 472 [ SHADOWLIBS="-lshadow" ; LIBS="-lshadow $LIBS" ]) 473AC_CHECK_FUNCS(endspent getspent) 474LIBS="$saveLIBS" 475 476if test "$doauthshadow" = "no" 477then 478 HAVE_SHADOW=0 479else 480 481 saveLIBS="$LIBS" 482 AC_CHECK_LIB(shadow, getspent) 483 AC_CHECK_FUNC(getspent, HAVE_SHADOW=1, HAVE_SHADOW=0) 484 LIBS="$saveLIBS" 485fi 486 487LIBAUTHSHADOW="" 488if test "$HAVE_SHADOW" = 1 489then 490 LIBAUTHSHADOW="libauthshadow.la" 491fi 492AC_SUBST(SHADOWLIBS) 493AC_SUBST(LIBAUTHSHADOW) 494 495LIBAUTHPWD="" 496if test "$HAVE_PWD" = 1 497then 498 LIBAUTHPWD="libauthpwd.la" 499fi 500AC_SUBST(LIBAUTHPWD) 501 502dnl ######################################################################### 503 504dnl Prepare authpgsql module 505 506dnl ######################################################################### 507 508AC_ARG_WITH(authpgsqlrc, 509[ --with-authpgsqlrc=filename Expect to find authpgsql here ], 510 authpgsqlrc="$withval", 511 authpgsqlrc="$pkgconfdir/authpgsqlrc") 512AC_SUBST(authpgsqlrc) 513 514AC_ARG_WITH(authpgsql, 515[ --without-authpgsql Do not include the authpgsql module ], 516 doauthpgsql="$withval") 517 518AC_PATH_PROGS(PG_CONFIG, pg_config, pg_config, $LPATH) 519 520PGSQL_LIBS="-lpq" 521AC_ARG_WITH(pgsql-libs, 522[ --with-pgsql-libs=DIR Look for pgsql libs in this dir ], 523 PGSQL_LIBS="-L$withval $PGSQL_LIBS", 524 if test -x $PG_CONFIG 525 then 526 PGSQL_LIBS="-L`$PG_CONFIG --libdir` $PGSQL_LIBS" 527 fi 528) 529AC_ARG_WITH(pgsql-includes, 530[ --with-pgsql-includes=DIR Look for pgsql includes in this dir ], 531 PGSQL_CFLAGS="-I$withval", 532 if test -x $PG_CONFIG 533 then 534 PGSQL_CFLAGS="-I`$PG_CONFIG --includedir`" 535 fi 536) 537 538if test "$doauthpgsql" = "" 539then 540 LIBS="$PGSQL_LIBS $LIBS" 541 AC_CHECK_FUNC(PQsetdbLogin, 542 doauthpgsql="yes" 543 ) 544 LIBS="$saveLIBS" 545fi 546 547if test "$doauthpgsql" != "yes" 548then 549 LIBAUTHPGSQL="" 550 HAVE_AUTHPGSQL=0 551else 552 saveLIBS="$LIBS" 553 LIBS="$PGSQL_LIBS $LIBS" 554 AC_CHECK_FUNC(PQsetdbLogin, 555 AUTHPGSQL="authpgsql" 556 HAVE_AUTHPGSQL=1, 557 AC_MSG_ERROR([--with-authpgsql specified but no libpq.so])) 558 LIBS="$saveLIBS" 559 HAVE_AUTHPGSQL=1 560 CFLAGS="$PGSQL_CFLAGS $CFLAGS" 561 CXXFLAGS="$PGSQL_CFLAGS $CXXFLAGS" 562 LIBAUTHPGSQL="libauthpgsql.la" 563fi 564 565AC_SUBST(PGSQL_LIBS) 566AC_SUBST(LIBAUTHPGSQL) 567AM_CONDITIONAL(HAVE_AUTHPGSQL, test "$HAVE_AUTHPGSQL" = 1) 568 569dnl ######################################################################### 570 571dnl Prepare authmysql module 572 573dnl ######################################################################### 574 575AC_ARG_WITH(authmysqlrc, 576[ --with-authmysqlrc=filename Expect to find authmysql here ], 577 authmysqlrc="$withval", 578 authmysqlrc="$pkgconfdir/authmysqlrc") 579AC_SUBST(authmysqlrc) 580 581AC_ARG_WITH(authmysql, 582[ --without-authmysql Do not include the authmysql module ], 583 doauthmysql="$withval") 584AC_ARG_WITH(mysql-libs, 585[ --with-mysql-libs=DIR Look for mysql libs in this dir ], 586 MYSQL_LIBS="-L$withval -lmysqlclient" 587) 588AC_ARG_WITH(mysql-includes, 589[ --with-mysql-includes=DIR Look for mysql includes in this dir ], 590 MYSQL_CFLAGS="-I$withval" 591) 592 593AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $LPATH) 594 595if test -x "$MYSQL_CONFIG" 596then 597 MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" 598 MYSQL_LIBS="`$MYSQL_CONFIG --libs`" 599 600 eval "MYSQL_CFLAGS=\"\`echo $MYSQL_CFLAGS\`\"" 601 eval "MYSQL_LIBS=\"\`echo $MYSQL_LIBS\`\"" 602fi 603 604if test "$doauthmysql" = "" 605then 606 LIBS="$MYSQL_LIBS $LIBS" 607 AC_CHECK_FUNC(mysql_connect, 608 doauthmysql="yes" 609 ) 610 AC_CHECK_FUNC(mysql_real_connect, 611 doauthmysql="yes" 612 ) 613 LIBS="$saveLIBS" 614fi 615 616if test "$doauthmysql" != "yes" 617then 618 LIBAUTHMYSQL="" 619 HAVE_AUTHMYSQL=0 620else 621 saveLIBS="$LIBS" 622 LIBS="$MYSQL_LIBS $LIBS" 623 AC_CHECK_FUNC(mysql_connect, 624 LIBAUTHMYSQL="libauthmysql.la" 625 HAVE_AUTHMYSQL=1, 626 [ 627 AC_CHECK_FUNC(mysql_real_connect, 628 LIBAUTHMYSQL="libauthmysql.la" 629 HAVE_AUTHMYSQL=1, 630 631 AC_MSG_ERROR([--with-authmysql specified but no mysqlclient.so]) 632 ) 633 ] 634) 635 LIBS="$saveLIBS" 636 HAVE_AUTHMYSQL=1 637 CFLAGS="$MYSQL_CFLAGS $CFLAGS" 638 CXXFLAGS="$MYSQL_CFLAGS $CXXFLAGS" 639fi 640AC_SUBST(LIBAUTHMYSQL) 641AC_SUBST(MYSQL_LIBS) 642AM_CONDITIONAL(HAVE_AUTHMYSQL, test "$HAVE_AUTHMYSQL" = 1) 643 644dnl ######################################################################### 645 646dnl Prepare authsqlite module 647 648dnl ######################################################################### 649 650AC_ARG_WITH(authsqliterc, 651[ --with-authsqliterc=filename Expect to find authmysql here ], 652 authsqliterc="$withval", 653 authsqliterc="$pkgconfdir/authsqliterc") 654AC_SUBST(authsqliterc) 655 656AC_ARG_WITH(authsqlite, 657[ --without-authsqlite Do not include the authsqlite module ], 658 doauthsqlite="$withval") 659 660AC_ARG_WITH(sqlite-libs, 661[ --with-sqlite-libs=DIR Look for sqlite libs in this dir ], 662 663 SQLITE_LIBS="-lsqlite3" 664) 665AC_ARG_WITH(sqlite-includes, 666[ --with-sqlite-includes=DIR Look for sqlite includes in this dir ], 667 SQLITE_CFLAGS="-I$withval" 668) 669 670if test "$doauthsqlite" = "" 671then 672 SQLITE_CFLAGS="`pkg-config --cflags sqlite3 2>/dev/null`" 673 SQLITE_LIBS="`pkg-config --libs sqlite3 2>/dev/null`" 674 saveLIBS="$LIBS" 675 LIBS="$SQLITE_LIBS $LIBS" 676 AC_CHECK_FUNC(sqlite3_version, 677 doauthsqlite="yes" 678 ) 679 LIBS="$saveLIBS" 680fi 681 682if test "$doauthsqlite" != "yes" 683then 684 SQLITE_LIBS="" 685 SQLITE_CFLAGS="" 686 HAVE_AUTHSQLITE=0 687 LIBAUTHSQLITE="" 688else 689 saveLIBS="$LIBS" 690 LIBS="$SQLITE_LIBS $LIBS" 691 AC_CHECK_FUNC(sqlite3_version, 692 [ : ], 693 [ AC_MSG_ERROR([Cannot link with $SQLITE_LIBS]) ] 694 ) 695 LIBS="$saveLIBS" 696 HAVE_AUTHSQLITE=1 697 CFLAGS="$SQLITE_CFLAGS $CFLAGS" 698 CXXFLAGS="$SQLITE_CXXFLAGS $CFLAGS" 699 LIBAUTHSQLITE="libauthsqlite.la" 700 701fi 702AC_SUBST(SQLITE_LIBS) 703AC_SUBST(LIBAUTHSQLITE) 704AM_CONDITIONAL(HAVE_AUTHSQLITE, test "$HAVE_AUTHSQLITE" = 1) 705 706dnl ######################################################################### 707 708dnl Prepare authcustom stub module. 709 710dnl ######################################################################### 711 712 713AC_ARG_WITH(authcustom, 714[ --without-authcustom Do not include the authcustom module ], 715 doauthcustom="$withval", 716 doauthcustom=yes) 717 718LIBAUTHCUSTOM="" 719 720if test "$doauthcustom" = "yes" 721then 722 LIBAUTHCUSTOM="libauthcustom.la" 723fi 724 725AM_CONDITIONAL(HAVE_CUSTOM, test "$AUTHCUSTOM" != "") 726AC_SUBST(LIBAUTHCUSTOM) 727 728 729dnl ######################################################################### 730 731dnl Prepare authpipe module. 732 733dnl ######################################################################### 734 735 736AC_ARG_WITH(pipeprog, 737[ --with-pipeprog=filename Expect to find the pipe-prog here ], 738 authProg="$withval", 739 authProg="$pkgconfdir/authProg") 740AC_SUBST(authProg) 741 742AC_ARG_WITH(authpipe, 743[ --without-authpipe Do not include the authpipe module ], 744 doauthpipe="$withval", 745 doauthpipe=yes) 746 747LIBAUTHPIPE="" 748 749if test "$doauthpipe" = "yes" 750then 751 LIBAUTHPIPE="libauthpipe.la" 752fi 753 754AM_CONDITIONAL(HAVE_PIPE, test "$AUTHPIPE" != "") 755AC_SUBST(LIBAUTHPIPE) 756 757 758 759dnl Checks for header files. 760AC_HEADER_STDC 761AC_HEADER_SYS_WAIT 762AC_CHECK_HEADERS(sys/stat.h sys/time.h sys/wait.h sys/select.h unistd.h fcntl.h crypt.h termios.h) 763 764dnl Checks for typedefs, structures, and compiler characteristics. 765AC_C_CONST 766AC_TYPE_PID_T 767AC_TYPE_UID_T 768dnl Other checks 769AC_CHECK_FUNCS(setsid setlogin) 770AC_CHECK_LIB(crypt, crypt, CRYPTLIBS="-lcrypt") 771saveLIBS="$LIBS" 772LIBS="$CRYPTLIBS $LIBS" 773AC_CHECK_FUNC(crypt, AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, 774 [ Whether we have the crypt() function ])) 775AC_CHECK_FUNC(bcrypt, AC_DEFINE_UNQUOTED(HAVE_BCRYPT, 1, 776 [ Whether we have the bcrypt() function ])) 777LIBS="$saveLIBS" 778AC_CACHE_CHECK([for crypt() prototype],userdb_cv_NEED_CRYPT_PROTOTYPE, 779 780 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 781 #if HAVE_CRYPT_H 782 #include <crypt.h> 783 #endif 784 #if HAVE_UNISTD_H 785 #include <unistd.h> 786 #endif 787 int crypt(int, int); 788 789 ]], [[]])],[userdb_cv_NEED_CRYPT_PROTOTYPE=1],[userdb_cv_NEED_CRYPT_PROTOTYPE=0 ]) 790 791 ) 792 793AC_DEFINE_UNQUOTED(NEED_CRYPT_PROTOTYPE, $userdb_cv_NEED_CRYPT_PROTOTYPE, 794 [ Whether we must a prototype for crypt()] ) 795AC_SUBST(CRYPTLIBS) 796 797dnl ######################################################################### 798 799dnl Prepare the authdaemon module. 800 801dnl ######################################################################### 802 803AC_ARG_WITH(authdaemonrc, 804[ --with-authdaemonrc=filename Expect to find authdaemonrc here ], 805 authdaemonrc="$withval", 806 authdaemonrc="$pkgconfdir/authdaemonrc") 807AC_SUBST(authdaemonrc) 808 809AC_ARG_WITH(authdaemonvar, 810[ --with-authdaemonvar=directory Directory where authdaemon.pid and 811 the listening socket is created], 812 authdaemonvar="$withval", 813 authdaemonvar="$localstatedir/spool/authdaemon") 814 815AC_SUBST(authdaemonvar) 816 817AC_SUBST(LIBM) 818 819rm -f authdaemonrc.h authldaprc.h authmysqlrc.h authpgsqlrc.h vpopmail_config.h 820 821dnl 822dnl Need to settle on our uid/gids here 823dnl 824 825result="" 826 827if test -x "$COURIERCONFIG" 828then 829 $COURIERCONFIG >conftest.out || exit 1 830 sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1 831 . ./conftest2.out 832 rm -f conftest.out conftest2.out 833 834 cmailuser="$mailuser" 835 cmailgroup="$mailgroup" 836 result=" (from courier-config)" 837fi 838 839if test -x "$bindir/courierauthconfig" 840then 841 $bindir/courierauthconfig --configfiles >conftest.out || exit 1 842 sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1 843 . ./conftest2.out 844 rm -f conftest.out conftest2.out 845 846 cmailuser="$mailuser" 847 cmailgroup="$mailgroup" 848 result=" (from previous courierauthconfig)" 849fi 850 851changequote() 852 853LB='[' 854RB=']' 855 856changequote([,]) 857 858AC_MSG_CHECKING(for mail userid) 859 860AC_ARG_WITH(mailuser,[ --with-mailuser=user Specify mail user name (defaults to 861 courier, daemon, admin, bin, or root)], 862 mailuser="$withval", 863 864 if test "$cmailuser" = "" 865 then 866 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 867#include <stdio.h> 868#include <pwd.h> 869#include <stdlib.h> 870 871static const char *ids $LB $RB={"courier","daemon","adm","bin","root", 0}; 872 873int main() 874{ 875int i; 876FILE *f; 877char *p; 878 879 for (i=0; ids $LB i $RB; i++) 880 if (getpwnam(ids $LB i $RB)) break; 881 882 f=fopen("conftest.out", "w"); 883 if (f && ids $LB i $RB) 884 { 885 fprintf(f, "%s\n", ids $LB i $RB); 886 fclose(f); 887 exit(0); 888 } 889 fclose(f); 890 exit (1); 891 return (1); 892} 893 ]])],[mailuser=`cat conftest.out`],[AC_MSG_ERROR(Cannot determine mail user, use --with-mailuser.)],[AC_MSG_ERROR(Must use --with-mailuser when cross compiling.)]) 894 else 895 mailuser="$cmailuser" 896 fi 897 ac_configure_args="$ac_configure_args --with-mailuser=$mailuser") 898 899AC_MSG_RESULT([$mailuser $result]) 900 901AC_MSG_CHECKING(for mail group id) 902 903AC_ARG_WITH(mailgroup, [ --with-mailgroup=group Specify mail group name (defaults to courier, 904 daemon, sys, adm, or root)], 905 mailgroup="$withval", 906 907 if test "$cmailgroup" = "" 908 then 909 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 910#include <stdio.h> 911#include <grp.h> 912#include <stdlib.h> 913 914static const char *ids $LB $RB={"courier", "daemon","sys","adm", "root", 0}; 915 916int main() 917{ 918int i; 919FILE *f; 920 921 for (i=0; ids $LB i $RB; i++) 922 if (getgrnam(ids $LB i $RB)) break; 923 924 f=fopen("conftest.out", "w"); 925 if (f && ids $LB i $RB) 926 { 927 fprintf(f, "%s\n", ids $LB i $RB); 928 fclose(f); 929 exit(0); 930 } 931 fclose(f); 932 exit (1); 933 return (1); 934} 935 ]])],[mailgroup=`cat conftest.out`],[AC_MSG_ERROR(Cannot determine mail group, use --with-mailgroup.)],[AC_MSG_ERROR(Must use --with-mailgroup when cross compiling.)]) 936 else 937 mailgroup="$cmailgroup" 938 fi 939 ac_configure_args="$ac_configure_args --with-mailgroup=$mailgroup" 940 ) 941AC_MSG_RESULT([$mailgroup $result]) 942AC_SUBST(mailuser) 943AC_SUBST(mailgroup) 944rm -f conftest.out 945 946AC_ARG_WITH(stdheaderdir, 947[ --without-stdheaderdir Header files will be installed into a directory 948 not in the compiler's default search path.], 949 [ 950 if test "$withval" = "no" 951 then 952 AC_DEFINE_UNQUOTED(HAVE_NOSTDHEADERDIR, 1, 953 [ Whether header installation directory is nontstandard ]) 954 fi 955 ]) 956 957AC_CACHE_CHECK([for socklen_t], 958 authlib_cv_hassocklen_t, 959 960AC_COMPILE_IFELSE([ 961AC_LANG_SOURCE( [ 962#include <sys/types.h> 963#include <sys/socket.h> 964 965socklen_t sl_t; 966],[ 967 accept(0, 0, &sl_t); 968])], 969 authlib_cv_hassocklen_t=yes, 970 authlib_cv_hassocklen_t=no) 971) 972 973socklen_t="int" 974 975if test $authlib_cv_hassocklen_t = yes 976then 977 : 978else 979 AC_DEFINE_UNQUOTED(socklen_t, int, [ Default definition for socklen_t ]) 980fi 981 982AC_ARG_WITH(repository, [], REPOSITORY="$withval") 983AC_SUBST(REPOSITORY) 984 985AM_CONDITIONAL(HAVE_SGML, test -d ${srcdir}/libs/docbook) 986 987save_LDFLAGS="$LDFLAGS" 988LDFLAGS="-Wl,--enable-new-dtags $LDFLAGS" 989 990AC_CACHE_CHECK([--enable-new-dtags option],authlib_cv_enable_new_dtags, 991 992 993 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 994 ]], [[return 0; ]])],[authlib_cv_enable_new_dtags=yes],[authlib_cv_enable_new_dtags=no ]) 995 996) 997 998if test "$authlib_cv_enable_new_dtags" = "yes" 999then 1000 courierauth_ldflags="-Wl,--enable-new-dtags $courierauth_ldflags" 1001fi 1002 1003AC_SUBST(courierauth_ldflags) 1004 1005VERSION_INFO=0:0:0 1006AC_SUBST(VERSION_INFO) 1007 1008# This gets built by the make rule, and is not in the git repo 1009 1010for f in authdaemonrc.in 1011do 1012 if test ! -f "$srcdir/$f" 1013 then 1014 cp -p "$srcdir/$f.git" "$srcdir/$f" 1015 touch "$srcdir/$f.git" 1016 fi 1017done 1018 1019AC_CONFIG_SUBDIRS(libs/bdbobj libs/gdbmobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/rfc822 libs/random128 libs/liblock liblog) 1020 1021AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h courier-authlib.spec courier-authlib.sysvinit courier-authlib.service userdb-test-cram-md5.pl) 1022AC_OUTPUT 1023