summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml3
-rw-r--r--build.rs7
-rw-r--r--src/ffi.rs1
3 files changed, 9 insertions, 2 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 2a7fcc3..f2ffc70 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,6 +31,7 @@ compiletest_rs = { version = "0.3", optional = true }
[build-dependencies]
cc = { version = "1.0", optional = true }
+pkg-config = "0.3.11"
[dev-dependencies]
rustyline = "1.0.0"
@@ -38,4 +39,4 @@ criterion = "0.2.0"
[[bench]]
name = "benchmark"
-harness = false \ No newline at end of file
+harness = false
diff --git a/build.rs b/build.rs
index 5d83dcb..eaa8526 100644
--- a/build.rs
+++ b/build.rs
@@ -1,6 +1,9 @@
#[cfg(feature = "builtin-lua")]
extern crate cc;
+#[cfg(not(feature = "builtin-lua"))]
+extern crate pkg_config;
+
fn main() {
#[cfg(feature = "builtin-lua")]
{
@@ -62,4 +65,8 @@ fn main() {
.file("lua/lzio.c")
.compile("liblua5.3.a");
}
+ #[cfg(not(feature = "builtin-lua"))]
+ {
+ pkg_config::Config::new().atleast_version("5.3").probe("lua").unwrap();
+ }
}
diff --git a/src/ffi.rs b/src/ffi.rs
index f72045c..69183b1 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -78,7 +78,6 @@ pub const LUA_GCSETPAUSE: c_int = 6;
pub const LUA_GCSETSTEPMUL: c_int = 7;
pub const LUA_GCISRUNNING: c_int = 9;
-#[link(name = "lua5.3")]
extern "C" {
pub fn lua_newstate(alloc: lua_Alloc, ud: *mut c_void) -> *mut lua_State;
pub fn lua_close(state: *mut lua_State);