// Register all cfg names so the unexpected_cfgs lint is satisfied regardless
// of which OpenSSL version is installed.
fn main() {
    println!("cargo::rustc-check-cfg=cfg(ossl307,ossl310,ossl320,ossl350,ossl_v400,ossl_slhdsa,ossl_mldsa,ossl_mlkem,param_clear_free)");

    // native-ossl-sys has `links = "ssl"`, so its `cargo::metadata=KEY=1`
    // entries arrive here as DEP_SSL_KEY environment variables.
    // Re-emit each as a rustc cfg flag for use in native-ossl/src/.
    let flags = [
        ("DEP_SSL_OSSL307", "ossl307"),
        ("DEP_SSL_OSSL310", "ossl310"),
        ("DEP_SSL_OSSL320", "ossl320"),
        ("DEP_SSL_OSSL350", "ossl350"),
        ("DEP_SSL_OSSL_V400", "ossl_v400"),
        ("DEP_SSL_OSSL_SLHDSA", "ossl_slhdsa"),
        ("DEP_SSL_OSSL_MLDSA", "ossl_mldsa"),
        ("DEP_SSL_OSSL_MLKEM", "ossl_mlkem"),
        ("DEP_SSL_PARAM_CLEAR_FREE", "param_clear_free"),
    ];
    for (env_var, cfg_name) in flags {
        if std::env::var(env_var).is_ok() {
            println!("cargo::rustc-cfg={cfg_name}");
        }
    }
}
