Tweaking C compiler options

I am on Mac OS X 11.x with the latest Xcode and all. Apparently, the C compiler (I think it is llvm-based) defaults to C99 flavor. Now, I’m trying to build some old Ocaml code that needs Ocaml 3.x (I’m going to try with 3.12.1 first, but I don’t really know which version will work). Unfortunately, the code for Ocaml itself, from that period, contains pre-99 constructs and so my attempt to create an opam switch fails.

So much for the background, now the question: how to persuade opam to pass “-std=c90” or “-ansi” to the C compiler when building Ocaml? An environment variable maybe , or a text configuration file somewhere?

I know how to do that on recent compilers, but for 3.12.1 I’m not sure…
I would create an empty switch (opam create --empty 3.12.1) then patch the configure command (opam pin add ocaml-base-compiler 3.12.1 --edit, replace the "-cc" "cc" part with "-cc" "cc -std=c90" or something like that). If it installs the compiler successfully, you can add opam switch set-invariant ocaml-base-compiler.3.12.1 as a safety measure, and hopefully you should have a working switch.