File: build.rs

package info (click to toggle)
rust-gperftools 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: makefile: 4
file content (19 lines) | stat: -rw-r--r-- 703 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
extern crate pkg_config;

/// Configures the crate to link against `lib_name`.
///
/// The library is first searched via the pkg-config file provided in
/// `pc_name`, which provides us accurate information on how to find the
/// library to link to. But because old gperftools did not supply such
/// files, this falls back to using the linker's path.
fn find_library(pc_name: &str, lib_name: &str) {
    match pkg_config::Config::new().atleast_version("2.0").probe(pc_name) {
        Ok(_) => (),
        Err(_) => println!("cargo:rustc-link-lib={}", lib_name),
    };
}

fn main () {
    find_library("libprofiler", "profiler");
    #[cfg(feature = "heap")] find_library("libtcmalloc", "tcmalloc");
}