annotate third_party/sqlite3/tea/teaish.tcl @ 195:f8f5004a920a

Merging back hg-web-tip
author MrJuneJune <me@mrjunejune.com>
date Tue, 27 Jan 2026 06:51:44 -0800
parents 589bab390fb4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
167
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
1 # Teaish configure script for the SQLite Tcl extension
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
2
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
3 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
4 # State for disparate config-time pieces.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
5 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
6 array set sqlite__Config [proj-strip-hash-comments {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
7 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
8 # The list of feature --flags which the --all flag implies. This
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
9 # requires special handling in a few places.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
10 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
11 all-flag-enables {fts3 fts4 fts5 rtree geopoly}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
12
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
13 # >0 if building in the canonical tree. -1=undetermined
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
14 is-canonical -1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
15 }]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
16
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
17 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
18 # Set up the package info for teaish...
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
19 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
20 apply {{dir} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
21 # Figure out the version number...
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
22 set version ""
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
23 if {[file exists $dir/../VERSION]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
24 # The canonical SQLite TEA(ish) build
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
25 set version [proj-file-content -trim $dir/../VERSION]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
26 set ::sqlite__Config(is-canonical) 1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
27 set distname sqlite-tcl
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
28 } elseif {[file exists $dir/generic/tclsqlite3.c]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
29 # The copy from the teaish tree, used as a dev/test bed before
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
30 # updating SQLite's tree.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
31 set ::sqlite__Config(is-canonical) 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
32 set fd [open $dir/generic/tclsqlite3.c rb]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
33 while {[gets $fd line] >=0} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
34 if {[regexp {^#define[ ]+SQLITE_VERSION[ ]+"(3.+)"} \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
35 $line - version]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
36 set distname sqlite-teaish
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
37 break
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
38 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
39 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
40 close $fd
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
41 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
42
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
43 if {"" eq $version} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
44 proj-fatal "Cannot determine the SQLite version number"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
45 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
46
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
47 proj-assert {$::sqlite__Config(is-canonical) > -1}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
48 proj-assert {[string match 3.*.* $version]} \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
49 "Unexpected SQLite version: $version"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
50
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
51 set pragmas {}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
52 if {$::sqlite__Config(is-canonical)} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
53 # Disable "make dist" in the canonical tree. That tree is
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
54 # generated from several pieces and creating/testing working
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
55 # "dist" rules for that sub-build currently feels unnecessary. The
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
56 # copy in the teaish tree, though, should be able to "make dist".
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
57 lappend pragmas no-dist
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
58 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
59 lappend pragmas full-dist
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
60 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
61
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
62 teaish-pkginfo-set -vars {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
63 -name sqlite
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
64 -name.pkg sqlite3
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
65 -version $version
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
66 -name.dist $distname
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
67 -libDir sqlite$version
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
68 -pragmas $pragmas
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
69 -src generic/tclsqlite3.c
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
70 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
71 # We should also have:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
72 # -vsatisfies 8.6-
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
73 # But at least one platform is failing this vsatisfies check
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
74 # for no apparent reason:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
75 # https://sqlite.org/forum/forumpost/fde857fb8101a4be
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
76 }} [teaish-get -dir]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
77
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
78
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
79 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
80 # Must return either an empty string or a list in the form accepted by
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
81 # autosetup's [options] function.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
82 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
83 proc teaish-options {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
84 # These flags and defaults mostly derive from the historical TEA
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
85 # build. Some, like ICU, are taken from the canonical SQLite tree.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
86 return [subst -nocommands -nobackslashes {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
87 with-system-sqlite=0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
88 => {Use the system-level SQLite instead of the copy in this tree.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
89 Also requires use of --override-sqlite-version so that the build
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
90 knows what version number to associate with the system-level SQLite.}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
91 override-sqlite-version:VERSION
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
92 => {For use with --with-system-sqlite to set the version number.}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
93 threadsafe=1 => {Disable mutexing}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
94 with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
95 load-extension=0 => {Enable loading of external extensions}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
96 math=1 => {Disable math functions}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
97 json=1 => {Disable JSON functions}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
98 fts3 => {Enable the FTS3 extension}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
99 fts4 => {Enable the FTS4 extension}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
100 fts5 => {Enable the FTS5 extension}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
101 update-limit => {Enable the UPDATE/DELETE LIMIT clause}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
102 geopoly => {Enable the GEOPOLY extension}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
103 rtree => {Enable the RTREE extension}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
104 session => {Enable the SESSION extension}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
105 all=1 => {Disable $::sqlite__Config(all-flag-enables)}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
106 with-icu-ldflags:LDFLAGS
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
107 => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
108 ICU libraries. e.g. on Ubuntu systems, try '-licui18n -licuuc -licudata'.}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
109 with-icu-cflags:CFLAGS
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
110 => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
111 e.g. -I/usr/local/include}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
112 with-icu-config:=auto
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
113 => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config,
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
114 /path/to/icu-config}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
115 icu-collations=0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
116 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=...
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
117 or --with-icu-config}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
118 }]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
119 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
120
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
121 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
122 # Gets called by tea-configure-core. Must perform any configuration
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
123 # work needed for this extension.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
124 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
125 proc teaish-configure {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
126 use teaish/feature
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
127
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
128 if {[proj-opt-was-provided override-sqlite-version]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
129 teaish-pkginfo-set -version [opt-val override-sqlite-version]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
130 proj-warn "overriding sqlite version number:" [teaish-pkginfo-get -version]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
131 } elseif {[proj-opt-was-provided with-system-sqlite]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
132 && [opt-val with-system-sqlite] ne "0"} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
133 proj-fatal "when using --with-system-sqlite also use" \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
134 "--override-sqlite-version to specify a library version number."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
135 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
136
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
137 define CFLAGS [proj-get-env CFLAGS {-O2}]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
138 sqlite-munge-cflags
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
139
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
140 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
141 # Add feature flags from legacy configure.ac which are not covered by
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
142 # --flags.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
143 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
144 sqlite-add-feature-flag {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
145 -DSQLITE_3_SUFFIX_ONLY=1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
146 -DSQLITE_ENABLE_DESERIALIZE=1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
147 -DSQLITE_ENABLE_DBPAGE_VTAB=1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
148 -DSQLITE_ENABLE_BYTECODE_VTAB=1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
149 -DSQLITE_ENABLE_DBSTAT_VTAB=1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
150 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
151
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
152 if {[opt-bool with-system-sqlite]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
153 msg-result "Using system-level sqlite3."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
154 teaish-cflags-add -DUSE_SYSTEM_SQLITE
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
155 teaish-ldflags-add -lsqlite3
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
156 } elseif {$::sqlite__Config(is-canonical)} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
157 teaish-cflags-add -I[teaish-get -dir]/..
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
158 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
159
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
160 teaish-check-librt
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
161 teaish-check-libz
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
162 sqlite-handle-threadsafe
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
163 sqlite-handle-tempstore
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
164 sqlite-handle-load-extension
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
165 sqlite-handle-math
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
166 sqlite-handle-icu
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
167
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
168 sqlite-handle-common-feature-flags; # must be late in the process
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
169 }; # teaish-configure
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
170
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
171 define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
172 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
173 # Adds $args, if not empty, to OPT_FEATURE_FLAGS. This is intended only for holding
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
174 # -DSQLITE_ENABLE/OMIT/... flags, but that is not enforced here.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
175 proc sqlite-add-feature-flag {args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
176 if {"" ne $args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
177 define-append OPT_FEATURE_FLAGS {*}$args
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
178 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
179 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
180
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
181 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
182 # Check for log(3) in libm and die with an error if it is not
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
183 # found. $featureName should be the feature name which requires that
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
184 # function (it's used only in error messages). defines LDFLAGS_MATH to
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
185 # the required linker flags (which may be empty even if the math APIs
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
186 # are found, depending on the OS).
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
187 proc sqlite-affirm-have-math {featureName} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
188 if {"" eq [get-define LDFLAGS_MATH ""]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
189 if {![msg-quiet proj-check-function-in-lib log m]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
190 user-error "Missing math APIs for $featureName"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
191 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
192 set lfl [get-define lib_log ""]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
193 undefine lib_log
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
194 if {"" ne $lfl} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
195 user-notice "Forcing requirement of $lfl for $featureName"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
196 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
197 define LDFLAGS_MATH $lfl
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
198 teaish-ldflags-prepend $lfl
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
199 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
200 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
201
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
202 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
203 # Handle various SQLITE_ENABLE/OMIT_... feature flags.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
204 proc sqlite-handle-common-feature-flags {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
205 msg-result "Feature flags..."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
206 if {![opt-bool all]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
207 # Special handling for --disable-all
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
208 foreach flag $::sqlite__Config(all-flag-enables) {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
209 if {![proj-opt-was-provided $flag]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
210 proj-opt-set $flag 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
211 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
212 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
213 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
214 foreach {boolFlag featureFlag ifSetEvalThis} [proj-strip-hash-comments {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
215 all {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
216 # The 'all' option must be first in this list. This impl makes
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
217 # an effort to only apply flags which the user did not already
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
218 # apply, so that combinations like (--all --disable-geopoly)
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
219 # will indeed disable geopoly. There are corner cases where
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
220 # flags which depend on each other will behave in non-intuitive
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
221 # ways:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
222 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
223 # --all --disable-rtree
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
224 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
225 # Will NOT disable geopoly, though geopoly depends on rtree.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
226 # The --geopoly flag, though, will automatically re-enable
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
227 # --rtree, so --disable-rtree won't actually disable anything in
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
228 # that case.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
229 foreach k $::sqlite__Config(all-flag-enables) {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
230 if {![proj-opt-was-provided $k]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
231 proj-opt-set $k 1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
232 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
233 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
234 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
235 fts3 -DSQLITE_ENABLE_FTS3 {sqlite-affirm-have-math fts3}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
236 fts4 -DSQLITE_ENABLE_FTS4 {sqlite-affirm-have-math fts4}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
237 fts5 -DSQLITE_ENABLE_FTS5 {sqlite-affirm-have-math fts5}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
238 geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
239 rtree -DSQLITE_ENABLE_RTREE {}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
240 session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
241 update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
242 scanstatus -DSQLITE_ENABLE_STMT_SCANSTATUS {}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
243 }] {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
244 if {$boolFlag ni $::autosetup(options)} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
245 # Skip flags which are in the canonical build but not
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
246 # the autoconf bundle.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
247 continue
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
248 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
249 proj-if-opt-truthy $boolFlag {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
250 sqlite-add-feature-flag $featureFlag
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
251 if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
252 msg-result " + $boolFlag"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
253 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
254 } {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
255 if {"all" ne $boolFlag} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
256 msg-result " - $boolFlag"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
257 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
258 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
259 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
260 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
261 # Invert the above loop's logic for some SQLITE_OMIT_... cases. If
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
262 # config option $boolFlag is false, [sqlite-add-feature-flag
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
263 # $featureFlag], where $featureFlag is intended to be
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
264 # -DSQLITE_OMIT_...
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
265 foreach {boolFlag featureFlag} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
266 json -DSQLITE_OMIT_JSON
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
267 } {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
268 if {[proj-opt-truthy $boolFlag]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
269 msg-result " + $boolFlag"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
270 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
271 sqlite-add-feature-flag $featureFlag
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
272 msg-result " - $boolFlag"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
273 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
274 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
275
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
276 ##
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
277 # Remove duplicates from the final feature flag sets and show them
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
278 # to the user.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
279 set oFF [get-define OPT_FEATURE_FLAGS]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
280 if {"" ne $oFF} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
281 define OPT_FEATURE_FLAGS [lsort -unique $oFF]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
282 msg-result "Library feature flags: [get-define OPT_FEATURE_FLAGS]"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
283 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
284 if {[lsearch [get-define TARGET_DEBUG ""] -DSQLITE_DEBUG=1] > -1} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
285 msg-result "Note: this is a debug build, so performance will suffer."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
286 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
287 teaish-cflags-add -define OPT_FEATURE_FLAGS
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
288 }; # sqlite-handle-common-feature-flags
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
289
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
290 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
291 # If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
292 # OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to the linker flags
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
293 # needed for linking pthread (possibly an empty string). If
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
294 # --enable-threadsafe is not set, adds -DSQLITE_THREADSAFE=0 to
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
295 # OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to an empty string.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
296 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
297 # It prepends the flags to the global LDFLAGS.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
298 proc sqlite-handle-threadsafe {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
299 msg-checking "Support threadsafe operation? "
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
300 define LDFLAGS_PTHREAD ""
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
301 set enable 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
302 if {[proj-opt-was-provided threadsafe]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
303 proj-if-opt-truthy threadsafe {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
304 if {[proj-check-function-in-lib pthread_create pthread]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
305 && [proj-check-function-in-lib pthread_mutexattr_init pthread]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
306 incr enable
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
307 set ldf [get-define lib_pthread_create]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
308 define LDFLAGS_PTHREAD $ldf
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
309 teaish-ldflags-prepend $ldf
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
310 undefine lib_pthread_create
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
311 undefine lib_pthread_mutexattr_init
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
312 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
313 user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
314 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
315 # Recall that LDFLAGS_PTHREAD might be empty even if pthreads if
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
316 # found because it's in -lc on some platforms.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
317 } {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
318 msg-result "Disabled using --disable-threadsafe"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
319 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
320 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
321 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
322 # If user does not specify --[disable-]threadsafe then select a
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
323 # default based on whether it looks like Tcl has threading
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
324 # support.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
325 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
326 catch {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
327 scan [exec echo {puts [tcl::pkgconfig get threaded]} | [get-define TCLSH_CMD]] \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
328 %d enable
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
329 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
330 if {$enable} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
331 set flagName "--threadsafe"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
332 set lblAbled "enabled"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
333 msg-result yes
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
334 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
335 set flagName "--disable-threadsafe"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
336 set lblAbled "disabled"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
337 msg-result no
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
338 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
339 msg-result "Defaulting to ${flagName} because Tcl has threading ${lblAbled}."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
340 # ^^^ We (probably) don't need to link against -lpthread in the
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
341 # is-enabled case. We might in the case of static linking. Unsure.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
342 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
343 sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
344 return $enable
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
345 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
346
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
347 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
348 # Handles the --enable-load-extension flag. Returns 1 if the support
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
349 # is enabled, else 0. If support for that feature is not found, a
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
350 # fatal error is triggered if --enable-load-extension is explicitly
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
351 # provided, else a loud warning is instead emitted. If
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
352 # --disable-load-extension is used, no check is performed.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
353 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
354 # Makes the following environment changes:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
355 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
356 # - defines LDFLAGS_DLOPEN to any linker flags needed for this
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
357 # feature. It may legally be empty on some systems where dlopen()
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
358 # is in libc.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
359 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
360 # - If the feature is not available, adds
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
361 # -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
362 proc sqlite-handle-load-extension {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
363 define LDFLAGS_DLOPEN ""
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
364 set found 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
365 proj-if-opt-truthy load-extension {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
366 set found [proj-check-function-in-lib dlopen dl]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
367 if {$found} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
368 set ldf [get-define lib_dlopen]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
369 define LDFLAGS_DLOPEN $ldf
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
370 teaish-ldflags-prepend $ldf
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
371 undefine lib_dlopen
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
372 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
373 if {[proj-opt-was-provided load-extension]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
374 # Explicit --enable-load-extension: fail if not found
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
375 proj-indented-notice -error {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
376 --enable-load-extension was provided but dlopen()
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
377 not found. Use --disable-load-extension to bypass this
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
378 check.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
379 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
380 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
381 # It was implicitly enabled: warn if not found
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
382 proj-indented-notice {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
383 WARNING: dlopen() not found, so loadable module support will
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
384 be disabled. Use --disable-load-extension to bypass this
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
385 check.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
386 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
387 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
388 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
389 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
390 if {$found} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
391 msg-result "Loadable extension support enabled."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
392 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
393 msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
394 sqlite-add-feature-flag -DSQLITE_OMIT_LOAD_EXTENSION=1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
395 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
396 return $found
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
397 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
398
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
399 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
400 # ICU - International Components for Unicode
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
401 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
402 # Handles these flags:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
403 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
404 # --with-icu-ldflags=LDFLAGS
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
405 # --with-icu-cflags=CFLAGS
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
406 # --with-icu-config[=auto | pkg-config | /path/to/icu-config]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
407 # --enable-icu-collations
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
408 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
409 # --with-icu-config values:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
410 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
411 # - auto: use the first one of (pkg-config, icu-config) found on the
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
412 # system.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
413 # - pkg-config: use only pkg-config to determine flags
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
414 # - /path/to/icu-config: use that to determine flags
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
415 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
416 # If --with-icu-config is used as neither pkg-config nor icu-config
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
417 # are found, fail fatally.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
418 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
419 # If both --with-icu-ldflags and --with-icu-config are provided, they
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
420 # are cumulative. If neither are provided, icu-collations is not
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
421 # honored and a warning is emitted if it is provided.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
422 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
423 # Design note: though we could automatically enable ICU if the
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
424 # icu-config binary or (pkg-config icu-io) are found, we specifically
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
425 # do not. ICU is always an opt-in feature.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
426 proc sqlite-handle-icu {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
427 define LDFLAGS_LIBICU [join [opt-val with-icu-ldflags ""]]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
428 define CFLAGS_LIBICU [join [opt-val with-icu-cflags ""]]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
429 if {[proj-opt-was-provided with-icu-config]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
430 msg-result "Checking for ICU support..."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
431 set icuConfigBin [opt-val with-icu-config]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
432 set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
433 if {$icuConfigBin in {auto pkg-config}} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
434 uplevel 3 { use pkg-config }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
435 if {[pkg-config-init 0] && [pkg-config icu-io]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
436 # Maintenance reminder: historical docs say to use both of
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
437 # (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
438 # all of them on tested OSes.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
439 set tryIcuConfigBin 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
440 define LDFLAGS_LIBICU [get-define PKG_ICU_IO_LDFLAGS]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
441 define-append LDFLAGS_LIBICU [get-define PKG_ICU_IO_LIBS]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
442 define CFLAGS_LIBICU [get-define PKG_ICU_IO_CFLAGS]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
443 } elseif {"pkg-config" eq $icuConfigBin} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
444 proj-fatal "pkg-config cannot find package icu-io"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
445 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
446 proj-assert {"auto" eq $icuConfigBin}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
447 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
448 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
449 if {$tryIcuConfigBin} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
450 if {"auto" eq $icuConfigBin} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
451 set icuConfigBin [proj-first-bin-of \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
452 /usr/local/bin/icu-config \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
453 /usr/bin/icu-config]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
454 if {"" eq $icuConfigBin} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
455 proj-indented-notice -error {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
456 --with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
457 On Ubuntu-like systems try:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
458 --with-icu-ldflags='-licui18n -licuuc -licudata'
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
459 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
460 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
461 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
462 if {[file-isexec $icuConfigBin]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
463 set x [exec $icuConfigBin --ldflags]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
464 if {"" eq $x} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
465 proj-indented-notice -error \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
466 [subst {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
467 $icuConfigBin --ldflags returned no data.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
468 On Ubuntu-like systems try:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
469 --with-icu-ldflags='-licui18n -licuuc -licudata'
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
470 }]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
471 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
472 define-append LDFLAGS_LIBICU $x
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
473 set x [exec $icuConfigBin --cppflags]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
474 define-append CFLAGS_LIBICU $x
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
475 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
476 proj-fatal "--with-icu-config=$icuConfigBin does not refer to an executable"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
477 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
478 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
479 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
480 set ldflags [define LDFLAGS_LIBICU [string trim [get-define LDFLAGS_LIBICU]]]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
481 set cflags [define CFLAGS_LIBICU [string trim [get-define CFLAGS_LIBICU]]]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
482 if {"" ne $ldflags} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
483 sqlite-add-feature-flag -DSQLITE_ENABLE_ICU
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
484 msg-result "Enabling ICU support with flags: $ldflags $cflags"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
485 if {[opt-bool icu-collations]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
486 msg-result "Enabling ICU collations."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
487 sqlite-add-feature-flag -DSQLITE_ENABLE_ICU_COLLATIONS
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
488 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
489 teaish-ldflags-prepend $ldflags
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
490 teaish-cflags-add $cflags
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
491 } elseif {[opt-bool icu-collations]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
492 proj-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
493 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
494 msg-result "ICU support is disabled."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
495 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
496 }; # sqlite-handle-icu
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
497
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
498
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
499 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
500 # Handles the --with-tempstore flag.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
501 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
502 # The test fixture likes to set SQLITE_TEMP_STORE on its own, so do
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
503 # not set that feature flag unless it was explicitly provided to the
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
504 # configure script.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
505 proc sqlite-handle-tempstore {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
506 if {[proj-opt-was-provided with-tempstore]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
507 set ts [opt-val with-tempstore no]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
508 set tsn 1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
509 msg-checking "Use an in-RAM database for temporary tables? "
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
510 switch -exact -- $ts {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
511 never { set tsn 0 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
512 no { set tsn 1 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
513 yes { set tsn 2 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
514 always { set tsn 3 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
515 default {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
516 user-error "Invalid --with-tempstore value '$ts'. Use one of: never, no, yes, always"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
517 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
518 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
519 msg-result $ts
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
520 sqlite-add-feature-flag -DSQLITE_TEMP_STORE=$tsn
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
521 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
522 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
523
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
524 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
525 # Handles the --enable-math flag.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
526 proc sqlite-handle-math {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
527 proj-if-opt-truthy math {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
528 if {![proj-check-function-in-lib ceil m]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
529 user-error "Cannot find libm functions. Use --disable-math to bypass this."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
530 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
531 set lfl [get-define lib_ceil]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
532 undefine lib_ceil
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
533 define LDFLAGS_MATH $lfl
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
534 teaish-ldflags-prepend $lfl
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
535 sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
536 msg-result "Enabling math SQL functions"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
537 } {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
538 define LDFLAGS_MATH ""
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
539 msg-result "Disabling math SQL functions"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
540 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
541 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
542
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
543 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
544 # Move -DSQLITE_OMIT... and -DSQLITE_ENABLE... flags from CFLAGS and
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
545 # CPPFLAGS to OPT_FEATURE_FLAGS and remove them from BUILD_CFLAGS.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
546 proc sqlite-munge-cflags {} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
547 # Move CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
548 # -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
549 # from the pre-3.48 build.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
550 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
551 # If any configure flags for features are in conflict with
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
552 # CFLAGS/CPPFLAGS-specified feature flags, all bets are off. There
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
553 # are no guarantees about which one will take precedence.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
554 foreach flagDef {CFLAGS CPPFLAGS} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
555 set tmp ""
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
556 foreach cf [get-define $flagDef ""] {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
557 switch -glob -- $cf {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
558 -DSQLITE_OMIT* -
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
559 -DSQLITE_ENABLE* {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
560 sqlite-add-feature-flag $cf
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
561 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
562 default {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
563 lappend tmp $cf
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
564 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
565 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
566 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
567 define $flagDef $tmp
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
568 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
569 }