diff --git a/LICENSE.md b/LICENSE.md
index 6a1f19246a..5382a66842 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -56,7 +56,7 @@ words, there are some non-public-domain files used to implement:
In all cases, the non-public-domain files included with this
repository have generous BSD-style licenses. So anyone is free to
use any of the code in this source repository for any purpose, though
-attribution my be required to reuse or republish the configure and
+attribution may be required to reuse or republish the configure and
build scripts. None of the non-public-domain code ever actually reaches
the build products, such as "sqlite3.c", however, so no attribution is
required to use SQLite itself. The non-public-domain code consists of
diff --git a/Makefile.in b/Makefile.in
index 6ca1f3ac10..7aac5ec02f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -95,10 +95,20 @@ INSTALL = @BIN_INSTALL@
AR = @AR@
AR.flags = cr # TODO? Add a configure test to determine this?
CC = @CC@
-B.cc = @BUILD_CC@ @BUILD_CFLAGS@
-T.cc = $(CC)
-CFLAGS = @CFLAGS@ @SH_CFLAGS@
-
+B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
+T.cc = @CC@
+#
+# CFLAGS is problematic because it is frequently overridden when
+# invoking make, which loses things like -fPIC. So... let's avoid
+# using it directly and instead add a level of indirection. We
+# combine CFLAGS and CPPFLAGS here because that's the way the legacy
+# build did it.
+#
+CFLAGS = @CFLAGS@ @CPPFLAGS@
+#
+# CFLAGS.core is documented in main.mk.
+#
+CFLAGS.core = @SH_CFLAGS@
LDFLAGS.shobj = @SHOBJ_LDFLAGS@
LDFLAGS.zlib = @LDFLAGS_ZLIB@
LDFLAGS.math = @LDFLAGS_MATH@
@@ -107,8 +117,10 @@ LDFLAGS.pthread = @LDFLAGS_PTHREAD@
LDFLAGS.dlopen = @LDFLAGS_DLOPEN@
LDFLAGS.readline = @LDFLAGS_READLINE@
CFLAGS.readline = @CFLAGS_READLINE@
+LDFLAGS.icu = @LDFLAGS_ICU@
ENABLE_SHARED = @ENABLE_SHARED@
+ENABLE_STATIC = @ENABLE_STATIC@
HAVE_WASI_SDK = @HAVE_WASI_SDK@
T.cc.sqlite = $(T.cc) @TARGET_DEBUG@
@@ -118,6 +130,12 @@ T.cc.sqlite = $(T.cc) @TARGET_DEBUG@
# can include the generated sqlite_cfg.h.
#
T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
+#
+# -I$(prefix)/include is primarily so that the ICU
+# headers can be found.
+#
+T.cc.sqlite += -I$(prefix)/include
+
#
# main.mk will fill out T.cc.sqlite with some flags common to all builds.
@@ -161,11 +179,9 @@ CFLAGS.libsqlite3 = -DSQLITE_TEMP_STORE=@TEMP_STORE@
OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ $(OPTIONS)
#
-# Release (X.Y.Z) and version (X.Y) numbers for the SQLite being
-# compiled.
+# Version (X.Y.Z) number for the SQLite being compiled.
#
-VERSION.XYZ = @VERSION_XYZ@
-# VERSION.XY = @VERSION_XY@ # we don't currently use this anywhere
+PACKAGE_VERSION = @PACKAGE_VERSION@
#
# Filename extensions for binaries and libraries
@@ -196,12 +212,29 @@ TCL_CONFIG_SH = @TCL_CONFIG_SH@
#
# TCL config info from tclConfig.sh
#
-TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
-TCL_LIB_SPEC = @TCL_LIB_SPEC@
-TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
-TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
-TCL_VERSION = @TCL_VERSION@
-TCLLIB_RPATH = @TCLLIB_RPATH@
+# We have to inject this differently in main.mk to accommodate static
+# makefiles, so we don't currently bother to export it here. This
+# block is retained in case we decide that we do indeed need to export
+# it at configure-time instead of calculate it at make-time.
+#
+#TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
+#TCL_LIB_SPEC = @TCL_LIB_SPEC@
+#TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+#TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
+#TCL_VERSION = @TCL_VERSION@
+#
+# $(TCLLIB_RPATH) is calculated by the configure script. Its counterpart
+# in tclConfig.sh (TCL_LD_SEARCH_FLAGS) is defined in such a way as to
+# make it incompatible with static makefiles.
+#
+#TCLLIB_RPATH = @TCLLIB_RPATH@
+#
+# $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it
+# is calculated at make-time by the targets which need it but we
+# export it here so that it can be set at configure-time, so that
+# clients are not required to pass it at make-time, or set it in their
+# environment, to override it.
+#
TCLLIBDIR = @TCLLIBDIR@
#
@@ -210,11 +243,6 @@ TCLLIBDIR = @TCLLIBDIR@
#
TSTRNNR_OPTS = @TSTRNNR_OPTS@
-#
-# Where do we want to install the tcl plugin
-#
-TCLLIBDIR = @TCLLIBDIR@
-
#
# If gcov support was enabled by the configure script, add the appropriate
# flags here. It's not always as easy as just having the user add the right
@@ -243,7 +271,7 @@ AS_AUTO_DEF = $(TOP)/auto.def
# Shell commands to re-run $(TOP)/configure with the same args it was
# invoked with to produce this makefile.
#
-AS_AUTOREMAKE = @SQLITE_AUTOREMAKE@
+AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@
USE_AMALGAMATION ?= @USE_AMALGAMATION@
AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
@@ -254,16 +282,16 @@ AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
SHELL_OPT ?= @OPT_SHELL@
Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)
- $(AS_AUTOREMAKE)
+ $(AS_AUTORECONFIG)
@touch $@
sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)
- $(AS_AUTOREMAKE)
+ $(AS_AUTORECONFIG)
@touch $@
install: install-pc # defined in main.mk
sqlite_cfg.h: $(TOP)/sqlite_cfg.h.in $(AS_AUTO_DEF)
- $(AS_AUTOREMAKE)
+ $(AS_AUTORECONFIG)
@touch $@
#
@@ -313,7 +341,7 @@ clean-autosetup:
clean: clean-autosetup
distclean-autosetup: clean
- rm -f sqlite_cfg.h config.log config.status config.defines.json Makefile sqlite3.pc
+ rm -f sqlite_cfg.h config.log config.status config.defines.* Makefile sqlite3.pc
rm -f $(TOP)/tool/emcc.sh
rm -f libsqlite3*$(T.dll)
rm -f jimsh0*
diff --git a/Makefile.linux-generic b/Makefile.linux-generic
index b91861bbe7..c7441fa517 100644
--- a/Makefile.linux-generic
+++ b/Makefile.linux-generic
@@ -24,9 +24,14 @@ TOP ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
#
# $(CFLAGS) will be used when compiling the library and most
-# utilities. It must normally contain -fPIC on Linux systems.
+# utilities. It must normally contain -fPIC on Linux systems,
+# but overriding CFLAGS is an easy way for users to inadvertently
+# remove -fPIC from their builds, so we generally expect to see
+# -fPIC in $(CFLAGS.core), which main.mk will integrate with
+# the CFLAGS where needed.
#
-CFLAGS = -fPIC
+CFLAGS =
+CFLAGS.core = -fPIC
#
# $(SHELL_OPT) contains CFLAGS for building the sqlite3 CLI shell.
@@ -42,7 +47,7 @@ LDFLAGS.zlib = -lz
#
# Library's version number.
#
-VERSION.XYZ ?= $(shell cat $(TOP)/VERSION 2>/dev/null)
+PACKAGE_VERSION ?= $(shell cat $(TOP)/VERSION 2>/dev/null)
# sqlite_cfg.h is typically created by the configure script. It's
# commonly not needed but main.mk does not know that so we have to
diff --git a/Makefile.msc b/Makefile.msc
index ac919738de..3385e152b9 100644
--- a/Makefile.msc
+++ b/Makefile.msc
@@ -1069,7 +1069,7 @@ TCLSH_CMD = tclsh
JIM_TCLSH = $(TCLSH_CMD)
!ENDIF
!IFNDEF JIM_TCLSH
-JIM_TCLSH = $(TOP)\jimsh0.exe
+JIM_TCLSH = jimsh0.exe
!ENDIF
# <>
@@ -1585,7 +1585,6 @@ TESTSRC = \
$(TOP)\src\test8.c \
$(TOP)\src\test9.c \
$(TOP)\src\test_autoext.c \
- $(TOP)\src\test_async.c \
$(TOP)\src\test_backup.c \
$(TOP)\src\test_bestindex.c \
$(TOP)\src\test_blob.c \
@@ -1683,7 +1682,6 @@ TESTSRC2 = \
$(SRC01) \
$(SRC07) \
$(SRC10) \
- $(TOP)\ext\async\sqlite3async.c \
fts5.c
# Header files used by all library source files.
diff --git a/auto.def b/auto.def
index b5bde98e25..9563405703 100644
--- a/auto.def
+++ b/auto.def
@@ -12,17 +12,18 @@
#
# JimTCL: https://jim.tcl.tk
#
-use cc cc-db cc-shared cc-lib hwaci-common pkg-config
+use cc cc-db cc-shared cc-lib proj pkg-config
+
# $DUMP_DEFINES_TXT is the file emitted by --dump-defines, intended
# only for build debugging and not part of the public build interface.
set DUMP_DEFINES_TXT ./config.defines.txt
# $DUMP_DEFINES_JSON is the autosetup counterpart of the historical
# "DEFS" var which was generated by the autotools in the pre-processed
-# autotools builds (but not in the canonical tree). This is used by at
-# least one high-profile client to extract build config info for use
-# in compiling a scripting-language binding, so its name should not be
-# arbitrarily changed.
-set DUMP_DEFINES_JSON ./config.defines.json
+# autotools builds (but not in the canonical tree). Generation of this
+# file is disabled (via an empty file name) until/unless someone
+# voices a specific interest in it. The original motivating use case
+# is handled fine by sqlite_cfg.h.
+set DUMP_DEFINES_JSON ""; #./config.defines.json
########################################################################
# Regarding flag compatibility with the historical autotool configure
@@ -113,32 +114,27 @@ set DUMP_DEFINES_JSON ./config.defines.json
# booleans: use one of:
# - [opt-bool FLAG] is autosetup's built-in command for this, but we
# have some convenience variants:
-# - [hwaci-opt-truthy FLAG]
-# - [hwaci-opt-if-truthy FLAG {THEN} {ELSE}]
+# - [proj-opt-truthy FLAG]
+# - [proj-opt-if-truthy FLAG {THEN} {ELSE}]
#
# Non-boolean (i.e. string) flags:
-# - [opt-val FLAG]
+# - [opt-val FLAG ?default?]
#
########################################################################
-options [subst {
+set flags {
+ #
with-debug:=1 => {Enable debug build flags}
- with-tclsh:PATH => {Full pathname of tclsh to use}
- with-tcl:DIR => {Directory containing tclConfig.sh}
- tcl=1 => {Disable components which require TCL-dev}
- test-status => {Enable status of tests}
+ shared=1 => {Disable build of shared libary}
+ static=1 => {Disable build of static library (mostly)}
+ amalgamation=1 => {Disable the amalgamation and instead build all files separately.}
+ #
+ #
threadsafe=1 => {Disable mutexing}
with-tempstore:=no => {Use an in-ram database for temporary tables: never,no,yes,always}
- editline=0 => {BSD editline support}
- readline=1 => {Disable readline support}
largefile=1 => {Disable large file support}
- with-readline-lib: => {Readline library}
- with-readline-inc: => {Readline include paths}
- with-linenoise:DIR => {}
- amalgamation=1 => {Disable the amalgamation and instead build all files separately}
load-extension=1 => {Disable loading of external extensions}
math=1 => {Disable math functions}
json=1 => {Disable JSON functions}
- all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
memsys5 => {Enable MEMSYS5}
memsys3 => {Enable MEMSYS3}
fts3 => {Enable the FTS3 extension}
@@ -148,196 +144,197 @@ options [subst {
geopoly => {Enable the GEOPOLY extension}
rtree => {Enable the RTREE extension}
session => {Enable the SESSION extension}
- gcov=0 => {Enable coverage testing using gcov}
- linemacros => {Enable #line macros in the amalgamation.}
+ all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
+ #
+ #
+ # --with-tcl=DIR may be either a dir containing tclConfig.sh or a
+ # dir one level up from that from which we can derive a dir
+ # containing tclConfig.sh.
+ with-tcl:DIR => {Root of path containing tclConfig.sh}
+ # If --with-tclsh=X given, it is used for (A) trying to find
+ # tclConfig.sh and (B) all TCL-based code generation. Warning: if
+ # its containing dir has multiple tclsh versions, it may select the
+ # wrong tclConfig.sh!
+ with-tclsh:PATH => {Full pathname of tclsh to use}
+ # --disable-tcl only disables building of the SQLite TCL extension,
+ # not the requirement for TCL. This tree requires TCL for code
+ # generation but can use the in-tree copy of autosetup/jimsh0.c for
+ # that. The SQLite TCL extension and, by extension, the test code
+ # require a canonical tclsh.
+ tcl=1 => {Disable components which require TCL-dev}
+ #
+ #
+ readline=1 => {Disable readline support}
+ # --with-readline-lib is a backwards-compatible alias for
+ # --with-readline-ldflags
+ with-readline-lib:
+ with-readline-ldflags:=auto
+ => {Readline LDFLAGS, e.g. -lreadline -lncurses}
+ # --with-readline-inc is a backwards-compatible alias for
+ # --with-readline-cflags.
+ with-readline-inc:
+ with-readline-cflags:=auto
+ => {Readline CFLAGS, e.g. -I/path/to/includes}
+ with-readline-header:PATH
+ => {Full path to readline.h, from which --with-readline-cflags will be derived}
+ with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h}
+ editline=0 => {BSD editline support}
+ #
+ #
+ with-icu-ldflags:LDFLAGS
+ => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries}
+ with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU and fetch linker flags from the given icu-config binary}
+ icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config}
+ #
+ #
with-wasi-sdk:=/opt/wasi-sdk
=> {Top-most dir of the wasi-sdk for a WASI build}
with-emsdk:DIR => {Top-most dir of the Emscripten SDK installation}
- defines-json-include-lowercase=0
- => {Include lower-case defines (primarily system paths) in $DUMP_DEFINES_JSON}
+ #
+ #
+ test-status => {Enable status of tests}
+ gcov=0 => {Enable coverage testing using gcov}
+ linemacros => {Enable #line macros in the amalgamation.}
dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)}
-}]
+ #
-# Are we cross-compiling?
-set cross_compiling 0
-if {[get-define host] ne [get-define build]} {
- set cross_compiling 1
+}
+if {"" ne $DUMP_DEFINES_JSON} {
+ lappend flags \
+ defines-json-include-lowercase=0 \
+ => {Include lower-case defines (primarily system paths) in $DUMP_DEFINES_JSON}
}
-########################################################################
-# Notes about certain historical flags:
-#
-# --releasemode: libtool-specific (which we don't have now)
+options [subst $flags]
+unset flags
+
#
+# Carry values from hidden --flag aliases over to their canonical flag
+# forms.
#
+proj-xfer-options-aliases {
+ with-readline-inc => with-readline-cflags
+ with-readline-lib => with-readline-ldflags
+}
+
set srcdir $::autosetup(srcdir)
set top_srcdir [get-define abs_top_srcdir]
+set PACKAGE_VERSION [readfile $srcdir/VERSION]
+define PACKAGE_NAME "sqlite"
+define PACKAGE_URL {https://sqlite.org}
+define PACKAGE_VERSION $PACKAGE_VERSION
+define PACKAGE_STRING "[get-define PACKAGE_NAME] $PACKAGE_VERSION"
+define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum
+
msg-result "srcdir = $srcdir"
msg-result "top_srcdir = $top_srcdir"
-set VERSION_XYZ [readfile $::autosetup(srcdir)/VERSION]
-regsub {([0-9]*\.*[0-9]*).*} $VERSION_XYZ {\1} VERSION_XY
-define VERSION_XY $VERSION_XY
-define VERSION_XYZ $VERSION_XYZ
-msg-result "RELEASE = $VERSION_XYZ"
-msg-result "VERSION = $VERSION_XY"
+msg-result [proj-bold "Configuring SQLite version $PACKAGE_VERSION"]
-define-append SQLITE_AUTOREMAKE cd $::autosetup(srcdir) && $top_srcdir/configure {*}$::autosetup(argv)
+#
+# SQLITE_AUTORECONFIG contains make target rules for re-running the
+# configure script with the same arguments it was initially invoked
+# with. This can be used to automatically reconfigure
+#
+define-append SQLITE_AUTORECONFIG cd '$::autosetup(builddir)' && '$top_srcdir/configure'
+#{*}$::autosetup(argv) breaks with --flag='val with spaces', so...
+foreach arg $::autosetup(argv) {
+ define-append SQLITE_AUTORECONFIG '$arg'
+}
-set outOfTreeBuild 0
+# Are we cross-compiling?
+set cross_compiling [proj-is-cross-compiling]
if {![file exists sqlite3.pc.in]} {
msg-result "This appears to be an out-of-tree build."
- set outOfTreeBuild 1
}
cc-check-tools ld ar
+define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
+define OPT_SHELL {} ; # CFLAGS for the sqlite3 CLI app
########################################################################
-# The build process allows for using a cross-compiler. But the default
-# action is to target the same platform that we are running on. The
-# configure script needs to discover the following properties of the
-# build and target systems:
-#
-# srcdir
-#
-# The is the name of the directory that contains the
-# "configure" shell script. All source files are
-# located relative to this directory.
-#
-# bindir
-#
-# The name of the directory where executables should be
-# written by the "install" target of the makefile.
-#
-# program_prefix
-#
-# Add this prefix to the names of all executables that run
-# on the target machine. Default: ""
-#
-# ENABLE_SHARED
-#
-# True if shared libraries should be generated.
-#
-# BUILD_CC
-#
-# The name of a command that is used to convert C
-# source files into executables that run on the build
-# platform.
-#
-# BUILD_CFLAGS
-#
-# Switches that the build compiler needs in order to construct
-# command-line programs.
-#
-# BUILD_LIBS
-#
-# Libraries that the build compiler needs in order to construct
-# command-line programs.
-#
-# TCL_*
-#
-# Lots of values are read in from the tclConfig.sh script,
-# if that script is available. This values are used for
-# constructing and installing the TCL extension.
-#
-# TARGET_READLINE_LIBS
-#
-# This is the library directives passed to the target linker
-# that cause the executable to link against the readline library.
-# This might be a switch like "-lreadline" or pathnames of library
-# file like "../../src/libreadline.a".
-#
-# TARGET_READLINE_INC
-#
-# This variables define the directory that contain header
-# files for the readline library. If the compiler is able
-# to find on its own, then this can be blank.
-
-#
-# OPT_FEATURE_FLAGS = -DSQLITE_OMIT/ENABLE flags.
-define OPT_FEATURE_FLAGS {}
-define OPT_SHELL {}; # CFLAGS for the sqlite3 CLI app
-
# Adds $args, if not empty, to OPT_FEATURE_FLAGS.
-proc add-feature-flag {args} {
+# If the first arg is -shell then it strips that arg
+# and passes the remaining args th sqlite-add-shell-opt
+# in addition to adding them to OPT_FEATURE_FLAGS.
+proc sqlite-add-feature-flag {args} {
+ set shell ""
+ if {"-shell" eq [lindex $args 0]} {
+ set args [lassign $args shell]
+ }
if {"" ne $args} {
+ if {"" ne $shell} {
+ sqlite-add-shell-opt {*}$args
+ }
define-append OPT_FEATURE_FLAGS {*}$args
}
}
-# add-feature-flag -DSQLITE_JUST_TESTING=3
-
-# Adds $args, if not empty, to OPT_SHELL.
-proc add-shell-opt {args} {
+# Appends $args, if not empty, to OPT_SHELL.
+proc sqlite-add-shell-opt {args} {
if {"" ne $args} {
define-append OPT_SHELL {*}$args
}
}
-hwaci-file-extensions
+# Pass msg-debug=1 to configure to enable obnoxiously loud output from
+# msg-debug.
+set msgDebugEnabled [proj-val-truthy [get-env msg-debug 0]]
+proc msg-debug {msg} {
+ if {$::msgDebugEnabled} {
+ puts stderr [proj-bold "** DEBUG: $msg"]
+ }
+}
+
+proj-file-extensions
if {".exe" eq [get-define TARGET_EXEEXT]} {
define SQLITE_OS_UNIX 0
define SQLITE_OS_WIN 1
- # todo? add -DSQLITE_OS_WIN=1 to CFLAGS?
+ # todo? add -DSQLITE_OS_WIN=1 to CFLAGS or CFLAGS_sqlite3_os?
} else {
define SQLITE_OS_UNIX 1
define SQLITE_OS_WIN 0
- # todo? add -DSQLITE_OS_UNIX=1 to CFLAGS?
+ # todo? add -DSQLITE_OS_UNIX=1 to CFLAGS or CFLAGS_sqlite3_os
}
#########
# Programs needed
-if {"" eq [hwaci-bin-define install]} {
- hwaci-warn "Cannot find install binary, so 'make install' will not work."
- # Reminder: we historically have ./install-sh in the source tree.
- # Can we not simply use that?
- #
- # define BIN_INSTALL "$top_srcdir/install-sh"
- #
- # Nope: it MOVES its source files over the target, which breaks the
- # installation in some cases, e.g. when libtclsqlite3.so is built in
- # response to 'make install' and libsqlite3.a is moved before
- # libtclsqlite3.so is linked. It's easy to hack to use cp instead
- # of mv (simply replace the instcmd=... bit) but that won't retain
- # the source timestamp and permissions unless we use cp's -p flag,
- # which may not be portable enough.
+if {"" eq [proj-bin-define install]} {
+ proj-warn "Cannot find install binary, so 'make install' will not work."
}
########################################################################
# We differentiate between two C compilers: the one used for binaries
-# which are to run on the build system (BUILD_CC, a.k.a. BCC) and the
-# one used for compiling binaries for the target system (CC,
-# a.k.a. TCC). Normally they're the same, but they will differ when
+# which are to run on the build system (in autosetup it's called
+# CC_FOR_BUILD and in Makefile.in it's $(B.cc)) and the one used for
+# compiling binaries for the target system (CC a.k.a. $(T.cc)).
+# Normally they're the same, but they will differ when
# cross-compiling.
-define BUILD_CC [get-define CC_FOR_BUILD]
-define BUILD_CFLAGS [get-env CFLAGS {-g}]
-define ENABLE_SHARED 1
-define HAVE_TCL 0
+define BUILD_CFLAGS [get-env BUILD_CFLAGS {-g}]
########################################################################
# Handle --with-wasi-sdk=DIR
#
# This must be early because it may change the toolchain and disable
# several config options.
-proc hwaci-check-wasi-sdk {} {
+proc sqlite-check-wasi-sdk {} {
set wasiSdkDir [opt-val with-wasi-sdk] ; # ??? [lindex [opt-val with-wasi-sdk] end]
define HAVE_WASI_SDK 0
#puts "x wasiSdkDir=$wasiSdkDir foo=[lindex [opt-val with-wasi-sdk] end]"
if {$wasiSdkDir eq ""} {
return 0
} elseif {$::cross_compiling} {
- hwaci-fatal "Cannot combine --with-wasi-sdk with cross-compilation"
+ proj-fatal "Cannot combine --with-wasi-sdk with cross-compilation"
}
msg-result "Checking WASI SDK directory \[$wasiSdkDir]... "
#puts "prefix = [prefix $wasiSdkDir/bin {clang ld}]"
- hwaci-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld}]
+ proj-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld}]
msg-result "Using wasi-sdk clang, disabling: tcl, CLI shell, DLL, loadable extensions, threading"
define HAVE_WASI_SDK 1
define WASI_SDK_DIR $wasiSdkDir
- hwaci-opt-set load-extension 0; # ==> --disable-load-extension
- hwaci-opt-set threadsafe 0; # ==> --threadsafe=0
- hwaci-opt-set tcl 0; # ==> --disable-tcl
- define HAVE_TCL 0
+ proj-opt-set load-extension 0 ;# ==> --disable-load-extension
+ proj-opt-set threadsafe 0 ;# ==> --threadsafe=0
+ proj-opt-set tcl 0 ;# ==> --disable-tcl
+ proj-opt-set shared 0 ;# ==> --disable-shared
set cross_compiling 1
- define ENABLE_SHARED 0
# Changing --host and --target have no effect here except to possibly
# cause confusion. autoconf has finished processing them by this
@@ -355,24 +352,28 @@ proc hwaci-check-wasi-sdk {} {
define LD "${wasiSdkDir}/bin/wasm-ld"
#define STRIP "${wasiSdkDir}/bin/strip"
return 1
-}; # hwaci-check-wasi-sdk
-hwaci-check-wasi-sdk
+}; # sqlite-check-wasi-sdk
+sqlite-check-wasi-sdk
#
# Enable large file support (if special flags are necessary)
-cc-check-lfs
+define HAVE_LFS 0
+if {[opt-bool largefile]} {
+ cc-check-lfs
+}
#
# Check for needed/wanted data types
-cc-check-types int8_t int16_t int32_t int64_t intptr_t \
- uint8_t uint16_t uint32_t uint64_t uintptr_t
+cc-with {-includes stdint.h} \
+ {cc-check-types int8_t int16_t int32_t int64_t intptr_t \
+ uint8_t uint16_t uint32_t uint64_t uintptr_t}
#
# Check for needed/wanted functions
cc-check-functions gmtime_r isnan localtime_r localtime_s \
malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
-hwaci-check-function-in-lib fdatasync rt
+proj-check-function-in-lib fdatasync rt
define LDFLAGS_FDATASYNC [get-define lib_fdatasync]
undefine lib_fdatasync
@@ -382,39 +383,39 @@ cc-check-includes \
sys/types.h sys/stat.h dlfcn.h unistd.h \
stdlib.h malloc.h memory.h \
string.h strings.h \
- stdint.h inttypes.h
+ inttypes.h
-# These are optional for JimTCL but necessary if we want to use it for
-# code generation:
-cc-check-includes dirent.h sys/time.h
-
-if {[cc-check-includes zlib.h] && [hwaci-check-function-in-lib deflate z]} {
+if {[cc-check-includes zlib.h] && [proj-check-function-in-lib deflate z]} {
# TODO: port over the more sophisticated zlib search from the fossil auto.def
- define HAVE_ZLIB 1; # "-DSQLITE_HAVE_ZLIB=1"
+ define HAVE_ZLIB 1
define LDFLAGS_ZLIB -lz
- # Note that -DSQLITE_HAVE_ZLIB=1 is handled separately from the
- # other feature flags in the autotools build. Do we need to emulate
- # that?
- add-shell-opt -DSQLITE_HAVE_ZLIB=1
+ sqlite-add-shell-opt -DSQLITE_HAVE_ZLIB=1
} else {
define HAVE_ZLIB 0
define LDFLAGS_ZLIB ""
}
-hwaci-define-if-opt-truthy amalgamation USE_AMALGAMATION \
- "Use amalgamation for builds?"
+proj-check-rpath; # Determine proper rpath-handling flags.
-hwaci-define-if-opt-truthy gcov USE_GCOV "Use gcov?"
+proj-define-if-opt-truthy shared ENABLE_SHARED "Build shared library?"
-hwaci-define-if-opt-truthy test-status TSTRNNR_OPTS \
+if {![proj-define-if-opt-truthy static ENABLE_STATIC \
+ "Build static library?"]} {
+ proj-warn "Static lib build may be implicitly re-activated by other components, e.g. some test apps."
+}
+
+proj-define-if-opt-truthy amalgamation USE_AMALGAMATION "Use amalgamation for builds?"
+
+proj-define-if-opt-truthy gcov USE_GCOV "Use gcov?"
+
+proj-define-if-opt-truthy test-status TSTRNNR_OPTS \
"test-runner flags:" {--status} {}
-hwaci-define-if-opt-truthy linemacros AMALGAMATION_LINE_MACROS \
+proj-define-if-opt-truthy linemacros AMALGAMATION_LINE_MACROS \
"Use #line macros in the amalgamation:"
-msg-checking "Debug build? "
-
-hwaci-if-opt-truthy with-debug {
+msg-checking "SQLITE_DEBUG build? "
+proj-if-opt-truthy with-debug {
define SQLITE_DEBUG 1
define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
msg-result yes
@@ -426,7 +427,7 @@ hwaci-if-opt-truthy with-debug {
########################################################################
# TCL...
#
-# hwaci-check-tcl performs most of the --with-tcl and --with-tclsh
+# sqlite-check-tcl performs most of the --with-tcl and --with-tclsh
# handling. Some related bits and pieces are performed before and
# after that function is called.
#
@@ -452,42 +453,52 @@ hwaci-if-opt-truthy with-debug {
# be empty - this tree requires TCL to generated numerous
# components.
#
-define TCLSH_CMD {exit 1}
-proc hwaci-check-tcl {} {
+proc sqlite-check-tcl {} {
+ define TCLSH_CMD false ; # Significant is that it exits with non-0
+ define HAVE_TCL 0 ; # Will be enabled via --tcl or a successful search
+ define TCLLIBDIR "" ; # Installation dir for TCL extension lib
+ define TCLLIB_RPATH "" ; # rpath for TCL extension lib
+ define TCL_CONFIG_SH ""; # full path to tclConfig.sh
+ if {![opt-bool tcl]} {
+ msg-result "TCL disabled via --disable-tcl. Will not be able to run tests."
+ return
+ }
# TODO: document the steps this is taking.
global top_srcdir
- puts "Checking for a suitable tcl... "
- set optTcl [hwaci-opt-truthy tcl]
- set use_tcl $optTcl
+ msg-result "Checking for a suitable tcl... "
+ proj-assert {proj-opt-truthy tcl}
+ set use_tcl 1
set with_tclsh [opt-val with-tclsh]
set with_tcl [opt-val with-tcl]
- #puts "hwaci-check-tcl: use_tcl ${use_tcl}"
- #puts "hwaci-check-tcl: with_tclsh=${with_tclsh}"
- #puts "hwaci-check-tcl: with_tcl=$with_tcl"
+ msg-debug "sqlite-check-tcl: use_tcl ${use_tcl}"
+ msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
+ msg-debug "sqlite-check-tcl: with_tcl=$with_tcl"
if {"" eq $with_tclsh && "" eq $with_tcl} {
- set with_tclsh [hwaci-first-bin-of tclsh9.0 tclsh8.6 tclsh]
+ # If neither --with-tclsh nor --with-tcl are provided, try to find
+ # a workable tclsh.
+ set with_tclsh [proj-first-bin-of tclsh9.0 tclsh8.6 tclsh]
+ msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
}
- #puts "hwaci-check-tcl: with_tclsh=${with_tclsh}"
if {"" ne $with_tclsh} {
+ # --with-tclsh was provided. Validate it and use it to trump any
+ # value passed via --with-tcl=DIR.
if {![file isfile $with_tclsh]} {
- hwaci-fatal "TCL shell $with_tclsh is not a file"
+ proj-fatal "TCL shell $with_tclsh is not a file"
} elseif {![file-isexec $with_tclsh]} {
- hwaci-fatal "TCL shell $with_tclsh is not executable"
+ proj-fatal "TCL shell $with_tclsh is not executable"
} else {
define TCLSH_CMD $with_tclsh
- msg-result "Using tclsh: $with_tclsh"
+ #msg-result "Using tclsh: $with_tclsh"
}
- if {$use_tcl} {
- if {[catch {exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl} result] == 0} {
- set with_tcl $result
- }
- if {"" ne $with_tcl && [file isdir $with_tcl]} {
- msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
- } else {
- hwaci-warn "$with_tclsh is unable to recommand a tclConfig.sh"
- set use_tcl 0
- }
+ if {[catch {exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl} result] == 0} {
+ set with_tcl $result
+ }
+ if {"" ne $with_tcl && [file isdir $with_tcl]} {
+ msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
+ } else {
+ proj-warn "$with_tclsh is unable to recommand a tclConfig.sh"
+ set use_tcl 0
}
}
@@ -496,6 +507,7 @@ proc hwaci-check-tcl {} {
while {1} {
if {$use_tcl} {
if {"" ne $with_tcl} {
+ # Ensure that we can find tclConfig.sh under ${with_tcl}/...
if {[file readable "${with_tcl}/tclConfig.sh"]} {
set cfg "${with_tcl}/tclConfig.sh"
} else {
@@ -507,12 +519,13 @@ proc hwaci-check-tcl {} {
}
}
if {"" eq $cfg} {
- hwaci-fatal "No tclConfig.sh found under ${with_tcl}"
+ proj-fatal "No tclConfig.sh found under ${with_tcl}"
}
} else {
- # If we have not yet found a tclConfig.sh file, look in $libdir which is
- # set automatically by autosetup or by the --prefix command-line option.
- # See https://sqlite.org/forum/forumpost/e04e693439a22457
+ # If we have not yet found a tclConfig.sh file, look in
+ # $libdir which is set automatically by autosetup or by the
+ # --prefix command-line option. See
+ # https://sqlite.org/forum/forumpost/e04e693439a22457
set libdir [get-define libdir]
if {[file readable "${libdir}/tclConfig.sh"]} {
set cfg "${libdir}/tclConfig.sh"
@@ -525,68 +538,71 @@ proc hwaci-check-tcl {} {
}
}
if {![file readable $cfg]} {
- hwaci-warn {
- Cannot find a usable tclConfig.sh file.
- Use --with-tcl=DIR to specify a directory where tclConfig.sh can be found.
- SQLite does not use TCL internally, but TCL is required to build SQLite
- from canonical sources and TCL is required for testing.
+ proj-indented-notice {
+ WARNING: Cannot find a usable tclConfig.sh file. Use
+ --with-tcl=DIR to specify a directory where tclConfig.sh
+ can be found. SQLite does not use TCL internally, but TCL
+ is required for testing.
}
break
}
}
msg-result "Using tclConfig.sh: $cfg"
- } elseif {!$optTcl} {
- hwaci-warn "Unable to run tests because of --disable-tcl"
} else {
- hwaci-warn "Unable to run tests because no tclConfig.sh file could be located"
+ proj-warn "Unable to run tests because no tclConfig.sh file could be located"
}
break
}
define TCL_CONFIG_SH $cfg
- # The historical configure.ac sources tclConfig.sh so that it can
- # use the several TCL_... env vars. We obviously cannot do that from
- # TCL, so we apply a level of indirection which sources that script
- # then emits the pieces we're interested in as TCL code. If the
+ # Export a subset of tclConfig.sh to the current TCL-space. If the
# config is not available, this emits empty-string entries for the
# various options we're interested in.
- eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "[get-define TCL_CONFIG_SH]"]
- #puts "hwaci-check-tcl: with_tclsh=$with_tclsh"
- #puts "hwaci-check-tcl: with_tcl=$with_tcl"
- #puts "hwaci-check-tcl: cfg=$cfg"
- #puts "hwaci-check-tcl: use_tcl ${use_tcl}"
+ eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "$cfg"]
if {"" eq $with_tclsh} {
+ proj-assert {expr {$cfg ne ""}}
+ proj-assert {expr {"" ne [get-define TCL_EXEC_PREFIX]}}
set with_tclsh [get-define TCL_EXEC_PREFIX]/bin/tclsh[get-define TCL_VERSION]
if {![file-isexec $with_tclsh]} {
set with_tclsh2 [get-define TCL_EXEC_PREFIX]/bin/tclsh
if {![file-isexec $with_tclsh2]} {
- hwaci-warn "Cannot find a usable tclsh (tried: $with_tclsh $with_tclsh2)"
+ proj-warn "Cannot find a usable tclsh (tried: $with_tclsh $with_tclsh2)"
} else {
set with_tclsh $with_tclsh2
}
}
}
define TCLSH_CMD $with_tclsh
-
+ proj-assert {expr {( $cfg eq "" && 0 == $use_tcl ) \
+ || ( $cfg ne "" && 1 == $use_tcl )}}
if {$use_tcl} {
# Set up the TCLLIBDIR and TCLLIB_RPATH
+ #
+ # 2024-10-28: calculation of TCLLIBDIR is now done via the shell
+ # in the main.mk (search it for T.tcllibdir) so that
+ # static/hand-written makefiles which import main.mk do not have
+ # to define that before importing main.mk. Even so, we export
+ # TCLLIBDIR from here for the benefit of those who want to provide
+ # it at configure-time and have it "stick", without having to
+ # provide it on each make invocation or set it in their
+ # environment.
set tcllibdir [get-env TCLLIBDIR ""]
if {"" eq $tcllibdir} {
+ # Attempt to extract TCLLIBDIR from TCL's $auto_path
if {[catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} {
foreach i $result {
if {[file isdir $i]} {
- set tcllibdir $i
+ set tcllibdir $i/sqlite3
break
}
}
} else {
- hwaci-warn "Cannot determine TCLLIBDIR"
+ proj-warn "Cannot determine TCLLIBDIR"
}
}
set tclrpath ""
if {"" ne $tcllibdir} {
- set tcllibdir "${tcllibdir}/sqlite3"
set rp [get-define SH_LINKRPATH]
set tclrpath [string map [list "%s" $tcllibdir] $rp]
# Reminder: tclConfig.sh has TCL_LD_SEARCH_FLAGS to set the
@@ -598,91 +614,99 @@ proc hwaci-check-tcl {} {
}
define TCLLIBDIR $tcllibdir
define TCLLIB_RPATH $tclrpath
- #hwaci-fatal "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
- } else {
- define TCLLIBDIR ""
- define TCLLIB_RPATH ""
- }
+ #msg-debug "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
+ }; # find TCLLIBDIR
if {[file exists $with_tclsh]} {
msg-result "Using tclsh: $with_tclsh"
define HAVE_TCL 1
} else {
- hwaci-warn "Cannot find a usable tclsh, so cannot run tests."
+ proj-warn "Cannot find a usable tclsh, so cannot run tests."
}
-}; # hwaci-check-tcl
+}; # sqlite-check-tcl
-hwaci-check-tcl
+sqlite-check-tcl
########################################################################
-# Check which TCL to use as a code generator. Prefer jimsh simply
-# because we have it in-tree (it's part of autosetup).
+# sqlite-determine-codegen-tcl checks which TCL to use as a code
+# generator. By default, prefer jimsh simply because we have it
+# in-tree (it's part of autosetup) unless --with-tclsh=X is used, in
+# which case prefix X.
#
-# Building jimsh0.c with -DJIM_COMPAT changes certain behavior to be
-# compatible with canonical TCL. Specifically: jim's [expr] only
-# accepts one arg unless JIM_COMPAT is defined. As of 2024-10-23,
-# jimsh0.c defines JIM_COMPAT automatically (prior to that it intended
-# to but a typo of JIM_TCL_COMPAT made it a no-op).
-define CFLAGS_JIMSH {}
-set useOwnJimsh 0
-msg-result "Which TCL to use for code generation... "
-set cgtcl jimtcl
-if {[cc-check-functions realpath]} {
- define-append CFLAGS_JIMSH -DHAVE_REALPATH
- define BTCLSH "\$(JIMSH)"
- set useOwnJimsh 1
-} elseif {[cc-check-functions _fullpath]} {
- # _fullpath() is a Windows API
- define-append CFLAGS_JIMSH -DHAVE__FULLPATH
- define BTCLSH "\$(JIMSH)"
- set useOwnJimsh 1
-} elseif {[file exists [get-define TCLSH_CMD]]} {
- set cgtcl [get-define TCLSH_CMD]
- define BTCLSH "\$(TCLSH_CMD)"
-} else {
- # One last-ditch effort to find TCLSH_CMD: use info from
- # tclConfig.sh to try to find a tclsh
- if {"" eq [get-define TCLSH_CMD]} {
- set tpre [get-define TCL_EXEC_PREFIX]
- if {"" ne $tpre} {
- set tv [get-define TCL_VERSION]
- if {[file-isexec "${tpre}/bin/tclsh${tv}"]} {
- define TCLSH_CMD "${tpre}/bin/tclsh${tv}"
- } elseif {[file-isexec "${tpre}/bin/tclsh"]} {
- define TCLSH_CMD "${tpre}/bin/tclsh"
+# Returns the name of the TCL it selects. Fails fatally if it cannot
+# detect a TCL appropriate for code generation.
+#
+# Defines:
+#
+# - BTCLSH = the TCL shell used for code generation. It may set this
+# to an unexpanded makefile var name.
+#
+# - CFLAGS_JIMSH = any flags needed for buildng a BTCLSH-compatible
+# jimsh.
+proc sqlite-determine-codegen-tcl {} {
+ msg-result "Checking for TCL to use for code generation... "
+ define CFLAGS_JIMSH {}
+ set cgtcl [opt-val with-tclsh jimsh]
+ if {"jimsh" ne $cgtcl} {
+ # When --with-tclsh=X is used, use that for all TCL purposes,
+ # including in-tree code generation, per developer request.
+ define BTCLSH "\$(TCLSH_CMD)"
+ } else {
+ # These headers are technically optional for JimTCL but necessary if
+ # we want to use it for code generation:
+ set sysh [cc-check-includes dirent.h sys/time.h]
+ if {$sysh && [cc-check-functions realpath]} {
+ define-append CFLAGS_JIMSH -DHAVE_REALPATH
+ define BTCLSH "\$(JIMSH)"
+ } elseif {$sysh && [cc-check-functions _fullpath]} {
+ # _fullpath() is a Windows API
+ define-append CFLAGS_JIMSH -DHAVE__FULLPATH
+ define BTCLSH "\$(JIMSH)"
+ } elseif {[file exists [get-define TCLSH_CMD]]} {
+ set cgtcl [get-define TCLSH_CMD]
+ define BTCLSH "\$(TCLSH_CMD)"
+ } else {
+ # One last-ditch effort to find TCLSH_CMD: use info from
+ # tclConfig.sh to try to find a tclsh
+ if {"" eq [get-define TCLSH_CMD]} {
+ set tpre [get-define TCL_EXEC_PREFIX]
+ if {"" ne $tpre} {
+ set tv [get-define TCL_VERSION]
+ if {[file-isexec "${tpre}/bin/tclsh${tv}"]} {
+ define TCLSH_CMD "${tpre}/bin/tclsh${tv}"
+ } elseif {[file-isexec "${tpre}/bin/tclsh"]} {
+ define TCLSH_CMD "${tpre}/bin/tclsh"
+ }
+ }
}
- unset tv
+ set cgtcl [get-define TCLSH_CMD]
+ if {![file exists $cgtcl]} {
+ proj-fatal "Cannot find a tclsh to use for code generation."
+ }
+ define BTCLSH "\$(TCLSH_CMD)"
}
- unset tpre
}
- set cgtcl [get-define TCLSH_CMD]
- if {![file exists $cgtcl]} {
- hwaci-fatal "Cannot find a tclsh to use for code generation."
- }
- define BTCLSH "\$(TCLSH_CMD)"
-}
-msg-result "TCL for code generation: $cgtcl"
-unset cgtcl
-#define CFLAGS_JIMSH {-DJUST_TESTING}
-
+ return $cgtcl
+}; # sqlite-determine-codegen-tcl
+msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
# /TCL
########################################################################
########################################################################
# Thread safety?
msg-checking "Support threadsafe operation? "
-hwaci-if-opt-truthy threadsafe {
+proj-if-opt-truthy threadsafe {
msg-result yes
- add-feature-flag -DSQLITE_THREADSAFE=1
- if {![hwaci-check-function-in-lib pthread_create pthread]
- || ![hwaci-check-function-in-lib pthread_mutexattr_init pthread]} {
+ sqlite-add-feature-flag -DSQLITE_THREADSAFE=1
+ if {![proj-check-function-in-lib pthread_create pthread]
+ || ![proj-check-function-in-lib pthread_mutexattr_init pthread]} {
user-error "Missing required pthread bits"
}
define LDFLAGS_PTHREAD [get-define lib_pthread_create]
undefine lib_pthread_create
} {
msg-result no
- add-feature-flag -DSQLITE_THREADSAFE=0
+ sqlite-add-feature-flag -DSQLITE_THREADSAFE=0
define LDFLAGS_PTHREAD ""
}
@@ -707,132 +731,223 @@ if {1} {
unset ts tsn
}
-if {1} {
- ##########
- # Figure out what C libraries are required to compile programs
- # that use "readline()" library.
- add-shell-opt -DHAVE_READLINE=[hwaci-check-readline]
-} else {
- # Older impl solely for reference while porting...
+########################################################################
+# sqlite-check-line-editing jumps through proverbial hoops to try to
+# find a working line-editing library, setting:
+#
+# - HAVE_READLINE to 0 or 1
+# - HAVE_LINENOISE to 0 or 1
+# - HAVE_EDITLINE to 0 or 1
+#
+# Only one of ^^^ those will be set to 1.
+#
+# - LDFLAGS_READLINE = linker flags or empty string
+#
+# - CFLAGS_READLINE = compilation flags for clients or empty string.
+#
+# Note that LDFLAGS_READLINE and CFLAGS_READLINE may refer to
+# linenoise or editline, not necessarily libreadline. In some cases
+# it will set HAVE_READLINE=1 when it's really using editline, for
+# reasons described in this function's comments.
+#
+# Returns a string describing which line-editing approach to use, or
+# "none" if no option is available.
+#
+# Order of checks:
+#
+# 1) --with-linenoise trumps all others
+#
+# 2) --editline trumps --readline
+#
+# 3) --disable-readline trumps --readline
+#
+# 4) Default to automatic search for optional readline
+#
+# 5) Try to find readline resp. editline. If it's not found AND the
+# corresponding --FEATURE flag was explicitly given, fail fatally,
+# else fail silently.
+proc sqlite-check-line-editing {} {
+ msg-result "Checking for line-editing capability..."
+ define HAVE_READLINE 0
+ define HAVE_LINENOISE 0
+ define HAVE_EDITLINE 0
+ define LDFLAGS_READLINE ""
+ define CFLAGS_READLINE ""
+ set failIfNotFound 0 ; # Set to 1 for explicit --FEATURE requests
+ set libsForReadline {readline edit} ; # -l names to check for readline().
+ # The libedit check changes this.
+ set editLibName "readline" ; # "readline" or "editline"
+ set editLibDef "HAVE_READLINE" ; # "HAVE_READLINE" or "HAVE_EDITLINE"
+ set dirLn [opt-val with-linenoise]
+ if {"" ne $dirLn} {
+ # Use linenoise from a copy of its sources (not a library)...
+ if {![file isdir $dirLn]} {
+ proj-fatal "--with-linenoise value is not a directory"
+ } elseif {![file exists $dirLn/linenoise.c] } {
+ proj-fatal "Cannot find linenoise.c in $dirLn"
+ } elseif {![file exists $dirLn/linenoise.h] } {
+ proj-fatal "Cannot find linenoise.h in $dirLn"
+ }
+ msg-result "Using linenoise from $dirLn"
+ define CFLAGS_READLINE "-I$dirLn $dirLn/linenoise.c"
+ define HAVE_LINENOISE 1
+ sqlite-add-shell-opt -DHAVE_LINENOISE=1
+ return "linenoise"
+ } elseif {[opt-bool editline]} {
+ # libedit mimics libreadline and on some systems does not have its
+ # own header installed (instead, that of libreadline is used).
+ #
+ # shell.c historically expects HAVE_EDITLINE to be set for
+ # libedit, but it then expects to see , which
+ # some system's don't actually have, despite having libedit. If
+ # we end up finding below, we will use
+ # -DHAVE_EDITLINE=1, else we will use -DHAVE_READLINE=1. In either
+ # case, we will link against libedit.
+ set failIfNotFound 1
+ set libsForReadline {edit}
+ set editLibName editline
+ } elseif {![opt-bool readline]} {
+ msg-result "Readline support explicitly disabled with --disable-readline"
+ return "none"
+ } elseif {[proj-opt-was-provided readline]} {
+ # If an explicit --[enable-]readline was used, fail if it's not
+ # found, else treat the feature as optional.
+ set failIfNotFound 1
+ }
+
+ # Transform with-readline-header=X to with-readline-cflags=-I...
+ set v [opt-val with-readline-header]
+ proj-opt-set with-readline-header ""
+ if {"" ne $v} {
+ if {"auto" eq $v} {
+ proj-opt-set with-readline-cflags auto
+ } else {
+ set v [file dirname $v]
+ if {[string match */readline $v]} {
+ # Special case: if the path includes .../readline/readline.h, set
+ # the -I to one dir up from that because our sources include
+ # or . Reminder: if
+ # auto.def is being run by jimsh0 then [file normalize] will not
+ # work!
+ set v [file dirname $v]
+ }
+ proj-opt-set with-readline-cflags "-I$v"
+ }
+ }
+
+ # Look for readline.h
+ set rlInc [opt-val with-readline-cflags auto]
+ if {"auto" eq $rlInc} {
+ set rlInc ""
+ if {$::cross_compiling} {
+ # ^^^ this check is derived from the legacy configure script.
+ proj-warn "Skipping check for readline.h because we're cross-compiling."
+ } else {
+ set dirs "[get-define prefix] /usr /usr/local /usr/local/readline /usr/contrib /mingw"
+ set subdirs "include/$editLibName"
+ if {"editline" eq $editLibName} {
+ lappend subdirs include/readline
+ # ^^^ editline, on some systems, does not have its own header,
+ # and uses libreadline's header.
+ }
+ lappend subdirs include
+ # ^^^ The dirs and subdirs lists are, except for the inclusion
+ # of $prefix and editline, from the legacy configure script
+ set rlInc [proj-search-for-header-dir readline.h \
+ -dirs $dirs -subdirs $subdirs]
+ if {"" ne $rlInc} {
+ if {[string match */readline $rlInc]} {
+ set rlInc [file dirname $rlInc]; # shell #include's
+ } elseif {[string match */editline $rlInc]} {
+ set editLibDef HAVE_EDITLINE
+ set rlInc [file dirname $rlInc]; # shell #include's
+ }
+ set rlInc "-I${rlInc}"
+ }
+ }
+ } elseif {"" ne $rlInc && ![string match *-I* $rlInc]} {
+ proj-fatal "Argument to --with-readline-cflags is intended to be CFLAGS and contain -I..."
+ }
+
+ # If readline.h was found/specified, look for lib(readline|edit)...
#
- # XXX TARGET_READLINE_LIBS=""
- # XXX TARGET_READLINE_INC=""
- # XXX TARGET_HAVE_READLINE=0
- # XXX TARGET_HAVE_EDITLINE=0
- if {[opt-bool editline]} {
- set with_editline $enableval
- } else {
- set with_editline auto
- }
- if {![opt-bool readline]} {
- set with_readline $enableval
- } else {
- set with_readline auto
+ # This is not quite straightforward because both libreadline and
+ # libedit typically require some other library which (according to
+ # legacy autotools-generated tests) provides tgetent(3). On some
+ # systems that's built into libreadline/edit, on some (most?) its in
+ # lib[n]curses, and on some it's in libtermcap.
+ set rlLib ""
+ if {"" ne $rlInc} {
+ set rlLib [opt-val with-readline-ldflags]
+ if {"" eq $rlLib || "auto" eq $rlLib} {
+ set rlLib ""
+ set libTerm ""
+ if {[proj-check-function-in-lib tgetent "$editLibName ncurses curses termcap"]} {
+ # ^^^ that libs list comes from the legacy configure script ^^^
+ set libTerm [get-define lib_tgetent]
+ undefine lib_tgetent
+ }
+ if {$editLibName eq $libTerm} {
+ set rlLib $libTerm
+ } elseif {[proj-check-function-in-lib readline $libsForReadline $libTerm]} {
+ set rlLib [get-define lib_readline]
+ lappend rlLib $libTerm
+ undefine lib_readline
+ }
+ }
}
- # XXX if test x"$with_editline" != xno; then
- # XXX sLIBS=$LIBS
- # XXX LIBS=""
- # XXX TARGET_HAVE_EDITLINE=1
- if {[hwaci-check-function-in-lib readline edit]} {
- set with_readline no
- } else {
- # XXX TARGET_HAVE_EDITLINE=0
+ # If we found a library, configure the build to use it...
+ if {"" ne $rlLib} {
+ if {"editline" eq $editLibName && "HAVE_READLINE" eq $editLibDef} {
+ proj-indented-notice {
+ NOTE: the local libedit but uses so we
+ will compile with -DHAVE_READLINE=1 but will link with
+ libedit.
+ }
+ }
+ set rlLib [join $rlLib]
+ set rlInc [join $rlInc]
+ define LDFLAGS_READLINE $rlLib
+ define CFLAGS_READLINE $rlInc
+ proj-assert {expr {$editLibDef in {HAVE_READLINE HAVE_EDITLINE}}}
+ proj-assert {expr {$editLibName in {readline editline}}}
+ sqlite-add-shell-opt -D${editLibDef}=1
+ msg-result "Using $editLibName flags: $rlInc $rlLib"
+ # Check whether rl_completion_matches() has a signature we can use
+ # and disable that sub-feature if it doesn't.
+ if {![cctest \
+ -cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 -source {
+ #include
+ #ifdef HAVE_EDITLINE
+ #include
+ #else
+ #include
+ #endif
+ static char * rcg(const char *z, int i){(void)z; (void)i; return 0;}
+ int main(void) {
+ char ** x = rl_completion_matches("one", rcg);
+ (void)x;
+ return 0;
+ }
+ }]} {
+ user-notice "WARNING: readline-style completion disabled due to rl_completion_matches() signature mismatch"
+ show-notices
+ sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION
+ }
+ return $editLibName
}
- # XXX TARGET_READLINE_LIBS=$LIBS
- # XXX LIBS=$sLIBS
- # XXX fi
- # XXX if test x"$with_readline" != xno; then
- set found "yes"
- if {[opt-val with-readline-lib] ne {}} {
- set withval [lindex [opt-val with-readline-lib] end]
- set with_readline_lib $withval
- } else {
- set with_readline_lib "auto"
+ if {$failIfNotFound} {
+ proj-fatal "Explicit --$editLibName failed to find a matching library."
}
- # XXX if test "x$with_readline_lib" = xauto; then
- # XXX save_LIBS="$LIBS"
- # XXX LIBS=""
- if {[hwaci-check-function-in-lib tgetent readline ncurses curses termcap]} {
- # XXX term_LIBS="$LIBS"
- } else {
- # XXX term_LIBS=""
- }
- if {[hwaci-check-function-in-lib readline readline]} {
- # XXX TARGET_READLINE_LIBS="-lreadline"
- } else {
- set found "no"
- }
- # XXX TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
- # XXX LIBS="$save_LIBS"
- # XXX else
- # XXX TARGET_READLINE_LIBS="$with_readline_lib"
- # XXX fi
- if {[opt-val with-readline-inc] ne {}} {
- set withval [lindex [opt-val with-readline-inc] end]
- set with_readline_inc $withval
- } else {
- set with_readline_inc "auto"
- }
- # XXX if test "x$with_readline_inc" = xauto; then
- if {[cc-check-includes readline.h]} {
- set found "yes"
- } else {
- set found "no"
- # XXX if test "$cross_compiling" != yes; then
- # XXX for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
- # XXX for subdir in include include/readline; do
- # XXX AC_CHECK_FILE $dir/$subdir/readline.h found=yes
- # XXX if test "$found" = "yes"; then
- # XXX TARGET_READLINE_INC="-I$dir/$subdir"
- # XXX break
- # XXX fi
- # XXX done
- # XXX test "$found" = "yes" && break
- # XXX done
- # XXX fi
- }
- # XXX else
- # XXX TARGET_READLINE_INC="$with_readline_inc"
- # XXX fi
+ return "none"
+}; # sqlite-check-line-editing
+msg-result "Line-editing support for the sqlite3 shell: [sqlite-check-line-editing]"
- # XXX if test x"$found" = xno; then
- # XXX TARGET_READLINE_LIBS=""
- # XXX TARGET_READLINE_INC=""
- # XXX TARGET_HAVE_READLINE=0
- # XXX else
- # XXX TARGET_HAVE_READLINE=1
- # XXX fi
- # XXX fi
- if {[opt-val with-linenoise] ne {}} {
- set withval [lindex [opt-val with-linenoise] end]
- set with_linenoise $withval
- } else {
- set with_linenoise "no"
- }
- # XXX if test "x$with_linenoise" != "xno"; then
- # XXX TARGET_HAVE_READLINE=0
- # XXX TARGET_HAVE_EDITLINE=0
- # XXX TARGET_HAVE_LINENOISE=1
- # XXX TARGET_READLINE_INC="-I${with_linenoise}"
- # XXX TARGET_READLINE_LIBS="${with_linenoise}/linenoise.c"
- # XXX echo "using linenoise source code at ${with_linenoise}"
- # XXX else
- # XXX TARGET_HAVE_LINENOISE=0
- # XXX echo "not using linenoise"
- # XXX fi
-
- # XXX AC_SUBST TARGET_READLINE_LIBS
- # XXX AC_SUBST TARGET_READLINE_INC
- # XXX AC_SUBST TARGET_HAVE_READLINE
- # XXX AC_SUBST TARGET_HAVE_EDITLINE
- # XXX AC_SUBST TARGET_HAVE_LINENOISE
-}
-
-hwaci-if-opt-truthy load-extension {
- if {[hwaci-check-function-in-lib dlopen dl]} {
+proj-if-opt-truthy load-extension {
+ if {[proj-check-function-in-lib dlopen dl]} {
define LDFLAGS_DLOPEN [get-define lib_dlopen]
undefine lib_dlopen
} else {
@@ -840,48 +955,108 @@ hwaci-if-opt-truthy load-extension {
}
} {
define LDFLAGS_DLOPEN ""
- add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
+ sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
msg-result "Disabling loadable extensions."
}
-hwaci-if-opt-truthy math {
- if {![hwaci-check-function-in-lib ceil m]} {
+proj-if-opt-truthy math {
+ if {![proj-check-function-in-lib ceil m]} {
user-error "Cannot find libm functions. Use --disable-math to bypass this."
}
define LDFLAGS_MATH [get-define lib_ceil]
undefine lib_ceil
- add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
+ sqlite-add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
msg-result "Enabling math SQL functions [get-define LDFLAGS_MATH]"
} {
define LDFLAGS_MATH ""
msg-result "Disabling math SQL functions"
}
-define cross_compiling ${cross_compiling}
+########################################################################
+# ICU - International Components for Unicode
+#
+# Handles these flags:
+#
+# --with-icu-ldflags=LDFLAGS
+# --with-icu-config[=/path/to/icu-config]
+# --enable-icu-collations
+#
+# If both icu-ldflags and icu-config are provided, they are
+# cumulative. If neither are provided, icu-collations is not honored
+# and a warning is emitted if it is provided.
+#
+# Design note: though we can automatically enable ICU if the
+# icu-config binary is found, we specifically do not. ICU is always an
+# opt-in feature.
+proc sqlite-check-icu {} {
+ define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]]
+ # Flags sets seen in the wild for ICU:
+ # - -licui18n -licuuc -licudata
+ # - -licui18n -licuuc
+ # - /usr/local/bin/icu-config --ldflags
+ if {[proj-opt-was-provided with-icu-config]} {
+ set bin [opt-val with-icu-config]
+ if {"auto" eq $bin} {
+ set bin [proj-first-bin-of \
+ [get-define prefix]/bin/icu-config \
+ /usr/local/bin/icu-config \
+ /usr/bin/icu-config]
+ if {"" eq $bin} {
+ proj-fatal "--with-icu-config=auto cannot find icu-config binary"
+ }
+ }
+ if {[file-isexec $bin]} {
+ set x [exec $bin --ldflags]
+ if {"" eq $x} {
+ proj-fatal "$bin --ldflags returned no data"
+ }
+ define-append LDFLAGS_ICU $x
+ } else {
+ proj-fatal "--with-icu-config=$bin does not refer to an executable"
+ }
+ }
+ set flags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]]
+ if {"" ne $flags} {
+ sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU
+ msg-result "Enabling ICU support with libs: $flags"
+ if {[opt-bool icu-collations]} {
+ msg-result "Enabling ICU collations."
+ sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU_COLLATIONS
+ # Recall that shell.c builds with sqlite3.c
+ }
+ } elseif {[opt-bool icu-collations]} {
+ proj-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags"
+ } else {
+ msg-result "ICU support is disabled."
+ }
+}; # sqlite-check-icu
+sqlite-check-icu
########################################################################
# Emscripten SDK for building the web-based wasm components.
#
-set emccsh $srcdir/tool/emcc.sh
-if {![get-define HAVE_WASI_SDK] && [hwaci-check-emsdk]} {
- define EMCC_WRAPPER $emccsh
- hwaci-make-from-dot-in $emccsh
- catch {exec chmod u+x $emccsh}
-} else {
- define EMCC_WRAPPER ""
- file delete -force $emccsh
+proc sqlite-check-emsdk {} {
+ set emccsh $::srcdir/tool/emcc.sh
+ if {![get-define HAVE_WASI_SDK] && [proj-check-emsdk]} {
+ define EMCC_WRAPPER $emccsh
+ proj-make-from-dot-in $emccsh
+ catch {exec chmod u+x $emccsh}
+ } else {
+ define EMCC_WRAPPER ""
+ file delete -force $emccsh
+ }
}
-unset emccsh
+sqlite-check-emsdk
########################################################################
# Check for log(3) in libm and die with an error if it is not
-# found. $why should be the feature name which requires that function
-# (it's used only in error messages). defines LDFLAGS_MATH to the
-# required linker flags (which may be empty even if the math APIs are
-# found, depending on the OS).
-proc affirm-have-math {why} {
- if {![hwaci-check-function-in-lib log m]} {
- user-error "Missing math APIs for $why"
+# found. $featureName should be the feature name which requires that
+# function (it's used only in error messages). defines LDFLAGS_MATH to
+# the required linker flags (which may be empty even if the math APIs
+# are found, depending on the OS).
+proc affirm-have-math {featureName} {
+ if {![msg-quiet proj-check-function-in-lib log m]} {
+ user-error "Missing math APIs for $featureName"
}
define LDFLAGS_MATH [get-define lib_log ""]
undefine lib_log
@@ -889,56 +1064,73 @@ proc affirm-have-math {why} {
########################################################################
# Handle various SQLITE_ENABLE_... feature flags.
+msg-result "Feature flags..."
foreach {boolFlag featureFlag ifSetEvalThis} {
all {} {
- hwaci-opt-set fts4
- hwaci-opt-set fts5
- hwaci-opt-set geopoly
- hwaci-opt-set rtree
- hwaci-opt-set session
+ proj-opt-set fts4
+ proj-opt-set fts5
+ proj-opt-set geopoly
+ proj-opt-set rtree
+ proj-opt-set session
}
fts4 -DSQLITE_ENABLE_FTS4 {affirm-have-math fts4}
fts5 -DSQLITE_ENABLE_FTS5 {affirm-have-math fts5}
- geopoly -DSQLITE_ENABLE_GEOPOLY {hwaci-opt-set rtree}
+ geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree}
rtree -DSQLITE_ENABLE_RTREE {}
session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {}
update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {}
+ memsys5 -DSQLITE_ENABLE_MEMSYS5 {}
memsys3 {} {
if {[opt-bool memsys5]} {
- msg-result "NOT enabling memsys3 because memsys5 is enabled."
+ proj-warn "not enabling memsys3 because memsys5 is enabled."
+ expr 0
} else {
- add-feature-flag -DSQLITE_ENABLE_MEMSYS3
+ sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3
}
}
- memsys5 -DSQLITE_ENABLE_MEMSYS5 {}
} {
- hwaci-if-opt-truthy $boolFlag {
- add-feature-flag $featureFlag
- eval $ifSetEvalThis
- if {"all" ne $boolFlag} {
- msg-result "Enabling $boolFlag"
+ proj-if-opt-truthy $boolFlag {
+ sqlite-add-feature-flag $featureFlag
+ if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} {
+ msg-result " + $boolFlag"
}
} {
- msg-result "Not enabling $boolFlag"
+ if {"all" ne $boolFlag} {
+ msg-result " - $boolFlag"
+ }
}
}
########################################################################
# Invert the above loop's logic for some explicit SQLITE_OMIT_...
-# cases. If config option $boolFlag is set, [add-feature-flag
+# cases. If config option $boolFlag is set, [sqlite-add-feature-flag
# $featureFlag], where $featureFlag is intended to be
# -DSQLITE_OMIT_...
foreach {boolFlag featureFlag} {
json -DSQLITE_OMIT_JSON
} {
- if {[hwaci-opt-truthy $boolFlag]} {
- msg-result "Enabling $boolFlag"
+ if {[proj-opt-truthy $boolFlag]} {
+ msg-result " + $boolFlag"
} else {
- add-feature-flag $featureFlag
- msg-result "Disabling $boolFlag"
+ sqlite-add-feature-flag $featureFlag
+ msg-result " - $boolFlag"
}
}
+#########################################################################
+# Show the final feature flag sets:
+set oFF [get-define OPT_FEATURE_FLAGS]
+if {"" ne $oFF} {
+ define OPT_FEATURE_FLAGS [lsort -unique $oFF]
+ msg-result "Library feature flags: [get-define OPT_FEATURE_FLAGS]"
+}
+set oFF [get-define OPT_SHELL]
+if {"" ne $oFF} {
+ define OPT_SHELL [lsort -unique $oFF]
+ msg-result "Shell options: [get-define OPT_SHELL]"
+}
+unset oFF
+
########################################################################
# Maybe extend JimTCL a bit. As of this writing (2024-09-27) it only
# needs (-DHAVE_REALPATH or -DHAVE__FULLPATH) and -DHAVE_DIRENT_H to
@@ -959,75 +1151,56 @@ if {0 && "" ne [get-define CFLAGS_JIMSH]} {
define-append CFLAGS_JIMSH -DHAVE_LONG_LONG; # SQLite relies on long long, so we know it's available
}; # JimTCL
-########################################################################
-# Determine proper rpath-handling flags
-hwaci-check-rpath
-
########################################################################
# Generate the output files.
#
-hwaci-make-from-dot-in -touch Makefile sqlite3.pc
-# for sqlite_cfg.h and $DUMP_DEFINES_JSON
-define PACKAGE_NAME "sqlite"
-define PACKAGE_URL {https://sqlite.org}
-define PACKAGE_VERSION [get-define VERSION_XYZ]
-define PACKAGE_STRING "[get-define PACKAGE_NAME] [get-define VERSION_XYZ]"
-define PACKAGE_BUGREPORT [get-define PACKAGE_URL]
+# Potential TODO (unclear): in sqlite3.pc.in, do we need to include
+# any CFLAGS_READLINE, CFLAGS_ZLIB, etc in its "Cflags:" section?
+proj-make-from-dot-in -touch Makefile sqlite3.pc
if {0} {
# Requires a hand-written sqlite_cfg.h.in...
- hwaci-make-from-dot-in sqlite_cfg.h
+ proj-make-from-dot-in sqlite_cfg.h
# vs...
} else {
# Requires no input template...
make-config-header sqlite_cfg.h \
-bare {SIZEOF_* HAVE_DECL_*} \
- -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTOREMAKE
+ -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG
TARGET_* USE_GCOV TCL_*} \
-auto {HAVE_* PACKAGE_*} \
-none *
- hwaci-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTOREMAKE@
+ proj-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTORECONFIG@
}
-#TODO hwaci-make-from-dot-in ext/wasm/GNUmakefile
+#TODO proj-make-from-dot-in ext/wasm/GNUmakefile
-set oFF [get-define OPT_FEATURE_FLAGS]
-if {"" ne $oFF} {
- define OPT_FEATURE_FLAGS [lsort -unique $oFF]
- msg-result "Library feature flags: [get-define OPT_FEATURE_FLAGS]"
+if {"" ne $DUMP_DEFINES_JSON} {
+ ########################################################################
+ # Dump config-defines.json...
+ # Demonstrate (mis?)handling of spaces in JSON-export array values:
+ # define-append OPT_FOO.list {"-DFOO=bar baz" -DBAR="baz barre"}
+ define OPT_FEATURE_FLAGS.list [get-define OPT_FEATURE_FLAGS]
+ define OPT_SHELL.list [get-define OPT_SHELL]
+ set dumpDefsOpt {
+ -bare {SIZEOF_* HAVE_DECL_*}
+ -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG TARGET_* USE_GCOV TCL_*}
+ -array {*.list}
+ -auto {OPT_* PACKAGE_* HAVE_*}
+ }
+ if {[opt-bool defines-json-include-lowercase]} {
+ lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends
+ lappend dumpDefsOpt -auto {[a-z]*}
+ }
+ lappend dumpDefsOpt -none *
+ proj-dump-defs-json $DUMP_DEFINES_JSON {*}$dumpDefsOpt
+ undefine OPT_FEATURE_FLAGS.list
+ undefine OPT_SHELL.list
}
-set oFF [get-define OPT_SHELL]
-if {"" ne $oFF} {
- define OPT_SHELL [lsort -unique $oFF]
- msg-result "Shell options: [get-define OPT_SHELL]"
-}
-unset oFF
-
-########################################################################
-# Dump config-defines.json...
-# Demonstrate (mis?)handling of spaces in JSON-export array values:
-# define-append OPT_FOO.list {"-DFOO=bar baz" -DBAR="baz barre"}
-define OPT_FEATURE_FLAGS.list [get-define OPT_FEATURE_FLAGS]
-define OPT_SHELL.list [get-define OPT_SHELL]
-set dumpDefsOpt {
- -bare {SIZEOF_* HAVE_DECL_*}
- -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTOREMAKE TARGET_* USE_GCOV TCL_*}
- -array {*.list}
- -auto {OPT_* PACKAGE_* HAVE_*}
-}
-if {[opt-bool defines-json-include-lowercase]} {
- lappend dumpDefsOpt -none {lib_*} ; # remnants from hwaci-check-function-in-lib and friends
- lappend dumpDefsOpt -auto {[a-z]*}
-}
-lappend dumpDefsOpt -none *
-hwaci-dump-defs-json $DUMP_DEFINES_JSON {*}$dumpDefsOpt
-undefine OPT_FEATURE_FLAGS.list
-undefine OPT_SHELL.list
########################################################################
# Some build-dev/debug-only output
-hwaci-if-opt-truthy dump-defines {
- global DUMP_DEFINES_TXT
- msg-result "--dump-defines is creating $DUMP_DEFINES_TXT"
- make-config-header $DUMP_DEFINES_TXT \
+proj-if-opt-truthy dump-defines {
+ msg-result "--dump-defines is creating $::DUMP_DEFINES_TXT"
+ make-config-header $::DUMP_DEFINES_TXT \
-bare {SQLITE_OS* SQLITE_DEBUG USE_*} \
-str {BIN_* CC LD AR LDFLAG* OPT_*} \
-auto {*}
@@ -1039,5 +1212,3 @@ hwaci-if-opt-truthy dump-defines {
}
}
}
-
-msg-result "Done! Now run make."
diff --git a/autosetup/hwaci-common.tcl b/autosetup/proj.tcl
similarity index 65%
rename from autosetup/hwaci-common.tcl
rename to autosetup/proj.tcl
index 06f3b11645..96c63aad43 100644
--- a/autosetup/hwaci-common.tcl
+++ b/autosetup/proj.tcl
@@ -12,25 +12,28 @@
# Routines for Steve Bennett's autosetup which are common to trees
# managed in and around the umbrella of the SQLite project.
#
-# Routines with a suffix of _ are intended for internal use,
-# within this file, and are not part of the API which auto.def files
-# should rely on.
-#
# This file was initially derived from one used in the libfossil
-# project, authored by the same person who ported it here, noted here
-# only as an indication that there are no licensing issue despite this
-# code having at least two near-twins running around in other trees.
+# project, authored by the same person who ported it here, and this is
+# noted here only as an indication that there are no licensing issues
+# despite this code having a handful of near-twins running around a
+# handful of third-party source trees.
#
########################################################################
#
-# Design notes: by and large, autosetup prefers to update global state
-# with the results of feature checks, e.g. whether the compiler
-# supports flag --X. In this developer's opinion that (A) causes more
-# confusion than it solves[^1] and (B) adds an unnecessary layer of
-# "voodoo" between the autosetup user and its internals. This module,
-# in contrast, instead injects the results of its own tests into
-# well-defined variables and leaves the integration of those values to
-# the caller's discretion.
+# Design notes:
+#
+# - Symbols with a suffix of _ are intended for internal use within
+# this file, and are not part of the API which auto.def files should
+# rely on.
+#
+# - By and large, autosetup prefers to update global state with the
+# results of feature checks, e.g. whether the compiler supports flag
+# --X. In this developer's opinion that (A) causes more confusion
+# than it solves[^1] and (B) adds an unnecessary layer of "voodoo"
+# between the autosetup user and its internals. This module, in
+# contrast, instead injects the results of its own tests into
+# well-defined variables and leaves the integration of those values
+# to the caller's discretion.
#
# [1]: As an example: testing for the -rpath flag, using
# cc-check-flags, can break later checks which use
@@ -42,28 +45,78 @@
########################################################################
########################################################################
-# $hwaci is an internal-use-only array for storing whatever generic
+# $proj_ is an internal-use-only array for storing whatever generic
# internal stuff we need stored.
-array set hwaci_ {}
+array set proj_ {}
+set proj_(isatty) [isatty? stdout]
-proc hwaci-warn {msg} {
- puts stderr "WARNING: $msg"
+proc proj-warn {msg} {
+ puts stderr [proj-bold "WARNING: $msg"]
}
-proc hwaci-notice {msg} {
- puts stderr "NOTICE: $msg"
-}
-proc hwaci-fatal {msg} {
- user-error "ERROR: $msg"
+proc proj-fatal {msg} {
+ show-notices
+ puts stderr [proj-bold "ERROR: $msg"]
+ exit 1
}
########################################################################
-# hwaci-lshift_ shifts $count elements from the list named $listVar and
-# returns them.
+# Kind of like a C assert if uplevel (eval) of $script is false,
+# triggers a fatal error.
+proc proj-assert {script} {
+ if {1 == [get-env proj-assert 0]} {
+ msg-result [proj-bold "asserting: [string trim $script]"]
+ }
+ if {![uplevel 1 $script]} {
+ proj-fatal "Assertion failed: $script"
+ }
+}
+
+########################################################################
+# If this function believes that the current console might support
+# ANSI escape sequences then this returns $str wrapped in a sequence
+# to bold that text, else it returns $str as-is.
+proc proj-bold {str} {
+ if {$::autosetup(iswin) || !$::proj_(isatty)} {
+ return $str
+ }
+ return "\033\[1m${str}\033\[0m"
+}
+
+########################################################################
+# Takes a multi-line message and emits it with consistent indentation
+# using [user-notice] (which means its rendering will (A) go to stderr
+# and (B) be delayed until the next time autosetup goes to output a
+# message).
+#
+# If its first argument is -error then it renders the message
+# immediately and then exits.
+proc proj-indented-notice {args} {
+ set fErr ""
+ if {"-error" eq [lindex $args 0]} {
+ set args [lassign $args fErr]
+ }
+ set lines [split [join $args] \n]
+ foreach line $lines {
+ user-notice " [string trimleft $line]"
+ }
+ if {"" ne $fErr} {
+ show-notices
+ exit 1
+ }
+}
+
+########################################################################
+# Returns 1 if cross-compiling, else 0.
+proc proj-is-cross-compiling {} {
+ return [expr {[get-define host] ne [get-define build]}]
+}
+
+########################################################################
+# proj-lshift_ shifts $count elements from the list named $listVar
+# and returns them as a new list. On empty input, returns "".
#
# Modified slightly from: https://wiki.tcl-lang.org/page/lshift
-#
-# On an empty list, returns "".
-proc hwaci-lshift_ {listVar {count 1}} {
+proc proj-lshift_ {listVar {count 1}} {
upvar 1 $listVar l
if {![info exists l]} {
# make the error message show the real variable name
@@ -78,11 +131,26 @@ proc hwaci-lshift_ {listVar {count 1}} {
return $r
}
+########################################################################
+# Expects to receive string input, which it splits on newlines, strips
+# out any lines which begin with an number of whitespace followed by a
+# '#', and returns a value containing the [append]ed results of each
+# remaining line with a \n between each.
+proc proj-strip-hash-comments_ {val} {
+ set x {}
+ foreach line [split $val \n] {
+ if {![string match "#*" [string trimleft $line]]} {
+ append x $line \n
+ }
+ }
+ return $x
+}
+
########################################################################
# A proxy for cc-check-function-in-lib which "undoes" any changes that
# routine makes to the LIBS define. Returns the result of
# cc-check-function-in-lib.
-proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
+proc proj-check-function-in-lib {function libs {otherlibs {}}} {
set found 0
define-push {LIBS} {
set found [cc-check-function-in-lib $function $libs $otherlibs]
@@ -91,27 +159,50 @@ proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
}
########################################################################
-# If $v is true, [puts $msg] is called, else puts is not called.
-#proc hwaci-maybe-verbose {v msg} {
-# if {$v} {
-# puts $msg
+# Searches for $header in a combination of dirs and subdirs, specified
+# by the -dirs {LIST} and -subdirs {LIST} flags (each of which have
+# sane defaults). Returns either the first matching dir or an empty
+# string. The return value does not contain the filename part.
+proc proj-search-for-header-dir {header args} {
+ set subdirs {include}
+ set dirs {/usr /usr/local /mingw}
+# Debatable:
+# if {![proj-is-cross-compiling]} {
+# lappend dirs [get-define prefix]
# }
-#}
+ while {[llength $args]} {
+ switch -exact -- [lindex $args 0] {
+ -dirs { set args [lassign $args - dirs] }
+ -subdirs { set args [lassign $args - subdirs] }
+ default {
+ proj-fatal "Unhandled argument: $args"
+ }
+ }
+ }
+ foreach dir $dirs {
+ foreach sub $subdirs {
+ if {[file exists $dir/$sub/$header]} {
+ return "$dir/$sub"
+ }
+ }
+ }
+ return ""
+}
########################################################################
-# Usage: hwaci-find-executable-path ?-v? binaryName
+# Usage: proj-find-executable-path ?-v? binaryName
#
# Works similarly to autosetup's [find-executable-path $binName] but:
#
# - If the first arg is -v, it's verbose about searching, else it's quiet.
#
# Returns the full path to the result or an empty string.
-proc hwaci-find-executable-path {args} {
+proc proj-find-executable-path {args} {
set binName $args
set verbose 0
if {[lindex $args 0] eq "-v"} {
set verbose 1
- set binName [lrange $args 1 end]
+ set args [lassign $args - binName]
msg-checking "Looking for $binName ... "
}
set check [find-executable-path $binName]
@@ -126,15 +217,15 @@ proc hwaci-find-executable-path {args} {
}
########################################################################
-# Uses [hwaci-find-executable-path $binName] to (verbosely) search for
+# Uses [proj-find-executable-path $binName] to (verbosely) search for
# a binary, sets a define (see below) to the result, and returns the
# result (an empty string if not found).
#
# The define'd name is: if defName is empty then "BIN_X" is used,
# where X is the upper-case form of $binName with any '-' characters
# replaced with '_'.
-proc hwaci-bin-define {binName {defName {}}} {
- set check [hwaci-find-executable-path -v $binName]
+proc proj-bin-define {binName {defName {}}} {
+ set check [proj-find-executable-path -v $binName]
if {"" eq $defName} {
set defName "BIN_[string toupper [string map {- _} $binName]]"
}
@@ -143,7 +234,7 @@ proc hwaci-bin-define {binName {defName {}}} {
}
########################################################################
-# Usage: hwaci-first-bin-of bin...
+# Usage: proj-first-bin-of bin...
#
# Looks for the first binary found of the names passed to this
# function. If a match is found, the full path to that binary is
@@ -153,36 +244,45 @@ proc hwaci-bin-define {binName {defName {}}} {
# any define'd name that function stores for the result (because the
# caller has no sensible way of knowing which result it was unless
# they pass only a single argument).
-proc hwaci-first-bin-of {args} {
+proc proj-first-bin-of {args} {
+ set rc ""
foreach b $args {
+ set u [string toupper $b]
+ # Note that cc-path-progs defines $u to false if it finds no match.
if {[cc-path-progs $b]} {
- set u [string toupper $b]
- set x [get-define $u]
- undefine $u
- return $x
+ set rc [get-define $u]
}
+ undefine $u
+ if {"" ne $rc} break
}
- return ""
+ return $rc
}
########################################################################
-# Looks for `bash` binary and dies if not found. On success, defines
-# BIN_BASH to the full path to bash and returns that value.
+# Returns 1 if the user specifically provided the given configure
+# flag, else 0. This can be used to distinguish between options which
+# have a default value and those which were explicitly provided by the
+# user, even if the latter is done in a way which uses the default
+# value.
#
-# TODO: move this out of this file and back into the 1 or 2 downstream
-# trees which use it.
-proc hwaci-require-bash {} {
- set bash [hwaci-bin-define bash]
- if {"" eq $bash} {
- user-error "Cannot find required bash shell"
- }
- return $bash
+# For example, with a configure flag defined like:
+#
+# { foo-bar:=baz => {its help text} }
+#
+# This function will, when passed foo-bar, return 1 only if the user
+# passes --foo-bar to configure, even if that invocation would resolve
+# to the default value of baz. If the user does not explicitly pass in
+# --foo-bar (with or without a value) then this returns 0.
+proc proj-opt-was-provided {key} {
+ dict exists $::autosetup(optset) $key
}
########################################################################
# Force-set autosetup option $flag to $val. The value can be fetched
# later with [opt-val], [opt-bool], and friends.
-proc hwaci-opt-set {flag {val 1}} {
+#
+# Returns $val.
+proc proj-opt-set {flag {val 1}} {
global autosetup
if {$flag ni $::autosetup(options)} {
# We have to add this to autosetup(options) or else future calls
@@ -190,20 +290,21 @@ proc hwaci-opt-set {flag {val 1}} {
lappend ::autosetup(options) $flag
}
dict set ::autosetup(optset) $flag $val
+ return $val
}
########################################################################
# Returns 1 if $val appears to be a truthy value, else returns
# 0. Truthy values are any of {1 on enabled yes}
-proc hwaci-val-truthy {val} {
+proc proj-val-truthy {val} {
expr {$val in {1 on enabled yes}}
}
########################################################################
# Returns 1 if [opt-val $flag] appears to be a truthy value or
-# [opt-bool $flag] is true. See hwaci-val-truthy.
-proc hwaci-opt-truthy {flag} {
- if {[hwaci-val-truthy [opt-val $flag]]} { return 1 }
+# [opt-bool $flag] is true. See proj-val-truthy.
+proc proj-opt-truthy {flag} {
+ if {[proj-val-truthy [opt-val $flag]]} { return 1 }
set rc 0
catch {
# opt-bool will throw if $flag is not a known boolean flag
@@ -213,9 +314,9 @@ proc hwaci-opt-truthy {flag} {
}
########################################################################
-# If [hwaci-opt-truthy $flag] is true, eval $then, else eval $else.
-proc hwaci-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
- if {[hwaci-opt-truthy $boolFlag]} {
+# If [proj-opt-truthy $flag] is true, eval $then, else eval $else.
+proc proj-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
+ if {[proj-opt-truthy $boolFlag]} {
uplevel 1 $thenScript
} else {
uplevel 1 $elseScript
@@ -223,23 +324,23 @@ proc hwaci-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
}
########################################################################
-# If [hwaci-opt-truthy $flag] then [define $def $iftrue] else [define
+# If [proj-opt-truthy $flag] then [define $def $iftrue] else [define
# $def $iffalse]. If $msg is not empty, output [msg-checking $msg] and
# a [msg-results ...] which corresponds to the result. Returns 1 if
# the opt-truthy check passes, else 0.
-proc hwaci-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
+proc proj-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
if {"" ne $msg} {
msg-checking "$msg "
}
set rcMsg ""
set rc 0
- if {[hwaci-opt-truthy $flag]} {
+ if {[proj-opt-truthy $flag]} {
define $def $iftrue
set rc 1
} else {
define $def $iffalse
}
- switch -- [hwaci-val-truthy [get-define $def]] {
+ switch -- [proj-val-truthy [get-define $def]] {
0 { set rcMsg no }
1 { set rcMsg yes }
}
@@ -252,28 +353,28 @@ proc hwaci-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
########################################################################
# Args: [-v] optName defName {descr {}}
#
-# Checks [hwaci-opt-truthy $optName] and calls [define $defName X]
+# Checks [proj-opt-truthy $optName] and calls [define $defName X]
# where X is 0 for false and 1 for true. descr is an optional
# [msg-checking] argument which defaults to $defName. Returns X.
#
# If args[0] is -v then the boolean semantics are inverted: if
# the option is set, it gets define'd to 0, else 1. Returns the
# define'd value.
-proc hwaci-opt-define-bool {args} {
+proc proj-opt-define-bool {args} {
set invert 0
if {[lindex $args 0] eq "-v"} {
set invert 1
set args [lrange $args 1 end]
}
- set optName [hwaci-lshift_ args]
- set defName [hwaci-lshift_ args]
- set descr [hwaci-lshift_ args]
+ set optName [proj-lshift_ args]
+ set defName [proj-lshift_ args]
+ set descr [proj-lshift_ args]
if {"" eq $descr} {
set descr $defName
}
set rc 0
msg-checking "$descr ... "
- if {[hwaci-opt-truthy $optName]} {
+ if {[proj-opt-truthy $optName]} {
if {0 eq $invert} {
set rc 1
} else {
@@ -305,7 +406,7 @@ proc hwaci-opt-define-bool {args} {
#
# Note that if it finds LIBLTDL it does not look for LIBDL, so will
# report only that is has LIBLTDL.
-proc hwaci-check-module-loader {} {
+proc proj-check-module-loader {} {
msg-checking "Looking for module-loader APIs... "
if {99 ne [get-define LDFLAGS_MODULE_LOADER 99]} {
if {1 eq [get-define HAVE_LIBLTDL 0]} {
@@ -351,11 +452,11 @@ proc hwaci-check-module-loader {} {
}
########################################################################
-# Sets all flags which would be set by hwaci-check-module-loader to
+# Sets all flags which would be set by proj-check-module-loader to
# empty/falsy values, as if those checks had failed to find a module
# loader. Intended to be called in place of that function when
# a module loader is explicitly not desired.
-proc hwaci-no-check-module-loader {} {
+proc proj-no-check-module-loader {} {
define HAVE_LIBDL 0
define HAVE_LIBLTDL 0
define LDFLAGS_MODULE_LOADER ""
@@ -363,7 +464,7 @@ proc hwaci-no-check-module-loader {} {
########################################################################
# Opens the given file, reads all of its content, and returns it.
-proc hwaci-file-content {fname} {
+proc proj-file-content {fname} {
set fp [open $fname r]
set rc [read $fp]
close $fp
@@ -373,7 +474,7 @@ proc hwaci-file-content {fname} {
########################################################################
# Returns the contents of the given file as an array of lines, with
# the EOL stripped from each input line.
-proc hwaci-file-content-list {fname} {
+proc proj-file-content-list {fname} {
set fp [open $fname r]
set rc {}
while { [gets $fp line] >= 0 } {
@@ -392,9 +493,9 @@ proc hwaci-file-content-list {fname} {
#
# This test has a long history of false positive results because of
# compilers reacting differently to the -MJ flag.
-proc hwaci-check-compile-commands {{configOpt {}}} {
+proc proj-check-compile-commands {{configOpt {}}} {
msg-checking "compile_commands.json support... "
- if {"" ne $configOpt && ![hwaci-opt-truthy $configOpt]} {
+ if {"" ne $configOpt && ![proj-opt-truthy $configOpt]} {
msg-result "explicitly disabled"
define MAKE_COMPILATION_DB no
return 0
@@ -416,14 +517,14 @@ proc hwaci-check-compile-commands {{configOpt {}}} {
########################################################################
# Runs the 'touch' command on one or more files, ignoring any errors.
-proc hwaci-touch {filename} {
+proc proj-touch {filename} {
catch { exec touch {*}$filename }
}
########################################################################
# Usage:
#
-# hwaci-make-from-dot-in ?-touch? filename(s)...
+# proj-make-from-dot-in ?-touch? filename(s)...
#
# Uses [make-template] to create makefile(-like) file(s) $filename
# from $filename.in but explicitly makes the output read-only, to
@@ -436,7 +537,7 @@ proc hwaci-touch {filename} {
# please the build process.
#
# Failures when running chmod or touch are silently ignored.
-proc hwaci-make-from-dot-in {args} {
+proc proj-make-from-dot-in {args} {
set filename $args
set touch 0
if {[lindex $args 0] eq "-touch"} {
@@ -448,7 +549,7 @@ proc hwaci-make-from-dot-in {args} {
catch { exec chmod u+w $f }
make-template $f.in $f
if {$touch} {
- hwaci-touch $f
+ proj-touch $f
}
catch { exec chmod -w $f }
}
@@ -465,9 +566,9 @@ proc hwaci-make-from-dot-in {args} {
# order to avoid potential problems with escaping, space-containing
# tokens, and interfering with autosetup's use of these vars, this
# routine does not directly modify CFLAGS or LDFLAGS.
-proc hwaci-check-profile-flag {{flagname profile}} {
- #puts "flagname=$flagname ?[hwaci-opt-truthy $flagname]?"
- if {[hwaci-opt-truthy $flagname]} {
+proc proj-check-profile-flag {{flagname profile}} {
+ #puts "flagname=$flagname ?[proj-opt-truthy $flagname]?"
+ if {[proj-opt-truthy $flagname]} {
set CC [get-define CC]
regsub {.*ccache *} $CC "" CC
# ^^^ if CC="ccache gcc" then [exec] treats "ccache gcc" as a
@@ -493,7 +594,7 @@ proc hwaci-check-profile-flag {{flagname profile}} {
# machine, i.e. the local host). If $key == "build" then some
# additional checks may be performed which are not applicable when
# $key == "host".
-proc hwaci-looks-like-windows {{key host}} {
+proc proj-looks-like-windows {{key host}} {
global autosetup
switch -glob -- [get-define $key] {
*-*-ming* - *-*-cygwin - *-*-msys {
@@ -502,7 +603,7 @@ proc hwaci-looks-like-windows {{key host}} {
}
if {$key eq "build"} {
# These apply only to the local OS, not a cross-compilation target,
- # as the above check can potentially.
+ # as the above check potentially can.
if {$::autosetup(iswin)} { return 1 }
if {[find-an-executable cygpath] ne "" || $::tcl_platform(os)=="Windows NT"} {
return 1
@@ -519,7 +620,7 @@ proc hwaci-looks-like-windows {{key host}} {
#
# TODO: have someone verify whether this is correct for the
# non-Linux/BSD platforms.
-proc hwaci-looks-like-mac {{key host}} {
+proc proj-looks-like-mac {{key host}} {
switch -glob -- [get-define $key] {
*apple* {
return 1
@@ -536,13 +637,13 @@ proc hwaci-looks-like-mac {{key host}} {
# build environment is then BUILD_EXEEXT is [define]'d to ".exe", else
# "". If the target, a.k.a. "host", is then TARGET_EXEEXT is
# [define]'d to ".exe", else "".
-proc hwaci-exe-extension {} {
+proc proj-exe-extension {} {
set rH ""
set rB ""
- if {[hwaci-looks-like-windows host]} {
+ if {[proj-looks-like-windows host]} {
set rH ".exe"
}
- if {[hwaci-looks-like-windows build]} {
+ if {[proj-looks-like-windows build]} {
set rB ".exe"
}
define BUILD_EXEEXT $rB
@@ -550,7 +651,7 @@ proc hwaci-exe-extension {} {
}
########################################################################
-# Works like hwaci-exe-extension except that it defines BUILD_DLLEXT
+# Works like proj-exe-extension except that it defines BUILD_DLLEXT
# and TARGET_DLLEXT to one of (.so, ,dll, .dylib).
#
# Trivia: for .dylib files, the linker needs the -dynamiclib flag
@@ -558,7 +659,7 @@ proc hwaci-exe-extension {} {
#
# TODO: have someone verify whether this is correct for the
# non-Linux/BSD platforms.
-proc hwaci-dll-extension {} {
+proc proj-dll-extension {} {
proc inner {key} {
switch -glob -- [get-define $key] {
*apple* {
@@ -577,10 +678,10 @@ proc hwaci-dll-extension {} {
}
########################################################################
-# Static-library counterpart of hwaci-dll-extension. Defines
+# Static-library counterpart of proj-dll-extension. Defines
# BUILD_LIBEXT and TARGET_LIBEXT to the conventional static library
# extension for the being-built-on resp. the target platform.
-proc hwaci-lib-extension {} {
+proc proj-lib-extension {} {
proc inner {key} {
switch -glob -- [get-define $key] {
*-*-ming* - *-*-cygwin - *-*-msys {
@@ -596,11 +697,11 @@ proc hwaci-lib-extension {} {
}
########################################################################
-# Calls all of the hwaci-*-extension functions.
-proc hwaci-file-extensions {} {
- hwaci-exe-extension
- hwaci-dll-extension
- hwaci-lib-extension
+# Calls all of the proj-*-extension functions.
+proc proj-file-extensions {} {
+ proj-exe-extension
+ proj-dll-extension
+ proj-lib-extension
}
########################################################################
@@ -608,7 +709,7 @@ proc hwaci-file-extensions {} {
# the filesystem, it fails fatally with an informative message.
# Returns the last file name it checks. If the first argument is -v
# then it emits msg-checking/msg-result messages for each file.
-proc hwaci-affirm-files-exist {args} {
+proc proj-affirm-files-exist {args} {
set rc ""
set verbose 0
if {[lindex $args 0] eq "-v"} {
@@ -644,7 +745,7 @@ proc hwaci-affirm-files-exist {args} {
# but BIN_EMCC is then emcc was not found in the EMSDK_HOME, in which
# case we have to rely on the fact that sourcing $EMSDK_ENV from a
# shell will add emcc to the $PATH.
-proc hwaci-check-emsdk {} {
+proc proj-check-emsdk {} {
set emsdkHome [opt-val with-emsdk]
define EMSDK_HOME ""
define EMSDK_ENV ""
@@ -685,7 +786,7 @@ proc hwaci-check-emsdk {} {
# Achtung: we have seen platforms which report that a given option
# checked here will work but then fails at build-time, and the current
# order of checks reflects that.
-proc hwaci-check-rpath {} {
+proc proj-check-rpath {} {
set rc 1
set lp "[get-define prefix]/lib"
# If we _don't_ use cc-with {} here (to avoid updating the global
@@ -695,6 +796,8 @@ proc hwaci-check-rpath {} {
cc-with {} {
if {[cc-check-flags "-rpath $lp"]} {
define LDFLAGS_RPATH "-rpath $lp"
+ } elseif {[cc-check-flags "-Wl,-rpath,$lp"]} {
+ define LDFLAGS_RPATH "-Wl,-rpath,$lp"
} elseif {[cc-check-flags "-Wl,-rpath -Wl,$lp"]} {
define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp"
} elseif {[cc-check-flags -Wl,-R$lp]} {
@@ -708,81 +811,12 @@ proc hwaci-check-rpath {} {
}
########################################################################
-# Under construction - check for libreadline functionality. Linking
-# in readline varies wildly by platform and this check does not cover
-# all known options.
-#
-# Defines the following vars:
-#
-# - HAVE_READLINE: 0 or 1
-# - LDFLAGS_READLINE: "" or linker flags
-# - CFLAGS_READLINE: "" or c-flags
-# - READLINE_H: "" or "readline/readlin.h" (or similar)
-#
-# Returns the value of HAVE_READLINE.
-proc hwaci-check-readline {} {
- define HAVE_READLINE 0
- define LDFLAGS_READLINE ""
- define CFLAGS_READLINE ""
- define READLINE_H ""
- if {![opt-bool readline]} {
- msg-result "libreadline disabled via --disable-readline."
- return 0
- }
-
- if {[pkg-config-init 0] && [pkg-config readline]} {
- define HAVE_READLINE 1
- define LDFLAGS_READLINE [get-define PKG_READLINE_LDFLAGS]
- define-append LDFLAGS_READLINE [get-define PKG_READLINE_LIBS]
- define CFLAGS_READLINE [get-define PKG_READLINE_CFLAGS]
- return 1
- }
-
- # On OpenBSD on a Raspberry pi 4:
- #
- # $ pkg-config readline; echo $?
- # 0
- # $ pkg-config --cflags readline
- # Package termcap was not found in the pkg-config search path
- # $ echo $?
- # 1
- # $ pkg-config --print-requires readline; echo $?
- # 1
- #
- # i.e. there's apparently no way to find out that readline
- # requires termcap beyond parsing the error message.
-
- set h "readline/readline.h"
- if {[cc-check-includes $h]} {
- define READLINE_H $h
- if {[hwaci-check-function-in-lib readline readline]} {
- msg-result "Enabling libreadline."
- define HAVE_READLINE 1
- define LDFLAGS_READLINE [get-define lib_readline]
- undefine lib_readline
- return 1
- }
- # else TODO: look in various places and [define CFLAGS_READLINE
- # -I...]
- }
- # Numerous TODOs:
- # - Requires linking with ncurses or similar on some platforms.
- # - Headers are in a weird place on some BSD systems.
- # - Add --with-readline=DIR
- # - Add --with-readline-lib=lib file
- # - Add --with-readline-inc=dir -Idir
- msg-result "libreadline not found."
- return 0
-}
-
-
-########################################################################
-# Internal helper for hwaci-dump-defs-json. Expects to be passed a
+# Internal helper for proj-dump-defs-json. Expects to be passed a
# [define] name and the variadic $args which are passed to
-# hwaci-dump-defs-json. If it finds a pattern match for the given
+# proj-dump-defs-json. If it finds a pattern match for the given
# $name in the various $args, it returns the type flag for that $name,
# e.g. "-str" or "-bare", else returns an empty string.
-proc hwaci-defs-type_ {name spec} {
+proc proj-defs-type_ {name spec} {
foreach {type patterns} $spec {
foreach pattern $patterns {
if {[string match $pattern $name]} {
@@ -794,50 +828,50 @@ proc hwaci-defs-type_ {name spec} {
}
########################################################################
-# Internal helper for hwaci-defs-format_: returns a JSON-ish quoted
+# Internal helper for proj-defs-format_: returns a JSON-ish quoted
# form of the given (JSON) string-type values.
-proc hwaci-quote-str_ {value} {
+proc proj-quote-str_ {value} {
return \"[string map [list \\ \\\\ \" \\\"] $value]\"
}
########################################################################
-# An internal impl detail of hwaci-dump-defs-json. Requires a data
+# An internal impl detail of proj-dump-defs-json. Requires a data
# type specifier, as used by make-config-header, and a value. Returns
-# the formatted value or the value $::hwaci_(defs-skip) if the caller
+# the formatted value or the value $::proj_(defs-skip) if the caller
# should skip emitting that value.
-set hwaci_(defs-skip) "-hwaci-defs-format_ sentinel"
-proc hwaci-defs-format_ {type value} {
+set proj_(defs-skip) "-proj-defs-format_ sentinel"
+proc proj-defs-format_ {type value} {
switch -exact -- $type {
-bare {
# Just output the value unchanged
}
-none {
- set value $::hwaci_(defs-skip)
+ set value $::proj_(defs-skip)
}
-str {
- set value [hwaci-quote-str_ $value]
+ set value [proj-quote-str_ $value]
}
-auto {
# Automatically determine the type
if {![string is integer -strict $value]} {
- set value [hwaci-quote-str_ $value]
+ set value [proj-quote-str_ $value]
}
}
-array {
set ar {}
foreach v $value {
- set v [hwaci-defs-format_ -auto $v]
- if {$::hwaci_(defs-skip) ne $v} {
+ set v [proj-defs-format_ -auto $v]
+ if {$::proj_(defs-skip) ne $v} {
lappend ar $v
}
}
set value "\[ [join $ar {, }] \]"
}
"" {
- set value $::hwaci_(defs-skip)
+ set value $::proj_(defs-skip)
}
default {
- hwaci-fatal "Unknown type in hwaci-dump-defs-json: $type"
+ proj-fatal "Unknown type in proj-dump-defs-json: $type"
}
}
return $value
@@ -873,14 +907,14 @@ proc hwaci-defs-format_ {type value} {
# Neither is especially satisfactory (and the second is useless), and
# handling of such values is subject to change if any such values ever
# _really_ need to be processed by our source trees.
-proc hwaci-dump-defs-json {file args} {
+proc proj-dump-defs-json {file args} {
file mkdir [file dirname $file]
set lines {}
lappend args -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_*
foreach n [lsort [dict keys [all-defines]]] {
- set type [hwaci-defs-type_ $n $args]
- set value [hwaci-defs-format_ $type [get-define $n]]
- if {$::hwaci_(defs-skip) ne $value} {
+ set type [proj-defs-type_ $n $args]
+ set value [proj-defs-format_ $type [get-define $n]]
+ if {$::proj_(defs-skip) ne $value} {
lappend lines "\"$n\": ${value}"
}
}
@@ -890,3 +924,68 @@ proc hwaci-dump-defs-json {file args} {
msg-result "Created $file"
}
}
+
+########################################################################
+# Expects a list of pairs of configure flags with the given names to
+# have been registered with autosetup, in this form:
+#
+# { alias1 => canonical1
+# aliasN => canonicalN ... }
+#
+# The names must not have their leading -- part and must be in the
+# form which autosetup will expect for passing to [opt-val NAME] and
+# friends.
+#
+# Commend lines are permitted in the input.
+#
+# If [opt-val $hidden] has a value but [opt-val
+# $canonical] does not, it copies the former over the latter. If
+# $hidden has no value set, this is a no-op. If both have explicit
+# values a fatal usage error is triggered.
+#
+# Motivation: autosetup enables "hidden aliases" in [options] lists,
+# and elides the aliases from --help output but does no further
+# handling of them. For example, when --alias is a hidden alias of
+# --canonical and a user passes --alias=X, [opt-val canonical] returns
+# no value. i.e. the script must check both [opt-val alias] and
+# [opt-val canonical]. The intent here is that this function be
+# passed such mappings immediately after [options] is called,
+# to carry over any values from hidden aliases into their canonical
+# names, so that in the above example [opt-value canonical] will
+# return X if --alias=X is passed in.
+proc proj-xfer-options-aliases {mapping} {
+ foreach {hidden - canonical} [proj-strip-hash-comments_ $mapping] {
+ if {[proj-opt-was-provided $hidden]} {
+ if {[proj-opt-was-provided $canonical]} {
+ proj-fatal "both --$canonical and its alias --$hidden were used. Use only one or the other."
+ } else {
+ proj-opt-set $canonical [opt-val $hidden]
+ }
+ }
+ }
+}
+
+########################################################################
+# Arguable/debatable...
+#
+# When _not_ cross-compiling and CC_FOR_BUILD is _not_ explcitely
+# specified, force CC_FOR_BUILD to be the same as CC, so that:
+#
+# ./configure CC=clang
+#
+# will use CC_FOR_BUILD=clang, instead of cc, for building in-tree
+# tools. This is based off of an email discussion and is thought to
+# be likely to cause less confusion than seeing 'cc' invocations
+# will when the user passes CC=clang.
+#
+# Sidebar: if we do this before the cc package is installed, it gets
+# reverted by that package. Ergo, the cc package init will tell the
+# user "Build C compiler...cc" shortly before we tell them:
+proc proj-redefine-cc-for-build {} {
+ if {![proj-is-cross-compiling]
+ && "nope" eq [get-env CC_FOR_BUILD "nope"]
+ && [get-define CC] ne [get-define CC_FOR_BUILD]} {
+ user-notice "Re-defining CC_FOR_BUILD to CC=[get-define CC]. To avoid this, explicitly pass CC_FOR_BUILD=..."
+ define CC_FOR_BUILD [get-define CC]
+ }
+}
diff --git a/ext/async/README.txt b/ext/async/README.txt
deleted file mode 100644
index f62fa2fc17..0000000000
--- a/ext/async/README.txt
+++ /dev/null
@@ -1,170 +0,0 @@
-NOTE (2012-11-29):
-
-The functionality implemented by this extension has been superseded
-by WAL-mode. This module is no longer supported or maintained. The
-code is retained for historical reference only.
-
-------------------------------------------------------------------------------
-
-Normally, when SQLite writes to a database file, it waits until the write
-operation is finished before returning control to the calling application.
-Since writing to the file-system is usually very slow compared with CPU
-bound operations, this can be a performance bottleneck. This directory
-contains an extension that causes SQLite to perform all write requests
-using a separate thread running in the background. Although this does not
-reduce the overall system resources (CPU, disk bandwidth etc.) at all, it
-allows SQLite to return control to the caller quickly even when writing to
-the database, eliminating the bottleneck.
-
- 1. Functionality
-
- 1.1 How it Works
- 1.2 Limitations
- 1.3 Locking and Concurrency
-
- 2. Compilation and Usage
-
- 3. Porting
-
-
-
-1. FUNCTIONALITY
-
- With asynchronous I/O, write requests are handled by a separate thread
- running in the background. This means that the thread that initiates
- a database write does not have to wait for (sometimes slow) disk I/O
- to occur. The write seems to happen very quickly, though in reality
- it is happening at its usual slow pace in the background.
-
- Asynchronous I/O appears to give better responsiveness, but at a price.
- You lose the Durable property. With the default I/O backend of SQLite,
- once a write completes, you know that the information you wrote is
- safely on disk. With the asynchronous I/O, this is not the case. If
- your program crashes or if a power loss occurs after the database
- write but before the asynchronous write thread has completed, then the
- database change might never make it to disk and the next user of the
- database might not see your change.
-
- You lose Durability with asynchronous I/O, but you still retain the
- other parts of ACID: Atomic, Consistent, and Isolated. Many
- appliations get along fine without the Durablity.
-
- 1.1 How it Works
-
- Asynchronous I/O works by creating a special SQLite "vfs" structure
- and registering it with sqlite3_vfs_register(). When files opened via
- this vfs are written to (using the vfs xWrite() method), the data is not
- written directly to disk, but is placed in the "write-queue" to be
- handled by the background thread.
-
- When files opened with the asynchronous vfs are read from
- (using the vfs xRead() method), the data is read from the file on
- disk and the write-queue, so that from the point of view of
- the vfs reader the xWrite() appears to have already completed.
-
- The special vfs is registered (and unregistered) by calls to the
- API functions sqlite3async_initialize() and sqlite3async_shutdown().
- See section "Compilation and Usage" below for details.
-
- 1.2 Limitations
-
- In order to gain experience with the main ideas surrounding asynchronous
- IO, this implementation is deliberately kept simple. Additional
- capabilities may be added in the future.
-
- For example, as currently implemented, if writes are happening at a
- steady stream that exceeds the I/O capability of the background writer
- thread, the queue of pending write operations will grow without bound.
- If this goes on for long enough, the host system could run out of memory.
- A more sophisticated module could to keep track of the quantity of
- pending writes and stop accepting new write requests when the queue of
- pending writes grows too large.
-
- 1.3 Locking and Concurrency
-
- Multiple connections from within a single process that use this
- implementation of asynchronous IO may access a single database
- file concurrently. From the point of view of the user, if all
- connections are from within a single process, there is no difference
- between the concurrency offered by "normal" SQLite and SQLite
- using the asynchronous backend.
-
- If file-locking is enabled (it is enabled by default), then connections
- from multiple processes may also read and write the database file.
- However concurrency is reduced as follows:
-
- * When a connection using asynchronous IO begins a database
- transaction, the database is locked immediately. However the
- lock is not released until after all relevant operations
- in the write-queue have been flushed to disk. This means
- (for example) that the database may remain locked for some
- time after a "COMMIT" or "ROLLBACK" is issued.
-
- * If an application using asynchronous IO executes transactions
- in quick succession, other database users may be effectively
- locked out of the database. This is because when a BEGIN
- is executed, a database lock is established immediately. But
- when the corresponding COMMIT or ROLLBACK occurs, the lock
- is not released until the relevant part of the write-queue
- has been flushed through. As a result, if a COMMIT is followed
- by a BEGIN before the write-queue is flushed through, the database
- is never unlocked,preventing other processes from accessing
- the database.
-
- File-locking may be disabled at runtime using the sqlite3async_control()
- API (see below). This may improve performance when an NFS or other
- network file-system, as the synchronous round-trips to the server be
- required to establish file locks are avoided. However, if multiple
- connections attempt to access the same database file when file-locking
- is disabled, application crashes and database corruption is a likely
- outcome.
-
-
-2. COMPILATION AND USAGE
-
- The asynchronous IO extension consists of a single file of C code
- (sqlite3async.c), and a header file (sqlite3async.h) that defines the
- C API used by applications to activate and control the modules
- functionality.
-
- To use the asynchronous IO extension, compile sqlite3async.c as
- part of the application that uses SQLite. Then use the API defined
- in sqlite3async.h to initialize and configure the module.
-
- The asynchronous IO VFS API is described in detail in comments in
- sqlite3async.h. Using the API usually consists of the following steps:
-
- 1. Register the asynchronous IO VFS with SQLite by calling the
- sqlite3async_initialize() function.
-
- 2. Create a background thread to perform write operations and call
- sqlite3async_run().
-
- 3. Use the normal SQLite API to read and write to databases via
- the asynchronous IO VFS.
-
- Refer to sqlite3async.h for details.
-
-
-3. PORTING
-
- Currently the asynchronous IO extension is compatible with win32 systems
- and systems that support the pthreads interface, including Mac OSX, Linux,
- and other varieties of Unix.
-
- To port the asynchronous IO extension to another platform, the user must
- implement mutex and condition variable primitives for the new platform.
- Currently there is no externally available interface to allow this, but
- modifying the code within sqlite3async.c to include the new platforms
- concurrency primitives is relatively easy. Search within sqlite3async.c
- for the comment string "PORTING FUNCTIONS" for details. Then implement
- new versions of each of the following:
-
- static void async_mutex_enter(int eMutex);
- static void async_mutex_leave(int eMutex);
- static void async_cond_wait(int eCond, int eMutex);
- static void async_cond_signal(int eCond);
- static void async_sched_yield(void);
-
- The functionality required of each of the above functions is described
- in comments in sqlite3async.c.
diff --git a/ext/async/sqlite3async.c b/ext/async/sqlite3async.c
deleted file mode 100644
index eed7c8d738..0000000000
--- a/ext/async/sqlite3async.c
+++ /dev/null
@@ -1,1706 +0,0 @@
-/*
-** 2005 December 14
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-*************************************************************************
-**
-** $Id: sqlite3async.c,v 1.7 2009/07/18 11:52:04 danielk1977 Exp $
-**
-** This file contains the implementation of an asynchronous IO backend
-** for SQLite.
-*/
-
-#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ASYNCIO)
-
-#include "sqlite3async.h"
-#include "sqlite3.h"
-#include
-#include
-#include
-
-/* Useful macros used in several places */
-#define MIN(x,y) ((x)<(y)?(x):(y))
-#define MAX(x,y) ((x)>(y)?(x):(y))
-
-#ifndef SQLITE_AMALGAMATION
-/* Macro to mark parameters as unused and silence compiler warnings. */
-#define UNUSED_PARAMETER(x) (void)(x)
-#endif
-
-/* Forward references */
-typedef struct AsyncWrite AsyncWrite;
-typedef struct AsyncFile AsyncFile;
-typedef struct AsyncFileData AsyncFileData;
-typedef struct AsyncFileLock AsyncFileLock;
-typedef struct AsyncLock AsyncLock;
-
-/* Enable for debugging */
-#ifndef NDEBUG
-#include
-static int sqlite3async_trace = 0;
-# define ASYNC_TRACE(X) if( sqlite3async_trace ) asyncTrace X
-static void asyncTrace(const char *zFormat, ...){
- char *z;
- va_list ap;
- va_start(ap, zFormat);
- z = sqlite3_vmprintf(zFormat, ap);
- va_end(ap);
- fprintf(stderr, "[%d] %s", 0 /* (int)pthread_self() */, z);
- sqlite3_free(z);
-}
-#else
-# define ASYNC_TRACE(X)
-#endif
-
-/*
-** THREAD SAFETY NOTES
-**
-** Basic rules:
-**
-** * Both read and write access to the global write-op queue must be
-** protected by the async.queueMutex. As are the async.ioError and
-** async.nFile variables.
-**
-** * The async.pLock list and all AsyncLock and AsyncFileLock
-** structures must be protected by the async.lockMutex mutex.
-**
-** * The file handles from the underlying system are not assumed to
-** be thread safe.
-**
-** * See the last two paragraphs under "The Writer Thread" for
-** an assumption to do with file-handle synchronization by the Os.
-**
-** Deadlock prevention:
-**
-** There are three mutex used by the system: the "writer" mutex,
-** the "queue" mutex and the "lock" mutex. Rules are:
-**
-** * It is illegal to block on the writer mutex when any other mutex
-** are held, and
-**
-** * It is illegal to block on the queue mutex when the lock mutex
-** is held.
-**
-** i.e. mutex's must be grabbed in the order "writer", "queue", "lock".
-**
-** File system operations (invoked by SQLite thread):
-**
-** xOpen
-** xDelete
-** xFileExists
-**
-** File handle operations (invoked by SQLite thread):
-**
-** asyncWrite, asyncClose, asyncTruncate, asyncSync
-**
-** The operations above add an entry to the global write-op list. They
-** prepare the entry, acquire the async.queueMutex momentarily while
-** list pointers are manipulated to insert the new entry, then release
-** the mutex and signal the writer thread to wake up in case it happens
-** to be asleep.
-**
-**
-** asyncRead, asyncFileSize.
-**
-** Read operations. Both of these read from both the underlying file
-** first then adjust their result based on pending writes in the
-** write-op queue. So async.queueMutex is held for the duration
-** of these operations to prevent other threads from changing the
-** queue in mid operation.
-**
-**
-** asyncLock, asyncUnlock, asyncCheckReservedLock
-**
-** These primitives implement in-process locking using a hash table
-** on the file name. Files are locked correctly for connections coming
-** from the same process. But other processes cannot see these locks
-** and will therefore not honor them.
-**
-**
-** The writer thread:
-**
-** The async.writerMutex is used to make sure only there is only
-** a single writer thread running at a time.
-**
-** Inside the writer thread is a loop that works like this:
-**
-** WHILE (write-op list is not empty)
-** Do IO operation at head of write-op list
-** Remove entry from head of write-op list
-** END WHILE
-**
-** The async.queueMutex is always held during the test, and when the entry is removed from the head
-** of the write-op list. Sometimes it is held for the interim
-** period (while the IO is performed), and sometimes it is
-** relinquished. It is relinquished if (a) the IO op is an
-** ASYNC_CLOSE or (b) when the file handle was opened, two of
-** the underlying systems handles were opened on the same
-** file-system entry.
-**
-** If condition (b) above is true, then one file-handle
-** (AsyncFile.pBaseRead) is used exclusively by sqlite threads to read the
-** file, the other (AsyncFile.pBaseWrite) by sqlite3_async_flush()
-** threads to perform write() operations. This means that read
-** operations are not blocked by asynchronous writes (although
-** asynchronous writes may still be blocked by reads).
-**
-** This assumes that the OS keeps two handles open on the same file
-** properly in sync. That is, any read operation that starts after a
-** write operation on the same file system entry has completed returns
-** data consistent with the write. We also assume that if one thread
-** reads a file while another is writing it all bytes other than the
-** ones actually being written contain valid data.
-**
-** If the above assumptions are not true, set the preprocessor symbol
-** SQLITE_ASYNC_TWO_FILEHANDLES to 0.
-*/
-
-
-#ifndef NDEBUG
-# define TESTONLY( X ) X
-#else
-# define TESTONLY( X )
-#endif
-
-/*
-** PORTING FUNCTIONS
-**
-** There are two definitions of the following functions. One for pthreads
-** compatible systems and one for Win32. These functions isolate the OS
-** specific code required by each platform.
-**
-** The system uses three mutexes and a single condition variable. To
-** block on a mutex, async_mutex_enter() is called. The parameter passed
-** to async_mutex_enter(), which must be one of ASYNC_MUTEX_LOCK,
-** ASYNC_MUTEX_QUEUE or ASYNC_MUTEX_WRITER, identifies which of the three
-** mutexes to lock. Similarly, to unlock a mutex, async_mutex_leave() is
-** called with a parameter identifying the mutex being unlocked. Mutexes
-** are not recursive - it is an error to call async_mutex_enter() to
-** lock a mutex that is already locked, or to call async_mutex_leave()
-** to unlock a mutex that is not currently locked.
-**
-** The async_cond_wait() and async_cond_signal() functions are modelled
-** on the pthreads functions with similar names. The first parameter to
-** both functions is always ASYNC_COND_QUEUE. When async_cond_wait()
-** is called the mutex identified by the second parameter must be held.
-** The mutex is unlocked, and the calling thread simultaneously begins
-** waiting for the condition variable to be signalled by another thread.
-** After another thread signals the condition variable, the calling
-** thread stops waiting, locks mutex eMutex and returns. The
-** async_cond_signal() function is used to signal the condition variable.
-** It is assumed that the mutex used by the thread calling async_cond_wait()
-** is held by the caller of async_cond_signal() (otherwise there would be
-** a race condition).
-**
-** It is guaranteed that no other thread will call async_cond_wait() when
-** there is already a thread waiting on the condition variable.
-**
-** The async_sched_yield() function is called to suggest to the operating
-** system that it would be a good time to shift the current thread off the
-** CPU. The system will still work if this function is not implemented
-** (it is not currently implemented for win32), but it might be marginally
-** more efficient if it is.
-*/
-static void async_mutex_enter(int eMutex);
-static void async_mutex_leave(int eMutex);
-static void async_cond_wait(int eCond, int eMutex);
-static void async_cond_signal(int eCond);
-static void async_sched_yield(void);
-
-/*
-** There are also two definitions of the following. async_os_initialize()
-** is called when the asynchronous VFS is first installed, and os_shutdown()
-** is called when it is uninstalled (from within sqlite3async_shutdown()).
-**
-** For pthreads builds, both of these functions are no-ops. For win32,
-** they provide an opportunity to initialize and finalize the required
-** mutex and condition variables.
-**
-** If async_os_initialize() returns other than zero, then the initialization
-** fails and SQLITE_ERROR is returned to the user.
-*/
-static int async_os_initialize(void);
-static void async_os_shutdown(void);
-
-/* Values for use as the 'eMutex' argument of the above functions. The
-** integer values assigned to these constants are important for assert()
-** statements that verify that mutexes are locked in the correct order.
-** Specifically, it is unsafe to try to lock mutex N while holding a lock
-** on mutex M if (M<=N).
-*/
-#define ASYNC_MUTEX_LOCK 0
-#define ASYNC_MUTEX_QUEUE 1
-#define ASYNC_MUTEX_WRITER 2
-
-/* Values for use as the 'eCond' argument of the above functions. */
-#define ASYNC_COND_QUEUE 0
-
-/*************************************************************************
-** Start of OS specific code.
-*/
-#if SQLITE_OS_WIN || defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
-
-#include
-
-/* The following block contains the win32 specific code. */
-
-#define mutex_held(X) (GetCurrentThreadId()==primitives.aHolder[X])
-
-static struct AsyncPrimitives {
- int isInit;
- DWORD aHolder[3];
- CRITICAL_SECTION aMutex[3];
- HANDLE aCond[1];
-} primitives = { 0 };
-
-static int async_os_initialize(void){
- if( !primitives.isInit ){
- primitives.aCond[0] = CreateEvent(NULL, TRUE, FALSE, 0);
- if( primitives.aCond[0]==NULL ){
- return 1;
- }
- InitializeCriticalSection(&primitives.aMutex[0]);
- InitializeCriticalSection(&primitives.aMutex[1]);
- InitializeCriticalSection(&primitives.aMutex[2]);
- primitives.isInit = 1;
- }
- return 0;
-}
-static void async_os_shutdown(void){
- if( primitives.isInit ){
- DeleteCriticalSection(&primitives.aMutex[0]);
- DeleteCriticalSection(&primitives.aMutex[1]);
- DeleteCriticalSection(&primitives.aMutex[2]);
- CloseHandle(primitives.aCond[0]);
- primitives.isInit = 0;
- }
-}
-
-/* The following block contains the Win32 specific code. */
-static void async_mutex_enter(int eMutex){
- assert( eMutex==0 || eMutex==1 || eMutex==2 );
- assert( eMutex!=2 || (!mutex_held(0) && !mutex_held(1) && !mutex_held(2)) );
- assert( eMutex!=1 || (!mutex_held(0) && !mutex_held(1)) );
- assert( eMutex!=0 || (!mutex_held(0)) );
- EnterCriticalSection(&primitives.aMutex[eMutex]);
- TESTONLY( primitives.aHolder[eMutex] = GetCurrentThreadId(); )
-}
-static void async_mutex_leave(int eMutex){
- assert( eMutex==0 || eMutex==1 || eMutex==2 );
- assert( mutex_held(eMutex) );
- TESTONLY( primitives.aHolder[eMutex] = 0; )
- LeaveCriticalSection(&primitives.aMutex[eMutex]);
-}
-static void async_cond_wait(int eCond, int eMutex){
- ResetEvent(primitives.aCond[eCond]);
- async_mutex_leave(eMutex);
- WaitForSingleObject(primitives.aCond[eCond], INFINITE);
- async_mutex_enter(eMutex);
-}
-static void async_cond_signal(int eCond){
- assert( mutex_held(ASYNC_MUTEX_QUEUE) );
- SetEvent(primitives.aCond[eCond]);
-}
-static void async_sched_yield(void){
- Sleep(0);
-}
-#else
-
-/* The following block contains the pthreads specific code. */
-#include
-#include
-
-#define mutex_held(X) pthread_equal(primitives.aHolder[X], pthread_self())
-
-static int async_os_initialize(void) {return 0;}
-static void async_os_shutdown(void) {}
-
-static struct AsyncPrimitives {
- pthread_mutex_t aMutex[3];
- pthread_cond_t aCond[1];
- pthread_t aHolder[3];
-} primitives = {
- { PTHREAD_MUTEX_INITIALIZER,
- PTHREAD_MUTEX_INITIALIZER,
- PTHREAD_MUTEX_INITIALIZER
- } , {
- PTHREAD_COND_INITIALIZER
- } , { 0, 0, 0 }
-};
-
-static void async_mutex_enter(int eMutex){
- assert( eMutex==0 || eMutex==1 || eMutex==2 );
- assert( eMutex!=2 || (!mutex_held(0) && !mutex_held(1) && !mutex_held(2)) );
- assert( eMutex!=1 || (!mutex_held(0) && !mutex_held(1)) );
- assert( eMutex!=0 || (!mutex_held(0)) );
- pthread_mutex_lock(&primitives.aMutex[eMutex]);
- TESTONLY( primitives.aHolder[eMutex] = pthread_self(); )
-}
-static void async_mutex_leave(int eMutex){
- assert( eMutex==0 || eMutex==1 || eMutex==2 );
- assert( mutex_held(eMutex) );
- TESTONLY( primitives.aHolder[eMutex] = 0; )
- pthread_mutex_unlock(&primitives.aMutex[eMutex]);
-}
-static void async_cond_wait(int eCond, int eMutex){
- assert( eMutex==0 || eMutex==1 || eMutex==2 );
- assert( mutex_held(eMutex) );
- TESTONLY( primitives.aHolder[eMutex] = 0; )
- pthread_cond_wait(&primitives.aCond[eCond], &primitives.aMutex[eMutex]);
- TESTONLY( primitives.aHolder[eMutex] = pthread_self(); )
-}
-static void async_cond_signal(int eCond){
- assert( mutex_held(ASYNC_MUTEX_QUEUE) );
- pthread_cond_signal(&primitives.aCond[eCond]);
-}
-static void async_sched_yield(void){
- sched_yield();
-}
-#endif
-/*
-** End of OS specific code.
-*************************************************************************/
-
-#define assert_mutex_is_held(X) assert( mutex_held(X) )
-
-
-#ifndef SQLITE_ASYNC_TWO_FILEHANDLES
-/* #define SQLITE_ASYNC_TWO_FILEHANDLES 0 */
-#define SQLITE_ASYNC_TWO_FILEHANDLES 1
-#endif
-
-/*
-** State information is held in the static variable "async" defined
-** as the following structure.
-**
-** Both async.ioError and async.nFile are protected by async.queueMutex.
-*/
-static struct TestAsyncStaticData {
- AsyncWrite *pQueueFirst; /* Next write operation to be processed */
- AsyncWrite *pQueueLast; /* Last write operation on the list */
- AsyncLock *pLock; /* Linked list of all AsyncLock structures */
- volatile int ioDelay; /* Extra delay between write operations */
- volatile int eHalt; /* One of the SQLITEASYNC_HALT_XXX values */
- volatile int bLockFiles; /* Current value of "lockfiles" parameter */
- int ioError; /* True if an IO error has occurred */
- int nFile; /* Number of open files (from sqlite pov) */
-} async = { 0,0,0,0,0,1,0,0 };
-
-/* Possible values of AsyncWrite.op */
-#define ASYNC_NOOP 0
-#define ASYNC_WRITE 1
-#define ASYNC_SYNC 2
-#define ASYNC_TRUNCATE 3
-#define ASYNC_CLOSE 4
-#define ASYNC_DELETE 5
-#define ASYNC_OPENEXCLUSIVE 6
-#define ASYNC_UNLOCK 7
-
-/* Names of opcodes. Used for debugging only.
-** Make sure these stay in sync with the macros above!
-*/
-static const char *azOpcodeName[] = {
- "NOOP", "WRITE", "SYNC", "TRUNCATE", "CLOSE", "DELETE", "OPENEX", "UNLOCK"
-};
-
-/*
-** Entries on the write-op queue are instances of the AsyncWrite
-** structure, defined here.
-**
-** The interpretation of the iOffset and nByte variables varies depending
-** on the value of AsyncWrite.op:
-**
-** ASYNC_NOOP:
-** No values used.
-**
-** ASYNC_WRITE:
-** iOffset -> Offset in file to write to.
-** nByte -> Number of bytes of data to write (pointed to by zBuf).
-**
-** ASYNC_SYNC:
-** nByte -> flags to pass to sqlite3OsSync().
-**
-** ASYNC_TRUNCATE:
-** iOffset -> Size to truncate file to.
-** nByte -> Unused.
-**
-** ASYNC_CLOSE:
-** iOffset -> Unused.
-** nByte -> Unused.
-**
-** ASYNC_DELETE:
-** iOffset -> Contains the "syncDir" flag.
-** nByte -> Number of bytes of zBuf points to (file name).
-**
-** ASYNC_OPENEXCLUSIVE:
-** iOffset -> Value of "delflag".
-** nByte -> Number of bytes of zBuf points to (file name).
-**
-** ASYNC_UNLOCK:
-** nByte -> Argument to sqlite3OsUnlock().
-**
-**
-** For an ASYNC_WRITE operation, zBuf points to the data to write to the file.
-** This space is sqlite3_malloc()d along with the AsyncWrite structure in a
-** single blob, so is deleted when sqlite3_free() is called on the parent
-** structure.
-*/
-struct AsyncWrite {
- AsyncFileData *pFileData; /* File to write data to or sync */
- int op; /* One of ASYNC_xxx etc. */
- sqlite_int64 iOffset; /* See above */
- int nByte; /* See above */
- char *zBuf; /* Data to write to file (or NULL if op!=ASYNC_WRITE) */
- AsyncWrite *pNext; /* Next write operation (to any file) */
-};
-
-/*
-** An instance of this structure is created for each distinct open file
-** (i.e. if two handles are opened on the one file, only one of these
-** structures is allocated) and stored in the async.aLock hash table. The
-** keys for async.aLock are the full pathnames of the opened files.
-**
-** AsyncLock.pList points to the head of a linked list of AsyncFileLock
-** structures, one for each handle currently open on the file.
-**
-** If the opened file is not a main-database (the SQLITE_OPEN_MAIN_DB is
-** not passed to the sqlite3OsOpen() call), or if async.bLockFiles is
-** false, variables AsyncLock.pFile and AsyncLock.eLock are never used.
-** Otherwise, pFile is a file handle opened on the file in question and
-** used to obtain the file-system locks required by database connections
-** within this process.
-**
-** See comments above the asyncLock() function for more details on
-** the implementation of database locking used by this backend.
-*/
-struct AsyncLock {
- char *zFile;
- int nFile;
- sqlite3_file *pFile;
- int eLock;
- AsyncFileLock *pList;
- AsyncLock *pNext; /* Next in linked list headed by async.pLock */
-};
-
-/*
-** An instance of the following structure is allocated along with each
-** AsyncFileData structure (see AsyncFileData.lock), but is only used if the
-** file was opened with the SQLITE_OPEN_MAIN_DB.
-*/
-struct AsyncFileLock {
- int eLock; /* Internally visible lock state (sqlite pov) */
- int eAsyncLock; /* Lock-state with write-queue unlock */
- AsyncFileLock *pNext;
-};
-
-/*
-** The AsyncFile structure is a subclass of sqlite3_file used for
-** asynchronous IO.
-**
-** All of the actual data for the structure is stored in the structure
-** pointed to by AsyncFile.pData, which is allocated as part of the
-** sqlite3OsOpen() using sqlite3_malloc(). The reason for this is that the
-** lifetime of the AsyncFile structure is ended by the caller after OsClose()
-** is called, but the data in AsyncFileData may be required by the
-** writer thread after that point.
-*/
-struct AsyncFile {
- sqlite3_io_methods *pMethod;
- AsyncFileData *pData;
-};
-struct AsyncFileData {
- char *zName; /* Underlying OS filename - used for debugging */
- int nName; /* Number of characters in zName */
- sqlite3_file *pBaseRead; /* Read handle to the underlying Os file */
- sqlite3_file *pBaseWrite; /* Write handle to the underlying Os file */
- AsyncFileLock lock; /* Lock state for this handle */
- AsyncLock *pLock; /* AsyncLock object for this file system entry */
- AsyncWrite closeOp; /* Preallocated close operation */
-};
-
-/*
-** Add an entry to the end of the global write-op list. pWrite should point
-** to an AsyncWrite structure allocated using sqlite3_malloc(). The writer
-** thread will call sqlite3_free() to free the structure after the specified
-** operation has been completed.
-**
-** Once an AsyncWrite structure has been added to the list, it becomes the
-** property of the writer thread and must not be read or modified by the
-** caller.
-*/
-static void addAsyncWrite(AsyncWrite *pWrite){
- /* We must hold the queue mutex in order to modify the queue pointers */
- if( pWrite->op!=ASYNC_UNLOCK ){
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- }
-
- /* Add the record to the end of the write-op queue */
- assert( !pWrite->pNext );
- if( async.pQueueLast ){
- assert( async.pQueueFirst );
- async.pQueueLast->pNext = pWrite;
- }else{
- async.pQueueFirst = pWrite;
- }
- async.pQueueLast = pWrite;
- ASYNC_TRACE(("PUSH %p (%s %s %d)\n", pWrite, azOpcodeName[pWrite->op],
- pWrite->pFileData ? pWrite->pFileData->zName : "-", pWrite->iOffset));
-
- if( pWrite->op==ASYNC_CLOSE ){
- async.nFile--;
- }
-
- /* The writer thread might have been idle because there was nothing
- ** on the write-op queue for it to do. So wake it up. */
- async_cond_signal(ASYNC_COND_QUEUE);
-
- /* Drop the queue mutex */
- if( pWrite->op!=ASYNC_UNLOCK ){
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- }
-}
-
-/*
-** Increment async.nFile in a thread-safe manner.
-*/
-static void incrOpenFileCount(void){
- /* We must hold the queue mutex in order to modify async.nFile */
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- if( async.nFile==0 ){
- async.ioError = SQLITE_OK;
- }
- async.nFile++;
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
-}
-
-/*
-** This is a utility function to allocate and populate a new AsyncWrite
-** structure and insert it (via addAsyncWrite() ) into the global list.
-*/
-static int addNewAsyncWrite(
- AsyncFileData *pFileData,
- int op,
- sqlite3_int64 iOffset,
- int nByte,
- const char *zByte
-){
- AsyncWrite *p;
- if( op!=ASYNC_CLOSE && async.ioError ){
- return async.ioError;
- }
- p = sqlite3_malloc(sizeof(AsyncWrite) + (zByte?nByte:0));
- if( !p ){
- /* The upper layer does not expect operations like OsWrite() to
- ** return SQLITE_NOMEM. This is partly because under normal conditions
- ** SQLite is required to do rollback without calling malloc(). So
- ** if malloc() fails here, treat it as an I/O error. The above
- ** layer knows how to handle that.
- */
- return SQLITE_IOERR;
- }
- p->op = op;
- p->iOffset = iOffset;
- p->nByte = nByte;
- p->pFileData = pFileData;
- p->pNext = 0;
- if( zByte ){
- p->zBuf = (char *)&p[1];
- memcpy(p->zBuf, zByte, nByte);
- }else{
- p->zBuf = 0;
- }
- addAsyncWrite(p);
- return SQLITE_OK;
-}
-
-/*
-** Close the file. This just adds an entry to the write-op list, the file is
-** not actually closed.
-*/
-static int asyncClose(sqlite3_file *pFile){
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
-
- /* Unlock the file, if it is locked */
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- p->lock.eLock = 0;
- async_mutex_leave(ASYNC_MUTEX_LOCK);
-
- addAsyncWrite(&p->closeOp);
- return SQLITE_OK;
-}
-
-/*
-** Implementation of sqlite3OsWrite() for asynchronous files. Instead of
-** writing to the underlying file, this function adds an entry to the end of
-** the global AsyncWrite list. Either SQLITE_OK or SQLITE_NOMEM may be
-** returned.
-*/
-static int asyncWrite(
- sqlite3_file *pFile,
- const void *pBuf,
- int amt,
- sqlite3_int64 iOff
-){
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
- return addNewAsyncWrite(p, ASYNC_WRITE, iOff, amt, pBuf);
-}
-
-/*
-** Read data from the file. First we read from the filesystem, then adjust
-** the contents of the buffer based on ASYNC_WRITE operations in the
-** write-op queue.
-**
-** This method holds the mutex from start to finish.
-*/
-static int asyncRead(
- sqlite3_file *pFile,
- void *zOut,
- int iAmt,
- sqlite3_int64 iOffset
-){
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
- int rc = SQLITE_OK;
- sqlite3_int64 filesize = 0;
- sqlite3_file *pBase = p->pBaseRead;
- sqlite3_int64 iAmt64 = (sqlite3_int64)iAmt;
-
- /* Grab the write queue mutex for the duration of the call */
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
-
- /* If an I/O error has previously occurred in this virtual file
- ** system, then all subsequent operations fail.
- */
- if( async.ioError!=SQLITE_OK ){
- rc = async.ioError;
- goto asyncread_out;
- }
-
- if( pBase->pMethods ){
- sqlite3_int64 nRead;
- rc = pBase->pMethods->xFileSize(pBase, &filesize);
- if( rc!=SQLITE_OK ){
- goto asyncread_out;
- }
- nRead = MIN(filesize - iOffset, iAmt64);
- if( nRead>0 ){
- rc = pBase->pMethods->xRead(pBase, zOut, (int)nRead, iOffset);
- ASYNC_TRACE(("READ %s %d bytes at %d\n", p->zName, nRead, iOffset));
- }
- }
-
- if( rc==SQLITE_OK ){
- AsyncWrite *pWrite;
- char *zName = p->zName;
-
- for(pWrite=async.pQueueFirst; pWrite; pWrite = pWrite->pNext){
- if( pWrite->op==ASYNC_WRITE && (
- (pWrite->pFileData==p) ||
- (zName && pWrite->pFileData->zName==zName)
- )){
- sqlite3_int64 nCopy;
- sqlite3_int64 nByte64 = (sqlite3_int64)pWrite->nByte;
-
- /* Set variable iBeginIn to the offset in buffer pWrite->zBuf[] from
- ** which data should be copied. Set iBeginOut to the offset within
- ** the output buffer to which data should be copied. If either of
- ** these offsets is a negative number, set them to 0.
- */
- sqlite3_int64 iBeginOut = (pWrite->iOffset-iOffset);
- sqlite3_int64 iBeginIn = -iBeginOut;
- if( iBeginIn<0 ) iBeginIn = 0;
- if( iBeginOut<0 ) iBeginOut = 0;
-
- filesize = MAX(filesize, pWrite->iOffset+nByte64);
-
- nCopy = MIN(nByte64-iBeginIn, iAmt64-iBeginOut);
- if( nCopy>0 ){
- memcpy(&((char *)zOut)[iBeginOut], &pWrite->zBuf[iBeginIn], (size_t)nCopy);
- ASYNC_TRACE(("OVERREAD %d bytes at %d\n", nCopy, iBeginOut+iOffset));
- }
- }
- }
- }
-
-asyncread_out:
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- if( rc==SQLITE_OK && filesize<(iOffset+iAmt) ){
- rc = SQLITE_IOERR_SHORT_READ;
- }
- return rc;
-}
-
-/*
-** Truncate the file to nByte bytes in length. This just adds an entry to
-** the write-op list, no IO actually takes place.
-*/
-static int asyncTruncate(sqlite3_file *pFile, sqlite3_int64 nByte){
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
- return addNewAsyncWrite(p, ASYNC_TRUNCATE, nByte, 0, 0);
-}
-
-/*
-** Sync the file. This just adds an entry to the write-op list, the
-** sync() is done later by sqlite3_async_flush().
-*/
-static int asyncSync(sqlite3_file *pFile, int flags){
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
- return addNewAsyncWrite(p, ASYNC_SYNC, 0, flags, 0);
-}
-
-/*
-** Read the size of the file. First we read the size of the file system
-** entry, then adjust for any ASYNC_WRITE or ASYNC_TRUNCATE operations
-** currently in the write-op list.
-**
-** This method holds the mutex from start to finish.
-*/
-int asyncFileSize(sqlite3_file *pFile, sqlite3_int64 *piSize){
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
- int rc = SQLITE_OK;
- sqlite3_int64 s = 0;
- sqlite3_file *pBase;
-
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
-
- /* Read the filesystem size from the base file. If pMethods is NULL, this
- ** means the file hasn't been opened yet. In this case all relevant data
- ** must be in the write-op queue anyway, so we can omit reading from the
- ** file-system.
- */
- pBase = p->pBaseRead;
- if( pBase->pMethods ){
- rc = pBase->pMethods->xFileSize(pBase, &s);
- }
-
- if( rc==SQLITE_OK ){
- AsyncWrite *pWrite;
- for(pWrite=async.pQueueFirst; pWrite; pWrite = pWrite->pNext){
- if( pWrite->op==ASYNC_DELETE
- && p->zName
- && strcmp(p->zName, pWrite->zBuf)==0
- ){
- s = 0;
- }else if( pWrite->pFileData && (
- (pWrite->pFileData==p)
- || (p->zName && pWrite->pFileData->zName==p->zName)
- )){
- switch( pWrite->op ){
- case ASYNC_WRITE:
- s = MAX(pWrite->iOffset + (sqlite3_int64)(pWrite->nByte), s);
- break;
- case ASYNC_TRUNCATE:
- s = MIN(s, pWrite->iOffset);
- break;
- }
- }
- }
- *piSize = s;
- }
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- return rc;
-}
-
-/*
-** Lock or unlock the actual file-system entry.
-*/
-static int getFileLock(AsyncLock *pLock){
- int rc = SQLITE_OK;
- AsyncFileLock *pIter;
- int eRequired = 0;
-
- if( pLock->pFile ){
- for(pIter=pLock->pList; pIter; pIter=pIter->pNext){
- assert(pIter->eAsyncLock>=pIter->eLock);
- if( pIter->eAsyncLock>eRequired ){
- eRequired = pIter->eAsyncLock;
- assert(eRequired>=0 && eRequired<=SQLITE_LOCK_EXCLUSIVE);
- }
- }
-
- if( eRequired>pLock->eLock ){
- rc = pLock->pFile->pMethods->xLock(pLock->pFile, eRequired);
- if( rc==SQLITE_OK ){
- pLock->eLock = eRequired;
- }
- }
- else if( eRequiredeLock && eRequired<=SQLITE_LOCK_SHARED ){
- rc = pLock->pFile->pMethods->xUnlock(pLock->pFile, eRequired);
- if( rc==SQLITE_OK ){
- pLock->eLock = eRequired;
- }
- }
- }
-
- return rc;
-}
-
-/*
-** Return the AsyncLock structure from the global async.pLock list
-** associated with the file-system entry identified by path zName
-** (a string of nName bytes). If no such structure exists, return 0.
-*/
-static AsyncLock *findLock(const char *zName, int nName){
- AsyncLock *p = async.pLock;
- while( p && (p->nFile!=nName || memcmp(p->zFile, zName, nName)) ){
- p = p->pNext;
- }
- return p;
-}
-
-/*
-** The following two methods - asyncLock() and asyncUnlock() - are used
-** to obtain and release locks on database files opened with the
-** asynchronous backend.
-*/
-static int asyncLock(sqlite3_file *pFile, int eLock){
- int rc = SQLITE_OK;
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
-
- if( p->zName ){
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- if( p->lock.eLockpLock;
- AsyncFileLock *pIter;
- assert(pLock && pLock->pList);
- for(pIter=pLock->pList; pIter; pIter=pIter->pNext){
- if( pIter!=&p->lock && (
- (eLock==SQLITE_LOCK_EXCLUSIVE && pIter->eLock>=SQLITE_LOCK_SHARED) ||
- (eLock==SQLITE_LOCK_PENDING && pIter->eLock>=SQLITE_LOCK_RESERVED) ||
- (eLock==SQLITE_LOCK_RESERVED && pIter->eLock>=SQLITE_LOCK_RESERVED) ||
- (eLock==SQLITE_LOCK_SHARED && pIter->eLock>=SQLITE_LOCK_PENDING)
- )){
- rc = SQLITE_BUSY;
- }
- }
- if( rc==SQLITE_OK ){
- p->lock.eLock = eLock;
- p->lock.eAsyncLock = MAX(p->lock.eAsyncLock, eLock);
- }
- assert(p->lock.eAsyncLock>=p->lock.eLock);
- if( rc==SQLITE_OK ){
- rc = getFileLock(pLock);
- }
- }
- async_mutex_leave(ASYNC_MUTEX_LOCK);
- }
-
- ASYNC_TRACE(("LOCK %d (%s) rc=%d\n", eLock, p->zName, rc));
- return rc;
-}
-static int asyncUnlock(sqlite3_file *pFile, int eLock){
- int rc = SQLITE_OK;
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
- if( p->zName ){
- AsyncFileLock *pLock = &p->lock;
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- pLock->eLock = MIN(pLock->eLock, eLock);
- rc = addNewAsyncWrite(p, ASYNC_UNLOCK, 0, eLock, 0);
- async_mutex_leave(ASYNC_MUTEX_LOCK);
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- }
- return rc;
-}
-
-/*
-** This function is called when the pager layer first opens a database file
-** and is checking for a hot-journal.
-*/
-static int asyncCheckReservedLock(sqlite3_file *pFile, int *pResOut){
- int ret = 0;
- AsyncFileLock *pIter;
- AsyncFileData *p = ((AsyncFile *)pFile)->pData;
-
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- for(pIter=p->pLock->pList; pIter; pIter=pIter->pNext){
- if( pIter->eLock>=SQLITE_LOCK_RESERVED ){
- ret = 1;
- break;
- }
- }
- async_mutex_leave(ASYNC_MUTEX_LOCK);
-
- ASYNC_TRACE(("CHECK-LOCK %d (%s)\n", ret, p->zName));
- *pResOut = ret;
- return SQLITE_OK;
-}
-
-/*
-** sqlite3_file_control() implementation.
-*/
-static int asyncFileControl(sqlite3_file *id, int op, void *pArg){
- switch( op ){
- case SQLITE_FCNTL_LOCKSTATE: {
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- *(int*)pArg = ((AsyncFile*)id)->pData->lock.eLock;
- async_mutex_leave(ASYNC_MUTEX_LOCK);
- return SQLITE_OK;
- }
- }
- return SQLITE_NOTFOUND;
-}
-
-/*
-** Return the device characteristics and sector-size of the device. It
-** is tricky to implement these correctly, as this backend might
-** not have an open file handle at this point.
-*/
-static int asyncSectorSize(sqlite3_file *pFile){
- UNUSED_PARAMETER(pFile);
- return 512;
-}
-static int asyncDeviceCharacteristics(sqlite3_file *pFile){
- UNUSED_PARAMETER(pFile);
- return 0;
-}
-
-static int unlinkAsyncFile(AsyncFileData *pData){
- AsyncFileLock **ppIter;
- int rc = SQLITE_OK;
-
- if( pData->zName ){
- AsyncLock *pLock = pData->pLock;
- for(ppIter=&pLock->pList; *ppIter; ppIter=&((*ppIter)->pNext)){
- if( (*ppIter)==&pData->lock ){
- *ppIter = pData->lock.pNext;
- break;
- }
- }
- if( !pLock->pList ){
- AsyncLock **pp;
- if( pLock->pFile ){
- pLock->pFile->pMethods->xClose(pLock->pFile);
- }
- for(pp=&async.pLock; *pp!=pLock; pp=&((*pp)->pNext));
- *pp = pLock->pNext;
- sqlite3_free(pLock);
- }else{
- rc = getFileLock(pLock);
- }
- }
-
- return rc;
-}
-
-/*
-** The parameter passed to this function is a copy of a 'flags' parameter
-** passed to this modules xOpen() method. This function returns true
-** if the file should be opened asynchronously, or false if it should
-** be opened immediately.
-**
-** If the file is to be opened asynchronously, then asyncOpen() will add
-** an entry to the event queue and the file will not actually be opened
-** until the event is processed. Otherwise, the file is opened directly
-** by the caller.
-*/
-static int doAsynchronousOpen(int flags){
- return (flags&SQLITE_OPEN_CREATE) && (
- (flags&SQLITE_OPEN_MAIN_JOURNAL) ||
- (flags&SQLITE_OPEN_TEMP_JOURNAL) ||
- (flags&SQLITE_OPEN_DELETEONCLOSE)
- );
-}
-
-/*
-** Open a file.
-*/
-static int asyncOpen(
- sqlite3_vfs *pAsyncVfs,
- const char *zName,
- sqlite3_file *pFile,
- int flags,
- int *pOutFlags
-){
- static sqlite3_io_methods async_methods = {
- 1, /* iVersion */
- asyncClose, /* xClose */
- asyncRead, /* xRead */
- asyncWrite, /* xWrite */
- asyncTruncate, /* xTruncate */
- asyncSync, /* xSync */
- asyncFileSize, /* xFileSize */
- asyncLock, /* xLock */
- asyncUnlock, /* xUnlock */
- asyncCheckReservedLock, /* xCheckReservedLock */
- asyncFileControl, /* xFileControl */
- asyncSectorSize, /* xSectorSize */
- asyncDeviceCharacteristics /* xDeviceCharacteristics */
- };
-
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- AsyncFile *p = (AsyncFile *)pFile;
- int nName = 0;
- int rc = SQLITE_OK;
- int nByte;
- AsyncFileData *pData;
- AsyncLock *pLock = 0;
- char *z;
- int isAsyncOpen = doAsynchronousOpen(flags);
-
- /* If zName is NULL, then the upper layer is requesting an anonymous file.
- ** Otherwise, allocate enough space to make a copy of the file name (along
- ** with the second nul-terminator byte required by xOpen).
- */
- if( zName ){
- nName = (int)strlen(zName);
- }
-
- nByte = (
- sizeof(AsyncFileData) + /* AsyncFileData structure */
- 2 * pVfs->szOsFile + /* AsyncFileData.pBaseRead and pBaseWrite */
- nName + 2 /* AsyncFileData.zName */
- );
- z = sqlite3_malloc(nByte);
- if( !z ){
- return SQLITE_NOMEM;
- }
- memset(z, 0, nByte);
- pData = (AsyncFileData*)z;
- z += sizeof(pData[0]);
- pData->pBaseRead = (sqlite3_file*)z;
- z += pVfs->szOsFile;
- pData->pBaseWrite = (sqlite3_file*)z;
- pData->closeOp.pFileData = pData;
- pData->closeOp.op = ASYNC_CLOSE;
-
- if( zName ){
- z += pVfs->szOsFile;
- pData->zName = z;
- pData->nName = nName;
- memcpy(pData->zName, zName, nName);
- }
-
- if( !isAsyncOpen ){
- int flagsout;
- rc = pVfs->xOpen(pVfs, pData->zName, pData->pBaseRead, flags, &flagsout);
- if( rc==SQLITE_OK
- && (flagsout&SQLITE_OPEN_READWRITE)
- && (flags&SQLITE_OPEN_EXCLUSIVE)==0
- ){
- rc = pVfs->xOpen(pVfs, pData->zName, pData->pBaseWrite, flags, 0);
- }
- if( pOutFlags ){
- *pOutFlags = flagsout;
- }
- }
-
- async_mutex_enter(ASYNC_MUTEX_LOCK);
-
- if( zName && rc==SQLITE_OK ){
- pLock = findLock(pData->zName, pData->nName);
- if( !pLock ){
- int nByte = pVfs->szOsFile + sizeof(AsyncLock) + pData->nName + 1;
- pLock = (AsyncLock *)sqlite3_malloc(nByte);
- if( pLock ){
- memset(pLock, 0, nByte);
- if( async.bLockFiles && (flags&SQLITE_OPEN_MAIN_DB) ){
- pLock->pFile = (sqlite3_file *)&pLock[1];
- rc = pVfs->xOpen(pVfs, pData->zName, pLock->pFile, flags, 0);
- if( rc!=SQLITE_OK ){
- sqlite3_free(pLock);
- pLock = 0;
- }
- }
- if( pLock ){
- pLock->nFile = pData->nName;
- pLock->zFile = &((char *)(&pLock[1]))[pVfs->szOsFile];
- memcpy(pLock->zFile, pData->zName, pLock->nFile);
- pLock->pNext = async.pLock;
- async.pLock = pLock;
- }
- }else{
- rc = SQLITE_NOMEM;
- }
- }
- }
-
- if( rc==SQLITE_OK ){
- p->pMethod = &async_methods;
- p->pData = pData;
-
- /* Link AsyncFileData.lock into the linked list of
- ** AsyncFileLock structures for this file.
- */
- if( zName ){
- pData->lock.pNext = pLock->pList;
- pLock->pList = &pData->lock;
- pData->zName = pLock->zFile;
- }
- }else{
- if( pData->pBaseRead->pMethods ){
- pData->pBaseRead->pMethods->xClose(pData->pBaseRead);
- }
- if( pData->pBaseWrite->pMethods ){
- pData->pBaseWrite->pMethods->xClose(pData->pBaseWrite);
- }
- sqlite3_free(pData);
- }
-
- async_mutex_leave(ASYNC_MUTEX_LOCK);
-
- if( rc==SQLITE_OK ){
- pData->pLock = pLock;
- }
-
- if( rc==SQLITE_OK && isAsyncOpen ){
- rc = addNewAsyncWrite(pData, ASYNC_OPENEXCLUSIVE, (sqlite3_int64)flags,0,0);
- if( rc==SQLITE_OK ){
- if( pOutFlags ) *pOutFlags = flags;
- }else{
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- unlinkAsyncFile(pData);
- async_mutex_leave(ASYNC_MUTEX_LOCK);
- sqlite3_free(pData);
- }
- }
- if( rc!=SQLITE_OK ){
- p->pMethod = 0;
- }else{
- incrOpenFileCount();
- }
-
- return rc;
-}
-
-/*
-** Implementation of sqlite3OsDelete. Add an entry to the end of the
-** write-op queue to perform the delete.
-*/
-static int asyncDelete(sqlite3_vfs *pAsyncVfs, const char *z, int syncDir){
- UNUSED_PARAMETER(pAsyncVfs);
- return addNewAsyncWrite(0, ASYNC_DELETE, syncDir, (int)strlen(z)+1, z);
-}
-
-/*
-** Implementation of sqlite3OsAccess. This method holds the mutex from
-** start to finish.
-*/
-static int asyncAccess(
- sqlite3_vfs *pAsyncVfs,
- const char *zName,
- int flags,
- int *pResOut
-){
- int rc;
- int ret;
- AsyncWrite *p;
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
-
- assert(flags==SQLITE_ACCESS_READWRITE
- || flags==SQLITE_ACCESS_READ
- || flags==SQLITE_ACCESS_EXISTS
- );
-
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- rc = pVfs->xAccess(pVfs, zName, flags, &ret);
- if( rc==SQLITE_OK && flags==SQLITE_ACCESS_EXISTS ){
- for(p=async.pQueueFirst; p; p = p->pNext){
- if( p->op==ASYNC_DELETE && 0==strcmp(p->zBuf, zName) ){
- ret = 0;
- }else if( p->op==ASYNC_OPENEXCLUSIVE
- && p->pFileData->zName
- && 0==strcmp(p->pFileData->zName, zName)
- ){
- ret = 1;
- }
- }
- }
- ASYNC_TRACE(("ACCESS(%s): %s = %d\n",
- flags==SQLITE_ACCESS_READWRITE?"read-write":
- flags==SQLITE_ACCESS_READ?"read":"exists"
- , zName, ret)
- );
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- *pResOut = ret;
- return rc;
-}
-
-/*
-** Fill in zPathOut with the full path to the file identified by zPath.
-*/
-static int asyncFullPathname(
- sqlite3_vfs *pAsyncVfs,
- const char *zPath,
- int nPathOut,
- char *zPathOut
-){
- int rc;
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- rc = pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);
-
- /* Because of the way intra-process file locking works, this backend
- ** needs to return a canonical path. The following block assumes the
- ** file-system uses unix style paths.
- */
- if( rc==SQLITE_OK ){
- int i, j;
- char *z = zPathOut;
- int n = (int)strlen(z);
- while( n>1 && z[n-1]=='/' ){ n--; }
- for(i=j=0; i0 && z[j-1]!='/' ){ j--; }
- if( j>0 ){ j--; }
- i += 2;
- continue;
- }
- }
- z[j++] = z[i];
- }
- z[j] = 0;
- }
-
- return rc;
-}
-static void *asyncDlOpen(sqlite3_vfs *pAsyncVfs, const char *zPath){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- return pVfs->xDlOpen(pVfs, zPath);
-}
-static void asyncDlError(sqlite3_vfs *pAsyncVfs, int nByte, char *zErrMsg){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- pVfs->xDlError(pVfs, nByte, zErrMsg);
-}
-static void (*asyncDlSym(
- sqlite3_vfs *pAsyncVfs,
- void *pHandle,
- const char *zSymbol
-))(void){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- return pVfs->xDlSym(pVfs, pHandle, zSymbol);
-}
-static void asyncDlClose(sqlite3_vfs *pAsyncVfs, void *pHandle){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- pVfs->xDlClose(pVfs, pHandle);
-}
-static int asyncRandomness(sqlite3_vfs *pAsyncVfs, int nByte, char *zBufOut){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- return pVfs->xRandomness(pVfs, nByte, zBufOut);
-}
-static int asyncSleep(sqlite3_vfs *pAsyncVfs, int nMicro){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- return pVfs->xSleep(pVfs, nMicro);
-}
-static int asyncCurrentTime(sqlite3_vfs *pAsyncVfs, double *pTimeOut){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
- return pVfs->xCurrentTime(pVfs, pTimeOut);
-}
-
-static sqlite3_vfs async_vfs = {
- 1, /* iVersion */
- sizeof(AsyncFile), /* szOsFile */
- 0, /* mxPathname */
- 0, /* pNext */
- SQLITEASYNC_VFSNAME, /* zName */
- 0, /* pAppData */
- asyncOpen, /* xOpen */
- asyncDelete, /* xDelete */
- asyncAccess, /* xAccess */
- asyncFullPathname, /* xFullPathname */
- asyncDlOpen, /* xDlOpen */
- asyncDlError, /* xDlError */
- asyncDlSym, /* xDlSym */
- asyncDlClose, /* xDlClose */
- asyncRandomness, /* xDlError */
- asyncSleep, /* xDlSym */
- asyncCurrentTime /* xDlClose */
-};
-
-/*
-** This procedure runs in a separate thread, reading messages off of the
-** write queue and processing them one by one.
-**
-** If async.writerHaltNow is true, then this procedure exits
-** after processing a single message.
-**
-** If async.writerHaltWhenIdle is true, then this procedure exits when
-** the write queue is empty.
-**
-** If both of the above variables are false, this procedure runs
-** indefinately, waiting for operations to be added to the write queue
-** and processing them in the order in which they arrive.
-**
-** An artifical delay of async.ioDelay milliseconds is inserted before
-** each write operation in order to simulate the effect of a slow disk.
-**
-** Only one instance of this procedure may be running at a time.
-*/
-static void asyncWriterThread(void){
- sqlite3_vfs *pVfs = (sqlite3_vfs *)(async_vfs.pAppData);
- AsyncWrite *p = 0;
- int rc = SQLITE_OK;
- int holdingMutex = 0;
-
- async_mutex_enter(ASYNC_MUTEX_WRITER);
-
- while( async.eHalt!=SQLITEASYNC_HALT_NOW ){
- int doNotFree = 0;
- sqlite3_file *pBase = 0;
-
- if( !holdingMutex ){
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- }
- while( (p = async.pQueueFirst)==0 ){
- if( async.eHalt!=SQLITEASYNC_HALT_NEVER ){
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- break;
- }else{
- ASYNC_TRACE(("IDLE\n"));
- async_cond_wait(ASYNC_COND_QUEUE, ASYNC_MUTEX_QUEUE);
- ASYNC_TRACE(("WAKEUP\n"));
- }
- }
- if( p==0 ) break;
- holdingMutex = 1;
-
- /* Right now this thread is holding the mutex on the write-op queue.
- ** Variable 'p' points to the first entry in the write-op queue. In
- ** the general case, we hold on to the mutex for the entire body of
- ** the loop.
- **
- ** However in the cases enumerated below, we relinquish the mutex,
- ** perform the IO, and then re-request the mutex before removing 'p' from
- ** the head of the write-op queue. The idea is to increase concurrency with
- ** sqlite threads.
- **
- ** * An ASYNC_CLOSE operation.
- ** * An ASYNC_OPENEXCLUSIVE operation. For this one, we relinquish
- ** the mutex, call the underlying xOpenExclusive() function, then
- ** re-aquire the mutex before seting the AsyncFile.pBaseRead
- ** variable.
- ** * ASYNC_SYNC and ASYNC_WRITE operations, if
- ** SQLITE_ASYNC_TWO_FILEHANDLES was set at compile time and two
- ** file-handles are open for the particular file being "synced".
- */
- if( async.ioError!=SQLITE_OK && p->op!=ASYNC_CLOSE ){
- p->op = ASYNC_NOOP;
- }
- if( p->pFileData ){
- pBase = p->pFileData->pBaseWrite;
- if(
- p->op==ASYNC_CLOSE ||
- p->op==ASYNC_OPENEXCLUSIVE ||
- (pBase->pMethods && (p->op==ASYNC_SYNC || p->op==ASYNC_WRITE) )
- ){
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- holdingMutex = 0;
- }
- if( !pBase->pMethods ){
- pBase = p->pFileData->pBaseRead;
- }
- }
-
- switch( p->op ){
- case ASYNC_NOOP:
- break;
-
- case ASYNC_WRITE:
- assert( pBase );
- ASYNC_TRACE(("WRITE %s %d bytes at %d\n",
- p->pFileData->zName, p->nByte, p->iOffset));
- rc = pBase->pMethods->xWrite(pBase, (void *)(p->zBuf), p->nByte, p->iOffset);
- break;
-
- case ASYNC_SYNC:
- assert( pBase );
- ASYNC_TRACE(("SYNC %s\n", p->pFileData->zName));
- rc = pBase->pMethods->xSync(pBase, p->nByte);
- break;
-
- case ASYNC_TRUNCATE:
- assert( pBase );
- ASYNC_TRACE(("TRUNCATE %s to %d bytes\n",
- p->pFileData->zName, p->iOffset));
- rc = pBase->pMethods->xTruncate(pBase, p->iOffset);
- break;
-
- case ASYNC_CLOSE: {
- AsyncFileData *pData = p->pFileData;
- ASYNC_TRACE(("CLOSE %s\n", p->pFileData->zName));
- if( pData->pBaseWrite->pMethods ){
- pData->pBaseWrite->pMethods->xClose(pData->pBaseWrite);
- }
- if( pData->pBaseRead->pMethods ){
- pData->pBaseRead->pMethods->xClose(pData->pBaseRead);
- }
-
- /* Unlink AsyncFileData.lock from the linked list of AsyncFileLock
- ** structures for this file. Obtain the async.lockMutex mutex
- ** before doing so.
- */
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- rc = unlinkAsyncFile(pData);
- async_mutex_leave(ASYNC_MUTEX_LOCK);
-
- if( !holdingMutex ){
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- holdingMutex = 1;
- }
- assert_mutex_is_held(ASYNC_MUTEX_QUEUE);
- async.pQueueFirst = p->pNext;
- sqlite3_free(pData);
- doNotFree = 1;
- break;
- }
-
- case ASYNC_UNLOCK: {
- AsyncWrite *pIter;
- AsyncFileData *pData = p->pFileData;
- int eLock = p->nByte;
-
- /* When a file is locked by SQLite using the async backend, it is
- ** locked within the 'real' file-system synchronously. When it is
- ** unlocked, an ASYNC_UNLOCK event is added to the write-queue to
- ** unlock the file asynchronously. The design of the async backend
- ** requires that the 'real' file-system file be locked from the
- ** time that SQLite first locks it (and probably reads from it)
- ** until all asynchronous write events that were scheduled before
- ** SQLite unlocked the file have been processed.
- **
- ** This is more complex if SQLite locks and unlocks the file multiple
- ** times in quick succession. For example, if SQLite does:
- **
- ** lock, write, unlock, lock, write, unlock
- **
- ** Each "lock" operation locks the file immediately. Each "write"
- ** and "unlock" operation adds an event to the event queue. If the
- ** second "lock" operation is performed before the first "unlock"
- ** operation has been processed asynchronously, then the first
- ** "unlock" cannot be safely processed as is, since this would mean
- ** the file was unlocked when the second "write" operation is
- ** processed. To work around this, when processing an ASYNC_UNLOCK
- ** operation, SQLite:
- **
- ** 1) Unlocks the file to the minimum of the argument passed to
- ** the xUnlock() call and the current lock from SQLite's point
- ** of view, and
- **
- ** 2) Only unlocks the file at all if this event is the last
- ** ASYNC_UNLOCK event on this file in the write-queue.
- */
- assert( holdingMutex==1 );
- assert( async.pQueueFirst==p );
- for(pIter=async.pQueueFirst->pNext; pIter; pIter=pIter->pNext){
- if( pIter->pFileData==pData && pIter->op==ASYNC_UNLOCK ) break;
- }
- if( !pIter ){
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- pData->lock.eAsyncLock = MIN(
- pData->lock.eAsyncLock, MAX(pData->lock.eLock, eLock)
- );
- assert(pData->lock.eAsyncLock>=pData->lock.eLock);
- rc = getFileLock(pData->pLock);
- async_mutex_leave(ASYNC_MUTEX_LOCK);
- }
- break;
- }
-
- case ASYNC_DELETE:
- ASYNC_TRACE(("DELETE %s\n", p->zBuf));
- rc = pVfs->xDelete(pVfs, p->zBuf, (int)p->iOffset);
- if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK;
- break;
-
- case ASYNC_OPENEXCLUSIVE: {
- int flags = (int)p->iOffset;
- AsyncFileData *pData = p->pFileData;
- ASYNC_TRACE(("OPEN %s flags=%d\n", p->zBuf, (int)p->iOffset));
- assert(pData->pBaseRead->pMethods==0 && pData->pBaseWrite->pMethods==0);
- rc = pVfs->xOpen(pVfs, pData->zName, pData->pBaseRead, flags, 0);
- assert( holdingMutex==0 );
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- holdingMutex = 1;
- break;
- }
-
- default: assert(!"Illegal value for AsyncWrite.op");
- }
-
- /* If we didn't hang on to the mutex during the IO op, obtain it now
- ** so that the AsyncWrite structure can be safely removed from the
- ** global write-op queue.
- */
- if( !holdingMutex ){
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- holdingMutex = 1;
- }
- /* ASYNC_TRACE(("UNLINK %p\n", p)); */
- if( p==async.pQueueLast ){
- async.pQueueLast = 0;
- }
- if( !doNotFree ){
- assert_mutex_is_held(ASYNC_MUTEX_QUEUE);
- async.pQueueFirst = p->pNext;
- sqlite3_free(p);
- }
- assert( holdingMutex );
-
- /* An IO error has occurred. We cannot report the error back to the
- ** connection that requested the I/O since the error happened
- ** asynchronously. The connection has already moved on. There
- ** really is nobody to report the error to.
- **
- ** The file for which the error occurred may have been a database or
- ** journal file. Regardless, none of the currently queued operations
- ** associated with the same database should now be performed. Nor should
- ** any subsequently requested IO on either a database or journal file
- ** handle for the same database be accepted until the main database
- ** file handle has been closed and reopened.
- **
- ** Furthermore, no further IO should be queued or performed on any file
- ** handle associated with a database that may have been part of a
- ** multi-file transaction that included the database associated with
- ** the IO error (i.e. a database ATTACHed to the same handle at some
- ** point in time).
- */
- if( rc!=SQLITE_OK ){
- async.ioError = rc;
- }
-
- if( async.ioError && !async.pQueueFirst ){
- async_mutex_enter(ASYNC_MUTEX_LOCK);
- if( 0==async.pLock ){
- async.ioError = SQLITE_OK;
- }
- async_mutex_leave(ASYNC_MUTEX_LOCK);
- }
-
- /* Drop the queue mutex before continuing to the next write operation
- ** in order to give other threads a chance to work with the write queue.
- */
- if( !async.pQueueFirst || !async.ioError ){
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- holdingMutex = 0;
- if( async.ioDelay>0 ){
- pVfs->xSleep(pVfs, async.ioDelay*1000);
- }else{
- async_sched_yield();
- }
- }
- }
-
- async_mutex_leave(ASYNC_MUTEX_WRITER);
- return;
-}
-
-/*
-** Install the asynchronous VFS.
-*/
-int sqlite3async_initialize(const char *zParent, int isDefault){
- int rc = SQLITE_OK;
- if( async_vfs.pAppData==0 ){
- sqlite3_vfs *pParent = sqlite3_vfs_find(zParent);
- if( !pParent || async_os_initialize() ){
- rc = SQLITE_ERROR;
- }else if( SQLITE_OK!=(rc = sqlite3_vfs_register(&async_vfs, isDefault)) ){
- async_os_shutdown();
- }else{
- async_vfs.pAppData = (void *)pParent;
- async_vfs.mxPathname = ((sqlite3_vfs *)async_vfs.pAppData)->mxPathname;
- }
- }
- return rc;
-}
-
-/*
-** Uninstall the asynchronous VFS.
-*/
-void sqlite3async_shutdown(void){
- if( async_vfs.pAppData ){
- async_os_shutdown();
- sqlite3_vfs_unregister((sqlite3_vfs *)&async_vfs);
- async_vfs.pAppData = 0;
- }
-}
-
-/*
-** Process events on the write-queue.
-*/
-void sqlite3async_run(void){
- asyncWriterThread();
-}
-
-/*
-** Control/configure the asynchronous IO system.
-*/
-int sqlite3async_control(int op, ...){
- int rc = SQLITE_OK;
- va_list ap;
- va_start(ap, op);
- switch( op ){
- case SQLITEASYNC_HALT: {
- int eWhen = va_arg(ap, int);
- if( eWhen!=SQLITEASYNC_HALT_NEVER
- && eWhen!=SQLITEASYNC_HALT_NOW
- && eWhen!=SQLITEASYNC_HALT_IDLE
- ){
- rc = SQLITE_MISUSE;
- break;
- }
- async.eHalt = eWhen;
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- async_cond_signal(ASYNC_COND_QUEUE);
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- break;
- }
-
- case SQLITEASYNC_DELAY: {
- int iDelay = va_arg(ap, int);
- if( iDelay<0 ){
- rc = SQLITE_MISUSE;
- break;
- }
- async.ioDelay = iDelay;
- break;
- }
-
- case SQLITEASYNC_LOCKFILES: {
- int bLock = va_arg(ap, int);
- async_mutex_enter(ASYNC_MUTEX_QUEUE);
- if( async.nFile || async.pQueueFirst ){
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- rc = SQLITE_MISUSE;
- break;
- }
- async.bLockFiles = bLock;
- async_mutex_leave(ASYNC_MUTEX_QUEUE);
- break;
- }
-
- case SQLITEASYNC_GET_HALT: {
- int *peWhen = va_arg(ap, int *);
- *peWhen = async.eHalt;
- break;
- }
- case SQLITEASYNC_GET_DELAY: {
- int *piDelay = va_arg(ap, int *);
- *piDelay = async.ioDelay;
- break;
- }
- case SQLITEASYNC_GET_LOCKFILES: {
- int *piDelay = va_arg(ap, int *);
- *piDelay = async.bLockFiles;
- break;
- }
-
- default:
- rc = SQLITE_ERROR;
- break;
- }
- va_end(ap);
- return rc;
-}
-
-#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ASYNCIO) */
diff --git a/ext/async/sqlite3async.h b/ext/async/sqlite3async.h
deleted file mode 100644
index 13b23bc6a2..0000000000
--- a/ext/async/sqlite3async.h
+++ /dev/null
@@ -1,222 +0,0 @@
-
-#ifndef __SQLITEASYNC_H_
-#define __SQLITEASYNC_H_ 1
-
-/*
-** Make sure we can call this stuff from C++.
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SQLITEASYNC_VFSNAME "sqlite3async"
-
-/*
-** THREAD SAFETY NOTES:
-**
-** Of the four API functions in this file, the following are not threadsafe:
-**
-** sqlite3async_initialize()
-** sqlite3async_shutdown()
-**
-** Care must be taken that neither of these functions is called while
-** another thread may be calling either any sqlite3async_XXX() function
-** or an sqlite3_XXX() API function related to a database handle that
-** is using the asynchronous IO VFS.
-**
-** These functions:
-**
-** sqlite3async_run()
-** sqlite3async_control()
-**
-** are threadsafe. It is quite safe to call either of these functions even
-** if another thread may also be calling one of them or an sqlite3_XXX()
-** function related to a database handle that uses the asynchronous IO VFS.
-*/
-
-/*
-** Initialize the asynchronous IO VFS and register it with SQLite using
-** sqlite3_vfs_register(). If the asynchronous VFS is already initialized
-** and registered, this function is a no-op. The asynchronous IO VFS
-** is registered as "sqlite3async".
-**
-** The asynchronous IO VFS does not make operating system IO requests
-** directly. Instead, it uses an existing VFS implementation for all
-** required file-system operations. If the first parameter to this function
-** is NULL, then the current default VFS is used for IO. If it is not
-** NULL, then it must be the name of an existing VFS. In other words, the
-** first argument to this function is passed to sqlite3_vfs_find() to
-** locate the VFS to use for all real IO operations. This VFS is known
-** as the "parent VFS".
-**
-** If the second parameter to this function is non-zero, then the
-** asynchronous IO VFS is registered as the default VFS for all SQLite
-** database connections within the process. Otherwise, the asynchronous IO
-** VFS is only used by connections opened using sqlite3_open_v2() that
-** specifically request VFS "sqlite3async".
-**
-** If a parent VFS cannot be located, then SQLITE_ERROR is returned.
-** In the unlikely event that operating system specific initialization
-** fails (win32 systems create the required critical section and event
-** objects within this function), then SQLITE_ERROR is also returned.
-** Finally, if the call to sqlite3_vfs_register() returns an error, then
-** the error code is returned to the user by this function. In all three
-** of these cases, intialization has failed and the asynchronous IO VFS
-** is not registered with SQLite.
-**
-** Otherwise, if no error occurs, SQLITE_OK is returned.
-*/
-int sqlite3async_initialize(const char *zParent, int isDefault);
-
-/*
-** This function unregisters the asynchronous IO VFS using
-** sqlite3_vfs_unregister().
-**
-** On win32 platforms, this function also releases the small number of
-** critical section and event objects created by sqlite3async_initialize().
-*/
-void sqlite3async_shutdown(void);
-
-/*
-** This function may only be called when the asynchronous IO VFS is
-** installed (after a call to sqlite3async_initialize()). It processes
-** zero or more queued write operations before returning. It is expected
-** (but not required) that this function will be called by a different
-** thread than those threads that use SQLite. The "background thread"
-** that performs IO.
-**
-** How many queued write operations are performed before returning
-** depends on the global setting configured by passing the SQLITEASYNC_HALT
-** verb to sqlite3async_control() (see below for details). By default
-** this function never returns - it processes all pending operations and
-** then blocks waiting for new ones.
-**
-** If multiple simultaneous calls are made to sqlite3async_run() from two
-** or more threads, then the calls are serialized internally.
-*/
-void sqlite3async_run(void);
-
-/*
-** This function may only be called when the asynchronous IO VFS is
-** installed (after a call to sqlite3async_initialize()). It is used
-** to query or configure various parameters that affect the operation
-** of the asynchronous IO VFS. At present there are three parameters
-** supported:
-**
-** * The "halt" parameter, which configures the circumstances under
-** which the sqlite3async_run() parameter is configured.
-**
-** * The "delay" parameter. Setting the delay parameter to a non-zero
-** value causes the sqlite3async_run() function to sleep for the
-** configured number of milliseconds between each queued write
-** operation.
-**
-** * The "lockfiles" parameter. This parameter determines whether or
-** not the asynchronous IO VFS locks the database files it operates
-** on. Disabling file locking can improve throughput.
-**
-** This function is always passed two arguments. When setting the value
-** of a parameter, the first argument must be one of SQLITEASYNC_HALT,
-** SQLITEASYNC_DELAY or SQLITEASYNC_LOCKFILES. The second argument must
-** be passed the new value for the parameter as type "int".
-**
-** When querying the current value of a paramter, the first argument must
-** be one of SQLITEASYNC_GET_HALT, GET_DELAY or GET_LOCKFILES. The second
-** argument to this function must be of type (int *). The current value
-** of the queried parameter is copied to the memory pointed to by the
-** second argument. For example:
-**
-** int eCurrentHalt;
-** int eNewHalt = SQLITEASYNC_HALT_IDLE;
-**
-** sqlite3async_control(SQLITEASYNC_HALT, eNewHalt);
-** sqlite3async_control(SQLITEASYNC_GET_HALT, &eCurrentHalt);
-** assert( eNewHalt==eCurrentHalt );
-**
-** See below for more detail on each configuration parameter.
-**
-** SQLITEASYNC_HALT:
-**
-** This is used to set the value of the "halt" parameter. The second
-** argument must be one of the SQLITEASYNC_HALT_XXX symbols defined
-** below (either NEVER, IDLE and NOW).
-**
-** If the parameter is set to NEVER, then calls to sqlite3async_run()
-** never return. This is the default setting. If the parameter is set
-** to IDLE, then calls to sqlite3async_run() return as soon as the
-** queue of pending write operations is empty. If the parameter is set
-** to NOW, then calls to sqlite3async_run() return as quickly as
-** possible, without processing any pending write requests.
-**
-** If an attempt is made to set this parameter to an integer value other
-** than SQLITEASYNC_HALT_NEVER, IDLE or NOW, then sqlite3async_control()
-** returns SQLITE_MISUSE and the current value of the parameter is not
-** modified.
-**
-** Modifying the "halt" parameter affects calls to sqlite3async_run()
-** made by other threads that are currently in progress.
-**
-** SQLITEASYNC_DELAY:
-**
-** This is used to set the value of the "delay" parameter. If set to
-** a non-zero value, then after completing a pending write request, the
-** sqlite3async_run() function sleeps for the configured number of
-** milliseconds.
-**
-** If an attempt is made to set this parameter to a negative value,
-** sqlite3async_control() returns SQLITE_MISUSE and the current value
-** of the parameter is not modified.
-**
-** Modifying the "delay" parameter affects calls to sqlite3async_run()
-** made by other threads that are currently in progress.
-**
-** SQLITEASYNC_LOCKFILES:
-**
-** This is used to set the value of the "lockfiles" parameter. This
-** parameter must be set to either 0 or 1. If set to 1, then the
-** asynchronous IO VFS uses the xLock() and xUnlock() methods of the
-** parent VFS to lock database files being read and/or written. If
-** the parameter is set to 0, then these locks are omitted.
-**
-** This parameter may only be set when there are no open database
-** connections using the VFS and the queue of pending write requests
-** is empty. Attempting to set it when this is not true, or to set it
-** to a value other than 0 or 1 causes sqlite3async_control() to return
-** SQLITE_MISUSE and the value of the parameter to remain unchanged.
-**
-** If this parameter is set to zero, then it is only safe to access the
-** database via the asynchronous IO VFS from within a single process. If
-** while writing to the database via the asynchronous IO VFS the database
-** is also read or written from within another process, or via another
-** connection that does not use the asynchronous IO VFS within the same
-** process, the results are undefined (and may include crashes or database
-** corruption).
-**
-** Alternatively, if this parameter is set to 1, then it is safe to access
-** the database from multiple connections within multiple processes using
-** either the asynchronous IO VFS or the parent VFS directly.
-*/
-int sqlite3async_control(int op, ...);
-
-/*
-** Values that can be used as the first argument to sqlite3async_control().
-*/
-#define SQLITEASYNC_HALT 1
-#define SQLITEASYNC_GET_HALT 2
-#define SQLITEASYNC_DELAY 3
-#define SQLITEASYNC_GET_DELAY 4
-#define SQLITEASYNC_LOCKFILES 5
-#define SQLITEASYNC_GET_LOCKFILES 6
-
-/*
-** If the first argument to sqlite3async_control() is SQLITEASYNC_HALT,
-** the second argument should be one of the following.
-*/
-#define SQLITEASYNC_HALT_NEVER 0 /* Never halt (default value) */
-#define SQLITEASYNC_HALT_NOW 1 /* Halt as soon as possible */
-#define SQLITEASYNC_HALT_IDLE 2 /* Halt when write-queue is empty */
-
-#ifdef __cplusplus
-} /* End of the 'extern "C"' block */
-#endif
-#endif /* ifndef __SQLITEASYNC_H_ */
diff --git a/ext/consio/console_io.c b/ext/consio/console_io.c
deleted file mode 100755
index 75324a34fd..0000000000
--- a/ext/consio/console_io.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
-** 2023 November 4
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-********************************************************************************
-** This file implements various interfaces used for console and stream I/O
-** by the SQLite project command-line tools, as explained in console_io.h .
-** Functions prefixed by "SQLITE_INTERNAL_LINKAGE" behave as described there.
-*/
-
-#ifndef SQLITE_CDECL
-# define SQLITE_CDECL
-#endif
-
-#ifndef SHELL_NO_SYSINC
-# include
-# include
-# include
-# include
-# include
-# include "sqlite3.h"
-#endif
-#ifndef HAVE_CONSOLE_IO_H
-# include "console_io.h"
-#endif
-#if defined(_MSC_VER)
-# pragma warning(disable : 4204)
-#endif
-
-#ifndef SQLITE_CIO_NO_TRANSLATE
-# if (defined(_WIN32) || defined(WIN32)) && !SQLITE_OS_WINRT
-# ifndef SHELL_NO_SYSINC
-# include
-# include
-# undef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# include
-# endif
-# define CIO_WIN_WC_XLATE 1 /* Use WCHAR Windows APIs for console I/O */
-# else
-# ifndef SHELL_NO_SYSINC
-# include
-# endif
-# define CIO_WIN_WC_XLATE 0 /* Use plain C library stream I/O at console */
-# endif
-#else
-# define CIO_WIN_WC_XLATE 0 /* Not exposing translation routines at all */
-#endif
-
-#if CIO_WIN_WC_XLATE
-static HANDLE handleOfFile(FILE *pf){
- int fileDesc = _fileno(pf);
- union { intptr_t osfh; HANDLE fh; } fid = {
- (fileDesc>=0)? _get_osfhandle(fileDesc) : (intptr_t)INVALID_HANDLE_VALUE
- };
- return fid.fh;
-}
-#endif
-
-#ifndef SQLITE_CIO_NO_TRANSLATE
-typedef struct PerStreamTags {
-# if CIO_WIN_WC_XLATE
- HANDLE hx;
- DWORD consMode;
- char acIncomplete[4];
-# else
- short reachesConsole;
-# endif
- FILE *pf;
-} PerStreamTags;
-
-/* Define NULL-like value for things which can validly be 0. */
-# define SHELL_INVALID_FILE_PTR ((FILE *)~0)
-# if CIO_WIN_WC_XLATE
-# define SHELL_INVALID_CONS_MODE 0xFFFF0000
-# endif
-
-# if CIO_WIN_WC_XLATE
-# define PST_INITIALIZER { INVALID_HANDLE_VALUE, SHELL_INVALID_CONS_MODE, \
- {0,0,0,0}, SHELL_INVALID_FILE_PTR }
-# else
-# define PST_INITIALIZER { 0, SHELL_INVALID_FILE_PTR }
-# endif
-
-/* Quickly say whether a known output is going to the console. */
-# if CIO_WIN_WC_XLATE
-static short pstReachesConsole(PerStreamTags *ppst){
- return (ppst->hx != INVALID_HANDLE_VALUE);
-}
-# else
-# define pstReachesConsole(ppst) 0
-# endif
-
-# if CIO_WIN_WC_XLATE
-static void restoreConsoleArb(PerStreamTags *ppst){
- if( pstReachesConsole(ppst) ) SetConsoleMode(ppst->hx, ppst->consMode);
-}
-# else
-# define restoreConsoleArb(ppst)
-# endif
-
-/* Say whether FILE* appears to be a console, collect associated info. */
-static short streamOfConsole(FILE *pf, /* out */ PerStreamTags *ppst){
-# if CIO_WIN_WC_XLATE
- short rv = 0;
- DWORD dwCM = SHELL_INVALID_CONS_MODE;
- HANDLE fh = handleOfFile(pf);
- ppst->pf = pf;
- if( INVALID_HANDLE_VALUE != fh ){
- rv = (GetFileType(fh) == FILE_TYPE_CHAR && GetConsoleMode(fh,&dwCM));
- }
- ppst->hx = (rv)? fh : INVALID_HANDLE_VALUE;
- ppst->consMode = dwCM;
- return rv;
-# else
- ppst->pf = pf;
- ppst->reachesConsole = ( (short)isatty(fileno(pf)) );
- return ppst->reachesConsole;
-# endif
-}
-
-# ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
-# define ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x4)
-# endif
-
-# if CIO_WIN_WC_XLATE
-/* Define console modes for use with the Windows Console API. */
-# define SHELL_CONI_MODE \
- (ENABLE_ECHO_INPUT | ENABLE_INSERT_MODE | ENABLE_LINE_INPUT | 0x80 \
- | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_PROCESSED_INPUT)
-# define SHELL_CONO_MODE (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT \
- | ENABLE_VIRTUAL_TERMINAL_PROCESSING)
-# endif
-
-typedef struct ConsoleInfo {
- PerStreamTags pstSetup[3];
- PerStreamTags pstDesignated[3];
- StreamsAreConsole sacSetup;
-} ConsoleInfo;
-
-static short isValidStreamInfo(PerStreamTags *ppst){
- return (ppst->pf != SHELL_INVALID_FILE_PTR);
-}
-
-static ConsoleInfo consoleInfo = {
- { /* pstSetup */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER },
- { /* pstDesignated[] */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER },
- SAC_NoConsole /* sacSetup */
-};
-
-SQLITE_INTERNAL_LINKAGE FILE* invalidFileStream = (FILE *)~0;
-
-# if CIO_WIN_WC_XLATE
-static void maybeSetupAsConsole(PerStreamTags *ppst, short odir){
- if( pstReachesConsole(ppst) ){
- DWORD cm = odir? SHELL_CONO_MODE : SHELL_CONI_MODE;
- SetConsoleMode(ppst->hx, cm);
- }
-}
-# else
-# define maybeSetupAsConsole(ppst,odir)
-# endif
-
-SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void){
-# if CIO_WIN_WC_XLATE
- int ix = 0;
- while( ix < 6 ){
- PerStreamTags *ppst = (ix<3)?
- &consoleInfo.pstSetup[ix] : &consoleInfo.pstDesignated[ix-3];
- maybeSetupAsConsole(ppst, (ix % 3)>0);
- ++ix;
- }
-# endif
-}
-
-SQLITE_INTERNAL_LINKAGE StreamsAreConsole
-consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr ){
- StreamsAreConsole rv = SAC_NoConsole;
- FILE* apf[3] = { pfIn, pfOut, pfErr };
- int ix;
- for( ix = 2; ix >= 0; --ix ){
- PerStreamTags *ppst = &consoleInfo.pstSetup[ix];
- if( streamOfConsole(apf[ix], ppst) ){
- rv |= (SAC_InConsole< 0 ) fflush(apf[ix]);
- }
- consoleInfo.sacSetup = rv;
- consoleRenewSetup();
- return rv;
-}
-
-SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void ){
-# if CIO_WIN_WC_XLATE
- static ConsoleInfo *pci = &consoleInfo;
- if( pci->sacSetup ){
- int ix;
- for( ix=0; ix<3; ++ix ){
- if( pci->sacSetup & (SAC_InConsole<pstSetup[ix];
- SetConsoleMode(ppst->hx, ppst->consMode);
- }
- }
- }
-# endif
-}
-#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
-
-#ifdef SQLITE_CIO_INPUT_REDIR
-/* Say whether given FILE* is among those known, via either
-** consoleClassifySetup() or set{Output,Error}Stream, as
-** readable, and return an associated PerStreamTags pointer
-** if so. Otherwise, return 0.
-*/
-static PerStreamTags * isKnownReadable(FILE *pf){
- static PerStreamTags *apst[] = {
- &consoleInfo.pstDesignated[0], &consoleInfo.pstSetup[0], 0
- };
- int ix = 0;
- do {
- if( apst[ix]->pf == pf ) break;
- } while( apst[++ix] != 0 );
- return apst[ix];
-}
-#endif
-
-#ifndef SQLITE_CIO_NO_TRANSLATE
-/* Say whether given FILE* is among those known, via either
-** consoleClassifySetup() or set{Output,Error}Stream, as
-** writable, and return an associated PerStreamTags pointer
-** if so. Otherwise, return 0.
-*/
-static PerStreamTags * isKnownWritable(FILE *pf){
- static PerStreamTags *apst[] = {
- &consoleInfo.pstDesignated[1], &consoleInfo.pstDesignated[2],
- &consoleInfo.pstSetup[1], &consoleInfo.pstSetup[2], 0
- };
- int ix = 0;
- do {
- if( apst[ix]->pf == pf ) break;
- } while( apst[++ix] != 0 );
- return apst[ix];
-}
-
-static FILE *designateEmitStream(FILE *pf, unsigned chix){
- FILE *rv = consoleInfo.pstDesignated[chix].pf;
- if( pf == invalidFileStream ) return rv;
- else{
- /* Setting a possibly new output stream. */
- PerStreamTags *ppst = isKnownWritable(pf);
- if( ppst != 0 ){
- PerStreamTags pst = *ppst;
- consoleInfo.pstDesignated[chix] = pst;
- }else streamOfConsole(pf, &consoleInfo.pstDesignated[chix]);
- }
- return rv;
-}
-
-SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf){
- return designateEmitStream(pf, 1);
-}
-# ifdef CONSIO_SET_ERROR_STREAM
-SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf){
- return designateEmitStream(pf, 2);
-}
-# endif
-#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
-
-#ifndef SQLITE_CIO_NO_SETMODE
-# if CIO_WIN_WC_XLATE
-static void setModeFlushQ(FILE *pf, short bFlush, int mode){
- if( bFlush ) fflush(pf);
- _setmode(_fileno(pf), mode);
-}
-# else
-# define setModeFlushQ(f, b, m) if(b) fflush(f)
-# endif
-
-SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *pf, short bFlush){
- setModeFlushQ(pf, bFlush, _O_BINARY);
-}
-SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *pf, short bFlush){
- setModeFlushQ(pf, bFlush, _O_TEXT);
-}
-# undef setModeFlushQ
-
-#else /* defined(SQLITE_CIO_NO_SETMODE) */
-# define setBinaryMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0)
-# define setTextMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0)
-#endif /* defined(SQLITE_CIO_NO_SETMODE) */
-
-#ifndef SQLITE_CIO_NO_TRANSLATE
-# if CIO_WIN_WC_XLATE
-/* Write buffer cBuf as output to stream known to reach console,
-** limited to ncTake char's. Return ncTake on success, else 0. */
-static int conZstrEmit(PerStreamTags *ppst, const char *z, int ncTake){
- int rv = 0;
- if( z!=NULL ){
- int nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, 0,0);
- if( nwc > 0 ){
- WCHAR *zw = sqlite3_malloc64(nwc*sizeof(WCHAR));
- if( zw!=NULL ){
- nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, zw,nwc);
- if( nwc > 0 ){
- /* Translation from UTF-8 to UTF-16, then WCHARs out. */
- if( WriteConsoleW(ppst->hx, zw,nwc, 0, NULL) ){
- rv = ncTake;
- }
- }
- sqlite3_free(zw);
- }
- }
- }
- return rv;
-}
-
-/* For {f,o,e}PrintfUtf8() when stream is known to reach console. */
-static int conioVmPrintf(PerStreamTags *ppst, const char *zFormat, va_list ap){
- char *z = sqlite3_vmprintf(zFormat, ap);
- if( z ){
- int rv = conZstrEmit(ppst, z, (int)strlen(z));
- sqlite3_free(z);
- return rv;
- }else return 0;
-}
-# endif /* CIO_WIN_WC_XLATE */
-
-# ifdef CONSIO_GET_EMIT_STREAM
-static PerStreamTags * getDesignatedEmitStream(FILE *pf, unsigned chix,
- PerStreamTags *ppst){
- PerStreamTags *rv = isKnownWritable(pf);
- short isValid = (rv!=0)? isValidStreamInfo(rv) : 0;
- if( rv != 0 && isValid ) return rv;
- streamOfConsole(pf, ppst);
- return ppst;
-}
-# endif
-
-/* Get stream info, either for designated output or error stream when
-** chix equals 1 or 2, or for an arbitrary stream when chix == 0.
-** In either case, ppst references a caller-owned PerStreamTags
-** struct which may be filled in if none of the known writable
-** streams is being held by consoleInfo. The ppf parameter is a
-** byref output when chix!=0 and a byref input when chix==0.
- */
-static PerStreamTags *
-getEmitStreamInfo(unsigned chix, PerStreamTags *ppst,
- /* in/out */ FILE **ppf){
- PerStreamTags *ppstTry;
- FILE *pfEmit;
- if( chix > 0 ){
- ppstTry = &consoleInfo.pstDesignated[chix];
- if( !isValidStreamInfo(ppstTry) ){
- ppstTry = &consoleInfo.pstSetup[chix];
- pfEmit = ppst->pf;
- }else pfEmit = ppstTry->pf;
- if( !isValidStreamInfo(ppstTry) ){
- pfEmit = (chix > 1)? stderr : stdout;
- ppstTry = ppst;
- streamOfConsole(pfEmit, ppstTry);
- }
- *ppf = pfEmit;
- }else{
- ppstTry = isKnownWritable(*ppf);
- if( ppstTry != 0 ) return ppstTry;
- streamOfConsole(*ppf, ppst);
- return ppst;
- }
- return ppstTry;
-}
-
-SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...){
- va_list ap;
- int rv;
- FILE *pfOut;
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
-# if CIO_WIN_WC_XLATE
- PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
-# else
- getEmitStreamInfo(1, &pst, &pfOut);
-# endif
- assert(zFormat!=0);
- va_start(ap, zFormat);
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ){
- rv = conioVmPrintf(ppst, zFormat, ap);
- }else{
-# endif
- rv = vfprintf(pfOut, zFormat, ap);
-# if CIO_WIN_WC_XLATE
- }
-# endif
- va_end(ap);
- return rv;
-}
-
-SQLITE_INTERNAL_LINKAGE int ePrintfUtf8(const char *zFormat, ...){
- va_list ap;
- int rv;
- FILE *pfErr;
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
-# if CIO_WIN_WC_XLATE
- PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
-# else
- getEmitStreamInfo(2, &pst, &pfErr);
-# endif
- assert(zFormat!=0);
- va_start(ap, zFormat);
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ){
- rv = conioVmPrintf(ppst, zFormat, ap);
- }else{
-# endif
- rv = vfprintf(pfErr, zFormat, ap);
-# if CIO_WIN_WC_XLATE
- }
-# endif
- va_end(ap);
- return rv;
-}
-
-SQLITE_INTERNAL_LINKAGE int fPrintfUtf8(FILE *pfO, const char *zFormat, ...){
- va_list ap;
- int rv;
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
-# if CIO_WIN_WC_XLATE
- PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
-# else
- getEmitStreamInfo(0, &pst, &pfO);
-# endif
- assert(zFormat!=0);
- va_start(ap, zFormat);
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ){
- maybeSetupAsConsole(ppst, 1);
- rv = conioVmPrintf(ppst, zFormat, ap);
- if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
- }else{
-# endif
- rv = vfprintf(pfO, zFormat, ap);
-# if CIO_WIN_WC_XLATE
- }
-# endif
- va_end(ap);
- return rv;
-}
-
-SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO){
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
-# if CIO_WIN_WC_XLATE
- PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
-# else
- getEmitStreamInfo(0, &pst, &pfO);
-# endif
- assert(z!=0);
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ){
- int rv;
- maybeSetupAsConsole(ppst, 1);
- rv = conZstrEmit(ppst, z, (int)strlen(z));
- if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
- return rv;
- }else {
-# endif
- return (fputs(z, pfO)<0)? 0 : (int)strlen(z);
-# if CIO_WIN_WC_XLATE
- }
-# endif
-}
-
-SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z){
- FILE *pfErr;
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
-# if CIO_WIN_WC_XLATE
- PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
-# else
- getEmitStreamInfo(2, &pst, &pfErr);
-# endif
- assert(z!=0);
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z));
- else {
-# endif
- return (fputs(z, pfErr)<0)? 0 : (int)strlen(z);
-# if CIO_WIN_WC_XLATE
- }
-# endif
-}
-
-SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){
- FILE *pfOut;
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
-# if CIO_WIN_WC_XLATE
- PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
-# else
- getEmitStreamInfo(1, &pst, &pfOut);
-# endif
- assert(z!=0);
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z));
- else {
-# endif
- return (fputs(z, pfOut)<0)? 0 : (int)strlen(z);
-# if CIO_WIN_WC_XLATE
- }
-# endif
-}
-
-#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
-
-#if !(defined(SQLITE_CIO_NO_UTF8SCAN) && defined(SQLITE_CIO_NO_TRANSLATE))
-/* Skip over as much z[] input char sequence as is valid UTF-8,
-** limited per nAccept char's or whole characters and containing
-** no char cn such that ((1<=0 => char count, nAccept<0 => character
- */
-SQLITE_INTERNAL_LINKAGE const char*
-zSkipValidUtf8(const char *z, int nAccept, long ccm){
- int ng = (nAccept<0)? -nAccept : 0;
- const char *pcLimit = (nAccept>=0)? z+nAccept : 0;
- assert(z!=0);
- while( (pcLimit)? (z= pcLimit ) return z;
- else{
- char ct = *zt++;
- if( ct==0 || (zt-z)>4 || (ct & 0xC0)!=0x80 ){
- /* Trailing bytes are too few, too many, or invalid. */
- return z;
- }
- }
- } while( ((c <<= 1) & 0x40) == 0x40 ); /* Eat lead byte's count. */
- z = zt;
- }
- }
- return z;
-}
-#endif /*!(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE))*/
-
-#ifndef SQLITE_CIO_NO_TRANSLATE
-# ifdef CONSIO_SPUTB
-SQLITE_INTERNAL_LINKAGE int
-fPutbUtf8(FILE *pfO, const char *cBuf, int nAccept){
- assert(pfO!=0);
-# if CIO_WIN_WC_XLATE
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
- PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
- if( pstReachesConsole(ppst) ){
- int rv;
- maybeSetupAsConsole(ppst, 1);
- rv = conZstrEmit(ppst, cBuf, nAccept);
- if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
- return rv;
- }else {
-# endif
- return (int)fwrite(cBuf, 1, nAccept, pfO);
-# if CIO_WIN_WC_XLATE
- }
-# endif
-}
-# endif
-
-SQLITE_INTERNAL_LINKAGE int
-oPutbUtf8(const char *cBuf, int nAccept){
- FILE *pfOut;
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
-# if CIO_WIN_WC_XLATE
- PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
-# else
- getEmitStreamInfo(1, &pst, &pfOut);
-# endif
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ){
- return conZstrEmit(ppst, cBuf, nAccept);
- }else {
-# endif
- return (int)fwrite(cBuf, 1, nAccept, pfOut);
-# if CIO_WIN_WC_XLATE
- }
-# endif
-}
-
-/*
-** Flush the given output stream. Return non-zero for success, else 0.
-*/
-#if !defined(SQLITE_CIO_NO_FLUSH) && !defined(SQLITE_CIO_NO_SETMODE)
-SQLITE_INTERNAL_LINKAGE int
-fFlushBuffer(FILE *pfOut){
-# if CIO_WIN_WC_XLATE && !defined(SHELL_OMIT_FIO_DUPE)
- return FlushFileBuffers(handleOfFile(pfOut))? 1 : 0;
-# else
- return fflush(pfOut);
-# endif
-}
-#endif
-
-#if CIO_WIN_WC_XLATE \
- && !defined(SHELL_OMIT_FIO_DUPE) \
- && defined(SQLITE_USE_ONLY_WIN32)
-static struct FileAltIds {
- int fd;
- HANDLE fh;
-} altIdsOfFile(FILE *pf){
- struct FileAltIds rv = { _fileno(pf) };
- union { intptr_t osfh; HANDLE fh; } fid = {
- (rv.fd>=0)? _get_osfhandle(rv.fd) : (intptr_t)INVALID_HANDLE_VALUE
- };
- rv.fh = fid.fh;
- return rv;
-}
-
-SQLITE_INTERNAL_LINKAGE size_t
-cfWrite(const void *buf, size_t osz, size_t ocnt, FILE *pf){
- size_t rv = 0;
- struct FileAltIds fai = altIdsOfFile(pf);
- int fmode = _setmode(fai.fd, _O_BINARY);
- _setmode(fai.fd, fmode);
- while( rv < ocnt ){
- size_t nbo = osz;
- while( nbo > 0 ){
- DWORD dwno = (nbo>(1L<<24))? 1L<<24 : (DWORD)nbo;
- BOOL wrc = TRUE;
- BOOL genCR = (fmode & _O_TEXT)!=0;
- if( genCR ){
- const char *pnl = (const char*)memchr(buf, '\n', nbo);
- if( pnl ) nbo = pnl - (const char*)buf;
- else genCR = 0;
- }
- if( dwno>0 ) wrc = WriteFile(fai.fh, buf, dwno, 0,0);
- if( genCR && wrc ){
- wrc = WriteFile(fai.fh, "\r\n", 2, 0,0);
- ++dwno; /* Skip over the LF */
- }
- if( !wrc ) return rv;
- buf = (const char*)buf + dwno;
- nbo += dwno;
- }
- ++rv;
- }
- return rv;
-}
-
-/* An fgets() equivalent, using Win32 file API for actual input.
-** Input ends when given buffer is filled or a newline is read.
-** If the FILE object is in text mode, swallows 0x0D. (ASCII CR)
-*/
-SQLITE_INTERNAL_LINKAGE char *
-cfGets(char *cBuf, int n, FILE *pf){
- int nci = 0;
- struct FileAltIds fai = altIdsOfFile(pf);
- int fmode = _setmode(fai.fd, _O_BINARY);
- BOOL eatCR = (fmode & _O_TEXT)!=0;
- _setmode(fai.fd, fmode);
- while( nci < n-1 ){
- DWORD nr;
- if( !ReadFile(fai.fh, cBuf+nci, 1, &nr, 0) || nr==0 ) break;
- if( nr>0 && (!eatCR || cBuf[nci]!='\r') ){
- nci += nr;
- if( cBuf[nci-nr]=='\n' ) break;
- }
- }
- if( nci < n ) cBuf[nci] = 0;
- return (nci>0)? cBuf : 0;
-}
-# else
-# define cfWrite(b,os,no,f) fwrite(b,os,no,f)
-# define cfGets(b,n,f) fgets(b,n,f)
-# endif
-
-# ifdef CONSIO_EPUTB
-SQLITE_INTERNAL_LINKAGE int
-ePutbUtf8(const char *cBuf, int nAccept){
- FILE *pfErr;
- PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
- PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
-# if CIO_WIN_WC_XLATE
- if( pstReachesConsole(ppst) ){
- return conZstrEmit(ppst, cBuf, nAccept);
- }else {
-# endif
- return (int)cfWrite(cBuf, 1, nAccept, pfErr);
-# if CIO_WIN_WC_XLATE
- }
-# endif
-}
-# endif /* defined(CONSIO_EPUTB) */
-
-SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn){
- if( pfIn==0 ) pfIn = stdin;
-# if CIO_WIN_WC_XLATE
- if( pfIn == consoleInfo.pstSetup[0].pf
- && (consoleInfo.sacSetup & SAC_InConsole)!=0 ){
-# if CIO_WIN_WC_XLATE==1
-# define SHELL_GULP 150 /* Count of WCHARS to be gulped at a time */
- WCHAR wcBuf[SHELL_GULP+1];
- int lend = 0, noc = 0;
- if( ncMax > 0 ) cBuf[0] = 0;
- while( noc < ncMax-8-1 && !lend ){
- /* There is room for at least 2 more characters and a 0-terminator. */
- int na = (ncMax > SHELL_GULP*4+1 + noc)? SHELL_GULP : (ncMax-1 - noc)/4;
-# undef SHELL_GULP
- DWORD nbr = 0;
- BOOL bRC = ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf, na, &nbr, 0);
- if( bRC && nbr>0 && (wcBuf[nbr-1]&0xF800)==0xD800 ){
- /* Last WHAR read is first of a UTF-16 surrogate pair. Grab its mate. */
- DWORD nbrx;
- bRC &= ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf+nbr, 1, &nbrx, 0);
- if( bRC ) nbr += nbrx;
- }
- if( !bRC || (noc==0 && nbr==0) ) return 0;
- if( nbr > 0 ){
- int nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,0,0,0,0);
- if( nmb != 0 && noc+nmb <= ncMax ){
- int iseg = noc;
- nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,cBuf+noc,nmb,0,0);
- noc += nmb;
- /* Fixup line-ends as coded by Windows for CR (or "Enter".)
- ** This is done without regard for any setMode{Text,Binary}()
- ** call that might have been done on the interactive input.
- */
- if( noc > 0 ){
- if( cBuf[noc-1]=='\n' ){
- lend = 1;
- if( noc > 1 && cBuf[noc-2]=='\r' ) cBuf[--noc-1] = '\n';
- }
- }
- /* Check for ^Z (anywhere in line) too, to act as EOF. */
- while( iseg < noc ){
- if( cBuf[iseg]=='\x1a' ){
- noc = iseg; /* Chop ^Z and anything following. */
- lend = 1; /* Counts as end of line too. */
- break;
- }
- ++iseg;
- }
- }else break; /* Drop apparent garbage in. (Could assert.) */
- }else break;
- }
- /* If got nothing, (after ^Z chop), must be at end-of-file. */
- if( noc > 0 ){
- cBuf[noc] = 0;
- return cBuf;
- }else return 0;
-# endif
- }else{
-# endif
- return cfGets(cBuf, ncMax, pfIn);
-# if CIO_WIN_WC_XLATE
- }
-# endif
-}
-#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
-
-#if defined(_MSC_VER)
-# pragma warning(default : 4204)
-#endif
-
-#undef SHELL_INVALID_FILE_PTR
diff --git a/ext/consio/console_io.h b/ext/consio/console_io.h
deleted file mode 100644
index 1affa15bad..0000000000
--- a/ext/consio/console_io.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
-** 2023 November 1
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-********************************************************************************
-** This file exposes various interfaces used for console and other I/O
-** by the SQLite project command-line tools. These interfaces are used
-** at either source conglomeration time, compilation time, or run time.
-** This source provides for either inclusion into conglomerated,
-** "single-source" forms or separate compilation then linking.
-**
-** Platform dependencies are "hidden" here by various stratagems so
-** that, provided certain conditions are met, the programs using this
-** source or object code compiled from it need no explicit conditional
-** compilation in their source for their console and stream I/O.
-**
-** The symbols and functionality exposed here are not a public API.
-** This code may change in tandem with other project code as needed.
-**
-** When this .h file and its companion .c are directly incorporated into
-** a source conglomeration (such as shell.c), the preprocessor symbol
-** CIO_WIN_WC_XLATE is defined as 0 or 1, reflecting whether console I/O
-** translation for Windows is effected for the build.
-*/
-#define HAVE_CONSOLE_IO_H 1
-#ifndef SQLITE_INTERNAL_LINKAGE
-# define SQLITE_INTERNAL_LINKAGE extern /* external to translation unit */
-# include
-#else
-# define SHELL_NO_SYSINC /* Better yet, modify mkshellc.tcl for this. */
-#endif
-
-#ifndef SQLITE3_H
-# include "sqlite3.h"
-#endif
-
-#ifndef SQLITE_CIO_NO_CLASSIFY
-
-/* Define enum for use with following function. */
-typedef enum StreamsAreConsole {
- SAC_NoConsole = 0,
- SAC_InConsole = 1, SAC_OutConsole = 2, SAC_ErrConsole = 4,
- SAC_AnyConsole = 0x7
-} StreamsAreConsole;
-
-/*
-** Classify the three standard I/O streams according to whether
-** they are connected to a console attached to the process.
-**
-** Returns the bit-wise OR of SAC_{In,Out,Err}Console values,
-** or SAC_NoConsole if none of the streams reaches a console.
-**
-** This function should be called before any I/O is done with
-** the given streams. As a side-effect, the given inputs are
-** recorded so that later I/O operations on them may be done
-** differently than the C library FILE* I/O would be done,
-** iff the stream is used for the I/O functions that follow,
-** and to support the ones that use an implicit stream.
-**
-** On some platforms, stream or console mode alteration (aka
-** "Setup") may be made which is undone by consoleRestore().
-*/
-SQLITE_INTERNAL_LINKAGE StreamsAreConsole
-consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr );
-/* A usual call for convenience: */
-#define SQLITE_STD_CONSOLE_INIT() consoleClassifySetup(stdin,stdout,stderr)
-
-/*
-** After an initial call to consoleClassifySetup(...), renew
-** the same setup it effected. (A call not after is an error.)
-** This will restore state altered by consoleRestore();
-**
-** Applications which run an inferior (child) process which
-** inherits the same I/O streams may call this function after
-** such a process exits to guard against console mode changes.
-*/
-SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void);
-
-/*
-** Undo any side-effects left by consoleClassifySetup(...).
-**
-** This should be called after consoleClassifySetup() and
-** before the process terminates normally. It is suitable
-** for use with the atexit() C library procedure. After
-** this call, no console I/O should be done until one of
-** console{Classify or Renew}Setup(...) is called again.
-**
-** Applications which run an inferior (child) process that
-** inherits the same I/O streams might call this procedure
-** before so that said process will have a console setup
-** however users have configured it or come to expect.
-*/
-SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void );
-
-#else /* defined(SQLITE_CIO_NO_CLASSIFY) */
-# define consoleClassifySetup(i,o,e)
-# define consoleRenewSetup()
-# define consoleRestore()
-#endif /* defined(SQLITE_CIO_NO_CLASSIFY) */
-
-#ifndef SQLITE_CIO_NO_REDIRECT
-/*
-** Set stream to be used for the functions below which write
-** to "the designated X stream", where X is Output or Error.
-** Returns the previous value.
-**
-** Alternatively, pass the special value, invalidFileStream,
-** to get the designated stream value without setting it.
-**
-** Before the designated streams are set, they default to
-** those passed to consoleClassifySetup(...), and before
-** that is called they default to stdout and stderr.
-**
-** It is error to close a stream so designated, then, without
-** designating another, use the corresponding {o,e}Emit(...).
-*/
-SQLITE_INTERNAL_LINKAGE FILE *invalidFileStream;
-SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf);
-# ifdef CONSIO_SET_ERROR_STREAM
-SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf);
-# endif
-#else
-# define setOutputStream(pf)
-# define setErrorStream(pf)
-#endif /* !defined(SQLITE_CIO_NO_REDIRECT) */
-
-#ifndef SQLITE_CIO_NO_TRANSLATE
-/*
-** Emit output like fprintf(). If the output is going to the
-** console and translation from UTF-8 is necessary, perform
-** the needed translation. Otherwise, write formatted output
-** to the provided stream almost as-is, possibly with newline
-** translation as specified by set{Binary,Text}Mode().
-*/
-SQLITE_INTERNAL_LINKAGE int fPrintfUtf8(FILE *pfO, const char *zFormat, ...);
-/* Like fPrintfUtf8 except stream is always the designated output. */
-SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...);
-/* Like fPrintfUtf8 except stream is always the designated error. */
-SQLITE_INTERNAL_LINKAGE int ePrintfUtf8(const char *zFormat, ...);
-
-/*
-** Emit output like fputs(). If the output is going to the
-** console and translation from UTF-8 is necessary, perform
-** the needed translation. Otherwise, write given text to the
-** provided stream almost as-is, possibly with newline
-** translation as specified by set{Binary,Text}Mode().
-*/
-SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO);
-/* Like fPutsUtf8 except stream is always the designated output. */
-SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z);
-/* Like fPutsUtf8 except stream is always the designated error. */
-SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z);
-
-/*
-** Emit output like fPutsUtf8(), except that the length of the
-** accepted char or character sequence is limited by nAccept.
-**
-** Returns the number of accepted char values.
-*/
-#ifdef CONSIO_SPUTB
-SQLITE_INTERNAL_LINKAGE int
-fPutbUtf8(FILE *pfOut, const char *cBuf, int nAccept);
-/* Like fPutbUtf8 except stream is always the designated output. */
-#endif
-SQLITE_INTERNAL_LINKAGE int
-oPutbUtf8(const char *cBuf, int nAccept);
-/* Like fPutbUtf8 except stream is always the designated error. */
-#ifdef CONSIO_EPUTB
-SQLITE_INTERNAL_LINKAGE int
-ePutbUtf8(const char *cBuf, int nAccept);
-#endif
-
-/*
-** Flush the given output stream. Return non-zero for success, else 0.
-*/
-#if !defined(SQLITE_CIO_NO_FLUSH) && !defined(SQLITE_CIO_NO_SETMODE)
-SQLITE_INTERNAL_LINKAGE int
-fFlushBuffer(FILE *pfOut);
-#endif
-
-/*
-** Collect input like fgets(...) with special provisions for input
-** from the console on such platforms as require same. Newline
-** translation may be done as set by set{Binary,Text}Mode().
-** As a convenience, pfIn==NULL is treated as stdin.
-*/
-SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn);
-/* Like fGetsUtf8 except stream is always the designated input. */
-/* SQLITE_INTERNAL_LINKAGE char* iGetsUtf8(char *cBuf, int ncMax); */
-
-#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
-
-#ifndef SQLITE_CIO_NO_SETMODE
-/*
-** Set given stream for binary mode, where newline translation is
-** not done, or for text mode where, for some platforms, newlines
-** are translated to the platform's conventional char sequence.
-** If bFlush true, flush the stream.
-**
-** An additional side-effect is that if the stream is one passed
-** to consoleClassifySetup() as an output, it is flushed first.
-**
-** Note that binary/text mode has no effect on console I/O
-** translation. On all platforms, newline to the console starts
-** a new line and CR,LF chars from the console become a newline.
-*/
-SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *, short bFlush);
-SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *, short bFlush);
-#endif
-
-#ifdef SQLITE_CIO_PROMPTED_IN
-typedef struct Prompts {
- int numPrompts;
- const char **azPrompts;
-} Prompts;
-
-/*
-** Macros for use of a line editor.
-**
-** The following macros define operations involving use of a
-** line-editing library or simple console interaction.
-** A "T" argument is a text (char *) buffer or filename.
-** A "N" argument is an integer.
-**
-** SHELL_ADD_HISTORY(T) // Record text as line(s) of history.
-** SHELL_READ_HISTORY(T) // Read history from file named by T.
-** SHELL_WRITE_HISTORY(T) // Write history to file named by T.
-** SHELL_STIFLE_HISTORY(N) // Limit history to N entries.
-**
-** A console program which does interactive console input is
-** expected to call:
-** SHELL_READ_HISTORY(T) before collecting such input;
-** SHELL_ADD_HISTORY(T) as record-worthy input is taken;
-** SHELL_STIFLE_HISTORY(N) after console input ceases; then
-** SHELL_WRITE_HISTORY(T) before the program exits.
-*/
-
-/*
-** Retrieve a single line of input text from an input stream.
-**
-** If pfIn is the input stream passed to consoleClassifySetup(),
-** and azPrompt is not NULL, then a prompt is issued before the
-** line is collected, as selected by the isContinuation flag.
-** Array azPrompt[{0,1}] holds the {main,continuation} prompt.
-**
-** If zBufPrior is not NULL then it is a buffer from a prior
-** call to this routine that can be reused, or will be freed.
-**
-** The result is stored in space obtained from malloc() and
-** must either be freed by the caller or else passed back to
-** this function as zBufPrior for reuse.
-**
-** This function may call upon services of a line-editing
-** library to interactively collect line edited input.
-*/
-SQLITE_INTERNAL_LINKAGE char *
-shellGetLine(FILE *pfIn, char *zBufPrior, int nLen,
- short isContinuation, Prompts azPrompt);
-#endif /* defined(SQLITE_CIO_PROMPTED_IN) */
-/*
-** TBD: Define an interface for application(s) to generate
-** completion candidates for use by the line-editor.
-**
-** This may be premature; the CLI is the only application
-** that does this. Yet, getting line-editing melded into
-** console I/O is desirable because a line-editing library
-** may have to establish console operating mode, possibly
-** in a way that interferes with the above functionality.
-*/
-
-#if !(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE))
-/* Skip over as much z[] input char sequence as is valid UTF-8,
-** limited per nAccept char's or whole characters and containing
-** no char cn such that ((1<=0 => char count, nAccept<0 => character
- */
-SQLITE_INTERNAL_LINKAGE const char*
-zSkipValidUtf8(const char *z, int nAccept, long ccm);
-
-#endif
diff --git a/ext/fts5/fts5_tcl.c b/ext/fts5/fts5_tcl.c
index a8ab44096b..dd2ed82c9e 100644
--- a/ext/fts5/fts5_tcl.c
+++ b/ext/fts5/fts5_tcl.c
@@ -21,6 +21,7 @@
#include "fts5.h"
#include
#include
+#include
#ifdef SQLITE_DEBUG
extern int sqlite3_fts5_may_be_corrupt;
@@ -1626,6 +1627,64 @@ static int SQLITE_TCLAPI f5tDropCorruptTable(
return TCL_OK;
}
+/*
+** Free a buffer returned to SQLite by the str() function.
+*/
+void f5tFree(void *p){
+ char *x = (char *)p;
+ ckfree(&x[-8]);
+}
+
+/*
+** Implementation of str().
+*/
+void f5tStrFunc(sqlite3_context *pCtx, int nArg, sqlite3_value **apArg){
+ const char *zText = 0;
+ assert( nArg==1 );
+
+ zText = sqlite3_value_text(apArg[0]);
+ if( zText ){
+ sqlite3_int64 nText = strlen(zText);
+ char *zCopy = (char*)ckalloc(nText+8);
+ if( zCopy==0 ){
+ sqlite3_result_error_nomem(pCtx);
+ }else{
+ zCopy += 8;
+ memcpy(zCopy, zText, nText);
+ sqlite3_result_text64(pCtx, zCopy, nText, f5tFree, SQLITE_UTF8);
+ }
+ }
+}
+
+/*
+** sqlite3_fts5_register_str DB
+**
+** Register the str() function with database handle DB. str() interprets
+** its only argument as text and returns a copy of the value in a
+** non-nul-terminated buffer.
+*/
+static int SQLITE_TCLAPI f5tRegisterStr(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ sqlite3 *db = 0;
+ int rc;
+
+ if( objc!=2 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "DB");
+ return TCL_ERROR;
+ }
+ if( f5tDbPointer(interp, objv[1], &db) ){
+ return TCL_ERROR;
+ }
+
+ sqlite3_create_function(db, "str", 1, SQLITE_UTF8, 0, f5tStrFunc, 0, 0);
+
+ return TCL_OK;
+}
+
/*
** Entry point.
*/
@@ -1645,7 +1704,8 @@ int Fts5tcl_Init(Tcl_Interp *interp){
{ "sqlite3_fts5_register_matchinfo", f5tRegisterMatchinfo, 0 },
{ "sqlite3_fts5_register_fts5tokenize", f5tRegisterTok, 0 },
{ "sqlite3_fts5_register_origintext",f5tRegisterOriginText, 0 },
- { "sqlite3_fts5_drop_corrupt_table", f5tDropCorruptTable, 0 }
+ { "sqlite3_fts5_drop_corrupt_table", f5tDropCorruptTable, 0 },
+ { "sqlite3_fts5_register_str", f5tRegisterStr, 0 }
};
int i;
F5tTokenizerContext *pContext;
diff --git a/ext/fts5/test/fts5trigram.test b/ext/fts5/test/fts5trigram.test
index 3742c647f0..5048f8beea 100644
--- a/ext/fts5/test/fts5trigram.test
+++ b/ext/fts5/test/fts5trigram.test
@@ -342,6 +342,13 @@ do_test 10.3 {
}
} {}
-
+do_execsql_test 11.0 {
+ CREATE VIRTUAL TABLE t4 USING fts5(y, tokenize=trigram);
+}
+sqlite3_fts5_register_str db
+do_execsql_test 11.1 {
+ INSERT INTO t4 VALUES( str('') );
+}
finish_test
+
diff --git a/ext/userauth/sqlite3userauth.h b/ext/userauth/sqlite3userauth.h
deleted file mode 100644
index c7d23b9399..0000000000
--- a/ext/userauth/sqlite3userauth.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-** 2014-09-08
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-*************************************************************************
-**
-** This file contains the application interface definitions for the
-** user-authentication extension feature.
-**
-** To compile with the user-authentication feature, append this file to
-** end of an SQLite amalgamation header file ("sqlite3.h"), then add
-** the SQLITE_USER_AUTHENTICATION compile-time option. See the
-** user-auth.txt file in the same source directory as this file for
-** additional information.
-*/
-#ifdef SQLITE_USER_AUTHENTICATION
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** If a database contains the SQLITE_USER table, then the
-** sqlite3_user_authenticate() interface must be invoked with an
-** appropriate username and password prior to enable read and write
-** access to the database.
-**
-** Return SQLITE_OK on success or SQLITE_ERROR if the username/password
-** combination is incorrect or unknown.
-**
-** If the SQLITE_USER table is not present in the database file, then
-** this interface is a harmless no-op returnning SQLITE_OK.
-*/
-int sqlite3_user_authenticate(
- sqlite3 *db, /* The database connection */
- const char *zUsername, /* Username */
- const char *aPW, /* Password or credentials */
- int nPW /* Number of bytes in aPW[] */
-);
-
-/*
-** The sqlite3_user_add() interface can be used (by an admin user only)
-** to create a new user. When called on a no-authentication-required
-** database, this routine converts the database into an authentication-
-** required database, automatically makes the added user an
-** administrator, and logs in the current connection as that user.
-** The sqlite3_user_add() interface only works for the "main" database, not
-** for any ATTACH-ed databases. Any call to sqlite3_user_add() by a
-** non-admin user results in an error.
-*/
-int sqlite3_user_add(
- sqlite3 *db, /* Database connection */
- const char *zUsername, /* Username to be added */
- const char *aPW, /* Password or credentials */
- int nPW, /* Number of bytes in aPW[] */
- int isAdmin /* True to give new user admin privilege */
-);
-
-/*
-** The sqlite3_user_change() interface can be used to change a users
-** login credentials or admin privilege. Any user can change their own
-** login credentials. Only an admin user can change another users login
-** credentials or admin privilege setting. No user may change their own
-** admin privilege setting.
-*/
-int sqlite3_user_change(
- sqlite3 *db, /* Database connection */
- const char *zUsername, /* Username to change */
- const char *aPW, /* New password or credentials */
- int nPW, /* Number of bytes in aPW[] */
- int isAdmin /* Modified admin privilege for the user */
-);
-
-/*
-** The sqlite3_user_delete() interface can be used (by an admin user only)
-** to delete a user. The currently logged-in user cannot be deleted,
-** which guarantees that there is always an admin user and hence that
-** the database cannot be converted into a no-authentication-required
-** database.
-*/
-int sqlite3_user_delete(
- sqlite3 *db, /* Database connection */
- const char *zUsername /* Username to remove */
-);
-
-#ifdef __cplusplus
-} /* end of the 'extern "C"' block */
-#endif
-
-#endif /* SQLITE_USER_AUTHENTICATION */
diff --git a/ext/userauth/user-auth.txt b/ext/userauth/user-auth.txt
deleted file mode 100644
index 9d6ba23336..0000000000
--- a/ext/userauth/user-auth.txt
+++ /dev/null
@@ -1,176 +0,0 @@
-*********************************** NOTICE ************************************
-* This extension is deprecated. The SQLite developers do not maintain this *
-* extension. At some point in the future, it might disappear from the source *
-* tree. *
-* *
-* If you are using this extension and think it should be supported moving *
-* forward, visit the SQLite Forum (https://sqlite.org/forum) and argue your *
-* case there. *
-* *
-* This deprecation notice was added on 2024-01-22. *
-*******************************************************************************
-
-Activate the user authentication logic by including the
-ext/userauth/userauth.c source code file in the build and
-adding the -DSQLITE_USER_AUTHENTICATION compile-time option.
-The ext/userauth/sqlite3userauth.h header file is available to
-applications to define the interface.
-
-When using the SQLite amalgamation, it is sufficient to append
-the ext/userauth/userauth.c source file onto the end of the
-amalgamation.
-
-The following new APIs are available when user authentication is
-activated:
-
- int sqlite3_user_authenticate(
- sqlite3 *db, /* The database connection */
- const char *zUsername, /* Username */
- const char *aPW, /* Password or credentials */
- int nPW /* Number of bytes in aPW[] */
- );
-
- int sqlite3_user_add(
- sqlite3 *db, /* Database connection */
- const char *zUsername, /* Username to be added */
- const char *aPW, /* Password or credentials */
- int nPW, /* Number of bytes in aPW[] */
- int isAdmin /* True to give new user admin privilege */
- );
-
- int sqlite3_user_change(
- sqlite3 *db, /* Database connection */
- const char *zUsername, /* Username to change */
- const void *aPW, /* Modified password or credentials */
- int nPW, /* Number of bytes in aPW[] */
- int isAdmin /* Modified admin privilege for the user */
- );
-
- int sqlite3_user_delete(
- sqlite3 *db, /* Database connection */
- const char *zUsername /* Username to remove */
- );
-
-With this extension, a database can be marked as requiring authentication.
-By default a database does not require authentication.
-
-The sqlite3_open(), sqlite3_open16(), and sqlite3_open_v2() interfaces
-work as before: they open a new database connection. However, if the
-database being opened requires authentication, then attempts to read
-or write from the database will fail with an SQLITE_AUTH error until
-after sqlite3_user_authenticate() has been called successfully. The
-sqlite3_user_authenticate() call will return SQLITE_OK if the
-authentication credentials are accepted and SQLITE_ERROR if not.
-
-Calling sqlite3_user_authenticate() on a no-authentication-required
-database connection is a harmless no-op.
-
-If the database is encrypted, then sqlite3_key_v2() must be called first,
-with the correct decryption key, prior to invoking sqlite3_user_authenticate().
-
-To recapitulate: When opening an existing unencrypted authentication-
-required database, the call sequence is:
-
- sqlite3_open_v2()
- sqlite3_user_authenticate();
- /* Database is now usable */
-
-To open an existing, encrypted, authentication-required database, the
-call sequence is:
-
- sqlite3_open_v2();
- sqlite3_key_v2();
- sqlite3_user_authenticate();
- /* Database is now usable */
-
-When opening a no-authentication-required database, the database
-connection is treated as if it was authenticated as an admin user.
-
-When ATTACH-ing new database files to a connection, each newly attached
-database that is an authentication-required database is checked using
-the same username and password as supplied to the main database. If that
-check fails, then the ATTACH command fails with an SQLITE_AUTH error.
-
-The sqlite3_user_add() interface can be used (by an admin user only)
-to create a new user. When called on a no-authentication-required
-database and when A is true, the sqlite3_user_add(D,U,P,N,A) routine
-converts the database into an authentication-required database and
-logs in the database connection D as user U with password P,N.
-To convert a no-authentication-required database into an authentication-
-required database, the isAdmin parameter must be true. If
-sqlite3_user_add(D,U,P,N,A) is called on a no-authentication-required
-database and A is false, then the call fails with an SQLITE_AUTH error.
-
-Any call to sqlite3_user_add() by a non-admin user results in an error.
-
-Hence, to create a new, unencrypted, authentication-required database,
-the call sequence is:
-
- sqlite3_open_v2();
- sqlite3_user_add();
-
-And to create a new, encrypted, authentication-required database, the call
-sequence is:
-
- sqlite3_open_v2();
- sqlite3_key_v2();
- sqlite3_user_add();
-
-The sqlite3_user_delete() interface can be used (by an admin user only)
-to delete a user. The currently logged-in user cannot be deleted,
-which guarantees that there is always an admin user and hence that
-the database cannot be converted into a no-authentication-required
-database.
-
-The sqlite3_user_change() interface can be used to change a users
-login credentials or admin privilege. Any user can change their own
-password. Only an admin user can change another users login
-credentials or admin privilege setting. No user may change their own
-admin privilege setting.
-
-The sqlite3_set_authorizer() callback is modified to take a 7th parameter
-which is the username of the currently logged in user, or NULL for a
-no-authentication-required database.
-
------------------------------------------------------------------------------
-Implementation notes:
-
-An authentication-required database is identified by the presence of a
-new table:
-
- CREATE TABLE sqlite_user(
- uname TEXT PRIMARY KEY,
- isAdmin BOOLEAN,
- pw BLOB
- ) WITHOUT ROWID;
-
-The sqlite_user table is inaccessible (unreadable and unwriteable) to
-non-admin users and is read-only for admin users. However, if the same
-database file is opened by a version of SQLite that omits
-the -DSQLITE_USER_AUTHENTICATION compile-time option, then the sqlite_user
-table will be readable by anybody and writeable by anybody if
-the "PRAGMA writable_schema=ON" statement is run first.
-
-The sqlite_user.pw field is encoded by a built-in SQL function
-"sqlite_crypt(X,Y)". The two arguments are both BLOBs. The first argument
-is the plaintext password supplied to the sqlite3_user_authenticate()
-interface. The second argument is the sqlite_user.pw value and is supplied
-so that the function can extract the "salt" used by the password encoder.
-The result of sqlite_crypt(X,Y) is another blob which is the value that
-ends up being stored in sqlite_user.pw. To verify credentials X supplied
-by the sqlite3_user_authenticate() routine, SQLite runs:
-
- sqlite_user.pw == sqlite_crypt(X, sqlite_user.pw)
-
-To compute an appropriate sqlite_user.pw value from a new or modified
-password X, sqlite_crypt(X,NULL) is run. A new random salt is selected
-when the second argument is NULL.
-
-The built-in version of of sqlite_crypt() uses a simple Ceasar-cypher
-which prevents passwords from being revealed by searching the raw database
-for ASCII text, but is otherwise trivally broken. For better password
-security, the database should be encrypted using the SQLite Encryption
-Extension or similar technology. Or, the application can use the
-sqlite3_create_function() interface to provide an alternative
-implementation of sqlite_crypt() that computes a stronger password hash,
-perhaps using a cryptographic hash function like SHA1.
diff --git a/ext/userauth/userauth.c b/ext/userauth/userauth.c
deleted file mode 100644
index fa708516ee..0000000000
--- a/ext/userauth/userauth.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
-** 2014-09-08
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-*************************************************************************
-**
-** This file contains the bulk of the implementation of the
-** user-authentication extension feature. Some parts of the user-
-** authentication code are contained within the SQLite core (in the
-** src/ subdirectory of the main source code tree) but those parts
-** that could reasonable be separated out are moved into this file.
-**
-** To compile with the user-authentication feature, append this file to
-** end of an SQLite amalgamation, then add the SQLITE_USER_AUTHENTICATION
-** compile-time option. See the user-auth.txt file in the same source
-** directory as this file for additional information.
-*/
-#ifdef SQLITE_USER_AUTHENTICATION
-#ifndef SQLITEINT_H
-# include "sqliteInt.h"
-#endif
-
-/*
-** Prepare an SQL statement for use by the user authentication logic.
-** Return a pointer to the prepared statement on success. Return a
-** NULL pointer if there is an error of any kind.
-*/
-static sqlite3_stmt *sqlite3UserAuthPrepare(
- sqlite3 *db,
- const char *zFormat,
- ...
-){
- sqlite3_stmt *pStmt;
- char *zSql;
- int rc;
- va_list ap;
- u64 savedFlags = db->flags;
-
- va_start(ap, zFormat);
- zSql = sqlite3_vmprintf(zFormat, ap);
- va_end(ap);
- if( zSql==0 ) return 0;
- db->flags |= SQLITE_WriteSchema;
- rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
- db->flags = savedFlags;
- sqlite3_free(zSql);
- if( rc ){
- sqlite3_finalize(pStmt);
- pStmt = 0;
- }
- return pStmt;
-}
-
-/*
-** Check to see if the sqlite_user table exists in database zDb.
-*/
-static int userTableExists(sqlite3 *db, const char *zDb){
- int rc;
- sqlite3_mutex_enter(db->mutex);
- sqlite3BtreeEnterAll(db);
- if( db->init.busy==0 ){
- char *zErr = 0;
- sqlite3Init(db, &zErr);
- sqlite3DbFree(db, zErr);
- }
- rc = sqlite3FindTable(db, "sqlite_user", zDb)!=0;
- sqlite3BtreeLeaveAll(db);
- sqlite3_mutex_leave(db->mutex);
- return rc;
-}
-
-/*
-** Check to see if database zDb has a "sqlite_user" table and if it does
-** whether that table can authenticate zUser with nPw,zPw. Write one of
-** the UAUTH_* user authorization level codes into *peAuth and return a
-** result code.
-*/
-static int userAuthCheckLogin(
- sqlite3 *db, /* The database connection to check */
- const char *zDb, /* Name of specific database to check */
- u8 *peAuth /* OUT: One of UAUTH_* constants */
-){
- sqlite3_stmt *pStmt;
- int rc;
-
- *peAuth = UAUTH_Unknown;
- if( !userTableExists(db, "main") ){
- *peAuth = UAUTH_Admin; /* No sqlite_user table. Everybody is admin. */
- return SQLITE_OK;
- }
- if( db->auth.zAuthUser==0 ){
- *peAuth = UAUTH_Fail;
- return SQLITE_OK;
- }
- pStmt = sqlite3UserAuthPrepare(db,
- "SELECT pw=sqlite_crypt(?1,pw), isAdmin FROM \"%w\".sqlite_user"
- " WHERE uname=?2", zDb);
- if( pStmt==0 ) return SQLITE_NOMEM;
- sqlite3_bind_blob(pStmt, 1, db->auth.zAuthPW, db->auth.nAuthPW,SQLITE_STATIC);
- sqlite3_bind_text(pStmt, 2, db->auth.zAuthUser, -1, SQLITE_STATIC);
- rc = sqlite3_step(pStmt);
- if( rc==SQLITE_ROW && sqlite3_column_int(pStmt,0) ){
- *peAuth = sqlite3_column_int(pStmt, 1) + UAUTH_User;
- }else{
- *peAuth = UAUTH_Fail;
- }
- return sqlite3_finalize(pStmt);
-}
-int sqlite3UserAuthCheckLogin(
- sqlite3 *db, /* The database connection to check */
- const char *zDb, /* Name of specific database to check */
- u8 *peAuth /* OUT: One of UAUTH_* constants */
-){
- int rc;
- u8 savedAuthLevel;
- assert( zDb!=0 );
- assert( peAuth!=0 );
- savedAuthLevel = db->auth.authLevel;
- db->auth.authLevel = UAUTH_Admin;
- rc = userAuthCheckLogin(db, zDb, peAuth);
- db->auth.authLevel = savedAuthLevel;
- return rc;
-}
-
-/*
-** If the current authLevel is UAUTH_Unknown, the take actions to figure
-** out what authLevel should be
-*/
-void sqlite3UserAuthInit(sqlite3 *db){
- if( db->auth.authLevel==UAUTH_Unknown ){
- u8 authLevel = UAUTH_Fail;
- sqlite3UserAuthCheckLogin(db, "main", &authLevel);
- db->auth.authLevel = authLevel;
- if( authLevelflags &= ~SQLITE_WriteSchema;
- }
-}
-
-/*
-** Implementation of the sqlite_crypt(X,Y) function.
-**
-** If Y is NULL then generate a new hash for password X and return that
-** hash. If Y is not null, then generate a hash for password X using the
-** same salt as the previous hash Y and return the new hash.
-*/
-void sqlite3CryptFunc(
- sqlite3_context *context,
- int NotUsed,
- sqlite3_value **argv
-){
- const char *zIn;
- int nIn, ii;
- u8 *zOut;
- char zSalt[8];
- zIn = sqlite3_value_blob(argv[0]);
- nIn = sqlite3_value_bytes(argv[0]);
- if( sqlite3_value_type(argv[1])==SQLITE_BLOB
- && sqlite3_value_bytes(argv[1])==nIn+sizeof(zSalt)
- ){
- memcpy(zSalt, sqlite3_value_blob(argv[1]), sizeof(zSalt));
- }else{
- sqlite3_randomness(sizeof(zSalt), zSalt);
- }
- zOut = sqlite3_malloc( nIn+sizeof(zSalt) );
- if( zOut==0 ){
- sqlite3_result_error_nomem(context);
- }else{
- memcpy(zOut, zSalt, sizeof(zSalt));
- for(ii=0; iiauth.authLevel = UAUTH_Unknown;
- sqlite3_free(db->auth.zAuthUser);
- sqlite3_free(db->auth.zAuthPW);
- memset(&db->auth, 0, sizeof(db->auth));
- db->auth.zAuthUser = sqlite3_mprintf("%s", zUsername);
- if( db->auth.zAuthUser==0 ) return SQLITE_NOMEM;
- db->auth.zAuthPW = sqlite3_malloc( nPW+1 );
- if( db->auth.zAuthPW==0 ) return SQLITE_NOMEM;
- memcpy(db->auth.zAuthPW,zPW,nPW);
- db->auth.nAuthPW = nPW;
- rc = sqlite3UserAuthCheckLogin(db, "main", &authLevel);
- db->auth.authLevel = authLevel;
- sqlite3ExpirePreparedStatements(db, 0);
- if( rc ){
- return rc; /* OOM error, I/O error, etc. */
- }
- if( authLevelauth.authLevelauth.zAuthUser==0 ){
- assert( isAdmin!=0 );
- sqlite3_user_authenticate(db, zUsername, aPW, nPW);
- }
- return SQLITE_OK;
-}
-
-/*
-** The sqlite3_user_change() interface can be used to change a users
-** login credentials or admin privilege. Any user can change their own
-** login credentials. Only an admin user can change another users login
-** credentials or admin privilege setting. No user may change their own
-** admin privilege setting.
-*/
-int sqlite3_user_change(
- sqlite3 *db, /* Database connection */
- const char *zUsername, /* Username to change */
- const char *aPW, /* Modified password or credentials */
- int nPW, /* Number of bytes in aPW[] */
- int isAdmin /* Modified admin privilege for the user */
-){
- sqlite3_stmt *pStmt;
- int rc;
- u8 authLevel;
-
- authLevel = db->auth.authLevel;
- if( authLevelauth.zAuthUser, zUsername)!=0 ){
- if( db->auth.authLevelauth.authLevel = UAUTH_Admin;
- if( !userTableExists(db, "main") ){
- /* This routine is a no-op if the user to be modified does not exist */
- }else{
- pStmt = sqlite3UserAuthPrepare(db,
- "UPDATE sqlite_user SET isAdmin=%d, pw=sqlite_crypt(?1,NULL)"
- " WHERE uname=%Q", isAdmin, zUsername);
- if( pStmt==0 ){
- rc = SQLITE_NOMEM;
- }else{
- sqlite3_bind_blob(pStmt, 1, aPW, nPW, SQLITE_STATIC);
- sqlite3_step(pStmt);
- rc = sqlite3_finalize(pStmt);
- }
- }
- db->auth.authLevel = authLevel;
- return rc;
-}
-
-/*
-** The sqlite3_user_delete() interface can be used (by an admin user only)
-** to delete a user. The currently logged-in user cannot be deleted,
-** which guarantees that there is always an admin user and hence that
-** the database cannot be converted into a no-authentication-required
-** database.
-*/
-int sqlite3_user_delete(
- sqlite3 *db, /* Database connection */
- const char *zUsername /* Username to remove */
-){
- sqlite3_stmt *pStmt;
- if( db->auth.authLevelauth.zAuthUser, zUsername)==0 ){
- /* Cannot delete self */
- return SQLITE_AUTH;
- }
- if( !userTableExists(db, "main") ){
- /* This routine is a no-op if the user to be deleted does not exist */
- return SQLITE_OK;
- }
- pStmt = sqlite3UserAuthPrepare(db,
- "DELETE FROM sqlite_user WHERE uname=%Q", zUsername);
- if( pStmt==0 ) return SQLITE_NOMEM;
- sqlite3_step(pStmt);
- return sqlite3_finalize(pStmt);
-}
-
-#endif /* SQLITE_USER_AUTHENTICATION */
diff --git a/install-sh b/install-sh
deleted file mode 100755
index e9de23842d..0000000000
--- a/install-sh
+++ /dev/null
@@ -1,251 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index 0634c4bccc..0000000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,8461 +0,0 @@
-# Generated from ltmain.m4sh.
-
-# ltmain.sh (GNU libtool) 2.2.6
-# Written by Gordon Matzigkeit , 1996
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions. There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-# GNU Libtool is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING. If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# Usage: $progname [OPTION]... [MODE-ARG]...
-#
-# Provide generalized library-building support services.
-#
-# --config show all configuration variables
-# --debug enable verbose shell tracing
-# -n, --dry-run display commands without modifying any files
-# --features display basic configuration information and exit
-# --mode=MODE use operation mode MODE
-# --preserve-dup-deps don't remove duplicate dependency libraries
-# --quiet, --silent don't print informational messages
-# --tag=TAG use configuration variables from tag TAG
-# -v, --verbose print informational messages (default)
-# --version print version information
-# -h, --help print short or long help message
-#
-# MODE must be one of the following:
-#
-# clean remove files from the build directory
-# compile compile a source file into a libtool object
-# execute automatically set library path, then run a program
-# finish complete the installation of libtool libraries
-# install install libraries or executables
-# link create a library or an executable
-# uninstall remove libraries from an installed directory
-#
-# MODE-ARGS vary depending on the MODE.
-# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
-#
-# When reporting a bug, please describe a test case to reproduce it and
-# include the following information:
-#
-# host-triplet: $host
-# shell: $SHELL
-# compiler: $LTCC
-# compiler flags: $LTCFLAGS
-# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.2.6
-# automake: $automake_version
-# autoconf: $autoconf_version
-#
-# Report bugs to .
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=2.2.6
-TIMESTAMP=""
-package_revision=1.3012
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-lt_user_locale=
-lt_safe_locale=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-do
- eval "if test \"\${$lt_var+set}\" = set; then
- save_$lt_var=\$$lt_var
- $lt_var=C
- export $lt_var
- lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
- lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
- fi"
-done
-
-$lt_unset CDPATH
-
-
-
-
-
-: ${CP="cp -f"}
-: ${ECHO="echo"}
-: ${EGREP="/usr/bin/grep -E"}
-: ${FGREP="/usr/bin/grep -F"}
-: ${GREP="/usr/bin/grep"}
-: ${LN_S="ln -s"}
-: ${MAKE="make"}
-: ${MKDIR="mkdir"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-: ${SED="/opt/local/bin/gsed"}
-: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
-: ${Xsed="$SED -e 1s/^X//"}
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
-EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
-
-exit_status=$EXIT_SUCCESS
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" $lt_nl"
-
-dirname="s,/[^/]*$,,"
-basename="s,^.*/,,"
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-# dirname: Compute the dirname of FILE. If nonempty,
-# add APPEND to the result, otherwise set result
-# to NONDIR_REPLACEMENT.
-# value returned in "$func_dirname_result"
-# basename: Compute filename of FILE.
-# value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
- # Extract subdirectory from the argument.
- func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
- if test "X$func_dirname_result" = "X${1}"; then
- func_dirname_result="${3}"
- else
- func_dirname_result="$func_dirname_result${2}"
- fi
- func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-# Generated shell functions inserted here.
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
-case $progname in
- -*) progname=./$progname ;;
-esac
-
-# Make sure we have an absolute path for reexecution:
-case $progpath in
- [\\/]*|[A-Za-z]:\\*) ;;
- *[\\/]*)
- progdir=$func_dirname_result
- progdir=`cd "$progdir" && pwd`
- progpath="$progdir/$progname"
- ;;
- *)
- save_IFS="$IFS"
- IFS=:
- for progdir in $PATH; do
- IFS="$save_IFS"
- test -x "$progdir/$progname" && break
- done
- IFS="$save_IFS"
- test -n "$progdir" || progdir=`pwd`
- progpath="$progdir/$progname"
- ;;
-esac
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Re-`\' parameter expansions in output of double_quote_subst that were
-# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
-# in input to double_quote_subst, that '$' was protected from expansion.
-# Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
-bs='\\'
-bs2='\\\\'
-bs4='\\\\\\\\'
-dollar='\$'
-sed_double_backslash="\
- s/$bs4/&\\
-/g
- s/^$bs2$dollar/$bs&/
- s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
- s/\n//g"
-
-# Standard options:
-opt_dry_run=false
-opt_help=false
-opt_quiet=false
-opt_verbose=false
-opt_warning=:
-
-# func_echo arg...
-# Echo program name prefixed message, along with the current mode
-# name if it has been set yet.
-func_echo ()
-{
- $ECHO "$progname${mode+: }$mode: $*"
-}
-
-# func_verbose arg...
-# Echo program name prefixed message in verbose mode only.
-func_verbose ()
-{
- $opt_verbose && func_echo ${1+"$@"}
-
- # A bug in bash halts the script if the last line of a function
- # fails when set -e is in force, so we need another command to
- # work around that:
- :
-}
-
-# func_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
- $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
-}
-
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
- $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
-
- # bash bug again:
- :
-}
-
-# func_fatal_error arg...
-# Echo program name prefixed message to standard error, and exit.
-func_fatal_error ()
-{
- func_error ${1+"$@"}
- exit $EXIT_FAILURE
-}
-
-# func_fatal_help arg...
-# Echo program name prefixed message to standard error, followed by
-# a help hint, and exit.
-func_fatal_help ()
-{
- func_error ${1+"$@"}
- func_fatal_error "$help"
-}
-help="Try \`$progname --help' for more information." ## default
-
-
-# func_grep expression filename
-# Check whether EXPRESSION matches any line of FILENAME, without output.
-func_grep ()
-{
- $GREP "$1" "$2" >/dev/null 2>&1
-}
-
-
-# func_mkdir_p directory-path
-# Make sure the entire path to DIRECTORY-PATH is available.
-func_mkdir_p ()
-{
- my_directory_path="$1"
- my_dir_list=
-
- if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
-
- # Protect directory names starting with `-'
- case $my_directory_path in
- -*) my_directory_path="./$my_directory_path" ;;
- esac
-
- # While some portion of DIR does not yet exist...
- while test ! -d "$my_directory_path"; do
- # ...make a list in topmost first order. Use a colon delimited
- # list incase some portion of path contains whitespace.
- my_dir_list="$my_directory_path:$my_dir_list"
-
- # If the last portion added has no slash in it, the list is done
- case $my_directory_path in */*) ;; *) break ;; esac
-
- # ...otherwise throw away the child directory and loop
- my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
- done
- my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
-
- save_mkdir_p_IFS="$IFS"; IFS=':'
- for my_dir in $my_dir_list; do
- IFS="$save_mkdir_p_IFS"
- # mkdir can fail with a `File exist' error if two processes
- # try to create one of the directories concurrently. Don't
- # stop in that case!
- $MKDIR "$my_dir" 2>/dev/null || :
- done
- IFS="$save_mkdir_p_IFS"
-
- # Bail out if we (or some other process) failed to create a directory.
- test -d "$my_directory_path" || \
- func_fatal_error "Failed to create \`$1'"
- fi
-}
-
-
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible. If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
- my_template="${TMPDIR-/tmp}/${1-$progname}"
-
- if test "$opt_dry_run" = ":"; then
- # Return a directory name, but don't create it in dry-run mode
- my_tmpdir="${my_template}-$$"
- else
-
- # If mktemp works, use that first and foremost
- my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
- if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
-
- save_mktempdir_umask=`umask`
- umask 0077
- $MKDIR "$my_tmpdir"
- umask $save_mktempdir_umask
- fi
-
- # If we're not in dry-run mode, bomb out on failure
- test -d "$my_tmpdir" || \
- func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
- fi
-
- $ECHO "X$my_tmpdir" | $Xsed
-}
-
-
-# func_quote_for_eval arg
-# Aesthetically quote ARG to be evaled later.
-# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
-# is double-quoted, suitable for a subsequent eval, whereas
-# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
-# which are still active within double quotes backslashified.
-func_quote_for_eval ()
-{
- case $1 in
- *[\\\`\"\$]*)
- func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
- *)
- func_quote_for_eval_unquoted_result="$1" ;;
- esac
-
- case $func_quote_for_eval_unquoted_result in
- # Double-quote args containing shell metacharacters to delay
- # word splitting, command substitution and and variable
- # expansion for a subsequent eval.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
- ;;
- *)
- func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
- esac
-}
-
-
-# func_quote_for_expand arg
-# Aesthetically quote ARG to be evaled later; same as above,
-# but do not quote variable references.
-func_quote_for_expand ()
-{
- case $1 in
- *[\\\`\"]*)
- my_arg=`$ECHO "X$1" | $Xsed \
- -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
- *)
- my_arg="$1" ;;
- esac
-
- case $my_arg in
- # Double-quote args containing shell metacharacters to delay
- # word splitting and command substitution for a subsequent eval.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- my_arg="\"$my_arg\""
- ;;
- esac
-
- func_quote_for_expand_result="$my_arg"
-}
-
-
-# func_show_eval cmd [fail_exp]
-# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
-# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.
-func_show_eval ()
-{
- my_cmd="$1"
- my_fail_exp="${2-:}"
-
- ${opt_silent-false} || {
- func_quote_for_expand "$my_cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
-
- if ${opt_dry_run-false}; then :; else
- eval "$my_cmd"
- my_status=$?
- if test "$my_status" -eq 0; then :; else
- eval "(exit $my_status); $my_fail_exp"
- fi
- fi
-}
-
-
-# func_show_eval_locale cmd [fail_exp]
-# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
-# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it. Use the saved locale for evaluation.
-func_show_eval_locale ()
-{
- my_cmd="$1"
- my_fail_exp="${2-:}"
-
- ${opt_silent-false} || {
- func_quote_for_expand "$my_cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
-
- if ${opt_dry_run-false}; then :; else
- eval "$lt_user_locale
- $my_cmd"
- my_status=$?
- eval "$lt_safe_locale"
- if test "$my_status" -eq 0; then :; else
- eval "(exit $my_status); $my_fail_exp"
- fi
- fi
-}
-
-
-
-
-
-# func_version
-# Echo version message to standard output and exit.
-func_version ()
-{
- $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
- s/^# //
- s/^# *$//
- s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
- p
- }' < "$progpath"
- exit $?
-}
-
-# func_usage
-# Echo short help message to standard output and exit.
-func_usage ()
-{
- $SED -n '/^# Usage:/,/# -h/ {
- s/^# //
- s/^# *$//
- s/\$progname/'$progname'/
- p
- }' < "$progpath"
- $ECHO
- $ECHO "run \`$progname --help | more' for full usage"
- exit $?
-}
-
-# func_help
-# Echo long help message to standard output and exit.
-func_help ()
-{
- $SED -n '/^# Usage:/,/# Report bugs to/ {
- s/^# //
- s/^# *$//
- s*\$progname*'$progname'*
- s*\$host*'"$host"'*
- s*\$SHELL*'"$SHELL"'*
- s*\$LTCC*'"$LTCC"'*
- s*\$LTCFLAGS*'"$LTCFLAGS"'*
- s*\$LD*'"$LD"'*
- s/\$with_gnu_ld/'"$with_gnu_ld"'/
- s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
- s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
- p
- }' < "$progpath"
- exit $?
-}
-
-# func_missing_arg argname
-# Echo program name prefixed message to standard error and set global
-# exit_cmd.
-func_missing_arg ()
-{
- func_error "missing argument for $1"
- exit_cmd=exit
-}
-
-exit_cmd=:
-
-
-
-
-
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
- # Yippee, $ECHO works!
- :
-else
- # Restart under the correct shell, and then maybe $ECHO will work.
- exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-# Same for EGREP, and just to be sure, do LTCC as well
-if test "x$EGREP" = x ; then
- EGREP=egrep
-fi
-if test "x$LTCC" = x ; then
- LTCC=${CC-gcc}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat </dev/null 2>&1; then
- taglist="$taglist $tagname"
-
- # Evaluate the configuration. Be careful to quote the path
- # and the sed script, to avoid splitting on whitespace, but
- # also don't use non-portable quotes within backquotes within
- # quotes we have to do it in 2 steps:
- extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
- eval "$extractedcf"
- else
- func_error "ignoring unknown tag $tagname"
- fi
- ;;
- esac
-}
-
-# Parse options once, thoroughly. This comes as soon as possible in
-# the script to make things like `libtool --version' happen quickly.
-{
-
- # Shorthand for --mode=foo, only valid as the first argument
- case $1 in
- clean|clea|cle|cl)
- shift; set dummy --mode clean ${1+"$@"}; shift
- ;;
- compile|compil|compi|comp|com|co|c)
- shift; set dummy --mode compile ${1+"$@"}; shift
- ;;
- execute|execut|execu|exec|exe|ex|e)
- shift; set dummy --mode execute ${1+"$@"}; shift
- ;;
- finish|finis|fini|fin|fi|f)
- shift; set dummy --mode finish ${1+"$@"}; shift
- ;;
- install|instal|insta|inst|ins|in|i)
- shift; set dummy --mode install ${1+"$@"}; shift
- ;;
- link|lin|li|l)
- shift; set dummy --mode link ${1+"$@"}; shift
- ;;
- uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
- shift; set dummy --mode uninstall ${1+"$@"}; shift
- ;;
- esac
-
- # Parse non-mode specific arguments:
- while test "$#" -gt 0; do
- opt="$1"
- shift
-
- case $opt in
- --config) func_config ;;
-
- --debug) preserve_args="$preserve_args $opt"
- func_echo "enabling shell trace mode"
- opt_debug='set -x'
- $opt_debug
- ;;
-
- -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
- execute_dlfiles="$execute_dlfiles $1"
- shift
- ;;
-
- --dry-run | -n) opt_dry_run=: ;;
- --features) func_features ;;
- --finish) mode="finish" ;;
-
- --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
- case $1 in
- # Valid mode arguments:
- clean) ;;
- compile) ;;
- execute) ;;
- finish) ;;
- install) ;;
- link) ;;
- relink) ;;
- uninstall) ;;
-
- # Catch anything else as an error
- *) func_error "invalid argument for $opt"
- exit_cmd=exit
- break
- ;;
- esac
-
- mode="$1"
- shift
- ;;
-
- --preserve-dup-deps)
- opt_duplicate_deps=: ;;
-
- --quiet|--silent) preserve_args="$preserve_args $opt"
- opt_silent=:
- ;;
-
- --verbose| -v) preserve_args="$preserve_args $opt"
- opt_silent=false
- ;;
-
- --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
- preserve_args="$preserve_args $opt $1"
- func_enable_tag "$1" # tagname is set here
- shift
- ;;
-
- # Separate optargs to long options:
- -dlopen=*|--mode=*|--tag=*)
- func_opt_split "$opt"
- set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
- shift
- ;;
-
- -\?|-h) func_usage ;;
- --help) opt_help=: ;;
- --version) func_version ;;
-
- -*) func_fatal_help "unrecognized option \`$opt'" ;;
-
- *) nonopt="$opt"
- break
- ;;
- esac
- done
-
-
- case $host in
- *cygwin* | *mingw* | *pw32* | *cegcc*)
- # don't eliminate duplications in $postdeps and $predeps
- opt_duplicate_compiler_generated_deps=:
- ;;
- *)
- opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
- ;;
- esac
-
- # Having warned about all mis-specified options, bail out if
- # anything was wrong.
- $exit_cmd $EXIT_FAILURE
-}
-
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
-{
- if test "$package_revision" != "$macro_revision"; then
- if test "$VERSION" != "$macro_version"; then
- if test -z "$macro_version"; then
- cat >&2 <<_LT_EOF
-$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
- else
- cat >&2 <<_LT_EOF
-$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
- fi
- else
- cat >&2 <<_LT_EOF
-$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
- fi
-
- exit $EXIT_MISMATCH
- fi
-}
-
-
-## ----------- ##
-## Main. ##
-## ----------- ##
-
-$opt_help || {
- # Sanity checks first:
- func_check_version_match
-
- if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- func_fatal_configuration "not configured to build any kind of library"
- fi
-
- test -z "$mode" && func_fatal_error "error: you must specify a MODE."
-
-
- # Darwin sucks
- eval std_shrext=\"$shrext_cmds\"
-
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- func_error "unrecognized option \`-dlopen'"
- $ECHO "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$progname --help --mode=$mode' for more information."
-}
-
-
-# func_lalib_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_lalib_p ()
-{
- test -f "$1" &&
- $SED -e 4q "$1" 2>/dev/null \
- | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
-}
-
-# func_lalib_unsafe_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function implements the same check as func_lalib_p without
-# resorting to external programs. To this end, it redirects stdin and
-# closes it afterwards, without saving the original file descriptor.
-# As a safety measure, use it only where a negative result would be
-# fatal anyway. Works if `file' does not exist.
-func_lalib_unsafe_p ()
-{
- lalib_p=no
- if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
- for lalib_p_l in 1 2 3 4
- do
- read lalib_p_line
- case "$lalib_p_line" in
- \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
- esac
- done
- exec 0<&5 5<&-
- fi
- test "$lalib_p" = yes
-}
-
-# func_ltwrapper_script_p file
-# True iff FILE is a libtool wrapper script
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_script_p ()
-{
- func_lalib_p "$1"
-}
-
-# func_ltwrapper_executable_p file
-# True iff FILE is a libtool wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_executable_p ()
-{
- func_ltwrapper_exec_suffix=
- case $1 in
- *.exe) ;;
- *) func_ltwrapper_exec_suffix=.exe ;;
- esac
- $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
-}
-
-# func_ltwrapper_scriptname file
-# Assumes file is an ltwrapper_executable
-# uses $file to determine the appropriate filename for a
-# temporary ltwrapper_script.
-func_ltwrapper_scriptname ()
-{
- func_ltwrapper_scriptname_result=""
- if func_ltwrapper_executable_p "$1"; then
- func_dirname_and_basename "$1" "" "."
- func_stripname '' '.exe' "$func_basename_result"
- func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
- fi
-}
-
-# func_ltwrapper_p file
-# True iff FILE is a libtool wrapper script or wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_p ()
-{
- func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
-}
-
-
-# func_execute_cmds commands fail_cmd
-# Execute tilde-delimited COMMANDS.
-# If FAIL_CMD is given, eval that upon failure.
-# FAIL_CMD may read-access the current command in variable CMD!
-func_execute_cmds ()
-{
- $opt_debug
- save_ifs=$IFS; IFS='~'
- for cmd in $1; do
- IFS=$save_ifs
- eval cmd=\"$cmd\"
- func_show_eval "$cmd" "${2-:}"
- done
- IFS=$save_ifs
-}
-
-
-# func_source file
-# Source FILE, adding directory component if necessary.
-# Note that it is not necessary on cygwin/mingw to append a dot to
-# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
-# behavior happens only for exec(3), not for open(2)! Also, sourcing
-# `FILE.' does not work on cygwin managed mounts.
-func_source ()
-{
- $opt_debug
- case $1 in
- */* | *\\*) . "$1" ;;
- *) . "./$1" ;;
- esac
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
- $opt_debug
- if test -n "$available_tags" && test -z "$tagname"; then
- CC_quoted=
- for arg in $CC; do
- func_quote_for_eval "$arg"
- CC_quoted="$CC_quoted $func_quote_for_eval_result"
- done
- case $@ in
- # Blanks in the command may have been stripped by the calling shell,
- # but not from the CC environment variable when configure was run.
- " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
- # Blanks at the start of $base_compile will cause this to fail
- # if we don't check for them as well.
- *)
- for z in $available_tags; do
- if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
- # Evaluate the configuration.
- eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
- CC_quoted=
- for arg in $CC; do
- # Double-quote args containing other shell metacharacters.
- func_quote_for_eval "$arg"
- CC_quoted="$CC_quoted $func_quote_for_eval_result"
- done
- case "$@ " in
- " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
- # The compiler in the base compile command matches
- # the one in the tagged configuration.
- # Assume this is the tagged configuration we want.
- tagname=$z
- break
- ;;
- esac
- fi
- done
- # If $tagname still isn't set, then no tagged configuration
- # was found and let the user know that the "--tag" command
- # line option must be used.
- if test -z "$tagname"; then
- func_echo "unable to infer tagged configuration"
- func_fatal_error "specify a tag with \`--tag'"
-# else
-# func_verbose "using $tagname tagged configuration"
- fi
- ;;
- esac
- fi
-}
-
-
-
-# func_write_libtool_object output_name pic_name nonpic_name
-# Create a libtool object file (analogous to a ".la" file),
-# but don't create it if we're doing a dry run.
-func_write_libtool_object ()
-{
- write_libobj=${1}
- if test "$build_libtool_libs" = yes; then
- write_lobj=\'${2}\'
- else
- write_lobj=none
- fi
-
- if test "$build_old_libs" = yes; then
- write_oldobj=\'${3}\'
- else
- write_oldobj=none
- fi
-
- $opt_dry_run || {
- cat >${write_libobj}T <?"'"'"' &()|`$[]' \
- && func_warning "libobj name \`$libobj' may not contain shell special characters."
- func_dirname_and_basename "$obj" "/" ""
- objname="$func_basename_result"
- xdir="$func_dirname_result"
- lobj=${xdir}$objdir/$objname
-
- test -z "$base_compile" && \
- func_fatal_help "you must specify a compilation command"
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- removelist="$obj $lobj $libobj ${libobj}T"
- else
- removelist="$lobj $libobj ${libobj}T"
- fi
-
- # On Cygwin there's no "real" PIC flag so we must build both object types
- case $host_os in
- cygwin* | mingw* | pw32* | os2* | cegcc*)
- pic_mode=default
- ;;
- esac
- if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
- # non-PIC code in shared libraries is not supported
- pic_mode=default
- fi
-
- # Calculate the filename of the output object if compiler does
- # not support -o with -c
- if test "$compiler_c_o" = no; then
- output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
- lockfile="$output_obj.lock"
- else
- output_obj=
- need_locks=no
- lockfile=
- fi
-
- # Lock this critical section if it is needed
- # We use this script file to make the link, it avoids creating a new file
- if test "$need_locks" = yes; then
- until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
- func_echo "Waiting for $lockfile to be removed"
- sleep 2
- done
- elif test "$need_locks" = warn; then
- if test -f "$lockfile"; then
- $ECHO "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $opt_dry_run || $RM $removelist
- exit $EXIT_FAILURE
- fi
- removelist="$removelist $output_obj"
- $ECHO "$srcfile" > "$lockfile"
- fi
-
- $opt_dry_run || $RM $removelist
- removelist="$removelist $lockfile"
- trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
- func_quote_for_eval "$srcfile"
- qsrcfile=$func_quote_for_eval_result
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- if test "$pic_mode" != no; then
- command="$base_compile $qsrcfile $pic_flag"
- else
- # Don't build PIC code
- command="$base_compile $qsrcfile"
- fi
-
- func_mkdir_p "$xdir$objdir"
-
- if test -z "$output_obj"; then
- # Place PIC objects in $objdir
- command="$command -o $lobj"
- fi
-
- func_show_eval_locale "$command" \
- 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $opt_dry_run || $RM $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed, then go on to compile the next one
- if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
- func_show_eval '$MV "$output_obj" "$lobj"' \
- 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
- fi
-
- # Allow error messages only from the first compilation.
- if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
- fi
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- if test "$pic_mode" != yes; then
- # Don't build PIC code
- command="$base_compile $qsrcfile$pie_flag"
- else
- command="$base_compile $qsrcfile $pic_flag"
- fi
- if test "$compiler_c_o" = yes; then
- command="$command -o $obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$command$suppress_output"
- func_show_eval_locale "$command" \
- '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $opt_dry_run || $RM $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed
- if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
- func_show_eval '$MV "$output_obj" "$obj"' \
- 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
- fi
- fi
-
- $opt_dry_run || {
- func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- removelist=$lockfile
- $RM "$lockfile"
- fi
- }
-
- exit $EXIT_SUCCESS
-}
-
-$opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
-}
-
-func_mode_help ()
-{
- # We need to display help for each of the modes.
- case $mode in
- "")
- # Generic help is extracted from the usage comments
- # at the start of this file.
- func_help
- ;;
-
- clean)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
- ;;
-
- compile)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -no-suppress do not suppress compiler output for multiple passes
- -prefer-pic try to building PIC objects only
- -prefer-non-pic try to building non-PIC objects only
- -shared do not build a \`.o' file suitable for static linking
- -static only build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
- execute)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
- finish)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
- install)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The following components of INSTALL-COMMAND are treated specially:
-
- -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
- link)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -export-symbols-regex REGEX
- try to export only the symbols matching REGEX
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-fast-install disable the fast-install mode
- -no-install link a not-installable executable
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -objectlist FILE Use a list of object files found in FILE to specify objects
- -precious-files-regex REGEX
- don't remove output files matching REGEX
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -shared only do dynamic linking of libtool libraries
- -shrext SUFFIX override the standard shared library file extension
- -static do not do any dynamic linking of uninstalled libtool libraries
- -static-libtool-libs
- do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
- -weak LIBNAME declare that the target provides the LIBNAME interface
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
- uninstall)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
- *)
- func_fatal_help "invalid operation mode \`$mode'"
- ;;
- esac
-
- $ECHO
- $ECHO "Try \`$progname --help' for more information about other modes."
-
- exit $?
-}
-
- # Now that we've collected a possible --mode arg, show help if necessary
- $opt_help && func_mode_help
-
-
-# func_mode_execute arg...
-func_mode_execute ()
-{
- $opt_debug
- # The first argument is the command name.
- cmd="$nonopt"
- test -z "$cmd" && \
- func_fatal_help "you must specify a COMMAND"
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- test -f "$file" \
- || func_fatal_help "\`$file' is not a file"
-
- dir=
- case $file in
- *.la)
- # Check to see that this really is a libtool archive.
- func_lalib_unsafe_p "$file" \
- || func_fatal_help "\`$lib' is not a valid libtool archive"
-
- # Read the libtool library.
- dlname=
- library_names=
- func_source "$file"
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && \
- func_warning "\`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- func_dirname "$file" "" "."
- dir="$func_dirname_result"
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- if test ! -f "$dir/$dlname"; then
- func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
- fi
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- func_dirname "$file" "" "."
- dir="$func_dirname_result"
- ;;
-
- *)
- func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case $file in
- -*) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if func_ltwrapper_script_p "$file"; then
- func_source "$file"
- # Transform arg to wrapped name.
- file="$progdir/$program"
- elif func_ltwrapper_executable_p "$file"; then
- func_ltwrapper_scriptname "$file"
- func_source "$func_ltwrapper_scriptname_result"
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- func_quote_for_eval "$file"
- args="$args $func_quote_for_eval_result"
- done
-
- if test "X$opt_dry_run" = Xfalse; then
- if test -n "$shlibpath_var"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
- fi
-
- # Restore saved environment variables
- for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
- do
- eval "if test \"\${save_$lt_var+set}\" = set; then
- $lt_var=\$save_$lt_var; export $lt_var
- else
- $lt_unset $lt_var
- fi"
- done
-
- # Now prepare to actually exec the command.
- exec_cmd="\$cmd$args"
- else
- # Display what would be done.
- if test -n "$shlibpath_var"; then
- eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
- $ECHO "export $shlibpath_var"
- fi
- $ECHO "$cmd$args"
- exit $EXIT_SUCCESS
- fi
-}
-
-test "$mode" = execute && func_mode_execute ${1+"$@"}
-
-
-# func_mode_finish arg...
-func_mode_finish ()
-{
- $opt_debug
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
-'"$cmd"'"'
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $opt_dry_run || eval "$cmds" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- $opt_silent && exit $EXIT_SUCCESS
-
- $ECHO "X----------------------------------------------------------------------" | $Xsed
- $ECHO "Libraries have been installed in:"
- for libdir in $libdirs; do
- $ECHO " $libdir"
- done
- $ECHO
- $ECHO "If you ever happen to want to link against installed libraries"
- $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
- $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
- $ECHO "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
- $ECHO " during execution"
- fi
- if test -n "$runpath_var"; then
- $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
- $ECHO " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- $ECHO " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- $ECHO " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- $ECHO
-
- $ECHO "See any operating system documentation about shared libraries for"
- case $host in
- solaris2.[6789]|solaris2.1[0-9])
- $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
- $ECHO "pages."
- ;;
- *)
- $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
- ;;
- esac
- $ECHO "X----------------------------------------------------------------------" | $Xsed
- exit $EXIT_SUCCESS
-}
-
-test "$mode" = finish && func_mode_finish ${1+"$@"}
-
-
-# func_mode_install arg...
-func_mode_install ()
-{
- $opt_debug
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
- # Allow the use of GNU shtool's install command.
- $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
- # Aesthetically quote it.
- func_quote_for_eval "$nonopt"
- install_prog="$func_quote_for_eval_result "
- arg=$1
- shift
- else
- install_prog=
- arg=$nonopt
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- func_quote_for_eval "$arg"
- install_prog="$install_prog$func_quote_for_eval_result"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest=$arg
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f)
- case " $install_prog " in
- *[\\\ /]cp\ *) ;;
- *) prev=$arg ;;
- esac
- ;;
- -g | -m | -o)
- prev=$arg
- ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*)
- ;;
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest=$arg
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- func_quote_for_eval "$arg"
- install_prog="$install_prog $func_quote_for_eval_result"
- done
-
- test -z "$install_prog" && \
- func_fatal_help "you must specify an install program"
-
- test -n "$prev" && \
- func_fatal_help "the \`$prev' option requires an argument"
-
- if test -z "$files"; then
- if test -z "$dest"; then
- func_fatal_help "no file or destination specified"
- else
- func_fatal_help "you must specify a destination"
- fi
- fi
-
- # Strip any trailing slash from the destination.
- func_stripname '' '/' "$dest"
- dest=$func_stripname_result
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- func_dirname_and_basename "$dest" "" "."
- destdir="$func_dirname_result"
- destname="$func_basename_result"
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files; shift
- test "$#" -gt 1 && \
- func_fatal_help "\`$dest' is not a directory"
- fi
- case $destdir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- for file in $files; do
- case $file in
- *.lo) ;;
- *)
- func_fatal_help "\`$destdir' must be an absolute directory name"
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case $file in
- *.$libext)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- func_lalib_unsafe_p "$file" \
- || func_fatal_help "\`$file' is not a valid libtool archive"
-
- library_names=
- old_library=
- relink_command=
- func_source "$file"
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- func_dirname "$file" "/" ""
- dir="$func_dirname_result"
- dir="$dir$objdir"
-
- if test -n "$relink_command"; then
- # Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
-
- # Don't allow the user to place us outside of our expected
- # location b/c this prevents finding dependent libraries that
- # are installed to the same prefix.
- # At present, this check doesn't affect windows .dll's that
- # are installed into $libdir/../bin (currently, that works fine)
- # but it's something to keep an eye on.
- test "$inst_prefix_dir" = "$destdir" && \
- func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
-
- if test -n "$inst_prefix_dir"; then
- # Stick the inst_prefix_dir data into the link command.
- relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
- else
- relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
- fi
-
- func_warning "relinking \`$file'"
- func_show_eval "$relink_command" \
- 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
- fi
-
- # See the names of the shared library.
- set dummy $library_names; shift
- if test -n "$1"; then
- realname="$1"
- shift
-
- srcname="$realname"
- test -n "$relink_command" && srcname="$realname"T
-
- # Install the shared library and build the symlinks.
- func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
- 'exit $?'
- tstripme="$stripme"
- case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
- case $realname in
- *.dll.a)
- tstripme=""
- ;;
- esac
- ;;
- esac
- if test -n "$tstripme" && test -n "$striplib"; then
- func_show_eval "$striplib $destdir/$realname" 'exit $?'
- fi
-
- if test "$#" -gt 0; then
- # Delete the old symlinks, and create new ones.
- # Try `ln -sf' first, because the `ln' binary might depend on
- # the symlink we replace! Solaris /bin/ln does not understand -f,
- # so we also need to try rm && ln -s.
- for linkname
- do
- test "$linkname" != "$realname" \
- && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
- done
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- func_execute_cmds "$postinstall_cmds" 'exit $?'
- fi
-
- # Install the pseudo-library for information purposes.
- func_basename "$file"
- name="$func_basename_result"
- instname="$dir/$name"i
- func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- func_basename "$file"
- destfile="$func_basename_result"
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case $destfile in
- *.lo)
- func_lo2o "$destfile"
- staticdest=$func_lo2o_result
- ;;
- *.$objext)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- func_fatal_help "cannot copy a libtool object to \`$destfile'"
- ;;
- esac
-
- # Install the libtool object if requested.
- test -n "$destfile" && \
- func_show_eval "$install_prog $file $destfile" 'exit $?'
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- func_lo2o "$file"
- staticobj=$func_lo2o_result
- func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
- fi
- exit $EXIT_SUCCESS
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- func_basename "$file"
- destfile="$func_basename_result"
- destfile="$destdir/$destfile"
- fi
-
- # If the file is missing, and there is a .exe on the end, strip it
- # because it is most likely a libtool script we actually want to
- # install
- stripped_ext=""
- case $file in
- *.exe)
- if test ! -f "$file"; then
- func_stripname '' '.exe' "$file"
- file=$func_stripname_result
- stripped_ext=".exe"
- fi
- ;;
- esac
-
- # Do a test to see if this is really a libtool program.
- case $host in
- *cygwin* | *mingw*)
- if func_ltwrapper_executable_p "$file"; then
- func_ltwrapper_scriptname "$file"
- wrapper=$func_ltwrapper_scriptname_result
- else
- func_stripname '' '.exe' "$file"
- wrapper=$func_stripname_result
- fi
- ;;
- *)
- wrapper=$file
- ;;
- esac
- if func_ltwrapper_script_p "$wrapper"; then
- notinst_deplibs=
- relink_command=
-
- func_source "$wrapper"
-
- # Check the variables that should have been set.
- test -z "$generated_by_libtool_version" && \
- func_fatal_error "invalid libtool wrapper script \`$wrapper'"
-
- finalize=yes
- for lib in $notinst_deplibs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- func_source "$lib"
- fi
- libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
- if test -n "$libdir" && test ! -f "$libfile"; then
- func_warning "\`$lib' has not been installed in \`$libdir'"
- finalize=no
- fi
- done
-
- relink_command=
- func_source "$wrapper"
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- $opt_dry_run || {
- if test "$finalize" = yes; then
- tmpdir=`func_mktempdir`
- func_basename "$file$stripped_ext"
- file="$func_basename_result"
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
- $opt_silent || {
- func_quote_for_expand "$relink_command"
- eval "func_echo $func_quote_for_expand_result"
- }
- if eval "$relink_command"; then :
- else
- func_error "error: relink \`$file' with the above command before installing it"
- $opt_dry_run || ${RM}r "$tmpdir"
- continue
- fi
- file="$outputname"
- else
- func_warning "cannot relink \`$file'"
- fi
- }
- else
- # Install the binary that we compiled earlier.
- file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- # remove .exe since cygwin /usr/bin/install will append another
- # one anyway
- case $install_prog,$host in
- */usr/bin/install*,*cygwin*)
- case $file:$destfile in
- *.exe:*.exe)
- # this is ok
- ;;
- *.exe:*)
- destfile=$destfile.exe
- ;;
- *:*.exe)
- func_stripname '' '.exe' "$destfile"
- destfile=$func_stripname_result
- ;;
- esac
- ;;
- esac
- func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
- $opt_dry_run || if test -n "$outputname"; then
- ${RM}r "$tmpdir"
- fi
- ;;
- esac
- done
-
- for file in $staticlibs; do
- func_basename "$file"
- name="$func_basename_result"
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
-
- if test -n "$stripme" && test -n "$old_striplib"; then
- func_show_eval "$old_striplib $oldlib" 'exit $?'
- fi
-
- # Do each command in the postinstall commands.
- func_execute_cmds "$old_postinstall_cmds" 'exit $?'
- done
-
- test -n "$future_libdirs" && \
- func_warning "remember to run \`$progname --finish$future_libdirs'"
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- $opt_dry_run && current_libdirs=" -n$current_libdirs"
- exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
- else
- exit $EXIT_SUCCESS
- fi
-}
-
-test "$mode" = install && func_mode_install ${1+"$@"}
-
-
-# func_generate_dlsyms outputname originator pic_p
-# Extract symbols from dlprefiles and create ${outputname}S.o with
-# a dlpreopen symbol table.
-func_generate_dlsyms ()
-{
- $opt_debug
- my_outputname="$1"
- my_originator="$2"
- my_pic_p="${3-no}"
- my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
- my_dlsyms=
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- my_dlsyms="${my_outputname}S.c"
- else
- func_error "not configured to extract global symbols from dlpreopened files"
- fi
- fi
-
- if test -n "$my_dlsyms"; then
- case $my_dlsyms in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$output_objdir/${my_outputname}.nm"
-
- func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
-
- # Parse the name list into a source file.
- func_verbose "creating $output_objdir/$my_dlsyms"
-
- $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
-/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
-/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- func_verbose "generating symbol list for \`$output'"
-
- $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for progfile in $progfiles; do
- func_verbose "extracting global C symbols from \`$progfile'"
- $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $opt_dry_run || {
- eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- eval '$MV "$nlist"T "$nlist"'
- }
- fi
-
- if test -n "$export_symbols_regex"; then
- $opt_dry_run || {
- eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- eval '$MV "$nlist"T "$nlist"'
- }
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$outputname.exp"
- $opt_dry_run || {
- $RM $export_symbols
- eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- }
- else
- $opt_dry_run || {
- eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
- eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
- eval '$MV "$nlist"T "$nlist"'
- case $host in
- *cygwin | *mingw* | *cegcc* )
- eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- }
- fi
- fi
-
- for dlprefile in $dlprefiles; do
- func_verbose "extracting global C symbols from \`$dlprefile'"
- func_basename "$dlprefile"
- name="$func_basename_result"
- $opt_dry_run || {
- eval '$ECHO ": $name " >> "$nlist"'
- eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
- }
- done
-
- $opt_dry_run || {
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $MV "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if $GREP -v "^: " < "$nlist" |
- if sort -k 3 /dev/null 2>&1; then
- sort -k 3
- else
- sort +2
- fi |
- uniq > "$nlist"S; then
- :
- else
- $GREP -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
- else
- $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
- fi
-
- $ECHO >> "$output_objdir/$my_dlsyms" "\
-
-/* The mapping between symbol names and symbols. */
-typedef struct {
- const char *name;
- void *address;
-} lt_dlsymlist;
-"
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- $ECHO >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
- runtime relocations are performed -- see ld's documentation
- on pseudo-relocs. */"
- lt_dlsym_const= ;;
- *osf5*)
- echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
- lt_dlsym_const= ;;
- *)
- lt_dlsym_const=const ;;
- esac
-
- $ECHO >> "$output_objdir/$my_dlsyms" "\
-extern $lt_dlsym_const lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[];
-$lt_dlsym_const lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[] =
-{\
- { \"$my_originator\", (void *) 0 },"
-
- case $need_lib_prefix in
- no)
- eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
- ;;
- *)
- eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
- ;;
- esac
- $ECHO >> "$output_objdir/$my_dlsyms" "\
- {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_${my_prefix}_LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- } # !$opt_dry_run
-
- pic_flag_for_symtable=
- case "$compile_command " in
- *" -static "*) ;;
- *)
- case $host in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
- pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
- *-*-hpux*)
- pic_flag_for_symtable=" $pic_flag" ;;
- *)
- if test "X$my_pic_p" != Xno; then
- pic_flag_for_symtable=" $pic_flag"
- fi
- ;;
- esac
- ;;
- esac
- symtab_cflags=
- for arg in $LTCFLAGS; do
- case $arg in
- -pie | -fpie | -fPIE) ;;
- *) symtab_cflags="$symtab_cflags $arg" ;;
- esac
- done
-
- # Now compile the dynamic symbol file.
- func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
-
- # Clean up the generated files.
- func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
-
- # Transform the symbol file into the correct name.
- symfileobj="$output_objdir/${my_outputname}S.$objext"
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- if test -f "$output_objdir/$my_outputname.def"; then
- compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
- else
- compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
- fi
- ;;
- *)
- compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
- ;;
- esac
- ;;
- *)
- func_fatal_error "unknown suffix for \`$my_dlsyms'"
- ;;
- esac
- else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
- fi
-}
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid ()
-{
- $opt_debug
- win32_libid_type="unknown"
- win32_fileres=`file -L $1 2>/dev/null`
- case $win32_fileres in
- *ar\ archive\ import\ library*) # definitely import
- win32_libid_type="x86 archive import"
- ;;
- *ar\ archive*) # could be an import, or static
- if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
- $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
- win32_nmres=`eval $NM -f posix -A $1 |
- $SED -n -e '
- 1,100{
- / I /{
- s,.*,import,
- p
- q
- }
- }'`
- case $win32_nmres in
- import*) win32_libid_type="x86 archive import";;
- *) win32_libid_type="x86 archive static";;
- esac
- fi
- ;;
- *DLL*)
- win32_libid_type="x86 DLL"
- ;;
- *executable*) # but shell scripts are "executable" too...
- case $win32_fileres in
- *MS\ Windows\ PE\ Intel*)
- win32_libid_type="x86 DLL"
- ;;
- esac
- ;;
- esac
- $ECHO "$win32_libid_type"
-}
-
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
- $opt_debug
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
- func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
- if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
- fi
-}
-
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
- $opt_debug
- my_gentop="$1"; shift
- my_oldlibs=${1+"$@"}
- my_oldobjs=""
- my_xlib=""
- my_xabs=""
- my_xdir=""
-
- for my_xlib in $my_oldlibs; do
- # Extract the objects.
- case $my_xlib in
- [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
- *) my_xabs=`pwd`"/$my_xlib" ;;
- esac
- func_basename "$my_xlib"
- my_xlib="$func_basename_result"
- my_xlib_u=$my_xlib
- while :; do
- case " $extracted_archives " in
- *" $my_xlib_u "*)
- func_arith $extracted_serial + 1
- extracted_serial=$func_arith_result
- my_xlib_u=lt$extracted_serial-$my_xlib ;;
- *) break ;;
- esac
- done
- extracted_archives="$extracted_archives $my_xlib_u"
- my_xdir="$my_gentop/$my_xlib_u"
-
- func_mkdir_p "$my_xdir"
-
- case $host in
- *-darwin*)
- func_verbose "Extracting $my_xabs"
- # Do not bother doing anything if just a dry run
- $opt_dry_run || {
- darwin_orig_dir=`pwd`
- cd $my_xdir || exit $?
- darwin_archive=$my_xabs
- darwin_curdir=`pwd`
- darwin_base_archive=`basename "$darwin_archive"`
- darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
- if test -n "$darwin_arches"; then
- darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
- darwin_arch=
- func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
- for darwin_arch in $darwin_arches ; do
- func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
- cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- func_extract_an_archive "`pwd`" "${darwin_base_archive}"
- cd "$darwin_curdir"
- $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
- done # $darwin_arches
- ## Okay now we've a bunch of thin objects, gotta fatten them up :)
- darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
- darwin_file=
- darwin_files=
- for darwin_file in $darwin_filelist; do
- darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
- $LIPO -create -output "$darwin_file" $darwin_files
- done # $darwin_filelist
- $RM -rf unfat-$$
- cd "$darwin_orig_dir"
- else
- cd $darwin_orig_dir
- func_extract_an_archive "$my_xdir" "$my_xabs"
- fi # $darwin_arches
- } # !$opt_dry_run
- ;;
- *)
- func_extract_an_archive "$my_xdir" "$my_xabs"
- ;;
- esac
- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
-
- func_extract_archives_result="$my_oldobjs"
-}
-
-
-
-# func_emit_wrapper_part1 [arg=no]
-#
-# Emit the first part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part1 ()
-{
- func_emit_wrapper_part1_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_part1_arg1=$1
- fi
-
- $ECHO "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible
-if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '\${1+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variables:
- generated_by_libtool_version='$macro_version'
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$ECHO are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- ECHO=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$ECHO works!
- :
- else
- # Restart under the correct shell, and then maybe \$ECHO will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $ECHO "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
- done
-"
-}
-# end: func_emit_wrapper_part1
-
-# func_emit_wrapper_part2 [arg=no]
-#
-# Emit the second part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part2 ()
-{
- func_emit_wrapper_part2_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_part2_arg1=$1
- fi
-
- $ECHO "\
-
- # Usually 'no', except on cygwin/mingw when embedded into
- # the cwrapper.
- WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
- if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
- # special case for '.'
- if test \"\$thisdir\" = \".\"; then
- thisdir=\`pwd\`
- fi
- # remove .libs from thisdir
- case \"\$thisdir\" in
- *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
- $objdir ) thisdir=. ;;
- esac
- fi
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- $ECHO "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" ||
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $MKDIR \"\$progdir\"
- else
- $RM \"\$progdir/\$file\"
- fi"
-
- $ECHO "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
- else
- $ECHO \"\$relink_command_output\" >&2
- $RM \"\$progdir/\$file\"
- exit 1
- fi
- fi
-
- $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $RM \"\$progdir/\$program\";
- $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $RM \"\$progdir/\$file\"
- fi"
- else
- $ECHO "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- $ECHO "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $ECHO "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $ECHO "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $ECHO "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2* | *-cegcc*)
- $ECHO "\
- exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
- ;;
-
- *)
- $ECHO "\
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
- ;;
- esac
- $ECHO "\
- \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
- exit 1
- fi
- else
- # The program doesn't exist.
- \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
- \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
- $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
- exit 1
- fi
-fi\
-"
-}
-# end: func_emit_wrapper_part2
-
-
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable. Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take. If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory. This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
- func_emit_wrapper_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_arg1=$1
- fi
-
- # split this up so that func_emit_cwrapperexe_src
- # can call each part independently.
- func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
- func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
-}
-
-
-# func_to_host_path arg
-#
-# Convert paths to host format when used with build tools.
-# Intended for use with "native" mingw (where libtool itself
-# is running under the msys shell), or in the following cross-
-# build environments:
-# $build $host
-# mingw (msys) mingw [e.g. native]
-# cygwin mingw
-# *nix + wine mingw
-# where wine is equipped with the `winepath' executable.
-# In the native mingw case, the (msys) shell automatically
-# converts paths for any non-msys applications it launches,
-# but that facility isn't available from inside the cwrapper.
-# Similar accommodations are necessary for $host mingw and
-# $build cygwin. Calling this function does no harm for other
-# $host/$build combinations not listed above.
-#
-# ARG is the path (on $build) that should be converted to
-# the proper representation for $host. The result is stored
-# in $func_to_host_path_result.
-func_to_host_path ()
-{
- func_to_host_path_result="$1"
- if test -n "$1" ; then
- case $host in
- *mingw* )
- lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
- case $build in
- *mingw* ) # actually, msys
- # awkward: cmd appends spaces to result
- lt_sed_strip_trailing_spaces="s/[ ]*\$//"
- func_to_host_path_tmp1=`( cmd //c echo "$1" |\
- $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
- func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- *cygwin* )
- func_to_host_path_tmp1=`cygpath -w "$1"`
- func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- * )
- # Unfortunately, winepath does not exit with a non-zero
- # error code, so we are forced to check the contents of
- # stdout. On the other hand, if the command is not
- # found, the shell will set an exit code of 127 and print
- # *an error message* to stdout. So we must check for both
- # error code of zero AND non-empty stdout, which explains
- # the odd construction:
- func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
- if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
- func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
- else
- # Allow warning below.
- func_to_host_path_result=""
- fi
- ;;
- esac
- if test -z "$func_to_host_path_result" ; then
- func_error "Could not determine host path corresponding to"
- func_error " '$1'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback:
- func_to_host_path_result="$1"
- fi
- ;;
- esac
- fi
-}
-# end: func_to_host_path
-
-# func_to_host_pathlist arg
-#
-# Convert pathlists to host format when used with build tools.
-# See func_to_host_path(), above. This function supports the
-# following $build/$host combinations (but does no harm for
-# combinations not listed here):
-# $build $host
-# mingw (msys) mingw [e.g. native]
-# cygwin mingw
-# *nix + wine mingw
-#
-# Path separators are also converted from $build format to
-# $host format. If ARG begins or ends with a path separator
-# character, it is preserved (but converted to $host format)
-# on output.
-#
-# ARG is a pathlist (on $build) that should be converted to
-# the proper representation on $host. The result is stored
-# in $func_to_host_pathlist_result.
-func_to_host_pathlist ()
-{
- func_to_host_pathlist_result="$1"
- if test -n "$1" ; then
- case $host in
- *mingw* )
- lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
- # Remove leading and trailing path separator characters from
- # ARG. msys behavior is inconsistent here, cygpath turns them
- # into '.;' and ';.', and winepath ignores them completely.
- func_to_host_pathlist_tmp2="$1"
- # Once set for this call, this variable should not be
- # reassigned. It is used in tha fallback case.
- func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e 's|^:*||' -e 's|:*$||'`
- case $build in
- *mingw* ) # Actually, msys.
- # Awkward: cmd appends spaces to result.
- lt_sed_strip_trailing_spaces="s/[ ]*\$//"
- func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
- $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- *cygwin* )
- func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- * )
- # unfortunately, winepath doesn't convert pathlists
- func_to_host_pathlist_result=""
- func_to_host_pathlist_oldIFS=$IFS
- IFS=:
- for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
- IFS=$func_to_host_pathlist_oldIFS
- if test -n "$func_to_host_pathlist_f" ; then
- func_to_host_path "$func_to_host_pathlist_f"
- if test -n "$func_to_host_path_result" ; then
- if test -z "$func_to_host_pathlist_result" ; then
- func_to_host_pathlist_result="$func_to_host_path_result"
- else
- func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
- fi
- fi
- fi
- IFS=:
- done
- IFS=$func_to_host_pathlist_oldIFS
- ;;
- esac
- if test -z "$func_to_host_pathlist_result" ; then
- func_error "Could not determine the host path(s) corresponding to"
- func_error " '$1'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback. This may break if $1 contains DOS-style drive
- # specifications. The fix is not to complicate the expression
- # below, but for the user to provide a working wine installation
- # with winepath so that path translation in the cross-to-mingw
- # case works properly.
- lt_replace_pathsep_nix_to_dos="s|:|;|g"
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
- $SED -e "$lt_replace_pathsep_nix_to_dos"`
- fi
- # Now, add the leading and trailing path separators back
- case "$1" in
- :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
- ;;
- esac
- case "$1" in
- *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
- ;;
- esac
- ;;
- esac
- fi
-}
-# end: func_to_host_pathlist
-
-# func_emit_cwrapperexe_src
-# emit the source code for a wrapper executable on stdout
-# Must ONLY be called from within func_mode_link because
-# it depends on a number of variable set therein.
-func_emit_cwrapperexe_src ()
-{
- cat <
-#include
-#ifdef _MSC_VER
-# include
-# include
-# include
-# define setmode _setmode
-#else
-# include
-# include
-# ifdef __CYGWIN__
-# include
-# define HAVE_SETENV
-# ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-# endif
-# endif
-#endif
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef S_IXOTH
-# define S_IXOTH 0
-#endif
-#ifndef S_IXGRP
-# define S_IXGRP 0
-#endif
-
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-# define intptr_t int
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
- defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# define FOPEN_WB "wb"
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-# define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
-#ifndef FOPEN_WB
-# define FOPEN_WB "w"
-#endif
-#ifndef _O_BINARY
-# define _O_BINARY 0
-#endif
-
-#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
- if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
- va_list args;
- va_start (args, fmt);
- (void) vfprintf (stderr, fmt, args);
- va_end (args);
-}
-#else
-# define LTWRAPPER_DEBUGPRINTF(args)
-#endif
-
-const char *program_name = NULL;
-
-void *xmalloc (size_t num);
-char *xstrdup (const char *string);
-const char *base_name (const char *name);
-char *find_executable (const char *wrapper);
-char *chase_symlinks (const char *pathspec);
-int make_executable (const char *path);
-int check_executable (const char *path);
-char *strendzap (char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-void lt_setenv (const char *name, const char *value);
-char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_opt_process_env_set (const char *arg);
-void lt_opt_process_env_prepend (const char *arg);
-void lt_opt_process_env_append (const char *arg);
-int lt_split_name_value (const char *arg, char** name, char** value);
-void lt_update_exe_path (const char *name, const char *value);
-void lt_update_lib_path (const char *name, const char *value);
-
-static const char *script_text_part1 =
-EOF
-
- func_emit_wrapper_part1 yes |
- $SED -e 's/\([\\"]\)/\\\1/g' \
- -e 's/^/ "/' -e 's/$/\\n"/'
- echo ";"
- cat <")));
- for (i = 0; i < newargc; i++)
- {
- LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "")));
- }
-
-EOF
-
- case $host_os in
- mingw*)
- cat <<"EOF"
- /* execv doesn't actually work on mingw as expected on unix */
- rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
- if (rval == -1)
- {
- /* failed to start process */
- LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
- return 127;
- }
- return rval;
-EOF
- ;;
- *)
- cat <<"EOF"
- execv (lt_argv_zero, newargz);
- return rval; /* =127, but avoids unused variable warning */
-EOF
- ;;
- esac
-
- cat <<"EOF"
-}
-
-void *
-xmalloc (size_t num)
-{
- void *p = (void *) malloc (num);
- if (!p)
- lt_fatal ("Memory exhausted");
-
- return p;
-}
-
-char *
-xstrdup (const char *string)
-{
- return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
- string) : NULL;
-}
-
-const char *
-base_name (const char *name)
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (isalpha ((unsigned char) name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
- return base;
-}
-
-int
-check_executable (const char *path)
-{
- struct stat st;
-
- LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
- path ? (*path ? path : "EMPTY!") : "NULL!"));
- if ((!path) || (!*path))
- return 0;
-
- if ((stat (path, &st) >= 0)
- && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
- return 1;
- else
- return 0;
-}
-
-int
-make_executable (const char *path)
-{
- int rval = 0;
- struct stat st;
-
- LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
- path ? (*path ? path : "EMPTY!") : "NULL!"));
- if ((!path) || (!*path))
- return 0;
-
- if (stat (path, &st) >= 0)
- {
- rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
- }
- return rval;
-}
-
-/* Searches for the full path of the wrapper. Returns
- newly allocated full path name if found, NULL otherwise
- Does not chase symlinks, even on platforms that support them.
-*/
-char *
-find_executable (const char *wrapper)
-{
- int has_slash = 0;
- const char *p;
- const char *p_next;
- /* static buffer for getcwd */
- char tmp[LT_PATHMAX + 1];
- int tmp_len;
- char *concat_name;
-
- LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
- wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
-
- if ((wrapper == NULL) || (*wrapper == '\0'))
- return NULL;
-
- /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
- {
- concat_name = xstrdup (wrapper);
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- }
- else
- {
-#endif
- if (IS_DIR_SEPARATOR (wrapper[0]))
- {
- concat_name = xstrdup (wrapper);
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- }
-#endif
-
- for (p = wrapper; *p; p++)
- if (*p == '/')
- {
- has_slash = 1;
- break;
- }
- if (!has_slash)
- {
- /* no slashes; search PATH */
- const char *path = getenv ("PATH");
- if (path != NULL)
- {
- for (p = path; *p; p = p_next)
- {
- const char *q;
- size_t p_len;
- for (q = p; *q; q++)
- if (IS_PATH_SEPARATOR (*q))
- break;
- p_len = q - p;
- p_next = (*q == '\0' ? q : q + 1);
- if (p_len == 0)
- {
- /* empty path: current directory */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- tmp_len = strlen (tmp);
- concat_name =
- XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
- }
- else
- {
- concat_name =
- XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
- memcpy (concat_name, p, p_len);
- concat_name[p_len] = '/';
- strcpy (concat_name + p_len + 1, wrapper);
- }
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- }
- }
- /* not found in PATH; assume curdir */
- }
- /* Relative path | not found in path: prepend cwd */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- tmp_len = strlen (tmp);
- concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
-
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- return NULL;
-}
-
-char *
-chase_symlinks (const char *pathspec)
-{
-#ifndef S_ISLNK
- return xstrdup (pathspec);
-#else
- char buf[LT_PATHMAX];
- struct stat s;
- char *tmp_pathspec = xstrdup (pathspec);
- char *p;
- int has_symlinks = 0;
- while (strlen (tmp_pathspec) && !has_symlinks)
- {
- LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
- tmp_pathspec));
- if (lstat (tmp_pathspec, &s) == 0)
- {
- if (S_ISLNK (s.st_mode) != 0)
- {
- has_symlinks = 1;
- break;
- }
-
- /* search backwards for last DIR_SEPARATOR */
- p = tmp_pathspec + strlen (tmp_pathspec) - 1;
- while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
- p--;
- if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
- {
- /* no more DIR_SEPARATORS left */
- break;
- }
- *p = '\0';
- }
- else
- {
- char *errstr = strerror (errno);
- lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
- }
- }
- XFREE (tmp_pathspec);
-
- if (!has_symlinks)
- {
- return xstrdup (pathspec);
- }
-
- tmp_pathspec = realpath (pathspec, buf);
- if (tmp_pathspec == 0)
- {
- lt_fatal ("Could not follow symlinks for %s", pathspec);
- }
- return xstrdup (tmp_pathspec);
-#endif
-}
-
-char *
-strendzap (char *str, const char *pat)
-{
- size_t len, patlen;
-
- assert (str != NULL);
- assert (pat != NULL);
-
- len = strlen (str);
- patlen = strlen (pat);
-
- if (patlen <= len)
- {
- str += len - patlen;
- if (strcmp (str, pat) == 0)
- *str = '\0';
- }
- return str;
-}
-
-static void
-lt_error_core (int exit_status, const char *mode,
- const char *message, va_list ap)
-{
- fprintf (stderr, "%s: %s: ", program_name, mode);
- vfprintf (stderr, message, ap);
- fprintf (stderr, ".\n");
-
- if (exit_status >= 0)
- exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
- va_list ap;
- va_start (ap, message);
- lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
- va_end (ap);
-}
-
-void
-lt_setenv (const char *name, const char *value)
-{
- LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
- (name ? name : ""),
- (value ? value : "")));
- {
-#ifdef HAVE_SETENV
- /* always make a copy, for consistency with !HAVE_SETENV */
- char *str = xstrdup (value);
- setenv (name, str, 1);
-#else
- int len = strlen (name) + 1 + strlen (value) + 1;
- char *str = XMALLOC (char, len);
- sprintf (str, "%s=%s", name, value);
- if (putenv (str) != EXIT_SUCCESS)
- {
- XFREE (str);
- }
-#endif
- }
-}
-
-char *
-lt_extend_str (const char *orig_value, const char *add, int to_end)
-{
- char *new_value;
- if (orig_value && *orig_value)
- {
- int orig_value_len = strlen (orig_value);
- int add_len = strlen (add);
- new_value = XMALLOC (char, add_len + orig_value_len + 1);
- if (to_end)
- {
- strcpy (new_value, orig_value);
- strcpy (new_value + orig_value_len, add);
- }
- else
- {
- strcpy (new_value, add);
- strcpy (new_value + add_len, orig_value);
- }
- }
- else
- {
- new_value = xstrdup (add);
- }
- return new_value;
-}
-
-int
-lt_split_name_value (const char *arg, char** name, char** value)
-{
- const char *p;
- int len;
- if (!arg || !*arg)
- return 1;
-
- p = strchr (arg, (int)'=');
-
- if (!p)
- return 1;
-
- *value = xstrdup (++p);
-
- len = strlen (arg) - strlen (*value);
- *name = XMALLOC (char, len);
- strncpy (*name, arg, len-1);
- (*name)[len - 1] = '\0';
-
- return 0;
-}
-
-void
-lt_opt_process_env_set (const char *arg)
-{
- char *name = NULL;
- char *value = NULL;
-
- if (lt_split_name_value (arg, &name, &value) != 0)
- {
- XFREE (name);
- XFREE (value);
- lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
- }
-
- lt_setenv (name, value);
- XFREE (name);
- XFREE (value);
-}
-
-void
-lt_opt_process_env_prepend (const char *arg)
-{
- char *name = NULL;
- char *value = NULL;
- char *new_value = NULL;
-
- if (lt_split_name_value (arg, &name, &value) != 0)
- {
- XFREE (name);
- XFREE (value);
- lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
- }
-
- new_value = lt_extend_str (getenv (name), value, 0);
- lt_setenv (name, new_value);
- XFREE (new_value);
- XFREE (name);
- XFREE (value);
-}
-
-void
-lt_opt_process_env_append (const char *arg)
-{
- char *name = NULL;
- char *value = NULL;
- char *new_value = NULL;
-
- if (lt_split_name_value (arg, &name, &value) != 0)
- {
- XFREE (name);
- XFREE (value);
- lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
- }
-
- new_value = lt_extend_str (getenv (name), value, 1);
- lt_setenv (name, new_value);
- XFREE (new_value);
- XFREE (name);
- XFREE (value);
-}
-
-void
-lt_update_exe_path (const char *name, const char *value)
-{
- LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
- (name ? name : ""),
- (value ? value : "")));
-
- if (name && *name && value && *value)
- {
- char *new_value = lt_extend_str (getenv (name), value, 0);
- /* some systems can't cope with a ':'-terminated path #' */
- int len = strlen (new_value);
- while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
- {
- new_value[len-1] = '\0';
- }
- lt_setenv (name, new_value);
- XFREE (new_value);
- }
-}
-
-void
-lt_update_lib_path (const char *name, const char *value)
-{
- LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
- (name ? name : ""),
- (value ? value : "")));
-
- if (name && *name && value && *value)
- {
- char *new_value = lt_extend_str (getenv (name), value, 0);
- lt_setenv (name, new_value);
- XFREE (new_value);
- }
-}
-
-
-EOF
-}
-# end: func_emit_cwrapperexe_src
-
-# func_mode_link arg...
-func_mode_link ()
-{
- $opt_debug
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
- # It is impossible to link a dll without this setting, and
- # we shouldn't force the makefile maintainer to figure out
- # which system we are compiling for in order to pass an extra
- # flag for every libtool invocation.
- # allow_undefined=no
-
- # FIXME: Unfortunately, there are problems with the above when trying
- # to make a dll which has undefined symbols, in which case not
- # even a static library is built. For now, we need to specify
- # -no-undefined on the libtool link line when we can be certain
- # that all symbols are satisfied, otherwise we get a static library.
- allow_undefined=yes
- ;;
- *)
- allow_undefined=yes
- ;;
- esac
- libtool_args=$nonopt
- base_compile="$nonopt $@"
- compile_command=$nonopt
- finalize_command=$nonopt
-
- compile_rpath=
- finalize_rpath=
- compile_shlibpath=
- finalize_shlibpath=
- convenience=
- old_convenience=
- deplibs=
- old_deplibs=
- compiler_flags=
- linker_flags=
- dllsearchpath=
- lib_search_path=`pwd`
- inst_prefix_dir=
- new_inherited_linker_flags=
-
- avoid_version=no
- dlfiles=
- dlprefiles=
- dlself=no
- export_dynamic=no
- export_symbols=
- export_symbols_regex=
- generated=
- libobjs=
- ltlibs=
- module=no
- no_install=no
- objs=
- non_pic_objects=
- precious_files_regex=
- prefer_static_libs=no
- preload=no
- prev=
- prevarg=
- release=
- rpath=
- xrpath=
- perm_rpath=
- temp_rpath=
- thread_safe=no
- vinfo=
- vinfo_number=no
- weak_libs=
- single_module="${wl}-single_module"
- func_infer_tag $base_compile
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case $arg in
- -shared)
- test "$build_libtool_libs" != yes && \
- func_fatal_configuration "can not build a shared library"
- build_old_libs=no
- break
- ;;
- -all-static | -static | -static-libtool-libs)
- case $arg in
- -all-static)
- if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- func_warning "complete static linking is impossible in this configuration"
- fi
- if test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=yes
- ;;
- -static)
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=built
- ;;
- -static-libtool-libs)
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=yes
- ;;
- esac
- build_libtool_libs=no
- build_old_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- while test "$#" -gt 0; do
- arg="$1"
- shift
- func_quote_for_eval "$arg"
- qarg=$func_quote_for_eval_unquoted_result
- func_append libtool_args " $func_quote_for_eval_result"
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- output)
- func_append compile_command " @OUTPUT@"
- func_append finalize_command " @OUTPUT@"
- ;;
- esac
-
- case $prev in
- dlfiles|dlprefiles)
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- func_append compile_command " @SYMFILE@"
- func_append finalize_command " @SYMFILE@"
- preload=yes
- fi
- case $arg in
- *.la | *.lo) ;; # We handle these cases below.
- force)
- if test "$dlself" = no; then
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- self)
- if test "$prev" = dlprefiles; then
- dlself=yes
- elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
- dlself=yes
- else
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- *)
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- else
- dlprefiles="$dlprefiles $arg"
- fi
- prev=
- continue
- ;;
- esac
- ;;
- expsyms)
- export_symbols="$arg"
- test -f "$arg" \
- || func_fatal_error "symbol file \`$arg' does not exist"
- prev=
- continue
- ;;
- expsyms_regex)
- export_symbols_regex="$arg"
- prev=
- continue
- ;;
- framework)
- case $host in
- *-*-darwin*)
- case "$deplibs " in
- *" $qarg.ltframework "*) ;;
- *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
- ;;
- esac
- ;;
- esac
- prev=
- continue
- ;;
- inst_prefix)
- inst_prefix_dir="$arg"
- prev=
- continue
- ;;
- objectlist)
- if test -f "$arg"; then
- save_arg=$arg
- moreargs=
- for fil in `cat "$save_arg"`
- do
-# moreargs="$moreargs $fil"
- arg=$fil
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if func_lalib_unsafe_p "$arg"; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- func_source "$arg"
-
- if test -z "$pic_object" ||
- test -z "$non_pic_object" ||
- test "$pic_object" = none &&
- test "$non_pic_object" = none; then
- func_fatal_error "cannot find name of object for \`$arg'"
- fi
-
- # Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- func_append libobjs " $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- func_append non_pic_objects " $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- func_append non_pic_objects " $non_pic_object"
- fi
- else
- # Only an error if not doing a dry-run.
- if $opt_dry_run; then
- # Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
-
- func_lo2o "$arg"
- pic_object=$xdir$objdir/$func_lo2o_result
- non_pic_object=$xdir$func_lo2o_result
- func_append libobjs " $pic_object"
- func_append non_pic_objects " $non_pic_object"
- else
- func_fatal_error "\`$arg' is not a valid libtool object"
- fi
- fi
- done
- else
- func_fatal_error "link input file \`$arg' does not exist"
- fi
- arg=$save_arg
- prev=
- continue
- ;;
- precious_regex)
- precious_files_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
- rpath | xrpath)
- # We need an absolute path.
- case $arg in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- func_fatal_error "only absolute run-paths are allowed"
- ;;
- esac
- if test "$prev" = rpath; then
- case "$rpath " in
- *" $arg "*) ;;
- *) rpath="$rpath $arg" ;;
- esac
- else
- case "$xrpath " in
- *" $arg "*) ;;
- *) xrpath="$xrpath $arg" ;;
- esac
- fi
- prev=
- continue
- ;;
- shrext)
- shrext_cmds="$arg"
- prev=
- continue
- ;;
- weak)
- weak_libs="$weak_libs $arg"
- prev=
- continue
- ;;
- xcclinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $qarg"
- prev=
- func_append compile_command " $qarg"
- func_append finalize_command " $qarg"
- continue
- ;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
- prev=
- func_append compile_command " $qarg"
- func_append finalize_command " $qarg"
- continue
- ;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
- prev=
- func_append compile_command " $wl$qarg"
- func_append finalize_command " $wl$qarg"
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi # test -n "$prev"
-
- prevarg="$arg"
-
- case $arg in
- -all-static)
- if test -n "$link_static_flag"; then
- # See comment for -static flag below, for more details.
- func_append compile_command " $link_static_flag"
- func_append finalize_command " $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- # FIXME: remove this flag sometime in the future.
- func_fatal_error "\`-allow-undefined' must not be used because it is the default"
- ;;
-
- -avoid-version)
- avoid_version=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- export_dynamic=yes
- continue
- ;;
-
- -export-symbols | -export-symbols-regex)
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- func_fatal_error "more than one -exported-symbols argument is not allowed"
- fi
- if test "X$arg" = "X-export-symbols"; then
- prev=expsyms
- else
- prev=expsyms_regex
- fi
- continue
- ;;
-
- -framework)
- prev=framework
- continue
- ;;
-
- -inst-prefix-dir)
- prev=inst_prefix
- continue
- ;;
-
- # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
- # so, if we see these flags be careful not to treat them like -L
- -L[A-Z][A-Z]*:*)
- case $with_gcc/$host in
- no/*-*-irix* | /*-*-irix*)
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- ;;
- esac
- continue
- ;;
-
- -L*)
- func_stripname '-L' '' "$arg"
- dir=$func_stripname_result
- if test -z "$dir"; then
- if test "$#" -gt 0; then
- func_fatal_error "require no space between \`-L' and \`$1'"
- else
- func_fatal_error "need path for \`-L' option"
- fi
- fi
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- test -z "$absdir" && \
- func_fatal_error "cannot determine absolute directory name of \`$dir'"
- dir="$absdir"
- ;;
- esac
- case "$deplibs " in
- *" -L$dir "*) ;;
- *)
- deplibs="$deplibs -L$dir"
- lib_search_path="$lib_search_path $dir"
- ;;
- esac
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
- testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
- case :$dllsearchpath: in
- *":$dir:"*) ;;
- ::) dllsearchpath=$dir;;
- *) dllsearchpath="$dllsearchpath:$dir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- ::) dllsearchpath=$testbindir;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
- ;;
- esac
- continue
- ;;
-
- -l*)
- if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
- # These systems don't actually have a C or math library (as such)
- continue
- ;;
- *-*-os2*)
- # These systems don't actually have a C library (as such)
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc due to us having libc/libc_r.
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C and math libraries are in the System framework
- deplibs="$deplibs System.ltframework"
- continue
- ;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- test "X$arg" = "X-lc" && continue
- ;;
- esac
- elif test "X$arg" = "X-lc_r"; then
- case $host in
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc_r directly, use -pthread flag.
- continue
- ;;
- esac
- fi
- deplibs="$deplibs $arg"
- continue
- ;;
-
- -module)
- module=yes
- continue
- ;;
-
- # Tru64 UNIX uses -model [arg] to determine the layout of C++
- # classes, name mangling, and exception handling.
- # Darwin uses the -arch flag to determine output architecture.
- -model|-arch|-isysroot)
- compiler_flags="$compiler_flags $arg"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- prev=xcompiler
- continue
- ;;
-
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
- compiler_flags="$compiler_flags $arg"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- case "$new_inherited_linker_flags " in
- *" $arg "*) ;;
- * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
- esac
- continue
- ;;
-
- -multi_module)
- single_module="${wl}-multi_module"
- continue
- ;;
-
- -no-fast-install)
- fast_install=no
- continue
- ;;
-
- -no-install)
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
- # The PATH hackery in wrapper scripts is required on Windows
- # and Darwin in order for the loader to find any dlls it needs.
- func_warning "\`-no-install' is ignored for $host"
- func_warning "assuming \`-no-fast-install' instead"
- fast_install=no
- ;;
- *) no_install=yes ;;
- esac
- continue
- ;;
-
- -no-undefined)
- allow_undefined=no
- continue
- ;;
-
- -objectlist)
- prev=objectlist
- continue
- ;;
-
- -o) prev=output ;;
-
- -precious-files-regex)
- prev=precious_regex
- continue
- ;;
-
- -release)
- prev=release
- continue
- ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -R)
- prev=xrpath
- continue
- ;;
-
- -R*)
- func_stripname '-R' '' "$arg"
- dir=$func_stripname_result
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- func_fatal_error "only absolute run-paths are allowed"
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- continue
- ;;
-
- -shared)
- # The effects of -shared are defined in a previous loop.
- continue
- ;;
-
- -shrext)
- prev=shrext
- continue
- ;;
-
- -static | -static-libtool-libs)
- # The effects of -static are defined in a previous loop.
- # We used to do the same as -all-static on platforms that
- # didn't have a PIC flag, but the assumption that the effects
- # would be equivalent was wrong. It would break on at least
- # Digital Unix and AIX.
- continue
- ;;
-
- -thread-safe)
- thread_safe=yes
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
-
- -version-number)
- prev=vinfo
- vinfo_number=yes
- continue
- ;;
-
- -weak)
- prev=weak
- continue
- ;;
-
- -Wc,*)
- func_stripname '-Wc,' '' "$arg"
- args=$func_stripname_result
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- func_quote_for_eval "$flag"
- arg="$arg $wl$func_quote_for_eval_result"
- compiler_flags="$compiler_flags $func_quote_for_eval_result"
- done
- IFS="$save_ifs"
- func_stripname ' ' '' "$arg"
- arg=$func_stripname_result
- ;;
-
- -Wl,*)
- func_stripname '-Wl,' '' "$arg"
- args=$func_stripname_result
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- func_quote_for_eval "$flag"
- arg="$arg $wl$func_quote_for_eval_result"
- compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
- linker_flags="$linker_flags $func_quote_for_eval_result"
- done
- IFS="$save_ifs"
- func_stripname ' ' '' "$arg"
- arg=$func_stripname_result
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Xlinker)
- prev=xlinker
- continue
- ;;
-
- -XCClinker)
- prev=xcclinker
- continue
- ;;
-
- # -msg_* for osf cc
- -msg_*)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- ;;
-
- # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
- # -r[0-9][0-9]* specifies the processor on the SGI compiler
- # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
- # +DA*, +DD* enable 64-bit mode on the HP compiler
- # -q* pass through compiler args for the IBM compiler
- # -m*, -t[45]*, -txscale* pass through architecture-specific
- # compiler args for GCC
- # -F/path gives path to uninstalled frameworks, gcc on darwin
- # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
- # @file GCC response files
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- compiler_flags="$compiler_flags $arg"
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- ;;
-
- *.$objext)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if func_lalib_unsafe_p "$arg"; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- func_source "$arg"
-
- if test -z "$pic_object" ||
- test -z "$non_pic_object" ||
- test "$pic_object" = none &&
- test "$non_pic_object" = none; then
- func_fatal_error "cannot find name of object for \`$arg'"
- fi
-
- # Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- func_append libobjs " $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- func_append non_pic_objects " $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- func_append non_pic_objects " $non_pic_object"
- fi
- else
- # Only an error if not doing a dry-run.
- if $opt_dry_run; then
- # Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
-
- func_lo2o "$arg"
- pic_object=$xdir$objdir/$func_lo2o_result
- non_pic_object=$xdir$func_lo2o_result
- func_append libobjs " $pic_object"
- func_append non_pic_objects " $non_pic_object"
- else
- func_fatal_error "\`$arg' is not a valid libtool object"
- fi
- fi
- ;;
-
- *.$libext)
- # An archive.
- deplibs="$deplibs $arg"
- old_deplibs="$old_deplibs $arg"
- continue
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- if test "$prev" = dlfiles; then
- # This library was specified with -dlopen.
- dlfiles="$dlfiles $arg"
- prev=
- elif test "$prev" = dlprefiles; then
- # The library was specified with -dlpreopen.
- dlprefiles="$dlprefiles $arg"
- prev=
- else
- deplibs="$deplibs $arg"
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- ;;
- esac # arg
-
- # Now actually substitute the argument into the commands.
- if test -n "$arg"; then
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- fi
- done # argument parsing loop
-
- test -n "$prev" && \
- func_fatal_help "the \`$prevarg' option requires an argument"
-
- if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- fi
-
- oldlibs=
- # calculate the name of the file, without its directory
- func_basename "$output"
- outputname="$func_basename_result"
- libobjs_save="$libobjs"
-
- if test -n "$shlibpath_var"; then
- # get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
- else
- shlib_search_path=
- fi
- eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
- func_dirname "$output" "/" ""
- output_objdir="$func_dirname_result$objdir"
- # Create the object directory.
- func_mkdir_p "$output_objdir"
-
- # Determine the type of output
- case $output in
- "")
- func_fatal_help "you must specify an output file"
- ;;
- *.$libext) linkmode=oldlib ;;
- *.lo | *.$objext) linkmode=obj ;;
- *.la) linkmode=lib ;;
- *) linkmode=prog ;; # Anything else should be a program.
- esac
-
- specialdeplibs=
-
- libs=
- # Find all interdependent deplibs by searching for libraries
- # that are linked more than once (e.g. -la -lb -la)
- for deplib in $deplibs; do
- if $opt_duplicate_deps ; then
- case "$libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- libs="$libs $deplib"
- done
-
- if test "$linkmode" = lib; then
- libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
- # Compute libraries that are listed more than once in $predeps
- # $postdeps and mark them as special (i.e., whose duplicates are
- # not to be eliminated).
- pre_post_deps=
- if $opt_duplicate_compiler_generated_deps; then
- for pre_post_dep in $predeps $postdeps; do
- case "$pre_post_deps " in
- *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
- esac
- pre_post_deps="$pre_post_deps $pre_post_dep"
- done
- fi
- pre_post_deps=
- fi
-
- deplibs=
- newdependency_libs=
- newlib_search_path=
- need_relink=no # whether we're linking any uninstalled libtool libraries
- notinst_deplibs= # not-installed libtool libraries
- notinst_path= # paths that contain not-installed libtool libraries
-
- case $linkmode in
- lib)
- passes="conv dlpreopen link"
- for file in $dlfiles $dlprefiles; do
- case $file in
- *.la) ;;
- *)
- func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
- ;;
- esac
- done
- ;;
- prog)
- compile_deplibs=
- finalize_deplibs=
- alldeplibs=no
- newdlfiles=
- newdlprefiles=
- passes="conv scan dlopen dlpreopen link"
- ;;
- *) passes="conv"
- ;;
- esac
-
- for pass in $passes; do
- # The preopen pass in lib mode reverses $deplibs; put it back here
- # so that -L comes before libs that need it for instance...
- if test "$linkmode,$pass" = "lib,link"; then
- ## FIXME: Find the place where the list is rebuilt in the wrong
- ## order, and fix it there properly
- tmp_deplibs=
- for deplib in $deplibs; do
- tmp_deplibs="$deplib $tmp_deplibs"
- done
- deplibs="$tmp_deplibs"
- fi
-
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan"; then
- libs="$deplibs"
- deplibs=
- fi
- if test "$linkmode" = prog; then
- case $pass in
- dlopen) libs="$dlfiles" ;;
- dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
- esac
- fi
- if test "$linkmode,$pass" = "lib,dlpreopen"; then
- # Collect and forward deplibs of preopened libtool libs
- for lib in $dlprefiles; do
- # Ignore non-libtool-libs
- dependency_libs=
- case $lib in
- *.la) func_source "$lib" ;;
- esac
-
- # Collect preopened libtool deplibs, except any this library
- # has declared as weak libs
- for deplib in $dependency_libs; do
- deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
- case " $weak_libs " in
- *" $deplib_base "*) ;;
- *) deplibs="$deplibs $deplib" ;;
- esac
- done
- done
- libs="$dlprefiles"
- fi
- if test "$pass" = dlopen; then
- # Collect dlpreopened libraries
- save_deplibs="$deplibs"
- deplibs=
- fi
-
- for deplib in $libs; do
- lib=
- found=no
- case $deplib in
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- compiler_flags="$compiler_flags $deplib"
- if test "$linkmode" = lib ; then
- case "$new_inherited_linker_flags " in
- *" $deplib "*) ;;
- * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
- esac
- fi
- fi
- continue
- ;;
- -l*)
- if test "$linkmode" != lib && test "$linkmode" != prog; then
- func_warning "\`-l' is ignored for archives/objects"
- continue
- fi
- func_stripname '-l' '' "$deplib"
- name=$func_stripname_result
- if test "$linkmode" = lib; then
- searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
- else
- searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
- fi
- for searchdir in $searchdirs; do
- for search_ext in .la $std_shrext .so .a; do
- # Search the libtool library
- lib="$searchdir/lib${name}${search_ext}"
- if test -f "$lib"; then
- if test "$search_ext" = ".la"; then
- found=yes
- else
- found=no
- fi
- break 2
- fi
- done
- done
- if test "$found" != yes; then
- # deplib doesn't seem to be a libtool library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- else # deplib is a libtool library
- # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
- # We need to do some special things here, and not later.
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $deplib "*)
- if func_lalib_p "$lib"; then
- library_names=
- old_library=
- func_source "$lib"
- for l in $old_library $library_names; do
- ll="$l"
- done
- if test "X$ll" = "X$old_library" ; then # only static version available
- found=no
- func_dirname "$lib" "" "."
- ladir="$func_dirname_result"
- lib=$ladir/$old_library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- fi
- fi
- ;;
- *) ;;
- esac
- fi
- fi
- ;; # -l
- *.ltframework)
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- if test "$linkmode" = lib ; then
- case "$new_inherited_linker_flags " in
- *" $deplib "*) ;;
- * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
- esac
- fi
- fi
- continue
- ;;
- -L*)
- case $linkmode in
- lib)
- deplibs="$deplib $deplibs"
- test "$pass" = conv && continue
- newdependency_libs="$deplib $newdependency_libs"
- func_stripname '-L' '' "$deplib"
- newlib_search_path="$newlib_search_path $func_stripname_result"
- ;;
- prog)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- if test "$pass" = scan; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- func_stripname '-L' '' "$deplib"
- newlib_search_path="$newlib_search_path $func_stripname_result"
- ;;
- *)
- func_warning "\`-L' is ignored for archives/objects"
- ;;
- esac # linkmode
- continue
- ;; # -L
- -R*)
- if test "$pass" = link; then
- func_stripname '-R' '' "$deplib"
- dir=$func_stripname_result
- # Make sure the xrpath contains only unique directories.
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- fi
- deplibs="$deplib $deplibs"
- continue
- ;;
- *.la) lib="$deplib" ;;
- *.$libext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- case $linkmode in
- lib)
- # Linking convenience modules into shared libraries is allowed,
- # but linking other static libraries is non-portable.
- case " $dlpreconveniencelibs " in
- *" $deplib "*) ;;
- *)
- valid_a_lib=no
- case $deplibs_check_method in
- match_pattern*)
- set dummy $deplibs_check_method; shift
- match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
- if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
- | $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
- ;;
- pass_all)
- valid_a_lib=yes
- ;;
- esac
- if test "$valid_a_lib" != yes; then
- $ECHO
- $ECHO "*** Warning: Trying to link with static lib archive $deplib."
- $ECHO "*** I have the capability to make that library automatically link in when"
- $ECHO "*** you link to this library. But I can only do this if you have a"
- $ECHO "*** shared version of the library, which you do not appear to have"
- $ECHO "*** because the file extensions .$libext of this argument makes me believe"
- $ECHO "*** that it is just a static archive that I should not use here."
- else
- $ECHO
- $ECHO "*** Warning: Linking the shared library $output against the"
- $ECHO "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
- ;;
- esac
- continue
- ;;
- prog)
- if test "$pass" != link; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- continue
- ;;
- esac # linkmode
- ;; # *.$libext
- *.lo | *.$objext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- elif test "$linkmode" = prog; then
- if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlopen support or we're linking statically,
- # we need to preload.
- newdlprefiles="$newdlprefiles $deplib"
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- newdlfiles="$newdlfiles $deplib"
- fi
- fi
- continue
- ;;
- %DEPLIBS%)
- alldeplibs=yes
- continue
- ;;
- esac # case $deplib
-
- if test "$found" = yes || test -f "$lib"; then :
- else
- func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
- fi
-
- # Check to see that this really is a libtool archive.
- func_lalib_unsafe_p "$lib" \
- || func_fatal_error "\`$lib' is not a valid libtool archive"
-
- func_dirname "$lib" "" "."
- ladir="$func_dirname_result"
-
- dlname=
- dlopen=
- dlpreopen=
- libdir=
- library_names=
- old_library=
- inherited_linker_flags=
- # If the library was installed with an old release of libtool,
- # it will not redefine variables installed, or shouldnotlink
- installed=yes
- shouldnotlink=no
- avoidtemprpath=
-
-
- # Read the .la file
- func_source "$lib"
-
- # Convert "-framework foo" to "foo.ltframework"
- if test -n "$inherited_linker_flags"; then
- tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
- for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
- case " $new_inherited_linker_flags " in
- *" $tmp_inherited_linker_flag "*) ;;
- *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
- esac
- done
- fi
- dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan" ||
- { test "$linkmode" != prog && test "$linkmode" != lib; }; then
- test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
- test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
- fi
-
- if test "$pass" = conv; then
- # Only check for convenience libraries
- deplibs="$lib $deplibs"
- if test -z "$libdir"; then
- if test -z "$old_library"; then
- func_fatal_error "cannot find name of link library for \`$lib'"
- fi
- # It is a libtool convenience library, so add in its objects.
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$old_convenience $ladir/$objdir/$old_library"
- elif test "$linkmode" != prog && test "$linkmode" != lib; then
- func_fatal_error "\`$lib' is not a convenience library"
- fi
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if $opt_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
- continue
- fi # $pass = conv
-
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
- if test -z "$linklib"; then
- func_fatal_error "cannot find name of link library for \`$lib'"
- fi
-
- # This library was specified with -dlopen.
- if test "$pass" = dlopen; then
- if test -z "$libdir"; then
- func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
- fi
- if test -z "$dlname" ||
- test "$dlopen_support" != yes ||
- test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking
- # statically, we need to preload. We also need to preload any
- # dependent libraries so libltdl's deplib preloader doesn't
- # bomb out in the load deplibs phase.
- dlprefiles="$dlprefiles $lib $dependency_libs"
- else
- newdlfiles="$newdlfiles $lib"
- fi
- continue
- fi # $pass = dlopen
-
- # We need an absolute path.
- case $ladir in
- [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
- *)
- abs_ladir=`cd "$ladir" && pwd`
- if test -z "$abs_ladir"; then
- func_warning "cannot determine absolute directory name of \`$ladir'"
- func_warning "passing it literally to the linker, although it might fail"
- abs_ladir="$ladir"
- fi
- ;;
- esac
- func_basename "$lib"
- laname="$func_basename_result"
-
- # Find the relevant object directory and library name.
- if test "X$installed" = Xyes; then
- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- func_warning "library \`$lib' was moved."
- dir="$ladir"
- absdir="$abs_ladir"
- libdir="$abs_ladir"
- else
- dir="$libdir"
- absdir="$libdir"
- fi
- test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
- else
- if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- dir="$ladir"
- absdir="$abs_ladir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- fi
- fi # $installed = yes
- func_stripname 'lib' '.la' "$laname"
- name=$func_stripname_result
-
- # This library was specified with -dlpreopen.
- if test "$pass" = dlpreopen; then
- if test -z "$libdir" && test "$linkmode" = prog; then
- func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
- fi
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- newdlprefiles="$newdlprefiles $dir/$old_library"
- # Keep a list of preopened convenience libraries to check
- # that they are being used correctly in the link pass.
- test -z "$libdir" && \
- dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- newdlprefiles="$newdlprefiles $dir/$dlname"
- else
- newdlprefiles="$newdlprefiles $dir/$linklib"
- fi
- fi # $pass = dlpreopen
-
- if test -z "$libdir"; then
- # Link the convenience library
- if test "$linkmode" = lib; then
- deplibs="$dir/$old_library $deplibs"
- elif test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$dir/$old_library $compile_deplibs"
- finalize_deplibs="$dir/$old_library $finalize_deplibs"
- else
- deplibs="$lib $deplibs" # used for prog,scan pass
- fi
- continue
- fi
-
-
- if test "$linkmode" = prog && test "$pass" != link; then
- newlib_search_path="$newlib_search_path $ladir"
- deplibs="$lib $deplibs"
-
- linkalldeplibs=no
- if test "$link_all_deplibs" != no || test -z "$library_names" ||
- test "$build_libtool_libs" = no; then
- linkalldeplibs=yes
- fi
-
- tmp_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) func_stripname '-L' '' "$deplib"
- newlib_search_path="$newlib_search_path $func_stripname_result"
- ;;
- esac
- # Need to link against all dependency_libs?
- if test "$linkalldeplibs" = yes; then
- deplibs="$deplib $deplibs"
- else
- # Need to hardcode shared library paths
- # or/and link against static libraries
- newdependency_libs="$deplib $newdependency_libs"
- fi
- if $opt_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done # for deplib
- continue
- fi # $linkmode = prog...
-
- if test "$linkmode,$pass" = "prog,link"; then
- if test -n "$library_names" &&
- { { test "$prefer_static_libs" = no ||
- test "$prefer_static_libs,$installed" = "built,yes"; } ||
- test -z "$old_library"; }; then
- # We need to hardcode the library path
- if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath:" in
- *"$absdir:"*) ;;
- *) temp_rpath="$temp_rpath$absdir:" ;;
- esac
- fi
-
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi # $linkmode,$pass = prog,link...
-
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
- fi
-
- link_static=no # Whether the deplib will be linked statically
- use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes; then
- use_static_libs=no
- fi
- if test -n "$library_names" &&
- { test "$use_static_libs" = no || test -z "$old_library"; }; then
- case $host in
- *cygwin* | *mingw* | *cegcc*)
- # No point in relinking DLLs because paths are not encoded
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=no
- ;;
- *)
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
- ;;
- esac
- # This is a shared library
-
- # Warn about portability, can't link against -module's on some
- # systems (darwin). Don't bleat about dlopened modules though!
- dlopenmodule=""
- for dlpremoduletest in $dlprefiles; do
- if test "X$dlpremoduletest" = "X$lib"; then
- dlopenmodule="$dlpremoduletest"
- break
- fi
- done
- if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
- $ECHO
- if test "$linkmode" = prog; then
- $ECHO "*** Warning: Linking the executable $output against the loadable module"
- else
- $ECHO "*** Warning: Linking the shared library $output against the loadable module"
- fi
- $ECHO "*** $linklib is not portable!"
- fi
- if test "$linkmode" = lib &&
- test "$hardcode_into_libs" = yes; then
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi
-
- if test -n "$old_archive_from_expsyms_cmds"; then
- # figure out the soname
- set dummy $library_names
- shift
- realname="$1"
- shift
- libname=`eval "\\$ECHO \"$libname_spec\""`
- # use dlname if we got it. it's perfectly good, no?
- if test -n "$dlname"; then
- soname="$dlname"
- elif test -n "$soname_spec"; then
- # bleh windows
- case $host in
- *cygwin* | mingw* | *cegcc*)
- func_arith $current - $age
- major=$func_arith_result
- versuffix="-$major"
- ;;
- esac
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
-
- # Make a new name for the extract_expsyms_cmds to use
- soroot="$soname"
- func_basename "$soroot"
- soname="$func_basename_result"
- func_stripname 'lib' '.dll' "$soname"
- newlib=libimp-$func_stripname_result.a
-
- # If the library has no export list, then create one now
- if test -f "$output_objdir/$soname-def"; then :
- else
- func_verbose "extracting exported symbol list from \`$soname'"
- func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
- fi
-
- # Create $newlib
- if test -f "$output_objdir/$newlib"; then :; else
- func_verbose "generating import library for \`$soname'"
- func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
- fi
- # make sure the library variables are pointing to the new library
- dir=$output_objdir
- linklib=$newlib
- fi # test -n "$old_archive_from_expsyms_cmds"
-
- if test "$linkmode" = prog || test "$mode" != relink; then
- add_shlibpath=
- add_dir=
- add=
- lib_linked=yes
- case $hardcode_action in
- immediate | unsupported)
- if test "$hardcode_direct" = no; then
- add="$dir/$linklib"
- case $host in
- *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
- *-*-sysv4*uw2*) add_dir="-L$dir" ;;
- *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
- *-*-unixware7*) add_dir="-L$dir" ;;
- *-*-darwin* )
- # if the lib is a (non-dlopened) module then we can not
- # link against it, someone is ignoring the earlier warnings
- if /usr/bin/file -L $add 2> /dev/null |
- $GREP ": [^:]* bundle" >/dev/null ; then
- if test "X$dlopenmodule" != "X$lib"; then
- $ECHO "*** Warning: lib $linklib is a module, not a shared library"
- if test -z "$old_library" ; then
- $ECHO
- $ECHO "*** And there doesn't seem to be a static archive available"
- $ECHO "*** The link will probably fail, sorry"
- else
- add="$dir/$old_library"
- fi
- elif test -n "$old_library"; then
- add="$dir/$old_library"
- fi
- fi
- esac
- elif test "$hardcode_minus_L" = no; then
- case $host in
- *-*-sunos*) add_shlibpath="$dir" ;;
- esac
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- relink)
- if test "$hardcode_direct" = yes &&
- test "$hardcode_direct_absolute" = no; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$dir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case $libdir in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- *) lib_linked=no ;;
- esac
-
- if test "$lib_linked" != yes; then
- func_fatal_configuration "unsupported hardcode properties"
- fi
-
- if test -n "$add_shlibpath"; then
- case :$compile_shlibpath: in
- *":$add_shlibpath:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
- esac
- fi
- if test "$linkmode" = prog; then
- test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
- test -n "$add" && compile_deplibs="$add $compile_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- if test "$hardcode_direct" != yes &&
- test "$hardcode_minus_L" != yes &&
- test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- fi
- fi
- fi
-
- if test "$linkmode" = prog || test "$mode" = relink; then
- add_shlibpath=
- add_dir=
- add=
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes &&
- test "$hardcode_direct_absolute" = no; then
- add="$libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$libdir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- add="-l$name"
- elif test "$hardcode_automatic" = yes; then
- if test -n "$inst_prefix_dir" &&
- test -f "$inst_prefix_dir$libdir/$linklib" ; then
- add="$inst_prefix_dir$libdir/$linklib"
- else
- add="$libdir/$linklib"
- fi
- else
- # We cannot seem to hardcode it, guess we'll fake it.
- add_dir="-L$libdir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case $libdir in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- fi
-
- if test "$linkmode" = prog; then
- test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
- test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- fi
- fi
- elif test "$linkmode" = prog; then
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_deplibs="$dir/$linklib $compile_deplibs"
- finalize_deplibs="$dir/$linklib $finalize_deplibs"
- else
- compile_deplibs="-l$name -L$dir $compile_deplibs"
- finalize_deplibs="-l$name -L$dir $finalize_deplibs"
- fi
- elif test "$build_libtool_libs" = yes; then
- # Not a shared library
- if test "$deplibs_check_method" != pass_all; then
- # We're trying link a shared library against a static one
- # but the system doesn't support it.
-
- # Just print a warning and add the library to dependency_libs so
- # that the program can be linked against the static library.
- $ECHO
- $ECHO "*** Warning: This system can not link to static lib archive $lib."
- $ECHO "*** I have the capability to make that library automatically link in when"
- $ECHO "*** you link to this library. But I can only do this if you have a"
- $ECHO "*** shared version of the library, which you do not appear to have."
- if test "$module" = yes; then
- $ECHO "*** But as you try to build a module library, libtool will still create "
- $ECHO "*** a static module, that should work as long as the dlopening application"
- $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
- if test -z "$global_symbol_pipe"; then
- $ECHO
- $ECHO "*** However, this would only work if libtool was able to extract symbol"
- $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $ECHO "*** not find such a program. So, this module is probably useless."
- $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- else
- deplibs="$dir/$old_library $deplibs"
- link_static=yes
- fi
- fi # link shared/static library?
-
- if test "$linkmode" = lib; then
- if test -n "$dependency_libs" &&
- { test "$hardcode_into_libs" != yes ||
- test "$build_old_libs" = yes ||
- test "$link_static" = yes; }; then
- # Extract -R from dependency_libs
- temp_deplibs=
- for libdir in $dependency_libs; do
- case $libdir in
- -R*) func_stripname '-R' '' "$libdir"
- temp_xrpath=$func_stripname_result
- case " $xrpath " in
- *" $temp_xrpath "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- *) temp_deplibs="$temp_deplibs $libdir";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- newlib_search_path="$newlib_search_path $absdir"
- # Link against this library
- test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
- # ... and its dependency_libs
- tmp_libs=
- for deplib in $dependency_libs; do
- newdependency_libs="$deplib $newdependency_libs"
- if $opt_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
-
- if test "$link_all_deplibs" != no; then
- # Add the search paths of all dependency libraries
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) path="$deplib" ;;
- *.la)
- func_dirname "$deplib" "" "."
- dir="$func_dirname_result"
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- func_warning "cannot determine absolute directory name of \`$dir'"
- absdir="$dir"
- fi
- ;;
- esac
- if $GREP "^installed=no" $deplib > /dev/null; then
- case $host in
- *-*-darwin*)
- depdepl=
- eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
- if test -n "$deplibrary_names" ; then
- for tmp in $deplibrary_names ; do
- depdepl=$tmp
- done
- if test -f "$absdir/$objdir/$depdepl" ; then
- depdepl="$absdir/$objdir/$depdepl"
- darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
- if test -z "$darwin_install_name"; then
- darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
- fi
- compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
- linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
- path=
- fi
- fi
- ;;
- *)
- path="-L$absdir/$objdir"
- ;;
- esac
- else
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- test -z "$libdir" && \
- func_fatal_error "\`$deplib' is not a valid libtool archive"
- test "$absdir" != "$libdir" && \
- func_warning "\`$deplib' seems to be moved"
-
- path="-L$absdir"
- fi
- ;;
- esac
- case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$path $deplibs" ;;
- esac
- done
- fi # link_all_deplibs != no
- fi # linkmode = lib
- done # for deplib in $libs
- if test "$pass" = link; then
- if test "$linkmode" = "prog"; then
- compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
- finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
- else
- compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- fi
- fi
- dependency_libs="$newdependency_libs"
- if test "$pass" = dlpreopen; then
- # Link the dlpreopened libraries before other libraries
- for deplib in $save_deplibs; do
- deplibs="$deplib $deplibs"
- done
- fi
- if test "$pass" != dlopen; then
- if test "$pass" != conv; then
- # Make sure lib_search_path contains only unique directories.
- lib_search_path=
- for dir in $newlib_search_path; do
- case "$lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir" ;;
- esac
- done
- newlib_search_path=
- fi
-
- if test "$linkmode,$pass" != "prog,link"; then
- vars="deplibs"
- else
- vars="compile_deplibs finalize_deplibs"
- fi
- for var in $vars dependency_libs; do
- # Add libraries to $var in reverse order
- eval tmp_libs=\"\$$var\"
- new_libs=
- for deplib in $tmp_libs; do
- # FIXME: Pedantically, this is the right thing to do, so
- # that some nasty dependency loop isn't accidentally
- # broken:
- #new_libs="$deplib $new_libs"
- # Pragmatically, this seems to cause very few problems in
- # practice:
- case $deplib in
- -L*) new_libs="$deplib $new_libs" ;;
- -R*) ;;
- *)
- # And here is the reason: when a library appears more
- # than once as an explicit dependence of a library, or
- # is implicitly linked in more than once by the
- # compiler, it is considered special, and multiple
- # occurrences thereof are not removed. Compare this
- # with having the same library being listed as a
- # dependency of multiple other libraries: in this case,
- # we know (pedantically, we assume) the library does not
- # need to be listed more than once, so we keep only the
- # last copy. This is not always right, but it is rare
- # enough that we require users that really mean to play
- # such unportable linking tricks to link the library
- # using -Wl,-lname, so that libtool does not consider it
- # for duplicate removal.
- case " $specialdeplibs " in
- *" $deplib "*) new_libs="$deplib $new_libs" ;;
- *)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$deplib $new_libs" ;;
- esac
- ;;
- esac
- ;;
- esac
- done
- tmp_libs=
- for deplib in $new_libs; do
- case $deplib in
- -L*)
- case " $tmp_libs " in
- *" $deplib "*) ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- done
- eval $var=\"$tmp_libs\"
- done # for var
- fi
- # Last step: remove runtime libs from dependency_libs
- # (they stay in deplibs)
- tmp_libs=
- for i in $dependency_libs ; do
- case " $predeps $postdeps $compiler_lib_search_path " in
- *" $i "*)
- i=""
- ;;
- esac
- if test -n "$i" ; then
- tmp_libs="$tmp_libs $i"
- fi
- done
- dependency_libs=$tmp_libs
- done # for pass
- if test "$linkmode" = prog; then
- dlfiles="$newdlfiles"
- fi
- if test "$linkmode" = prog || test "$linkmode" = lib; then
- dlprefiles="$newdlprefiles"
- fi
-
- case $linkmode in
- oldlib)
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- func_warning "\`-dlopen' is ignored for archives"
- fi
-
- case " $deplibs" in
- *\ -l* | *\ -L*)
- func_warning "\`-l' and \`-L' are ignored for archives" ;;
- esac
-
- test -n "$rpath" && \
- func_warning "\`-rpath' is ignored for archives"
-
- test -n "$xrpath" && \
- func_warning "\`-R' is ignored for archives"
-
- test -n "$vinfo" && \
- func_warning "\`-version-info/-version-number' is ignored for archives"
-
- test -n "$release" && \
- func_warning "\`-release' is ignored for archives"
-
- test -n "$export_symbols$export_symbols_regex" && \
- func_warning "\`-export-symbols' is ignored for archives"
-
- # Now set the variables for building old libraries.
- build_libtool_libs=no
- oldlibs="$output"
- objs="$objs$old_deplibs"
- ;;
-
- lib)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case $outputname in
- lib*)
- func_stripname 'lib' '.la' "$outputname"
- name=$func_stripname_result
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- ;;
- *)
- test "$module" = no && \
- func_fatal_help "libtool library \`$output' must begin with \`lib'"
-
- if test "$need_lib_prefix" != no; then
- # Add the "lib" prefix for modules if required
- func_stripname '' '.la' "$outputname"
- name=$func_stripname_result
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- else
- func_stripname '' '.la' "$outputname"
- libname=$func_stripname_result
- fi
- ;;
- esac
-
- if test -n "$objs"; then
- if test "$deplibs_check_method" != pass_all; then
- func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
- else
- $ECHO
- $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
- $ECHO "*** objects $objs is not portable!"
- libobjs="$libobjs $objs"
- fi
- fi
-
- test "$dlself" != no && \
- func_warning "\`-dlopen self' is ignored for libtool libraries"
-
- set dummy $rpath
- shift
- test "$#" -gt 1 && \
- func_warning "ignoring multiple \`-rpath's for a libtool library"
-
- install_libdir="$1"
-
- oldlibs=
- if test -z "$rpath"; then
- if test "$build_libtool_libs" = yes; then
- # Building a libtool convenience library.
- # Some compilers have problems with a `.al' extension so
- # convenience libraries should have the same extension an
- # archive normally would.
- oldlibs="$output_objdir/$libname.$libext $oldlibs"
- build_libtool_libs=convenience
- build_old_libs=yes
- fi
-
- test -n "$vinfo" && \
- func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
-
- test -n "$release" && \
- func_warning "\`-release' is ignored for convenience libraries"
- else
-
- # Parse the version information argument.
- save_ifs="$IFS"; IFS=':'
- set dummy $vinfo 0 0 0
- shift
- IFS="$save_ifs"
-
- test -n "$7" && \
- func_fatal_help "too many parameters to \`-version-info'"
-
- # convert absolute version numbers to libtool ages
- # this retains compatibility with .la files and attempts
- # to make the code below a bit more comprehensible
-
- case $vinfo_number in
- yes)
- number_major="$1"
- number_minor="$2"
- number_revision="$3"
- #
- # There are really only two kinds -- those that
- # use the current revision as the major version
- # and those that subtract age and use age as
- # a minor version. But, then there is irix
- # which has an extra 1 added just for fun
- #
- case $version_type in
- darwin|linux|osf|windows|none)
- func_arith $number_major + $number_minor
- current=$func_arith_result
- age="$number_minor"
- revision="$number_revision"
- ;;
- freebsd-aout|freebsd-elf|sunos)
- current="$number_major"
- revision="$number_minor"
- age="0"
- ;;
- irix|nonstopux)
- func_arith $number_major + $number_minor
- current=$func_arith_result
- age="$number_minor"
- revision="$number_minor"
- lt_irix_increment=no
- ;;
- esac
- ;;
- no)
- current="$1"
- revision="$2"
- age="$3"
- ;;
- esac
-
- # Check that each of the things are valid numbers.
- case $current in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- func_error "CURRENT \`$current' must be a nonnegative integer"
- func_fatal_error "\`$vinfo' is not valid version information"
- ;;
- esac
-
- case $revision in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- func_error "REVISION \`$revision' must be a nonnegative integer"
- func_fatal_error "\`$vinfo' is not valid version information"
- ;;
- esac
-
- case $age in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- func_error "AGE \`$age' must be a nonnegative integer"
- func_fatal_error "\`$vinfo' is not valid version information"
- ;;
- esac
-
- if test "$age" -gt "$current"; then
- func_error "AGE \`$age' is greater than the current interface number \`$current'"
- func_fatal_error "\`$vinfo' is not valid version information"
- fi
-
- # Calculate the version variables.
- major=
- versuffix=
- verstring=
- case $version_type in
- none) ;;
-
- darwin)
- # Like Linux, but with the current version available in
- # verstring for coding it into the library header
- func_arith $current - $age
- major=.$func_arith_result
- versuffix="$major.$age.$revision"
- # Darwin ld doesn't like 0 for these options...
- func_arith $current + 1
- minor_current=$func_arith_result
- xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
- ;;
-
- freebsd-aout)
- major=".$current"
- versuffix=".$current.$revision";
- ;;
-
- freebsd-elf)
- major=".$current"
- versuffix=".$current"
- ;;
-
- irix | nonstopux)
- if test "X$lt_irix_increment" = "Xno"; then
- func_arith $current - $age
- else
- func_arith $current - $age + 1
- fi
- major=$func_arith_result
-
- case $version_type in
- nonstopux) verstring_prefix=nonstopux ;;
- *) verstring_prefix=sgi ;;
- esac
- verstring="$verstring_prefix$major.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$revision
- while test "$loop" -ne 0; do
- func_arith $revision - $loop
- iface=$func_arith_result
- func_arith $loop - 1
- loop=$func_arith_result
- verstring="$verstring_prefix$major.$iface:$verstring"
- done
-
- # Before this point, $major must not contain `.'.
- major=.$major
- versuffix="$major.$revision"
- ;;
-
- linux)
- func_arith $current - $age
- major=.$func_arith_result
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- func_arith $current - $age
- major=.$func_arith_result
- versuffix=".$current.$age.$revision"
- verstring="$current.$age.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test "$loop" -ne 0; do
- func_arith $current - $loop
- iface=$func_arith_result
- func_arith $loop - 1
- loop=$func_arith_result
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- qnx)
- major=".$current"
- versuffix=".$current"
- ;;
-
- sunos)
- major=".$current"
- versuffix=".$current.$revision"
- ;;
-
- windows)
- # Use '-' rather than '.', since we only want one
- # extension on DOS 8.3 filesystems.
- func_arith $current - $age
- major=$func_arith_result
- versuffix="-$major"
- ;;
-
- *)
- func_fatal_configuration "unknown library version type \`$version_type'"
- ;;
- esac
-
- # Clear the version info if we defaulted, and they specified a release.
- if test -z "$vinfo" && test -n "$release"; then
- major=
- case $version_type in
- darwin)
- # we can't check for "0.0" in archive_cmds due to quoting
- # problems, so we reset it completely
- verstring=
- ;;
- *)
- verstring="0.0"
- ;;
- esac
- if test "$need_version" = no; then
- versuffix=
- else
- versuffix=".0.0"
- fi
- fi
-
- # Remove version info from name if versioning should be avoided
- if test "$avoid_version" = yes && test "$need_version" = no; then
- major=
- versuffix=
- verstring=""
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- func_warning "undefined symbols not allowed in $host shared libraries"
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Don't allow undefined symbols.
- allow_undefined_flag="$no_undefined_flag"
- fi
-
- fi
-
- func_generate_dlsyms "$libname" "$libname" "yes"
- libobjs="$libobjs $symfileobj"
- test "X$libobjs" = "X " && libobjs=
-
- if test "$mode" != relink; then
- # Remove our outputs, but don't remove object files since they
- # may have been created when compiling PIC objects.
- removelist=
- tempremovelist=`$ECHO "$output_objdir/*"`
- for p in $tempremovelist; do
- case $p in
- *.$objext | *.gcno)
- ;;
- $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
- if test "X$precious_files_regex" != "X"; then
- if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
- then
- continue
- fi
- fi
- removelist="$removelist $p"
- ;;
- *) ;;
- esac
- done
- test -n "$removelist" && \
- func_show_eval "${RM}r \$removelist"
- fi
-
- # Now set the variables for building old libraries.
- if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- # Eliminate all temporary directories.
- #for path in $notinst_path; do
- # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
- # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
- # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
- #done
-
- if test -n "$xrpath"; then
- # If the user specified any rpath flags, then add them.
- temp_xrpath=
- for libdir in $xrpath; do
- temp_xrpath="$temp_xrpath -R$libdir"
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
- dependency_libs="$temp_xrpath $dependency_libs"
- fi
- fi
-
- # Make sure dlfiles contains only unique files that won't be dlpreopened
- old_dlfiles="$dlfiles"
- dlfiles=
- for lib in $old_dlfiles; do
- case " $dlprefiles $dlfiles " in
- *" $lib "*) ;;
- *) dlfiles="$dlfiles $lib" ;;
- esac
- done
-
- # Make sure dlprefiles contains only unique files
- old_dlprefiles="$dlprefiles"
- dlprefiles=
- for lib in $old_dlprefiles; do
- case "$dlprefiles " in
- *" $lib "*) ;;
- *) dlprefiles="$dlprefiles $lib" ;;
- esac
- done
-
- if test "$build_libtool_libs" = yes; then
- if test -n "$rpath"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
- # these systems don't actually have a c library (as such)!
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C library is in the System framework
- deplibs="$deplibs System.ltframework"
- ;;
- *-*-netbsd*)
- # Don't link with libc until the a.out ld.so is fixed.
- ;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc due to us having libc/libc_r.
- ;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- ;;
- *)
- # Add libc to deplibs on all other systems if necessary.
- if test "$build_libtool_need_lc" = "yes"; then
- deplibs="$deplibs -lc"
- fi
- ;;
- esac
- fi
-
- # Transform deplibs into only deplibs that can be linked in shared.
- name_save=$name
- libname_save=$libname
- release_save=$release
- versuffix_save=$versuffix
- major_save=$major
- # I'm not sure if I'm treating the release correctly. I think
- # release should show up in the -l (ie -lgmp5) so we don't want to
- # add it in twice. Is that correct?
- release=""
- versuffix=""
- major=""
- newdeplibs=
- droppeddeps=no
- case $deplibs_check_method in
- pass_all)
- # Don't check for shared/static. Everything works.
- # This might be a little naive. We might want to check
- # whether the library exists or not. But this is on
- # osf3 & osf4 and I'm not really sure... Just
- # implementing what was already the behavior.
- newdeplibs=$deplibs
- ;;
- test_compile)
- # This code stresses the "libraries are programs" paradigm to its
- # limits. Maybe even breaks it. We compile a program, linking it
- # against the deplibs as a proxy for the library. Then we can check
- # whether they linked in statically or dynamically with ldd.
- $opt_dry_run || $RM conftest.c
- cat > conftest.c </dev/null`
- for potent_lib in $potential_libs; do
- # Follow soft links.
- if ls -lLd "$potent_lib" 2>/dev/null |
- $GREP " -> " >/dev/null; then
- continue
- fi
- # The statement above tries to avoid entering an
- # endless loop below, in case of cyclic links.
- # We might still enter an endless loop, since a link
- # loop can be closed while we follow links,
- # but so what?
- potlib="$potent_lib"
- while test -h "$potlib" 2>/dev/null; do
- potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
- case $potliblink in
- [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
- $SED -e 10q |
- $EGREP "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $ECHO
- $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
- $ECHO "*** I have the capability to make that library automatically link in when"
- $ECHO "*** you link to this library. But I can only do this if you have a"
- $ECHO "*** shared version of the library, which you do not appear to have"
- $ECHO "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
- else
- $ECHO "*** with $libname and none of the candidates passed a file format test"
- $ECHO "*** using a file magic. Last file checked: $potlib"
- fi
- fi
- ;;
- *)
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- ;;
- esac
- done # Gone through all deplibs.
- ;;
- match_pattern*)
- set dummy $deplibs_check_method; shift
- match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
- for a_deplib in $deplibs; do
- case $a_deplib in
- -l*)
- func_stripname -l '' "$a_deplib"
- name=$func_stripname_result
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $a_deplib "*)
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- ;;
- esac
- fi
- if test -n "$a_deplib" ; then
- libname=`eval "\\$ECHO \"$libname_spec\""`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- potlib="$potent_lib" # see symlink-check above in file_magic test
- if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
- $EGREP "$match_pattern_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $ECHO
- $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
- $ECHO "*** I have the capability to make that library automatically link in when"
- $ECHO "*** you link to this library. But I can only do this if you have a"
- $ECHO "*** shared version of the library, which you do not appear to have"
- $ECHO "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
- else
- $ECHO "*** with $libname and none of the candidates passed a file format test"
- $ECHO "*** using a regex pattern. Last file checked: $potlib"
- fi
- fi
- ;;
- *)
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- ;;
- esac
- done # Gone through all deplibs.
- ;;
- none | unknown | *)
- newdeplibs=""
- tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
- -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- for i in $predeps $postdeps ; do
- # can't use Xsed below, because $i might contain '/'
- tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
- done
- fi
- if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
- $GREP . >/dev/null; then
- $ECHO
- if test "X$deplibs_check_method" = "Xnone"; then
- $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
- else
- $ECHO "*** Warning: inter-library dependencies are not known to be supported."
- fi
- $ECHO "*** All declared inter-library dependencies are being dropped."
- droppeddeps=yes
- fi
- ;;
- esac
- versuffix=$versuffix_save
- major=$major_save
- release=$release_save
- libname=$libname_save
- name=$name_save
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library with the System framework
- newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
- ;;
- esac
-
- if test "$droppeddeps" = yes; then
- if test "$module" = yes; then
- $ECHO
- $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
- $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
- $ECHO "*** a static module, that should work as long as the dlopening"
- $ECHO "*** application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- $ECHO
- $ECHO "*** However, this would only work if libtool was able to extract symbol"
- $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $ECHO "*** not find such a program. So, this module is probably useless."
- $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- else
- $ECHO "*** The inter-library dependencies that have been dropped here will be"
- $ECHO "*** automatically added whenever a program is linked with this library"
- $ECHO "*** or is declared to -dlopen it."
-
- if test "$allow_undefined" = no; then
- $ECHO
- $ECHO "*** Since this library must not contain undefined symbols,"
- $ECHO "*** because either the platform does not support them or"
- $ECHO "*** it was explicitly requested with -no-undefined,"
- $ECHO "*** libtool will only create a static version of it."
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- fi
- fi
- # Done checking deplibs!
- deplibs=$newdeplibs
- fi
- # Time to change all our "foo.ltframework" stuff back to "-framework foo"
- case $host in
- *-*-darwin*)
- newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- ;;
- esac
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- deplibs="$new_libs"
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
-
- # Test again, we may have decided not to build it any more
- if test "$build_libtool_libs" = yes; then
- if test "$hardcode_into_libs" = yes; then
- # Hardcode the library paths
- hardcode_libdirs=
- dep_rpath=
- rpath="$finalize_rpath"
- test "$mode" != relink && rpath="$compile_rpath$rpath"
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- dep_rpath="$dep_rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- if test -n "$hardcode_libdir_flag_spec_ld"; then
- eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
- else
- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
- fi
- fi
- if test -n "$runpath_var" && test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
- fi
- test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
- fi
-
- shlibpath="$finalize_shlibpath"
- test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
- if test -n "$shlibpath"; then
- eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
- fi
-
- # Get the real and link names of the library.
- eval shared_ext=\"$shrext_cmds\"
- eval library_names=\"$library_names_spec\"
- set dummy $library_names
- shift
- realname="$1"
- shift
-
- if test -n "$soname_spec"; then
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
- if test -z "$dlname"; then
- dlname=$soname
- fi
-
- lib="$output_objdir/$realname"
- linknames=
- for link
- do
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- test "X$libobjs" = "X " && libobjs=
-
- delfiles=
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
- export_symbols="$output_objdir/$libname.uexp"
- delfiles="$delfiles $export_symbols"
- fi
-
- orig_export_symbols=
- case $host_os in
- cygwin* | mingw* | cegcc*)
- if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
- # exporting using user supplied symfile
- if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
- # and it's NOT already a .def file. Must figure out
- # which of the given symbols are data symbols and tag
- # them as such. So, trigger use of export_symbols_cmds.
- # export_symbols gets reassigned inside the "prepare
- # the list of exported symbols" if statement, so the
- # include_expsyms logic still works.
- orig_export_symbols="$export_symbols"
- export_symbols=
- always_export_symbols=yes
- fi
- fi
- ;;
- esac
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- func_verbose "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $opt_dry_run || $RM $export_symbols
- cmds=$export_symbols_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- func_len " $cmd"
- len=$func_len_result
- if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- func_show_eval "$cmd" 'exit $?'
- skipped_export=false
- else
- # The command line is too long to execute in one step.
- func_verbose "using reloadable object file for export list..."
- skipped_export=:
- # Break out early, otherwise skipped_export may be
- # set to false by a later but shorter cmd.
- break
- fi
- done
- IFS="$save_ifs"
- if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
- func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
- fi
- fi
- fi
-
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- tmp_export_symbols="$export_symbols"
- test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
- $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
- fi
-
- if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
- # The given exports_symbols file has to be filtered, so filter it.
- func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
- # FIXME: $output_objdir/$libname.filter potentially contains lots of
- # 's' commands which not all seds can handle. GNU sed should be fine
- # though. Also, the filter scales superlinearly with the number of
- # global variables. join(1) would be nice here, but unfortunately
- # isn't a blessed tool.
- $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
- delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
- export_symbols=$output_objdir/$libname.def
- $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
- fi
-
- tmp_deplibs=
- for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- tmp_deplibs="$tmp_deplibs $test_deplib"
- ;;
- esac
- done
- deplibs="$tmp_deplibs"
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec" &&
- test "$compiler_needs_object" = yes &&
- test -z "$libobjs"; then
- # extract the archives, so we have objects to list.
- # TODO: could optimize this to just extract one archive.
- whole_archive_flag_spec=
- fi
- if test -n "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- test "X$libobjs" = "X " && libobjs=
- else
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- libobjs="$libobjs $func_extract_archives_result"
- test "X$libobjs" = "X " && libobjs=
- fi
- fi
-
- if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
- eval flag=\"$thread_safe_flag_spec\"
- linker_flags="$linker_flags $flag"
- fi
-
- # Make a backup of the uninstalled library when relinking
- if test "$mode" = relink; then
- $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
- fi
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- eval test_cmds=\"$module_expsym_cmds\"
- cmds=$module_expsym_cmds
- else
- eval test_cmds=\"$module_cmds\"
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval test_cmds=\"$archive_expsym_cmds\"
- cmds=$archive_expsym_cmds
- else
- eval test_cmds=\"$archive_cmds\"
- cmds=$archive_cmds
- fi
- fi
-
- if test "X$skipped_export" != "X:" &&
- func_len " $test_cmds" &&
- len=$func_len_result &&
- test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- :
- else
- # The command line is too long to link in one step, link piecewise
- # or, if using GNU ld and skipped_export is not :, use a linker
- # script.
-
- # Save the value of $output and $libobjs because we want to
- # use them later. If we have whole_archive_flag_spec, we
- # want to use save_libobjs as it was before
- # whole_archive_flag_spec was expanded, because we can't
- # assume the linker understands whole_archive_flag_spec.
- # This may have to be revisited, in case too many
- # convenience libraries get linked in and end up exceeding
- # the spec.
- if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- fi
- save_output=$output
- output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
-
- # Clear the reloadable object creation command queue and
- # initialize k to one.
- test_cmds=
- concat_cmds=
- objlist=
- last_robj=
- k=1
-
- if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
- output=${output_objdir}/${output_la}.lnkscript
- func_verbose "creating GNU ld script: $output"
- $ECHO 'INPUT (' > $output
- for obj in $save_libobjs
- do
- $ECHO "$obj" >> $output
- done
- $ECHO ')' >> $output
- delfiles="$delfiles $output"
- elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
- output=${output_objdir}/${output_la}.lnk
- func_verbose "creating linker input file list: $output"
- : > $output
- set x $save_libobjs
- shift
- firstobj=
- if test "$compiler_needs_object" = yes; then
- firstobj="$1 "
- shift
- fi
- for obj
- do
- $ECHO "$obj" >> $output
- done
- delfiles="$delfiles $output"
- output=$firstobj\"$file_list_spec$output\"
- else
- if test -n "$save_libobjs"; then
- func_verbose "creating reloadable object files..."
- output=$output_objdir/$output_la-${k}.$objext
- eval test_cmds=\"$reload_cmds\"
- func_len " $test_cmds"
- len0=$func_len_result
- len=$len0
-
- # Loop over the list of objects to be linked.
- for obj in $save_libobjs
- do
- func_len " $obj"
- func_arith $len + $func_len_result
- len=$func_arith_result
- if test "X$objlist" = X ||
- test "$len" -lt "$max_cmd_len"; then
- func_append objlist " $obj"
- else
- # The command $test_cmds is almost too long, add a
- # command to the queue.
- if test "$k" -eq 1 ; then
- # The first file doesn't have a previous command to add.
- eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
- else
- # All subsequent reloadable object files will link in
- # the last one created.
- eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
- fi
- last_robj=$output_objdir/$output_la-${k}.$objext
- func_arith $k + 1
- k=$func_arith_result
- output=$output_objdir/$output_la-${k}.$objext
- objlist=$obj
- func_len " $last_robj"
- func_arith $len0 + $func_len_result
- len=$func_arith_result
- fi
- done
- # Handle the remaining objects by creating one last
- # reloadable object file. All subsequent reloadable object
- # files will link in the last one created.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
- if test -n "$last_robj"; then
- eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
- fi
- delfiles="$delfiles $output"
-
- else
- output=
- fi
-
- if ${skipped_export-false}; then
- func_verbose "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $opt_dry_run || $RM $export_symbols
- libobjs=$output
- # Append the command to create the export file.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
- if test -n "$last_robj"; then
- eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
- fi
- fi
-
- test -n "$save_libobjs" &&
- func_verbose "creating a temporary reloadable object file: $output"
-
- # Loop through the commands generated above and execute them.
- save_ifs="$IFS"; IFS='~'
- for cmd in $concat_cmds; do
- IFS="$save_ifs"
- $opt_silent || {
- func_quote_for_expand "$cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
- $opt_dry_run || eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- ( cd "$output_objdir" && \
- $RM "${realname}T" && \
- $MV "${realname}U" "$realname" )
- fi
-
- exit $lt_exit
- }
- done
- IFS="$save_ifs"
-
- if test -n "$export_symbols_regex" && ${skipped_export-false}; then
- func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
- fi
- fi
-
- if ${skipped_export-false}; then
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- tmp_export_symbols="$export_symbols"
- test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
- $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
- fi
-
- if test -n "$orig_export_symbols"; then
- # The given exports_symbols file has to be filtered, so filter it.
- func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
- # FIXME: $output_objdir/$libname.filter potentially contains lots of
- # 's' commands which not all seds can handle. GNU sed should be fine
- # though. Also, the filter scales superlinearly with the number of
- # global variables. join(1) would be nice here, but unfortunately
- # isn't a blessed tool.
- $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
- delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
- export_symbols=$output_objdir/$libname.def
- $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
- fi
- fi
-
- libobjs=$output
- # Restore the value of output.
- output=$save_output
-
- if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- test "X$libobjs" = "X " && libobjs=
- fi
- # Expand the library linking commands again to reset the
- # value of $libobjs for piecewise linking.
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- cmds=$module_expsym_cmds
- else
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
- fi
- fi
- fi
-
- if test -n "$delfiles"; then
- # Append the command to remove temporary files to $cmds.
- eval cmds=\"\$cmds~\$RM $delfiles\"
- fi
-
- # Add any objects from preloaded convenience libraries
- if test -n "$dlprefiles"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $dlprefiles
- libobjs="$libobjs $func_extract_archives_result"
- test "X$libobjs" = "X " && libobjs=
- fi
-
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $opt_silent || {
- func_quote_for_expand "$cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
- $opt_dry_run || eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- ( cd "$output_objdir" && \
- $RM "${realname}T" && \
- $MV "${realname}U" "$realname" )
- fi
-
- exit $lt_exit
- }
- done
- IFS="$save_ifs"
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
-
- if test -n "$convenience"; then
- if test -z "$whole_archive_flag_spec"; then
- func_show_eval '${RM}r "$gentop"'
- fi
- fi
-
- exit $EXIT_SUCCESS
- fi
-
- # Create links to the real library.
- for linkname in $linknames; do
- if test "$realname" != "$linkname"; then
- func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
- fi
- done
-
- # If -module or -export-dynamic was specified, set the dlname.
- if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- obj)
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- func_warning "\`-dlopen' is ignored for objects"
- fi
-
- case " $deplibs" in
- *\ -l* | *\ -L*)
- func_warning "\`-l' and \`-L' are ignored for objects" ;;
- esac
-
- test -n "$rpath" && \
- func_warning "\`-rpath' is ignored for objects"
-
- test -n "$xrpath" && \
- func_warning "\`-R' is ignored for objects"
-
- test -n "$vinfo" && \
- func_warning "\`-version-info' is ignored for objects"
-
- test -n "$release" && \
- func_warning "\`-release' is ignored for objects"
-
- case $output in
- *.lo)
- test -n "$objs$old_deplibs" && \
- func_fatal_error "cannot build library object \`$output' from non-libtool objects"
-
- libobj=$output
- func_lo2o "$libobj"
- obj=$func_lo2o_result
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $opt_dry_run || $RM $obj $libobj
-
- # Objects from convenience libraries. This assumes
- # single-version convenience libraries. Whenever we create
- # different ones for PIC/non-PIC, this we'll have to duplicate
- # the extraction.
- reload_conv_objs=
- gentop=
- # reload_cmds runs $LD directly, so let us get rid of
- # -Wl from whole_archive_flag_spec and hope we can get by with
- # turning comma into space..
- wl=
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
- reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
- else
- gentop="$output_objdir/${obj}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- reload_conv_objs="$reload_objs $func_extract_archives_result"
- fi
- fi
-
- # Create the old-style object.
- reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
- output="$obj"
- func_execute_cmds "$reload_cmds" 'exit $?'
-
- # Exit if we aren't doing a library object file.
- if test -z "$libobj"; then
- if test -n "$gentop"; then
- func_show_eval '${RM}r "$gentop"'
- fi
-
- exit $EXIT_SUCCESS
- fi
-
- if test "$build_libtool_libs" != yes; then
- if test -n "$gentop"; then
- func_show_eval '${RM}r "$gentop"'
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- # $show "echo timestamp > $libobj"
- # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
- exit $EXIT_SUCCESS
- fi
-
- if test -n "$pic_flag" || test "$pic_mode" != default; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs $reload_conv_objs"
- output="$libobj"
- func_execute_cmds "$reload_cmds" 'exit $?'
- fi
-
- if test -n "$gentop"; then
- func_show_eval '${RM}r "$gentop"'
- fi
-
- exit $EXIT_SUCCESS
- ;;
-
- prog)
- case $host in
- *cygwin*) func_stripname '' '.exe' "$output"
- output=$func_stripname_result.exe;;
- esac
- test -n "$vinfo" && \
- func_warning "\`-version-info' is ignored for programs"
-
- test -n "$release" && \
- func_warning "\`-release' is ignored for programs"
-
- test "$preload" = yes \
- && test "$dlopen_support" = unknown \
- && test "$dlopen_self" = unknown \
- && test "$dlopen_self_static" = unknown && \
- func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
- finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
- ;;
- esac
-
- case $host in
- *-*-darwin*)
- # Don't allow lazy linking, it breaks C++ global constructors
- # But is supposedly fixed on 10.4 or later (yay!).
- if test "$tagname" = CXX ; then
- case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
- 10.[0123])
- compile_command="$compile_command ${wl}-bind_at_load"
- finalize_command="$finalize_command ${wl}-bind_at_load"
- ;;
- esac
- fi
- # Time to change all our "foo.ltframework" stuff back to "-framework foo"
- compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- ;;
- esac
-
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $compile_deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $compile_deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- compile_deplibs="$new_libs"
-
-
- compile_command="$compile_command $compile_deplibs"
- finalize_command="$finalize_command $finalize_deplibs"
-
- if test -n "$rpath$xrpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath $xrpath; do
- # This is the magic to use -rpath.
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- fi
-
- # Now hardcode the library paths
- rpath=
- hardcode_libdirs=
- for libdir in $compile_rpath $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
- testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
- case :$dllsearchpath: in
- *":$libdir:"*) ;;
- ::) dllsearchpath=$libdir;;
- *) dllsearchpath="$dllsearchpath:$libdir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- ::) dllsearchpath=$testbindir;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
- ;;
- esac
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- compile_rpath="$rpath"
-
- rpath=
- hardcode_libdirs=
- for libdir in $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- finalize_rpath="$rpath"
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- fi
-
- func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
-
- # template prelinking step
- if test -n "$prelink_cmds"; then
- func_execute_cmds "$prelink_cmds" 'exit $?'
- fi
-
- wrappers_required=yes
- case $host in
- *cygwin* | *mingw* )
- if test "$build_libtool_libs" != yes; then
- wrappers_required=no
- fi
- ;;
- *cegcc)
- # Disable wrappers for cegcc, we are cross compiling anyway.
- wrappers_required=no
- ;;
- *)
- if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
- wrappers_required=no
- fi
- ;;
- esac
- if test "$wrappers_required" = no; then
- # Replace the output file specification.
- compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- link_command="$compile_command$compile_rpath"
-
- # We have no uninstalled library dependencies, so finalize right now.
- exit_status=0
- func_show_eval "$link_command" 'exit_status=$?'
-
- # Delete the generated files.
- if test -f "$output_objdir/${outputname}S.${objext}"; then
- func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
- fi
-
- exit $exit_status
- fi
-
- if test -n "$compile_shlibpath$finalize_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- compile_var=
- finalize_var=
- if test -n "$runpath_var"; then
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- if test -n "$finalize_perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $finalize_perm_rpath; do
- rpath="$rpath$dir:"
- done
- finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- fi
-
- if test "$no_install" = yes; then
- # We don't need to create a wrapper script.
- link_command="$compile_var$compile_command$compile_rpath"
- # Replace the output file specification.
- link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- # Delete the old output file.
- $opt_dry_run || $RM $output
- # Link the executable and exit
- func_show_eval "$link_command" 'exit $?'
- exit $EXIT_SUCCESS
- fi
-
- if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
-
- func_warning "this platform does not like uninstalled shared libraries"
- func_warning "\`$output' will be relinked during installation"
- else
- if test "$fast_install" != no; then
- link_command="$finalize_var$compile_command$finalize_rpath"
- if test "$fast_install" = yes; then
- relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
- else
- # fast_install is set to needless
- relink_command=
- fi
- else
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
- fi
- fi
-
- # Replace the output file specification.
- link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
- # Delete the old output files.
- $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
- func_show_eval "$link_command" 'exit $?'
-
- # Now create the wrapper script.
- func_verbose "creating $output"
-
- # Quote the relink command for shipping.
- if test -n "$relink_command"; then
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- func_quote_for_eval "$var_value"
- relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
- fi
- done
- relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Quote $ECHO for shipping.
- if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
- case $progpath in
- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
- *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
- esac
- qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Only actually do things if not in dry run mode.
- $opt_dry_run || {
- # win32 will think the script is a binary if it has
- # a .exe suffix, so we strip it off here.
- case $output in
- *.exe) func_stripname '' '.exe' "$output"
- output=$func_stripname_result ;;
- esac
- # test for cygwin because mv fails w/o .exe extensions
- case $host in
- *cygwin*)
- exeext=.exe
- func_stripname '' '.exe' "$outputname"
- outputname=$func_stripname_result ;;
- *) exeext= ;;
- esac
- case $host in
- *cygwin* | *mingw* )
- func_dirname_and_basename "$output" "" "."
- output_name=$func_basename_result
- output_path=$func_dirname_result
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
- $RM $cwrappersource $cwrapper
- trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
- func_emit_cwrapperexe_src > $cwrappersource
-
- # The wrapper executable is built using the $host compiler,
- # because it contains $host paths and files. If cross-
- # compiling, it, like the target executable, must be
- # executed on the $host or under an emulation environment.
- $opt_dry_run || {
- $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
- $STRIP $cwrapper
- }
-
- # Now, create the wrapper script for func_source use:
- func_ltwrapper_scriptname $cwrapper
- $RM $func_ltwrapper_scriptname_result
- trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
- $opt_dry_run || {
- # note: this script will not be executed, so do not chmod.
- if test "x$build" = "x$host" ; then
- $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
- else
- func_emit_wrapper no > $func_ltwrapper_scriptname_result
- fi
- }
- ;;
- * )
- $RM $output
- trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
-
- func_emit_wrapper no > $output
- chmod +x $output
- ;;
- esac
- }
- exit $EXIT_SUCCESS
- ;;
- esac
-
- # See if we need to build an old-fashioned archive.
- for oldlib in $oldlibs; do
-
- if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save $symfileobj"
- addlibs="$convenience"
- build_libtool_libs=no
- else
- if test "$build_libtool_libs" = module; then
- oldobjs="$libobjs_save"
- build_libtool_libs=no
- else
- oldobjs="$old_deplibs $non_pic_objects"
- if test "$preload" = yes && test -f "$symfileobj"; then
- oldobjs="$oldobjs $symfileobj"
- fi
- fi
- addlibs="$old_convenience"
- fi
-
- if test -n "$addlibs"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $addlibs
- oldobjs="$oldobjs $func_extract_archives_result"
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=$old_archive_from_new_cmds
- else
-
- # Add any objects from preloaded convenience libraries
- if test -n "$dlprefiles"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $dlprefiles
- oldobjs="$oldobjs $func_extract_archives_result"
- fi
-
- # POSIX demands no paths to be encoded in archives. We have
- # to avoid creating archives with duplicate basenames if we
- # might have to extract them afterwards, e.g., when creating a
- # static archive out of a convenience library, or when linking
- # the entirety of a libtool archive into another (currently
- # not supported by libtool).
- if (for obj in $oldobjs
- do
- func_basename "$obj"
- $ECHO "$func_basename_result"
- done | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $ECHO "copying selected object files to avoid basename conflicts..."
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
- func_mkdir_p "$gentop"
- save_oldobjs=$oldobjs
- oldobjs=
- counter=1
- for obj in $save_oldobjs
- do
- func_basename "$obj"
- objbase="$func_basename_result"
- case " $oldobjs " in
- " ") oldobjs=$obj ;;
- *[\ /]"$objbase "*)
- while :; do
- # Make sure we don't pick an alternate name that also
- # overlaps.
- newobj=lt$counter-$objbase
- func_arith $counter + 1
- counter=$func_arith_result
- case " $oldobjs " in
- *[\ /]"$newobj "*) ;;
- *) if test ! -f "$gentop/$newobj"; then break; fi ;;
- esac
- done
- func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
- oldobjs="$oldobjs $gentop/$newobj"
- ;;
- *) oldobjs="$oldobjs $obj" ;;
- esac
- done
- fi
- eval cmds=\"$old_archive_cmds\"
-
- func_len " $cmds"
- len=$func_len_result
- if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- cmds=$old_archive_cmds
- else
- # the command line is too long to link in one step, link in parts
- func_verbose "using piecewise archive linking..."
- save_RANLIB=$RANLIB
- RANLIB=:
- objlist=
- concat_cmds=
- save_oldobjs=$oldobjs
- oldobjs=
- # Is there a better way of finding the last object in the list?
- for obj in $save_oldobjs
- do
- last_oldobj=$obj
- done
- eval test_cmds=\"$old_archive_cmds\"
- func_len " $test_cmds"
- len0=$func_len_result
- len=$len0
- for obj in $save_oldobjs
- do
- func_len " $obj"
- func_arith $len + $func_len_result
- len=$func_arith_result
- func_append objlist " $obj"
- if test "$len" -lt "$max_cmd_len"; then
- :
- else
- # the above command should be used before it gets too long
- oldobjs=$objlist
- if test "$obj" = "$last_oldobj" ; then
- RANLIB=$save_RANLIB
- fi
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
- objlist=
- len=$len0
- fi
- done
- RANLIB=$save_RANLIB
- oldobjs=$objlist
- if test "X$oldobjs" = "X" ; then
- eval cmds=\"\$concat_cmds\"
- else
- eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
- fi
- fi
- fi
- func_execute_cmds "$cmds" 'exit $?'
- done
-
- test -n "$generated" && \
- func_show_eval "${RM}r$generated"
-
- # Now create the libtool archive.
- case $output in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.$libext"
- func_verbose "creating $output"
-
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- func_quote_for_eval "$var_value"
- relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
- fi
- done
- # Quote the link command for shipping.
- relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
- relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- if test "$hardcode_automatic" = yes ; then
- relink_command=
- fi
-
- # Only create the output if not a dry run.
- $opt_dry_run || {
- for installed in no yes; do
- if test "$installed" = yes; then
- if test -z "$install_libdir"; then
- break
- fi
- output="$output_objdir/$outputname"i
- # Replace all uninstalled libtool libraries with the installed ones
- newdependency_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- *.la)
- func_basename "$deplib"
- name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- test -z "$libdir" && \
- func_fatal_error "\`$deplib' is not a valid libtool archive"
- if test "x$EGREP" = x ; then
- EGREP=egrep
- fi
- # We do not want portage's install root ($D) present. Check only for
- # this if the .la is being installed.
- if test "$installed" = yes && test "$D"; then
- eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
- else
- mynewdependency_lib="$libdir/$name"
- fi
- # Do not add duplicates
- if test "$mynewdependency_lib"; then
- my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
- if test -z "$my_little_ninja_foo_1"; then
- newdependency_libs="$newdependency_libs $mynewdependency_lib"
- fi
- fi
- ;;
- *)
- if test "$installed" = yes; then
- # Rather use S=WORKDIR if our version of portage supports it.
- # This is because some ebuild (gcc) do not use $S as buildroot.
- if test "$PWORKDIR"; then
- S="$PWORKDIR"
- fi
- # We do not want portage's build root ($S) present.
- my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
- # We do not want portage's install root ($D) present.
- my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
- if test -n "$my_little_ninja_foo_2" && test "$S"; then
- mynewdependency_lib=""
- elif test -n "$my_little_ninja_foo_3" && test "$D"; then
- eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
- else
- mynewdependency_lib="$deplib"
- fi
- else
- mynewdependency_lib="$deplib"
- fi
- # Do not add duplicates
- if test "$mynewdependency_lib"; then
- my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
- if test -z "$my_little_ninja_foo_4"; then
- newdependency_libs="$newdependency_libs $mynewdependency_lib"
- fi
- fi
- ;;
- esac
- done
- dependency_libs="$newdependency_libs"
- newdlfiles=
-
- for lib in $dlfiles; do
- case $lib in
- *.la)
- func_basename "$lib"
- name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- test -z "$libdir" && \
- func_fatal_error "\`$lib' is not a valid libtool archive"
- newdlfiles="$newdlfiles $libdir/$name"
- ;;
- *) newdlfiles="$newdlfiles $lib" ;;
- esac
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- case $lib in
- *.la)
- # Only pass preopened files to the pseudo-archive (for
- # eventual linking with the app. that links it) if we
- # didn't already link the preopened objects directly into
- # the library:
- func_basename "$lib"
- name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- test -z "$libdir" && \
- func_fatal_error "\`$lib' is not a valid libtool archive"
- newdlprefiles="$newdlprefiles $libdir/$name"
- ;;
- esac
- done
- dlprefiles="$newdlprefiles"
- else
- newdlfiles=
- for lib in $dlfiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlfiles="$newdlfiles $abs"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlprefiles="$newdlprefiles $abs"
- done
- dlprefiles="$newdlprefiles"
- fi
- $RM $output
- # place dlname in correct position for cygwin
- tdlname=$dlname
- case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
- esac
- # Do not add duplicates
- if test "$installed" = yes && test "$D"; then
- install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
- fi
- $ECHO > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags='$new_inherited_linker_flags'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Names of additional weak libraries provided by this library
-weak_library_names='$weak_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
- if test "$installed" = no && test "$need_relink" = yes; then
- $ECHO >> $output "\
-relink_command=\"$relink_command\""
- fi
- done
- }
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
- ;;
- esac
- exit $EXIT_SUCCESS
-}
-
-{ test "$mode" = link || test "$mode" = relink; } &&
- func_mode_link ${1+"$@"}
-
-
-# func_mode_uninstall arg...
-func_mode_uninstall ()
-{
- $opt_debug
- RM="$nonopt"
- files=
- rmforce=
- exit_status=0
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- for arg
- do
- case $arg in
- -f) RM="$RM $arg"; rmforce=yes ;;
- -*) RM="$RM $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- test -z "$RM" && \
- func_fatal_help "you must specify an RM program"
-
- rmdirs=
-
- origobjdir="$objdir"
- for file in $files; do
- func_dirname "$file" "" "."
- dir="$func_dirname_result"
- if test "X$dir" = X.; then
- objdir="$origobjdir"
- else
- objdir="$dir/$origobjdir"
- fi
- func_basename "$file"
- name="$func_basename_result"
- test "$mode" = uninstall && objdir="$dir"
-
- # Remember objdir for removal later, being careful to avoid duplicates
- if test "$mode" = clean; then
- case " $rmdirs " in
- *" $objdir "*) ;;
- *) rmdirs="$rmdirs $objdir" ;;
- esac
- fi
-
- # Don't error if the file doesn't exist and rm -f was used.
- if { test -L "$file"; } >/dev/null 2>&1 ||
- { test -h "$file"; } >/dev/null 2>&1 ||
- test -f "$file"; then
- :
- elif test -d "$file"; then
- exit_status=1
- continue
- elif test "$rmforce" = yes; then
- continue
- fi
-
- rmfiles="$file"
-
- case $name in
- *.la)
- # Possibly a libtool archive, so verify it.
- if func_lalib_p "$file"; then
- func_source $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-
- case "$mode" in
- clean)
- case " $library_names " in
- # " " in the beginning catches empty $dlname
- *" $dlname "*) ;;
- *) rmfiles="$rmfiles $objdir/$dlname" ;;
- esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
- ;;
- uninstall)
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
- fi
-
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
- fi
- # FIXME: should reinstall the best remaining shared library.
- ;;
- esac
- fi
- ;;
-
- *.lo)
- # Possibly a libtool object, so verify it.
- if func_lalib_p "$file"; then
-
- # Read the .lo file
- func_source $dir/$name
-
- # Add PIC object to the list of files to remove.
- if test -n "$pic_object" &&
- test "$pic_object" != none; then
- rmfiles="$rmfiles $dir/$pic_object"
- fi
-
- # Add non-PIC object to the list of files to remove.
- if test -n "$non_pic_object" &&
- test "$non_pic_object" != none; then
- rmfiles="$rmfiles $dir/$non_pic_object"
- fi
- fi
- ;;
-
- *)
- if test "$mode" = clean ; then
- noexename=$name
- case $file in
- *.exe)
- func_stripname '' '.exe' "$file"
- file=$func_stripname_result
- func_stripname '' '.exe' "$name"
- noexename=$func_stripname_result
- # $file with .exe has already been added to rmfiles,
- # add $file without .exe
- rmfiles="$rmfiles $file"
- ;;
- esac
- # Do a test to see if this is a libtool program.
- if func_ltwrapper_p "$file"; then
- if func_ltwrapper_executable_p "$file"; then
- func_ltwrapper_scriptname "$file"
- relink_command=
- func_source $func_ltwrapper_scriptname_result
- rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
- else
- relink_command=
- func_source $dir/$noexename
- fi
-
- # note $name still contains .exe if it was in $file originally
- # as does the version of $file that was added into $rmfiles
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- if test "X$noexename" != "X$name" ; then
- rmfiles="$rmfiles $objdir/lt-${noexename}.c"
- fi
- fi
- fi
- ;;
- esac
- func_show_eval "$RM $rmfiles" 'exit_status=1'
- done
- objdir="$origobjdir"
-
- # Try to remove the ${objdir}s in the directories where we deleted files
- for dir in $rmdirs; do
- if test -d "$dir"; then
- func_show_eval "rmdir $dir >/dev/null 2>&1"
- fi
- done
-
- exit $exit_status
-}
-
-{ test "$mode" = uninstall || test "$mode" = clean; } &&
- func_mode_uninstall ${1+"$@"}
-
-test -z "$mode" && {
- help="$generic_help"
- func_fatal_help "you must specify a MODE"
-}
-
-test -z "$exec_cmd" && \
- func_fatal_help "invalid operation mode \`$mode'"
-
-if test -n "$exec_cmd"; then
- eval exec "$exec_cmd"
- exit $EXIT_FAILURE
-fi
-
-exit $exit_status
-
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries. Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them. This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration. But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
-# vi:sw=2
-
diff --git a/main.mk b/main.mk
index 2cc1d63588..cedea063f2 100644
--- a/main.mk
+++ b/main.mk
@@ -25,11 +25,11 @@
#
TOP ?= $(PWD)
#
-# $(VERSION.XYZ) =
+# $(PACKAGE_VERSION) =
#
# The MAJOR.MINOR.PATCH version number of this build.
#
-VERSION.XYZ ?=
+PACKAGE_VERSION ?=
#
# $(B.cc) =
#
@@ -141,12 +141,12 @@ LDFLAGS.dlopen ?= -ldl
LDFLAGS.shobj ?= -shared
LDFLAGS.icu ?= # -licui18n -licuuc -licudata
# libreadline (or a workalike):
-# To activate readline in the shell: SHELL_OPT = -DHAVE_READLINE
+# To activate readline in the shell: SHELL_OPT = -DHAVE_READLINE=1
LDFLAGS.readline ?= -lreadline # these vary wildly across platforms
CFLAGS.readline ?= -I$(prefix)/include/readline
# ^^^ When using linenoise instead of readline, do something like:
-# SHELL_OPT += -DHAVE_LINENOISE
-# CFLAGS.readline = $(HOME)/linenoise $(HOME)/linenoise/linenoise.c
+# SHELL_OPT += -DHAVE_LINENOISE=1
+# CFLAGS.readline = -I$(HOME)/linenoise $(HOME)/linenoise/linenoise.c
# LDFLAGS.readline = # empty
#
@@ -167,6 +167,14 @@ INSTALL ?= install
#
ENABLE_SHARED ?= 1
#
+# $(ENABLE_STATIC) =
+#
+# 1 if libsqlite3.$(T.lib) should be built. Some components,
+# e.g. libtclsqlite3 and some test apps, implicitly require the static
+# library and will ignore this preference.
+#
+ENABLE_STATIC ?= 1
+#
# $(USE_AMALGAMATION)
#
# 1 if the amalgamation (sqlite3.c/h) should be built/used, otherwise
@@ -204,23 +212,11 @@ OPT_FEATURE_FLAGS ?=
#
SHELL_OPT ?=
#
-# The following TCL_vars come from tclConfig.sh
+# TCL_CONFIG_SH must, for some of the build targets, refer to a valid
+# tclConfig.sh. That script will be used to populate most of the other
+# TCL-related vars the build needs.
#
-# Potential TODO: a shell script, similar tool/tclConfigShToTcl.sh,
-# which emits these vars in a format which we can include from this
-# makefile.
-#
-TCL_INCLUDE_SPEC ?=
-TCL_LIB_SPEC ?=
-TCL_STUB_LIB_SPEC ?=
-TCL_EXEC_PREFIX ?=
-TCL_VERSION ?=
-TCLLIBDIR ?=
-#
-# $(TCLLIB_RPATH) is the -rpath flag for libtclsqlite3, not
-# libsqlite3, and will usually differ from $(LDFLAGS.rpath).
-#
-TCLLIB_RPATH ?=
+TCL_CONFIG_SH ?=
#
# $(HAVE_WASI_SDK) =
#
@@ -246,9 +242,15 @@ all: sqlite3.h sqlite3.c
#
# $(CFLAGS) should ideally only contain flags which are relevant for
-# all binaries built for the target platform.
+# all binaries built for the target platform. However, many people
+# like to pass it to "make" without realizing that it applies to
+# dozens of apps, and they override core flags when doing so. To help
+# work around that, we expect core-most CFLAGS (only), e.g. -fPIC, to
+# be set in $(CFLAGS.core). That enables people to pass their other
+# CFLAGS without triggering, e.g., "recompile with -fPIC" errors.
#
-T.cc += $(CFLAGS)
+CFLAGS.core ?=
+T.cc += $(CFLAGS.core) $(CFLAGS)
#
# The difference between $(OPT_FEATURE_FLAGS) and $(OPTS) is that the
@@ -298,8 +300,8 @@ T.cc.sqlite ?= $(T.cc)
#
CFLAGS.intree_includes = \
-I. -I$(TOP)/src -I$(TOP)/ext/rtree -I$(TOP)/ext/icu \
- -I$(TOP)/ext/fts3 -I$(TOP)/ext/async -I$(TOP)/ext/session \
- -I$(TOP)/ext/misc -I$(TOP)/ext/userauth
+ -I$(TOP)/ext/fts3 -I$(TOP)/ext/session \
+ -I$(TOP)/ext/misc
T.cc.sqlite += $(CFLAGS.intree_includes)
#
@@ -321,16 +323,22 @@ T.link = $(T.cc.sqlite) $(T.link.extras)
T.link.shared = $(T.link) $(LDFLAGS.shobj)
#
-# LDFLAGS.libsqlite3 should be used with any target which either
-# results in building libsqlite3.so, compiles sqlite3.c directly, or
-# links in either of $(LIBOBJSO) or $(LIBOBJS1). Note that these
-# flags are for the target build platform, not necessarily localhost.
-# i.e. it should be used with $(T.cc.sqlite) or $(T.link) but not $(B.cc).
+# LDFLAGS.libsqlite3 should be used with any deliverable for which any
+# of the following apply:
+#
+# - Results in building libsqlite3.so
+# - Compiles sqlite3.c in to an application
+# - Links with libsqlite3.a
+# - Links in either of $(LIBOBJSO) or $(LIBOBJS1)
+#
+# Note that these flags are for the target build platform, not
+# necessarily localhost. i.e. it should be used with $(T.cc.sqlite)
+# or $(T.link) but not $(B.cc).
#
LDFLAGS.libsqlite3 = \
$(LDFLAGS.rpath) $(LDFLAGS.pthread) \
- $(LDFLAGS.math) $(LDFLAGS.zlib) \
- $(LDFLAGS.dlopen)
+ $(LDFLAGS.math) $(LDFLAGS.dlopen) \
+ $(LDFLAGS.zlib) $(LDFLAGS.icu)
#
# $(install-dir.XYZ) = dirs for installation.
@@ -352,7 +360,7 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \
$(install-dir.lib) $(install-dir.man1) \
$(install-dir.pkgconfig)
$(install-dir.all):
- $(INSTALL) -d $@
+ $(INSTALL) -d "$@"
#
# After jimsh is compiled, we run some sanity checks to ensure that
@@ -390,11 +398,11 @@ distclean: distclean-jimsh
# in other flavors of Make.
#
MAKE_SANITY_CHECK = .main.mk.checks
-$(MAKE_SANITY_CHECK): $(MAKEFILE_LIST)
+$(MAKE_SANITY_CHECK): $(MAKEFILE_LIST) $(TOP)/auto.def
@if [ x = "x$(TOP)" ]; then echo "Missing TOP var" 1>&2; exit 1; fi
@if [ ! -d "$(TOP)" ]; then echo "$(TOP) is not a directory" 1>&2; exit 1; fi
@if [ ! -f "$(TOP)/auto.def" ]; then echo "$(TOP) does not appear to be the top-most source dir" 1>&2; exit 1; fi
- @if [ x = "x$(VERSION.XYZ)" ]; then echo "VERSION.XYZ must be set to the library's X.Y.Z-format version number" 1>&2; exit 1; fi
+ @if [ x = "x$(PACKAGE_VERSION)" ]; then echo "PACKAGE_VERSION must be set to the library's X.Y.Z-format version number" 1>&2; exit 1; fi
@if [ x = "x$(B.cc)" ]; then echo "Missing B.cc var" 1>&2; exit 1; fi
@if [ x = "x$(T.cc)" ]; then echo "Missing T.cc var" 1>&2; exit 1; fi
@if [ x = "x$(B.tclsh)" ]; then echo "Missing B.tclsh var" 1>&2; exit 1; fi
@@ -427,25 +435,26 @@ LIBOBJS0 = alter.o analyze.o attach.o auth.o \
random.o resolve.o rowset.o rtree.o \
sqlite3session.o select.o sqlite3rbu.o status.o stmt.o \
table.o threads.o tokenize.o treeview.o trigger.o \
- update.o upsert.o userauth.o utf.o util.o vacuum.o \
+ update.o upsert.o utf.o util.o vacuum.o \
vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
vdbetrace.o vdbevtab.o vtab.o \
wal.o walker.o where.o wherecode.o whereexpr.o \
window.o
LIBOBJS = $(LIBOBJS0)
+#
# Object files for the amalgamation.
#
LIBOBJS1 = sqlite3.o
-# Determine the real value of LIBOBJ based on the 'configure' script
+#
+# Determine the real value of LIBOBJ based on whether the amalgamation
+# is enabled or not.
#
LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION))
-#LIBSRC0 = $(SRC)
-#LIBSRC1 = sqlite3.c
-#LIBSRC = $(LIBSRC$(USE_AMALGAMATION))
$(LIBOBJ): $(MAKE_SANITY_CHECK)
+#
# All of the source code files.
#
SRC = \
@@ -585,9 +594,6 @@ SRC += \
SRC += \
$(TOP)/ext/session/sqlite3session.c \
$(TOP)/ext/session/sqlite3session.h
-SRC += \
- $(TOP)/ext/userauth/userauth.c \
- $(TOP)/ext/userauth/sqlite3userauth.h
SRC += \
$(TOP)/ext/rbu/sqlite3rbu.h \
$(TOP)/ext/rbu/sqlite3rbu.c
@@ -618,7 +624,6 @@ TESTSRC = \
$(TOP)/src/test8.c \
$(TOP)/src/test9.c \
$(TOP)/src/test_autoext.c \
- $(TOP)/src/test_async.c \
$(TOP)/src/test_backup.c \
$(TOP)/src/test_bestindex.c \
$(TOP)/src/test_blob.c \
@@ -701,7 +706,6 @@ TESTSRC += \
$(TOP)/ext/misc/unionvtab.c \
$(TOP)/ext/misc/wholenumber.c \
$(TOP)/ext/misc/zipfile.c \
- $(TOP)/ext/userauth/userauth.c \
$(TOP)/ext/rtree/test_rtreedoc.c
# Source code to the library files needed by the test fixture
@@ -757,7 +761,6 @@ TESTSRC2 = \
$(TOP)/ext/fts3/fts3_term.c \
$(TOP)/ext/fts3/fts3_tokenizer.c \
$(TOP)/ext/fts3/fts3_write.c \
- $(TOP)/ext/async/sqlite3async.c \
$(TOP)/ext/session/sqlite3session.c \
$(TOP)/ext/misc/stmt.c \
fts5.c
@@ -806,8 +809,6 @@ EXTHDR += \
$(TOP)/ext/icu/sqliteicu.h
EXTHDR += \
$(TOP)/ext/rtree/sqlite3rtree.h
-EXTHDR += \
- $(TOP)/ext/userauth/sqlite3userauth.h
#
# Executables needed for testing
@@ -906,6 +907,56 @@ has_tclsh85:
sh $(TOP)/tool/cktclsh.sh 8.5 $(TCLSH_CMD)
touch has_tclsh85
+#
+# .tclconfig.make has the config info from tclConfig.sh, but in
+# makefile form. If TCL_CONFIG_SH is empty then it will emit
+# empty config state (which is harmless).
+#
+# Alas, it turns out that POSIX make cannot both generate a makefile
+# and import it in the same make invocation (GNU make can), so this
+# approach, while simple to implement and non-intrusive on the targets
+# which require the config state, is not portable.
+#
+# An alternative is $(SOURCE_TCLCONFIG), defined below, but this impl
+# is retained as a reminder of why we cannot portably use this
+# otherwise trivial approach.
+#
+#.tclconfig.make:
+# sh $(TOP)/tool/tclConfigShToMake.sh $(TCL_CONFIG_SH) > .tclconfig.make
+#distclean-tclconfig:
+# rm -f .tclconfig.make
+#distclean: distclean-tclconfig
+#-include .tclconfig.make
+
+#
+# SOURCE_TCLCONFIG is shell code to be run as part of any compilation
+# or link step which requires vars from $(TCL_CONFIG_SH). All targets
+# which use this should also have a dependency on has_tclconfig.
+#
+SOURCE_TCLCONFIG = . $(TCL_CONFIG_SH) || exit $$?
+#
+# T.tcllibdir = shell code to extract the TCLLIBDIR to the tcllibdir
+# shell var and exit with !0 if it cannot be determined. It must be
+# part of a chained series of commands so that the var survives for
+# the following rules in the same recipe.
+#
+# Algo: tcllibdir = the first entry from TCL's $auto_path which refers
+# to an existing dir, then append /sqlite3 to it.
+#
+T.tcllibdir = \
+ if [ x != "x$(TCLLIBDIR)" ]; then tcllibdir="$(TCLLIBDIR)"; else \
+ for tcllibdir in `echo "puts stdout \\$$auto_path" | $(TCLSH_CMD)`; do \
+ [ -d "$$tcllibdir" ] && break; done; \
+ if [ x = "x$$tcllibdir" ]; then echo "Cannot determine TCLLIBDIR" 1>&2; exit 1; fi; \
+ tcllibdir="$$tcllibdir/sqlite3"; \
+ fi; echo "TCLLIBDIR=$$tcllibdir"
+#
+# $(T.compile.tcl) and $(T.link.tcl) are TCL-specific counterparts for $(T.compile)
+# and $(T.link) which first invoke $(SOURCE_TCLCONFIG).
+#
+T.compile.tcl = $(SOURCE_TCLCONFIG); $(T.compile)
+T.link.tcl = $(SOURCE_TCLCONFIG); $(T.link)
+
has_tclconfig:
@if [ x = "x$(TCL_CONFIG_SH)" ]; then \
echo 'TCL_CONFIG_SH must be set to point to a "tclConfig.sh"' 1>&2; exit 1; \
@@ -949,7 +1000,7 @@ sqlite3.h: $(MAKE_SANITY_CHECK) $(TOP)/src/sqlite.h.in \
$(TOP)/VERSION $(B.tclsh) # has_tclsh84
$(B.tclsh) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
-sqlite3.c: .target_source sqlite3.h $(TOP)/tool/mksqlite3c.tcl src-verify \
+sqlite3.c: .target_source sqlite3.h $(TOP)/tool/mksqlite3c.tcl src-verify$(B.exe) \
$(B.tclsh) # has_tclsh84
$(B.tclsh) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_GEN_FLAGS) $(EXTRA_SRC)
cp tsrc/sqlite3ext.h .
@@ -1225,19 +1276,19 @@ whereexpr.o: $(TOP)/src/whereexpr.c $(DEPS_OBJ_COMMON)
window.o: $(TOP)/src/window.c $(DEPS_OBJ_COMMON)
$(T.cc.sqlite) $(CFLAGS.libsqlite3) -c $(TOP)/src/window.c
-tclsqlite.o: $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
- $(T.compile) -DUSE_TCL_STUBS=1 $(TCL_INCLUDE_SPEC) $(CFLAGS.intree_includes) \
+tclsqlite.o: has_tclconfig $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
+ $(T.compile.tcl) -DUSE_TCL_STUBS=1 $$TCL_INCLUDE_SPEC $(CFLAGS.intree_includes) \
-c $(TOP)/src/tclsqlite.c
-tclsqlite-shell.o: $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
- $(T.compile) -DTCLSH -o $@ -c $(TOP)/src/tclsqlite.c $(TCL_INCLUDE_SPEC)
+tclsqlite-shell.o: has_tclconfig $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
+ $(T.compile.tcl) -DTCLSH -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC
-tclsqlite-stubs.o: $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
- $(T.compile) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c $(TCL_INCLUDE_SPEC)
+tclsqlite-stubs.o: has_tclconfig $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
+ $(T.compile.tcl) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC
-tclsqlite3$(T.exe): has_tclconfig tclsqlite-shell.o $(libsqlite3.LIB)
- $(T.link) -o $@ tclsqlite-shell.o \
- $(libsqlite3.LIB) $(TCL_INCLUDE_SPEC) $(TCL_LIB_SPEC) $(LDFLAGS.libsqlite3)
+tclsqlite3$(T.exe): has_tclconfig tclsqlite-shell.o $(libsqlite3.SO)
+ $(T.link.tcl) -o $@ tclsqlite-shell.o \
+ $(libsqlite3.SO) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
# Rules to build opcodes.c and opcodes.h
#
@@ -1278,7 +1329,9 @@ sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl $(B.tclsh) # has_tclsh84
#
$(libsqlite3.LIB): $(LIBOBJ)
$(AR) $(AR.flags) $@ $(LIBOBJ)
-lib: $(libsqlite3.LIB)
+$(libsqlite3.LIB)-1: $(libsqlite3.LIB)
+$(libsqlite3.LIB)-0 $(libsqlite3.LIB)-:
+lib: $(libsqlite3.LIB)-$(ENABLE_STATIC)
all: lib
#
@@ -1292,64 +1345,70 @@ so: $(libsqlite3.SO)-$(ENABLE_SHARED)
all: so
#
-# Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(VERSION.XYZ) and
-# create symlinks which point to it. Do we really need all of this
-# hoop-jumping? Can we not simply install the .so as-is to
-# libsqlite3.so (without the versioned bits)?
+# Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(PACKAGE_VERSION)
+# and create symlinks which point to it:
#
-# The historical SQLite build always used a version number of 0.8.6
-# for reasons lost to history but having something to do with libtool
-# (which is not longer used in this tree).
+# - libsqlite3.so.$(PACKAGE_VERSION)
+# - libsqlite3.so.3 =symlink-> libsqlite3.so.$(PACKAGE_VERSION)
+# - libsqlite3.so =symlink-> libsqlite3.so.3
#
install-so-1: $(install-dir.lib) $(libsqlite3.SO)
- $(INSTALL) $(libsqlite3.SO) $(install-dir.lib)
+ $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)"
@echo "Setting up SO symlinks..."; \
- cd $(install-dir.lib) || exit $$?; \
- rm -f $(libsqlite3.SO).3 $(libsqlite3.SO).$(VERSION.XYZ) || exit $$?; \
- mv $(libsqlite3.SO) $(libsqlite3.SO).$(VERSION.XYZ) || exit $$?; \
- ln -s $(libsqlite3.SO).$(VERSION.XYZ) $(libsqlite3.SO).3 || exit $$?; \
+ cd "$(install-dir.lib)" || exit $$?; \
+ rm -f $(libsqlite3.SO).3 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
+ mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
+ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).3 || exit $$?; \
ln -s $(libsqlite3.SO).3 $(libsqlite3.SO) || exit $$?; \
- ls -la $(libsqlite3.SO) $(libsqlite3.SO).3 $(libsqlite3.SO).$(VERSION.XYZ)
+ ls -la $(libsqlite3.SO) $(libsqlite3.SO).3*
install-so-0 install-so-:
-install: install-so-$(ENABLE_SHARED)
+install-so: install-so-$(ENABLE_SHARED)
+install: install-so
#
# Install $(libsqlite3.LIB)
#
-install-lib: $(install-dir.lib) $(libsqlite3.LIB)
- $(INSTALL.noexec) $(libsqlite3.LIB) $(install-dir.lib)
+install-lib-1: $(install-dir.lib) $(libsqlite3.LIB)
+ $(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)"
+install-lib-0 install-lib-:
+install-lib: install-lib-$(ENABLE_STATIC)
install: install-lib
#
# Install C header files
#
-install-includes: sqlite3.h $(install-dir.include)
- $(INSTALL.noexec) sqlite3.h "$(TOP)/src/sqlite3ext.h" $(install-dir.include)
-install: install-includes
+install-headers: sqlite3.h $(install-dir.include)
+ $(INSTALL.noexec) sqlite3.h "$(TOP)/src/sqlite3ext.h" "$(install-dir.include)"
+install: install-headers
#
# libtclsqlite3...
#
pkgIndex.tcl:
- echo 'package ifneeded sqlite3 $(VERSION.XYZ) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@
+ echo 'package ifneeded sqlite3 $(PACKAGE_VERSION) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@
libtclsqlite3.SO = libtclsqlite3$(T.dll)
-$(libtclsqlite3.SO): tclsqlite.o $(libsqlite3.LIB)
+$(libtclsqlite3.SO): has_tclconfig tclsqlite.o $(libsqlite3.SO)
+ @$(T.tcllibdir); \
+ $(SOURCE_TCLCONFIG); set -x; \
$(T.link.shared) -o $@ tclsqlite.o \
- $(TCL_INCLUDE_SPEC) $(TCL_STUB_LIB_SPEC) $(LDFLAGS.libsqlite3) \
- $(libsqlite3.LIB) $(TCLLIB_RPATH)
+ $$TCL_INCLUDE_SPEC $$TCL_STUB_LIB_SPEC $(LDFLAGS.libsqlite3) \
+ $(libsqlite3.SO) -Wl,-rpath,$$tcllibdir
+# ^^^ that rpath bit is defined as TCL_LD_SEARCH_FLAGS in
+# tclConfig.sh, but it's defined in such a way as to be useless for a
+# _static_ makefile.
$(libtclsqlite3.SO)-1: $(libtclsqlite3.SO)
$(libtclsqlite3.SO)-0 $(libtclsqlite3.SO)-:
libtcl: $(libtclsqlite3.SO)-$(HAVE_TCL)
all: libtcl
-install.tcldir = $(DESTDIR)$(TCLLIBDIR)
-install-tcl-1: install-lib $(libtclsqlite3.SO) pkgIndex.tcl
- @if [ "x$(DESTDIR)" = "x$(install.tcldir)" ]; then echo "TCLLIBDIR is not set." 1>&2; exit 1; fi
- $(INSTALL) -d $(install.tcldir)
- $(INSTALL) $(libtclsqlite3.SO) $(install.tcldir)
- $(INSTALL.noexec) pkgIndex.tcl $(install.tcldir)
+install-tcl-1: $(libtclsqlite3.SO) pkgIndex.tcl
+ @$(T.tcllibdir); set -x; \
+ $(INSTALL) -d "$(DESTDIR)$$tcllibdir"; \
+ $(INSTALL) $(libtclsqlite3.SO) "$(DESTDIR)$$tcllibdir"; \
+ $(INSTALL.noexec) pkgIndex.tcl "$(DESTDIR)$$tcllibdir"
install-tcl-0 install-tcl-:
-install: install-tcl-$(HAVE_TCL)
+install-tcl: install-tcl-$(HAVE_TCL)
+install: install-tcl
tclsqlite3.c: sqlite3.c
echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
@@ -1364,14 +1423,14 @@ CFLAGS.tclextension = $(CFLAGS.intree_includes) $(CFLAGS) $(OPT_FEATURE_FLAGS) $
# by --with-tclsh=
#
tclextension: tclsqlite3.c
- $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only --cc "$(CC)" $(CFLAGS.tclextension)
+ $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only --cc "$(T.cc)" $(CFLAGS.tclextension)
#
# Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD
# to find it.
#
tclextension-install: tclsqlite3.c
- $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --cc "$(CC)" $(CFLAGS.tclextension)
+ $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --cc "$(T.cc)" $(CFLAGS.tclextension)
#
# Install the SQLite TCL extension that is used by $TCLSH_CMD
@@ -1451,9 +1510,9 @@ TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c
TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
testfixture$(T.exe): has_tclconfig has_tclsh85 $(TESTFIXTURE_SRC)
- $(T.link) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
+ $(T.link.tcl) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
-o $@ $(TESTFIXTURE_SRC) \
- $(TCL_LIB_SPEC) $(TCL_INCLUDE_SPEC) \
+ $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC \
$(CFLAGS.libsqlite3) $(LDFLAGS.libsqlite3)
coretestprogs: testfixture$(B.exe) sqlite3$(B.exe)
@@ -1571,7 +1630,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl \
$(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
sqlite3_analyzer$(T.exe): has_tclconfig sqlite3_analyzer.c
- $(T.link) sqlite3_analyzer.c -o $@ $(TCL_LIB_SPEC) $(TCL_INCLUDE_SPEC) $(LDFLAGS.libsqlite3)
+ $(T.link.tcl) sqlite3_analyzer.c -o $@ $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC $(LDFLAGS.libsqlite3)
sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl \
$(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl \
@@ -1579,7 +1638,7 @@ sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl \
$(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c
sqltclsh$(T.exe): has_tclconfig sqltclsh.c
- $(T.link) sqltclsh.c -o $@ $(TCL_INCLUDE_SPEC) $(CFLAGS.libsqlite3) $(TCL_LIB_SPEC) $(LDFLAGS.libsqlite3)
+ $(T.link.tcl) sqltclsh.c -o $@ $$TCL_INCLUDE_SPEC $(CFLAGS.libsqlite3) $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
# xbin: target for generic binaries which aren't usually built. It is
# used primarily for testing the build process.
xbin: sqltclsh$(T.exe)
@@ -1604,7 +1663,7 @@ sqlite3_checker.c: $(CHECKER_DEPS) has_tclsh85
$(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@
sqlite3_checker$(T.exe): has_tclconfig sqlite3_checker.c
- $(T.link) sqlite3_checker.c -o $@ $(TCL_INCLUDE_SPEC) $(CFLAGS.libsqlite3) $(TCL_LIB_SPEC) $(LDFLAGS.libsqlite3)
+ $(T.link.tcl) sqlite3_checker.c -o $@ $$TCL_INCLUDE_SPEC $(CFLAGS.libsqlite3) $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
xbin: sqlite3_checker$(T.exe)
dbdump$(T.exe): $(TOP)/ext/misc/dbdump.c sqlite3.o
@@ -1755,7 +1814,7 @@ sqlite3$(T.exe): shell.c sqlite3.c
$(T.link) -o $@ \
shell.c sqlite3.c \
$(CFLAGS.readline) $(SHELL_OPT) \
- $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) $(LDFLAGS.icu)
+ $(LDFLAGS.libsqlite3) $(LDFLAGS.readline)
#
# Build sqlite3$(T.exe) by default except in wasi-sdk builds. Yes, the
@@ -1766,7 +1825,7 @@ sqlite3$(T.exe)-0 sqlite3$(T.exe)-: sqlite3$(T.exe)
all: sqlite3$(T.exe)-$(HAVE_WASI_SDK)
install-shell-0: sqlite3$(TEXT) $(install-dir.bin)
- $(INSTALL) -s sqlite3$(TEXT) $(install-dir.bin)
+ $(INSTALL) -s sqlite3$(TEXT) "$(install-dir.bin)"
install-shell-1 install-shell-:
install: install-shell-$(HAVE_WASI_SDK)
@@ -1774,7 +1833,7 @@ sqldiff$(T.exe): $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o
$(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3)
install-diff: sqldiff$(T.exe) $(install-dir.bin)
- $(INSTALL) -s sqldiff$(TEXT) $(install-dir.bin)
+ $(INSTALL) -s sqldiff$(TEXT) "$(install-dir.bin)"
#install: install-diff
dbhash$(T.exe): $(TOP)/tool/dbhash.c sqlite3.o sqlite3.h
@@ -1797,18 +1856,18 @@ sqlite3_rsync$(T.exe): $(RSYNC_SRC)
xbin: sqlite3_rsync$(T.exe)
install-rsync: sqlite3_rsync$(T.exe) $(install-dir.bin)
- $(INSTALL) sqlite3_rsync$(TEXT) $(install-dir.bin)
+ $(INSTALL) sqlite3_rsync$(TEXT) "$(install-dir.bin)"
#install: install-rsync
install-man1: $(install-dir.man1)
- $(INSTALL.noexec) $(TOP)/sqlite3.1 $(install-dir.man1)
+ $(INSTALL.noexec) $(TOP)/sqlite3.1 "$(install-dir.man1)"
install: install-man1
#
# sqlite3.pc is typically generated by the configure script but could
# conceivably be generated by hand.
install-pc: sqlite3.pc $(install-dir.pkgconfig)
- $(INSTALL.noexec) sqlite3.pc $(install-dir.pkgconfig)
+ $(INSTALL.noexec) sqlite3.pc "$(install-dir.pkgconfig)"
scrub$(T.exe): $(TOP)/ext/misc/scrub.c sqlite3.o
$(T.link) -o $@ -I. -DSCRUB_STANDALONE \
@@ -1923,8 +1982,6 @@ mptest: mptester$(T.exe)
# Source and header files that shell.c depends on
SHELL_DEP = \
$(TOP)/src/shell.c.in \
- $(TOP)/ext/consio/console_io.c \
- $(TOP)/ext/consio/console_io.h \
$(TOP)/ext/expert/sqlite3expert.c \
$(TOP)/ext/expert/sqlite3expert.h \
$(TOP)/ext/intck/sqlite3intck.c \
@@ -2005,9 +2062,6 @@ fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(DEPS_EXT_COMMON)
rtree.o: $(TOP)/ext/rtree/rtree.c $(DEPS_EXT_COMMON)
$(T.cc.extension) -c $(TOP)/ext/rtree/rtree.c
-userauth.o: $(TOP)/ext/userauth/userauth.c $(DEPS_EXT_COMMON)
- $(T.cc.extension) -c $(TOP)/ext/userauth/userauth.c
-
sqlite3session.o: $(TOP)/ext/session/sqlite3session.c $(DEPS_EXT_COMMON)
$(T.cc.extension) -c $(TOP)/ext/session/sqlite3session.c
@@ -2027,6 +2081,29 @@ sqlite3.dll: $(LIBOBJ) sqlite3.def
$(T.cc.sqlite) $(LDFLAGS.shobj) -o $@ sqlite3.def \
-Wl,"--strip-all" $(LIBOBJ)
+#
+# Emit a list of commonly-used targets
+help:
+ @echo; echo "Frequently-used high-level make targets:"; echo; \
+ echo " - all [default] = builds most components"; \
+ echo " - clean = cleans up most build products"; \
+ echo " - distclean = cleans up all build products"; \
+ echo " - install = installs activated components"; \
+ echo; echo "Testing-related targets:"; echo; \
+ echo " - test = a number of sanity checks"; \
+ echo " - quicktest = minimal tests"; \
+ echo " - releasetest = pre-release tests"; \
+ echo " - devtest = Minimum tests required before code check-ins"; \
+ echo " - mdevtest = A variant of devtest"; \
+ echo " - sdevtest = A variant of devtest"; \
+ echo " - tcltest = Runs test/veryquick.test"; \
+ echo " - testrunner = Like tcltest but spread across multiple cores"; \
+ echo " - fuzztest = The core fuzz tester (see target docs for important info)"; \
+ echo " - valgrindfuzz = Runs fuzztest under valgrind"; \
+ echo " - soaktest = Really, really long tests"; \
+ echo " - alltest = Runs most or all TCL tests"; \
+ echo
+
# Remove build products sufficient so that subsequent makes will recompile
# everything from scratch. Do not remove:
diff --git a/manifest b/manifest
index 60cee5511d..9f26d1b266 100644
--- a/manifest
+++ b/manifest
@@ -1,11 +1,11 @@
-C Merge\sthe\slatest\strunk\senhancements\sinto\sthe\sreuse-schema\sbranch.
-D 2024-10-25T20:21:57.974
+C Merge\sthe\sreadonly-ignore-wal-jrnl\sfeature\sinto\sa\ssub-branch\sof\sreuse-schema.
+D 2024-10-30T14:24:15.852
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
-F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2
-F Makefile.in 5a95c68b70be1448a6f226c09c1df5e338cc496e70987173fcfdca9ad94cb5a4
-F Makefile.linux-generic 8df0e6ee5e4671f844caf27f88d2be7421e904639f7a0ffdce0e2cd4ea11e8c0 w Makefile.linux-gcc
-F Makefile.msc d9deac6e98e27a29ceb2b22e5cc069e90039fb5128ade945e100422f1d07a2ff
+F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
+F Makefile.in c938c6f4febb0c5d63870bf9f6f8c43e5b20f3e1cfc889460d340add94d40db3
+F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
+F Makefile.msc 382cbcfd8470f07eb722a5ed3d82e4a4b7292f23c2e09a52b65b23d38231d969
F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159
F VERSION 8dc0c3df15fd5ff0622f88fc483533fce990b1cbb2f5fb9fdfb4dbd71eef2889
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
@@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
-F auto.def 44bfd6a96800a552736e2b1c482d2be818aa1e8156c63fb877cbab480d974af0
+F auto.def 246f9d5fd2db744fd8670e2fc02ac2986501bc0fb96041bbe5891b80238e0be9
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@@ -47,9 +47,9 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f
F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14
F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
-F autosetup/hwaci-common.tcl 97b55f68dd190e624340ced9c2de16286edad9db95fede4a184af4249561b4bb
F autosetup/jimsh0.c 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
+F autosetup/proj.tcl fa96b17f000042f467239f2ef3e7a33d4787bc0fb5db4e69bd5bf1e55bb380f4 w autosetup/hwaci-common.tcl
F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f
F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9
@@ -69,11 +69,6 @@ F doc/vdbesort-memory.md 4da2639c14cd24a31e0af694b1a8dd37eaf277aff3867e9a8cc1404
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
F doc/wal-lock.md 781726aaba20bafeceb7ba9f91d5c98c6731691b30c954e37cf0b49a053d461d
F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
-F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
-F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
-F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
-F ext/consio/console_io.c d2b74afae8d301de2e8447b1045fcd33eb59df13bf581d906d99c74fe5d2b13f x
-F ext/consio/console_io.h b5ebe34aa15b357621ebbea3d3f2e2b24750d4280b5802516409e23947fd9ee5
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
F ext/expert/expert1.test 1d2da6606623b57bb47064e02140823ce1daecd4cacbf402c73ad3473d7f000c
@@ -121,7 +116,7 @@ F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a
F ext/fts5/fts5_index.c 368a968570ce12ba40223e284a588d9f93ee23a0133727f0df1fcd64086b1fb6
F ext/fts5/fts5_main.c 50eb059e51d730e8e0c77df4e568b018079e112a755c094488b0d5b1aa06afbb
F ext/fts5/fts5_storage.c 337b05e4c66fc822d031e264d65bde807ec2fab08665ca2cc8aaf9c5fa06792c
-F ext/fts5/fts5_tcl.c 4db9258a7882c5eac0da4433042132aaf15b87dd1e1636c7a6ca203abd2c8bfe
+F ext/fts5/fts5_tcl.c 5b16a249962809b2aaaab964bf58838ea72f30b8b12373cafe612f8cc71e2a40
F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee
F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b
F ext/fts5/fts5_tokenize.c 033e2e43b8e852c0ef6cecc611266d61e2346e52ec7dcfb76a428fe56a07efa9
@@ -256,7 +251,7 @@ F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2
F ext/fts5/test/fts5tokenizer.test 7937cec672b148223fff8746d21d3e7ed0965fd7caf35ccdc888a005bb452f98
F ext/fts5/test/fts5tokenizer2.test ddb8b10fbe4b84b2a75812671f127774c1d2e3e2bf82d2e0e4f0bb1cd8a2b2d6
F ext/fts5/test/fts5tokenizer3.test eea778f7bb7024c3e904e28915f9d53286141671b138722148be22a9c758bdc3
-F ext/fts5/test/fts5trigram.test fb9ee982edd76280ce979905a2251081cd04ae4c470248bd5d391b2d096430ab
+F ext/fts5/test/fts5trigram.test 9927c9e9b35116ea00748c8e41d9cbc2b95a6c90845cd82a59c11fedfd16404a
F ext/fts5/test/fts5trigram2.test 6fde9de7f63a6b4aa18dc731be56dbd6be4e755c9b13dcd55479e200d1df0e61
F ext/fts5/test/fts5ubsan.test 9a2dcf399dc8d0e0de661f0d93884d1d27e5b7f0693cfceb97dd24d818df5dd2
F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602
@@ -620,9 +615,6 @@ F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009e
F ext/session/sqlite3session.c 3d0a7f0f7a1c946e01818c716a55a40ae30542a29a9045cb05daf7fb658cdafa
F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b
F ext/session/test_session.c aa29abdcc9011ac02f4fa38e8ede226106eaeee7c3ea7d8b2b999a124e0c368c
-F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
-F ext/userauth/user-auth.txt ca7e9ee82ca4e1c1744295f8184dd70edfae1992865d26c64303f539eb6c084c
-F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle 7fb73f7150ab79d83bb45a67d257553c905c78cd3d693101699243f36c5ae6c3
F ext/wasm/GNUmakefile 311aa0d5edc7006409962cc77cc26560d92f9be69c2c4302e8bbc68189fd02db
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
@@ -705,35 +697,32 @@ F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35
-F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
-F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
-F main.mk d28aa7355723a24e94c83b9d584db9ed1bc348ff6eb6bc5a42c92917b7d46fb9
+F main.mk 9622a287c30ed269c0443fd3ccbf42ee9122ddea0113b792862ce61ca58329c7
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
F mptest/mptest.c aa41ace6dbc5050d76b02548d3521e6bbccae4f0
F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d
-F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc
-F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
+F sqlite3.pc.in 2d5c88643679fc199dafc9afb6ea8868ea3192d941c2e57dbe06395149d892ba
F sqlite_cfg.h.in be1d075cf77134d53fdf5cc2c0919842e7e02a648c66a56e735af25ccdcaff91
F src/alter.c 2da1deedaeb736237b8a73a59e06428df0bda1a763520ecd9e76eb2824b2ce46
F src/analyze.c d898233cbff9da0b22b0eba75c78527a71a95e00361a7a49efc338b28e1d20c2
-F src/attach.c 1f985e4fe445ece2feb4a18bd612f9d8a9c3fe420d27b8533ef80032c8cd0ead
-F src/auth.c 4c1ea890e0069ad73bead5d17a5b12c34cfa4f1a24175c8147ea439b64be271c
+F src/attach.c da15336ec4d0f4a246815bd092b4b6c78e4e9c57faf9865e310c567f42dde1d0
+F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645
F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c
F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50
F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6
-F src/build.c 648138031b04e573fd9ad6781f0adb0fcd6b6c7d849611918c280f696d7dfab5
+F src/build.c f6c56d42ffed89876230da0694963ce3ab34d6b3f05da83dd2e774761755612a
F src/callback.c fbd4e8247f1a7f37aec721bde0e312e79cc3bfa41f55a59930bc876ca6baf455
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
-F src/ctime.c b224d3db0f28c4a5f1407c50107a0a8133bd244ff3c7f6f8cedeb896a8cf1b64
+F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b
F src/date.c 89ce1ff20512a7fa5070ba6e7dd5c171148ca7d580955795bf97c79c2456144a
F src/dbpage.c db1be8adaf1f839ad733c08baeac5c22aa912f7b535865c0c061382602081360
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
@@ -741,7 +730,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c a9d9f5fdfbdd3b2c94d7af1b11f181464b8a641736cf32cb92fa3c5e7ecb30df
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
-F src/func.c 1d093b93b8f097665721e59a1c404d7db4dc591e1a777a7a1022dfbda21e108b
+F src/func.c fa138d44348e189817542f6efa6232420b3e0081c835ced65883adc7fd777d65
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
@@ -751,7 +740,7 @@ F src/insert.c f8d1a0f8ee258411009c6b7f2d93170e351bd19f5ad89d57e1180644297cbe70
F src/json.c 68a98c020c22127f2d65f08855f7fc7460ff352a6ce0b543d8931dde83319c22
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
-F src/main.c a87eca9472a7f6aa8899e4fdf2b1aa68ea2075b33fd8aa55b0f23192dfa6e14f
+F src/main.c cd6faca7df7c23f5228bd61bef521704b6acf3fbba7dc742ae432de6d4d7e9ab
F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@@ -775,13 +764,13 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210
F src/os_unix.c 0ad4e0885294b3a0e135a18533590ec9ad91ffe82f6a08e55b40babd51772928
F src/os_win.c 970c80992fda8bc026154fc87879609f00c37472004f3a06626521b3868d694e
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
-F src/pager.c 9656ad4e8331efb8a4f94f7a0c6440b98caea073950a367ea0c728a53b8e62c9
+F src/pager.c 9aae5bb8a2bcd5a6347cc2548e7df428a0108b6c52834876ebe12900e5158c47
F src/pager.h 4b1140d691860de0be1347474c51fee07d5420bd7f802d38cbab8ea4ab9f538a
F src/parse.y a7a8d42eeff01d267444ddb476029b0b1726fb70ae3d77984140f17ad02e2d61
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319
-F src/pragma.c 71993e99ce76cb51ffbb2ec531bcb3cca4a1437abab5b0f4e6c1e7f1d48535d9
+F src/pragma.c 82fc31a123da36fdd8966fcb83d43185fd9f0c29de7d5f380770b2feff9ce582
F src/pragma.h 50f6d3b408ed56bde4f4e4aead8c0b2022030b692e8de237c1b7a0b5ce87a0c8
F src/prepare.c 2b6fdbfb4b859aa1b40777019e2f9759dc62c5283cd73f853a06c97acd722804
F src/printf.c 6a87534ebfb9e5346011191b1f3a7ebc457f5938c7e4feeea478ecf53f6a41b2
@@ -789,17 +778,17 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c c8a5372b97b2a2e972a280676f06ddb5b74e885d3b1f5ce383f839907b57ef68
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 4b14337a2742f0c0beeba490e9a05507e9b4b12184b9cd12773501d08d48e3fe
-F src/shell.c.in 081736dcf4377c08737bc7bbc321fbd41e2eb9545fa2fcd3be46d87c744f1597
-F src/sqlite.h.in de975ddb182d7d2fab1ecb98da8fcd7b4c18bc9291237f843915a40d4f501789
+F src/shell.c.in a7351eea9758d4111aea4c9d83c3c62fe9159b64f0463e4d3abb19f45653f959
+F src/sqlite.h.in c61995509640a2fd40970e28394425bdfa42f2f4b046bd96bb93d7c128ea2cb8
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
-F src/sqliteInt.h a2152d7befeb8115eb3807e769f4fbf03f009f689513e07c1f96586c9e75e6d1
+F src/sqliteInt.h 94d55fd7272cf1a553db7dc953e4190cb98065a38d82f0a9c2488592c6cc6f52
F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728
F src/status.c 5028a0afee355aa492f26f0b6a3ec23145caa9261a93164d96cd0b9bf1b2318f
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
-F src/tclsqlite.c 12c9eaef230df8501e616f562be02b489b0a568e1a7328f5144c0898a7467d22
-F src/tclsqlite.h 529047feec49e7f463374749147f64d3f17505b0ebd84b3477a364c6f46a9de1
-F src/test1.c 370668f1832dc7bc2ab0212d807d880b6cdb0d5949550489593ce0cdb4a61012
+F src/tclsqlite.c a068917be2fce183452295ba6fc291bb6f832c64804d5ffd5fd2f9485b28df8a
+F src/tclsqlite.h 65e2c761446e1c9fa0342b7d2612a703483643c8b6a316d12a65b745a4727395
+F src/test1.c 9df74d1d8c0513b0f906942d004b7d7aff5c6f47320a921a0b890748bac0e34d
F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3
F src/test3.c e7573aa0f78ee4e070a4bc8c3493941c1aa64d5c66d4825c74c0f055451f432b
F src/test4.c 13e57ae7ec7a959ee180970aef09deed141252fe9bb07c61054f0dfa4f1dfd5d
@@ -807,13 +796,12 @@ F src/test5.c bb87279ed12e199486894e6c83e58dc8cd1de9524ace171d59219d3ab696a0c1
F src/test6.c 763b92489f11f4a77b773f0d3b8369ab0edd5292ac794043062c337019f12d8a
F src/test8.c 206d8f3cc73950d252906656e2646b5de0d580b07187b635fcb3edd8c2c5fbc0
F src/test9.c 7a708ad27f8fda79113e5e15de66632710958c401e64c2f22bc04e2f5a7a1b62
-F src/test_async.c 0101173cf8137ba5473a84a695281fa9dedc2a1d155998c68623f2978017ad98
F src/test_autoext.c 14d4bbd3d0bd1eec0f6d16b29e28cf1e2d0b020d454835f0721a5f68121ac10f
F src/test_backup.c bd901e3c116c7f3b3bbbd4aae4ce87d99b400c9cbb0a9e7b4610af451d9719a7
F src/test_bestindex.c 3401bee51665cbf7f9ed2552b5795452a8b86365e4c9ece745b54155a55670c6
F src/test_blob.c bcdf6a6c22d0bcc13c41479d63692ef413add2a4d30e1e26b9f74ab85b9fb4d5
F src/test_btree.c 28283787d32b8fa953eb77412ad0de2c9895260e4e5bd5a94b3c7411664f90d5
-F src/test_config.c 828e696c55314e35510a801d21f3890c5b368163757edc2a066db61adeefcdd2
+F src/test_config.c 72ec68c4b8c4d1f06e48f2078a2a25e13c1b092cafaae73788950c0ddf237e2c
F src/test_delete.c e2fe07646dff6300b48d49b2fee2fe192ed389e834dd635e3b3bac0ce0bf9f8f
F src/test_demovfs.c 3efa2adf4f21e10d95521721687d5ca047aea91fa62dd8cc22ac9e5a9c942383
F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86
@@ -841,7 +829,7 @@ F src/test_schemapool.c fc6c14f7a20fcf4fb76e56c7ce3a3bc7056e105efeb11a6476172d5d
F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a
F src/test_superlock.c 18355ca274746aa6909e3744163e5deb1196a85d5bc64b9cd377273cef626da7
F src/test_syscall.c 9ad7ab39910c16d29411678d91b0d27a7a996a718df5ee93dcd635e846d0275c
-F src/test_tclsh.c 3799a1f527224b3ae71c75460f0421a0ce076b3f356b11deae9a68fafbf0f533
+F src/test_tclsh.c b2f529c87674301eb7ce168c6dd2d0a9030a0c75a0d88d85bcb0677195114249
F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424
F src/test_thread.c d7a8bcea7445f37cc2a1f7f81dd6059634f45e0c61bfe80182b02872fb0328bb
F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3
@@ -923,11 +911,6 @@ F test/analyzeE.test d2ec7921c162cdc33ac8e7eb01f9ebf78100610af7c94c8552bbf551de1
F test/analyzeF.test 40b5cc3ad7b10e81020d7ca86f1417647ecfae7477cfd88acc5aa7ae1068f949
F test/analyzeG.test 623be33038c49648872746c8dd8b23b5792c08fef173c55e82f1b12fca259852
F test/analyzer1.test 459fa02c445ddbf0101a3bad47b34290a35f2e49
-F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b
-F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
-F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
-F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
-F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0
F test/atof1.test 7ec56debc04b32e8f9dc87239f4bbb07d84550fb83dd7475b0ead9e83beb35da
F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061
F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da
@@ -1421,7 +1404,7 @@ F test/literal2.tcl 1499037beaf661aeecdbe48801220a181d805372a64c6128d5f26bb6a4a8
F test/literal2.test b149e16b5fc9ee6249069a8858ed41052f222014fe0ba7ad43c2fb989c2dada2
F test/loadext.test faa4f6eed07a5aac35d57fdd7bc07f8fc82464cfd327567c10cf0ba3c86cde04
F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7
-F test/lock.test be4fe08118fb988fed741f429b7dd5d65e1c90db
+F test/lock.test 05f346b65040b9a27c032c984e1e509dfef1661135b4f26a3ab6d21358277803
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
F test/lock4.test 27143363eda1622f03c133efc8db808fc331afd973486cb571ea71cd717d37b8
@@ -1430,7 +1413,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431
F test/lock_common.tcl 2f3f7f2e9637f93ccf609df48ef5b27a50278b6b1cd752b445d52262e5841413
F test/lookaside.test 5a828e7256f1ee4da8e1bdaa03373a3ccdb0f1ff98dfa82e9b76cb41a45b1083
-F test/main.test 1b07447e484d3a3ca8c620c6551258fa51f9cc9fdd56648e8949ea8c836be961
+F test/main.test e8752d76233b1c8906cd2c98ad920dba868bd63c87d51d8a2ea5e9cba55dd496
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/malloc.test 18dd1c4188c81ca79cf123527c71b19ee0c31feb9947fdffb0dc6ceb1436816a
F test/malloc3.test 6e88bae6312854a4adb4ecc2a6a5ea8c59b4db778b724ba718e1c43fc8c3c136
@@ -1463,7 +1446,7 @@ F test/memdb1.test c737ac9aa5895092332b1dde24fae7ae494b7fcbcd346d22d600891096a38
F test/memdb2.test 4ba1fc09e2f51df80d148a540e4a3fa66d0462e91167b27497084de4d1f6b5b4
F test/memjournal.test 70f3a00c7f84ee2978ad14e831231caa1e7f23915a2c54b4f775a021d5740c6c
F test/memjournal2.test dbc2c5cb5f7b38950f4f6dc3e73fcecf0fcbed3fc32c7ce913bba164d288da1e
-F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2
+F test/memleak.test c7478f1195d64887dd1c677edc39fa03b5bf29024e6dcc5b5cc554d7ed00b01f
F test/memsubsys1.test 86b8158752af9188ed5b32a30674a1ef71183e6bc4e6808e815cd658ca9058a6
F test/memsubsys2.test 774b93cb09ca50d1b759bb7c645baa2a9ce172edc3a3da67d5150a26a9fc2a08
F test/merge1.test 7dd9dc6838bcd0623a069485fe3a8dd498a051c16e1877cf84f506c0d6a29b43
@@ -1496,7 +1479,7 @@ F test/mutex1.test 42cb5e244c3a77bb0ef2b967e06fa5e7ba7d32d90a9b20bed98f6f5ede185
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test 73ea63ab43668313e2f8cc9ef9e9a966672c7934f3ce76926fbe991235d07d91
F test/nockpt.test 8c43b25af63b0bd620cf1b003529e37b6f1dc53bd22690e96a1bd73f78dde53a
-F test/nolock.test f196cf8b8fbea4e2ca345140a2b3f3b0da45c76e
+F test/nolock.test 284c72c2b752cf3ffbfd224dfa868bd524e624d3ab5c5ef181fc49ad9df0b444
F test/normalize.test f23b6c5926c59548635fcf39678ac613e726121e073dd902a3062fbb83903b72
F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf
F test/notify2.test 2ecabaa1305083856b7c39cf32816b612740c161
@@ -1542,7 +1525,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/pendingrace.test e99efc5ab3584da3dfc8cd6a0ec4e5a42214820574f5ea24ee93f1d84655f463
F test/percentile.test 52ba89d6ee6b65f770972b67dace358bab7cdbd532803d3db157845268e789cd
-F test/permutations.test 405542f1d659942994a6b38a9e024cf5cfd23eaa68c806aeb24a72d7c9186e80
+F test/permutations.test 37650c5286f7d6f322af95cad876b69c6c2c79c28dc649f09de07d3312b1213c
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 11cb9310c42f921918f7f563e3c0b6e70f9f9c3a6a1cf12af8fccb6c574f3882
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@@ -1569,6 +1552,8 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
F test/readonly.test 69a7ccec846cad2e000b3539d56360d02f327061dc5e41f7f9a3e01f19719952
+F test/readonly2.test 4f4c451adf06e314c3eeed5c5e01e5df8fa10fb3cd5f537a77a48ef50ed97b84
+F test/readonlyfault.test 2b9c98ed3ac47e3f3cb00db3850b4d7fc7c857be1502a7b74985fecf50837b1e
F test/recover.test a163a156ea9f2beea63fa83c4dcd8dea6e57b8a569fc647155e3d2754eaac1b5
F test/regexp1.test 8f2a8bc1569666e29a4cee6c1a666cd224eb6d50e2470d1dc1df995170f3e0f1
F test/regexp2.test 55ed41da802b0e284ac7e2fe944be3948f93ff25abbca0361a609acfed1368b5
@@ -1745,8 +1730,8 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 14284e98554d0a27c3982dcf4b7c4b88cf025ae8e238dd7e2683071c51c371fd
-F test/testrunner.tcl e570e9899be8b04a132ec09bf2e0833c6deaa635a20198b6d807a326ecf85920 x
-F test/testrunner_data.tcl cc042d8fdf059ccfe51b0c863779f5fbb03ef1c14632752193cc37676a923853
+F test/testrunner.tcl 6a63b99f001d30a18a2a28bcb9239001cf1c7ff89e96fe1f1895f9e0d10e22cd x
+F test/testrunner_data.tcl a1f30ea7d7ec017f50ebae0c305aa6833b44c364d02705d328ecc649212076e9
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
@@ -1795,7 +1780,6 @@ F test/tkt-8454a207b9.test ead80b7a01438ca1436cee029694a96c821346cf1e24f06de12f8
F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356
F test/tkt-8c63ff0ec.test 258b7fc8d7e4e1cb5362c7d65c143528b9c4cbed
F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5
-F test/tkt-94c04eaadb.test f738c57c7f68ab8be1c054415af7774617cb6223
F test/tkt-99378177930f87bd.test 9d6cff39b50d062c813ae1cb0ebbd1b7acf81ecc23ae5d5215e5bb05667dc137
F test/tkt-9a8b09f8e6.test b2ef151d0984b2ebf237760dbeaa50724e5a0667
F test/tkt-9d68c883.test 16f7cb96781ba579bc2e19bb14b4ad609d9774b6
@@ -1970,7 +1954,6 @@ F test/upsert5.test 9953b180d02d1369cdbb6c73c900834e5fef8cb78e98e07511c8762ec21c
F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018db8a94b35
F test/uri.test c1abaaaa28e9422d61e5f3f9cbc8ef993ec49fe802f581520731708561d49384
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
-F test/userauth01.test e740a2697a7b40d7c5003a7d7edaee16acd349a9
F test/utf16align.test 9fde0bb5d3a821594aa68c6829ab9c5453a084384137ebb9f6153e2d678039da
F test/vacuum-into.test 77845cee98770c416dae9b0da6bb3229753861f2da65c11b4f9715d081712d8a
F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d
@@ -2165,7 +2148,7 @@ F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176
F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a
F tool/mkccode.tcl 4cb8ad7e7330aaed052b0657a1bfacbc67103c400e41860aff643a482cfc2d3e x
-F tool/mkctimec.tcl e3af51acc2ef92062fe6d622de010a27a34b497258a248dada04388b916c61c6 x
+F tool/mkctimec.tcl ef6a67ec82e5b6fc19152a4c79f237227b18bf67ff16d155bac7adb94355d9cf x
F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559
F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a
F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef
@@ -2176,8 +2159,8 @@ F tool/mkshellc.tcl 2bc29c201933ae72a16a79070fe80aded80c24ea487ecd2f8df20c2973c8
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
-F tool/mksqlite3c.tcl 98a250d6f2ea60343268e32e2997790e678205ce128aa0d0a67a3f70811615af
-F tool/mksqlite3h.tcl 1d996a99cda519e8519e9e514b564fa29b37a49d20263d57494903d685caf067
+F tool/mksqlite3c.tcl 9e88a30981280e33489fe4782f4ab1e5349ba1866603fba7f1a948d5599b9124
+F tool/mksqlite3h.tcl 7a4648fef5efb33308d575c7775eb242855d71d5bf89065df3f006b9a634a0a1
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
F tool/mktoolzip.tcl 34b4e92be544f820e2cc26f143f7d5aec511e826ec394cc82969a5dcf7c7a27c
F tool/mkvsix.tcl 67b40996a50f985a573278eea32fc5a5eb6110bdf14d33f1d8086e48c69e540a
@@ -2208,7 +2191,7 @@ F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d
F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60
F tool/sqldiff.c 2a0987d183027c795ced13d6749061c1d2f38e24eddb428f56fa64c3a8f51e4b
F tool/sqlite3_analyzer.c.in 348ba349bbdc93c9866439f9f935d7284866a2a4e6898bc906ae1204ade56918
-F tool/sqlite3_rsync.c 6c9cac5a9197f591985b271aeff803ec4fb4db36c8eab97e1331ff64aa1b8d94
+F tool/sqlite3_rsync.c 9a1cca2ab1271c59b37a6493c15dc1bcd0ab9149197a9125926bc08dd26b83fb
F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898
F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848
F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4
@@ -2218,6 +2201,7 @@ F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43
F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37
F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d
F tool/symbols.sh 1612bd947750e21e7b47befad5f6b3825b06cce0705441f903bf35ced65ae9b9
+F tool/tclConfigShToMake.sh 7c065d81c2d178e15e45a77372c6e5a38b5a1b08755301cd6f20a3a862db7312 x
F tool/tclConfigShToTcl.sh 44ec55046d86a3febb2cb3e099399b41794e80e9cd138eee7b9b016f819e882b x
F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003
F tool/vdbe-compress.tcl fa2f37ab39b2a0087fafb6a7f3ce19503e25e624ffa8ed9951717ab72920c088
@@ -2226,29 +2210,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-F vsixtest/App.xaml b76d3b48860e7454775c47ea38ffea9c4abe3e85
-F vsixtest/App.xaml.cpp 41158ee43269820136fa3bba00c0bd91b26cc38b650ee392aec2a8d823e54318
-F vsixtest/App.xaml.h 4a9768e2983d05600ad1e1c2f1b00a132967da9f
-F vsixtest/Assets/LockScreenLogo.scale-200.png e820c9a3deb909197081b0bf3216c06e13905f0a
-F vsixtest/Assets/SplashScreen.scale-200.png cab70988ca71bebec7bfeb3b6dbafe17b9ab0b4a
-F vsixtest/Assets/Square150x150Logo.scale-200.png e17b40817db7a239fc239d83efcc951fb824e3ff
-F vsixtest/Assets/Square44x44Logo.scale-200.png 2f166237094dea94d952d10b9eeae81806844f1c
-F vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png 5f6a6d391b95a3061ccca6e6fdd6955ede63b4ed
-F vsixtest/Assets/StoreLogo.png 0828b7257db74a4ecd5eeb6b7b4971f0fdc4d9d1
-F vsixtest/Assets/Wide310x150Logo.scale-200.png 04ddefe5bc5f43ae12a7433f6f236ddab101ac42
-F vsixtest/MainPage.xaml 34f49897e3ca533a7e74506ba0759b66eebce151
-F vsixtest/MainPage.xaml.cpp 7f31fc6de751b64676c0924c97a5485d950a91d7
-F vsixtest/MainPage.xaml.h cc05cca10d50a003f6c6e4448b701cdd07f52f29
-F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93
-F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af
-F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c
-F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547
-F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080bb302912
-F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
-F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
-F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d49d28279539e8c82e401e35fa0b687c9b84c45a4f7ab2fa8d60cb20146c8f77 c4da7fa279274e5a6fe214b5c22f17bcf9b40299aeeab5bfbdae2ba0b2de6af0
-R dffee085c2773d37ad76cd25ffb032ca
+P 12fc5fd5e0ec539faf6d0965096e20c2eea1c0cf5fe9704f8f1479a37b10a333 21ed4e78863f2622d756d2f5e0e951f3c4a992913cd1e459b2366cb5bab0153c
+R 395a6787fc56e8a5aa03c2e2f8cded7d
+T *branch * reuse-schema-ro-waljrnl
+T *sym-reuse-schema-ro-waljrnl *
+T -sym-reuse-schema *
U drh
-Z 955a50ee8d8622ad9013c7c7742773f6
+Z 316b4c41033ad0d30b2658f1bc4c53b1
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 1d110f8645..6abb82afde 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-12fc5fd5e0ec539faf6d0965096e20c2eea1c0cf5fe9704f8f1479a37b10a333
+67087fe433ff1d1bdae913becd908658cc03d61556c408091b640d0161a5edca
diff --git a/spec.template b/spec.template
deleted file mode 100644
index 6cc7ab2eab..0000000000
--- a/spec.template
+++ /dev/null
@@ -1,67 +0,0 @@
-%define name sqlite
-%define version SQLITE_VERSION
-%define release 1
-
-Name: %{name}
-Summary: SQLite is a C library that implements an embeddable SQL database engine
-Version: %{version}
-Release: %{release}
-Source: %{name}-%{version}.tar.gz
-Group: System/Libraries
-URL: http://www.sqlite.org/
-License: Public Domain
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
-
-%description
-SQLite is a software library that implements a self-contained, serverless,
-zero-configuration, transactional SQL database engine.
-Programs that link with the SQLite library can have SQL database access
-without running a separate RDBMS process. The distribution comes with a
-standalone command-line access program (sqlite) that can be used to
-administer an SQLite database and which serves as an example of how to
-use the SQLite library.
-
-%package -n %{name}-devel
-Summary: Header files and libraries for developing apps which will use sqlite
-Group: Development/C
-Requires: %{name} = %{version}-%{release}
-
-%description -n %{name}-devel
-The sqlite-devel package contains the header files and libraries needed
-to develop programs that use the SQLite database library.
-
-%prep
-%setup -q -n %{name}
-
-%build
-CFLAGS="%optflags -DNDEBUG=1" CXXFLAGS="%optflags -DNDEBUG=1" ./configure --prefix=%{_prefix}
-
-make
-make doc
-
-%install
-install -d $RPM_BUILD_ROOT/%{_prefix}
-install -d $RPM_BUILD_ROOT/%{_prefix}/bin
-install -d $RPM_BUILD_ROOT/%{_prefix}/include
-install -d $RPM_BUILD_ROOT/%{_prefix}/lib
-make install prefix=$RPM_BUILD_ROOT/%{_prefix}
-
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
-%clean
-rm -fr $RPM_BUILD_ROOT
-
-%files
-%defattr(-, root, root)
-%{_libdir}/*.so*
-%{_bindir}/*
-
-%files -n %{name}-devel
-%defattr(-, root, root)
-%{_libdir}/pkgconfig/sqlite3.pc
-%{_libdir}/*.a
-%{_libdir}/*.la
-%{_includedir}/*
-%doc doc/*
diff --git a/sqlite3.pc.in b/sqlite3.pc.in
index 3799671e61..97f3c1a60d 100644
--- a/sqlite3.pc.in
+++ b/sqlite3.pc.in
@@ -9,5 +9,5 @@ Name: SQLite
Description: SQL database engine
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lsqlite3
-Libs.private: @LIBS@
+Libs.private: @LDFLAGS_MATH@ @LDFLAGS_ICU@
Cflags: -I${includedir}
diff --git a/src/attach.c b/src/attach.c
index 2045d7006d..f8bedcc190 100644
--- a/src/attach.c
+++ b/src/attach.c
@@ -227,15 +227,6 @@ static void attachFunc(
assert( zErrDyn==0 || rc!=SQLITE_OK );
}
}
-#ifdef SQLITE_USER_AUTHENTICATION
- if( rc==SQLITE_OK && !REOPEN_AS_MEMDB(db) ){
- u8 newAuth = 0;
- rc = sqlite3UserAuthCheckLogin(db, zName, &newAuth);
- if( newAuthauth.authLevel ){
- rc = SQLITE_AUTH_USER;
- }
- }
-#endif
if( rc ){
if( ALWAYS(!REOPEN_AS_MEMDB(db)) ){
int iDb = db->nDb - 1;
diff --git a/src/auth.c b/src/auth.c
index fba2c09905..9ec2e7d046 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -112,11 +112,7 @@ int sqlite3AuthReadCol(
int rc; /* Auth callback return code */
if( db->init.busy ) return SQLITE_OK;
- rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext
-#ifdef SQLITE_USER_AUTHENTICATION
- ,db->auth.zAuthUser
-#endif
- );
+ rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext);
if( rc==SQLITE_DENY ){
char *z = sqlite3_mprintf("%s.%s", zTab, zCol);
if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z);
@@ -223,11 +219,7 @@ int sqlite3AuthCheck(
testcase( zArg3==0 );
testcase( pParse->zAuthContext==0 );
- rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext
-#ifdef SQLITE_USER_AUTHENTICATION
- ,db->auth.zAuthUser
-#endif
- );
+ rc = db->xAuth(db->pAuthArg,code,zArg1,zArg2,zArg3,pParse->zAuthContext);
if( rc==SQLITE_DENY ){
sqlite3ErrorMsg(pParse, "not authorized");
pParse->rc = SQLITE_AUTH;
diff --git a/src/build.c b/src/build.c
index 3a3a329395..c04d804625 100644
--- a/src/build.c
+++ b/src/build.c
@@ -189,17 +189,6 @@ void sqlite3FinishCoding(Parse *pParse){
}
sqlite3VdbeAddOp0(v, OP_Halt);
-#if SQLITE_USER_AUTHENTICATION && !defined(SQLITE_OMIT_SHARED_CACHE)
- if( pParse->nTableLock>0 && db->init.busy==0 ){
- sqlite3UserAuthInit(db);
- if( db->auth.authLevelrc = SQLITE_AUTH_USER;
- return;
- }
- }
-#endif
-
/* The cookie mask contains one bit for each database file open.
** (Bit 0 is for main, bit 1 is for temp, and so forth.) Bits are
** set for each database that is used. Generate code to start a
@@ -328,16 +317,6 @@ void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
pParse->nested--;
}
-#if SQLITE_USER_AUTHENTICATION
-/*
-** Return TRUE if zTable is the name of the system table that stores the
-** list of users and their access credentials.
-*/
-int sqlite3UserAuthTable(const char *zTable){
- return sqlite3_stricmp(zTable, "sqlite_user")==0;
-}
-#endif
-
#ifdef SQLITE_ENABLE_SHARED_SCHEMA
/*
** If this database connection was opened with the SQLITE_OPEN_SHARED_SCHEMA
@@ -389,13 +368,6 @@ Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
/* All mutexes are required for schema access. Make sure we hold them. */
assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
-#if SQLITE_USER_AUTHENTICATION
- /* Only the admin user is allowed to know that the sqlite_user table
- ** exists */
- if( db->auth.authLevelnDb; i++){
int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
@@ -4048,9 +4020,6 @@ void sqlite3CreateIndex(
if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
&& db->init.busy==0
&& pTblName!=0
-#if SQLITE_USER_AUTHENTICATION
- && sqlite3UserAuthTable(pTab->zName)==0
-#endif
){
sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
goto exit_create_index;
diff --git a/src/ctime.c b/src/ctime.c
index fe7849fec7..9f358bd27f 100644
--- a/src/ctime.c
+++ b/src/ctime.c
@@ -767,9 +767,6 @@ static const char * const sqlite3azCompileOpt[] = {
#ifdef SQLITE_UNTESTABLE
"UNTESTABLE",
#endif
-#ifdef SQLITE_USER_AUTHENTICATION
- "USER_AUTHENTICATION",
-#endif
#ifdef SQLITE_USE_ALLOCA
"USE_ALLOCA",
#endif
diff --git a/src/func.c b/src/func.c
index 2de16b8aa9..419ce24c62 100644
--- a/src/func.c
+++ b/src/func.c
@@ -2678,9 +2678,6 @@ void sqlite3RegisterBuiltinFunctions(void){
SFUNCTION(load_extension, 1, 0, 0, loadExt ),
SFUNCTION(load_extension, 2, 0, 0, loadExt ),
#endif
-#if SQLITE_USER_AUTHENTICATION
- FUNCTION(sqlite_crypt, 2, 0, 0, sqlite3CryptFunc ),
-#endif
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
DFUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ),
DFUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ),
diff --git a/src/main.c b/src/main.c
index 99a3d469df..8ec9a62157 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1435,10 +1435,6 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
sqlite3Error(db, SQLITE_OK); /* Deallocates any cached error strings. */
sqlite3ValueFree(db->pErr);
sqlite3CloseExtensions(db);
-#if SQLITE_USER_AUTHENTICATION
- sqlite3_free(db->auth.zAuthUser);
- sqlite3_free(db->auth.zAuthPW);
-#endif
db->eOpenState = SQLITE_STATE_ERROR;
diff --git a/src/pager.c b/src/pager.c
index 4f616f0c7f..56f3802214 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -5081,6 +5081,100 @@ sqlite3_file *sqlite3_database_file_object(const char *zName){
}
+#ifdef SQLITE_ENABLE_READONLY_WALJOURNAL
+/*
+** This is used by a read-only database connection in cases where there
+** is a hot journal which cannot be rolled back, but the hot journal was
+** created by an aborted "PRAGMA journal_mode = wal" statement. In this
+** case we can proceed, but must set bytes 18 and 19 of page 1 of the
+** db file to indicate that this is not a wal mode database.
+*/
+static int getPageOneNoWal(
+ Pager *pPager, /* The pager open on the database file */
+ Pgno pgno, /* Page number to fetch */
+ DbPage **ppPage, /* Write a pointer to the page here */
+ int flags /* PAGER_GET_XXX flags */
+){
+ int rc = SQLITE_OK;
+
+ assert( pgno==1 );
+ rc = getPageNormal(pPager, pgno, ppPage, flags);
+ if( rc==SQLITE_OK ){
+ u8 *aPg = (u8*)(*ppPage)->pData;
+ aPg[18] = 1;
+ aPg[19] = 1;
+ }
+ setGetterMethod(pPager);
+ return rc;
+}
+#endif /* SQLITE_ENABLE_READONLY_WALJOURNAL */
+
+/*
+** This function is called after a potentially hot journal has been opened
+** to inspect its contents and determine whether or not it really is a
+** hot journal. The journal is not a hot journal in two cases:
+**
+** * The first byte of the journal is 0x00, or,
+**
+** * The connection is opened read-only, the journal consist of page 1
+** of the db only, and the contents of page 1 differs from the contents
+** of the db only in bytes 18 and 19 (the wal mode setting).
+**
+** If the journal is not hot, then output variable (*pbHot) is set to 0
+** before this function returns. Otherwise, if the journal is hot, (*pbHot)
+** is set to 1.
+*/
+static int checkHotJournal(Pager *pPager, int *pbHot){
+ char aHdr[28];
+ int rc = SQLITE_OK;
+
+ *pbHot = 1;
+ rc = sqlite3OsRead(pPager->jfd, (void *)aHdr, sizeof(aHdr), 0);
+ if( rc==SQLITE_OK ){
+ if( aHdr[0]==0 ){
+ *pbHot = 0;
+ }
+#ifdef SQLITE_ENABLE_READONLY_WALJOURNAL
+ else if( pPager->readOnly ){
+ u32 nPg = sqlite3Get4byte(&aHdr[8]);
+ u32 off = sqlite3Get4byte(&aHdr[20]);
+ u32 pgsz = sqlite3Get4byte(&aHdr[24]);
+
+ if( nPg==0xFFFFFFFF ){
+ i64 sz = 0;
+ rc = sqlite3OsFileSize(pPager->jfd, &sz);
+ nPg = ((sz-off) / pgsz);
+ }
+ if( nPg==1 ){
+ u8 *a1 = 0;
+ a1 = sqlite3_malloc(pgsz*2);
+ if( a1==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ }else{
+ u8 *a2 = &a1[pgsz];
+ rc = sqlite3OsRead(pPager->jfd, a1, pgsz, off+4);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsRead(pPager->fd, a2, pgsz, 0);
+ memcpy(&a2[18], &a1[18], 2);
+ memcpy(&a2[24], &a1[24], 4);
+ memcpy(&a2[92], &a1[92], 8);
+ }
+ if( rc==SQLITE_OK && memcmp(a1, a2, pgsz)==0 ){
+ *pbHot = 0;
+ pPager->xGet = getPageOneNoWal;
+ }
+ sqlite3_free(a1);
+ }
+ }
+ }
+#endif /* SQLITE_ENABLE_READONLY_WALJOURNAL */
+ }
+ if( rc==SQLITE_IOERR_SHORT_READ ){
+ rc = SQLITE_OK;
+ }
+ return rc;
+}
+
/*
** This function is called after transitioning from PAGER_UNLOCK to
** PAGER_SHARED state. It tests if there is a hot journal present in
@@ -5175,15 +5269,10 @@ static int hasHotJournal(Pager *pPager, int *pExists){
rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f);
}
if( rc==SQLITE_OK ){
- u8 first = 0;
- rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0);
- if( rc==SQLITE_IOERR_SHORT_READ ){
- rc = SQLITE_OK;
- }
+ rc = checkHotJournal(pPager, pExists);
if( !jrnlOpen ){
sqlite3OsClose(pPager->jfd);
}
- *pExists = (first!=0);
}else if( rc==SQLITE_CANTOPEN ){
/* If we cannot open the rollback journal file in order to see if
** it has a zero header, that might be due to an I/O error, or
@@ -5434,6 +5523,10 @@ int sqlite3PagerSharedLock(Pager *pPager){
assert( !MEMDB );
pager_unlock(pPager);
assert( pPager->eState==PAGER_OPEN );
+#ifdef SQLITE_ENABLE_READONLY_WALJOURNAL
+ testcase( pPager->xGet==getPageOneNoWal );
+ setGetterMethod(pPager);
+#endif /* SQLITE_ENABLE_READONLY_WALJOURNAL */
}else{
pPager->eState = PAGER_READER;
pPager->hasHeldSharedLock = 1;
@@ -5701,7 +5794,6 @@ static int getPageError(
return pPager->errCode;
}
-
/* Dispatch all page fetch requests to the appropriate getter method.
*/
int sqlite3PagerGet(
@@ -7402,6 +7494,15 @@ int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
assert( state==PAGER_OPEN || state==PAGER_READER );
if( state==PAGER_OPEN ){
rc = sqlite3PagerSharedLock(pPager);
+
+#ifdef SQLITE_ENABLE_READONLY_WALJOURNAL
+ /* If this is a read-only connection, and there is a hot-journal
+ ** created by "PRAGMA journal_mode = wal" in the file-system, then
+ ** the Pager.xGet method may have been set to getPageOneNoWal. Call
+ ** setGetterMethod() here to ensure it is set properly. */
+ testcase( pPager->xGet==getPageOneNoWal );
+ setGetterMethod(pPager);
+#endif /* SQLITE_ENABLE_READONLY_WALJOURNAL */
}
if( pPager->eState==PAGER_READER ){
assert( rc==SQLITE_OK );
diff --git a/src/pragma.c b/src/pragma.c
index 8d59728f3c..5c55f2a0fd 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1150,12 +1150,6 @@ void sqlite3Pragma(
** in auto-commit mode. */
mask &= ~(SQLITE_ForeignKeys);
}
-#if SQLITE_USER_AUTHENTICATION
- if( db->auth.authLevel==UAUTH_User ){
- /* Do not allow non-admin users to modify the schema arbitrarily */
- mask &= ~(SQLITE_WriteSchema);
- }
-#endif
if( sqlite3GetBoolean(zRight, 0) ){
if( (mask & SQLITE_WriteSchema)==0
diff --git a/src/shell.c.in b/src/shell.c.in
index 6feb26fed0..53c5bb2168 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -104,9 +104,6 @@ typedef unsigned short int u16;
typedef sqlite3_int64 i64;
typedef sqlite3_uint64 u64;
typedef unsigned char u8;
-#if SQLITE_USER_AUTHENTICATION
-# include "sqlite3userauth.h"
-#endif
#include
#include
@@ -5771,7 +5768,8 @@ void close_db(sqlite3 *db){
}
}
-#if HAVE_READLINE || HAVE_EDITLINE
+#if (HAVE_READLINE || HAVE_EDITLINE) \
+ && !defined(SQLITE_OMIT_READLINE_COMPLETION)
/*
** Readline completion callbacks
*/
@@ -12045,69 +12043,6 @@ static int do_meta_command(char *zLine, ShellState *p){
}else
#endif
-#if SQLITE_USER_AUTHENTICATION
- if( c=='u' && cli_strncmp(azArg[0], "user", n)==0 ){
- if( nArg<2 ){
- eputz("Usage: .user SUBCOMMAND ...\n");
- rc = 1;
- goto meta_command_exit;
- }
- open_db(p, 0);
- if( cli_strcmp(azArg[1],"login")==0 ){
- if( nArg!=4 ){
- eputz("Usage: .user login USER PASSWORD\n");
- rc = 1;
- goto meta_command_exit;
- }
- rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3],
- strlen30(azArg[3]));
- if( rc ){
- sqlite3_fprintf(stderr,"Authentication failed for user %s\n", azArg[2]);
- rc = 1;
- }
- }else if( cli_strcmp(azArg[1],"add")==0 ){
- if( nArg!=5 ){
- eputz("Usage: .user add USER PASSWORD ISADMIN\n");
- rc = 1;
- goto meta_command_exit;
- }
- rc = sqlite3_user_add(p->db, azArg[2], azArg[3], strlen30(azArg[3]),
- booleanValue(azArg[4]));
- if( rc ){
- sqlite3_fprintf(stderr,"User-Add failed: %d\n", rc);
- rc = 1;
- }
- }else if( cli_strcmp(azArg[1],"edit")==0 ){
- if( nArg!=5 ){
- eputz("Usage: .user edit USER PASSWORD ISADMIN\n");
- rc = 1;
- goto meta_command_exit;
- }
- rc = sqlite3_user_change(p->db, azArg[2], azArg[3], strlen30(azArg[3]),
- booleanValue(azArg[4]));
- if( rc ){
- sqlite3_fprintf(stderr,"User-Edit failed: %d\n", rc);
- rc = 1;
- }
- }else if( cli_strcmp(azArg[1],"delete")==0 ){
- if( nArg!=3 ){
- eputz("Usage: .user delete USER\n");
- rc = 1;
- goto meta_command_exit;
- }
- rc = sqlite3_user_delete(p->db, azArg[2]);
- if( rc ){
- sqlite3_fprintf(stderr,"User-Delete failed: %d\n", rc);
- rc = 1;
- }
- }else{
- eputz("Usage: .user login|add|edit|delete ...\n");
- rc = 1;
- goto meta_command_exit;
- }
- }else
-#endif /* SQLITE_USER_AUTHENTICATION */
-
if( c=='v' && cli_strncmp(azArg[0], "version", n)==0 ){
char *zPtrSz = sizeof(void*)==8 ? "64-bit" : "32-bit";
sqlite3_fprintf(p->out, "SQLite %s %s\n" /*extra-version-info*/,
@@ -13551,7 +13486,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
}
}
if( zHistory ){ shell_read_history(zHistory); }
-#if HAVE_READLINE || HAVE_EDITLINE
+#if (HAVE_READLINE || HAVE_EDITLINE) && !defined(SQLITE_OMIT_READLINE_COMPLETION)
rl_attempted_completion_function = readline_completion;
#elif HAVE_LINENOISE
linenoiseSetCompletionCallback(linenoise_completion, NULL);
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 69ce33b68a..670ab27d32 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -10890,4 +10890,4 @@ int sqlite3_deserialize(
#ifdef __cplusplus
} /* End of the 'extern "C"' block */
#endif
-#endif /* SQLITE3_H */
+/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 56e492db51..22b18ef29c 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1610,47 +1610,11 @@ struct FuncDefHash {
};
#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
-#if defined(SQLITE_USER_AUTHENTICATION)
-# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \
- See ext/userauth/user-auth.txt for details."
-#endif
-#ifdef SQLITE_USER_AUTHENTICATION
-/*
-** Information held in the "sqlite3" database connection object and used
-** to manage user authentication.
-*/
-typedef struct sqlite3_userauth sqlite3_userauth;
-struct sqlite3_userauth {
- u8 authLevel; /* Current authentication level */
- int nAuthPW; /* Size of the zAuthPW in bytes */
- char *zAuthPW; /* Password used to authenticate */
- char *zAuthUser; /* User name used to authenticate */
-};
-
-/* Allowed values for sqlite3_userauth.authLevel */
-#define UAUTH_Unknown 0 /* Authentication not yet checked */
-#define UAUTH_Fail 1 /* User authentication failed */
-#define UAUTH_User 2 /* Authenticated as a normal user */
-#define UAUTH_Admin 3 /* Authenticated as an administrator */
-
-/* Functions used only by user authorization logic */
-int sqlite3UserAuthTable(const char*);
-int sqlite3UserAuthCheckLogin(sqlite3*,const char*,u8*);
-void sqlite3UserAuthInit(sqlite3*);
-void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**);
-
-#endif /* SQLITE_USER_AUTHENTICATION */
-
/*
** typedef for the authorization callback function.
*/
-#ifdef SQLITE_USER_AUTHENTICATION
- typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
- const char*, const char*);
-#else
- typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
- const char*);
-#endif
+typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
+ const char*);
#ifndef SQLITE_OMIT_DEPRECATED
/* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing
@@ -1811,9 +1775,6 @@ struct sqlite3 {
void (*xUnlockNotify)(void **, int); /* Unlock notify callback */
sqlite3 *pNextBlocked; /* Next in list of all blocked connections */
#endif
-#ifdef SQLITE_USER_AUTHENTICATION
- sqlite3_userauth auth; /* User authentication information */
-#endif
};
#ifdef SQLITE_ENABLE_SHARED_SCHEMA
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 5d71469687..c73b42e315 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -1155,9 +1155,6 @@ static int auth_callback(
const char *zArg2,
const char *zArg3,
const char *zArg4
-#ifdef SQLITE_USER_AUTHENTICATION
- ,const char *zArg5
-#endif
){
const char *zCode;
Tcl_DString str;
@@ -1217,9 +1214,6 @@ static int auth_callback(
Tcl_DStringAppendElement(&str, zArg2 ? zArg2 : "");
Tcl_DStringAppendElement(&str, zArg3 ? zArg3 : "");
Tcl_DStringAppendElement(&str, zArg4 ? zArg4 : "");
-#ifdef SQLITE_USER_AUTHENTICATION
- Tcl_DStringAppendElement(&str, zArg5 ? zArg5 : "");
-#endif
rc = Tcl_GlobalEval(pDb->interp, Tcl_DStringValue(&str));
Tcl_DStringFree(&str);
zReply = rc==TCL_OK ? Tcl_GetStringResult(pDb->interp) : "SQLITE_DENY";
diff --git a/src/tclsqlite.h b/src/tclsqlite.h
index 9997e4de26..a9a1262931 100644
--- a/src/tclsqlite.h
+++ b/src/tclsqlite.h
@@ -36,7 +36,7 @@
#if TCL_MAJOR_VERSION==9
# define CONST const
#elif !defined(Tcl_Size)
- typedef int Tcl_Size;
+# define Tcl_Size int
#endif
/****** Any edits to this file must mirrored in tclsqlite.c ***********/
diff --git a/src/test1.c b/src/test1.c
index 5d05667476..b124faa0c4 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -8324,131 +8324,6 @@ static int SQLITE_TCLAPI sorter_test_sort4_helper(
}
-#ifdef SQLITE_USER_AUTHENTICATION
-#include "sqlite3userauth.h"
-/*
-** tclcmd: sqlite3_user_authenticate DB USERNAME PASSWORD
-*/
-static int SQLITE_TCLAPI test_user_authenticate(
- ClientData clientData, /* Unused */
- Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
- int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[] /* Command arguments */
-){
- char *zUser = 0;
- char *zPasswd = 0;
- Tcl_Size nPasswd = 0;
- sqlite3 *db;
- int rc;
-
- if( objc!=4 ){
- Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME PASSWORD");
- return TCL_ERROR;
- }
- if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
- return TCL_ERROR;
- }
- zUser = Tcl_GetString(objv[2]);
- zPasswd = Tcl_GetStringFromObj(objv[3], &nPasswd);
- rc = sqlite3_user_authenticate(db, zUser, zPasswd, (int)nPasswd);
- Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
- return TCL_OK;
-}
-#endif /* SQLITE_USER_AUTHENTICATION */
-
-#ifdef SQLITE_USER_AUTHENTICATION
-/*
-** tclcmd: sqlite3_user_add DB USERNAME PASSWORD ISADMIN
-*/
-static int SQLITE_TCLAPI test_user_add(
- ClientData clientData, /* Unused */
- Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
- int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[] /* Command arguments */
-){
- char *zUser = 0;
- char *zPasswd = 0;
- Tcl_Size nPasswd = 0;
- int isAdmin = 0;
- sqlite3 *db;
- int rc;
-
- if( objc!=5 ){
- Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME PASSWORD ISADMIN");
- return TCL_ERROR;
- }
- if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
- return TCL_ERROR;
- }
- zUser = Tcl_GetString(objv[2]);
- zPasswd = Tcl_GetStringFromObj(objv[3], &nPasswd);
- Tcl_GetBooleanFromObj(interp, objv[4], &isAdmin);
- rc = sqlite3_user_add(db, zUser, zPasswd, (int)nPasswd, isAdmin);
- Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
- return TCL_OK;
-}
-#endif /* SQLITE_USER_AUTHENTICATION */
-
-#ifdef SQLITE_USER_AUTHENTICATION
-/*
-** tclcmd: sqlite3_user_change DB USERNAME PASSWORD ISADMIN
-*/
-static int SQLITE_TCLAPI test_user_change(
- ClientData clientData, /* Unused */
- Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
- int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[] /* Command arguments */
-){
- char *zUser = 0;
- char *zPasswd = 0;
- Tcl_Size nPasswd = 0;
- int isAdmin = 0;
- sqlite3 *db;
- int rc;
-
- if( objc!=5 ){
- Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME PASSWORD ISADMIN");
- return TCL_ERROR;
- }
- if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
- return TCL_ERROR;
- }
- zUser = Tcl_GetString(objv[2]);
- zPasswd = Tcl_GetStringFromObj(objv[3], &nPasswd);
- Tcl_GetBooleanFromObj(interp, objv[4], &isAdmin);
- rc = sqlite3_user_change(db, zUser, zPasswd, (int)nPasswd, isAdmin);
- Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
- return TCL_OK;
-}
-#endif /* SQLITE_USER_AUTHENTICATION */
-
-#ifdef SQLITE_USER_AUTHENTICATION
-/*
-** tclcmd: sqlite3_user_delete DB USERNAME
-*/
-static int SQLITE_TCLAPI test_user_delete(
- ClientData clientData, /* Unused */
- Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
- int objc, /* Number of arguments */
- Tcl_Obj *CONST objv[] /* Command arguments */
-){
- char *zUser = 0;
- sqlite3 *db;
- int rc;
-
- if( objc!=3 ){
- Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME");
- return TCL_ERROR;
- }
- if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
- return TCL_ERROR;
- }
- zUser = Tcl_GetString(objv[2]);
- rc = sqlite3_user_delete(db, zUser);
- Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
- return TCL_OK;
-}
-#endif /* SQLITE_USER_AUTHENTICATION */
/*
** tclcmd: register_dbstat_vtab DB
@@ -9169,12 +9044,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "load_static_extension", tclLoadStaticExtensionCmd },
{ "sorter_test_fakeheap", sorter_test_fakeheap },
{ "sorter_test_sort4_helper", sorter_test_sort4_helper },
-#ifdef SQLITE_USER_AUTHENTICATION
- { "sqlite3_user_authenticate", test_user_authenticate, 0 },
- { "sqlite3_user_add", test_user_add, 0 },
- { "sqlite3_user_change", test_user_change, 0 },
- { "sqlite3_user_delete", test_user_delete, 0 },
-#endif
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
{ "sqlite3_stmt_scanstatus", test_stmt_scanstatus, 0 },
{ "sqlite3_stmt_scanstatus_reset", test_stmt_scanstatus_reset, 0 },
diff --git a/src/test_async.c b/src/test_async.c
deleted file mode 100644
index afe401ac69..0000000000
--- a/src/test_async.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-** 2005 December 14
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-*************************************************************************
-**
-** This file contains a binding of the asynchronous IO extension interface
-** (defined in ext/async/sqlite3async.h) to Tcl.
-*/
-
-#define TCL_THREADS
-#include "tclsqlite.h"
-
-#ifdef SQLITE_ENABLE_ASYNCIO
-
-#include "sqlite3async.h"
-#include "sqlite3.h"
-#include
-
-/* From main.c */
-extern const char *sqlite3ErrName(int);
-
-
-struct TestAsyncGlobal {
- int isInstalled; /* True when async VFS is installed */
-} testasync_g = { 0 };
-
-TCL_DECLARE_MUTEX(testasync_g_writerMutex);
-
-/*
-** sqlite3async_initialize PARENT-VFS ISDEFAULT
-*/
-static int SQLITE_TCLAPI testAsyncInit(
- void * clientData,
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *CONST objv[]
-){
- const char *zParent;
- int isDefault;
- int rc;
-
- if( objc!=3 ){
- Tcl_WrongNumArgs(interp, 1, objv, "PARENT-VFS ISDEFAULT");
- return TCL_ERROR;
- }
- zParent = Tcl_GetString(objv[1]);
- if( !*zParent ) {
- zParent = 0;
- }
- if( Tcl_GetBooleanFromObj(interp, objv[2], &isDefault) ){
- return TCL_ERROR;
- }
-
- rc = sqlite3async_initialize(zParent, isDefault);
- if( rc!=SQLITE_OK ){
- Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
- return TCL_ERROR;
- }
- return TCL_OK;
-}
-
-/*
-** sqlite3async_shutdown
-*/
-static int SQLITE_TCLAPI testAsyncShutdown(
- void * clientData,
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *CONST objv[]
-){
- sqlite3async_shutdown();
- return TCL_OK;
-}
-
-static Tcl_ThreadCreateType tclWriterThread(ClientData pIsStarted){
- Tcl_MutexLock(&testasync_g_writerMutex);
- *((int *)pIsStarted) = 1;
- sqlite3async_run();
- Tcl_MutexUnlock(&testasync_g_writerMutex);
- Tcl_ExitThread(0);
- TCL_THREAD_CREATE_RETURN;
-}
-
-/*
-** sqlite3async_start
-**
-** Start a new writer thread.
-*/
-static int SQLITE_TCLAPI testAsyncStart(
- void * clientData,
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *CONST objv[]
-){
- volatile int isStarted = 0;
- ClientData threadData = (ClientData)&isStarted;
-
- Tcl_ThreadId x;
- const int nStack = TCL_THREAD_STACK_DEFAULT;
- const int flags = TCL_THREAD_NOFLAGS;
- int rc;
-
- rc = Tcl_CreateThread(&x, tclWriterThread, threadData, nStack, flags);
- if( rc!=TCL_OK ){
- Tcl_AppendResult(interp, "Tcl_CreateThread() failed", 0);
- return TCL_ERROR;
- }
-
- while( isStarted==0 ) { /* Busy loop */ }
- return TCL_OK;
-}
-
-/*
-** sqlite3async_wait
-**
-** Wait for the current writer thread to terminate.
-**
-** If the current writer thread is set to run forever then this
-** command would block forever. To prevent that, an error is returned.
-*/
-static int SQLITE_TCLAPI testAsyncWait(
- void * clientData,
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *CONST objv[]
-){
- int eCond;
- if( objc!=1 ){
- Tcl_WrongNumArgs(interp, 1, objv, "");
- return TCL_ERROR;
- }
-
- sqlite3async_control(SQLITEASYNC_GET_HALT, &eCond);
- if( eCond==SQLITEASYNC_HALT_NEVER ){
- Tcl_AppendResult(interp, "would block forever", (char*)0);
- return TCL_ERROR;
- }
-
- Tcl_MutexLock(&testasync_g_writerMutex);
- Tcl_MutexUnlock(&testasync_g_writerMutex);
- return TCL_OK;
-}
-
-/*
-** sqlite3async_control OPTION ?VALUE?
-*/
-static int SQLITE_TCLAPI testAsyncControl(
- void * clientData,
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *CONST objv[]
-){
- int rc = SQLITE_OK;
- int aeOpt[] = { SQLITEASYNC_HALT, SQLITEASYNC_DELAY, SQLITEASYNC_LOCKFILES };
- const char *azOpt[] = { "halt", "delay", "lockfiles", 0 };
- const char *az[] = { "never", "now", "idle", 0 };
- int iVal;
- int eOpt;
-
- if( objc!=2 && objc!=3 ){
- Tcl_WrongNumArgs(interp, 1, objv, "OPTION ?VALUE?");
- return TCL_ERROR;
- }
- if( Tcl_GetIndexFromObj(interp, objv[1], azOpt, "option", 0, &eOpt) ){
- return TCL_ERROR;
- }
- eOpt = aeOpt[eOpt];
-
- if( objc==3 ){
- switch( eOpt ){
- case SQLITEASYNC_HALT: {
- assert( SQLITEASYNC_HALT_NEVER==0 );
- assert( SQLITEASYNC_HALT_NOW==1 );
- assert( SQLITEASYNC_HALT_IDLE==2 );
- if( Tcl_GetIndexFromObj(interp, objv[2], az, "value", 0, &iVal) ){
- return TCL_ERROR;
- }
- break;
- }
- case SQLITEASYNC_DELAY:
- if( Tcl_GetIntFromObj(interp, objv[2], &iVal) ){
- return TCL_ERROR;
- }
- break;
-
- case SQLITEASYNC_LOCKFILES:
- if( Tcl_GetBooleanFromObj(interp, objv[2], &iVal) ){
- return TCL_ERROR;
- }
- break;
- }
-
- rc = sqlite3async_control(eOpt, iVal);
- }
-
- if( rc==SQLITE_OK ){
- rc = sqlite3async_control(
- eOpt==SQLITEASYNC_HALT ? SQLITEASYNC_GET_HALT :
- eOpt==SQLITEASYNC_DELAY ? SQLITEASYNC_GET_DELAY :
- SQLITEASYNC_GET_LOCKFILES, &iVal);
- }
-
- if( rc!=SQLITE_OK ){
- Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
- return TCL_ERROR;
- }
-
- if( eOpt==SQLITEASYNC_HALT ){
- Tcl_SetObjResult(interp, Tcl_NewStringObj(az[iVal], -1));
- }else{
- Tcl_SetObjResult(interp, Tcl_NewIntObj(iVal));
- }
-
- return TCL_OK;
-}
-
-#endif /* SQLITE_ENABLE_ASYNCIO */
-
-/*
-** This routine registers the custom TCL commands defined in this
-** module. This should be the only procedure visible from outside
-** of this module.
-*/
-int Sqlitetestasync_Init(Tcl_Interp *interp){
-#ifdef SQLITE_ENABLE_ASYNCIO
- Tcl_CreateObjCommand(interp,"sqlite3async_start",testAsyncStart,0,0);
- Tcl_CreateObjCommand(interp,"sqlite3async_wait",testAsyncWait,0,0);
-
- Tcl_CreateObjCommand(interp,"sqlite3async_control",testAsyncControl,0,0);
- Tcl_CreateObjCommand(interp,"sqlite3async_initialize",testAsyncInit,0,0);
- Tcl_CreateObjCommand(interp,"sqlite3async_shutdown",testAsyncShutdown,0,0);
-#endif /* SQLITE_ENABLE_ASYNCIO */
- return TCL_OK;
-}
diff --git a/src/test_config.c b/src/test_config.c
index 183400260c..1bee368e9c 100644
--- a/src/test_config.c
+++ b/src/test_config.c
@@ -563,6 +563,14 @@ Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
#endif
+#ifdef SQLITE_ENABLE_READONLY_WALJOURNAL
+ Tcl_SetVar2(
+ interp, "sqlite_options", "readonly_waljournal", "1", TCL_GLOBAL_ONLY);
+#else
+ Tcl_SetVar2(
+ interp, "sqlite_options", "readonly_waljournal", "0", TCL_GLOBAL_ONLY);
+#endif
+
#ifdef SQLITE_OMIT_REINDEX
Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
#else
@@ -745,12 +753,6 @@ Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
#endif
-#ifdef SQLITE_USER_AUTHENTICATION
- Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY);
-#else
- Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY);
-#endif
-
#ifdef SQLITE_MULTIPLEX_EXT_OVWR
Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY);
#else
diff --git a/src/test_tclsh.c b/src/test_tclsh.c
index 429de38e47..421d748d60 100644
--- a/src/test_tclsh.c
+++ b/src/test_tclsh.c
@@ -59,7 +59,6 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
extern int Sqlitetest6_Init(Tcl_Interp*);
extern int Sqlitetest8_Init(Tcl_Interp*);
extern int Sqlitetest9_Init(Tcl_Interp*);
- extern int Sqlitetestasync_Init(Tcl_Interp*);
extern int Sqlitetest_autoext_Init(Tcl_Interp*);
extern int Sqlitetest_blob_Init(Tcl_Interp*);
extern int Sqlitetest_demovfs_Init(Tcl_Interp *);
@@ -132,7 +131,6 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
Sqlitetest6_Init(interp);
Sqlitetest8_Init(interp);
Sqlitetest9_Init(interp);
- Sqlitetestasync_Init(interp);
Sqlitetest_autoext_Init(interp);
Sqlitetest_blob_Init(interp);
Sqlitetest_demovfs_Init(interp);
diff --git a/test/async.test b/test/async.test
deleted file mode 100644
index e1bc08642e..0000000000
--- a/test/async.test
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# May you do good and not evil.
-# May you find forgiveness for yourself and forgive others.
-# May you share freely, never taking more than you give.
-#
-#***********************************************************************
-# This file runs all tests.
-#
-# $Id: async.test,v 1.21 2009/06/05 17:09:12 drh Exp $
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-
-if {[info commands sqlite3async_initialize] eq ""} {
- # The async logic is not built into this system
- finish_test
- return
-}
-
-rename finish_test async_really_finish_test
-proc finish_test {} {
- catch {db close}
- catch {db2 close}
- catch {db3 close}
-}
-if {[info exists G(isquick)]} { set ASYNC_SAVE_ISQUICK $G(isquick) }
-set G(isquick) 1
-
-set ASYNC_INCLUDE {
- insert.test
- insert2.test
- insert3.test
- lock.test
- lock2.test
- lock3.test
- select1.test
- select2.test
- select3.test
- select4.test
- trans.test
-}
-
-# Enable asynchronous IO.
-sqlite3async_initialize "" 1
-
-# This proc flushes the contents of the async-IO queue through to the
-# underlying VFS. A couple of the test scripts identified in $ASYNC_INCLUDE
-# above contain lines like "catch flush_async_queue" in places where
-# this is required for the tests to work in async mode.
-#
-proc flush_async_queue {} {
- sqlite3async_control halt idle
- sqlite3async_start
- sqlite3async_wait
- sqlite3async_control halt never
-}
-
-rename do_test async_really_do_test
-proc do_test {name args} {
- uplevel async_really_do_test async_io-$name $args
- flush_async_queue
-}
-
-foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
- set tail [file tail $testfile]
- if {[lsearch -exact $ASYNC_INCLUDE $tail]<0} continue
- source $testfile
-
- # Make sure everything is flushed through. This is because [source]ing
- # the next test file will delete the database file on disk (using
- # [delete_file]). If the asynchronous backend still has the file
- # open, it will become confused.
- #
- flush_async_queue
-}
-
-# Flush the write-queue and disable asynchronous IO. This should ensure
-# all allocated memory is cleaned up.
-set sqlite3async_trace 1
-flush_async_queue
-sqlite3async_shutdown
-set sqlite3async_trace 0
-
-rename do_test {}
-rename async_really_do_test do_test
-rename finish_test {}
-rename async_really_finish_test finish_test
-
-if {[info exists ASYNC_SAVE_ISQUICK]} { set G(isquick) $ASYNC_SAVE_ISQUICK }
-finish_test
diff --git a/test/async2.test b/test/async2.test
deleted file mode 100644
index 7994a7219d..0000000000
--- a/test/async2.test
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# May you do good and not evil.
-# May you find forgiveness for yourself and forgive others.
-# May you share freely, never taking more than you give.
-#
-#***********************************************************************
-#
-# $Id: async2.test,v 1.12 2009/04/25 08:39:15 danielk1977 Exp $
-
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-
-if {
- [info commands sqlite3async_initialize]=="" ||
- [info command sqlite3_memdebug_fail]==""
-} {
- # The async logic is not built into this system
- puts "Skipping async2 tests: not compiled with required features"
- finish_test
- return
-}
-
-# Enable asynchronous IO.
-
-set setup_script {
- CREATE TABLE counter(c);
- INSERT INTO counter(c) VALUES (1);
-}
-
-set sql_script {
- BEGIN;
- UPDATE counter SET c = 2;
- CREATE TABLE t1(a PRIMARY KEY, b, c);
- CREATE TABLE t2(a PRIMARY KEY, b, c);
- COMMIT;
-
- BEGIN;
- UPDATE counter SET c = 3;
- INSERT INTO t1 VALUES('abcdefghij', 'four', 'score');
- INSERT INTO t2 VALUES('klmnopqrst', 'and', 'seven');
- COMMIT;
-
- UPDATE counter SET c = 'FIN';
-}
-
-db close
-
-foreach err [list ioerr malloc-transient malloc-persistent] {
- set ::go 10
- for {set n 1} {$::go} {incr n} {
- set ::sqlite_io_error_pending 0
- sqlite3_memdebug_fail -1
- forcedelete test.db test.db-journal
- sqlite3 db test.db
- execsql $::setup_script
- db close
-
- sqlite3async_initialize "" 1
- sqlite3 db test.db
- sqlite3_db_config_lookaside db 0 0 0
-
- switch -- $err {
- ioerr { set ::sqlite_io_error_pending $n }
- malloc-persistent { sqlite3_memdebug_fail $n -repeat 1 }
- malloc-transient { sqlite3_memdebug_fail $n -repeat 0 }
- }
-
- catchsql $::sql_script
- db close
-
- sqlite3async_control halt idle
- sqlite3async_start
- sqlite3async_wait
- sqlite3async_control halt never
- sqlite3async_shutdown
-
- set ::sqlite_io_error_pending 0
- sqlite3_memdebug_fail -1
-
- sqlite3 db test.db
- set c [db one {SELECT c FROM counter LIMIT 1}]
- switch -- $c {
- 1 {
- do_test async-$err-1.1.$n {
- execsql {
- SELECT name FROM sqlite_master;
- }
- } {counter}
- }
- 2 {
- do_test async-$err-1.2.$n.1 {
- execsql {
- SELECT * FROM t1;
- }
- } {}
- do_test async-$err-1.2.$n.2 {
- execsql {
- SELECT * FROM t2;
- }
- } {}
- }
- 3 {
- do_test async-$err-1.3.$n.1 {
- execsql {
- SELECT * FROM t1;
- }
- } {abcdefghij four score}
- do_test async-$err-1.3.$n.2 {
- execsql {
- SELECT * FROM t2;
- }
- } {klmnopqrst and seven}
- }
- FIN {
- incr ::go -1
- }
- }
-
- db close
- }
-}
-
-catch {db close}
-
-finish_test
diff --git a/test/async3.test b/test/async3.test
deleted file mode 100644
index 9336b66058..0000000000
--- a/test/async3.test
+++ /dev/null
@@ -1,76 +0,0 @@
-# 2007 September 5
-#
-# The author disclaims copyright to this source code. In place of
-# a legal notice, here is a blessing:
-#
-# May you do good and not evil.
-# May you find forgiveness for yourself and forgive others.
-# May you share freely, never taking more than you give.
-#
-#***********************************************************************
-#
-# The focus of this file is testing the code in test_async.c.
-# Specifically, it tests that the xFullPathname() method of
-# of the asynchronous vfs works correctly.
-#
-# $Id: async3.test,v 1.5 2009/04/25 08:39:15 danielk1977 Exp $
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-
-if { [info commands sqlite3async_initialize]=="" } {
- # The async logic is not built into this system
- puts "Skipping async3 tests: not compiled with required features"
- finish_test
- return
-}
-
-db close
-sqlite3async_initialize "" 1
-#set sqlite3async_trace 1
-sqlite3async_start
-
-set paths {
- chocolate/banana/vanilla/file.db
- chocolate//banana/vanilla/file.db
- chocolate/./banana//vanilla/file.db
- chocolate/banana/./vanilla/file.db
- chocolate/banana/../banana/vanilla/file.db
- chocolate/banana/./vanilla/extra_bit/../file.db
-}
-
-do_test async3-1.0 {
- file mkdir [file join chocolate banana vanilla]
- forcedelete chocolate/banana/vanilla/file.db
- forcedelete chocolate/banana/vanilla/file.db-journal
-} {}
-
-do_test async3-1.1 {
- sqlite3 db chocolate/banana/vanilla/file.db
- execsql {
- CREATE TABLE abc(a, b, c);
- BEGIN;
- INSERT INTO abc VALUES(1, 2, 3);
- }
-} {}
-
-set N 2
-foreach p $paths {
- sqlite3 db2 $p
- do_test async3-1.$N.1 {
- execsql {SELECT * FROM abc} db2
- } {}
- do_test async3-1.$N.2 {
- catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
- } {1 {database is locked}}
- db2 close
- incr N
-}
-
-db close
-
-sqlite3async_control halt idle
-sqlite3async_wait
-sqlite3async_control halt never
-sqlite3async_shutdown
-finish_test
diff --git a/test/async4.test b/test/async4.test
deleted file mode 100644
index 92a820173e..0000000000
--- a/test/async4.test
+++ /dev/null
@@ -1,168 +0,0 @@
-# 2009 April 25
-#
-# The author disclaims copyright to this source code. In place of
-# a legal notice, here is a blessing:
-#
-# May you do good and not evil.
-# May you find forgiveness for yourself and forgive others.
-# May you share freely, never taking more than you give.
-#
-#***********************************************************************
-#
-# $Id: async4.test,v 1.4 2009/06/05 17:09:12 drh Exp $
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-
-# Do not use a codec for tests in this file, as the database file is
-# manipulated directly using tcl scripts (using the [hexio_write] command).
-#
-do_not_use_codec
-
-# These tests only work for Tcl version 8.5 and later on Windows (for now)
-#
-if {$tcl_platform(platform)=="windows"} {
- scan $::tcl_version %f vx
- if {$vx<8.5} {
- finish_test
- return
- }
-}
-
-if {[info commands sqlite3async_initialize] eq ""} {
- # The async logic is not built into this system
- finish_test
- return
-}
-db close
-
-# Test layout:
-#
-# async4.1.*: Test the lockfiles parameter.
-# async4.2.*: Test the delay parameter.
-
-do_test async4.1.1 {
- sqlite3async_initialize {} 0
- sqlite3async_control lockfiles
-} {1}
-do_test async4.1.2 {
- sqlite3async_control lockfiles false
-} {0}
-do_test async4.1.3 {
- sqlite3async_control lockfiles
-} {0}
-do_test async4.1.4 {
- sqlite3async_control lockfiles true
-} {1}
-
-do_test async4.1.5 {
- sqlite3 db test.db -vfs sqlite3async
- execsql { CREATE TABLE t1(a, b, c) }
-} {}
-do_test async4.1.6 {
- list [file exists test.db] [file size test.db]
-} {1 0}
-do_test async4.1.7 {
- sqlite3 db2 test.db
- catchsql { CREATE TABLE t2(a, b, c) } db2
-} {1 {database is locked}}
-do_test async4.1.8 {
- sqlite3async_control halt idle
- sqlite3async_start
- sqlite3async_wait
-} {}
-do_test async4.1.9 {
- catchsql { CREATE TABLE t2(a, b, c) } db2
-} {0 {}}
-do_test async4.1.10 {
- list [catch {sqlite3async_control lockfiles false} msg] $msg
-} {1 SQLITE_MISUSE}
-do_test async4.1.11 {
- db close
- list [catch {sqlite3async_control lockfiles false} msg] $msg
-} {1 SQLITE_MISUSE}
-do_test async4.1.12 {
- sqlite3async_start
- sqlite3async_wait
- sqlite3async_control lockfiles false
-} {0}
-do_test async4.1.13 {
- sqlite3 db test.db -vfs sqlite3async
- execsql { CREATE TABLE t3(a, b, c) } db
-} {}
-do_test async4.1.14 {
- execsql {
- CREATE INDEX i1 ON t2(a);
- CREATE INDEX i2 ON t1(a);
- } db2
-} {}
-do_test async4.1.15 {
- sqlite3async_start
- sqlite3async_wait
- hexio_write test.db 28 00000000
- execsql { pragma integrity_check } db2
-} {{*** in database main ***
-Page 5 is never used}}
-do_test async4.1.16 {
- db close
- db2 close
- sqlite3async_start
- sqlite3async_wait
-} {}
-do_test async4.1.17 {
- sqlite3async_control lockfiles true
-} {1}
-
-do_test async4.2.1 {
- sqlite3async_control delay
-} {0}
-do_test async4.2.2 {
- sqlite3async_control delay 23
-} {23}
-do_test async4.2.3 {
- sqlite3async_control delay
-} {23}
-do_test async4.2.4 {
- sqlite3async_control delay 0
-} {0}
-do_test async4.2.5 {
- sqlite3 db test.db -vfs sqlite3async
-
- execsql { CREATE TABLE t4(a, b) }
- set T1 [lindex [time {
- sqlite3async_start
- sqlite3async_wait
- }] 0]
-
- sqlite3async_control delay 100
- execsql { CREATE TABLE t5(a, b) }
- set T2 [lindex [time {
- sqlite3async_start
- sqlite3async_wait
- }] 0]
-
- expr {($T1+1000000) < $T2}
-} {1}
-
-do_test async4.2.6 {
- sqlite3async_control delay 0
- execsql { CREATE TABLE t6(a, b) }
- set T1 [lindex [time {
- sqlite3async_start
- sqlite3async_wait
- }] 0]
-
- expr {($T1+1000000) < $T2}
-} {1}
-
-do_test async4.2.7 {
- list [catch { sqlite3async_control delay -1 } msg] $msg
-} {1 SQLITE_MISUSE}
-
-do_test async4.2.8 {
- db close
- sqlite3async_start
- sqlite3async_wait
-} {}
-
-finish_test
diff --git a/test/async5.test b/test/async5.test
deleted file mode 100644
index abac11f750..0000000000
--- a/test/async5.test
+++ /dev/null
@@ -1,68 +0,0 @@
-# 2009 July 19
-#
-# May you do good and not evil.
-# May you find forgiveness for yourself and forgive others.
-# May you share freely, never taking more than you give.
-#
-#***********************************************************************
-# This file tests that asynchronous IO is compatible with multi-file
-# transactions.
-#
-# $Id: async5.test,v 1.1 2009/07/18 11:52:04 danielk1977 Exp $
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-
-if {[info commands sqlite3async_initialize] eq ""} {
- # The async logic is not built into this system
- finish_test
- return
-}
-
-db close
-forcedelete test2.db
-sqlite3async_initialize "" 1
-sqlite3async_control halt never
-sqlite3 db test.db
-
-do_test async5-1.1 {
- execsql {
- ATTACH 'test2.db' AS next;
- CREATE TABLE main.t1(a, b);
- CREATE TABLE next.t2(a, b);
- BEGIN;
- INSERT INTO t1 VALUES(1, 2);
- INSERT INTO t2 VALUES(3, 4);
- COMMIT;
- }
-} {}
-do_test async5-1.2 {
- execsql { SELECT * FROM t1 }
-} {1 2}
-do_test async5-1.3 {
- execsql { SELECT * FROM t2 }
-} {3 4}
-do_test async5-1.4 {
- execsql {
- BEGIN;
- INSERT INTO t1 VALUES('a', 'b');
- INSERT INTO t2 VALUES('c', 'd');
- COMMIT;
- }
-} {}
-do_test async5-1.5 {
- execsql { SELECT * FROM t1 }
-} {1 2 a b}
-do_test async5-1.6 {
- execsql { SELECT * FROM t2 }
-} {3 4 c d}
-
-db close
-
-sqlite3async_control halt idle
-sqlite3async_start
-sqlite3async_wait
-sqlite3async_control halt never
-sqlite3async_shutdown
-set sqlite3async_trace 0
-finish_test
diff --git a/test/lock.test b/test/lock.test
index 534aa3b9a4..cacb6d3ff1 100644
--- a/test/lock.test
+++ b/test/lock.test
@@ -21,7 +21,7 @@ source $testdir/tester.tcl
#
do_test lock-1.0 {
# Give a complex pathname to stress the path simplification logic in
- # the vxworks driver and in test_async.
+ # the vxworks driver.
file mkdir tempdir/t1/t2
sqlite3 db2 ./tempdir/../tempdir/t1/.//t2/../../..//test.db
set dummy {}
diff --git a/test/main.test b/test/main.test
index cdf9fb99e0..556a8bdfcc 100644
--- a/test/main.test
+++ b/test/main.test
@@ -472,49 +472,6 @@ do_test main-3.6 {
catchsql {SELECT 'abc' + #9}
} {1 {near "#9": syntax error}}
-# The following test-case tests the linked list code used to manage
-# sqlite3_vfs structures.
-if {$::tcl_platform(platform)=="unix"
- && [info command sqlite3async_initialize]!=""} {
- ifcapable threadsafe {
- do_test main-4.1 {
- sqlite3_crash_enable 1
- sqlite3_crash_enable 0
-
- sqlite3async_initialize "" 1
- sqlite3async_shutdown
-
- sqlite3_crash_enable 1
- sqlite3async_initialize "" 1
- sqlite3_crash_enable 0
- sqlite3async_shutdown
-
- sqlite3_crash_enable 1
- sqlite3async_initialize "" 1
- sqlite3async_shutdown
- sqlite3_crash_enable 0
-
- sqlite3async_initialize "" 1
- sqlite3_crash_enable 1
- sqlite3_crash_enable 0
- sqlite3async_shutdown
-
- sqlite3async_initialize "" 1
- sqlite3_crash_enable 1
- sqlite3async_shutdown
- sqlite3_crash_enable 0
- } {}
- do_test main-4.2 {
- set rc [catch {sqlite3 db test.db -vfs crash} msg]
- list $rc $msg
- } {1 {no such vfs: crash}}
- do_test main-4.3 {
- set rc [catch {sqlite3 db test.db -vfs async} msg]
- list $rc $msg
- } {1 {no such vfs: async}}
- }
-}
-
# Print the version number so that it can be picked up by releasetest.tcl.
#
puts [db one {SELECT 'VERSION: ' ||
diff --git a/test/memleak.test b/test/memleak.test
index a24a901f50..8443162ed6 100644
--- a/test/memleak.test
+++ b/test/memleak.test
@@ -38,8 +38,6 @@ set EXCLUDE {
misuse.test
memleak.test
btree2.test
- async.test
- async2.test
trans.test
crash.test
autovacuum_crash.test
diff --git a/test/nolock.test b/test/nolock.test
index e732dcf13b..8426165dcb 100644
--- a/test/nolock.test
+++ b/test/nolock.test
@@ -16,6 +16,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+set testprefix nolock
unset -nocomplain tvfs_calls
proc tvfs_reset {} {
@@ -217,4 +218,31 @@ if {[permutation]!="inmemory_journal"} {
} {1 {unable to open database file}}
}
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 5.0 {
+ CREATE TABLE t1(x, y);
+ CREATE TABLE t2(x, y);
+ INSERT INTO t1 VALUES(1, 2), (3, 4), (5, 6);
+ INSERT INTO t2 VALUES(1, 2), (3, 4), (5, 6);
+ PRAGMA cache_size = 0;
+ BEGIN;
+ INSERT INTO t1 VALUES(7, 8);
+ INSERT INTO t2 VALUES(7, 8);
+}
+
+do_test 5.1 {
+ forcecopy test.db test.db2
+ forcecopy test.db-journal test.db2-journal
+ sqlite3 db2 file:test.db2?immutable=0 -uri 1 -readonly 1
+
+ list [catch {
+ db2 eval {
+ SELECT * FROM t1;
+ SELECT * FROM t2;
+ }
+ } msg] $msg
+} {1 {attempt to write a readonly database}}
+
finish_test
+
diff --git a/test/permutations.test b/test/permutations.test
index c26d6ead14..5bbef184c7 100644
--- a/test/permutations.test
+++ b/test/permutations.test
@@ -108,14 +108,14 @@ if {$::tcl_platform(platform)!="unix"} {
set alltests [test_set $alltests -exclude crash.test crash2.test]
}
set alltests [test_set $alltests -exclude {
- all.test async.test quick.test veryquick.test
+ all.test quick.test veryquick.test
memleak.test permutations.test soak.test fts3.test
mallocAll.test rtree.test full.test extraquick.test
session.test rbu.test
}]
set allquicktests [test_set $alltests -exclude {
- async2.test async3.test backup_ioerr.test corrupt.test
+ backup_ioerr.test corrupt.test
corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test
crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test
fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
@@ -790,7 +790,7 @@ test_suite "inmemory_journal" -description {
journal3.test 8_3_names.test shmlock.test
pendingrace.test
- pager1.test async4.test corrupt.test filefmt.test pager2.test
+ pager1.test corrupt.test filefmt.test pager2.test
corrupt5.test corruptA.test pageropt.test
# Exclude stmt.test, which expects sub-journals to use temporary files.
@@ -951,12 +951,11 @@ test_suite "safe_append" -description {
set ::G(perm:sqlite3_args) [list -vfs devsym]
sqlite3_simulate_device -char safe_append
} -files [
- test_set $::allquicktests shared_err.test -exclude async3.test
+ test_set $::allquicktests shared_err.test
]
# The set of tests to run on the alternative-pcache
set perm-alt-pcache-testset {
- async.test
attach.test
delete.test delete2.test
index.test
@@ -997,7 +996,7 @@ test_suite "journaltest" -description {
unregister_jt_vfs
} -files [test_set $::allquicktests -exclude {
wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test
- async4.test bigfile.test backcompat.test e_wal* fstat.test mmap2.test
+ bigfile.test backcompat.test e_wal* fstat.test mmap2.test
pager1.test syscall.test tkt3457.test *malloc* mmap* multiplex* nolock*
pager2.test *fault* rowal* snapshot* superlock* symlink.test
delete_db.test shmlock.test chunksize.test
diff --git a/test/readonly2.test b/test/readonly2.test
new file mode 100644
index 0000000000..be1ff88c6f
--- /dev/null
+++ b/test/readonly2.test
@@ -0,0 +1,121 @@
+# 2024 October 30
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# Test that readonly database connections may ignore a hot journal
+# created by an aborted "PRAGMA journal_mode = wal" statement.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+ifcapable !readonly_waljournal {
+ finish_test
+ return
+}
+
+set ::testprefix readonly2
+
+testvfs tvfs -default 1
+tvfs script at_vfs_callback
+tvfs filter {xDelete}
+
+set ::delete_shall_fail 0
+proc at_vfs_callback {method file z args} {
+ if {$::delete_shall_fail} {
+ return "SQLITE_IOERR"
+ }
+ return "SQLITE_OK"
+}
+
+reset_db
+do_execsql_test 1.0 {
+ BEGIN;
+ CREATE TABLE t1(a, b);
+ INSERT INTO t1 VALUES(1, 2), (3, 4), (5, 6);
+ COMMIT;
+}
+
+set ::delete_shall_fail 1
+do_catchsql_test 1.1 {
+ PRAGMA journal_mode = wal;
+} {1 {disk I/O error}}
+
+do_test 1.2 {
+ file exists test.db-journal
+} 1
+
+do_test 1.3 {
+ sqlite3 db2 test.db -readonly 1
+ db2 eval {
+ SELECT * FROM t1
+ }
+} {1 2 3 4 5 6}
+
+do_test 1.4 {
+ file exists test.db-journal
+} 1
+
+set ::delete_shall_fail 0
+do_execsql_test 1.5 {
+ SELECT * FROM t1
+} {1 2 3 4 5 6}
+
+set ::delete_shall_fail 1
+do_catchsql_test 1.6 {
+ PRAGMA user_version = 444;
+} {1 {disk I/O error}}
+
+do_test 1.7 {
+ file exists test.db-journal
+} 1
+
+do_test 1.8 {
+ list [catch { db2 eval { SELECT * FROM t1 } } msg] $msg
+} {1 {attempt to write a readonly database}}
+
+do_test 1.9 {
+ file exists test.db-journal
+} 1
+
+set ::delete_shall_fail 0
+do_execsql_test 1.10 {
+ SELECT * FROM t1
+} {1 2 3 4 5 6}
+
+#---------------------------------------------------------
+reset_db
+
+do_execsql_test 2.1 {
+ CREATE TABLE t1(a, b);
+ INSERT INTO t1 VALUES('abc', 'def');
+}
+
+set ::delete_shall_fail 1
+do_catchsql_test 2.2 {
+ PRAGMA journal_mode = wal;
+} {1 {disk I/O error}}
+
+do_test 2.3 {
+ sqlite3 db2 test.db -readonly 1
+ breakpoint
+ db2 eval {
+ PRAGMA journal_mode = persist;
+ PRAGMA journal_mode = off;
+ }
+} {persist off}
+
+do_test 2.4 {
+ db2 eval {
+ SELECT * FROM t1
+ }
+} {abc def}
+
+finish_test
+
diff --git a/test/readonlyfault.test b/test/readonlyfault.test
new file mode 100644
index 0000000000..eac6f5855c
--- /dev/null
+++ b/test/readonlyfault.test
@@ -0,0 +1,70 @@
+# 2024 October 30
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+ifcapable !readonly_waljournal {
+ finish_test
+ return
+}
+
+set ::testprefix readonlyfault
+
+testvfs tvfs -default 1
+tvfs script at_vfs_callback
+tvfs filter {xDelete}
+
+set ::delete_shall_fail 0
+proc at_vfs_callback {method file z args} {
+ if {$::delete_shall_fail} {
+ return "SQLITE_IOERR"
+ }
+ return "SQLITE_OK"
+}
+
+reset_db
+do_execsql_test 1.0 {
+ BEGIN;
+ CREATE TABLE t1(a, b);
+ INSERT INTO t1 VALUES(1, 2), (3, 4), (5, 6);
+ COMMIT;
+}
+
+set ::delete_shall_fail 1
+do_catchsql_test 1.1 {
+ PRAGMA journal_mode = wal;
+} {1 {disk I/O error}}
+
+do_test 1.2 {
+ file exists test.db-journal
+} 1
+
+db_save_and_close
+
+# Injecting CANTOPEN errors doesn't work here. If such an error occurs
+# while trying to open a potentially hot journal to inspect its contents,
+# the error is ignored and the journal assumed to be hot. Leading to an
+# SQLITE_READONLY error. So only the other types of fault-injection are
+# tested here.
+#
+do_faultsim_test readonlyfault-1 -faults {oom* ioerr* inter* full*} -prep {
+ catch { db close }
+ db_restore
+ sqlite3 db test.db -readonly 1
+} -body {
+ execsql { SELECT count(*), sum(a), sum(b) FROM t1 }
+} -test {
+ faultsim_test_result {0 {3 9 12}}
+}
+
+
+finish_test
diff --git a/test/testrunner.tcl b/test/testrunner.tcl
index 9a4f93c635..6ee49ca9e7 100755
--- a/test/testrunner.tcl
+++ b/test/testrunner.tcl
@@ -663,7 +663,9 @@ if {[llength $argv]>=1
set SQL {SELECT displaytype, displayname, state FROM jobs}
if {$pattern!=""} {
regsub -all {[^a-zA-Z0-9*.-/]} $pattern ? pattern
- append SQL " WHERE displayname GLOB '*$pattern*'"
+ set pattern [string tolower $pattern]
+ append SQL \
+ " WHERE lower(concat(state,' ',displaytype,' ',displayname)) GLOB '*$pattern*'"
}
append SQL " ORDER BY starttime"
diff --git a/test/testrunner_data.tcl b/test/testrunner_data.tcl
index 12f9672749..b5a4fa7fc6 100644
--- a/test/testrunner_data.tcl
+++ b/test/testrunner_data.tcl
@@ -72,11 +72,11 @@ namespace eval trd {
# The following mirrors the set of test suites invoked by "all.test".
#
set all_configs {
- full no_optimization memsubsys1 memsubsys2 singlethread
- multithread onefile utf16 exclusive persistent_journal
+ full no_optimization memsubsys1 memsubsys2 singlethread
+ multithread onefile utf16 exclusive persistent_journal
persistent_journal_error no_journal no_journal_error
- autovacuum_ioerr no_mutex_try fullmutex journaltest
- inmemory_journal pcache0 pcache10 pcache50 pcache90
+ autovacuum_ioerr no_mutex_try fullmutex journaltest
+ inmemory_journal pcache0 pcache10 pcache50 pcache90
pcache100 prepare mmap
}
@@ -91,17 +91,17 @@ namespace eval trd {
-DSQLITE_ENABLE_STMT_SCANSTATUS
}
- # These two are used by [testrunner.tcl mdevtest] (All-O0) and
+ # These two are used by [testrunner.tcl mdevtest] (All-O0) and
# [testrunner.tcl sdevtest] (All-Sanitize).
#
set build(All-Debug) {
- --enable-debug --enable-all
+ --with-debug --enable-all
-DSQLITE_ENABLE_ORDERED_SET_AGGREGATES
}
set build(All-O0) {
-O0 --enable-all
}
- set build(All-Sanitize) {
+ set build(All-Sanitize) {
-DSQLITE_OMIT_LOOKASIDE=1
--enable-all -fsanitize=address,undefined -fno-sanitize-recover=undefined
}
@@ -124,7 +124,7 @@ namespace eval trd {
-DSQLITE_OMIT_LOOKASIDE=1
-DCONFIG_SLOWDOWN_FACTOR=5.0
-DSQLITE_ENABLE_RBU
- --enable-debug
+ --with-debug
--enable-all
}
set build(Stdcall) {
@@ -205,7 +205,7 @@ namespace eval trd {
set build(Debug-Two) {
-DSQLITE_DEFAULT_MEMSTATUS=0
-DSQLITE_MAX_EXPR_DEPTH=0
- --enable-debug
+ --with-debug
}
set build(Fast-One) {
-O6
@@ -576,7 +576,7 @@ proc make_script {cfg srcdir bMsvc} {
}
--enable-fts5 {
lappend opts -DSQLITE_ENABLE_FTS5
- }
+ }
--enable-shared {
lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
}
@@ -586,7 +586,7 @@ proc make_script {cfg srcdir bMsvc} {
}
--enable-all {
}
- --enable-debug {
+ --with-debug {
# lappend makeOpts OPTIMIZATIONS=0
lappend opts -DSQLITE_DEBUG
}
diff --git a/test/tkt-94c04eaadb.test b/test/tkt-94c04eaadb.test
deleted file mode 100644
index 9de8aea28d..0000000000
--- a/test/tkt-94c04eaadb.test
+++ /dev/null
@@ -1,72 +0,0 @@
-# 2009 October 19
-#
-# The author disclaims copyright to this source code. In place of
-# a legal notice, here is a blessing:
-#
-# May you do good and not evil.
-# May you find forgiveness for yourself and forgive others.
-# May you share freely, never taking more than you give.
-#
-#***********************************************************************
-# This file implements regression tests for SQLite library.
-#
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-
-if {[info commands sqlite3async_initialize] eq ""} {
- # The async logic is not built into this system
- finish_test
- return
-}
-
-# Create a database.
-do_test tkt-94c94-1.1 {
- execsql { CREATE TABLE t1(a, b) }
-} {}
-
-# Grow the file to larger than 4096MB (2^32 bytes)
-db close
-if {[catch {fake_big_file 4096 [get_pwd]/test.db} msg]} {
- puts "**** Unable to create a file larger than 4096 MB. *****"
- finish_test
- return
-}
-
-# Switch to async mode.
-sqlite3async_initialize "" 1
-sqlite3 db test.db
-sqlite3 db2 test.db
-
-# Read from and write to the db just past the 4096MB mark.
-#
-do_test tkt-94c94-2.1 {
- execsql { CREATE TABLE t2(x, y) } db
-} {}
-do_test tkt-94c94-2.2 {
- execsql { INSERT INTO t2 VALUES(1, 2) } db2
-} {}
-do_test tkt-94c94-2.3 {
- execsql { SELECT * FROM t2 } db
-} {1 2}
-do_test tkt-94c94-2.4 {
- sqlite3async_control halt idle
- sqlite3async_start
- sqlite3async_wait
-} {}
-do_test tkt-94c94-2.5 {
- execsql { SELECT * FROM t2 } db
-} {1 2}
-do_test tkt-94c94-2.6 {
- sqlite3async_start
- sqlite3async_wait
-} {}
-
-db close
-db2 close
-sqlite3async_start
-sqlite3async_wait
-sqlite3async_control halt never
-sqlite3async_shutdown
-
-finish_test
diff --git a/test/userauth01.test b/test/userauth01.test
deleted file mode 100644
index 644937b192..0000000000
--- a/test/userauth01.test
+++ /dev/null
@@ -1,257 +0,0 @@
-# 2014-09-10
-#
-# The author disclaims copyright to this source code. In place of
-# a legal notice, here is a blessing:
-#
-# May you do good and not evil.
-# May you find forgiveness for yourself and forgive others.
-# May you share freely, never taking more than you give.
-#
-#***********************************************************************
-#
-# This file implements tests of the SQLITE_USER_AUTHENTICATION extension.
-#
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-set testprefix userauth01
-
-ifcapable !userauth {
- finish_test
- return
-}
-
-# Create a no-authentication-required database
-#
-do_execsql_test userauth01-1.0 {
- CREATE TABLE t1(x);
- INSERT INTO t1 VALUES(1),(2.5),('three'),(x'4444'),(NULL);
- SELECT quote(x) FROM t1 ORDER BY x;
- SELECT name FROM sqlite_master;
-} {NULL 1 2.5 'three' X'4444' t1}
-
-# Calling sqlite3_user_authenticate() on a no-authentication-required
-# database connection is a harmless no-op.
-#
-do_test userauth01-1.1 {
- sqlite3_user_authenticate db alice pw-4-alice
- execsql {
- SELECT quote(x) FROM t1 ORDER BY x;
- SELECT name FROM sqlite_master;
- }
-} {NULL 1 2.5 'three' X'4444' t1}
-
-# If sqlite3_user_add(D,U,P,N,A) is called on a no-authentication-required
-# database and A is false, then the call fails with an SQLITE_AUTH error.
-#
-do_test userauth01-1.2 {
- sqlite3_user_add db bob pw-4-bob 0
-} {SQLITE_AUTH}
-do_test userauth01-1.3 {
- execsql {
- SELECT quote(x) FROM t1 ORDER BY x;
- SELECT name FROM sqlite_master;
- }
-} {NULL 1 2.5 'three' X'4444' t1}
-
-# When called on a no-authentication-required
-# database and when A is true, the sqlite3_user_add(D,U,P,N,A) routine
-# converts the database into an authentication-required database and
-# logs the database connection D in using user U with password P,N.
-#
-do_test userauth01-1.4 {
- sqlite3_user_add db alice pw-4-alice 1
-} {SQLITE_OK}
-do_test userauth01-1.5 {
- execsql {
- SELECT quote(x) FROM t1 ORDER BY x;
- SELECT uname, isadmin FROM sqlite_user ORDER BY uname;
- SELECT name FROM sqlite_master ORDER BY name;
- }
-} {NULL 1 2.5 'three' X'4444' alice 1 sqlite_user t1}
-
-# The sqlite3_user_add() interface can be used (by an admin user only)
-# to create a new user.
-#
-do_test userauth01-1.6 {
- sqlite3_user_add db bob pw-4-bob 0
- sqlite3_user_add db cindy pw-4-cindy 0
- sqlite3_user_add db david pw-4-david 0
- execsql {
- SELECT uname, isadmin FROM sqlite_user ORDER BY uname;
- }
-} {alice 1 bob 0 cindy 0 david 0}
-
-# The sqlite_user table is inaccessible (unreadable and unwriteable) to
-# non-admin users and is read-only for admin users. However, if the same
-#
-do_test userauth01-1.7 {
- sqlite3 db2 test.db
- sqlite3_user_authenticate db2 cindy pw-4-cindy
- db2 eval {
- SELECT quote(x) FROM t1 ORDER BY x;
- SELECT name FROM sqlite_master ORDER BY name;
- }
-} {NULL 1 2.5 'three' X'4444' sqlite_user t1}
-do_test userauth01-1.8 {
- catchsql {
- SELECT uname, isadmin FROM sqlite_user ORDER BY uname;
- } db2
-} {1 {no such table: sqlite_user}}
-
-# Any user can change their own password.
-#
-do_test userauth01-1.9 {
- sqlite3_user_change db2 cindy xyzzy-cindy 0
-} {SQLITE_OK}
-do_test userauth01-1.10 {
- sqlite3_user_authenticate db2 cindy pw-4-cindy
-} {SQLITE_AUTH}
-do_test userauth01-1.11 {
- sqlite3_user_authenticate db2 cindy xyzzy-cindy
-} {SQLITE_OK}
-do_test userauth01-1.12 {
- sqlite3_user_change db alice xyzzy-alice 1
-} {SQLITE_OK}
-do_test userauth01-1.13 {
- sqlite3_user_authenticate db alice pw-4-alice
-} {SQLITE_AUTH}
-do_test userauth01-1.14 {
- sqlite3_user_authenticate db alice xyzzy-alice
-} {SQLITE_OK}
-
-# No user may change their own admin privilege setting.
-#
-do_test userauth01-1.15 {
- sqlite3_user_change db alice xyzzy-alice 0
-} {SQLITE_AUTH}
-do_test userauth01-1.16 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 bob 0 cindy 0 david 0}
-do_test userauth01-1.17 {
- sqlite3_user_change db2 cindy xyzzy-cindy 1
-} {SQLITE_AUTH}
-do_test userauth01-1.18 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 bob 0 cindy 0 david 0}
-
-# The sqlite3_user_change() interface can be used to change a users
-# login credentials or admin privilege.
-#
-do_test userauth01-1.20 {
- sqlite3_user_change db david xyzzy-david 1
-} {SQLITE_OK}
-do_test userauth01-1.21 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 bob 0 cindy 0 david 1}
-do_test userauth01-1.22 {
- sqlite3_user_authenticate db2 david xyzzy-david
-} {SQLITE_OK}
-do_test userauth01-1.23 {
- db2 eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 bob 0 cindy 0 david 1}
-do_test userauth01-1.24 {
- sqlite3_user_change db david pw-4-david 0
-} {SQLITE_OK}
-do_test userauth01-1.25 {
- sqlite3_user_authenticate db2 david pw-4-david
-} {SQLITE_OK}
-do_test userauth01-1.26 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 bob 0 cindy 0 david 0}
-do_test userauth01-1.27 {
- catchsql {SELECT uname, isadmin FROM sqlite_user ORDER BY uname} db2
-} {1 {no such table: sqlite_user}}
-
-# Only an admin user can change another users login
-# credentials or admin privilege setting.
-#
-do_test userauth01-1.30 {
- sqlite3_user_change db2 bob xyzzy-bob 1
-} {SQLITE_AUTH}
-do_test userauth01-1.31 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 bob 0 cindy 0 david 0}
-
-# The sqlite3_user_delete() interface can be used (by an admin user only)
-# to delete a user.
-#
-do_test userauth01-1.40 {
- sqlite3_user_delete db bob
-} {SQLITE_OK}
-do_test userauth01-1.41 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 cindy 0 david 0}
-do_test userauth01-1.42 {
- sqlite3_user_delete db2 cindy
-} {SQLITE_AUTH}
-do_test userauth01-1.43 {
- sqlite3_user_delete db2 alice
-} {SQLITE_AUTH}
-do_test userauth01-1.44 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 cindy 0 david 0}
-
-# The currently logged-in user cannot be deleted
-#
-do_test userauth01-1.50 {
- sqlite3_user_delete db alice
-} {SQLITE_AUTH}
-do_test userauth01-1.51 {
- db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
-} {alice 1 cindy 0 david 0}
-
-# When ATTACH-ing new database files to a connection, each newly attached
-# database that is an authentication-required database is checked using
-# the same username and password as supplied to the main database. If that
-# check fails, then the ATTACH command fails with an SQLITE_AUTH error.
-#
-do_test userauth01-1.60 {
- forcedelete test3.db
- sqlite3 db3 test3.db
- sqlite3_user_add db3 alice xyzzy-alice 1
-} {SQLITE_OK}
-do_test userauth01-1.61 {
- db3 eval {
- CREATE TABLE t3(a,b,c); INSERT INTO t3 VALUES(1,2,3);
- SELECT * FROM t3;
- }
-} {1 2 3}
-do_test userauth01-1.62 {
- db eval {
- ATTACH 'test3.db' AS aux;
- SELECT * FROM t1, t3 ORDER BY x LIMIT 1;
- DETACH aux;
- }
-} {{} 1 2 3}
-do_test userauth01-1.63 {
- sqlite3_user_change db alice pw-4-alice 1
- sqlite3_user_authenticate db alice pw-4-alice
- catchsql {
- ATTACH 'test3.db' AS aux;
- }
-} {1 {unable to open database: test3.db}}
-do_test userauth01-1.64 {
- sqlite3_extended_errcode db
-} {SQLITE_AUTH}
-do_test userauth01-1.65 {
- db eval {PRAGMA database_list}
-} {~/test3.db/}
-
-# The sqlite3_set_authorizer() callback is modified to take a 7th parameter
-# which is the username of the currently logged in user, or NULL for a
-# no-authentication-required database.
-#
-proc auth {args} {
- lappend ::authargs $args
- return SQLITE_OK
-}
-do_test authuser01-2.1 {
- unset -nocomplain ::authargs
- db auth auth
- db eval {SELECT x FROM t1}
- set ::authargs
-} {/SQLITE_SELECT {} {} {} {} alice/}
-
-
-finish_test
diff --git a/tool/mkctimec.tcl b/tool/mkctimec.tcl
index a7e897a596..69d25c678e 100755
--- a/tool/mkctimec.tcl
+++ b/tool/mkctimec.tcl
@@ -279,7 +279,6 @@ set boolean_defnil_options {
SQLITE_UNTESTABLE
SQLITE_USE_ALLOCA
SQLITE_USE_FCNTL_TRACE
- SQLITE_USER_AUTHENTICATION
SQLITE_USE_URI
SQLITE_VDBE_COVERAGE
SQLITE_WIN32_MALLOC
diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl
index dd0ce380b4..1b3958f460 100644
--- a/tool/mksqlite3c.tcl
+++ b/tool/mksqlite3c.tcl
@@ -138,6 +138,7 @@ if {[file executable $vsrcprog] && [file readable $srcroot/manifest]} {
puts $out "** is unknown."
}
puts $out [subst {*/
+#ifndef SQLITE_AMALGAMATION
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1}]
if {$addstatic} {
@@ -509,6 +510,7 @@ puts $out \
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }"
puts $out \
-"/************************** End of sqlite3.c ******************************/"
+"#endif /* SQLITE_AMALGAMATION */
+/************************** End of sqlite3.c ******************************/"
close $out
diff --git a/tool/mksqlite3h.tcl b/tool/mksqlite3h.tcl
index 8a723f01a6..c242005a07 100644
--- a/tool/mksqlite3h.tcl
+++ b/tool/mksqlite3h.tcl
@@ -67,7 +67,7 @@ exec $PWD/mksourceid manifest > $tmpfile
set fd [open $tmpfile rb]
set zSourceId [string trim [read $fd]]
close $fd
-#file delete -force $tmpfile
+file delete -force $tmpfile
cd $PWD
# Set up patterns for recognizing API declarations.
@@ -168,3 +168,4 @@ foreach file $filelist {
puts "/******** End of [file tail $file] *********/"
}
}
+puts "#endif /* SQLITE3_H */"
diff --git a/tool/sqlite3_rsync.c b/tool/sqlite3_rsync.c
index 7a453b6cc3..01dcbed050 100644
--- a/tool/sqlite3_rsync.c
+++ b/tool/sqlite3_rsync.c
@@ -1217,6 +1217,7 @@ static void originSide(SQLiteRsync *p){
unsigned int lockBytePage = 0;
unsigned int szPg = 0;
sqlite3_stmt *pCkHash = 0;
+ sqlite3_stmt *pInsHash = 0;
char buf[200];
p->isReplica = 0;
@@ -1281,10 +1282,12 @@ static void originSide(SQLiteRsync *p){
if( pCkHash==0 ){
runSql(p, "CREATE TEMP TABLE badHash(pgno INTEGER PRIMARY KEY)");
pCkHash = prepareStmt(p,
- "INSERT INTO badHash SELECT pgno FROM sqlite_dbpage('main')"
+ "SELECT pgno FROM sqlite_dbpage('main')"
" WHERE pgno=?1 AND hash(data)!=?2"
);
if( pCkHash==0 ) break;
+ pInsHash = prepareStmt(p, "INSERT INTO badHash VALUES(?)");
+ if( pInsHash==0 ) break;
}
p->nHashSent++;
iPage++;
@@ -1292,7 +1295,16 @@ static void originSide(SQLiteRsync *p){
readBytes(p, 20, buf);
sqlite3_bind_blob(pCkHash, 2, buf, 20, SQLITE_STATIC);
rc = sqlite3_step(pCkHash);
- if( rc!=SQLITE_DONE ){
+ if( rc==SQLITE_ROW ){
+ sqlite3_bind_int64(pInsHash, 1, sqlite3_column_int64(pCkHash, 0));
+ rc = sqlite3_step(pInsHash);
+ if( rc!=SQLITE_DONE ){
+ reportError(p, "SQL statement [%s] failed: %s",
+ sqlite3_sql(pInsHash), sqlite3_errmsg(p->db));
+ }
+ sqlite3_reset(pInsHash);
+ }
+ else if( rc!=SQLITE_DONE ){
reportError(p, "SQL statement [%s] failed: %s",
sqlite3_sql(pCkHash), sqlite3_errmsg(p->db));
}
@@ -1302,7 +1314,9 @@ static void originSide(SQLiteRsync *p){
case REPLICA_READY: {
sqlite3_stmt *pStmt;
sqlite3_finalize(pCkHash);
+ sqlite3_finalize(pInsHash);
pCkHash = 0;
+ pInsHash = 0;
if( iPage+1nPage ){
runSql(p, "WITH RECURSIVE c(n) AS"
" (VALUES(%d) UNION ALL SELECT n+1 FROM c WHERE n<%d)"
@@ -1338,6 +1352,7 @@ static void originSide(SQLiteRsync *p){
}
if( pCkHash ) sqlite3_finalize(pCkHash);
+ if( pInsHash ) sqlite3_finalize(pInsHash);
closeDb(p);
}
diff --git a/tool/tclConfigShToMake.sh b/tool/tclConfigShToMake.sh
new file mode 100755
index 0000000000..89ca15ad5b
--- /dev/null
+++ b/tool/tclConfigShToMake.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# A level of indirection for use soley by main.mk to extract info
+# from tclConfig.sh if it's not provided by the configure script.
+#
+# Expects to be passed a full path to a tclConfig.sh. It sources it
+# and emits TCL code which sets some vars which are exported by
+# tclConfig.sh.
+#
+# This script expects that the caller has already validated that the
+# file exists, is not a directory, and is readable.
+#
+# If passed no filename, or an empty one, then it emits config code
+# suitable for the "config not found" case.
+if test x = "x$1"; then
+ TCL_INCLUDE_SPEC=
+ TCL_LIB_SPEC=
+ TCL_STUB_LIB_SPEC=
+ TCL_EXEC_PREFIX=
+ TCL_VERSION=
+else
+ . "$1"
+fi
+
+cat <
-
-
diff --git a/vsixtest/App.xaml.cpp b/vsixtest/App.xaml.cpp
deleted file mode 100644
index c90604a830..0000000000
--- a/vsixtest/App.xaml.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// App.xaml.cpp
-// Implementation of the App class.
-//
-
-#include "pch.h"
-#include "MainPage.xaml.h"
-
-using namespace vsixtest;
-
-using namespace Platform;
-using namespace Windows::ApplicationModel;
-using namespace Windows::ApplicationModel::Activation;
-using namespace Windows::Foundation;
-using namespace Windows::Foundation::Collections;
-using namespace Windows::UI::Xaml;
-using namespace Windows::UI::Xaml::Controls;
-using namespace Windows::UI::Xaml::Controls::Primitives;
-using namespace Windows::UI::Xaml::Data;
-using namespace Windows::UI::Xaml::Input;
-using namespace Windows::UI::Xaml::Interop;
-using namespace Windows::UI::Xaml::Media;
-using namespace Windows::UI::Xaml::Navigation;
-
-///
-/// Initializes the singleton application object. This is the first line of authored code
-/// executed, and as such is the logical equivalent of main() or WinMain().
-///
-App::App()
-{
- InitializeComponent();
- Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
-}
-
-///
-/// Invoked when the application is launched normally by the end user. Other entry points
-/// will be used such as when the application is launched to open a specific file.
-///
-/// Details about the launch request and process.
-void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e)
-{
-
-#if _DEBUG
- // Show graphics profiling information while debugging.
- if (IsDebuggerPresent())
- {
- // Display the current frame rate counters
- DebugSettings->EnableFrameRateCounter = true;
- }
-#endif
-
- auto rootFrame = dynamic_cast(Window::Current->Content);
-
- // Do not repeat app initialization when the Window already has content,
- // just ensure that the window is active
- if (rootFrame == nullptr)
- {
- // Create a Frame to act as the navigation context and associate it with
- // a SuspensionManager key
- rootFrame = ref new Frame();
-
- rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed);
-
- if (e->PreviousExecutionState == ApplicationExecutionState::Terminated)
- {
- // TODO: Restore the saved session state only when appropriate, scheduling the
- // final launch steps after the restore is complete
-
- }
-
- if (rootFrame->Content == nullptr)
- {
- // When the navigation stack isn't restored navigate to the first page,
- // configuring the new page by passing required information as a navigation
- // parameter
- rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
- }
- // Place the frame in the current Window
- Window::Current->Content = rootFrame;
- // Ensure the current window is active
- Window::Current->Activate();
- }
- else
- {
- if (rootFrame->Content == nullptr)
- {
- // When the navigation stack isn't restored navigate to the first page,
- // configuring the new page by passing required information as a navigation
- // parameter
- rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
- }
- // Ensure the current window is active
- Window::Current->Activate();
- }
-}
-
-///
-/// Invoked when application execution is being suspended. Application state is saved
-/// without knowing whether the application will be terminated or resumed with the contents
-/// of memory still intact.
-///
-/// The source of the suspend request.
-/// Details about the suspend request.
-void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
-{
- (void) sender; // Unused parameter
- (void) e; // Unused parameter
-
- //TODO: Save application state and stop any background activity
-}
-
-///
-/// Invoked when Navigation to a certain page fails
-///
-/// The Frame which failed navigation
-/// Details about the navigation failure
-void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e)
-{
- throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name);
-}
diff --git a/vsixtest/App.xaml.h b/vsixtest/App.xaml.h
deleted file mode 100644
index 5fa8837d38..0000000000
--- a/vsixtest/App.xaml.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// App.xaml.h
-// Declaration of the App class.
-//
-
-#pragma once
-
-#include "App.g.h"
-
-namespace vsixtest
-{
- ///
- /// Provides application-specific behavior to supplement the default Application class.
- ///
- ref class App sealed
- {
- protected:
- virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override;
-
- internal:
- App();
-
- private:
- void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
- void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e);
- };
-}
diff --git a/vsixtest/Assets/LockScreenLogo.scale-200.png b/vsixtest/Assets/LockScreenLogo.scale-200.png
deleted file mode 100644
index 735f57adb5..0000000000
Binary files a/vsixtest/Assets/LockScreenLogo.scale-200.png and /dev/null differ
diff --git a/vsixtest/Assets/SplashScreen.scale-200.png b/vsixtest/Assets/SplashScreen.scale-200.png
deleted file mode 100644
index 023e7f1fed..0000000000
Binary files a/vsixtest/Assets/SplashScreen.scale-200.png and /dev/null differ
diff --git a/vsixtest/Assets/Square150x150Logo.scale-200.png b/vsixtest/Assets/Square150x150Logo.scale-200.png
deleted file mode 100644
index af49fec1a5..0000000000
Binary files a/vsixtest/Assets/Square150x150Logo.scale-200.png and /dev/null differ
diff --git a/vsixtest/Assets/Square44x44Logo.scale-200.png b/vsixtest/Assets/Square44x44Logo.scale-200.png
deleted file mode 100644
index ce342a2ec8..0000000000
Binary files a/vsixtest/Assets/Square44x44Logo.scale-200.png and /dev/null differ
diff --git a/vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
deleted file mode 100644
index f6c02ce97e..0000000000
Binary files a/vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ
diff --git a/vsixtest/Assets/StoreLogo.png b/vsixtest/Assets/StoreLogo.png
deleted file mode 100644
index 7385b56c0e..0000000000
Binary files a/vsixtest/Assets/StoreLogo.png and /dev/null differ
diff --git a/vsixtest/Assets/Wide310x150Logo.scale-200.png b/vsixtest/Assets/Wide310x150Logo.scale-200.png
deleted file mode 100644
index 288995b397..0000000000
Binary files a/vsixtest/Assets/Wide310x150Logo.scale-200.png and /dev/null differ
diff --git a/vsixtest/MainPage.xaml b/vsixtest/MainPage.xaml
deleted file mode 100644
index 7472ad8626..0000000000
--- a/vsixtest/MainPage.xaml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
diff --git a/vsixtest/MainPage.xaml.cpp b/vsixtest/MainPage.xaml.cpp
deleted file mode 100644
index e67dcb83b2..0000000000
--- a/vsixtest/MainPage.xaml.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// MainPage.xaml.cpp
-// Implementation of the MainPage class.
-//
-
-#include "pch.h"
-#include "MainPage.xaml.h"
-#include "sqlite3.h"
-
-using namespace vsixtest;
-
-using namespace Platform;
-using namespace Windows::Foundation;
-using namespace Windows::Foundation::Collections;
-using namespace Windows::UI::Xaml;
-using namespace Windows::UI::Xaml::Controls;
-using namespace Windows::UI::Xaml::Controls::Primitives;
-using namespace Windows::UI::Xaml::Data;
-using namespace Windows::UI::Xaml::Input;
-using namespace Windows::UI::Xaml::Media;
-using namespace Windows::UI::Xaml::Navigation;
-
-// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
-
-MainPage::MainPage()
-{
- InitializeComponent();
- UseSQLite();
-}
-
-void MainPage::UseSQLite(void)
-{
- int rc = SQLITE_OK;
- sqlite3 *pDb = nullptr;
-
- rc = sqlite3_open_v2("test.db", &pDb,
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
-
- if (rc != SQLITE_OK)
- throw ref new FailureException("Failed to open database.");
-
- rc = sqlite3_exec(pDb, "VACUUM;", nullptr, nullptr, nullptr);
-
- if (rc != SQLITE_OK)
- throw ref new FailureException("Failed to vacuum database.");
-
- rc = sqlite3_close(pDb);
-
- if (rc != SQLITE_OK)
- throw ref new FailureException("Failed to close database.");
-
- pDb = nullptr;
-}
diff --git a/vsixtest/MainPage.xaml.h b/vsixtest/MainPage.xaml.h
deleted file mode 100644
index ea327a3e4c..0000000000
--- a/vsixtest/MainPage.xaml.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// MainPage.xaml.h
-// Declaration of the MainPage class.
-//
-
-#pragma once
-
-#include "MainPage.g.h"
-
-namespace vsixtest
-{
- ///
- /// An empty page that can be used on its own or navigated to within a Frame.
- ///
- public ref class MainPage sealed
- {
- public:
- MainPage();
- void UseSQLite(void);
-
- };
-}
diff --git a/vsixtest/Package.appxmanifest b/vsixtest/Package.appxmanifest
deleted file mode 100644
index 106b3f1e41..0000000000
--- a/vsixtest/Package.appxmanifest
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
- vsixtest
- mistachkin
- Assets\StoreLogo.png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vsixtest/pch.cpp b/vsixtest/pch.cpp
deleted file mode 100644
index 97b544ec11..0000000000
--- a/vsixtest/pch.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-//
-// pch.cpp
-// Include the standard header and generate the precompiled header.
-//
-
-#include "pch.h"
diff --git a/vsixtest/pch.h b/vsixtest/pch.h
deleted file mode 100644
index b793236d02..0000000000
--- a/vsixtest/pch.h
+++ /dev/null
@@ -1,11 +0,0 @@
-//
-// pch.h
-// Header for standard system include files.
-//
-
-#pragma once
-
-#include
-#include
-
-#include "App.xaml.h"
diff --git a/vsixtest/vsixtest.sln b/vsixtest/vsixtest.sln
deleted file mode 100644
index 1ab6e064f9..0000000000
--- a/vsixtest/vsixtest.sln
+++ /dev/null
@@ -1,39 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsixtest", "vsixtest.vcxproj", "{60BB14A5-0871-4656-BC38-4F0958230F9A}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|ARM = Debug|ARM
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|ARM = Release|ARM
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.ActiveCfg = Debug|ARM
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Build.0 = Debug|ARM
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Deploy.0 = Debug|ARM
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.ActiveCfg = Debug|x64
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Build.0 = Debug|x64
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Deploy.0 = Debug|x64
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.ActiveCfg = Debug|Win32
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Build.0 = Debug|Win32
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Deploy.0 = Debug|Win32
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.ActiveCfg = Release|ARM
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Build.0 = Release|ARM
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Deploy.0 = Release|ARM
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.ActiveCfg = Release|x64
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Build.0 = Release|x64
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Deploy.0 = Release|x64
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.ActiveCfg = Release|Win32
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Build.0 = Release|Win32
- {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Deploy.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl
deleted file mode 100644
index 8b2288be35..0000000000
--- a/vsixtest/vsixtest.tcl
+++ /dev/null
@@ -1,373 +0,0 @@
-#!/usr/bin/tclsh
-#
-# This script is used to quickly test a VSIX (Visual Studio Extension) file
-# with Visual Studio 2015 on Windows.
-#
-# PREREQUISITES
-#
-# 1. This tool is Windows only.
-#
-# 2. This tool must be executed with "elevated administrator" privileges.
-#
-# 3. Tcl 8.4 and later are supported, earlier versions have not been tested.
-#
-# 4. The "sqlite-UWP-output.vsix" file is assumed to exist in the parent
-# directory of the directory containing this script. The [optional] first
-# command line argument to this script may be used to specify an alternate
-# file. However, currently, the file must be compatible with both Visual
-# Studio 2015 and the Universal Windows Platform.
-#
-# 5. The "VERSION" file is assumed to exist in the parent directory of the
-# directory containing this script. It must contain a version number that
-# matches the VSIX file being tested.
-#
-# 6. The temporary directory specified in the TEMP or TMP environment variables
-# must refer to an existing directory writable by the current user.
-#
-# 7. The VS140COMNTOOLS environment variable must refer to the Visual Studio
-# 2015 common tools directory.
-#
-# USAGE
-#
-# The first argument to this script is optional. If specified, it must be the
-# name of the VSIX file to test.
-#
-package require Tcl 8.4
-
-proc fail { {error ""} {usage false} } {
- if {[string length $error] > 0} then {
- puts stdout $error
- if {!$usage} then {exit 1}
- }
-
- puts stdout "usage:\
-[file tail [info nameofexecutable]]\
-[file tail [info script]] \[vsixFile\]"
-
- exit 1
-}
-
-proc isWindows {} {
- #
- # NOTE: Returns non-zero only when running on Windows.
- #
- return [expr {[info exists ::tcl_platform(platform)] && \
- $::tcl_platform(platform) eq "windows"}]
-}
-
-proc isAdministrator {} {
- #
- # NOTE: Returns non-zero only when running as "elevated administrator".
- #
- if {[isWindows]} then {
- if {[catch {exec -- whoami /groups} groups] == 0} then {
- set groups [string map [list \r\n \n] $groups]
-
- foreach group [split $groups \n] {
- #
- # NOTE: Match this group line against the "well-known" SID for
- # the "Administrators" group on Windows.
- #
- if {[regexp -- {\sS-1-5-32-544\s} $group]} then {
- #
- # NOTE: Match this group line against the attributes column
- # sub-value that should be present when running with
- # elevated administrator credentials.
- #
- if {[regexp -- {\sEnabled group(?:,|\s)} $group]} then {
- return true
- }
- }
- }
- }
- }
-
- return false
-}
-
-proc getEnvironmentVariable { name } {
- #
- # NOTE: Returns the value of the specified environment variable or an empty
- # string for environment variables that do not exist in the current
- # process environment.
- #
- return [expr {[info exists ::env($name)] ? $::env($name) : ""}]
-}
-
-proc getTemporaryPath {} {
- #
- # NOTE: Returns the normalized path to the first temporary directory found
- # in the typical set of environment variables used for that purpose
- # or an empty string to signal a failure to locate such a directory.
- #
- set names [list]
-
- foreach name [list TEMP TMP] {
- lappend names [string toupper $name] [string tolower $name] \
- [string totitle $name]
- }
-
- foreach name $names {
- set value [getEnvironmentVariable $name]
-
- if {[string length $value] > 0} then {
- return [file normalize $value]
- }
- }
-
- return ""
-}
-
-proc appendArgs { args } {
- #
- # NOTE: Returns all passed arguments joined together as a single string
- # with no intervening spaces between arguments.
- #
- eval append result $args
-}
-
-proc readFile { fileName } {
- #
- # NOTE: Reads and returns the entire contents of the specified file, which
- # may contain binary data.
- #
- set file_id [open $fileName RDONLY]
- fconfigure $file_id -translation binary
- set result [read $file_id]
- close $file_id
- return $result
-}
-
-proc writeFile { fileName data } {
- #
- # NOTE: Writes the entire contents of the specified file, which may contain
- # binary data.
- #
- set file_id [open $fileName {WRONLY CREAT TRUNC}]
- fconfigure $file_id -translation binary
- puts -nonewline $file_id $data
- close $file_id
- return ""
-}
-
-proc putsAndEval { command } {
- #
- # NOTE: Outputs a command to the standard output channel and then evaluates
- # it in the callers context.
- #
- catch {
- puts stdout [appendArgs "Running: " [lrange $command 1 end] ...\n]
- }
-
- return [uplevel 1 $command]
-}
-
-proc isBadDirectory { directory } {
- #
- # NOTE: Returns non-zero if the directory is empty, does not exist, -OR- is
- # not a directory.
- #
- catch {
- puts stdout [appendArgs "Checking directory \"" $directory \"...\n]
- }
-
- return [expr {[string length $directory] == 0 || \
- ![file exists $directory] || ![file isdirectory $directory]}]
-}
-
-proc isBadFile { fileName } {
- #
- # NOTE: Returns non-zero if the file name is empty, does not exist, -OR- is
- # not a regular file.
- #
- catch {
- puts stdout [appendArgs "Checking file \"" $fileName \"...\n]
- }
-
- return [expr {[string length $fileName] == 0 || \
- ![file exists $fileName] || ![file isfile $fileName]}]
-}
-
-#
-# NOTE: This is the entry point for this script.
-#
-set script [file normalize [info script]]
-
-if {[string length $script] == 0} then {
- fail "script file currently being evaluated is unknown" true
-}
-
-if {![isWindows]} then {
- fail "this tool only works properly on Windows"
-}
-
-if {![isAdministrator]} then {
- fail "this tool must run with \"elevated administrator\" privileges"
-}
-
-set path [file normalize [file dirname $script]]
-set argc [llength $argv]; if {$argc > 1} then {fail "" true}
-
-if {$argc == 1} then {
- set vsixFileName [lindex $argv 0]
-} else {
- set vsixFileName [file join \
- [file dirname $path] sqlite-UWP-output.vsix]
-}
-
-###############################################################################
-
-if {[isBadFile $vsixFileName]} then {
- fail [appendArgs \
- "VSIX file \"" $vsixFileName "\" does not exist"]
-}
-
-set versionFileName [file join [file dirname $path] VERSION]
-
-if {[isBadFile $versionFileName]} then {
- fail [appendArgs \
- "Version file \"" $versionFileName "\" does not exist"]
-}
-
-set projectTemplateFileName [file join $path vsixtest.vcxproj.data]
-
-if {[isBadFile $projectTemplateFileName]} then {
- fail [appendArgs \
- "Project template file \"" $projectTemplateFileName \
- "\" does not exist"]
-}
-
-set envVarName VS140COMNTOOLS
-set vsDirectory [getEnvironmentVariable $envVarName]
-
-if {[isBadDirectory $vsDirectory]} then {
- fail [appendArgs \
- "Visual Studio 2015 directory \"" $vsDirectory \
- "\" from environment variable \"" $envVarName \
- "\" does not exist"]
-}
-
-set vsixInstaller [file join \
- [file dirname $vsDirectory] IDE VSIXInstaller.exe]
-
-if {[isBadFile $vsixInstaller]} then {
- fail [appendArgs \
- "Visual Studio 2015 VSIX installer \"" $vsixInstaller \
- "\" does not exist"]
-}
-
-set envVarName ProgramFiles
-set programFiles [getEnvironmentVariable $envVarName]
-
-if {[isBadDirectory $programFiles]} then {
- fail [appendArgs \
- "Program Files directory \"" $programFiles \
- "\" from environment variable \"" $envVarName \
- "\" does not exist"]
-}
-
-set msBuild [file join $programFiles MSBuild 14.0 Bin MSBuild.exe]
-
-if {[isBadFile $msBuild]} then {
- fail [appendArgs \
- "MSBuild v14.0 executable file \"" $msBuild \
- "\" does not exist"]
-}
-
-set temporaryDirectory [getTemporaryPath]
-
-if {[isBadDirectory $temporaryDirectory]} then {
- fail [appendArgs \
- "Temporary directory \"" $temporaryDirectory \
- "\" does not exist"]
-}
-
-###############################################################################
-
-set installLogFileName [appendArgs \
- [file rootname [file tail $vsixFileName]] \
- -install- [pid] .log]
-
-set commands(1) [list exec [file nativename $vsixInstaller]]
-
-lappend commands(1) /quiet /norepair
-lappend commands(1) [appendArgs /logFile: $installLogFileName]
-lappend commands(1) [file nativename $vsixFileName]
-
-###############################################################################
-
-set buildLogFileName [appendArgs \
- [file rootname [file tail $vsixFileName]] \
- -build-%configuration%-%platform%- [pid] .log]
-
-set commands(2) [list exec [file nativename $msBuild]]
-
-lappend commands(2) [file nativename [file join $path vsixtest.sln]]
-lappend commands(2) /target:Rebuild
-lappend commands(2) /property:Configuration=%configuration%
-lappend commands(2) /property:Platform=%platform%
-
-lappend commands(2) [appendArgs \
- /logger:FileLogger,Microsoft.Build.Engine\;Logfile= \
- [file nativename [file join $temporaryDirectory \
- $buildLogFileName]] \;Verbosity=diagnostic]
-
-###############################################################################
-
-set uninstallLogFileName [appendArgs \
- [file rootname [file tail $vsixFileName]] \
- -uninstall- [pid] .log]
-
-set commands(3) [list exec [file nativename $vsixInstaller]]
-
-lappend commands(3) /quiet /norepair
-lappend commands(3) [appendArgs /logFile: $uninstallLogFileName]
-lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015]
-
-###############################################################################
-
-if {1} then {
- catch {
- puts stdout [appendArgs \
- "Install log: \"" [file nativename [file join \
- $temporaryDirectory $installLogFileName]] \"\n]
- }
-
- catch {
- puts stdout [appendArgs \
- "Build logs: \"" [file nativename [file join \
- $temporaryDirectory $buildLogFileName]] \"\n]
- }
-
- catch {
- puts stdout [appendArgs \
- "Uninstall log: \"" [file nativename [file join \
- $temporaryDirectory $uninstallLogFileName]] \"\n]
- }
-}
-
-###############################################################################
-
-if {1} then {
- putsAndEval $commands(1)
-
- set versionNumber [string trim [readFile $versionFileName]]
- set data [readFile $projectTemplateFileName]
- set data [string map [list %versionNumber% $versionNumber] $data]
-
- set projectFileName [file join $path vsixtest.vcxproj]
- writeFile $projectFileName $data
-
- set platforms [list x86 x64 ARM]
- set configurations [list Debug Release]
-
- foreach platform $platforms {
- foreach configuration $configurations {
- putsAndEval [string map [list \
- %platform% $platform %configuration% $configuration] \
- $commands(2)]
- }
- }
-
- putsAndEval $commands(3)
-}
diff --git a/vsixtest/vsixtest.vcxproj.data b/vsixtest/vsixtest.vcxproj.data
deleted file mode 100644
index a64584c3a2..0000000000
--- a/vsixtest/vsixtest.vcxproj.data
+++ /dev/null
@@ -1,198 +0,0 @@
-
-
-
- {60bb14a5-0871-4656-bc38-4f0958230f9a}
- vsixtest
- en-US
- 14.0
- true
- Windows Store
- 10.0.10586.0
- 10.0.10586.0
- 10.0
-
-
-
-
- Debug
- ARM
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- ARM
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- Application
- true
- v140
-
-
- Application
- true
- v140
-
-
- Application
- true
- v140
-
-
- Application
- false
- true
- v140
- true
-
-
- Application
- false
- true
- v140
- true
-
-
- Application
- false
- true
- v140
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- vsixtest_TemporaryKey.pfx
-
-
-
- /bigobj %(AdditionalOptions)
- 4453;28204
-
-
-
-
- /bigobj %(AdditionalOptions)
- 4453;28204
-
-
-
-
- /bigobj %(AdditionalOptions)
- 4453;28204
-
-
-
-
- /bigobj %(AdditionalOptions)
- 4453;28204
-
-
-
-
- /bigobj %(AdditionalOptions)
- 4453;28204
-
-
-
-
- /bigobj %(AdditionalOptions)
- 4453;28204
-
-
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
-
-
- Designer
-
-
- Designer
-
-
-
-
- Designer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
- Create
- Create
- Create
- Create
- Create
- Create
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vsixtest/vsixtest.vcxproj.filters b/vsixtest/vsixtest.vcxproj.filters
deleted file mode 100644
index ac1dfca421..0000000000
--- a/vsixtest/vsixtest.vcxproj.filters
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- 60bb14a5-0871-4656-bc38-4f0958230f9a
-
-
- e6271362-8f96-476d-907f-4da227b02435
- bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Assets
-
-
- Assets
-
-
- Assets
-
-
- Assets
-
-
- Assets
-
-
- Assets
-
-
- Assets
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vsixtest/vsixtest_TemporaryKey.pfx b/vsixtest/vsixtest_TemporaryKey.pfx
deleted file mode 100644
index e6787bcad0..0000000000
Binary files a/vsixtest/vsixtest_TemporaryKey.pfx and /dev/null differ