Fossil SCM

configure now checks system sqlite version against the version in auto.def

danshearer 2021-03-05 16:00 trunk
Commit 834f6515a77420dce8f02bc823a1e0684d190e19a450fa287bc8d04d5a723193
2 files changed +5 +23 -4
+5
--- auto.def
+++ auto.def
@@ -32,10 +32,12 @@
3232
}
3333
3434
# Update the minimum required SQLite version number here.
3535
define MINIMUM_SQLITE_VERSION "3.35.0"
3636
37
+# This is useful for people wanting Fossil to use an external SQLite library
38
+# to compare the one they have against the minimum required
3739
if {[opt-bool print-minimum-sqlite-version]} {
3840
puts [get-define MINIMUM_SQLITE_VERSION]
3941
exit 0
4042
}
4143
@@ -166,17 +168,20 @@
166168
find_system_sqlite
167169
168170
proc test_system_sqlite {} {
169171
# Check compatibility of the system SQLite library by running the sqlcompttest.c
170172
# program in the source tree
173
+ # passes MINIMUM_SQLITE_VERSION set at the top of this file to sqlcompttest.c
171174
#
172175
set cmdline {}
173176
lappend cmdline {*}[get-define CCACHE]
174177
lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
175178
lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__
176179
lappend cmdline {*}[get-define LDFLAGS]
177180
lappend cmdline {*}[get-define LIBS]
181
+ set sqlite-version [string cat "-D MINIMUM_SQLITE_VERSION=" [get-define MINIMUM_SQLITE_VERSION]]
182
+ lappend cmdline {*}[set sqlite-version]
178183
set ok 1
179184
set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
180185
if {$err} {
181186
configlog "Failed: [join $cmdline]"
182187
if {[string length $result]>0} {configlog $result}
183188
--- auto.def
+++ auto.def
@@ -32,10 +32,12 @@
32 }
33
34 # Update the minimum required SQLite version number here.
35 define MINIMUM_SQLITE_VERSION "3.35.0"
36
 
 
37 if {[opt-bool print-minimum-sqlite-version]} {
38 puts [get-define MINIMUM_SQLITE_VERSION]
39 exit 0
40 }
41
@@ -166,17 +168,20 @@
166 find_system_sqlite
167
168 proc test_system_sqlite {} {
169 # Check compatibility of the system SQLite library by running the sqlcompttest.c
170 # program in the source tree
 
171 #
172 set cmdline {}
173 lappend cmdline {*}[get-define CCACHE]
174 lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
175 lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__
176 lappend cmdline {*}[get-define LDFLAGS]
177 lappend cmdline {*}[get-define LIBS]
 
 
178 set ok 1
179 set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
180 if {$err} {
181 configlog "Failed: [join $cmdline]"
182 if {[string length $result]>0} {configlog $result}
183
--- auto.def
+++ auto.def
@@ -32,10 +32,12 @@
32 }
33
34 # Update the minimum required SQLite version number here.
35 define MINIMUM_SQLITE_VERSION "3.35.0"
36
37 # This is useful for people wanting Fossil to use an external SQLite library
38 # to compare the one they have against the minimum required
39 if {[opt-bool print-minimum-sqlite-version]} {
40 puts [get-define MINIMUM_SQLITE_VERSION]
41 exit 0
42 }
43
@@ -166,17 +168,20 @@
168 find_system_sqlite
169
170 proc test_system_sqlite {} {
171 # Check compatibility of the system SQLite library by running the sqlcompttest.c
172 # program in the source tree
173 # passes MINIMUM_SQLITE_VERSION set at the top of this file to sqlcompttest.c
174 #
175 set cmdline {}
176 lappend cmdline {*}[get-define CCACHE]
177 lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
178 lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__
179 lappend cmdline {*}[get-define LDFLAGS]
180 lappend cmdline {*}[get-define LIBS]
181 set sqlite-version [string cat "-D MINIMUM_SQLITE_VERSION=" [get-define MINIMUM_SQLITE_VERSION]]
182 lappend cmdline {*}[set sqlite-version]
183 set ok 1
184 set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
185 if {$err} {
186 configlog "Failed: [join $cmdline]"
187 if {[string length $result]>0} {configlog $result}
188
--- src/sqlcompattest.c
+++ src/sqlcompattest.c
@@ -13,15 +13,18 @@
1313
** [email protected]
1414
** http://www.hwaci.com/drh/
1515
**
1616
*******************************************************************************
1717
**
18
-** This file is NOT part of the Fossil executable
18
+** This file is NOT part of the Fossil executable. It is called from
19
+** auto.def in the autosetup system.
1920
**
2021
** This file contains a test program used by ../configure with the
2122
** the --disable-internal-sqlite option to determine whether or
2223
** not the system SQLite library is sufficient to support Fossil.
24
+**
25
+** This must be compiled with -D MINIMUM_SQLITE_VERSION set in auto.def.
2326
**
2427
** It is preferred to statically link Fossil with the sqlite3.c source
2528
** file that is part of the source tree and not use any SQLite shared
2629
** library that is included with the system. But some packagers do not
2730
** like to do this. Hence, we provide the option to link Fossil against
@@ -38,23 +41,39 @@
3841
** lacks some capability that Fossil uses. A message on stdout describes
3942
** the missing feature.
4043
*/
4144
#include "sqlite3.h"
4245
#include <stdio.h>
46
+#include <string.h>
4347
4448
int main(int argc, char **argv){
49
+
50
+#if !defined(MINIMUM_SQLITE_VERSION)
51
+#error "Must set -DMINIMUM_SQLITE_VERSION=nn.nn.nn in auto.def"
52
+#endif
53
+
54
+#define QUOTE(VAL) #VAL
55
+#define STR(MACRO_VAL) QUOTE(MACRO_VAL)
56
+
57
+ char zMinimumVersionNumber[8]="nn.nn.nn";
58
+ strncpy((char *)&zMinimumVersionNumber,STR(MINIMUM_SQLITE_VERSION),sizeof(zMinimumVersionNumber));
59
+
60
+ long major, minor, release, version;
61
+ sscanf(zMinimumVersionNumber, "%li.%li.%li", &major, &minor, &release);
62
+ version=(major*1000000)+(minor*1000)+release;
63
+
4564
int i;
4665
static const char *zRequiredOpts[] = {
4766
"ENABLE_FTS4", /* Required for repository search */
4867
"ENABLE_JSON1", /* Required for the check-in locking protocol */
4968
"ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */
5069
};
5170
5271
/* Check minimum SQLite version number */
53
- if( sqlite3_libversion_number()<3033000 ){
54
- printf("found SQLite version %s but need 3.33.0 or later\n",
55
- sqlite3_libversion());
72
+ if( sqlite3_libversion_number()<version ){
73
+ printf("found system SQLite version %s but need %s or later, consider removing --disable-internal-sqlite\n",
74
+ sqlite3_libversion(),STR(MINIMUM_SQLITE_VERSION));
5675
return 1;
5776
}
5877
5978
for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){
6079
if( !sqlite3_compileoption_used(zRequiredOpts[i]) ){
6180
--- src/sqlcompattest.c
+++ src/sqlcompattest.c
@@ -13,15 +13,18 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file is NOT part of the Fossil executable
 
19 **
20 ** This file contains a test program used by ../configure with the
21 ** the --disable-internal-sqlite option to determine whether or
22 ** not the system SQLite library is sufficient to support Fossil.
 
 
23 **
24 ** It is preferred to statically link Fossil with the sqlite3.c source
25 ** file that is part of the source tree and not use any SQLite shared
26 ** library that is included with the system. But some packagers do not
27 ** like to do this. Hence, we provide the option to link Fossil against
@@ -38,23 +41,39 @@
38 ** lacks some capability that Fossil uses. A message on stdout describes
39 ** the missing feature.
40 */
41 #include "sqlite3.h"
42 #include <stdio.h>
 
43
44 int main(int argc, char **argv){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45 int i;
46 static const char *zRequiredOpts[] = {
47 "ENABLE_FTS4", /* Required for repository search */
48 "ENABLE_JSON1", /* Required for the check-in locking protocol */
49 "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */
50 };
51
52 /* Check minimum SQLite version number */
53 if( sqlite3_libversion_number()<3033000 ){
54 printf("found SQLite version %s but need 3.33.0 or later\n",
55 sqlite3_libversion());
56 return 1;
57 }
58
59 for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){
60 if( !sqlite3_compileoption_used(zRequiredOpts[i]) ){
61
--- src/sqlcompattest.c
+++ src/sqlcompattest.c
@@ -13,15 +13,18 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file is NOT part of the Fossil executable. It is called from
19 ** auto.def in the autosetup system.
20 **
21 ** This file contains a test program used by ../configure with the
22 ** the --disable-internal-sqlite option to determine whether or
23 ** not the system SQLite library is sufficient to support Fossil.
24 **
25 ** This must be compiled with -D MINIMUM_SQLITE_VERSION set in auto.def.
26 **
27 ** It is preferred to statically link Fossil with the sqlite3.c source
28 ** file that is part of the source tree and not use any SQLite shared
29 ** library that is included with the system. But some packagers do not
30 ** like to do this. Hence, we provide the option to link Fossil against
@@ -38,23 +41,39 @@
41 ** lacks some capability that Fossil uses. A message on stdout describes
42 ** the missing feature.
43 */
44 #include "sqlite3.h"
45 #include <stdio.h>
46 #include <string.h>
47
48 int main(int argc, char **argv){
49
50 #if !defined(MINIMUM_SQLITE_VERSION)
51 #error "Must set -DMINIMUM_SQLITE_VERSION=nn.nn.nn in auto.def"
52 #endif
53
54 #define QUOTE(VAL) #VAL
55 #define STR(MACRO_VAL) QUOTE(MACRO_VAL)
56
57 char zMinimumVersionNumber[8]="nn.nn.nn";
58 strncpy((char *)&zMinimumVersionNumber,STR(MINIMUM_SQLITE_VERSION),sizeof(zMinimumVersionNumber));
59
60 long major, minor, release, version;
61 sscanf(zMinimumVersionNumber, "%li.%li.%li", &major, &minor, &release);
62 version=(major*1000000)+(minor*1000)+release;
63
64 int i;
65 static const char *zRequiredOpts[] = {
66 "ENABLE_FTS4", /* Required for repository search */
67 "ENABLE_JSON1", /* Required for the check-in locking protocol */
68 "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */
69 };
70
71 /* Check minimum SQLite version number */
72 if( sqlite3_libversion_number()<version ){
73 printf("found system SQLite version %s but need %s or later, consider removing --disable-internal-sqlite\n",
74 sqlite3_libversion(),STR(MINIMUM_SQLITE_VERSION));
75 return 1;
76 }
77
78 for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){
79 if( !sqlite3_compileoption_used(zRequiredOpts[i]) ){
80

Keyboard Shortcuts

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