Fossil SCM

Initial go at a new --with-sqlite=tree|path|auto configure flag which enables building against out-of-tree sqlite3.o or libsqlite3, with the caveat that we do not know whether the external sqlite3 is built with all features we need, e.g. JSON1.

stephan 2021-12-23 20:38 trunk
Commit dfa758b016a90cff09fa6c6201ce2e1632b001b5eee9453d45e53c22fbb1a07f
1 file changed +38
+38
--- auto.def
+++ auto.def
@@ -8,10 +8,12 @@
88
with-openssl:path|auto|tree|none
99
=> {Look for OpenSSL in the given path, automatically, in the source tree, or none}
1010
with-miniz=0 => {Use miniz from the source tree}
1111
with-zlib:path|auto|tree
1212
=> {Look for zlib in the given path, automatically, or in the source tree}
13
+ with-sqlite:path|auto|tree
14
+ => {Look for sqlite in the given path, automatically, or in the source tree}
1315
with-exec-rel-paths=0
1416
=> {Enable relative paths for external diff/gdiff}
1517
with-sanitizer: => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined}
1618
with-th1-docs=0 => {Enable TH1 for embedded documentation pages}
1719
with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages}
@@ -448,10 +450,46 @@
448450
} else {
449451
if {[info exists ::zlib_lib]} {
450452
define-append LIBS $::zlib_lib
451453
}
452454
}
455
+
456
+# Check for sqlite3, using the given location if specified
457
+set sq3path [opt-val with-sqlite]
458
+if {$sq3path in {tree ""}} {
459
+ msg-result "Using sqlite3.c from this source tree."
460
+} else {
461
+ if {$sq3path != "auto"} {
462
+ # Look for sqlite3.o or libsqlite3.*
463
+ if {[file exists $sq3path/sqlite3.o]} {
464
+ # Prefer sqlite3.o if found. TODO: if we find sqlite3.c,
465
+ # include it in our build process.
466
+ define-append EXTRA_CFLAGS -I$sq3path
467
+ define-append EXTRA_LDFLAGS $sq3path/sqlite3.o -lpthread -lm
468
+ # ^^^ additional -lXXX flags are conservative estimates
469
+ msg-result "Using sqlite3.o from $sq3path"
470
+ } elseif { ([llength [glob -directory $sq3path/lib libsqlite3*]] != 0) \
471
+ && ([file exists $sq3path/include/sqlite3.h]) } {
472
+ # e.g. --with-sqlite=/usr/local. Try $sq3path/lib
473
+ # and $sq3path/include/sqlite3.h
474
+ define-append EXTRA_CFLAGS -I$sq3path/include
475
+ define-append EXTRA_LDFLAGS -L$sq3path/lib -lsqlite3 -lpthread -lm
476
+ # ^^^ additional -lXXX flags are conservative estimates
477
+ msg-result "Using -lsqlite3 from $sq3path"
478
+ } else {
479
+ # Assume $sq3path holds both the lib and header
480
+ cc-with [list -cflags "-I$sq3path -L$sq3path"]
481
+ define-append EXTRA_CFLAGS -I$sq3path
482
+ define-append EXTRA_LDFLAGS -L$sq3path -lsqlite3 -lpthread -lm
483
+ # ^^^ additional -lXXX flags are conservative estimates
484
+ msg-result "Using -lsqlite3 from $sq3path"
485
+ }
486
+ } elseif {![cc-check-includes sqlite3.h] || ![check-function-in-lib sqlite3_open_v2 sqlite3]} {
487
+ user-error "libsqlite3 not found please install it or specify the location with --with-sqlite"
488
+ }
489
+ define USE_SYSTEM_SQLITE 1
490
+}
453491
454492
set tclpath [opt-val with-tcl]
455493
if {$tclpath ne ""} {
456494
set tclprivatestubs [opt-bool with-tcl-private-stubs]
457495
# Note parse-tclconfig-sh is in autosetup/local.tcl
458496
--- auto.def
+++ auto.def
@@ -8,10 +8,12 @@
8 with-openssl:path|auto|tree|none
9 => {Look for OpenSSL in the given path, automatically, in the source tree, or none}
10 with-miniz=0 => {Use miniz from the source tree}
11 with-zlib:path|auto|tree
12 => {Look for zlib in the given path, automatically, or in the source tree}
 
 
13 with-exec-rel-paths=0
14 => {Enable relative paths for external diff/gdiff}
15 with-sanitizer: => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined}
16 with-th1-docs=0 => {Enable TH1 for embedded documentation pages}
17 with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages}
@@ -448,10 +450,46 @@
448 } else {
449 if {[info exists ::zlib_lib]} {
450 define-append LIBS $::zlib_lib
451 }
452 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
454 set tclpath [opt-val with-tcl]
455 if {$tclpath ne ""} {
456 set tclprivatestubs [opt-bool with-tcl-private-stubs]
457 # Note parse-tclconfig-sh is in autosetup/local.tcl
458
--- auto.def
+++ auto.def
@@ -8,10 +8,12 @@
8 with-openssl:path|auto|tree|none
9 => {Look for OpenSSL in the given path, automatically, in the source tree, or none}
10 with-miniz=0 => {Use miniz from the source tree}
11 with-zlib:path|auto|tree
12 => {Look for zlib in the given path, automatically, or in the source tree}
13 with-sqlite:path|auto|tree
14 => {Look for sqlite in the given path, automatically, or in the source tree}
15 with-exec-rel-paths=0
16 => {Enable relative paths for external diff/gdiff}
17 with-sanitizer: => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined}
18 with-th1-docs=0 => {Enable TH1 for embedded documentation pages}
19 with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages}
@@ -448,10 +450,46 @@
450 } else {
451 if {[info exists ::zlib_lib]} {
452 define-append LIBS $::zlib_lib
453 }
454 }
455
456 # Check for sqlite3, using the given location if specified
457 set sq3path [opt-val with-sqlite]
458 if {$sq3path in {tree ""}} {
459 msg-result "Using sqlite3.c from this source tree."
460 } else {
461 if {$sq3path != "auto"} {
462 # Look for sqlite3.o or libsqlite3.*
463 if {[file exists $sq3path/sqlite3.o]} {
464 # Prefer sqlite3.o if found. TODO: if we find sqlite3.c,
465 # include it in our build process.
466 define-append EXTRA_CFLAGS -I$sq3path
467 define-append EXTRA_LDFLAGS $sq3path/sqlite3.o -lpthread -lm
468 # ^^^ additional -lXXX flags are conservative estimates
469 msg-result "Using sqlite3.o from $sq3path"
470 } elseif { ([llength [glob -directory $sq3path/lib libsqlite3*]] != 0) \
471 && ([file exists $sq3path/include/sqlite3.h]) } {
472 # e.g. --with-sqlite=/usr/local. Try $sq3path/lib
473 # and $sq3path/include/sqlite3.h
474 define-append EXTRA_CFLAGS -I$sq3path/include
475 define-append EXTRA_LDFLAGS -L$sq3path/lib -lsqlite3 -lpthread -lm
476 # ^^^ additional -lXXX flags are conservative estimates
477 msg-result "Using -lsqlite3 from $sq3path"
478 } else {
479 # Assume $sq3path holds both the lib and header
480 cc-with [list -cflags "-I$sq3path -L$sq3path"]
481 define-append EXTRA_CFLAGS -I$sq3path
482 define-append EXTRA_LDFLAGS -L$sq3path -lsqlite3 -lpthread -lm
483 # ^^^ additional -lXXX flags are conservative estimates
484 msg-result "Using -lsqlite3 from $sq3path"
485 }
486 } elseif {![cc-check-includes sqlite3.h] || ![check-function-in-lib sqlite3_open_v2 sqlite3]} {
487 user-error "libsqlite3 not found please install it or specify the location with --with-sqlite"
488 }
489 define USE_SYSTEM_SQLITE 1
490 }
491
492 set tclpath [opt-val with-tcl]
493 if {$tclpath ne ""} {
494 set tclprivatestubs [opt-bool with-tcl-private-stubs]
495 # Note parse-tclconfig-sh is in autosetup/local.tcl
496

Keyboard Shortcuts

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