See: http://www.gnuvola.org/wip/ (libredwg)
The v2 series aims to enable (optionally configured) runtime trace control. It is inspired by a comment on the LibreDWG wiki. Details: f7a9d0a [build] Move config.h into src/. It's nice to have all the source components together in one directory. Also, this allows Automake to avoid generating "-I..". f9b1a87 [build] Make every .c file #include "config.h". This propagates the information found by the configure script to the source files. Our immediate need is to pass the fact that the option "--enable-trace" was specified. However, looking ahead, there may be other kinds of information that will be useful, such as endianness, alloca availability, word size, etc, and gnulib is a nice way to add support for such things, so we make sure this change is forward compatible with gnulib. 54455cc [build] Add preliminary "configure --enable-trace" support. This uses AC_ARG_ENABLE, defaulting to "no". c3e29a8 [build r] Add runtime tracing support for read (decode) path. 32bf5b3 [build w] Add runtime tracing support for write (encode) path. These make the respective file-static `loglevel' variables in src/{de,en}code.c subject to a lookup of the env var LIBREDWG_TRACE. The lookup is done only once. If there is no tracing, the default is now hardcoded as zero (no output). fb534d3 Refill README; nfc. 2a91cbc [admin] Mention --enable-trace in README; nfc. This documents the configure script feature. It includes a blurb: "NB: This is an experimental feature that is not in its final form." That's because i think "levels" of tracing is not the best; i personally would prefer to see a bitset approach: The library-global (as opposed to bifurcated file-static) variable `trace' would hold a set of independent flags that enable tracing for various aspects of the operation. For example: encoding, decoding, top-level objects, strings, etc. Another idea is to support a file descriptor for trace output. Together, these features would be very helpful for "make check". WDYT?