Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Port autoconf/tea from the autotools to autosetup. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
691708642bf1cac562274a6df427d7c6 |
User & Date: | stephan 2025-04-12 21:24:10.947 |
Context
2025-04-12
| ||
21:47 | tea build: use autosetup's file-normalize instead of Tcl's (file normalize) because JimTcl's (file normalize) throws on cygwin for names like '.' and './'. Update a doc URL. (check-in: 0fe77341a0 user: stephan tags: trunk) | |
21:24 | Port autoconf/tea from the autotools to autosetup. (check-in: 691708642b user: stephan tags: trunk) | |
19:26 | Move the post-configure dot-in-file validation from sqlite-config.tcl to proj.tcl for reuse in the tea port and other downstream trees. (check-in: 0bac496d5c user: stephan tags: trunk) | |
18:37 | Doc typo fix. (Closed-Leaf check-in: 10b917040b user: stephan tags: teaish) | |
Changes
Changes to autoconf/Makefile.in.
︙ | ︙ | |||
289 290 291 292 293 294 295 | # dist_name = sqlite-$(PACKAGE_VERSION) dist_tarball = $(dist_name).tar.gz dist: rm -fr $(dist_name) mkdir -p $(dist_name) cp -rp $(DIST_FILES) $(dist_name)/. | < | 289 290 291 292 293 294 295 296 297 298 | # dist_name = sqlite-$(PACKAGE_VERSION) dist_tarball = $(dist_name).tar.gz dist: rm -fr $(dist_name) mkdir -p $(dist_name) cp -rp $(DIST_FILES) $(dist_name)/. tar czf $(dist_tarball) $(dist_name) rm -fr $(dist_name) ls -l $(dist_tarball) |
Changes to autoconf/tea/Makefile.in.
|
| | | | | < < > > | < < | > > > | < < < < | | < < < < < | < < < < < < < < < | < < > | < < < < > > | < > > > > | < < < > > > | | | > > > > > > > > | | | > > < > | | | | < < | > > | > | | | | | | | > | | | < | | < | < < < | < | < < < < < < < > > | | < | < < | < | | | | < < | > > | | | | < > | < | > | | | | | | < > | < | > | | < > | | < < | < < > > | | < < | | > > > | > | < | | > | < < < < < | | | > | < < | < < < < | | < < | > > > > > | < < < | > > > | | | | < | > | < < < < < < | < > | < < < < > | < > > | < > > > | | > > > > > > < < < < < > > < < < < < | < > > | > | > < | < < < < > | < > | < < < < < < | < < | < > > > | < < | | < | < < | < < | > > > > > | | > | < < < < < < | < < > | > > | | < < < < > > > | < < > > | < | < > | < < | < < > < < < < < < < > > > | < > > > > > | | | < < | < | | > > > | | | < > | | < | > > > < < < < < < | | < | < < | < < < < < | < < | | | > > > | | > | < < < < < < < < < < < < | < > | < > > > > > | < | < < < < > > > | | < < < | > > > | > > > | > > > | > > > > > > > > | > > < < < < < < < > < < > | < > > | < > | < < < < < | < < | | | | | | | | | | | | | < | | < < < < < < < < | < | < | | | < > > | | < > > | < > | < > > | < < < | < > | < < | > > | < | > | > > | > | < < < > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | all: # # This makefile is part of the teaish framework, a tool for building # Tcl extensions, conceptually related to TEA/tclconfig but using the # Autosetup configuration system instead of the GNU Autotools. # # A copy of this makefile gets processed for each extension separately # and populated with info about how to build, test, and install the # extension. # # Maintenance reminder: this file needs to stay portable with POSIX # Make, not just GNU Make. Yes, that's unfortunate because it makes # some things impossible (like skipping over swathes of rules when # 'make distclean' is invoked). # CC = @CC@ INSTALL = @BIN_INSTALL@ INSTALL.noexec = $(INSTALL) -m 0644 # # Var name prefixes: # # teaish. => teaish core # tx. => teaish extension # # Vars with a "tx." or "teaish." prefix are all "public" for purposes # of the extension makefile, but the extension must not any "teaish." # vars and must only modify "tx." vars where that allowance is # specifically noted. # # Vars with a "teaish__" prefix are "private" and must not be used by # the extension makefile. They may change semantics or be removed in # any given teaish build. # tx.name = @TEAISH_NAME@ tx.pkgName = @TEAISH_PKGNAME@ tx.version = @TEAISH_VERSION@ tx.libdir = @TEAISH_LIBDIR_NAME@ tx.loadPrefix = @TEAISH_LOAD_PREFIX@ #tx.testScript = @TEAISH_TEST_TCL@ tx.tcl = @TEAISH_TCL@ tx.makefile = @TEAISH_MAKEFILE@ tx.makefile.in = @TEAISH_MAKEFILE_IN@ tx.dll8.basename = @TEAISH_DLL8_BASENAME@ tx.dll9.basename = @TEAISH_DLL9_BASENAME@ tx.dll8 = @TEAISH_DLL8@ tx.dll9 = @TEAISH_DLL9@ tx.dll = $(tx.dll$(TCL_MAJOR_VERSION)) tx.dir = @TEAISH_DIR@ teaish.dir = @abs_top_srcdir@ teaish.dir.autosetup = @TEAISH_AUTOSETUP_DIR@ teaish.makefile = Makefile teaish.makefile.in = $(teaish.dir)/Makefile.in teaish__auto.def = $(teaish.dir)/auto.def # # Autotools-conventional vars. We don't actually use these in this # makefile but some may be referenced by vars imported via # tclConfig.sh. They are part of the public API and may be reliably # depended on from teaish.make.in. # bindir = @bindir@ datadir = @datadir@ exec_prefix = @exec_prefix@ includedir = @includedir@ infodir = @infodir@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ # # Vars derived (mostly) from tclConfig.sh. These may be reliably # used from the extension makefile. # TCLSH = @TCLSH_CMD@ TCL_CONFIG_SH = @TCL_CONFIG_SH@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_VERSION = @TCL_VERSION@ TCL_MAJOR_VERSION = @TCL_MAJOR_VERSION@ TCL_MINOR_VERSION = @TCL_MINOR_VERSION@ TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_LIBS = @TCL_LIBS@ TCLLIBDIR = @TCLLIBDIR@ # # CFLAGS.configure = CFLAGS as known at configure-time. # # This ordering is deliberate: flags populated via tcl's # [teaish-add-cflags] should preceed CFLAGS and CPPFLAGS (which # typically come from the ./configure command-line invocation). # CFLAGS.configure = @SH_CFLAGS@ @TEAISH_CFLAGS@ @CFLAGS@ @CPPFLAGS@ $(TCL_INCLUDE_SPEC) #CFLAGS.configure += -DUSE_TCL_STUBS=1 # # LDFLAGS.configure = LDFLAGS as known at configure-time. # # This ordering is deliberate: flags populated via tcl's # [teaish-add-ldflags] should preceed LDFLAGS (which typically # comes from the ./configure command-line invocation). # LDFLAGS.configure = @SH_LDFLAGS@ @TEAISH_LDFLAGS@ @LDFLAGS@ $(TCL_STUB_LIB_SPEC) # # The following tx.XYZ vars may be populated/modified by teaish.tcl # and/or teaish.make. # # # tx.src is the list of source or object files to include in the # (single) compiler invocation. This will initially contain any # sources passed to [teaish-add-src], but may also be appended to # by teaish.make. # tx.src =@TEAISH_SRC@ # # tx.CFLAGS is typically set by teaish.make, whereas TEAISH_CFLAGS # gets set up via the configure script. # tx.CFLAGS = # # tx.LDFLAGS is typically set by teaish.make, whereas TEAISH_LDFLAGS # gets set up via the configure script. # tx.LDFLAGS = # # The list of 'dist' files may be appended to from teaish.make.in. # It can also be set up from teaish.tcl using [teaish-add-dist] # and/or [teaish-add-src -dist ...]. # tx.dist.files = @TEAISH_DIST_FILES@ # # May get amended with generated file names. They are cleaned up by # the 'clean' rules. Client code which wants to clean up extra stuff # should do so by adding their cleanup target (e.g. clean-extension) # as a dependency to the 'clean' target, like so: # # clean: distclean-extension # distclean: distclean-extension # teaish__cleanExtra = # # List of deps which may trigger an auto-reconfigure. # teaish__autogen.deps = \ $(tx.makefile.in) $(teaish.makefile.in) \ $(tx.tcl) $(teaish.dir)/pkgIndex.tcl.in \ @AUTODEPS@ # # Problem: when more than one target can invoke TEAISH_AUTORECONFIG, # we can get parallel reconfigures running. Thus, targets which # may require reconfigure should depend on... # config.log: $(teaish__autogen.deps) @TEAISH_AUTORECONFIG@ # ^^^ We would love to skip this when running [dist]clean, but there's # no POSIX Make-portable way to do that. GNU Make can. .PHONY: reconfigure reconfigure: @TEAISH_AUTORECONFIG@ $(teaish.makefile): $(teaish__auto.def) $(teaish.makefile.in) \ @AUTODEPS@ # # The rest of this makefile exists solely to support this brief # target: the extension shared lib. # $(tx.dll): $(tx.src) config.log $(CC) -o $@ $(CFLAGS.configure) $(CFLAGS) $(tx.CFLAGS) \ $(tx.src) $(LDFLAGS.configure) $(LDFLAGS) $(tx.LDFLAGS) all: $(tx.dll) tclsh: $(teaish.makefile) config.log @{ echo "#!/bin/sh"; echo "exec $(TCLSH) \"\$$@\""; } > $@ @chmod +x $@ @echo "Created $@" # # If the extension includes teaish.test.tcl then provide a "test" # target which which runs that script, passing it (1) the full path to # extension's DLL (which also provides the script with a way to get # the test directory) and (2) a script of test utility code intended for # sourcing by the client. # # If the extension has no test script, add a small one which # simply loads the DLL and success if it can. # # tx.tester.args = $(tx.dll) $(tx.loadPrefix) @TEAISH_TESTER_TCL@ .PHONY: test-pre test-core test test-post test-extension test-extension: # this name is reserved for use by teaish.make test-prepre: $(tx.dll) test-pre: test-prepre test-core: test-pre $(TCLSH) teaish.tester.tcl $(tx.tester.args) test-post: test-core test: test-post # # Cleanup rules... # .PHONY: clean-pre clean-core clean-post clean-extension clean-extension: # this name is reserved for use by teaish.make clean-pre: clean-core: clean-pre rm -f $(tx.dll8) $(tx.dll9) tclsh $(teaish__cleanExtra) clean-post: clean-core clean: clean-post .PHONY: distclean-pre distclean-core distclean-post clean-extension distclean-extension: # this name is reserved for use by teaish.make distclean-pre: clean distclean-core: distclean-pre rm -f Makefile pkgIndex.tcl teaish.make teaish.tester.tcl rm -f config.log config.defines.txt distclean-post: distclean-core distclean: distclean-post # # Installation rules... # .PHONY: install-pre install-core install-post install-test install-prepre install-extension install-extension: # this name is reserved for use by teaish.make install-prepre: $(tx.dll) install-pre: install-prepre install-core: install-pre @if [ ! -d "$(DESTDIR)$(TCLLIBDIR)" ]; then \ set -x; $(INSTALL) -d "$(DESTDIR)$(TCLLIBDIR)"; \ fi # ^^^^ on some platforms, install -d fails if the target already exists. $(INSTALL) $(tx.dll) "$(DESTDIR)$(TCLLIBDIR)" $(INSTALL.noexec) pkgIndex.tcl "$(DESTDIR)$(TCLLIBDIR)" @if TEAISH_PKGINIT_TCL $(INSTALL.noexec) @TEAISH_PKGINIT_TCL@ "$(DESTDIR)$(TCLLIBDIR)" @endif install-test: install-core @echo 'package require $(tx.pkgName) $(tx.version)' > $@.tcl @echo "Post-install test of [package require $(tx.pkgName) $(tx.version)]..." @if $(TCLSH) $@.tcl ; then \ echo "test passed"; \ rm -f $@.tcl; \ else \ echo "TEST FAILED"; \ rm -f $@.tcl; \ exit 1; \ fi install-post: install-test install: install-post # # Uninstall rules... # .PHONY: uninstall uninstall-pre uninstall-core uninstall-post uninstall-extension uninstall-extension: # this name is reserved for use by teaish.make uninstall-pre: uninstall-core: uninstall-pre rm -fr "$(DESTDIR)$(TCLLIBDIR)" uninstall-post: uninstall-core @echo "Uninstalled Tcl extension $(tx.name) $(tx.version)" uninstall: uninstall-post Makefile: config.log $(teaish.makefile.in) @if TEAISH_MAKEFILE $(tx.makefile): config.log @endif # # Package archive generation ("dist") rules... # @if THEAISH_OUT_OF_EXT_TREE dist: @echo "'dist' can only be used from an extension's home dir" 1>&2; \ echo "In this case: @TEAISH_DIR@" 1>&2; exit 1 undist: @else @if BIN_ZIP # Temp dir for dist.zip. Must be different than dist.tgz or else # parallel builds may hose the dist. teaish__dist.tmp.zip = teaish__dist_zip # # Make a distribution zip file... # dist.zip.dir = $(tx.name)-$(tx.version) dist.zip = $(dist.zip.dir).zip .PHONY: dist.zip dist.zip-core dist.zip-post #dist.zip-pre: # We apparently can't add a pre-hook here, even if dist.zip-pre is # .PHONY, else "make dist" rebuilds the archive each time it's run. $(dist.zip): $(tx.dist.files) @rm -fr $(teaish__dist.tmp.zip) @mkdir -p $(teaish__dist.tmp.zip)/$(dist.zip.dir) @tar cf $(teaish__dist.tmp.zip)/tmp.tar $(tx.dist.files) @tar xf $(teaish__dist.tmp.zip)/tmp.tar -C $(teaish__dist.tmp.zip)/$(dist.zip.dir) @rm -f $(dist.zip.dir)/tmp.tar $(dist.zip) @cd $(teaish__dist.tmp.zip) && zip -q -r ../$(dist.zip) $(dist.zip.dir) @rm -fr $(teaish__dist.tmp.zip) @ls -la $(dist.zip) dist.zip-core: $(dist.zip) dist.zip-post: dist.zip-core dist.zip: dist.zip-post dist: dist.zip undist-zip: rm -f $(dist.zip) undist: undist-zip @endif #BIN_ZIP @if BIN_TAR # # Make a distribution tarball... # teaish__dist.tmp.tgz = teaish__dist_tgz dist.tgz.dir = $(tx.name)-$(tx.version) dist.tgz = $(dist.tgz.dir).tar.gz .PHONY: dist.tgz dist.tgz-core dist.tgz-post # dist.tgz-pre: # see notes in dist.zip $(dist.tgz): $(tx.dist.files) @rm -fr $(teaish__dist.tmp.tgz) @mkdir -p $(teaish__dist.tmp.tgz)/$(dist.tgz.dir) @tar cf $(teaish__dist.tmp.tgz)/tmp.tar $(tx.dist.files) @tar xf $(teaish__dist.tmp.tgz)/tmp.tar -C $(teaish__dist.tmp.tgz)/$(dist.tgz.dir) @rm -f $(dist.tgz.dir)/tmp.tar $(dist.tgz) @cd $(teaish__dist.tmp.tgz) && tar czf ../$(dist.tgz) $(dist.tgz.dir) @rm -fr $(teaish__dist.tmp.tgz) @ls -la $(dist.tgz) dist.tgz-core: $(dist.tgz) dist.tgz-post: dist.tgz-core dist.tgz: dist.tgz-post dist: dist.tgz undist-tgz: rm -f $(dist.tgz) undist: undist-tgz @endif #BIN_TAR @endif #THEAISH_OUT_OF_EXT_TREE @if TEAISH_MAKEFILE # # tx.makefile defines any extension-specific state this file # needs. # # It must set the following vars if they're not already accounted for # via teaish.tcl. # # - tx.src = list of the extension's source files, being sure to # prefix each with $(tx.dir) (if it's in the same dir as the # extension) so that out-of-tree builds can find them. Optionally, # [define] TEAISH_SRC or pass them to [teaish-add-src]. # # It may optionally set the following vars: # # - tx.CFLAGS = CFLAGS/CPPFLAGS. Optionally, [define] TEAISH_CFLAGS # or pass them to [teaish-add-cflags]. # # - tx.LDFLAGS = LDFLAGS. Optionally, [define] TEAISH_LDFLAGS or # pass them to [teaish-add-ldflags]. # # It may optionally hook into various targets as documented in # /doc/extensions.md in the canonical teaish source tree. @include @TEAISH_MAKEFILE@ @endif #TEAISH_MAKEFILE @if TEAISH_MAKEFILE_CODE # # TEAISH_MAKEFILE_CODE may contain literal makefile code, which # gets pasted verbatim here. Either [define TEAISH_MAKEFILE_CODE # ...] or use [teaish-add-make] to incrementally build up this # content. # @TEAISH_MAKEFILE_CODE@ @endif #TEAISH_MAKEFILE_CODE |
Changes to autoconf/tea/README.txt.
|
| | | > > > > > > > > > > > > > > > > > > > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | This is the SQLite extension for Tcl using something akin to the Tcl Extension Architecture (TEA). To build it: ./configure ...flags... e.g.: ./configure --with-tcl=/path/to/tcl/install/root or: ./configure --with-tclsh=/path/to/tcl/install/root Run ./configure --help for the full list of flags. The configuration process will fail if tclConfig.sh cannot be found. The makefile will only honor CFLAGS and CPPFLAGS passed to the configure script, not those directly passed to the makefile. Then: make test install ----------------------- THE PREFERRED WAY --------------------------- The preferred way to build the TCL extension for SQLite is to use the canonical source code tarball. For Unix: ./configure --with-tclsh=$(TCLSH) make tclextension-install For Windows: |
︙ | ︙ |
Deleted autoconf/tea/aclocal.m4.
|
| < < < < < < < < < |
Added autoconf/tea/auto.def.
> > > > > > > | 1 2 3 4 5 6 7 | #/do/not/tclsh # ^^^ help out editors which guess this file's content type. # # Main configure script entry point for the "TEA-via-autosetup" # framework. use teaish-core teaish-configure-core |
Added autoconf/tea/autosetup/README.txt.
> > > > | 1 2 3 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). |
Added autoconf/tea/autosetup/teaish-core.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | ######################################################################## # 2025 April 5 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # * May you do good and not evil. # * May you find forgiveness for yourself and forgive others. # * May you share freely, never taking more than you give. # ######################################################################## # ----- @module teaish.tcl ----- # @section TEA-ish ((TCL Extension Architecture)-ish) # # Functions in this file with a prefix of teaish__ are # private/internal APIs. Those with a prefix of teaish- are # public APIs. # # Teaish has a hard dependency on proj.tcl, and any public API members # of that module are considered legal for use by teaish extensions. # # Project home page: https://fossil.wanderinghorse.net/r/teaish use proj define TEAISH_VERSION 0.1-beta use system ; # Will output "Host System" and "Build System" lines if {"--help" ni $::argv} { proj-tweak-default-env-dirs msg-result "Source dir = $::autosetup(srcdir)" msg-result "Build dir = $::autosetup(builddir)" msg-result "TEA-ish Version = [get-define TEAISH_VERSION]" } array set teaishConfig [proj-strip-hash-comments { # set to 1 to enable some internal debugging output debug-enabled 0 }] # # Returns true if any arg in $::argv matches the given glob, else # returns false. # proc teaish__argv-has {glob} { foreach arg $::argv { if {[string match $glob $arg]} { return 1 } } return 0 } # # Main entry point for the TEA-ish configure process. auto.def's primary # (ideally only) job should be to call this. # proc teaish-configure-core {} { # # "Declare" some defines for potential later use. # foreach f { TEAISH_MAKEFILE TEAISH_MAKEFILE_IN TEAISH_TCL TEAISH_CFLAGS TEAISH_LDFLAGS TEAISH_SRC TEAISH_DIST_FILES TEAISH_PKGINIT_TCL EXTRA_CFLAGS } { define $f {} } set gotExt 0; # True if an extension config is found if {![teaish__argv-has --teaish-create-extension*]} { set gotExt [teaish__find-extension] } if {$gotExt} { proj-assert {[file exists [get-define TEAISH_TCL]]} uplevel 1 { source [get-define TEAISH_TCL] } if {"" eq [get-define TEAISH_NAME ""]} { proj-fatal "[get-define TEAISH_TCL] did not define TEAISH_NAME" } elseif {"" eq [get-define TEAISH_VERSION ""]} { proj-fatal "[get-define TEAISH_TCL] did not define TEAISH_VERSION" } } set opts [proj-strip-hash-comments { 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.} with-tclsh:PATH => {Full pathname of tclsh to use. It is used for trying to find tclConfig.sh. Warning: if its containing dir has multiple tclsh versions, it may select the wrong tclConfig.sh!} # TEA has --with-tclinclude but it appears to only be useful for # building an extension against an uninstalled copy of TCL's own # source tree. Either we get that info from tclConfig.sh or we # give up. # # with-tclinclude:DIR # => {Specify the directory which contains the tcl.h. This should not # normally be required, as that information comes from tclConfig.sh.} # We _generally_ want to reduce the possibility of flag collisions with # extensions, and thus use a teaish-... prefix on most flags. However, # --teaish-extension-dir is frequently needed, so... # # As of this spontaneous moment, we'll formalize using using # --t-X-Y to abbreviate teaish flags when doing so is # unambiguous... t-e-d: teaish-extension-dir:DIR => {Looks for an extension in the given directory instead of the current dir.} t-c-e: teaish-create-extension:TARGET_DIRECTORY => {Writes stub files for creating an extension. Will refuse to overwrite existing files without --force.} t-f teaish-force => {Has a context-dependent meaning (autosetup defines --force for its own use)} t-d-d teaish-dump-defines => {Dump all configure-defined vars to config.defines.txt} t-d teaish-debug => {Enable teaish-specific debug output} }]; # $opts 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 } } #lappend opts "soname:=duplicateEntry => {x}"; #just testing if {[catch {options $opts} msg xopts]} { # Workaround for <https://github.com/msteveb/autosetup/issues/73> # where [options] behaves oddly on _some_ TCL builds when it's # called from deeper than the global scope. dict incr xopts -level return {*}$xopts $msg } proj-xfer-options-aliases { t-c-e => teaish-create-extension t-d => teaish-debug t-d-d => teaish-dump-defines ted => teaish-extension-dir t-e-d => teaish-extension-dir t-f => teaish-force } set ::teaishConfig(debug-enabled) [opt-bool teaish-debug] if {[proj-opt-was-provided teaish-create-extension]} { teaish__create-extension [opt-val teaish-create-extension] return } proj-assert {1==$gotExt} "Else we cannot have gotten this far" teaish__configure-phase1 } ######################################################################## # Internal config-time debugging output routine. It is not legal to # call this from the global scope. proc teaish-debug {msg} { if {$::teaishConfig(debug-enabled)} { puts stderr [proj-bold "** DEBUG: \[[proj-current-scope 1]\]: $msg"] } } proc teaish__configure-phase1 {} { msg-result \ "Configuring extension [proj-bold [get-define TEAISH_NAME] [get-define TEAISH_VERSION]]..." uplevel 1 { use cc cc-db cc-shared cc-lib; # pkg-config } teaish__check-common-bins if {"" eq [get-define TEAISH_LIBDIR_NAME]} { define TEAISH_LIBDIR_NAME [get-define TEAISH_NAME] } teaish__check-tcl apply {{} { # # If --prefix or --exec-prefix are _not_ provided, use their # TCL_... counterpart from tclConfig.sh. Caveat: by the time we can # reach this point, autosetup's system.tcl will have already done # some non-trivial amount of work with these to create various # derived values from them, so we temporarily end up with a mishmash # of autotools-compatibility var values. That will be straightened # out in the final stage of the configure script via # [proj-remap-autoconf-dir-vars]. # foreach {flag uflag tclVar} { prefix prefix TCL_PREFIX exec-prefix exec_prefix TCL_EXEC_PREFIX } { if {![proj-opt-was-provided $flag]} { set v [get-define $tclVar "???"] proj-assert {"???" ne $v} "Expecting teach-check-tcl to have defined $tclVar" proj-opt-set $flag $v define $uflag $v # ^^^ As of here, all autotools-compatibility vars which derive # from --$flag, e.g. --libdir, still derive from the default # --$flag value which was active when system.tcl was # included. So long as those flags are not explicitly passed to # the configure script, those will be straightened out via # [proj-remap-autoconf-dir-vars]. msg-result "Using \$$tclVar for --$flag=$v" } } }}; # --[exec-]prefix defaults proj-file-extensions apply {{} { set pkgname [get-define TEAISH_NAME] set pkgver [get-define TEAISH_VERSION] set libname "lib" if {[string match *-cygwin [get-define host]]} { set libname cyg } define TEAISH_DLL8_BASENAME $libname$pkgname$pkgver define TEAISH_DLL9_BASENAME ${libname}tcl9$pkgname$pkgver set ext [get-define TARGET_DLLEXT] define TEAISH_DLL8 [get-define TEAISH_DLL8_BASENAME]$ext define TEAISH_DLL9 [get-define TEAISH_DLL9_BASENAME]$ext }} if {[llength [info proc teaish-configure]] > 0} { # teaish-options is assumed to be imported via # TEAISH_TCL teaish-configure } if {[proj-looks-like-windows]} { # Without this, linking of an extension will not work on Cygwin or # Msys2. msg-result "Using USE_TCL_STUBS for Unix(ish)-on-Windows environment" teaish-add-cflags -DUSE_TCL_STUBS=1 } # # Ensure we don't have a stale pkgIndex.tcl when rebuilding for different # --with-tcl=... values. # file delete -force pkgIndex.tcl define TEAISH_TEST_TCL \ [join [glob -nocomplain [get-define TEAISH_DIR]/teaish.test.tcl]] #define AS_LIBDIR $::autosetup(libdir) define TEAISH_TESTER_TCL $::autosetup(libdir)/teaish-tester.tcl teaish__configure-finalize } proc teaish__configure-finalize {} { apply {{} { # Set up TEAISH_DIST_FILES set df {} foreach d { TEAISH_TCL TEAISH_MAKEFILE_IN TEAISH_TEST_TCL TEAISH_PKGINIT_TCL } { set x [get-define $d ""] if {"" ne $x} { lappend df [file tail $x] } } teaish-add-dist {*}$df }} foreach f { TEAISH_CFLAGS TEAISH_LDFLAGS TEAISH_SRC TEAISH_DIST_FILES } { define $f [join [get-define $f]] } define TEAISH_AUTOSETUP_DIR $::autosetup(libdir) proj-setup-autoreconfig TEAISH_AUTORECONFIG proj-dot-ins-append $::autosetup(srcdir)/Makefile.in proj-dot-ins-append $::autosetup(srcdir)/pkgIndex.tcl.in proj-dot-ins-append $::autosetup(srcdir)/teaish.tester.tcl.in set dotIns [proj-dot-ins-list] #puts "*** dotIns = $dotIns" proj-dot-ins-process; # do not [define] after this point foreach e $dotIns { proj-validate-no-unresolved-ats [lindex $e 1] } proj-if-opt-truthy teaish-dump-defines { make-config-header config.defines.txt \ -str {BIN_* CC LD AR INSTALL LDFLAG*} \ -bare {HAVE_*} \ -str {TEAISH_DIST_FILES} \ -auto {*} } # # If these are set up before call [options], it triggers an # "option already defined" error. # #proj-opt-set teaish.tcl [get-define ] #proj-opt-set teaish.make.in [get-define ] # # $::autosetup(builddir)/.configured is a workaround to prevent # concurrent executions of TEAISH_AUTORECONFIG. MUST come last in # the configure process. # #proj-file-write $::autosetup(builddir)/.configured "" } ######################################################################## # Run checks for required binaries. proc teaish__check-common-bins {} { if {"" eq [proj-bin-define install]} { proj-warn "Cannot find install binary, so 'make install' will not work." define BIN_INSTALL false } if {"" eq [proj-bin-define zip]} { proj-warn "Cannot find zip, so 'make dist.zip' will not work." } if {"" eq [proj-bin-define tar]} { proj-warn "Cannot find tar, so 'make dist.tgz' will not work." } } ######################################################################## # TCL... # # teaish__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: # # - TCLSH_CMD is the path to the canonical tclsh or "". # # - TCL_CONFIG_SH is the path to tclConfig.sh or "". # # - TCLLIBDIR is the dir to which the extension library gets # - installed. # proc teaish__check-tcl {} { define TCLSH_CMD false ; # Significant is that it exits with non-0 define TCLLIBDIR "" ; # Installation dir for TCL extension lib define TCL_CONFIG_SH ""; # full path to tclConfig.sh # Clear out all vars which would harvest from tclConfig.sh so that # the late-config validation of @VARS@ works even if --disable-tcl # is used. proj-tclConfig-sh-to-autosetup "" # TODO: better document the steps this is taking. set srcdir $::autosetup(srcdir) msg-result "Checking for a suitable tcl... " set use_tcl 1 set with_tclsh [opt-val with-tclsh] set with_tcl [opt-val with-tcl] if {0} { # This misinteracts with the $TCL_PREFIX default: it will use the # autosetup-defined --prefix default if {"prefix" eq $with_tcl} { set with_tcl [get-define prefix] } } teaish-debug "use_tcl ${use_tcl}" teaish-debug "with_tclsh=${with_tclsh}" teaish-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] teaish-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 up the TCLLIBDIR # # 2024-10-28: calculation of TCLLIBDIR is now done via the shell # in main.mk (search it for T.tcl.env.sh) so that # static/hand-written makefiles which import main.mk do not have # to define that before importing main.mk. Even so, we export # TCLLIBDIR from here, which will cause the canonical makefile to # use this one rather than to re-calculate it at make-time. set tcllibdir [get-env TCLLIBDIR ""] set extDirName [get-define TEAISH_LIBDIR_NAME] if {"" eq $tcllibdir} { # Attempt to extract TCLLIBDIR from TCL's $auto_path 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/$extDirName break } } } else { proj-fatal "Cannot determine TCLLIBDIR." } } define TCLLIBDIR $tcllibdir }; # find 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 TCL is not found: if it was explicitly requested then fail # fatally, else just emit a warning. If we can find the APIs needed # to generate a working JimTCL then that will suffice for build-time # TCL purposes (see: proc sqlite-determine-codegen-tcl). if {![file-isexec $with_tclsh]} { proj-fatal "Did not find tclsh" } elseif {"" eq $cfg} { proj-indented-notice -error { Cannot find a usable tclConfig.sh file. Use --with-tcl=DIR to specify a directory where tclConfig.sh can be found. } } }; # teaish-check-tcl # # Searches $::argv and/or the build dir and/or the source dir for # teaish.make and teaish.tcl. Fails if it cannot find one of # them. If it returns 0 then it did not find an extension but the # --help flag was seen, in which case that's not an error. # proc teaish__find-extension {} { msg-result "Looking for teaish extension..." # # We have to handle some flags manually because the extension must # be loaded before [options] is run (so that the extension can # inject its own options). # set largv {}; # rewritten $::argv set extM ""; # teaish.make.in set extT ""; # teaish.tcl set lambdaM {{f} { if {[file isdir $f]} { set f [file join $f teaish.make.in] } if {[file readable $f]} { return [file normalize $f] } return "" }} set lambdaT {{f} { if {[file isdir $f]} { set f [file join $f teaish.tcl] } if {![file readable $f]} { proj-fatal "extension tcl file is not readable: $f" } return [file normalize $f] }} # set gotNonFlag 0 foreach arg $::argv { #puts "*** arg=$arg" switch -glob -- $arg { --ted=* - --t-e-d=* - --teaish-extension-dir=* { regexp -- {--[^=]+=(.+)} $arg - extD set extD [file normalize $extD] if {![file isdir $extD]} { proj-fatal "--teaish-extension-dir value is not a directory: $extD" } set extM [apply $lambdaM [file join $extD teaish.make.in]] set extT [apply $lambdaT [file join $extD teaish.tcl]] define TEAISH_DIR $extD } default { # We'd like to treat the first non-flag argument as # --teaish-extension-dir, but autosetup does not accept args # except in the form --flag or X=Y lappend largv $arg # # --* { # lappend largv $arg # } # default { # if {$gotNonFlag || "" ne $extT} { # lappend largv $arg # } else { # incr gotNonFlag # msg-checking "Treating fist non-flag argument as --teaish-extension-dir ... " # if {[catch [set extD [file normalize $arg]]]} { # msg-result "dir name not normalizable: $arg" # lappend largv $arg # } else { # set extM [apply $lambdaM [file join $arg teaish.make.in]] # set extT [apply $lambdaT [file join $arg teaish.tcl]] # define TEAISH_DIR $extD # msg-result "$arg" # } # } # } } } } set ::argv $largv set dbld $::autosetup(builddir) set dsrc $::autosetup(srcdir) set dext [get-define TEAISH_DIR $::autosetup(builddir)] # # teaish.tcl is a TCL script which implements various # interfaces described by this framework. # # We use the first one we find in the builddir or srcdir. # if {"" eq $extT} { set flist [list $dext/teaish.tcl $dsrc/teaish.tcl] if {![proj-first-file-found $flist extT]} { if {"--help" in $::argv} { return 0 } proj-indented-notice -error " Did not find any of: $flist If you are attempting an out-of-tree build, be sure to use --teaish-extension-dir=/path/to/extension" } } if {![file readable $extT]} { proj-fatal "extension tcl file is not readable: $extT" } msg-result "Extension config = $extT" define TEAISH_TCL $extT if {"" eq [get-define TEAISH_DIR ""]} { # If this wasn't set via --teaish.dir then derive it from # --teaish.tcl. #puts "extT=$extT" define TEAISH_DIR [file dirname $extT] } # # teaish.make provides some of the info for the main makefile, # like which source(s) to build and their build flags. # # We use the first one of teaish.make.in we find in either # the builddir or the srcdir. # if {"" eq $extM} { set flist [list $dext/teaish.make.in $dsrc/teaish.make.in] proj-first-file-found $flist extM } if {"" ne $extM && [file readable $extM]} { define TEAISH_MAKEFILE_IN $extM define TEAISH_MAKEFILE [file rootname [file tail $extM]] proj-dot-ins-append $extM [get-define TEAISH_MAKEFILE] msg-result "Extension makefile = $extM" } else { define TEAISH_MAKEFILE_IN "" define TEAISH_MAKEFILE "" #proj-warn "Did not find an teaish.make.in." } set extI $dext/teaish.pkginit.tcl if {[file exists $extI]} { define TEAISH_PKGINIT_TCL $extI msg-result "Extension post-load init = $extI" #teaish-add-install $extI } # # Set some sane defaults... # define TEAISH_NAME [file tail [file dirname $extT]] define TEAISH_PKGNAME [get-define TEAISH_NAME] define TEAISH_LIBDIR_NAME [get-define TEAISH_PKGNAME] define TEAISH_VERSION 0.0.0 # THEAISH_OUT_OF_EXT_TREE = 1 if we're building from a dir other # than the extension's home dir. define THEAISH_OUT_OF_EXT_TREE \ [expr {[file normalize $::autosetup(builddir)] ne [file-normalize [get-define TEAISH_DIR]]}] # # Defines which extensions may optionally make but are not required # to. # foreach {optionalDef dflt} [subst { TEAISH_LOAD_PREFIX "[string totitle [get-define TEAISH_PKGNAME]]" TEAISH_MAKEFILE_CODE "" }] { define $optionalDef $dflt } return 1 } # Internal helper to append $args to [define-append] $def proc teaish__append_stuff {def args} { foreach a $args { if {"" ne $a} { define-append $def {*}$a } } } # @teaish-add-cflags ?-define? cflags... # # Appends all non-empty $args to TEAISH_CFLAGS # # If -define is used then each flag is assumed to be a [define]'d # symbol name and [get-define X ""] used to fetch it. proc teaish-add-cflags {args} { set isdefs 0 if {[lindex $args 0] in {-d -define}} { set args [lassign $args -] set xargs [list] foreach arg $args { lappend xargs [get-define $arg ""] } set args $xargs } teaish__append_stuff TEAISH_CFLAGS {*}$args } # @teaish-add-cflags ?-p|-prepend? ?-define? ldflags... # # Appends all non-empty $args to TEAISH_LDFLAGS unless the first # argument is one of (-p | -prepend), in which case it prepends all # arguments, in their given order, to TEAISH_LDFLAGS. # # If -define is used then each argument is assumed to be a [define]'d # flag and [get-define X ""] is used to fetch it. # # Typically, -lXYZ flags need to be in "reverse" order, with each -lY # resolving symbols for -lX's to its left. This order is largely # historical, and not relevant on all environments, but it is # technically correct and still relevant on some environments. # # See: teaish-prepend-ldflags proc teaish-add-ldflags {args} { set prepend 0 set isdefs 0 set xargs [list] foreach arg $args { switch -exact -- $arg { -p - -prepend { set prepend 1 } -d - -define { set isdefs 1 } default { lappend xargs $arg } } } set args $xargs if {$isdefs} { set xargs [list] foreach arg $args { lappend xargs [get-define $arg ""] } set args $xargs } if {$prepend} { lappend args {*}[get-define TEAISH_LDFLAGS ""] define TEAISH_LDFLAGS [join $args]; # join to eliminate {} entries } else { teaish__append_stuff TEAISH_LDFLAGS {*}$args } } # @teaish-prepend-ldflags args... # # Functionally equivalent to [teaish-add-ldflags -p {*}$args] proc teaish-prepend-ldflags {args} { teaish-add-ldflags -p {*}$args } # @teaish-add-cflags ?-dist? ?-dir? src-files... # # Appends all non-empty $args to TEAISH_SRC. # # If passed -dist then it also passes each filename, as-is, to # [teaish-add-dist]. # # If passed -dir then each src-file has the TEAISH_DIR prepended to # it for before they're added to TEAISH_SRC. As often as not, that # will be the desired behavior so that out-of-tree builds can find the # sources, but there are cases where it's not desired (e.g. when using # a source file from outside of the extension's dir). proc teaish-add-src {args} { set dist 0 set xdir 0 set i 0 foreach arg $args { switch -exact -- $arg { -dist { set dist 1 set args [lassign $args -] } -dir { set xdir 1 set args [lassign $args -] } default { #lappend xargs $arg break; } } } if {$dist} { teaish-add-dist {*}$args } if {$xdir} { set xargs {} set d [get-define TEAISH_DIR] foreach arg $args { lappend xargs $d/$arg } set args $xargs } teaish__append_stuff TEAISH_SRC {*}$args } # @teaish-add-dist files-or-dirs... # Appends all non-empty $args to TEAISH_DIST_FILES proc teaish-add-dist {args} { teaish__append_stuff TEAISH_DIST_FILES {*}$args } # teaish-add-install files... # Appends all non-empty $args to TEAISH_INSTALL_FILES #proc teaish-add-install {args} { # teaish__append_stuff TEAISH_INSTALL_FILES {*}$args #} # @teash-append-make args... # # Appends makefile code to the TEAISH_MAKEFILE_CODE define. Each # arg may be any of: # # -tab: emit a literal tab # -nl: emit a literal newline # -nltab: short for -nl -tab # -eol: emit a backslash-escaped end-of-line # -eoltab: short for -eol -tab # # Anything else is appended verbatim. This function adds no additional # spacing between each argument nor between subsequent invocations. # proc teaish-add-make {args} { set out [get-define TEAISH_MAKEFILE_CODE ""] foreach a $args { switch -exact -- $a { -eol { set a " \\\n" } -eoltab { set a " \\\n\t" } -tab { set a "\t" } -nl { set a "\n" } -nltab { set a "\n\t" } } append out $a } define TEAISH_MAKEFILE_CODE $out } # @teaish-make-config-header filename # # Invokes autosetup's [make-config-header] and passes it $filename and # a relatively generic list of options for controlling which defined # symbols get exported. Clients which need more control over the # exports can copy/paste/customize this. # # The exported file is then passed to [proj-touch] because, in # practice, that's sometimes necessary to avoid build dependency # issues. proc teaish-make-config-header {filename} { make-config-header $filename \ -bare {} \ -none {HAVE_CFLAG_* LDFLAGS_* SH_*} \ -auto {SIZEOF_* HAVE_* TEAISH_* TCL_*} \ -none * proj-touch $filename; # help avoid frequent unnecessary auto-reconfig } # internal cache for feature checks. array set teaish__fCache {} # @teaish-feature-cache-set ?$depth? value # # Sets a feature-check cache entry with a key equal to # [proj-current-scope [expr {$depth+1}]] and the given value. proc teaish-feature-cache-set {{depth 0} val} { array set ::teaish__fCache [list [proj-current-scope [expr {$depth + 1}]] $val] return $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 # returns 1, else it assigns tgtVar to "" and returns 0. # proc teaish-feature-cache-check {{depth 0} tgtVar} { upvar $tgtVar tgt set scope [proj-current-scope [expr {$depth + 1}]] if {[info exists ::teaish__fCache($scope)]} { set tgt $::teaish__fCache($scope) return 1 } set tgtVar "" return 0 } # # Handles --teaish-create-extension=TARGET-DIR # proc teaish__create-extension {dir} { set force [opt-bool teaish-force] file mkdir $dir set cwd [pwd] set dir [file normalize [file join $cwd $dir]] msg-result "Created dir $dir" cd $dir set flist {teaish.tcl} foreach f $flist { if {!$force && [file exists $f]} { error "Cowardly refusing to overwrite $dir/$f. Use --teaish-force to overwrite." } } set name [file tail $dir] set pkgName $name set version 0.0.1 set loadPrefix [string totitle $pkgName] set content "define TEAISH_NAME ${name} define TEAISH_VERSION ${version} # define TEAISH_PKGNAME ${pkgName} # define TEAISH_LIBDIR_NAME ${name} define TEAISH_LOAD_PREFIX ${loadPrefix} proc teaish-options {} {} proc teaish-configure {} { set d \[get-define TEAISH_DIR] teaish-add-src \$d/teaish.c teaish-add-dist teaish.c } " proj-file-write teaish.tcl $content msg-result "Created teaish.tcl" set content [subst -nocommands -nobackslashes { #include <tcl.h> static int ${loadPrefix}_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]){ Tcl_SetObjResult(interp, Tcl_NewStringObj("this is the ${name} extension", -1)); return TCL_OK; } extern int DLLEXPORT ${loadPrefix}_Init(Tcl_Interp *interp){ if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { return TCL_ERROR; } if (Tcl_PkgProvide(interp, "${name}", "${version}") == TCL_ERROR) { return TCL_ERROR; } Tcl_CreateObjCommand(interp, "${name}", ${loadPrefix}_Cmd, NULL, NULL); return TCL_OK; } }] proj-file-write teaish.c $content msg-result "Created teaish.c" set content "# teaish makefile for the ${name} extension # tx.src = \$(tx.dir)/teaish.c # tx.LDFLAGS = # tx.CFLAGS = " proj-file-write teaish.make.in $content msg-result "Created teaish.make.in" msg-result "Created new extension $name in \[$dir]" cd $cwd } |
Added autoconf/tea/autosetup/teaish-feature-tests.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | ######################################################################## # 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 } } |
Added autoconf/tea/autosetup/teaish-tester.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | ######################################################################## # 2025 April 5 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # * May you do good and not evil. # * May you find forgiveness for yourself and forgive others. # * May you share freely, never taking more than you give. # ######################################################################## # # Helper routines for running automated tests on teaish extensions # ######################################################################## # ----- @module teaish-tester.tcl ----- # @section TEA-ish Testing APIs ######################################################################## # @test-current-scope ?lvl? # # Returns the name of the _calling_ proc from ($lvl + 1) levels up the # call stack (where the caller's level will be 1 up from _this_ # call). If $lvl would resolve to global scope "global scope" is # returned and if it would be negative then a string indicating such # is returned (as opposed to throwing an error). proc test-current-scope {{lvl 0}} { #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} set ilvl [info level] set offset [expr {$ilvl - $lvl - 1}] if { $offset < 0} { return "invalid scope ($offset)" } elseif { $offset == 0} { return "global scope" } else { return [lindex [info level $offset] 0] } } proc test-msg {args} { puts "{*}$args" } ######################################################################## # @test-error msg # # Emits an error message to stderr and exits with non-0. proc test-fail {msg} { #puts stderr "ERROR: \[[test-current-scope 1]]: $msg" #exit 1 error "ERROR: \[[test-current-scope 1]]: $msg" } ######################################################################## # @assert script ?message? # # Kind of like a C assert: if uplevel (eval) of [expr {$script}] is # false, a fatal error is triggered. The error message, by default, # includes the body of the failed assertion, but if $msg is set then # that is used instead. proc assert {script {msg ""}} { set x "expr \{ $script \}" if {![uplevel 1 $x]} { if {"" eq $msg} { set msg $script } test-fail "Assertion failed in \[[test-current-scope 1]]: $msg" } } ######################################################################## # @test-expect testId script result # # Runs $script in the calling scope and compares its result to # $result. If they differ, it triggers an [assert]. proc test-expect {testId script result} { puts "test $testId" set x [uplevel 1 $script] assert {$x eq $result} "\nEXPECTED: <<$result>>\nGOT: <<$x>>" } ######################################################################## # @test-assert testId script ?msg? # # Works like [assert] but emits $testId to stdout first. proc test-assert {testId script {msg ""}} { puts "test $testId" assert $script $msg } ######################################################################## # @test-catch cmd ?...args? # # Runs [cmd ...args], repressing any exception except to possibly log # the failure. proc test-catch {cmd args} { if {[catch { $cmd {*}$args } rc xopts]} { puts "[test-current-scope] ignoring failure of: $cmd [lindex $args 0]" #how to extract just the message text from $xopts? } } |
Added autoconf/tea/configure.
> > > > > > > | 1 2 3 4 5 6 7 | #!/bin/sh dir0="`dirname "$0"`" dirA="$dir0/../autosetup" # This is the case ^^^^^^^^^^^^ in the SQLite "autoconf" bundle. WRAPPER="$0"; export WRAPPER; exec "`"$dirA/autosetup-find-tclsh"`" \ "$dirA/autosetup" --teaish-extension-dir="$dir0" \ "$@" |
Deleted autoconf/tea/configure.ac.in.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to autoconf/tea/pkgIndex.tcl.in.
1 | # -*- tcl -*- | > | < > | | > > > > > > > > | > | > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # -*- tcl -*- # Automatically generated - do not edit # Tcl package index file # Adapted from https://core.tcl-lang.org/tcltls if {[package vsatisfies [package provide Tcl] 9.0-]} { package ifneeded @TEAISH_PKGNAME@ @TEAISH_VERSION@ [list apply {{dir} { load [file join $dir @TEAISH_DLL9@] @TEAISH_LOAD_PREFIX@ @if TEAISH_PKGINIT_TCL set initScript [file join $dir @TEAISH_PKGINIT_TCL@] # if {[file exists $initScript]} { source -encoding utf-8 $initScript # } @endif }} $dir] } else { if {![package vsatisfies [package provide Tcl] 8.5]} {return} package ifneeded @TEAISH_PKGNAME@ @TEAISH_VERSION@ [list apply {{dir} { if {[string tolower [file extension @TEAISH_DLL8@]] in [list .dll .dylib .so]} { load [file join $dir @TEAISH_DLL8@] @TEAISH_LOAD_PREFIX@ } else { load {} @TEAISH_LOAD_PREFIX@ } @if TEAISH_PKGINIT_TCL set initScript [file join $dir @TEAISH_PKGINIT_TCL@] # if {[file exists $initScript]} { source -encoding utf-8 $initScript # } @endif }} $dir] } |
Deleted autoconf/tea/tclconfig/install-sh.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted autoconf/tea/tclconfig/tcl.m4.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Added autoconf/tea/teaish.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | # Teaish configure script extension for the SQLite TCL extension define TEAISH_NAME sqlite define TEAISH_PKGNAME sqlite3 define TEAISH_LIBDIR_NAME sqlite3 define TEAISH_LOAD_PREFIX Sqlite3; # 2nd arg to [load] # # Get the version... # define TEAISH_VERSION [proj-file-content -trim [get-define TEAISH_DIR]/../VERSION] proj-assert {[string match 3.*.* [get-define TEAISH_VERSION]]} # # Object for communicating certain config-time state across various # auto.def-related pieces. # array set sqliteConfig [subst [proj-strip-hash-comments { # # The list of feature --flags which the --all flag implies. This # requires special handling in a few places. # all-flag-enables {fts3 fts4 fts5 rtree geopoly} }]] # # Must return either an empty string or a list in the form accepted by # autosetup's [options] function. # proc teaish-options {} { return [proj-strip-hash-comments [subst -nocommands -nobackslashes { with-system-sqlite=0 => {Use the system-level sqlite instead of the copy in this tree. WARNING: this extension's version is taken from the in-tree copy and there is no reliable way to get the version of a system-level copy without knowing exactly where it lives (which this script does not)} override-sqlite-version:VERSION => {For use with --with-system-sqlite to set the version number.} threadsafe=1 => {Disable mutexing} with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} load-extension=0 => {Enable loading of external extensions} math=1 => {Disable math functions} json=1 => {Disable JSON functions} 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} all=1 => {Disable $::sqliteConfig(all-flag-enables)} 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} }]] } # # Gets called by tea-configure-core. Must perform any configuration # work needed for this extension. # proc teaish-configure {} { uplevel 1 {use teaish-feature-tests} set srcdir [get-define TEAISH_DIR] teaish-add-src -dist -dir generic/tclsqlite3.c teaish-add-cflags -I${srcdir}/.. ; # for sqlite3.c if {[proj-opt-was-provided override-sqlite-version]} { define TEAISH_VERSION [opt-val override-sqlite-version] msg-result "NOTICE: overriding version number: [get-define TEAISH_VERSION]" } define CFLAGS [proj-get-env CFLAGS {-O2}] sqlite-munge-cflags # # Add feature flags from legacy configure.ac which are not covered by # --flags. # sqlite-add-feature-flag { -DSQLITE_3_SUFFIX_ONLY=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_BYTECODE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 } if {[opt-bool with-system-sqlite]} { msg-result "Using system-level sqlite3." teaish-add-cflags -DUSE_SYSTEM_SQLITE teaish-add-ldflags -lsqlite3 } sqlite-check-common-system-deps sqlite-handle-threadsafe sqlite-handle-tempstore sqlite-handle-load-extension sqlite-handle-math sqlite-handle-icu sqlite-handle-common-feature-flags teaish-add-ldflags -p -d \ LDFLAGS_LIBICU LDFLAGS_LIBMATH LDFLAGS_DLOPEN \ LDFLAGS_LIBRT teaish-add-cflags -define CFLAGS_LIBICU OPT_FEATURE_FLAGS }; # teaish-configure define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags. ######################################################################## # Adds $args, if not empty, to OPT_FEATURE_FLAGS. This is intended only for holding # -DSQLITE_ENABLE/OMIT/... flags, but that is not enforced here. proc sqlite-add-feature-flag {args} { if {"" ne $args} { define-append OPT_FEATURE_FLAGS {*}$args } } ######################################################################## # Check for log(3) in libm and die with an error if it is not # found. $featureName should be the feature name which requires that # function (it's used only in error messages). defines LDFLAGS_MATH to # the required linker flags (which may be empty even if the math APIs # are found, depending on the OS). proc 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" } define LDFLAGS_MATH [get-define lib_log ""] undefine lib_log } } ######################################################################## # Handle various SQLITE_ENABLE/OMIT_... feature flags. proc sqlite-handle-common-feature-flags {} { msg-result "Feature flags..." if {![opt-bool all]} { # Special handling for --disable-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 {} { # The 'all' option must be first in this list. This impl makes # an effort to only apply flags which the user did not already # apply, so that combinations like (--all --disable-geopoly) # will indeed disable geopoly. There are corner cases where # flags which depend on each other will behave in non-intuitive # ways: # # --all --disable-rtree # # Will NOT disable geopoly, though geopoly depends on rtree. # The --geopoly flag, though, will automatically re-enable # --rtree, so --disable-rtree won't actually disable anything in # that case. 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 {} scanstatus -DSQLITE_ENABLE_STMT_SCANSTATUS {} }] { if {$boolFlag ni $::autosetup(options)} { # Skip flags which are in the canonical build but not # the autoconf bundle. 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" } } } ######################################################################## # Invert the above loop's logic for some SQLITE_OMIT_... cases. If # config option $boolFlag is false, [sqlite-add-feature-flag # $featureFlag], where $featureFlag is intended to be # -DSQLITE_OMIT_... foreach {boolFlag featureFlag} { json -DSQLITE_OMIT_JSON } { if {[proj-opt-truthy $boolFlag]} { msg-result " + $boolFlag" } else { sqlite-add-feature-flag $featureFlag msg-result " - $boolFlag" } } sqlite-finalize-feature-flags } ######################################################################### # Remove duplicates from the final feature flag sets and show them to # the user. 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]" } if {[lsearch [get-define TARGET_DEBUG ""] -DSQLITE_DEBUG=1] > -1} { msg-result "Note: this is a debug build, so performance will suffer." } } ######################################################################## # Run checks for system-level includes and libs which are common to # both the canonical build and the "autoconf" bundle. # proc sqlite-check-common-system-deps {} { # Check for needed/wanted data types if {0} { # We don't need these until/unless we want to generate # sqlite_cfg.h. The historical TEA build does not generate that # file. cc-with {-includes stdint.h} \ {cc-check-types int8_t int16_t int32_t int64_t intptr_t \ uint8_t uint16_t uint32_t uint64_t uintptr_t} # Check for needed/wanted functions cc-check-functions gmtime_r isnan localtime_r localtime_s \ malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64 # Check for needed/wanted headers 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 } teaish-check-librt teaish-check-libz } ######################################################################## # If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to # OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to the linker flags # needed for linking pthread (possibly an empty string). If # --enable-threadsafe is not set, adds -DSQLITE_THREADSAFE=0 to # OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to an empty string. proc sqlite-handle-threadsafe {} { msg-checking "Support threadsafe operation? " define LDFLAGS_PTHREAD "" set enable 0 if {[proj-opt-was-provided threadsafe]} { proj-if-opt-truthy threadsafe { 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" } # Recall that LDFLAGS_PTHREAD might be empty even if pthreads if # found because it's in -lc on some platforms. } { msg-result "Disabled using --disable-threadsafe" } } else { # # If user does not specify --[disable-]threadsafe then select a # default based on whether it looks like TCL has threading # support. # #puts "TCL_LIBS = [get-define TCL_LIBS]" if {[string match *pthread* [get-define TCL_LIBS]]} { # ^^^ FIXME: there must be a better way of testing this set flagName "--threadsafe" set lblAbled "en" set enable 1 msg-result "yes" } else { set flagName "--disable-threadsafe" set lblAbled "dis" set enable 0 msg-result "no" } msg-result "NOTICE: defaulting to ${flagName} because TCL has threading ${lblAbled}abled." # ^^^ We don't need to link against -lpthread in the is-enabled case. } sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable} return $enable } ######################################################################## # Handles the --enable-load-extension flag. Returns 1 if the support # is enabled, else 0. If support for that feature is not found, a # fatal error is triggered if --enable-load-extension is explicitly # provided, else a loud warning is instead emitted. If # --disable-load-extension is used, no check is performed. # # Makes the following environment changes: # # - defines LDFLAGS_DLOPEN to any linker flags needed for this # feature. It may legally be empty on some systems where dlopen() # is in libc. # # - If the feature is not available, adds # -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list. proc sqlite-handle-load-extension {} { define LDFLAGS_DLOPEN "" set found 0 proj-if-opt-truthy load-extension { set found [proj-check-function-in-lib dlopen dl] if {$found} { define LDFLAGS_DLOPEN [get-define lib_dlopen] undefine lib_dlopen } else { if {[proj-opt-was-provided load-extension]} { # Explicit --enable-load-extension: fail if not found proj-indented-notice -error { --enable-load-extension was provided but dlopen() not found. Use --disable-load-extension to bypass this check. } } else { # It was implicitly enabled: warn if not found 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." } 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 } ######################################################################## # ICU - International Components for Unicode # # Handles these flags: # # --with-icu-ldflags=LDFLAGS # --with-icu-cflags=CFLAGS # --with-icu-config[=auto | pkg-config | /path/to/icu-config] # --enable-icu-collations # # --with-icu-config values: # # - auto: use the first one of (pkg-config, icu-config) found on the # system. # - pkg-config: use only pkg-config to determine flags # - /path/to/icu-config: use that to determine flags # # If --with-icu-config is used as neither pkg-config nor icu-config # are found, fail fatally. # # If both --with-icu-ldflags and --with-icu-config are provided, they # are cumulative. If neither are provided, icu-collations is not # honored and a warning is emitted if it is provided. # # Design note: though we could automatically enable ICU if the # icu-config binary or (pkg-config icu-io) are found, we specifically # do not. ICU is always an opt-in feature. proc sqlite-handle-icu {} { define LDFLAGS_LIBICU [join [opt-val with-icu-ldflags ""]] define CFLAGS_LIBICU [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; # set to 0 if we end up using pkg-config if {$icuConfigBin in {auto pkg-config}} { uplevel 3 { use pkg-config } if {[pkg-config-init 0] && [pkg-config icu-io]} { # Maintenance reminder: historical docs say to use both of # (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has # all of them on tested OSes. set tryIcuConfigBin 0 define LDFLAGS_LIBICU [get-define PKG_ICU_IO_LDFLAGS] define-append LDFLAGS_LIBICU [get-define PKG_ICU_IO_LIBS] define CFLAGS_LIBICU [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_LIBICU $x set x [exec $icuConfigBin --cppflags] define-append CFLAGS_LIBICU $x } else { proj-fatal "--with-icu-config=$icuConfigBin does not refer to an executable" } } } set ldflags [define LDFLAGS_LIBICU [string trim [get-define LDFLAGS_LIBICU]]] set cflags [define CFLAGS_LIBICU [string trim [get-define CFLAGS_LIBICU]]] if {"" ne $ldflags} { sqlite-add-feature-flag -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 -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." } }; # sqlite-handle-icu ######################################################################## # Handles the --with-tempstore flag. # # The test fixture likes to set SQLITE_TEMP_STORE on its own, so do # not set that feature flag unless it was explicitly provided to the # configure script. 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 } } ######################################################################## # Handles the --enable-math flag. 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." } set lfl [get-define lib_ceil] undefine lib_ceil define LDFLAGS_MATH $lfl teaish-prepend-ldflags $lfl sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS msg-result "Enabling math SQL functions" } { define LDFLAGS_MATH "" msg-result "Disabling math SQL functions" } } ######################################################################## # Move -DSQLITE_OMIT... and -DSQLITE_ENABLE... flags from CFLAGS and # CPPFLAGS to OPT_FEATURE_FLAGS and remove them from BUILD_CFLAGS. proc sqlite-munge-cflags {} { # Move CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and # -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived # from the legacy build and was missing the 3.48.0 release (the # initial Autosetup port). # https://sqlite.org/forum/forumpost/9801e54665afd728 # # Handling of CPPFLAGS, as well as removing ENABLE/OMIT from # CFLAGS/CPPFLAGS, was missing in the 3.49.0 release as well. # # If any configure flags for features are in conflict with # CFLAGS/CPPFLAGS-specified feature flags, all bets are off. There # are no guarantees about which one will take precedence. 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 } } |
Added autoconf/tea/teaish.test.tcl.
> > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | test-expect 1.0-open { sqlite3 db :memory: } {} test-assert 1.1-version-3.x { [string match 3.* [db eval {select sqlite_version()}]] } test-expect 1.2-select { db eval {select 'hi, world',1,2,3} } {{hi, world} 1 2 3} test-expect 99.0-db-close {db close} {} |
Added autoconf/tea/teaish.tester.tcl.in.
> > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # -*- tcl -*- # Automatically generated - do not edit # # This is the wrapper script invoked by teaish's "make test" recipe. load [lindex $::argv 0] [lindex $::argv 1]; source [lindex $::argv 2] @if TEAISH_PKGINIT_TCL apply {{} {set dir [file dirname $::argv0]; source @TEAISH_PKGINIT_TCL@}} @endif @if TEAISH_TEST_TCL source @TEAISH_TEST_TCL@ @else puts "Extension successfully loaded" @endif |
Deleted autoconf/tea/win/makefile.vc.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted autoconf/tea/win/nmakehlp.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted autoconf/tea/win/rules-ext.vc.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted autoconf/tea/win/rules.vc.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted autoconf/tea/win/targets.vc.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to autosetup/proj.tcl.
︙ | ︙ | |||
72 73 74 75 76 77 78 | ######################################################################## # @proj-warn msg # # Emits a warning message to stderr. proc proj-warn {args} { show-notices | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ######################################################################## # @proj-warn msg # # Emits a warning message to stderr. proc proj-warn {args} { show-notices puts stderr [join [list "WARNING:" {*}$args] " "] } ######################################################################## # @proj-error msg # # Emits an error message to stderr and exits with non-0. proc proj-fatal {args} { |
︙ | ︙ |
Changes to tool/mkautoconfamal.sh.
︙ | ︙ | |||
20 21 22 23 24 25 26 | set -e set -u TMPSPACE=./mkpkg_tmp_dir VERSION=`cat $TOP/VERSION` HASH=`cut -c1-10 $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12` | < < < < < < < < < < < < < < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | set -e set -u TMPSPACE=./mkpkg_tmp_dir VERSION=`cat $TOP/VERSION` HASH=`cut -c1-10 $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12` # If this script is given an argument of --snapshot, then generate a # snapshot tarball named for the current checkout SHA hash, rather than # the version number. # if test "$#" -ge 1 -a x$1 != x--snapshot then |
︙ | ︙ | |||
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # Clean up *~ files (emacs-generated backups). # This bit is only for use during development of # the autoconf bundle. # find . -name '*~' -exec rm \{} \; #fi mkdir -p tea/generic cat <<EOF > tea/generic/tclsqlite3.c #ifdef USE_SYSTEM_SQLITE # include <sqlite3.h> #else # include "sqlite3.c" #endif EOF cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c | > > > < | < < < | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | # Clean up *~ files (emacs-generated backups). # This bit is only for use during development of # the autoconf bundle. # find . -name '*~' -exec rm \{} \; #fi mkdir -p tea/generic mv tea/autosetup/*.tcl autosetup/. rm -fr tea/autosetup cat <<EOF > tea/generic/tclsqlite3.c #ifdef USE_SYSTEM_SQLITE # include <sqlite3.h> #else # include "sqlite3.c" #endif EOF cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c find . -type f -name '*~' -exec rm -f \{} \; ./configure && make dist tar xzf sqlite-$VERSION.tar.gz mv sqlite-$VERSION $TARBALLNAME tar czf $TARBALLNAME.tar.gz $TARBALLNAME mv $TARBALLNAME.tar.gz .. cd .. ls -l $TARBALLNAME.tar.gz |