Fossil SCM
configure now checks system sqlite version against the version in auto.def
Commit
834f6515a77420dce8f02bc823a1e0684d190e19a450fa287bc8d04d5a723193
Parent
65c71961195d135…
2 files changed
+5
+23
-4
M
auto.def
+5
| --- auto.def | ||
| +++ auto.def | ||
| @@ -32,10 +32,12 @@ | ||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | # Update the minimum required SQLite version number here. |
| 35 | 35 | define MINIMUM_SQLITE_VERSION "3.35.0" |
| 36 | 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 | |
| 37 | 39 | if {[opt-bool print-minimum-sqlite-version]} { |
| 38 | 40 | puts [get-define MINIMUM_SQLITE_VERSION] |
| 39 | 41 | exit 0 |
| 40 | 42 | } |
| 41 | 43 | |
| @@ -166,17 +168,20 @@ | ||
| 166 | 168 | find_system_sqlite |
| 167 | 169 | |
| 168 | 170 | proc test_system_sqlite {} { |
| 169 | 171 | # Check compatibility of the system SQLite library by running the sqlcompttest.c |
| 170 | 172 | # program in the source tree |
| 173 | + # passes MINIMUM_SQLITE_VERSION set at the top of this file to sqlcompttest.c | |
| 171 | 174 | # |
| 172 | 175 | set cmdline {} |
| 173 | 176 | lappend cmdline {*}[get-define CCACHE] |
| 174 | 177 | lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS] |
| 175 | 178 | lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__ |
| 176 | 179 | lappend cmdline {*}[get-define LDFLAGS] |
| 177 | 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] | |
| 178 | 183 | set ok 1 |
| 179 | 184 | set err [catch {exec-with-stderr {*}$cmdline} result errinfo] |
| 180 | 185 | if {$err} { |
| 181 | 186 | configlog "Failed: [join $cmdline]" |
| 182 | 187 | if {[string length $result]>0} {configlog $result} |
| 183 | 188 |
| --- 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 |
+23
-4
| --- src/sqlcompattest.c | ||
| +++ src/sqlcompattest.c | ||
| @@ -13,15 +13,18 @@ | ||
| 13 | 13 | ** [email protected] |
| 14 | 14 | ** http://www.hwaci.com/drh/ |
| 15 | 15 | ** |
| 16 | 16 | ******************************************************************************* |
| 17 | 17 | ** |
| 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. | |
| 19 | 20 | ** |
| 20 | 21 | ** This file contains a test program used by ../configure with the |
| 21 | 22 | ** the --disable-internal-sqlite option to determine whether or |
| 22 | 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. | |
| 23 | 26 | ** |
| 24 | 27 | ** It is preferred to statically link Fossil with the sqlite3.c source |
| 25 | 28 | ** file that is part of the source tree and not use any SQLite shared |
| 26 | 29 | ** library that is included with the system. But some packagers do not |
| 27 | 30 | ** like to do this. Hence, we provide the option to link Fossil against |
| @@ -38,23 +41,39 @@ | ||
| 38 | 41 | ** lacks some capability that Fossil uses. A message on stdout describes |
| 39 | 42 | ** the missing feature. |
| 40 | 43 | */ |
| 41 | 44 | #include "sqlite3.h" |
| 42 | 45 | #include <stdio.h> |
| 46 | +#include <string.h> | |
| 43 | 47 | |
| 44 | 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 | + | |
| 45 | 64 | int i; |
| 46 | 65 | static const char *zRequiredOpts[] = { |
| 47 | 66 | "ENABLE_FTS4", /* Required for repository search */ |
| 48 | 67 | "ENABLE_JSON1", /* Required for the check-in locking protocol */ |
| 49 | 68 | "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */ |
| 50 | 69 | }; |
| 51 | 70 | |
| 52 | 71 | /* 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)); | |
| 56 | 75 | return 1; |
| 57 | 76 | } |
| 58 | 77 | |
| 59 | 78 | for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){ |
| 60 | 79 | if( !sqlite3_compileoption_used(zRequiredOpts[i]) ){ |
| 61 | 80 |
| --- 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 |