configure.in
上传用户:s81996212
上传日期:2007-01-04
资源大小:722k
文件大小:16k
- dnl Process this file with autoconf to produce a configure script.
- dnl
- dnl $Id: configure.in,v 1.34 2000/07/04 16:48:07 mrsam Exp $
- dnl
- dnl Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
- dnl distribution information.
- AC_INIT(mod.h)
- AM_INIT_AUTOMAKE(authlib, 0.10, 0)
- AM_CONFIG_HEADER(config.h)
- dnl Checks for programs.
- AC_PROG_AWK
- AC_PROG_CC
- AC_PROG_CPP
- AC_PROG_INSTALL
- AC_PROG_LN_S
- AC_PROG_RANLIB
- AC_PATH_PROGS(PERL, perl5 perl)
- if test "$PERL" = "perl"
- then
- AC_MSG_ERROR(Perl is required)
- fi
- if test "$GCC" = "yes"
- then
- CFLAGS="$CFLAGS -Wall"
- fi
- CFLAGS="$CFLAGS -I.. -I${srcdir}/.."
- AC_CHECK_FUNCS(setgroups initgroups)
- dnl Check whether to install man pages
- AC_ARG_WITH(authlib-man, [], installman="$withval", installman="yes")
- case "$installman" in
- y*)
- installman=yes
- ;;
- Y*)
- installman=yes
- ;;
- esac
- if test "$installman" = "yes"
- then
- manFILES='$(man8)'
- manLINKS='$(manlinks)'
- fi
- AC_SUBST(manFILES)
- AC_SUBST(manLINKS)
- 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 "localstatedir=$localstatedir"
- eval "libexecdir=$libexecdir"
- dnl #########################################################################
- dnl Check if the MD5 library is available
- dnl #########################################################################
- if test -d ../md5
- then
- MD5=1
- AC_DEFINE_UNQUOTED(HAVE_MD5LIB,1)
- MD5LIB=../md5/libmd5.a
- else
- MD5LIB=""
- MD5=0
- fi
- AC_SUBST(MD5LIB)
- AM_CONDITIONAL(HAVE_MD5, test "$MD5" = 1)
- dnl #########################################################################
- dnl Check if the SHA1 library is available
- dnl #########################################################################
- if test -d ../sha1
- then
- SHA1=1
- AC_DEFINE_UNQUOTED(HAVE_SHA1LIB,1)
- SHA1LIB=../sha1/libsha1.a
- else
- SHA1LIB=""
- SHA1=0
- fi
- AC_SUBST(SHA1LIB)
- AM_CONDITIONAL(HAVE_SHA1, test "$SHA1" = 1)
- dnl #########################################################################
- dnl Check if the HMAC library is available
- dnl #########################################################################
- if test -d ../libhmac
- then
- HMAC=1
- AC_DEFINE_UNQUOTED(HAVE_HMACLIB,1)
- HMACLIB=../libhmac/libhmac.a
- else
- HMACLIB=""
- HMAC=0
- fi
- AC_SUBST(HMACLIB)
- AM_CONDITIONAL(HAVE_HMACLIB, test "$HMAC" = 1)
- saveLIBS="$LIBS"
- NETLIBS=""
- AC_MSG_CHECKING(whether -lnsl is needed for inet_addr)
- AC_TRY_LINK_FUNC(inet_addr,
- AC_MSG_RESULT(no),
- LIBS="-lnsl $LIBS"
- AC_TRY_LINK_FUNC(inet_addr,
- NETLIBS="-lnsl"
- AC_MSG_RESULT(yes),
- AC_MSG_ERROR(Cannot find function inet_addr)))
- AC_MSG_CHECKING(whether -lsocket is needed for socket)
- AC_TRY_LINK_FUNC(socket,
- AC_MSG_RESULT(no),
- LIBS="-lsocket $LIBS",
- AC_TRY_LINK_FUNC(socket,
- NETLIBS="-lsocket $NETLIBS"
- AC_MSG_RESULT(yes),
- AC_MSG_ERROR(Cannot find function socket)))
- LIBS="$saveLIBS"
- AC_SUBST(NETLIBS)
- STATIC_LIST=""
- STATIC_MODULES=""
- LIBAUTH=""
- SASL_LIST="SASL("LOGIN", authsasl_login)"
- rm -f authconfiglist
- cp /dev/null authconfiglist
- dnl #########################################################################
- dnl Prepare authuserdb module if userdb library is available
- dnl #########################################################################
- AC_ARG_WITH(authuserdb,
- [ --without-authuserdb Do not include the authuserdb module ],
- doauthuserdb="$withval",
- doauthuserdb="no"
- if test -d ../userdb
- then
- doauthuserdb="yes"
- fi)
- if test "$doauthuserdb" = "no"
- then
- USE_DB=0
- USE_GDBM=0
- LIBGDBM=""
- LIBDB=""
- dblibrary=""
- AUTHUSERDB=""
- else
- AC_ARG_WITH(userdb, [], userdb="$withval", userdb="/etc/userdb")
- AC_ARG_WITH(db, [], db="$withval", db="")
- case "$db" in
- gdbm)
- . ../dbobj.config
- USE_GDBM=1
- USE_DB=0
- LIBDB=""
- dblibrary=../gdbmobj/libgdbmobj.a
- AUTHUSERDB="authuserdb"
- if test "$userdb" = ""
- then
- AC_MSG_ERROR(--with-userdb option required)
- fi
- ;;
- db)
- . ../dbobj.config
- USE_DB=1
- USE_GDBM=0
- LIBGDBM=""
- dblibrary=../bdbobj/libbdbobj.a
- AUTHUSERDB="authuserdb"
- if test "$userdb" = ""
- then
- AC_MSG_ERROR(--with-userdb option required)
- fi
- ;;
- "")
- USE_DB=0
- USE_GDBM=0
- LIBGDBM=""
- LIBDB=""
- dblibrary=""
- AUTHUSERDB=""
- ;;
- *)
- AC_MSG_ERROR(Invalid --with-db option)
- esac
- fi
- AC_SUBST(USE_GDBM)
- AC_SUBST(USE_DB)
- AC_SUBST(dblibrary)
- AC_SUBST(LIBGDBM)
- AC_SUBST(LIBDB)
- AC_SUBST(AUTHUSERDB)
- if test "$userdb" = ""
- then
- userdb="/etc/userdb"
- fi
- AC_DEFINE_UNQUOTED(USERDB,"$userdb")
- AC_SUBST(userdb)
- AM_CONDITIONAL(HAVE_AUTHUSERDB, test "$USE_GDBM$USE_DB" != 00)
- if test "$USE_GDBM$USE_DB" != 00
- then
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authuserdb", auth_userdb, auth_userdb_pre, auth_userdb_cleanup)"
- LIBAUTH="$LIBAUTH libauth-authuserdb.a"
- fi
- dnl #########################################################################
- dnl Prepare authpam module if libpam is available.
- dnl #########################################################################
- AC_ARG_WITH(authpam,
- [ --without-authpam Do not include the authpam module ],
- doauthpam="$withval")
- if test "$doauthpam" = "no"
- then
- HAVE_PAM=0
- LIBDL=""
- else
- AC_CHECK_HEADERS(security/pam_appl.h Pam/pam_appl.h)
- 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)
- AC_SUBST(HAVE_PAM)
- AM_CONDITIONAL(HAVE_PAM, test "$HAVE_PAM" = 1)
- AUTHPAM=""
- if test "$HAVE_PAM" = 1
- then
- AUTHPAM=authpam
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authpam", auth_pam, auth_pam_pre, authdummy)"
- LIBAUTH="$LIBAUTH libauth-authpam.a"
- 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)
- 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(ldap.h lber.h syslog.h)
- if test "$doauthldap" = "no"
- then
- HAVE_LDAP=0
- else
- saveLIBS="$LIBS"
- LIBS="$NETLIBS $LIBS"
- LDAPLIBS=""
- AC_CHECK_LIB(lber, ber_scanf,
- LDAPLIBS="-llber" ; 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)
- LIBS="$saveLIBS"
- fi
- AC_ARG_WITH(authldaprc,
- [ --with-authldaprc=filename Expect to find authldaprc here ],
- authldaprc="$withval",
- authldaprc="$sysconfdir/authldaprc")
- AC_SUBST(authldaprc)
- AUTHLDAP=""
- if test "$HAVE_LDAP" = 1
- then
- AUTHLDAP=authldap
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authldap", auth_ldap, auth_ldap_pre, authldapclose)"
- LIBAUTH="$LIBAUTH libauth-authldap.a"
- echo authldaprc >>authconfiglist
- else
- authldaprc=""
- fi
- AC_SUBST(LDAPLIBS)
- AM_CONDITIONAL(HAVE_LDAP, test "$HAVE_LDAP" = 1)
- 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
- 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(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
- AUTHSHADOW=""
- if test "$HAVE_SHADOW" = 1
- then
- AUTHSHADOW=authshadow
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authshadow", auth_shadow, auth_shadow_pre, authdummy)"
- LIBAUTH="$LIBAUTH libauth-authshadow.a"
- fi
- AC_SUBST(SHADOWLIBS)
- AM_CONDITIONAL(HAVE_SHADOW, test "$HAVE_SHADOW" = 1)
- AUTHPWD=""
- if test "$HAVE_PWD" = 1
- then
- AUTHPWD=authpwd
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authpwd", auth_pwd, auth_pwd_pre, authdummy)"
- LIBAUTH="$LIBAUTH libauth-authpwd.a"
- fi
- AM_CONDITIONAL(HAVE_PWD, test "$HAVE_PWD" = 1)
- dnl #########################################################################
- dnl Prepare authvchkpw module if vchkpw is installed.
- dnl #########################################################################
- AC_ARG_WITH(authvchkpw,
- [ --without-authvchkpw Do not include the authvchkpw module ],
- doauthvchkpw="$withval",
- doauthvchkpw=no
- if test -d ~vpopmail/.
- then
- doauthvchkpw=yes
- fi)
- vpopmail_home=.
- if test "$doauthvchkpw" = "no"
- then
- HAVE_VCHKPW=0
- else
- HAVE_VCHKPW=1
- vpopmail_home="`echo ~vpopmail`"
- AC_MSG_CHECKING(whether -lm is needed for floor)
- AC_TRY_LINK_FUNC(floor,
- AC_MSG_RESULT(no),
- LIBM="-lm"
- AC_MSG_RESULT(yes))
- CFLAGS="-I${vpopmail_home}/include $CFLAGS"
- LDFLAGS="-L${vpopmail_home}/lib $LDFLAGS"
- AC_SUBST(LIBM)
- fi
- AC_SUBST(vpopmail_home)
- AUTHVCHKPW=""
- if test "$HAVE_VCHKPW" = 1
- then
- AUTHVCHKPW=authvchkpw
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authvchkpw", auth_vchkpw, auth_vchkpw_pre, authdummy)"
- LIBAUTH="$LIBAUTH libauth-authvchkpw.a"
- fi
- AM_CONDITIONAL(HAVE_VCHKPW, test "$HAVE_VCHKPW" = 1)
- dnl #########################################################################
- dnl Prepare authmysql module
- dnl #########################################################################
- AC_ARG_WITH(authmysqlrc,
- [ --with-authmysqlrc=filename Expect to find authmysql here ],
- authmysqlrc="$withval",
- authmysqlrc="$sysconfdir/authmysqlrc")
- AC_SUBST(authmysqlrc)
- AC_ARG_WITH(authmysql,
- [ --without-authmysql Do not include the authmysql module ],
- doauthmysql="$withval",
- # Do not configure authmysql if authvchkpw was found
- if test "$HAVE_VCHKPW" = 1
- then
- doauthmysql="no"
- fi
- )
- if test "$doauthmysql" = ""
- then
- saveLIBS="$LIBS"
- LIBS="$NETLIBS $LIBS"
- AC_CHECK_LIB(mysqlclient,mysql_connect,
- doauthmysql="yes"
- )
- LIBS="$saveLIBS"
- fi
- if test "$doauthmysql" != "yes"
- then
- AUTHMYSQL=""
- HAVE_AUTHMYSQL=0
- else
- saveLIBS="$LIBS"
- AC_CHECK_LIB(mysqlclient,mysql_connect,
- MYSQLLIB="-lmysqlclient"
- AUTHMYSQL="authmysql"
- HAVE_AUTHMYSQL=1,
- AC_MSG_ERROR(--with-authmysql specified, but no mysqlclient.so)
- )
- LIBS="$saveLIBS"
- echo authmysqlrc >>authconfiglist
- HAVE_AUTHMYSQL=1
- fi
- if test $HAVE_AUTHMYSQL = 1
- then
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authmysql", auth_mysql, auth_mysql_pre, auth_mysql_cleanup)"
- fi
- AC_SUBST(MYSQLLIB)
- AC_SUBST(AUTHMYSQL)
- AM_CONDITIONAL(HAVE_AUTHMYSQL, test "$HAVE_AUTHMYSQL" = 1)
- dnl #########################################################################
- dnl Prepare authcram module if userdb and libhmac is available, and either
- dnl md5 or sha1 (or both) is available
- dnl #########################################################################
- AC_ARG_WITH(authcram,
- [ --without-authcram Do not include the authcram module ],
- doauthcram="$withval",
- doauthcram=yes)
- AUTHCRAM=""
- if test "$USE_GDBM$USE_DB" != 00
- then
- if test "$HMAC" != 0
- then
- if test "$MD5$SHA1" != 00
- then
- if test "$doauthcram" = "yes"
- then
- AUTHCRAM="authcram"
- STATIC_LIST="$STATIC_LIST AUTHSTATIC("authcram", auth_cram, auth_cram_pre, auth_userdb_cleanup)"
- LIBAUTH="$LIBAUTH libauth-authcram.a"
- fi
- fi
- if test "$MD5" != 0
- then
- SASL_LIST="$SASL_LIST SASL("CRAM-MD5", authsasl_cram)"
- fi
- if test "$SHA1" != 0
- then
- SASL_LIST="$SASL_LIST SASL("CRAM-SHA1", authsasl_cram)"
- fi
- fi
- fi
- AM_CONDITIONAL(HAVE_AUTHCRAM, test "$AUTHCRAM" != "")
- dnl Checks for header files.
- AC_HEADER_STDC
- AC_HEADER_SYS_WAIT
- AC_CHECK_HEADERS(sys/stat.h sys/time.h sys/wait.h unistd.h fcntl.h crypt.h)
- dnl Checks for typedefs, structures, and compiler characteristics.
- AC_C_CONST
- AC_PID_T
- AC_TYPE_UID_T
- dnl Other checks
- AC_CHECK_LIB(crypt, crypt, CRYPTLIBS="-lcrypt")
- saveLIBS="$LIBS"
- LIBS="$CRYPTLIBS $LIBS"
- AC_CHECK_FUNC(crypt, AC_DEFINE_UNQUOTED(HAVE_CRYPT,1))
- LIBS="$saveLIBS"
- AC_CACHE_CHECK([for crypt() prototype],userdb_cv_NEED_CRYPT_PROTOTYPE,
- AC_TRY_COMPILE( [
- #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)
- AC_SUBST(CRYPTLIBS)
- AUTHMODULES="$AUTHCRAM $AUTHUSERDB $AUTHVCHKPW $AUTHPAM $AUTHSHADOW $AUTHPWD $AUTHLDAP $AUTHMYSQL"
- AUTHMODULES=`echo $AUTHMODULES`
- dnl #########################################################################
- dnl Prepare authdaemon module. The default is to enable it if either
- dnl authmysql or authvchkpw or authldap is used.
- dnl #########################################################################
- AC_ARG_WITH(authdaemonrc,
- [ --with-authdaemonrc=filename Expect to find authmysql here ],
- authdaemonrc="$withval",
- authdaemonrc="$sysconfdir/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/authdaemon")
- AC_ARG_WITH(authdaemon,
- [ --with-authdaemon Include the authdaemon module
- --without-authdaemon Do not include the authdaemon module],
- doauthdaemon="$withval",
- doauthdaemon=1
- if test "$HAVE_AUTHMYSQL$HAVE_LDAP" = "00"
- then
- doauthdaemon=0
- fi)
- AM_CONDITIONAL(HAVE_AUTHDAEMON, test $doauthdaemon = 1)
- DAEMON_STATIC_LIST=""
- NONDAEMONAUTHMODULES="$AUTHMODULES"
- AUTHDAEMONMODULELIST=""
- if test $doauthdaemon = 1
- then
- DAEMON_STATIC_LIST="$STATIC_LIST"
- STATIC_LIST="AUTHSTATIC("authdaemon", auth_daemon, auth_daemon_pre, auth_daemon_cleanup)"
- AUTHDAEMONMODULELIST="$AUTHMODULES"
- AC_DEFINE_UNQUOTED(AUTHDAEMONMODULELIST,"$AUTHDAEMONMODULELIST")
- NONDAEMONAUTHMODULES="authdaemon"
- LIBAUTH="$LIBAUTH libauth-authdaemon.a"
- echo authdaemonrc >>authconfiglist
- authdaemondprog="authdaemond authdaemontest authmksock"
- else
- authdaemonvar=""
- authdaemondprog=""
- fi
- AC_SUBST(authdaemonvar)
- AC_SUBST(authdaemondprog)
- AC_SUBST(DAEMON_STATIC_LIST)
- AC_SUBST(NONDAEMONAUTHMODULES)
- AC_SUBST(AUTHDAEMONMODULELIST)
- AC_SUBST(AUTHMODULES)
- AC_SUBST(LIBAUTH)
- INSTALLAUTHMODULES="$NONDAEMONAUTHMODULES"
- cp /dev/null authdaemon.msg
- if test $doauthdaemon = 1
- then
- INSTALLAUTHMODULES="$INSTALLAUTHMODULES authdaemond"
- cat >authdaemon.msg <<EOF
- ----------------------------------------------------------------------------
- You must now set up the following command to run at system boot:
- $libexecdir/authlib/authdaemond start
- ----------------------------------------------------------------------------
- EOF
- fi
- AC_SUBST(INSTALLAUTHMODULES)
- AC_DEFINE_UNQUOTED(DAEMON_STATIC_LIST,$DAEMON_STATIC_LIST)
- AC_DEFINE_UNQUOTED(STATIC_LIST,$STATIC_LIST)
- AC_DEFINE_UNQUOTED(SASL_LIST,$SASL_LIST)
- rm -f authdaemonrc.h authldaprc.h authmysqlrc.h vpopmail_config.h
- AC_OUTPUT(Makefile html2man.pl authlib.html modulelist installlist authdaemonrc)