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