I recommend you use a VRemember object to make sure the value gets restored in case of an exception. If you don't set any flags, there is still a small performance overhead. Fortunately, there is a workaround. This is a m4 macro which adds a configure check for each flag. The default options depend on whether debugging is enabled.
All flag switches default to 'no'.
Have a look at the UDS configure.in for a few examples. Checks that libuds is installed on your system. If not, a short message and a link to the download page are printed. Same as above, but it is also checked for libudsthread. You can pass space separated lists of paths to the options to specify extra library and include paths.