Pass custom CFLAGS while building ocaml

If I understand ocaml’s configure file (I’m looking at >= 4.09.1), I can run ./configure CFLAGS=$MYFLAGS to configure ocaml with custom CFLAGS. However I am not running the configure by hand, but as part of a opam init/opam switch create process.

My understanding is that I could patch ocaml’s opam file with my new flags, but I didn’t find in the doc how to access environment variables from a opam file.
In the past (4.07.1) we were patching the configure file directly, but it seems things have changed since then.

Is it the right path to follow or are there other solutions ?

Best,
V.

As far as I know currently CFLAGS and LDFLAGS are not properly taken into account by ./configure. See https://github.com/ocaml/ocaml/issues/8648, where you can also find information about some workarounds.

Cheers,
Nicolás

Thank you for the link. I’m still struggling with it but it is very helpful :slight_smile: