/ Check-in [457513f2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge the PCACHE2 changes into trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 457513f21f2438c61b1a214716e338a4e3eeaafa
User & Date: drh 2011-11-16 18:08:07
Context
2011-11-16
19:29
Add the sqlite3_db_release_memory() interface and the shrink_memory pragma. check-in: 3f58e7c8 user: drh tags: trunk
18:08
Merge the PCACHE2 changes into trunk. check-in: 457513f2 user: drh tags: trunk
16:23
Remove code made obsolete by the changes to index processing that allow range search on the rowid. check-in: a5418c7f user: drh tags: trunk
2011-11-13
21:44
Add a version number to the sqlite3_pcache_methods2 object. Other PCACHE2 documentation improvements. Closed-Leaf check-in: 9f839ac0 user: drh tags: experimental-pcache
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

    45     45   
    46     46   # C Compile and options for use in building executables that
    47     47   # will run on the target platform.  (BCC and TCC are usually the
    48     48   # same unless your are cross-compiling.)
    49     49   #
    50     50   TCC = cl.exe -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src -fp:precise
    51     51   
           52  +# We always have the _msize function available when using MSVC.
           53  +TCC = $(TCC) -DHAVE_MALLOC_USABLE_SIZE -Dmalloc_usable_size=_msize
           54  +
    52     55   # The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in 
    53     56   # any extension header files by default.  For non-amalgamation
    54     57   # builds, we need to make sure the compiler can find these.
    55     58   #
    56     59   !IF $(USE_AMALGAMATION)==0
    57     60   TCC = $(TCC) -I$(TOP)\ext\fts3
    58     61   TCC = $(TCC) -I$(TOP)\ext\rtree

Changes to config.h.in.

    28     28   #undef HAVE_INTTYPES_H
    29     29   
    30     30   /* Define to 1 if you have the `localtime_r' function. */
    31     31   #undef HAVE_LOCALTIME_R
    32     32   
    33     33   /* Define to 1 if you have the `localtime_s' function. */
    34     34   #undef HAVE_LOCALTIME_S
           35  +
           36  +/* Define to 1 if you have the `malloc_usable_size' function. */
           37  +#undef HAVE_MALLOC_USABLE_SIZE
    35     38   
    36     39   /* Define to 1 if you have the <memory.h> header file. */
    37     40   #undef HAVE_MEMORY_H
    38     41   
    39     42   /* Define to 1 if you have the <stdint.h> header file. */
    40     43   #undef HAVE_STDINT_H
    41     44   

Changes to configure.

     1      1   #! /bin/sh
     2      2   # Guess values for system-dependent variables and create Makefiles.
     3         -# Generated by GNU Autoconf 2.67 for sqlite 3.7.9.
            3  +# Generated by GNU Autoconf 2.68 for sqlite 3.7.9.
     4      4   #
     5      5   #
     6      6   # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
     7      7   # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
     8      8   # Foundation, Inc.
     9      9   #
    10     10   #
................................................................................
    85     85   # We need space, tab and new line, in precisely that order.  Quoting is
    86     86   # there to prevent editors from complaining about space-tab.
    87     87   # (If _AS_PATH_WALK were called with IFS unset, it would disable word
    88     88   # splitting by setting IFS to empty value.)
    89     89   IFS=" ""	$as_nl"
    90     90   
    91     91   # Find who we are.  Look in the path if we contain no directory separator.
           92  +as_myself=
    92     93   case $0 in #((
    93     94     *[\\/]* ) as_myself=$0 ;;
    94     95     *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
    95     96   for as_dir in $PATH
    96     97   do
    97     98     IFS=$as_save_IFS
    98     99     test -z "$as_dir" && as_dir=.
................................................................................
   210    211   IFS=$as_save_IFS
   211    212   
   212    213   
   213    214         if test "x$CONFIG_SHELL" != x; then :
   214    215     # We cannot yet assume a decent shell, so we have to provide a
   215    216   	# neutralization value for shells without unset; and this also
   216    217   	# works around shells that cannot unset nonexistent variables.
          218  +	# Preserve -v and -x to the replacement shell.
   217    219   	BASH_ENV=/dev/null
   218    220   	ENV=/dev/null
   219    221   	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
   220    222   	export CONFIG_SHELL
   221         -	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
          223  +	case $- in # ((((
          224  +	  *v*x* | *x*v* ) as_opts=-vx ;;
          225  +	  *v* ) as_opts=-v ;;
          226  +	  *x* ) as_opts=-x ;;
          227  +	  * ) as_opts= ;;
          228  +	esac
          229  +	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
   222    230   fi
   223    231   
   224    232       if test x$as_have_required = xno; then :
   225    233     $as_echo "$0: This script requires a shell more modern than all"
   226    234     $as_echo "$0: the shells that I found on your system."
   227    235     if test x${ZSH_VERSION+set} = xset ; then
   228    236       $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
................................................................................
  1290   1298       export $ac_envvar ;;
  1291   1299   
  1292   1300     *)
  1293   1301       # FIXME: should be removed in autoconf 3.0.
  1294   1302       $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
  1295   1303       expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
  1296   1304         $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
  1297         -    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
         1305  +    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
  1298   1306       ;;
  1299   1307   
  1300   1308     esac
  1301   1309   done
  1302   1310   
  1303   1311   if test -n "$ac_prev"; then
  1304   1312     ac_option=--`echo $ac_prev | sed 's/_/-/g'`
................................................................................
  1611   1619     done
  1612   1620   fi
  1613   1621   
  1614   1622   test -n "$ac_init_help" && exit $ac_status
  1615   1623   if $ac_init_version; then
  1616   1624     cat <<\_ACEOF
  1617   1625   sqlite configure 3.7.9
  1618         -generated by GNU Autoconf 2.67
         1626  +generated by GNU Autoconf 2.68
  1619   1627   
  1620   1628   Copyright (C) 2010 Free Software Foundation, Inc.
  1621   1629   This configure script is free software; the Free Software Foundation
  1622   1630   gives unlimited permission to copy, distribute and modify it.
  1623   1631   _ACEOF
  1624   1632     exit
  1625   1633   fi
................................................................................
  1657   1665     ac_retval=0
  1658   1666   else
  1659   1667     $as_echo "$as_me: failed program was:" >&5
  1660   1668   sed 's/^/| /' conftest.$ac_ext >&5
  1661   1669   
  1662   1670   	ac_retval=1
  1663   1671   fi
  1664         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         1672  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1665   1673     as_fn_set_status $ac_retval
  1666   1674   
  1667   1675   } # ac_fn_c_try_compile
  1668   1676   
  1669   1677   # ac_fn_c_try_link LINENO
  1670   1678   # -----------------------
  1671   1679   # Try to link conftest.$ac_ext, and return whether this succeeded.
................................................................................
  1703   1711   	ac_retval=1
  1704   1712   fi
  1705   1713     # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
  1706   1714     # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
  1707   1715     # interfere with the next link command; also delete a directory that is
  1708   1716     # left behind by Apple's compiler.  We do this before executing the actions.
  1709   1717     rm -rf conftest.dSYM conftest_ipa8_conftest.oo
  1710         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         1718  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1711   1719     as_fn_set_status $ac_retval
  1712   1720   
  1713   1721   } # ac_fn_c_try_link
  1714   1722   
  1715   1723   # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
  1716   1724   # -------------------------------------------------------
  1717   1725   # Tests whether HEADER exists and can be compiled using the include files in
  1718   1726   # INCLUDES, setting the cache variable VAR accordingly.
  1719   1727   ac_fn_c_check_header_compile ()
  1720   1728   {
  1721   1729     as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  1722   1730     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1723   1731   $as_echo_n "checking for $2... " >&6; }
  1724         -if eval "test \"\${$3+set}\"" = set; then :
         1732  +if eval \${$3+:} false; then :
  1725   1733     $as_echo_n "(cached) " >&6
  1726   1734   else
  1727   1735     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  1728   1736   /* end confdefs.h.  */
  1729   1737   $4
  1730   1738   #include <$2>
  1731   1739   _ACEOF
................................................................................
  1735   1743     eval "$3=no"
  1736   1744   fi
  1737   1745   rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  1738   1746   fi
  1739   1747   eval ac_res=\$$3
  1740   1748   	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1741   1749   $as_echo "$ac_res" >&6; }
  1742         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         1750  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1743   1751   
  1744   1752   } # ac_fn_c_check_header_compile
  1745   1753   
  1746   1754   # ac_fn_c_try_cpp LINENO
  1747   1755   # ----------------------
  1748   1756   # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
  1749   1757   ac_fn_c_try_cpp ()
................................................................................
  1771   1779     ac_retval=0
  1772   1780   else
  1773   1781     $as_echo "$as_me: failed program was:" >&5
  1774   1782   sed 's/^/| /' conftest.$ac_ext >&5
  1775   1783   
  1776   1784       ac_retval=1
  1777   1785   fi
  1778         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         1786  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1779   1787     as_fn_set_status $ac_retval
  1780   1788   
  1781   1789   } # ac_fn_c_try_cpp
  1782   1790   
  1783   1791   # ac_fn_c_try_run LINENO
  1784   1792   # ----------------------
  1785   1793   # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
................................................................................
  1813   1821     $as_echo "$as_me: program exited with status $ac_status" >&5
  1814   1822          $as_echo "$as_me: failed program was:" >&5
  1815   1823   sed 's/^/| /' conftest.$ac_ext >&5
  1816   1824   
  1817   1825          ac_retval=$ac_status
  1818   1826   fi
  1819   1827     rm -rf conftest.dSYM conftest_ipa8_conftest.oo
  1820         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         1828  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1821   1829     as_fn_set_status $ac_retval
  1822   1830   
  1823   1831   } # ac_fn_c_try_run
  1824   1832   
  1825   1833   # ac_fn_c_check_func LINENO FUNC VAR
  1826   1834   # ----------------------------------
  1827   1835   # Tests whether FUNC exists, setting the cache variable VAR accordingly
  1828   1836   ac_fn_c_check_func ()
  1829   1837   {
  1830   1838     as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  1831   1839     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1832   1840   $as_echo_n "checking for $2... " >&6; }
  1833         -if eval "test \"\${$3+set}\"" = set; then :
         1841  +if eval \${$3+:} false; then :
  1834   1842     $as_echo_n "(cached) " >&6
  1835   1843   else
  1836   1844     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  1837   1845   /* end confdefs.h.  */
  1838   1846   /* Define $2 to an innocuous variant, in case <limits.h> declares $2.
  1839   1847      For example, HP-UX 11i <limits.h> declares gettimeofday.  */
  1840   1848   #define $2 innocuous_$2
................................................................................
  1881   1889   fi
  1882   1890   rm -f core conftest.err conftest.$ac_objext \
  1883   1891       conftest$ac_exeext conftest.$ac_ext
  1884   1892   fi
  1885   1893   eval ac_res=\$$3
  1886   1894   	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1887   1895   $as_echo "$ac_res" >&6; }
  1888         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         1896  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1889   1897   
  1890   1898   } # ac_fn_c_check_func
  1891   1899   
  1892   1900   # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
  1893   1901   # -------------------------------------------
  1894   1902   # Tests whether TYPE exists after having included INCLUDES, setting cache
  1895   1903   # variable VAR accordingly.
  1896   1904   ac_fn_c_check_type ()
  1897   1905   {
  1898   1906     as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  1899   1907     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1900   1908   $as_echo_n "checking for $2... " >&6; }
  1901         -if eval "test \"\${$3+set}\"" = set; then :
         1909  +if eval \${$3+:} false; then :
  1902   1910     $as_echo_n "(cached) " >&6
  1903   1911   else
  1904   1912     eval "$3=no"
  1905   1913     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  1906   1914   /* end confdefs.h.  */
  1907   1915   $4
  1908   1916   int
................................................................................
  1935   1943   rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  1936   1944   fi
  1937   1945   rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  1938   1946   fi
  1939   1947   eval ac_res=\$$3
  1940   1948   	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1941   1949   $as_echo "$ac_res" >&6; }
  1942         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         1950  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  1943   1951   
  1944   1952   } # ac_fn_c_check_type
  1945   1953   
  1946   1954   # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
  1947   1955   # -------------------------------------------------------
  1948   1956   # Tests whether HEADER exists, giving a warning if it cannot be compiled using
  1949   1957   # the include files in INCLUDES and setting the cache variable VAR
  1950   1958   # accordingly.
  1951   1959   ac_fn_c_check_header_mongrel ()
  1952   1960   {
  1953   1961     as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  1954         -  if eval "test \"\${$3+set}\"" = set; then :
         1962  +  if eval \${$3+:} false; then :
  1955   1963     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  1956   1964   $as_echo_n "checking for $2... " >&6; }
  1957         -if eval "test \"\${$3+set}\"" = set; then :
         1965  +if eval \${$3+:} false; then :
  1958   1966     $as_echo_n "(cached) " >&6
  1959   1967   fi
  1960   1968   eval ac_res=\$$3
  1961   1969   	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  1962   1970   $as_echo "$ac_res" >&6; }
  1963   1971   else
  1964   1972     # Is the header compilable?
................................................................................
  2013   2021   $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
  2014   2022       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
  2015   2023   $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
  2016   2024       ;;
  2017   2025   esac
  2018   2026     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
  2019   2027   $as_echo_n "checking for $2... " >&6; }
  2020         -if eval "test \"\${$3+set}\"" = set; then :
         2028  +if eval \${$3+:} false; then :
  2021   2029     $as_echo_n "(cached) " >&6
  2022   2030   else
  2023   2031     eval "$3=\$ac_header_compiler"
  2024   2032   fi
  2025   2033   eval ac_res=\$$3
  2026   2034   	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
  2027   2035   $as_echo "$ac_res" >&6; }
  2028   2036   fi
  2029         -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
         2037  +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  2030   2038   
  2031   2039   } # ac_fn_c_check_header_mongrel
  2032   2040   cat >config.log <<_ACEOF
  2033   2041   This file contains any messages produced by compilers while
  2034   2042   running configure, to aid debugging if configure makes a mistake.
  2035   2043   
  2036   2044   It was created by sqlite $as_me 3.7.9, which was
  2037         -generated by GNU Autoconf 2.67.  Invocation command line was
         2045  +generated by GNU Autoconf 2.68.  Invocation command line was
  2038   2046   
  2039   2047     $ $0 $@
  2040   2048   
  2041   2049   _ACEOF
  2042   2050   exec 5>>config.log
  2043   2051   {
  2044   2052   cat <<_ASUNAME
................................................................................
  2288   2296       { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
  2289   2297   $as_echo "$as_me: loading site script $ac_site_file" >&6;}
  2290   2298       sed 's/^/| /' "$ac_site_file" >&5
  2291   2299       . "$ac_site_file" \
  2292   2300         || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  2293   2301   $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  2294   2302   as_fn_error $? "failed to load site script $ac_site_file
  2295         -See \`config.log' for more details" "$LINENO" 5 ; }
         2303  +See \`config.log' for more details" "$LINENO" 5; }
  2296   2304     fi
  2297   2305   done
  2298   2306   
  2299   2307   if test -r "$cache_file"; then
  2300   2308     # Some versions of bash will fail to source /dev/null (special files
  2301   2309     # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
  2302   2310     if test /dev/null != "$cache_file" && test -f "$cache_file"; then
................................................................................
  2452   2460   
  2453   2461   # Make sure we can run config.sub.
  2454   2462   $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
  2455   2463     as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
  2456   2464   
  2457   2465   { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
  2458   2466   $as_echo_n "checking build system type... " >&6; }
  2459         -if test "${ac_cv_build+set}" = set; then :
         2467  +if ${ac_cv_build+:} false; then :
  2460   2468     $as_echo_n "(cached) " >&6
  2461   2469   else
  2462   2470     ac_build_alias=$build_alias
  2463   2471   test "x$ac_build_alias" = x &&
  2464   2472     ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
  2465   2473   test "x$ac_build_alias" = x &&
  2466   2474     as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
................................................................................
  2468   2476     as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
  2469   2477   
  2470   2478   fi
  2471   2479   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
  2472   2480   $as_echo "$ac_cv_build" >&6; }
  2473   2481   case $ac_cv_build in
  2474   2482   *-*-*) ;;
  2475         -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
         2483  +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
  2476   2484   esac
  2477   2485   build=$ac_cv_build
  2478   2486   ac_save_IFS=$IFS; IFS='-'
  2479   2487   set x $ac_cv_build
  2480   2488   shift
  2481   2489   build_cpu=$1
  2482   2490   build_vendor=$2
................................................................................
  2486   2494   build_os=$*
  2487   2495   IFS=$ac_save_IFS
  2488   2496   case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
  2489   2497   
  2490   2498   
  2491   2499   { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
  2492   2500   $as_echo_n "checking host system type... " >&6; }
  2493         -if test "${ac_cv_host+set}" = set; then :
         2501  +if ${ac_cv_host+:} false; then :
  2494   2502     $as_echo_n "(cached) " >&6
  2495   2503   else
  2496   2504     if test "x$host_alias" = x; then
  2497   2505     ac_cv_host=$ac_cv_build
  2498   2506   else
  2499   2507     ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
  2500   2508       as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
................................................................................
  2501   2509   fi
  2502   2510   
  2503   2511   fi
  2504   2512   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
  2505   2513   $as_echo "$ac_cv_host" >&6; }
  2506   2514   case $ac_cv_host in
  2507   2515   *-*-*) ;;
  2508         -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
         2516  +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
  2509   2517   esac
  2510   2518   host=$ac_cv_host
  2511   2519   ac_save_IFS=$IFS; IFS='-'
  2512   2520   set x $ac_cv_host
  2513   2521   shift
  2514   2522   host_cpu=$1
  2515   2523   host_vendor=$2
................................................................................
  2527   2535   ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  2528   2536   ac_compiler_gnu=$ac_cv_c_compiler_gnu
  2529   2537   if test -n "$ac_tool_prefix"; then
  2530   2538     # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
  2531   2539   set dummy ${ac_tool_prefix}gcc; ac_word=$2
  2532   2540   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  2533   2541   $as_echo_n "checking for $ac_word... " >&6; }
  2534         -if test "${ac_cv_prog_CC+set}" = set; then :
         2542  +if ${ac_cv_prog_CC+:} false; then :
  2535   2543     $as_echo_n "(cached) " >&6
  2536   2544   else
  2537   2545     if test -n "$CC"; then
  2538   2546     ac_cv_prog_CC="$CC" # Let the user override the test.
  2539   2547   else
  2540   2548   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  2541   2549   for as_dir in $PATH
................................................................................
  2567   2575   fi
  2568   2576   if test -z "$ac_cv_prog_CC"; then
  2569   2577     ac_ct_CC=$CC
  2570   2578     # Extract the first word of "gcc", so it can be a program name with args.
  2571   2579   set dummy gcc; ac_word=$2
  2572   2580   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  2573   2581   $as_echo_n "checking for $ac_word... " >&6; }
  2574         -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
         2582  +if ${ac_cv_prog_ac_ct_CC+:} false; then :
  2575   2583     $as_echo_n "(cached) " >&6
  2576   2584   else
  2577   2585     if test -n "$ac_ct_CC"; then
  2578   2586     ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  2579   2587   else
  2580   2588   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  2581   2589   for as_dir in $PATH
................................................................................
  2620   2628   
  2621   2629   if test -z "$CC"; then
  2622   2630             if test -n "$ac_tool_prefix"; then
  2623   2631       # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
  2624   2632   set dummy ${ac_tool_prefix}cc; ac_word=$2
  2625   2633   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  2626   2634   $as_echo_n "checking for $ac_word... " >&6; }
  2627         -if test "${ac_cv_prog_CC+set}" = set; then :
         2635  +if ${ac_cv_prog_CC+:} false; then :
  2628   2636     $as_echo_n "(cached) " >&6
  2629   2637   else
  2630   2638     if test -n "$CC"; then
  2631   2639     ac_cv_prog_CC="$CC" # Let the user override the test.
  2632   2640   else
  2633   2641   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  2634   2642   for as_dir in $PATH
................................................................................
  2660   2668     fi
  2661   2669   fi
  2662   2670   if test -z "$CC"; then
  2663   2671     # Extract the first word of "cc", so it can be a program name with args.
  2664   2672   set dummy cc; ac_word=$2
  2665   2673   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  2666   2674   $as_echo_n "checking for $ac_word... " >&6; }
  2667         -if test "${ac_cv_prog_CC+set}" = set; then :
         2675  +if ${ac_cv_prog_CC+:} false; then :
  2668   2676     $as_echo_n "(cached) " >&6
  2669   2677   else
  2670   2678     if test -n "$CC"; then
  2671   2679     ac_cv_prog_CC="$CC" # Let the user override the test.
  2672   2680   else
  2673   2681     ac_prog_rejected=no
  2674   2682   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
................................................................................
  2719   2727     if test -n "$ac_tool_prefix"; then
  2720   2728     for ac_prog in cl.exe
  2721   2729     do
  2722   2730       # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
  2723   2731   set dummy $ac_tool_prefix$ac_prog; ac_word=$2
  2724   2732   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  2725   2733   $as_echo_n "checking for $ac_word... " >&6; }
  2726         -if test "${ac_cv_prog_CC+set}" = set; then :
         2734  +if ${ac_cv_prog_CC+:} false; then :
  2727   2735     $as_echo_n "(cached) " >&6
  2728   2736   else
  2729   2737     if test -n "$CC"; then
  2730   2738     ac_cv_prog_CC="$CC" # Let the user override the test.
  2731   2739   else
  2732   2740   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  2733   2741   for as_dir in $PATH
................................................................................
  2763   2771     ac_ct_CC=$CC
  2764   2772     for ac_prog in cl.exe
  2765   2773   do
  2766   2774     # Extract the first word of "$ac_prog", so it can be a program name with args.
  2767   2775   set dummy $ac_prog; ac_word=$2
  2768   2776   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  2769   2777   $as_echo_n "checking for $ac_word... " >&6; }
  2770         -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
         2778  +if ${ac_cv_prog_ac_ct_CC+:} false; then :
  2771   2779     $as_echo_n "(cached) " >&6
  2772   2780   else
  2773   2781     if test -n "$ac_ct_CC"; then
  2774   2782     ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  2775   2783   else
  2776   2784   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  2777   2785   for as_dir in $PATH
................................................................................
  2818   2826   
  2819   2827   fi
  2820   2828   
  2821   2829   
  2822   2830   test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  2823   2831   $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  2824   2832   as_fn_error $? "no acceptable C compiler found in \$PATH
  2825         -See \`config.log' for more details" "$LINENO" 5 ; }
         2833  +See \`config.log' for more details" "$LINENO" 5; }
  2826   2834   
  2827   2835   # Provide some information about the compiler.
  2828   2836   $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
  2829   2837   set X $ac_compile
  2830   2838   ac_compiler=$2
  2831   2839   for ac_option in --version -v -V -qversion; do
  2832   2840     { { ac_try="$ac_compiler $ac_option >&5"
................................................................................
  2933   2941   $as_echo "no" >&6; }
  2934   2942   $as_echo "$as_me: failed program was:" >&5
  2935   2943   sed 's/^/| /' conftest.$ac_ext >&5
  2936   2944   
  2937   2945   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  2938   2946   $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  2939   2947   as_fn_error 77 "C compiler cannot create executables
  2940         -See \`config.log' for more details" "$LINENO" 5 ; }
         2948  +See \`config.log' for more details" "$LINENO" 5; }
  2941   2949   else
  2942   2950     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  2943   2951   $as_echo "yes" >&6; }
  2944   2952   fi
  2945   2953   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
  2946   2954   $as_echo_n "checking for C compiler default output file name... " >&6; }
  2947   2955   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
................................................................................
  2976   2984       * ) break;;
  2977   2985     esac
  2978   2986   done
  2979   2987   else
  2980   2988     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  2981   2989   $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  2982   2990   as_fn_error $? "cannot compute suffix of executables: cannot compile and link
  2983         -See \`config.log' for more details" "$LINENO" 5 ; }
         2991  +See \`config.log' for more details" "$LINENO" 5; }
  2984   2992   fi
  2985   2993   rm -f conftest conftest$ac_cv_exeext
  2986   2994   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
  2987   2995   $as_echo "$ac_cv_exeext" >&6; }
  2988   2996   
  2989   2997   rm -f conftest.$ac_ext
  2990   2998   EXEEXT=$ac_cv_exeext
................................................................................
  3035   3043       if test "$cross_compiling" = maybe; then
  3036   3044   	cross_compiling=yes
  3037   3045       else
  3038   3046   	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  3039   3047   $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  3040   3048   as_fn_error $? "cannot run C compiled programs.
  3041   3049   If you meant to cross compile, use \`--host'.
  3042         -See \`config.log' for more details" "$LINENO" 5 ; }
         3050  +See \`config.log' for more details" "$LINENO" 5; }
  3043   3051       fi
  3044   3052     fi
  3045   3053   fi
  3046   3054   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
  3047   3055   $as_echo "$cross_compiling" >&6; }
  3048   3056   
  3049   3057   rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
  3050   3058   ac_clean_files=$ac_clean_files_save
  3051   3059   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
  3052   3060   $as_echo_n "checking for suffix of object files... " >&6; }
  3053         -if test "${ac_cv_objext+set}" = set; then :
         3061  +if ${ac_cv_objext+:} false; then :
  3054   3062     $as_echo_n "(cached) " >&6
  3055   3063   else
  3056   3064     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  3057   3065   /* end confdefs.h.  */
  3058   3066   
  3059   3067   int
  3060   3068   main ()
................................................................................
  3087   3095   else
  3088   3096     $as_echo "$as_me: failed program was:" >&5
  3089   3097   sed 's/^/| /' conftest.$ac_ext >&5
  3090   3098   
  3091   3099   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  3092   3100   $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  3093   3101   as_fn_error $? "cannot compute suffix of object files: cannot compile
  3094         -See \`config.log' for more details" "$LINENO" 5 ; }
         3102  +See \`config.log' for more details" "$LINENO" 5; }
  3095   3103   fi
  3096   3104   rm -f conftest.$ac_cv_objext conftest.$ac_ext
  3097   3105   fi
  3098   3106   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
  3099   3107   $as_echo "$ac_cv_objext" >&6; }
  3100   3108   OBJEXT=$ac_cv_objext
  3101   3109   ac_objext=$OBJEXT
  3102   3110   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
  3103   3111   $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
  3104         -if test "${ac_cv_c_compiler_gnu+set}" = set; then :
         3112  +if ${ac_cv_c_compiler_gnu+:} false; then :
  3105   3113     $as_echo_n "(cached) " >&6
  3106   3114   else
  3107   3115     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  3108   3116   /* end confdefs.h.  */
  3109   3117   
  3110   3118   int
  3111   3119   main ()
................................................................................
  3134   3142   else
  3135   3143     GCC=
  3136   3144   fi
  3137   3145   ac_test_CFLAGS=${CFLAGS+set}
  3138   3146   ac_save_CFLAGS=$CFLAGS
  3139   3147   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
  3140   3148   $as_echo_n "checking whether $CC accepts -g... " >&6; }
  3141         -if test "${ac_cv_prog_cc_g+set}" = set; then :
         3149  +if ${ac_cv_prog_cc_g+:} false; then :
  3142   3150     $as_echo_n "(cached) " >&6
  3143   3151   else
  3144   3152     ac_save_c_werror_flag=$ac_c_werror_flag
  3145   3153      ac_c_werror_flag=yes
  3146   3154      ac_cv_prog_cc_g=no
  3147   3155      CFLAGS="-g"
  3148   3156      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
................................................................................
  3212   3220       CFLAGS="-O2"
  3213   3221     else
  3214   3222       CFLAGS=
  3215   3223     fi
  3216   3224   fi
  3217   3225   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
  3218   3226   $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
  3219         -if test "${ac_cv_prog_cc_c89+set}" = set; then :
         3227  +if ${ac_cv_prog_cc_c89+:} false; then :
  3220   3228     $as_echo_n "(cached) " >&6
  3221   3229   else
  3222   3230     ac_cv_prog_cc_c89=no
  3223   3231   ac_save_CC=$CC
  3224   3232   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  3225   3233   /* end confdefs.h.  */
  3226   3234   #include <stdarg.h>
................................................................................
  3309   3317   ac_cpp='$CPP $CPPFLAGS'
  3310   3318   ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  3311   3319   ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  3312   3320   ac_compiler_gnu=$ac_cv_c_compiler_gnu
  3313   3321   
  3314   3322   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
  3315   3323   $as_echo_n "checking for a sed that does not truncate output... " >&6; }
  3316         -if test "${ac_cv_path_SED+set}" = set; then :
         3324  +if ${ac_cv_path_SED+:} false; then :
  3317   3325     $as_echo_n "(cached) " >&6
  3318   3326   else
  3319   3327               ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  3320   3328        for ac_i in 1 2 3 4 5 6 7; do
  3321   3329          ac_script="$ac_script$as_nl$ac_script"
  3322   3330        done
  3323   3331        echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
................................................................................
  3391   3399   
  3392   3400   
  3393   3401   
  3394   3402   
  3395   3403   
  3396   3404   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
  3397   3405   $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
  3398         -if test "${ac_cv_path_GREP+set}" = set; then :
         3406  +if ${ac_cv_path_GREP+:} false; then :
  3399   3407     $as_echo_n "(cached) " >&6
  3400   3408   else
  3401   3409     if test -z "$GREP"; then
  3402   3410     ac_path_GREP_found=false
  3403   3411     # Loop through the user's path and test for each of PROGNAME-LIST
  3404   3412     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  3405   3413   for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
................................................................................
  3454   3462   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
  3455   3463   $as_echo "$ac_cv_path_GREP" >&6; }
  3456   3464    GREP="$ac_cv_path_GREP"
  3457   3465   
  3458   3466   
  3459   3467   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
  3460   3468   $as_echo_n "checking for egrep... " >&6; }
  3461         -if test "${ac_cv_path_EGREP+set}" = set; then :
         3469  +if ${ac_cv_path_EGREP+:} false; then :
  3462   3470     $as_echo_n "(cached) " >&6
  3463   3471   else
  3464   3472     if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
  3465   3473      then ac_cv_path_EGREP="$GREP -E"
  3466   3474      else
  3467   3475        if test -z "$EGREP"; then
  3468   3476     ac_path_EGREP_found=false
................................................................................
  3521   3529   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
  3522   3530   $as_echo "$ac_cv_path_EGREP" >&6; }
  3523   3531    EGREP="$ac_cv_path_EGREP"
  3524   3532   
  3525   3533   
  3526   3534   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
  3527   3535   $as_echo_n "checking for fgrep... " >&6; }
  3528         -if test "${ac_cv_path_FGREP+set}" = set; then :
         3536  +if ${ac_cv_path_FGREP+:} false; then :
  3529   3537     $as_echo_n "(cached) " >&6
  3530   3538   else
  3531   3539     if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
  3532   3540      then ac_cv_path_FGREP="$GREP -F"
  3533   3541      else
  3534   3542        if test -z "$FGREP"; then
  3535   3543     ac_path_FGREP_found=false
................................................................................
  3652   3660   elif test "$with_gnu_ld" = yes; then
  3653   3661     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
  3654   3662   $as_echo_n "checking for GNU ld... " >&6; }
  3655   3663   else
  3656   3664     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
  3657   3665   $as_echo_n "checking for non-GNU ld... " >&6; }
  3658   3666   fi
  3659         -if test "${lt_cv_path_LD+set}" = set; then :
         3667  +if ${lt_cv_path_LD+:} false; then :
  3660   3668     $as_echo_n "(cached) " >&6
  3661   3669   else
  3662   3670     if test -z "$LD"; then
  3663   3671     lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
  3664   3672     for ac_dir in $PATH; do
  3665   3673       IFS="$lt_save_ifs"
  3666   3674       test -z "$ac_dir" && ac_dir=.
................................................................................
  3692   3700   else
  3693   3701     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  3694   3702   $as_echo "no" >&6; }
  3695   3703   fi
  3696   3704   test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
  3697   3705   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
  3698   3706   $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
  3699         -if test "${lt_cv_prog_gnu_ld+set}" = set; then :
         3707  +if ${lt_cv_prog_gnu_ld+:} false; then :
  3700   3708     $as_echo_n "(cached) " >&6
  3701   3709   else
  3702   3710     # I'd rather use --version here, but apparently some GNU lds only accept -v.
  3703   3711   case `$LD -v 2>&1 </dev/null` in
  3704   3712   *GNU* | *'with BFD'*)
  3705   3713     lt_cv_prog_gnu_ld=yes
  3706   3714     ;;
................................................................................
  3719   3727   
  3720   3728   
  3721   3729   
  3722   3730   
  3723   3731   
  3724   3732   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
  3725   3733   $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
  3726         -if test "${lt_cv_path_NM+set}" = set; then :
         3734  +if ${lt_cv_path_NM+:} false; then :
  3727   3735     $as_echo_n "(cached) " >&6
  3728   3736   else
  3729   3737     if test -n "$NM"; then
  3730   3738     # Let the user override the test.
  3731   3739     lt_cv_path_NM="$NM"
  3732   3740   else
  3733   3741     lt_nm_to_check="${ac_tool_prefix}nm"
................................................................................
  3779   3787     if test -n "$ac_tool_prefix"; then
  3780   3788     for ac_prog in "dumpbin -symbols" "link -dump -symbols"
  3781   3789     do
  3782   3790       # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
  3783   3791   set dummy $ac_tool_prefix$ac_prog; ac_word=$2
  3784   3792   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  3785   3793   $as_echo_n "checking for $ac_word... " >&6; }
  3786         -if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
         3794  +if ${ac_cv_prog_DUMPBIN+:} false; then :
  3787   3795     $as_echo_n "(cached) " >&6
  3788   3796   else
  3789   3797     if test -n "$DUMPBIN"; then
  3790   3798     ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
  3791   3799   else
  3792   3800   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  3793   3801   for as_dir in $PATH
................................................................................
  3823   3831     ac_ct_DUMPBIN=$DUMPBIN
  3824   3832     for ac_prog in "dumpbin -symbols" "link -dump -symbols"
  3825   3833   do
  3826   3834     # Extract the first word of "$ac_prog", so it can be a program name with args.
  3827   3835   set dummy $ac_prog; ac_word=$2
  3828   3836   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  3829   3837   $as_echo_n "checking for $ac_word... " >&6; }
  3830         -if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
         3838  +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
  3831   3839     $as_echo_n "(cached) " >&6
  3832   3840   else
  3833   3841     if test -n "$ac_ct_DUMPBIN"; then
  3834   3842     ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
  3835   3843   else
  3836   3844   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  3837   3845   for as_dir in $PATH
................................................................................
  3886   3894   
  3887   3895   
  3888   3896   
  3889   3897   
  3890   3898   
  3891   3899   { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
  3892   3900   $as_echo_n "checking the name lister ($NM) interface... " >&6; }
  3893         -if test "${lt_cv_nm_interface+set}" = set; then :
         3901  +if ${lt_cv_nm_interface+:} false; then :
  3894   3902     $as_echo_n "(cached) " >&6
  3895   3903   else
  3896   3904     lt_cv_nm_interface="BSD nm"
  3897   3905     echo "int some_variable = 0;" > conftest.$ac_ext
  3898         -  (eval echo "\"\$as_me:3898: $ac_compile\"" >&5)
         3906  +  (eval echo "\"\$as_me:3906: $ac_compile\"" >&5)
  3899   3907     (eval "$ac_compile" 2>conftest.err)
  3900   3908     cat conftest.err >&5
  3901         -  (eval echo "\"\$as_me:3901: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
         3909  +  (eval echo "\"\$as_me:3909: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
  3902   3910     (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
  3903   3911     cat conftest.err >&5
  3904         -  (eval echo "\"\$as_me:3904: output\"" >&5)
         3912  +  (eval echo "\"\$as_me:3912: output\"" >&5)
  3905   3913     cat conftest.out >&5
  3906   3914     if $GREP 'External.*some_variable' conftest.out > /dev/null; then
  3907   3915       lt_cv_nm_interface="MS dumpbin"
  3908   3916     fi
  3909   3917     rm -f conftest*
  3910   3918   fi
  3911   3919   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
................................................................................
  3921   3929     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
  3922   3930   $as_echo "no, using $LN_S" >&6; }
  3923   3931   fi
  3924   3932   
  3925   3933   # find the maximum length of command line arguments
  3926   3934   { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
  3927   3935   $as_echo_n "checking the maximum length of command line arguments... " >&6; }
  3928         -if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
         3936  +if ${lt_cv_sys_max_cmd_len+:} false; then :
  3929   3937     $as_echo_n "(cached) " >&6
  3930   3938   else
  3931   3939       i=0
  3932   3940     teststring="ABCD"
  3933   3941   
  3934   3942     case $build_os in
  3935   3943     msdosdjgpp*)
................................................................................
  4113   4121   
  4114   4122   
  4115   4123   
  4116   4124   
  4117   4125   
  4118   4126   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
  4119   4127   $as_echo_n "checking for $LD option to reload object files... " >&6; }
  4120         -if test "${lt_cv_ld_reload_flag+set}" = set; then :
         4128  +if ${lt_cv_ld_reload_flag+:} false; then :
  4121   4129     $as_echo_n "(cached) " >&6
  4122   4130   else
  4123   4131     lt_cv_ld_reload_flag='-r'
  4124   4132   fi
  4125   4133   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
  4126   4134   $as_echo "$lt_cv_ld_reload_flag" >&6; }
  4127   4135   reload_flag=$lt_cv_ld_reload_flag
................................................................................
  4149   4157   
  4150   4158   
  4151   4159   if test -n "$ac_tool_prefix"; then
  4152   4160     # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
  4153   4161   set dummy ${ac_tool_prefix}objdump; ac_word=$2
  4154   4162   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4155   4163   $as_echo_n "checking for $ac_word... " >&6; }
  4156         -if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
         4164  +if ${ac_cv_prog_OBJDUMP+:} false; then :
  4157   4165     $as_echo_n "(cached) " >&6
  4158   4166   else
  4159   4167     if test -n "$OBJDUMP"; then
  4160   4168     ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
  4161   4169   else
  4162   4170   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4163   4171   for as_dir in $PATH
................................................................................
  4189   4197   fi
  4190   4198   if test -z "$ac_cv_prog_OBJDUMP"; then
  4191   4199     ac_ct_OBJDUMP=$OBJDUMP
  4192   4200     # Extract the first word of "objdump", so it can be a program name with args.
  4193   4201   set dummy objdump; ac_word=$2
  4194   4202   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4195   4203   $as_echo_n "checking for $ac_word... " >&6; }
  4196         -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
         4204  +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
  4197   4205     $as_echo_n "(cached) " >&6
  4198   4206   else
  4199   4207     if test -n "$ac_ct_OBJDUMP"; then
  4200   4208     ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
  4201   4209   else
  4202   4210   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4203   4211   for as_dir in $PATH
................................................................................
  4248   4256   
  4249   4257   
  4250   4258   
  4251   4259   
  4252   4260   
  4253   4261   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
  4254   4262   $as_echo_n "checking how to recognize dependent libraries... " >&6; }
  4255         -if test "${lt_cv_deplibs_check_method+set}" = set; then :
         4263  +if ${lt_cv_deplibs_check_method+:} false; then :
  4256   4264     $as_echo_n "(cached) " >&6
  4257   4265   else
  4258   4266     lt_cv_file_magic_cmd='$MAGIC_CMD'
  4259   4267   lt_cv_file_magic_test_file=
  4260   4268   lt_cv_deplibs_check_method='unknown'
  4261   4269   # Need to set the preceding variable on all platforms that support
  4262   4270   # interlibrary dependencies.
................................................................................
  4464   4472   
  4465   4473   
  4466   4474   if test -n "$ac_tool_prefix"; then
  4467   4475     # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
  4468   4476   set dummy ${ac_tool_prefix}ar; ac_word=$2
  4469   4477   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4470   4478   $as_echo_n "checking for $ac_word... " >&6; }
  4471         -if test "${ac_cv_prog_AR+set}" = set; then :
         4479  +if ${ac_cv_prog_AR+:} false; then :
  4472   4480     $as_echo_n "(cached) " >&6
  4473   4481   else
  4474   4482     if test -n "$AR"; then
  4475   4483     ac_cv_prog_AR="$AR" # Let the user override the test.
  4476   4484   else
  4477   4485   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4478   4486   for as_dir in $PATH
................................................................................
  4504   4512   fi
  4505   4513   if test -z "$ac_cv_prog_AR"; then
  4506   4514     ac_ct_AR=$AR
  4507   4515     # Extract the first word of "ar", so it can be a program name with args.
  4508   4516   set dummy ar; ac_word=$2
  4509   4517   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4510   4518   $as_echo_n "checking for $ac_word... " >&6; }
  4511         -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
         4519  +if ${ac_cv_prog_ac_ct_AR+:} false; then :
  4512   4520     $as_echo_n "(cached) " >&6
  4513   4521   else
  4514   4522     if test -n "$ac_ct_AR"; then
  4515   4523     ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
  4516   4524   else
  4517   4525   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4518   4526   for as_dir in $PATH
................................................................................
  4569   4577   
  4570   4578   
  4571   4579   if test -n "$ac_tool_prefix"; then
  4572   4580     # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
  4573   4581   set dummy ${ac_tool_prefix}strip; ac_word=$2
  4574   4582   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4575   4583   $as_echo_n "checking for $ac_word... " >&6; }
  4576         -if test "${ac_cv_prog_STRIP+set}" = set; then :
         4584  +if ${ac_cv_prog_STRIP+:} false; then :
  4577   4585     $as_echo_n "(cached) " >&6
  4578   4586   else
  4579   4587     if test -n "$STRIP"; then
  4580   4588     ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
  4581   4589   else
  4582   4590   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4583   4591   for as_dir in $PATH
................................................................................
  4609   4617   fi
  4610   4618   if test -z "$ac_cv_prog_STRIP"; then
  4611   4619     ac_ct_STRIP=$STRIP
  4612   4620     # Extract the first word of "strip", so it can be a program name with args.
  4613   4621   set dummy strip; ac_word=$2
  4614   4622   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4615   4623   $as_echo_n "checking for $ac_word... " >&6; }
  4616         -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
         4624  +if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
  4617   4625     $as_echo_n "(cached) " >&6
  4618   4626   else
  4619   4627     if test -n "$ac_ct_STRIP"; then
  4620   4628     ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
  4621   4629   else
  4622   4630   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4623   4631   for as_dir in $PATH
................................................................................
  4668   4676   
  4669   4677   
  4670   4678   if test -n "$ac_tool_prefix"; then
  4671   4679     # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  4672   4680   set dummy ${ac_tool_prefix}ranlib; ac_word=$2
  4673   4681   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4674   4682   $as_echo_n "checking for $ac_word... " >&6; }
  4675         -if test "${ac_cv_prog_RANLIB+set}" = set; then :
         4683  +if ${ac_cv_prog_RANLIB+:} false; then :
  4676   4684     $as_echo_n "(cached) " >&6
  4677   4685   else
  4678   4686     if test -n "$RANLIB"; then
  4679   4687     ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  4680   4688   else
  4681   4689   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4682   4690   for as_dir in $PATH
................................................................................
  4708   4716   fi
  4709   4717   if test -z "$ac_cv_prog_RANLIB"; then
  4710   4718     ac_ct_RANLIB=$RANLIB
  4711   4719     # Extract the first word of "ranlib", so it can be a program name with args.
  4712   4720   set dummy ranlib; ac_word=$2
  4713   4721   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  4714   4722   $as_echo_n "checking for $ac_word... " >&6; }
  4715         -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
         4723  +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
  4716   4724     $as_echo_n "(cached) " >&6
  4717   4725   else
  4718   4726     if test -n "$ac_ct_RANLIB"; then
  4719   4727     ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
  4720   4728   else
  4721   4729   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  4722   4730   for as_dir in $PATH
................................................................................
  4825   4833   # Allow CC to be a program name with arguments.
  4826   4834   compiler=$CC
  4827   4835   
  4828   4836   
  4829   4837   # Check for command to grab the raw symbol name followed by C symbol from nm.
  4830   4838   { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
  4831   4839   $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
  4832         -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
         4840  +if ${lt_cv_sys_global_symbol_pipe+:} false; then :
  4833   4841     $as_echo_n "(cached) " >&6
  4834   4842   else
  4835   4843   
  4836   4844   # These are sane defaults that work on at least a few old systems.
  4837   4845   # [They come from Ultrix.  What could be older than Ultrix?!! ;)]
  4838   4846   
  4839   4847   # Character class describing NM global symbol codes.
................................................................................
  5103   5111   	;;
  5104   5112       esac
  5105   5113     fi
  5106   5114     rm -rf conftest*
  5107   5115     ;;
  5108   5116   *-*-irix6*)
  5109   5117     # Find out which ABI we are using.
  5110         -  echo '#line 5110 "configure"' > conftest.$ac_ext
         5118  +  echo '#line 5118 "configure"' > conftest.$ac_ext
  5111   5119     if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
  5112   5120     (eval $ac_compile) 2>&5
  5113   5121     ac_status=$?
  5114   5122     $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  5115   5123     test $ac_status = 0; }; then
  5116   5124       if test "$lt_cv_prog_gnu_ld" = yes; then
  5117   5125         case `/usr/bin/file conftest.$ac_objext` in
................................................................................
  5197   5205   
  5198   5206   *-*-sco3.2v5*)
  5199   5207     # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  5200   5208     SAVE_CFLAGS="$CFLAGS"
  5201   5209     CFLAGS="$CFLAGS -belf"
  5202   5210     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
  5203   5211   $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
  5204         -if test "${lt_cv_cc_needs_belf+set}" = set; then :
         5212  +if ${lt_cv_cc_needs_belf+:} false; then :
  5205   5213     $as_echo_n "(cached) " >&6
  5206   5214   else
  5207   5215     ac_ext=c
  5208   5216   ac_cpp='$CPP $CPPFLAGS'
  5209   5217   ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  5210   5218   ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  5211   5219   ac_compiler_gnu=$ac_cv_c_compiler_gnu
................................................................................
  5273   5281     case $host_os in
  5274   5282       rhapsody* | darwin*)
  5275   5283       if test -n "$ac_tool_prefix"; then
  5276   5284     # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
  5277   5285   set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
  5278   5286   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5279   5287   $as_echo_n "checking for $ac_word... " >&6; }
  5280         -if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
         5288  +if ${ac_cv_prog_DSYMUTIL+:} false; then :
  5281   5289     $as_echo_n "(cached) " >&6
  5282   5290   else
  5283   5291     if test -n "$DSYMUTIL"; then
  5284   5292     ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
  5285   5293   else
  5286   5294   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5287   5295   for as_dir in $PATH
................................................................................
  5313   5321   fi
  5314   5322   if test -z "$ac_cv_prog_DSYMUTIL"; then
  5315   5323     ac_ct_DSYMUTIL=$DSYMUTIL
  5316   5324     # Extract the first word of "dsymutil", so it can be a program name with args.
  5317   5325   set dummy dsymutil; ac_word=$2
  5318   5326   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5319   5327   $as_echo_n "checking for $ac_word... " >&6; }
  5320         -if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
         5328  +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
  5321   5329     $as_echo_n "(cached) " >&6
  5322   5330   else
  5323   5331     if test -n "$ac_ct_DSYMUTIL"; then
  5324   5332     ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
  5325   5333   else
  5326   5334   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5327   5335   for as_dir in $PATH
................................................................................
  5365   5373   fi
  5366   5374   
  5367   5375       if test -n "$ac_tool_prefix"; then
  5368   5376     # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
  5369   5377   set dummy ${ac_tool_prefix}nmedit; ac_word=$2
  5370   5378   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5371   5379   $as_echo_n "checking for $ac_word... " >&6; }
  5372         -if test "${ac_cv_prog_NMEDIT+set}" = set; then :
         5380  +if ${ac_cv_prog_NMEDIT+:} false; then :
  5373   5381     $as_echo_n "(cached) " >&6
  5374   5382   else
  5375   5383     if test -n "$NMEDIT"; then
  5376   5384     ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
  5377   5385   else
  5378   5386   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5379   5387   for as_dir in $PATH
................................................................................
  5405   5413   fi
  5406   5414   if test -z "$ac_cv_prog_NMEDIT"; then
  5407   5415     ac_ct_NMEDIT=$NMEDIT
  5408   5416     # Extract the first word of "nmedit", so it can be a program name with args.
  5409   5417   set dummy nmedit; ac_word=$2
  5410   5418   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5411   5419   $as_echo_n "checking for $ac_word... " >&6; }
  5412         -if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
         5420  +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
  5413   5421     $as_echo_n "(cached) " >&6
  5414   5422   else
  5415   5423     if test -n "$ac_ct_NMEDIT"; then
  5416   5424     ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
  5417   5425   else
  5418   5426   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5419   5427   for as_dir in $PATH
................................................................................
  5457   5465   fi
  5458   5466   
  5459   5467       if test -n "$ac_tool_prefix"; then
  5460   5468     # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
  5461   5469   set dummy ${ac_tool_prefix}lipo; ac_word=$2
  5462   5470   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5463   5471   $as_echo_n "checking for $ac_word... " >&6; }
  5464         -if test "${ac_cv_prog_LIPO+set}" = set; then :
         5472  +if ${ac_cv_prog_LIPO+:} false; then :
  5465   5473     $as_echo_n "(cached) " >&6
  5466   5474   else
  5467   5475     if test -n "$LIPO"; then
  5468   5476     ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
  5469   5477   else
  5470   5478   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5471   5479   for as_dir in $PATH
................................................................................
  5497   5505   fi
  5498   5506   if test -z "$ac_cv_prog_LIPO"; then
  5499   5507     ac_ct_LIPO=$LIPO
  5500   5508     # Extract the first word of "lipo", so it can be a program name with args.
  5501   5509   set dummy lipo; ac_word=$2
  5502   5510   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5503   5511   $as_echo_n "checking for $ac_word... " >&6; }
  5504         -if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
         5512  +if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
  5505   5513     $as_echo_n "(cached) " >&6
  5506   5514   else
  5507   5515     if test -n "$ac_ct_LIPO"; then
  5508   5516     ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
  5509   5517   else
  5510   5518   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5511   5519   for as_dir in $PATH
................................................................................
  5549   5557   fi
  5550   5558   
  5551   5559       if test -n "$ac_tool_prefix"; then
  5552   5560     # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
  5553   5561   set dummy ${ac_tool_prefix}otool; ac_word=$2
  5554   5562   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5555   5563   $as_echo_n "checking for $ac_word... " >&6; }
  5556         -if test "${ac_cv_prog_OTOOL+set}" = set; then :
         5564  +if ${ac_cv_prog_OTOOL+:} false; then :
  5557   5565     $as_echo_n "(cached) " >&6
  5558   5566   else
  5559   5567     if test -n "$OTOOL"; then
  5560   5568     ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
  5561   5569   else
  5562   5570   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5563   5571   for as_dir in $PATH
................................................................................
  5589   5597   fi
  5590   5598   if test -z "$ac_cv_prog_OTOOL"; then
  5591   5599     ac_ct_OTOOL=$OTOOL
  5592   5600     # Extract the first word of "otool", so it can be a program name with args.
  5593   5601   set dummy otool; ac_word=$2
  5594   5602   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5595   5603   $as_echo_n "checking for $ac_word... " >&6; }
  5596         -if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
         5604  +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
  5597   5605     $as_echo_n "(cached) " >&6
  5598   5606   else
  5599   5607     if test -n "$ac_ct_OTOOL"; then
  5600   5608     ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
  5601   5609   else
  5602   5610   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5603   5611   for as_dir in $PATH
................................................................................
  5641   5649   fi
  5642   5650   
  5643   5651       if test -n "$ac_tool_prefix"; then
  5644   5652     # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
  5645   5653   set dummy ${ac_tool_prefix}otool64; ac_word=$2
  5646   5654   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5647   5655   $as_echo_n "checking for $ac_word... " >&6; }
  5648         -if test "${ac_cv_prog_OTOOL64+set}" = set; then :
         5656  +if ${ac_cv_prog_OTOOL64+:} false; then :
  5649   5657     $as_echo_n "(cached) " >&6
  5650   5658   else
  5651   5659     if test -n "$OTOOL64"; then
  5652   5660     ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
  5653   5661   else
  5654   5662   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5655   5663   for as_dir in $PATH
................................................................................
  5681   5689   fi
  5682   5690   if test -z "$ac_cv_prog_OTOOL64"; then
  5683   5691     ac_ct_OTOOL64=$OTOOL64
  5684   5692     # Extract the first word of "otool64", so it can be a program name with args.
  5685   5693   set dummy otool64; ac_word=$2
  5686   5694   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  5687   5695   $as_echo_n "checking for $ac_word... " >&6; }
  5688         -if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
         5696  +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
  5689   5697     $as_echo_n "(cached) " >&6
  5690   5698   else
  5691   5699     if test -n "$ac_ct_OTOOL64"; then
  5692   5700     ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
  5693   5701   else
  5694   5702   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  5695   5703   for as_dir in $PATH
................................................................................
  5756   5764   
  5757   5765   
  5758   5766   
  5759   5767   
  5760   5768   
  5761   5769       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
  5762   5770   $as_echo_n "checking for -single_module linker flag... " >&6; }
  5763         -if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
         5771  +if ${lt_cv_apple_cc_single_mod+:} false; then :
  5764   5772     $as_echo_n "(cached) " >&6
  5765   5773   else
  5766   5774     lt_cv_apple_cc_single_mod=no
  5767   5775         if test -z "${LT_MULTI_MODULE}"; then
  5768   5776   	# By default we will add the -single_module flag. You can override
  5769   5777   	# by either setting the environment variable LT_MULTI_MODULE
  5770   5778   	# non-empty at configure time, or by adding -multi_module to the
................................................................................
  5785   5793   	rm -f conftest.*
  5786   5794         fi
  5787   5795   fi
  5788   5796   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
  5789   5797   $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
  5790   5798       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
  5791   5799   $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
  5792         -if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
         5800  +if ${lt_cv_ld_exported_symbols_list+:} false; then :
  5793   5801     $as_echo_n "(cached) " >&6
  5794   5802   else
  5795   5803     lt_cv_ld_exported_symbols_list=no
  5796   5804         save_LDFLAGS=$LDFLAGS
  5797   5805         echo "_main" > conftest.sym
  5798   5806         LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
  5799   5807         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
................................................................................
  5862   5870   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
  5863   5871   $as_echo_n "checking how to run the C preprocessor... " >&6; }
  5864   5872   # On Suns, sometimes $CPP names a directory.
  5865   5873   if test -n "$CPP" && test -d "$CPP"; then
  5866   5874     CPP=
  5867   5875   fi
  5868   5876   if test -z "$CPP"; then
  5869         -  if test "${ac_cv_prog_CPP+set}" = set; then :
         5877  +  if ${ac_cv_prog_CPP+:} false; then :
  5870   5878     $as_echo_n "(cached) " >&6
  5871   5879   else
  5872   5880         # Double quotes because CPP needs to be expanded
  5873   5881       for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
  5874   5882       do
  5875   5883         ac_preproc_ok=false
  5876   5884   for ac_c_preproc_warn_flag in '' yes
................................................................................
  5978   5986   rm -f conftest.i conftest.err conftest.$ac_ext
  5979   5987   if $ac_preproc_ok; then :
  5980   5988   
  5981   5989   else
  5982   5990     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  5983   5991   $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  5984   5992   as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
  5985         -See \`config.log' for more details" "$LINENO" 5 ; }
         5993  +See \`config.log' for more details" "$LINENO" 5; }
  5986   5994   fi
  5987   5995   
  5988   5996   ac_ext=c
  5989   5997   ac_cpp='$CPP $CPPFLAGS'
  5990   5998   ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  5991   5999   ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  5992   6000   ac_compiler_gnu=$ac_cv_c_compiler_gnu
  5993   6001   
  5994   6002   
  5995   6003   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
  5996   6004   $as_echo_n "checking for ANSI C header files... " >&6; }
  5997         -if test "${ac_cv_header_stdc+set}" = set; then :
         6005  +if ${ac_cv_header_stdc+:} false; then :
  5998   6006     $as_echo_n "(cached) " >&6
  5999   6007   else
  6000   6008     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  6001   6009   /* end confdefs.h.  */
  6002   6010   #include <stdlib.h>
  6003   6011   #include <stdarg.h>
  6004   6012   #include <string.h>
................................................................................
  6121   6129   done
  6122   6130   
  6123   6131   
  6124   6132   for ac_header in dlfcn.h
  6125   6133   do :
  6126   6134     ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
  6127   6135   "
  6128         -if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
         6136  +if test "x$ac_cv_header_dlfcn_h" = xyes; then :
  6129   6137     cat >>confdefs.h <<_ACEOF
  6130   6138   #define HAVE_DLFCN_H 1
  6131   6139   _ACEOF
  6132   6140   
  6133   6141   fi
  6134   6142   
  6135   6143   done
................................................................................
  6305   6313   
  6306   6314   if test -n "${ZSH_VERSION+set}" ; then
  6307   6315      setopt NO_GLOB_SUBST
  6308   6316   fi
  6309   6317   
  6310   6318   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
  6311   6319   $as_echo_n "checking for objdir... " >&6; }
  6312         -if test "${lt_cv_objdir+set}" = set; then :
         6320  +if ${lt_cv_objdir+:} false; then :
  6313   6321     $as_echo_n "(cached) " >&6
  6314   6322   else
  6315   6323     rm -f .libs 2>/dev/null
  6316   6324   mkdir .libs 2>/dev/null
  6317   6325   if test -d .libs; then
  6318   6326     lt_cv_objdir=.libs
  6319   6327   else
................................................................................
  6413   6421   # Only perform the check for file, if the check method requires it
  6414   6422   test -z "$MAGIC_CMD" && MAGIC_CMD=file
  6415   6423   case $deplibs_check_method in
  6416   6424   file_magic*)
  6417   6425     if test "$file_magic_cmd" = '$MAGIC_CMD'; then
  6418   6426       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
  6419   6427   $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
  6420         -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
         6428  +if ${lt_cv_path_MAGIC_CMD+:} false; then :
  6421   6429     $as_echo_n "(cached) " >&6
  6422   6430   else
  6423   6431     case $MAGIC_CMD in
  6424   6432   [\\/*] |  ?:[\\/]*)
  6425   6433     lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
  6426   6434     ;;
  6427   6435   *)
................................................................................
  6479   6487   
  6480   6488   
  6481   6489   
  6482   6490   if test -z "$lt_cv_path_MAGIC_CMD"; then
  6483   6491     if test -n "$ac_tool_prefix"; then
  6484   6492       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
  6485   6493   $as_echo_n "checking for file... " >&6; }
  6486         -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
         6494  +if ${lt_cv_path_MAGIC_CMD+:} false; then :
  6487   6495     $as_echo_n "(cached) " >&6
  6488   6496   else
  6489   6497     case $MAGIC_CMD in
  6490   6498   [\\/*] |  ?:[\\/]*)
  6491   6499     lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
  6492   6500     ;;
  6493   6501   *)
................................................................................
  6612   6620   lt_prog_compiler_no_builtin_flag=
  6613   6621   
  6614   6622   if test "$GCC" = yes; then
  6615   6623     lt_prog_compiler_no_builtin_flag=' -fno-builtin'
  6616   6624   
  6617   6625     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
  6618   6626   $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
  6619         -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
         6627  +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
  6620   6628     $as_echo_n "(cached) " >&6
  6621   6629   else
  6622   6630     lt_cv_prog_compiler_rtti_exceptions=no
  6623   6631      ac_outfile=conftest.$ac_objext
  6624   6632      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
  6625   6633      lt_compiler_flag="-fno-rtti -fno-exceptions"
  6626   6634      # Insert the option either (1) after the last *FLAGS variable, or
................................................................................
  6628   6636      # Note that $ac_compile itself does not contain backslashes and begins
  6629   6637      # with a dollar sign (not a hyphen), so the echo should work correctly.
  6630   6638      # The option is referenced via a variable to avoid confusing sed.
  6631   6639      lt_compile=`echo "$ac_compile" | $SED \
  6632   6640      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  6633   6641      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  6634   6642      -e 's:$: $lt_compiler_flag:'`
  6635         -   (eval echo "\"\$as_me:6635: $lt_compile\"" >&5)
         6643  +   (eval echo "\"\$as_me:6643: $lt_compile\"" >&5)
  6636   6644      (eval "$lt_compile" 2>conftest.err)
  6637   6645      ac_status=$?
  6638   6646      cat conftest.err >&5
  6639         -   echo "$as_me:6639: \$? = $ac_status" >&5
         6647  +   echo "$as_me:6647: \$? = $ac_status" >&5
  6640   6648      if (exit $ac_status) && test -s "$ac_outfile"; then
  6641   6649        # The compiler can only warn and ignore the option if not recognized
  6642   6650        # So say no if there are warnings other than the usual output.
  6643   6651        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
  6644   6652        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  6645   6653        if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
  6646   6654          lt_cv_prog_compiler_rtti_exceptions=yes
................................................................................
  6951   6959   
  6952   6960   #
  6953   6961   # Check to make sure the PIC flag actually works.
  6954   6962   #
  6955   6963   if test -n "$lt_prog_compiler_pic"; then
  6956   6964     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
  6957   6965   $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
  6958         -if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
         6966  +if ${lt_cv_prog_compiler_pic_works+:} false; then :
  6959   6967     $as_echo_n "(cached) " >&6
  6960   6968   else
  6961   6969     lt_cv_prog_compiler_pic_works=no
  6962   6970      ac_outfile=conftest.$ac_objext
  6963   6971      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
  6964   6972      lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
  6965   6973      # Insert the option either (1) after the last *FLAGS variable, or
................................................................................
  6967   6975      # Note that $ac_compile itself does not contain backslashes and begins
  6968   6976      # with a dollar sign (not a hyphen), so the echo should work correctly.
  6969   6977      # The option is referenced via a variable to avoid confusing sed.
  6970   6978      lt_compile=`echo "$ac_compile" | $SED \
  6971   6979      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  6972   6980      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  6973   6981      -e 's:$: $lt_compiler_flag:'`
  6974         -   (eval echo "\"\$as_me:6974: $lt_compile\"" >&5)
         6982  +   (eval echo "\"\$as_me:6982: $lt_compile\"" >&5)
  6975   6983      (eval "$lt_compile" 2>conftest.err)
  6976   6984      ac_status=$?
  6977   6985      cat conftest.err >&5
  6978         -   echo "$as_me:6978: \$? = $ac_status" >&5
         6986  +   echo "$as_me:6986: \$? = $ac_status" >&5
  6979   6987      if (exit $ac_status) && test -s "$ac_outfile"; then
  6980   6988        # The compiler can only warn and ignore the option if not recognized
  6981   6989        # So say no if there are warnings other than the usual output.
  6982   6990        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
  6983   6991        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  6984   6992        if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
  6985   6993          lt_cv_prog_compiler_pic_works=yes
................................................................................
  7010   7018   
  7011   7019   #
  7012   7020   # Check to make sure the static flag actually works.
  7013   7021   #
  7014   7022   wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
  7015   7023   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
  7016   7024   $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
  7017         -if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
         7025  +if ${lt_cv_prog_compiler_static_works+:} false; then :
  7018   7026     $as_echo_n "(cached) " >&6
  7019   7027   else
  7020   7028     lt_cv_prog_compiler_static_works=no
  7021   7029      save_LDFLAGS="$LDFLAGS"
  7022   7030      LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
  7023   7031      echo "$lt_simple_link_test_code" > conftest.$ac_ext
  7024   7032      if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
................................................................................
  7053   7061   
  7054   7062   
  7055   7063   
  7056   7064   
  7057   7065   
  7058   7066     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
  7059   7067   $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
  7060         -if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
         7068  +if ${lt_cv_prog_compiler_c_o+:} false; then :
  7061   7069     $as_echo_n "(cached) " >&6
  7062   7070   else
  7063   7071     lt_cv_prog_compiler_c_o=no
  7064   7072      $RM -r conftest 2>/dev/null
  7065   7073      mkdir conftest
  7066   7074      cd conftest
  7067   7075      mkdir out
................................................................................
  7072   7080      # (2) before a word containing "conftest.", or (3) at the end.
  7073   7081      # Note that $ac_compile itself does not contain backslashes and begins
  7074   7082      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7075   7083      lt_compile=`echo "$ac_compile" | $SED \
  7076   7084      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7077   7085      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7078   7086      -e 's:$: $lt_compiler_flag:'`
  7079         -   (eval echo "\"\$as_me:7079: $lt_compile\"" >&5)
         7087  +   (eval echo "\"\$as_me:7087: $lt_compile\"" >&5)
  7080   7088      (eval "$lt_compile" 2>out/conftest.err)
  7081   7089      ac_status=$?
  7082   7090      cat out/conftest.err >&5
  7083         -   echo "$as_me:7083: \$? = $ac_status" >&5
         7091  +   echo "$as_me:7091: \$? = $ac_status" >&5
  7084   7092      if (exit $ac_status) && test -s out/conftest2.$ac_objext
  7085   7093      then
  7086   7094        # The compiler can only warn and ignore the option if not recognized
  7087   7095        # So say no if there are warnings
  7088   7096        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
  7089   7097        $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
  7090   7098        if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
................................................................................
  7108   7116   
  7109   7117   
  7110   7118   
  7111   7119   
  7112   7120   
  7113   7121     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
  7114   7122   $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
  7115         -if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
         7123  +if ${lt_cv_prog_compiler_c_o+:} false; then :
  7116   7124     $as_echo_n "(cached) " >&6
  7117   7125   else
  7118   7126     lt_cv_prog_compiler_c_o=no
  7119   7127      $RM -r conftest 2>/dev/null
  7120   7128      mkdir conftest
  7121   7129      cd conftest
  7122   7130      mkdir out
................................................................................
  7127   7135      # (2) before a word containing "conftest.", or (3) at the end.
  7128   7136      # Note that $ac_compile itself does not contain backslashes and begins
  7129   7137      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7130   7138      lt_compile=`echo "$ac_compile" | $SED \
  7131   7139      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7132   7140      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7133   7141      -e 's:$: $lt_compiler_flag:'`
  7134         -   (eval echo "\"\$as_me:7134: $lt_compile\"" >&5)
         7142  +   (eval echo "\"\$as_me:7142: $lt_compile\"" >&5)
  7135   7143      (eval "$lt_compile" 2>out/conftest.err)
  7136   7144      ac_status=$?
  7137   7145      cat out/conftest.err >&5
  7138         -   echo "$as_me:7138: \$? = $ac_status" >&5
         7146  +   echo "$as_me:7146: \$? = $ac_status" >&5
  7139   7147      if (exit $ac_status) && test -s out/conftest2.$ac_objext
  7140   7148      then
  7141   7149        # The compiler can only warn and ignore the option if not recognized
  7142   7150        # So say no if there are warnings
  7143   7151        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
  7144   7152        $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
  7145   7153        if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
................................................................................
  9249   9257       lt_cv_dlopen_libs=
  9250   9258       ;;
  9251   9259   
  9252   9260     darwin*)
  9253   9261     # if libdl is installed we need to link against it
  9254   9262       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
  9255   9263   $as_echo_n "checking for dlopen in -ldl... " >&6; }
  9256         -if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
         9264  +if ${ac_cv_lib_dl_dlopen+:} false; then :
  9257   9265     $as_echo_n "(cached) " >&6
  9258   9266   else
  9259   9267     ac_check_lib_save_LIBS=$LIBS
  9260   9268   LIBS="-ldl  $LIBS"
  9261   9269   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  9262   9270   /* end confdefs.h.  */
  9263   9271   
................................................................................
  9283   9291   fi
  9284   9292   rm -f core conftest.err conftest.$ac_objext \
  9285   9293       conftest$ac_exeext conftest.$ac_ext
  9286   9294   LIBS=$ac_check_lib_save_LIBS
  9287   9295   fi
  9288   9296   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
  9289   9297   $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
  9290         -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
         9298  +if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
  9291   9299     lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
  9292   9300   else
  9293   9301   
  9294   9302       lt_cv_dlopen="dyld"
  9295   9303       lt_cv_dlopen_libs=
  9296   9304       lt_cv_dlopen_self=yes
  9297   9305   
  9298   9306   fi
  9299   9307   
  9300   9308       ;;
  9301   9309   
  9302   9310     *)
  9303   9311       ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
  9304         -if test "x$ac_cv_func_shl_load" = x""yes; then :
         9312  +if test "x$ac_cv_func_shl_load" = xyes; then :
  9305   9313     lt_cv_dlopen="shl_load"
  9306   9314   else
  9307   9315     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
  9308   9316   $as_echo_n "checking for shl_load in -ldld... " >&6; }
  9309         -if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
         9317  +if ${ac_cv_lib_dld_shl_load+:} false; then :
  9310   9318     $as_echo_n "(cached) " >&6
  9311   9319   else
  9312   9320     ac_check_lib_save_LIBS=$LIBS
  9313   9321   LIBS="-ldld  $LIBS"
  9314   9322   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  9315   9323   /* end confdefs.h.  */
  9316   9324   
................................................................................
  9336   9344   fi
  9337   9345   rm -f core conftest.err conftest.$ac_objext \
  9338   9346       conftest$ac_exeext conftest.$ac_ext
  9339   9347   LIBS=$ac_check_lib_save_LIBS
  9340   9348   fi
  9341   9349   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
  9342   9350   $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
  9343         -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
         9351  +if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
  9344   9352     lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
  9345   9353   else
  9346   9354     ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
  9347         -if test "x$ac_cv_func_dlopen" = x""yes; then :
         9355  +if test "x$ac_cv_func_dlopen" = xyes; then :
  9348   9356     lt_cv_dlopen="dlopen"
  9349   9357   else
  9350   9358     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
  9351   9359   $as_echo_n "checking for dlopen in -ldl... " >&6; }
  9352         -if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
         9360  +if ${ac_cv_lib_dl_dlopen+:} false; then :
  9353   9361     $as_echo_n "(cached) " >&6
  9354   9362   else
  9355   9363     ac_check_lib_save_LIBS=$LIBS
  9356   9364   LIBS="-ldl  $LIBS"
  9357   9365   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  9358   9366   /* end confdefs.h.  */
  9359   9367   
................................................................................
  9379   9387   fi
  9380   9388   rm -f core conftest.err conftest.$ac_objext \
  9381   9389       conftest$ac_exeext conftest.$ac_ext
  9382   9390   LIBS=$ac_check_lib_save_LIBS
  9383   9391   fi
  9384   9392   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
  9385   9393   $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
  9386         -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
         9394  +if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
  9387   9395     lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
  9388   9396   else
  9389   9397     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
  9390   9398   $as_echo_n "checking for dlopen in -lsvld... " >&6; }
  9391         -if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
         9399  +if ${ac_cv_lib_svld_dlopen+:} false; then :
  9392   9400     $as_echo_n "(cached) " >&6
  9393   9401   else
  9394   9402     ac_check_lib_save_LIBS=$LIBS
  9395   9403   LIBS="-lsvld  $LIBS"
  9396   9404   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  9397   9405   /* end confdefs.h.  */
  9398   9406   
................................................................................
  9418   9426   fi
  9419   9427   rm -f core conftest.err conftest.$ac_objext \
  9420   9428       conftest$ac_exeext conftest.$ac_ext
  9421   9429   LIBS=$ac_check_lib_save_LIBS
  9422   9430   fi
  9423   9431   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
  9424   9432   $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
  9425         -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
         9433  +if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
  9426   9434     lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
  9427   9435   else
  9428   9436     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
  9429   9437   $as_echo_n "checking for dld_link in -ldld... " >&6; }
  9430         -if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
         9438  +if ${ac_cv_lib_dld_dld_link+:} false; then :
  9431   9439     $as_echo_n "(cached) " >&6
  9432   9440   else
  9433   9441     ac_check_lib_save_LIBS=$LIBS
  9434   9442   LIBS="-ldld  $LIBS"
  9435   9443   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  9436   9444   /* end confdefs.h.  */
  9437   9445   
................................................................................
  9457   9465   fi
  9458   9466   rm -f core conftest.err conftest.$ac_objext \
  9459   9467       conftest$ac_exeext conftest.$ac_ext
  9460   9468   LIBS=$ac_check_lib_save_LIBS
  9461   9469   fi
  9462   9470   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
  9463   9471   $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
  9464         -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
         9472  +if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
  9465   9473     lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
  9466   9474   fi
  9467   9475   
  9468   9476   
  9469   9477   fi
  9470   9478   
  9471   9479   
................................................................................
  9498   9506       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
  9499   9507   
  9500   9508       save_LIBS="$LIBS"
  9501   9509       LIBS="$lt_cv_dlopen_libs $LIBS"
  9502   9510   
  9503   9511       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
  9504   9512   $as_echo_n "checking whether a program can dlopen itself... " >&6; }
  9505         -if test "${lt_cv_dlopen_self+set}" = set; then :
         9513  +if ${lt_cv_dlopen_self+:} false; then :
  9506   9514     $as_echo_n "(cached) " >&6
  9507   9515   else
  9508   9516     	  if test "$cross_compiling" = yes; then :
  9509   9517     lt_cv_dlopen_self=cross
  9510   9518   else
  9511   9519     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  9512   9520     lt_status=$lt_dlunknown
  9513   9521     cat > conftest.$ac_ext <<_LT_EOF
  9514         -#line 9514 "configure"
         9522  +#line 9522 "configure"
  9515   9523   #include "confdefs.h"
  9516   9524   
  9517   9525   #if HAVE_DLFCN_H
  9518   9526   #include <dlfcn.h>
  9519   9527   #endif
  9520   9528   
  9521   9529   #include <stdio.h>
................................................................................
  9594   9602   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
  9595   9603   $as_echo "$lt_cv_dlopen_self" >&6; }
  9596   9604   
  9597   9605       if test "x$lt_cv_dlopen_self" = xyes; then
  9598   9606         wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
  9599   9607         { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
  9600   9608   $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
  9601         -if test "${lt_cv_dlopen_self_static+set}" = set; then :
         9609  +if ${lt_cv_dlopen_self_static+:} false; then :
  9602   9610     $as_echo_n "(cached) " >&6
  9603   9611   else
  9604   9612     	  if test "$cross_compiling" = yes; then :
  9605   9613     lt_cv_dlopen_self_static=cross
  9606   9614   else
  9607   9615     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  9608   9616     lt_status=$lt_dlunknown
  9609   9617     cat > conftest.$ac_ext <<_LT_EOF
  9610         -#line 9610 "configure"
         9618  +#line 9618 "configure"
  9611   9619   #include "confdefs.h"
  9612   9620   
  9613   9621   #if HAVE_DLFCN_H
  9614   9622   #include <dlfcn.h>
  9615   9623   #endif
  9616   9624   
  9617   9625   #include <stdio.h>
................................................................................
  9847   9855   # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  9848   9856   # OS/2's system install, which has a completely different semantic
  9849   9857   # ./install, which can be erroneously created by make from ./install.sh.
  9850   9858   # Reject install programs that cannot install multiple files.
  9851   9859   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
  9852   9860   $as_echo_n "checking for a BSD-compatible install... " >&6; }
  9853   9861   if test -z "$INSTALL"; then
  9854         -if test "${ac_cv_path_install+set}" = set; then :
         9862  +if ${ac_cv_path_install+:} false; then :
  9855   9863     $as_echo_n "(cached) " >&6
  9856   9864   else
  9857   9865     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  9858   9866   for as_dir in $PATH
  9859   9867   do
  9860   9868     IFS=$as_save_IFS
  9861   9869     test -z "$as_dir" && as_dir=.
................................................................................
  9929   9937   
  9930   9938   for ac_prog in gawk mawk nawk awk
  9931   9939   do
  9932   9940     # Extract the first word of "$ac_prog", so it can be a program name with args.
  9933   9941   set dummy $ac_prog; ac_word=$2
  9934   9942   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  9935   9943   $as_echo_n "checking for $ac_word... " >&6; }
  9936         -if test "${ac_cv_prog_AWK+set}" = set; then :
         9944  +if ${ac_cv_prog_AWK+:} false; then :
  9937   9945     $as_echo_n "(cached) " >&6
  9938   9946   else
  9939   9947     if test -n "$AWK"; then
  9940   9948     ac_cv_prog_AWK="$AWK" # Let the user override the test.
  9941   9949   else
  9942   9950   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  9943   9951   for as_dir in $PATH
................................................................................
  9978   9986     enableval=$enable_largefile;
  9979   9987   fi
  9980   9988   
  9981   9989   if test "$enable_largefile" != no; then
  9982   9990   
  9983   9991     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
  9984   9992   $as_echo_n "checking for special C compiler options needed for large files... " >&6; }
  9985         -if test "${ac_cv_sys_largefile_CC+set}" = set; then :
         9993  +if ${ac_cv_sys_largefile_CC+:} false; then :
  9986   9994     $as_echo_n "(cached) " >&6
  9987   9995   else
  9988   9996     ac_cv_sys_largefile_CC=no
  9989   9997        if test "$GCC" != yes; then
  9990   9998          ac_save_CC=$CC
  9991   9999          while :; do
  9992  10000   	 # IRIX 6.2 and later do not support large files by default,
................................................................................
 10029  10037   $as_echo "$ac_cv_sys_largefile_CC" >&6; }
 10030  10038     if test "$ac_cv_sys_largefile_CC" != no; then
 10031  10039       CC=$CC$ac_cv_sys_largefile_CC
 10032  10040     fi
 10033  10041   
 10034  10042     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
 10035  10043   $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
 10036         -if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
        10044  +if ${ac_cv_sys_file_offset_bits+:} false; then :
 10037  10045     $as_echo_n "(cached) " >&6
 10038  10046   else
 10039  10047     while :; do
 10040  10048     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10041  10049   /* end confdefs.h.  */
 10042  10050   #include <sys/types.h>
 10043  10051    /* Check that off_t can represent 2**63 - 1 correctly.
................................................................................
 10098  10106   _ACEOF
 10099  10107   ;;
 10100  10108   esac
 10101  10109   rm -rf conftest*
 10102  10110     if test $ac_cv_sys_file_offset_bits = unknown; then
 10103  10111       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
 10104  10112   $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
 10105         -if test "${ac_cv_sys_large_files+set}" = set; then :
        10113  +if ${ac_cv_sys_large_files+:} false; then :
 10106  10114     $as_echo_n "(cached) " >&6
 10107  10115   else
 10108  10116     while :; do
 10109  10117     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10110  10118   /* end confdefs.h.  */
 10111  10119   #include <sys/types.h>
 10112  10120    /* Check that off_t can represent 2**63 - 1 correctly.
................................................................................
 10171  10179     fi
 10172  10180   fi
 10173  10181   
 10174  10182   
 10175  10183   #########
 10176  10184   # Check for needed/wanted data types
 10177  10185   ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default"
 10178         -if test "x$ac_cv_type_int8_t" = x""yes; then :
        10186  +if test "x$ac_cv_type_int8_t" = xyes; then :
 10179  10187   
 10180  10188   cat >>confdefs.h <<_ACEOF
 10181  10189   #define HAVE_INT8_T 1
 10182  10190   _ACEOF
 10183  10191   
 10184  10192   
 10185  10193   fi
 10186  10194   ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default"
 10187         -if test "x$ac_cv_type_int16_t" = x""yes; then :
        10195  +if test "x$ac_cv_type_int16_t" = xyes; then :
 10188  10196   
 10189  10197   cat >>confdefs.h <<_ACEOF
 10190  10198   #define HAVE_INT16_T 1
 10191  10199   _ACEOF
 10192  10200   
 10193  10201   
 10194  10202   fi
 10195  10203   ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default"
 10196         -if test "x$ac_cv_type_int32_t" = x""yes; then :
        10204  +if test "x$ac_cv_type_int32_t" = xyes; then :
 10197  10205   
 10198  10206   cat >>confdefs.h <<_ACEOF
 10199  10207   #define HAVE_INT32_T 1
 10200  10208   _ACEOF
 10201  10209   
 10202  10210   
 10203  10211   fi
 10204  10212   ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default"
 10205         -if test "x$ac_cv_type_int64_t" = x""yes; then :
        10213  +if test "x$ac_cv_type_int64_t" = xyes; then :
 10206  10214   
 10207  10215   cat >>confdefs.h <<_ACEOF
 10208  10216   #define HAVE_INT64_T 1
 10209  10217   _ACEOF
 10210  10218   
 10211  10219   
 10212  10220   fi
 10213  10221   ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
 10214         -if test "x$ac_cv_type_intptr_t" = x""yes; then :
        10222  +if test "x$ac_cv_type_intptr_t" = xyes; then :
 10215  10223   
 10216  10224   cat >>confdefs.h <<_ACEOF
 10217  10225   #define HAVE_INTPTR_T 1
 10218  10226   _ACEOF
 10219  10227   
 10220  10228   
 10221  10229   fi
 10222  10230   ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default"
 10223         -if test "x$ac_cv_type_uint8_t" = x""yes; then :
        10231  +if test "x$ac_cv_type_uint8_t" = xyes; then :
 10224  10232   
 10225  10233   cat >>confdefs.h <<_ACEOF
 10226  10234   #define HAVE_UINT8_T 1
 10227  10235   _ACEOF
 10228  10236   
 10229  10237   
 10230  10238   fi
 10231  10239   ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default"
 10232         -if test "x$ac_cv_type_uint16_t" = x""yes; then :
        10240  +if test "x$ac_cv_type_uint16_t" = xyes; then :
 10233  10241   
 10234  10242   cat >>confdefs.h <<_ACEOF
 10235  10243   #define HAVE_UINT16_T 1
 10236  10244   _ACEOF
 10237  10245   
 10238  10246   
 10239  10247   fi
 10240  10248   ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default"
 10241         -if test "x$ac_cv_type_uint32_t" = x""yes; then :
        10249  +if test "x$ac_cv_type_uint32_t" = xyes; then :
 10242  10250   
 10243  10251   cat >>confdefs.h <<_ACEOF
 10244  10252   #define HAVE_UINT32_T 1
 10245  10253   _ACEOF
 10246  10254   
 10247  10255   
 10248  10256   fi
 10249  10257   ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default"
 10250         -if test "x$ac_cv_type_uint64_t" = x""yes; then :
        10258  +if test "x$ac_cv_type_uint64_t" = xyes; then :
 10251  10259   
 10252  10260   cat >>confdefs.h <<_ACEOF
 10253  10261   #define HAVE_UINT64_T 1
 10254  10262   _ACEOF
 10255  10263   
 10256  10264   
 10257  10265   fi
 10258  10266   ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
 10259         -if test "x$ac_cv_type_uintptr_t" = x""yes; then :
        10267  +if test "x$ac_cv_type_uintptr_t" = xyes; then :
 10260  10268   
 10261  10269   cat >>confdefs.h <<_ACEOF
 10262  10270   #define HAVE_UINTPTR_T 1
 10263  10271   _ACEOF
 10264  10272   
 10265  10273   
 10266  10274   fi
................................................................................
 10281  10289   
 10282  10290   done
 10283  10291   
 10284  10292   
 10285  10293   #########
 10286  10294   # Figure out whether or not we have these functions
 10287  10295   #
 10288         -for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime
        10296  +for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size
 10289  10297   do :
 10290  10298     as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 10291  10299   ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 10292  10300   if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
 10293  10301     cat >>confdefs.h <<_ACEOF
 10294  10302   #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 10295  10303   _ACEOF
................................................................................
 10310  10318   #
 10311  10319   for ac_prog in tclsh8.5 tclsh
 10312  10320   do
 10313  10321     # Extract the first word of "$ac_prog", so it can be a program name with args.
 10314  10322   set dummy $ac_prog; ac_word=$2
 10315  10323   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 10316  10324   $as_echo_n "checking for $ac_word... " >&6; }
 10317         -if test "${ac_cv_prog_TCLSH_CMD+set}" = set; then :
        10325  +if ${ac_cv_prog_TCLSH_CMD+:} false; then :
 10318  10326     $as_echo_n "(cached) " >&6
 10319  10327   else
 10320  10328     if test -n "$TCLSH_CMD"; then
 10321  10329     ac_cv_prog_TCLSH_CMD="$TCLSH_CMD" # Let the user override the test.
 10322  10330   else
 10323  10331   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 10324  10332   for as_dir in $PATH
................................................................................
 10444  10452   	if test "${BUILD_CC+set}" != set; then
 10445  10453   		for ac_prog in gcc cc cl
 10446  10454   do
 10447  10455     # Extract the first word of "$ac_prog", so it can be a program name with args.
 10448  10456   set dummy $ac_prog; ac_word=$2
 10449  10457   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 10450  10458   $as_echo_n "checking for $ac_word... " >&6; }
 10451         -if test "${ac_cv_prog_BUILD_CC+set}" = set; then :
        10459  +if ${ac_cv_prog_BUILD_CC+:} false; then :
 10452  10460     $as_echo_n "(cached) " >&6
 10453  10461   else
 10454  10462     if test -n "$BUILD_CC"; then
 10455  10463     ac_cv_prog_BUILD_CC="$BUILD_CC" # Let the user override the test.
 10456  10464   else
 10457  10465   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 10458  10466   for as_dir in $PATH
................................................................................
 10513  10521   $as_echo "yes" >&6; }
 10514  10522   fi
 10515  10523   
 10516  10524   
 10517  10525   if test "$SQLITE_THREADSAFE" = "1"; then
 10518  10526     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5
 10519  10527   $as_echo_n "checking for library containing pthread_create... " >&6; }
 10520         -if test "${ac_cv_search_pthread_create+set}" = set; then :
        10528  +if ${ac_cv_search_pthread_create+:} false; then :
 10521  10529     $as_echo_n "(cached) " >&6
 10522  10530   else
 10523  10531     ac_func_search_save_LIBS=$LIBS
 10524  10532   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10525  10533   /* end confdefs.h.  */
 10526  10534   
 10527  10535   /* Override any GCC internal prototype to avoid an error.
................................................................................
 10547  10555       LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 10548  10556     fi
 10549  10557     if ac_fn_c_try_link "$LINENO"; then :
 10550  10558     ac_cv_search_pthread_create=$ac_res
 10551  10559   fi
 10552  10560   rm -f core conftest.err conftest.$ac_objext \
 10553  10561       conftest$ac_exeext
 10554         -  if test "${ac_cv_search_pthread_create+set}" = set; then :
        10562  +  if ${ac_cv_search_pthread_create+:} false; then :
 10555  10563     break
 10556  10564   fi
 10557  10565   done
 10558         -if test "${ac_cv_search_pthread_create+set}" = set; then :
        10566  +if ${ac_cv_search_pthread_create+:} false; then :
 10559  10567   
 10560  10568   else
 10561  10569     ac_cv_search_pthread_create=no
 10562  10570   fi
 10563  10571   rm conftest.$ac_ext
 10564  10572   LIBS=$ac_func_search_save_LIBS
 10565  10573   fi
................................................................................
 10741  10749   # Check whether --with-tcl was given.
 10742  10750   if test "${with_tcl+set}" = set; then :
 10743  10751     withval=$with_tcl; with_tclconfig=${withval}
 10744  10752   fi
 10745  10753   
 10746  10754     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
 10747  10755   $as_echo_n "checking for Tcl configuration... " >&6; }
 10748         -  if test "${ac_cv_c_tclconfig+set}" = set; then :
        10756  +  if ${ac_cv_c_tclconfig+:} false; then :
 10749  10757     $as_echo_n "(cached) " >&6
 10750  10758   else
 10751  10759   
 10752  10760       # First check to see if --with-tcl was specified.
 10753  10761       if test x"${with_tclconfig}" != x ; then
 10754  10762         if test -f "${with_tclconfig}/tclConfig.sh" ; then
 10755  10763           ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
................................................................................
 10925  10933   fi
 10926  10934   
 10927  10935   	if test "x$with_readline_lib" = xauto; then
 10928  10936   		save_LIBS="$LIBS"
 10929  10937   		LIBS=""
 10930  10938   		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
 10931  10939   $as_echo_n "checking for library containing tgetent... " >&6; }
 10932         -if test "${ac_cv_search_tgetent+set}" = set; then :
        10940  +if ${ac_cv_search_tgetent+:} false; then :
 10933  10941     $as_echo_n "(cached) " >&6
 10934  10942   else
 10935  10943     ac_func_search_save_LIBS=$LIBS
 10936  10944   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10937  10945   /* end confdefs.h.  */
 10938  10946   
 10939  10947   /* Override any GCC internal prototype to avoid an error.
................................................................................
 10959  10967       LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 10960  10968     fi
 10961  10969     if ac_fn_c_try_link "$LINENO"; then :
 10962  10970     ac_cv_search_tgetent=$ac_res
 10963  10971   fi
 10964  10972   rm -f core conftest.err conftest.$ac_objext \
 10965  10973       conftest$ac_exeext
 10966         -  if test "${ac_cv_search_tgetent+set}" = set; then :
        10974  +  if ${ac_cv_search_tgetent+:} false; then :
 10967  10975     break
 10968  10976   fi
 10969  10977   done
 10970         -if test "${ac_cv_search_tgetent+set}" = set; then :
        10978  +if ${ac_cv_search_tgetent+:} false; then :
 10971  10979   
 10972  10980   else
 10973  10981     ac_cv_search_tgetent=no
 10974  10982   fi
 10975  10983   rm conftest.$ac_ext
 10976  10984   LIBS=$ac_func_search_save_LIBS
 10977  10985   fi
................................................................................
 10983  10991     term_LIBS="$LIBS"
 10984  10992   else
 10985  10993     term_LIBS=""
 10986  10994   fi
 10987  10995   
 10988  10996   		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5
 10989  10997   $as_echo_n "checking for readline in -lreadline... " >&6; }
 10990         -if test "${ac_cv_lib_readline_readline+set}" = set; then :
        10998  +if ${ac_cv_lib_readline_readline+:} false; then :
 10991  10999     $as_echo_n "(cached) " >&6
 10992  11000   else
 10993  11001     ac_check_lib_save_LIBS=$LIBS
 10994  11002   LIBS="-lreadline  $LIBS"
 10995  11003   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10996  11004   /* end confdefs.h.  */
 10997  11005   
................................................................................
 11017  11025   fi
 11018  11026   rm -f core conftest.err conftest.$ac_objext \
 11019  11027       conftest$ac_exeext conftest.$ac_ext
 11020  11028   LIBS=$ac_check_lib_save_LIBS
 11021  11029   fi
 11022  11030   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5
 11023  11031   $as_echo "$ac_cv_lib_readline_readline" >&6; }
 11024         -if test "x$ac_cv_lib_readline_readline" = x""yes; then :
        11032  +if test "x$ac_cv_lib_readline_readline" = xyes; then :
 11025  11033     TARGET_READLINE_LIBS="-lreadline"
 11026  11034   else
 11027  11035     found="no"
 11028  11036   fi
 11029  11037   
 11030  11038   		TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
 11031  11039   		LIBS="$save_LIBS"
................................................................................
 11039  11047     withval=$with_readline_inc; with_readline_inc=$withval
 11040  11048   else
 11041  11049     with_readline_inc="auto"
 11042  11050   fi
 11043  11051   
 11044  11052   	if test "x$with_readline_inc" = xauto; then
 11045  11053   		ac_fn_c_check_header_mongrel "$LINENO" "readline.h" "ac_cv_header_readline_h" "$ac_includes_default"
 11046         -if test "x$ac_cv_header_readline_h" = x""yes; then :
        11054  +if test "x$ac_cv_header_readline_h" = xyes; then :
 11047  11055     found="yes"
 11048  11056   else
 11049  11057   
 11050  11058   			found="no"
 11051  11059   			if test "$cross_compiling" != yes; then
 11052  11060   				for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
 11053  11061   					for subdir in include include/readline; do
 11054  11062   						as_ac_File=`$as_echo "ac_cv_file_$dir/$subdir/readline.h" | $as_tr_sh`
 11055  11063   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $dir/$subdir/readline.h" >&5
 11056  11064   $as_echo_n "checking for $dir/$subdir/readline.h... " >&6; }
 11057         -if eval "test \"\${$as_ac_File+set}\"" = set; then :
        11065  +if eval \${$as_ac_File+:} false; then :
 11058  11066     $as_echo_n "(cached) " >&6
 11059  11067   else
 11060  11068     test "$cross_compiling" = yes &&
 11061  11069     as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
 11062  11070   if test -r "$dir/$subdir/readline.h"; then
 11063  11071     eval "$as_ac_File=yes"
 11064  11072   else
................................................................................
 11103  11111   
 11104  11112   ##########
 11105  11113   # Figure out what C libraries are required to compile programs
 11106  11114   # that use "fdatasync()" function.
 11107  11115   #
 11108  11116   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing fdatasync" >&5
 11109  11117   $as_echo_n "checking for library containing fdatasync... " >&6; }
 11110         -if test "${ac_cv_search_fdatasync+set}" = set; then :
        11118  +if ${ac_cv_search_fdatasync+:} false; then :
 11111  11119     $as_echo_n "(cached) " >&6
 11112  11120   else
 11113  11121     ac_func_search_save_LIBS=$LIBS
 11114  11122   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 11115  11123   /* end confdefs.h.  */
 11116  11124   
 11117  11125   /* Override any GCC internal prototype to avoid an error.
................................................................................
 11137  11145       LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 11138  11146     fi
 11139  11147     if ac_fn_c_try_link "$LINENO"; then :
 11140  11148     ac_cv_search_fdatasync=$ac_res
 11141  11149   fi
 11142  11150   rm -f core conftest.err conftest.$ac_objext \
 11143  11151       conftest$ac_exeext
 11144         -  if test "${ac_cv_search_fdatasync+set}" = set; then :
        11152  +  if ${ac_cv_search_fdatasync+:} false; then :
 11145  11153     break
 11146  11154   fi
 11147  11155   done
 11148         -if test "${ac_cv_search_fdatasync+set}" = set; then :
        11156  +if ${ac_cv_search_fdatasync+:} false; then :
 11149  11157   
 11150  11158   else
 11151  11159     ac_cv_search_fdatasync=no
 11152  11160   fi
 11153  11161   rm conftest.$ac_ext
 11154  11162   LIBS=$ac_func_search_save_LIBS
 11155  11163   fi
................................................................................
 11201  11209     use_loadextension=no
 11202  11210   fi
 11203  11211   
 11204  11212   if test "${use_loadextension}" = "yes" ; then
 11205  11213     OPT_FEATURE_FLAGS=""
 11206  11214     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
 11207  11215   $as_echo_n "checking for library containing dlopen... " >&6; }
 11208         -if test "${ac_cv_search_dlopen+set}" = set; then :
        11216  +if ${ac_cv_search_dlopen+:} false; then :
 11209  11217     $as_echo_n "(cached) " >&6
 11210  11218   else
 11211  11219     ac_func_search_save_LIBS=$LIBS
 11212  11220   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 11213  11221   /* end confdefs.h.  */
 11214  11222   
 11215  11223   /* Override any GCC internal prototype to avoid an error.
................................................................................
 11235  11243       LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 11236  11244     fi
 11237  11245     if ac_fn_c_try_link "$LINENO"; then :
 11238  11246     ac_cv_search_dlopen=$ac_res
 11239  11247   fi
 11240  11248   rm -f core conftest.err conftest.$ac_objext \
 11241  11249       conftest$ac_exeext
 11242         -  if test "${ac_cv_search_dlopen+set}" = set; then :
        11250  +  if ${ac_cv_search_dlopen+:} false; then :
 11243  11251     break
 11244  11252   fi
 11245  11253   done
 11246         -if test "${ac_cv_search_dlopen+set}" = set; then :
        11254  +if ${ac_cv_search_dlopen+:} false; then :
 11247  11255   
 11248  11256   else
 11249  11257     ac_cv_search_dlopen=no
 11250  11258   fi
 11251  11259   rm conftest.$ac_ext
 11252  11260   LIBS=$ac_func_search_save_LIBS
 11253  11261   fi
................................................................................
 11402  11410        :clear
 11403  11411        s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
 11404  11412        t end
 11405  11413        s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
 11406  11414        :end' >>confcache
 11407  11415   if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
 11408  11416     if test -w "$cache_file"; then
 11409         -    test "x$cache_file" != "x/dev/null" &&
        11417  +    if test "x$cache_file" != "x/dev/null"; then
 11410  11418         { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 11411  11419   $as_echo "$as_me: updating cache $cache_file" >&6;}
 11412         -    cat confcache >$cache_file
        11420  +      if test ! -f "$cache_file" || test -h "$cache_file"; then
        11421  +	cat confcache >"$cache_file"
        11422  +      else
        11423  +        case $cache_file in #(
        11424  +        */* | ?:*)
        11425  +	  mv -f confcache "$cache_file"$$ &&
        11426  +	  mv -f "$cache_file"$$ "$cache_file" ;; #(
        11427  +        *)
        11428  +	  mv -f confcache "$cache_file" ;;
        11429  +	esac
        11430  +      fi
        11431  +    fi
 11413  11432     else
 11414  11433       { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 11415  11434   $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
 11416  11435     fi
 11417  11436   fi
 11418  11437   rm -f confcache
 11419  11438   
................................................................................
 11437  11456   done
 11438  11457   LIBOBJS=$ac_libobjs
 11439  11458   
 11440  11459   LTLIBOBJS=$ac_ltlibobjs
 11441  11460   
 11442  11461   
 11443  11462   
 11444         -: ${CONFIG_STATUS=./config.status}
        11463  +: "${CONFIG_STATUS=./config.status}"
 11445  11464   ac_write_fail=0
 11446  11465   ac_clean_files_save=$ac_clean_files
 11447  11466   ac_clean_files="$ac_clean_files $CONFIG_STATUS"
 11448  11467   { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
 11449  11468   $as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
 11450  11469   as_write_fail=0
 11451  11470   cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
................................................................................
 11538  11557   # We need space, tab and new line, in precisely that order.  Quoting is
 11539  11558   # there to prevent editors from complaining about space-tab.
 11540  11559   # (If _AS_PATH_WALK were called with IFS unset, it would disable word
 11541  11560   # splitting by setting IFS to empty value.)
 11542  11561   IFS=" ""	$as_nl"
 11543  11562   
 11544  11563   # Find who we are.  Look in the path if we contain no directory separator.
        11564  +as_myself=
 11545  11565   case $0 in #((
 11546  11566     *[\\/]* ) as_myself=$0 ;;
 11547  11567     *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 11548  11568   for as_dir in $PATH
 11549  11569   do
 11550  11570     IFS=$as_save_IFS
 11551  11571     test -z "$as_dir" && as_dir=.
................................................................................
 11845  11865   
 11846  11866   cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 11847  11867   # Save the log message, to keep $0 and so on meaningful, and to
 11848  11868   # report actual input values of CONFIG_FILES etc. instead of their
 11849  11869   # values after options handling.
 11850  11870   ac_log="
 11851  11871   This file was extended by sqlite $as_me 3.7.9, which was
 11852         -generated by GNU Autoconf 2.67.  Invocation command line was
        11872  +generated by GNU Autoconf 2.68.  Invocation command line was
 11853  11873   
 11854  11874     CONFIG_FILES    = $CONFIG_FILES
 11855  11875     CONFIG_HEADERS  = $CONFIG_HEADERS
 11856  11876     CONFIG_LINKS    = $CONFIG_LINKS
 11857  11877     CONFIG_COMMANDS = $CONFIG_COMMANDS
 11858  11878     $ $0 $@
 11859  11879   
................................................................................
 11911  11931   Report bugs to the package provider."
 11912  11932   
 11913  11933   _ACEOF
 11914  11934   cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 11915  11935   ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 11916  11936   ac_cs_version="\\
 11917  11937   sqlite config.status 3.7.9
 11918         -configured by $0, generated by GNU Autoconf 2.67,
        11938  +configured by $0, generated by GNU Autoconf 2.68,
 11919  11939     with options \\"\$ac_cs_config\\"
 11920  11940   
 11921  11941   Copyright (C) 2010 Free Software Foundation, Inc.
 11922  11942   This config.status script is free software; the Free Software Foundation
 11923  11943   gives unlimited permission to copy, distribute and modify it."
 11924  11944   
 11925  11945   ac_pwd='$ac_pwd'
................................................................................
 12297  12317   do
 12298  12318     case $ac_config_target in
 12299  12319       "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
 12300  12320       "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
 12301  12321       "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 12302  12322       "sqlite3.pc") CONFIG_FILES="$CONFIG_FILES sqlite3.pc" ;;
 12303  12323   
 12304         -  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
        12324  +  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
 12305  12325     esac
 12306  12326   done
 12307  12327   
 12308  12328   
 12309  12329   # If the user did not use the arguments to specify the items to instantiate,
 12310  12330   # then the envvar interface is used.  Set only those that are not.
 12311  12331   # We use the long form for the default assignment because of an extremely
................................................................................
 12320  12340   # simply because there is no reason against having it here, and in addition,
 12321  12341   # creating and moving files from /tmp can sometimes cause problems.
 12322  12342   # Hook for its removal unless debugging.
 12323  12343   # Note that there is a small window in which the directory will not be cleaned:
 12324  12344   # after its creation but before its name has been assigned to `$tmp'.
 12325  12345   $debug ||
 12326  12346   {
 12327         -  tmp=
        12347  +  tmp= ac_tmp=
 12328  12348     trap 'exit_status=$?
 12329         -  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
        12349  +  : "${ac_tmp:=$tmp}"
        12350  +  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 12330  12351   ' 0
 12331  12352     trap 'as_fn_exit 1' 1 2 13 15
 12332  12353   }
 12333  12354   # Create a (secure) tmp directory for tmp files.
 12334  12355   
 12335  12356   {
 12336  12357     tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
 12337         -  test -n "$tmp" && test -d "$tmp"
        12358  +  test -d "$tmp"
 12338  12359   }  ||
 12339  12360   {
 12340  12361     tmp=./conf$$-$RANDOM
 12341  12362     (umask 077 && mkdir "$tmp")
 12342  12363   } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
        12364  +ac_tmp=$tmp
 12343  12365   
 12344  12366   # Set up the scripts for CONFIG_FILES section.
 12345  12367   # No need to generate them if there are no CONFIG_FILES.
 12346  12368   # This happens for instance with `./config.status config.h'.
 12347  12369   if test -n "$CONFIG_FILES"; then
 12348  12370   
 12349  12371   
................................................................................
 12357  12379   ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 12358  12380   if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
 12359  12381     ac_cs_awk_cr='\\r'
 12360  12382   else
 12361  12383     ac_cs_awk_cr=$ac_cr
 12362  12384   fi
 12363  12385   
 12364         -echo 'BEGIN {' >"$tmp/subs1.awk" &&
        12386  +echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 12365  12387   _ACEOF
 12366  12388   
 12367  12389   
 12368  12390   {
 12369  12391     echo "cat >conf$$subs.awk <<_ACEOF" &&
 12370  12392     echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
 12371  12393     echo "_ACEOF"
................................................................................
 12385  12407     else
 12386  12408       ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
 12387  12409     fi
 12388  12410   done
 12389  12411   rm -f conf$$subs.sh
 12390  12412   
 12391  12413   cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 12392         -cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
        12414  +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 12393  12415   _ACEOF
 12394  12416   sed -n '
 12395  12417   h
 12396  12418   s/^/S["/; s/!.*/"]=/
 12397  12419   p
 12398  12420   g
 12399  12421   s/^[^!]*!//
................................................................................
 12433  12455     N
 12434  12456     s/\n//
 12435  12457   }
 12436  12458   ' >>$CONFIG_STATUS || ac_write_fail=1
 12437  12459   rm -f conf$$subs.awk
 12438  12460   cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 12439  12461   _ACAWK
 12440         -cat >>"\$tmp/subs1.awk" <<_ACAWK &&
        12462  +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
 12441  12463     for (key in S) S_is_set[key] = 1
 12442  12464     FS = ""
 12443  12465   
 12444  12466   }
 12445  12467   {
 12446  12468     line = $ 0
 12447  12469     nfields = split(line, field, "@")
................................................................................
 12465  12487   _ACAWK
 12466  12488   _ACEOF
 12467  12489   cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 12468  12490   if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
 12469  12491     sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 12470  12492   else
 12471  12493     cat
 12472         -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
        12494  +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
 12473  12495     || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 12474  12496   _ACEOF
 12475  12497   
 12476  12498   # VPATH may cause trouble with some makes, so we remove sole $(srcdir),
 12477  12499   # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
 12478  12500   # trailing colons and then remove the whole line if VPATH becomes empty
 12479  12501   # (actually we leave an empty line to preserve line numbers).
................................................................................
 12499  12521   cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 12500  12522   fi # test -n "$CONFIG_FILES"
 12501  12523   
 12502  12524   # Set up the scripts for CONFIG_HEADERS section.
 12503  12525   # No need to generate them if there are no CONFIG_HEADERS.
 12504  12526   # This happens for instance with `./config.status Makefile'.
 12505  12527   if test -n "$CONFIG_HEADERS"; then
 12506         -cat >"$tmp/defines.awk" <<\_ACAWK ||
        12528  +cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 12507  12529   BEGIN {
 12508  12530   _ACEOF
 12509  12531   
 12510  12532   # Transform confdefs.h into an awk script `defines.awk', embedded as
 12511  12533   # here-document in config.status, that substitutes the proper values into
 12512  12534   # config.h.in to produce config.h.
 12513  12535   
 12514  12536   # Create a delimiter string that does not exist in confdefs.h, to ease
 12515  12537   # handling of long lines.
 12516  12538   ac_delim='%!_!# '
 12517  12539   for ac_last_try in false false :; do
 12518         -  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
 12519         -  if test -z "$ac_t"; then
        12540  +  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
        12541  +  if test -z "$ac_tt"; then
 12520  12542       break
 12521  12543     elif $ac_last_try; then
 12522  12544       as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
 12523  12545     else
 12524  12546       ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
 12525  12547     fi
 12526  12548   done
................................................................................
 12613  12635   for ac_tag
 12614  12636   do
 12615  12637     case $ac_tag in
 12616  12638     :[FHLC]) ac_mode=$ac_tag; continue;;
 12617  12639     esac
 12618  12640     case $ac_mode$ac_tag in
 12619  12641     :[FHL]*:*);;
 12620         -  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
        12642  +  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
 12621  12643     :[FH]-) ac_tag=-:-;;
 12622  12644     :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
 12623  12645     esac
 12624  12646     ac_save_IFS=$IFS
 12625  12647     IFS=:
 12626  12648     set x $ac_tag
 12627  12649     IFS=$ac_save_IFS
................................................................................
 12632  12654     case $ac_mode in
 12633  12655     :L) ac_source=$1;;
 12634  12656     :[FH])
 12635  12657       ac_file_inputs=
 12636  12658       for ac_f
 12637  12659       do
 12638  12660         case $ac_f in
 12639         -      -) ac_f="$tmp/stdin";;
        12661  +      -) ac_f="$ac_tmp/stdin";;
 12640  12662         *) # Look for the file first in the build tree, then in the source tree
 12641  12663   	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 12642  12664   	 # because $ac_f cannot contain `:'.
 12643  12665   	 test -f "$ac_f" ||
 12644  12666   	   case $ac_f in
 12645  12667   	   [\\/$]*) false;;
 12646  12668   	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 12647  12669   	   esac ||
 12648         -	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
        12670  +	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
 12649  12671         esac
 12650  12672         case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
 12651  12673         as_fn_append ac_file_inputs " '$ac_f'"
 12652  12674       done
 12653  12675   
 12654  12676       # Let's still pretend it is `configure' which instantiates (i.e., don't
 12655  12677       # use $as_me), people would be surprised to read:
................................................................................
 12667  12689       *\&* | *\|* | *\\* )
 12668  12690          ac_sed_conf_input=`$as_echo "$configure_input" |
 12669  12691          sed 's/[\\\\&|]/\\\\&/g'`;; #(
 12670  12692       *) ac_sed_conf_input=$configure_input;;
 12671  12693       esac
 12672  12694   
 12673  12695       case $ac_tag in
 12674         -    *:-:* | *:-) cat >"$tmp/stdin" \
 12675         -      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
        12696  +    *:-:* | *:-) cat >"$ac_tmp/stdin" \
        12697  +      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
 12676  12698       esac
 12677  12699       ;;
 12678  12700     esac
 12679  12701   
 12680  12702     ac_dir=`$as_dirname -- "$ac_file" ||
 12681  12703   $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 12682  12704   	 X"$ac_file" : 'X\(//\)[^/]' \| \
................................................................................
 12798  12820   s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
 12799  12821   s&@builddir@&$ac_builddir&;t t
 12800  12822   s&@abs_builddir@&$ac_abs_builddir&;t t
 12801  12823   s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 12802  12824   s&@INSTALL@&$ac_INSTALL&;t t
 12803  12825   $ac_datarootdir_hack
 12804  12826   "
 12805         -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
 12806         -  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
        12827  +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
        12828  +  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 12807  12829   
 12808  12830   test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
 12809         -  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
 12810         -  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
        12831  +  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
        12832  +  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
        12833  +      "$ac_tmp/out"`; test -z "$ac_out"; } &&
 12811  12834     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 12812  12835   which seems to be undefined.  Please make sure it is defined" >&5
 12813  12836   $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 12814  12837   which seems to be undefined.  Please make sure it is defined" >&2;}
 12815  12838   
 12816         -  rm -f "$tmp/stdin"
        12839  +  rm -f "$ac_tmp/stdin"
 12817  12840     case $ac_file in
 12818         -  -) cat "$tmp/out" && rm -f "$tmp/out";;
 12819         -  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
        12841  +  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
        12842  +  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
 12820  12843     esac \
 12821  12844     || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 12822  12845    ;;
 12823  12846     :H)
 12824  12847     #
 12825  12848     # CONFIG_HEADER
 12826  12849     #
 12827  12850     if test x"$ac_file" != x-; then
 12828  12851       {
 12829  12852         $as_echo "/* $configure_input  */" \
 12830         -      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
 12831         -    } >"$tmp/config.h" \
        12853  +      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
        12854  +    } >"$ac_tmp/config.h" \
 12832  12855         || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 12833         -    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
        12856  +    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
 12834  12857         { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 12835  12858   $as_echo "$as_me: $ac_file is unchanged" >&6;}
 12836  12859       else
 12837  12860         rm -f "$ac_file"
 12838         -      mv "$tmp/config.h" "$ac_file" \
        12861  +      mv "$ac_tmp/config.h" "$ac_file" \
 12839  12862   	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
 12840  12863       fi
 12841  12864     else
 12842  12865       $as_echo "/* $configure_input  */" \
 12843         -      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
        12866  +      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
 12844  12867         || as_fn_error $? "could not create -" "$LINENO" 5
 12845  12868     fi
 12846  12869    ;;
 12847  12870   
 12848  12871     :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
 12849  12872   $as_echo "$as_me: executing $ac_file commands" >&6;}
 12850  12873    ;;

