mirror of
https://github.com/sqlite/sqlite.git
synced 2024-11-21 19:29:09 +01:00
Move the linenoise flavor check from auto.def to proj.tcl for re-use in downstream projects.
FossilOrigin-Name: 84e503dc1e3672fe7787fb747ed70ca14ad181a743925bd1658c40baaa8a27cd
This commit is contained in:
parent
2d73547cdb
commit
1e563f4817
60
auto.def
60
auto.def
@ -731,39 +731,6 @@ if {1} {
|
||||
unset ts tsn
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Attempts to determine whether the given linenoise header file is of
|
||||
# the "antirez" or "msteveb" flavor. It returns 1 for antirez, 2 for
|
||||
# msteveb, and 0 if it's neither.
|
||||
proc sqlite-which-linenoise {dotH} {
|
||||
set sourceOrig {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
/* size_t has to be be in there _somewhere_ */
|
||||
}
|
||||
append sourceOrig [proj-file-content $dotH]
|
||||
set sourceTail {
|
||||
int main(void) {
|
||||
linenoiseSetCompletionCallback(0 $arg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
set arg ""
|
||||
set source $sourceOrig
|
||||
append source [subst $sourceTail]
|
||||
if {[cctest -nooutput 1 -source $source]} {
|
||||
return 1
|
||||
}
|
||||
set arg ", 0"
|
||||
set source $sourceOrig
|
||||
append source [subst $sourceTail]
|
||||
if {[cctest -nooutput 1 -source $source]} {
|
||||
return 2
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# sqlite-check-line-editing jumps through proverbial hoops to try to
|
||||
# find a working line-editing library, setting:
|
||||
@ -821,20 +788,6 @@ proc sqlite-check-line-editing {} {
|
||||
if {![file exists $lnH] } {
|
||||
proj-fatal "Cannot find linenoise.h in $dirLn"
|
||||
}
|
||||
set flavor ""
|
||||
switch -- [sqlite-which-linenoise $lnH] {
|
||||
1 {
|
||||
set flavor "antirez"
|
||||
define HAVE_LINENOISE 1
|
||||
}
|
||||
2 {
|
||||
set flavor "msteveb"
|
||||
define HAVE_LINENOISE 2
|
||||
}
|
||||
default {
|
||||
user-error "Cannot determine the flavor of linenoise from $lnH"
|
||||
}
|
||||
}
|
||||
set lnC ""
|
||||
set lnCOpts {linenoise-ship.c linenoise.c}
|
||||
foreach f $lnCOpts {
|
||||
@ -846,9 +799,18 @@ proc sqlite-check-line-editing {} {
|
||||
if {"" eq $lnC} {
|
||||
proj-fatal "Cannot find any of $lnCOpts in $dirLn"
|
||||
}
|
||||
msg-result "Using $flavor linenoise from $dirLn"
|
||||
set flavor ""
|
||||
set lnVal [proj-which-linenoise $lnH]
|
||||
switch -- $lnVal {
|
||||
1 { set flavor "antirez" }
|
||||
2 { set flavor "msteveb" }
|
||||
default {
|
||||
proj-fatal "Cannot determine the flavor of linenoise from $lnH"
|
||||
}
|
||||
}
|
||||
define CFLAGS_READLINE "-I$dirLn $lnC"
|
||||
sqlite-add-shell-opt -DHAVE_LINENOISE=[get-define HAVE_LINENOISE]
|
||||
define HAVE_LINENOISE $lnVal
|
||||
sqlite-add-shell-opt -DHAVE_LINENOISE=$lnVal
|
||||
return "linenoise ($flavor)"
|
||||
} elseif {[opt-bool editline]} {
|
||||
# libedit mimics libreadline and on some systems does not have its
|
||||
|
@ -989,3 +989,36 @@ proc proj-redefine-cc-for-build {} {
|
||||
define CC_FOR_BUILD [get-define CC]
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Attempts to determine whether the given linenoise header file is of
|
||||
# the "antirez" or "msteveb" flavor. It returns 1 for antirez, 2 for
|
||||
# msteveb, and 0 if it's neither.
|
||||
proc proj-which-linenoise {dotH} {
|
||||
set sourceOrig {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
/* size_t has to be be in there _somewhere_ */
|
||||
}
|
||||
append sourceOrig [proj-file-content $dotH]
|
||||
set sourceTail {
|
||||
int main(void) {
|
||||
linenoiseSetCompletionCallback(0 $arg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
set arg ""
|
||||
set source $sourceOrig
|
||||
append source [subst $sourceTail]
|
||||
if {[cctest -nooutput 1 -source $source]} {
|
||||
return 1
|
||||
}
|
||||
set arg ", 0"
|
||||
set source $sourceOrig
|
||||
append source [subst $sourceTail]
|
||||
if {[cctest -nooutput 1 -source $source]} {
|
||||
return 2
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Expand\s[c0048e4482e9]\sto\sdetermine\sthe\slinenoise\sAPI\sflavor\svia\sa\scompile\stest\srather\sthan\sguessing\sbased\son\sthe\sfilename.
|
||||
D 2024-10-30T22:41:12.401
|
||||
C Move\sthe\slinenoise\sflavor\scheck\sfrom\sauto.def\sto\sproj.tcl\sfor\sre-use\sin\sdownstream\sprojects.
|
||||
D 2024-10-30T22:49:40.804
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
|
||||
@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d
|
||||
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
|
||||
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
|
||||
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||
F auto.def 9a03b31df3ceaf4fbf62e3467502caac5dda856ba73d4a47b63b4c379805313c
|
||||
F auto.def 690effe8c5d7bb046120bd30400896b1a7fdd649912c01114df1c0df400bb62b
|
||||
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
||||
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
|
||||
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
|
||||
@ -49,7 +49,7 @@ F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bd
|
||||
F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
|
||||
F autosetup/jimsh0.c 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6
|
||||
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
|
||||
F autosetup/proj.tcl bbcad82f274f23b4467ba346a750b340ba97ff6218e231e8b471f8b960ed1273
|
||||
F autosetup/proj.tcl 035cc7ab786b11eb771f19bca7d908cd64f783af85a21e6594a3634acd67b726
|
||||
F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
|
||||
F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f
|
||||
F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9
|
||||
@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
|
||||
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
|
||||
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P e06574c6b4b666ef26f0fa06e6d60e5d896caaf1b1ca27f5369f5b7650d12b9b
|
||||
R d52ea075c2a44b2ded7d1c0f8762d401
|
||||
P dbf0079190d98ec1760cc3b55aa0116c9f85f215586bd864c5d6cede5a034fa5
|
||||
R c2cdfa3dffe3b9b6690b173654ff9db0
|
||||
U stephan
|
||||
Z 35f287fa088fe3c09becc3325399abda
|
||||
Z 0dcc5db1b022ddc0e6c0ca033d369137
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
dbf0079190d98ec1760cc3b55aa0116c9f85f215586bd864c5d6cede5a034fa5
|
||||
84e503dc1e3672fe7787fb747ed70ca14ad181a743925bd1658c40baaa8a27cd
|
||||
|
Loading…
Reference in New Issue
Block a user