You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rj...@apache.org on 2012/08/10 22:05:00 UTC

svn commit: r1371820 - in /apr/apr-util/branches/1.5.x: ./ CHANGES build/dbm.m4

Author: rjung
Date: Fri Aug 10 20:05:00 2012
New Revision: 1371820

URL: http://svn.apache.org/viewvc?rev=1371820&view=rev
Log:
Add support for Berkeley DB 5.1 and 5.2.
Simplify detection script and remove a lot
of redundant code.

PR 53684.

Backport of 1371818 from trunk.

Modified:
    apr/apr-util/branches/1.5.x/   (props changed)
    apr/apr-util/branches/1.5.x/CHANGES
    apr/apr-util/branches/1.5.x/build/dbm.m4

Propchange: apr/apr-util/branches/1.5.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1371817

Modified: apr/apr-util/branches/1.5.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/CHANGES?rev=1371820&r1=1371819&r2=1371820&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.5.x/CHANGES [utf-8] Fri Aug 10 20:05:00 2012
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.5.1
 
+  *) Add support for Berkeley DB 5.2 and 5.3. Simplify detection skript.
+     PR 53684.  [Rainer Jung]
+
   *) configure: Allow to specify library specific custom linker flags
      via the LDADD_XXX variables. [Rainer Jung]
 