Changes to configure.ac.

   123    123   #########
   124    124   # Check for needed/wanted headers
   125    125   AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h])
   126    126   
   127    127   #########
   128    128   # Figure out whether or not we have these functions
   129    129   #
   130         -AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime])
          130  +AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size])
   131    131   
   132    132   #########
   133    133   # By default, we use the amalgamation (this may be changed below...)
   134    134   #
   135    135   USE_AMALGAMATION=1
   136    136   
   137    137   #########

Changes to src/btree.c.

  2478   2478   
  2479   2479     assert( sqlite3_mutex_held(pBt->mutex) );
  2480   2480     if( pBt->nPage>0 ){
  2481   2481       return SQLITE_OK;
  2482   2482     }
  2483   2483     pP1 = pBt->pPage1;
  2484   2484     assert( pP1!=0 );
  2485         -  data = pP1->aData;
  2486   2485     rc = sqlite3PagerWrite(pP1->pDbPage);
  2487   2486     if( rc ) return rc;
         2487  +  data = pP1->aData;
  2488   2488     memcpy(data, zMagicHeader, sizeof(zMagicHeader));
  2489   2489     assert( sizeof(zMagicHeader)==16 );
  2490   2490     data[16] = (u8)((pBt->pageSize>>8)&0xff);
  2491   2491     data[17] = (u8)((pBt->pageSize>>16)&0xff);
  2492   2492     data[18] = 1;
  2493   2493     data[19] = 1;
  2494   2494     assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
