1c67d6573Sopenharmony_ciuse std::env; 2c67d6573Sopenharmony_ci 3c67d6573Sopenharmony_cifn main() { 4c67d6573Sopenharmony_ci if env::var("CARGO_FEATURE_RE_PCRE2").is_ok() { 5c67d6573Sopenharmony_ci pkg_config::probe_library("libpcre2-8").unwrap(); 6c67d6573Sopenharmony_ci } 7c67d6573Sopenharmony_ci if env::var("CARGO_FEATURE_RE_RE2").is_ok() { 8c67d6573Sopenharmony_ci // RE2 is a C++ library, so we need to compile our shim layer. 9c67d6573Sopenharmony_ci cc::Build::new() 10c67d6573Sopenharmony_ci .cpp(true) 11c67d6573Sopenharmony_ci .file("src/ffi/re2.cpp") 12c67d6573Sopenharmony_ci .compile("libcre2.a"); 13c67d6573Sopenharmony_ci // It's important this comes after compiling the shim, which results 14c67d6573Sopenharmony_ci // in the correct order of arguments given to the linker. 15c67d6573Sopenharmony_ci pkg_config::probe_library("re2").unwrap(); 16c67d6573Sopenharmony_ci } 17c67d6573Sopenharmony_ci if env::var("CARGO_FEATURE_RE_TCL").is_ok() { 18c67d6573Sopenharmony_ci pkg_config::probe_library("tcl").unwrap(); 19c67d6573Sopenharmony_ci } 20c67d6573Sopenharmony_ci} 21