diff options
author | stephan <stephan@noemail.net> | 2025-04-13 16:22:58 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2025-04-13 16:22:58 +0000 |
commit | a5198b2e13d06b87edeaae816ba5faefa05139bc (patch) | |
tree | 9ad3054cdb54945736d97f44e56b423e584a5850 | |
parent | 6b4dcad51452319111b4d6b677d311fae7ca55ce (diff) | |
download | sqlite-a5198b2e13d06b87edeaae816ba5faefa05139bc.tar.gz sqlite-a5198b2e13d06b87edeaae816ba5faefa05139bc.zip |
Latest upstream teaish, which restructures the teaish files a bit.
FossilOrigin-Name: 4f54f7d07d31938f271bc5d04a40cb1f7b5e6ea48e78ad06b7cc65483533f54e
-rw-r--r-- | autoconf/tea/auto.def | 2 | ||||
-rw-r--r-- | autoconf/tea/autosetup/README.txt | 4 | ||||
-rw-r--r-- | autoconf/tea/autosetup/core.tcl (renamed from autoconf/tea/autosetup/teaish-core.tcl) | 27 | ||||
-rw-r--r-- | autoconf/tea/autosetup/feature-tests.tcl | 480 | ||||
-rw-r--r-- | autoconf/tea/autosetup/teaish-feature-tests.tcl | 279 | ||||
-rw-r--r-- | autoconf/tea/autosetup/tester.tcl (renamed from autoconf/tea/autosetup/teaish-tester.tcl) | 9 | ||||
-rw-r--r-- | autoconf/tea/teaish.tcl | 2 | ||||
-rw-r--r-- | manifest | 24 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | tool/mkautoconfamal.sh | 6 |
10 files changed, 529 insertions, 306 deletions
diff --git a/autoconf/tea/auto.def b/autoconf/tea/auto.def index 98b53382b..861257cce 100644 --- a/autoconf/tea/auto.def +++ b/autoconf/tea/auto.def @@ -3,5 +3,5 @@ # # Main configure script entry point for the "TEA-via-autosetup" # framework. -use teaish-core +use teaish/core teaish-configure-core diff --git a/autoconf/tea/autosetup/README.txt b/autoconf/tea/autosetup/README.txt index bc0e0b2b3..e11519b04 100644 --- a/autoconf/tea/autosetup/README.txt +++ b/autoconf/tea/autosetup/README.txt @@ -1,4 +1,4 @@ The *.tcl files in this directory are part of the SQLite's "autoconf" bundle which are specific to the TEA(-ish) build. During the tarball -generation process, they are copied into <TOP>/autoconf/autosetup -(which itself is created earlier in that process). +generation process, they are copied into <TOP>/autoconf/autosetup/teaish +(which itself is created as part of that process). diff --git a/autoconf/tea/autosetup/teaish-core.tcl b/autoconf/tea/autosetup/core.tcl index bee1b35e6..e46d49503 100644 --- a/autoconf/tea/autosetup/teaish-core.tcl +++ b/autoconf/tea/autosetup/core.tcl @@ -139,10 +139,7 @@ proc teaish-configure-core {} { if {[llength [info proc teaish-options]] > 0} { # teaish-options is assumed to be imported via # TEAISH_TCL - set o [teaish-options] - if {"" ne $o} { - lappend opts {*}$o - } + set opts [teaish-combine-option-lists $opts [teaish-options]] } #lappend opts "soname:=duplicateEntry => {x}"; #just testing @@ -267,7 +264,8 @@ proc teaish__configure-phase1 {} { [join [glob -nocomplain [get-define TEAISH_DIR]/teaish.test.tcl]] #define AS_LIBDIR $::autosetup(libdir) - define TEAISH_TESTER_TCL $::autosetup(libdir)/teaish-tester.tcl + define TEAISH_LIBDIR $::autosetup(libdir)/teaish + define TEAISH_TESTER_TCL [get-define TEAISH_LIBDIR]/tester.tcl teaish__configure-finalize } @@ -914,7 +912,7 @@ proc teaish-feature-cache-set {{depth 0} val} { # @teaish-feature-cache-check ?$depth? tgtVarName # # If the feature-check cache has an entry named [proj-current-scope -# [expr {$depth+1}]] this function assigns its value to tgtVar and +# [expr {$depth+1}]] then this function assigns its value to tgtVar and # returns 1, else it assigns tgtVar to "" and returns 0. # proc teaish-feature-cache-check {{depth 0} tgtVar} { @@ -928,6 +926,23 @@ proc teaish-feature-cache-check {{depth 0} tgtVar} { return 0 } +# @teash-combine-option-lists list1 ?...listN? +# +# Expects each argument to be a list of options compatible with +# autosetup's [options] function. This function concatenates the +# contents of each list into a new top-level list, stripping the outer +# list part of each argument. The intent is that teaish-options +# implementations can use this to combine multiple lists, e.g. from +# functions teaish-check-openssl-options. +proc teaish-combine-option-lists {args} { + set rv [list] + foreach e $args { + foreach x $e { + lappend rv $x + } + } + return $rv +} # # Handles --teaish-create-extension=TARGET-DIR diff --git a/autoconf/tea/autosetup/feature-tests.tcl b/autoconf/tea/autosetup/feature-tests.tcl new file mode 100644 index 000000000..1ecdc013a --- /dev/null +++ b/autoconf/tea/autosetup/feature-tests.tcl @@ -0,0 +1,480 @@ +######################################################################## +# 2025 April 7 +# +# 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. +# +######################################################################## +# ----- @module teaish-checks.tcl ----- +# @section TEA-ish collection of feature tests. +# +# Functions in this file with a prefix of teaish__ are +# private/internal APIs. Those with a prefix of teaish- are +# public APIs. + +# @teaish-check-cached@ ?-flags? msg script +# +# Under construction. +# +# A proxy for feature-test impls which handles chacheing of the +# feature flag check on a per-caller basis, using the calling scope's +# name as the cache key. +# +# The test is performed by $script. This function caches the result +# and checks for a chache hit before running $script. The value stored +# in the cache is the final value of $script (and this routine will +# intercept a 'return' from $script). +# +# Flags: +# +# -nostatus = do not emit "ok" or "no" at the end. This presumes +# that the caller will emit a newline before turning. +proc teaish-check-cached {args} { + set quiet 0 + set xargs {} + foreach arg $args { + switch -exact -- $arg { + -nostatus { + incr quiet + } + default { + lappend xargs $arg + } + } + } + lassign $xargs msg script + if {"" eq $msg} { + set msg [proj-current-scope 1] + } + msg-checking "${msg} ... " + if {[teaish-feature-cache-check 1 check]} { + msg-checking "(cached) " + if {$check} {msg-result "ok"} else {msg-result "no"} + return $check + } else { + set code [catch {uplevel 1 $script} rc xopt] + #puts "***** ::teaish__fCache ="; parray ::teaish__fCache + if {$code in {0 2}} { + teaish-feature-cache-set 1 $rc + if {!$quiet} { + if {$rc} { + msg-result "ok" + } else { + msg-result "no" + } + } + } else { + #puts "**** code=$code rc=$rc xopt=$xopt" + teaish-feature-cache-set 1 0 + } + return -options $xopt $rc + } +} + + +# @teaish-check-libz +# +# Checks for zlib.h and the function deflate in libz. If found, +# prepends -lz to the extension's ldflags and returns 1, else returns +# 0. It also defines LDFLAGS_LIBZ to the libs flag. +# +proc teaish-check-libz {} { + teaish-check-cached "Checking for libz" { + set rc 0 + if {[msg-quiet cc-check-includes zlib.h] && [msg-quiet proj-check-function-in-lib deflate z]} { + teaish-prepend-ldflags [define LDFLAGS_LIBZ [get-define lib_deflate]] + undefine lib_deflate + incr rc + } + expr $rc + } +} + +# @teaish-check-librt ?funclist? +# +# Checks whether -lrt is needed for any of the given functions. If +# so, appends -lrt via [teaish-prepend-ldflags] and returns 1, else +# returns 0. It also defines LDFLAGS_LIBRT to the libs flag or an +# empty string. +# +# Some systems (ex: SunOS) require -lrt in order to use nanosleep. +# +proc teaish-check-librt {{funclist {fdatasync nanosleep}}} { + teaish-check-cached -nostatus "Checking whether ($funclist) need librt" { + define LDFLAGS_LIBRT "" + foreach func $funclist { + if {[msg-quiet proj-check-function-in-lib $func rt]} { + set ldrt [get-define lib_${func}] + undefine lib_${func} + if {"" ne $ldrt} { + teaish-prepend-ldflags -r [define LDFLAGS_LIBRT $ldrt] + msg-result $ldrt + return 1 + } else { + msg-result "no lib needed" + return 1 + } + } + } + msg-result "not found" + return 0 + } +} + +# @teaish-check-stdint +# +# A thin proxy for [cc-with] which checks for <stdint.h> and the +# various fixed-size int types it declares. It defines HAVE_STDINT_T +# to 0 or 1 and (if it's 1) defines HAVE_XYZ_T for each XYZ int type +# to 0 or 1, depending on whether its available. +proc teaish-check-stdint {} { + teaish-check-cached "Checking for stdint.h" { + msg-quiet 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} + } +} + +# @teaish-is-mingw +# +# Returns 1 if building for mingw, else 0. +proc teaish-is-mingw {} { + return [expr { + [string match *mingw* [get-define host]] && + ![file exists /dev/null] + }] +} + +# @teaish-check-libdl +# +# Checks for whether dlopen() can be found and whether it requires +# -ldl for linking. If found, returns 1, defines LDFLAGS_DLOPEN to the +# linker flags (if any), and passes those flags to +# teaish-prepend-ldflags. It unconditionally defines HAVE_DLOPEN to 0 +# or 1 (the its return result value). +proc teaish-check-dlopen {} { + teaish-check-cached -nostatus "Checking for dlopen()" { + set rc 0 + set lfl "" + if {[cc-with {-includes dlfcn.h} { + cctest -link 1 -declare "extern char* dlerror(void);" -code "dlerror();"}]} { + msg-result "-ldl not needed" + incr rc + } elseif {[cc-check-includes dlfcn.h]} { + incr rc + if {[cc-check-function-in-lib dlopen dl]} { + set lfl [get-define lib_dlopen] + undefine lib_dlopen + msg-result " dlopen() needs $lfl" + } else { + msg-result " - dlopen() not found in libdl. Assuming dlopen() is built-in." + } + } else { + msg-result "not found" + } + teaish-prepend-ldflags [define LDFLAGS_DLOPEN $lfl] + define HAVE_DLOPEN $rc + } +} + +######################################################################## +# Handles the --enable-math flag. +proc teaish-check-libmath {} { + teaish-check-cached "Checking for libc math library" { + set lfl "" + set rc 0 + if {[msg-quiet proj-check-function-in-lib ceil m]} { + incr rc + set lfl [get-define lib_ceil] + undefine lib_ceil + teaish-prepend-ldflags $lfl + msg-checking "$lfl " + } + define LDFLAGS_LIBMATH $lfl + expr $rc + } +} + +# @teaish-check-pkg-config-openssl +# +# Returns 1 if openssl is found via pkg-config, else 0. If found, +# passes its link flags to teaish-prepend-ldflags. +# +# It defines LDFLAGS_OPENSSL to the linker flags and CFLAGS_OPENSSL to +# the CFLAGS, or "" if it's not found. +# +# Defines HAVE_OPENSSL to 0 or 1 (its return value). +# +# If it returns true, the underlying pkg-config test will set several +# defines named PKG_OPENSSL_... (see the docs for [pkg-config] for +# details). +proc teaish-check-pkg-config-openssl {} { + use pkg-config + teaish-check-cached -nostatus "Checking for openssl via pkg-config" { + set rc 0 + if {[msg-quiet pkg-config-init 0] && [msg-quiet pkg-config openssl]} { + incr rc + set lfl [string trim "[get-define PKG_OPENSSL_LDFLAGS] [get-define PKG_OPENSSL_LIBS]"] + define CFLAGS_OPENSSL [get-define PKG_OPENSSL_CFLAGS] + define LDFLAGS_OPENSSL $lfl + teaish-prepend-ldflags $lfl + msg-result "ok ($lfl)" + } else { + define CFLAGS_OPENSSL "" + define LDFLAGS_OPENSSL "" + msg-result "no" + } + define HAVE_OPENSSL $rc + return [teaish-feature-cache-set $rc] + } +} + +# Internal helper for OpenSSL checking using cc-with to check if the +# given $cflags, $ldflags, and list of -l libs can link an +# application. +# +# For a system-level check, use empty $cflags and $ldflags. +# +# On success, it defines CFLAGS_OPENSSL to $cflags and LDFLAGS_OPENSSL +# to a combination of $ldflags and any required libs (which may be +# amended beyond those provided in $libs). It then returns 1. +# +# On failure it defines the above-mentioned flags to "" +# and returns 0. +# +# Defines HAVE_OPENSSL to its return value. +# +# Derived from https://fossil-scm.org/file/auto.def +proc teaish__check-openssl {msg cflags ldflags {libs {-lssl -lcrypto -lpthread}}} { + msg-checking "$msg ... " + set rc 0 + set isMinGw [teaish-is-mingw] + if {$isMinGw} { + lappend libs -lgdi32 -lwsock32 -lcrypt32 + } + set prefix msg-quiet + #set prefix "" + set lz "" + if {[{*}$prefix teaish-check-libz]} { + set lz [get-define LDFLAGS_LIBZ] + } + set libs2 $libs + if {$lz ne ""} { + lappend libs2 $lz + } + {*}$prefix cc-with [list -link 1 -cflags "$cflags $ldflags" -libs $libs2] { + if {[cc-check-includes openssl/ssl.h] && \ + [cc-check-functions SSL_new]} { + incr rc + } + } + if {!$rc && !$isMinGw} { + # On some systems, OpenSSL appears to require -ldl to link. + if {[{*}$prefix teaish-check-dlopen]} { + lappend libs2 [get-define LDFLAGS_DLOPEN ""] + {*}$prefix cc-with [list -link 1 -cflags "$cflags $ldflags" -libs $libs2] { + if {[cc-check-includes openssl/ssl.h] && \ + [cc-check-functions SSL_new]} { + incr rc + } + } + } + } + #puts "*???? cflags=$cflags ldflags=$ldflags libs2=$libs2" + if {$rc} { + msg-result "ok" + define CFLAGS_OPENSSL "$cflags" + define LDFLAGS_OPENSSL "$ldflags $libs2" + } else { + define CFLAGS_OPENSSL "" + define LDFLAGS_OPENSSL "" + msg-result "no" + } + define HAVE_OPENSSL $rc + return $rc +} + +# @teaish-check-openssl +# +# Jumps through some provierbial hoops to look for OpenSSL dev pieces. +# +# $where must be one of the following: +# +# - "pkg-config": check only pkg-config for it, but also verify that +# the results from pkg-config seem to work. +# +# - "system": look in standard(ish) system paths, starting with +# a lookup requiring no -L flag. +# +# - "auto" or "": try (pkg-config, system), in that order. +# +# - "none": do no lookup, define vars (see below), and return 0. +# +# - Any other value is assumed to be a directory name suitable for +# finding OpenSSL, but how this lookup is run is not currently +# well-defined. +# +# It defines LDFLAGS_OPENSSL and CFLAGS_OPENSSL to ldflags +# resp. cflags needed for compiling and linking, and updates teaish's +# internal ldflags/cflags lists. If OpenSSL is not found, they're +# defined to "". +# +# It defines HAVE_OPENSSL to 0 or 1 (its return value). +# +# If $where is empty then it defaults to auto. If $where is not empty +# _and_ OpenSSL is not found +# +# If the --with-openssl=... config flag is defined (see +# teaish-check-openssl-options) then an empty $where value will use +# the value of the --with-openssl flag, defaulting to "auto" if that +# flag also has an empty value. If that flag is provided, and has a +# value other than "none", then failure to find the library is +# considered fatal. +# +# Derived from https://fossil-scm.org/file/auto.def +proc teaish-check-openssl {{where ""}} { + teaish-check-cached -nostatus "Looking for openssl" { + if {$where eq ""} { + if {[proj-opt-exists with-openssl]} { + set where [join [opt-val with-openssl auto]] + } + } + + set notfound {{checkWithFlag msg} { + if {$checkWithFlag && [proj-opt-was-provided with-openssl]} { + proj-fatal "--with-openssl " \ + "found no working installation. Try --with-openssl=none" + } + define LDFLAGS_OPENSSL "" + define CFLAGS_OPENSSL "" + define HAVE_OPENSSL 0 + msg-result $msg + }} + + switch -exact -- $where { + none { + apply $notfound 0 none + return 0 + } + "" { + set where auto + } + } + if {$where in {pkg-config auto}} { + # Check pkg-config + if {[teaish-check-pkg-config-openssl]} { + set cflags [get-define PKG_OPENSSL_CFLAGS ""] + set ldflags [get-define LDFLAGS_OPENSSL ""] + if {[teaish__check-openssl "Verifying openssl pkg-config values" \ + "$cflags $ldflags"]} { + teaish-prepend-ldflags $ldflags + return 1 + } + } + if {$where eq "pkg-config"} { + apply $notfound 1 "not found" + return 0 + } + } + + # Determine which dirs to search... + set ssldirs {} + if {$where in {auto system}} { + set ssldirs { + {} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl + /usr/pkg /usr/local /usr /usr/local/opt/openssl + /opt/homebrew/opt/openssl + } + } elseif {$where ne ""} { + lappend ssldirs $where + } + + foreach dir $ssldirs { + set msg "in $dir" + set cflags "-I$dir/include" + if {$dir eq ""} { + set msg "without -L/path" + set ldflags "" + set cflags "" + } elseif {![file isdir $dir]} { + continue + } elseif {[file readable $dir/libssl.a]} { + set ldflags -L$dir + } elseif {[file readable $dir/lib/libssl.a]} { + set ldflags -L$dir/lib + } elseif {[file isdir $dir/lib]} { + set ldflags [list -L$dir -L$dir/lib] + } else { + set ldflags -L$dir + } + if {[teaish__check-openssl $msg $cflags $ldflags]} { + teaish-add-cflags [get-define CFLAGS_OPENSSL] + teaish-prepend-ldflags [get-define LDFLAGS_OPENSSL] + return 1 + } + if {$dir ne ""} { + # Look for a static build under $dir... + set ldflags "" + set libs [list $dir/libssl.a $dir/libcrypto.a] + set foundLibs 0 + foreach x $libs { + if {![file readlable $x]} break; + incr foundLibs + } + if {$foundLibs != [llength $libs]} { + continue + } + set cflags "-I$dir/include" + lappend libs -lpthread + if {[teaish__check-openssl "Checking for static openssl build in $dir" \ + $cflags $ldflags $libs]} { + teaish-add-cflags [get-define CFLAGS_OPENSSL] + teaish-prepend-ldflags [get-define LDFLAGS_OPENSSL] + return 1 + } + } + } + + apply $notfound 1 no + return 0 + } +}; # teaish-check-openssl + +# @teaish-check-openssl-options +# +# teaish.tcl files which use teaish-check-openssl should +# include this function's result from their teaish-options +# impl, so that configure --help can include the --with-openssl +# flag that check exposes. +# +# Returns a list of options for the teaish-check-openssl feature test. +# +# Example usage: +# +# proc teaish-options {} { +# use teaish-feature-tests +# return [teaish-combine-option-lists \ +# [teaish-check-openssl-options] \ +# { hell-world => {just testing} } \ +# ] +# } +proc teaish-check-openssl-options {} { + return { + with-openssl:see-the-help => + {Checks for OpenSSL development libraries in a variety of ways. + "pkg-config" only checks the system's pkg-config. + "system" checks only for a system-level copy. + "auto" checks the prior options and a list of + likely candidate locations. "none" disables the check + altogether and causes the check to not fail if it's + not found. Any other value is a directory in which a + _static_ copy of libssl.a can be found, e.g. a locally-built + copy of the OpenSSL source tree. If this flag is explicitly provided, + and has a value other than "none", failure to find OpenSSL + is fatal.} + } +} diff --git a/autoconf/tea/autosetup/teaish-feature-tests.tcl b/autoconf/tea/autosetup/teaish-feature-tests.tcl deleted file mode 100644 index fe5464151..000000000 --- a/autoconf/tea/autosetup/teaish-feature-tests.tcl +++ /dev/null @@ -1,279 +0,0 @@ -######################################################################## -# 2025 April 7 -# -# 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. -# -######################################################################## -# ----- @module teaish-checks.tcl ----- -# @section TEA-ish collection of feature tests. -# -# Functions in this file with a prefix of teaish__ are -# private/internal APIs. Those with a prefix of teaish- are -# public APIs. - -use pkg-config - -# @teaish-check-cached@ ?-flags? msg script -# -# Under construction. -# -# A proxy for feature-test impls which handles chacheing of the -# feature flag check on a per-caller basis, using the calling scope's -# name as the cache key. -# -# The test is performed by $script. This function caches the result -# and checks for a chache hit before running $script. The value stored -# in the cache is the final value of $script (and this routine will -# intercept a 'return' from $script). -# -# Flags: -# -# -nostatus = do not emit "ok" or "no" at the end. This presumes -# that the caller will emit a newline before turning. -proc teaish-check-cached {args} { - set quiet 0 - set xargs {} - foreach arg $args { - switch -exact -- $arg { - -nostatus { - incr quiet - } - default { - lappend xargs $arg - } - } - } - lassign $xargs msg script - if {"" eq $msg} { - set msg [proj-current-scope 1] - } - if {[teaish-feature-cache-check 1 check]} { - msg-checking "${msg} ... (cached) " - if {$check} {msg-result "ok"} else {msg-result "no"} - return $check - } else { - msg-checking "${msg} ... " - set code [catch {uplevel 1 $script} rc xopt] - #puts "***** ::teaish__fCache ="; parray ::teaish__fCache - if {$code in {0 2}} { - teaish-feature-cache-set 1 $rc - if {!$quiet} { - if {$rc} { - msg-result "ok" - } else { - msg-result "no" - } - } - #puts "**** code=$code rc=$rc xopt=$xopt" - } else { - return -options $xopt $rc - } - } -} - - -# @teaish-check-libz -# -# Checks for zlib.h and the function deflate in libz. If found, -# prepends -lz to the extension's ldflags and returns 1, else returns -# 0. It also defines LDFLAGS_LIBZ to the libs flag. -# -proc teaish-check-libz {} { - teaish-check-cached "Checking for libz" { - set rc 0 - if {[msg-quiet cc-check-includes zlib.h] && [msg-quiet proj-check-function-in-lib deflate z]} { - teaish-prepend-ldflags [define LDFLAGS_LIBZ [get-define lib_deflate]] - undefine lib_deflate - incr rc - } - expr $rc - } -} - -# @teaish-check-librt ?funclist? -# -# Checks whether -lrt is needed for any of the given functions. If -# so, appends -lrt via [teaish-prepend-ldflags] and returns 1, else -# returns 0. It also defines LDFLAGS_LIBRT to the libs flag or an -# empty string. -# -# Some systems (ex: SunOS) require -lrt in order to use nanosleep. -# -proc teaish-check-librt {{funclist {fdatasync nanosleep}}} { - teaish-check-cached -nostatus "Checking whether ($funclist) need librt" { - define LDFLAGS_LIBRT "" - foreach func $funclist { - if {[msg-quiet proj-check-function-in-lib $func rt]} { - set ldrt [get-define lib_${func}] - undefine lib_${func} - if {"" ne $ldrt} { - teaish-prepend-ldflags -r [define LDFLAGS_LIBRT $ldrt] - msg-result $ldrt - return 1 - } else { - msg-result "no lib needed" - return 1 - } - } - } - msg-result "not found" - return 0 - } -} - -# @teaish-check-stdint -# -# A thin proxy for [cc-with] which checks for <stdint.h> and the -# various fixed-size int types it declares. It defines HAVE_STDINT_T -# to 0 or 1 and (if it's 1) defines HAVE_XYZ_T for each XYZ int type -# to 0 or 1, depending on whether its available. -proc teaish-check-stdint {} { - teaish-check-cached "Checking for stdint.h" { - msg-quiet 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} - } -} - -# @teaish-is-mingw -# -# Returns 1 if building for mingw, else 0. -proc teaish-is-mingw {} { - return [expr { - [string match *mingw* [get-define host]] && - ![file exists /dev/null] - }] -} - -# @teaish-check-libdl -# -# Checks for whether dlopen() can be found and whether it requires -ldl -# for linking. If found, returns 1, defines LDFLAGS_DLOPEN to the linker flags -# (if any), and passes those flags to teaish-prepend-ldflags. -proc teaish-check-dlopen {} { - teaish-check-cached -nostatus "Checking for dlopen()" { - set rc 0 - set lfl "" - if {[cc-with {-includes dlfcn.h} { - cctest -link 1 -declare "extern char* dlerror(void);" -code "dlerror();"}]} { - msg-result "-ldl not needed" - incr rc - } elseif {[cc-check-includes dlfcn.h]} { - incr rc - if {[cc-check-function-in-lib dlopen dl]} { - set lfl [get-define lib_dlopen] - undefine lib_dlopen - msg-result " dlopen() needs $lfl" - } else { - msg-result " - dlopen() not found in libdl. Assuming dlopen() is built-in." - } - } else { - msg-result "not found" - } - teaish-prepend-ldflags [define LDFLAGS_DLOPEN $lfl] - define HAVE_DLOPEN $rc - } -} - -######################################################################## -# Handles the --enable-math flag. -proc teaish-check-libmath {} { - teaish-check-cached "Checking for libc math library" { - set lfl "" - set rc 0 - if {[msg-quiet proj-check-function-in-lib ceil m]} { - incr rc - set lfl [get-define lib_ceil] - undefine lib_ceil - teaish-prepend-ldflags $lfl - msg-checking "$lfl " - } - define LDFLAGS_LIBMATH $lfl - expr $rc - } -} - - -# @teaish-check-pkg-config-libssl -# -# Returns 1 if libssl is found via pkg-config, else 0. If found, -# passes its link flags to teaish-prepend-ldflags. Defines LDFLAGS_SSL -# to the linker flags, if found, else "". -# -# If it returns true, the underlying pkg-config test will set several -# defines named PKG_LIBSSL_... (see the docs for [pkg-config] for -# details). -proc teaish-check-pkg-config-libssl {} { - teaish-check-cached -nostatus "Checking for libssl via pkg-config" { - msg-result "Looking for libssl ..." - set lfl {} - set rc 0 - if {[msg-quiet pkg-config-init 0] && [msg-quiet pkg-config libssl]} { - lappend lfl [get-define PKG_LIBSSL_LDFLAGS] \ - [get-define PKG_LIBSSL_LIBS] - incr rc - } else { - # TODO: port over the more elaborate checks from fossil. - } - if {$rc} { - set lfl [string trim [join $lfl]] - define LDFLAGS_SSL $lfl - teaish-prepend-ldflags $lfl - } - define HAVE_LIBSSL $rc - return [teaish-feature-cache-set $rc] - } -} - -# Under construction -# -# Helper for OpenSSL checking -proc teaish__check-openssl {msg {cflags {}} {libs {-lssl -lcrypto -lpthread}}} { - msg-checking "Checking for $msg..." - set rc 0 - set isMinGw [teaish-is-mingw] - if {$isMinGw} { - lappend libs -lgdi32 -lwsock32 -lcrypt32 - } - if {[teaish-check-libz]} { - lappend libs [get-define LDFLAGS_LIBZ] - } - msg-quiet cc-with [list -cflags $cflags -libs $libs] { - if {[cc-check-includes openssl/ssl.h] && \ - [cc-check-functions SSL_new]} { - incr rc - } - } - # TODO - if {!$rc && !$isMinGw} { - # On some systems, OpenSSL appears to require -ldl to link. - if {[teaish-check-dlopen]} { - lappend libs [get-define LDFLAGS_DLOPEN ""] - msg-quiet cc-with [list -cflags $cflags -libs $libs] { - if {[cc-check-includes openssl/ssl.h] && \ - [cc-check-functions SSL_new]} { - incr rc - } - } - } - } - if {$rc} { - msg-result "ok" - } else { - msg-result "no" - } - return $rc -} - -# Under construction -proc teaish-check-libssl {} { - # Goal: port in fossil's handle-with-openssl. It's a bit of a beast. - if {![teaish-check-pkg-config-libssl]} { - #teaish__check-openssl - } -} diff --git a/autoconf/tea/autosetup/teaish-tester.tcl b/autoconf/tea/autosetup/tester.tcl index 7e5039484..f464c85a2 100644 --- a/autoconf/tea/autosetup/teaish-tester.tcl +++ b/autoconf/tea/autosetup/tester.tcl @@ -14,7 +14,12 @@ # ######################################################################## # ----- @module teaish-tester.tcl ----- -# @section TEA-ish Testing APIs +# +# @section TEA-ish Testing APIs. +# +# Though these are part of the autosup dir hierarchy, they are not +# intended to be run from autosetup code. Rather, they're for +# use with/via teaish.tester.tcl. ######################################################################## # @test-current-scope ?lvl? @@ -97,7 +102,7 @@ proc test-catch {cmd args} { if {[catch { $cmd {*}$args } rc xopts]} { - puts "[test-current-scope] ignoring failure of: $cmd [lindex $args 0]" + puts "[test-current-scope] ignoring failure of: $cmd [lindex $args 0]: $rc" #how to extract just the message text from $xopts? } } diff --git a/autoconf/tea/teaish.tcl b/autoconf/tea/teaish.tcl index f5b54ef70..56aeb9362 100644 --- a/autoconf/tea/teaish.tcl +++ b/autoconf/tea/teaish.tcl @@ -68,7 +68,7 @@ proc teaish-options {} { # work needed for this extension. # proc teaish-configure {} { - uplevel 1 {use teaish-feature-tests} + use teaish/feature-tests set srcdir [get-define TEAISH_DIR] teaish-add-src -dist -dir generic/tclsqlite3.c @@ -1,5 +1,5 @@ -C tea\sbuild:\suse\sautosetup's\sfile-normalize\sinstead\sof\sTcl's\s(file\snormalize)\sbecause\sthe\slatter\sthrows\son\scygwin\sfor\snames\slike\s'.'\sand\s'./'.\sUpdate\sa\sdoc\sURL. -D 2025-04-12T21:47:18.323 +C Latest\supstream\steaish,\swhich\srestructures\sthe\steaish\sfiles\sa\sbit. +D 2025-04-13T16:22:58.217 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -24,16 +24,16 @@ F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439 F autoconf/auto.def 3d994f3a9cc9b712dbce92a5708570ddcf3b988141b6eb738f2ed16127a9f0ac F autoconf/tea/Makefile.in 9ca3a7ccbeda98aaf4d48582905f00b7c3b30c0c2843383dc4424d1e57969c44 F autoconf/tea/README.txt 656d4686c509d375f5988ff3deda94f65fe6cd8358cd55d1f1dcc7b6e2ff73aa -F autoconf/tea/auto.def 0ee2afbdbf5289fb5ab06d8c4cc9cd6fa8cdd173cf0db962bbb66212c8dc5106 -F autoconf/tea/autosetup/README.txt 17dd4cfae6094b3c239c7ad0a437b13162481e72c60243ba482d180e34314024 -F autoconf/tea/autosetup/teaish-core.tcl f5890a83ba034ad9543bf97c7978359679a178dfaa7f391e4c7b773d80ffd6d9 -F autoconf/tea/autosetup/teaish-feature-tests.tcl 4f641aff23eb364d5483dbd2122e070ea279059cab17e24b8108598c2b5f4457 -F autoconf/tea/autosetup/teaish-tester.tcl 6ea18f15260db28961581599de6b675b5118e86da1511b5e5bffdcbbc8d3b42c +F autoconf/tea/auto.def 81e2617cfb90d53c19b53b3ec632cd2893bf32f2e5dd272b1116fadf2ea86c2d +F autoconf/tea/autosetup/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca +F autoconf/tea/autosetup/core.tcl a3b4e4521aec05ed53ce382b6fa16a49cba3636e211909d97872263b97919258 w autoconf/tea/autosetup/teaish-core.tcl +F autoconf/tea/autosetup/feature-tests.tcl 0e2893c787edb26d2d4302ea5178d4c0a6878f396905bf8fa485afb7a6fad5f0 w autoconf/tea/autosetup/teaish-feature-tests.tcl +F autoconf/tea/autosetup/tester.tcl 91beb9e26916cdb54400446e2890105cdea4186789141d5748c72b2f73b26ed0 w autoconf/tea/autosetup/teaish-tester.tcl F autoconf/tea/configure d0b12b984edca6030d1976375b80157ac78b5b90a5b4f0dcee39357f63f4a80b x F autoconf/tea/doc/sqlite3.n 9a97f4f717ceab73004ea412af7960625c1cb24b5c25e4ae4c8b5d8fa4300f4e F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in ea13b90006ef3f1205f46fbd382736fe2f364caa644cc8e958c83a78ac7fa1d1 -F autoconf/tea/teaish.tcl 2ef641703ea6ae28c42975bd052c2e2b7ac85f9b688af2c2bb1f4dbfb2fa1bb9 +F autoconf/tea/teaish.tcl f629718e52538031162dd8d74ce014a3d7d9c9f5428f59d4978da08549bdf09b F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a1414c1fb8d77f4aea6 F autoconf/tea/teaish.tester.tcl.in 743fd0fe1e667f82fd8fc3ebe0a5c77763e4dbed7bbc8605a9d4b1d0663dac78 F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4 @@ -2152,7 +2152,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a -F tool/mkautoconfamal.sh 3e9ff23d3f63ccc82097022208859ff961faf7f171041695b369b9443fb907dc +F tool/mkautoconfamal.sh 07b43da6ef5dfe4c8a119f813b997429e7237ccf537daa14e19af6e6d5a0947f F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x F tool/mkctimec.tcl f76dbfc74cefad8d126384ba3263677939f077bd184fcdf8c592a1daf64f50c3 x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 691708642bf1cac562274a6df427d7c631aa4401dfbe98711963cf89203fb104 -R 9c8fbcf9ab3d161375e30cc0f94dd9d5 +P 0fe77341a0f1e869a909623cdd07b03355b90d302b4f8a875e520befab88ce35 +R 811a32afcc86e700c429419fd06d1b5a U stephan -Z 75cf9a17534a4e6b26001cae515ab4e2 +Z 6864eb9a6caa1acee33b5cc98d2d48ee # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e74a79692..f52cfd453 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0fe77341a0f1e869a909623cdd07b03355b90d302b4f8a875e520befab88ce35 +4f54f7d07d31938f271bc5d04a40cb1f7b5e6ea48e78ad06b7cc65483533f54e diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index 7c9ee06a7..35f8dbc8c 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -73,10 +73,11 @@ rm -f ./*~ # find . -name '*~' -exec rm \{} \; #fi -mkdir -p tea/generic -mv tea/autosetup/*.tcl autosetup/. +mkdir -p autosetup/teaish +mv tea/autosetup/*.tcl autosetup/teaish/. rm -fr tea/autosetup +mkdir -p tea/generic cat <<EOF > tea/generic/tclsqlite3.c #ifdef USE_SYSTEM_SQLITE # include <sqlite3.h> @@ -87,6 +88,7 @@ EOF cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c find . -type f -name '*~' -exec rm -f \{} \; +find . -type f -name '#*#' -exec rm -f \{} \; ./configure && make dist tar xzf sqlite-$VERSION.tar.gz |