................................................................................
  3778   3778       *ppPage = pPage;
  3779   3779     }else{
  3780   3780       releasePage(pPage);
  3781   3781     }
  3782   3782     return (rc==SQLITE_DONE ? SQLITE_OK : rc);
  3783   3783   }
  3784   3784   
  3785         -/*
  3786         -** Copy data from a buffer to a page, or from a page to a buffer.
  3787         -**
  3788         -** pPayload is a pointer to data stored on database page pDbPage.
  3789         -** If argument eOp is false, then nByte bytes of data are copied
  3790         -** from pPayload to the buffer pointed at by pBuf. If eOp is true,
  3791         -** then sqlite3PagerWrite() is called on pDbPage and nByte bytes
  3792         -** of data are copied from the buffer pBuf to pPayload.
  3793         -**
  3794         -** SQLITE_OK is returned on success, otherwise an error code.
  3795         -*/
  3796         -static int copyPayload(
  3797         -  void *pPayload,           /* Pointer to page data */
  3798         -  void *pBuf,               /* Pointer to buffer */
  3799         -  int nByte,                /* Number of bytes to copy */
  3800         -  int eOp,                  /* 0 -> copy from page, 1 -> copy to page */
  3801         -  DbPage *pDbPage           /* Page containing pPayload */
  3802         -){
  3803         -  if( eOp ){
  3804         -    /* Copy data from buffer to page (a write operation) */
  3805         -    int rc = sqlite3PagerWrite(pDbPage);
  3806         -    if( rc!=SQLITE_OK ){
  3807         -      return rc;
  3808         -    }
  3809         -    memcpy(pPayload, pBuf, nByte);
  3810         -  }else{
  3811         -    /* Copy data from page to buffer (a read operation) */
  3812         -    memcpy(pBuf, pPayload, nByte);
  3813         -  }
  3814         -  return SQLITE_OK;
  3815         -}
  3816         -
  3817   3785   /*
  3818   3786   ** This function is used to read or overwrite payload information
  3819   3787   ** for the entry that the pCur cursor is pointing to. If the eOp
  3820   3788   ** parameter is 0, this is a read operation (data copied into
  3821   3789   ** buffer pBuf). If it is non-zero, a write (data copied from
  3822   3790   ** buffer pBuf).
  3823   3791   **
................................................................................
  3856   3824     MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */
  3857   3825     BtShared *pBt = pCur->pBt;                  /* Btree this cursor belongs to */
  3858   3826   
  3859   3827     assert( pPage );
  3860   3828     assert( pCur->eState==CURSOR_VALID );
  3861   3829     assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );
  3862   3830     assert( cursorHoldsMutex(pCur) );
         3831  +
  3863   3832   
  3864   3833     getCellInfo(pCur);
  3865   3834     aPayload = pCur->info.pCell + pCur->info.nHeader;
  3866   3835     nKey = (pPage->intKey ? 0 : (int)pCur->info.nKey);
  3867   3836   
  3868   3837     if( NEVER(offset+amt > nKey+pCur->info.nData) 
  3869   3838      || &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]
................................................................................
  3874   3843   
  3875   3844     /* Check if data must be read/written to/from the btree page itself. */
  3876   3845     if( offset<pCur->info.nLocal ){
  3877   3846       int a = amt;
  3878   3847       if( a+offset>pCur->info.nLocal ){
  3879   3848         a = pCur->info.nLocal - offset;
  3880   3849       }
  3881         -    rc = copyPayload(&aPayload[offset], pBuf, a, eOp, pPage->pDbPage);
         3850  +    if( eOp ){
         3851  +      if( (rc = sqlite3PagerWrite(pPage->pDbPage))!=SQLITE_OK ) return rc;
         3852  +      getCellInfo(pCur);
         3853  +      aPayload = pCur->info.pCell + pCur->info.nHeader;
         3854  +      memcpy(aPayload+offset, pBuf, a);
         3855  +    }else{
         3856  +      memcpy(pBuf, aPayload+offset, a);
         3857  +    }
  3882   3858       offset = 0;
  3883   3859       pBuf += a;
  3884   3860       amt -= a;
  3885   3861     }else{
  3886   3862       offset -= pCur->info.nLocal;
  3887   3863     }
  3888   3864   
................................................................................
  3985   3961           }else
  3986   3962   #endif
  3987   3963   
  3988   3964           {
  3989   3965             DbPage *pDbPage;
  3990   3966             rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage);
  3991   3967             if( rc==SQLITE_OK ){
         3968  +            if( eOp && (rc = sqlite3PagerWrite(pDbPage))!=SQLITE_OK ){
         3969  +              sqlite3PagerUnref(pDbPage);
         3970  +              return rc;
         3971  +            }
  3992   3972               aPayload = sqlite3PagerGetData(pDbPage);
  3993   3973               nextPage = get4byte(aPayload);
  3994         -            rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage);
         3974  +            if( eOp ){
         3975  +              memcpy(&aPayload[offset+4], pBuf, a);
         3976  +            }else{
         3977  +              memcpy(pBuf, &aPayload[offset+4], a);
         3978  +            }
  3995   3979               sqlite3PagerUnref(pDbPage);
  3996   3980               offset = 0;
  3997   3981             }
  3998   3982           }
  3999   3983           amt -= a;
  4000   3984           pBuf += a;
  4001   3985         }
................................................................................
  7386   7370   
  7387   7371   /*
  7388   7372   ** Write meta-information back into the database.  Meta[0] is
  7389   7373   ** read-only and may not be written.
  7390   7374   */
  7391   7375   int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){
  7392   7376     BtShared *pBt = p->pBt;
  7393         -  unsigned char *pP1;
  7394   7377     int rc;
  7395   7378     assert( idx>=1 && idx<=15 );
  7396   7379     sqlite3BtreeEnter(p);
  7397   7380     assert( p->inTrans==TRANS_WRITE );
  7398   7381     assert( pBt->pPage1!=0 );
  7399         -  pP1 = pBt->pPage1->aData;
  7400   7382     rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
  7401   7383     if( rc==SQLITE_OK ){
  7402         -    put4byte(&pP1[36 + idx*4], iMeta);
         7384  +    put4byte(&pBt->pPage1->aData[36 + idx*4], iMeta);
  7403   7385   #ifndef SQLITE_OMIT_AUTOVACUUM
  7404   7386       if( idx==BTREE_INCR_VACUUM ){
  7405   7387         assert( pBt->autoVacuum || iMeta==0 );
  7406   7388         assert( iMeta==0 || iMeta==1 );
  7407   7389         pBt->incrVacuum = (u8)iMeta;
  7408   7390       }
  7409   7391   #endif
................................................................................
  8224   8206     if( rc==SQLITE_OK ){
  8225   8207       u8 *aData = pBt->pPage1->aData;
  8226   8208       if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){
  8227   8209         rc = sqlite3BtreeBeginTrans(pBtree, 2);
  8228   8210         if( rc==SQLITE_OK ){
  8229   8211           rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
  8230   8212           if( rc==SQLITE_OK ){
         8213  +          aData = pBt->pPage1->aData;
  8231   8214             aData[18] = (u8)iVersion;
  8232   8215             aData[19] = (u8)iVersion;
  8233   8216           }
  8234   8217         }
  8235   8218       }
  8236   8219     }
  8237   8220   
  8238   8221     pBt->doNotUseWAL = 0;
  8239   8222     return rc;
  8240   8223   }

Changes to src/global.c.

   143    143      SQLITE_THREADSAFE==1,      /* bFullMutex */
   144    144      SQLITE_USE_URI,            /* bOpenUri */
   145    145      0x7ffffffe,                /* mxStrlen */
   146    146      128,                       /* szLookaside */
   147    147      500,                       /* nLookaside */
   148    148      {0,0,0,0,0,0,0,0},         /* m */
   149    149      {0,0,0,0,0,0,0,0,0},       /* mutex */
   150         -   {0,0,0,0,0,0,0,0,0,0,0},   /* pcache */
          150  +   {0,0,0,0,0,0,0,0,0,0,0},   /* pcache2 */
   151    151      (void*)0,                  /* pHeap */
   152    152      0,                         /* nHeap */
   153    153      0, 0,                      /* mnHeap, mxHeap */
   154    154      (void*)0,                  /* pScratch */
   155    155      0,                         /* szScratch */
   156    156      0,                         /* nScratch */
   157    157      (void*)0,                  /* pPage */

Changes to src/main.c.

   361    361         sqlite3GlobalConfig.pPage = va_arg(ap, void*);
   362    362         sqlite3GlobalConfig.szPage = va_arg(ap, int);
   363    363         sqlite3GlobalConfig.nPage = va_arg(ap, int);
   364    364         break;
   365    365       }
   366    366   
   367    367       case SQLITE_CONFIG_PCACHE: {
   368         -      /* Specify an alternative page cache implementation */
   369         -      sqlite3GlobalConfig.pcache = *va_arg(ap, sqlite3_pcache_methods*);
          368  +      /* no-op */
   370    369         break;
   371    370       }
   372         -
   373    371       case SQLITE_CONFIG_GETPCACHE: {
   374         -      if( sqlite3GlobalConfig.pcache.xInit==0 ){
          372  +      /* now an error */
          373  +      rc = SQLITE_ERROR;
          374  +      break;
          375  +    }
          376  +
          377  +    case SQLITE_CONFIG_PCACHE2: {
          378  +      /* Specify an alternative page cache implementation */
          379  +      sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);
          380  +      break;
          381  +    }
          382  +    case SQLITE_CONFIG_GETPCACHE2: {
          383  +      if( sqlite3GlobalConfig.pcache2.xInit==0 ){
   375    384           sqlite3PCacheSetDefault();
   376    385         }
   377         -      *va_arg(ap, sqlite3_pcache_methods*) = sqlite3GlobalConfig.pcache;
          386  +      *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;
   378    387         break;
   379    388       }
   380    389   
   381    390   #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
   382    391       case SQLITE_CONFIG_HEAP: {
   383    392         /* Designate a buffer for heap memory space */
   384    393         sqlite3GlobalConfig.pHeap = va_arg(ap, void*);
................................................................................
   469    478     /* Free any existing lookaside buffer for this handle before
   470    479     ** allocating a new one so we don't have to have space for 
   471    480     ** both at the same time.
   472    481     */
   473    482     if( db->lookaside.bMalloced ){
   474    483       sqlite3_free(db->lookaside.pStart);
   475    484     }
   476         -  /* The size of a lookaside slot needs to be larger than a pointer
   477         -  ** to be useful.
          485  +  /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger
          486  +  ** than a pointer to be useful.
   478    487     */
          488  +  sz = ROUNDDOWN8(sz);  /* IMP: R-33038-09382 */
   479    489     if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0;
   480    490     if( cnt<0 ) cnt = 0;
   481    491     if( sz==0 || cnt==0 ){
   482    492       sz = 0;
   483    493       pStart = 0;
   484    494     }else if( pBuf==0 ){
   485         -    sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */
   486    495       sqlite3BeginBenignMalloc();
   487    496       pStart = sqlite3Malloc( sz*cnt );  /* IMP: R-61949-35727 */
   488    497       sqlite3EndBenignMalloc();
          498  +    if( pStart ) cnt = sqlite3MallocSize(pStart)/sz;
   489    499     }else{
   490         -    sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */
   491    500       pStart = pBuf;
   492    501     }
   493    502     db->lookaside.pStart = pStart;
   494    503     db->lookaside.pFree = 0;
   495    504     db->lookaside.sz = (u16)sz;
   496    505     if( pStart ){
   497    506       int i;
................................................................................
  2885   2894         const char *zWord = va_arg(ap, const char*);
  2886   2895         int n = sqlite3Strlen30(zWord);
  2887   2896         rc = (sqlite3KeywordCode((u8*)zWord, n)!=TK_ID) ? SQLITE_N_KEYWORD : 0;
  2888   2897         break;
  2889   2898       }
  2890   2899   #endif 
  2891   2900   
  2892         -    /* sqlite3_test_control(SQLITE_TESTCTRL_PGHDRSZ)
  2893         -    **
  2894         -    ** Return the size of a pcache header in bytes.
  2895         -    */
  2896         -    case SQLITE_TESTCTRL_PGHDRSZ: {
  2897         -      rc = sizeof(PgHdr);
  2898         -      break;
  2899         -    }
  2900         -
  2901   2901       /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree);
  2902   2902       **
  2903   2903       ** Pass pFree into sqlite3ScratchFree(). 
  2904   2904       ** If sz>0 then allocate a scratch buffer into pNew.  
  2905   2905       */
  2906   2906       case SQLITE_TESTCTRL_SCRATCHMALLOC: {
  2907   2907         void *pFree, **ppNew;

Changes to src/mem1.c.

    22     22   /*
    23     23   ** This version of the memory allocator is the default.  It is
    24     24   ** used when no other memory allocator is specified using compile-time
    25     25   ** macros.
    26     26   */
    27     27   #ifdef SQLITE_SYSTEM_MALLOC
    28     28   
           29  +#ifdef HAVE_MALLOC_USABLE_SIZE
           30  +#include <malloc.h>
           31  +#endif
           32  +
    29     33   /*
    30     34   ** Like malloc(), but remember the size of the allocation
    31     35   ** so that we can find it later using sqlite3MemSize().
    32     36   **
    33     37   ** For this low-level routine, we are guaranteed that nByte>0 because
    34     38   ** cases of nByte<=0 will be intercepted and dealt with by higher level
    35     39   ** routines.
    36     40   */
    37     41   static void *sqlite3MemMalloc(int nByte){
           42  +#ifdef HAVE_MALLOC_USABLE_SIZE
           43  +  void *p = malloc( nByte );
           44  +  if( p==0 ){
           45  +    testcase( sqlite3GlobalConfig.xLog!=0 );
           46  +    sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
           47  +  }
           48  +  return p;
           49  +#else
    38     50     sqlite3_int64 *p;
    39     51     assert( nByte>0 );
    40     52     nByte = ROUND8(nByte);
    41     53     p = malloc( nByte+8 );
    42     54     if( p ){
    43     55       p[0] = nByte;
    44     56       p++;
    45     57     }else{
    46     58       testcase( sqlite3GlobalConfig.xLog!=0 );
    47     59       sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
    48     60     }
    49     61     return (void *)p;
           62  +#endif
    50     63   }
    51     64   
    52     65   /*
    53     66   ** Like free() but works for allocations obtained from sqlite3MemMalloc()
    54     67   ** or sqlite3MemRealloc().
    55     68   **
    56     69   ** For this low-level routine, we already know that pPrior!=0 since
    57     70   ** cases where pPrior==0 will have been intecepted and dealt with
    58     71   ** by higher-level routines.
    59     72   */
    60     73   static void sqlite3MemFree(void *pPrior){
           74  +#if HAVE_MALLOC_USABLE_SIZE
           75  +  free(pPrior);
           76  +#else
    61     77     sqlite3_int64 *p = (sqlite3_int64*)pPrior;
    62     78     assert( pPrior!=0 );
    63     79     p--;
    64     80     free(p);
           81  +#endif
    65     82   }
    66     83   
    67     84   /*
    68     85   ** Report the allocated size of a prior return from xMalloc()
    69     86   ** or xRealloc().
    70     87   */
    71     88   static int sqlite3MemSize(void *pPrior){
           89  +#if HAVE_MALLOC_USABLE_SIZE
           90  +  return pPrior ? (int)malloc_usable_size(pPrior) : 0;
           91  +#else
    72     92     sqlite3_int64 *p;
    73     93     if( pPrior==0 ) return 0;
    74     94     p = (sqlite3_int64*)pPrior;
    75     95     p--;
    76     96     return (int)p[0];
           97  +#endif
    77     98   }
    78     99   
    79    100   /*
    80    101   ** Like realloc().  Resize an allocation previously obtained from
    81    102   ** sqlite3MemMalloc().
    82    103   **
    83    104   ** For this low-level interface, we know that pPrior!=0.  Cases where
    84    105   ** pPrior==0 while have been intercepted by higher-level routine and
    85    106   ** redirected to xMalloc.  Similarly, we know that nByte>0 becauses
    86    107   ** cases where nByte<=0 will have been intercepted by higher-level
    87    108   ** routines and redirected to xFree.
    88    109   */
    89    110   static void *sqlite3MemRealloc(void *pPrior, int nByte){
          111  +#if HAVE_MALLOC_USABLE_SIZE
          112  +  void *p = realloc(pPrior, nByte);
          113  +  if( p==0 ){
          114  +    testcase( sqlite3GlobalConfig.xLog!=0 );
          115  +    sqlite3_log(SQLITE_NOMEM,
          116  +      "failed memory resize %u to %u bytes",
          117  +      malloc_usable_size(pPrior), nByte);
          118  +  }
          119  +  return p;
          120  +#else
    90    121     sqlite3_int64 *p = (sqlite3_int64*)pPrior;
    91    122     assert( pPrior!=0 && nByte>0 );
    92    123     assert( nByte==ROUND8(nByte) ); /* EV: R-46199-30249 */
    93    124     p--;
    94    125     p = realloc(p, nByte+8 );
    95    126     if( p ){
    96    127       p[0] = nByte;
................................................................................
    98    129     }else{
    99    130       testcase( sqlite3GlobalConfig.xLog!=0 );
   100    131       sqlite3_log(SQLITE_NOMEM,
   101    132         "failed memory resize %u to %u bytes",
   102    133         sqlite3MemSize(pPrior), nByte);
   103    134     }
   104    135     return (void*)p;
          136  +#endif
   105    137   }
   106    138   
   107    139   /*
   108    140   ** Round up a request size to the next valid allocation size.
   109    141   */
   110    142   static int sqlite3MemRoundup(int n){
   111    143     return ROUND8(n);

Changes to src/pcache.c.

    16     16   /*
    17     17   ** A complete page cache is an instance of this structure.
    18     18   */
    19     19   struct PCache {
    20     20     PgHdr *pDirty, *pDirtyTail;         /* List of dirty pages in LRU order */
    21     21     PgHdr *pSynced;                     /* Last synced page in dirty page list */
    22     22     int nRef;                           /* Number of referenced pages */
    23         -  int nMax;                           /* Configured cache size */
           23  +  int szCache;                        /* Configured cache size */
    24     24     int szPage;                         /* Size of every page in this cache */
    25     25     int szExtra;                        /* Size of extra space for each page */
    26     26     int bPurgeable;                     /* True if pages are on backing store */
    27     27     int (*xStress)(void*,PgHdr*);       /* Call to try make a page clean */
    28     28     void *pStress;                      /* Argument to xStress */
    29     29     sqlite3_pcache *pCache;             /* Pluggable cache module */
    30     30     PgHdr *pPage1;                      /* Reference to page 1 */
................................................................................
   127    127   */
   128    128   static void pcacheUnpin(PgHdr *p){
   129    129     PCache *pCache = p->pCache;
   130    130     if( pCache->bPurgeable ){
   131    131       if( p->pgno==1 ){
   132    132         pCache->pPage1 = 0;
   133    133       }
   134         -    sqlite3GlobalConfig.pcache.xUnpin(pCache->pCache, p, 0);
          134  +    sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, p->pPage, 0);
   135    135     }
   136    136   }
   137    137   
   138    138   /*************************************************** General Interfaces ******
   139    139   **
   140    140   ** Initialize and shutdown the page cache subsystem. Neither of these 
   141    141   ** functions are threadsafe.
   142    142   */
   143    143   int sqlite3PcacheInitialize(void){
   144         -  if( sqlite3GlobalConfig.pcache.xInit==0 ){
          144  +  if( sqlite3GlobalConfig.pcache2.xInit==0 ){
   145    145       /* IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the
   146    146       ** built-in default page cache is used instead of the application defined
   147    147       ** page cache. */
   148    148       sqlite3PCacheSetDefault();
   149    149     }
   150         -  return sqlite3GlobalConfig.pcache.xInit(sqlite3GlobalConfig.pcache.pArg);
          150  +  return sqlite3GlobalConfig.pcache2.xInit(sqlite3GlobalConfig.pcache2.pArg);
   151    151   }
   152    152   void sqlite3PcacheShutdown(void){
   153         -  if( sqlite3GlobalConfig.pcache.xShutdown ){
          153  +  if( sqlite3GlobalConfig.pcache2.xShutdown ){
   154    154       /* IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. */
   155         -    sqlite3GlobalConfig.pcache.xShutdown(sqlite3GlobalConfig.pcache.pArg);
          155  +    sqlite3GlobalConfig.pcache2.xShutdown(sqlite3GlobalConfig.pcache2.pArg);
   156    156     }
   157    157   }
   158    158   
   159    159   /*
   160    160   ** Return the size in bytes of a PCache object.
   161    161   */
   162    162   int sqlite3PcacheSize(void){ return sizeof(PCache); }
................................................................................
   177    177   ){
   178    178     memset(p, 0, sizeof(PCache));
   179    179     p->szPage = szPage;
   180    180     p->szExtra = szExtra;
   181    181     p->bPurgeable = bPurgeable;
   182    182     p->xStress = xStress;
   183    183     p->pStress = pStress;
   184         -  p->nMax = 100;
          184  +  p->szCache = 100;
   185    185   }
   186    186   
   187    187   /*
   188    188   ** Change the page size for PCache object. The caller must ensure that there
   189    189   ** are no outstanding page references when this function is called.
   190    190   */
   191    191   void sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
   192    192     assert( pCache->nRef==0 && pCache->pDirty==0 );
   193    193     if( pCache->pCache ){
   194         -    sqlite3GlobalConfig.pcache.xDestroy(pCache->pCache);
          194  +    sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);
   195    195       pCache->pCache = 0;
   196    196       pCache->pPage1 = 0;
   197    197     }
   198    198     pCache->szPage = szPage;
   199    199   }
          200  +
          201  +/*
          202  +** Compute the number of pages of cache requested.
          203  +*/
          204  +static int numberOfCachePages(PCache *p){
          205  +  if( p->szCache>=0 ){
          206  +    return p->szCache;
          207  +  }else{
          208  +    return (-1024*p->szCache)/(p->szPage+p->szExtra);
          209  +  }
          210  +}
   200    211   
   201    212   /*
   202    213   ** Try to obtain a page from the cache.
   203    214   */
   204    215   int sqlite3PcacheFetch(
   205    216     PCache *pCache,       /* Obtain the page from this cache */
   206    217     Pgno pgno,            /* Page number to obtain */
   207    218     int createFlag,       /* If true, create page if it does not exist already */
   208    219     PgHdr **ppPage        /* Write the page here */
   209    220   ){
   210         -  PgHdr *pPage = 0;
          221  +  sqlite3_pcache_page *pPage = 0;
          222  +  PgHdr *pPgHdr = 0;
   211    223     int eCreate;
   212    224   
   213    225     assert( pCache!=0 );
   214    226     assert( createFlag==1 || createFlag==0 );
   215    227     assert( pgno>0 );
   216    228   
   217    229     /* If the pluggable cache (sqlite3_pcache*) has not been allocated,
   218    230     ** allocate it now.
   219    231     */
   220    232     if( !pCache->pCache && createFlag ){
   221    233       sqlite3_pcache *p;
   222         -    int nByte;
   223         -    nByte = pCache->szPage + pCache->szExtra + sizeof(PgHdr);
   224         -    p = sqlite3GlobalConfig.pcache.xCreate(nByte, pCache->bPurgeable);
          234  +    p = sqlite3GlobalConfig.pcache2.xCreate(
          235  +        pCache->szPage, pCache->szExtra + sizeof(PgHdr), pCache->bPurgeable
          236  +    );
   225    237       if( !p ){
   226    238         return SQLITE_NOMEM;
   227    239       }
   228         -    sqlite3GlobalConfig.pcache.xCachesize(p, pCache->nMax);
          240  +    sqlite3GlobalConfig.pcache2.xCachesize(p, numberOfCachePages(pCache));
   229    241       pCache->pCache = p;
   230    242     }
   231    243   
   232    244     eCreate = createFlag * (1 + (!pCache->bPurgeable || !pCache->pDirty));
   233    245     if( pCache->pCache ){
   234         -    pPage = sqlite3GlobalConfig.pcache.xFetch(pCache->pCache, pgno, eCreate);
          246  +    pPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate);
   235    247     }
   236    248   
   237    249     if( !pPage && eCreate==1 ){
   238    250       PgHdr *pPg;
   239    251   
   240    252       /* Find a dirty page to write-out and recycle. First try to find a 
   241    253       ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC
................................................................................
   254    266       if( pPg ){
   255    267         int rc;
   256    268   #ifdef SQLITE_LOG_CACHE_SPILL
   257    269         sqlite3_log(SQLITE_FULL, 
   258    270                     "spill page %d making room for %d - cache used: %d/%d",
   259    271                     pPg->pgno, pgno,
   260    272                     sqlite3GlobalConfig.pcache.xPagecount(pCache->pCache),
   261         -                  pCache->nMax);
          273  +                  numberOfCachePages(pCache));
   262    274   #endif
   263    275         rc = pCache->xStress(pCache->pStress, pPg);
   264    276         if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
   265    277           return rc;
   266    278         }
   267    279       }
   268    280   
   269         -    pPage = sqlite3GlobalConfig.pcache.xFetch(pCache->pCache, pgno, 2);
          281  +    pPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2);
   270    282     }
   271    283   
   272    284     if( pPage ){
   273         -    if( !pPage->pData ){
   274         -      memset(pPage, 0, sizeof(PgHdr));
   275         -      pPage->pData = (void *)&pPage[1];
   276         -      pPage->pExtra = (void*)&((char *)pPage->pData)[pCache->szPage];
   277         -      memset(pPage->pExtra, 0, pCache->szExtra);
   278         -      pPage->pCache = pCache;
   279         -      pPage->pgno = pgno;
          285  +    pPgHdr = (PgHdr *)pPage->pExtra;
          286  +
          287  +    if( !pPgHdr->pPage ){
          288  +      memset(pPgHdr, 0, sizeof(PgHdr));
          289  +      pPgHdr->pPage = pPage;
          290  +      pPgHdr->pData = pPage->pBuf;
          291  +      pPgHdr->pExtra = (void *)&pPgHdr[1];
          292  +      memset(pPgHdr->pExtra, 0, pCache->szExtra);
          293  +      pPgHdr->pCache = pCache;
          294  +      pPgHdr->pgno = pgno;
   280    295       }
   281         -    assert( pPage->pCache==pCache );
   282         -    assert( pPage->pgno==pgno );
   283         -    assert( pPage->pData==(void *)&pPage[1] );
   284         -    assert( pPage->pExtra==(void *)&((char *)&pPage[1])[pCache->szPage] );
          296  +    assert( pPgHdr->pCache==pCache );
          297  +    assert( pPgHdr->pgno==pgno );
          298  +    assert( pPgHdr->pData==pPage->pBuf );
          299  +    assert( pPgHdr->pExtra==(void *)&pPgHdr[1] );
   285    300   
   286         -    if( 0==pPage->nRef ){
          301  +    if( 0==pPgHdr->nRef ){
   287    302         pCache->nRef++;
   288    303       }
   289         -    pPage->nRef++;
          304  +    pPgHdr->nRef++;
   290    305       if( pgno==1 ){
   291         -      pCache->pPage1 = pPage;
          306  +      pCache->pPage1 = pPgHdr;
   292    307       }
   293    308     }
   294         -  *ppPage = pPage;
   295         -  return (pPage==0 && eCreate) ? SQLITE_NOMEM : SQLITE_OK;
          309  +  *ppPage = pPgHdr;
          310  +  return (pPgHdr==0 && eCreate) ? SQLITE_NOMEM : SQLITE_OK;
   296    311   }
   297    312   
   298    313   /*
   299    314   ** Decrement the reference count on a page. If the page is clean and the
   300    315   ** reference count drops to 0, then it is made elible for recycling.
   301    316   */
   302    317   void sqlite3PcacheRelease(PgHdr *p){
................................................................................
   335    350       pcacheRemoveFromDirtyList(p);
   336    351     }
   337    352     pCache = p->pCache;
   338    353     pCache->nRef--;
   339    354     if( p->pgno==1 ){
   340    355       pCache->pPage1 = 0;
   341    356     }
   342         -  sqlite3GlobalConfig.pcache.xUnpin(pCache->pCache, p, 1);
          357  +  sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, p->pPage, 1);
   343    358   }
   344    359   
   345    360   /*
   346    361   ** Make sure the page is marked as dirty. If it isn't dirty already,
   347    362   ** make it so.
   348    363   */
   349    364   void sqlite3PcacheMakeDirty(PgHdr *p){
................................................................................
   393    408   /*
   394    409   ** Change the page number of page p to newPgno. 
   395    410   */
   396    411   void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
   397    412     PCache *pCache = p->pCache;
   398    413     assert( p->nRef>0 );
   399    414     assert( newPgno>0 );
   400         -  sqlite3GlobalConfig.pcache.xRekey(pCache->pCache, p, p->pgno, newPgno);
          415  +  sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
   401    416     p->pgno = newPgno;
   402    417     if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
   403    418       pcacheRemoveFromDirtyList(p);
   404    419       pcacheAddToDirtyList(p);
   405    420     }
   406    421   }
   407    422   
