⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbm.m4

📁 Apache 2.0.63 is the current stable version of the 2.0 series, and is recommended over any previous
💻 M4
📖 第 1 页 / 共 2 页
字号:
    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
])

AC_DEFUN(APU_CHECK_DB, [
  requested=$1
  check_places=$2

  case "$requested" in
  db)
    APU_CHECK_DB_ALL("$check_places")
    if test "$apu_have_db" = "0"; then
      AC_MSG_ERROR(Berkeley db requested, but not found)
    fi
    ;;
  db1)
    APU_CHECK_DB1("$check_places")
    if test "$apu_db_version" != "1"; then
      AC_MSG_ERROR(Berkeley db1 not found)
    fi
    ;;
  db185)
    APU_CHECK_DB185("$check_places")
    if test "$apu_db_version" != "185"; then
      AC_MSG_ERROR(Berkeley db185 not found)
    fi
    ;;
  db2)
    APU_CHECK_DB2("$check_places")
    if test "$apu_db_version" != "2"; then
      AC_MSG_ERROR(Berkeley db2 not found)
    fi
    ;;
  db3)
    APU_CHECK_DB3("$check_places")
    if test "$apu_db_version" != "3"; then
      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_DB44("$check_places")
    if test "$apu_db_version" != "4"; then
      AC_MSG_ERROR(Berkeley db4 not found)
    fi
    ;;
  default)
    APU_CHECK_DB_ALL("$check_places")
    ;;
  esac
])

