meillo@0: dnl Process this file with autoconf to produce a configure script. meillo@0: meillo@0: AC_PREREQ(2.59) meillo@382: AC_INIT(masqmail, 0.3.5-dev, 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: 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@181: dnl # use the next line to use glib-1.2 meillo@181: dnl PKG_CHECK_MODULES(GLIB, glib) meillo@181: 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@193: [ --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@193: [ --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@358: [ --with-group=GROUP set group [mail]], meillo@0: ) meillo@0: if test "x$with_group" = 'x'; then meillo@358: with_group='mail' meillo@0: fi meillo@0: meillo@0: dnl debugging support (default is use it) meillo@0: AC_ARG_ENABLE(debug, meillo@193: [ --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 optional features meillo@0: MD5_LIBS='' meillo@0: BASE64_LIBS='' meillo@0: meillo@364: dnl auth support (default: use it) meillo@0: AC_ARG_ENABLE(auth, meillo@364: [ --disable-auth disable AUTH (RFC 2554) client support], meillo@0: if test "x$enable_auth" != 'xno'; then meillo@0: auth_enabled='yes' meillo@0: fi, meillo@364: auth_enabled='yes' 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: need_md5='yes' meillo@0: fi meillo@0: AC_SUBST(BASE64_LIBS) meillo@0: meillo@0: if test "x$need_md5" = 'xyes'; then meillo@363: MD5_LIBS='md5/libmd5.a' meillo@0: fi meillo@0: AC_SUBST(MD5_LIBS) meillo@0: meillo@0: dnl liblockfile meillo@0: AC_ARG_WITH(liblockfile, meillo@193: [ --with-liblockfile use liblock (for Debian)], meillo@0: ) meillo@173: if test "x$with_liblockfile" = 'xno'; then meillo@173: with_liblockfile='' meillo@173: fi 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@193: [ --with-logdir=DIR set log directory [/var/log/masqmail]], meillo@0: , meillo@422: with_logdir='/var/log/masqmail' meillo@0: ) meillo@151: AC_DEFINE_UNQUOTED(LOG_DIR, "${with_logdir}", [The log directory]) meillo@0: AC_SUBST(with_logdir) meillo@0: meillo@0: AC_ARG_WITH(spooldir, meillo@193: [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]], meillo@0: , meillo@422: with_spooldir='/var/spool/masqmail' meillo@0: ) meillo@151: AC_DEFINE_UNQUOTED(SPOOL_DIR, "${with_spooldir}", [The spool directory]) meillo@0: AC_SUBST(with_spooldir) meillo@0: meillo@0: dnl configuration file meillo@0: AC_ARG_WITH(confdir, meillo@365: [ --with-confdir=DIR 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@419: dnl dir for pid files meillo@419: AC_ARG_WITH(piddir, meillo@419: [ --with-piddir=DIR directory for pid files [/var/run]], meillo@419: , meillo@419: with_piddir='/var/run' meillo@419: ) meillo@419: AC_DEFINE_UNQUOTED(PID_DIR, "${with_piddir}", [The pid file location]) meillo@419: AC_SUBST(with_piddir) meillo@419: meillo@421: dnl dir for lock files meillo@421: AC_ARG_WITH(lockdir, meillo@421: [ --with-lockdir=DIR directory for lock files [/var/lock/masqmail]], meillo@421: , meillo@421: with_lockdir='/var/lock/masqmail' meillo@421: ) meillo@421: AC_DEFINE_UNQUOTED(LOCK_DIR, "${with_lockdir}", [The lock file location]) meillo@421: AC_SUBST(with_lockdir) meillo@421: 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@57: man/Makefile meillo@0: )