Lines Matching +full:dll +full:- +full:config

3 # that they can be reused in the autoconf sub-tree. This file requires
6 if {[string first " " $autosetup(srcdir)] != -1} {
7 user-error "The pathname of the source tree\
10 if {[string first " " $autosetup(builddir)] != -1} {
11 user-error "The pathname of the build directory\
19 # --prefix=... to work and to emit the Host/Build system info, but we
20 # don't want those to interfere with --help output.
21 define PACKAGE_VERSION [proj-file-content -trim $::autosetup(srcdir)/VERSION]
22 if {"--help" ni $::argv} {
23 msg-result "Configuring SQLite version [get-define PACKAGE_VERSION]"
26 if {"--help" ni $::argv} {
27 proj-tweak-default-env-dirs
28 msg-result "Source dir = $::autosetup(srcdir)"
29 msg-result "Build dir = $::autosetup(builddir)"
30 use cc cc-db cc-shared cc-lib pkg-config
34 # Object for communicating certain config-time state across various
35 # auto.def-related pieces.
36 array set sqliteConfig [subst [proj-strip-hash-comments {
38 # Gets set by [sqlite-configure] (the main configure script driver).
39 build-mode unknown
43 use-jim-for-codegen 0
45 # Set to 1 when cross-compiling This value may be changed by certain
46 # build options, so it's important that config code which checks for
47 # cross-compilation uses this var instead of
48 # [proj-is-cross-compiling].
49 is-cross-compiling [proj-is-cross-compiling]
51 # Pass msg-debug=1 to configure to enable obnoxiously loud output
52 # from [msg-debug].
53 msg-debug-enabled 0
55 # Output file for --dump-defines. Intended only for build debugging
57 dump-defines-txt ./config.defines.txt
59 # If not empty then --dump-defines will dump not only
60 # (dump-defines-txt) but also a JSON file named after this option's
62 dump-defines-json ""
65 # The list of feature --flags which the --all flag implies. This
68 all-flag-enables {fts4 fts5 rtree geopoly session}
71 # Default value for the --all flag. Can hypothetically be modified
72 # by non-canonical builds.
74 all-flag-default 0
78 # Processes all configure --flags for this build, run build-specific
79 # config checks, then finalize the configure process. $buildMode must
82 # scope, then post-configuration finalization is run. $configScript is
84 # $buildMode, with the caveat that _some_ build-specific code is
87 # The intent is that all (or almost all) build-mode-specific
91 # use sqlite-config
92 # sqlite-configure BUILD_NAME { build-specific configure script }
94 # There are snippets of build-mode-specific decision-making in
95 # [sqlite-configure-finalize]
96 proc sqlite-configure {buildMode configScript} {
97 proj-assert {$::sqliteConfig(build-mode) eq "unknown"} \
98 "sqlite-configure must not be called more than once"
101 user-error "Invalid build mode: $buildMode. Expecting one of: $allBuildModes"
103 if {$::sqliteConfig(all-flag-default)} {
104 set allFlagHelp "Disable these extensions: $::sqliteConfig(all-flag-enables)"
106 set allFlagHelp "Enable these extensions: $::sqliteConfig(all-flag-enables)"
109 set ::sqliteConfig(build-mode) $buildMode
124 # stringopt: => "an option which takes an argument, e.g. --stringopt=value"
127 # optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help"
130 # especially booleans. Each bool-type --FLAG implicitly gets
131 # --enable-FLAG and --disable-FLAG forms. That can lead lead to some
137 # which defaults to true is, in the --help text, rendered as:
139 # --disable-json Disable JSON functions
143 # --enable-FLAG
145 # Non-boolean flags, in contrast, use the names specifically given to
146 # them in the [options] invocation. e.g. "with-tcl" is the --with-tcl
152 # - [opt-bool FLAG] is autosetup's built-in command for this, but we
154 # - [proj-opt-truthy FLAG]
155 # - [proj-opt-if-truthy FLAG {THEN} {ELSE}]
157 # Non-boolean (i.e. string) flags:
158 # - [opt-val FLAG ?default?]
159 # - [opt-str ...] - see the docs in ./autosetup/autosetup
161 # [proj-opt-was-provided] can be used to determine whether a flag was
172 # passed on to [options]. The order of each Y and sub-Y is
173 # retained, which is significant for rendering of --help.
178 # a newline: it starts left-aligned, directly under the --flag, and
180 # pretty-printed.
186 build-modes {
196 # Library-level features and defaults
197 lib-features {
200 with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always}
201 load-extension=1 => {Disable loading of external extensions}
202 # ^^^ one of the downstream custom builds overrides the load-extension default to 0, which
203 # confuses the --help text generator. https://github.com/msteveb/autosetup/issues/77
211 update-limit => {Enable the UPDATE/DELETE LIMIT clause}
215 all=$::sqliteConfig(all-flag-default) => {$allFlagHelp}
227 This tree requires TCL for code generation but can use the in-tree
232 with-tcl:DIR
236 the --prefix flag.}
237 with-tclsh:PATH
239 tclConfig.sh and (B) all TCL-based code generation. Warning: if
244 static-tclsqlite3=0
245 => {Statically-link tclsqlite3. This only works if TCL support is
253 # Options for line-editing modes for the CLI shell
254 line-editing {
258 # --with-readline-lib is a backwards-compatible alias for
259 # --with-readline-ldflags
260 with-readline-lib:
261 with-readline-ldflags:=auto
262 => {Readline LDFLAGS, e.g. -lreadline -lncurses}
263 # --with-readline-inc is a backwards-compatible alias for
264 # --with-readline-cflags.
265 with-readline-inc:
266 with-readline-cflags:=auto
267 => {Readline CFLAGS, e.g. -I/path/to/includes}
268 with-readline-header:PATH
269 => {Full path to readline.h, from which --with-readline-cflags will be derived}
270 with-linenoise:DIR
280 with-icu-ldflags:LDFLAGS
282 ICU libraries. e.g. on Ubuntu systems, try '-licui18n -licuuc -licudata'.}
283 with-icu-cflags:CFLAGS
285 e.g. -I/usr/local/include}
286 with-icu-config:=auto
287 => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config,
288 /path/to/icu-config}
289 icu-collations=0
290 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=...
291 or --with-icu-config}
296 alternative-builds {
298 with-wasi-sdk:=/opt/wasi-sdk
299 => {Top-most dir of the wasi-sdk for a WASI build}
303 # Note that --static-cli-shell has a completely different
304 # meaning from --static-shell in the autoconf build!
305 # --[disable-]static-shell is a legacy flag which we can't
307 static-cli-shell=0
308 => {Statically-link the sqlite3 CLI shell.
314 static-shells=0
315 => {Shorthand for --static-cli-shell --static-tclsqlite3}
317 with-emsdk:=auto
318 => {Top-most dir of the Emscripten SDK installation.
321 amalgamation-extra-src:FILES
322 => {Space-separated list of soure files to append as-is to the resulting
330 # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704
331 # Note that this has a different meaning from --static-cli-shell in the
333 static-shell=1
334 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c}
346 e.g. --soname=9.10 equates to "libsqlite3.so.9.10".}
347 # dll-basename: https://sqlite.org/forum/forumpost/828fdfe904
348 dll-basename:=auto
349 => {Specifies the base name of the resulting DLL file.
351 a platform-dependent default is used. On some platforms this flag
353 explicitly disable platform-dependent activation on such systems.}
354 # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2
355 out-implib:=auto
356 => {Enable use of --out-implib linker flag to generate an
357 "import library" for the DLL. The output's base name is
368 # Note that using the --debug/--enable-debug flag here
370 # --debug to --autosetup-debug. See details in
372 with-debug=0
376 performance-critical loops. Never use --debug for production
383 => {Enable dev-mode build: automatically enables certain other flags}
384 test-status
390 dynlink-tools
392 asan-fsanitize:=auto
393 => {Comma- or space-separated list of -fsanitize flags for use with the
394 fuzzcheck-asan tool. Only those which the compiler claims to support
398 dump-defines=0
399 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt)
405 set allFlags [proj-strip-hash-comments $allFlags]
406 # ^^^ lappend of [sqlite-custom-flags] introduces weirdness if
407 # we delay [proj-strip-hash-comments] until after that.
411 # sqlite-custom.tcl is intended only for vendor-branch-specific
412 # customization. See autosetup/README.md#branch-customization for
414 if {[file exists $::autosetup(libdir)/sqlite-custom.tcl]} {
415 uplevel 1 {source $::autosetup(libdir)/sqlite-custom.tcl}
418 if {[llength [info proc sqlite-custom-flags]] > 0} {
419 # sqlite-custom-flags is assumed to be imported via
420 # autosetup/sqlite-custom.tcl.
421 set scf [sqlite-custom-flags]
423 lappend allFlags sqlite-custom-flags $scf
428 foreach {group XY} [subst -nobackslashes -nocommands $allFlags] {
431 options-add $Y
440 dict incr xopts -level
443 sqlite-configure-phase1 $buildMode
445 sqlite-configure-finalize
446 }; # sqlite-configure
449 # Runs "phase 1" of the configure process: after initial --flags
450 # handling but before the build-specific parts are run. $buildMode
451 # must be the mode which was passed to [sqlite-configure].
452 proc sqlite-configure-phase1 {buildMode} {
455 define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum
456 define PACKAGE_STRING "[get-define PACKAGE_NAME] [get-define PACKAGE_VERSION]"
457 proj-xfer-options-aliases {
458 # Carry values from hidden --flag aliases over to their canonical
460 # to all build modes supported by [sqlite-configure].
461 with-readline-inc => with-readline-cflags
462 with-readline-lib => with-readline-ldflags
463 with-debug => debug
465 set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]]
466 proc-debug "msg-debug is enabled"
467 proj-setup-autoreconfig SQLITE_AUTORECONFIG
468 proj-file-extensions
469 if {".exe" eq [get-define TARGET_EXEEXT]} {
476 sqlite-setup-default-cflags
478 if {[opt-bool largefile]} {
482 # --enable/disable-largefile flag is retained because it's
484 # visible side-effects, though: the generated sqlite_cfg.h may (or
486 cc-check-lfs
489 proj-dot-ins-append $srcdir/Makefile.in
491 proj-dot-ins-append $srcdir/sqlite3.pc.in
493 }; # sqlite-configure-phase1
496 # Performs late-stage config steps common to all supported
497 # $::sqliteConfig(build-mode) values.
498 proc sqlite-configure-finalize {} {
499 sqlite-handle-rpath
500 sqlite-handle-soname
501 sqlite-handle-threadsafe
502 sqlite-handle-tempstore
503 sqlite-handle-load-extension
504 sqlite-handle-math
505 sqlite-handle-icu
506 if {[proj-opt-exists readline]} {
507 sqlite-handle-line-editing
509 if {[proj-opt-exists shared]} {
510 proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?"
512 if {[proj-opt-exists static]} {
513 if {![proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?"]} {
515 proj-indented-notice {
516 NOTICE: static lib build may be implicitly re-activated by
521 sqlite-handle-env-quirks
522 sqlite-handle-common-feature-flags
523 sqlite-finalize-feature-flags
524 sqlite-process-dot-in-files; # do not [define] anything after this
525 sqlite-dump-defines
529 # Internal config-time debugging output routine. It generates no
530 # output unless msg-debug=1 is passed to the configure script.
531 proc msg-debug {msg} {
532 if {$::sqliteConfig(msg-debug-enabled)} {
533 puts stderr [proj-bold "** DEBUG: $msg"]
537 # A [msg-debug] proxy which prepends the name of the current proc to
540 proc proc-debug {msg} {
541 msg-debug "\[[proj-scope 1]\]: $msg"
544 define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
545 define OPT_SHELL {} ; # Feature-related CFLAGS for the sqlite3 CLI app
548 # -shell then it strips that arg and passes the remaining args the
549 # sqlite-add-shell-opt in addition to adding them to
551 # -DSQLITE_ENABLE/OMIT/... flags, but that is not enforced here.
552 proc sqlite-add-feature-flag {args} {
554 if {"-shell" eq [lindex $args 0]} {
559 sqlite-add-shell-opt {*}$args
561 define-append OPT_FEATURE_FLAGS {*}$args
567 proc sqlite-add-shell-opt {args} {
569 define-append OPT_SHELL {*}$args
579 proc sqlite-affirm-have-math {featureName} {
580 if {"" eq [get-define LDFLAGS_MATH ""]} {
581 if {![msg-quiet proj-check-function-in-lib log m]} {
582 user-error "Missing math APIs for $featureName"
584 set lfl [get-define lib_log ""]
587 user-notice "Forcing requirement of $lfl for $featureName"
595 # build this must come before [sqlite-handle-wasi-sdk].
596 proc sqlite-check-common-bins {} {
597 cc-check-tools ld ar ; # must come before [sqlite-handle-wasi-sdk]
598 if {"" eq [proj-bin-define install]} {
599 proj-warn "Cannot find install binary, so 'make install' will not work."
605 # Run checks for system-level includes and libs which are common to
609 # [sqlite-handle-wasi-sdk], as that function may change the
611 proc sqlite-check-common-system-deps {} {
613 cc-with {-includes stdint.h} \
614 {cc-check-types int8_t int16_t int32_t int64_t intptr_t \
618 cc-check-functions gmtime_r isnan localtime_r localtime_s \
624 # Some systems (ex: SunOS) require -lrt in order to use nanosleep
626 if {[proj-check-function-in-lib $func rt]} {
627 set ldrt [get-define lib_${func} ""]
638 cc-check-includes \
644 if {[cc-check-includes zlib.h] && [proj-check-function-in-lib deflate z]} {
647 define LDFLAGS_ZLIB -lz
648 sqlite-add-shell-opt -DSQLITE_HAVE_ZLIB=1
656 # Move -DSQLITE_OMIT... and -DSQLITE_ENABLE... flags from CFLAGS and
658 proc sqlite-munge-cflags {} {
659 # Move CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and
660 # -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived
669 # CFLAGS/CPPFLAGS-specified feature flags, all bets are off. There
673 foreach cf [get-define $flagDef ""] {
674 switch -glob -- $cf {
675 -DSQLITE_OMIT* -
676 -DSQLITE_ENABLE* {
677 sqlite-add-feature-flag $cf
690 foreach cf [get-define BUILD_CFLAGS ""] {
691 switch -glob -- $cf {
692 -DSQLITE_OMIT* -
693 -DSQLITE_ENABLE* {}
704 proc sqlite-setup-default-cflags {} {
711 # cross-compiling.
713 # When cross-compiling we default to not using the -g flag, based on a
716 set defaultCFlags {-O2}
717 if {!$::sqliteConfig(is-cross-compiling)} {
718 lappend defaultCFlags -g
720 define CFLAGS [proj-get-env CFLAGS $defaultCFlags]
722 define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}]
723 sqlite-munge-cflags
728 proc sqlite-handle-common-feature-flags {} {
729 msg-result "Feature flags..."
730 if {![opt-bool all]} {
731 # Special handling for --disable-all
732 foreach flag $::sqliteConfig(all-flag-enables) {
733 if {![proj-opt-was-provided $flag]} {
734 proj-opt-set $flag 0
738 foreach {boolFlag featureFlag ifSetEvalThis} [proj-strip-hash-comments {
742 # apply, so that combinations like (--all --disable-geopoly)
744 # flags which depend on each other will behave in non-intuitive
747 # --all --disable-rtree
750 # The --geopoly flag, though, will automatically re-enable
751 # --rtree, so --disable-rtree won't actually disable anything in
753 foreach k $::sqliteConfig(all-flag-enables) {
754 if {![proj-opt-was-provided $k]} {
755 proj-opt-set $k 1
759 fts3 -DSQLITE_ENABLE_FTS3 {sqlite-affirm-have-math fts3}
760 fts4 -DSQLITE_ENABLE_FTS4 {sqlite-affirm-have-math fts4}
761 fts5 -DSQLITE_ENABLE_FTS5 {sqlite-affirm-have-math fts5}
762 geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree}
763 rtree -DSQLITE_ENABLE_RTREE {}
764 session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {}
765 update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {}
766 memsys5 -DSQLITE_ENABLE_MEMSYS5 {}
768 if {[opt-bool memsys5]} {
769 proj-warn "not enabling memsys3 because memsys5 is enabled."
772 sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3
775 scanstatus -DSQLITE_ENABLE_STMT_SCANSTATUS {}
782 proj-if-opt-truthy $boolFlag {
783 sqlite-add-feature-flag $featureFlag
785 msg-result " + $boolFlag"
789 msg-result " - $boolFlag"
795 # config option $boolFlag is false, [sqlite-add-feature-flag
797 # -DSQLITE_OMIT_...
799 json -DSQLITE_OMIT_JSON
801 if {[proj-opt-truthy $boolFlag]} {
802 msg-result " + $boolFlag"
804 sqlite-add-feature-flag $featureFlag
805 msg-result " - $boolFlag"
813 proc sqlite-finalize-feature-flags {} {
814 set oFF [get-define OPT_FEATURE_FLAGS]
816 define OPT_FEATURE_FLAGS [lsort -unique $oFF]
817 msg-result "Library feature flags: [get-define OPT_FEATURE_FLAGS]"
819 set oFF [get-define OPT_SHELL]
821 define OPT_SHELL [lsort -unique $oFF]
822 msg-result "Shell options: [get-define OPT_SHELL]"
824 if {"" ne [set extraSrc [get-define AMALGAMATION_EXTRA_SRC ""]]} {
825 proj-assert {"canonical" eq $::sqliteConfig(build-mode)}
826 msg-result "Appending source files to amalgamation: $extraSrc"
828 if {[lsearch [get-define TARGET_DEBUG ""] -DSQLITE_DEBUG=1] > -1} {
829 msg-result "Note: this is a debug build, so performance will suffer."
834 # Checks for the --debug flag and [define]s TARGET_DEBUG based on
837 proc sqlite-handle-debug {} {
838 msg-checking "SQLITE_DEBUG build? "
839 proj-if-opt-truthy debug {
840 define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -O0 -Wall}
841 sqlite-add-feature-flag -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE
842 proj-opt-set memsys5
843 msg-result yes
845 define TARGET_DEBUG {-DNDEBUG}
846 msg-result no
853 proc sqlite-handle-soname {} {
855 if {[proj-opt-was-provided soname]} {
856 set soname [join [opt-val soname] ""]
858 # Enabling soname breaks linking for the --dynlink-tools feature,
864 switch -exact -- $soname {
865 none - "" { return 0 }
869 # use it as-is
876 proc-debug "soname=$soname"
877 if {[proj-check-soname $soname]} {
878 define LDFLAGS_LIBSQLITE3_SONAME [get-define LDFLAGS_SONAME_PREFIX]$soname
879 msg-result "Setting SONAME using: [get-define LDFLAGS_LIBSQLITE3_SONAME]"
880 } elseif {[proj-opt-was-provided soname]} {
881 # --soname was explicitly requested but not available, so fail fatally
882 proj-fatal "This environment does not support SONAME."
884 # --soname was not explicitly requested but not available, so just warn
885 msg-result "This environment does not support SONAME."
890 # If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to
893 # --enable-threadsafe is not set, adds -DSQLITE_THREADSAFE=0 to
895 proc sqlite-handle-threadsafe {} {
896 msg-checking "Support threadsafe operation? "
899 proj-if-opt-truthy threadsafe {
900 msg-result "Checking for libs..."
901 if {[proj-check-function-in-lib pthread_create pthread]
902 && [proj-check-function-in-lib pthread_mutexattr_init pthread]} {
904 define LDFLAGS_PTHREAD [get-define lib_pthread_create]
907 } elseif {[proj-opt-was-provided threadsafe]} {
908 … user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check."
910 msg-result "pthread support not detected"
913 # found because it's in -lc on some platforms.
915 msg-result "Disabled using --disable-threadsafe"
917 sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable}
922 # Handles the --with-tempstore flag.
927 proc sqlite-handle-tempstore {} {
928 if {[proj-opt-was-provided with-tempstore]} {
929 set ts [opt-val with-tempstore no]
931 msg-checking "Use an in-RAM database for temporary tables? "
932 switch -exact -- $ts {
938 user-error "Invalid --with-tempstore value '$ts'. Use one of: never, no, yes, always"
941 msg-result $ts
942 sqlite-add-feature-flag -DSQLITE_TEMP_STORE=$tsn
947 # Check for the Emscripten SDK for building the web-based wasm
949 # does. Most of the work is done via [proj-check-emsdk], then this
952 # - EMCC_WRAPPER = "" or top-srcdir/tool/emcc.sh
953 # - BIN_WASM_OPT = "" or path to wasm-opt
954 # - BIN_WASM_STRIP = "" or path to wasm-strip
961 # 2) wasm-strip is part of the wabt package:
965 # and this project requires it for production-mode builds but not dev
968 proc sqlite-handle-emsdk {} {
975 # even when doing an out-of-tree build. The ext/wasm pieces do not
976 # support an out-of-tree build so we treat that case as if EMSDK
978 msg-result "Out-of tree build: not checking for EMSDK."
982 set extWasmConfig $srcdir/ext/wasm/config.make
983 if {![get-define HAVE_WASI_SDK] && [proj-check-emsdk]} {
985 set emsdkHome [get-define EMSDK_HOME ""]
986 proj-assert {"" ne $emsdkHome}
988 proj-bin-define wasm-strip
989 proj-bin-define bash; # ext/wasm/GNUmakefile requires bash
990 if {[file-isexec $emsdkHome/upstream/bin/wasm-opt]} {
991 define BIN_WASM_OPT $emsdkHome/upstream/bin/wasm-opt
994 proj-bin-define wasm-opt BIN_WASM_OPT
996 proj-dot-ins-append $emccSh.in $emccSh {
999 proj-dot-ins-append $extWasmConfig.in $extWasmConfig
1002 file delete -force -- $emccSh $extWasmConfig
1007 # Internal helper for [sqlite-check-line-editing]. Returns a list of
1011 # sqlite-check-line-editing figure out how to find libreadline and
1013 # result value, e.g. by modifying configure --flags.
1014 proc sqlite-get-readline-dir-list {} {
1016 # $prefix and some platform-specific dirs, originates from the
1018 set dirs [list [get-define prefix]]
1019 switch -glob -- [get-define host] {
1020 *-linux-android {
1024 *-mingw32 {
1027 *-mingw64 {
1030 *-haiku {
1032 if {[opt-val with-readline-ldflags] in {auto ""}} {
1033 # If the user did not supply their own --with-readline-ldflags
1036 if {"" ne [glob -nocomplain /boot/system/lib/libreadline*]} {
1037 proj-opt-set with-readline-ldflags {-L/boot/system/lib -lreadline}
1047 #proc-debug "dirs=$rv"
1052 # sqlite-check-line-editing jumps through proverbial hoops to try to
1053 # find a working line-editing library, setting:
1055 # - HAVE_READLINE to 0 or 1
1056 # - HAVE_LINENOISE to 0, 1, or 2
1057 # - HAVE_EDITLINE to 0 or 1
1059 # Only one of ^^^ those will be set to non-0.
1061 # - LDFLAGS_READLINE = linker flags or empty string
1063 # - CFLAGS_READLINE = compilation flags for clients or empty string.
1070 # Returns a string describing which line-editing approach to use, or
1075 # 1) --with-linenoise trumps all others and skips all of the
1078 # 2) --editline trumps --readline
1080 # 3) --disable-readline trumps --readline
1085 # corresponding --FEATURE flag was explicitly given, fail fatally,
1087 proc sqlite-check-line-editing {} {
1088 msg-result "Checking for line-editing capability..."
1094 set failIfNotFound 0 ; # Gets set to 1 for explicit --FEATURE requests
1097 set libsForReadline {readline edit} ; # -l<LIB> names to check for readline().
1101 set dirLn [opt-val with-linenoise]
1105 proj-fatal "--with-linenoise value is not a directory"
1109 proj-fatal "Cannot find linenoise.h in $dirLn"
1112 set lnCOpts {linenoise-ship.c linenoise.c}
1120 proj-fatal "Cannot find any of $lnCOpts in $dirLn"
1123 set lnVal [proj-which-linenoise $lnH]
1124 switch -- $lnVal {
1128 proj-fatal "Cannot determine the flavor of linenoise from $lnH"
1131 define CFLAGS_READLINE "-I$dirLn $lnC"
1133 sqlite-add-shell-opt -DHAVE_LINENOISE=$lnVal
1134 if {$::sqliteConfig(use-jim-for-codegen) && 2 == $lnVal} {
1135 define-append CFLAGS_JIMSH -DUSE_LINENOISE [get-define CFLAGS_READLINE]
1136 user-notice "Adding linenoise support to jimsh."
1139 } elseif {[opt-bool editline]} {
1147 # -DHAVE_EDITLINE=1, else we will use -DHAVE_READLINE=1. In either
1152 } elseif {![opt-bool readline]} {
1153 msg-result "Readline support explicitly disabled with --disable-readline"
1155 } elseif {[proj-opt-was-provided readline]} {
1156 # If an explicit --[enable-]readline was used, fail if it's not
1161 # Transform with-readline-header=X to with-readline-cflags=-I...
1162 set v [opt-val with-readline-header]
1163 proj-opt-set with-readline-header ""
1166 proj-opt-set with-readline-cflags auto
1171 # set the -I to one dir up from that because our sources
1175 proj-opt-set with-readline-cflags "-I$v"
1180 set rlInc [opt-val with-readline-cflags auto]
1183 if {$::sqliteConfig(is-cross-compiling)} {
1185 proj-warn "Skipping check for readline.h because we're cross-compiling."
1187 set dirs [sqlite-get-readline-dir-list]
1197 set rlInc [proj-search-for-header-dir readline.h \
1198 -dirs $dirs -subdirs $subdirs]
1199 #proc-debug "rlInc=$rlInc"
1207 set rlInc "-I${rlInc}"
1210 } elseif {"" ne $rlInc && ![string match *-I* $rlInc]} {
1211 proj-fatal "Argument to --with-readline-cflags is intended to be CFLAGS and contain -I..."
1218 # legacy autotools-generated tests) provides tgetent(3). On some
1223 set rlLib [opt-val with-readline-ldflags]
1224 #proc-debug "rlLib=$rlLib"
1228 if {[proj-check-function-in-lib tgetent "$editLibName ncurses curses termcap"]} {
1230 set libTerm [get-define lib_tgetent]
1235 } elseif {[proj-check-function-in-lib readline $libsForReadline $libTerm]} {
1236 set rlLib [get-define lib_readline]
1248 # significant for those using --editline.
1249 proj-indented-notice {
1251 will compile with -DHAVE_READLINE=1 but will link with
1259 proj-assert {$editLibDef in {HAVE_READLINE HAVE_EDITLINE}}
1260 proj-assert {$editLibName in {readline editline}}
1261 sqlite-add-shell-opt -D${editLibDef}=1
1262 msg-result "Using $editLibName flags: $rlInc $rlLib"
1264 # and disable that sub-feature if it doesn't.
1266 -cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 -source {
1280 … proj-warn "readline-style completion disabled due to rl_completion_matches() signature mismatch"
1281 sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION
1287 proj-fatal "Explicit --$editLibName failed to find a matching library."
1290 }; # sqlite-check-line-editing
1293 # Runs sqlite-check-line-editing and adds a message around it. In the
1295 # sqlite-determine-codegen-tcl for reasons now lost to history (and
1297 proc sqlite-handle-line-editing {} {
1298 msg-result "Line-editing support for the sqlite3 shell: [sqlite-check-line-editing]"
1303 # ICU - International Components for Unicode
1307 # --with-icu-ldflags=LDFLAGS
1308 # --with-icu-cflags=CFLAGS
1309 # --with-icu-config[=auto | pkg-config | /path/to/icu-config]
1310 # --enable-icu-collations
1312 # --with-icu-config values:
1314 # - auto: use the first one of (pkg-config, icu-config) found on the
1316 # - pkg-config: use only pkg-config to determine flags
1317 # - /path/to/icu-config: use that to determine flags
1319 # If --with-icu-config is used as neither pkg-config nor icu-config
1322 # If both --with-icu-ldflags and --with-icu-config are provided, they
1323 # are cumulative. If neither are provided, icu-collations is not
1327 # icu-config binary or (pkg-config icu-io) are found, we specifically
1328 # do not. ICU is always an opt-in feature.
1329 proc sqlite-handle-icu {} {
1330 define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]]
1331 define CFLAGS_ICU [join [opt-val with-icu-cflags ""]]
1332 if {[proj-opt-was-provided with-icu-config]} {
1333 msg-result "Checking for ICU support..."
1334 set icuConfigBin [opt-val with-icu-config]
1335 set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config
1336 if {$icuConfigBin in {auto pkg-config}} {
1337 if {[pkg-config-init 0] && [pkg-config icu-io]} {
1339 # (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has
1342 define LDFLAGS_ICU [get-define PKG_ICU_IO_LDFLAGS]
1343 define-append LDFLAGS_ICU [get-define PKG_ICU_IO_LIBS]
1344 define CFLAGS_ICU [get-define PKG_ICU_IO_CFLAGS]
1345 } elseif {"pkg-config" eq $icuConfigBin} {
1346 proj-fatal "pkg-config cannot find package icu-io"
1348 proj-assert {"auto" eq $icuConfigBin}
1353 set icuConfigBin [proj-first-bin-of \
1354 /usr/local/bin/icu-config \
1355 /usr/bin/icu-config]
1357 proj-indented-notice -error {
1358 --with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary.
1359 On Ubuntu-like systems try:
1360 --with-icu-ldflags='-licui18n -licuuc -licudata'
1364 if {[file-isexec $icuConfigBin]} {
1365 set x [exec $icuConfigBin --ldflags]
1367 proj-indented-notice -error \
1369 $icuConfigBin --ldflags returned no data.
1370 On Ubuntu-like systems try:
1371 --with-icu-ldflags='-licui18n -licuuc -licudata'
1374 define-append LDFLAGS_ICU $x
1375 set x [exec $icuConfigBin --cppflags]
1376 define-append CFLAGS_ICU $x
1378 proj-fatal "--with-icu-config=$icuConfigBin does not refer to an executable"
1382 set ldflags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]]
1383 set cflags [define CFLAGS_ICU [string trim [get-define CFLAGS_ICU]]]
1385 sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU
1386 msg-result "Enabling ICU support with flags: $ldflags $cflags"
1387 if {[opt-bool icu-collations]} {
1388 msg-result "Enabling ICU collations."
1389 sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU_COLLATIONS
1391 # of --disable-static-shell, a combination we do not
1394 } elseif {[opt-bool icu-collations]} {
1395 …proj-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-conf…
1397 msg-result "ICU support is disabled."
1399 }; # sqlite-handle-icu
1403 # Handles the --enable-load-extension flag. Returns 1 if the support
1405 # fatal error is triggered if --enable-load-extension is explicitly
1407 # --disable-load-extension is used, no check is performed.
1411 # - defines LDFLAGS_DLOPEN to any linker flags needed for this
1415 # - If the feature is not available, adds
1416 # -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list.
1417 proc sqlite-handle-load-extension {} {
1420 proj-if-opt-truthy load-extension {
1421 set found [proj-check-function-in-lib dlopen dl]
1423 define LDFLAGS_DLOPEN [get-define lib_dlopen]
1426 if {[proj-opt-was-provided load-extension]} {
1427 # Explicit --enable-load-extension: fail if not found
1428 proj-indented-notice -error {
1429 --enable-load-extension was provided but dlopen()
1430 not found. Use --disable-load-extension to bypass this
1435 proj-indented-notice {
1437 be disabled. Use --disable-load-extension to bypass this
1444 msg-result "Loadable extension support enabled."
1446 msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them."
1447 sqlite-add-feature-flag -DSQLITE_OMIT_LOAD_EXTENSION=1
1453 # Handles the --enable-math flag.
1454 proc sqlite-handle-math {} {
1455 proj-if-opt-truthy math {
1456 if {![proj-check-function-in-lib ceil m]} {
1457 user-error "Cannot find libm functions. Use --disable-math to bypass this."
1459 define LDFLAGS_MATH [get-define lib_ceil]
1461 sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS
1462 msg-result "Enabling math SQL functions"
1465 msg-result "Disabling math SQL functions"
1470 # If this OS looks like a Mac, checks for the Mac-specific
1471 # -current_version and -compatibility_version linker flags. Defines
1475 # We don't check this on non-Macs because this whole thing is a
1480 proc sqlite-handle-mac-cversion {} {
1483 if {[proj-looks-like-mac]} {
1484 cc-with {-link 1} {
1485 # These version numbers are historical libtool-defined values, not
1486 # library-defined ones
1487 if {[cc-check-flags "-Wl,-current_version,9.6.0"]
1488 && [cc-check-flags "-Wl,-compatibility_version,9.0.0"]} {
1489 define LDFLAGS_MAC_CVERSION "-Wl,-compatibility_version,9.0.0 -Wl,-current_version,9.6.0"
1491 } elseif {[cc-check-flags "-compatibility_version 9.0.0"]
1492 && [cc-check-flags "-current_version 9.6.0"]} {
1493 define LDFLAGS_MAC_CVERSION "-compatibility_version 9.0.0 -current_version 9.6.0"
1503 # -Wl,-install_name,... and, if it's available, define
1505 # intended to expand at make-time, else set LDFLAGS_MAC_INSTALL_NAME
1509 proc sqlite-handle-mac-install-name {} {
1510 define LDFLAGS_MAC_INSTALL_NAME ""; # {-Wl,-install_name,"$(install-dir.lib)/$(libsqlite3.DLL)"}
1512 if {[proj-looks-like-mac]} {
1513 cc-with {-link 1} {
1514 if {[cc-check-flags "-Wl,-install_name,/usr/local/lib/libsqlite3.dylib"]} {
1515 define LDFLAGS_MAC_INSTALL_NAME {-Wl,-install_name,"$(install-dir.lib)/$(libsqlite3.DLL)"}
1524 # Handles the --dll-basename configure flag. [define]'s
1525 # SQLITE_DLL_BASENAME to the DLL's preferred base name (minus
1526 # extension). If --dll-basename is not provided (or programmatically
1527 # set - see [sqlite-handle-env-quirks]) then this is always
1529 # value of [get-define host].
1530 proc sqlite-handle-dll-basename {} {
1531 if {[proj-opt-was-provided dll-basename]} {
1532 set dn [join [opt-val dll-basename] ""]
1538 switch -glob -- [get-define host] {
1539 *-*-cygwin { set dn cygsqlite3-0 }
1540 *-*-ming* { set dn libsqlite3-0 }
1541 *-*-msys { set dn msys-sqlite3-0 }
1550 # -Wl,... flag for the platform-specific --out-implib flag, which is
1551 # used for building an "import library .dll.a" file on some platforms
1557 # If the configure flag --out-implib is not used (or programmatically
1558 # set) then this simply sets the above-listed defines to empty strings
1559 # (but see [sqlite-handle-env-quirks]). If that flag is used but the
1562 # This feature is specifically opt-in because it's supported on far
1570 # - cygwin sqlite packages historically install no .dll.a file.
1572 # - msys2 and mingw sqlite packages historically install
1573 # /usr/lib/libsqlite3.dll.a despite the DLL being in
1575 proc sqlite-handle-out-implib {} {
1579 if {[proj-opt-was-provided out-implib]} {
1580 set olBaseName [join [opt-val out-implib] ""]
1582 set olBaseName "libsqlite3" ;# [get-define SQLITE_DLL_BASENAME]
1584 # should always be called libsqlite3.dll.a even on platforms
1585 # which rename libsqlite3.dll to something else.
1588 cc-with {-link 1} {
1589 set dll "${olBaseName}[get-define TARGET_DLLEXT]"
1590 set flags [proj-cc-check-Wl-flag --out-implib ${dll}.a]
1593 define SQLITE_OUT_IMPLIB ${dll}.a
1598 user-error "--out-implib is not supported on this platform"
1606 # If the given platform identifier (defaulting to [get-define host])
1607 # appears to be one of the Unix-on-Windows environments, returns a
1615 proc sqlite-env-is-unix-on-windows {{envTuple ""}} {
1617 set envTuple [get-define host]
1620 switch -glob -- $envTuple {
1621 *-*-cygwin { set name cygwin }
1622 *-*-ming* { set name mingw }
1623 *-*-msys { set name msys }
1633 # 1) DLL installation:
1636 # set of "make install" rules to use for installation of the DLL
1638 # install-dll-NAME which runs the installation for that set, as well
1639 # as providing a rule named install-dll which resolves to
1640 # install-dll-NAME (perhaps indirectly, depending on whether the DLL
1643 # The default value is "unix-generic".
1645 # 2) --out-implib:
1648 # --out-implib was not explicitly used, automatically add that flag.
1652 # 3) --dll-basename:
1654 # On the same platforms addressed by --out-implib, if --dll-basename
1655 # is not explicitly specified, --dll-basename=auto is implied.
1656 proc sqlite-handle-env-quirks {} {
1657 set instName unix-generic; # name of installation rules set
1658 set autoDll 0; # true if --out-implib/--dll-basename should be implied
1659 set host [get-define host]
1660 switch -glob -- $host {
1661 *apple* -
1664 set x [sqlite-env-is-unix-on-windows $host]
1673 if {![proj-opt-was-provided out-implib]} {
1674 # Imply --out-implib=auto
1675 proj-indented-notice [subst -nocommands -nobackslashes {
1676 NOTICE: auto-enabling --out-implib for environment [$host].
1677 Use --out-implib=none to disable this special case
1678 or --out-implib=auto to squelch this notice.
1680 proj-opt-set out-implib auto
1682 if {![proj-opt-was-provided dll-basename]} {
1683 # Imply --dll-basename=auto
1684 proj-indented-notice [subst -nocommands -nobackslashes {
1685 NOTICE: auto-enabling --dll-basename for environment [$host].
1686 Use --dll-basename=default to disable this special case
1687 or --dll-basename=auto to squelch this notice.
1689 proj-opt-set dll-basename auto
1692 sqlite-handle-dll-basename
1693 sqlite-handle-out-implib
1694 sqlite-handle-mac-cversion
1695 sqlite-handle-mac-install-name
1696 if {[llength [info proc sqlite-custom-handle-flags]] > 0} {
1697 # sqlite-custom-handle-flags is assumed to be imported via a
1698 # client-specific import: autosetup/sqlite-custom.tcl.
1699 sqlite-custom-handle-flags
1704 # Perform some late-stage work and generate the configure-process
1706 proc sqlite-process-dot-in-files {} {
1708 # "Re-export" the autoconf-conventional --XYZdir flags into something
1710 # for [proj-remap-autoconf-dir-vars] for the explanation of why.
1712 # We do this late in the config process, immediately before we export
1714 # which make make use of the autotools-conventional flags
1715 # (e.g. [proj-check-rpath]) may do so before we "mangle" them here.
1716 proj-remap-autoconf-dir-vars
1718 proj-dot-ins-process -validate
1719 make-config-header sqlite_cfg.h \
1720 -bare {SIZEOF_* HAVE_DECL_*} \
1721 -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG
1723 -auto {HAVE_* PACKAGE_*} \
1724 -none *
1725 proj-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTORECONFIG@
1729 # Handle --with-wasi-sdk[=DIR]
1732 # toolchain and disable a number of config options. However, in the
1733 # canonical build this must come after [sqlite-check-common-bins].
1734 proc sqlite-handle-wasi-sdk {} {
1735 set wasiSdkDir [opt-val with-wasi-sdk] ; # ??? [lindex [opt-val with-wasi-sdk] end]
1739 } elseif {$::sqliteConfig(is-cross-compiling)} {
1740 proj-fatal "Cannot combine --with-wasi-sdk with cross-compilation"
1742 msg-result "Checking WASI SDK directory \[$wasiSdkDir]... "
1743 proj-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld ar}]
1748 msg-result "Using wasi-sdk clang. Disabling CLI shell and modifying config flags:"
1749 # Boolean (--enable-/--disable-) flags which must be switched off:
1751 dynlink-tools
1754 icu-collations
1755 load-extension
1761 if {[proj-opt-exists $opt] && [opt-bool $opt]} {
1762 # -^^^^ not all builds define all of these flags
1763 msg-result " --disable-$opt"
1764 proj-opt-set $opt 0
1767 # Non-boolean flags which need to be cleared:
1769 with-emsdk
1770 with-icu-config
1771 with-icu-ldflags
1772 with-icu-cflags
1773 with-linenoise
1774 with-tcl
1776 if {[proj-opt-was-provided $opt]} {
1777 msg-result " removing --$opt"
1778 proj-opt-set $opt ""
1782 # $::sqliteConfig(is-cross-compiling) and [proj-is-cross-compiling].
1783 set ::sqliteConfig(is-cross-compiling) 1
1786 # Changing --host and --target have no effect here except to
1790 # host_alias=wasm32-wasi
1791 # target=wasm32-wasi
1793 # Merely changing CC, LD, and AR to the wasi-sdk's is enough to get
1797 define LD "${wasiSdkDir}/bin/wasm-ld"
1801 }; # sqlite-handle-wasi-sdk
1806 # sqlite-check-tcl performs most of the --with-tcl and --with-tclsh
1812 # - HAVE_TCL indicates whether we have a tclsh suitable for building
1817 # - TCLSH_CMD is the path to the canonical tclsh or "". It never
1820 # - TCL_CONFIG_SH is the path to tclConfig.sh or "".
1822 # - TCLLIBDIR is the dir to which libtclsqlite3 gets installed.
1824 # - BTCLSH = the path to the tcl interpreter used for in-tree code
1826 # be empty - this tree requires TCL to generated numerous
1829 # If --tcl or --with-tcl are provided but no TCL is found, this
1833 proc sqlite-check-tcl {} {
1834 define TCLSH_CMD false ; # Significant is that it exits with non-0
1835 define HAVE_TCL 0 ; # Will be enabled via --tcl or a successful search
1840 # the late-config validation of @VARS@ works even if --disable-tcl
1842 proj-tclConfig-sh-to-autosetup ""
1844 file delete -force ".tclenv.sh"; # ensure no stale state from previous configures.
1845 if {![opt-bool tcl]} {
1846 proj-indented-notice {
1847 NOTE: TCL is disabled via --disable-tcl. This means that none
1848 of the TCL-based components will be built, including tests
1855 msg-result "Checking for a suitable tcl... "
1856 proj-assert [proj-opt-truthy tcl]
1858 set with_tclsh [opt-val with-tclsh]
1859 set with_tcl [opt-val with-tcl]
1861 set with_tcl [get-define prefix]
1863 proc-debug "use_tcl ${use_tcl}"
1864 proc-debug "with_tclsh=${with_tclsh}"
1865 proc-debug "with_tcl=$with_tcl"
1867 # If neither --with-tclsh nor --with-tcl are provided, try to find
1869 set with_tclsh [proj-first-bin-of tclsh9.1 tclsh9.0 tclsh8.6 tclsh]
1870 proc-debug "with_tclsh=${with_tclsh}"
1873 set doConfigLookup 1 ; # set to 0 to test the tclConfig.sh-not-found cases
1875 # --with-tclsh was provided or found above. Validate it and use it
1876 # to trump any value passed via --with-tcl=DIR.
1877 if {![file-isexec $with_tclsh]} {
1878 proj-fatal "TCL shell $with_tclsh is not executable"
1881 #msg-result "Using tclsh: $with_tclsh"
1888 msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
1890 proj-warn "$with_tclsh is unable to recommend a tclConfig.sh"
1912 proj-fatal "No tclConfig.sh found under ${with_tcl}"
1916 # which is set automatically by autosetup or via the --prefix
1917 # command-line option. See
1919 set libdir [get-define libdir]
1934 msg-result "Using tclConfig.sh: $cfg"
1938 # Export a subset of tclConfig.sh to the current TCL-space. If $cfg
1939 # is an empty string, this emits empty-string entries for the
1941 proj-tclConfig-sh-to-autosetup $cfg
1946 set tclExecPrefix [get-define TCL_EXEC_PREFIX]
1947 proj-assert {"" ne $tclExecPrefix}
1949 $tclExecPrefix/bin/tclsh[get-define TCL_VERSION] \
1952 if {[file-isexec $trySh]} {
1957 if {![file-isexec $with_tclsh]} {
1958 proj-warn "Cannot find a usable tclsh (tried: $tryThese)
1965 # 2024-10-28: calculation of TCLLIBDIR is now done via the shell
1967 # static/hand-written makefiles which import main.mk do not have
1970 # use this one rather than to re-calculate it at make-time.
1971 set tcllibdir [get-env TCLLIBDIR ""]
1983 proj-warn "Cannot determine TCLLIBDIR."
1988 #if {"" ne $tcllibdir} { msg-result "TCLLIBDIR = ${tcllibdir}"; }
1992 if {[file-isexec $with_tclsh]} {
1993 msg-result "Using tclsh: $with_tclsh"
1997 proj-warn "Found tclsh but no tclConfig.sh."
2000 show-notices
2003 # to generate a working JimTCL then that will suffice for build-time
2004 # TCL purposes (see: proc sqlite-determine-codegen-tcl).
2005 if {![get-define HAVE_TCL] &&
2006 ([proj-opt-was-provided tcl] || [proj-opt-was-provided with-tcl])} {
2007 proj-fatal "TCL support was requested but no tclConfig.sh could be found."
2010 proj-assert {0 == [get-define HAVE_TCL]}
2011 proj-indented-notice {
2013 --with-tcl=DIR to specify a directory where tclConfig.sh can be
2018 }; # sqlite-check-tcl
2021 # sqlite-determine-codegen-tcl checks which TCL to use as a code
2023 # in-tree (it's part of autosetup) unless --with-tclsh=X is used, in
2026 # Returns the human-readable name of the TCL it selects. Fails fatally
2031 # - BTCLSH = the TCL shell used for code generation. It may set this
2034 # - CFLAGS_JIMSH = any flags needed for buildng a BTCLSH-compatible
2037 proc sqlite-determine-codegen-tcl {} {
2038 msg-result "Checking for TCL to use for code generation... "
2039 define CFLAGS_JIMSH [proj-get-env CFLAGS_JIMSH {-O1}]
2040 set cgtcl [opt-val with-tclsh jimsh]
2042 # When --with-tclsh=X is used, use that for all TCL purposes,
2043 # including in-tree code generation, per developer request.
2048 define-push $flagsToRestore {
2050 # [cc-...] tests below. Recall that --with-wasi-sdk may have
2053 # requires us to [define-push] the whole $flagsToRestore list
2059 define CC [get-define CC_FOR_BUILD]
2062 set sysh [cc-check-includes dirent.h sys/time.h]
2063 # jimsh0.c hard-codes #define's for HAVE_DIRENT_H and
2065 # need to add -D... flags for those. We check for them here only
2067 # make-time, try to compile jimsh but it then fails due to
2069 if {$sysh && [cc-check-functions realpath]} {
2070 define-append CFLAGS_JIMSH -DHAVE_REALPATH
2072 set ::sqliteConfig(use-jim-for-codegen) 1
2073 } elseif {$sysh && [cc-check-functions _fullpath]} {
2075 # whether we need to add {-DHAVE_SYS_TIME_H -DHAVE_DIRENT_H}
2077 # not want to because it already hard-codes them. On _MSC_VER
2079 define-append CFLAGS_JIMSH -DHAVE__FULLPATH
2081 set ::sqliteConfig(use-jim-for-codegen) 1
2082 } elseif {[file-isexec [get-define TCLSH_CMD]]} {
2083 set cgtcl [get-define TCLSH_CMD]
2086 # One last-ditch effort to find TCLSH_CMD: use info from
2088 if {"" eq [get-define TCLSH_CMD]} {
2089 set tpre [get-define TCL_EXEC_PREFIX]
2091 set tv [get-define TCL_VERSION]
2092 if {[file-isexec "${tpre}/bin/tclsh${tv}"]} {
2094 } elseif {[file-isexec "${tpre}/bin/tclsh"]} {
2099 set cgtcl [get-define TCLSH_CMD]
2100 if {![file-isexec $cgtcl]} {
2101 proj-fatal "Cannot find a tclsh to use for code generation."
2105 }; # /define-push $flagsToRestore
2107 }; # sqlite-determine-codegen-tcl
2110 # Runs sqlite-check-tcl and, if this is the canonical build,
2111 # sqlite-determine-codegen-tcl.
2112 proc sqlite-handle-tcl {} {
2113 sqlite-check-tcl
2114 if {"canonical" eq $::sqliteConfig(build-mode)} {
2115 msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
2120 # Handle the --enable/disable-rpath flag.
2121 proc sqlite-handle-rpath {} {
2122 proj-check-rpath
2123 # autosetup/cc-shared.tcl sets the rpath flag definition in
2124 # [get-define SH_LINKRPATH], but it does so on a per-platform basis
2126 # compiler check (as proj-check-rpath does), we may want to consider
2128 # for which sqlite-env-is-unix-on-windows returns a non-empty
2131 # if {[proj-opt-truthy rpath]} {
2132 # proj-check-rpath
2134 # msg-result "Disabling use of rpath."
2140 # If the --dump-defines configure flag is provided then emit a list of
2141 # all [define] values to config.defines.txt, else do nothing.
2142 proc sqlite-dump-defines {} {
2143 proj-if-opt-truthy dump-defines {
2144 make-config-header $::sqliteConfig(dump-defines-txt) \
2145 -bare {SQLITE_OS* SQLITE_DEBUG USE_*} \
2146 -str {BIN_* CC LD AR LDFLAG* OPT_*} \
2147 -auto {*}
2149 # get _undefined_ here unless it's part of the -bare set.
2150 if {"" ne $::sqliteConfig(dump-defines-json)} {
2151 msg-result "--dump-defines is creating $::sqliteConfig(dump-defines-json)"
2153 # Dump config-defines.json...
2154 # Demonstrate (mis?)handling of spaces in JSON-export array values:
2155 # define-append OPT_FOO.list {"-DFOO=bar baz" -DBAR="baz barre"}
2156 define OPT_FEATURE_FLAGS.list [get-define OPT_FEATURE_FLAGS]
2157 define OPT_SHELL.list [get-define OPT_SHELL]
2159 -bare {SIZEOF_* HAVE_DECL_*}
2160 -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG TARGET_* USE_GCOV TCL_*}
2161 -array {*.list}
2162 -auto {OPT_* PACKAGE_* HAVE_*}
2164 # if {$::sqliteConfig(dump-defines-json-include-lowercase)} {
2165 # lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends
2166 # lappend dumpDefsOpt -auto {[a-z]*}
2168 lappend dumpDefsOpt -none *
2169 proj-dump-defs-json $::sqliteConfig(dump-defines-json) {*}$dumpDefsOpt