meillo@0: dnl Process this file with autoconf to produce a configure script. meillo@0: meillo@0: AC_PREREQ(2.59) meillo@35: AC_INIT(masqmail, 0.2.21, meillo@marmaro.de) meillo@0: AC_CONFIG_SRCDIR([src/masqmail.c]) meillo@0: AM_CONFIG_HEADER(config.h) meillo@0: AM_INIT_AUTOMAKE() meillo@0: meillo@0: AC_PREFIX_DEFAULT(/usr) meillo@0: meillo@0: dnl Checks for programs. meillo@0: meillo@0: dnl Checks for libraries. meillo@0: meillo@0: AC_PROG_CC meillo@0: AC_ISC_POSIX meillo@0: AC_STDC_HEADERS meillo@0: dnl AC_ARG_PROGRAM meillo@0: AC_PROG_RANLIB meillo@0: meillo@0: PKG_CHECK_MODULES(GLIB, glib-2.0) meillo@0: AC_SUBST(GLIB_LIBS) meillo@0: AC_SUBST(GLIB_CFLAGS) meillo@0: meillo@0: dnl resolver support (default is use it) meillo@0: AC_ARG_ENABLE(resolver, meillo@0: [ --disable-resolver disable resolver support], meillo@0: if test "$enable_resolver" != 'no'; then meillo@0: resolver_enabled='yes' meillo@0: fi, meillo@0: resolver_enabled='yes' meillo@0: ) meillo@0: meillo@0: if test "$resolver_enabled" = yes; then meillo@0: AC_DEFINE(ENABLE_RESOLVER, 1, [If the resolver is to be used]) meillo@0: dnl checks necessary for libc5: meillo@0: dnl if there is res_search in libc, it is probably libc5 meillo@0: dnl if not, it is probably libc6 and we need libresolv meillo@0: AC_CHECK_LIB(c, res_search, need_resolv=no, need_resolv=yes) meillo@0: if test "$need_resolv" = yes; then meillo@1: AC_CHECK_LIB(resolv, res_search, meillo@1: has_resolv=yes; RESOLV_LIBS="-lresolv", meillo@1: has_resolv=no) meillo@1: if test "$has_resolv" = no; then meillo@1: saved_LIBS="$LIBS" meillo@1: LIBS="$LIBS -lresolv" meillo@1: AC_MSG_CHECKING(for res_search in -lresolv) meillo@1: AC_TRY_LINK([#include ], meillo@1: [res_search (0, 0, 0, 0, 0);], meillo@1: RESOLV_LIBS="-lresolv"; has_resolv=yes; AC_MSG_RESULT(yes), meillo@1: AC_MSG_RESULT(no)); meillo@1: LIBS="$saved_LIBS" meillo@1: fi meillo@1: if test "$has_resolv" = no; then meillo@1: AC_MSG_ERROR("no libresolv") meillo@1: RESOLV_LIBS='' meillo@1: fi meillo@0: fi meillo@0: else meillo@0: RESOLV_LIBS='' meillo@0: fi meillo@0: AC_SUBST(RESOLV_LIBS) meillo@0: meillo@0: dnl if there is no getline, we define it using getdelim in src/masqmail.h meillo@0: AC_CHECK_FUNCS(getline) meillo@0: meillo@0: dnl if there is no fdatasync, we define it to fsync in src/masqmail.h meillo@0: AC_CHECK_FUNCS(fdatasync) meillo@0: meillo@0: dnl Checks for header files. meillo@0: AC_HEADER_STDC meillo@0: AC_CHECK_HEADERS(fcntl.h sys/time.h syslog.h unistd.h) meillo@0: meillo@0: dnl Checks for typedefs, structures, and compiler characteristics. meillo@0: AC_C_CONST meillo@0: AC_TYPE_PID_T meillo@0: AC_TYPE_SIZE_T meillo@0: AC_HEADER_TIME meillo@0: AC_STRUCT_TM meillo@0: meillo@0: dnl Checks for library functions. meillo@0: AC_FUNC_FNMATCH meillo@0: AC_TYPE_SIGNAL meillo@0: AC_FUNC_STRFTIME meillo@0: AC_FUNC_VPRINTF meillo@0: AC_CHECK_FUNCS(select socket strerror strstr) meillo@0: meillo@0: dnl user and group configuration meillo@0: AC_ARG_WITH(user, meillo@0: [ --with-user=USER set user [mail]], meillo@0: ) meillo@0: if test "x$with_user" = 'x'; then meillo@0: with_user='mail' meillo@0: fi meillo@0: meillo@0: AC_ARG_WITH(group, meillo@0: [ --with-group=GROUP set group [trusted]], meillo@0: ) meillo@0: if test "x$with_group" = 'x'; then meillo@0: with_group='trusted' meillo@0: fi meillo@0: meillo@0: dnl debugging support (default is use it) meillo@0: AC_ARG_ENABLE(debug, meillo@0: [ --disable-debug disable debugging], meillo@0: if test "x$enable_debug" != 'xno'; then meillo@0: debug_enabled='yes' meillo@0: fi, meillo@0: debug_enabled='yes' meillo@0: ) meillo@0: if test "x$debug_enabled" = xyes; then meillo@0: AC_DEFINE(ENABLE_DEBUG, 1, [If debugging is enabled]) meillo@0: fi meillo@0: meillo@0: AC_DEFINE_UNQUOTED(DEF_MAIL_USER, "${with_user}", [The mail user]) meillo@0: AC_SUBST(with_user) meillo@0: AC_DEFINE_UNQUOTED(DEF_MAIL_GROUP, "${with_group}", [The mail group]) meillo@0: AC_SUBST(with_group) meillo@0: meillo@0: dnl link glib statically? meillo@0: AC_ARG_WITH(glib_static, meillo@0: [ --with-glib-static=path link glib statically (path mandatory!)], meillo@0: ) meillo@0: if test "x$with_glib_static" != 'x'; then meillo@0: GLIB_LIBS=$with_glib_static meillo@0: AC_SUBST(GLIB_LIBS) meillo@0: fi meillo@0: meillo@0: dnl optional features meillo@0: MD5_LIBS='' meillo@0: BASE64_LIBS='' meillo@0: meillo@0: dnl smtp server support (default is use it) meillo@0: AC_ARG_ENABLE(smtp_server, meillo@0: [ --disable-smtp-server disable smtp server support], meillo@0: if test "x$enable_smtp_server" != 'xno'; then meillo@0: smtp_server_enabled='yes' meillo@0: fi, meillo@0: smtp_server_enabled='yes' meillo@0: ) meillo@0: if test "x$smtp_server_enabled" = xyes; then meillo@0: AC_DEFINE(ENABLE_SMTP_SERVER, 1, [If the SMTP server is enabled]) meillo@0: fi meillo@0: meillo@0: dnl pop support (default is use it) meillo@0: AC_ARG_ENABLE(pop3, meillo@0: [ --disable-pop3 disable pop3 support], meillo@0: if test "x$enable_pop3" != 'xno'; then meillo@0: pop3_enabled='yes' meillo@0: fi, meillo@0: pop3_enabled='yes' meillo@0: ) meillo@0: if test "x$pop3_enabled" = xyes; then meillo@0: AC_DEFINE(ENABLE_POP3, 1, [If the POP3 support is enabled]) meillo@0: # MD5_LIBS='md5/libmd5c.a' meillo@0: need_md5='yes' meillo@0: fi meillo@0: meillo@0: dnl auth support (default is to not use it) meillo@0: AC_ARG_ENABLE(auth, meillo@0: [ --enable-auth enable AUTH (RFC 2554) client support], meillo@0: if test "x$enable_auth" != 'xno'; then meillo@0: auth_enabled='yes' meillo@0: fi, meillo@0: ) meillo@0: if test "x$auth_enabled" = xyes; then meillo@0: AC_DEFINE(ENABLE_AUTH, 1, [If AUTH is enabled]) meillo@0: BASE64_LIBS='base64/libbase64.a' meillo@0: # MD5_LIBS='md5/libmd5c.a' meillo@0: need_md5='yes' meillo@0: fi meillo@0: AC_SUBST(BASE64_LIBS) meillo@0: meillo@0: dnl maildir support (default is to not use it) meillo@0: AC_ARG_ENABLE(maildir, meillo@0: [ --enable-maildir enable qmail style maildir support], meillo@0: if test "x$enable_maildir" != 'xno'; then meillo@0: maildir_enabled='yes' meillo@0: fi, meillo@0: ) meillo@0: if test "x$maildir_enabled" = xyes; then meillo@0: AC_DEFINE(ENABLE_MAILDIR, 1, [If Maildirs are enabled]) meillo@0: fi meillo@0: meillo@0: dnl libcrypto meillo@0: AC_ARG_WITH(libcrypto, meillo@0: [ --with-libcrypto use libcrypto], meillo@0: ) meillo@0: if test "x$with_libcrypto" != 'xyes'; then meillo@0: with_libcrypto='no' meillo@0: fi meillo@0: meillo@0: if test "x$need_md5" = 'xyes'; then meillo@0: dnl check whether we have md5 in libcrypto if md5 needed and we shall link with libcrypto meillo@0: if test "x$with_libcrypto" = "xyes"; then meillo@0: AC_CHECK_LIB(crypto, MD5, has_crypto='yes', AC_MSG_ERROR('no libcrypto')) meillo@0: if test "x$has_crypto" = 'xyes'; then meillo@0: AC_DEFINE(USE_LIB_CRYPTO, 1, [If libcrypto is available]) meillo@0: MD5_LIBS='-lcrypto' meillo@0: fi meillo@0: else meillo@0: MD5_LIBS='md5/libmd5c.a' meillo@0: fi meillo@0: fi meillo@0: AC_SUBST(MD5_LIBS) meillo@0: meillo@0: dnl ident support (default is to not use it) meillo@0: IDENT_LIBS='' meillo@0: AC_ARG_ENABLE(ident, meillo@0: [ --enable-ident enable ident (RFC 1413) support], meillo@0: if test "x$enable_ident" != 'xno'; then meillo@0: ident_enabled='yes' meillo@0: fi, meillo@0: ) meillo@0: AC_SUBST(has_ident) meillo@0: if test "x$ident_enabled" = xyes; then meillo@0: AC_DEFINE(ENABLE_IDENT, 1, [If ident is enabled]) meillo@0: AC_CHECK_LIB(ident, ident_id, IDENT_LIBS='-lident', IDENT_LIBS='libident/libident.a') meillo@0: fi meillo@0: AC_SUBST(IDENT_LIBS) meillo@0: meillo@0: dnl mserver support (default is to not use it) meillo@0: AC_ARG_ENABLE(mserver, meillo@0: [ --enable-mserver enable mserver support], meillo@0: if test "x$enable_mserver" != 'xno'; then meillo@0: mserver_enabled='yes' meillo@0: fi, meillo@0: ) meillo@0: if test "x$mserver_enabled" = xyes; then meillo@0: AC_DEFINE(ENABLE_MSERVER, 1, [If mserver support is enabled]) meillo@0: fi meillo@0: meillo@0: dnl liblockfile meillo@0: AC_ARG_WITH(liblockfile, meillo@0: [ --with-liblockfile use liblock (for Debian)], meillo@0: ) meillo@0: if test "x$with_liblockfile" != 'x'; then meillo@0: with_liblockfile='yes' meillo@0: fi meillo@0: if test "x$with_liblockfile" = xyes; then meillo@0: AC_CHECK_LIB(lockfile, maillock, has_lockfile=yes, AC_MSG_ERROR("no liblockfile")) meillo@0: LOCKFILE_LIBS='-llockfile' meillo@0: AC_DEFINE(USE_LIBLOCKFILE, 1, [If liblockfile is to be used]) meillo@0: else meillo@0: LOCKFILE_LIBS='' meillo@0: fi meillo@0: AC_SUBST(LOCKFILE_LIBS) meillo@0: AC_SUBST(USE_LIBLOCKFILE) meillo@0: meillo@0: dnl log and spool directories meillo@0: AC_ARG_WITH(logdir, meillo@0: [ --with-logdir=DIR set log directory [/var/masqmail]], meillo@0: , meillo@0: with_logdir='/var/log/masqmail/' meillo@0: ) meillo@0: AC_SUBST(with_logdir) meillo@0: meillo@0: AC_ARG_WITH(spooldir, meillo@0: [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]], meillo@0: , meillo@0: with_spooldir='/var/spool/masqmail/' meillo@0: ) meillo@0: AC_SUBST(with_spooldir) meillo@0: meillo@0: dnl configuration file meillo@0: AC_ARG_WITH(confdir, meillo@0: [ --with-confdir directory for configuration [/etc/masqmail]], meillo@0: , meillo@0: with_confdir='/etc/masqmail' meillo@0: ) meillo@0: AC_DEFINE_UNQUOTED(CONF_DIR, "${with_confdir}", [The configuration file location]) meillo@0: AC_SUBST(with_confdir) meillo@0: meillo@0: test "x$prefix" = xNONE && prefix="$ac_default_prefix" meillo@35: meillo@35: dnl well, /me/ thought that autoconf should make things _easy_ ... -- oku meillo@35: dnl I needed the two `eval's to get the variable expanded in all cases -- meillo meillo@35: dnl this is just horrible! -- meillo meillo@35: AC_DEFINE_UNQUOTED(DATA_DIR, "`eval eval echo $datadir`/masqmail", [The data directory]) meillo@0: meillo@0: dnl gymnastics to get the correct path where masqmail should be installed meillo@0: dnl we need this to call ourselves in failmsg.c meillo@0: if test "x${exec_prefix}" != 'xNONE'; then meillo@0: AC_DEFINE_UNQUOTED(SBINDIR, "${exec_prefix}/sbin", [The sbin directory]) meillo@0: else meillo@0: if test "x${prefix}" != 'xNONE'; then meillo@0: AC_DEFINE_UNQUOTED(SBINDIR, "${prefix}/sbin") meillo@0: else meillo@0: AC_DEFINE_UNQUOTED(SBINDIR, "/usr/sbin") meillo@0: fi meillo@0: fi meillo@0: meillo@0: AC_OUTPUT(Makefile \ meillo@0: src/Makefile \ meillo@0: src/base64/Makefile \ meillo@0: src/md5/Makefile \ meillo@4: src/libident/Makefile meillo@0: )