2011/3/24 Colin Guthrie <gmane at colin.guthr.ie>: > 'Twas brillig, and Colin Guthrie at 24/03/11 09:02 did gyre and gimble: >> 'Twas brillig, and Maarten Bosmans at 22/03/11 15:06 did gyre and gimble: >>> Is there a better way than >>> #if defined(__linux__) && !defined(__OPTIMIZE__) >>> to check for a debug build? By default the CFLAGS contain -g -O2, so >>> __OPTIMIZE__ will not be defined and running uninstalled does not >>> work. >> >> Do you mean __OPTIMIZE__ *will* be defined? Yes, of course, __OPTIMIZE__ is defined when compiling with -O2 and the condition *will not* be true and running uninstalled does not work. > Also, is there any way we can check to see if the binary being run is in > the build tree? Would that be an easier hack? Well the actual check is in the body of that function: pa_bool_t pa_run_from_build_tree(void) { char *rp; pa_bool_t b = FALSE; if ((rp = pa_readlink("/proc/self/exe"))) { b = pa_startswith(rp, PA_BUILDDIR); pa_xfree(rp); } return b; } I think only compiling that on developer builds and inlining return FALSE for normal, e.g. distro builds makes sense. However __OPTIMIZE__ is not a good differentiator here. > Col Maarten