I found some snippet in an unrelated forum/question where someone had shown how to find the compiler flags at runtime that were passed to zlib. This is a zlib specific API and looks something like:
zlibCompileFlags();
The API is here https://github.com/madler/zlib/blob/cacf7f1d4e3d44d871b605da3b647f07d718623f/zlib.h#L1174. This can then be combined with flags of your choice (the flags are noted in the doc of that API). So in my case I added something like:
printf("compiler flags %lu\n", zlibCompileFlags());
if ((zlibCompileFlags() & (1 << 9))) {
printf("Compiled with ASMV or ASMINF, uses ASM code\n");
} else {
printf("No ASM code\n");
}
if ((zlibCompileFlags() & (1 << 8))) {
printf("Compiled with ZLIB_DEBUG\n");
} else {
printf("No ZLIB_DEBUG\n");
}
if ((zlibCompileFlags() & (1 << 10))) {
printf("Compiled with ZLIB_WINAPI\n");
} else {
printf("No ZLIB_WINAPI\n");
}
to verify the flags of my interest. The output of that code against MacOS 12.2.1 shows that the ZLIB_DEBUG wasn't enabled while building this library. So essentially, I won't be seeing any logging output from this library at runtime.
Having said that, this is a very "intrusive" way since I had to write some C code and link it against this zlib library to invoke this API and get the output.
It would help if there was a way to just know what set of commands and options were used to build this zlib library that's shipped in MacOS. Anyone has any ideas?