masqmail

annotate configure.ac @ 424:19be3b27df6f

Fixed forgotten resetting of identity.
author markus schnalke <meillo@marmaro.de>
date Wed, 30 May 2012 11:24:33 +0200
parents f37384470855
children 34c919a8d74e
rev   line source
meillo@0 1 dnl Process this file with autoconf to produce a configure script.
meillo@0 2
meillo@0 3 AC_PREREQ(2.59)
meillo@382 4 AC_INIT(masqmail, 0.3.5-dev, meillo@marmaro.de)
meillo@0 5 AC_CONFIG_SRCDIR([src/masqmail.c])
meillo@0 6 AM_CONFIG_HEADER(config.h)
meillo@0 7 AM_INIT_AUTOMAKE()
meillo@0 8
meillo@0 9 dnl Checks for programs.
meillo@0 10
meillo@0 11 dnl Checks for libraries.
meillo@0 12
meillo@0 13 AC_PROG_CC
meillo@0 14 AC_ISC_POSIX
meillo@0 15 AC_STDC_HEADERS
meillo@0 16 dnl AC_ARG_PROGRAM
meillo@0 17 AC_PROG_RANLIB
meillo@0 18
meillo@0 19 PKG_CHECK_MODULES(GLIB, glib-2.0)
meillo@181 20 dnl # use the next line to use glib-1.2
meillo@181 21 dnl PKG_CHECK_MODULES(GLIB, glib)
meillo@181 22
meillo@0 23 AC_SUBST(GLIB_LIBS)
meillo@0 24 AC_SUBST(GLIB_CFLAGS)
meillo@0 25
meillo@0 26 dnl resolver support (default is use it)
meillo@0 27 AC_ARG_ENABLE(resolver,
meillo@193 28 [ --disable-resolver disable resolver support],
meillo@0 29 if test "$enable_resolver" != 'no'; then
meillo@0 30 resolver_enabled='yes'
meillo@0 31 fi,
meillo@0 32 resolver_enabled='yes'
meillo@0 33 )
meillo@0 34
meillo@0 35 if test "$resolver_enabled" = yes; then
meillo@0 36 AC_DEFINE(ENABLE_RESOLVER, 1, [If the resolver is to be used])
meillo@0 37 dnl checks necessary for libc5:
meillo@0 38 dnl if there is res_search in libc, it is probably libc5
meillo@0 39 dnl if not, it is probably libc6 and we need libresolv
meillo@0 40 AC_CHECK_LIB(c, res_search, need_resolv=no, need_resolv=yes)
meillo@0 41 if test "$need_resolv" = yes; then
meillo@1 42 AC_CHECK_LIB(resolv, res_search,
meillo@1 43 has_resolv=yes; RESOLV_LIBS="-lresolv",
meillo@1 44 has_resolv=no)
meillo@1 45 if test "$has_resolv" = no; then
meillo@1 46 saved_LIBS="$LIBS"
meillo@1 47 LIBS="$LIBS -lresolv"
meillo@1 48 AC_MSG_CHECKING(for res_search in -lresolv)
meillo@1 49 AC_TRY_LINK([#include <resolv.h>],
meillo@1 50 [res_search (0, 0, 0, 0, 0);],
meillo@1 51 RESOLV_LIBS="-lresolv"; has_resolv=yes; AC_MSG_RESULT(yes),
meillo@1 52 AC_MSG_RESULT(no));
meillo@1 53 LIBS="$saved_LIBS"
meillo@1 54 fi
meillo@1 55 if test "$has_resolv" = no; then
meillo@1 56 AC_MSG_ERROR("no libresolv")
meillo@1 57 RESOLV_LIBS=''
meillo@1 58 fi
meillo@0 59 fi
meillo@0 60 else
meillo@0 61 RESOLV_LIBS=''
meillo@0 62 fi
meillo@0 63 AC_SUBST(RESOLV_LIBS)
meillo@0 64
meillo@0 65 dnl if there is no getline, we define it using getdelim in src/masqmail.h
meillo@0 66 AC_CHECK_FUNCS(getline)
meillo@0 67
meillo@0 68 dnl if there is no fdatasync, we define it to fsync in src/masqmail.h
meillo@0 69 AC_CHECK_FUNCS(fdatasync)
meillo@0 70
meillo@0 71 dnl Checks for header files.
meillo@0 72 AC_HEADER_STDC
meillo@0 73 AC_CHECK_HEADERS(fcntl.h sys/time.h syslog.h unistd.h)
meillo@0 74
meillo@0 75 dnl Checks for typedefs, structures, and compiler characteristics.
meillo@0 76 AC_C_CONST
meillo@0 77 AC_TYPE_PID_T
meillo@0 78 AC_TYPE_SIZE_T
meillo@0 79 AC_HEADER_TIME
meillo@0 80 AC_STRUCT_TM
meillo@0 81
meillo@0 82 dnl Checks for library functions.
meillo@0 83 AC_FUNC_FNMATCH
meillo@0 84 AC_TYPE_SIGNAL
meillo@0 85 AC_FUNC_STRFTIME
meillo@0 86 AC_FUNC_VPRINTF
meillo@0 87 AC_CHECK_FUNCS(select socket strerror strstr)
meillo@0 88
meillo@0 89 dnl user and group configuration
meillo@0 90 AC_ARG_WITH(user,
meillo@193 91 [ --with-user=USER set user [mail]],
meillo@0 92 )
meillo@0 93 if test "x$with_user" = 'x'; then
meillo@0 94 with_user='mail'
meillo@0 95 fi
meillo@0 96
meillo@0 97 AC_ARG_WITH(group,
meillo@358 98 [ --with-group=GROUP set group [mail]],
meillo@0 99 )
meillo@0 100 if test "x$with_group" = 'x'; then
meillo@358 101 with_group='mail'
meillo@0 102 fi
meillo@0 103
meillo@0 104 dnl debugging support (default is use it)
meillo@0 105 AC_ARG_ENABLE(debug,
meillo@193 106 [ --disable-debug disable debugging],
meillo@0 107 if test "x$enable_debug" != 'xno'; then
meillo@0 108 debug_enabled='yes'
meillo@0 109 fi,
meillo@0 110 debug_enabled='yes'
meillo@0 111 )
meillo@0 112 if test "x$debug_enabled" = xyes; then
meillo@0 113 AC_DEFINE(ENABLE_DEBUG, 1, [If debugging is enabled])
meillo@0 114 fi
meillo@0 115
meillo@0 116 AC_DEFINE_UNQUOTED(DEF_MAIL_USER, "${with_user}", [The mail user])
meillo@0 117 AC_SUBST(with_user)
meillo@0 118 AC_DEFINE_UNQUOTED(DEF_MAIL_GROUP, "${with_group}", [The mail group])
meillo@0 119 AC_SUBST(with_group)
meillo@0 120
meillo@0 121 dnl optional features
meillo@0 122 MD5_LIBS=''
meillo@0 123 BASE64_LIBS=''
meillo@0 124
meillo@364 125 dnl auth support (default: use it)
meillo@0 126 AC_ARG_ENABLE(auth,
meillo@364 127 [ --disable-auth disable AUTH (RFC 2554) client support],
meillo@0 128 if test "x$enable_auth" != 'xno'; then
meillo@0 129 auth_enabled='yes'
meillo@0 130 fi,
meillo@364 131 auth_enabled='yes'
meillo@0 132 )
meillo@0 133 if test "x$auth_enabled" = xyes; then
meillo@0 134 AC_DEFINE(ENABLE_AUTH, 1, [If AUTH is enabled])
meillo@0 135 BASE64_LIBS='base64/libbase64.a'
meillo@0 136 need_md5='yes'
meillo@0 137 fi
meillo@0 138 AC_SUBST(BASE64_LIBS)
meillo@0 139
meillo@0 140 if test "x$need_md5" = 'xyes'; then
meillo@363 141 MD5_LIBS='md5/libmd5.a'
meillo@0 142 fi
meillo@0 143 AC_SUBST(MD5_LIBS)
meillo@0 144
meillo@0 145 dnl liblockfile
meillo@0 146 AC_ARG_WITH(liblockfile,
meillo@193 147 [ --with-liblockfile use liblock (for Debian)],
meillo@0 148 )
meillo@173 149 if test "x$with_liblockfile" = 'xno'; then
meillo@173 150 with_liblockfile=''
meillo@173 151 fi
meillo@0 152 if test "x$with_liblockfile" != 'x'; then
meillo@0 153 with_liblockfile='yes'
meillo@0 154 fi
meillo@0 155 if test "x$with_liblockfile" = xyes; then
meillo@0 156 AC_CHECK_LIB(lockfile, maillock, has_lockfile=yes, AC_MSG_ERROR("no liblockfile"))
meillo@0 157 LOCKFILE_LIBS='-llockfile'
meillo@0 158 AC_DEFINE(USE_LIBLOCKFILE, 1, [If liblockfile is to be used])
meillo@0 159 else
meillo@0 160 LOCKFILE_LIBS=''
meillo@0 161 fi
meillo@0 162 AC_SUBST(LOCKFILE_LIBS)
meillo@0 163 AC_SUBST(USE_LIBLOCKFILE)
meillo@0 164
meillo@0 165 dnl log and spool directories
meillo@0 166 AC_ARG_WITH(logdir,
meillo@193 167 [ --with-logdir=DIR set log directory [/var/log/masqmail]],
meillo@0 168 ,
meillo@422 169 with_logdir='/var/log/masqmail'
meillo@0 170 )
meillo@151 171 AC_DEFINE_UNQUOTED(LOG_DIR, "${with_logdir}", [The log directory])
meillo@0 172 AC_SUBST(with_logdir)
meillo@0 173
meillo@0 174 AC_ARG_WITH(spooldir,
meillo@193 175 [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]],
meillo@0 176 ,
meillo@422 177 with_spooldir='/var/spool/masqmail'
meillo@0 178 )
meillo@151 179 AC_DEFINE_UNQUOTED(SPOOL_DIR, "${with_spooldir}", [The spool directory])
meillo@0 180 AC_SUBST(with_spooldir)
meillo@0 181
meillo@0 182 dnl configuration file
meillo@0 183 AC_ARG_WITH(confdir,
meillo@365 184 [ --with-confdir=DIR directory for configuration [/etc/masqmail]],
meillo@0 185 ,
meillo@0 186 with_confdir='/etc/masqmail'
meillo@0 187 )
meillo@0 188 AC_DEFINE_UNQUOTED(CONF_DIR, "${with_confdir}", [The configuration file location])
meillo@0 189 AC_SUBST(with_confdir)
meillo@0 190
meillo@419 191 dnl dir for pid files
meillo@419 192 AC_ARG_WITH(piddir,
meillo@419 193 [ --with-piddir=DIR directory for pid files [/var/run]],
meillo@419 194 ,
meillo@419 195 with_piddir='/var/run'
meillo@419 196 )
meillo@419 197 AC_DEFINE_UNQUOTED(PID_DIR, "${with_piddir}", [The pid file location])
meillo@419 198 AC_SUBST(with_piddir)
meillo@419 199
meillo@421 200 dnl dir for lock files
meillo@421 201 AC_ARG_WITH(lockdir,
meillo@421 202 [ --with-lockdir=DIR directory for lock files [/var/lock/masqmail]],
meillo@421 203 ,
meillo@421 204 with_lockdir='/var/lock/masqmail'
meillo@421 205 )
meillo@421 206 AC_DEFINE_UNQUOTED(LOCK_DIR, "${with_lockdir}", [The lock file location])
meillo@421 207 AC_SUBST(with_lockdir)
meillo@421 208
meillo@0 209 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
meillo@35 210
meillo@35 211 dnl well, /me/ thought that autoconf should make things _easy_ ... -- oku
meillo@35 212 dnl I needed the two `eval's to get the variable expanded in all cases -- meillo
meillo@35 213 dnl this is just horrible! -- meillo
meillo@35 214 AC_DEFINE_UNQUOTED(DATA_DIR, "`eval eval echo $datadir`/masqmail", [The data directory])
meillo@0 215
meillo@0 216 dnl gymnastics to get the correct path where masqmail should be installed
meillo@0 217 dnl we need this to call ourselves in failmsg.c
meillo@0 218 if test "x${exec_prefix}" != 'xNONE'; then
meillo@0 219 AC_DEFINE_UNQUOTED(SBINDIR, "${exec_prefix}/sbin", [The sbin directory])
meillo@0 220 else
meillo@0 221 if test "x${prefix}" != 'xNONE'; then
meillo@0 222 AC_DEFINE_UNQUOTED(SBINDIR, "${prefix}/sbin")
meillo@0 223 else
meillo@0 224 AC_DEFINE_UNQUOTED(SBINDIR, "/usr/sbin")
meillo@0 225 fi
meillo@0 226 fi
meillo@0 227
meillo@0 228 AC_OUTPUT(Makefile \
meillo@0 229 src/Makefile \
meillo@0 230 src/base64/Makefile \
meillo@0 231 src/md5/Makefile \
meillo@57 232 man/Makefile
meillo@0 233 )