extern crate pkg_config;
extern crate gcc;

fn main() {
    if !pkg_config::find_library("liblmdb").is_ok() {
        gcc::compile_library("liblmdb.a",
                             &["mdb/libraries/liblmdb/mdb.c",
                               "mdb/libraries/liblmdb/midl.c"]);
    }
}

extern crate pkg_config;
extern crate gcc;

fn main() {
    let target = std::env::var("TARGET").unwrap();

    if !pkg_config::find_library("liblmdb").is_ok() {
        let mut config = gcc::Config::new();
        config.file("mdb/libraries/liblmdb/mdb.c")
              .file("mdb/libraries/liblmdb/midl.c");

        if target.contains("dragonfly") {
            config.flag("-DMDB_DSYNC=O_SYNC");
            config.flag("-DMDB_FDATASYNC=fsync");
        }

        config.compile("liblmdb.a");
    }
}

Set MDB_DSYNC and MDB_FDATASYNC on dragonflybsd.
Set MDB_DSYNC and MDB_FDATASYNC on dragonflybsd.