diff --git a/auto.def b/auto.def index 0f6cc74a06..9ea09c8d11 100644 --- a/auto.def +++ b/auto.def @@ -163,15 +163,15 @@ set flags { largefile=1 => {Disable large file support} shared=1 => {Disable build of shared libary} static=1 => {Disable build of static library} - # --with-readline-lib is a legacy name, now a backwards-compatible - # alias for --with-readline-ldflags. + # --with-readline-lib is a backwards-compatible alias for + # --with-readline-ldflags with-readline-lib: - with-readline-ldflags:LDFLAGS + with-readline-ldflags:=auto => {Readline LDFLAGS, e.g. -lreadline -lncurses} - # --with-readline-inc is a legacy name, now a backwards-compatible - # alias for --with-readline-ldflags. + # --with-readline-inc is a backwards-compatible alias for + # --with-readline-cflags with-readline-inc: - with-readline-cflags:CFLAGS + 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} @@ -211,11 +211,9 @@ unset flags # Carry values from hidden --flag aliases over to their canonical flag # forms. # -foreach {hidden => canonical} { +hwaci-xfer-options-aliases { with-readline-inc => with-readline-cflags with-readline-lib => with-readline-ldflags -} { - hwaci-xfer-opt-alias $hidden $canonical } set srcdir $::autosetup(srcdir) diff --git a/autosetup/hwaci-common.tcl b/autosetup/hwaci-common.tcl index bb9836f7dc..611238f080 100644 --- a/autosetup/hwaci-common.tcl +++ b/autosetup/hwaci-common.tcl @@ -93,6 +93,21 @@ proc hwaci-lshift_ {listVar {count 1}} { return $r } +######################################################################## +# Expects to receive string input, which it splits on newlines, strips +# out any lines which begin with an number of whitespace followed by a +# '#', and returns a value containing the [append]ed results of each +# remaining line with a \n between each. +proc hwaci-strip-comments {val} { + set x {} + foreach line [split $val \n] { + if {![string match "#*" [string trimleft $line]]} { + append x $line \n + } + } + return $x +} + ######################################################################## # A proxy for cc-check-function-in-lib which "undoes" any changes that # routine makes to the LIBS define. Returns the result of @@ -977,28 +992,42 @@ proc hwaci-dump-defs-json {file args} { } ######################################################################## -# Expects configure flags with the given names to have been registered -# with autosetup. If [opt-val $hidden] has a value but [opt-val +# Expects a list of pairs of configure flags with the given names to +# have been registered with autosetup, in this form: +# +# { alias1 => canonical1 +# aliasN => canonicalN ... } +# +# The names must not have their leading -- part and must be in the +# form which autosetup will expect for passing to [opt-val NAME] and +# friends. +# +# Commend lines are permitted in the input. +# +# If [opt-val $hidden] has a value but [opt-val # $canonical] does not, it copies the former over the latter. If # $hidden has no value set, this is a no-op. If both have explicit # values a fatal usage error is triggered. # -# Motivation: autosetup accounts for hidden aliases in [options] lists -# but does no further handling of them. For example, when --foo is a -# hidden alias of the canonical flag --bar, and a user passes --foo=X, -# [opt-val bar] returns no value. i.e. the script must check both -# [opt-val foo] and [opt-val bar], despite them being aliases. The -# intent is that this function be passed each such mapping immediately -# after [options] is processed, to carry over any values from hidden -# aliases into their canonical names, so that in the above example -# [opt-value bar] will return X if --foo=X is passed in. -proc hwaci-xfer-opt-alias {hidden canonical} { - set x [opt-val $hidden "-9-9-9-"] - if {"-9-9-9-" ne $x} { - if {"-0-0-0-" eq [opt-val $canonical "-0-0-0-"]} { - hwaci-opt-set $canonical $x - } else { - hwaci-fatal "both --$canonical and its hidden alias --$hidden were used. Use only one or the other." +# Motivation: autosetup enables "hidden aliases" in [options] lists, +# and elides the aliases from --help output but does no further +# handling of them. For example, when --alias is a hidden alias of +# --canonical and a user passes --alias=X, [opt-val canonical] returns +# no value. i.e. the script must check both [opt-val alias] and +# [opt-val canonical]. The intent here is that this function be +# passed such mappings immediately after [options] is called, +# to carry over any values from hidden aliases into their canonical +# names, so that in the above example [opt-value canonical] will +# return X if --alias=X is passed in. +proc hwaci-xfer-options-aliases {mapping} { + foreach {hidden => canonical} [hwaci-strip-comments $mapping] { + set x [opt-val $hidden "~9~9~9~"] + if {"~9~9~9~" ne $x} { + if {"~0~0~0~" eq [opt-val $canonical "~0~0~0~"]} { + hwaci-opt-set $canonical $x + } else { + hwaci-fatal "both --$canonical and its alias --$hidden were used. Use only one or the other." + } } } } diff --git a/manifest b/manifest index bab329676f..9d55604594 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Doc\sadditions\sand\sminor\scleanups\sin\sthe\s--flag\salias\shandling. -D 2024-10-27T20:14:49.852 +C Generic\scleanups\sin\sauto.def\sand\shwaci-common.tcl. +D 2024-10-27T20:46:09.058 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2 @@ -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 a5cc3792cfe6e82561c810f5f6383186ee5ce73cdde4ca06b70f18252ec38f84 +F auto.def dd9bda48dc2a4c515d1a518f342b992c1cdea46c0d4e20a25d515ab423de2d49 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -47,7 +47,7 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14 F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 -F autosetup/hwaci-common.tcl f8b683adc42ac4a9d1a950118f024b8b7d2b90460ee39c5a9a0feb8e7ad9d179 +F autosetup/hwaci-common.tcl c6a68fe4ad416db70260bc0f8a85ee9f52d6976ca796aaa8ae013a1bf632b49d F autosetup/jimsh0.c 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb @@ -2237,8 +2237,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 e50a03f9f2a40a5e65f874ffff234a7b397ce4ebdc7b360d4e6ade7575577c38 -R 689f8e7c0b273a0d5f61c39635b6551a +P 37a1da038195365cd7eb866b3aa749ad8060a656ac38063520fdb70cf0a0e5f1 +R 4a5971ae5787ab5ca5bc6c1b2940924e U stephan -Z 9c99ac6705fb06550102fd68e4fd933c +Z f7c559f6f234bc23301783ef1baa5b93 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d17d4d17dd..bc0860a133 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -37a1da038195365cd7eb866b3aa749ad8060a656ac38063520fdb70cf0a0e5f1 +428e542452bac99d48950f1f62b65b4e235636540b946151747e2d5b59dbfd99