DELETED Make.defines Index: Make.defines ================================================================== --- Make.defines +++ /dev/null @@ -1,320 +0,0 @@ -DEBUG_ON = -D DEBUG -DEBUG_OFF = -O2 -PROFILE_ON = -pg --profile-arcs --test-coverage -PROFILE_OFF = -PROFILING = $(PROFILE_OFF) -DEBUGGING = $(DEBUG_ON) - -NAME = sqlite4 - -# The toplevel directory of the source tree. This is the directory that -# contains this "Makefile.in" and the "configure.in" script. - -TOP = . - -############################################################################### -# The following macros should be defined before this script is -# invoked: -# -# TOP The toplevel directory of the source tree. This is the -# directory that contains files "VERSION" and "README". -# -# BCC C Compiler and options for use in building executables that -# will run on the platform that is doing the build. -# -# TCC C Compiler and options for use in building executables that -# will run on the target platform. This is usually the same -# as BCC, unless you are cross-compiling. -# -# THREADLIB Specify any extra linker options needed to make the library -# thread safe -# -# OPTS Extra compiler command-line options for the TCC compiler -# -# EXE The suffix to add to executable files. ".exe" for windows -# and "" for Unix. -# -# AR Tools used to build a static library. -# RANLIB -# -# TCL_FLAGS Extra compiler options needed for programs that use the -# TCL library. -# -# LIBTCL Linker options needed to link against the TCL library. -# -# READLINE_FLAGS Compiler options needed for programs that use the -# readline() library. -# -# LIBREADLINE Linker options needed by programs using readline() must -# link against. -# -# NAWK Nawk compatible awk program. Older (obsolete?) solaris -# systems need this to avoid using the original AT&T AWK. -# -# Once the macros above are defined, the rest of this make script will -# build the SQLite library and testing tools. - -# Tools used to build a static library - -AR = ar cr -RANLIB = ranlib - -# Linker options needed to link against the TCL library. -#LIBTCL = -ltcl8.4 -lm -ldl -LIBTCL = -ltcl8.6 -lm -lpthread -ldl -lz - -# Extra compiler options needed for programs that use the TCL library. -# TCL_FLAGS = -DSTATIC_BUILD=1 - -# Compiler options needed for programs that use the readline() library. -READLINE_FLAGS = -#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline - -# Linker options needed by programs using readline() must link against. -LIBREADLINE = -ldl -lpthread -#LIBREADLINE = -static -lreadline -ltermcap - -# Should the database engine assume text is coded as UTF-8 or iso8859? -ENCODING = UTF8 -#ENCODING = ISO8859 - -# Math library -MATHLIB = -lm - -# AWK (Needed by brain-dead Solaris systems) -NAWK = awk - -# THREADLIB Libraries needed for threadtest -THREADLIB = -ldl -lpthread - -LIBOBJ+= vdbe.o parse.o \ - alter.o analyze.o attach.o auth.o \ - build.o \ - callback.o complete.o ctime.o date.o delete.o env.o expr.o \ - fault.o fkey.o fts5.o fts5func.o \ - func.o global.o hash.o \ - icu.o insert.o kv.o kvlsm.o kvmem.o legacy.o \ - lsm_ckpt.o lsm_file.o lsm_log.o lsm_main.o lsm_mem.o lsm_mutex.o \ - lsm_shared.o lsm_str.o lsm_sorted.o lsm_tree.o \ - lsm_unix.o lsm_varint.o \ - main.o malloc.o math.o mem.o mem0.o mem1.o mem2.o mem3.o mem5.o \ - mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \ - opcodes.o os.o \ - pragma.o prepare.o printf.o \ - random.o resolve.o rowset.o rtree.o select.o status.o \ - tokenize.o trigger.o \ - update.o util.o varint.o \ - vdbeapi.o vdbeaux.o vdbecodec.o vdbecursor.o \ - vdbemem.o vdbetrace.o \ - walker.o where.o utf.o - -# All of the source code files. -SRC = \ - $(TOP)/src/alter.c \ - $(TOP)/src/analyze.c \ - $(TOP)/src/attach.c \ - $(TOP)/src/auth.c \ - $(TOP)/src/build.c \ - $(TOP)/src/callback.c \ - $(TOP)/src/complete.c \ - $(TOP)/src/ctime.c \ - $(TOP)/src/date.c \ - $(TOP)/src/delete.c \ - $(TOP)/src/env.c \ - $(TOP)/src/expr.c \ - $(TOP)/src/fault.c \ - $(TOP)/src/fkey.c \ - $(TOP)/src/fts5.c \ - $(TOP)/src/fts5func.c \ - $(TOP)/src/func.c \ - $(TOP)/src/global.c \ - $(TOP)/src/hash.c \ - $(TOP)/src/hash.h \ - $(TOP)/src/hwtime.h \ - $(TOP)/src/insert.c \ - $(TOP)/src/kv.c \ - $(TOP)/src/kv.h \ - $(TOP)/src/kvlsm.c \ - $(TOP)/src/kvmem.c \ - $(TOP)/src/legacy.c \ - $(TOP)/src/lsm.h \ - $(TOP)/src/lsmInt.h \ - $(TOP)/src/lsm_ckpt.c \ - $(TOP)/src/lsm_file.c \ - $(TOP)/src/lsm_log.c \ - $(TOP)/src/lsm_main.c \ - $(TOP)/src/lsm_mem.c \ - $(TOP)/src/lsm_mutex.c \ - $(TOP)/src/lsm_shared.c \ - $(TOP)/src/lsm_str.c \ - $(TOP)/src/lsm_sorted.c \ - $(TOP)/src/lsm_tree.c \ - $(TOP)/src/lsm_unix.c \ - $(TOP)/src/lsm_varint.c \ - $(TOP)/src/main.c \ - $(TOP)/src/malloc.c \ - $(TOP)/src/math.c \ - $(TOP)/src/mem.c \ - $(TOP)/src/mem0.c \ - $(TOP)/src/mem1.c \ - $(TOP)/src/mem2.c \ - $(TOP)/src/mem3.c \ - $(TOP)/src/mem5.c \ - $(TOP)/src/mutex.c \ - $(TOP)/src/mutex.h \ - $(TOP)/src/mutex_noop.c \ - $(TOP)/src/mutex_unix.c \ - $(TOP)/src/mutex_w32.c \ - $(TOP)/src/os.c \ - $(TOP)/src/os.h \ - $(TOP)/src/parse.y \ - $(TOP)/src/pragma.c \ - $(TOP)/src/prepare.c \ - $(TOP)/src/printf.c \ - $(TOP)/src/random.c \ - $(TOP)/src/resolve.c \ - $(TOP)/src/rowset.c \ - $(TOP)/src/select.c \ - $(TOP)/src/shell.c \ - $(TOP)/src/sqlite.h.in \ - $(TOP)/src/sqliteInt.h \ - $(TOP)/src/sqliteLimit.h \ - $(TOP)/src/status.c \ - $(TOP)/src/tclsqlite.c \ - $(TOP)/src/tokenize.c \ - $(TOP)/src/trigger.c \ - $(TOP)/src/utf.c \ - $(TOP)/src/update.c \ - $(TOP)/src/util.c \ - $(TOP)/src/varint.c \ - $(TOP)/src/vdbe.c \ - $(TOP)/src/vdbe.h \ - $(TOP)/src/vdbeapi.c \ - $(TOP)/src/vdbeaux.c \ - $(TOP)/src/vdbecodec.c \ - $(TOP)/src/vdbecursor.c \ - $(TOP)/src/vdbemem.c \ - $(TOP)/src/vdbetrace.c \ - $(TOP)/src/vdbeInt.h \ - $(TOP)/src/walker.c \ - $(TOP)/src/where.c - -# Source code for extensions -SRC += \ - $(TOP)/ext/fts3/fts3.c \ - $(TOP)/ext/fts3/fts3.h \ - $(TOP)/ext/fts3/fts3Int.h \ - $(TOP)/ext/fts3/fts3_aux.c \ - $(TOP)/ext/fts3/fts3_expr.c \ - $(TOP)/ext/fts3/fts3_hash.c \ - $(TOP)/ext/fts3/fts3_hash.h \ - $(TOP)/ext/fts3/fts3_icu.c \ - $(TOP)/ext/fts3/fts3_porter.c \ - $(TOP)/ext/fts3/fts3_snippet.c \ - $(TOP)/ext/fts3/fts3_tokenizer.h \ - $(TOP)/ext/fts3/fts3_tokenizer.c \ - $(TOP)/ext/fts3/fts3_tokenizer1.c \ - $(TOP)/ext/fts3/fts3_write.c -SRC += \ - $(TOP)/ext/icu/sqliteicu.h \ - $(TOP)/ext/icu/icu.c -SRC += \ - $(TOP)/ext/rtree/rtree.h \ - $(TOP)/ext/rtree/rtree.c - -# Generated source code files -SRC += \ - keywordhash.h \ - opcodes.c \ - opcodes.h \ - parse.c \ - parse.h \ - sqlite4.h - -# Source code to the test files. -TESTSRC = \ - $(TOP)/test/test_main.c \ - $(TOP)/test/test_thread0.c \ - $(TOP)/test/test_utf.c \ - $(TOP)/test/test_misc1.c \ - $(TOP)/test/test_config.c \ - $(TOP)/test/test_func.c \ - $(TOP)/test/test_hexio.c \ - $(TOP)/test/test_lsm.c \ - $(TOP)/test/test_kv.c \ - $(TOP)/test/test_kv2.c \ - $(TOP)/test/test_malloc.c \ - $(TOP)/test/test_mem.c \ - $(TOP)/test/test_mutex.c \ - $(TOP)/test/test_thread.c \ - $(TOP)/test/test_wsd.c - -#TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c -#TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c - -TESTSRC2 = \ - $(TOP)/src/attach.c \ - $(TOP)/src/build.c \ - $(TOP)/src/date.c \ - $(TOP)/src/expr.c \ - $(TOP)/src/fts5.c \ - $(TOP)/src/fts5func.c \ - $(TOP)/src/func.c \ - $(TOP)/src/insert.c \ - $(TOP)/src/mem5.c \ - $(TOP)/src/os.c \ - $(TOP)/src/pragma.c \ - $(TOP)/src/prepare.c \ - $(TOP)/src/printf.c \ - $(TOP)/src/random.c \ - $(TOP)/src/select.c \ - $(TOP)/src/tokenize.c \ - $(TOP)/src/utf.c \ - $(TOP)/src/util.c \ - $(TOP)/src/vdbeapi.c \ - $(TOP)/src/vdbeaux.c \ - $(TOP)/src/vdbe.c \ - $(TOP)/src/vdbemem.c \ - $(TOP)/src/where.c \ - parse.c \ - -# Header files used by all library source files. -HDR = \ - $(TOP)/src/hash.h \ - $(TOP)/src/hwtime.h \ - keywordhash.h \ - $(TOP)/src/kv.h \ - $(TOP)/src/lsm.h \ - $(TOP)/src/lsmInt.h \ - $(TOP)/src/mutex.h \ - opcodes.h \ - $(TOP)/src/os.h \ - parse.h \ - sqlite4.h \ - $(TOP)/src/sqliteInt.h \ - $(TOP)/src/sqliteLimit.h \ - $(TOP)/src/vdbe.h \ - $(TOP)/src/vdbeInt.h - -EXTHDR = \ - $(TOP)/ext/fts3/fts3.h \ - $(TOP)/ext/fts3/fts3Int.h \ - $(TOP)/ext/fts3/fts3_hash.h \ - $(TOP)/ext/fts3/fts3_tokenizer.h -EXTHDR += \ - $(TOP)/ext/rtree/rtree.h -EXTHDR += \ - $(TOP)/ext/icu/sqliteicu.h - -LSMTESTSRC = $(TOP)/lsm-test/lsmtest1.c $(TOP)/lsm-test/lsmtest2.c \ - $(TOP)/lsm-test/lsmtest3.c $(TOP)/lsm-test/lsmtest4.c \ - $(TOP)/lsm-test/lsmtest5.c $(TOP)/lsm-test/lsmtest6.c \ - $(TOP)/lsm-test/lsmtest7.c $(TOP)/lsm-test/lsmtest8.c \ - $(TOP)/lsm-test/lsmtest9.c \ - $(TOP)/lsm-test/lsmtest_datasource.c \ - $(TOP)/lsm-test/lsmtest_func.c $(TOP)/lsm-test/lsmtest_io.c \ - $(TOP)/lsm-test/lsmtest_main.c $(TOP)/lsm-test/lsmtest_mem.c \ - $(TOP)/lsm-test/lsmtest_tdb.c $(TOP)/lsm-test/lsmtest_tdb3.c \ - $(TOP)/lsm-test/lsmtest_util.c - -LSMTESTHDR = $(TOP)/lsm-test/lsmtest.h $(TOP)/lsm-test/lsmtest_tdb.h DELETED Make.freebsd Index: Make.freebsd ================================================================== --- Make.freebsd +++ /dev/null @@ -1,4 +0,0 @@ -# FreeBSD build configuration - -include Make.unix - DELETED Make.linux Index: Make.linux ================================================================== --- Make.linux +++ /dev/null @@ -1,32 +0,0 @@ -# Linux build configuration - -include Make.unix - -# Pick a compiler... -compiler ?= gcc -compiler ?= tcc -compiler ?= clang - -######################################################################## -# LIBTCL compile/link flags -TCL_FLAGS ?= -I/usr/include/tcl -LIBTCL ?= -L/usr/lib -ltcl8.5 -lm -ldl - -######################################################################## -# TCC=Compiler for target platform binaries. -# BCC=Compiler for local native binaries. -ifeq (gcc,$(compiler)) - BCC ?= gcc -g -fPIC -UNDEBUG -DDEBUG -Wall - BCC += -std=c89 -endif -ifeq (tcc,$(compiler)) - BCC ?= tcc -g -Wall -endif -ifeq (clang,$(compiler)) - BCC ?= clang -g -Wall -endif - -# Force regeneration of sqlite4.h if any makefiles change... -parse.h sqlite4.h: $(MAKEFILE_LIST) -$(MAKEFILE_LIST): - DELETED Make.mingw Index: Make.mingw ================================================================== --- Make.mingw +++ /dev/null @@ -1,3 +0,0 @@ -# MingGW build configuration - -include Make.win DELETED Make.opts Index: Make.opts ================================================================== --- Make.opts +++ /dev/null @@ -1,147 +0,0 @@ - -################################################################################ - -OPTS ?=# leave this blank - -# FIXME: Required options for now. - -OPTS += -DLSM_MUTEX_NONE -OPTS += -DSQLITE4_DEBUG=1 -DLSM_DEBUG=1 -OPTS += -DHAVE_GMTIME_R -OPTS += -DHAVE_LOCALTIME_R -OPTS += -DHAVE_MALLOC_USABLE_SIZE -OPTS += -DHAVE_USLEEP -OPTS += -DSQLITE4_MEMDEBUG=1 -#OPTS += -DSQLITE4_NO_SYNC=1 -DLSM_NO_SYNC=1 -OPTS += -DSQLITE4_OMIT_ANALYZE -OPTS += -DSQLITE4_OMIT_AUTOMATIC_INDEX -OPTS += -DSQLITE4_OMIT_BTREECOUNT -OPTS += -DSQLITE4_OMIT_VIRTUALTABLE=1 -OPTS += -DSQLITE4_OMIT_XFER_OPT -OPTS += -DSQLITE4_THREADSAFE=0 - -#### Leave SQLITE4_DEBUG undefined for maximum speed. Use SQLITE4_DEBUG=1 -# to check for memory leaks. Use SQLITE4_DEBUG=2 to print a log of all -# malloc()s and free()s in order to track down memory leaks. -# -# SQLite uses some expensive assert() statements in the inner loop. -# You can make the library go almost twice as fast if you compile -# with -DNDEBUG=1 -# -#OPTS += -DHAVE_DLOPEN -OPTS += -DSQLITE4_DEBUG=1 -OPTS += -DHAVE_GMTIME_R -OPTS += -DHAVE_LOCALTIME_R -OPTS += -DHAVE_MALLOC_USABLE_SIZE -OPTS += -DHAVE_USLEEP - -#OPTS += -DSQLITE4_DEBUG=2 -#OPTS += -DSQLITE4_DEBUG=1 -OPTS += -DNDEBUG=1 -OPTS += -DHAVE_FDATASYNC=1 - -#OPTS += -DLONGDOUBLE_TYPE=double -#OPTS += -DSQLITE4_64BIT_STATS -#OPTS += -DSQLITE4_CASE_SENSITIVE_LIKE -#OPTS += -DSQLITE4_CHECK_PAGES -#OPTS += -DSQLITE4_COVERAGE_TEST -#OPTS += -DSQLITE4_DEBUG -#OPTS += -DSQLITE4_DEFAULT_AUTOVACUUM=1 -#OPTS += -DSQLITE4_DEFAULT_CACHE_SIZE=64 -#OPTS += -DSQLITE4_DEFAULT_FILE_FORMAT=4 -#OPTS += -DSQLITE4_DEFAULT_MEMSTATUS=0 -#OPTS += -DSQLITE4_DEFAULT_PAGE_SIZE=1024 -#OPTS += -DSQLITE4_DEFAULT_TEMP_CACHE_SIZE=32 -#OPTS += -DSQLITE4_DISABLE_LFS=1 -#OPTS += -DSQLITE4_ENABLE_8_3_NAMES -#OPTS += -DSQLITE4_ENABLE_ASYNCIO -#OPTS += -DSQLITE4_ENABLE_ATOMIC_WRITE -#OPTS += -DSQLITE4_ENABLE_COLUMN_METADATA -#OPTS += -DSQLITE4_ENABLE_EXPENSIVE_ASSERT -#OPTS += -DSQLITE4_ENABLE_FTS3 -#OPTS += -DSQLITE4_ENABLE_FTS4 -#OPTS += -DSQLITE4_ENABLE_FTS3_PARENTHESIS -#OPTS += -DSQLITE4_ENABLE_INSTVFS=1 -#OPTS += -DSQLITE4_ENABLE_ICU -#OPTS += -DSQLITE4_ENABLE_IOTRACE=1 -#OPTS += -DSQLITE4_ENABLE_LOAD_EXTENSION=1 -#OPTS += -DSQLITE4_ENABLE_LOCKING_STYLE=1 -#OPTS += -DSQLITE4_ENABLE_MEMORY_MANAGEMENT=1 -#OPTS += -DSQLITE4_ENABLE_MEMSYS3=1 -#OPTS += -DSQLITE4_ENABLE_MEMSYS5=1 -#OPTS += -DSQLITE4_ENABLE_OVERSIZE_CELL_CHECK -#OPTS += -DSQLITE4_ENABLE_PREUPDATE_HOOK -#OPTS += -DSQLITE4_ENABLE_RTREE -#OPTS += -DSQLITE4_ENABLE_RTREE -DVARIANT_RSTARTREE_CHOOSESUBTREE -#OPTS += -DSQLITE4_ENABLE_SESSION -#OPTS += -DSQLITE4_ENABLE_STAT2 -#OPTS += -DSQLITE4_ENABLE_STAT3 -#OPTS += -DSQLITE4_ENABLE_TREE_EXPLAIN -#OPTS += -DSQLITE4_ENABLE_UNLOCK_NOTIFY -#OPTS += -DSQLITE4_ENABLE_UPDATE_DELETE_LIMIT -#OPTS += '-DSQLITE4_FILE_HEADER="MotorolaDB v001"' -#OPTS += -DSQLITE4_HAVE_ISNAN -#OPTS += -DSQLITE4_HOMEGROWN_RECURSIVE_MUTEX=1 -#OPTS += -DSQLITE4_INT64_TYPE=int -#OPTS += -DSQLITE4_LOCK_TRACE -#OPTS += -DSQLITE4_MALLOC_SOFT_LIMIT=1024 -#OPTS += -DSQLITE4_MAX_EXPR_DEPTH=0 -#OPTS += -DSQLITE4_MAX_PAGE_SIZE=4096 -#OPTS += -DSQLITE4_MAX_VARIABLE_NUMBER=500000 -#OPTS += -DSQLITE4_MEMDEBUG=1 -#OPTS += -DSQLITE4_MIXED_ENDIAN_64BIT_FLOAT=1 -#OPTS += -DSQLITE4_MUTEX_NOOP=1 -#OPTS += -DNO_GETTOD=1 -OPTS += -DSQLITE4_NO_SYNC=1 -#OPTS += -DSQLITE4_OMIT_ALTER_TABLE=1 -#OPTS += -DSQLITE4_OMIT_AUTOMATIC_INDEX -#OPTS += -DSQLITE4_OMIT_AUTOVACUUM=1 -#OPTS += -DSQLITE4_OMIT_BLOB_LITERAL=1 -#OPTS += -DSQLITE4_OMIT_CHECK=1 -#OPTS += -DSQLITE4_OMIT_DATETIME_FUNCS=1 -#OPTS += -DSQLITE4_OMIT_DEPRECATED=1 -#OPTS += -DSQLITE4_OMIT_DISKIO -#OPTS += -DSQLITE4_OMIT_FLOATING_POINT=1 -#OPTS += -DSQLITE4_OMIT_ICU_LIKE -#OPTS += -DSQLITE4_OMIT_LOAD_EXTENSION=1 -#OPTS += -DSQLITE4_OMIT_LOOKASIDE=1 -#OPTS += -DSQLITE4_OMIT_MEMORYDB=1 -#OPTS += -DSQLITE4_OMIT_MERGE_SORT=1 -#OPTS += -DSQLITE4_OMIT_PROGESS_CALLBACK=1 -#OPTS += -DSQLITE4_OMIT_REINDEX=1 -#OPTS += -DSQLITE4_OMIT_SHARED_CACHE=1 -#OPTS += -DSQLITE4_OMIT_TRACE=1 -#OPTS += -DSQLITE4_OMIT_UTF16=1 -#OPTS += -DSQLITE4_OMIT_VIEW=1 -#OPTS += -DSQLITE4_OMIT_VIRTUALTABLE=1 -#OPTS += -DSQLITE4_OMIT_WAL -#OPTS += -DSQLITE4_OMIT_WSD=1 -#OPTS += -DSQLITE4_OS_OTHER=1 -#OPTS += -DSQLITE4_OS_UNIX=1 -#OPTS += -DSQLITE4_PCACHE_SEPARATE_HEADER -#OPTS += -DSQLITE4_PAGECACHE_BLOCKALLOC -#OPTS += -DSQLITE4_SECURE_DELETE=1 -#OPTS += '-DSQLITE4_SHM_DIRECTORY="/dev/shm"' -#OPTS += -DSQLITE4_SMALL_STACK -#OPTS += -DSQLITE4_SOUNDEX=1 -#OPTS += -DSQLITE4_TCL_DEFAULT_FULLMUTEX=1 -#OPTS += -DSQLITE4_TEMP_STORE=3 -#OPTS += -DSQLITE4_THREADSAFE=0 -#OPTS += -DSQLITE4_THREADSAFE=1 -#OPTS += -DSQLITE4_USE_ALLOCA -#OPTS += -DSQLITE4_ZERO_MALLOC=1 -#OPTS += -DUSE_PREAD64=1 -#OPTS += -DYYSTACKDEPTH=0 -#OPTS += -DSQLITE4_DEFAULT_AUTOVACUUM=1 -#OPTS += -DSQLITE4_DEFAULT_CACHE_SIZE=64 -#OPTS += -DSQLITE4_DEFAULT_PAGE_SIZE=1024 -#OPTS += -DSQLITE4_DEFAULT_TEMP_CACHE_SIZE=32 -#OPTS += -DSQLITE4_DISABLE_LFS=1 -#OPTS += -DSQLITE4_ENABLE_ATOMIC_WRITE=1 -#OPTS += -DSQLITE4_ENABLE_IOTRACE=1 -#OPTS += -DSQLITE4_ENABLE_MEMORY_MANAGEMENT=1 -#OPTS += -DSQLITE4_MAX_PAGE_SIZE=4096 -#OPTS += -DSQLITE4_OMIT_LOAD_EXTENSION=1 -#OPTS += -DSQLITE4_OMIT_PROGRESS_CALLBACK=1 -#OPTS += -DSQLITE4_OMIT_VIRTUALTABLE=1 -#OPTS += -DSQLITE4_TEMP_STORE=3 DELETED Make.solaris Index: Make.solaris ================================================================== --- Make.solaris +++ /dev/null @@ -1,4 +0,0 @@ -# Solaris build configuration - -include Make.unix - DELETED Make.unix Index: Make.unix ================================================================== --- Make.unix +++ /dev/null @@ -1,323 +0,0 @@ -# Linux/UNIX build configuration - -ADDCFLAGS = -ggdb -D UNIX -D_REENTRANT -W -fPIC -ADDCPPFLAGS = -ADDLDFLAGS = -D_REENTRANT -L $(PREFIX)/lib -ADDLIBS = -pthread -DSO_EXTENSION = so -INCPATHS = -I $(PREFIX)/include - -# C Compiler and options for use in building executables that will run on the -# platform that is doing the build. - -BCC = clang -g -#BCC = /opt/ancic/bin/c89 -0 - -# If the target operating system supports the "usleep()" system call, then -# define the HAVE_USLEEP macro for all C modules. - -#USLEEP = -USLEEP = -DHAVE_USLEEP=1 - -#### If you want the SQLite library to be safe for use within a -# multi-threaded program, then define the following macro -# appropriately: -# -#THREADSAFE = -DTHREADSAFE=1 -THREADSAFE = -DTHREADSAFE=0 - -#### Specify any extra linker options needed to make the library -# thread safe -# -#THREADLIB = -lpthread -THREADLIB = - -#### Specify any extra libraries needed to access required functions. -# -#TLIBS = -lrt # fdatasync on Solaris 8 -TLIBS = - -# Compiler Settings - -#### C Compile and options for use in building executables that -# will run on the target platform. This is usually the same -# as BCC, unless you are cross-compiling. -# -#TCC = gcc -O6 -TCC = gcc -g -rdynamic -O0 -Wall -fstrict-aliasing -#TCC = clang -g -O0 -Wall -fstrict-aliasing -#TCC = gcc420 -g -O2 -Wall -#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage -#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6 -#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive - -TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src -I$(TOP) -TCCX += -I$(TOP)/ext/rtree -I$(TOP)/ext/icu -I$(TOP)/ext/fts3 -TCCX += -I$(TOP)/ext/async -TCPPX = g++ -Wall -g -I. -I$(TOP)/src $(OPTS) - -#------------------------------------------------------------------------------- -# Build -#------------------------------------------------------------------------------- - -# This is the default Makefile target. The objects listed here -# are what get build when you type just "make" with no arguments. -# -all: sqlite4.h libsqlite4.a sqlite4$(EXE) - -libsqlite4.a: parse.c $(LIBOBJ) - $(AR) libsqlite4.a $(LIBOBJ) - $(RANLIB) libsqlite4.a - -sqlite4$(EXE): $(TOP)/src/shell.c libsqlite4.a sqlite4.h - $(TCCX) $(READLINE_FLAGS) -o sqlite4$(EXE) \ - $(TOP)/src/shell.c \ - libsqlite4.a $(LIBREADLINE) $(TLIBS) $(THREADLIB) $(MATHLIB) - -sqlite4.o: sqlite4.c - $(TCCX) -c sqlite4.c - -# This target creates a directory named "tsrc" and fills it with copies of all -# of the C source code and header files needed to build on the target -# system. Some of the C source code and header files are automatically -# generated. This target takes care of all that automatic generation. - -target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl - rm -rf tsrc - mkdir tsrc - cp -f $(SRC) tsrc - rm tsrc/sqlite.h.in tsrc/parse.y - tclsh $(TOP)/tool/vdbe-compress.tcl vdbe.new - mv vdbe.new tsrc/vdbe.c - touch target_source - -sqlite4.c: target_source $(TOP)/tool/mksqlite4c.tcl - tclsh $(TOP)/tool/mksqlite4c.tcl - echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite4.c - cat sqlite4.c >>tclsqlite4.c - echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite4.c - cat $(TOP)/src/tclsqlite.c >>tclsqlite4.c - -sqlite4.c-debug: target_source $(TOP)/tool/mksqlite4c.tcl - tclsh $(TOP)/tool/mksqlite4c.tcl --linemacros - echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite4.c - cat sqlite4.c >>tclsqlite4.c - echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite4.c - echo '#line 1 "tclsqlite.c"' >>tclsqlite4.c - cat $(TOP)/src/tclsqlite.c >>tclsqlite4.c - -sqlite4-all.c: sqlite4.c $(TOP)/tool/split-sqlite4c.tcl - tclsh $(TOP)/tool/split-sqlite4c.tcl - -fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl - tclsh $(TOP)/ext/fts2/mkfts2amal.tcl - -fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl - tclsh $(TOP)/ext/fts3/mkfts3amal.tcl - -# Rules to build the LEMON compiler generator -# -lemon: $(TOP)/tool/lemon.c $(TOP)/src/lempar.c - $(BCC) -o lemon $(TOP)/tool/lemon.c - cp $(TOP)/src/lempar.c . - -# Rules to build individual *.o files from generated *.c files. This -# applies to: -# -# parse.o -# opcodes.o -# -%.o: %.c $(HDR) - $(TCCX) -c $< - -# Rules to build individual *.o files from files in the src directory. -# -%.o: $(TOP)/src/%.c $(HDR) - $(TCCX) -c $< - -tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) - $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c - -# Rules to build opcodes.c and opcodes.h -# -opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.awk - $(NAWK) -f $(TOP)/tool/mkopcodec.awk opcodes.h >opcodes.c - -opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.awk - cat parse.h $(TOP)/src/vdbe.c | \ - $(NAWK) -f $(TOP)/tool/mkopcodeh.awk >opcodes.h - -# Rules to build parse.c and parse.h - the outputs of lemon. -# -parse.h: parse.c - -parse.c: $(TOP)/src/parse.y lemon $(TOP)/tool/addopcodes.awk - cp $(TOP)/src/parse.y . - rm -f parse.h - ./lemon $(OPTS) parse.y - mv parse.h parse.h.temp - $(NAWK) -f $(TOP)/tool/addopcodes.awk parse.h.temp >parse.h - -sqlite4.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION - tclsh $(TOP)/tool/mksqlite4h.tcl $(TOP) >sqlite4.h - -keywordhash.h: $(TOP)/tool/mkkeywordhash.c - $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c - ./mkkeywordhash >keywordhash.h - -# Rules to build the extension objects. -icu.o: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/icu/icu.c - -fts2.o: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts2/fts2.c - -fts2_hash.o: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts2/fts2_hash.c - -fts2_icu.o: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts2/fts2_icu.c - -fts2_porter.o: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts2/fts2_porter.c - -fts2_tokenizer.o: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c - -fts2_tokenizer1.o: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c - -fts3.o: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3.c - -fts3_aux.o: $(TOP)/ext/fts3/fts3_aux.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_aux.c - -fts3_expr.o: $(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_expr.c - -fts3_hash.o: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_hash.c - -fts3_icu.o: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_icu.c - -fts3_snippet.o: $(TOP)/ext/fts3/fts3_snippet.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_snippet.c - -fts3_porter.o: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_porter.c - -fts3_tokenizer.o: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c - -fts3_tokenizer1.o: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c - -fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/fts3/fts3_write.c - -rtree.o: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR) - $(TCCX) -DSQLITE4_CORE -c $(TOP)/ext/rtree/rtree.c - -# Rules for building test programs and for running tests -# -tclsqlite4: $(TOP)/src/tclsqlite.c libsqlite4.a - $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite4 \ - $(TOP)/src/tclsqlite.c libsqlite4.a $(LIBTCL) $(THREADLIB) - -# Rules to build the 'testfixture' application. -# -TESTFIXTURE_FLAGS = -DSQLITE4_TEST=1 -DSQLITE4_CRASH_TEST=1 -TESTFIXTURE_FLAGS += -DSQLITE4_SERVER=1 -DSQLITE4_PRIVATE="" -DSQLITE4_CORE - -TESTFIXTURE_PREREQ = $(TESTSRC) $(TESTSRC2) -TESTFIXTURE_PREREQ += $(TOP)/src/tclsqlite.c -TESTFIXTURE_PREREQ += libsqlite4.a - -testfixture$(EXE): $(TESTFIXTURE_PREREQ) - $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ - $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \ - -o testfixture$(EXE) $(LIBTCL) libsqlite4.a $(THREADLIB) - -amalgamation-testfixture$(EXE): sqlite4.c $(TESTSRC) $(TOP)/src/tclsqlite.c - $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ - $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite4.c \ - -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) - -fts3-testfixture$(EXE): sqlite4.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c - $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ - -DSQLITE4_ENABLE_FTS3=1 \ - $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite4.c fts3amal.c \ - -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) - -fulltest: testfixture$(EXE) sqlite4$(EXE) - ./testfixture$(EXE) $(TOP)/test/all.test - -soaktest: testfixture$(EXE) sqlite4$(EXE) - ./testfixture$(EXE) $(TOP)/test/all.test -soak=1 - -test: testfixture$(EXE) sqlite4$(EXE) - ./testfixture$(EXE) $(TOP)/test/src4.test - -# Rules to build the 'lsmtest' application. -# -lsmtest$(EXE): libsqlite4.a $(LSMTESTSRC) $(LSMTESTHDR) - $(TCPPX) -c $(TOP)/lsm-test/lsmtest_tdb2.cc - $(TCCX) $(LSMTESTSRC) lsmtest_tdb2.o libsqlite4.a -o lsmtest$(EXE) $(THREADLIB) -lsqlite3 - - -varint$(EXE): $(TOP)/src/varint.c - $(TCCX) -DVARINT_TOOL -o varint$(EXE) $(TOP)/src/varint.c - -# The next two rules are used to support the "threadtest" target. Building -# threadtest runs a few thread-safety tests that are implemented in C. This -# target is invoked by the releasetest.tcl script. -# -threadtest3$(EXE): sqlite4.o $(TOP)/test/threadtest3.c $(TOP)/test/tt3_checkpoint.c - $(TCCX) -O2 sqlite4.o $(TOP)/test/threadtest3.c \ - -o threadtest3$(EXE) $(THREADLIB) - -threadtest: threadtest3$(EXE) - ./threadtest3$(EXE) - -TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO) -$(TEST_EXTENSION): $(TOP)/test/test_loadext.c - $(MKSHLIB) $(TOP)/test/test_loadext.c -o $(TEST_EXTENSION) - -extensiontest: testfixture$(EXE) $(TEST_EXTENSION) - ./testfixture$(EXE) $(TOP)/test/loadext.test - -# This target will fail if the SQLite amalgamation contains any exported -# symbols that do not begin with "sqlite4_". It is run as part of the -# releasetest.tcl script. -# -checksymbols: sqlite4.o - nm -g --defined-only sqlite4.o | grep -v " sqlite4_" ; test $$? -ne 0 - -# Standard install and cleanup targets -# -install: sqlite4 libsqlite4.a sqlite4.h - mv sqlite4 /usr/bin - mv libsqlite4.a /usr/lib - mv sqlite4.h /usr/include - -clean: - rm -f *.o sqlite4 sqlite4.exe libsqlite4.a sqlite4.h opcodes.* - rm -f lemon lemon.exe lempar.c parse.* sqlite*.tar.gz - rm -f mkkeywordhash mkkeywordhash.exe keywordhash.h - rm -f $(PUBLISH) - rm -f *.da *.bb *.bbg gmon.out - rm -rf tsrc target_source - rm -f testloadext.dll libtestloadext.so - rm -f amalgamation-testfixture amalgamation-testfixture.exe - rm -f fts3-testfixture fts3-testfixture.exe - rm -f testfixture testfixture.exe - rm -f lsmtest - rm -f threadtest3 threadtest3.exe - rm -f sqlite4.c fts?amal.c tclsqlite4.c - rm -f sqlite4_analyzer sqlite4_analyzer.exe sqlite4_analyzer.c - -fossil-clean: - fossil extras | xargs rm - DELETED Make.win Index: Make.win ================================================================== --- Make.win +++ /dev/null @@ -1,8 +0,0 @@ -# Windows build configuration - -DSO_EXTENSION = dll -INCPATHS = -I ../include -ADDCFLAGS = -Wall -D_WIN32 -ADDLDFLAGS = -L/usr/lib -Wl,-L,/c/usr/bin -Wl,--dll -ADDLIBS = $(STATIC_LIBS) -lbz2 \ - -lrpcrt4 -lshell32 -lws2_32 -ladvapi32 -lkernel32 -lmsvcrt ADDED Makefile Index: Makefile ================================================================== --- /dev/null +++ Makefile @@ -0,0 +1,226 @@ +#!/usr/make +# +# Makefile for SQLITE +# +# This is a template makefile for SQLite. Most people prefer to +# use the autoconf generated "configure" script to generate the +# makefile automatically. But that does not work for everybody +# and in every situation. If you are having problems with the +# "configure" script, you might want to try this makefile as an +# alternative. Create a copy of this file, edit the parameters +# below and type "make". +# + +#### The toplevel directory of the source tree. This is the directory +# that contains this "Makefile.in" and the "configure.in" script. +# +TOP = . + +#### C Compiler and options for use in building executables that +# will run on the platform that is doing the build. +# +BCC = clang -g +#BCC = /opt/ancic/bin/c89 -0 + +#### If the target operating system supports the "usleep()" system +# call, then define the HAVE_USLEEP macro for all C modules. +# +#USLEEP = +USLEEP = -DHAVE_USLEEP=1 + +#### Leave SQLITE4_DEBUG undefined for maximum speed. Use SQLITE4_DEBUG=1 +# to check for memory leaks. Use SQLITE4_DEBUG=2 to print a log of all +# malloc()s and free()s in order to track down memory leaks. +# +# SQLite uses some expensive assert() statements in the inner loop. +# You can make the library go almost twice as fast if you compile +# with -DNDEBUG=1 +# +#OPTS += -DHAVE_DLOPEN +OPTS += -DSQLITE4_DEBUG=1 +OPTS += -DHAVE_GMTIME_R +OPTS += -DHAVE_LOCALTIME_R +OPTS += -DHAVE_MALLOC_USABLE_SIZE +OPTS += -DHAVE_USLEEP +#OPTS += -DLONGDOUBLE_TYPE=double +#OPTS += -DSQLITE4_64BIT_STATS +#OPTS += -DSQLITE4_CASE_SENSITIVE_LIKE +#OPTS += -DSQLITE4_CHECK_PAGES +#OPTS += -DSQLITE4_COVERAGE_TEST +#OPTS += -DSQLITE4_DEBUG +#OPTS += -DSQLITE4_DEFAULT_AUTOVACUUM=1 +#OPTS += -DSQLITE4_DEFAULT_CACHE_SIZE=64 +#OPTS += -DSQLITE4_DEFAULT_FILE_FORMAT=4 +#OPTS += -DSQLITE4_DEFAULT_MEMSTATUS=0 +#OPTS += -DSQLITE4_DEFAULT_PAGE_SIZE=1024 +#OPTS += -DSQLITE4_DEFAULT_TEMP_CACHE_SIZE=32 +#OPTS += -DSQLITE4_DISABLE_LFS=1 +#OPTS += -DSQLITE4_ENABLE_8_3_NAMES +#OPTS += -DSQLITE4_ENABLE_ASYNCIO +#OPTS += -DSQLITE4_ENABLE_ATOMIC_WRITE +#OPTS += -DSQLITE4_ENABLE_COLUMN_METADATA +#OPTS += -DSQLITE4_ENABLE_EXPENSIVE_ASSERT +#OPTS += -DSQLITE4_ENABLE_FTS3 +OPTS += -DSQLITE4_ENABLE_FTS4 +#OPTS += -DSQLITE4_ENABLE_FTS3_PARENTHESIS +#OPTS += -DSQLITE4_ENABLE_INSTVFS=1 +#OPTS += -DSQLITE4_ENABLE_ICU +#OPTS += -DSQLITE4_ENABLE_IOTRACE=1 +#OPTS += -DSQLITE4_ENABLE_LOAD_EXTENSION=1 +#OPTS += -DSQLITE4_ENABLE_LOCKING_STYLE=1 +#OPTS += -DSQLITE4_ENABLE_MEMORY_MANAGEMENT=1 +#OPTS += -DSQLITE4_ENABLE_MEMSYS3=1 +#OPTS += -DSQLITE4_ENABLE_MEMSYS5=1 +#OPTS += -DSQLITE4_ENABLE_OVERSIZE_CELL_CHECK +#OPTS += -DSQLITE4_ENABLE_PREUPDATE_HOOK +OPTS += -DSQLITE4_ENABLE_RTREE +#OPTS += -DSQLITE4_ENABLE_RTREE -DVARIANT_RSTARTREE_CHOOSESUBTREE +#OPTS += -DSQLITE4_ENABLE_SESSION +#OPTS += -DSQLITE4_ENABLE_STAT2 +#OPTS += -DSQLITE4_ENABLE_STAT3 +#OPTS += -DSQLITE4_ENABLE_TREE_EXPLAIN +#OPTS += -DSQLITE4_ENABLE_UNLOCK_NOTIFY +#OPTS += -DSQLITE4_ENABLE_UPDATE_DELETE_LIMIT +#OPTS += '-DSQLITE4_FILE_HEADER="MotorolaDB v001"' +#OPTS += -DSQLITE4_HAVE_ISNAN +#OPTS += -DSQLITE4_HOMEGROWN_RECURSIVE_MUTEX=1 +#OPTS += -DSQLITE4_INT64_TYPE=int +#OPTS += -DSQLITE4_LOCK_TRACE +#OPTS += -DSQLITE4_MALLOC_SOFT_LIMIT=1024 +#OPTS += -DSQLITE4_MAX_EXPR_DEPTH=0 +#OPTS += -DSQLITE4_MAX_PAGE_SIZE=4096 +#OPTS += -DSQLITE4_MAX_VARIABLE_NUMBER=500000 +#OPTS += -DSQLITE4_MEMDEBUG=1 +#OPTS += -DSQLITE4_MIXED_ENDIAN_64BIT_FLOAT=1 +#OPTS += -DSQLITE4_MUTEX_NOOP=1 +#OPTS += -DNO_GETTOD=1 +OPTS += -DSQLITE4_NO_SYNC=1 +#OPTS += -DSQLITE4_OMIT_ALTER_TABLE=1 +#OPTS += -DSQLITE4_OMIT_AUTOMATIC_INDEX +#OPTS += -DSQLITE4_OMIT_AUTOVACUUM=1 +#OPTS += -DSQLITE4_OMIT_BLOB_LITERAL=1 +#OPTS += -DSQLITE4_OMIT_CHECK=1 +#OPTS += -DSQLITE4_OMIT_DATETIME_FUNCS=1 +#OPTS += -DSQLITE4_OMIT_DEPRECATED=1 +#OPTS += -DSQLITE4_OMIT_DISKIO +#OPTS += -DSQLITE4_OMIT_FLOATING_POINT=1 +#OPTS += -DSQLITE4_OMIT_ICU_LIKE +#OPTS += -DSQLITE4_OMIT_LOAD_EXTENSION=1 +#OPTS += -DSQLITE4_OMIT_LOOKASIDE=1 +#OPTS += -DSQLITE4_OMIT_MEMORYDB=1 +#OPTS += -DSQLITE4_OMIT_MERGE_SORT=1 +#OPTS += -DSQLITE4_OMIT_PROGESS_CALLBACK=1 +#OPTS += -DSQLITE4_OMIT_REINDEX=1 +#OPTS += -DSQLITE4_OMIT_SHARED_CACHE=1 +#OPTS += -DSQLITE4_OMIT_TRACE=1 +#OPTS += -DSQLITE4_OMIT_UTF16=1 +#OPTS += -DSQLITE4_OMIT_VIEW=1 +#OPTS += -DSQLITE4_OMIT_VIRTUALTABLE=1 +#OPTS += -DSQLITE4_OMIT_WAL +#OPTS += -DSQLITE4_OMIT_WSD=1 +#OPTS += -DSQLITE4_OS_OTHER=1 +#OPTS += -DSQLITE4_OS_UNIX=1 +#OPTS += -DSQLITE4_PCACHE_SEPARATE_HEADER +#OPTS += -DSQLITE4_PAGECACHE_BLOCKALLOC +#OPTS += -DSQLITE4_SECURE_DELETE=1 +#OPTS += '-DSQLITE4_SHM_DIRECTORY="/dev/shm"' +#OPTS += -DSQLITE4_SMALL_STACK +#OPTS += -DSQLITE4_SOUNDEX=1 +#OPTS += -DSQLITE4_TCL_DEFAULT_FULLMUTEX=1 +#OPTS += -DSQLITE4_TEMP_STORE=3 +#OPTS += -DSQLITE4_THREADSAFE=0 +#OPTS += -DSQLITE4_THREADSAFE=1 +#OPTS += -DSQLITE4_USE_ALLOCA +#OPTS += -DSQLITE4_ZERO_MALLOC=1 +#OPTS += -DUSE_PREAD64=1 +#OPTS += -DYYSTACKDEPTH=0 +#OPTS += -DSQLITE4_DEFAULT_AUTOVACUUM=1 +#OPTS += -DSQLITE4_DEFAULT_CACHE_SIZE=64 +#OPTS += -DSQLITE4_DEFAULT_PAGE_SIZE=1024 +#OPTS += -DSQLITE4_DEFAULT_TEMP_CACHE_SIZE=32 +#OPTS += -DSQLITE4_DISABLE_LFS=1 +#OPTS += -DSQLITE4_ENABLE_ATOMIC_WRITE=1 +#OPTS += -DSQLITE4_ENABLE_IOTRACE=1 +#OPTS += -DSQLITE4_ENABLE_MEMORY_MANAGEMENT=1 +#OPTS += -DSQLITE4_MAX_PAGE_SIZE=4096 +#OPTS += -DSQLITE4_OMIT_LOAD_EXTENSION=1 +#OPTS += -DSQLITE4_OMIT_PROGRESS_CALLBACK=1 +#OPTS += -DSQLITE4_OMIT_VIRTUALTABLE=1 +#OPTS += -DSQLITE4_TEMP_STORE=3 + +#### The suffix to add to executable files. ".exe" for windows. +# Nothing for unix. +# +#EXE = .exe +EXE = + +#### C Compile and options for use in building executables that +# will run on the target platform. This is usually the same +# as BCC, unless you are cross-compiling. +# +#TCC = gcc -O6 +#TCC = gcc -g -rdynamic -O0 -Wall -fstrict-aliasing +TCC = clang -g -O0 -Wall -fstrict-aliasing +#TCC = gcc420 -g -O2 -Wall +#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage +#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6 +#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive + +#### Tools used to build a static library. +# +AR = ar cr +#AR = /opt/mingw/bin/i386-mingw32-ar cr +RANLIB = ranlib +#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib + +#### Extra compiler options needed for programs that use the TCL library. +# +#TCL_FLAGS = +#TCL_FLAGS = -DSTATIC_BUILD=1 +#TCL_FLAGS = -I/home/drh/tcltk/85linux +#TCL_FLAGS = -I/home/drh/tcltk/86linux +#TCL_FLAGS = -I/home/drh/tcltk/84win -DSTATIC_BUILD=1 +#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux + +#### Linker options needed to link against the TCL library. +# +#LIBTCL = -ltcl8.4 -lm -ldl +#LIBTCL = /home/drh/tcltk/85linux/libtcl8.5.a -lm -ldl -lpthread +LIBTCL = -ltcl8.6 -lm -lpthread -ldl -lz +#LIBTCL = /home/drh/tcltk/84linux/libtcl84thread.a -lm -ldl +#LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt +#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc + +#### Compiler options needed for programs that use the readline() library. +# +READLINE_FLAGS = +#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline + +#### Linker options needed by programs using readline() must link against. +# +LIBREADLINE = -ldl -lpthread +#LIBREADLINE = -static -lreadline -ltermcap + +#### Should the database engine assume text is coded as UTF-8 or iso8859? +# +ENCODING = UTF8 +#ENCODING = ISO8859 + +#### Math library +# +MATHLIB = -lm +# MATHLIB = + +#### AWK (Needed by brain-dead Solaris systems) +# +NAWK = awk + +#### THREADLIB Libraries needed for threadtest +# +THREADLIB = -ldl -lpthread + +#OPTS += -DSQLITE4_FILE_HEADER='"bogus header..."' + +# You should not have to change anything below this line +############################################################################### +include $(TOP)/main.mk DELETED Makefile.in Index: Makefile.in ================================================================== --- Makefile.in +++ /dev/null @@ -1,78 +0,0 @@ -#------------------------------------------------------------------------------- -# Project Specific Parameters -#------------------------------------------------------------------------------- - -include Make.defines -include Make.opts - -#------------------------------------------------------------------------------- -# Directories -#------------------------------------------------------------------------------- - -PREFIX = @prefix@ -DESTDIR = -BINDIR = $(DESTDIR)/$(PREFIX)/bin -INCDIR = $(DESTDIR)/$(PREFIX)/include -LIBDIR = $(DESTDIR)/$(PREFIX)/lib -INFODIR = $(DESTDIR)/$(PREFIX)/info -MANDIR = $(DESTDIR)/$(PREFIX)/man -TOP_SRCDIR = @top_srcdir@ -SRCDIR = @srcdir@ - -include @OS_MAKEFILE@ - -#------------------------------------------------------------------------------- -# Compile Options -#------------------------------------------------------------------------------- - -CPP = g++ -CC = gcc -CFLAGS = $(ADDLCFLAGS) $(INCPATHS) \ - $(PROFILING) $(MEM_TRACING) $(DEBUGGING) $(TRACING) -CPPFLAGS = @CPPFLAGS@ $(ADDCPPFLAGS) -LDFLAGS = @LDFLAGS@ $(ADDLDFLAGS) -LIBS = @LIBS@ $(ADDLIBS) -INSTALL = @INSTALL@ - -#------------------------------------------------------------------------------- -# Targets -#------------------------------------------------------------------------------- - -LIBVER = @VERSION@ -A_LIB = lib$(NAME).a -S_LIB = lib$(NAME).$(DSO_EXTENSION) -VS_LIB = $(S_LIB).$(LIBVER) -PROGS = all -FILES = -LIBFILES = lib.o fs.o common.o -HDR = -CLEANFILES = gmon.out prof.txt *core \ - *.o *~ *.$(DSO_EXTENSION) *.a - -BUILDFILES = config.h autoscan.log config.status \ - tmp.txt configure config.log configure.scan - -#------------------------------------------------------------------------------- -# Autoconf -#------------------------------------------------------------------------------- - -# automatic re-running of configure if the ocnfigure.in file has changed -${SRCDIR}/configure: configure.in - cd ${SRCDIR} && autoconf - -# autoheader might not change config.h.in, so touch a stamp file -${SRCDIR}/config.h.in: stamp-h.in -${SRCDIR}/stamp-h.in: configure.in aclocal.m4 - cd ${SRCDIR} && autoheader - echo timestamp > ${SRCDIR}/stamp-h.in - -config.h: stamp-h - -stamp-h: config.h.in config.status - ./config.status - -Makefile: Makefile.in config.status - ./config.status - -config.status: configure - ./config.status --recheck Index: README ================================================================== --- README +++ README @@ -9,12 +9,13 @@ script found at the root of the source tree. Then run "make". For example: tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite" - ./autogen.sh ;# Create the configure script - configure ;# Run the configure script + mkdir bld ;# Build will occur in a sibling directory + cd bld ;# Change to the build directory + ../sqlite/configure ;# Run the configure script make ;# Run the makefile. make install ;# (Optional) Install the build products The configure script uses autoconf 2.61 and libtool. If the configure script does not work out for you, there is a generic makefile named DELETED autogen.sh Index: autogen.sh ================================================================== --- autogen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -echo "m4_define([VERSION_NUMBER],[$(cat VERSION)])" > VERSION.m4 -autoscan && autoheader && autoconf DELETED config.h.in Index: config.h.in ================================================================== --- config.h.in +++ /dev/null @@ -1,55 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ -#undef HAVE_UTIME_NULL - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS DELETED config/config.guess Index: config/config.guess ================================================================== --- config/config.guess +++ /dev/null @@ -1,1510 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-12-08' - -# This file 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. -# -# This program 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 this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -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." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - x86:Interix*:[3456]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[3456]* | authenticamd:Interix*:[3456]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa:Linux:*:*) - echo xtensa-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: DELETED config/config.sub Index: config/config.sub ================================================================== --- config/config.sub +++ /dev/null @@ -1,1619 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-12-08' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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. -# -# This program 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 this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -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." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: DELETED config/install-sh Index: config/install-sh ================================================================== --- config/install-sh +++ /dev/null DELETED config/missing Index: config/missing ================================================================== --- config/missing +++ /dev/null DELETED config/mkinstalldirs Index: config/mkinstalldirs ================================================================== --- config/mkinstalldirs +++ /dev/null DELETED configure.in Index: configure.in ================================================================== --- configure.in +++ /dev/null @@ -1,56 +0,0 @@ -m4_include([VERSION.m4]) - -AC_INIT(sqlite4, VERSION_NUMBER, drh@sqlite.org) - -AC_CONFIG_AUX_DIR(config) - -PACKAGE=sqlite4 - -AC_SUBST(VERSION, $VERSION_NUMBER) - -AC_CANONICAL_HOST -AC_MSG_NOTICE([Host = ${host}]) - -case ${host} in - *-FreeBSD*) - AC_SUBST(OS_MAKEFILE, Make.freebsd) - ;; - *-linux*) - AC_SUBST(OS_MAKEFILE, Make.linux) - ;; - *-*-mingw32*) - AC_SUBST(OS_MAKEFILE, Make.mingw) - ;; - *-solaris*) - AC_SUBST(OS_MAKEFILE, Make.solaris) - ;; -esac - -AC_CONFIG_HEADERS(config.h) - -# Checks for programs. -AC_PROG_CC -AC_PROG_CXX -AC_PROG_CXXCPP -AC_PROG_INSTALL -AC_PROG_RANLIB -AC_PROG_AWK - -# Checks for libraries. - -# Checks for header files. - -AC_HEADER_STDC -#AC_CHECK_HEADERS(utime.h) -#AC_CHECK_HEADERS(sys/epoll.h, AC_DEFINE([LINUX_26],[],[Linux 2.6]), AC_DEFINE([LINUX_24],[],[Linux 2.4])) -#AC_CHECK_HEADERS(sys/epoll.h) -AC_FUNC_UTIME_NULL - -# Checks for typedefs, structures, and compiler characteristics. - -# Checks for library functions. - -AC_CONFIG_FILES([Makefile]) - -AC_OUTPUT - Index: lsm-test/lsmtest_main.c ================================================================== --- lsm-test/lsmtest_main.c +++ lsm-test/lsmtest_main.c @@ -565,11 +565,11 @@ " -write $write (default value 10000)\n" " -pause $pause (default value 0)\n" " -fetch $fetch (default value 0)\n" " -keysize $keysize (default value 12)\n" " -valsize $valsize (default value 100)\n" -" -system $system (default value \"lsm\")\n" +" -system $system (default value \"lsm\"\n" "\n" ); } int do_speed_test2(int nArg, char **azArg){ @@ -644,11 +644,11 @@ printf("#"); for(i=0; i=0 ){ printf(" %s=%d", &aOpt[i].zOpt[1], aParam[aOpt[i].eVal]); - }else if( aOpt[i].eVal==-1 ){ + }else{ printf(" %s=\"%s\"", &aOpt[i].zOpt[1], zSystem); } } } printf("\n"); @@ -1428,11 +1428,11 @@ #include static void lsmtest_rusage_report(void){ int res; struct rusage r; - memset(&r, 0, sizeof(r)); + memset(&r, sizeof(r), 0); res = getrusage(RUSAGE_SELF, &r); assert( res==0 ); printf("# getrusage: { ru_maxrss %d ru_oublock %d ru_inblock %d }\n", @@ -1456,11 +1456,11 @@ {"insert", do_insert}, {"replay", do_replay}, {"speed", do_speed_tests}, - {"speed2", do_speed_test2}, + {"speed2", do_speed_test2}, {"show", st_do_show}, {"work", st_do_work}, {"test", do_test}, {0, 0} }; Index: lsm-test/lsmtest_tdb3.c ================================================================== --- lsm-test/lsmtest_tdb3.c +++ lsm-test/lsmtest_tdb3.c @@ -814,14 +814,14 @@ z++; zStart = z; while( *z>='0' && *z<='9' ) z++; if( *z=='k' || *z=='K' ){ - iMul = 1; + iMul = 1024; z++; }else if( *z=='M' || *z=='M' ){ - iMul = 1024; + iMul = 1024 * 1024; z++; } nParam = z-zStart; if( nParam==0 || nParam>sizeof(zParam)-1 ) goto syntax_error; memcpy(zParam, zStart, nParam); @@ -839,14 +839,14 @@ break; case TEST_MT_MODE: if( pLsm ) nThread = iVal; break; case TEST_MT_MIN_CKPT: - if( pLsm && iVal>0 ) pLsm->nMtMinCkpt = iVal*1024; + if( pLsm && iVal>0 ) pLsm->nMtMinCkpt = iVal; break; case TEST_MT_MAX_CKPT: - if( pLsm && iVal>0 ) pLsm->nMtMaxCkpt = iVal*1024; + if( pLsm && iVal>0 ) pLsm->nMtMaxCkpt = iVal; break; #ifdef HAVE_ZLIB case TEST_COMPRESSION: testConfigureCompression(db); break; Index: lsm-test/lsmtest_util.c ================================================================== --- lsm-test/lsmtest_util.c +++ lsm-test/lsmtest_util.c @@ -1,10 +1,13 @@ +#include "lsmtest.h" + #include #include #include #include + /* ** Global variables used within this module. */ static struct TestutilGlobal { @@ -11,13 +14,13 @@ char **argv; int argc; } g = {0, 0}; static struct TestutilRnd { - unsigned int aRand1[2048]; /* Bits 0..10 */ - unsigned int aRand2[2048]; /* Bits 11..21 */ - unsigned int aRand3[1024]; /* Bits 22..31 */ + u32 aRand1[2048]; /* Bits 0..10 */ + u32 aRand2[2048]; /* Bits 11..21 */ + u32 aRand3[1024]; /* Bits 22..31 */ } r; /************************************************************************* ** The following block is a copy of the implementation of SQLite function ** sqlite3_randomness. This version has two important differences: @@ -67,11 +70,11 @@ 0xAE, 0x13, 0x06, 0xF5, 0x1C, 0x4E, 0x52, 0xF7 } }; /* Generate and return single random byte */ -static unsigned char randomByte(void){ +static u8 randomByte(void){ unsigned char t; sqlite3Prng.i++; t = sqlite3Prng.s[sqlite3Prng.i]; sqlite3Prng.j += t; sqlite3Prng.s[sqlite3Prng.i] = sqlite3Prng.s[sqlite3Prng.j]; @@ -93,32 +96,33 @@ ** End of code copied from SQLite. *************************************************************************/ int testPrngInit(void){ + sqlite3_initialize(); randomBlob(sizeof(r.aRand1), (unsigned char *)r.aRand1); randomBlob(sizeof(r.aRand2), (unsigned char *)r.aRand2); randomBlob(sizeof(r.aRand3), (unsigned char *)r.aRand3); - return 0; + return LSM_OK; } -unsigned int testPrngValue(unsigned int iVal){ +u32 testPrngValue(u32 iVal){ return r.aRand1[iVal & 0x000007FF] ^ r.aRand2[(iVal>>11) & 0x000007FF] ^ r.aRand3[(iVal>>22) & 0x000003FF] ; } -void testPrngArray(unsigned int iVal, unsigned int *aOut, int nOut){ +void testPrngArray(u32 iVal, u32 *aOut, int nOut){ int i; for(i=0; izName; - pEntry=(struct Entry *)&((unsigned char *)pEntry)[sz] + pEntry=(struct Entry *)&((u8 *)pEntry)[sz] ){ if( zPrev ){ testPrintError("%s, ", zPrev); } zPrev = pEntry->zName; } testPrintError("or %s\n", zPrev); @@ -171,11 +175,11 @@ int iOut = -1; int nOut = 0; for(pEntry=(struct Entry *)aData; pEntry->zName; - pEntry=(struct Entry *)&((unsigned char *)pEntry)[sz] + pEntry=(struct Entry *)&((u8 *)pEntry)[sz] ){ int nName = strlen(pEntry->zName); if( nArg<=nName && memcmp(pEntry->zName, zArg, nArg)==0 ){ iOut = i; if( nName==nArg ){ DELETED lsm-test/sqltest.c Index: lsm-test/sqltest.c ================================================================== --- lsm-test/sqltest.c +++ /dev/null @@ -1,553 +0,0 @@ -/* -** 2013 March 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 contains C code for a program that links against SQLite -** versions 3 and 4. It contains a few simple performance test routines -** that can be run against either database system. -*/ - -#include "sqlite4.h" -#include "sqlite3.h" -#include "lsm.h" - -#include -#include -#include -#include - -#define SQLITE3_DB_FILE "test.db3" -#define SQLITE4_DB_FILE "test.db4" - -#include "lsmtest_util.c" - -/* -** Unlink database zDb and its supporting files (wal, shm, journal, and log). -** This function works with both lsm and sqlite3 databases. -*/ -static int unlink_db(const char *zDb){ - int i; - char *zBase = (char *)zDb; - const char *azExt[] = { "", "-shm", "-wal", "-journal", "-log", 0 }; - - if( 0==sqlite4_strnicmp("file:", zDb, 5) ){ - for(i=5; zDb[i] && zDb[i]!='?'; i++); - zBase = sqlite4_mprintf(0, "%.*s", i-5, &zDb[5]); - } - - for(i=0; azExt[i]; i++){ - char *zFile = sqlite4_mprintf(0, "%s%s", zBase, azExt[i]); - unlink(zFile); - sqlite4_free(0, zFile); - } - - if( zBase!=zDb ){ - sqlite4_free(0, zBase); - } - return 0; -} - -static char *create_schema_sql(int nIdx){ - char *zSchema; - int i; - - zSchema = sqlite4_mprintf(0, "CREATE TABLE t1(k PRIMARY KEY,"); - for(i=0; i=nMin && nByte<=nMax ); - if( nByte>sizeof(aBlob) ) nByte = sizeof(aBlob); - testPrngArray(iSeed, (unsigned int *)aBlob, (nByte+3)/4); - - sqlite4_result_blob(ctx, aBlob, nByte, SQLITE4_TRANSIENT, 0); -} -static void install_rblob_function4(sqlite4 *db){ - testPrngInit(); - sqlite4_create_function(db, "rblob", 3, SQLITE4_UTF8, 0, rblobFunc4, 0, 0); -} - -/* sqlite3 implementation */ -static void rblobFunc3(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){ - unsigned char aBlob[1000]; - - int iSeed = sqlite3_value_int(apArg[0]); - int nMin = sqlite3_value_int(apArg[1]); - int nMax = sqlite3_value_int(apArg[2]); - int nByte; - - nByte = testPrngValue(iSeed + 1000000) & 0x7FFFFFFF; - nByte = (nByte % (nMax+1-nMin)) + nMin; - assert( nByte>=nMin && nByte<=nMax ); - if( nByte>sizeof(aBlob) ) nByte = sizeof(aBlob); - testPrngArray(iSeed, (unsigned int *)aBlob, (nByte+3)/4); - - sqlite3_result_blob(ctx, aBlob, nByte, SQLITE_TRANSIENT); -} -static void install_rblob_function3(sqlite3 *db){ - testPrngInit(); - sqlite3_create_function(db, "rblob", 3, SQLITE_UTF8, 0, rblobFunc3, 0, 0); -} -/* -** End of rblob() implementations. -*************************************************************************/ - -/************************************************************************* -** Integer query functions for sqlite3 and src4. -*/ -static int integer_query4(sqlite4 *db, const char *zSql){ - int iRet; - sqlite4_stmt *pStmt; - - EXPLODE( sqlite4_prepare(db, zSql, -1, &pStmt, 0) ); - EXPLODE( SQLITE_ROW!=sqlite4_step(pStmt) ); - iRet = sqlite4_column_int(pStmt, 0); - EXPLODE( sqlite4_finalize(pStmt) ); - - return iRet; -} -static int integer_query3(sqlite3 *db, const char *zSql){ - int iRet; - sqlite3_stmt *pStmt; - - EXPLODE( sqlite3_prepare(db, zSql, -1, &pStmt, 0) ); - EXPLODE( SQLITE_ROW!=sqlite3_step(pStmt) ); - iRet = sqlite3_column_int(pStmt, 0); - EXPLODE( sqlite3_finalize(pStmt) ); - - return iRet; -} -/* -** End of integer query implementations. -*************************************************************************/ - -static int do_insert1_test4( - const char *zFile, - int nRow, /* Number of rows to insert in total */ - int nRowPerTrans, /* Number of rows per transaction */ - int nIdx, /* Number of aux indexes (aside from PK) */ - int iSync /* PRAGMA synchronous value (0, 1 or 2) */ -){ - char *zCreateTbl; /* Create table statement */ - char *zInsert; /* INSERT statement */ - sqlite4_stmt *pInsert; /* Compiled INSERT statement */ - sqlite4 *db = 0; /* Database handle */ - int i; /* Counter to count nRow rows */ - int nMs; /* Test time in ms */ - - lsm_db *pLsm; - - if( zFile==0 ) zFile = SQLITE4_DB_FILE; - unlink_db(zFile); - EXPLODE( sqlite4_open(0, zFile, &db) ); - sqlite4_kvstore_control(db, "main", SQLITE4_KVCTRL_LSM_HANDLE, &pLsm); - i = iSync; - lsm_config(pLsm, LSM_CONFIG_SAFETY, &i); - assert( i==iSync ); - - install_rblob_function4(db); - - zCreateTbl = create_schema_sql(nIdx); - zInsert = create_insert_sql(nIdx); - - /* Create the db schema and prepare the INSERT statement */ - EXPLODE( sqlite4_exec(db, zCreateTbl, 0, 0, 0) ); - EXPLODE( sqlite4_prepare(db, zInsert, -1, &pInsert, 0) ); - - /* Run the test */ - testTimeInit(); - for(i=0; iaArg[iSel].nMax ){ - fprintf(stderr, "option %s out of range (%d..%d)\n", - aArg[iSel].zArg, aArg[iSel].nMin, aArg[iSel].nMax - ); - return -1; - } - - switch( iSel ){ - case 0: iDb = iVal; break; - case 1: nRow = iVal; break; - case 2: nRowPerTrans = iVal; break; - case 3: nIdx = iVal; break; - case 4: iSync = iVal; break; - } - } - } - - printf("insert1: db=%d rows=%d rowspertrans=%d indexes=%d sync=%d ... ", - iDb, nRow, nRowPerTrans, nIdx, iSync - ); - fflush(stdout); - if( iDb==3 ){ - do_insert1_test3(zFile, nRow, nRowPerTrans, nIdx, iSync); - }else{ - do_insert1_test4(zFile, nRow, nRowPerTrans, nIdx, iSync); - } - - return 0; -} - -static int do_select1_test4( - const char *zFile, - int nRow, /* Number of rows to read in total */ - int nRowPerTrans, /* Number of rows per transaction */ - int iIdx -){ - int nMs = 0; - sqlite4_stmt *pSelect = 0; - char *zSelect; - sqlite4 *db; - int i; - int nTblRow; - - if( zFile==0 ) zFile = SQLITE4_DB_FILE; - EXPLODE( sqlite4_open(0, zFile, &db) ); - install_rblob_function4(db); - - nTblRow = integer_query4(db, "SELECT count(*) FROM t1"); - - /* Create the db schema and prepare the INSERT statement */ - zSelect = create_select_sql(iIdx); - EXPLODE( sqlite4_prepare(db, zSelect, -1, &pSelect, 0) ); - - testTimeInit(); - for(i=0; iaArg[iSel].nMax ){ - fprintf(stderr, "option %s out of range (%d..%d)\n", - aArg[iSel].zArg, aArg[iSel].nMin, aArg[iSel].nMax - ); - return -1; - } - - switch( iSel ){ - case 0: iDb = iVal; break; - case 1: nRow = iVal; break; - case 2: nRowPerTrans = iVal; break; - case 3: iIdx = iVal; break; - } - } - } - - printf("select1: db=%d rows=%d rowspertrans=%d index=%d ... ", - iDb, nRow, nRowPerTrans, iIdx - ); - fflush(stdout); - if( iDb==3 ){ - do_select1_test3(zFile, nRow, nRowPerTrans, iIdx); - }else{ - do_select1_test4(zFile, nRow, nRowPerTrans, iIdx); - } - - return 0; -} - -int main(int argc, char **argv){ - struct SqltestArg { - const char *zPrg; - int (*xPrg)(int, char **); - } aArg[] = { - {"select", do_select1}, - {"insert", do_insert1}, - {0, 0} - }; - int iSel; - int rc; - - if( argc<2 ){ - fprintf(stderr, "Usage: %s sub-program...\n", argv[0]); - return -1; - } - - rc = testArgSelectX(aArg, "sub-program", sizeof(aArg[0]), argv[1], &iSel); - if( rc!=0 ) return -1; - - aArg[iSel].xPrg(argc-2, argv+2); - return 0; -} Index: main.mk ================================================================== --- main.mk +++ main.mk @@ -42,16 +42,16 @@ ################################################################################ # FIXME: Required options for now. # OPTS += -DLSM_MUTEX_NONE -#OPTS += -DSQLITE4_DEBUG=1 -DLSM_DEBUG=1 +OPTS += -DSQLITE4_DEBUG=1 -DLSM_DEBUG=1 OPTS += -DHAVE_GMTIME_R OPTS += -DHAVE_LOCALTIME_R OPTS += -DHAVE_MALLOC_USABLE_SIZE OPTS += -DHAVE_USLEEP -#OPTS += -DSQLITE4_MEMDEBUG=1 +OPTS += -DSQLITE4_MEMDEBUG=1 #OPTS += -DSQLITE4_NO_SYNC=1 -DLSM_NO_SYNC=1 OPTS += -DSQLITE4_OMIT_ANALYZE OPTS += -DSQLITE4_OMIT_AUTOMATIC_INDEX OPTS += -DSQLITE4_OMIT_BTREECOUNT OPTS += -DSQLITE4_OMIT_VIRTUALTABLE=1 @@ -489,11 +489,11 @@ TESTFIXTURE_PREREQ += libsqlite4.a testfixture$(EXE): $(TESTFIXTURE_PREREQ) $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ $(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \ - -o testfixture$(EXE) $(LIBTCL) libsqlite4.a $(THREADLIB) + -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite4.a amalgamation-testfixture$(EXE): sqlite4.c $(TESTSRC) $(TOP)/src/tclsqlite.c $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite4.c \ -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) @@ -532,15 +532,10 @@ -o threadtest3$(EXE) $(THREADLIB) threadtest: threadtest3$(EXE) ./threadtest3$(EXE) -SQLSRC = $(TOP)/lsm-test/sqltest.c $(TOP)/lsm-test/lsmtest_util.c -sqltest$(EXE): $(SQLSRC) libsqlite4.a - $(TCCX) $(TOP)/lsm-test/sqltest.c \ - -o sqltest$(EXE) -lsqlite3 libsqlite4.a $(THREADLIB) - TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO) $(TEST_EXTENSION): $(TOP)/test/test_loadext.c $(MKSHLIB) $(TOP)/test/test_loadext.c -o $(TEST_EXTENSION) extensiontest: testfixture$(EXE) $(TEST_EXTENSION) Index: src/fts5func.c ================================================================== --- src/fts5func.c +++ src/fts5func.c @@ -544,43 +544,10 @@ mask = mask >> nShift; pSnip->iOff = iOff; pSnip->hlmask = mask; } - -/* -** Parameter aSnip points to an array of nSnip Snippet objects, where nSnip -** is less than or equal to 4. This function sorts the array in place in -** ascending order of Snippet.iCol and Snippet.iOff. -*/ -static void fts5SnippetSort(Snippet *aSnip, int nSnip){ - Snippet aTmp[4]; - int i; - - assert( nSnip<=4 && nSnip>=1 ); - - for(i=0; iiCol>=0 && (iBest<0 - || pTry->iColiCol==aSnip[iBest].iCol && pTry->iOff=0 ); - memcpy(&aTmp[i], &aSnip[iBest], sizeof(Snippet)); - aSnip[iBest].iCol = -1; - } - - memcpy(aSnip, aTmp, sizeof(Snippet)*nSnip); -} - static void fts5Snippet(sqlite4_context *pCtx, int nArg, sqlite4_value **apArg){ Snippet aSnip[4]; int nSnip; int iCol = -1; @@ -614,11 +581,10 @@ for(i=0; rc==SQLITE4_OK && i %s", p->kvId, (int)iVal); - return p->pStoreVfunc->xPutMeta(p, iVal); -} - -/* -** Read the schema cookie value into *piVal. -*/ -int sqlite4KVStoreGetSchema(KVStore *p, unsigned int *piVal){ - int rc = p->pStoreVfunc->xGetMeta(p, piVal); - kvTrace(p, "xGetMeta(%d) -> %d", p->kvId, (int)*piVal); - return rc; -} - /* ** Write nMeta unsigned 32-bit integers beginning with iStart. */ int sqlite4KVStorePutMeta( sqlite4 *db, /* Database connection. Needed to malloc */ Index: src/kv.h ================================================================== --- src/kv.h +++ src/kv.h @@ -172,12 +172,8 @@ int sqlite4KVStoreRevert(KVStore *p, int iLevel); int sqlite4KVStoreClose(KVStore *p); int sqlite4KVStoreGetMeta(KVStore *p, int, int, unsigned int*); int sqlite4KVStorePutMeta(sqlite4*, KVStore *p, int, int, unsigned int*); - -int sqlite4KVStorePutSchema(KVStore *p, unsigned int iVal); -int sqlite4KVStoreGetSchema(KVStore *p, unsigned int *piVal); - #ifdef SQLITE4_DEBUG void sqlite4KVStoreDump(KVStore *p); #endif Index: src/kvlsm.c ================================================================== --- src/kvlsm.c +++ src/kvlsm.c @@ -407,20 +407,10 @@ } return rc; } -static int kvlsmGetMeta(KVStore *pKVStore, unsigned int *piVal){ - KVLsm *p = (KVLsm *)pKVStore; - return lsm_get_user_version(p->pDb, piVal); -} - -static int kvlsmPutMeta(KVStore *pKVStore, unsigned int iVal){ - KVLsm *p = (KVLsm *)pKVStore; - return lsm_set_user_version(p->pDb, iVal); -} - /* ** Create a new in-memory storage engine and return a pointer to it. */ int sqlite4KVStoreOpenLsm( sqlite4_env *pEnv, /* Run-time environment */ @@ -429,31 +419,29 @@ unsigned openFlags /* Flags */ ){ /* Virtual methods for an LSM data store */ static const KVStoreMethods kvlsmMethods = { - 1, /* iVersion */ - sizeof(KVStoreMethods), /* szSelf */ - kvlsmReplace, /* xReplace */ - kvlsmOpenCursor, /* xOpenCursor */ - kvlsmSeek, /* xSeek */ - kvlsmNextEntry, /* xNext */ - kvlsmPrevEntry, /* xPrev */ - kvlsmDelete, /* xDelete */ - kvlsmKey, /* xKey */ - kvlsmData, /* xData */ - kvlsmReset, /* xReset */ - kvlsmCloseCursor, /* xCloseCursor */ - kvlsmBegin, /* xBegin */ - kvlsmCommitPhaseOne, /* xCommitPhaseOne */ - kvlsmCommitPhaseTwo, /* xCommitPhaseTwo */ - kvlsmRollback, /* xRollback */ - kvlsmRevert, /* xRevert */ - kvlsmClose, /* xClose */ - kvlsmControl, /* xControl */ - kvlsmGetMeta, /* xGetMeta */ - kvlsmPutMeta /* xPutMeta */ + 1, /* iVersion */ + sizeof(KVStoreMethods), /* szSelf */ + kvlsmReplace, /* xReplace */ + kvlsmOpenCursor, /* xOpenCursor */ + kvlsmSeek, /* xSeek */ + kvlsmNextEntry, /* xNext */ + kvlsmPrevEntry, /* xPrev */ + kvlsmDelete, /* xDelete */ + kvlsmKey, /* xKey */ + kvlsmData, /* xData */ + kvlsmReset, /* xReset */ + kvlsmCloseCursor, /* xCloseCursor */ + kvlsmBegin, /* xBegin */ + kvlsmCommitPhaseOne, /* xCommitPhaseOne */ + kvlsmCommitPhaseTwo, /* xCommitPhaseTwo */ + kvlsmRollback, /* xRollback */ + kvlsmRevert, /* xRevert */ + kvlsmClose, /* xClose */ + kvlsmControl /* xControl */ }; KVLsm *pNew; int rc = SQLITE4_OK; @@ -463,12 +451,10 @@ }else{ struct Config { const char *zParam; int eParam; } aConfig[] = { - { "lsm_mmap", LSM_CONFIG_MMAP }, - { "lsm_page_size", LSM_CONFIG_PAGE_SIZE }, { "lsm_block_size", LSM_CONFIG_BLOCK_SIZE }, { "lsm_multiple_processes", LSM_CONFIG_MULTIPLE_PROCESSES } }; memset(pNew, 0, sizeof(KVLsm)); @@ -477,11 +463,10 @@ rc = lsm_new(0, &pNew->pDb); if( rc==SQLITE4_OK ){ int i; int bMmap = 0; lsm_config(pNew->pDb, LSM_CONFIG_MMAP, &bMmap); - for(i=0; ipDb, aConfig[i].eParam, &nVal); Index: src/kvmem.c ================================================================== --- src/kvmem.c +++ src/kvmem.c @@ -68,11 +68,10 @@ KVMemNode *pRoot; /* Root of the tree of content */ unsigned openFlags; /* Flags used at open */ KVMemChng **apLog; /* Array of transaction logs */ int nCursor; /* Number of outstanding cursors */ int iMagicKVMemBase; /* Magic number of sanity */ - unsigned int iMeta; /* Schema cookie value */ }; #define SQLITE4_KVMEMBASE_MAGIC 0xbfcd47d0 /* ** A cursor used for scanning through the tree @@ -915,22 +914,10 @@ static int kvmemControl(KVStore *pKVStore, int op, void *pArg){ return SQLITE4_NOTFOUND; } -static int kvmemGetMeta(KVStore *pKVStore, unsigned int *piVal){ - KVMem *p = (KVMem*)pKVStore; - *piVal = p->iMeta; - return SQLITE4_OK; -} - -static int kvmemPutMeta(KVStore *pKVStore, unsigned int iVal){ - KVMem *p = (KVMem*)pKVStore; - p->iMeta = iVal; - return SQLITE4_OK; -} - /* Virtual methods for the in-memory storage engine */ static const KVStoreMethods kvmemMethods = { 1, /* iVersion */ sizeof(KVStoreMethods), /* szSelf */ kvmemReplace, /* xReplace */ @@ -947,13 +934,11 @@ kvmemCommitPhaseOne, /* xCommitPhaseOne */ kvmemCommitPhaseTwo, /* xCommitPhaseTwo */ kvmemRollback, /* xRollback */ kvmemRevert, /* xRevert */ kvmemClose, /* xClose */ - kvmemControl, /* xControl */ - kvmemGetMeta, /* xGetMeta */ - kvmemPutMeta /* xPutMeta */ + kvmemControl /* xControl */ }; /* ** Create a new in-memory storage engine and return a pointer to it. */ Index: src/lsm.h ================================================================== --- src/lsm.h +++ src/lsm.h @@ -332,13 +332,10 @@ ** ** Query a database connection for operational statistics or data. */ int lsm_info(lsm_db *, int, ...); -int lsm_get_user_version(lsm_db *, unsigned int *); -int lsm_set_user_version(lsm_db *, unsigned int); - /* ** The following values may be passed as the second argument to lsm_info(). ** ** LSM_INFO_NWRITE: ** The third parameter should be of type (int *). The location pointed Index: src/lsmInt.h ================================================================== --- src/lsmInt.h +++ src/lsmInt.h @@ -169,12 +169,10 @@ #define LSM_POINT_DELETE 0x04 /* Delete this key */ #define LSM_INSERT 0x08 /* Insert this key and value */ #define LSM_SEPARATOR 0x10 /* True if entry is separator key only */ #define LSM_SYSTEMKEY 0x20 /* True if entry is a system key (FREELIST) */ -#define LSM_CONTIGUOUS 0x40 /* Used in lsm_tree.c */ - /* ** A string that can grow by appending. */ struct LsmString { lsm_env *pEnv; /* Run-time environment */ @@ -279,11 +277,10 @@ u32 nChunk; /* Number of chunks in shared-memory file */ TreeRoot root; /* Root and height of current tree */ u32 iWrite; /* Write offset in shm file */ TreeRoot oldroot; /* Root and height of the previous tree */ u32 iOldShmid; /* Last shm-id used by previous tree */ - u32 iUsrVersion; /* get/set_user_version() value */ i64 iOldLog; /* Log offset associated with old tree */ u32 oldcksum0; u32 oldcksum1; DbLog log; /* Current layout of log file */ u32 aCksum[2]; /* Checksums 1 and 2. */ @@ -305,22 +302,10 @@ ** (mLock & ((iLock+32-1) << 1)) ** ** Or for an EXCLUSIVE lock: ** ** (mLock & ((iLock-1) << 1)) -** -** pCsr: -** Points to the head of a linked list that contains all currently open -** cursors. Once this list becomes empty, the user has no outstanding -** cursors and the database handle can be successfully closed. -** -** pCsrCache: -** This list contains cursor objects that have been closed using -** lsm_csr_close(). Each time a cursor is closed, it is shifted from -** the pCsr list to this list. When a new cursor is opened, this list -** is inspected to see if there exists a cursor object that can be -** reused. This is an optimization only. */ struct lsm_db { /* Database handle configuration */ lsm_env *pEnv; /* runtime environment */ @@ -358,12 +343,10 @@ int nTransAlloc; /* Allocated size of aTrans[] array */ TransMark *aTrans; /* Array of marks for transaction rollback */ IntArray rollback; /* List of tree-nodes to roll back */ int bDiscardOld; /* True if lsmTreeDiscardOld() was called */ - MultiCursor *pCsrCache; /* List of all closed cursors */ - /* Worker context */ Snapshot *pWorker; /* Worker snapshot (or NULL) */ Freelist *pFreelist; /* See sortedNewToplevel() */ int bUseFreelist; /* True to use pFreelist */ int bIncrMerge; /* True if currently doing a merge */ @@ -768,12 +751,10 @@ int lsmFsReadSyncedId(lsm_db *db, int, i64 *piVal); int lsmFsSegmentContainsPg(FileSystem *pFS, Segment *, Pgno, int *); Pgno lsmFsRedirectPage(FileSystem *, Redirect *, Pgno); -void lsmFsPurgeCache(FileSystem *); - /* ** End of functions from "lsm_file.c". **************************************************************************/ /* @@ -801,11 +782,11 @@ void *lsmSortedSplitKey(Level *pLevel, int *pnByte); void lsmSortedSaveTreeCursors(lsm_db *); int lsmMCursorNew(lsm_db *, MultiCursor **); -void lsmMCursorClose(MultiCursor *, int); +void lsmMCursorClose(MultiCursor *); int lsmMCursorSeek(MultiCursor *, int, void *, int , int); int lsmMCursorFirst(MultiCursor *); int lsmMCursorPrev(MultiCursor *); int lsmMCursorLast(MultiCursor *); int lsmMCursorValid(MultiCursor *); @@ -812,11 +793,10 @@ int lsmMCursorNext(MultiCursor *); int lsmMCursorKey(MultiCursor *, void **, int *); int lsmMCursorValue(MultiCursor *, void **, int *); int lsmMCursorType(MultiCursor *, int *); lsm_db *lsmMCursorDb(MultiCursor *); -void lsmMCursorFreeCache(lsm_db *); int lsmSaveCursors(lsm_db *pDb); int lsmRestoreCursors(lsm_db *pDb); void lsmSortedDumpStructure(lsm_db *pDb, Snapshot *, int, int, const char *); Index: src/lsm_file.c ================================================================== --- src/lsm_file.c +++ src/lsm_file.c @@ -560,11 +560,11 @@ memcpy(pFS->zLog, zDb, nDb); memcpy(&pFS->zLog[nDb], "-log", 5); /* Allocate the hash-table here. At some point, it should be changed ** so that it can grow dynamicly. */ - pFS->nCacheMax = 2048*1024 / pFS->nPagesize; + pFS->nCacheMax = 2048; pFS->nHash = 4096; pFS->apHash = lsmMallocZeroRc(pDb->pEnv, sizeof(Page *) * pFS->nHash, &rc); /* Open the database file */ pLsmFile = lsmDbRecycleFd(pDb); @@ -727,11 +727,10 @@ ** Configure the nominal page-size used by this file-system. Actual ** pages may be smaller or larger than this value. */ void lsmFsSetPageSize(FileSystem *pFS, int nPgsz){ pFS->nPagesize = nPgsz; - pFS->nCacheMax = 2048*1024 / pFS->nPagesize; } /* ** Configure the block-size used by this file-system. Actual pages may be ** smaller or larger than this value. @@ -886,86 +885,40 @@ iHash = fsHashKey(pFS->nHash, pPg->iPg); for(pp=&pFS->apHash[iHash]; *pp!=pPg; pp=&(*pp)->pHashNext); *pp = pPg->pHashNext; } - -/* -** Purge the page cache of all entries with nRef==0. -*/ -void lsmFsPurgeCache(FileSystem *pFS){ - if( pFS->bUseMmap==0 ){ - Page *pPg; - - pPg = pFS->pLruFirst; - while( pPg ){ - Page *pNext = pPg->pLruNext; - fsPageRemoveFromHash(pFS, pPg); - if( pPg->flags & PAGE_FREE ){ - lsmFree(pFS->pEnv, pPg->aData); - } - lsmFree(pFS->pEnv, pPg); - pPg = pNext; - pFS->nCacheAlloc--; - } - pFS->pLruFirst = 0; - pFS->pLruLast = 0; - - assert( pFS->nCacheAlloc<=pFS->nOut && pFS->nCacheAlloc>=0 ); - } -} - -/* -** Search the hash-table for page iPg. If an entry is round, return a pointer -** to it. Otherwise, return NULL. -** -** Either way, if argument piHash is not NULL set *piHash to the hash slot -** number that page iPg would be stored in before returning. -*/ -static Page *fsPageFindInHash(FileSystem *pFS, Pgno iPg, int *piHash){ - Page *p; /* Return value */ - int iHash = fsHashKey(pFS->nHash, iPg); - - if( piHash ) *piHash = iHash; - for(p=pFS->apHash[iHash]; p; p=p->pHashNext){ - if( p->iPg==iPg) break; - } - return p; -} - static int fsPageBuffer( FileSystem *pFS, + int bRequireData, /* True to allocate buffer as well */ Page **ppOut ){ int rc = LSM_OK; Page *pPage = 0; if( pFS->bUseMmap || pFS->pLruFirst==0 || pFS->nCacheAllocnCacheMax ){ pPage = lsmMallocZero(pFS->pEnv, sizeof(Page)); if( !pPage ){ rc = LSM_NOMEM_BKPT; - }else{ + }else if( bRequireData ){ pPage->aData = (u8 *)lsmMalloc(pFS->pEnv, pFS->nPagesize); pPage->flags = PAGE_FREE; if( !pPage->aData ){ lsmFree(pFS->pEnv, pPage); rc = LSM_NOMEM_BKPT; pPage = 0; } pFS->nCacheAlloc++; + }else{ + fsPageAddToLru(pFS, pPage); } }else{ - u8 *aData; pPage = pFS->pLruFirst; - aData = pPage->aData; fsPageRemoveFromLru(pFS, pPage); fsPageRemoveFromHash(pFS, pPage); - - memset(pPage, 0, sizeof(Page)); - pPage->flags = PAGE_FREE; - pPage->aData = aData; } + assert( pPage==0 || (pPage->flags & PAGE_DIRTY)==0 ); *ppOut = pPage; return rc; } static void fsPageBufferFree(Page *pPg){ @@ -1377,21 +1330,20 @@ fsPageAddToLru(pFS, p); p->pFS = pFS; } p->aData = &((u8 *)pFS->pMap)[pFS->nPagesize * (iReal-1)]; p->iPg = iReal; - assert( (p->flags & PAGE_FREE)==0 ); }else{ /* Search the hash-table for the page */ iHash = fsHashKey(pFS->nHash, iReal); for(p=pFS->apHash[iHash]; p; p=p->pHashNext){ if( p->iPg==iReal) break; } if( p==0 ){ - rc = fsPageBuffer(pFS, &p); + rc = fsPageBuffer(pFS, 1, &p); if( rc==LSM_OK ){ int nSpace = 0; p->iPg = iReal; p->nRef = 0; p->pFS = pFS; @@ -1868,11 +1820,11 @@ if( pFS->pCompress || bDefer ){ /* In compressed database mode the page is not assigned a page number ** or location in the database file at this point. This will be done ** by the lsmFsPagePersist() call. */ - rc = fsPageBuffer(pFS, &pPg); + rc = fsPageBuffer(pFS, 1, &pPg); if( rc==LSM_OK ){ pPg->pFS = pFS; pPg->pSeg = p; pPg->iPg = 0; pPg->flags |= PAGE_DIRTY; @@ -2156,11 +2108,10 @@ if( rc==LSM_OK ){ iOff = iToOff + i*nSz; rc = lsmEnvWrite(pFS->pEnv, pFS->fdDb, iOff, aData, nSz); } } - lsmFsPurgeCache(pFS); } } /* Update append-point list if necessary */ if( rc==LSM_OK ){ @@ -2354,26 +2305,10 @@ pPg = pNext; } *pRc = rc; } -static void fsRemoveHashEntry(FileSystem *pFS, Pgno iPg){ - Page *p; - int iHash = fsHashKey(pFS->nHash, iPg); - - for(p=pFS->apHash[iHash]; p && p->iPg!=iPg; p=p->pHashNext); - - if( p ){ - assert( p->nRef==0 ); - fsPageRemoveFromHash(pFS, p); - p->iPg = 0; - iHash = fsHashKey(pFS->nHash, 0); - p->pHashNext = pFS->apHash[iHash]; - pFS->apHash[iHash] = p; - } -} - /* ** If the page passed as an argument is dirty, update the database file ** (or mapping of the database file) with its current contents and mark ** the page as clean. ** @@ -2432,11 +2367,10 @@ rc = fsAppendPage(pFS, pPg->pSeg, &pPg->iPg, &iPrev, &iNext); if( rc!=LSM_OK ) return rc; if( pFS->bUseMmap==0 ){ int iHash = fsHashKey(pFS->nHash, pPg->iPg); - fsRemoveHashEntry(pFS, pPg->iPg); pPg->pHashNext = pFS->apHash[iHash]; pFS->apHash[iHash] = pPg; assert( pPg->pHashNext==0 || pPg->pHashNext->iPg!=pPg->iPg ); } @@ -2578,18 +2512,14 @@ if( pFS->bUseMmap ){ pPg->pHashNext = pFS->pFree; pFS->pFree = pPg; }else{ -#if 0 assert( pPg->pLruNext==0 ); assert( pPg->pLruPrev==0 ); fsPageRemoveFromHash(pFS, pPg); fsPageBufferFree(pPg); -#else - fsPageAddToLru(pFS, pPg); -#endif } } } return rc; Index: src/lsm_main.c ================================================================== --- src/lsm_main.c +++ src/lsm_main.c @@ -141,29 +141,10 @@ } *pzAbs = zAlloc; return rc; } -/* -** Check that the bits in the db->mLock mask are consistent with the -** value stored in db->iRwclient. An assert shall fail otherwise. -*/ -static void assertRwclientLockValue(lsm_db *db){ -#ifndef NDEBUG - u64 msk; /* Mask of mLock bits for RWCLIENT locks */ - u64 rwclient = 0; /* Bit corresponding to db->iRwclient */ - - if( db->iRwclient>=0 ){ - rwclient = ((u64)1 << (LSM_LOCK_RWCLIENT(db->iRwclient)-1)); - } - msk = ((u64)1 << (LSM_LOCK_RWCLIENT(LSM_LOCK_NRWCLIENT)-1)) - 1; - msk -= (((u64)1 << (LSM_LOCK_RWCLIENT(0)-1)) - 1); - - assert( (db->mLock & msk)==rwclient ); -#endif -} - /* ** Open a new connection to database zFilename. */ int lsm_open(lsm_db *pDb, const char *zFilename){ int rc; @@ -199,32 +180,29 @@ lsmFsSetBlockSize(pDb->pFS, lsmCheckpointBlksz(pDb->aSnapshot)); } } lsmFree(pDb->pEnv, zFull); - assertRwclientLockValue(pDb); } assert( pDb->bReadonly==0 || pDb->bReadonly==1 ); assert( rc!=LSM_OK || (pDb->pShmhdr==0)==(pDb->bReadonly==1) ); return rc; } + int lsm_close(lsm_db *pDb){ int rc = LSM_OK; if( pDb ){ assert_db_state(pDb); if( pDb->pCsr || pDb->nTransOpen ){ rc = LSM_MISUSE_BKPT; }else{ - lsmMCursorFreeCache(pDb); lsmFreeSnapshot(pDb->pEnv, pDb->pClient); pDb->pClient = 0; - assertRwclientLockValue(pDb); - lsmDbDatabaseRelease(pDb); lsmLogClose(pDb); lsmFsClose(pDb->pFS); assert( pDb->mLock==0 ); @@ -754,33 +732,31 @@ ** ** If there are currently no other open cursor handles, and no open write ** transaction, open a read transaction here. */ int lsm_csr_open(lsm_db *pDb, lsm_cursor **ppCsr){ - int rc = LSM_OK; /* Return code */ + int rc; /* Return code */ MultiCursor *pCsr = 0; /* New cursor object */ /* Open a read transaction if one is not already open. */ assert_db_state(pDb); if( pDb->pShmhdr==0 ){ assert( pDb->bReadonly ); rc = lsmBeginRoTrans(pDb); - }else if( pDb->iReader<0 ){ + }else{ rc = lsmBeginReadTrans(pDb); } /* Allocate the multi-cursor. */ - if( rc==LSM_OK ){ - rc = lsmMCursorNew(pDb, &pCsr); - } + if( rc==LSM_OK ) rc = lsmMCursorNew(pDb, &pCsr); /* If an error has occured, set the output to NULL and delete any partially ** allocated cursor. If this means there are no open cursors, release the ** client snapshot. */ if( rc!=LSM_OK ){ - lsmMCursorClose(pCsr, 0); + lsmMCursorClose(pCsr); dbReleaseClientSnapshot(pDb); } assert_db_state(pDb); *ppCsr = (lsm_cursor *)pCsr; @@ -792,11 +768,11 @@ */ int lsm_csr_close(lsm_cursor *p){ if( p ){ lsm_db *pDb = lsmMCursorDb((MultiCursor *)p); assert_db_state(pDb); - lsmMCursorClose((MultiCursor *)p, 1); + lsmMCursorClose((MultiCursor *)p); dbReleaseClientSnapshot(pDb); assert_db_state(pDb); } return LSM_OK; } @@ -955,57 +931,9 @@ lsmFinishWriteTrans(pDb, 0); } dbReleaseClientSnapshot(pDb); } - return rc; -} - -int lsm_get_user_version(lsm_db *pDb, unsigned int *piUsr){ - int rc = LSM_OK; /* Return code */ - - /* Open a read transaction if one is not already open. */ - assert_db_state(pDb); - if( pDb->pShmhdr==0 ){ - assert( pDb->bReadonly ); - rc = lsmBeginRoTrans(pDb); - }else if( pDb->iReader<0 ){ - rc = lsmBeginReadTrans(pDb); - } - - /* Allocate the multi-cursor. */ - if( rc==LSM_OK ){ - *piUsr = pDb->treehdr.iUsrVersion; - } - - dbReleaseClientSnapshot(pDb); - assert_db_state(pDb); - return rc; -} - -int lsm_set_user_version(lsm_db *pDb, unsigned int iUsr){ - int rc = LSM_OK; /* Return code */ - int bCommit = 0; /* True to commit before returning */ - - if( pDb->nTransOpen==0 ){ - bCommit = 1; - rc = lsm_begin(pDb, 1); - } - - if( rc==LSM_OK ){ - pDb->treehdr.iUsrVersion = iUsr; - } - - /* If a transaction was opened at the start of this function, commit it. - ** Or, if an error has occurred, roll it back. */ - if( bCommit ){ - if( rc==LSM_OK ){ - rc = lsm_commit(pDb, 0); - }else{ - lsm_rollback(pDb, 0); - } - } - return rc; } Index: src/lsm_shared.c ================================================================== --- src/lsm_shared.c +++ src/lsm_shared.c @@ -316,11 +316,10 @@ } } if( pDb->iRwclient>=0 ){ lsmShmLock(pDb, LSM_LOCK_RWCLIENT(pDb->iRwclient), LSM_LOCK_UNLOCK, 0); - pDb->iRwclient = -1; } lsmShmLock(pDb, LSM_LOCK_DMS2, LSM_LOCK_UNLOCK, 0); lsmShmLock(pDb, LSM_LOCK_DMS1, LSM_LOCK_UNLOCK, 0); } @@ -400,11 +399,10 @@ break; } } } lsmShmLock(pDb, LSM_LOCK_DMS1, LSM_LOCK_UNLOCK, 0); - return rc; } static int dbOpenSharedFd(lsm_env *pEnv, Database *p, int bRoOk){ int rc; @@ -1149,12 +1147,10 @@ /* Load the database snapshot */ if( rc==LSM_OK ){ if( lsmCheckpointClientCacheOk(pDb)==0 ){ lsmFreeSnapshot(pDb->pEnv, pDb->pClient); pDb->pClient = 0; - lsmMCursorFreeCache(pDb); - lsmFsPurgeCache(pDb->pFS); rc = lsmCheckpointLoad(pDb, &iSnap); }else{ iSnap = 1; } } @@ -1337,21 +1333,19 @@ /* ** Open a write transaction. */ int lsmBeginWriteTrans(lsm_db *pDb){ - int rc = LSM_OK; /* Return code */ + int rc; /* Return code */ ShmHeader *pShm = pDb->pShmhdr; /* Shared memory header */ assert( pDb->nTransOpen==0 ); assert( pDb->bDiscardOld==0 ); assert( pDb->bReadonly==0 ); /* If there is no read-transaction open, open one now. */ - if( pDb->iReader<0 ){ - rc = lsmBeginReadTrans(pDb); - } + rc = lsmBeginReadTrans(pDb); /* Attempt to take the WRITER lock */ if( rc==LSM_OK ){ rc = lsmShmLock(pDb, LSM_LOCK_WRITER, LSM_LOCK_EXCL, 0); } @@ -1821,26 +1815,22 @@ rc = LSM_BUSY; }else{ if( nShared==0 ){ rc = lockSharedFile(db->pEnv, p, iLock, LSM_LOCK_SHARED); } - if( rc==LSM_OK ){ - db->mLock |= ms; - db->mLock &= ~me; - } + db->mLock |= ms; + db->mLock &= ~me; } break; default: assert( eOp==LSM_LOCK_EXCL ); if( nExcl || nShared ){ rc = LSM_BUSY; }else{ rc = lockSharedFile(db->pEnv, p, iLock, LSM_LOCK_EXCL); - if( rc==LSM_OK ){ - db->mLock |= (me|ms); - } + db->mLock |= (me|ms); } break; } lsmMutexLeave(db->pEnv, p->pClientMutex); Index: src/lsm_sorted.c ================================================================== --- src/lsm_sorted.c +++ src/lsm_sorted.c @@ -2243,27 +2243,11 @@ pCsr->apTreeCsr[0] = 0; pCsr->apTreeCsr[1] = 0; pCsr->pBtCsr = 0; } -void lsmMCursorFreeCache(lsm_db *pDb){ - MultiCursor *p; - MultiCursor *pNext; - for(p=pDb->pCsrCache; p; p=pNext){ - pNext = p->pNext; - lsmMCursorClose(p, 0); - } - pDb->pCsrCache = 0; -} - -/* -** Close the cursor passed as the first argument. -** -** If the bCache parameter is true, then shift the cursor to the pCsrCache -** list for possible reuse instead of actually deleting it. -*/ -void lsmMCursorClose(MultiCursor *pCsr, int bCache){ +void lsmMCursorClose(MultiCursor *pCsr){ if( pCsr ){ lsm_db *pDb = pCsr->pDb; MultiCursor **pp; /* Iterator variable */ /* The cursor may or may not be currently part of the linked list @@ -2273,39 +2257,19 @@ *pp = pCsr->pNext; break; } } - if( bCache ){ - int i; /* Used to iterate through segment-pointers */ - - /* Release any page references held by this cursor. */ - assert( !pCsr->pBtCsr ); - for(i=0; inPtr; i++){ - SegmentPtr *pPtr = &pCsr->aPtr[i]; - lsmFsPageRelease(pPtr->pPg); - pPtr->pPg = 0; - } - - /* Reset the tree cursors */ - lsmTreeCursorReset(pCsr->apTreeCsr[0]); - lsmTreeCursorReset(pCsr->apTreeCsr[1]); - - /* Add the cursor to the pCsrCache list */ - pCsr->pNext = pDb->pCsrCache; - pDb->pCsrCache = pCsr; - }else{ - /* Free the allocation used to cache the current key, if any. */ - sortedBlobFree(&pCsr->key); - sortedBlobFree(&pCsr->val); - - /* Free the component cursors */ - mcursorFreeComponents(pCsr); - - /* Free the cursor structure itself */ - lsmFree(pDb->pEnv, pCsr); - } + /* Free the allocation used to cache the current key, if any. */ + sortedBlobFree(&pCsr->key); + sortedBlobFree(&pCsr->val); + + /* Free the component cursors */ + mcursorFreeComponents(pCsr); + + /* Free the cursor structure itself */ + lsmFree(pDb->pEnv, pCsr); } } #define TREE_NONE 0 #define TREE_OLD 1 @@ -2460,48 +2424,23 @@ return rc; } /* ** Allocate and return a new database cursor. -** -** This method should only be called to allocate user cursors. As it may -** recycle a cursor from lsm_db.pCsrCache. */ int lsmMCursorNew( lsm_db *pDb, /* Database handle */ MultiCursor **ppCsr /* OUT: Allocated cursor */ ){ MultiCursor *pCsr = 0; int rc = LSM_OK; - if( pDb->pCsrCache ){ - int bOld; /* True if there is an old in-memory tree */ - - /* Remove a cursor from the pCsrCache list and add it to the open list. */ - pCsr = pDb->pCsrCache; - pDb->pCsrCache = pCsr->pNext; - pCsr->pNext = pDb->pCsr; - pDb->pCsr = pCsr; - - /* The cursor can almost be used as is, except that the old in-memory - ** tree cursor may be present and not required, or required and not - ** present. Fix this if required. */ - bOld = (lsmTreeHasOld(pDb) && pDb->treehdr.iOldLog!=pDb->pClient->iLogOff); - if( !bOld && pCsr->apTreeCsr[1] ){ - lsmTreeCursorDestroy(pCsr->apTreeCsr[1]); - pCsr->apTreeCsr[1] = 0; - }else if( bOld && !pCsr->apTreeCsr[1] ){ - rc = lsmTreeCursorNew(pDb, 1, &pCsr->apTreeCsr[1]); - } - - }else{ - pCsr = multiCursorNew(pDb, &rc); - if( rc==LSM_OK ) rc = multiCursorInit(pCsr, pDb->pClient); - } + pCsr = multiCursorNew(pDb, &rc); + if( rc==LSM_OK ) rc = multiCursorInit(pCsr, pDb->pClient); if( rc!=LSM_OK ){ - lsmMCursorClose(pCsr, 0); + lsmMCursorClose(pCsr); pCsr = 0; } assert( (rc==LSM_OK)==(pCsr!=0) ); *ppCsr = pCsr; return rc; @@ -2616,11 +2555,11 @@ rc = multiCursorAdvance(pCsr, !bReverse); } } } - lsmMCursorClose(pCsr, 0); + lsmMCursorClose(pCsr); if( pSnap!=pDb->pWorker ){ lsmFreeSnapshot(pDb->pEnv, pSnap); } return rc; @@ -2659,11 +2598,11 @@ *pnVal = nVal; } } } - lsmMCursorClose(pCsr, 0); + lsmMCursorClose(pCsr); } return rc; } @@ -4094,11 +4033,11 @@ } pMerge->iOutputOff = -1; } - lsmMCursorClose(pCsr, 0); + lsmMCursorClose(pCsr); /* Persist and release the output page. */ if( rc==LSM_OK ) rc = mergeWorkerPersistAndRelease(pMW); if( rc==LSM_OK ) rc = mergeWorkerBtreeIndirect(pMW); if( rc==LSM_OK ) rc = mergeWorkerFinishHierarchy(pMW); @@ -4348,11 +4287,11 @@ multiCursorIgnoreDelete(pCsr); } } if( rc!=LSM_OK ){ - lsmMCursorClose(pCsr, 0); + lsmMCursorClose(pCsr); }else{ Pgno iLeftPtr = 0; Merge merge; /* Merge object used to create new level */ MergeWorker mergeworker; /* MergeWorker object for the same purpose */ @@ -5311,12 +5250,10 @@ /* This function may not be called if pDb has an open read or write ** transaction. Return LSM_MISUSE if an application attempts this. */ if( pDb->nTransOpen || pDb->pCsr ) return LSM_MISUSE_BKPT; if( nMerge<=0 ) nMerge = pDb->nMerge; - lsmFsPurgeCache(pDb->pFS); - /* Convert from KB to pages */ nPgsz = lsmFsPageSize(pDb->pFS); if( nKB>=0 ){ nPage = ((i64)nKB * 1024 + nPgsz - 1) / nPgsz; }else{ @@ -5400,11 +5337,10 @@ assert( nRemaining>=0 ); rc = doLsmWork(pDb, pDb->nMerge, nRemaining, 0); if( rc==LSM_BUSY ) rc = LSM_OK; if( bRestore && pDb->pCsr ){ - lsmMCursorFreeCache(pDb); lsmFreeSnapshot(pDb->pEnv, pDb->pClient); pDb->pClient = 0; rc = lsmCheckpointLoad(pDb, 0); if( rc==LSM_OK ){ rc = lsmCheckpointDeserialize(pDb, 0, pDb->aSnapshot, &pDb->pClient); @@ -5838,10 +5774,11 @@ const char *zWhy /* Caption to print near top of dump */ ){ Snapshot *pDump = pSnap; Level *pTopLevel; char *zFree = 0; + assert( pSnap ); pTopLevel = lsmDbSnapshotLevel(pDump); if( pDb->xLog && pTopLevel ){ static int nCall = 0; Index: src/lsm_tree.c ================================================================== --- src/lsm_tree.c +++ src/lsm_tree.c @@ -266,17 +266,10 @@ p->nArray = nVal; } /* End of IntArray methods. ***********************************************************************/ -static int treeKeycmp(void *p1, int n1, void *p2, int n2){ - int res; - res = memcmp(p1, p2, LSM_MIN(n1, n2)); - if( res==0 ) res = (n1-n2); - return res; -} - /* ** The pointer passed as the first argument points to an interior node, ** not a leaf. This function returns the offset of the iCell'th child ** sub-tree of the node. */ @@ -292,23 +285,20 @@ static int treeOffsetToChunk(u32 iOff){ assert( LSM_SHM_CHUNK_SIZE==(1<<15) ); return (int)(iOff>>15); } -#define treeShmptrUnsafe(pDb, iPtr) \ -(&((u8*)((pDb)->apShm[(iPtr)>>15]))[(iPtr) & (LSM_SHM_CHUNK_SIZE-1)]) - /* ** Return a pointer to the mapped memory location associated with *-shm ** file offset iPtr. */ static void *treeShmptr(lsm_db *pDb, u32 iPtr){ assert( (iPtr>>15)nShm ); assert( pDb->apShm[iPtr>>15] ); - return iPtr ? treeShmptrUnsafe(pDb, iPtr) : 0; + return iPtr?(&((u8*)(pDb->apShm[iPtr>>15]))[iPtr & (LSM_SHM_CHUNK_SIZE-1)]):0; } static ShmChunk * treeShmChunk(lsm_db *pDb, int iChunk){ return (ShmChunk *)(pDb->apShm[iChunk]); } @@ -573,20 +563,15 @@ /* ** Return a pointer to the mapping of the TreeKey object that the cursor ** is pointing to. */ static TreeKey *csrGetKey(TreeCursor *pCsr, TreeBlob *pBlob, int *pRc){ - TreeKey *pRet; - lsm_db *pDb = pCsr->pDb; - u32 iPtr = pCsr->apTreeNode[pCsr->iNode]->aiKeyPtr[pCsr->aiCell[pCsr->iNode]]; - - assert( iPtr ); - pRet = treeShmptrUnsafe(pDb, iPtr); - if( !(pRet->flags & LSM_CONTIGUOUS) ){ - pRet = treeShmkey(pDb, iPtr, TKV_LOADVAL, pBlob, pRc); - } - + TreeKey *pRet = (TreeKey *)treeShmkey(pCsr->pDb, + pCsr->apTreeNode[pCsr->iNode]->aiKeyPtr[pCsr->aiCell[pCsr->iNode]], + TKV_LOADVAL, pBlob, pRc + ); + assert( pRet==0 || assertFlagsOk(pRet->flags) ); return pRet; } /* ** Save the current position of tree cursor pCsr. @@ -734,11 +719,10 @@ void *pVal, int nVal, /* Value data (or nVal<0 for delete) */ int *pRc ){ TreeKey *p; u32 iPtr; - u32 iEnd; int nRem; u8 *a; int n; /* Allocate space for the TreeKey structure itself */ @@ -769,17 +753,10 @@ a = pVal; n = nRem = nVal; pVal = 0; } - iEnd = iPtr + sizeof(TreeKey) + nKey + LSM_MAX(0, nVal); - if( (iPtr & ~(LSM_SHM_CHUNK_SIZE-1))!=(iEnd & ~(LSM_SHM_CHUNK_SIZE-1)) ){ - p->flags = 0; - }else{ - p->flags = LSM_CONTIGUOUS; - } - if( *pRc ) return 0; #if 0 printf("store: %d %s\n", (int)iPtr, (char *)pKey); #endif return p; @@ -1461,11 +1438,10 @@ assert( nVal>=0 || pVal==0 ); assert_tree_looks_ok(LSM_OK, pTree); assert( flags==LSM_INSERT || flags==LSM_POINT_DELETE || flags==LSM_START_DELETE || flags==LSM_END_DELETE ); - assert( (flags & LSM_CONTIGUOUS)==0 ); #if 0 dump_tree_contents(pDb, "before"); #endif if( p->iRoot ){ @@ -1519,12 +1495,11 @@ } /* Allocate and populate a new key-value pair structure */ pTreeKey = newTreeKey(pDb, &iTreeKey, pKey, nKey, pVal, nVal, &rc); if( rc!=LSM_OK ) return rc; - assert( pTreeKey->flags==0 || pTreeKey->flags==LSM_CONTIGUOUS ); - pTreeKey->flags |= flags; + pTreeKey->flags = flags; if( p->iRoot==0 ){ /* The tree is completely empty. Add a new root node and install ** (pKey/nKey) as the middle entry. Even though it is a leaf at the ** moment, use newTreeNode() to allocate the node (i.e. allocate enough @@ -1806,11 +1781,11 @@ int bDone = 0; TreeRoot *p = &db->treehdr.root; TreeBlob blob = {0, 0}; /* The range must be sensible - that (key1 < key2). */ - assert( treeKeycmp(pKey1, nKey1, pKey2, nKey2)<0 ); + assert( db->xCmp(pKey1, nKey1, pKey2, nKey2)<0 ); assert( assert_delete_ranges_match(db) ); #if 0 static int nCall = 0; printf("\n"); @@ -1838,11 +1813,11 @@ ** tree now contains no keys in the range being deleted. In this case ** break out of the loop. */ bDone = 1; if( lsmTreeCursorValid(&csr) ){ lsmTreeCursorKey(&csr, 0, &pDel, &nDel); - if( treeKeycmp(pDel, nDel, pKey2, nKey2)<0 ) bDone = 0; + if( db->xCmp(pDel, nDel, pKey2, nKey2)<0 ) bDone = 0; } if( bDone==0 ){ if( csr.iNode==(p->nHeight-1) ){ /* The element to delete already lies on a leaf node */ @@ -1955,11 +1930,11 @@ int cmp = 0; int rc = LSM_OK; assert( pCsr->iNode>=0 ); p = csrGetKey(pCsr, &pCsr->blob, &rc); if( p ){ - cmp = treeKeycmp(TKV_KEY(p), p->nKey, pKey, nKey); + cmp = pCsr->pDb->xCmp(TKV_KEY(p), p->nKey, pKey, nKey); } return cmp; } #endif @@ -1980,10 +1955,12 @@ */ int lsmTreeCursorSeek(TreeCursor *pCsr, void *pKey, int nKey, int *pRes){ int rc = LSM_OK; /* Return code */ lsm_db *pDb = pCsr->pDb; TreeRoot *pRoot = pCsr->pRoot; + int (*xCmp)(void *, int, void *, int) = pDb->xCmp; + u32 iNodePtr; /* Location of current node in search */ /* Discard any saved position data */ treeCursorRestore(pCsr, 0); @@ -1998,49 +1975,41 @@ int res = 0; /* Result of comparison function */ int iNode = -1; while( iNodePtr ){ TreeNode *pNode; /* Node at location iNodePtr */ int iTest; /* Index of second key to test (0 or 2) */ - u32 iTreeKey; TreeKey *pTreeKey; /* Key to compare against */ - pNode = (TreeNode *)treeShmptrUnsafe(pDb, iNodePtr); + pNode = (TreeNode *)treeShmptr(pDb, iNodePtr); iNode++; pCsr->apTreeNode[iNode] = pNode; /* Compare (pKey/nKey) with the key in the middle slot of B-tree node ** pNode. The middle slot is never empty. If the comparison is a match, ** then the search is finished. Break out of the loop. */ - pTreeKey = treeShmptrUnsafe(pDb, pNode->aiKeyPtr[1]); - if( !(pTreeKey->flags & LSM_CONTIGUOUS) ){ - pTreeKey = treeShmkey(pDb, pNode->aiKeyPtr[1], TKV_LOADKEY, &b, &rc); - if( rc!=LSM_OK ) break; - } - res = treeKeycmp((void *)&pTreeKey[1], pTreeKey->nKey, pKey, nKey); + pTreeKey = treeShmkey(pDb, pNode->aiKeyPtr[1], TKV_LOADKEY, &b, &rc); + if( rc!=LSM_OK ) break; + res = xCmp((void *)&pTreeKey[1], pTreeKey->nKey, pKey, nKey); if( res==0 ){ pCsr->aiCell[iNode] = 1; break; } /* Based on the results of the previous comparison, compare (pKey/nKey) ** to either the left or right key of the B-tree node, if such a key ** exists. */ iTest = (res>0 ? 0 : 2); - iTreeKey = pNode->aiKeyPtr[iTest]; - if( iTreeKey ){ - pTreeKey = treeShmptrUnsafe(pDb, iTreeKey); - if( !(pTreeKey->flags & LSM_CONTIGUOUS) ){ - pTreeKey = treeShmkey(pDb, iTreeKey, TKV_LOADKEY, &b, &rc); - if( rc ) break; - } - res = treeKeycmp((void *)&pTreeKey[1], pTreeKey->nKey, pKey, nKey); + pTreeKey = treeShmkey(pDb, pNode->aiKeyPtr[iTest], TKV_LOADKEY, &b, &rc); + if( rc ) break; + if( pTreeKey==0 ){ + iTest = 1; + }else{ + res = xCmp((void *)&pTreeKey[1], pTreeKey->nKey, pKey, nKey); if( res==0 ){ pCsr->aiCell[iNode] = iTest; break; } - }else{ - iTest = 1; } if( iNode<(pRoot->nHeight-1) ){ iNodePtr = getChildPtr(pNode, pRoot->iTransId, iTest + (res<0)); }else{ @@ -2121,11 +2090,11 @@ } #ifndef NDEBUG if( pCsr->iNode>=0 ){ TreeKey *pK2 = csrGetKey(pCsr, &pCsr->blob, &rc); - assert( rc||treeKeycmp(TKV_KEY(pK2),pK2->nKey,TKV_KEY(pK1),pK1->nKey)>=0 ); + assert( rc || pDb->xCmp(TKV_KEY(pK2),pK2->nKey,TKV_KEY(pK1),pK1->nKey)>=0 ); } tblobFree(pDb, &key1); #endif return rc; @@ -2189,11 +2158,11 @@ } #ifndef NDEBUG if( pCsr->iNode>=0 ){ TreeKey *pK2 = csrGetKey(pCsr, &pCsr->blob, &rc); - assert( rc || treeKeycmp(TKV_KEY(pK2),pK2->nKey,TKV_KEY(pK1),pK1->nKey)<0 ); + assert( rc || pDb->xCmp(TKV_KEY(pK2), pK2->nKey, TKV_KEY(pK1), pK1->nKey)<0 ); } tblobFree(pDb, &key1); #endif return rc; @@ -2243,15 +2212,15 @@ int lsmTreeCursorFlags(TreeCursor *pCsr){ int flags = 0; if( pCsr && pCsr->iNode>=0 ){ int rc = LSM_OK; - TreeKey *pKey = (TreeKey *)treeShmptrUnsafe(pCsr->pDb, + TreeKey *pKey = (TreeKey *)treeShmptr(pCsr->pDb, pCsr->apTreeNode[pCsr->iNode]->aiKeyPtr[pCsr->aiCell[pCsr->iNode]] ); assert( rc==LSM_OK ); - flags = (pKey->flags & ~LSM_CONTIGUOUS); + flags = pKey->flags; } return flags; } int lsmTreeCursorKey(TreeCursor *pCsr, int *pFlags, void **ppKey, int *pnKey){ Index: src/prepare.c ================================================================== --- src/prepare.c +++ src/prepare.c @@ -134,10 +134,11 @@ static int sqlite4InitOne(sqlite4 *db, int iDb, char **pzErrMsg){ int rc; Table *pTab; Db *pDb; char const *azArg[4]; + unsigned int meta[5]; InitData initData; char const *zMasterSchema; char const *zMasterName; int openedTransaction = 0; @@ -221,13 +222,29 @@ goto initone_error_out; } openedTransaction = 1; } - /* Get the database schema version. + /* Get the database meta information. + ** + ** Meta values are as follows: + ** meta[0] Schema cookie. Changes with each schema change. + ** meta[1] unused + ** meta[2] unused + ** meta[3] unused + ** meta[4] unused + ** meta[5] unused + ** meta[6] unused + ** meta[7] unused + ** meta[8] unused + ** meta[9] unused + ** + ** Note: The #defined SQLITE4_UTF* symbols in sqliteInt.h correspond to + ** the possible values of meta[4]. */ - sqlite4KVStoreGetSchema(pDb->pKV, (u32 *)&pDb->pSchema->schema_cookie); + sqlite4KVStoreGetMeta(pDb->pKV, 0, ArraySize(meta), meta); + pDb->pSchema->schema_cookie = meta[0]; /* Read the schema information out of the schema tables */ assert( db->init.busy ); { @@ -383,11 +400,11 @@ } /* Read the schema cookie from the database. If it does not match the ** value stored as part of the in-memory schema representation, ** set Parse.rc to SQLITE4_SCHEMA. */ - sqlite4KVStoreGetSchema(pKV, (u32 *)&cookie); + sqlite4KVStoreGetMeta(pKV, 0, 1, (u32 *)&cookie); if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){ sqlite4ResetInternalSchema(db, iDb); pParse->rc = SQLITE4_SCHEMA; } Index: src/sqlite.h.in ================================================================== --- src/sqlite.h.in +++ src/sqlite.h.in @@ -4032,10 +4032,131 @@ */ #define SQLITE4_STMTSTATUS_FULLSCAN_STEP 1 #define SQLITE4_STMTSTATUS_SORT 2 #define SQLITE4_STMTSTATUS_AUTOINDEX 3 + +/* +** CAPIREF: Unlock Notification +** +** ^When running in shared-cache mode, a database operation may fail with +** an [SQLITE4_LOCKED] error if the required locks on the shared-cache or +** individual tables within the shared-cache cannot be obtained. See +** [SQLite Shared-Cache Mode] for a description of shared-cache locking. +** ^This API may be used to register a callback that SQLite will invoke +** when the connection currently holding the required lock relinquishes it. +** ^This API is only available if the library was compiled with the +** [SQLITE4_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. +** +** See Also: [Using the SQLite Unlock Notification Feature]. +** +** ^Shared-cache locks are released when a database connection concludes +** its current transaction, either by committing it or rolling it back. +** +** ^When a connection (known as the blocked connection) fails to obtain a +** shared-cache lock and SQLITE4_LOCKED is returned to the caller, the +** identity of the database connection (the blocking connection) that +** has locked the required resource is stored internally. ^After an +** application receives an SQLITE4_LOCKED error, it may call the +** sqlite4_unlock_notify() method with the blocked connection handle as +** the first argument to register for a callback that will be invoked +** when the blocking connections current transaction is concluded. ^The +** callback is invoked from within the [sqlite4_step] or [sqlite4_close] +** call that concludes the blocking connections transaction. +** +** ^(If sqlite4_unlock_notify() is called in a multi-threaded application, +** there is a chance that the blocking connection will have already +** concluded its transaction by the time sqlite4_unlock_notify() is invoked. +** If this happens, then the specified callback is invoked immediately, +** from within the call to sqlite4_unlock_notify().)^ +** +** ^If the blocked connection is attempting to obtain a write-lock on a +** shared-cache table, and more than one other connection currently holds +** a read-lock on the same table, then SQLite arbitrarily selects one of +** the other connections to use as the blocking connection. +** +** ^(There may be at most one unlock-notify callback registered by a +** blocked connection. If sqlite4_unlock_notify() is called when the +** blocked connection already has a registered unlock-notify callback, +** then the new callback replaces the old.)^ ^If sqlite4_unlock_notify() is +** called with a NULL pointer as its second argument, then any existing +** unlock-notify callback is canceled. ^The blocked connections +** unlock-notify callback may also be canceled by closing the blocked +** connection using [sqlite4_close()]. +** +** The unlock-notify callback is not reentrant. If an application invokes +** any sqlite4_xxx API functions from within an unlock-notify callback, a +** crash or deadlock may be the result. +** +** ^Unless deadlock is detected (see below), sqlite4_unlock_notify() always +** returns SQLITE4_OK. +** +** Callback Invocation Details +** +** When an unlock-notify callback is registered, the application provides a +** single void* pointer that is passed to the callback when it is invoked. +** However, the signature of the callback function allows SQLite to pass +** it an array of void* context pointers. The first argument passed to +** an unlock-notify callback is a pointer to an array of void* pointers, +** and the second is the number of entries in the array. +** +** When a blocking connections transaction is concluded, there may be +** more than one blocked connection that has registered for an unlock-notify +** callback. ^If two or more such blocked connections have specified the +** same callback function, then instead of invoking the callback function +** multiple times, it is invoked once with the set of void* context pointers +** specified by the blocked connections bundled together into an array. +** This gives the application an opportunity to prioritize any actions +** related to the set of unblocked database connections. +** +** Deadlock Detection +** +** Assuming that after registering for an unlock-notify callback a +** database waits for the callback to be issued before taking any further +** action (a reasonable assumption), then using this API may cause the +** application to deadlock. For example, if connection X is waiting for +** connection Y's transaction to be concluded, and similarly connection +** Y is waiting on connection X's transaction, then neither connection +** will proceed and the system may remain deadlocked indefinitely. +** +** To avoid this scenario, the sqlite4_unlock_notify() performs deadlock +** detection. ^If a given call to sqlite4_unlock_notify() would put the +** system in a deadlocked state, then SQLITE4_LOCKED is returned and no +** unlock-notify callback is registered. The system is said to be in +** a deadlocked state if connection A has registered for an unlock-notify +** callback on the conclusion of connection B's transaction, and connection +** B has itself registered for an unlock-notify callback when connection +** A's transaction is concluded. ^Indirect deadlock is also detected, so +** the system is also considered to be deadlocked if connection B has +** registered for an unlock-notify callback on the conclusion of connection +** C's transaction, where connection C is waiting on connection A. ^Any +** number of levels of indirection are allowed. +** +** The "DROP TABLE" Exception +** +** When a call to [sqlite4_step()] returns SQLITE4_LOCKED, it is almost +** always appropriate to call sqlite4_unlock_notify(). There is however, +** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, +** SQLite checks if there are any currently executing SELECT statements +** that belong to the same connection. If there are, SQLITE4_LOCKED is +** returned. In this case there is no "blocking connection", so invoking +** sqlite4_unlock_notify() results in the unlock-notify callback being +** invoked immediately. If the application then re-attempts the "DROP TABLE" +** or "DROP INDEX" query, an infinite loop might be the result. +** +** One way around this problem is to check the extended error code returned +** by an sqlite4_step() call. ^(If there is a blocking connection, then the +** extended error code is set to SQLITE4_LOCKED_SHAREDCACHE. Otherwise, in +** the special "DROP TABLE/INDEX" case, the extended error code is just +** SQLITE4_LOCKED.)^ +*/ +int sqlite4_unlock_notify( + sqlite4 *pBlocked, /* Waiting connection */ + void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ + void *pNotifyArg /* Argument to pass to xNotify */ +); + /* ** CAPIREF: String Comparison ** ** ^The [sqlite4_strnicmp()] API allows applications and extensions to @@ -4229,12 +4350,10 @@ int (*xCommitPhaseTwo)(sqlite4_kvstore*, int); int (*xRollback)(sqlite4_kvstore*, int); int (*xRevert)(sqlite4_kvstore*, int); int (*xClose)(sqlite4_kvstore*); int (*xControl)(sqlite4_kvstore*, int, void*); - int (*xGetMeta)(sqlite4_kvstore*, unsigned int *); - int (*xPutMeta)(sqlite4_kvstore*, unsigned int); }; typedef struct sqlite4_kv_methods sqlite4_kv_methods; /* ** CAPI4REF: Key-value storage engine open flags Index: src/tclsqlite.c ================================================================== --- src/tclsqlite.c +++ src/tclsqlite.c @@ -116,10 +116,11 @@ char *zProgress; /* The progress callback routine */ char *zAuth; /* The authorization callback routine */ int disableAuth; /* Disable the authorizer if it exists */ char *zNull; /* Text to substitute for an SQL NULL value */ SqlFunc *pFunc; /* List of SQL functions */ + Tcl_Obj *pUnlockNotify; /* Unlock notify script (if any) */ SqlCollate *pCollate; /* List of SQL collation functions */ int rc; /* Return code of most recent sqlite4_exec() */ Tcl_Obj *pCollateNeeded; /* Collation needed script */ SqlPreparedStmt *stmtList; /* List of prepared statements*/ SqlPreparedStmt *stmtLast; /* Last statement in the list */ @@ -310,10 +311,37 @@ Tcl_DStringAppendElement(&str, zSql); Tcl_DStringAppendElement(&str, zTm); Tcl_Eval(pDb->interp, Tcl_DStringValue(&str)); Tcl_DStringFree(&str); Tcl_ResetResult(pDb->interp); +} +#endif + +#if defined(SQLITE4_TEST) && defined(SQLITE4_ENABLE_UNLOCK_NOTIFY) +static void setTestUnlockNotifyVars(Tcl_Interp *interp, int iArg, int nArg){ + char zBuf[64]; + sprintf(zBuf, "%d", iArg); + Tcl_SetVar(interp, "sqlite_unlock_notify_arg", zBuf, TCL_GLOBAL_ONLY); + sprintf(zBuf, "%d", nArg); + Tcl_SetVar(interp, "sqlite_unlock_notify_argcount", zBuf, TCL_GLOBAL_ONLY); +} +#else +# define setTestUnlockNotifyVars(x,y,z) +#endif + +#ifdef SQLITE4_ENABLE_UNLOCK_NOTIFY +static void DbUnlockNotify(void **apArg, int nArg){ + int i; + for(i=0; iinterp, i, nArg); + assert( pDb->pUnlockNotify); + Tcl_EvalObjEx(pDb->interp, pDb->pUnlockNotify, flags); + Tcl_DecrRefCount(pDb->pUnlockNotify); + pDb->pUnlockNotify = 0; + } } #endif static void tclCollateNeeded( void *pCtx, @@ -1246,11 +1274,11 @@ "complete", "copy", "enable_load_extension", "errorcode", "eval", "exists", "function", "interrupt", "nullvalue", "onecolumn", "profile", "rekey", "status", "total_changes", - "trace", "transaction", + "trace", "transaction", "unlock_notify", "version", 0 }; enum DB_enum { DB_AUTHORIZER, DB_CACHE, DB_CHANGES, DB_CLOSE, DB_COLLATE, DB_COLLATION_NEEDED, @@ -1257,11 +1285,11 @@ DB_COMPLETE, DB_COPY, DB_ENABLE_LOAD_EXTENSION, DB_ERRORCODE, DB_EVAL, DB_EXISTS, DB_FUNCTION, DB_INTERRUPT, DB_NULLVALUE, DB_ONECOLUMN, DB_PROFILE, DB_REKEY, DB_STATUS, DB_TOTAL_CHANGES, - DB_TRACE, DB_TRANSACTION, + DB_TRACE, DB_TRANSACTION, DB_UNLOCK_NOTIFY, DB_VERSION }; /* don't leave trailing commas on DB_enum, it confuses the AIX xlc compiler */ if( objc<2 ){ @@ -2090,10 +2118,46 @@ }else{ rc = DbTransPostCmd(&cd, interp, Tcl_EvalObjEx(interp, pScript, 0)); } break; } + + /* + ** $db unlock_notify ?script? + */ + case DB_UNLOCK_NOTIFY: { +#ifndef SQLITE4_ENABLE_UNLOCK_NOTIFY + Tcl_AppendResult(interp, "unlock_notify not available in this build", 0); + rc = TCL_ERROR; +#else + if( objc!=2 && objc!=3 ){ + Tcl_WrongNumArgs(interp, 2, objv, "?SCRIPT?"); + rc = TCL_ERROR; + }else{ + void (*xNotify)(void **, int) = 0; + void *pNotifyArg = 0; + + if( pDb->pUnlockNotify ){ + Tcl_DecrRefCount(pDb->pUnlockNotify); + pDb->pUnlockNotify = 0; + } + + if( objc==3 ){ + xNotify = DbUnlockNotify; + pNotifyArg = (void *)pDb; + pDb->pUnlockNotify = objv[2]; + Tcl_IncrRefCount(pDb->pUnlockNotify); + } + + if( sqlite4_unlock_notify(pDb->db, xNotify, pNotifyArg) ){ + Tcl_AppendResult(interp, sqlite4_errmsg(pDb->db), 0); + rc = TCL_ERROR; + } + } +#endif + break; + } /* $db version ** ** Return the version string for this database. */ Index: src/vdbe.c ================================================================== --- src/vdbe.c +++ src/vdbe.c @@ -2557,11 +2557,11 @@ assert( pOp->p1>=0 && pOp->p1nDb ); pDb = &db->aDb[pOp->p1]; pIn3 = &aMem[pOp->p3]; sqlite4VdbeMemIntegerify(pIn3); v = (u32)pIn3->u.i; - rc = sqlite4KVStorePutSchema(pDb->pKV, v); + rc = sqlite4KVStorePutMeta(db, pDb->pKV, 0, 1, &v); pDb->pSchema->schema_cookie = (int)pIn3->u.i; db->flags |= SQLITE4_InternChanges; if( pOp->p1==1 ){ /* Invalidate all prepared statements whenever the TEMP database ** schema is changed. Ticket #1644 */ @@ -2571,11 +2571,11 @@ break; } /* Opcode: VerifyCookie P1 P2 P3 * * ** -** Check the value of global database parameter number 0 (the +** cHECK THe value of global database parameter number 0 (the ** schema version) and make sure it is equal to P2 and that the ** generation counter on the local schema parse equals P3. ** ** P1 is the database number which is 0 for the main database file ** and 1 for the file holding temporary tables and some higher number @@ -2595,11 +2595,11 @@ KVStore *pKV; assert( pOp->p1>=0 && pOp->p1nDb ); pKV = db->aDb[pOp->p1].pKV; if( pKV ){ - rc = sqlite4KVStoreGetSchema(pKV, &iMeta); + rc = sqlite4KVStoreGetMeta(pKV, 0, 1, &iMeta); if( rc ) break; iGen = db->aDb[pOp->p1].pSchema->iGeneration; }else{ iGen = iMeta = 0; } Index: src/where.c ================================================================== --- src/where.c +++ src/where.c @@ -4163,11 +4163,11 @@ testcase( op==OP_SeekGt ); testcase( op==OP_SeekGe ); testcase( op==OP_SeekLe ); testcase( op==OP_SeekLt ); sqlite4VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); - if( (pIdx->nColumn + (pIdx==pPk ? 0 : pPk->nColumn))>nEq ){ + if( pIdx->nColumn>nEq ){ sqlite4VdbeChangeP5(v, OPFLAG_PARTIALKEY); } /* Set variable op to the instruction required to determine if the ** cursor is passed the end of the range. If the range is unbounded, Index: test/ckpt1.test ================================================================== --- test/ckpt1.test +++ test/ckpt1.test @@ -74,10 +74,11 @@ INSERT INTO t1 SELECT randstr(100,100), randstr(100,100) FROM t1; -- 16K INSERT INTO t1 SELECT randstr(100,100), randstr(100,100) FROM t1; -- 32K INSERT INTO t1 SELECT randstr(100,100), randstr(100,100) FROM t1; -- 64K } do_test 3.2 { + sqlite4_lsm_flush db main sqlite4_lsm_work db main -nmerge 1 -npage 1000000 execsql { SELECT count(*) FROM t1 } } {65536} do_test 3.3 { db close @@ -84,13 +85,12 @@ sqlite4 db test.db execsql { SELECT count(*) FROM t1 } } {65536} do_test 3.4 { execsql { INSERT INTO t1 VALUES(randstr(100,100), randstr(100,100)) } - db close - sqlite4 db test.db + sqlite4_lsm_flush db main sqlite4_lsm_work db main -nmerge 1 -npage 1000000 execsql { SELECT count(*) FROM t1 } } {65537} finish_test Index: test/csr1.test ================================================================== --- test/csr1.test +++ test/csr1.test @@ -75,12 +75,12 @@ populate_db_2 do_execsql_test 3.1 { BEGIN; INSERT INTO t1 VALUES(10, randstr(910, 910)); } -do_test 3.2 { sqlite4_lsm_config db main autoflush } 1024 -do_test 3.3 { sqlite4_lsm_config db main autoflush 4 } 4 +do_test 3.2 { sqlite4_lsm_config db main autoflush } [expr 1*1024*1024] +do_test 3.3 { sqlite4_lsm_config db main autoflush 4096 } 4096 do_test 3.4 { set res [list] db eval { SELECT a, length(b) AS l FROM t1 } { lappend res $a $l Index: test/log3.test ================================================================== --- test/log3.test +++ test/log3.test @@ -34,10 +34,11 @@ do_test 1.9 { sqlite4_lsm_config db main safety } {2} #------------------------------------------------------------------------- reset_db do_test 2.0 { sqlite4_lsm_config db main safety 2 } {2} +do_test 2.1 { sqlite4_lsm_config db main log-size 1024 } {1024} do_execsql_test 2.2 { CREATE TABLE t1(a PRIMARY KEY, b); INSERT INTO t1 VALUES(randstr(50,50), randstr(50,50)); } {} @@ -53,11 +54,11 @@ INSERT INTO t1 VALUES(randstr(50,50), randstr(50,50)); COMMIT; } {} do_filesize_test 2.5 0 2048 -do_test 2.6 { optimize_db } {} +do_test 2.6 { sqlite4_lsm_flush db main } {} do_execsql_test 2.7 { INSERT INTO t1 VALUES(randstr(50,50), randstr(50,50)) } do_test 2.8 { sqlite4_lsm_checkpoint db main } {} do_test 2.9 { sqlite4_lsm_info db main log-structure } {0 0 0 0 2560 3072} for {set i 1} {$i <= 6} {incr i} { @@ -68,9 +69,9 @@ do_recover_test 2.10.$i.3 { SELECT count(*) FROM t1 } [expr 8 + $i] } do_test 2.11 { sqlite4_lsm_info db main log-structure -} {0 0 0 0 2560 6144} +} {2560 3080 0 2216 3584 4608} finish_test Index: test/lsm1.test ================================================================== --- test/lsm1.test +++ test/lsm1.test @@ -88,10 +88,11 @@ db write eee five db write fff six reopen db delete_range a bbb reopen +breakpoint db work 10 } {1} do_contents_test 2.2 { {bbb two} {ccc three} {ddd four} {eee five} {fff six} } @@ -116,12 +117,12 @@ do_test 3.2 { db write bx seven reopen db delete_range aaa bx reopen - db work 2 10 -} {1} + db work 10 +} {2} do_contents_test 3.3 { {aaa one} {bx seven} {ccc three} {ddd four} {eee five} {fff six} } Index: test/permutations.test ================================================================== --- test/permutations.test +++ test/permutations.test @@ -133,11 +133,11 @@ test_suite "src4" -prefix "" -description { } -files { simple.test simple2.test log3.test - lsm1.test lsm2.test lsm3.test lsm4.test lsm5.test + lsm1.test lsm2.test csr1.test ckpt1.test mc1.test fts5expr1.test fts5query1.test fts5rnd1.test fts5create.test fts5snippet.test Index: test/simple.test ================================================================== --- test/simple.test +++ test/simple.test @@ -85,11 +85,11 @@ do_execsql_test 3.2 { SELECT * FROM sqlite_master } { table t1 t1 2 {CREATE TABLE t1(k PRIMARY KEY, v UNIQUE)} - index sqlite_t1_unique2 t1 3 {} + index sqlite_autoindex_t1_2 t1 3 {} } #explain { INSERT INTO t1 VALUES('one', '111') } #execsql { PRAGMA vdbe_trace = 1 } #execsql { PRAGMA kv_trace = 1 } @@ -125,11 +125,11 @@ do_execsql_test 5.3 { SELECT * FROM sqlite_master } { table t1 t1 3 {CREATE TABLE t1(k, v UNIQUE)} - index sqlite_t1_unique1 t1 2 {} + index sqlite_autoindex_t1_1 t1 2 {} index i1 t1 4 {CREATE INDEX i1 ON t1(v)} } do_execsql_test 5.3 { INSERT INTO t1 VALUES('one', '111') } {} do_execsql_test 5.4 { SELECT * FROM t1 } {one 111} @@ -1459,26 +1459,9 @@ db close sqlite4 db test.db execsql "INSERT INTO t1 VALUES('k$i', randstr(500,500))" } } {} +breakpoint db close -#------------------------------------------------------------------------- -# Index on a blob. -# -reset_db - -do_execsql_test 75.1 { - CREATE TABLE t1(a PRIMARY KEY, b UNIQUE); - INSERT INTO t1 VALUES(x'12345678', x'12345678'); -} - -do_execsql_test 75.2 { - SELECT count(*) FROM t1 WHERE a = x'12345678' -} 1 - -do_execsql_test 75.3 { - SELECT count(*) FROM t1 WHERE b = x'12345678' -} 1 - finish_test Index: test/test_kv2.c ================================================================== --- test/test_kv2.c +++ test/test_kv2.c @@ -232,20 +232,10 @@ static int kvwrapControl(KVStore *pKVStore, int op, void *pArg){ KVWrap *p = (KVWrap *)pKVStore; return p->pReal->pStoreVfunc->xControl(p->pReal, op, pArg); } -static int kvwrapGetMeta(KVStore *pKVStore, unsigned int *piVal){ - KVWrap *p = (KVWrap *)pKVStore; - return p->pReal->pStoreVfunc->xGetMeta(p->pReal, piVal); -} - -static int kvwrapPutMeta(KVStore *pKVStore, unsigned int iVal){ - KVWrap *p = (KVWrap *)pKVStore; - return p->pReal->pStoreVfunc->xPutMeta(p->pReal, iVal); -} - static int newFileStorage( sqlite4_env *pEnv, KVStore **ppKVStore, const char *zName, unsigned openFlags @@ -269,13 +259,11 @@ kvwrapCommitPhaseOne, kvwrapCommitPhaseTwo, kvwrapRollback, kvwrapRevert, kvwrapClose, - kvwrapControl, - kvwrapGetMeta, - kvwrapPutMeta + kvwrapControl }; KVWrap *pNew; int rc = SQLITE4_OK; Index: test/test_lsm.c ================================================================== --- test/test_lsm.c +++ test/test_lsm.c @@ -145,177 +145,35 @@ } /* ** End of compression routines "noop". *************************************************************************/ -static int testConfigureSetCompression( - Tcl_Interp *interp, - lsm_db *db, - Tcl_Obj *pCmp, - unsigned int iId -){ - struct CompressionScheme { - const char *zName; - lsm_compress cmp; - } aCmp[] = { - { "encrypt", { 0, 43, - testCompressEncBound, testCompressEncCompress, - testCompressEncUncompress, testCompressEncFree - } }, - { "rle", { 0, 44, - testCompressRleBound, testCompressRleCompress, - testCompressRleUncompress, testCompressRleFree - } }, - { "noop", { 0, 45, - testCompressNoopBound, testCompressNoopCompress, - testCompressNoopUncompress, testCompressNoopFree - } }, - { 0, {0, 0, 0, 0, 0, 0} } - }; - int iOpt; - int rc; - - if( interp ){ - rc = Tcl_GetIndexFromObjStruct( - interp, pCmp, aCmp, sizeof(aCmp[0]), "scheme", 0, &iOpt - ); - if( rc!=TCL_OK ) return rc; - }else{ - int nOpt = sizeof(aCmp)/sizeof(aCmp[0]); - for(iOpt=0; iOptdb); return test_lsm_error(interp, "lsm_flush", rc); } case 10: assert( 0==strcmp(aCmd[10].zCmd, "config") ); { - Tcl_Obj **apObj; - int nObj; - if( TCL_OK==Tcl_ListObjGetElements(interp, objv[2], &nObj, &apObj) ){ - return testConfigureLsm(interp, p->db, nObj, apObj); - } - return TCL_ERROR; + return testConfigureLsm(interp, p->db, objv[2]); } case 11: assert( 0==strcmp(aCmd[11].zCmd, "checkpoint") ); { rc = lsm_checkpoint(p->db, 0); return test_lsm_error(interp, "lsm_checkpoint", rc); @@ -906,16 +942,11 @@ test_lsm_error(interp, "lsm_new", rc); return TCL_ERROR; } if( objc==4 ){ - Tcl_Obj **apObj; - int nObj; - rc = Tcl_ListObjGetElements(interp, objv[3], &nObj, &apObj); - if( rc==TCL_OK ){ - rc = testConfigureLsm(interp, p->db, nObj, apObj); - } + rc = testConfigureLsm(interp, p->db, objv[3]); if( rc!=TCL_OK ){ test_lsm_del((void *)p); return rc; } } @@ -939,10 +970,11 @@ const char *zName; Tcl_ObjCmdProc *xCmd; } aCmd[] = { { "sqlite4_lsm_work", test_sqlite4_lsm_work }, { "sqlite4_lsm_checkpoint", test_sqlite4_lsm_checkpoint }, + { "sqlite4_lsm_flush", test_sqlite4_lsm_flush }, { "sqlite4_lsm_info", test_sqlite4_lsm_info }, { "sqlite4_lsm_config", test_sqlite4_lsm_config }, { "lsm_open", test_lsm_open }, }; int i; Index: test/tester.tcl ================================================================== --- test/tester.tcl +++ test/tester.tcl @@ -1564,15 +1564,11 @@ # the next rowid allocated for each table with an IPK will be as expected # by SQLite 3 tests. # proc optimize_db {} { #catch { - set af [sqlite4_lsm_config db main autoflush] - sqlite4_lsm_config db main autoflush 0 - db eval { BEGIN EXCLUSIVE; COMMIT; } - sqlite4_lsm_config db main autoflush $af - + sqlite4_lsm_flush db main sqlite4_lsm_work db main -nmerge 1 -npage 100000 sqlite4_lsm_checkpoint db main #} return "" } Index: test/tkt-bd484a090c.test ================================================================== --- test/tkt-bd484a090c.test +++ test/tkt-bd484a090c.test @@ -22,11 +22,10 @@ } {0} do_test 1.2 { lindex [catchsql { SELECT datetime('now', 'utc') }] 0 } {0} -if 0 { sqlite4_test_control SQLITE4_TESTCTRL_LOCALTIME_FAULT 1 do_test 2.1 { catchsql { SELECT datetime('now', 'localtime') } } {1 {local time unavailable}} @@ -33,8 +32,7 @@ do_test 2.2 { catchsql { SELECT datetime('now', 'utc') } } {1 {local time unavailable}} sqlite4_test_control SQLITE4_TESTCTRL_LOCALTIME_FAULT 0 -} finish_test Index: test/tkt3761.test ================================================================== --- test/tkt3761.test +++ test/tkt3761.test @@ -15,18 +15,13 @@ # $Id: tkt3761.test,v 1.1 2009/03/31 02:54:40 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl -proc zeroblob {n} { - string repeat [binary format c 0] $n -} - do_test tkt3761-1.1 { db close sqlite4 db :memory: - db func zeroblob zeroblob db eval { PRAGMA auto_vacuum=INCREMENTAL; CREATE TABLE t1(x); INSERT INTO t1 VALUES(zeroblob(900)); INSERT INTO t1 VALUES(zeroblob(900)); Index: test/where8.test ================================================================== --- test/where8.test +++ test/where8.test @@ -328,11 +328,11 @@ INSERT INTO t3 VALUES(1339.360726, 2847564.823, 'over'); INSERT INTO t3 VALUES('villages', 'their', 'have'); INSERT INTO t3 VALUES('unalike', 'remarkably', 'in'); INSERT INTO t3 VALUES('and', 8979323846, 'and'); INSERT INTO t3 VALUES(NULL, 1415926535, 'an'); - INSERT INTO t3 VALUES(271.25, 8628034825, 0.4811174502); + INSERT INTO t3 VALUES(271.2019091, 8628034825, 0.4811174502); INSERT INTO t3 VALUES('all', 3421170679, 'the'); INSERT INTO t3 VALUES('Not', 'and', 1415926535); INSERT INTO t3 VALUES('of', 'other', 'light'); INSERT INTO t3 VALUES(NULL, 'towering', 'Not'); INSERT INTO t3 VALUES(346.0348610, NULL, 'other'); Index: www/lsm.wiki ================================================================== --- www/lsm.wiki +++ www/lsm.wiki @@ -3,11 +3,10 @@ -
      1. Summary
      2. Locks
      3. Database Connect and Disconnect Operations
            3.1. Read-write clients
