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

📄 dbm.m4

📁 最新apache的源代码
💻 M4
📖 第 1 页 / 共 2 页
字号:
dnldnl DBM modulednldnl   APU_LIB_BERKELEY_DB(major, minor, patch, places, headers, libnames)dnldnl   Search for a useable version of Berkeley DB in a number ofdnl   common places.  The installed DB must be no older than thednl   version given by MAJOR, MINOR, and PATCH.  All of thesednl   arguments are allowed to be '-1', indicating we don't care.dnl   PLACES is a list of places to search for a Berkeley DBdnl   installation.  HEADERS is a list of headers to try.  LIBNAMESdnl   is a list of names of the library to attempt to link against,dnl   typically 'db' and 'db4'.dnldnl   If we find a useable version, set CPPFLAGS and LIBS asdnl   appropriate, and set the shell variable `apu_have_db' todnl   `1', and apu_db_lib to the matching lib name, and apu_db_headerdnl   to the header to use.  Otherwise, set `apu_have_db' to `0'.dnldnl   This macro also checks for the `--with-berkeley-db=PATH' flag;dnl   if given, the macro will use the PATH specified, and thednl   configuration script will die if it can't find the library.  Ifdnl   the user gives the `--without-berkeley-db' flag, the entirednl   search is skipped.dnldnl   We cache the results of individual searches under particulardnl   prefixes, not the overall result of whether we found Berkeleydnl   DB.  That way, the user can re-run the configure script withdnl   different --with-berkeley-db switch values, without interferencednl   from the cache.AC_DEFUN(APU_CHECK_BERKELEY_DB, [  bdb_version=$1  if test "$2" != "-1"; then    bdb_version="$bdb_version.$2"    if test "$3" != "-1"; then      bdb_version="$bdb_version.$3"    fi  fi  bdb_places=$4  bdb_default_search_headers=$5  bdb_default_search_lib_names=$6  apu_have_db=0  # Save the original values of the flags we tweak.  apu_check_lib_save_libs="$LIBS"  apu_check_lib_save_ldflags="$LDFLAGS"  apu_check_lib_save_cppflags="$CPPFLAGS"  # The variable `found' is the prefix under which we've found  # Berkeley DB, or `not' if we haven't found it anywhere yet.  found=not  for bdb_place in $bdb_places; do    LDFLAGS="$apu_check_lib_save_ldflags"    CPPFLAGS="$apu_check_lib_save_cppflags"    case "$bdb_place" in      "std" )        description="the standard places"      ;;      *":"* )        header="`echo $bdb_place | sed -e 's/:.*$//'`"        lib="`echo $bdb_place | sed -e 's/^.*://'`"        CPPFLAGS="$CPPFLAGS -I$header"        LDFLAGS="$LDFLAGS -L$lib"        description="$header and $lib"      ;;      * )        if test -d $bdb_place; then          LDFLAGS="$LDFLAGS -L$bdb_place/lib"          CPPFLAGS="$CPPFLAGS -I$bdb_place/include"        else          AC_MSG_CHECKING([for Berkeley DB $bdb_version in $bdb_place])          AC_MSG_RESULT([directory not found])          continue        fi        description="$bdb_place"      ;;    esac    # Since there is no AC_MSG_NOTICE in autoconf 2.13, we use this    # trick to display a message instead.    AC_MSG_CHECKING([for Berkeley DB $bdb_version in $description])    AC_MSG_RESULT()    for bdb_libname in $bdb_default_search_lib_names; do      for bdb_header in $bdb_default_search_headers; do        # Clear the header cache variable for each location        changequote(,)        cache_id="`echo ac_cv_header_${bdb_header} \                 | sed -e 's/[^a-zA-Z0-9_]/_/g'`"        changequote([,])        unset $cache_id        AC_CHECK_HEADER([$bdb_header], [          if test "$1" = "3" -o "$1" = "4"; then            # We generate a separate cache variable for each prefix and libname            # we search under.  That way, we avoid caching information that            # changes if the user runs `configure' with a different set of            # switches.            changequote(,)            cache_id="`echo apu_cv_check_berkeley_db_$1_$2_$3_${bdb_header}_${bdb_libname}_in_${bdb_place} \                     | sed -e 's/[^a-zA-Z0-9_]/_/g'`"            changequote([,])            AC_MSG_CHECKING([for -l$bdb_libname])            dnl We can't use AC_CACHE_CHECK here, because that won't print out            dnl the value of the computed cache variable properly.            AC_CACHE_VAL($cache_id,              [                APU_TRY_BERKELEY_DB($1, $2, $3, $bdb_header, $bdb_libname)                eval "$cache_id=$apu_try_berkeley_db"              ])            result="`eval echo '$'$cache_id`"            AC_MSG_RESULT($result)          elif test "$1" = "1"; then            AC_CHECK_LIB($bdb_libname,              dbopen,              [result=yes],              [result=no]            )          elif test "$1" = "2"; then            AC_CHECK_LIB($bdb_libname,              db_open,              [result=yes],              [result=no]            )          fi        ], [result="no"])                # If we found it, no need to search any more.        if test "$result" = "yes"; then          found="$bdb_place"          break        fi      done      test "$found" != "not" && break    done    test "$found" != "not" && break  done  # Restore the original values of the flags we tweak.  LDFLAGS="$apu_check_lib_save_ldflags"  CPPFLAGS="$apu_check_lib_save_cppflags"  case "$found" in  "not")    apu_have_db=0    ;;  "std")    apu_db_header=$bdb_header    apu_db_lib=$bdb_libname    apu_have_db=1    ;;  *":"*)    header="`echo $found | sed -e 's/:.*$//'`"    lib="`echo $found | sed -e 's/^.*://'`"    APR_ADDTO(APRUTIL_INCLUDES, [-I$header])    APR_ADDTO(APRUTIL_LDFLAGS, [-L$lib])    apu_db_header=$bdb_header    apu_db_lib=$bdb_libname    apu_have_db=1    ;;  *)    APR_ADDTO(APRUTIL_INCLUDES, [-I$found/include])    APR_ADDTO(APRUTIL_LDFLAGS, [-L$found/lib])    apu_db_header=$bdb_header    apu_db_lib=$bdb_libname    apu_have_db=1    ;;  esac])dnl   APU_TRY_BERKELEY_DB(major, minor, patch, header, libname)dnldnl   A subroutine of APU_CHECK_BERKELEY_DB.dnldnl   Check that a new-enough version of Berkeley DB is installed.dnl   "New enough" means no older than the version given by MAJOR,dnl   MINOR, and PATCH.  The result of the test is not cached; nodnl   messages are printed.  Use HEADER as the header file to include.dnl   Use LIBNAME as the library to link against.dnl   (e.g. LIBNAME should usually be "db" or "db4".)dnldnl   Set the shell variable `apu_try_berkeley_db' to `yes' if we founddnl   an appropriate version installed, or `no' otherwise.dnldnl   This macro uses the Berkeley DB library function `db_version' todnl   find the version.  If the library installed doesn't have thisdnl   function, then this macro assumes it is too old.dnl   NOTE: This is pretty messed up.  It seems that the FreeBSD port ofdnl   Berkeley DB 4 puts the header file in /usr/local/include/db4, but thednl   database library in /usr/local/lib, as libdb4.[a|so].  There is nodnl   /usr/local/include/db.h.  So if you check for /usr/local first, you'lldnl   get the old header file from /usr/include, and the new library fromdnl   /usr/local/lib.  Disaster.  Thus this test compares the version constantsdnl   in the db.h header with the ones returned by db_version().AC_DEFUN(APU_TRY_BERKELEY_DB,  [    apu_try_berkeley_db_save_libs="$LIBS"    apu_check_berkeley_db_major=$1    apu_check_berkeley_db_minor=$2    apu_check_berkeley_db_patch=$3    apu_try_berkeley_db_header=$4    apu_try_berkeley_db_libname=$5    LIBS="$LIBS -l$apu_try_berkeley_db_libname"    AC_TRY_RUN(      [#include <stdio.h>#include <$apu_try_berkeley_db_header>main (){  int major, minor, patch;  db_version(&major, &minor, &patch);  /* Sanity check: ensure that db.h constants actually match the db library */  if (major != DB_VERSION_MAJOR      || minor != DB_VERSION_MINOR      || patch != DB_VERSION_PATCH)    exit (1);  /* Run-time check:  ensure the library claims to be the correct version. */  if ($apu_check_berkeley_db_major != -1) {    if (major < $apu_check_berkeley_db_major)      exit (1);    if (major > $apu_check_berkeley_db_major)      exit (0);  }  if ($apu_check_berkeley_db_minor != -1) {    if (minor < $apu_check_berkeley_db_minor)      exit (1);    if (minor > $apu_check_berkeley_db_minor)      exit (0);  }  if ($apu_check_berkeley_db_patch == -1      || patch >= $apu_check_berkeley_db_patch)    exit (0);  else    exit (1);}      ],      [apu_try_berkeley_db=yes],      [apu_try_berkeley_db=no],      [apu_try_berkeley_db=yes]    )    LIBS="$apu_try_berkeley_db_save_libs"  ])dnldnl APU_CHECK_DB1: is DB1 present?dnldnl if present: sets apu_db_header, apu_db_lib, and apu_db_versiondnlAC_DEFUN(APU_CHECK_DB1, [  places=$1  if test -z "$places"; then    places="std"  fi  APU_CHECK_BERKELEY_DB(1, 0, 0,    "$places",    "db1/db.h db.h",    "db1"  )  if test "$apu_have_db" = "1"; then    apu_db_version=1  fi])dnldnl APU_CHECK_DB185: is DB1.85 present?dnldnl if present: sets apu_db_header, apu_db_lib, and apu_db_versiondnldnl NB: BerkelyDB v2 and above can be compiled in 1.85 modednl which has a libdb not libdb1 or libdb185AC_DEFUN(APU_CHECK_DB185, [  places=$1  if test -z "$places"; then    places="std"  fi  APU_CHECK_BERKELEY_DB(1, -1, -1,    "$places",    "db_185.h",    "db"  )  if test "$apu_have_db" = "1"; then    apu_db_version=185  fi])dnldnl APU_CHECK_DB2: is DB2 present?dnldnl if present: sets apu_db_header, apu_db_lib, and apu_db_versiondnlAC_DEFUN(APU_CHECK_DB2, [  places=$1  if test -z "$places"; then    places="std"  fi  APU_CHECK_BERKELEY_DB(2, -1, -1,    "$places",    "db2/db.h db.h",    "db2 db"  )  if test "$apu_have_db" = "1"; then    apu_db_version=2  fi])dnldnl APU_CHECK_DB3: is DB3 present?dnldnl if present: sets apu_db_header, apu_db_lib, and apu_db_versiondnlAC_DEFUN(APU_CHECK_DB3, [  places=$1  if test -z "$places"; then    places="std"  fi  APU_CHECK_BERKELEY_DB(3, -1, -1,    "$places",    "db3/db.h db.h",    "db3 db"  )  if test "$apu_have_db" = "1"; then    apu_db_version=3  fi])dnldnl APU_CHECK_DB4: is DB4 present?dnldnl if present: sets apu_db_header, apu_db_lib, and apu_db_versiondnlAC_DEFUN(APU_CHECK_DB4, [  places=$1  if test -z "$places"; then    places="std /usr/local /usr/local/BerkeleyDB.4.0 /boot/home/config"  fi  APU_CHECK_BERKELEY_DB("4", "0", "-1",    "$places",    "db4/db.h db.h",    "db-4.0 db4 db"  )  if test "$apu_have_db" = "1"; then    apu_db_version=4  fi])dnldnl APU_CHECK_DB41: is DB4.1 present?dnldnl if present: sets apu_db_header, apu_db_lib, and apu_db_versiondnlAC_DEFUN(APU_CHECK_DB41, [  places=$1  if test -z "$places"; then    places="std /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 db4 db"  )  if test "$apu_have_db" = "1"; then    apu_db_version=4  fi])dnldnl APU_CHECK_DB42: is DB4.2 present?dnl

⌨️ 快捷键说明

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