................................................................................
   430    445           sqlite3PcacheMakeClean(p);
   431    446         }
   432    447       }
   433    448       if( pgno==0 && pCache->pPage1 ){
   434    449         memset(pCache->pPage1->pData, 0, pCache->szPage);
   435    450         pgno = 1;
   436    451       }
   437         -    sqlite3GlobalConfig.pcache.xTruncate(pCache->pCache, pgno+1);
          452  +    sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1);
   438    453     }
   439    454   }
   440    455   
   441    456   /*
   442    457   ** Close a cache.
   443    458   */
   444    459   void sqlite3PcacheClose(PCache *pCache){
   445    460     if( pCache->pCache ){
   446         -    sqlite3GlobalConfig.pcache.xDestroy(pCache->pCache);
          461  +    sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);
   447    462     }
   448    463   }
   449    464   
   450    465   /* 
   451    466   ** Discard the contents of the cache.
   452    467   */
   453    468   void sqlite3PcacheClear(PCache *pCache){
................................................................................
   551    566   
   552    567   /* 
   553    568   ** Return the total number of pages in the cache.
   554    569   */
   555    570   int sqlite3PcachePagecount(PCache *pCache){
   556    571     int nPage = 0;
   557    572     if( pCache->pCache ){
   558         -    nPage = sqlite3GlobalConfig.pcache.xPagecount(pCache->pCache);
          573  +    nPage = sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache);
   559    574     }
   560    575     return nPage;
   561    576   }
   562    577   
   563    578   #ifdef SQLITE_TEST
   564    579   /*
   565    580   ** Get the suggested cache-size value.
   566    581   */
   567    582   int sqlite3PcacheGetCachesize(PCache *pCache){
   568         -  return pCache->nMax;
          583  +  return numberOfCachePages(pCache);
   569    584   }
   570    585   #endif
   571    586   
   572    587   /*
   573    588   ** Set the suggested cache-size value.
   574    589   */
   575    590   void sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){
   576         -  pCache->nMax = mxPage;
          591  +  pCache->szCache = mxPage;
   577    592     if( pCache->pCache ){
   578         -    sqlite3GlobalConfig.pcache.xCachesize(pCache->pCache, mxPage);
          593  +    sqlite3GlobalConfig.pcache2.xCachesize(pCache->pCache,
          594  +                                           numberOfCachePages(pCache));
   579    595     }
   580    596   }
   581    597   
   582    598   #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
   583    599   /*
   584    600   ** For all dirty pages currently in the cache, invoke the specified
   585    601   ** callback. This is only used if the SQLITE_CHECK_PAGES macro is

Changes to src/pcache.h.

    19     19   typedef struct PCache PCache;
    20     20   
    21     21   /*
    22     22   ** Every page in the cache is controlled by an instance of the following
    23     23   ** structure.
    24     24   */
    25     25   struct PgHdr {
    26         -  void *pData;                   /* Content of this page */
           26  +  sqlite3_pcache_page *pPage;    /* Pcache object page handle */
           27  +  void *pData;                   /* Page data */
    27     28     void *pExtra;                  /* Extra content */
    28     29     PgHdr *pDirty;                 /* Transient list of dirty pages */
    29     30     Pgno pgno;                     /* Page number for this page */
    30     31     Pager *pPager;                 /* The pager this page is part of */
    31     32   #ifdef SQLITE_CHECK_PAGES
    32     33     u32 pageHash;                  /* Hash of page content */
    33     34   #endif

Changes to src/pcache1.c.

    20     20   #include "sqliteInt.h"
    21     21   
    22     22   typedef struct PCache1 PCache1;
    23     23   typedef struct PgHdr1 PgHdr1;
    24     24   typedef struct PgFreeslot PgFreeslot;
    25     25   typedef struct PGroup PGroup;
    26     26   
    27         -
    28     27   /* Each page cache (or PCache) belongs to a PGroup.  A PGroup is a set 
    29     28   ** of one or more PCaches that are able to recycle each others unpinned
    30     29   ** pages when they are under memory pressure.  A PGroup is an instance of
    31     30   ** the following object.
    32     31   **
    33     32   ** This page cache implementation works in one of two modes:
    34     33   **
................................................................................
    68     67     /* Cache configuration parameters. Page size (szPage) and the purgeable
    69     68     ** flag (bPurgeable) are set when the cache is created. nMax may be 
    70     69     ** modified at any time by a call to the pcache1CacheSize() method.
    71     70     ** The PGroup mutex must be held when accessing nMax.
    72     71     */
    73     72     PGroup *pGroup;                     /* PGroup this cache belongs to */
    74     73     int szPage;                         /* Size of allocated pages in bytes */
           74  +  int szExtra;                        /* Size of extra space in bytes */
    75     75     int bPurgeable;                     /* True if cache is purgeable */
    76     76     unsigned int nMin;                  /* Minimum number of pages reserved */
    77     77     unsigned int nMax;                  /* Configured "cache_size" value */
    78     78     unsigned int n90pct;                /* nMax*9/10 */
    79     79   
    80     80     /* Hash table of all pages. The following variables may only be accessed
    81     81     ** when the accessor is holding the PGroup mutex.
................................................................................
    86     86     PgHdr1 **apHash;                    /* Hash table for fast lookup by key */
    87     87   
    88     88     unsigned int iMaxKey;               /* Largest key seen since xTruncate() */
    89     89   };
    90     90   
    91     91   /*
    92     92   ** Each cache entry is represented by an instance of the following 
    93         -** structure. A buffer of PgHdr1.pCache->szPage bytes is allocated 
    94         -** directly before this structure in memory (see the PGHDR1_TO_PAGE() 
    95         -** macro below).
           93  +** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of
           94  +** PgHdr1.pCache->szPage bytes is allocated directly before this structure 
           95  +** in memory.
    96     96   */
    97     97   struct PgHdr1 {
           98  +  sqlite3_pcache_page page;
    98     99     unsigned int iKey;             /* Key value (page number) */
    99    100     PgHdr1 *pNext;                 /* Next in hash table chain */
   100    101     PCache1 *pCache;               /* Cache that currently owns this page */
   101    102     PgHdr1 *pLruNext;              /* Next in LRU list of unpinned pages */
   102    103     PgHdr1 *pLruPrev;              /* Previous in LRU list of unpinned pages */
   103    104   };
   104    105   
................................................................................
   140    141   /*
   141    142   ** All code in this file should access the global structure above via the
   142    143   ** alias "pcache1". This ensures that the WSD emulation is used when
   143    144   ** compiling for systems that do not support real WSD.
   144    145   */
   145    146   #define pcache1 (GLOBAL(struct PCacheGlobal, pcache1_g))
   146    147   
   147         -/*
   148         -** When a PgHdr1 structure is allocated, the associated PCache1.szPage
   149         -** bytes of data are located directly before it in memory (i.e. the total
   150         -** size of the allocation is sizeof(PgHdr1)+PCache1.szPage byte). The
   151         -** PGHDR1_TO_PAGE() macro takes a pointer to a PgHdr1 structure as
   152         -** an argument and returns a pointer to the associated block of szPage
   153         -** bytes. The PAGE_TO_PGHDR1() macro does the opposite: its argument is
   154         -** a pointer to a block of szPage bytes of data and the return value is
   155         -** a pointer to the associated PgHdr1 structure.
   156         -**
   157         -**   assert( PGHDR1_TO_PAGE(PAGE_TO_PGHDR1(pCache, X))==X );
   158         -*/
   159         -#define PGHDR1_TO_PAGE(p)    (void*)(((char*)p) - p->pCache->szPage)
   160         -#define PAGE_TO_PGHDR1(c, p) (PgHdr1*)(((char*)p) + c->szPage)
   161         -
   162    148   /*
   163    149   ** Macros to enter and leave the PCache LRU mutex.
   164    150   */
   165    151   #define pcache1EnterMutex(X) sqlite3_mutex_enter((X)->mutex)
   166    152   #define pcache1LeaveMutex(X) sqlite3_mutex_leave((X)->mutex)
   167    153   
   168    154   /******************************************************************************/
................................................................................
   284    270   }
   285    271   #endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
   286    272   
   287    273   /*
   288    274   ** Allocate a new page object initially associated with cache pCache.
   289    275   */
   290    276   static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
   291         -  int nByte = sizeof(PgHdr1) + pCache->szPage;
   292    277     PgHdr1 *p = 0;
   293    278     void *pPg;
   294    279   
   295    280     /* The group mutex must be released before pcache1Alloc() is called. This
   296    281     ** is because it may call sqlite3_release_memory(), which assumes that 
   297    282     ** this mutex is not held. */
   298    283     assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
   299    284     pcache1LeaveMutex(pCache->pGroup);
   300         -  pPg = pcache1Alloc(nByte);
          285  +#ifdef SQLITE_PCACHE_SEPARATE_HEADER
          286  +  pPg = pcache1Alloc(pCache->szPage);
          287  +  p = sqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra);
          288  +  if( !pPg || !p ){
          289  +    pcache1Free(pPg);
          290  +    sqlite3_free(p);
          291  +    pPg = 0;
          292  +  }
          293  +#else
          294  +  pPg = pcache1Alloc(sizeof(PgHdr1) + pCache->szPage + pCache->szExtra);
          295  +  p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage];
          296  +#endif
   301    297     pcache1EnterMutex(pCache->pGroup);
   302    298   
   303    299     if( pPg ){
   304         -    p = PAGE_TO_PGHDR1(pCache, pPg);
          300  +    p->page.pBuf = pPg;
          301  +    p->page.pExtra = &p[1];
   305    302       if( pCache->bPurgeable ){
   306    303         pCache->pGroup->nCurrentPage++;
   307    304       }
          305  +    return p;
   308    306     }
   309         -  return p;
          307  +  return 0;
   310    308   }
   311    309   
   312    310   /*
   313    311   ** Free a page object allocated by pcache1AllocPage().
   314    312   **
   315    313   ** The pointer is allowed to be NULL, which is prudent.  But it turns out
   316    314   ** that the current implementation happens to never call this routine
   317    315   ** with a NULL pointer, so we mark the NULL test with ALWAYS().
   318    316   */
   319    317   static void pcache1FreePage(PgHdr1 *p){
   320    318     if( ALWAYS(p) ){
   321    319       PCache1 *pCache = p->pCache;
   322    320       assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) );
   323         -    pcache1Free(PGHDR1_TO_PAGE(p));
          321  +    pcache1Free(p->page.pBuf);
          322  +#ifdef SQLITE_PCACHE_SEPARATE_HEADER
          323  +    sqlite3_free(p);
          324  +#endif
   324    325       if( pCache->bPurgeable ){
   325    326         pCache->pGroup->nCurrentPage--;
   326    327       }
   327    328     }
   328    329   }
   329    330   
   330    331   /*
................................................................................
   357    358   **
   358    359   ** Or, the heap is used for all page cache memory put the heap is
   359    360   ** under memory pressure, then again it is desirable to avoid
   360    361   ** allocating a new page cache entry in order to avoid stressing
   361    362   ** the heap even further.
   362    363   */
   363    364   static int pcache1UnderMemoryPressure(PCache1 *pCache){
   364         -  if( pcache1.nSlot && pCache->szPage<=pcache1.szSlot ){
          365  +  if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){
   365    366       return pcache1.bUnderPressure;
   366    367     }else{
   367    368       return sqlite3HeapNearlyFull();
   368    369     }
   369    370   }
   370    371   
   371    372   /******************************************************************************/
