apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr-util/build apu-conf.m4
Date Thu, 29 Nov 2001 10:22:31 GMT
jerenkrantz    01/11/29 02:22:31

  Modified:    build    apu-conf.m4
  Log:
  Clean up the autoconf code for multi-DBM detection
  
  - APU_CHECK_DB1, APU_CHECK_DB185 now set db_version (for consistency)
  - Capitalize APU_CHECK_DB2OR3
  - Make the APU_CHECK_DB2OR3 check go without warnings (check me out)
  - Remove APU_FIND_DB as it only gets called once and is confusing things
  - Change look_for->requested and which_dbm->default_dbm (pedantic)
  - Error out if we don't have the requested DB
  - Move the AC_MSG_ERROR to the point where it errors rather than
    delaying (confusing)
  - Fix the setting of the DBM libraries to be sane
  
  Revision  Changes    Path
  1.18      +69 -68    apr-util/build/apu-conf.m4
  
  Index: apu-conf.m4
  ===================================================================
  RCS file: /home/cvs/apr-util/build/apu-conf.m4,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- apu-conf.m4	2001/11/29 09:07:09	1.17
  +++ apu-conf.m4	2001/11/29 10:22:31	1.18
  @@ -61,7 +61,7 @@
   dnl
   dnl APU_CHECK_DB1: is DB1 present?
   dnl
  -dnl if present: sets apu_have_db=1, db_header, and db_lib
  +dnl if present: sets apu_have_db=1, db_header, db_lib, and db_version
   dnl
   AC_DEFUN(APU_CHECK_DB1,[
   AC_CHECK_HEADER(db1/db.h, [
  @@ -69,12 +69,13 @@
     apu_have_db=1
     db_header=db1/db.h
     db_lib=db1
  +  db_version=1
     ])])])
   
   dnl
   dnl APU_CHECK_DB185: is DB1.85 present?
   dnl
  -dnl if present: sets apu_have_db=1, db_header, and db_lib
  +dnl if present: sets apu_have_db=1, db_header, db_lib, and db_version
   dnl
   AC_DEFUN(APU_CHECK_DB185,[
   AC_CHECK_HEADER(db_185.h, [
  @@ -82,14 +83,15 @@
     apu_have_db=1
     db_header=db_185.h
     db_lib=db1
  +  db_version=185
     ])])])
   
   dnl
  -dnl APU_CHECK_DB2or3: are DB2 or DB3 present?
  +dnl APU_CHECK_DB2OR3: are DB2 or DB3 present?
   dnl
   dnl if present: sets apu_have_db=1, db_header, and db_lib
   dnl
  -AC_DEFUN(APU_CHECK_DB2or3,[
  +AC_DEFUN(APU_CHECK_DB2OR3,[
   AC_CHECK_HEADER(db.h, [
     AC_CHECK_LIB(db2, db_open, [
     apu_have_db=1
  @@ -106,8 +108,9 @@
     apu_save_libs="$LIBS"
     LIBS="$LIBS -ldb"
     AC_TRY_RUN([
  +#include <stdlib.h> /* for exit() */
   #include "db.h"
  -main()
  +int main()
   {
       int major, minor, patch;
       db_version(&major, &minor, &patch);
  @@ -120,34 +123,9 @@
   ])
   
   dnl
  -dnl APU_FIND_DB: find one of the DB libraries to use
  -dnl
  -dnl if found, then which_dbm is set to one of: db1, db185, db2, db3
  -dnl
  -AC_DEFUN(APU_FIND_DB,[
  -  apu_have_db=0
  -  APU_CHECK_DB2or3
  -  if test $apu_have_db = 1; then
  -    APU_CHECK_DB_VSN
  -    which_dbm="db$db_version"
  -  else
  -    APU_CHECK_DB1
  -    if test $apu_have_db = 1; then
  -      which_dbm="db1"
  -    else
  -      APU_CHECK_DB185
  -      if test $apu_have_db = 1; then
  -        which_dbm="db185"
  -      fi
  -    fi
  -  fi
  -])
  -
  -dnl
   dnl APU_CHECK_DBM: see what kind of DBM backend to use for apr_dbm.
   dnl
   AC_DEFUN(APU_CHECK_DBM,[
  -
   apu_use_sdbm=0
   apu_use_gdbm=0
   apu_use_db=0
  @@ -165,96 +143,121 @@
       AC_MSG_ERROR([--with-dbm needs to specify a DBM type to use.
   One of: sdbm, gdbm, db, db1, db185, db2, db3])
     fi
  -  look_for="$withval"
  +  requested="$withval"
   ],[
  -  look_for=default
  +  requested=default
   ])
   
  -apu_have_gdbm=0
   AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1]))
   
  -APU_FIND_DB
  +dnl We're going to try to find the highest version of Berkeley DB supported.
  +APU_CHECK_DB2OR3
  +if test $apu_have_db = 1; then
  +  APU_CHECK_DB_VSN
  +else
  +  APU_CHECK_DB1
  +  if test $apu_have_db != 1; then
  +    APU_CHECK_DB185
  +  fi
  +fi
   
  -case "$look_for" in
  +dnl Yes, it'd be nice if we could collate the output in an order
  +dnl so that the AC_MSG_CHECKING would be output before the actual
  +dnl checks, but it isn't happening now.
  +AC_MSG_CHECKING(for Berkeley DB)
  +if test $apu_have_db = 1; then
  +  AC_MSG_RESULT(found db$db_version)
  +else
  +  AC_MSG_RESULT(not found)
  +fi
  +
  +dnl Note that we may have found db3, but the user wants db1.  So, check
  +dnl explicitly for db1 in this case.  Unfortunately, this means 
  +dnl repeating the DB tests again.  And, the fact that the APU Berkeley
  +dnl DB macros can't have the side-effect of setting LIBS.
  +case "$requested" in
     sdbm)
       apu_use_sdbm=1
  -    which_dbm=sdbm
  +    default_dbm=sdbm
       ;;
     gdbm)
       apu_use_gdbm=1
  -    which_dbm=gdbm
  +    default_dbm=gdbm
       ;;
     db)
       if test $apu_have_db = 1; then
         apu_use_db=1
  -      which_dbm=db
  +      default_dbm=db
       else
  -     look_errmsg="couldn't find berkley DB"
  +      AC_MSG_ERROR(Berkeley db requested, but not found)
       fi
       ;;
     db1)
       apu_have_db=0
       APU_CHECK_DB1
       if test $apu_have_db = 1; then
  -      which_dbm=db1
         apu_use_db=1
  +      default_dbm=db1
  +    else
  +      AC_MSG_ERROR(Berkeley db1 not found)
       fi
       ;;
     db185)
       apu_have_db=0
       APU_CHECK_DB185
       if test $apu_have_db = 1; then
  -      which_dbm=db185
         apu_use_db=1
  +      default_dbm=db185
  +    else
  +      AC_MSG_ERROR(Berkeley db185 not found)
       fi
       ;;
     db2)
       apu_have_db=0
  -    APU_CHECK_DB2or3
  +    APU_CHECK_DB2OR3
       if test $apu_have_db = 1; then
         apu_use_db=1
         APU_CHECK_DB_VSN
         if test "$db_version" = 2; then
  -        which_dbm=db2
  +        default_dbm=db2
         else
  -        look_errmsg="db2 not present (found db3)"
  +        AC_MSG_ERROR([db2 not present (found db3)])
         fi
  +    else
  +      AC_MSG_ERROR([db2 not present])
       fi
       ;;
     db3)
       apu_have_db=0
  -    APU_CHECK_DB2or3
  +    APU_CHECK_DB2OR3
       if test $apu_have_db = 1; then
         apu_use_db=1
         APU_CHECK_DB_VSN
         if test "$db_version" = 3; then
  -        which_dbm=db3
  +        default_dbm=db3
         else
  -        look_errmsg="db3 not present (found db2)"
  +        AC_MSG_ERROR([db3 not present (found db2)])
         fi
  +    else
  +      AC_MSG_ERROR([db3 not present])
       fi
       ;;
     default)
       dnl ### use more sophisticated DBMs for the default?
  -    which_dbm="sdbm (default)"
  +    default_dbm="sdbm (default)"
       apu_use_sdbm=1
       ;;
     *)
  -    look_errmsg="--with-dbm=$look_for is an unknown DBM type.
  -Use one of: sdbm, gdbm, db, db1, db185, db2, db3"
  +    AC_MSG_ERROR([--with-dbm=$look_for is an unknown DBM type.
  +Use one of: sdbm, gdbm, db, db1, db185, db2, db3])
       ;;
   esac
   
  -AC_MSG_CHECKING(for chosen DBM type)
  -if test "$look_for" = "$which_dbm"; then
  -  AC_MSG_RESULT($which_dbm)
  -elif test "$look_for" = "default"; then
  -  AC_MSG_RESULT($which_dbm)
  -elif test -n "$look_errmsg"; then
  -  AC_MSG_ERROR($look_errmsg)
  -else
  -  AC_MSG_ERROR($look_for not present)
  -fi
  +dnl Yes, it'd be nice if we could collate the output in an order
  +dnl so that the AC_MSG_CHECKING would be output before the actual
  +dnl checks, but it isn't happening now.
  +AC_MSG_CHECKING(for default DBM)
  +AC_MSG_RESULT($default_dbm)
   
   AC_SUBST(apu_use_sdbm)
   AC_SUBST(apu_use_gdbm)
  @@ -266,18 +269,16 @@
   AC_SUBST(db_header)
   AC_SUBST(db_version)
   
  +dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
  +dnl we know the library is there.
   if test $apu_have_gdbm = 1; then
  -  lib_save="$LIBS"
  -  LIBS=""
  -  AC_CHECK_LIB(gdbm, gdbm_open)
  -  APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LIBS"
  -  LIBS="$lib_save $LIBS"
  +  APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lgdbm])
  +  APR_ADDTO(LIBS,[-lgdbm])
   fi
   
   if test $apu_have_db = 1; then
  -  dnl ### use AC_CHECK_LIB?
  -  LIBS="$LIBS -l$db_lib"
  -  APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS -l$db_lib"
  +  APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$db_lib])
  +  APR_ADDTO(LIBS,[-l$db_lib])
   fi
   
   ])
  
  
  

Mime
View raw message