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.
Commit
dfa758b016a90cff09fa6c6201ce2e1632b001b5eee9453d45e53c22fbb1a07f
Parent
0aff8d8744c6131…
1 file changed
+38
M
auto.def
+38
| --- auto.def | ||
| +++ auto.def | ||
| @@ -8,10 +8,12 @@ | ||
| 8 | 8 | with-openssl:path|auto|tree|none |
| 9 | 9 | => {Look for OpenSSL in the given path, automatically, in the source tree, or none} |
| 10 | 10 | with-miniz=0 => {Use miniz from the source tree} |
| 11 | 11 | with-zlib:path|auto|tree |
| 12 | 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} | |
| 13 | 15 | with-exec-rel-paths=0 |
| 14 | 16 | => {Enable relative paths for external diff/gdiff} |
| 15 | 17 | with-sanitizer: => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined} |
| 16 | 18 | with-th1-docs=0 => {Enable TH1 for embedded documentation pages} |
| 17 | 19 | with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages} |
| @@ -448,10 +450,46 @@ | ||
| 448 | 450 | } else { |
| 449 | 451 | if {[info exists ::zlib_lib]} { |
| 450 | 452 | define-append LIBS $::zlib_lib |
| 451 | 453 | } |
| 452 | 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 | +} | |
| 453 | 491 | |
| 454 | 492 | set tclpath [opt-val with-tcl] |
| 455 | 493 | if {$tclpath ne ""} { |
| 456 | 494 | set tclprivatestubs [opt-bool with-tcl-private-stubs] |
| 457 | 495 | # Note parse-tclconfig-sh is in autosetup/local.tcl |
| 458 | 496 |
| --- 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 |