Modified: apr/apr-util/branches/1.5.x/build/dbm.m4
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/build/dbm.m4?rev=1371820&r1=1371819&r2=1371820&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/build/dbm.m4 (original)
+++ apr/apr-util/branches/1.5.x/build/dbm.m4 Fri Aug 10 20:05:00 2012
@@ -367,219 +367,28 @@ AC_DEFUN([APU_CHECK_DB3], [
 
 
 dnl
-dnl APU_CHECK_DB4: is DB4 present?
+dnl APU_CHECK_DBXY: is DBX.Y present?
 dnl
 dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
 dnl
-AC_DEFUN([APU_CHECK_DB4], [
+AC_DEFUN([APU_CHECK_DBXY], [
   places=$1
+  db_major=$2
+  db_minor=$3
   if test -z "$places"; then
-    places="std /usr/local /usr/local/BerkeleyDB.4.0 /boot/home/config"
+    places="std /usr/local /usr/local/BerkeleyDB.${db_major}.${db_minor} /boot/home/config"
   fi
-  APU_CHECK_BERKELEY_DB("4", "0", "-1",
+  APU_CHECK_BERKELEY_DB("${db_major}", "${db_minor}", "-1",
     "$places",
-    "db4/db.h db.h",
-    "db-4.0 db4 db"
+    "db${db_major}${db_minor}/db.h db${db_major}/db.h db.h",
+    "db-${db_major}.${db_minor} db${db_major}-${db_major}.${db_minor} db${db_major}${db_minor} db${db_major} db"
   )
   if test "$apu_have_db" = "1"; then
-    apu_db_version=4
+    apu_db_version=${db_major}
   fi
 ])
 
 
-dnl
-dnl APU_CHECK_DB41: is DB4.1 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB41], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local /usr/local/BerkeleyDB.4.1 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "1", "-1",
-    "$places",
-    "db41/db.h db4/db.h db.h",
-    "db-4.1 db41 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-
-
-dnl
-dnl APU_CHECK_DB42: is DB4.2 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB42], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local /usr/local/BerkeleyDB.4.2 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "2", "-1",
-    "$places",
-    "db42/db.h db4/db.h db.h",
-    "db-4.2 db42 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-dnl
-dnl APU_CHECK_DB43: is DB4.3 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB43], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.4.3 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "3", "-1",
-    "$places",
-    "db43/db.h db4/db.h db.h",
-    "db-4.3 db4-4.3 db43 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-dnl
-dnl APU_CHECK_DB44: is DB4.4 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB44], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.4.4 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "4", "-1",
-    "$places",
-    "db44/db.h db4/db.h db.h",
-    "db-4.4 db4-4.4 db44 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-dnl
-dnl APU_CHECK_DB45: is DB4.5 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB45], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.4.5 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "5", "-1",
-    "$places",
-    "db45/db.h db4/db.h db.h",
-    "db-4.5 db4-4.5 db45 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-dnl
-dnl APU_CHECK_DB46: is DB4.6 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB46], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.4.6 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "6", "-1",
-    "$places",
-    "db46/db.h db4/db.h db.h",
-    "db-4.6 db4-4.6 db46 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-dnl
-dnl APU_CHECK_DB47: is DB4.7 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB47], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.4.7 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "7", "-1",
-    "$places",
-    "db47/db.h db4/db.h db.h",
-    "db-4.7 db4-4.7 db47 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-dnl
-dnl APU_CHECK_DB48: is DB4.8 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB48], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.4.8 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("4", "8", "-1",
-    "$places",
-    "db48/db.h db4/db.h db.h",
-    "db-4.8 db4-4.8 db48 db4 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=4
-  fi
-])
-dnl
-dnl APU_CHECK_DB50: is DB5.0 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB50], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.5.0 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("5", "0", "-1",
-    "$places",
-    "db50/db.h db5/db.h db.h",
-    "db-5.0 db5-5.0 db50 db5 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=5
-  fi
-])
-dnl
-dnl APU_CHECK_DB51: is DB5.1 present?
-dnl
-dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-dnl
-AC_DEFUN([APU_CHECK_DB51], [
-  places=$1
-  if test -z "$places"; then
-    places="std /usr/local/BerkeleyDB.5.1 /boot/home/config"
-  fi
-  APU_CHECK_BERKELEY_DB("5", "1", "-1",
-    "$places",
-    "db51/db.h db5/db.h db.h",
-    "db-5.1 db5-5.1 db51 db5 db"
-  )
-  if test "$apu_have_db" = "1"; then
-    apu_db_version=5
-  fi
-])
-
 AC_DEFUN([APU_CHECK_DB], [
   requested=$1
   check_places=$2
@@ -615,70 +424,12 @@ AC_DEFUN([APU_CHECK_DB], [
       AC_MSG_ERROR(Berkeley db3 not found)
     fi
     ;;
-  db4)
-    APU_CHECK_DB4("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db41)
-    APU_CHECK_DB41("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db42)
-    APU_CHECK_DB42("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db43)
-    APU_CHECK_DB43("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db44)
-    APU_CHECK_DB44("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db45)
-    APU_CHECK_DB45("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db46)
-    APU_CHECK_DB46("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db47)
-    APU_CHECK_DB47("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db48)
-    APU_CHECK_DB48("$check_places")
-    if test "$apu_db_version" != "4"; then
-      AC_MSG_ERROR(Berkeley db4 not found)
-    fi
-    ;;
-  db50)
-    APU_CHECK_DB50("$check_places")
-    if test "$apu_db_version" != "5"; then
-      AC_MSG_ERROR(Berkeley db5 not found)
-    fi
-    ;;
-  db51)
-    APU_CHECK_DB51("$check_places")
-    if test "$apu_db_version" != "5"; then
-      AC_MSG_ERROR(Berkeley db5 not found)
+  db[[45]] | db[[45]][[0-9]])
+    db_major=`echo "$requested" | sed -e 's/db//' -e 's/.$//`
+    db_minor=`echo "$requested" | sed -e 's/db//' -e 's/.//`
+    APU_CHECK_DBXY("$check_places", "$db_major", "$db_minor")
+    if test "$apu_db_version" != "$db_major"; then
+      AC_MSG_ERROR(Berkeley db$db_major not found)
     fi
     ;;
   default)
@@ -688,53 +439,34 @@ AC_DEFUN([APU_CHECK_DB], [
 ])
 
 dnl
-dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 5.1 to 1.
+dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 5.X to 1.
 dnl
 AC_DEFUN([APU_CHECK_DB_ALL], [
   all_places=$1
  
-  APU_CHECK_DB51("$all_places")
-  if test "$apu_db_version" != "5"; then
-    APU_CHECK_DB50("$all_places")
-    if test "$apu_db_version" != "5"; then
-      APU_CHECK_DB48("$all_places")
-      if test "$apu_db_version" != "4"; then
-        APU_CHECK_DB47("$all_places")
-        if test "$apu_db_version" != "4"; then
-          APU_CHECK_DB46("$all_places")
-          if test "$apu_db_version" != "4"; then
-            APU_CHECK_DB45("$all_places")
-            if test "$apu_db_version" != "4"; then
-              APU_CHECK_DB44("$all_places")
-              if test "$apu_db_version" != "4"; then
-                APU_CHECK_DB43("$all_places")
-                if test "$apu_db_version" != "4"; then
-                  APU_CHECK_DB42("$all_places")
-                  if test "$apu_db_version" != "4"; then
-                    APU_CHECK_DB41("$all_places")
-                    if test "$apu_db_version" != "4"; then
-                      APU_CHECK_DB4("$all_places")
-                      if test "$apu_db_version" != "4"; then
-                        APU_CHECK_DB3("$all_places")
-                        if test "$apu_db_version" != "3"; then
-                          APU_CHECK_DB2("$all_places")
-                          if test "$apu_db_version" != "2"; then
-                            APU_CHECK_DB1("$all_places")
-                            if test "$apu_db_version" != "1"; then
-                              APU_CHECK_DB185("$all_places")
-                            fi
-                          fi
-                        fi
-                      fi
-                    fi
-                  fi
-                fi
-              fi
-            fi
-          fi
-        fi
-      fi
-    fi
+  # Start version search at version 5.9
+  version=59
+  while [ $version -ge 40 ]
+  do
+    db_major=`echo $version | sed -e 's/.$//'`
+    db_minor=`echo $version | sed -e 's/.//'`
+    APU_CHECK_DBXY("$all_places", "$db_major", "$db_minor")
+    if test "$apu_have_db" = "1"; then
+      break
+    fi
+    version=`expr $version - 1`
+  done
+  if test "$apu_have_db" = "0"; then
+    APU_CHECK_DB3("$all_places")
+  fi
+  if test "$apu_have_db" = "0"; then
+    APU_CHECK_DB2("$all_places")
+  fi
+  if test "$apu_have_db" = "0"; then
+    APU_CHECK_DB1("$all_places")
+  fi
+  if test "$apu_have_db" = "0"; then
+    APU_CHECK_DB185("$all_places")
   fi
   AC_MSG_CHECKING(for Berkeley DB)
   if test "$apu_have_db" = "1"; then
@@ -762,12 +494,23 @@ AC_DEFUN([APU_CHECK_DBM], [
   apu_db_header=db.h                # default so apu_select_dbm.h is syntactically correct
   apu_db_version=0
 
+  db_max_version=53
+  db_min_version=41
+  dbm_list="sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4"
+  db_version="$db_min_version"
+  while [ $version -ge 41 ]
+  do
+    dbm_list="$dbm_list, db$db_version"
+    version=`expr $version - 1`
+  done
+  dbm_short_list=`echo $dbm_list | sed -e 's/ //g'`
+
   AC_ARG_WITH(dbm, [APR_HELP_STRING([--with-dbm=DBM], [choose the DBM type to use.
-      DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db41,db42,db43,db44,db45,db46,db47,db48,db50,db51}])],
+      DBM={$dbm_short_list}])],
   [
     if test "$withval" = "yes"; then
       AC_MSG_ERROR([--with-dbm needs to specify a DBM type to use.
-        One of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51])
+        One of: $dbm_list])
     fi
     requested="$withval"
   ], [
@@ -902,81 +645,17 @@ AC_DEFUN([APU_CHECK_DBM], [
   fi
 
   case "$requested" in
-    sdbm)
-      apu_use_sdbm=1
-      apu_default_dbm=sdbm
-      ;;
-    gdbm)
-      apu_use_gdbm=1
-      apu_default_dbm=gdbm
-      ;;
-    ndbm)
-      apu_use_ndbm=1
-      apu_default_dbm=ndbm
-      ;;
-    db)
-      apu_use_db=1
-      apu_default_dbm=db
-      ;;
-    db1)
-      apu_use_db=1
-      apu_default_dbm=db1
-      ;;
-    db185)
-      apu_use_db=1
-      apu_default_dbm=db185
-      ;;
-    db2)
-      apu_use_db=1
-      apu_default_dbm=db2
-      ;;
-    db3)
-      apu_use_db=1
-      apu_default_dbm=db3
-      ;;
-    db4)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db41)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db42)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db43)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db44)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db45)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db46)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db47)
-      apu_use_db=1
-      apu_default_dbm=db4
-      ;;
-    db48)
-      apu_use_db=1
-      apu_default_dbm=db4
+    sdbm | gdbm | ndbm | db)
+      eval "apu_use_$requested=1"
+      apu_default_dbm=$requested
       ;;
-    db50)
+    db185 | db[12345])
       apu_use_db=1
-      apu_default_dbm=db5
+      apu_default_dbm=$requested
       ;;
-    db51)
+    db[45][0-9])
       apu_use_db=1
-      apu_default_dbm=db5
+      apu_default_dbm=`echo $requested | sed -e 's/.$//'`
       ;;
     default)
       dnl ### use more sophisticated DBMs for the default?
@@ -985,7 +664,7 @@ AC_DEFUN([APU_CHECK_DBM], [
       ;;
     *)
       AC_MSG_ERROR([--with-dbm=$look_for is an unknown DBM type.
-        Use one of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51])
+        Use one of: $dbm_list])
       ;;
   esac