autoconf_defaults
Rules
autoconf_defaults
load("@rules_cc_autoconf//autoconf:autoconf_defaults.bzl", "autoconf_defaults")
autoconf_defaults(name, deps, defines, substs, variables)
Default values for autoconf results.
A default is not a check: nothing is probed, no toolchain is resolved, and the
values are written at analysis time. A target reads defaults through
default_deps, beneath every ordinary result, so a probe of the same name
overrides the default silently where a second probe would be a duplicate
error. deps rejects defaults targets; they only enter through default_deps.
This is how gnulib's *_H_DEFAULTS macros work: gl_UNISTD_H_DEFAULTS sets
HAVE_DUP3=1, REPLACE_DUP2=0 and so on, and the probes that run later
reassign only what they find wanting. Port such a macro as one
autoconf_defaults target and list it in the default_deps of every target
whose m4 AC_REQUIREs it:
load("@rules_cc_autoconf//autoconf:autoconf.bzl", "autoconf")
load("@rules_cc_autoconf//autoconf:autoconf_defaults.bzl", "autoconf_defaults")
load("@rules_cc_autoconf//autoconf:checks.bzl", "checks")
# gl_UNISTD_H_DEFAULTS
autoconf_defaults(
name = "defaults",
substs = {
"HAVE_DUP3": "1",
"REPLACE_DUP2": "0",
},
)
# gl_FUNC_DUP2: AC_REQUIRE([gl_UNISTD_H_DEFAULTS]), then may set REPLACE_DUP2=1
autoconf(
name = "dup2",
checks = [
checks.AC_SUBST("REPLACE_DUP2", 1, condition = "!gl_cv_func_dup2_works"),
],
default_deps = [":defaults"],
)
Defaults compose: deps lists other autoconf_defaults targets whose values
this one carries along (gnulib's _H_REQUIRE_DEFAULTS on top of
_H_DEFAULTS), and an autoconf target passes the defaults it reads on to
its dependents. Two defaults of one name must agree.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| deps | Other autoconf_defaults targets whose values this target carries along. | List of labels | optional | [] |
| defines | Default AC_DEFINE values: define name to value. Decimal integers are stored as numbers, as checks.AC_DEFINE("X", 1) stores them; anything else as text. | Dictionary: String -> String | optional | {} |
| substs | Default AC_SUBST values: variable name to value ({"HAVE_DUP3": "1"}), stored under the cache name ac_cv_subst_<NAME> as checks.AC_SUBST does. Decimal integers are stored as numbers; anything else as text. | Dictionary: String -> String | optional | {} |
| variables | Default shell variables that are neither defines nor substitutions (checks.M4_VARIABLE): name to value, read by requires and condition expressions and by cc_gnulib_conditional_hdrs conditions, e.g. {"GL_GENERATE_ICONV_H": "false"}. | Dictionary: String -> String | optional | {} |