Assuming that you mean "-Wunreachable-code" rather than "-Dunreachable-code", the answer is fairly simple (though hard to track down.)
The problem is that the configure script is generating something like:
Code:
#include <stdlib.h>
int main()
{
exit (malloc (0) ? 0 : 1);
return 0;
}
The combination of "-Werror" and "-Wunreachable-code" to GCC will cause the "return 0" in the generated code to be unreachable (GCC recognizes exit() as not returning), thus produces a warning, which (due to "-Werror") is an error, hence the test fails because the compile fails.
If you're feeling ambitious, and insist on using the combination of "-Werror" and "-Wunreachable-code", you could go to /usr/lib/share/autoconf/autoconf (or wherever you have the autoconf M4 files), and edit the file autoconf.m4f; search for the line that reads:
Code:
[exit (malloc (0) ? 0 : 1);])],
and replace it with something like:
Code:
[if (malloc(0) == 0) exit(1);])],
This should provide an execution path to the "return 0;", thus get rid of the unreachable-code warning, which should then produce the correct result. Test it, of course, as I may have screwed the code fragment up. This only fixes this instance of unreachable code in autoconf's generated tests, so my recommendation is that you don't use "-Wunreachable-code" in distributed apps, just in development.
I hope this helps.