Show
Ignore:
Timestamp:
2007-09-08 15:20:47 (16 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Attempt to clean up DB back-end selection

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • configure.ac

    r5204 r5212  
    809809 
    810810dnl -- start cache -- 
    811 AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching]), 
    812 [if test x$enableval = xyes; then 
     811use_qdbm=no 
     812AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], 
     813  [Enable header caching])) 
     814AC_ARG_WITH(qdbm, AC_HELP_STRING([--without-qdbm], 
     815  [Don't use qdbm even if it is available])) 
     816AC_ARG_WITH(gdbm, AC_HELP_STRING([--without-gdbm], 
     817  [Don't use gdbm even if it is available])) 
     818AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb[=DIR]], 
     819  [Use BerkeleyDB4 if gdbm is not available]), ac_bdb_prefix=$withval) 
     820 
     821if test x$enable_hcache = xyes 
     822then 
    813823    AC_DEFINE(USE_HCACHE, 1, [Enable header caching]) 
    814824    MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS hcache.o" 
    815825 
    816826    OLDCPPFLAGS="$CPPFLAGS" 
     827    OLDLDFLAGS="$LDFLAGS" 
    817828    OLDLIBS="$LIBS" 
    818829 
     
    822833    AC_CHECK_PROGS([MD5], [md5 md5sum openssl], [none]) 
    823834 
    824     use_qdbm=no 
    825     AC_ARG_WITH(qdbm, AC_HELP_STRING([--without-qdbm], [Don't use qdbm even if it is available])) 
     835    dnl -- QDBM -- 
    826836    if test "$with_qdbm" != "no" 
    827837    then 
     
    842852      saved_LIBS="$LIBS" 
    843853      AC_CHECK_HEADERS(villa.h) 
    844       AC_CHECK_LIB(qdbm, vlopen, [MUTTLIBS="$MUTTLIBS -lqdbm"; use_qdbm=yes]) 
     854      AC_CHECK_LIB(qdbm, vlopen, 
     855        [MUTTLIBS="$MUTTLIBS -lqdbm" 
     856         AC_DEFINE(HAVE_QDBM, 1, [QDBM Support]) 
     857         use_qdbm=yes], 
     858        [CPPFLAGS="$OLDCPPFLAGS" 
     859         LDFLAGS="$OLDLDFLAGS"]) 
    845860      LIBS="$saved_LIBS" 
    846861      if test -n "$with_qdbm" && test "$use_qdbm" != yes 
     
    850865    fi 
    851866 
    852     AC_ARG_WITH(gdbm, AC_HELP_STRING([--without-gdbm], [Don't use gdbm even if it is available])) 
    853     if test x$with_gdbm != xno && test $use_qdbm != yes; then 
     867    dnl -- GDBM -- 
     868    if test x$with_gdbm != xno && test $use_qdbm != yes 
     869    then 
    854870        if test "$with_gdbm" != "yes" 
    855871        then 
     
    857873          LDFLAGS="$LDFLAGS -L$with_gdbm/lib" 
    858874        fi 
    859         CPPFLAGS="$OLDCPPFLAGS" 
    860         LIBS="$OLDLIBS -lgdbm"; 
     875        saved_LIBS="$LIBS" 
     876        LIBS="$LIBS -lgdbm" 
    861877        AC_CACHE_CHECK(for gdbm_open, ac_cv_gdbmopen,[ 
    862878            ac_cv_gdbmopen=no 
    863879            AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes]) 
    864880        ]) 
     881        LIBS="$saved_LIBS" 
     882        if test "$ac_cv_gdbmopen" = yes 
     883        then 
     884          AC_DEFINE(HAVE_GDBM, 1, [GDBM Support]) 
     885          MUTTLIBS="$MUTTLIBS -lgdbm" 
     886        elif test -n "$with_gdbm" 
     887        then 
     888          AC_MSG_ERROR([GDBM could not be used. Check config.log for details.]) 
     889        fi 
    865890    fi 
    866891 
     892    dnl -- BDB -- 
    867893    ac_bdb_prefix=yes 
    868     AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb[=DIR]], [Use BerkeleyDB4 if gdbm is not available]), 
    869         ac_bdb_prefix=$withval) 
    870894    if test x$ac_bdb_prefix != xno && test x$ac_cv_gdbmopen != xyes && test $use_qdbm != yes; then 
    871895        test x$ac_bdb_prefix = xyes && ac_bdb_prefix="$mutt_cv_prefix /opt/csw/bdb4 /opt /usr/local /usr" 
     
    908932            test x$BDB_LIB != x && break 
    909933        done 
    910         if test x$ac_cv_dbcreate = xyes; then 
     934        if test x$ac_cv_dbcreate = xyes 
     935        then 
    911936            AC_MSG_RESULT(yes) 
     937            CPPFLAGS="$OLDCPPFLAGS -I$BDB_INCLUDE_DIR" 
     938            LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$BDB_LIB" 
     939            AC_DEFINE(HAVE_DB4, 1, [Berkeley DB4 Support]) 
    912940        else 
    913941            AC_MSG_RESULT(no) 
     
    915943    fi 
    916944 
    917     if test "$use_qdbm" = yes; then 
    918         AC_DEFINE(HAVE_QDBM, 1, [QDBM Support]) 
    919     elif test x$ac_cv_gdbmopen = xyes; then 
    920         CPPFLAGS="$OLDCPPFLAGS" 
    921         LIBS="$OLDLIBS -lgdbm"; 
    922         AC_DEFINE(HAVE_GDBM, 1, [GDBM Support]) 
    923     elif test x$ac_cv_dbcreate = xyes; then 
    924         CPPFLAGS="$OLDCPPFLAGS -I$BDB_INCLUDE_DIR" 
    925         LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$BDB_LIB" 
    926         AC_DEFINE(HAVE_DB4, 1, [Berkeley DB4 Support]) 
    927     else 
     945    if test x$use_qdbm != xyes && test x$ac_cv_gdbmopen != xyes && test x$ac_cv_dbcreate != xyes 
     946    then 
    928947        AC_MSG_ERROR([You need QDBM, GDBM or Berkeley DB4 for hcache]) 
    929948    fi 
    930 fi]) 
     949fi 
    931950dnl -- end cache -- 
    932951