diff options
author | aaron <aaron@7b491191-dbf0-0310-aff6-d879d4d69008> | 2006-12-13 09:06:54 +0000 |
---|---|---|
committer | aaron <aaron@7b491191-dbf0-0310-aff6-d879d4d69008> | 2006-12-13 09:06:54 +0000 |
commit | 3dd8a485aa121733630e809c25741f551da02be8 (patch) | |
tree | e8af8480e00bc825f40beda491529c7d1b0467c9 | |
parent | ed9200689f7a59a97171e5dae95137555f13f78f (diff) |
* acinclude.m4, configure.in, Makefile.am, modules/Makefile.am:
Updated tests for libSieve and LDAP headers and libraries (closes bug
#195).
git-svn-id: https://svn.ic-s.nl/svn/dbmail/branches/dbmail_2_2_branch@2395 7b491191-dbf0-0310-aff6-d879d4d69008
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | acinclude.m4 | 345 | ||||
-rw-r--r-- | configure.in | 13 | ||||
-rw-r--r-- | modules/Makefile.am | 5 |
5 files changed, 248 insertions, 124 deletions
@@ -1,3 +1,9 @@ +2006-12-13 Aaron Stone <aaron@serendipity.cx> + + * acinclude.m4, configure.in, Makefile.am, modules/Makefile.am: + Updated tests for libSieve and LDAP headers and libraries (closes bug + #195). + 2006-12-12 Paul J Stevens <paul@nfg.nl> * dm_imaputil.c, dm_imaputil.h, imap4.c, test-scripts/testsearch.imap: diff --git a/Makefile.am b/Makefile.am index c135b8e0..017fc592 100644 --- a/Makefile.am +++ b/Makefile.am @@ -67,8 +67,7 @@ MODULES = dbmodule.c \ sortmodule.c -# CFLAGS -#AM_CFLAGS = -fomit-frame-pointer +AM_CFLAGS = @SIEVEINC@ @LDAPINC@ INCLUDES = -I$(top_srcdir) diff --git a/acinclude.m4 b/acinclude.m4 index 65d2cd79..74416030 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -23,8 +23,8 @@ GMIME: $ac_gmime_libs MYSQL: $MYSQLLIB PGSQL: $PGSQLLIB SQLITE: $SQLITELIB -SIEVE: $SORTLIB -LDAP: $LDAPLIB +SIEVE: $SIEVEINC $SIEVELIB +LDAP: $LDAPINC $LDAPLIB SHARED: $enable_shared STATIC: $enable_static CHECK: $with_check @@ -159,136 +159,259 @@ if test [ "$usesqlite" = "yes" ]; then fi fi ]) + + +dnl Check for Sieve header. +AC_DEFUN([DBMAIL_CHECK_SIEVE_INC],[ + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([[ + #define NULL 0 + #include <sieve2.h>]]), + [$1], + [$2]) +]) +dnl Check for Sieve library. +AC_DEFUN([DBMAIL_CHECK_SIEVE_LIB],[ + AC_LINK_IFELSE( + AC_LANG_PROGRAM([[ + #define NULL 0 + #include <sieve2.h>]]), + [$1], + [$2]) +]) + dnl DBMAIL_SIEVE_CONF dnl check for ldap or sql authentication AC_DEFUN([DBMAIL_SIEVE_CONF], [dnl +WARN=0 -sieveheadername="no" +AC_ARG_WITH(sieve,[ --with-sieve=PATH path to libSieve base directory (e.g. /usr/local or /usr)], + [lookforsieve="$withval"],[lookforsieve="no"]) -AC_MSG_RESULT([checking for sorting configuration]) -AC_ARG_WITH(sieve,[ --with-sieve=PATH full path to libSieve header directory], - sieveheadername="$withval") -SORTALIB="modules/.libs/libsort_null.a" -SORTLTLIB="modules/libsort_null.la" -WARN=0 -if test [ "$sieveheadername" != "no" ]; then - AC_MSG_RESULT([using Sieve sorting]) - AC_DEFINE([SIEVE], 1, [Define if Sieve sorting will be used.]) - # Redefine if there's actually Sieve sorting - SORTALIB="modules/.libs/libsort_sieve.a" - SORTLTLIB="modules/libsort_sieve.la" - if test [ "$sieveheadername" != "yes" ]; then - AC_MSG_CHECKING([for sieve2.h (user supplied)]) - if test [ -r "$sieveheadername/sieve2.h" ]; then - AC_MSG_RESULT([$sieveheadername/sieve2.h]) - SIEVEINC="-I$sieveheadername" - else - AC_MSG_RESULT([not found]) - SIEVEINC="" - sieveheadername="" - AC_MSG_ERROR([ - Unable to find sieve2.h where you specified, try just --with-sieve to - have configure guess]) +dnl Go looking for the Sieve headers and libraries. +if test [ "x$lookforsieve" != "xno" ]; then + + dnl We were given a specific path. Only look there. + if test [ "x$lookforsieve" != "xyes" ]; then + sieveprefixes=$lookforsieve fi - else - AC_MSG_CHECKING([for sieve2.h]) - for sievepaths in $sieveheaderpaths - do - if test [ -r "$sievepaths/sieve2.h" ]; then - SIEVEINC="-I$sievepaths" - AC_MSG_RESULT([$sievepaths/sieve2.h]) - break - fi + + dnl Look for Sieve headers. + AC_MSG_CHECKING([for libSieve headers]) + STOP_LOOKING_FOR_SIEVE="" + while test [ -z $STOP_LOOKING_FOR_SIEVE ]; do + + dnl See if we already have the paths we need in the environment. + dnl ...but only if --with-sieve was given without a specific path. + if test [ "x$lookforsieve" = "xyes" ]; then + DBMAIL_CHECK_SIEVE_INC([SIEVEINC=""], [SIEVEINC="failed"]) + if test [ "x$SIEVEINC" != "xfailed" ]; then + break + fi + fi + + dnl Explicitly test paths from --with-sieve or configure.in + for TEST_PATH in $sieveprefixes; do + TEST_PATH="$TEST_PATH/include" + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -I$TEST_PATH" + DBMAIL_CHECK_SIEVE_INC([SIEVEINC="-I$TEST_PATH"], [SIEVEINC="failed"]) + CFLAGS=$SAVE_CFLAGS + if test [ "x$SIEVEINC" != "xfailed" ]; then + break 2 + fi + done + + STOP_LOOKING_FOR_SIEVE="done" + done + + if test [ "x$SIEVEINC" = "xfailed" ]; then + AC_MSG_ERROR([Could not find libSieve headers.]) + else + AC_MSG_RESULT($SIEVEINC) + fi + + dnl Look for Sieve libraries. + AC_MSG_CHECKING([for libSieve libraries]) + STOP_LOOKING_FOR_SIEVE="" + while test [ -z $STOP_LOOKING_FOR_SIEVE ]; do + + dnl See if we already have the paths we need in the environment. + dnl ...but only if --with-sieve was given without a specific path. + if test [ "x$lookforsieve" = "xyes" ]; then + DBMAIL_CHECK_SIEVE_LIB([SIEVELIB="-lsieve"], [SIEVELIB="failed"]) + if test [ "x$SIEVELIB" != "xfailed" ]; then + break + fi + fi + + dnl Explicitly test paths from --with-sieve or configure.in + for TEST_PATH in $sieveprefixes; do + TEST_PATH="$TEST_PATH/lib" + SAVE_CFLAGS=$CFLAGS + dnl The headers might be in a funny place, so we need to use -Ipath + CFLAGS="$CFLAGS -L$TEST_PATH $SIEVEINC" + DBMAIL_CHECK_SIEVE_LIB([SIEVELIB="-L$TEST_PATH -lsieve"], [SIEVELIB="failed"]) + CFLAGS=$SAVE_CFLAGS + if test [ "x$SIEVELIB" != "xfailed" ]; then + break 2 + fi + done + + STOP_LOOKING_FOR_SIEVE="done" done - if test [ -z "$SIEVEINC" ]; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([ - Unable to locate sieve2.h, try specifying with --with-sieve]) + + if test [ "x$SIEVELIB" = "xfailed" ]; then + AC_MSG_ERROR([Could not find libSieve library.]) + else + AC_MSG_RESULT($SIEVELIB) fi - fi -else - AC_MSG_RESULT([not using any sorting]) fi -]) -dnl DBMAIL_CHECK_SIEVE_LIBS -AC_DEFUN([DBMAIL_CHECK_SIEVE_LIBS], [dnl -# Look for libs needed to link to SIEVE first -if test [ "$sieveheadername" != "no" ]; then - AC_CHECK_LIB(sieve,sieve2_listextensions,[ SORTLIB="-lsieve"], [SORTLIB=""]) - if test [ -z "$SORTLIB" ]; 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 +dnl Found it, set the settings. +if test [ -n $SIEVE_FOUND ]; then + AC_DEFINE([SIEVE], 1, [Define if Sieve sorting will be used.]) + AC_SUBST(SIEVELIB) + AC_SUBST(SIEVEINC) + SORTALIB="modules/.libs/libsort_sieve.a" + SORTLTLIB="modules/libsort_sieve.la" +dnl Never asked for Sieve in the first place. else - SORTLIB="" + SORTALIB="modules/.libs/libsort_null.a" + SORTLTLIB="modules/libsort_null.la" fi ]) - -dnl DBMAIL_AUTH_CONF -dnl check for ldap or sql authentication -AC_DEFUN([DBMAIL_AUTH_CONF], [dnl -authldapheadername="no" -AC_MSG_RESULT([checking for authentication configuration]) -AC_ARG_WITH(auth-ldap,[ --with-auth-ldap=PATH full path to ldap header directory], - authldapheadername="$withval") -AUTHALIB="modules/.libs/libauth_ldap.a" -AUTHLTLIB="modules/libauth_ldap.la" +dnl Check for LDAP header. +AC_DEFUN([DBMAIL_CHECK_LDAP_INC],[ + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([[ + #define NULL 0 + #include <ldap.h>]]), + [$1], + [$2]) +]) +dnl Check for LDAP library. +AC_DEFUN([DBMAIL_CHECK_LDAP_LIB],[ + AC_LINK_IFELSE( + AC_LANG_PROGRAM([[ + #define NULL 0 + #include <ldap.h>]]), + [$1], + [$2]) +]) +dnl DBMAIL_LDAP_CONF +dnl check for ldap or sql authentication +AC_DEFUN([DBMAIL_LDAP_CONF], [dnl WARN=0 -if test [ "$authldapheadername" != "no" ]; then - # --with-auth-ldap was specified - AC_MSG_RESULT([using LDAP authentication]) - dnl CFLAGS="$CFLAGS -DAUTHLDAP" - AC_DEFINE([AUTHLDAP], 1, [Define if LDAP authentication will be used.]) - if test [ "$withval" != "yes" ]; then - AC_MSG_CHECKING([for ldap.h (user supplied)]) - if test [ -r "$authldapheadername/ldap.h" ]; then - AC_MSG_RESULT([$authldapheadername/ldap.h]) - LDAPINC="-I$authldapheadername" - else - 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 - AC_MSG_CHECKING([for ldap.h]) - for ldappath in $ldapheaderpaths; do - if test [ -r "$ldappath/ldap.h" ]; then - LDAPINC="-I$ldappath" - AC_MSG_RESULT([$ldappath/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-auth-ldap]) - fi - fi -else - AUTHALIB="modules/.libs/libauth_sql.a" - AUTHLTLIB="modules/libauth_sql.la" - AC_MSG_RESULT([using SQL authentication]) + +dnl --with-auth-ldap is deprecated as of DBMail 2.2.2 +AC_ARG_WITH(auth-ldap,[ --with-auth-ldap=PATH deprecated, use --with-ldap], + [lookforauthldap="$withval"],[lookforauthldap="no"]) + +AC_ARG_WITH(ldap,[ --with-ldap=PATH path to LDAP base directory (e.g. /usr/local or /usr)], + [lookforldap="$withval"],[lookforldap="no"]) + + +dnl Go looking for the LDAP headers and libraries. +if ( test [ "x$lookforldap" != "xno" ] || test [ "x$lookforauthldap" != "xno" ] ); then + + dnl Support the deprecated --with-auth-ldap per comment above. + if ( test [ "x$lookforauthldap" != "xyes" ] && test [ "x$lookforauthldap" != "xno" ] ); then + lookforldap=$lookforauthldap + fi + + dnl We were given a specific path. Only look there. + if ( test [ "x$lookforldap" != "xyes" ] && test [ "x$lookforldap" != "xno" ] ); then + ldapprefixes=$lookforldap + fi + + dnl Look for LDAP headers. + AC_MSG_CHECKING([for LDAP headers]) + STOP_LOOKING_FOR_LDAP="" + while test [ -z $STOP_LOOKING_FOR_LDAP ]; do + + dnl See if we already have the paths we need in the environment. + dnl ...but only if --with-ldap was given without a specific path. + if ( test [ "x$lookforldap" = "xyes" ] || test [ "x$lookforauthldap" = "xyes" ] ); then + DBMAIL_CHECK_LDAP_INC([LDAPINC=""], [LDAPINC="failed"]) + if test [ "x$LDAPINC" != "xfailed" ]; then + break + fi + fi + + dnl Explicitly test paths from --with-ldap or configure.in + for TEST_PATH in $ldapprefixes; do + TEST_PATH="$TEST_PATH/include" + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -I$TEST_PATH" + DBMAIL_CHECK_LDAP_INC([LDAPINC="-I$TEST_PATH"], [LDAPINC="failed"]) + CFLAGS=$SAVE_CFLAGS + if test [ "x$LDAPINC" != "xfailed" ]; then + break 2 + fi + done + + STOP_LOOKING_FOR_LDAP="done" + done + + if test [ "x$LDAPINC" = "xfailed" ]; then + AC_MSG_ERROR([Could not find LDAP headers.]) + else + AC_MSG_RESULT($LDAPINC) + fi + + dnl Look for LDAP libraries. + AC_MSG_CHECKING([for LDAP libraries]) + STOP_LOOKING_FOR_LDAP="" + while test [ -z $STOP_LOOKING_FOR_LDAP ]; do + + dnl See if we already have the paths we need in the environment. + dnl ...but only if --with-ldap was given without a specific path. + if ( test [ "x$lookforldap" = "xyes" ] || test [ "x$lookforauthldap" = "xyes" ] ); then + DBMAIL_CHECK_LDAP_LIB([LDAPLIB="-lldap"], [LDAPLIB="failed"]) + if test [ "x$LDAPLIB" != "xfailed" ]; then + break + fi + fi + + dnl Explicitly test paths from --with-ldap or configure.in + for TEST_PATH in $ldapprefixes; do + TEST_PATH="$TEST_PATH/lib" + SAVE_CFLAGS=$CFLAGS + dnl The headers might be in a funny place, so we need to use -Ipath + CFLAGS="$CFLAGS -L$TEST_PATH $LDAPINC" + DBMAIL_CHECK_LDAP_LIB([LDAPLIB="-L$TEST_PATH -lldap"], [LDAPLIB="failed"]) + CFLAGS=$SAVE_CFLAGS + if test [ "x$LDAPLIB" != "xfailed" ]; then + break 2 + fi + done + + STOP_LOOKING_FOR_LDAP="done" + done + + if test [ "x$LDAPLIB" = "xfailed" ]; then + AC_MSG_ERROR([Could not find LDAP library.]) + else + AC_MSG_RESULT($LDAPLIB) + fi 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" != "no" ]; 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 +dnl Found it, set the settings. +if test [ -n $LDAP_FOUND ]; then + AC_DEFINE([AUTHLDAP], 1, [Define if LDAP sorting will be used.]) + AC_SUBST(LDAPLIB) + AC_SUBST(LDAPINC) + AUTHALIB="modules/.libs/libauth_ldap.a" + AUTHLTLIB="modules/libauth_ldap.la" +dnl Never asked for LDAP in the first place. else - LDAPLIB="" + AUTHALIB="modules/.libs/libauth_sql.a" + AUTHLTLIB="modules/libauth_sql.la" fi ]) diff --git a/configure.in b/configure.in index cde55220..9249e6fd 100644 --- a/configure.in +++ b/configure.in @@ -28,8 +28,8 @@ pgsqlheaderpaths="/usr/include/pgsql /usr/include /usr/local/include/pgsql \ /usr/freeware/include $HOME/include $HOME/pgsql/include \ /usr/local/pgsql/include /usr/include/postgresql $HOME" -ldapheaderpaths="/usr/include /usr/local/include" -sieveheaderpaths="/usr/include /usr/local/include" +ldapprefixes="/usr /usr/local" +sieveprefixes="/usr /usr/local" AC_DEFINE(_GNU_SOURCE,'','Defined GNU SOURCE') @@ -46,10 +46,8 @@ AM_CONDITIONAL(STATIC, [ test "$enable_static" = "yes" ]) DM_DEFINES DBMAIL_BOTH_SQL_CHECK DBMAIL_CHECK_SQL_LIBS -DBMAIL_AUTH_CONF -DBMAIL_CHECK_LDAP_LIBS +DBMAIL_LDAP_CONF DBMAIL_SIEVE_CONF -DBMAIL_CHECK_SIEVE_LIBS DBMAIL_CHECK_GLIB DBMAIL_CHECK_GMIME DBMAIL_CHECK_GC @@ -84,7 +82,8 @@ AC_SUBST(SQLITELIB) AC_SUBST(SQLITELALIB) AC_SUBST(SQLITELTLIB) -AC_SUBST(SORTLIB) +AC_SUBST(SIEVEINC) +AC_SUBST(SIEVELIB) AC_SUBST(SORTALIB) AC_SUBST(SORTLTLIB) @@ -95,8 +94,6 @@ AC_SUBST(MYSQLINC) AC_SUBST(PGSQLINC) AC_SUBST(SQLITEINC) -AC_SUBST(SIEVEINC) - AC_SUBST(LDAPLIB) AC_SUBST(LDAPINC) diff --git a/modules/Makefile.am b/modules/Makefile.am index fdc82655..444f6e0a 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. INCLUDES = -I$(top_srcdir) -AM_CFLAGS = @MYSQLINC@ @PGSQLINC@ @SQLITEINC@ @LDAPINC@ @SIEVEINC@ -fomit-frame-pointer +AM_CFLAGS = @MYSQLINC@ @PGSQLINC@ @SQLITEINC@ @LDAPINC@ @SIEVEINC@ @@ -58,11 +58,10 @@ endif # This one is always built. libsort_null_la_SOURCES = sortnull.c -libsort_null_la_LIBADD = @SORTLIB@ if SIEVE libsort_sieve_la_SOURCES = sortsieve.c -libsort_sieve_la_LIBADD = @SORTLIB@ +libsort_sieve_la_LIBADD = @SIEVELIB@ endif # This one is always built. |