Skip to content

Commit

Permalink
Merge pull request #2 from ynqa/check-dependencies-installed
Browse files Browse the repository at this point in the history
v0.1.3: check whether autoconf/automake are installed
  • Loading branch information
ynqa authored Mar 23, 2024
2 parents ccc5c03 + 8aabb46 commit 01ae2c9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions j9-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,37 @@ extern crate bindgen;
use std::{
env, fs,
path::{Path, PathBuf},
process::Command,
};

fn check_installed(name: &str) -> anyhow::Result<()> {
let check = Command::new(name).arg("--version").output();

match check {
Ok(output) => {
if !output.status.success() {
return Err(anyhow::anyhow!(
"{} is required, but it's not installed or not in PATH.",
name
));
}
}
Err(_) => {
return Err(anyhow::anyhow!(
"{} is required, but it's not installed or not in PATH.",
name
));
}
}

Ok(())
}

fn main() -> anyhow::Result<()> {
// Check if autoconf is installed
check_installed("autoconf")?;
check_installed("automake")?;

let out_dir = env::var("OUT_DIR").map(PathBuf::from)?;
let src_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("jq");
let build_dir = out_dir.join("jq_build");
Expand Down

0 comments on commit 01ae2c9

Please sign in to comment.