2024-09-25 03:39:39 +02:00
|
|
|
# Created by migrate-autoconf - fix items marked XXX
|
2024-09-25 10:04:14 +02:00
|
|
|
global autosetup
|
2024-09-26 00:13:49 +02:00
|
|
|
use cc cc-db cc-shared cc-lib hwaci-common
|
2024-09-25 03:39:39 +02:00
|
|
|
set DUMP_DEFINES_FILE defines.list
|
2024-10-09 07:28:29 +02:00
|
|
|
define ENABLE_SHARED 1
|
2024-09-24 23:08:49 +02:00
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
# Are we cross compiling?
|
|
|
|
set cross_compiling 0
|
|
|
|
if {[get-define host] ne [get-define build]} {
|
|
|
|
set cross_compiling 1
|
|
|
|
}
|
|
|
|
|
2024-09-25 05:37:34 +02:00
|
|
|
########################################################################
|
2024-09-26 00:13:49 +02:00
|
|
|
# A very long story made short, autosetup's --flag handling has
|
|
|
|
# some behaviors which make it impossible to implement 100% identical
|
|
|
|
# flags, compared to the historical autotools build. The differences
|
|
|
|
# are documented here:
|
2024-09-25 06:20:58 +02:00
|
|
|
#
|
|
|
|
#
|
2024-09-26 00:13:49 +02:00
|
|
|
# 1) --debug is used by autosetup itself, so we have to rename it to
|
|
|
|
# --with-debug. We cannot use --enable-debug because that is, for
|
|
|
|
# autosetup, and alias for --debug=1.
|
2024-09-25 06:20:58 +02:00
|
|
|
#
|
2024-09-26 00:13:49 +02:00
|
|
|
# 2) In autosetup, all flags starting with (--enable, --disable) are
|
|
|
|
# forced to be booleans and received special handling in how they're
|
|
|
|
# resolved. Because of that we have to rename:
|
2024-09-25 06:20:58 +02:00
|
|
|
#
|
2024-09-26 00:13:49 +02:00
|
|
|
# 2.1) --enable-tempstore[=no] to --with-tempstore[=no].
|
2024-09-25 09:30:54 +02:00
|
|
|
#
|
2024-09-24 23:08:49 +02:00
|
|
|
options {
|
2024-09-25 16:38:46 +02:00
|
|
|
with-debug:=1 => {Enable debug build flags}
|
2024-10-09 06:01:14 +02:00
|
|
|
with-tclsh:PATH => {Full pathname of tclsh to use}
|
|
|
|
with-tcl:DIR => {Directory containing tclConfig.sh}
|
2024-09-25 08:07:54 +02:00
|
|
|
tcl=1 => {Disable building accessory programs that require TCL-dev}
|
|
|
|
test-status => {Enable status of tests}
|
|
|
|
threadsafe=1 => {Disable mutexing}
|
2024-09-26 20:40:07 +02:00
|
|
|
with-tempstore:=no => {Use an in-ram database for temporary tables: never,no,yes,always.}
|
2024-09-25 08:07:54 +02:00
|
|
|
editline=0 => {BSD editline support}
|
2024-09-27 15:29:50 +02:00
|
|
|
readline=1 => {Disable readline support}
|
2024-09-25 20:03:26 +02:00
|
|
|
largefile=1 => {Disable large file support}
|
2024-09-25 08:07:54 +02:00
|
|
|
with-readline-lib => {readline library}
|
|
|
|
with-readline-inc => {readline include paths}
|
2024-09-25 03:39:39 +02:00
|
|
|
with-linenoise:DIR => {}
|
2024-09-25 08:07:54 +02:00
|
|
|
amalgamation=1 => {Disable the amalgamation and instead build all files separately}
|
|
|
|
load-extension=1 => {Disable loading of external extensions}
|
|
|
|
math=1 => {Disable math functions}
|
|
|
|
json=1 => {Disable JSON functions}
|
|
|
|
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
|
|
|
|
memsys5 => {Enable MEMSYS5}
|
|
|
|
memsys3 => {Enable MEMSYS3}
|
|
|
|
fts3 => {Enable the FTS3 extension}
|
|
|
|
fts4 => {Enable the FTS4 extension}
|
|
|
|
fts5 => {Enable the FTS5 extension}
|
|
|
|
update-limit => {Enable the UPDATE/DELETE LIMIT clause}
|
|
|
|
geopoly => {Enable the GEOPOLY extension}
|
|
|
|
rtree => {Enable the RTREE extension}
|
|
|
|
session => {Enable the SESSION extension}
|
2024-09-25 16:38:46 +02:00
|
|
|
gcov=0 => {Enable coverage testing using gcov}
|
2024-09-25 08:07:54 +02:00
|
|
|
linemacros => {Enable #line macros in the amalgamation.}
|
|
|
|
with-wasi-sdk:=/opt/wasi-sdk
|
2024-09-26 20:40:07 +02:00
|
|
|
=> {Top-most dir of the wasi-sdk for a WASI build.}
|
2024-09-25 16:38:46 +02:00
|
|
|
with-emsdk:DIR => {Top-most dir of the Emscripten SDK installation}
|
2024-09-26 20:40:07 +02:00
|
|
|
dump-defines=1 => {Disable dump of autosetup defines to $DUMP_DEFINES_FILE}
|
2024-09-25 08:07:54 +02:00
|
|
|
}
|
2024-09-24 23:08:49 +02:00
|
|
|
|
2024-10-08 18:06:11 +02:00
|
|
|
########################################################################
|
|
|
|
# Notes about certain historical flags:
|
|
|
|
#
|
|
|
|
# --releasemode: libtool-specific (which we don't have now)
|
|
|
|
#
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-10-08 18:06:11 +02:00
|
|
|
|
|
|
|
|
2024-09-25 03:39:39 +02:00
|
|
|
set srcdir $autosetup(srcdir)
|
2024-09-27 03:00:32 +02:00
|
|
|
set top_srcdir [get-define abs_top_srcdir]
|
|
|
|
puts "srcdir = $srcdir"
|
|
|
|
puts "top_srcdir = $top_srcdir"
|
2024-09-26 14:16:46 +02:00
|
|
|
set RELEASE [readfile $autosetup(srcdir)/VERSION]
|
|
|
|
regsub {([0-9]*\.*[0-9]*).*} $RELEASE {\1} VERSION
|
2024-09-26 01:09:38 +02:00
|
|
|
define VERSION $VERSION
|
2024-09-26 14:16:46 +02:00
|
|
|
define RELEASE $RELEASE
|
|
|
|
puts "RELEASE = $RELEASE"
|
|
|
|
puts "VERSION = $VERSION"
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-09-27 03:00:32 +02:00
|
|
|
define SQLITE_AUTOREMAKE cd
|
|
|
|
define-append SQLITE_AUTOREMAKE $autosetup(srcdir) && $top_srcdir/configure {*}$autosetup(argv)
|
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
set outOfTreeBuild 0
|
|
|
|
if {![file exists sqlite3.pc.in]} {
|
|
|
|
puts "This appears to be an out-of-tree build."
|
|
|
|
set outOfTreeBuild 1
|
|
|
|
}
|
|
|
|
|
2024-09-26 14:16:46 +02:00
|
|
|
cc-check-tools ld ar
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
2024-09-25 03:39:39 +02:00
|
|
|
# The build process allows for using a cross-compiler. But the default
|
|
|
|
# action is to target the same platform that we are running on. The
|
|
|
|
# configure script needs to discover the following properties of the
|
|
|
|
# build and target systems:
|
|
|
|
#
|
|
|
|
# srcdir
|
|
|
|
#
|
|
|
|
# The is the name of the directory that contains the
|
|
|
|
# "configure" shell script. All source files are
|
|
|
|
# located relative to this directory.
|
|
|
|
#
|
|
|
|
# bindir
|
|
|
|
#
|
|
|
|
# The name of the directory where executables should be
|
|
|
|
# written by the "install" target of the makefile.
|
|
|
|
#
|
|
|
|
# program_prefix
|
|
|
|
#
|
|
|
|
# Add this prefix to the names of all executables that run
|
|
|
|
# on the target machine. Default: ""
|
|
|
|
#
|
|
|
|
# ENABLE_SHARED
|
|
|
|
#
|
|
|
|
# True if shared libraries should be generated.
|
|
|
|
#
|
|
|
|
# BUILD_CC
|
|
|
|
#
|
|
|
|
# The name of a command that is used to convert C
|
|
|
|
# source files into executables that run on the build
|
|
|
|
# platform.
|
|
|
|
#
|
|
|
|
# BUILD_CFLAGS
|
|
|
|
#
|
|
|
|
# Switches that the build compiler needs in order to construct
|
|
|
|
# command-line programs.
|
|
|
|
#
|
|
|
|
# BUILD_LIBS
|
|
|
|
#
|
|
|
|
# Libraries that the build compiler needs in order to construct
|
|
|
|
# command-line programs.
|
|
|
|
#
|
|
|
|
# TCL_*
|
|
|
|
#
|
|
|
|
# Lots of values are read in from the tclConfig.sh script,
|
|
|
|
# if that script is available. This values are used for
|
|
|
|
# constructing and installing the TCL extension.
|
|
|
|
#
|
|
|
|
# TARGET_READLINE_LIBS
|
|
|
|
#
|
|
|
|
# This is the library directives passed to the target linker
|
|
|
|
# that cause the executable to link against the readline library.
|
|
|
|
# This might be a switch like "-lreadline" or pathnames of library
|
|
|
|
# file like "../../src/libreadline.a".
|
|
|
|
#
|
|
|
|
# TARGET_READLINE_INC
|
|
|
|
#
|
|
|
|
# This variables define the directory that contain header
|
|
|
|
# files for the readline library. If the compiler is able
|
|
|
|
# to find <readline.h> on its own, then this can be blank.
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 05:37:34 +02:00
|
|
|
# OPT_FEATURE_FLAGS = -DSQLITE_OMIT/ENABLE flags.
|
|
|
|
define OPT_FEATURE_FLAGS {}
|
2024-09-27 15:29:50 +02:00
|
|
|
define OPT_SHELL {}; # CFLAGS for the sqlite3 CLI app
|
2024-09-25 16:38:46 +02:00
|
|
|
# Adds $flag, if not empty, to OPT_FEATURE_FLAGS.
|
2024-09-27 15:29:50 +02:00
|
|
|
proc add-feature-flag {args} {
|
|
|
|
if {"" ne $args} {
|
|
|
|
define-append OPT_FEATURE_FLAGS {*}$args
|
2024-09-25 16:38:46 +02:00
|
|
|
}
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
|
|
|
# add-feature-flag -DSQLITE_JUST_TESTING=3
|
2024-09-27 15:29:50 +02:00
|
|
|
proc add-shell-opt {args} {
|
|
|
|
if {"" ne $args} {
|
|
|
|
define-append OPT_SHELL {*}$args
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 07:28:29 +02:00
|
|
|
hwaci-file-extensions
|
2024-09-25 10:04:14 +02:00
|
|
|
if {".exe" eq [get-define TARGET_EXEEXT]} {
|
|
|
|
define SQLITE_OS_UNIX 0
|
|
|
|
define SQLITE_OS_WIN 1
|
|
|
|
# todo? add -DSQLITE_OS_WIN=1 to CFLAGS?
|
|
|
|
} else {
|
|
|
|
define SQLITE_OS_UNIX 1
|
|
|
|
define SQLITE_OS_WIN 0
|
|
|
|
# todo? add -DSQLITE_OS_UNIX=1 to CFLAGS?
|
|
|
|
}
|
|
|
|
|
2024-09-25 03:39:39 +02:00
|
|
|
#########
|
|
|
|
# Programs needed
|
2024-09-25 10:04:14 +02:00
|
|
|
if {"" eq [hwaci-bin-define install]} {
|
|
|
|
msg-result "Cannot find install binary, so 'make install' will not work."
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 20:03:26 +02:00
|
|
|
# Locate a compiler for the build machine. This compiler should
|
|
|
|
# generate command-line programs that run on the build machine.
|
|
|
|
#
|
|
|
|
# XXX if test x"$cross_compiling" = xno; then
|
|
|
|
# XXX BUILD_CC=$CC
|
|
|
|
# XXX BUILD_CFLAGS=$CFLAGS
|
|
|
|
# XXX else
|
|
|
|
# XXX if test "${BUILD_CC+set}" != set; then
|
|
|
|
# XXX AC_CHECK_PROGS BUILD_CC gcc cc cl
|
|
|
|
# XXX fi
|
|
|
|
# XXX if test "${BUILD_CFLAGS+set}" != set; then
|
|
|
|
# XXX BUILD_CFLAGS="-g"
|
|
|
|
# XXX fi
|
|
|
|
# XXX fi
|
|
|
|
# XXX AC_SUBST BUILD_CC
|
2024-09-25 16:38:46 +02:00
|
|
|
|
2024-09-26 14:16:46 +02:00
|
|
|
define BUILD_CC [get-define CC_FOR_BUILD]
|
|
|
|
define BUILD_CFLAGS [get-env CFLAGS {-g}]
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 05:37:34 +02:00
|
|
|
# Handle --with-wasi-sdk=DIR
|
|
|
|
#
|
2024-09-25 20:03:26 +02:00
|
|
|
# This must be early because it may change the toolchain and several
|
|
|
|
# config options.
|
2024-09-25 03:39:39 +02:00
|
|
|
#
|
2024-09-25 08:07:54 +02:00
|
|
|
# It's unclear whether we can actually get away with making these
|
|
|
|
# changes to the autosetup environment.
|
2024-09-25 05:37:34 +02:00
|
|
|
if {1} {
|
2024-09-25 10:04:14 +02:00
|
|
|
set wasiSdkDir [opt-val with-wasi-sdk] ; # ??? [lindex [opt-val with-wasi-sdk] end]
|
|
|
|
#puts "x wasiSdkDir=$wasiSdkDir foo=[lindex [opt-val with-wasi-sdk] end]"
|
2024-09-27 15:29:50 +02:00
|
|
|
if {$wasiSdkDir ne ""} {
|
2024-09-25 05:37:34 +02:00
|
|
|
msg-checking "Checking WASI SDK directory \[$wasiSdkDir]... "
|
2024-09-26 14:16:46 +02:00
|
|
|
puts "prefix = [prefix $wasiSdkDir/bin {clang ld}]"
|
|
|
|
hwaci-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld}]
|
|
|
|
msg-result "Using wasi-sdk clang, disabling: tcl, CLI shell, DLL, loadable extensions, threading"
|
2024-09-25 05:37:34 +02:00
|
|
|
define HAVE_WASI_SDK 1
|
|
|
|
define WASI_SDK_DIR $wasiSdkDir
|
2024-09-26 14:16:46 +02:00
|
|
|
hwaci-opt-set load-extension 0; # ==> --disable-load-extension
|
2024-10-09 07:28:29 +02:00
|
|
|
hwaci-opt-set threadsafe 0; # ==> --threadsafe=0
|
2024-09-26 14:16:46 +02:00
|
|
|
hwaci-opt-set tcl 0; # ==> --disable-tcl
|
|
|
|
define HAVE_TCL 0
|
2024-09-25 10:04:14 +02:00
|
|
|
set cross_compiling 1
|
2024-09-26 14:16:46 +02:00
|
|
|
# libtool is apparently hard-coded to use gcc for linking DLLs, so
|
|
|
|
# we disable the DLL build.
|
2024-10-09 07:28:29 +02:00
|
|
|
define ENABLE_SHARED 0
|
2024-09-25 05:37:34 +02:00
|
|
|
|
|
|
|
# Changing --host and --target have no effect here except to possibly
|
|
|
|
# cause confusion. autoconf has finished processing them by this
|
|
|
|
# point.
|
|
|
|
#
|
|
|
|
# host_alias=wasm32-wasi
|
|
|
|
# target=wasm32-wasi
|
|
|
|
#
|
|
|
|
# Merely changing CC and LD to the wasi-sdk's is enough to get
|
|
|
|
# sqlite3.o building in WASM format.
|
2024-09-25 09:30:54 +02:00
|
|
|
# XXX CC="${wasiSdkDir}/bin/clang"
|
|
|
|
# XXX LD="${wasiSdkDir}/bin/wasm-ld"
|
|
|
|
# XXX RANLIB="${wasiSdkDir}/bin/llvm-ranlib"
|
2024-09-26 14:16:46 +02:00
|
|
|
define CC "${wasiSdkDir}/bin/clang"
|
|
|
|
define LD "${wasiSdkDir}/bin/wasm-ld"
|
|
|
|
#define STRIP "${wasiSdkDir}/bin/strip"
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
2024-09-25 20:03:26 +02:00
|
|
|
unset wasiSdkDir
|
2024-09-25 05:37:34 +02:00
|
|
|
}; # --wasi-sdk-dir
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 20:03:26 +02:00
|
|
|
# Enable large file support (if special flags are necessary)
|
|
|
|
cc-check-lfs
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 20:03:26 +02:00
|
|
|
# Check for needed/wanted data types
|
|
|
|
cc-check-types int8_t int16_t int32_t int64_t intptr_t \
|
|
|
|
uint8_t uint16_t uint32_t uint64_t uintptr_t
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-27 15:29:50 +02:00
|
|
|
# Check for needed/wanted functions
|
2024-09-25 20:03:26 +02:00
|
|
|
cc-check-functions gmtime_r isnan localtime_r localtime_s \
|
|
|
|
malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
|
|
|
|
|
2024-09-30 19:44:41 +02:00
|
|
|
hwaci-check-function-in-lib fdatasync rt
|
2024-09-25 20:03:26 +02:00
|
|
|
define LDFLAGS_FDATASYNC [get-define lib_fdatasync]
|
|
|
|
undefine lib_fdatasync
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 20:03:26 +02:00
|
|
|
# Check for needed/wanted headers
|
2024-09-27 03:00:32 +02:00
|
|
|
cc-check-includes \
|
|
|
|
sys/types.h sys/stat.h dlfcn.h unistd.h \
|
|
|
|
stdlib.h malloc.h memory.h \
|
|
|
|
string.h strings.h \
|
|
|
|
stdint.h inttypes.h
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
# These are optional for JimTCL but necessary if we want to use it for
|
|
|
|
# code generation:
|
2024-09-27 05:04:16 +02:00
|
|
|
cc-check-includes dirent.h sys/time.h
|
|
|
|
|
2024-09-30 19:44:41 +02:00
|
|
|
if {[cc-check-includes zlib.h] && [hwaci-check-function-in-lib deflate z]} {
|
2024-09-26 00:13:49 +02:00
|
|
|
# TODO: port over the more sophisticated zlib search from the fossil auto.def
|
2024-09-25 20:03:26 +02:00
|
|
|
define HAVE_ZLIB 1; # "-DSQLITE_HAVE_ZLIB=1"
|
|
|
|
define LDFLAGS_ZLIB -lz
|
2024-09-30 21:01:41 +02:00
|
|
|
# -DSQLITE_HAVE_ZLIB=1 is handled separately from the other feature
|
|
|
|
# flags in the autotools build
|
|
|
|
# add-feature-flag -DSQLITE_HAVE_ZLIB=1
|
|
|
|
define CFLAGS_ZLIB -DSQLITE_HAVE_ZLIB=1
|
2024-09-25 20:03:26 +02:00
|
|
|
} else {
|
|
|
|
define HAVE_ZLIB 0
|
|
|
|
define LDFLAGS_ZLIB ""
|
2024-09-30 21:01:41 +02:00
|
|
|
define CFLAGS_ZLIB ""
|
2024-09-25 20:03:26 +02:00
|
|
|
}
|
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
hwaci-define-if-opt-truthy amalgamation USE_AMALGAMATION \
|
|
|
|
"Use amalgamation for builds?"
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-25 20:03:26 +02:00
|
|
|
hwaci-define-if-opt-truthy gcov USE_GCOV "Use gcov?"
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
hwaci-define-if-opt-truthy test-status TSTRNNR_OPTS \
|
|
|
|
"test-runner flags:" {--status} {}
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
hwaci-define-if-opt-truthy linemacros AMALGAMATION_LINE_MACROS \
|
|
|
|
"Use #line macros in the amalgamation:" {--linemacros=1} {--linemacros=0}
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-26 10:25:10 +02:00
|
|
|
msg-checking "Debug build? "
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-26 10:25:10 +02:00
|
|
|
hwaci-if-opt-truthy with-debug {
|
|
|
|
define SQLITE_DEBUG 1
|
|
|
|
define TARGET_DEBUG {-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
|
|
|
|
msg-result yes
|
|
|
|
} {
|
|
|
|
define TARGET_DEBUG {-DNDEBUG}
|
|
|
|
msg-result no
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
|
|
|
# TCL...
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-10-09 09:12:32 +02:00
|
|
|
# hwaci-check-tcl performs most of the --with-tcl and --with-tclsh
|
|
|
|
# handling. Some related bits and pieces are performed before and
|
|
|
|
# after that function is called.
|
|
|
|
#
|
|
|
|
# Important [define]'d vars:
|
|
|
|
#
|
|
|
|
# - HAVE_TCL indicates whether we have a tclsh suitable for building
|
|
|
|
# the TCL SQLite extension and, by extension, the testing
|
|
|
|
# infrastructure. This must only be 1 for environments where
|
|
|
|
# tclConfig.sh can be found.
|
|
|
|
#
|
|
|
|
# - TCLSH_CMD is the path to the canonical tclsh. It never refers to
|
|
|
|
# jimtcl.
|
|
|
|
#
|
|
|
|
# - TCL_CONFIG_SH is the path to tclConfig.sh or "".
|
|
|
|
#
|
|
|
|
# - TCLLIBDIR is the dir to which libtclsqlite3 gets installed.
|
|
|
|
#
|
|
|
|
# - TCLLIB_RPATH = the -rpath flag specific to libtclsqlite3.
|
|
|
|
#
|
|
|
|
# - BTCL = the path to the tcl interpreter used for in-tree code
|
|
|
|
# generation. It may be jimtcl or the canonical tclsh.
|
2024-09-27 04:35:41 +02:00
|
|
|
define HAVE_TCL 0
|
|
|
|
define TCLSH_CMD {exit 1}
|
2024-10-09 06:01:14 +02:00
|
|
|
proc hwaci-check-tcl {} {
|
|
|
|
global top_srcdir
|
|
|
|
puts "Checking for a suitable tcl... "
|
|
|
|
set optTcl [hwaci-opt-truthy tcl]
|
|
|
|
set use_tcl $optTcl
|
2024-09-27 03:00:32 +02:00
|
|
|
set with_tclsh [opt-val with-tclsh]
|
|
|
|
set with_tcl [opt-val with-tcl]
|
2024-10-09 06:01:14 +02:00
|
|
|
# puts "hwaci-check-tcl: use_tcl ${use_tcl}"
|
|
|
|
# puts "hwaci-check-tcl: with_tclsh=${with_tclsh}"
|
|
|
|
# puts "hwaci-check-tcl: with_tcl=$with_tcl"
|
2024-09-27 03:00:32 +02:00
|
|
|
if {"" eq $with_tclsh && "" eq $with_tcl} {
|
|
|
|
set with_tclsh [hwaci-first-bin-of tclsh8.6 tclsh tclsh9.0]
|
|
|
|
}
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
if {"" ne $with_tclsh} {
|
|
|
|
if {![file isfile $with_tclsh]} {
|
|
|
|
hwaci-error "TCL shell $with_tclsh is not a file"
|
|
|
|
} elseif {![file executable $with_tclsh]} {
|
|
|
|
hwaci-error "TCL shell $with_tclsh is not executable"
|
|
|
|
} else {
|
|
|
|
define TCLSH_CMD $with_tclsh
|
|
|
|
puts "Using tclsh at \"$with_tclsh\""
|
|
|
|
}
|
2024-09-27 03:00:32 +02:00
|
|
|
if {$use_tcl} {
|
2024-10-09 06:01:14 +02:00
|
|
|
#set with_tcl [exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl]
|
|
|
|
if {[catch {exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl} result] == 0} {
|
|
|
|
set with_tcl $result
|
|
|
|
}
|
|
|
|
if {"" ne $with_tcl && [file isdir $with_tcl]} {
|
|
|
|
puts "$with_tclsh recommends the tclConfig.sh from $with_tcl"
|
|
|
|
} else {
|
|
|
|
puts "$with_tclsh is unable to recommand a tclConfig.sh"
|
|
|
|
set use_tcl 0
|
|
|
|
}
|
2024-09-27 03:00:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
set cfg ""
|
|
|
|
set tclSubdirs {tcl8.6 tcl9.0 lib}
|
|
|
|
if {$use_tcl} {
|
|
|
|
if {"" ne $with_tcl} {
|
|
|
|
if {[file readable "${with_tcl}/tclConfig.sh"]} {
|
|
|
|
set cfg "${with_tcl}/tclConfig.sh"
|
|
|
|
} else {
|
|
|
|
foreach i $tclSubdirs {
|
|
|
|
if {[file readable "${with_tcl}/$i/tclConfig.sh"]} {
|
|
|
|
set cfg "${with_tcl}/$i/tclConfig.sh"
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if {"" eq $cfg} {
|
|
|
|
hwaci-error "No tclConfig.sh found under ${with_tcl}"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# If we have not yet found a tclConfig.sh file, look in $libdir which is
|
|
|
|
# set automatically by autosetup or by the --prefix command-line option.
|
|
|
|
# See https://sqlite.org/forum/forumpost/e04e693439a22457
|
|
|
|
set libdir [get-define libdir]
|
|
|
|
if {[file readable "${libdir}/tclConfig.sh"]} {
|
|
|
|
set cfg "${libdir}/tclConfig.sh"
|
|
|
|
} else {
|
|
|
|
foreach i $tclSubdirs {
|
|
|
|
if {[file readable "${libdir}/$i/tclConfig.sh"]} {
|
|
|
|
set cfg "${libdir}/$i/tclConfig.sh"
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if {![file readable $cfg]} {
|
|
|
|
hwaci-error {
|
|
|
|
Cannot find a usable tclConfig.sh file.
|
|
|
|
Use --with-tcl=DIR to specify a directory where tclConfig.sh can be found.
|
|
|
|
SQLite does not use TCL internally, but TCL is required to build SQLite
|
|
|
|
from canonical sources and TCL is required for testing.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} elseif {!$optTcl} {
|
|
|
|
puts "Unable to run tests because of --disable-tcl"
|
|
|
|
} else {
|
|
|
|
puts "Unable to run tests because no tclConfig.sh file could be located"
|
|
|
|
}
|
2024-09-27 03:00:32 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
define HAVE_TCL $use_tcl
|
|
|
|
define TCL_CONFIG_SH $cfg
|
2024-10-09 07:28:29 +02:00
|
|
|
# The historical configure.ac sources tclConfig.sh so that it can
|
|
|
|
# use the several TCL_... env vars. We obviously cannot do that from
|
|
|
|
# TCL, so we apply a level of indirection. If the config is not
|
|
|
|
# available, this generates empty-string entries for the various
|
|
|
|
# options we're interested in.
|
|
|
|
eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "[get-define TCL_CONFIG_SH]"]
|
2024-10-09 06:01:14 +02:00
|
|
|
# puts "hwaci-check-tcl: with_tclsh=$with_tclsh"
|
|
|
|
# puts "hwaci-check-tcl: with_tcl=$with_tcl"
|
|
|
|
# puts "hwaci-check-tcl: cfg=$cfg"
|
|
|
|
# puts "hwaci-check-tcl: use_tcl ${use_tcl}"
|
2024-10-09 09:12:32 +02:00
|
|
|
|
|
|
|
if {$use_tcl} {
|
|
|
|
# Set up the TCLLIBDIR and TCLLIB_RPATH
|
|
|
|
set tcllibdir [getenv TCLLIBDIR ""]
|
|
|
|
if {"" eq $tcllibdir} {
|
|
|
|
if {[catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} {
|
|
|
|
foreach i $result {
|
|
|
|
if {[file isdir $i]} {
|
|
|
|
set tcllibdir $i
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
hwaci-warn "Cannot determine TCLLIBDIR"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set tclrpath ""
|
|
|
|
if {"" ne $tcllibdir} {
|
|
|
|
set tcllibdir "${tcllibdir}/sqlite3"
|
|
|
|
set rp [get-define SH_LINKRPATH]
|
|
|
|
set tclrpath [string map [list "%s" $tcllibdir] $rp]
|
|
|
|
}
|
|
|
|
define TCLLIBDIR $tcllibdir
|
|
|
|
define TCLLIB_RPATH $tclrpath
|
|
|
|
#hwaci-error "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
|
|
|
|
}
|
|
|
|
}; # hwaci-check-tcl
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
hwaci-check-tcl
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
|
|
|
# Check which TCL to use as a code generator. Prefer jimsh simply
|
|
|
|
# because we have it in-tree (it's part of autosetup).
|
|
|
|
define CFLAGS_JIMSH {}
|
2024-10-09 06:27:03 +02:00
|
|
|
puts "Which TCL to use for code generation... "
|
|
|
|
set cgtcl jimtcl
|
2024-10-09 06:01:14 +02:00
|
|
|
if {[cc-check-functions realpath]} {
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE_REALPATH
|
|
|
|
define BTCL "\$(JIMSH)"
|
|
|
|
} elseif {[cc-check-functions _fullpath]} {
|
|
|
|
# _fullpath() is a Windows API
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE__FULLPATH
|
|
|
|
define BTCL "\$(JIMSH)"
|
|
|
|
} elseif {"" ne [get-define TCLSH_CMD]} {
|
2024-10-09 06:27:03 +02:00
|
|
|
set cgtcl [get-define TCLSH_CMD]
|
2024-10-09 06:01:14 +02:00
|
|
|
define BTCL "\$(TCLSH_CMD)"
|
|
|
|
} else {
|
2024-10-09 06:27:03 +02:00
|
|
|
# One last-ditch effort to find TCLSH_CMD: use info from
|
|
|
|
# tclConfig.sh to try to find a tclsh
|
|
|
|
if {"" eq [get-define TCLSH_CMD]} {
|
|
|
|
set tpre [get-define TCL_EXEC_PREFIX]
|
|
|
|
if {"" ne $tpre} {
|
|
|
|
set tv [get-define TCL_VERSION]
|
|
|
|
if {[file executable "${tpre}/bin/tclsh${tv}"]} {
|
|
|
|
define TCLSH_CMD "${tpre}/bin/tclsh${tv}"
|
|
|
|
} elseif {[file executable "${tpre}/bin/tclsh"]} {
|
|
|
|
define TCLSH_CMD "${tpre}/bin/tclsh"
|
|
|
|
}
|
|
|
|
unset tv
|
|
|
|
}
|
|
|
|
unset tpre
|
|
|
|
if {"" eq [get-define TCLSH_CMD]} {
|
|
|
|
hwaci-error "Cannot find a tclsh to use for code generation."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set cgtcl [get-define TCLSH_CMD]
|
|
|
|
define BTCL "\$(TCLSH_CMD)"
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
2024-10-09 06:27:03 +02:00
|
|
|
puts "TCL for code generation: $cgtcl"
|
|
|
|
unset cgtcl
|
2024-10-09 09:12:32 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
# /TCL
|
|
|
|
########################################################################
|
2024-09-30 16:33:36 +02:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
|
|
|
# Thread safety?
|
2024-09-25 16:58:09 +02:00
|
|
|
msg-checking "Support threadsafe operation? "
|
2024-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy threadsafe {
|
|
|
|
msg-result yes
|
|
|
|
add-feature-flag -DSQLITE_THREADSAFE=1
|
2024-09-30 19:44:41 +02:00
|
|
|
if {![hwaci-check-function-in-lib pthread_create pthread]
|
|
|
|
|| ![hwaci-check-function-in-lib pthread_mutexattr_init pthread]} {
|
2024-09-25 20:03:26 +02:00
|
|
|
user-error "Missing required pthread bits"
|
|
|
|
}
|
|
|
|
define LDFLAGS_PTHREAD [get-define lib_pthread_create]
|
|
|
|
undefine lib_pthread_create
|
2024-09-25 16:38:46 +02:00
|
|
|
} {
|
|
|
|
msg-result no
|
|
|
|
add-feature-flag -DSQLITE_THREADSAFE=0
|
2024-09-25 20:03:26 +02:00
|
|
|
define LDFLAGS_PTHREAD ""
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 16:38:46 +02:00
|
|
|
# Do we want temporary databases in memory?
|
|
|
|
#
|
2024-09-25 09:30:54 +02:00
|
|
|
if {1} {
|
2024-09-25 14:16:13 +02:00
|
|
|
set ts [opt-val with-tempstore no]
|
2024-09-25 09:30:54 +02:00
|
|
|
set tsn 1
|
|
|
|
msg-checking "Use an in-ram database for temporary tables? "
|
|
|
|
switch -- $ts {
|
|
|
|
never { set tsn 0 }
|
|
|
|
no { set tsn 1 }
|
|
|
|
yes { set tsn 2 }
|
|
|
|
always { set tsn 3 }
|
|
|
|
default {
|
2024-09-25 16:38:46 +02:00
|
|
|
user-error "Invalid with-tempstore value \[$ts]. Use one of: never, no, yes, always"
|
2024-09-25 09:30:54 +02:00
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-09-25 09:30:54 +02:00
|
|
|
msg-result $ts
|
|
|
|
define TEMP_STORE $tsn
|
|
|
|
unset ts tsn
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
|
|
|
|
2024-09-27 15:29:50 +02:00
|
|
|
if {1} {
|
2024-09-25 03:39:39 +02:00
|
|
|
##########
|
|
|
|
# Figure out what C libraries are required to compile programs
|
|
|
|
# that use "readline()" library.
|
2024-09-27 15:29:50 +02:00
|
|
|
hwaci-check-readline
|
|
|
|
} else {
|
|
|
|
# Older impl solely for reference while porting...
|
2024-09-25 03:39:39 +02:00
|
|
|
#
|
|
|
|
# XXX TARGET_READLINE_LIBS=""
|
|
|
|
# XXX TARGET_READLINE_INC=""
|
|
|
|
# XXX TARGET_HAVE_READLINE=0
|
|
|
|
# XXX TARGET_HAVE_EDITLINE=0
|
|
|
|
if {[opt-bool editline]} {
|
|
|
|
set with_editline $enableval
|
|
|
|
} else {
|
|
|
|
set with_editline auto
|
|
|
|
}
|
|
|
|
if {![opt-bool readline]} {
|
|
|
|
set with_readline $enableval
|
|
|
|
} else {
|
|
|
|
set with_readline auto
|
|
|
|
}
|
|
|
|
|
|
|
|
# XXX if test x"$with_editline" != xno; then
|
|
|
|
# XXX sLIBS=$LIBS
|
|
|
|
# XXX LIBS=""
|
|
|
|
# XXX TARGET_HAVE_EDITLINE=1
|
2024-09-30 19:44:41 +02:00
|
|
|
if {[hwaci-check-function-in-lib readline edit]} {
|
2024-09-25 03:39:39 +02:00
|
|
|
set with_readline no
|
|
|
|
} else {
|
|
|
|
# XXX TARGET_HAVE_EDITLINE=0
|
|
|
|
}
|
|
|
|
# XXX TARGET_READLINE_LIBS=$LIBS
|
|
|
|
# XXX LIBS=$sLIBS
|
|
|
|
# XXX fi
|
|
|
|
# XXX if test x"$with_readline" != xno; then
|
|
|
|
set found "yes"
|
|
|
|
|
|
|
|
if {[opt-val with-readline-lib] ne {}} {
|
|
|
|
set withval [lindex [opt-val with-readline-lib] end]
|
|
|
|
set with_readline_lib $withval
|
|
|
|
} else {
|
|
|
|
set with_readline_lib "auto"
|
|
|
|
}
|
|
|
|
# XXX if test "x$with_readline_lib" = xauto; then
|
|
|
|
# XXX save_LIBS="$LIBS"
|
|
|
|
# XXX LIBS=""
|
2024-09-30 19:44:41 +02:00
|
|
|
if {[hwaci-check-function-in-lib tgetent readline ncurses curses termcap]} {
|
2024-09-25 03:39:39 +02:00
|
|
|
# XXX term_LIBS="$LIBS"
|
|
|
|
} else {
|
|
|
|
# XXX term_LIBS=""
|
|
|
|
}
|
2024-09-30 19:44:41 +02:00
|
|
|
if {[hwaci-check-function-in-lib readline readline]} {
|
2024-09-25 03:39:39 +02:00
|
|
|
# XXX TARGET_READLINE_LIBS="-lreadline"
|
|
|
|
} else {
|
|
|
|
set found "no"
|
|
|
|
}
|
|
|
|
# XXX TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
|
|
|
|
# XXX LIBS="$save_LIBS"
|
|
|
|
# XXX else
|
|
|
|
# XXX TARGET_READLINE_LIBS="$with_readline_lib"
|
|
|
|
# XXX fi
|
|
|
|
|
|
|
|
if {[opt-val with-readline-inc] ne {}} {
|
|
|
|
set withval [lindex [opt-val with-readline-inc] end]
|
|
|
|
set with_readline_inc $withval
|
|
|
|
} else {
|
|
|
|
set with_readline_inc "auto"
|
|
|
|
}
|
|
|
|
# XXX if test "x$with_readline_inc" = xauto; then
|
|
|
|
if {[cc-check-includes readline.h]} {
|
|
|
|
set found "yes"
|
|
|
|
} else {
|
|
|
|
set found "no"
|
|
|
|
# XXX if test "$cross_compiling" != yes; then
|
|
|
|
# XXX for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
|
|
|
|
# XXX for subdir in include include/readline; do
|
|
|
|
# XXX AC_CHECK_FILE $dir/$subdir/readline.h found=yes
|
|
|
|
# XXX if test "$found" = "yes"; then
|
|
|
|
# XXX TARGET_READLINE_INC="-I$dir/$subdir"
|
|
|
|
# XXX break
|
|
|
|
# XXX fi
|
|
|
|
# XXX done
|
|
|
|
# XXX test "$found" = "yes" && break
|
|
|
|
# XXX done
|
|
|
|
# XXX fi
|
|
|
|
}
|
|
|
|
# XXX else
|
|
|
|
# XXX TARGET_READLINE_INC="$with_readline_inc"
|
|
|
|
# XXX fi
|
|
|
|
|
|
|
|
# XXX if test x"$found" = xno; then
|
|
|
|
# XXX TARGET_READLINE_LIBS=""
|
|
|
|
# XXX TARGET_READLINE_INC=""
|
|
|
|
# XXX TARGET_HAVE_READLINE=0
|
|
|
|
# XXX else
|
|
|
|
# XXX TARGET_HAVE_READLINE=1
|
|
|
|
# XXX fi
|
|
|
|
# XXX fi
|
|
|
|
if {[opt-val with-linenoise] ne {}} {
|
|
|
|
set withval [lindex [opt-val with-linenoise] end]
|
|
|
|
set with_linenoise $withval
|
|
|
|
} else {
|
|
|
|
set with_linenoise "no"
|
|
|
|
}
|
|
|
|
# XXX if test "x$with_linenoise" != "xno"; then
|
|
|
|
# XXX TARGET_HAVE_READLINE=0
|
|
|
|
# XXX TARGET_HAVE_EDITLINE=0
|
|
|
|
# XXX TARGET_HAVE_LINENOISE=1
|
|
|
|
# XXX TARGET_READLINE_INC="-I${with_linenoise}"
|
|
|
|
# XXX TARGET_READLINE_LIBS="${with_linenoise}/linenoise.c"
|
|
|
|
# XXX echo "using linenoise source code at ${with_linenoise}"
|
|
|
|
# XXX else
|
|
|
|
# XXX TARGET_HAVE_LINENOISE=0
|
|
|
|
# XXX echo "not using linenoise"
|
|
|
|
# XXX fi
|
|
|
|
|
|
|
|
# XXX AC_SUBST TARGET_READLINE_LIBS
|
|
|
|
# XXX AC_SUBST TARGET_READLINE_INC
|
|
|
|
# XXX AC_SUBST TARGET_HAVE_READLINE
|
|
|
|
# XXX AC_SUBST TARGET_HAVE_EDITLINE
|
|
|
|
# XXX AC_SUBST TARGET_HAVE_LINENOISE
|
|
|
|
}
|
|
|
|
|
2024-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy load-extension {
|
2024-09-30 19:44:41 +02:00
|
|
|
if {[hwaci-check-function-in-lib dlopen dl]} {
|
2024-09-25 05:37:34 +02:00
|
|
|
define LDFLAGS_DLOPEN [get-define lib_dlopen]
|
2024-09-25 20:03:26 +02:00
|
|
|
undefine lib_dlopen
|
2024-09-25 05:37:34 +02:00
|
|
|
} else {
|
|
|
|
user-error "dlopen() not found. Use --disable-load-extension to bypass this check."
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-09-25 05:37:34 +02:00
|
|
|
} {
|
|
|
|
define LDFLAGS_DLOPEN ""
|
|
|
|
add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
|
|
|
|
msg-result "Disabling loadable extensions."
|
|
|
|
}
|
|
|
|
|
2024-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy math {
|
2024-09-30 19:44:41 +02:00
|
|
|
if {![hwaci-check-function-in-lib ceil m]} {
|
2024-09-25 05:37:34 +02:00
|
|
|
user-error "Cannot find libm functions. Use --disable-math to bypass this."
|
|
|
|
}
|
|
|
|
define LDFLAGS_MATH [get-define lib_ceil]
|
|
|
|
undefine lib_ceil
|
|
|
|
add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
|
2024-09-30 19:44:41 +02:00
|
|
|
msg-result "Enabling math SQL functions [get-define LDFLAGS_MATH]"
|
2024-09-25 05:37:34 +02:00
|
|
|
} {
|
|
|
|
define LDFLAGS_MATH ""
|
2024-09-25 06:20:58 +02:00
|
|
|
msg-result "Disabling math SQL functions"
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
|
|
|
|
2024-10-09 07:28:29 +02:00
|
|
|
define cross_compiling ${cross_compiling}
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-26 00:13:49 +02:00
|
|
|
# Emscripten SDK for building the web-based wasm components.
|
|
|
|
#
|
|
|
|
if {[hwaci-check-emsdk]} {
|
|
|
|
set wrapper $srcdir/tool/emcc.sh
|
|
|
|
define EMCC_WRAPPER $wrapper
|
2024-09-26 10:53:37 +02:00
|
|
|
hwaci-make-from-dot-in $wrapper
|
2024-09-26 00:13:49 +02:00
|
|
|
catch {exec chmod u+x $wrapper}
|
|
|
|
unset wrapper
|
|
|
|
} else {
|
|
|
|
define EMCC_WRAPPER ""
|
|
|
|
catch {exec rm -f $srcdir/tool/emcc.sh}
|
|
|
|
}
|
|
|
|
|
2024-10-09 07:28:29 +02:00
|
|
|
########################################################################
|
|
|
|
# Check for log(3) in libm and die with an error if it is not
|
|
|
|
# found. $why should be the feature name which requires that function
|
|
|
|
# (it's used only in error messages). defines LDFLAGS_MATH to the
|
|
|
|
# required linker flags (which may be empty even if the math APIs are
|
|
|
|
# found, depending on the OS).
|
|
|
|
proc affirm-have-math {why} {
|
2024-09-30 19:44:41 +02:00
|
|
|
if {![hwaci-check-function-in-lib log m]} {
|
2024-10-09 07:28:29 +02:00
|
|
|
user-error "Missing math APIs for $why"
|
2024-09-25 16:58:09 +02:00
|
|
|
}
|
|
|
|
define LDFLAGS_MATH [get-define lib_log ""]
|
2024-10-09 07:28:29 +02:00
|
|
|
undefine lib_log
|
2024-09-25 16:58:09 +02:00
|
|
|
}
|
|
|
|
|
2024-09-25 16:38:46 +02:00
|
|
|
########################################################################
|
|
|
|
# Handle various SQLITE_ENABLE_... feature flags.
|
|
|
|
foreach {boolFlag featureFlag ifSetEvalThis} {
|
2024-09-25 16:58:09 +02:00
|
|
|
all {} {
|
|
|
|
hwaci-opt-set fts4
|
|
|
|
hwaci-opt-set fts5
|
|
|
|
hwaci-opt-set geopoly
|
|
|
|
hwaci-opt-set rtree
|
|
|
|
hwaci-opt-set session
|
|
|
|
}
|
2024-10-09 07:28:29 +02:00
|
|
|
fts4 -DSQLITE_ENABLE_FTS4 {affirm-have-math fts4}
|
|
|
|
fts5 -DSQLITE_ENABLE_FTS5 {affirm-have-math fts5}
|
2024-09-25 16:38:46 +02:00
|
|
|
geopoly -DSQLITE_ENABLE_GEOPOLY {hwaci-opt-set rtree}
|
|
|
|
rtree -DSQLITE_ENABLE_RTREE {}
|
|
|
|
session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {}
|
|
|
|
update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {}
|
|
|
|
memsys3 {} {
|
|
|
|
if {[opt-bool memsys5]} {
|
|
|
|
msg-result "NOT enabling memsys3 because memsys5 is enabled."
|
|
|
|
} else {
|
|
|
|
add-feature-flag -DSQLITE_ENABLE_MEMSYS3
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 16:58:09 +02:00
|
|
|
memsys5 -DSQLITE_ENABLE_MEMSYS5 {}
|
2024-09-25 06:20:58 +02:00
|
|
|
} {
|
2024-09-27 14:15:14 +02:00
|
|
|
hwaci-if-opt-truthy $boolFlag {
|
2024-09-25 06:20:58 +02:00
|
|
|
add-feature-flag $featureFlag
|
2024-09-25 16:38:46 +02:00
|
|
|
eval $ifSetEvalThis
|
2024-10-09 07:28:29 +02:00
|
|
|
if {"all" ne $boolFlag} {
|
|
|
|
msg-result "Enabling $boolFlag"
|
|
|
|
}
|
2024-09-27 14:15:14 +02:00
|
|
|
} {
|
2024-09-25 16:38:46 +02:00
|
|
|
msg-result "Not enabling $boolFlag"
|
2024-09-25 06:20:58 +02:00
|
|
|
}
|
2024-09-25 08:07:54 +02:00
|
|
|
}
|
|
|
|
|
2024-09-30 19:44:41 +02:00
|
|
|
########################################################################
|
2024-10-09 06:01:14 +02:00
|
|
|
# Invert the above loop's logic for some explicit SQLITE_OMIT_...
|
|
|
|
# cases. If config option $boolFlag is set, [add-feature-flag
|
|
|
|
# $featureFlag], where $featureFlag is intended to be
|
|
|
|
# -DSQLITE_OMIT_...
|
2024-09-30 19:44:41 +02:00
|
|
|
foreach {boolFlag featureFlag} {
|
|
|
|
json -DSQLITE_OMIT_JSON
|
|
|
|
} {
|
|
|
|
if {[hwaci-opt-truthy $boolFlag]} {
|
|
|
|
msg-result "Enabling $boolFlag"
|
|
|
|
} else {
|
|
|
|
add-feature-flag $featureFlag
|
|
|
|
msg-result "Disabling $boolFlag"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-27 05:16:01 +02:00
|
|
|
# Maybe extend JimTCL a bit. As of this writing (2024-09-27) it only
|
2024-10-09 06:01:14 +02:00
|
|
|
# needs (-DHAVE_REALPATH or -DHAVE__FULLPATH) and -DHAVE_DIRENT_H to
|
|
|
|
# be compatible with our code generators. It can, however, be slightly
|
|
|
|
# extended via easy-to-detect features, should we need them.
|
2024-09-27 05:16:01 +02:00
|
|
|
if {0 && "" ne [get-define CFLAGS_JIMSH]} {
|
2024-09-27 05:04:16 +02:00
|
|
|
foreach jimFunc {opendir fsync isascii} {
|
|
|
|
if {[cc-check-functions $jimFunc]} {
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE_[string toupper $jimFunc]
|
|
|
|
}
|
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
#These are hard-coded into jimsh0.c, so we must not -D them:
|
2024-09-27 05:04:16 +02:00
|
|
|
#foreach jimDef {HAVE_UNISTD_H HAVE_DIRENT_H} {
|
|
|
|
# if {[is-defined $jimDef]} {
|
|
|
|
# define-append CFLAGS_JIMSH -D$jimDef
|
|
|
|
# }
|
|
|
|
#}
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE_LONG_LONG; # SQLite relies on long long, so we know it's available
|
|
|
|
}; # JimTCL
|
2024-09-25 16:38:46 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# Determine proper rpath-handling flags
|
|
|
|
hwaci-check-rpath
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 16:38:46 +02:00
|
|
|
# Generate the output files.
|
|
|
|
#
|
|
|
|
if {1} {
|
|
|
|
hwaci-make-from-dot-in Makefile
|
|
|
|
hwaci-make-from-dot-in sqlite3.pc
|
2024-09-27 03:00:32 +02:00
|
|
|
if {1} {
|
2024-09-27 05:04:16 +02:00
|
|
|
# for sqlite_cfg.h
|
|
|
|
define PACKAGE_URL {https://sqlite.org}
|
|
|
|
define PACKAGE_VERSION [get-define VERSION]
|
|
|
|
}
|
|
|
|
if {0} {
|
|
|
|
# Requires a hand-written sqlite_cfg.h.in...
|
2024-09-27 03:00:32 +02:00
|
|
|
hwaci-make-from-dot-in sqlite_cfg.h
|
2024-09-27 05:04:16 +02:00
|
|
|
# vs...
|
2024-09-27 03:00:32 +02:00
|
|
|
} else {
|
2024-09-27 05:04:16 +02:00
|
|
|
# Requires no input template...
|
|
|
|
make-config-header sqlite_cfg.h \
|
|
|
|
-bare {SIZEOF_* HAVE_DECL_*} \
|
2024-09-27 03:00:32 +02:00
|
|
|
-auto {HAVE_* PACKAGE_*} -none *
|
2024-09-25 16:38:46 +02:00
|
|
|
}
|
2024-09-27 03:00:32 +02:00
|
|
|
#hwaci-make-from-dot-in ext/wasm/GNUmakefile
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
|
|
|
|
2024-09-25 16:38:46 +02:00
|
|
|
set oFF [get-define OPT_FEATURE_FLAGS]
|
|
|
|
if {"" ne $oFF} {
|
|
|
|
define OPT_FEATURE_FLAGS [lsort -unique $oFF]
|
2024-09-25 06:20:58 +02:00
|
|
|
msg-result "Final feature flags: [get-define OPT_FEATURE_FLAGS]"
|
|
|
|
}
|
2024-09-28 16:51:10 +02:00
|
|
|
set oFF [get-define OPT_SHELL]
|
2024-09-27 15:29:50 +02:00
|
|
|
if {"" ne $oFF} {
|
|
|
|
msg-result "Final shell opts: [get-define OPT_SHELL]"
|
|
|
|
}
|
2024-09-25 16:38:46 +02:00
|
|
|
unset oFF
|
2024-09-25 06:20:58 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
|
|
|
# Some build-dev/debug-only output
|
2024-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy dump-defines {
|
2024-09-25 08:07:54 +02:00
|
|
|
global DUMP_DEFINES_FILE
|
|
|
|
msg-result "--dump-defines is creating file: $DUMP_DEFINES_FILE"
|
2024-09-25 16:58:09 +02:00
|
|
|
make-config-header $DUMP_DEFINES_FILE \
|
2024-09-30 16:33:36 +02:00
|
|
|
-bare {SQLITE_OS* SQLITE_DEBUG USE_*} \
|
|
|
|
-str {BIN_* CC LD AR LDFLAG* OPT_*} \
|
2024-09-25 16:58:09 +02:00
|
|
|
-auto {*}
|
2024-09-25 10:04:14 +02:00
|
|
|
# achtung: ^^^^ whichever SQLITE_OS_foo flag which is set to 0 will
|
|
|
|
# get _undefined_ here unless it's part of the -bare set.
|
2024-09-26 00:13:49 +02:00
|
|
|
if {0} {
|
2024-09-26 14:16:46 +02:00
|
|
|
foreach x [all-defines] {
|
2024-09-26 00:13:49 +02:00
|
|
|
puts "\t$x"
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-09-30 19:44:41 +02:00
|
|
|
|
|
|
|
puts {
|
|
|
|
Done! Now run "make".
|
|
|
|
}
|