0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-21 19:29:09 +01:00

Get several of the --enable/--disable configure flags working.

FossilOrigin-Name: fd16d53d3a95cd4f5f81f4b1b09955f04c89116586aa16fa01627ae4904d587b
This commit is contained in:
stephan 2024-09-25 03:37:34 +00:00
parent e6b41c4641
commit 63c4d89ae1
4 changed files with 180 additions and 156 deletions

271
auto.def
View File

@ -3,6 +3,17 @@
use cc cc-shared cc-lib hwaci-common
set DUMP_DEFINES_FILE defines.list
########################################################################
# Note that boolean flags...
#
# 1) Are in the form flagname (default=false) or flagname=0 (false) or
# flagname=1 (true).
#
# 2) If they default to false, the actual flag mapped to them is
# --enable-FLAG.
#
# 3) If they default to true, the actual flag mapped to them is
# --disable-FLAG.
options {
with-tclsh:PATHNAME => {Full pathname of tclsh to use}
with-tcl:DIR => {Directory containing tclConfig.sh}
@ -18,10 +29,10 @@ options {
with-readline-inc => {readline include paths}
with-linenoise:DIR => {}
disable-amalgamation=0 => {Disable the amalgamation and instead build all files separately}
disable-load-extension=0 => {Disable loading of external extensions}
disable-math=0 => {math functions}
disable-json=0 => {JSON functions}
enable-all=0 => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
load-extension=1 => {loading of external extensions}
math=1 => {math functions}
json=1 => {JSON functions}
all=0 => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
enable-memsys5=0 => MEMSYS5
enable-memsys3=0 => MEMSYS3
enable-fts3=0 => {Enable the FTS3 extension}
@ -32,7 +43,7 @@ options {
enable-rtree=0 => {Enable the RTREE extension}
enable-session=0 => {Enable the SESSION extension}
enable-gcov=0 => {Enable coverage testing using gcov}
dump-defines=1 => {Dump autosetup defines to $DUMP_DEFINES_FILE}
dump-defines=1 => {Dump autosetup defines to $DUMP_DEFINES_FILE}
}
# debug=0 => {debugging & verbose explain}
@ -84,11 +95,6 @@ puts "with-wasi-sdk? = [opt-val with-wasi-sdk]"
# Libraries that the build compiler needs in order to construct
# command-line programs.
#
# BUILD_EXEEXT
#
# The filename extension for executables on the build
# platform. "" for Unix and ".exe" for Windows.
#
# TCL_*
#
# Lots of values are read in from the tclConfig.sh script,
@ -107,49 +113,94 @@ puts "with-wasi-sdk? = [opt-val with-wasi-sdk]"
# This variables define the directory that contain header
# files for the readline library. If the compiler is able
# to find <readline.h> on its own, then this can be blank.
#
# TARGET_EXEEXT
#
# The filename extension for executables on the
# target platform. "" for Unix and ".exe" for windows.
#
# This configure.in file is easy to reuse on other projects. Just
# change the argument to AC_INIT. And disable any features that
# you don't need (for example BLT) by erasing or commenting out
# the corresponding code.
#
hwaci-check-exeext
#set sqlite_version_sanity_check `cat $autosetup(srcdir)/VERSION | tr -d '\n'`
# XXX if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then
#user-error "configure script is out of date:
# configure \$PACKAGE_VERSION = $PACKAGE_VERSION
# top level VERSION file = $sqlite_version_sanity_check
#please regen with autoconf"
# XXX fi
########################################################################
# OPT_FEATURE_FLAGS = -DSQLITE_OMIT/ENABLE flags.
define OPT_FEATURE_FLAGS {}
proc add-feature-flag {flag} {
define-append OPT_FEATURE_FLAGS $flag
}
# add-feature-flag -DSQLITE_JUST_TESTING=3
#########
# Programs needed
cc-check-progs install
if {1} {
if {"" eq [hwaci-bin-define install]} {
msg-result "Cannot find install binary, so 'make install' will not work."
}
}
#########
# Enable large file support (if special flags are necessary)
cc-check-lfs
if {1} {
cc-check-lfs
}
#########
# Check for needed/wanted data types
if {1} {
cc-check-types int8_t int16_t int32_t int64_t intptr_t uint8_t uint16_t uint32_t uint64_t uintptr_t
cc-check-types int8_t int16_t int32_t int64_t intptr_t \
uint8_t uint16_t uint32_t uint64_t uintptr_t
}
#########
# Check for needed/wanted headers
cc-check-includes sys/types.h stdlib.h stdint.h inttypes.h malloc.h
if {1} {
cc-check-includes sys/types.h stdlib.h stdint.h inttypes.h malloc.h
}
#########
# Figure out whether or not we have these functions
if {1} {
cc-check-functions fdatasync gmtime_r isnan localtime_r localtime_s \
malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
}
##########
# Handle --with-wasi-sdk=DIR
#
cc-check-functions fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
# This must be early because it changes the toolchain.
#
# It's unclear whether we can actually get away with these changes in
# autosetup.
if {1} {
set wasiSdkDir [lindex [opt-val with-wasi-sdk] end]
if {$wasiSdkDir eq ""} {
define HAVE_WASI_SDK 0
define WASI_SDK_DIR ""
} else {
msg-checking "Checking WASI SDK directory \[$wasiSdkDir]... "
if {![file exists $wasiSdkDir/bin/clang]} {
user-error "--with-wasi-sdk=${wasiSdkDir} directory does not contain bin/clang"
}
msg-result "using wasi-sdk clang, disabling: tcl, CLI shell, DLL"
define HAVE_WASI_SDK 1
define WASI_SDK_DIR $wasiSdkDir
# Changing --host and --target have no effect here except to possibly
# cause confusion. autoconf has finished processing them by this
# point.
#
# host_alias=wasm32-wasi
# target=wasm32-wasi
#
# Merely changing CC and LD to the wasi-sdk's is enough to get
# sqlite3.o building in WASM format.
# XXX CC="${with_wasi_sdk}/bin/clang"
# XXX LD="${with_wasi_sdk}/bin/wasm-ld"
# XXX RANLIB="${with_wasi_sdk}/bin/llvm-ranlib"
# set cross_compiling yes
# set enable_threadsafe no
# set use_tcl no
# set enable_tcl no
# libtool is apparently hard-coded to use gcc for linking DLLs, so
# we disable the DLL build...
# set enable_shared no
}
}; # --wasi-sdk-dir
#########
# By default, we use the amalgamation (this may be changed below...)
@ -282,9 +333,9 @@ if {0} {
# Set up options for running tests.
#
if {[opt-bool test-status]} {
set use_vt100 $enableval
define TSTRNNR_OPTS {--status}
} else {
set use_vt100 no
define TSTRNNR_OPTS {}
}
# XXX if test $use_vt100 != no; then
# XXX TSTRNNR_OPTS=--status
@ -294,74 +345,6 @@ if {0} {
# XXX AC_SUBST TSTRNNR_OPTS
}
if {0} {
#########
# Set up an appropriate program prefix
#
# XXX if test "$program_prefix" = "NONE"; then
set program_prefix ""
# XXX fi
# XXX AC_SUBST program_prefix
# XXX VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
# msg-result "Version set to $VERSION"
# XXX AC_SUBST VERSION
# XXX RELEASE=`cat $srcdir/VERSION`
# msg-result "Release set to $RELEASE"
# XXX AC_SUBST RELEASE
}
if {0} {
##########
# Handle --with-wasi-sdk=DIR
#
# This must be early because it changes the toolchain.
#
if {[opt-val with-wasi-sdk] ne {}} {
set withval [lindex [opt-val with-wasi-sdk] end]
set with_wasisdk ${withval}
}
msg-checking "Checking for WASI SDK directory..."
# First check to see if --with-tcl was specified.
# XXX if test x"${with_wasi_sdk}" != x ; then
# XXX if ! test -d "${with_wasi_sdk}" ; then
user-error "${with_wasi_sdk} directory doesn't exist"
# XXX fi
msg-result "${with_wasi_sdk}: using wasi-sdk clang, disabling: tcl, CLI shell, DLL"
set use_wasi_sdk yes
# XXX else
set use_wasi_sdk no
# XXX fi
# XXX if test "${use_wasi_sdk}" = "no" ; then
# XXX HAVE_WASI_SDK=""
msg-result "no"
# XXX else
# XXX HAVE_WASI_SDK=1
# Changing --host and --target have no effect here except to possibly
# cause confusion. autoconf has finished processing them by this
# point.
#
# host_alias=wasm32-wasi
# target=wasm32-wasi
#
# Merely changing CC and LD to the wasi-sdk's is enough to get
# sqlite3.o building in WASM format.
# XXX CC="${with_wasi_sdk}/bin/clang"
# XXX LD="${with_wasi_sdk}/bin/wasm-ld"
# XXX RANLIB="${with_wasi_sdk}/bin/llvm-ranlib"
set cross_compiling yes
set enable_threadsafe no
set use_tcl no
set enable_tcl no
# libtool is apparently hard-coded to use gcc for linking DLLs, so
# we disable the DLL build...
set enable_shared no
msg-result "yes"
# XXX fi
# XXX AC_SUBST HAVE_WASI_SDK
}
#########
# Locate a compiler for the build machine. This compiler should
# generate command-line programs that run on the build machine.
@ -675,56 +658,56 @@ if {0} {
# XXX AC_SUBST HAVE_ZLIB
}
if {0} {
#########
# See whether we should allow loadable extensions
if {![opt-bool load-extension]} {
proc if-disabled {boolFlag then {else {}}} {
if {![opt-bool $boolFlag]} {
eval $then
} else {
set enable_load_extension yes
eval $else
}
# XXX if test "${enable_load_extension}" = "yes" ; then
# XXX OPT_FEATURE_FLAGS=""
cc-check-function-in-lib dlopen dl
# XXX else
# XXX OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
# XXX fi
}
if {0} {
##########
# Do we want to support math functions
#
if {![opt-bool math]} {
proc if-enabled {boolFlag then {else {}}} {
if {[opt-bool $boolFlag]} {
eval $then
} else {
eval $else
}
msg-checking "Checking whether to support math functions..."
# XXX if test "$enable_math" = "no"; then
msg-result "no"
# XXX else
msg-result "yes"
# XXX OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MATH_FUNCTIONS"
cc-check-function-in-lib ceil m
# XXX fi
}
if {0} {
##########
# Do we want to support JSON functions
#
if {![opt-bool json]} {
if-enabled load-extension {
if {[cc-check-function-in-lib dlopen dl]} {
define LDFLAGS_DLOPEN [get-define lib_dlopen]
} else {
user-error "dlopen() not found. Use --disable-load-extension to bypass this check."
}
msg-checking "Checking whether to support JSON functions..."
# XXX if test "$enable_json" = "no"; then
msg-result "no"
# XXX OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_OMIT_JSON"
# XXX else
msg-result "yes"
# XXX fi
} {
define LDFLAGS_DLOPEN ""
add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
msg-result "Disabling loadable extensions."
}
########
# The --enable-all argument is short-hand to enable
# multiple extensions.
if {[opt-bool enable-all]} {
if-enabled math {
if {![cc-check-function-in-lib ceil m]} {
user-error "Cannot find libm functions. Use --disable-math to bypass this."
}
define LDFLAGS_MATH [get-define lib_ceil]
undefine lib_ceil
add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
msg-result "Enabling math functions."
} {
define LDFLAGS_MATH ""
msg-result "Disabling math functions."
}
if-enabled json {
msg-result "Enabling JSON SQL functions."
} {
add-feature-flag {-DSQLITE_OMIT_JSON}
msg-result "Disabling JSON SQL functions."
}
if-enabled all {
msg-result "TODO: handle --enable-all"
}
if {0} {
@ -941,5 +924,5 @@ if {0} {
if {[opt-bool dump-defines]} {
msg-result "--dump-defines is creating file: $DUMP_DEFINES_FILE"
make-config-header $DUMP_DEFINES_FILE -auto {*}
make-config-header $DUMP_DEFINES_FILE -bare OPT_FEATURE_FLAGS -auto {*}
}

View File

@ -53,15 +53,14 @@ proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
}
########################################################################
# Look for binary named $binName and `define`s $defName to that full
# Looks for binary named $binName and `define`s $defName to that full
# path, or an empty string if not found. Returns the value it defines.
# This caches the result for a given $binName/$defName combination, so
# calls after the first for a given combination will always return the
# same result.
#
# If defName is empty then "BIN_X" is used, where X is the upper-case
# form of $binName with any '-' characters removed. (TODO: map them to
# "_" instead, but i'll need to fix my affected builds in parallel.)
# form of $binName with any '-' characters replaced with '_'.
proc hwaci-bin-define {binName {defName {}}} {
global hwaciCache
set cacheName "$binName:$defName"
@ -88,7 +87,7 @@ proc hwaci-bin-define {binName {defName {}}} {
set hwaciCache($cacheName) $check
}
if {"" eq $defName} {
set defName "BIN_[string toupper [string map {- {}} $binName]]"
set defName "BIN_[string toupper [string map {- _} $binName]]"
}
define $defName $check
return $check
@ -322,3 +321,45 @@ proc hwaci-check-profile-flag {{flagname profile}} {
define CC_PROFILE_FLAG ""
return 0
}
########################################################################
# Returns 1 if this appears to be a Windows environment (MinGw,
# Cygwin, MSys), else returns 0. The optional argument is the name of
# an autosetup define which contains platform name info, defaulting to
# "host". The other legal value is "target".
proc hwaci-looks-like-windows {{key host}} {
switch -glob -- [get-define $key] {
*-*-ming* - *-*-cygwin - *-*-msys {
return 1
}
default {
return 0
}
}
}
########################################################################
# Checks autosetup's "host" and "target" defines to see if the build
# host and target are Windows-esque (Cygwin, MinGW, MSys). If the
# build host is then BUILD_EXEEXT is [define]'d to ".exe", else "". If
# the build target is then TARGET_EXEEXT is [define]'d to ".exe", else
# "".
proc hwaci-check-exeext {} {
msg-checking "Build host is Windows-esque? "
if {[hwaci-looks-like-windows host]} {
define BUILD_EXEEXT ".exe"
msg-result yes
} else {
define BUILD_EXEEXT ""
msg-result no
}
msg-checking "Build target is Windows-esque? "
if {[hwaci-looks-like-windows target]} {
define TARGET_EXEEXT ".exe"
msg-result yes
} else {
define TARGET_EXEEXT ""
msg-result no
}
}

View File

@ -1,5 +1,5 @@
C Testing\slibfossil\scheckin\sfix\sfor\sinheritance\sof\sprivateness.
D 2024-09-25T02:00:09.512
C Get\sseveral\sof\sthe\s--enable/--disable\sconfigure\sflags\sworking.
D 2024-09-25T03:37:34.226
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -14,7 +14,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 3b6d2ee3ddb3fe0c79292f0a84e4fbe9302c23b06388fa2c06ae17ee25283707
F auto.def 1c121db3f48b25002887220168e1120b5f8865f2d0468d62dca4220192367bef
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@ -46,7 +46,7 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f
F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
F autosetup/cc.tcl 1b52de228642c1db5a714d54ca974d723ec8b4092e8c3765d348b625850f7311
F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
F autosetup/hwaci-common.tcl 120d1cc6f1604fdf9403d730ed5955c18aaac11ce533231d62e22e614b9cbbfd
F autosetup/hwaci-common.tcl b6f0c57b377898b8837bd031ca9a37c021d4fe859c9d3967dbb36deab6748459
F autosetup/jimsh0.c 1b5fe91fffcddbc29f2b16acb80f1650632ea2edbe8336b8155ef7b4c66f6d8d
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
@ -2232,8 +2232,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P e707634cf755346752bb83b7be5d0c683e39d6e0a497846019323fed31c08b9d
R 55f0e3bb43a27631a03061e331dafb41
P 4b104926bf0862a5088e51549c2d688c2af649d45bf0e396cc48e171bed06b0a
R 5abab1c4da63e377666cdbb79ca9e337
U stephan
Z 800ded8d31a18a53ba5fd1647482872b
Z 675f689497b17977048f4ba0ec321727
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
4b104926bf0862a5088e51549c2d688c2af649d45bf0e396cc48e171bed06b0a
fd16d53d3a95cd4f5f81f4b1b09955f04c89116586aa16fa01627ae4904d587b