Fossil SCM
Modify auto.def to detect the case where the system SQLite is too old for WAL support (used by fossil).
Commit
5fe55cb10331cd85bab4fd79e405691e1ac32fd5
Parent
734af429e34905a…
1 file changed
+28
-9
M
auto.def
+28
-9
| --- auto.def | ||
| +++ auto.def | ||
| @@ -26,21 +26,40 @@ | ||
| 26 | 26 | define EXTRA_CFLAGS "" |
| 27 | 27 | define EXTRA_LDFLAGS "" |
| 28 | 28 | define USE_SYSTEM_SQLITE "" |
| 29 | 29 | |
| 30 | 30 | if {![opt-bool internal-sqlite]} { |
| 31 | - if {![cc-check-function-in-lib sqlite3_open sqlite3]} { | |
| 32 | - if {![cc-check-function-in-lib sqlite3_open sqlite3 {-ldl}]} { | |
| 33 | - user-error "system sqlite3 not found" | |
| 34 | - } else { | |
| 35 | - # On some systems (slackware), the libsqlite3.so file cannot be | |
| 36 | - # linked without also specifying -ldl. This is a bug in the | |
| 37 | - # distribution. | |
| 38 | - define-append EXTRA_LDFLAGS -ldl | |
| 31 | + proc find_internal_sqlite {} { | |
| 32 | + | |
| 33 | + # On some systems (slackware), libsqlite3 requires -ldl to link. So | |
| 34 | + # search for the system SQLite once with -ldl, and once without. If | |
| 35 | + # the library can only be found with $extralibs set to -ldl, then | |
| 36 | + # the code below will append -ldl to LIBS. | |
| 37 | + # | |
| 38 | + foreach extralibs {{} {-ldl}} { | |
| 39 | + | |
| 40 | + # Locate the system SQLite by searching for sqlite3_open(). Then check | |
| 41 | + # if sqlite3_wal_checkpoint() can be found as well. If we can find | |
| 42 | + # open() but not wal_checkpoint(), then the system SQLite is too old | |
| 43 | + # to link against fossil. | |
| 44 | + # | |
| 45 | + if {[cc-check-function-in-lib sqlite3_open sqlite3 $extralibs]} { | |
| 46 | + if {![cc-check-function-in-lib sqlite3_wal_checkpoint sqlite3 $extralibs]} { | |
| 47 | + user-error "system sqlite3 too old (require >= 3.7.0)" | |
| 48 | + } | |
| 49 | + | |
| 50 | + # Success. Update symbols and return. | |
| 51 | + # | |
| 52 | + define USE_SYSTEM_SQLITE 1 | |
| 53 | + define-append LIBS $extralibs | |
| 54 | + return | |
| 39 | 55 | } |
| 40 | 56 | } |
| 41 | - define USE_SYSTEM_SQLITE 1 | |
| 57 | + user-error "system sqlite3 not found" | |
| 58 | + } | |
| 59 | + | |
| 60 | + find_internal_sqlite | |
| 42 | 61 | } |
| 43 | 62 | |
| 44 | 63 | if {[opt-bool fossil-debug]} { |
| 45 | 64 | define-append EXTRA_CFLAGS -DFOSSIL_DEBUG |
| 46 | 65 | } |
| 47 | 66 |
| --- auto.def | |
| +++ auto.def | |
| @@ -26,21 +26,40 @@ | |
| 26 | define EXTRA_CFLAGS "" |
| 27 | define EXTRA_LDFLAGS "" |
| 28 | define USE_SYSTEM_SQLITE "" |
| 29 | |
| 30 | if {![opt-bool internal-sqlite]} { |
| 31 | if {![cc-check-function-in-lib sqlite3_open sqlite3]} { |
| 32 | if {![cc-check-function-in-lib sqlite3_open sqlite3 {-ldl}]} { |
| 33 | user-error "system sqlite3 not found" |
| 34 | } else { |
| 35 | # On some systems (slackware), the libsqlite3.so file cannot be |
| 36 | # linked without also specifying -ldl. This is a bug in the |
| 37 | # distribution. |
| 38 | define-append EXTRA_LDFLAGS -ldl |
| 39 | } |
| 40 | } |
| 41 | define USE_SYSTEM_SQLITE 1 |
| 42 | } |
| 43 | |
| 44 | if {[opt-bool fossil-debug]} { |
| 45 | define-append EXTRA_CFLAGS -DFOSSIL_DEBUG |
| 46 | } |
| 47 |
| --- auto.def | |
| +++ auto.def | |
| @@ -26,21 +26,40 @@ | |
| 26 | define EXTRA_CFLAGS "" |
| 27 | define EXTRA_LDFLAGS "" |
| 28 | define USE_SYSTEM_SQLITE "" |
| 29 | |
| 30 | if {![opt-bool internal-sqlite]} { |
| 31 | proc find_internal_sqlite {} { |
| 32 | |
| 33 | # On some systems (slackware), libsqlite3 requires -ldl to link. So |
| 34 | # search for the system SQLite once with -ldl, and once without. If |
| 35 | # the library can only be found with $extralibs set to -ldl, then |
| 36 | # the code below will append -ldl to LIBS. |
| 37 | # |
| 38 | foreach extralibs {{} {-ldl}} { |
| 39 | |
| 40 | # Locate the system SQLite by searching for sqlite3_open(). Then check |
| 41 | # if sqlite3_wal_checkpoint() can be found as well. If we can find |
| 42 | # open() but not wal_checkpoint(), then the system SQLite is too old |
| 43 | # to link against fossil. |
| 44 | # |
| 45 | if {[cc-check-function-in-lib sqlite3_open sqlite3 $extralibs]} { |
| 46 | if {![cc-check-function-in-lib sqlite3_wal_checkpoint sqlite3 $extralibs]} { |
| 47 | user-error "system sqlite3 too old (require >= 3.7.0)" |
| 48 | } |
| 49 | |
| 50 | # Success. Update symbols and return. |
| 51 | # |
| 52 | define USE_SYSTEM_SQLITE 1 |
| 53 | define-append LIBS $extralibs |
| 54 | return |
| 55 | } |
| 56 | } |
| 57 | user-error "system sqlite3 not found" |
| 58 | } |
| 59 | |
| 60 | find_internal_sqlite |
| 61 | } |
| 62 | |
| 63 | if {[opt-bool fossil-debug]} { |
| 64 | define-append EXTRA_CFLAGS -DFOSSIL_DEBUG |
| 65 | } |
| 66 |