Fossil SCM

Add an SQLite compatibility test program and run that program during the "./configure" if the --disable-internal-sqlite option is used in order to verify that the system SQLite library has all of the capabilities that we need.

drh 2019-08-07 11:34 trunk
Commit 350c627a52908458a2c598f3134ce76266f3479545c5b2484aa46b2868aa3628
2 files changed +34 -6 +25
+34 -6
--- auto.def
+++ auto.def
@@ -116,11 +116,11 @@
116116
}
117117
return $found
118118
}
119119
120120
if {![opt-bool internal-sqlite]} {
121
- proc find_internal_sqlite {} {
121
+ proc find_system_sqlite {} {
122122
123123
# On some systems (slackware), libsqlite3 requires -ldl to link. So
124124
# search for the system SQLite once with -ldl, and once without. If
125125
# the library can only be found with $extralibs set to -ldl, then
126126
# the code below will append -ldl to LIBS.
@@ -131,14 +131,10 @@
131131
# if sqlite3_stmt_isexplain can be found as well. If we can find open() but
132132
# not stmt_isexplain(), then the system SQLite is too old to link against
133133
# fossil.
134134
#
135135
if {[check-function-in-lib sqlite3_open sqlite3 $extralibs]} {
136
- if {![check-function-in-lib sqlite3_stmt_isexplain sqlite3 $extralibs]} {
137
- user-error "system sqlite3 too old (require >= 3.28.0)"
138
- }
139
-
140136
# Success. Update symbols and return.
141137
#
142138
define USE_SYSTEM_SQLITE 1
143139
define-append LIBS -lsqlite3
144140
define-append LIBS $extralibs
@@ -146,11 +142,43 @@
146142
}
147143
}
148144
user-error "system sqlite3 not found"
149145
}
150146
151
- find_internal_sqlite
147
+ find_system_sqlite
148
+
149
+ proc test_system_sqlite {} {
150
+ # Check compatibility of the system SQLite library by running the sqlcompttest.c
151
+ # program in the source tree
152
+ #
153
+ set cmdline {}
154
+ lappend cmdline {*}[get-define CCACHE]
155
+ lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
156
+ lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__
157
+ lappend cmdline {*}[get-define LIBS]
158
+ set ok 1
159
+ set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
160
+ if {$err} {
161
+ configlog "Failed: [join $cmdline]"
162
+ if {[string length $result]>0} {configlog $result}
163
+ configlog "============"
164
+ set ok 0
165
+ } elseif {$::autosetup(debug)} {
166
+ configlog "Compiled OK: [join $cmdline]"
167
+ configlog "============"
168
+ }
169
+ if {!$ok} {
170
+ user-error "unable to compile SQLite compatibility test program"
171
+ }
172
+ set err [catch {exec-with-stderr ./conftest__} result errinfo]
173
+ if {$err} {
174
+ user-error $result
175
+ }
176
+ file delete ./conftest__
177
+ }
178
+ test_system_sqlite
179
+
152180
}
153181
154182
proc is_mingw {} {
155183
return [string match *mingw* [get-define host]]
156184
}
157185
158186
ADDED src/sqlcompattest.c
--- auto.def
+++ auto.def
@@ -116,11 +116,11 @@
116 }
117 return $found
118 }
119
120 if {![opt-bool internal-sqlite]} {
121 proc find_internal_sqlite {} {
122
123 # On some systems (slackware), libsqlite3 requires -ldl to link. So
124 # search for the system SQLite once with -ldl, and once without. If
125 # the library can only be found with $extralibs set to -ldl, then
126 # the code below will append -ldl to LIBS.
@@ -131,14 +131,10 @@
131 # if sqlite3_stmt_isexplain can be found as well. If we can find open() but
132 # not stmt_isexplain(), then the system SQLite is too old to link against
133 # fossil.
134 #
135 if {[check-function-in-lib sqlite3_open sqlite3 $extralibs]} {
136 if {![check-function-in-lib sqlite3_stmt_isexplain sqlite3 $extralibs]} {
137 user-error "system sqlite3 too old (require >= 3.28.0)"
138 }
139
140 # Success. Update symbols and return.
141 #
142 define USE_SYSTEM_SQLITE 1
143 define-append LIBS -lsqlite3
144 define-append LIBS $extralibs
@@ -146,11 +142,43 @@
146 }
147 }
148 user-error "system sqlite3 not found"
149 }
150
151 find_internal_sqlite
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152 }
153
154 proc is_mingw {} {
155 return [string match *mingw* [get-define host]]
156 }
157
158 DDED src/sqlcompattest.c
--- auto.def
+++ auto.def
@@ -116,11 +116,11 @@
116 }
117 return $found
118 }
119
120 if {![opt-bool internal-sqlite]} {
121 proc find_system_sqlite {} {
122
123 # On some systems (slackware), libsqlite3 requires -ldl to link. So
124 # search for the system SQLite once with -ldl, and once without. If
125 # the library can only be found with $extralibs set to -ldl, then
126 # the code below will append -ldl to LIBS.
@@ -131,14 +131,10 @@
131 # if sqlite3_stmt_isexplain can be found as well. If we can find open() but
132 # not stmt_isexplain(), then the system SQLite is too old to link against
133 # fossil.
134 #
135 if {[check-function-in-lib sqlite3_open sqlite3 $extralibs]} {
 
 
 
 
136 # Success. Update symbols and return.
137 #
138 define USE_SYSTEM_SQLITE 1
139 define-append LIBS -lsqlite3
140 define-append LIBS $extralibs
@@ -146,11 +142,43 @@
142 }
143 }
144 user-error "system sqlite3 not found"
145 }
146
147 find_system_sqlite
148
149 proc test_system_sqlite {} {
150 # Check compatibility of the system SQLite library by running the sqlcompttest.c
151 # program in the source tree
152 #
153 set cmdline {}
154 lappend cmdline {*}[get-define CCACHE]
155 lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
156 lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__
157 lappend cmdline {*}[get-define LIBS]
158 set ok 1
159 set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
160 if {$err} {
161 configlog "Failed: [join $cmdline]"
162 if {[string length $result]>0} {configlog $result}
163 configlog "============"
164 set ok 0
165 } elseif {$::autosetup(debug)} {
166 configlog "Compiled OK: [join $cmdline]"
167 configlog "============"
168 }
169 if {!$ok} {
170 user-error "unable to compile SQLite compatibility test program"
171 }
172 set err [catch {exec-with-stderr ./conftest__} result errinfo]
173 if {$err} {
174 user-error $result
175 }
176 file delete ./conftest__
177 }
178 test_system_sqlite
179
180 }
181
182 proc is_mingw {} {
183 return [string match *mingw* [get-define host]]
184 }
185
186 DDED src/sqlcompattest.c
--- a/src/sqlcompattest.c
+++ b/src/sqlcompattest.c
@@ -0,0 +1,25 @@
1
+/*
2
+** Copyright (c) 201/*
3
+** Copyright (c) 2019 D. Richard Hipp
4
+**
5
+** This program is free software; you can redistribute it and/or
6
+** modify it under the terms of the Simplified BSD License (also
7
+** known as the "2-Clause License" or "FreeBSD License".)
8
+**
9
+** This program is distributed in the hope that it will be useful,
10
+** but without any warranty; without even the implied warranty of
11
+** merchantability or fitness for a particular purpose.
12
+**
13
+** Author contact information:
14
+** [email protected]
15
+** http://www.hwaci.com/drh/
16
+**
17
+********************d Hipp
18
+**
19
+** This program is free software; you can redistribute it and/or
20
+** modify it uied BSD License (also
21
+** known as the "2-Clause License" or "FreeBSD License".)
22
+**
23
+** This program is distributed in the hope that it will be useful,
24
+** but without any warranty; without even the implied warope that it will be useful,
25
+** but without any warranty; without eve "ENABLE_DBPAGE_VTAB", /* Required by the .recover command in "fossil sql"dumpthe "fossil sql" command */
--- a/src/sqlcompattest.c
+++ b/src/sqlcompattest.c
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/sqlcompattest.c
+++ b/src/sqlcompattest.c
@@ -0,0 +1,25 @@
1 /*
2 ** Copyright (c) 201/*
3 ** Copyright (c) 2019 D. Richard Hipp
4 **
5 ** This program is free software; you can redistribute it and/or
6 ** modify it under the terms of the Simplified BSD License (also
7 ** known as the "2-Clause License" or "FreeBSD License".)
8 **
9 ** This program is distributed in the hope that it will be useful,
10 ** but without any warranty; without even the implied warranty of
11 ** merchantability or fitness for a particular purpose.
12 **
13 ** Author contact information:
14 ** [email protected]
15 ** http://www.hwaci.com/drh/
16 **
17 ********************d Hipp
18 **
19 ** This program is free software; you can redistribute it and/or
20 ** modify it uied BSD License (also
21 ** known as the "2-Clause License" or "FreeBSD License".)
22 **
23 ** This program is distributed in the hope that it will be useful,
24 ** but without any warranty; without even the implied warope that it will be useful,
25 ** but without any warranty; without eve "ENABLE_DBPAGE_VTAB", /* Required by the .recover command in "fossil sql"dumpthe "fossil sql" command */

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button