diff --git a/lang/elb.el b/lang/elb.el index dd9b298..e80eff5 100644 --- a/lang/elb.el +++ b/lang/elb.el @@ -271,7 +271,10 @@ fn link_binary(c_files: [String], out_bin: String, runtime_path: String, out_dir let parts: [String] = native_list_empty() // Include both the runtime dir (for el_runtime.h) and the output dir // (for module.elh cross-module forward declarations). - let parts = native_list_append(parts, "cc -O2 -fbracket-depth=1024 -I " + dirname_of(runtime_path) + " -I " + out_dir) + // Detect clang vs gcc: -fbracket-depth is clang-only; silently ignored + // if unsupported but gcc rejects it with an error. + let bracket_flag: String = "$(cc --version 2>&1 | grep -q clang && printf -- '-fbracket-depth=1024' || true)" + let parts = native_list_append(parts, "cc -O2 " + bracket_flag + " -I " + dirname_of(runtime_path) + " -I " + out_dir) let i = 0 while i < n { let f: String = native_list_get(c_files, i)