@@ -23,10 +22,13 @@             4.3. Other Shared-Memory Fields
            4.4. Log file
      5. Database Operations
            5.1. Reading
            5.2. Writing
+                  5.2.1. Flushing the in-memory tree to disk
+                  5.2.2. Shared-memory management
+                  5.2.3. Log file management
            5.3. Working
                  5.3.1. Free-block list management
            5.4. Checkpoint Operations
@@ -701,10 +703,71 @@ that it is consistent with the current tree-header.
  • Clear the writer flag. +

    5.2.1. Flushing the in-memory tree to disk

    + +

    +For the purposes of writing, the database file and the in-memory tree are +largely independent. Processes holding the WRITER lock write to the in-memory +tree, and processes holding the WORKER lock write to the database file. + +

      +
    1. If a write transaction is open, write the new tree-header to + shared-memory (as described above). Otherwise, if no write-transaction + is open, open one - repairing the tree headers if required. + +
    2. Execute a WORKER transaction (see "Working" below) to add a new level + to the LSM. The new level contains the current contents of the + in-memory tree. + +
    3. Update the private copy of the tree-header to reflect a new, empty tree. + +
    4. Commit the write transaction, writing the new, empty tree to + shared-memory. +
    + +

    5.2.2. Shared-memory management

    + +

    +A writer client may have to allocate new shared-memory chunks. This can be +done either by extending the shared-memory region or by recycling the first +chunk in the linked-list. To check if the first chunk in the linked-list may +be reused, the writer must check that: + +

      +
    • The chunk is not part of the current in-memory tree (the one being + appended to by the writer). A writer can check this by examining its + private copy of the tree-header. + +
    • The chunk is not part of an in-memory tree being used by an existing + reader. A writer checks this by scanning (and possibly updating) the + values associated with the READER locks - similar to the way SQLite + does in WAL mode. +
    + +

    5.2.3. Log file management

    + +

    +A writer client also writes to the log file. All information required to write +to the log file (the offset to write to and the initial checksum values) is +embedded in the tree-header. Except, in order to reuse log file space (wrap +around to the start of the log file), a writer needs to know that the space +being recycled will not be required by any recovery process in the future. +In other words, that the information contained in the transactions being +overwritten has been written into the database file and is part of the +snapshot written into the database file by a checkpointer (see "Checkpoint +Operations" below). + +

    +To determine whether or not the log file can be wrapped, the writer requires +access to information stored in the newest snapshot written into the database +header. Their exists a shared-memory variable indicating which of the two +meta-pages contain this snapshot, but the writer process still has to read the +snapshot data and verify its checksum from disk. +

    5.3. Working

    Working is similar to writing. The difference is that a "writer" modifies the in-memory tree. A "worker" modifies the contents of the database file. @@ -780,11 +843,9 @@

  • Update the shared-memory variable to indicate the meta-page written in step 5.
  • Drop the CHECKPOINTER lock. - -