................................................................................
   548    549   }
   549    550   
   550    551   /*
   551    552   ** Implementation of the sqlite3_pcache.xCreate method.
   552    553   **
   553    554   ** Allocate a new cache.
   554    555   */
   555         -static sqlite3_pcache *pcache1Create(int szPage, int bPurgeable){
          556  +static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){
   556    557     PCache1 *pCache;      /* The newly created page cache */
   557    558     PGroup *pGroup;       /* The group the new page cache will belong to */
   558    559     int sz;               /* Bytes of memory required to allocate the new cache */
   559    560   
   560    561     /*
   561    562     ** The seperateCache variable is true if each PCache has its own private
   562    563     ** PGroup.  In other words, separateCache is true for mode (1) where no
................................................................................
   570    571     **      use separate caches (mode-1)
   571    572     */
   572    573   #if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0
   573    574     const int separateCache = 0;
   574    575   #else
   575    576     int separateCache = sqlite3GlobalConfig.bCoreMutex>0;
   576    577   #endif
          578  +
          579  +  assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 );
          580  +  assert( szExtra < 300 );
   577    581   
   578    582     sz = sizeof(PCache1) + sizeof(PGroup)*separateCache;
   579    583     pCache = (PCache1 *)sqlite3_malloc(sz);
   580    584     if( pCache ){
   581    585       memset(pCache, 0, sz);
   582    586       if( separateCache ){
   583    587         pGroup = (PGroup*)&pCache[1];
   584    588         pGroup->mxPinned = 10;
   585    589       }else{
   586    590         pGroup = &pcache1.grp;
   587    591       }
   588    592       pCache->pGroup = pGroup;
   589    593       pCache->szPage = szPage;
          594  +    pCache->szExtra = szExtra;
   590    595       pCache->bPurgeable = (bPurgeable ? 1 : 0);
   591    596       if( bPurgeable ){
   592    597         pCache->nMin = 10;
   593    598         pcache1EnterMutex(pGroup);
   594    599         pGroup->nMinPage += pCache->nMin;
   595    600         pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
   596    601         pcache1LeaveMutex(pGroup);
................................................................................
   680    685   **
   681    686   **      then attempt to recycle a page from the LRU list. If it is the right
   682    687   **      size, return the recycled buffer. Otherwise, free the buffer and
   683    688   **      proceed to step 5. 
   684    689   **
   685    690   **   5. Otherwise, allocate and return a new page buffer.
   686    691   */
   687         -static void *pcache1Fetch(sqlite3_pcache *p, unsigned int iKey, int createFlag){
          692  +static sqlite3_pcache_page *pcache1Fetch(
          693  +  sqlite3_pcache *p, 
          694  +  unsigned int iKey, 
          695  +  int createFlag
          696  +){
   688    697     int nPinned;
   689    698     PCache1 *pCache = (PCache1 *)p;
   690    699     PGroup *pGroup;
   691    700     PgHdr1 *pPage = 0;
   692    701   
   693    702     assert( pCache->bPurgeable || createFlag!=1 );
   694    703     assert( pCache->bPurgeable || pCache->nMin==0 );
................................................................................
   715    724     ** optimization:  The common case is to exit the module before reaching
   716    725     ** this point.
   717    726     */
   718    727   #ifdef SQLITE_MUTEX_OMIT
   719    728     pGroup = pCache->pGroup;
   720    729   #endif
   721    730   
   722         -
   723    731     /* Step 3: Abort if createFlag is 1 but the cache is nearly full */
   724    732     nPinned = pCache->nPage - pCache->nRecyclable;
   725    733     assert( nPinned>=0 );
   726    734     assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage );
   727    735     assert( pCache->n90pct == pCache->nMax*9/10 );
   728    736     if( createFlag==1 && (
   729    737           nPinned>=pGroup->mxPinned
................................................................................
   739    747   
   740    748     /* Step 4. Try to recycle a page. */
   741    749     if( pCache->bPurgeable && pGroup->pLruTail && (
   742    750            (pCache->nPage+1>=pCache->nMax)
   743    751         || pGroup->nCurrentPage>=pGroup->nMaxPage
   744    752         || pcache1UnderMemoryPressure(pCache)
   745    753     )){
   746         -    PCache1 *pOtherCache;
          754  +    PCache1 *pOther;
   747    755       pPage = pGroup->pLruTail;
   748    756       pcache1RemoveFromHash(pPage);
   749    757       pcache1PinPage(pPage);
   750         -    if( (pOtherCache = pPage->pCache)->szPage!=pCache->szPage ){
          758  +    pOther = pPage->pCache;
          759  +
          760  +    /* We want to verify that szPage and szExtra are the same for pOther
          761  +    ** and pCache.  Assert that we can verify this by comparing sums. */
          762  +    assert( (pCache->szPage & (pCache->szPage-1))==0 && pCache->szPage>=512 );
          763  +    assert( pCache->szExtra<512 );
          764  +    assert( (pOther->szPage & (pOther->szPage-1))==0 && pOther->szPage>=512 );
          765  +    assert( pOther->szExtra<512 );
          766  +
          767  +    if( pOther->szPage+pOther->szExtra != pCache->szPage+pCache->szExtra ){
   751    768         pcache1FreePage(pPage);
   752    769         pPage = 0;
   753    770       }else{
   754         -      pGroup->nCurrentPage -= 
   755         -               (pOtherCache->bPurgeable - pCache->bPurgeable);
          771  +      pGroup->nCurrentPage -= (pOther->bPurgeable - pCache->bPurgeable);
   756    772       }
   757    773     }
   758    774   
   759    775     /* Step 5. If a usable page buffer has still not been found, 
   760    776     ** attempt to allocate a new one. 
   761    777     */
   762    778     if( !pPage ){
................................................................................
   769    785       unsigned int h = iKey % pCache->nHash;
   770    786       pCache->nPage++;
   771    787       pPage->iKey = iKey;
   772    788       pPage->pNext = pCache->apHash[h];
   773    789       pPage->pCache = pCache;
   774    790       pPage->pLruPrev = 0;
   775    791       pPage->pLruNext = 0;
   776         -    *(void **)(PGHDR1_TO_PAGE(pPage)) = 0;
          792  +    *(void **)pPage->page.pExtra = 0;
   777    793       pCache->apHash[h] = pPage;
   778    794     }
   779    795   
   780    796   fetch_out:
   781    797     if( pPage && iKey>pCache->iMaxKey ){
   782    798       pCache->iMaxKey = iKey;
   783    799     }
   784    800     pcache1LeaveMutex(pGroup);
   785         -  return (pPage ? PGHDR1_TO_PAGE(pPage) : 0);
          801  +  return &pPage->page;
   786    802   }
   787    803   
   788    804   
   789    805   /*
   790    806   ** Implementation of the sqlite3_pcache.xUnpin method.
   791    807   **
   792    808   ** Mark a page as unpinned (eligible for asynchronous recycling).
   793    809   */
   794         -static void pcache1Unpin(sqlite3_pcache *p, void *pPg, int reuseUnlikely){
          810  +static void pcache1Unpin(
          811  +  sqlite3_pcache *p, 
          812  +  sqlite3_pcache_page *pPg, 
          813  +  int reuseUnlikely
          814  +){
   795    815     PCache1 *pCache = (PCache1 *)p;
   796         -  PgHdr1 *pPage = PAGE_TO_PGHDR1(pCache, pPg);
          816  +  PgHdr1 *pPage = (PgHdr1 *)pPg;
   797    817     PGroup *pGroup = pCache->pGroup;
   798    818    
   799    819     assert( pPage->pCache==pCache );
   800    820     pcache1EnterMutex(pGroup);
   801    821   
   802    822     /* It is an error to call this function if the page is already 
   803    823     ** part of the PGroup LRU list.
................................................................................
   825    845   }
   826    846   
   827    847   /*
   828    848   ** Implementation of the sqlite3_pcache.xRekey method. 
   829    849   */
   830    850   static void pcache1Rekey(
   831    851     sqlite3_pcache *p,
   832         -  void *pPg,
          852  +  sqlite3_pcache_page *pPg,
   833    853     unsigned int iOld,
   834    854     unsigned int iNew
   835    855   ){
   836    856     PCache1 *pCache = (PCache1 *)p;
   837         -  PgHdr1 *pPage = PAGE_TO_PGHDR1(pCache, pPg);
          857  +  PgHdr1 *pPage = (PgHdr1 *)pPg;
   838    858     PgHdr1 **pp;
   839    859     unsigned int h; 
   840    860     assert( pPage->iKey==iOld );
   841    861     assert( pPage->pCache==pCache );
   842    862   
   843    863     pcache1EnterMutex(pCache->pGroup);
   844    864   
................................................................................
   899    919   
   900    920   /*
   901    921   ** This function is called during initialization (sqlite3_initialize()) to
   902    922   ** install the default pluggable cache module, assuming the user has not
   903    923   ** already provided an alternative.
   904    924   */
   905    925   void sqlite3PCacheSetDefault(void){
   906         -  static const sqlite3_pcache_methods defaultMethods = {
          926  +  static const sqlite3_pcache_methods2 defaultMethods = {
          927  +    1,                       /* iVersion */
   907    928       0,                       /* pArg */
   908    929       pcache1Init,             /* xInit */
   909    930       pcache1Shutdown,         /* xShutdown */
   910    931       pcache1Create,           /* xCreate */
   911    932       pcache1Cachesize,        /* xCachesize */
   912    933       pcache1Pagecount,        /* xPagecount */
   913    934       pcache1Fetch,            /* xFetch */
   914    935       pcache1Unpin,            /* xUnpin */
   915    936       pcache1Rekey,            /* xRekey */
   916    937       pcache1Truncate,         /* xTruncate */
   917    938       pcache1Destroy           /* xDestroy */
   918    939     };
   919         -  sqlite3_config(SQLITE_CONFIG_PCACHE, &defaultMethods);
          940  +  sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods);
   920    941   }
   921    942   
   922    943   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
   923    944   /*
   924    945   ** This function is called to free superfluous dynamically allocated memory
   925    946   ** held by the pager system. Memory in use by any SQLite pager allocated
   926    947   ** by the current thread may be sqlite3_free()ed.
................................................................................
   933    954     int nFree = 0;
   934    955     assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
   935    956     assert( sqlite3_mutex_notheld(pcache1.mutex) );
   936    957     if( pcache1.pStart==0 ){
   937    958       PgHdr1 *p;
   938    959       pcache1EnterMutex(&pcache1.grp);
   939    960       while( (nReq<0 || nFree<nReq) && ((p=pcache1.grp.pLruTail)!=0) ){
   940         -      nFree += pcache1MemSize(PGHDR1_TO_PAGE(p));
          961  +      nFree += pcache1MemSize(p->page.pBuf);
          962  +#ifdef SQLITE_PCACHE_SEPARATE_HEADER
          963  +      nFree += sqlite3MemSize(p);
          964  +#endif
   941    965         pcache1PinPage(p);
   942    966         pcache1RemoveFromHash(p);
   943    967         pcache1FreePage(p);
   944    968       }
   945    969       pcache1LeaveMutex(&pcache1.grp);
   946    970     }
   947    971     return nFree;

Changes to src/pragma.c.

   342    342   
   343    343     assert( pId2 );
   344    344     zDb = pId2->n>0 ? pDb->zName : 0;
   345    345     if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
   346    346       goto pragma_out;
   347    347     }
   348    348    
   349         -#ifndef SQLITE_OMIT_PAGER_PRAGMAS
          349  +#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
   350    350     /*
   351    351     **  PRAGMA [database.]default_cache_size
   352    352     **  PRAGMA [database.]default_cache_size=N
   353    353     **
   354    354     ** The first form reports the current persistent setting for the
   355    355     ** page cache size.  The value returned is the maximum number of
   356    356     ** pages in the page cache.  The second form sets both the current
................................................................................
   391    391         sqlite3VdbeAddOp2(v, OP_Integer, size, 1);
   392    392         sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, 1);
   393    393         assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
   394    394         pDb->pSchema->cache_size = size;
   395    395         sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
   396    396       }
   397    397     }else
          398  +#endif /* !SQLITE_OMIT_PAGER_PRAGMAS && !SQLITE_OMIT_DEPRECATED */
   398    399   
          400  +#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
   399    401     /*
   400    402     **  PRAGMA [database.]page_size
   401    403     **  PRAGMA [database.]page_size=N
   402    404     **
   403    405     ** The first form reports the current setting for the
   404    406     ** database page size in bytes.  The second form sets the
   405    407     ** database page size value.  The value can only be set if
................................................................................
   412    414         int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;
   413    415         returnSingleInt(pParse, "page_size", size);
   414    416       }else{
   415    417         /* Malloc may fail when setting the page-size, as there is an internal
   416    418         ** buffer that the pager module resizes using sqlite3_realloc().
   417    419         */
   418    420         db->nextPagesize = sqlite3Atoi(zRight);
   419         -      if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){
          421  +      if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){
   420    422           db->mallocFailed = 1;
   421    423         }
   422    424       }
   423    425     }else
   424    426   
   425    427     /*
   426    428     **  PRAGMA [database.]secure_delete
................................................................................
   452    454     **  PRAGMA [database.]max_page_count=N
   453    455     **
   454    456     ** The first form reports the current setting for the
   455    457     ** maximum number of pages in the database file.  The 
   456    458     ** second form attempts to change this setting.  Both
   457    459     ** forms return the current setting.
   458    460     **
          461  +  ** The absolute value of N is used.  This is undocumented and might
          462  +  ** change.  The only purpose is to provide an easy way to test
          463  +  ** the sqlite3AbsInt32() function.
          464  +  **
   459    465     **  PRAGMA [database.]page_count
   460    466     **
   461    467     ** Return the number of pages in the specified database.
   462    468     */
   463    469     if( sqlite3StrICmp(zLeft,"page_count")==0
   464    470      || sqlite3StrICmp(zLeft,"max_page_count")==0
   465    471     ){
................................................................................
   466    472       int iReg;
   467    473       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
   468    474       sqlite3CodeVerifySchema(pParse, iDb);
   469    475       iReg = ++pParse->nMem;
   470    476       if( sqlite3Tolower(zLeft[0])=='p' ){
   471    477         sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);
   472    478       }else{
   473         -      sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, sqlite3Atoi(zRight));
          479  +      sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, 
          480  +                        sqlite3AbsInt32(sqlite3Atoi(zRight)));
   474    481       }
   475    482       sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);
   476    483       sqlite3VdbeSetNumCols(v, 1);
   477    484       sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);
   478    485     }else
   479    486   
   480    487     /*
................................................................................
   680    687   
   681    688   #ifndef SQLITE_OMIT_PAGER_PRAGMAS
   682    689     /*
   683    690     **  PRAGMA [database.]cache_size
   684    691     **  PRAGMA [database.]cache_size=N
   685    692     **
   686    693     ** The first form reports the current local setting for the
   687         -  ** page cache size.  The local setting can be different from
   688         -  ** the persistent cache size value that is stored in the database
   689         -  ** file itself.  The value returned is the maximum number of
   690         -  ** pages in the page cache.  The second form sets the local
   691         -  ** page cache size value.  It does not change the persistent
   692         -  ** cache size stored on the disk so the cache size will revert
   693         -  ** to its default value when the database is closed and reopened.
   694         -  ** N should be a positive integer.
          694  +  ** page cache size. The second form sets the local
          695  +  ** page cache size value.  If N is positive then that is the
          696  +  ** number of pages in the cache.  If N is negative, then the
          697  +  ** number of pages is adjusted so that the cache uses -N kibibytes
          698  +  ** of memory.
   695    699     */
   696    700     if( sqlite3StrICmp(zLeft,"cache_size")==0 ){
   697    701       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
   698    702       assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
   699    703       if( !zRight ){
   700    704         returnSingleInt(pParse, "cache_size", pDb->pSchema->cache_size);
   701    705       }else{
   702         -      int size = sqlite3AbsInt32(sqlite3Atoi(zRight));
          706  +      int size = sqlite3Atoi(zRight);
   703    707         pDb->pSchema->cache_size = size;
   704    708         sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
   705    709       }
   706    710     }else
   707    711   
   708    712     /*
   709    713     **   PRAGMA temp_store

Changes to src/prepare.c.

   274    274       }
   275    275     }else{
   276    276       DbSetProperty(db, iDb, DB_Empty);
   277    277     }
   278    278     pDb->pSchema->enc = ENC(db);
   279    279   
   280    280     if( pDb->pSchema->cache_size==0 ){
          281  +#ifndef SQLITE_OMIT_DEPRECATED
   281    282       size = sqlite3AbsInt32(meta[BTREE_DEFAULT_CACHE_SIZE-1]);
   282    283       if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }
   283    284       pDb->pSchema->cache_size = size;
          285  +#else
          286  +    pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;
          287  +#endif
   284    288       sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
   285    289     }
   286    290   
   287    291     /*
   288    292     ** file_format==1    Version 3.0.0.
   289    293     ** file_format==2    Version 3.1.3.  // ALTER TABLE ADD COLUMN
   290    294     ** file_format==3    Version 3.1.4.  // ditto but with non-NULL defaults

Changes to src/shell.c.

  2216   2216         { "benign_malloc_hooks",   SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS    },
  2217   2217         { "pending_byte",          SQLITE_TESTCTRL_PENDING_BYTE           },
  2218   2218         { "assert",                SQLITE_TESTCTRL_ASSERT                 },
  2219   2219         { "always",                SQLITE_TESTCTRL_ALWAYS                 },
  2220   2220         { "reserve",               SQLITE_TESTCTRL_RESERVE                },
  2221   2221         { "optimizations",         SQLITE_TESTCTRL_OPTIMIZATIONS          },
  2222   2222         { "iskeyword",             SQLITE_TESTCTRL_ISKEYWORD              },
  2223         -      { "pghdrsz",               SQLITE_TESTCTRL_PGHDRSZ                },
  2224   2223         { "scratchmalloc",         SQLITE_TESTCTRL_SCRATCHMALLOC          },
  2225   2224       };
  2226   2225       int testctrl = -1;
  2227   2226       int rc = 0;
  2228   2227       int i, n;
  2229   2228       open_db(p);
  2230   2229   
................................................................................
  2261   2260             }
  2262   2261             break;
  2263   2262   
  2264   2263           /* sqlite3_test_control(int) */
  2265   2264           case SQLITE_TESTCTRL_PRNG_SAVE:           
  2266   2265           case SQLITE_TESTCTRL_PRNG_RESTORE:        
  2267   2266           case SQLITE_TESTCTRL_PRNG_RESET:
  2268         -        case SQLITE_TESTCTRL_PGHDRSZ:             
  2269   2267             if( nArg==2 ){
  2270   2268               rc = sqlite3_test_control(testctrl);
  2271   2269               printf("%d (0x%08x)\n", rc, rc);
  2272   2270             } else {
  2273   2271               fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]);
  2274   2272             }
  2275   2273             break;

Changes to src/sqlite.h.in.

  1364   1364   ** scratch memory beyond what is provided by this configuration option, then 
  1365   1365   ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
  1366   1366   **
  1367   1367   ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
  1368   1368   ** <dd> ^This option specifies a static memory buffer that SQLite can use for
  1369   1369   ** the database page cache with the default page cache implementation.  
  1370   1370   ** This configuration should not be used if an application-define page
  1371         -** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
         1371  +** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
  1372   1372   ** There are three arguments to this option: A pointer to 8-byte aligned
  1373   1373   ** memory, the size of each page buffer (sz), and the number of pages (N).
  1374   1374   ** The sz argument should be the size of the largest database page
  1375   1375   ** (a power of two between 512 and 32768) plus a little extra for each
  1376   1376   ** page header.  ^The page header size is 20 to 40 bytes depending on
  1377   1377   ** the host architecture.  ^It is harmless, apart from the wasted memory,
  1378   1378   ** to make sz a little too large.  The first
................................................................................
  1433   1433   ** [database connection].  The first argument is the
  1434   1434   ** size of each lookaside buffer slot and the second is the number of
  1435   1435   ** slots allocated to each database connection.)^  ^(This option sets the
  1436   1436   ** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
  1437   1437   ** verb to [sqlite3_db_config()] can be used to change the lookaside
  1438   1438   ** configuration on individual connections.)^ </dd>
  1439   1439   **
  1440         -** [[SQLITE_CONFIG_PCACHE]] <dt>SQLITE_CONFIG_PCACHE</dt>
         1440  +** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
  1441   1441   ** <dd> ^(This option takes a single argument which is a pointer to
  1442         -** an [sqlite3_pcache_methods] object.  This object specifies the interface
         1442  +** an [sqlite3_pcache_methods2] object.  This object specifies the interface
  1443   1443   ** to a custom page cache implementation.)^  ^SQLite makes a copy of the
  1444   1444   ** object and uses it for page cache memory allocations.</dd>
  1445   1445   **
  1446         -** [[SQLITE_CONFIG_GETPCACHE]] <dt>SQLITE_CONFIG_GETPCACHE</dt>
         1446  +** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
  1447   1447   ** <dd> ^(This option takes a single argument which is a pointer to an
  1448         -** [sqlite3_pcache_methods] object.  SQLite copies of the current
         1448  +** [sqlite3_pcache_methods2] object.  SQLite copies of the current
  1449   1449   ** page cache implementation into that object.)^ </dd>
  1450   1450   **
  1451   1451   ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
  1452   1452   ** <dd> ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
  1453   1453   ** function with a call signature of void(*)(void*,int,const char*), 
  1454   1454   ** and a pointer to void. ^If the function pointer is not NULL, it is
  1455   1455   ** invoked by [sqlite3_log()] to process each logging event.  ^If the
................................................................................
  1474   1474   ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
  1475   1475   ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
  1476   1476   ** connection is opened. If it is globally disabled, filenames are
  1477   1477   ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
  1478   1478   ** database connection is opened. By default, URI handling is globally
  1479   1479   ** disabled. The default value may be changed by compiling with the
  1480   1480   ** [SQLITE_USE_URI] symbol defined.
         1481  +**
         1482  +** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]
         1483  +** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFNIG_GETPCACHE
         1484  +** <dd> These options are obsolete and should not be used by new code.
         1485  +** They are retained for backwards compatibility but are now no-ops.
  1481   1486   ** </dl>
  1482   1487   */
  1483   1488   #define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */
  1484   1489   #define SQLITE_CONFIG_MULTITHREAD   2  /* nil */
  1485   1490   #define SQLITE_CONFIG_SERIALIZED    3  /* nil */
  1486   1491   #define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */
  1487   1492   #define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */
................................................................................
  1489   1494   #define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */
  1490   1495   #define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */
  1491   1496   #define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */
  1492   1497   #define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */
  1493   1498   #define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* */
  1494   1499   /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ 
  1495   1500   #define SQLITE_CONFIG_LOOKASIDE    13  /* int int */
  1496         -#define SQLITE_CONFIG_PCACHE       14  /* sqlite3_pcache_methods* */
  1497         -#define SQLITE_CONFIG_GETPCACHE    15  /* sqlite3_pcache_methods* */
         1501  +#define SQLITE_CONFIG_PCACHE       14  /* no-op */
         1502  +#define SQLITE_CONFIG_GETPCACHE    15  /* no-op */
  1498   1503   #define SQLITE_CONFIG_LOG          16  /* xFunc, void* */
  1499   1504   #define SQLITE_CONFIG_URI          17  /* int */
         1505  +#define SQLITE_CONFIG_PCACHE2      18  /* sqlite3_pcache_methods2* */
         1506  +#define SQLITE_CONFIG_GETPCACHE2   19  /* sqlite3_pcache_methods2* */
  1500   1507   
  1501   1508   /*
  1502   1509   ** CAPI3REF: Database Connection Configuration Options
  1503   1510   **
  1504   1511   ** These constants are the available integer configuration options that
  1505   1512   ** can be passed as the second argument to the [sqlite3_db_config()] interface.
  1506   1513   **
................................................................................
  4551   4558   **
  4552   4559   ** <ul>
  4553   4560   ** <li> The soft heap limit is set to zero.
  4554   4561   ** <li> Memory accounting is disabled using a combination of the
  4555   4562   **      [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
  4556   4563   **      the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
  4557   4564   ** <li> An alternative page cache implementation is specified using
  4558         -**      [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
         4565  +**      [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).
  4559   4566   ** <li> The page cache allocates from its own memory pool supplied
  4560   4567   **      by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
  4561   4568   **      from the heap.
  4562   4569   ** </ul>)^
  4563   4570   **
  4564   4571   ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
  4565   4572   ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
................................................................................
  5619   5626   #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10
  5620   5627   #define SQLITE_TESTCTRL_PENDING_BYTE            11
  5621   5628   #define SQLITE_TESTCTRL_ASSERT                  12
  5622   5629   #define SQLITE_TESTCTRL_ALWAYS                  13
  5623   5630   #define SQLITE_TESTCTRL_RESERVE                 14
  5624   5631   #define SQLITE_TESTCTRL_OPTIMIZATIONS           15
  5625   5632   #define SQLITE_TESTCTRL_ISKEYWORD               16
  5626         -#define SQLITE_TESTCTRL_PGHDRSZ                 17
  5627         -#define SQLITE_TESTCTRL_SCRATCHMALLOC           18
  5628         -#define SQLITE_TESTCTRL_LOCALTIME_FAULT         19
  5629         -#define SQLITE_TESTCTRL_LAST                    19
         5633  +#define SQLITE_TESTCTRL_SCRATCHMALLOC           17
         5634  +#define SQLITE_TESTCTRL_LOCALTIME_FAULT         18
         5635  +#define SQLITE_TESTCTRL_LAST                    18
  5630   5636   
  5631   5637   /*
  5632   5638   ** CAPI3REF: SQLite Runtime Status
  5633   5639   **
  5634   5640   ** ^This interface is used to retrieve runtime status information
  5635   5641   ** about the performance of SQLite, and optionally to reset various
  5636   5642   ** highwater marks.  ^The first argument is an integer code for
................................................................................
  5924   5930   **
  5925   5931   ** The sqlite3_pcache type is opaque.  It is implemented by
  5926   5932   ** the pluggable module.  The SQLite core has no knowledge of
  5927   5933   ** its size or internal structure and never deals with the
  5928   5934   ** sqlite3_pcache object except by holding and passing pointers
  5929   5935   ** to the object.
  5930   5936   **
  5931         -** See [sqlite3_pcache_methods] for additional information.
         5937  +** See [sqlite3_pcache_methods2] for additional information.
  5932   5938   */
  5933   5939   typedef struct sqlite3_pcache sqlite3_pcache;
         5940  +
         5941  +/*
         5942  +** CAPI3REF: Custom Page Cache Object
         5943  +**
         5944  +** The sqlite3_pcache_page object represents a single page in the
         5945  +** page cache.  The page cache will allocate instances of this
         5946  +** object.  Various methods of the page cache use pointers to instances
         5947  +** of this object as parameters or as their return value.
         5948  +**
         5949  +** See [sqlite3_pcache_methods2] for additional information.
         5950  +*/
         5951  +typedef struct sqlite3_pcache_page sqlite3_pcache_page;
         5952  +struct sqlite3_pcache_page {
         5953  +  void *pBuf;        /* The content of the page */
         5954  +  void *pExtra;      /* Extra information associated with the page */
         5955  +};
  5934   5956   
  5935   5957   /*
  5936   5958   ** CAPI3REF: Application Defined Page Cache.
  5937   5959   ** KEYWORDS: {page cache}
  5938   5960   **
  5939         -** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can
         5961  +** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
  5940   5962   ** register an alternative page cache implementation by passing in an 
  5941         -** instance of the sqlite3_pcache_methods structure.)^
         5963  +** instance of the sqlite3_pcache_methods2 structure.)^
  5942   5964   ** In many applications, most of the heap memory allocated by 
  5943   5965   ** SQLite is used for the page cache.
  5944   5966   ** By implementing a 
  5945   5967   ** custom page cache using this API, an application can better control
  5946   5968   ** the amount of memory consumed by SQLite, the way in which 
  5947   5969   ** that memory is allocated and released, and the policies used to 
  5948   5970   ** determine exactly which parts of a database file are cached and for 
  5949   5971   ** how long.
  5950   5972   **
  5951   5973   ** The alternative page cache mechanism is an
  5952   5974   ** extreme measure that is only needed by the most demanding applications.
  5953   5975   ** The built-in page cache is recommended for most uses.
  5954   5976   **
  5955         -** ^(The contents of the sqlite3_pcache_methods structure are copied to an
         5977  +** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
  5956   5978   ** internal buffer by SQLite within the call to [sqlite3_config].  Hence
  5957   5979   ** the application may discard the parameter after the call to
  5958   5980   ** [sqlite3_config()] returns.)^
  5959   5981   **
  5960   5982   ** [[the xInit() page cache method]]
  5961   5983   ** ^(The xInit() method is called once for each effective 
  5962   5984   ** call to [sqlite3_initialize()])^
................................................................................
  5983   6005   ** ^SQLite will never invoke xInit() more than once without an intervening
  5984   6006   ** call to xShutdown().
  5985   6007   **
  5986   6008   ** [[the xCreate() page cache methods]]
  5987   6009   ** ^SQLite invokes the xCreate() method to construct a new cache instance.
  5988   6010   ** SQLite will typically create one cache instance for each open database file,
  5989   6011   ** though this is not guaranteed. ^The
  5990         -** first parameter, szPage, is the size in bytes of the pages that must
  5991         -** be allocated by the cache.  ^szPage will not be a power of two.  ^szPage
  5992         -** will the page size of the database file that is to be cached plus an
  5993         -** increment (here called "R") of less than 250.  SQLite will use the
  5994         -** extra R bytes on each page to store metadata about the underlying
  5995         -** database page on disk.  The value of R depends
         6012  +** parameter parameter, szPage, is the size in bytes of the pages that must
         6013  +** be allocated by the cache.  ^szPage will always a power of two.  ^The
         6014  +** second parameter szExtra is a number of bytes of extra storage 
         6015  +** associated with each page cache entry.  ^The szExtra parameter will
         6016  +** a number less than 250.  SQLite will use the
         6017  +** extra szExtra bytes on each page to store metadata about the underlying
         6018  +** database page on disk.  The value passed into szExtra depends
  5996   6019   ** on the SQLite version, the target platform, and how SQLite was compiled.
  5997         -** ^(R is constant for a particular build of SQLite. Except, there are two
  5998         -** distinct values of R when SQLite is compiled with the proprietary
  5999         -** ZIPVFS extension.)^  ^The second argument to
  6000         -** xCreate(), bPurgeable, is true if the cache being created will
  6001         -** be used to cache database pages of a file stored on disk, or
         6020  +** ^The third argument to xCreate(), bPurgeable, is true if the cache being
         6021  +** created will be used to cache database pages of a file stored on disk, or
  6002   6022   ** false if it is used for an in-memory database. The cache implementation
  6003   6023   ** does not have to do anything special based with the value of bPurgeable;
  6004   6024   ** it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
  6005   6025   ** never invoke xUnpin() except to deliberately delete a page.
  6006   6026   ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
  6007   6027   ** false will always have the "discard" flag set to true.  
  6008   6028   ** ^Hence, a cache created with bPurgeable false will
................................................................................
  6018   6038   **
  6019   6039   ** [[the xPagecount() page cache methods]]
  6020   6040   ** The xPagecount() method must return the number of pages currently
  6021   6041   ** stored in the cache, both pinned and unpinned.
  6022   6042   ** 
  6023   6043   ** [[the xFetch() page cache methods]]
  6024   6044   ** The xFetch() method locates a page in the cache and returns a pointer to 
  6025         -** the page, or a NULL pointer.
  6026         -** A "page", in this context, means a buffer of szPage bytes aligned at an
  6027         -** 8-byte boundary. The page to be fetched is determined by the key. ^The
  6028         -** minimum key value is 1.  After it has been retrieved using xFetch, the page 
  6029         -** is considered to be "pinned".
         6045  +** an sqlite3_pcache_page object associated with that page, or a NULL pointer.
         6046  +** The pBuf element of the returned sqlite3_pcache_page object will be a
         6047  +** pointer to a buffer of szPage bytes used to store the content of a 
         6048  +** single database page.  The pExtra element of sqlite3_pcache_page will be
         6049  +** a pointer to the szExtra bytes of extra storage that SQLite has requested
         6050  +** for each entry in the page cache.
         6051  +**
         6052  +** The page to be fetched is determined by the key. ^The minimum key value
         6053  +** is 1.  After it has been retrieved using xFetch, the page is considered
         6054  +** to be "pinned".
  6030   6055   **
  6031   6056   ** If the requested page is already in the page cache, then the page cache
  6032   6057   ** implementation must return a pointer to the page buffer with its content
  6033   6058   ** intact.  If the requested page is not already in the cache, then the
  6034   6059   ** cache implementation should use the value of the createFlag
  6035   6060   ** parameter to help it determined what action to take:
  6036   6061   **
................................................................................
  6078   6103   ** [[the xDestroy() page cache method]]
  6079   6104   ** ^The xDestroy() method is used to delete a cache allocated by xCreate().
  6080   6105   ** All resources associated with the specified cache should be freed. ^After
  6081   6106   ** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
  6082   6107   ** handle invalid, and will not use it with any other sqlite3_pcache_methods
  6083   6108   ** functions.
  6084   6109   */
         6110  +typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
         6111  +struct sqlite3_pcache_methods2 {
         6112  +  int iVersion;
         6113  +  void *pArg;
         6114  +  int (*xInit)(void*);
         6115  +  void (*xShutdown)(void*);
         6116  +  sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);
         6117  +  void (*xCachesize)(sqlite3_pcache*, int nCachesize);
         6118  +  int (*xPagecount)(sqlite3_pcache*);
         6119  +  sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
         6120  +  void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);
         6121  +  void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, 
         6122  +      unsigned oldKey, unsigned newKey);
         6123  +  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
         6124  +  void (*xDestroy)(sqlite3_pcache*);
         6125  +};
         6126  +
         6127  +/*
         6128  +** This is the obsolete pcache_methods object that has now been replaced
         6129  +** by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
         6130  +** retained in the header file for backwards compatibility only.
         6131  +*/
  6085   6132   typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
  6086   6133   struct sqlite3_pcache_methods {
  6087   6134     void *pArg;
  6088   6135     int (*xInit)(void*);
  6089   6136     void (*xShutdown)(void*);
  6090   6137     sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);
  6091   6138     void (*xCachesize)(sqlite3_pcache*, int nCachesize);
