Consolidate cfg checks for wasm/proc_macro
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..4567b6c
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,21 @@
+use std::env;
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+
+    let target = env::var("TARGET").unwrap();
+
+    maybe_enable_use_proc_macro(&target);
+}
+
+fn maybe_enable_use_proc_macro(target: &str) {
+    // wasm targets don't have the `proc_macro` crate, disable this feature.
+    if target.contains("wasm32") {
+        return
+    }
+
+    // Otherwise, only enable it if our feature is actually enabled.
+    if cfg!(feature = "proc-macro") {
+        println!("cargo:rustc-cfg=use_proc_macro");
+    }
+}