1 dnl Process this file with autoconf to produce a configure script.
3 dnl $Id: configure.in,v 1.152 2007/10/07 18:33:22 mrsam Exp $
5 dnl Copyright 1998 - 2007 Double Precision, Inc. See COPYING for
6 dnl distribution information.
9 AC_INIT(courier-authlib, 0.60.1, [courier-users@lists.sourceforge.net])
11 AC_CONFIG_SRCDIR([courierauth.h])
12 AM_CONFIG_HEADER([courier_auth_config.h])
15 >confdefs.h # Kill PACKAGE_ macros
17 LPATH="$PATH:/usr/local/bin"
19 dnl Checks for programs.
26 AC_LIBLTDL_INSTALLABLE
31 AC_PATH_PROGS(PERL, perl5 perl, perl, $LPATH)
32 AC_PATH_PROGS(COURIERCONFIG, courier-config, courier-config, $LPATH)
34 if test "$PERL" = "perl"
36 AC_MSG_ERROR(Perl is required)
39 test "x$prefix" = xNONE && prefix=$ac_default_prefix
40 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
42 eval "exec_prefix=$exec_prefix"
43 eval "sysconfdir=$sysconfdir"
45 eval "sbindir=$sbindir"
46 eval "localstatedir=$localstatedir"
47 eval "libexecdir=$libexecdir"
49 AC_ARG_WITH(redhat, [], [ redhat=$withval ], [redhat=no])
51 if test "$srcdir" = "."
53 case `./config.guess` in
55 if test "$redhat" = "no"
58 AC_MSG_WARN(=== I think you are trying to run this configure script)
59 AC_MSG_WARN([=== on Red Hat/Fedora. You're doing too much work!])
60 AC_MSG_WARN([=== It's much faster to create installable binary RPMs])
61 AC_MSG_WARN([=== like this: http://www.courier-mta.org/FAQ.html${hash}rpm])
62 AC_MSG_WARN(=== When you do this you may find that RPM will tell you)
63 AC_MSG_WARN([=== to install some other software first, before trying to])
64 AC_MSG_WARN([=== build this one, and even tell you the name of RPMs you])
65 AC_MSG_WARN([=== need to install from the distribution CD. That's much])
66 AC_MSG_WARN([=== easier than trying to figure out the same from some])
67 AC_MSG_WARN([=== cryptic error message.])
69 AC_MSG_WARN([=== Even if you don't intend to use everything you need to])
70 AC_MSG_WARN([=== have in order to build via RPM, you should still do as])
71 AC_MSG_WARN([=== you're told. All the extra stuff (LDAP, SQL, etc...)])
72 AC_MSG_WARN([=== goes into RPM sub-packages, which do not need to be])
73 AC_MSG_WARN([=== installed.])
74 AC_MSG_WARN([=== But, if you insist, you can simply add '--with-redhat'])
75 AC_MSG_WARN(=== parameter to this configure script and not see this)
76 AC_MSG_WARN(=== error message. You should also do this when upgrading)
77 AC_MSG_WARN([=== and you didn't use RPM with the older version.])
78 AC_MSG_ERROR(... in either case you better know what you're doing!)
85 AC_PATH_PROGS(EXPECT, expect, expect, $LPATH)
87 if test "$EXPECT" = "expect"
89 AC_MSG_WARN(-----------------------------------------------------)
90 AC_MSG_WARN(expect not found - will not be able to change passwds)
91 AC_MSG_WARN(in webmail)
92 AC_MSG_WARN(-----------------------------------------------------)
95 AC_DEFINE_UNQUOTED(HAVE_EXPECT, 1, [ Whether expect(1) is installed ])
98 AC_PATH_PROGS(PASSWD, passwd, passwd, $LPATH)
101 if test "$GCC" = "yes"
103 CFLAGS="$CFLAGS -Wall"
106 CFLAGS="$CFLAGS -I.. -I${srcdir}/.."
108 AC_MSG_CHECKING(whether -lm is needed for floor)
109 AC_TRY_LINK_FUNC(floor,
114 AC_ARG_WITH(pkgconfdir,
115 [ --with-pkgconfdir=d Install config files in directory ],
116 [pkgconfdir="$withval"],
117 [pkgconfdir="$sysconfdir/authlib"])
119 SASL_LIST="SASL(\"PLAIN\", authsasl_plain, authsaslclient_plain) SASL(\"LOGIN\", authsasl_login, authsaslclient_login)"
121 dnl #########################################################################
123 dnl Check if the MD5 library is available
125 dnl #########################################################################
128 if test -d ${srcdir}/md5
131 AC_DEFINE_UNQUOTED(HAVE_MD5LIB, 1,
132 [ Whether we have the MD5 library available ])
134 if test -d ${srcdir}/md5
136 SASL_LIST="SASL(\"CRAM-MD5\", authsasl_cram, authsaslclient_crammd5) $SASL_LIST"
143 AM_CONDITIONAL(HAVE_MD5, test "$MD5" = 1)
145 dnl #########################################################################
147 dnl Check if the SHA1 library is available
149 dnl #########################################################################
152 if test -d ${srcdir}/sha1
155 AC_DEFINE_UNQUOTED(HAVE_SHA1LIB, 1,
156 [ Whether we have the SHA1 library available ])
157 SHA1LIB=sha1/libsha1.la
158 if test -d ${srcdir}/sha1
160 SASL_LIST="SASL(\"CRAM-SHA1\", authsasl_cram, authsaslclient_cramsha1) $SASL_LIST"
161 SASL_LIST="SASL(\"CRAM-SHA256\", authsasl_cram, authsaslclient_cramsha256) $SASL_LIST"
168 AM_CONDITIONAL(HAVE_SHA1, test "$SHA1" = 1)
172 dnl #########################################################################
174 dnl Check if the HMAC library is available
176 dnl #########################################################################
178 if test -d ${srcdir}/libhmac
181 AC_DEFINE_UNQUOTED(HAVE_HMACLIB, 1,
182 [ Whether we have the HMAC library available ])
183 HMACLIB=libhmac/libhmac.la
189 AM_CONDITIONAL(HAVE_HMACLIB, test "$HMAC" = 1)
195 AC_CHECK_LIB(socket,socket,result=yes,result=no)
196 if test $result = yes; then
199 AC_CHECK_LIB(socket,socket,result=yes,result=no,-lnsl)
200 if test $result = yes; then
201 NETLIBS = "-lsocket -lnsl"
204 AC_CHECK_LIB(socket,connect,result=yes,result=no)
205 if test $result = yes; then
208 AC_CHECK_LIB(socket,connect,result=yes,result=no,-lnsl)
209 if test $result = yes; then
210 NETLIBS="-lsocket -lnsl"
217 if test $USENSL != yes; then
218 LIBS="$LIBS $NETLIBS"
219 AC_TRY_LINK_FUNC(inet_addr, [ : ],
221 AC_CHECK_LIB(nsl,inet_addr,result=yes,result=no)
222 if test $result = yes; then
223 NETLIBS="$NETLIBS -lnsl"
231 dnl #########################################################################
233 dnl Prepare authuserdb module if userdb library is available
235 dnl #########################################################################
238 AC_ARG_WITH(db, [ --with-db=gdbm Use the GDBM library.
239 --with-db=db Use the libdb.a library.],
240 db="$withval", needs_withdb=1)
250 AC_MSG_ERROR(Invalid --with-db option.)
256 if test "$db" != "db"
258 AC_CHECK_LIB(gdbm, gdbm_open,
259 [ LIBGDBM=-lgdbm ; LIBS="-lgdbm $LIBS" ])
260 AC_CHECK_FUNC(gdbm_open, [ HAVE_GDBM=y ])
265 if test "$db" != "gdbm"
267 AC_CHECK_LIB(db, dbopen, [ LIBDB=-ldb ; LIBS="-ldb $LIBS" ],
268 [ AC_CHECK_LIB(db, db_open, [ LIBDB=-ldb ; LIBS="-ldb $LIBS"],
269 [ AC_CHECK_LIB(db, db_env_create,
270 [ LIBDB=-ldb; LIBS="-ldb $LIBS"]) ]
273 AC_CHECK_FUNC(dbopen, HAVE_BDB=1)
274 AC_CHECK_FUNC(db_open, HAVE_BDB=1)
275 AC_CHECK_FUNC(db_env_create, HAVE_BDB=1)
280 if test "$HAVE_GDBM$HAVE_BDB" = ""
282 AC_MSG_ERROR(Cannot find either the gdbm or the db library.)
288 if test "$HAVE_GDBM" = "y"
293 if test "$needs_withdb" = 1
295 ac_configure_args="$ac_configure_args --with-db=gdbm"
297 dblibrary=gdbmobj/libgdbmobj.la
302 if test "$needs_withdb" = 1
304 ac_configure_args="$ac_configure_args --with-db=db"
306 dblibrary=bdbobj/libbdbobj.la
315 AC_ARG_WITH(authuserdb,
316 [ --without-authuserdb Do not include the authuserdb module ],
317 doauthuserdb="$withval",
319 if test -d ${srcdir}/userdb
324 if test "$doauthuserdb" = "no"
328 AUTHUSERDB="authuserdb"
329 LIBAUTHUSERDB="libauthuserdb.la"
333 AC_ARG_WITH(makedatprog, [ ], [ : ],
335 ac_configure_args="$ac_configure_args --with-makedatprog=$libexecdir/courier-authlib/makedatprog"
338 cat >dbobj.config <<EOF
350 AC_SUBST(LIBAUTHUSERDB)
352 userdb="$pkgconfdir/userdb"
353 AC_ARG_WITH(userdb, [], [ userdb="$withval" ], [ac_configure_args="$ac_configure_args '--with-userdb=$userdb'"])
355 AC_DEFINE_UNQUOTED(USERDB,"$userdb", [ Location of the userdb database ])
358 dnl Checks for header files.
360 dnl Because autoconf sets macros for C preprocessor where
361 dnl AC_CHECK_HEADERS appears first, the first AC_CHECK_HEADERS
362 dnl must not place in conditional level but top level.
363 dnl This is a dummy AC_CHECK_HEADERS for it.
365 AC_CHECK_HEADERS(stdio.h)
367 dnl #########################################################################
369 dnl Prepare authpam module if libpam is available.
371 dnl #########################################################################
374 [ --without-authpam Do not include the authpam module ],
375 doauthpam="$withval")
377 AC_CHECK_HEADERS(security/pam_appl.h Pam/pam_appl.h)
378 if test "$doauthpam" = "no"
384 AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ])
387 AC_CHECK_LIB(pam, pam_start,
389 LIBS="-lpam $LIBDL $LIBS"
390 AC_CHECK_FUNCS(pam_setcred)],
399 if test "$HAVE_PAM" = 1
401 LIBAUTHPAM=libauthpam.la
404 AC_ARG_WITH(authpam-libraries,
405 [ --with-authpam-libraries="libs" Link 'libs' with authpam, this may be
406 required for FreeBSD 3.3],
407 authpamcrypt="$withval")
409 AUTHPAMCRYPT="$authpamcrypt"
410 AC_SUBST(AUTHPAMCRYPT)
413 dnl #########################################################################
415 dnl Prepare authldap module if ldap functions are available.
417 dnl #########################################################################
419 AC_ARG_WITH(authldap,
420 [ --without-authldap Do not include the authldap module ],
421 doauthldap="$withval",
424 AC_CHECK_HEADERS(lber.h)
425 AC_CHECK_HEADERS(ldap.h)
426 AC_CHECK_HEADERS(netinet/in.h)
428 if test "$doauthldap" = "no"
433 LIBS="$NETLIBS $LIBS"
436 AC_MSG_CHECKING(whether -lresolv is needed for res_query)
437 AC_LINK_IFELSE(AC_LANG_PROGRAM([
438 #include <sys/types.h>
439 #if HAVE_NETINET_IN_H
440 #include <netinet/in.h>
444 void (*func)()= (void (*)())res_query;
449 LIBS="-lresolv $LIBS"
451 AC_LINK_IFELSE(AC_LANG_PROGRAM([
452 #include <sys/types.h>
453 #if HAVE_NETINET_IN_H
454 #include <netinet/in.h>
458 void (*func)()= (void (*)())res_query;
461 LDAPLIBS="-lresolv $LDAPLIBS"
465 AC_MSG_ERROR(Cannot find function res_query))
468 AC_CHECK_LIB(lber, ber_scanf,
469 [ LDAPLIBS="-llber $LDAPLIBS" LIBS="-llber $LIBS" ])
470 AC_CHECK_LIB(ldap, ldap_open,
471 [ LDAPLIBS="-lldap $LDAPLIBS" ; LIBS="-lldap $LIBS" ])
472 AC_CHECK_FUNC(ldap_search_st, HAVE_LDAP=1, HAVE_LDAP=0)
473 AC_CHECK_FUNC(ldap_start_tls_s, HAVE_LDAP_TLS=1, HAVE_LDAP_TLS=0)
474 AC_CHECK_FUNC(ldap_result2error, HAVE_LDAP_RESULT2ERROR=1, HAVE_LDAP_RESULT2ERROR=0)
475 AC_CHECK_FUNC(ldap_parse_result, HAVE_LDAP_PARSE_RESULT=1, HAVE_LDAP_PARSE_RESULT=0)
479 AC_ARG_WITH(authldaprc,
480 [ --with-authldaprc=filename Expect to find authldaprc here ],
481 authldaprc="$withval",
482 authldaprc="$pkgconfdir/authldaprc")
486 if test "$HAVE_LDAP" = 1
488 LIBAUTHLDAP="libauthldap.la"
493 AC_SUBST(LIBAUTHLDAP)
495 AM_CONDITIONAL(HAVE_LDAP, test "$HAVE_LDAP" = 1)
496 AC_DEFINE_UNQUOTED(HAVE_LDAP_TLS,$HAVE_LDAP_TLS,
497 [ Whether we have ldap_start_tls_s ])
498 AC_DEFINE_UNQUOTED(HAVE_LDAP_RESULT2ERROR, $HAVE_LDAP_RESULT2ERROR,
499 [ Whether we have ldap_result2error() function ])
500 AC_DEFINE_UNQUOTED(HAVE_LDAP_PARSE_RESULT, $HAVE_LDAP_PARSE_RESULT,
501 [ Whether we have ldap_parse_result() function])
502 dnl #########################################################################
504 dnl Prepare authpwd module
506 dnl #########################################################################
509 [ --without-authpwd Do not include the authpwd module ],
510 doauthpwd="$withval",
512 test "$HAVE_PAM" = 1 && doauthpwd="no"
513 test "$HAVE_LDAP" = 1 && doauthpwd="no"
517 if test "$doauthpwd" = "no"
521 AC_CHECK_FUNCS(endpwent)
523 dnl #########################################################################
525 dnl Prepare authshadow module if shadow functions are available.
527 dnl #########################################################################
529 AC_ARG_WITH(authshadow,
530 [ --without-authshadow Do not include the authshadow module ],
531 doauthshadow="$withval",
533 test "$HAVE_PAM" = 1 && doauthshadow="no"
534 test "$HAVE_LDAP" = 1 && doauthshadow="no")
536 AC_CHECK_HEADERS(shadow.h)
539 AC_CHECK_LIB(shadow, getspent,
540 [ SHADOWLIBS="-lshadow" ; LIBS="-lshadow $LIBS" ])
541 AC_CHECK_FUNCS(endspent getspent)
544 if test "$doauthshadow" = "no"
550 AC_CHECK_LIB(shadow, getspent)
551 AC_CHECK_FUNC(getspent, HAVE_SHADOW=1, HAVE_SHADOW=0)
556 if test "$HAVE_SHADOW" = 1
558 LIBAUTHSHADOW="libauthshadow.la"
561 AC_SUBST(LIBAUTHSHADOW)
564 if test "$HAVE_PWD" = 1
566 LIBAUTHPWD="libauthpwd.la"
570 dnl #########################################################################
572 dnl Prepare authvchkpw module if vchkpw is installed.
574 dnl #########################################################################
578 vpopmail_home=`$PERL -e '@a=getpwnam("vpopmail"); print "$a[7]";'`
582 AC_ARG_WITH(authvchkpw,
583 [ --without-authvchkpw Do not include the authvchkpw module ],
584 doauthvchkpw="$withval",
586 if test "$vpopmail_home" != ""
591 if test "$doauthvchkpw" = "no"
600 ----------------------------------------------------
604 All questions regarding ANY vpopmail-related problems,
605 such as compiling/building failures, or login errors
606 should be referred to the vpopmail mailing list.
607 Vpopmail questions sent to the Courier mailing lists
609 ----------------------------------------------------
614 if test -f ${vpopmail_home}/etc/lib_deps
616 CFLAGS="`cat ${vpopmail_home}/etc/inc_deps` $CFLAGS"
617 VPOPMAILLIBS="`cat ${vpopmail_home}/etc/lib_deps`"
619 AC_MSG_ERROR(${vpopmail_home}/etc/lib_deps does not exist - upgrade vpopmail to the current version or fix the permissions on this file)
622 AC_SUBST(vpopmail_home)
623 AC_SUBST(VPOPMAILLIBS)
626 if test "$HAVE_VCHKPW" = 1
628 LIBAUTHVCHKPW="libauthvchkpw.la"
631 dnl Check if vpopmail has open_smtp_relay() function
634 LIBS="$VPOPMAILLIBS $CRYPTLIBS $LIBS"
635 AC_CHECK_FUNC(open_smtp_relay,
636 AC_DEFINE(HAVE_OPEN_SMTP_RELAY, 1,
637 [ Whether -lvpopmail has the open_smtp_relay() function ]) )
638 AC_CHECK_FUNC(vset_lastauth,
639 AC_DEFINE(HAVE_VSET_LASTAUTH, 1,
640 [ Whether -lvpopmail has the vset_lastauth() function ]))
644 AC_SUBST(LIBAUTHVCHKPW)
646 dnl #########################################################################
648 dnl Prepare authpgsql module
650 dnl #########################################################################
652 AC_ARG_WITH(authpgsqlrc,
653 [ --with-authpgsqlrc=filename Expect to find authpgsql here ],
654 authpgsqlrc="$withval",
655 authpgsqlrc="$pkgconfdir/authpgsqlrc")
656 AC_SUBST(authpgsqlrc)
658 AC_ARG_WITH(authpgsql,
659 [ --without-authpgsql Do not include the authpgsql module ],
660 doauthpgsql="$withval")
662 AC_PATH_PROGS(PG_CONFIG, pg_config, pg_config, $LPATH)
665 AC_ARG_WITH(pgsql-libs,
666 [ --with-pgsql-libs=DIR Look for pgsql libs in this dir ],
667 PGSQL_LIBS="-L$withval $PGSQL_LIBS",
668 if test -x $PG_CONFIG
670 PGSQL_LIBS="-L`$PG_CONFIG --libdir` $PGSQL_LIBS"
673 AC_ARG_WITH(pgsql-includes,
674 [ --with-pgsql-includes=DIR Look for pgsql includes in this dir ],
675 PGSQL_CFLAGS="-I$withval",
676 if test -x $PG_CONFIG
678 PGSQL_CFLAGS="-I`$PG_CONFIG --includedir`"
682 if test "$doauthpgsql" = ""
684 LIBS="$PGSQL_LIBS $LIBS"
685 AC_CHECK_FUNC(PQsetdbLogin,
691 if test "$doauthpgsql" != "yes"
697 LIBS="$PGSQL_LIBS $LIBS"
698 AC_CHECK_FUNC(PQsetdbLogin,
699 AUTHPGSQL="authpgsql"
701 AC_MSG_ERROR([--with-authpgsql specified but no libpq.so]))
704 CFLAGS="$PGSQL_CFLAGS $CFLAGS"
705 LIBAUTHPGSQL="libauthpgsql.la"
709 AC_SUBST(LIBAUTHPGSQL)
710 AM_CONDITIONAL(HAVE_AUTHPGSQL, test "$HAVE_AUTHPGSQL" = 1)
712 dnl #########################################################################
714 dnl Prepare authmysql module
716 dnl #########################################################################
718 AC_ARG_WITH(authmysqlrc,
719 [ --with-authmysqlrc=filename Expect to find authmysql here ],
720 authmysqlrc="$withval",
721 authmysqlrc="$pkgconfdir/authmysqlrc")
722 AC_SUBST(authmysqlrc)
724 AC_ARG_WITH(authmysql,
725 [ --without-authmysql Do not include the authmysql module ],
726 doauthmysql="$withval")
727 AC_ARG_WITH(mysql-libs,
728 [ --with-mysql-libs=DIR Look for mysql libs in this dir ],
729 MYSQL_LIBS="-L$withval -lmysqlclient"
731 AC_ARG_WITH(mysql-includes,
732 [ --with-mysql-includes=DIR Look for mysql includes in this dir ],
733 MYSQL_CFLAGS="-I$withval"
736 AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $LPATH)
738 if test -x "$MYSQL_CONFIG"
740 MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
741 MYSQL_LIBS="`$MYSQL_CONFIG --libs`"
743 eval "MYSQL_CFLAGS=\"\`echo $MYSQL_CFLAGS\`\""
744 eval "MYSQL_LIBS=\"\`echo $MYSQL_LIBS\`\""
747 if test "$doauthmysql" = ""
749 LIBS="$MYSQL_LIBS $LIBS"
750 AC_CHECK_FUNC(mysql_connect,
753 AC_CHECK_FUNC(mysql_real_connect,
759 if test "$doauthmysql" != "yes"
765 LIBS="$MYSQL_LIBS $LIBS"
766 AC_CHECK_FUNC(mysql_connect,
767 LIBAUTHMYSQL="libauthmysql.la"
770 AC_CHECK_FUNC(mysql_real_connect,
771 LIBAUTHMYSQL="libauthmysql.la"
774 AC_MSG_ERROR([--with-authmysql specified but no mysqlclient.so])
780 CFLAGS="$MYSQL_CFLAGS $CFLAGS"
782 AC_SUBST(LIBAUTHMYSQL)
784 AM_CONDITIONAL(HAVE_AUTHMYSQL, test "$HAVE_AUTHMYSQL" = 1)
787 dnl #########################################################################
789 dnl Prepare authcustom stub module.
791 dnl #########################################################################
794 AC_ARG_WITH(authcustom,
795 [ --without-authcustom Do not include the authcustom module ],
796 doauthcustom="$withval",
801 if test "$doauthcustom" = "yes"
803 LIBAUTHCUSTOM="libauthcustom.la"
806 AM_CONDITIONAL(HAVE_CUSTOM, test "$AUTHCUSTOM" != "")
807 AC_SUBST(LIBAUTHCUSTOM)
810 dnl #########################################################################
812 dnl Prepare authpipe module.
814 dnl #########################################################################
817 AC_ARG_WITH(pipeprog,
818 [ --with-pipeprog=filename Expect to find the pipe-prog here ],
820 authProg="$pkgconfdir/authProg")
823 AC_ARG_WITH(authpipe,
824 [ --without-authpipe Do not include the authpipe module ],
825 doauthpipe="$withval",
830 if test "$doauthpipe" = "yes"
832 LIBAUTHPIPE="libauthpipe.la"
835 AM_CONDITIONAL(HAVE_PIPE, test "$AUTHPIPE" != "")
836 AC_SUBST(LIBAUTHPIPE)
840 dnl Checks for header files.
843 AC_CHECK_HEADERS(sys/stat.h sys/time.h sys/wait.h sys/select.h unistd.h fcntl.h crypt.h termios.h)
845 dnl Checks for typedefs, structures, and compiler characteristics.
852 AC_CHECK_FUNCS(setsid setlogin)
853 AC_CHECK_LIB(crypt, crypt, CRYPTLIBS="-lcrypt")
855 LIBS="$CRYPTLIBS $LIBS"
856 AC_CHECK_FUNC(crypt, AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1,
857 [ Whether we have the crypt() function ]))
859 AC_CACHE_CHECK([for crypt() prototype],userdb_cv_NEED_CRYPT_PROTOTYPE,
870 ], [], userdb_cv_NEED_CRYPT_PROTOTYPE=1,
871 userdb_cv_NEED_CRYPT_PROTOTYPE=0 )
875 AC_DEFINE_UNQUOTED(NEED_CRYPT_PROTOTYPE, $userdb_cv_NEED_CRYPT_PROTOTYPE,
876 [ Whether we must a prototype for crypt()] )
879 dnl #########################################################################
881 dnl Prepare the authdaemon module.
883 dnl #########################################################################
885 AC_ARG_WITH(authdaemonrc,
886 [ --with-authdaemonrc=filename Expect to find authdaemonrc here ],
887 authdaemonrc="$withval",
888 authdaemonrc="$pkgconfdir/authdaemonrc")
889 AC_SUBST(authdaemonrc)
891 AC_ARG_WITH(authdaemonvar,
892 [ --with-authdaemonvar=directory Directory where authdaemon.pid and
893 the listening socket is created],
894 authdaemonvar="$withval",
895 authdaemonvar="$localstatedir/spool/authdaemon")
897 AC_SUBST(authdaemonvar)
901 AC_DEFINE_UNQUOTED(SASL_LIST,$SASL_LIST,
902 [ This macro is used to build the list of SASL modules ])
904 rm -f authdaemonrc.h authldaprc.h authmysqlrc.h authpgsqlrc.h vpopmail_config.h
908 dnl Need to settle on our uid/gids here
913 if test -x "$COURIERCONFIG"
915 $COURIERCONFIG >conftest.out || exit 1
916 sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1
918 rm -f conftest.out conftest2.out
920 cmailuser="$mailuser"
921 cmailgroup="$mailgroup"
922 result=" (from courier-config)"
925 if test -x "$bindir/courierauthconfig"
927 $bindir/courierauthconfig --configfiles >conftest.out || exit 1
928 sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1
930 rm -f conftest.out conftest2.out
932 cmailuser="$mailuser"
933 cmailgroup="$mailgroup"
934 result=" (from previous courierauthconfig)"
944 AC_MSG_CHECKING(for mail userid)
946 AC_ARG_WITH(mailuser,[ --with-mailuser=user Specify mail user name (defaults to
947 courier, daemon, admin, bin, or root)],
950 if test "$cmailuser" = ""
957 static const char *ids $LB $RB={"courier","daemon","adm","bin","root", 0};
965 for (i=0; ids $LB i $RB; i++)
966 if (getpwnam(ids $LB i $RB)) break;
968 f=fopen("conftest.out", "w");
969 if (f && ids $LB i $RB)
971 fprintf(f, "%s\n", ids $LB i $RB);
980 mailuser=`cat conftest.out`,
981 AC_MSG_ERROR(Cannot determine mail user, use --with-mailuser.),
982 AC_MSG_ERROR(Must use --with-mailuser when cross compiling.))
984 mailuser="$cmailuser"
986 ac_configure_args="$ac_configure_args --with-mailuser=$mailuser")
988 AC_MSG_RESULT([$mailuser $result])
990 AC_MSG_CHECKING(for mail group id)
992 AC_ARG_WITH(mailgroup, [ --with-mailgroup=group Specify mail group name (defaults to courier,
993 daemon, sys, adm, or root)],
994 mailgroup="$withval",
996 if test "$cmailgroup" = ""
1003 static const char *ids $LB $RB={"courier", "daemon","sys","adm", "root", 0};
1010 for (i=0; ids $LB i $RB; i++)
1011 if (getgrnam(ids $LB i $RB)) break;
1013 f=fopen("conftest.out", "w");
1014 if (f && ids $LB i $RB)
1016 fprintf(f, "%s\n", ids $LB i $RB);
1026 mailgroup=`cat conftest.out`,
1027 AC_MSG_ERROR(Cannot determine mail group, use --with-mailgroup.),
1028 AC_MSG_ERROR(Must use --with-mailgroup when cross compiling.))
1030 mailgroup="$cmailgroup"
1032 ac_configure_args="$ac_configure_args --with-mailgroup=$mailgroup"
1034 AC_MSG_RESULT([$mailgroup $result])
1039 AC_ARG_WITH(stdheaderdir,
1040 [ --without-stdheaderdir Header files will be installed into a directory
1041 not in the compiler's default search path.],
1043 if test "$withval" = "no"
1045 AC_DEFINE_UNQUOTED(HAVE_NOSTDHEADERDIR, 1,
1046 [ Whether header installation directory is nontstandard ])
1050 AC_CACHE_CHECK([for socklen_t],
1051 authlib_cv_hassocklen_t,
1055 #include <sys/types.h>
1056 #include <sys/socket.h>
1060 accept(0, 0, &sl_t);
1062 authlib_cv_hassocklen_t=yes,
1063 authlib_cv_hassocklen_t=no)
1068 if test $authlib_cv_hassocklen_t = yes
1072 AC_DEFINE_UNQUOTED(socklen_t, int, [ Default definition for socklen_t ])
1075 if test x"$enable_ltdl_install" = x"yes"
1077 LIBLTDL_SUBDIR=libltdl
1080 AC_SUBST(LIBLTDL_SUBDIR)
1082 AC_ARG_WITH(repository, [], REPOSITORY="$withval")
1083 AC_SUBST(REPOSITORY)
1085 AM_CONDITIONAL(HAVE_SGML, test -d ${srcdir}/docbook)
1086 AC_CONFIG_SUBDIRS(libltdl bdbobj gdbmobj md5 sha1 libhmac numlib makedat userdb rfc822 random128 liblock liblog)
1088 AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.h authmigrate courier-authlib.spec courier-authlib.lpspec courier-authlib.sysvinit userdb-test-cram-md5.pl)