................................................................................
  6092   6139     int (*xPagecount)(sqlite3_pcache*);
  6093   6140     void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
  6094   6141     void (*xUnpin)(sqlite3_pcache*, void*, int discard);
  6095   6142     void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);
  6096   6143     void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
  6097   6144     void (*xDestroy)(sqlite3_pcache*);
  6098   6145   };
         6146  +
  6099   6147   
  6100   6148   /*
  6101   6149   ** CAPI3REF: Online Backup Object
  6102   6150   **
  6103   6151   ** The sqlite3_backup object records state information about an ongoing
  6104   6152   ** online backup operation.  ^The sqlite3_backup object is created by
  6105   6153   ** a call to [sqlite3_backup_init()] and is destroyed by a call to

Changes to src/sqliteInt.h.

  2454   2454     int bFullMutex;                   /* True to enable full mutexing */
  2455   2455     int bOpenUri;                     /* True to interpret filenames as URIs */
  2456   2456     int mxStrlen;                     /* Maximum string length */
  2457   2457     int szLookaside;                  /* Default lookaside buffer size */
  2458   2458     int nLookaside;                   /* Default lookaside buffer count */
  2459   2459     sqlite3_mem_methods m;            /* Low-level memory allocation interface */
  2460   2460     sqlite3_mutex_methods mutex;      /* Low-level mutex interface */
  2461         -  sqlite3_pcache_methods pcache;    /* Low-level page-cache interface */
         2461  +  sqlite3_pcache_methods2 pcache2;  /* Low-level page-cache interface */
  2462   2462     void *pHeap;                      /* Heap storage space */
  2463   2463     int nHeap;                        /* Size of pHeap[] */
  2464   2464     int mnReq, mxReq;                 /* Min and max heap requests sizes */
  2465   2465     void *pScratch;                   /* Scratch memory */
  2466   2466     int szScratch;                    /* Size of each scratch buffer */
  2467   2467     int nScratch;                     /* Number of scratch buffers */
  2468   2468     void *pPage;                      /* Page cache memory */

Changes to src/test_config.c.

    33     33   
    34     34   /*
    35     35   ** This routine sets entries in the global ::sqlite_options() array variable
    36     36   ** according to the compile-time configuration of the database.  Test
    37     37   ** procedures use this to determine when tests should be omitted.
    38     38   */
    39     39   static void set_options(Tcl_Interp *interp){
           40  +#ifdef HAVE_MALLOC_USABLE_SIZE
           41  +  Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "1",
           42  +              TCL_GLOBAL_ONLY);
           43  +#else
           44  +  Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "0",
           45  +              TCL_GLOBAL_ONLY);
           46  +#endif
           47  +
    40     48   #ifdef SQLITE_32BIT_ROWID
    41     49     Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY);
    42     50   #else
    43     51     Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY);
    44     52   #endif
    45     53   
    46     54   #ifdef SQLITE_CASE_SENSITIVE_LIKE

Changes to src/test_init.c.

    26     26   */
    27     27   
    28     28   #include "sqliteInt.h"
    29     29   #include <string.h>
    30     30   #include <tcl.h>
    31     31   
    32     32   static struct Wrapped {
    33         -  sqlite3_pcache_methods pcache;
    34         -  sqlite3_mem_methods    mem;
    35         -  sqlite3_mutex_methods  mutex;
           33  +  sqlite3_pcache_methods2 pcache;
           34  +  sqlite3_mem_methods     mem;
           35  +  sqlite3_mutex_methods   mutex;
    36     36   
    37     37     int mem_init;                /* True if mem subsystem is initalized */
    38     38     int mem_fail;                /* True to fail mem subsystem inialization */
    39     39     int mutex_init;              /* True if mutex subsystem is initalized */
    40     40     int mutex_fail;              /* True to fail mutex subsystem inialization */
    41     41     int pcache_init;             /* True if pcache subsystem is initalized */
    42     42     int pcache_fail;             /* True to fail pcache subsystem inialization */
................................................................................
   119    119     return rc;
   120    120   }
   121    121   static void wrPCacheShutdown(void *pArg){
   122    122     wrapped.pcache.xShutdown(wrapped.pcache.pArg);
   123    123     wrapped.pcache_init = 0;
   124    124   }
   125    125   
   126         -static sqlite3_pcache *wrPCacheCreate(int a, int b){
   127         -  return wrapped.pcache.xCreate(a, b);
          126  +static sqlite3_pcache *wrPCacheCreate(int a, int b, int c){
          127  +  return wrapped.pcache.xCreate(a, b, c);
   128    128   }  
   129    129   static void wrPCacheCachesize(sqlite3_pcache *p, int n){
   130    130     wrapped.pcache.xCachesize(p, n);
   131    131   }  
   132    132   static int wrPCachePagecount(sqlite3_pcache *p){
   133    133     return wrapped.pcache.xPagecount(p);
   134    134   }  
   135         -static void *wrPCacheFetch(sqlite3_pcache *p, unsigned a, int b){
          135  +static sqlite3_pcache_page *wrPCacheFetch(sqlite3_pcache *p, unsigned a, int b){
   136    136     return wrapped.pcache.xFetch(p, a, b);
   137    137   }  
   138         -static void wrPCacheUnpin(sqlite3_pcache *p, void *a, int b){
          138  +static void wrPCacheUnpin(sqlite3_pcache *p, sqlite3_pcache_page *a, int b){
   139    139     wrapped.pcache.xUnpin(p, a, b);
   140    140   }  
   141         -static void wrPCacheRekey(sqlite3_pcache *p, void *a, unsigned b, unsigned c){
          141  +static void wrPCacheRekey(
          142  +  sqlite3_pcache *p, 
          143  +  sqlite3_pcache_page *a, 
          144  +  unsigned b, 
          145  +  unsigned c
          146  +){
   142    147     wrapped.pcache.xRekey(p, a, b, c);
   143    148   }  
   144    149   static void wrPCacheTruncate(sqlite3_pcache *p, unsigned a){
   145    150     wrapped.pcache.xTruncate(p, a);
   146    151   }  
   147    152   static void wrPCacheDestroy(sqlite3_pcache *p){
   148    153     wrapped.pcache.xDestroy(p);
................................................................................
   150    155   
   151    156   static void installInitWrappers(void){
   152    157     sqlite3_mutex_methods mutexmethods = {
   153    158       wrMutexInit,  wrMutexEnd,   wrMutexAlloc,
   154    159       wrMutexFree,  wrMutexEnter, wrMutexTry,
   155    160       wrMutexLeave, wrMutexHeld,  wrMutexNotheld
   156    161     };
   157         -  sqlite3_pcache_methods pcachemethods = {
   158         -    0,
          162  +  sqlite3_pcache_methods2 pcachemethods = {
          163  +    1, 0,
   159    164       wrPCacheInit,      wrPCacheShutdown,  wrPCacheCreate, 
   160    165       wrPCacheCachesize, wrPCachePagecount, wrPCacheFetch,
   161    166       wrPCacheUnpin,     wrPCacheRekey,     wrPCacheTruncate,  
   162    167       wrPCacheDestroy
   163    168     };
   164    169     sqlite3_mem_methods memmethods = {
   165    170       wrMemMalloc,   wrMemFree,    wrMemRealloc,
................................................................................
   169    174     };
   170    175   
   171    176     memset(&wrapped, 0, sizeof(wrapped));
   172    177   
   173    178     sqlite3_shutdown();
   174    179     sqlite3_config(SQLITE_CONFIG_GETMUTEX, &wrapped.mutex);
   175    180     sqlite3_config(SQLITE_CONFIG_GETMALLOC, &wrapped.mem);
   176         -  sqlite3_config(SQLITE_CONFIG_GETPCACHE, &wrapped.pcache);
          181  +  sqlite3_config(SQLITE_CONFIG_GETPCACHE2, &wrapped.pcache);
   177    182     sqlite3_config(SQLITE_CONFIG_MUTEX, &mutexmethods);
   178    183     sqlite3_config(SQLITE_CONFIG_MALLOC, &memmethods);
   179         -  sqlite3_config(SQLITE_CONFIG_PCACHE, &pcachemethods);
          184  +  sqlite3_config(SQLITE_CONFIG_PCACHE2, &pcachemethods);
   180    185   }
   181    186   
   182    187   static int init_wrapper_install(
   183    188     ClientData clientData, /* Unused */
   184    189     Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   185    190     int objc,              /* Number of arguments */
   186    191     Tcl_Obj *CONST objv[]  /* Command arguments */
................................................................................
   214    219       return TCL_ERROR;
   215    220     }
   216    221   
   217    222     memset(&wrapped, 0, sizeof(&wrapped));
   218    223     sqlite3_shutdown();
   219    224     sqlite3_config(SQLITE_CONFIG_MUTEX, &wrapped.mutex);
   220    225     sqlite3_config(SQLITE_CONFIG_MALLOC, &wrapped.mem);
   221         -  sqlite3_config(SQLITE_CONFIG_PCACHE, &wrapped.pcache);
          226  +  sqlite3_config(SQLITE_CONFIG_PCACHE2, &wrapped.pcache);
   222    227     return TCL_OK;
   223    228   }
   224    229   
   225    230   static int init_wrapper_clear(
   226    231     ClientData clientData, /* Unused */
   227    232     Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   228    233     int objc,              /* Number of arguments */

Changes to src/test_pcache.c.

    96     96   
    97     97   /*
    98     98   ** Private implementation of a page cache.
    99     99   */
   100    100   typedef struct testpcache testpcache;
   101    101   struct testpcache {
   102    102     int szPage;               /* Size of each page.  Multiple of 8. */
          103  +  int szExtra;              /* Size of extra data that accompanies each page */
   103    104     int bPurgeable;           /* True if the page cache is purgeable */
   104    105     int nFree;                /* Number of unused slots in a[] */
   105    106     int nPinned;              /* Number of pinned slots in a[] */
   106    107     unsigned iRand;           /* State of the PRNG */
   107    108     unsigned iMagic;          /* Magic number for sanity checking */
   108    109     struct testpcachePage {
          110  +    sqlite3_pcache_page page;  /* Base class */
   109    111       unsigned key;              /* The key for this page. 0 means unallocated */
   110    112       int isPinned;              /* True if the page is pinned */
   111         -    void *pData;               /* Data for this page */
   112    113     } a[TESTPCACHE_NPAGE];    /* All pages in the cache */
   113    114   };
   114    115   
   115    116   /*
   116    117   ** Get a random number using the PRNG in the given page cache.
   117    118   */
   118    119   static unsigned testpcacheRandom(testpcache *p){
................................................................................
   125    126     return x;
   126    127   }
   127    128   
   128    129   
   129    130   /*
   130    131   ** Allocate a new page cache instance.
   131    132   */
   132         -static sqlite3_pcache *testpcacheCreate(int szPage, int bPurgeable){
          133  +static sqlite3_pcache *testpcacheCreate(
          134  +  int szPage, 
          135  +  int szExtra, 
          136  +  int bPurgeable
          137  +){
   133    138     int nMem;
   134    139     char *x;
   135    140     testpcache *p;
   136    141     int i;
   137    142     assert( testpcacheGlobal.pDummy!=0 );
   138    143     szPage = (szPage+7)&~7;
   139         -  nMem = sizeof(testpcache) + TESTPCACHE_NPAGE*szPage;
          144  +  nMem = sizeof(testpcache) + TESTPCACHE_NPAGE*(szPage+szExtra);
   140    145     p = sqlite3_malloc( nMem );
   141    146     if( p==0 ) return 0;
   142    147     x = (char*)&p[1];
   143    148     p->szPage = szPage;
          149  +  p->szExtra = szExtra;
   144    150     p->nFree = TESTPCACHE_NPAGE;
   145    151     p->nPinned = 0;
   146    152     p->iRand = testpcacheGlobal.prngSeed;
   147    153     p->bPurgeable = bPurgeable;
   148    154     p->iMagic = TESTPCACHE_VALID;
   149         -  for(i=0; i<TESTPCACHE_NPAGE; i++, x += szPage){
          155  +  for(i=0; i<TESTPCACHE_NPAGE; i++, x += (szPage+szExtra)){
   150    156       p->a[i].key = 0;
   151    157       p->a[i].isPinned = 0;
   152         -    p->a[i].pData = (void*)x;
          158  +    p->a[i].page.pBuf = (void*)x;
          159  +    p->a[i].page.pExtra = (void*)&x[szPage];
   153    160     }
   154    161     testpcacheGlobal.nInstance++;
   155    162     return (sqlite3_pcache*)p;
   156    163   }
   157    164   
   158    165   /*
   159    166   ** Set the cache size
................................................................................
   176    183     assert( testpcacheGlobal.nInstance>0 );
   177    184     return TESTPCACHE_NPAGE - p->nFree;
   178    185   }
   179    186   
   180    187   /*
   181    188   ** Fetch a page.
   182    189   */
   183         -static void *testpcacheFetch(
          190  +static sqlite3_pcache_page *testpcacheFetch(
   184    191     sqlite3_pcache *pCache,
   185    192     unsigned key,
   186    193     int createFlag
   187    194   ){
   188    195     testpcache *p = (testpcache*)pCache;
   189    196     int i, j;
   190    197     assert( p->iMagic==TESTPCACHE_VALID );
................................................................................
   195    202     for(i=0; i<TESTPCACHE_NPAGE; i++){
   196    203       if( p->a[i].key==key ){
   197    204         if( !p->a[i].isPinned ){
   198    205           p->nPinned++;
   199    206           assert( p->nPinned <= TESTPCACHE_NPAGE - p->nFree );
   200    207           p->a[i].isPinned = 1;
   201    208         }
   202         -      return p->a[i].pData;
          209  +      return &p->a[i].page;
   203    210       }
   204    211     }
   205    212   
   206    213     /* If createFlag is 0, never allocate a new page */
   207    214     if( createFlag==0 ){
   208    215       return 0;
   209    216     }
................................................................................
   232    239     */
   233    240     if( p->nFree>TESTPCACHE_RESERVE || (createFlag==2 && p->nFree>0) ){
   234    241       j = testpcacheRandom(p) % TESTPCACHE_NPAGE;
   235    242       for(i=0; i<TESTPCACHE_NPAGE; i++, j = (j+1)%TESTPCACHE_NPAGE){
   236    243         if( p->a[j].key==0 ){
   237    244           p->a[j].key = key;
   238    245           p->a[j].isPinned = 1;
   239         -        memset(p->a[j].pData, 0, p->szPage);
          246  +        memset(p->a[j].page.pBuf, 0, p->szPage);
          247  +        memset(p->a[j].page.pExtra, 0, p->szExtra);
   240    248           p->nPinned++;
   241    249           p->nFree--;
   242    250           assert( p->nPinned <= TESTPCACHE_NPAGE - p->nFree );
   243         -        return p->a[j].pData;
          251  +        return &p->a[j].page;
   244    252         }
   245    253       }
   246    254   
   247    255       /* The prior loop always finds a freepage to allocate */
   248    256       assert( 0 );
   249    257     }
   250    258   
................................................................................
   258    266     ** recycle is selected at random from all unpinned pages.
   259    267     */
   260    268     j = testpcacheRandom(p) % TESTPCACHE_NPAGE;
   261    269     for(i=0; i<TESTPCACHE_NPAGE; i++, j = (j+1)%TESTPCACHE_NPAGE){
   262    270       if( p->a[j].key>0 && p->a[j].isPinned==0 ){
   263    271         p->a[j].key = key;
   264    272         p->a[j].isPinned = 1;
   265         -      memset(p->a[j].pData, 0, p->szPage);
          273  +      memset(p->a[j].page.pBuf, 0, p->szPage);
          274  +      memset(p->a[j].page.pExtra, 0, p->szExtra);
   266    275         p->nPinned++;
   267    276         assert( p->nPinned <= TESTPCACHE_NPAGE - p->nFree );
   268         -      return p->a[j].pData;
          277  +      return &p->a[j].page;
   269    278       }
   270    279     }
   271    280   
   272    281     /* The previous loop always finds a page to recycle. */
   273    282     assert(0);
   274    283     return 0;
   275    284   }
   276    285   
   277    286   /*
   278    287   ** Unpin a page.
   279    288   */
   280    289   static void testpcacheUnpin(
   281    290     sqlite3_pcache *pCache,
   282         -  void *pOldPage,
          291  +  sqlite3_pcache_page *pOldPage,
   283    292     int discard
   284    293   ){
   285    294     testpcache *p = (testpcache*)pCache;
   286    295     int i;
   287    296     assert( p->iMagic==TESTPCACHE_VALID );
   288    297     assert( testpcacheGlobal.pDummy!=0 );
   289    298     assert( testpcacheGlobal.nInstance>0 );
................................................................................
   295    304     if( p->bPurgeable
   296    305     && (100-testpcacheGlobal.discardChance) <= (testpcacheRandom(p)%100)
   297    306     ){
   298    307       discard = 1;
   299    308     }
   300    309   
   301    310     for(i=0; i<TESTPCACHE_NPAGE; i++){
   302         -    if( p->a[i].pData==pOldPage ){
          311  +    if( &p->a[i].page==pOldPage ){
   303    312         /* The pOldPage pointer always points to a pinned page */
   304    313         assert( p->a[i].isPinned );
   305    314         p->a[i].isPinned = 0;
   306    315         p->nPinned--;
   307    316         assert( p->nPinned>=0 );
   308    317         if( discard ){
   309    318           p->a[i].key = 0;
................................................................................
   320    329   
   321    330   
   322    331   /*
   323    332   ** Rekey a single page.
   324    333   */
   325    334   static void testpcacheRekey(
   326    335     sqlite3_pcache *pCache,
   327         -  void *pOldPage,
          336  +  sqlite3_pcache_page *pOldPage,
   328    337     unsigned oldKey,
   329    338     unsigned newKey
   330    339   ){
   331    340     testpcache *p = (testpcache*)pCache;
   332    341     int i;
   333    342     assert( p->iMagic==TESTPCACHE_VALID );
   334    343     assert( testpcacheGlobal.pDummy!=0 );
................................................................................
   349    358     }
   350    359   
   351    360     /* Find the page to be rekeyed and rekey it.
   352    361     */
   353    362     for(i=0; i<TESTPCACHE_NPAGE; i++){
   354    363       if( p->a[i].key==oldKey ){
   355    364         /* The oldKey and pOldPage parameters match */
   356         -      assert( p->a[i].pData==pOldPage );
          365  +      assert( &p->a[i].page==pOldPage );
   357    366         /* Page to be rekeyed must be pinned */
   358    367         assert( p->a[i].isPinned );
   359    368         p->a[i].key = newKey;
   360    369         return;
   361    370       }
   362    371     }
   363    372   
................................................................................
   417    426   */
   418    427   void installTestPCache(
   419    428     int installFlag,            /* True to install.  False to uninstall. */
   420    429     unsigned discardChance,     /* 0-100.  Chance to discard on unpin */
   421    430     unsigned prngSeed,          /* Seed for the PRNG */
   422    431     unsigned highStress         /* Call xStress agressively */
   423    432   ){
   424         -  static const sqlite3_pcache_methods testPcache = {
          433  +  static const sqlite3_pcache_methods2 testPcache = {
          434  +    1,
   425    435       (void*)&testpcacheGlobal,
   426    436       testpcacheInit,
   427    437       testpcacheShutdown,
   428    438       testpcacheCreate,
   429    439       testpcacheCachesize,
   430    440       testpcachePagecount,
   431    441       testpcacheFetch,
   432    442       testpcacheUnpin,
   433    443       testpcacheRekey,
   434    444       testpcacheTruncate,
   435    445       testpcacheDestroy,
   436    446     };
   437         -  static sqlite3_pcache_methods defaultPcache;
          447  +  static sqlite3_pcache_methods2 defaultPcache;
   438    448     static int isInstalled = 0;
   439    449   
   440    450     assert( testpcacheGlobal.nInstance==0 );
   441    451     assert( testpcacheGlobal.pDummy==0 );
   442    452     assert( discardChance<=100 );
   443    453     testpcacheGlobal.discardChance = discardChance;
   444    454     testpcacheGlobal.prngSeed = prngSeed ^ (prngSeed<<16);
   445    455     testpcacheGlobal.highStress = highStress;
   446    456     if( installFlag!=isInstalled ){
   447    457       if( installFlag ){
   448         -      sqlite3_config(SQLITE_CONFIG_GETPCACHE, &defaultPcache);
          458  +      sqlite3_config(SQLITE_CONFIG_GETPCACHE2, &defaultPcache);
   449    459         assert( defaultPcache.xCreate!=testpcacheCreate );
   450         -      sqlite3_config(SQLITE_CONFIG_PCACHE, &testPcache);
          460  +      sqlite3_config(SQLITE_CONFIG_PCACHE2, &testPcache);
   451    461       }else{
   452    462         assert( defaultPcache.xCreate!=0 );
   453         -      sqlite3_config(SQLITE_CONFIG_PCACHE, &defaultPcache);
          463  +      sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultPcache);
   454    464       }
   455    465       isInstalled = installFlag;
   456    466     }
   457    467   }

Changes to test/dbstatus.test.

    57     57   }
    58     58   
    59     59   ifcapable stat3 {
    60     60     set STAT3 1
    61     61   } else {
    62     62     set STAT3 0
    63     63   }
           64  +
           65  +ifcapable malloc_usable_size {
           66  +  finish_test
           67  +  return
           68  +}
    64     69   
    65     70   #---------------------------------------------------------------------------
    66     71   # Run the dbstatus-2 and dbstatus-3 tests with several of different
    67     72   # lookaside buffer sizes.
    68     73   #
    69     74   foreach ::lookaside_buffer_size {0 64 120} {
    70     75   

Changes to test/memsubsys1.test.

    64     64     sqlite3_status SQLITE_STATUS_PAGECACHE_SIZE 1
    65     65     sqlite3_status SQLITE_STATUS_SCRATCH_USED 1
    66     66     sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 1
    67     67     sqlite3_status SQLITE_STATUS_SCRATCH_SIZE 1
    68     68     sqlite3_status SQLITE_STATUS_PARSER_STACK 1
    69     69   }
    70     70   
    71         -set xtra_size 272
           71  +set xtra_size 290
    72     72   
    73     73   # Test 1:  Both PAGECACHE and SCRATCH are shut down.
    74     74   #
    75     75   db close
    76     76   sqlite3_shutdown
    77     77   sqlite3_config_lookaside 0 0
    78     78   sqlite3_initialize
................................................................................
    93     93   sqlite3_shutdown
    94     94   sqlite3_config_pagecache [expr 1024+$xtra_size] 20
    95     95   sqlite3_initialize
    96     96   reset_highwater_marks
    97     97   build_test_db memsubsys1-2 {PRAGMA page_size=1024}
    98     98   #show_memstats
    99     99   set MEMORY_MANAGEMENT $sqlite_options(memorymanage)
   100         -do_test memsubsys1-2.3 {
   101         -  set pg_ovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 2]
   102         -} [expr ($TEMP_STORE>1 || $MEMORY_MANAGEMENT==0)*1024]
          100  +ifcapable !malloc_usable_size {
          101  + do_test memsubsys1-2.3 {
          102  +    set pg_ovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 2]
          103  +  } [expr ($TEMP_STORE>1 || $MEMORY_MANAGEMENT==0)*1024]
          104  +}
   103    105   do_test memsubsys1-2.4 {
   104    106     set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
   105    107   } 20
   106    108   do_test memsubsys1-2.5 {
   107    109     set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
   108    110   } 0
   109    111   

Changes to test/pragma.test.

    95     95   do_test pragma-1.5 {
    96     96     execsql {
    97     97       PRAGMA cache_size=-4321;
    98     98       PRAGMA cache_size;
    99     99       PRAGMA default_cache_size;
   100    100       PRAGMA synchronous;
   101    101     }
   102         -} [list 4321 $DFLT_CACHE_SZ 0]
          102  +} [list -4321 $DFLT_CACHE_SZ 0]
   103    103   do_test pragma-1.6 {
   104    104     execsql {
   105    105       PRAGMA synchronous=ON;
   106    106       PRAGMA cache_size;
   107    107       PRAGMA default_cache_size;
   108    108       PRAGMA synchronous;
   109    109     }
   110         -} [list 4321 $DFLT_CACHE_SZ 1]
          110  +} [list -4321 $DFLT_CACHE_SZ 1]
   111    111   do_test pragma-1.7 {
   112    112     db close
   113    113     sqlite3 db test.db
   114    114     execsql {
   115    115       PRAGMA cache_size;
   116    116       PRAGMA default_cache_size;
   117    117       PRAGMA synchronous;