#/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
# This is the main autosetup-compatible configure script for the
# "autoconf" bundle of the SQLite project.
#
# This script must be kept compatible with JimTCL, a copy of which is
# included in this source tree as ./autosetup/jimsh0.c.
#
use sqlite-config

options {
  # <build-modes>
  static=1             => {Disable build of static library}
  shared=1             => {Disable build of shared library}
  # </build-modes>
  # <lib-feature>
  threadsafe=1         => {Disable mutexing}
  with-tempstore:=no   => {Use an in-RAM database for temporary tables: never,no,yes,always}
  load-extension=1     => {Disable loading of external extensions}
  math=1               => {Disable math functions}
  json=1               => {Disable JSON functions}
  memsys5              => {Enable MEMSYS5}
  memsys3              => {Enable MEMSYS3}
  fts3                 => {Enable the FTS3 extension}
  fts4                 => {Enable the FTS4 extension}
  fts5                 => {Enable the FTS5 extension}
  update-limit         => {Enable the UPDATE/DELETE LIMIT clause}
  geopoly              => {Enable the GEOPOLY extension}
  rtree                => {Enable the RTREE extension}
  session              => {Enable the SESSION extension}
  all                  => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
  # </lib-feature>
  # <line-editing>
  readline=1           => {Disable readline support}
  # --with-readline-lib is a backwards-compatible alias for
  # --with-readline-ldflags
  with-readline-lib:
  with-readline-ldflags:=auto
                       => {Readline LDFLAGS, e.g. -lreadline -lncurses}
  # --with-readline-inc is a backwards-compatible alias for
  # --with-readline-cflags.
  with-readline-inc:
  with-readline-cflags:=auto
                       => {Readline CFLAGS, e.g. -I/path/to/includes}
  with-readline-header:PATH
                       => {Full path to readline.h, from which --with-readline-cflags will be derived}
  with-linenoise:DIR   => {Source directory for linenoise.c and linenoise.h}
  editline=0           => {Enable BSD editline support}
  # </line-editing>
  # <icu>
  with-icu-ldflags:LDFLAGS
                        => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries}
  with-icu-cflags:CFLAGS
                        => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include}
  with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config}
  icu-collations=0      => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config}
  # </icu>
  # <developer>
  # Note that using the --debug/--enable-debug flag here requires patching
  # autosetup/autosetup to rename the --debug to --autosetup-debug.
  with-debug=0
  debug=0              =>
    {Enable debug build flags. This option will impact performance by
     as much as 4x, as it includes large numbers of assert()s in
     performance-critical loops.  Never use --debug for production
     builds.}
  # </developer>
  soname:=legacy       =>
    # --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded
    {SONAME for libsqlite3.so. "none", or not using this flag, sets no
     soname. "legacy" sets it to its historical value of
     libsqlite3.so.0.  A value matching the glob "libsqlite3.*" sets
     it to that literal value. Any other value is assumed to be a
     suffix which gets applied to "libsqlite3.so.",
     e.g. --soname=9.10 equates to "libsqlite3.so.9.10".
    }
}

sqlite-post-options-init
sqlite-check-common-bins
sqlite-check-common-system-deps
proj-check-rpath
sqlite-handle-soname
sqlite-setup-default-cflags
sqlite-handle-debug
sqlite-handle-threadsafe
sqlite-handle-tempstore
sqlite-handle-line-editing
sqlite-handle-load-extension
sqlite-handle-math
sqlite-handle-icu

define ENABLE_LIB_SHARED [opt-bool shared]
define ENABLE_LIB_STATIC [opt-bool static]

sqlite-process-dot-in-files
sqlite-post-config-validation
