# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl DBMAIL_BOTH_SQL_CHECK
dnl
AC_DEFUN([DBMAIL_BOTH_SQL_CHECK], [dnl
AC_ARG_WITH(mysql,
[ --with-mysql use MySQL as database. Uses mysql_config
for finding includes and libraries],
mysqlheadername="$withval")
AC_ARG_WITH(pgsql,
[ --with-pgsql use PostgreSQL as database.
Uses pg_config for finding includes and libraries],
pgsqlheadername="$withval")
WARN=0
# Make sure we only select one, mysql or pgsql
if test "${mysqlheadername-x}" = "x"
then
if test "${pgsqlheadername-x}" = "x"
then
NEITHER=1
mysqlheadername=""
# MYSQLINC=""
# PGSQLINC=""
fi
fi
if test "$NEITHER" = 1
then
AC_MSG_ERROR([
You have to specify --with-mysql or --with-pgsql to build.
])
fi
if test ! "${mysqlheadername-x}" = "x"
then
if test ! "${pgsqlheadername-x}" = "x"
then
WARN=1
mysqlheadername=""
# MYSQLINC=""
# PGSQLINC=""
fi
fi
if test "$WARN" = 1
then
AC_MSG_ERROR([
You cannot specify both --with-mysql and --with-pgsql on the same
build...
])
fi
])
dnl DBMAIL_CHECK_SQL_LIBS
dnl
AC_DEFUN([DBMAIL_CHECK_SQL_LIBS], [dnl
#Look for include files and libs needed to link
#use the configuration utilities (mysql_config and pg_config for this)
# MySQL first
if test ! "${mysqlheadername-x}" = "x"
then
AC_PATH_PROG(mysqlconfig,mysql_config)
if test [ -z "$mysqlconfig" ]
then
AC_MSG_ERROR([mysql_config executable not found. Make sure mysql_config is in your path])
else
AC_MSG_CHECKING([MySQL headers])
MYSQLINC=`${mysqlconfig} --cflags`
AC_MSG_RESULT([$MYSQLINC])
AC_MSG_CHECKING([MySQL libraries])
SQLLIB=`${mysqlconfig} --libs`
SQLALIB="mysql/.libs/libmysqldbmail.a"
SQLLTLIB="mysql/libmysqldbmail.la"
AC_MSG_RESULT([$SQLLIB])
fi
else
if test ! "${pgsqlheadername-x}" = "x"
then
AC_PATH_PROG(pgsqlconfig,pg_config)
if test [ -z "$pgsqlconfig" ]
then
AC_MSG_ERROR([pg_config executable not found. Make sure pg_config is in your path])
else
AC_MSG_CHECKING([PostgreSQL headers])
PGINCDIR=`${pgsqlconfig} --includedir`
PGSQLINC="-I$PGINCDIR"
AC_MSG_RESULT([$PGSQLINC])
AC_MSG_CHECKING([PostgreSQL libraries])
PGLIBDIR=`${pgsqlconfig} --libdir`
SQLLIB="-L$PGLIBDIR -lpq"
SQLALIB="pgsql/.libs/libpgsqldbmail.a"
SQLLTLIB="pgsql/libpgsqldbmail.la"
AC_MSG_RESULT([$SQLLIB])
fi
fi
fi
])
dnl DBMAIL_SIEVE_CONF
dnl check for ldap or sql authentication
AC_DEFUN([DBMAIL_SIEVE_CONF], [dnl
AC_MSG_RESULT([checking for sorting configuration])
AC_ARG_WITH(sieve,[ --with-sieve=PATH full path to libSieve header directory (don't use, not stable)],
sieveheadername="$withval$")
dnl This always needs to be defined
SORTALIB="sort/.libs/libsortdbmail.a"
SORTLTLIB="sort/libsortdbmail.la"
WARN=0
if test ! "${sieveheadername-x}" = "x"
then
# --with-sieve was specified
AC_MSG_RESULT([using Sieve sorting])
if test "$withval" != "yes"
then
AC_MSG_CHECKING([for sieve2_interface.h (user supplied)])
if test -r "$sieveheadername/sieve2_interface.h"
then
# found
AC_MSG_RESULT([$sieveheadername/sieve2_interface.h])
SIEVEINC=$sieveheadername
else
# Not found
AC_MSG_RESULT([not found])
SIEVEINC=""
sieveheadername=""
AC_MSG_ERROR([
Unable to find sieve2_inteface.h where you specified, try just --with-sieve to
have configure guess])
fi
else
# Lets look in our standard paths
AC_MSG_CHECKING([for sieve2_interface.h])
for sievepaths in $sieveheaderpaths
do
if test -r "$sievepaths/sieve2_interface.h"
then
SIEVEINC="$sievepaths"
AC_MSG_RESULT([$sievepaths/sieve2_interface.h])
break
fi
done
if test -z "$SIEVEINC"
then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Unable to locate sieve2_inteface.h, try specifying with --with-sieve])
fi
fi
else
AC_MSG_RESULT([not using any sorting])
fi
])
dnl DBMAIL_CHECK_SIEVE_LIBS
dnl
AC_DEFUN([DBMAIL_CHECK_SIEVE_LIBS], [dnl
# Look for libs needed to link to SIEVE first
if test ! "${sieveheadername-x}" = "x"
then
AC_CHECK_LIB(sieve,sieve2_listextensions,[ SIEVELIB="-lsieve"], [SIEVELIB=""])
if test -z "$SIEVELIB"
then
AC_MSG_ERROR([
Unable to link against libSieve. It appears you are missing the
development libraries or they aren't in your linker's path
])
fi
else
#no Sieve needed
SIEVELIB=""
fi
])
dnl DBMAIL_AUTH_CONF
dnl check for ldap or sql authentication
AC_DEFUN([DBMAIL_AUTH_CONF], [dnl
AC_MSG_RESULT([checking for authentication configuration])
AC_ARG_WITH(auth-ldap,[ --with-auth-ldap=PATH full path to ldap header directory],
authldapheadername="$withval$")
dnl This always needs to be defined
AUTHALIB="auth/.libs/libauthdbmail.a"
AUTHLTLIB="auth/libauthdbmail.la"
WARN=0
if test ! "${authldapheadername-x}" = "x"
then
# --with-auth-ldap was specified
AC_MSG_RESULT([using LDAP authentication])
if test "$withval" != "yes"
then
AC_MSG_CHECKING([for ldap.h (user supplied)])
if test -r "$authldapheadername/ldap.h"
then
# found
AC_MSG_RESULT([$authldapheadername/ldap.h])
LDAPINC=$authldapheadername
else
# Not found
AC_MSG_RESULT([not found])
LDAPINC=""
authldapheadername=""
AC_MSG_ERROR([
Unable to find ldap.h where you specified, try just --with-auth-ldap to
have configure guess])
fi
else
# Lets look in our standard paths
AC_MSG_CHECKING([for ldap.h])
for ldappaths in $ldapheaderpaths
do
if test -r "$ldappaths/ldap.h"
then
LDAPINC="$ldappaths"
AC_MSG_RESULT([$ldappaths/ldap.h])
break
fi
done
if test -z "$LDAPINC"
then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Unable to locate ldap.h, try specifying with --with-ldap])
fi
fi
else
AC_MSG_RESULT([using SQL authentication])
fi
])
dnl DBMAIL_CHECK_LDAP_LIBS
dnl
AC_DEFUN([DBMAIL_CHECK_LDAP_LIBS], [dnl
# Look for libs needed to link to LDAP first
if test ! "${authldapheadername-x}" = "x"
then
AC_CHECK_LIB(ldap,ldap_bind,[ LDAPLIB="-lldap"], [LDAPLIB=""])
if test -z "$LDAPLIB"
then
AC_MSG_ERROR([
Unable to link against ldap. It appears you are missing the
development libraries or they aren't in your linker's path
])
fi
else
#no ldap needed
LDAPLIB=""
fi
])
dnl AC_COMPILE_WARNINGS
dnl set to compile with '-W -Wall'
AC_DEFUN([AC_COMPILE_WARNINGS],
[AC_MSG_CHECKING(maximum warning verbosity option)
if test -n "$CXX"
then
if test "$GXX" = "yes"
then
ac_compile_warnings_opt='-Wall'
fi
CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt"
ac_compile_warnings_msg="$ac_compile_warnings_opt for C++"
fi
if test -n "$CC"
then
if test "$GCC" = "yes"
then
ac_compile_warnings_opt='-W -Wall -Wpointer-arith -Wstrict-prototypes'
fi
CFLAGS="$CFLAGS $ac_compile_warnings_opt"
ac_compile_warnings_msg="$ac_compile_warnings_msg $ac_compile_warnings_opt for C"
fi
AC_MSG_RESULT($ac_compile_warnings_msg)
unset ac_compile_warnings_msg
unset ac_compile_warnings_opt
])
# ----------------------------------------------------------------
# DBMAIL_CHECK_GC
# I cheated I copied from w3m's acinclude.m4 :)
# Modified for DBMAIL by Dan Weber
# ----------------------------------------------------------------
AC_DEFUN([DBMAIL_CHECK_GC],
[AC_MSG_CHECKING(for --with-gc)
AC_ARG_WITH(gc,
[ --with-gc[=PREFIX] libgc PREFIX],
[test x"$with_gc" = xno && with_gc="no"],
[with_gc="no"])
AC_MSG_RESULT($with_gc)
# Don't check for gc if not appended to command line
if test x"$with_gc" = xyes
then
test x"$with_gc" = xyes && with_gc="/usr /usr/local ${HOME}"
unset ac_cv_header_gc_h
AC_CHECK_HEADER(gc/gc.h)
if test x"$ac_cv_header_gc_h" = xno; then
AC_MSG_CHECKING(GC header location)
AC_MSG_RESULT($with_gc)
gcincludedir=no
for dir in $with_gc; do
for inc in include include/gc; do
cflags="$CFLAGS"
CFLAGS="$CFLAGS -I$dir/$inc -DUSE_GC=1"
AC_MSG_CHECKING($dir/$inc)
unset ac_cv_header_gc_h
AC_CHECK_HEADER(gc/gc.h, [gcincludedir="$dir/$inc"; CFLAGS="$CFLAGS -I$dir/$inc -DUSE_GC=1"; break])
CFLAGS="$cflags"
done
if test x"$gcincludedir" != xno; then
break;
fi
done
if test x"$gcincludedir" = xno; then
AC_MSG_ERROR([gc/gc.h not found])
fi
else
cflags="$CFLAGS -DUSE_GC=1"
CFLAGS="$cflags"
fi
unset ac_cv_lib_gc_GC_init
AC_CHECK_LIB(gc, GC_init, [LIBS="$LIBS -lgc"])
if test x"$ac_cv_lib_gc_GC_init" = xno; then
AC_MSG_CHECKING(GC library location)
AC_MSG_RESULT($with_gc)
gclibdir=no
for dir in $with_gc; do
ldflags="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$dir/lib"
AC_MSG_CHECKING($dir)
unset ac_cv_lib_gc_GC_init
AC_CHECK_LIB(gc, GC_init, [gclibdir="$dir/lib"; LIBS="$LIBS -L$dir/lib -lgc"; break])
LDFLAGS="$ldflags"
done
if test x"$gclibdir" = xno; then
AC_MSG_ERROR([libgc not found])
fi
fi
fi])
# getopt.m4 serial 6
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# The getopt module assume you want GNU getopt, with getopt_long etc,
# rather than vanilla POSIX getopt. This means your your code should
# always include <getopt.h> for the getopt prototypes.
AC_DEFUN([CHECK_GETOPT_SUBSTITUTE],
[
GETOPT_H=getopt.h
AC_LIBOBJ([getopt])
AC_LIBOBJ([getopt1])
AC_DEFINE([USE_DM_GETOPT], 1,
[Define if my_getopt should be used instead of the system's getopt.])
USE_DM_GETOPT=1
AC_SUBST([USE_DM_GETOPT])
])
AC_DEFUN([DBMAIL_CHECK_GETOPT],
[
CHECK_PREREQ_GETOPT
if test -z "$GETOPT_H"; then
GETOPT_H=
AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
dnl BSD getopt_long uses an incompatible method to reset option processing,
dnl and (as of 2004-10-15) mishandles optional option-arguments.
AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
if test -n "$GETOPT_H"; then
CHECK_GETOPT_SUBSTITUTE
fi
fi
])
# Prerequisites of lib/getopt*.
AC_DEFUN([CHECK_PREREQ_GETOPT], [:])
#
# socklen_t
# from curl
dnl Check for socklen_t: historically on BSD it is an int, and in
dnl POSIX 1g it is a type of its own, but some platforms use different
dnl types for the argument to getsockopt, getpeername, etc. So we
dnl have to test to find something that will work.
AC_DEFUN([DBMAIL_CHECK_SOCKLEN_T],
[
AC_CHECK_TYPE([socklen_t], ,[
AC_MSG_CHECKING([for socklen_t equivalent])
AC_CACHE_VAL([socklen_t_equiv],
[
# Systems have either "struct sockaddr *" or
# "void *" as the second argument to getpeername
socklen_t_equiv=
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
int getpeername (int, $arg2 *, $t *);
],[
$t len;
getpeername(0,0,&len);
],[
socklen_t_equiv="$t"
break
])
done
done
if test "x$socklen_t_equiv" = x; then
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
fi
])
AC_MSG_RESULT($socklen_t_equiv)
AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv,
[type to use in place of socklen_t if not defined])],
[#include <sys/types.h>
#include <sys/socket.h>])
])
syntax highlighted by Code2HTML, v. 0.9.1