| |
| |
| |
| |
|
|
| if {[string first " " $autosetup(srcdir)] != -1} { |
| user-error "The pathname of the source tree\ |
| may not contain space characters" |
| } |
| if {[string first " " $autosetup(builddir)] != -1} { |
| user-error "The pathname of the build directory\ |
| may not contain space characters" |
| } |
|
|
| use proj |
| |
| |
| |
| |
| |
| define PACKAGE_VERSION [proj-file-content -trim $::autosetup(srcdir)/VERSION] |
| if {"--help" ni $::argv} { |
| msg-result "Configuring SQLite version [get-define PACKAGE_VERSION]" |
| } |
| use system |
| if {"--help" ni $::argv} { |
| proj-tweak-default-env-dirs |
| msg-result "Source dir = $::autosetup(srcdir)" |
| msg-result "Build dir = $::autosetup(builddir)" |
| use cc cc-db cc-shared cc-lib pkg-config |
| } |
|
|
| |
| |
| |
| array set sqliteConfig [subst [proj-strip-hash-comments { |
| |
| |
| build-mode unknown |
| |
| |
| |
| use-jim-for-codegen 0 |
| |
| |
| |
| |
| |
| is-cross-compiling [proj-is-cross-compiling] |
| |
| |
| |
| msg-debug-enabled 0 |
| |
| |
| |
| dump-defines-txt ./config.defines.txt |
| |
| |
| |
| |
| dump-defines-json "" |
|
|
| |
| |
| |
| |
| all-flag-enables {fts4 fts5 rtree geopoly session dbpage dbstat carray} |
|
|
| |
| |
| |
| |
| |
| all-flag-default 0 |
| }]] |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-configure {buildMode configScript} { |
| proj-assert {$::sqliteConfig(build-mode) eq "unknown"} \ |
| "sqlite-configure must not be called more than once" |
| set allBuildModes {canonical autoconf} |
| if {$buildMode ni $allBuildModes} { |
| user-error "Invalid build mode: $buildMode. Expecting one of: $allBuildModes" |
| } |
| if {$::sqliteConfig(all-flag-default)} { |
| set allFlagHelp "Disable these extensions: $::sqliteConfig(all-flag-enables)" |
| } else { |
| set allFlagHelp "Enable these extensions: $::sqliteConfig(all-flag-enables)" |
| } |
|
|
| set ::sqliteConfig(build-mode) $buildMode |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| set allFlags { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| build-modes { |
| {canonical autoconf} { |
| shared=1 => {Disable build of shared library} |
| static=1 => {Disable build of static library} |
| } |
| {canonical} { |
| amalgamation=1 => {Disable the amalgamation and instead build all files separately} |
| } |
| } |
|
|
| |
| lib-features { |
| {*} { |
| threadsafe=1 => {Disable mutexing} |
| with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} |
| load-extension=1 => {Disable loading of external extensions} |
| |
| |
| math=1 => {Disable math functions} |
| json=1 => {Disable JSON functions} |
| 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} |
| dbpage => {Enable the sqlite3_dbpage extension} |
| dbstat => {Enable the sqlite3_dbstat extension} |
| carray=1 => {Disable the CARRAY extension} |
| all=$::sqliteConfig(all-flag-default) => {$allFlagHelp} |
| largefile=1 |
| => {This legacy flag has no effect on the library but may influence |
| the generated sqlite_cfg.h by adding #define HAVE_LFS} |
| } |
| {canonical} { |
| column-metadata => {Enable the column metadata APIs} |
| |
| |
| } |
| } |
|
|
| |
| tcl { |
| {canonical} { |
| tcl=1 |
| => {Disable components which require TCL, including all tests. |
| This tree requires TCL for code generation but can use the in-tree |
| copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the |
| test code require a canonical tclsh.} |
| with-tcl:DIR |
| => {Directory containing tclConfig.sh or a directory one level up from |
| that, from which we can derive a directory containing tclConfig.sh. |
| A dir name of "prefix" is equivalent to the directory specified by |
| the --prefix flag.} |
| with-tclsh:PATH |
| => {Full pathname of tclsh to use. It is used for (A) trying to find |
| tclConfig.sh and (B) all TCL-based code generation. Use --with-tcl |
| unless you have a specific need for this flag. Warning: if its |
| containing dir has multiple tclsh versions, it may select the |
| wrong tclConfig.sh!} |
| static-tclsqlite3=0 |
| => {Statically-link tclsqlite3. This only works if TCL support is |
| enabled and all requisite libraries are available in |
| static form. Note that glibc is unable to fully statically |
| link certain libraries required by tclsqlite3, so this won't |
| work on most Linux environments.} |
| } |
| } |
|
|
| |
| line-editing { |
| {canonical autoconf} { |
| readline=1 |
| => {Disable readline support} |
| |
| |
| with-readline-lib: |
| with-readline-ldflags:=auto |
| => {Readline LDFLAGS, e.g. -lreadline -lncurses} |
| |
| |
| with-readline-inc: |
| with-readline-cflags:=auto |
| => {Readline CFLAGS, e.g. -I/path/to/includes} |
| with-readline-header:PATH |
| => {Full path to readline.h, from which --with-readline-cflags will be derived} |
| with-linenoise:DIR |
| => {Source directory for linenoise.c and linenoise.h} |
| editline=0 |
| => {Enable BSD editline support} |
| } |
| } |
|
|
| |
| icu { |
| {*} { |
| with-icu-ldflags:LDFLAGS |
| => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the |
| ICU libraries. e.g. on Ubuntu systems, try '-licui18n -licuuc -licudata'.} |
| with-icu-cflags:CFLAGS |
| => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. |
| e.g. -I/usr/local/include} |
| with-icu-config:=auto |
| => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, |
| /path/to/icu-config} |
| icu-collations=0 |
| => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... |
| or --with-icu-config} |
| } |
| } |
|
|
| |
| alternative-builds { |
| {canonical autoconf} { |
| with-wasi-sdk:=/opt/wasi-sdk |
| => {Top-most dir of the wasi-sdk for a WASI build} |
| } |
|
|
| {*} { |
| |
| |
| |
| |
| static-cli-shell=0 |
| => {Statically-link the sqlite3 CLI shell. |
| This only works if the requisite libraries are all available in |
| static form.} |
| } |
|
|
| {canonical} { |
| static-shells=0 |
| => {Shorthand for --static-cli-shell --static-tclsqlite3} |
|
|
| with-emsdk:=auto |
| => {Top-most dir of the Emscripten SDK installation. |
| Needed only by ext/wasm. Default=EMSDK env var.} |
|
|
| amalgamation-extra-src:FILES |
| => {Space-separated list of source files to append as-is to the resulting |
| sqlite3.c amalgamation file. May be provided multiple times.} |
| } |
| } |
|
|
| |
| packaging { |
| {autoconf} { |
| |
| |
| |
| static-shell=1 |
| => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} |
| } |
| {canonical autoconf} { |
| rpath=1 => {Disable use of the rpath linker flag} |
| |
| soname:=legacy |
| => {SONAME for libsqlite3.so. "none", or not using this flag, sets no |
| soname. "legacy" sets it to its historical value of |
| libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets |
| it to that literal value. Any other value is assumed to be a |
| suffix which gets applied to "libsqlite3.so.", |
| e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} |
| |
| dll-basename:=auto |
| => {Specifies the base name of the resulting DLL file. |
| If not provided, "libsqlite3" is usually assumed but on some platforms |
| a platform-dependent default is used. On some platforms this flag |
| gets automatically enabled if it is not provided. Use "default" to |
| explicitly disable platform-dependent activation on such systems.} |
| |
| out-implib:=auto |
| => {Enable use of --out-implib linker flag to generate an |
| "import library" for the DLL. The output's base name is |
| specified by this flag's value, with "auto" meaning to figure |
| out a name automatically. On some platforms this flag gets |
| automatically enabled if it is not provided. Use "none" to |
| explicitly disable this feature on such platforms.} |
| } |
| } |
|
|
| |
| developer { |
| {*} { |
| |
| |
| |
| |
| with-debug=0 |
| debug=0 |
| => {Enable debug build flags. This option will impact performance by |
| as much as 4x, as it includes large numbers of assert()s in |
| performance-critical loops. Never use --debug for production |
| builds.} |
| scanstatus |
| => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} |
| } |
| {canonical} { |
| dev |
| => {Enable dev-mode build: automatically enables certain other flags} |
| test-status |
| => {Enable status of tests} |
| gcov=0 |
| => {Enable coverage testing using gcov} |
| linemacros |
| => {Enable #line macros in the amalgamation} |
| dynlink-tools |
| => {Dynamically link libsqlite3 to certain tools which normally statically embed it} |
| asan-fsanitize:=auto |
| => {Comma- or space-separated list of -fsanitize flags for use with the |
| fuzzcheck-asan tool. Only those which the compiler claims to support |
| will actually be used. May be provided multiple times.} |
| } |
| {*} { |
| dump-defines=0 |
| => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) |
| (for build debugging)} |
| } |
| } |
| } |
|
|
| set allFlags [proj-strip-hash-comments $allFlags] |
| |
| |
|
|
| |
| |
| |
| |
| if {[file exists $::autosetup(libdir)/sqlite-custom.tcl]} { |
| uplevel 1 {source $::autosetup(libdir)/sqlite-custom.tcl} |
| } |
|
|
| if {[llength [info proc sqlite-custom-flags]] > 0} { |
| |
| |
| set scf [sqlite-custom-flags] |
| if {"" ne $scf} { |
| lappend allFlags sqlite-custom-flags $scf |
| } |
| } |
|
|
| |
|
|
| |
| foreach {group XY} [subst -nobackslashes -nocommands $allFlags] { |
| foreach {X Y} $XY { |
| if { $buildMode in $X || "*" in $X } { |
| options-add $Y |
| } |
| } |
| } |
|
|
| if {[catch {options {}} msg xopts]} { |
| |
| |
| |
| dict incr xopts -level |
| return {*}$xopts $msg |
| } |
| sqlite-configure-phase1 $buildMode |
| uplevel 1 $configScript |
| sqlite-configure-finalize |
| } |
|
|
| |
| |
| |
| |
| |
| proc sqlite-configure-phase1 {buildMode} { |
| define PACKAGE_NAME sqlite |
| define PACKAGE_URL {https://sqlite.org} |
| define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum |
| define PACKAGE_STRING "[get-define PACKAGE_NAME] [get-define PACKAGE_VERSION]" |
| proj-xfer-options-aliases { |
| |
| |
| |
| with-readline-inc => with-readline-cflags |
| with-readline-lib => with-readline-ldflags |
| with-debug => debug |
| } |
| set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]] |
| proc-debug "msg-debug is enabled" |
| proj-setup-autoreconfig SQLITE_AUTORECONFIG |
| proj-file-extensions |
| if {".exe" eq [get-define TARGET_EXEEXT]} { |
| define SQLITE_OS_UNIX 0 |
| define SQLITE_OS_WIN 1 |
| } else { |
| define SQLITE_OS_UNIX 1 |
| define SQLITE_OS_WIN 0 |
| } |
| sqlite-setup-default-cflags |
| define HAVE_LFS 0 |
| if {[opt-bool largefile]} { |
| |
| |
| |
| |
| |
| |
| |
| cc-check-lfs |
| } |
| set srcdir $::autosetup(srcdir) |
| proj-dot-ins-append $srcdir/Makefile.in |
| if {[file exists $srcdir/sqlite3.pc.in]} { |
| proj-dot-ins-append $srcdir/sqlite3.pc.in |
| } |
| sqlite-handle-hpux |
| } |
|
|
| |
| |
| |
| proc sqlite-configure-finalize {} { |
| sqlite-handle-rpath |
| sqlite-handle-soname |
| sqlite-handle-threadsafe |
| sqlite-handle-tempstore |
| sqlite-handle-load-extension |
| sqlite-handle-math |
| sqlite-handle-icu |
| if {[proj-opt-exists readline]} { |
| sqlite-handle-line-editing |
| } |
| if {[proj-opt-exists shared]} { |
| proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?" |
| } |
| if {[proj-opt-exists static]} { |
| if {![proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?"]} { |
| |
| proj-indented-notice { |
| NOTICE: static lib build may be implicitly re-activated by |
| other components, e.g. some test apps. |
| } |
| } |
| } |
| sqlite-handle-env-quirks |
| sqlite-handle-common-feature-flags |
| sqlite-finalize-feature-flags |
| sqlite-process-dot-in-files |
| sqlite-dump-defines |
| } |
|
|
| |
| |
| |
| proc msg-debug {msg} { |
| if {$::sqliteConfig(msg-debug-enabled)} { |
| puts stderr [proj-bold "** DEBUG: $msg"] |
| } |
| } |
| |
| |
| |
| |
| proc proc-debug {msg} { |
| msg-debug "\[[proj-scope 1]\]: $msg" |
| } |
|
|
| define OPT_FEATURE_FLAGS {} |
| |
| |
| |
| |
| |
| define OPT_SHELL { |
| -DSQLITE_DQS=0 |
| -DSQLITE_ENABLE_FTS4 |
| -DSQLITE_ENABLE_RTREE |
| -DSQLITE_ENABLE_EXPLAIN_COMMENTS |
| -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION |
| -DSQLITE_ENABLE_STMTVTAB |
| -DSQLITE_ENABLE_DBPAGE_VTAB |
| -DSQLITE_ENABLE_DBSTAT_VTAB |
| -DSQLITE_ENABLE_BYTECODE_VTAB |
| -DSQLITE_ENABLE_OFFSET_SQL_FUNC |
| -DSQLITE_ENABLE_PERCENTILE |
| -DSQLITE_STRICT_SUBTYPE=1 |
| } |
| |
| |
| |
| |
| |
| |
| proc sqlite-add-feature-flag {args} { |
| set shell "" |
| if {"-shell" eq [lindex $args 0]} { |
| set args [lassign $args shell] |
| } |
| if {"" ne $args} { |
| if {"" ne $shell} { |
| sqlite-add-shell-opt {*}$args |
| } |
| define-append OPT_FEATURE_FLAGS {*}$args |
| } |
| } |
|
|
| |
| |
| proc sqlite-add-shell-opt {args} { |
| if {"" ne $args} { |
| define-append OPT_SHELL {*}$args |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| proc sqlite-affirm-have-math {featureName} { |
| if {"" eq [get-define LDFLAGS_MATH ""]} { |
| if {![msg-quiet proj-check-function-in-lib log m]} { |
| user-error "Missing math APIs for $featureName" |
| } |
| set lfl [get-define lib_log ""] |
| undefine lib_log |
| if {"" ne $lfl} { |
| user-notice "Forcing requirement of $lfl for $featureName" |
| } |
| define LDFLAGS_MATH $lfl |
| } |
| } |
|
|
| |
| |
| |
| proc sqlite-check-common-bins {} { |
| cc-check-tools ld ar |
| if {"" eq [proj-bin-define install]} { |
| proj-warn "Cannot find install binary, so 'make install' will not work." |
| define BIN_INSTALL false |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-check-common-system-deps {} { |
| |
| cc-with {-includes stdint.h} \ |
| {cc-check-types int8_t int16_t int32_t int64_t intptr_t \ |
| uint8_t uint16_t uint32_t uint64_t uintptr_t} |
|
|
| |
| cc-check-functions gmtime_r isnan localtime_r localtime_s \ |
| usleep utime pread pread64 pwrite pwrite64 |
|
|
| apply {{} { |
| set ldrt "" |
| |
| |
| foreach func {fdatasync nanosleep} { |
| if {[proj-check-function-in-lib $func rt]} { |
| set ldrt [get-define lib_${func} ""] |
| undefine lib_${func} |
| if {"" ne $ldrt} { |
| break |
| } |
| } |
| } |
| define LDFLAGS_RT $ldrt |
| }} |
|
|
| |
| cc-check-includes \ |
| sys/types.h sys/stat.h dlfcn.h unistd.h \ |
| stdlib.h malloc.h memory.h \ |
| string.h strings.h \ |
| inttypes.h |
|
|
| if {[cc-check-includes zlib.h] && [proj-check-function-in-lib deflate z]} { |
| |
| define HAVE_ZLIB 1 |
| define LDFLAGS_ZLIB -lz |
| sqlite-add-shell-opt -DSQLITE_HAVE_ZLIB=1 |
| sqlite-add-feature-flag -DSQLITE_HAVE_ZLIB=1 |
| } else { |
| define HAVE_ZLIB 0 |
| define LDFLAGS_ZLIB "" |
| } |
| } |
|
|
| |
| |
| |
| proc sqlite-munge-cflags {} { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| foreach flagDef {CFLAGS CPPFLAGS} { |
| set tmp "" |
| foreach cf [get-define $flagDef ""] { |
| switch -glob -- $cf { |
| -DSQLITE_OMIT* - |
| -DSQLITE_ENABLE* { |
| sqlite-add-feature-flag $cf |
| } |
| default { |
| lappend tmp $cf |
| } |
| } |
| } |
| define $flagDef $tmp |
| } |
|
|
| |
| |
| set tmp "" |
| foreach cf [get-define BUILD_CFLAGS ""] { |
| switch -glob -- $cf { |
| -DSQLITE_OMIT* - |
| -DSQLITE_ENABLE* {} |
| default { |
| lappend tmp $cf |
| } |
| } |
| } |
| define BUILD_CFLAGS $tmp |
| } |
|
|
| |
| |
| proc sqlite-setup-default-cflags {} { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| set defaultCFlags {-O2} |
| if {!$::sqliteConfig(is-cross-compiling)} { |
| lappend defaultCFlags -g |
| } |
| define CFLAGS [proj-get-env CFLAGS $defaultCFlags] |
| |
| define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}] |
| sqlite-munge-cflags |
| } |
|
|
| |
| |
| proc sqlite-handle-common-feature-flags {} { |
| msg-result "Feature flags..." |
| if {![opt-bool all]} { |
| |
| foreach flag $::sqliteConfig(all-flag-enables) { |
| if {![proj-opt-was-provided $flag]} { |
| proj-opt-set $flag 0 |
| } |
| } |
| } |
| foreach {boolFlag featureFlag ifSetEvalThis} [proj-strip-hash-comments { |
| all {} { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| foreach k $::sqliteConfig(all-flag-enables) { |
| if {![proj-opt-was-provided $k]} { |
| proj-opt-set $k 1 |
| } |
| } |
| } |
| fts3 -DSQLITE_ENABLE_FTS3 {sqlite-affirm-have-math fts3} |
| fts4 -DSQLITE_ENABLE_FTS4 {sqlite-affirm-have-math fts4} |
| fts5 -DSQLITE_ENABLE_FTS5 {sqlite-affirm-have-math fts5} |
| geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree} |
| rtree -DSQLITE_ENABLE_RTREE {} |
| session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {} |
| update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {} |
| memsys5 -DSQLITE_ENABLE_MEMSYS5 {} |
| memsys3 {} { |
| if {[opt-bool memsys5]} { |
| proj-warn "not enabling memsys3 because memsys5 is enabled." |
| expr 0 |
| } else { |
| sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3 |
| } |
| } |
| bytecode-vtab -DSQLITE_ENABLE_BYTECODE_VTAB {} |
| scanstatus {-DSQLITE_ENABLE_STMT_SCANSTATUS -DSQLITE_ENABLE_BYTECODE_VTAB} {} |
| column-metadata -DSQLITE_ENABLE_COLUMN_METADATA {} |
| dbpage -DSQLITE_ENABLE_DBPAGE_VTAB {} |
| dbstat -DSQLITE_ENABLE_DBSTAT_VTAB {} |
| carray -DSQLITE_ENABLE_CARRAY {} |
| }] { |
| if {$boolFlag ni $::autosetup(options)} { |
| |
| |
| continue |
| } |
| proj-if-opt-truthy $boolFlag { |
| sqlite-add-feature-flag $featureFlag |
| if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} { |
| msg-result " + $boolFlag" |
| } |
| } { |
| if {"all" ne $boolFlag} { |
| msg-result " - $boolFlag" |
| } |
| } |
| } |
| |
| |
| |
| |
| |
| foreach {boolFlag featureFlag} { |
| json -DSQLITE_OMIT_JSON |
| } { |
| if {[proj-opt-truthy $boolFlag]} { |
| msg-result " + $boolFlag" |
| } else { |
| sqlite-add-feature-flag $featureFlag |
| msg-result " - $boolFlag" |
| } |
| } |
| } |
|
|
| |
| |
| |
| proc sqlite-finalize-feature-flags {} { |
| set oFF [get-define OPT_FEATURE_FLAGS] |
| if {"" ne $oFF} { |
| define OPT_FEATURE_FLAGS [lsort -unique $oFF] |
| msg-result "Library feature flags: [get-define OPT_FEATURE_FLAGS]" |
| } |
| set oFF [get-define OPT_SHELL] |
| if {"" ne $oFF} { |
| define OPT_SHELL [lsort -unique $oFF] |
| msg-result "Shell options: [get-define OPT_SHELL]" |
| } |
| if {"" ne [set extraSrc [get-define AMALGAMATION_EXTRA_SRC ""]]} { |
| proj-assert {"canonical" eq $::sqliteConfig(build-mode)} |
| msg-result "Appending source files to amalgamation: $extraSrc" |
| } |
| if {[lsearch [get-define TARGET_DEBUG ""] -DSQLITE_DEBUG=1] > -1} { |
| msg-result "Note: this is a debug build, so performance will suffer." |
| } |
| } |
|
|
| |
| |
| |
| |
| proc sqlite-handle-debug {} { |
| msg-checking "SQLITE_DEBUG build? " |
| proj-if-opt-truthy debug { |
| define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -O0 -Wall} |
| sqlite-add-feature-flag -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE |
| proj-opt-set memsys5 |
| msg-result yes |
| } { |
| define TARGET_DEBUG {-DNDEBUG} |
| msg-result no |
| } |
| } |
|
|
| |
| |
| |
| proc sqlite-handle-soname {} { |
| define LDFLAGS_LIBSQLITE3_SONAME "" |
| if {[proj-opt-was-provided soname]} { |
| set soname [join [opt-val soname] ""] |
| } else { |
| |
| |
| |
| |
| set soname none |
| } |
| switch -exact -- $soname { |
| none - "" { return 0 } |
| legacy { set soname libsqlite3.so.0 } |
| default { |
| if {[string match libsqlite3.* $soname]} { |
| |
| } else { |
| |
| set soname "libsqlite3.so.${soname}" |
| } |
| } |
| } |
| proc-debug "soname=$soname" |
| if {[proj-check-soname $soname]} { |
| define LDFLAGS_LIBSQLITE3_SONAME [get-define LDFLAGS_SONAME_PREFIX]$soname |
| msg-result "Setting SONAME using: [get-define LDFLAGS_LIBSQLITE3_SONAME]" |
| } elseif {[proj-opt-was-provided soname]} { |
| |
| proj-fatal "This environment does not support SONAME." |
| } else { |
| |
| msg-result "This environment does not support SONAME." |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-threadsafe {} { |
| msg-checking "Support threadsafe operation? " |
| define LDFLAGS_PTHREAD "" |
| set enable 0 |
| proj-if-opt-truthy threadsafe { |
| msg-result "Checking for libs..." |
| if {[proj-check-function-in-lib pthread_create pthread] |
| && [proj-check-function-in-lib pthread_mutexattr_init pthread]} { |
| set enable 1 |
| define LDFLAGS_PTHREAD [get-define lib_pthread_create] |
| undefine lib_pthread_create |
| undefine lib_pthread_mutexattr_init |
| } elseif {[proj-opt-was-provided threadsafe]} { |
| user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check." |
| } else { |
| msg-result "pthread support not detected" |
| } |
| |
| |
| } { |
| msg-result "Disabled using --disable-threadsafe" |
| } |
| sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable} |
| return $enable |
| } |
|
|
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-tempstore {} { |
| if {[proj-opt-was-provided with-tempstore]} { |
| set ts [opt-val with-tempstore no] |
| set tsn 1 |
| msg-checking "Use an in-RAM database for temporary tables? " |
| switch -exact -- $ts { |
| never { set tsn 0 } |
| no { set tsn 1 } |
| yes { set tsn 2 } |
| always { set tsn 3 } |
| default { |
| user-error "Invalid --with-tempstore value '$ts'. Use one of: never, no, yes, always" |
| } |
| } |
| msg-result $ts |
| sqlite-add-feature-flag -DSQLITE_TEMP_STORE=$tsn |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-emsdk {} { |
| define EMCC_WRAPPER "" |
| define BIN_WASM_STRIP "" |
| define BIN_WASM_OPT "" |
| set srcdir $::autosetup(srcdir) |
| if {$srcdir ne $::autosetup(builddir)} { |
| |
| |
| |
| |
| msg-result "Out-of tree build: not checking for EMSDK." |
| return |
| } |
| set emccSh $srcdir/tool/emcc.sh |
| set extWasmConfig $srcdir/ext/wasm/config.make |
| if {![get-define HAVE_WASI_SDK] && [proj-check-emsdk]} { |
| define EMCC_WRAPPER $emccSh |
| set emsdkHome [get-define EMSDK_HOME ""] |
| proj-assert {"" ne $emsdkHome} |
| |
| proj-bin-define wasm-strip |
| proj-bin-define bash |
| if {[file-isexec $emsdkHome/upstream/bin/wasm-opt]} { |
| define BIN_WASM_OPT $emsdkHome/upstream/bin/wasm-opt |
| } else { |
| |
| proj-bin-define wasm-opt BIN_WASM_OPT |
| } |
| proj-dot-ins-append $emccSh.in $emccSh { |
| catch {exec chmod u+x $dotInsOut} |
| } |
| proj-dot-ins-append $extWasmConfig.in $extWasmConfig |
| } else { |
| define EMCC_WRAPPER "" |
| file delete -force -- $emccSh $extWasmConfig |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-get-readline-dir-list {} { |
| |
| |
| |
| set dirs [list [get-define prefix]] |
| switch -glob -- [get-define host] { |
| *-linux-android { |
| |
| lappend dirs /data/data/com.termux/files/usr |
| } |
| *-mingw32 { |
| lappend dirs /mingw32 /mingw |
| } |
| *-mingw64 { |
| lappend dirs /mingw64 /mingw |
| } |
| *-haiku { |
| lappend dirs /boot/system/develop/headers |
| if {[opt-val with-readline-ldflags] in {auto ""}} { |
| |
| |
| |
| if {"" ne [glob -nocomplain /boot/system/lib/libreadline*]} { |
| proj-opt-set with-readline-ldflags {-L/boot/system/lib -lreadline} |
| } |
| } |
| } |
| } |
| lappend dirs /usr /usr/local /usr/local/readline /usr/contrib |
| set rv {} |
| foreach d $dirs { |
| if {[file isdir $d]} {lappend rv $d} |
| } |
| |
| return $rv |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-check-line-editing {} { |
| msg-result "Checking for line-editing capability..." |
| define HAVE_READLINE 0 |
| define HAVE_LINENOISE 0 |
| define HAVE_EDITLINE 0 |
| define LDFLAGS_READLINE "" |
| define CFLAGS_READLINE "" |
| set failIfNotFound 0 |
| |
| |
| set libsForReadline {readline edit} |
| |
| set editLibName "readline" |
| set editLibDef "HAVE_READLINE" |
| set dirLn [opt-val with-linenoise] |
| if {"" ne $dirLn} { |
| |
| if {![file isdir $dirLn]} { |
| proj-fatal "--with-linenoise value is not a directory" |
| } |
| set lnH $dirLn/linenoise.h |
| if {![file exists $lnH] } { |
| proj-fatal "Cannot find linenoise.h in $dirLn" |
| } |
| set lnC "" |
| set lnCOpts {linenoise-ship.c linenoise.c} |
| foreach f $lnCOpts { |
| if {[file exists $dirLn/$f]} { |
| set lnC $dirLn/$f |
| break |
| } |
| } |
| if {"" eq $lnC} { |
| proj-fatal "Cannot find any of $lnCOpts in $dirLn" |
| } |
| set flavor "" |
| set lnVal [proj-which-linenoise $lnH] |
| switch -- $lnVal { |
| 1 { set flavor "antirez" } |
| 2 { set flavor "msteveb" } |
| default { |
| proj-fatal "Cannot determine the flavor of linenoise from $lnH" |
| } |
| } |
| define CFLAGS_READLINE "-I$dirLn $lnC" |
| define HAVE_LINENOISE $lnVal |
| sqlite-add-shell-opt -DHAVE_LINENOISE=$lnVal |
| if {$::sqliteConfig(use-jim-for-codegen) && 2 == $lnVal} { |
| define-append CFLAGS_JIMSH -DUSE_LINENOISE [get-define CFLAGS_READLINE] |
| user-notice "Adding linenoise support to jimsh." |
| } |
| return "linenoise ($flavor)" |
| } elseif {[opt-bool editline]} { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| set failIfNotFound 1 |
| set libsForReadline {edit} |
| set editLibName editline |
| } elseif {![opt-bool readline]} { |
| msg-result "Readline support explicitly disabled with --disable-readline" |
| return "none" |
| } elseif {[proj-opt-was-provided readline]} { |
| |
| |
| set failIfNotFound 1 |
| } |
|
|
| |
| set v [opt-val with-readline-header] |
| proj-opt-set with-readline-header "" |
| if {"" ne $v} { |
| if {"auto" eq $v} { |
| proj-opt-set with-readline-cflags auto |
| } else { |
| set v [file dirname $v] |
| if {[string match */readline $v]} { |
| |
| |
| |
| set v [file dirname $v] |
| } |
| proj-opt-set with-readline-cflags "-I$v" |
| } |
| } |
|
|
| |
| set rlInc [opt-val with-readline-cflags auto] |
| if {"auto" eq $rlInc} { |
| set rlInc "" |
| if {$::sqliteConfig(is-cross-compiling)} { |
| |
| proj-warn "Skipping check for readline.h because we're cross-compiling." |
| } else { |
| set dirs [sqlite-get-readline-dir-list] |
| set subdirs [list \ |
| include/$editLibName \ |
| readline] |
| if {"editline" eq $editLibName} { |
| lappend subdirs include/readline |
| |
| |
| } |
| lappend subdirs include |
| set rlInc [proj-search-for-header-dir readline.h \ |
| -dirs $dirs -subdirs $subdirs] |
| |
| if {"" ne $rlInc} { |
| if {[string match */readline $rlInc]} { |
| set rlInc [file dirname $rlInc] |
| } elseif {[string match */editline $rlInc]} { |
| set editLibDef HAVE_EDITLINE |
| set rlInc [file dirname $rlInc] |
| } |
| set rlInc "-I${rlInc}" |
| } |
| } |
| } elseif {"" ne $rlInc && ![string match *-I* $rlInc]} { |
| proj-fatal "Argument to --with-readline-cflags is intended to be CFLAGS and contain -I..." |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| set rlLib "" |
| if {"" ne $rlInc} { |
| set rlLib [opt-val with-readline-ldflags] |
| |
| if {$rlLib in {auto ""}} { |
| set rlLib "" |
| set libTerm "" |
| if {[proj-check-function-in-lib tgetent [list $editLibName ncurses curses termcap]]} { |
| |
| set libTerm [get-define lib_tgetent] |
| undefine lib_tgetent |
| } |
| if {$editLibName eq $libTerm} { |
| |
| set rlLib $libTerm |
| } elseif {[proj-check-function-in-lib readline $libsForReadline $libTerm]} { |
| |
| set rlLib [get-define lib_readline] |
| lappend rlLib $libTerm |
| undefine lib_readline |
| } |
| } |
| } |
|
|
| |
| if {"" ne $rlLib} { |
| if {"editline" eq $editLibName && "HAVE_READLINE" eq $editLibDef} { |
| |
| |
| |
| proj-indented-notice { |
| NOTE: the local libedit uses <readline/readline.h> so we |
| will compile with -DHAVE_READLINE=1 but will link with |
| libedit. |
| } |
| } |
| set rlLib [join $rlLib] |
| set rlInc [join $rlInc] |
| define LDFLAGS_READLINE $rlLib |
| define CFLAGS_READLINE $rlInc |
| proj-assert {$editLibDef in {HAVE_READLINE HAVE_EDITLINE}} |
| proj-assert {$editLibName in {readline editline}} |
| sqlite-add-shell-opt -D${editLibDef}=1 |
| msg-result "Using $editLibName flags: $rlInc $rlLib" |
| |
| |
| if {![cctest -cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 \ |
| -source { |
| |
| |
| |
| |
| |
| |
| static char * rcg(const char *z, int i){(void)z; (void)i; return 0;} |
| int main(void) { |
| char ** x = rl_completion_matches("one", rcg); |
| (void)x; |
| return 0; |
| } |
| }]} { |
| proj-warn "readline-style completion disabled due to rl_completion_matches() signature mismatch" |
| sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION |
| } |
| return $editLibName |
| } |
|
|
| if {$failIfNotFound} { |
| proj-fatal "Explicit --$editLibName failed to find a matching library." |
| } |
| return "none" |
| } |
|
|
| |
| |
| |
| |
| |
| proc sqlite-handle-line-editing {} { |
| msg-result "Line-editing support for the sqlite3 shell: [sqlite-check-line-editing]" |
| } |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-icu {} { |
| define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]] |
| define CFLAGS_ICU [join [opt-val with-icu-cflags ""]] |
| if {[proj-opt-was-provided with-icu-config]} { |
| msg-result "Checking for ICU support..." |
| set icuConfigBin [opt-val with-icu-config] |
| set tryIcuConfigBin 1 |
| if {$icuConfigBin in {auto pkg-config}} { |
| if {[pkg-config-init 0] && [pkg-config icu-io]} { |
| |
| |
| |
| set tryIcuConfigBin 0 |
| define LDFLAGS_ICU [get-define PKG_ICU_IO_LDFLAGS] |
| define-append LDFLAGS_ICU [get-define PKG_ICU_IO_LIBS] |
| define CFLAGS_ICU [get-define PKG_ICU_IO_CFLAGS] |
| } elseif {"pkg-config" eq $icuConfigBin} { |
| proj-fatal "pkg-config cannot find package icu-io" |
| } else { |
| proj-assert {"auto" eq $icuConfigBin} |
| } |
| } |
| if {$tryIcuConfigBin} { |
| if {"auto" eq $icuConfigBin} { |
| set icuConfigBin [proj-first-bin-of \ |
| /usr/local/bin/icu-config \ |
| /usr/bin/icu-config] |
| if {"" eq $icuConfigBin} { |
| proj-indented-notice -error { |
| --with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary. |
| On Ubuntu-like systems try: |
| --with-icu-ldflags='-licui18n -licuuc -licudata' |
| } |
| } |
| } |
| if {[file-isexec $icuConfigBin]} { |
| set x [exec $icuConfigBin --ldflags] |
| if {"" eq $x} { |
| proj-indented-notice -error \ |
| [subst { |
| $icuConfigBin --ldflags returned no data. |
| On Ubuntu-like systems try: |
| --with-icu-ldflags='-licui18n -licuuc -licudata' |
| }] |
| } |
| define-append LDFLAGS_ICU $x |
| set x [exec $icuConfigBin --cppflags] |
| define-append CFLAGS_ICU $x |
| } else { |
| proj-fatal "--with-icu-config=$icuConfigBin does not refer to an executable" |
| } |
| } |
| } |
| set ldflags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]] |
| set cflags [define CFLAGS_ICU [string trim [get-define CFLAGS_ICU]]] |
| if {"" ne $ldflags} { |
| sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU |
| msg-result "Enabling ICU support with flags: $ldflags $cflags" |
| if {[opt-bool icu-collations]} { |
| msg-result "Enabling ICU collations." |
| sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU_COLLATIONS |
| |
| |
| |
| } |
| } elseif {[opt-bool icu-collations]} { |
| proj-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags" |
| } else { |
| msg-result "ICU support is disabled." |
| } |
| } |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-load-extension {} { |
| define LDFLAGS_DLOPEN "" |
| set found 0 |
| set suffix "" |
| proj-if-opt-truthy load-extension { |
| switch -glob -- [get-define host] { |
| *-*-mingw* - *windows* { |
| incr found |
| set suffix "Using LoadLibrary()" |
| } |
| default { |
| set found [proj-check-function-in-lib dlopen dl] |
| if {$found} { |
| set suffix [define LDFLAGS_DLOPEN [get-define lib_dlopen]] |
| undefine lib_dlopen |
| } else { |
| if {[proj-opt-was-provided load-extension]} { |
| |
| proj-indented-notice -error { |
| --enable-load-extension was provided but dlopen() |
| not found. Use --disable-load-extension to bypass this |
| check. |
| } |
| } else { |
| |
| proj-indented-notice { |
| WARNING: dlopen() not found, so loadable module support will |
| be disabled. Use --disable-load-extension to bypass this |
| check. |
| } |
| } |
| } |
| } |
| } |
| } |
| if {$found} { |
| msg-result "Loadable extension support enabled. $suffix" |
| } else { |
| msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them." |
| sqlite-add-feature-flag -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| } |
| return $found |
| } |
|
|
| |
| |
| proc sqlite-handle-math {} { |
| proj-if-opt-truthy math { |
| if {![proj-check-function-in-lib ceil m]} { |
| user-error "Cannot find libm functions. Use --disable-math to bypass this." |
| } |
| define LDFLAGS_MATH [get-define lib_ceil] |
| undefine lib_ceil |
| sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE |
| msg-result "Enabling math SQL functions" |
| } { |
| define LDFLAGS_MATH "" |
| msg-result "Disabling math SQL functions" |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-mac-cversion {} { |
| define LDFLAGS_MAC_CVERSION "" |
| set rc 0 |
| if {[proj-looks-like-mac]} { |
| cc-with {-link 1} { |
| |
| |
| if {[cc-check-flags "-Wl,-current_version,9.6.0"] |
| && [cc-check-flags "-Wl,-compatibility_version,9.0.0"]} { |
| define LDFLAGS_MAC_CVERSION "-Wl,-compatibility_version,9.0.0 -Wl,-current_version,9.6.0" |
| set rc 1 |
| } elseif {[cc-check-flags "-compatibility_version 9.0.0"] |
| && [cc-check-flags "-current_version 9.6.0"]} { |
| define LDFLAGS_MAC_CVERSION "-compatibility_version 9.0.0 -current_version 9.6.0" |
| set rc 1 |
| } |
| } |
| } |
| return $rc |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-mac-install-name {} { |
| define LDFLAGS_MAC_INSTALL_NAME "" |
| set rc 0 |
| if {[proj-looks-like-mac]} { |
| cc-with {-link 1} { |
| if {[cc-check-flags "-Wl,-install_name,/usr/local/lib/libsqlite3.dylib"]} { |
| define LDFLAGS_MAC_INSTALL_NAME {-Wl,-install_name,"$(install-dir.lib)/$(libsqlite3.DLL)"} |
| set rc 1 |
| } |
| } |
| } |
| return $rc |
| } |
|
|
| |
| |
| |
| proc sqlite-handle-hpux {} { |
| switch -glob -- [get-define host] { |
| *hpux* { |
| if {[cc-check-flags "-Ae"]} { |
| define-append CFLAGS -Ae |
| } |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-dll-basename {} { |
| if {[proj-opt-was-provided dll-basename]} { |
| set dn [join [opt-val dll-basename] ""] |
| if {$dn in {none default}} { set dn libsqlite3 } |
| } else { |
| set dn libsqlite3 |
| } |
| if {$dn in {auto ""}} { |
| switch -glob -- [get-define host] { |
| *-*-cygwin { set dn cygsqlite3-0 } |
| *-*-ming* { set dn libsqlite3-0 } |
| *-*-msys { set dn msys-sqlite3-0 } |
| default { set dn libsqlite3 } |
| } |
| } |
| define SQLITE_DLL_BASENAME $dn |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-out-implib {} { |
| define LDFLAGS_OUT_IMPLIB "" |
| define SQLITE_OUT_IMPLIB "" |
| set rc 0 |
| if {[proj-opt-was-provided out-implib]} { |
| set olBaseName [join [opt-val out-implib] ""] |
| if {$olBaseName in {auto ""}} { |
| set olBaseName "libsqlite3" |
| |
| |
| |
| } |
| if {$olBaseName ne "none"} { |
| cc-with {-link 1} { |
| set dll "${olBaseName}[get-define TARGET_DLLEXT]" |
| set flags [proj-cc-check-Wl-flag --out-implib ${dll}.a] |
| if {"" ne $flags} { |
| define LDFLAGS_OUT_IMPLIB $flags |
| define SQLITE_OUT_IMPLIB ${dll}.a |
| set rc 1 |
| } |
| } |
| if {!$rc} { |
| user-error "--out-implib is not supported on this platform" |
| } |
| } |
| } |
| return $rc |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-env-is-unix-on-windows {{envTuple ""}} { |
| if {"" eq $envTuple} { |
| set envTuple [get-define host] |
| } |
| set name "" |
| switch -glob -- $envTuple { |
| *-*-cygwin { set name cygwin } |
| *-*-ming* { set name mingw } |
| *-*-msys { set name msys } |
| } |
| return $name |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-env-quirks {} { |
| set instName unix-generic |
| set autoDll 0 |
| set host [get-define host] |
| switch -glob -- $host { |
| *apple* - |
| *darwin* { set instName darwin } |
| default { |
| set x [sqlite-env-is-unix-on-windows $host] |
| if {"" ne $x} { |
| set instName $x |
| set autoDll 1 |
| } |
| } |
| } |
| define SQLITE_DLL_INSTALL_RULES $instName |
| if {$autoDll} { |
| if {![proj-opt-was-provided out-implib]} { |
| |
| proj-indented-notice [subst -nocommands -nobackslashes { |
| NOTICE: auto-enabling --out-implib for environment [$host]. |
| Use --out-implib=none to disable this special case |
| or --out-implib=auto to squelch this notice. |
| }] |
| proj-opt-set out-implib auto |
| } |
| if {![proj-opt-was-provided dll-basename]} { |
| |
| proj-indented-notice [subst -nocommands -nobackslashes { |
| NOTICE: auto-enabling --dll-basename for environment [$host]. |
| Use --dll-basename=default to disable this special case |
| or --dll-basename=auto to squelch this notice. |
| }] |
| proj-opt-set dll-basename auto |
| } |
| } |
| sqlite-handle-dll-basename |
| sqlite-handle-out-implib |
| sqlite-handle-mac-cversion |
| sqlite-handle-mac-install-name |
| if {[llength [info proc sqlite-custom-handle-flags]] > 0} { |
| |
| |
| sqlite-custom-handle-flags |
| } |
| } |
|
|
| |
| |
| |
| proc sqlite-process-dot-in-files {} { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proj-remap-autoconf-dir-vars |
|
|
| proj-dot-ins-process -validate |
| make-config-header sqlite_cfg.h \ |
| -bare {SIZEOF_* HAVE_DECL_*} \ |
| -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG |
| TARGET_* USE_GCOV TCL_*} \ |
| -auto {HAVE_* PACKAGE_*} \ |
| -none * |
| proj-touch sqlite_cfg.h |
| } |
|
|
| |
| |
| |
| |
| |
| |
| proc sqlite-handle-wasi-sdk {} { |
| set wasiSdkDir [opt-val with-wasi-sdk] |
| define HAVE_WASI_SDK 0 |
| if {$wasiSdkDir eq ""} { |
| return 0 |
| } elseif {$::sqliteConfig(is-cross-compiling)} { |
| proj-fatal "Cannot combine --with-wasi-sdk with cross-compilation" |
| } |
| msg-result "Checking WASI SDK directory \[$wasiSdkDir]... " |
| proj-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld ar}] |
| define HAVE_WASI_SDK 1 |
| define WASI_SDK_DIR $wasiSdkDir |
| |
| |
| msg-result "Using wasi-sdk clang. Disabling CLI shell and modifying config flags:" |
| |
| foreach opt { |
| dynlink-tools |
| editline |
| gcov |
| icu-collations |
| load-extension |
| readline |
| shared |
| tcl |
| threadsafe |
| } { |
| if {[proj-opt-exists $opt] && [opt-bool $opt]} { |
| |
| msg-result " --disable-$opt" |
| proj-opt-set $opt 0 |
| } |
| } |
| |
| foreach opt { |
| with-emsdk |
| with-icu-config |
| with-icu-ldflags |
| with-icu-cflags |
| with-linenoise |
| with-tcl |
| } { |
| if {[proj-opt-was-provided $opt]} { |
| msg-result " removing --$opt" |
| proj-opt-set $opt "" |
| } |
| } |
| |
| |
| set ::sqliteConfig(is-cross-compiling) 1 |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| define CC "${wasiSdkDir}/bin/clang" |
| define LD "${wasiSdkDir}/bin/wasm-ld" |
| define AR "${wasiSdkDir}/bin/ar" |
| |
| return 1 |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-check-tcl {} { |
| define TCLSH_CMD false |
| define HAVE_TCL 0 |
| define TCLLIBDIR "" |
| define TCL_CONFIG_SH "" |
|
|
| |
| |
| |
| proj-tclConfig-sh-to-autosetup "" |
|
|
| file delete -force ".tclenv.sh" |
| if {![opt-bool tcl]} { |
| proj-indented-notice { |
| NOTE: TCL is disabled via --disable-tcl. This means that none |
| of the TCL-based components will be built, including tests |
| and sqlite3_analyzer. |
| } |
| return |
| } |
| |
| set srcdir $::autosetup(srcdir) |
| msg-result "Checking for a suitable tcl... " |
| proj-assert [proj-opt-truthy tcl] |
| set use_tcl 1 |
| set with_tclsh [opt-val with-tclsh] |
| set with_tcl [opt-val with-tcl] |
| if {"prefix" eq $with_tcl} { |
| set with_tcl [get-define prefix] |
| } |
| proc-debug "use_tcl ${use_tcl}" |
| proc-debug "with_tclsh=${with_tclsh}" |
| proc-debug "with_tcl=$with_tcl" |
| if {"" eq $with_tclsh && "" eq $with_tcl} { |
| # If neither --with-tclsh nor --with-tcl are provided, try to find |
| # a workable tclsh. |
| set with_tclsh [proj-first-bin-of tclsh9.1 tclsh9.0 tclsh8.6 tclsh] |
| proc-debug "with_tclsh=${with_tclsh}" |
| } |
| |
| set doConfigLookup 1 ; # set to 0 to test the tclConfig.sh-not-found cases |
| if {"" ne $with_tclsh} { |
| # --with-tclsh was provided or found above. Validate it and use it |
| # to trump any value passed via --with-tcl=DIR. |
| if {![file-isexec $with_tclsh]} { |
| proj-fatal "TCL shell $with_tclsh is not executable" |
| } else { |
| define TCLSH_CMD $with_tclsh |
| #msg-result "Using tclsh: $with_tclsh" |
| } |
| if {$doConfigLookup && |
| [catch {exec $with_tclsh $::autosetup(libdir)/find_tclconfig.tcl} result] == 0} { |
| set with_tcl $result |
| } |
| if {"" ne $with_tcl && [file isdir $with_tcl]} { |
| msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl" |
| } else { |
| proj-warn "$with_tclsh is unable to recommend a tclConfig.sh" |
| set use_tcl 0 |
| } |
| } |
| set cfg "" |
| set tclSubdirs {tcl9.1 tcl9.0 tcl8.6 lib} |
| while {$use_tcl} { |
| if {"" ne $with_tcl} { |
| # Ensure that we can find tclConfig.sh under ${with_tcl}/... |
| if {$doConfigLookup} { |
| 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} { |
| proj-fatal "No tclConfig.sh found under ${with_tcl}" |
| } |
| } else { |
| # If we have not yet found a tclConfig.sh file, look in $libdir |
| # which is set automatically by autosetup or via 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]} { |
| break |
| } |
| } |
| msg-result "Using tclConfig.sh: $cfg" |
| break |
| } |
| define TCL_CONFIG_SH $cfg |
| # Export a subset of tclConfig.sh to the current TCL-space. If $cfg |
| # is an empty string, this emits empty-string entries for the |
| # various options we're interested in. |
| proj-tclConfig-sh-to-autosetup $cfg |
| |
| if {"" eq $with_tclsh && $cfg ne ""} { |
| # We have tclConfig.sh but no tclsh. Attempt to locate a tclsh |
| # based on info from tclConfig.sh. |
| set tclExecPrefix [get-define TCL_EXEC_PREFIX] |
| proj-assert {"" ne $tclExecPrefix} |
| set tryThese [list \ |
| $tclExecPrefix/bin/tclsh[get-define TCL_VERSION] \ |
| $tclExecPrefix/bin/tclsh ] |
| foreach trySh $tryThese { |
| if {[file-isexec $trySh]} { |
| set with_tclsh $trySh |
| break |
| } |
| } |
| if {![file-isexec $with_tclsh]} { |
| proj-warn "Cannot find a usable tclsh (tried: $tryThese) |
| } |
| } |
| define TCLSH_CMD $with_tclsh |
| if {$use_tcl} { |
| |
| |
| |
| |
| |
| |
| |
| |
| set tcllibdir [get-env TCLLIBDIR ""] |
| set sq3Ver [get-define PACKAGE_VERSION] |
| if {"" eq $tcllibdir} { |
| |
| if {"" ne $with_tclsh && |
| [catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} { |
| foreach i $result { |
| if {[file isdir $i]} { |
| set tcllibdir $i/sqlite${sq3Ver} |
| break |
| } |
| } |
| } else { |
| proj-warn "Cannot determine TCLLIBDIR." |
| |
| |
| } |
| } |
| |
| define TCLLIBDIR $tcllibdir |
| } |
|
|
| if {[file-isexec $with_tclsh]} { |
| msg-result "Using tclsh: $with_tclsh" |
| if {$cfg ne ""} { |
| define HAVE_TCL 1 |
| } else { |
| proj-warn "Found tclsh but no tclConfig.sh." |
| } |
| } |
| show-notices |
| |
| |
| |
| |
| if {![get-define HAVE_TCL] && |
| ([proj-opt-was-provided tcl] || [proj-opt-was-provided with-tcl])} { |
| proj-fatal "TCL support was requested but no tclConfig.sh could be found." |
| } |
| if {"" eq $cfg} { |
| proj-assert {0 == [get-define HAVE_TCL]} |
| proj-indented-notice { |
| WARNING: Cannot find a usable tclConfig.sh file. Use |
| --with-tcl=DIR to specify a directory where tclConfig.sh can be |
| found. SQLite does not use TCL internally, but some optional |
| components require TCL, including tests and sqlite3_analyzer. |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proc sqlite-determine-codegen-tcl {} { |
| msg-result "Checking for TCL to use for code generation... " |
| define CFLAGS_JIMSH [proj-get-env CFLAGS_JIMSH {-O1}] |
| set cgtcl [opt-val with-tclsh jimsh] |
| if {"jimsh" ne $cgtcl} { |
| |
| |
| define BTCLSH "\$(TCLSH_CMD)" |
| return $cgtcl |
| } |
| set flagsToRestore {CC CFLAGS AS_CFLAGS CPPFLAGS AS_CPPFLAGS LDFLAGS LINKFLAGS LIBS CROSS} |
| define-push $flagsToRestore { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| foreach flag $flagsToRestore {define $flag ""} |
| define CC [get-define CC_FOR_BUILD] |
| |
| |
| set sysh [cc-check-includes dirent.h sys/time.h] |
| |
| |
| |
| |
| |
| |
| if {$sysh && [cc-check-functions realpath]} { |
| define-append CFLAGS_JIMSH -DHAVE_REALPATH |
| define BTCLSH "\$(JIMSH)" |
| set ::sqliteConfig(use-jim-for-codegen) 1 |
| } elseif {$sysh && [cc-check-functions _fullpath]} { |
| |
| |
| |
| |
| |
| define-append CFLAGS_JIMSH -DHAVE__FULLPATH |
| define BTCLSH "\$(JIMSH)" |
| set ::sqliteConfig(use-jim-for-codegen) 1 |
| } elseif {[file-isexec [get-define TCLSH_CMD]]} { |
| set cgtcl [get-define TCLSH_CMD] |
| define BTCLSH "\$(TCLSH_CMD)" |
| } else { |
| |
| |
| if {"" eq [get-define TCLSH_CMD]} { |
| set tpre [get-define TCL_EXEC_PREFIX] |
| if {"" ne $tpre} { |
| set tv [get-define TCL_VERSION] |
| if {[file-isexec "${tpre}/bin/tclsh${tv}"]} { |
| define TCLSH_CMD "${tpre}/bin/tclsh${tv}" |
| } elseif {[file-isexec "${tpre}/bin/tclsh"]} { |
| define TCLSH_CMD "${tpre}/bin/tclsh" |
| } |
| } |
| } |
| set cgtcl [get-define TCLSH_CMD] |
| if {![file-isexec $cgtcl]} { |
| proj-fatal "Cannot find a tclsh to use for code generation." |
| } |
| define BTCLSH "\$(TCLSH_CMD)" |
| } |
| } |
| return $cgtcl |
| } |
|
|
| |
| |
| |
| proc sqlite-handle-tcl {} { |
| sqlite-check-tcl |
| if {"canonical" ne $::sqliteConfig(build-mode)} return |
| msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]" |
|
|
| |
| |
| if {[get-define HAVE_TCL]} { |
| if {[string match *-cygwin [get-define host]]} { |
| set libname cyg |
| } else { |
| set libname lib |
| } |
| if {[get-define TCL_MAJOR_VERSION] > 8} { |
| append libname tcl9 |
| } |
| append libname sqlite |
| } else { |
| set libname "" |
| } |
| define TCL_EXT_DLL_BASENAME $libname |
| |
| } |
|
|
| |
| |
| proc sqlite-handle-rpath {} { |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| if {[proj-opt-truthy rpath]} { |
| proj-check-rpath |
| } else { |
| msg-result "Disabling use of rpath." |
| define LDFLAGS_RPATH "" |
| } |
| } |
|
|
| |
| |
| |
| proc sqlite-dump-defines {} { |
| proj-if-opt-truthy dump-defines { |
| make-config-header $::sqliteConfig(dump-defines-txt) \ |
| -bare {SQLITE_OS* SQLITE_DEBUG USE_*} \ |
| -str {BIN_* CC LD AR LDFLAG* OPT_*} \ |
| -auto {*} |
| |
| |
| if {"" ne $::sqliteConfig(dump-defines-json)} { |
| msg-result "--dump-defines is creating $::sqliteConfig(dump-defines-json)" |
| |
| |
| |
| |
| define OPT_FEATURE_FLAGS.list [get-define OPT_FEATURE_FLAGS] |
| define OPT_SHELL.list [get-define OPT_SHELL] |
| set dumpDefsOpt { |
| -bare {SIZEOF_* HAVE_DECL_*} |
| -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG TARGET_* USE_GCOV TCL_*} |
| -array {*.list} |
| -auto {OPT_* PACKAGE_* HAVE_*} |
| } |
| |
| |
| |
| |
| lappend dumpDefsOpt -none * |
| proj-dump-defs-json $::sqliteConfig(dump-defines-json) {*}$dumpDefsOpt |
| undefine OPT_FEATURE_FLAGS.list |
| undefine OPT_SHELL.list |
| } |
| } |
| } |
|
|