dnl
dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 4.3 to 1.
dnl
AC_DEFUN(APU_CHECK_DB_ALL, [
  all_places=$1
 
  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
  AC_MSG_CHECKING(for Berkeley DB)
  if test "$apu_have_db" = "1"; then
    AC_MSG_RESULT(found db$apu_db_version)
  else
    AC_MSG_RESULT(not found)
  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_ndbm=0
  apu_use_gdbm=0
  apu_use_db=0
  dnl it's in our codebase
  apu_have_sdbm=1
  apu_have_gdbm=0
  apu_have_ndbm=0
  apu_have_db=0

  apu_db_header=db.h                # default so apu_select_dbm.h is syntactically correct
  apu_db_version=0

  AC_ARG_WITH(dbm, [
    --with-dbm=DBM          choose the DBM type to use.
      DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db41,db42,db43,db44,db45}
  ], [
    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])
    fi
    requested="$withval"
  ], [
    requested=default
  ])

  dnl We don't pull in GDBM unless the user asks for it, since it's GPL
  AC_ARG_WITH([gdbm], [
    --with-gdbm=DIR          specify GDBM location
  ], [
    apu_have_gdbm=0
    if test "$withval" = "yes"; then
      AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1]))
    elif test "$withval" = "no"; then
      apu_have_gdbm=0
    else
      CPPFLAGS="-I$withval/include"
      LIBS="-L$withval/lib "

      AC_MSG_CHECKING(checking for gdbm in $withval)
      AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1]))
      if test "$apu_have_gdbm" != "0"; then
        APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
        APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
      fi
    fi
  ])

  AC_ARG_WITH([ndbm], [
    --with-ndbm=PATH 
      Find the NDBM header and library in \`PATH/include' and 
      \`PATH/lib'.  If PATH is of the form \`HEADER:LIB', then search 
      for header files in HEADER, and the library in LIB.  If you omit
      the \`=PATH' part completely, the configure script will search
      for NDBM in a number of standard places.
  ], [
    apu_have_ndbm=0
    if test "$withval" = "yes"; then
      AC_MSG_CHECKING(checking for ndbm in the usual places)
      apu_want_ndbm=1
      NDBM_INC=""
      NDBM_LDFLAGS=""
    elif test "$withval" = "no"; then
      apu_want_ndbm=0
    else
      apu_want_ndbm=1
      case "$withval" in
        *":"*)
          NDBM_INC="-I`echo $withval |sed -e 's/:.*$//'`"
          NDBM_LDFLAGS="-L`echo $withval |sed -e 's/^.*://'`"
          AC_MSG_CHECKING(checking for ndbm includes with $NDBM_INC libs with $NDBM_LDFLAGS )
        ;;
        *)
          NDBM_INC="-I$withval/include"
          NDBM_LDFLAGS="-L$withval/lib"
          AC_MSG_CHECKING(checking for ndbm includes in $withval)
        ;;
      esac
    fi

    save_cppflags="$CPPFLAGS"
    save_ldflags="$LDFLAGS"
    CPPFLAGS="$CPPFLAGS $NDBM_INC"
    LDFLAGS="$LDFLAGS $NDBM_LDFLAGS"
    dnl db_ndbm_open is what sleepcat's compatibility library actually has in it's lib
    if test "$apu_want_ndbm" != "0"; then
      AC_CHECK_HEADER(ndbm.h, 
        AC_CHECK_LIB(c, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=c],
          AC_CHECK_LIB(dbm, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=dbm],
            AC_CHECK_LIB(db, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=db],
              AC_CHECK_LIB(db, __db_ndbm_open, [apu_have_ndbm=1;apu_ndbm_lib=db])
            )
          )
        )
      )
      if test "$apu_have_ndbm" != "0";  then
        if test "$withval" != "yes"; then
          APR_ADDTO(APRUTIL_INCLUDES, [$NDBM_INC])
          APR_ADDTO(APRUTIL_LDFLAGS, [$NDBM_LDFLAGS])
        fi
      elif test "$withval" != "yes"; then
        AC_ERROR( NDBM not found in the specified directory)
      fi
    fi
    CPPFLAGS="$save_cppflags"
    LDFLAGS="$save_ldflags"
  ], [
    dnl don't check it no one has asked us for it
    apu_have_ndbm=0
  ])


  if test -n "$apu_db_xtra_libs"; then
    saveddbxtralibs="$LIBS"
    LIBS="$apu_db_xtra_libs $LIBS"
  fi

  dnl We're going to try to find the highest version of Berkeley DB supported.
  dnl
  dnl Note that we only do this if the user requested it, since the Sleepycat
  dnl license is viral and requires distribution of source along with programs
  dnl that use it.
  AC_ARG_WITH([berkeley-db], [
    --with-berkeley-db=PATH
      Find the Berkeley DB header and library in \`PATH/include' and
      \`PATH/lib'.  If PATH is of the form \`HEADER:LIB', then search
      for header files in HEADER, and the library in LIB.  If you omit
      the \`=PATH' part completely, the configure script will search
      for Berkeley DB in a number of standard places.
  ], [
    if test "$withval" = "yes"; then
      apu_want_db=1
      user_places=""
    elif test "$withval" = "no"; then
      apu_want_db=0
    else
      apu_want_db=1
      user_places="$withval"
    fi

    if test "$apu_want_db" != "0"; then
      APU_CHECK_DB($requested, $user_places)
      if test "$apu_have_db" = "0"; then
        AC_ERROR(Berkeley DB not found.)
      fi
    fi 
  ])

  if test -n "$apu_db_xtra_libs"; then
    LIBS="$saveddbxtralibs"
  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
      ;;
    default)
      dnl ### use more sophisticated DBMs for the default?
      apu_default_dbm="sdbm (default)"
      apu_use_sdbm=1
      ;;
    *)
      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])
      ;;
  esac

  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($apu_default_dbm)

  AC_SUBST(apu_use_sdbm)
  AC_SUBST(apu_use_gdbm)
  AC_SUBST(apu_use_ndbm)
  AC_SUBST(apu_use_db)

  AC_SUBST(apu_have_sdbm)
  AC_SUBST(apu_have_gdbm)
  AC_SUBST(apu_have_ndbm)
  AC_SUBST(apu_have_db)
  AC_SUBST(apu_db_header)
  AC_SUBST(apu_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
    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lgdbm])
    APR_ADDTO(APRUTIL_LIBS,[-lgdbm])
  fi

  if test "$apu_have_ndbm" = "1"; then
    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$apu_ndbm_lib])
    APR_ADDTO(APRUTIL_LIBS,[-l$apu_ndbm_lib])
  fi

  if test "$apu_have_db" = "1"; then
    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$apu_db_lib])
    APR_ADDTO(APRUTIL_LIBS,[-l$apu_db_lib])
    if test -n "apu_db_xtra_libs"; then
      APR_ADDTO(APRUTIL_EXPORT_LIBS,[$apu_db_xtra_libs])
      APR_ADDTO(APRUTIL_LIBS,[$apu_db_xtra_libs])
    fi
  fi
])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -