diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-02-14 06:34:00 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-02-14 06:34:00 -0800 |
commit | c2b2f22392e77fa98a3f71daf915ebe1a5239e99 (patch) | |
tree | 94713a38142acb64dce55ce611ffa9831a0c19a4 | |
parent | db69c993b1b3de0509a06d80ddd6d5e88baedfd8 (diff) | |
download | txr-c2b2f22392e77fa98a3f71daf915ebe1a5239e99.tar.gz txr-c2b2f22392e77fa98a3f71daf915ebe1a5239e99.tar.bz2 txr-c2b2f22392e77fa98a3f71daf915ebe1a5239e99.zip |
configure: detect ubsan compilation.
* configure: detect that the compiler is generating undefined
behavior sanitizer code, a feature supported in GCC and Clang.
The tell-tale sign of this is that "ubsan" occurs in the
executable. If so, we deposit #define HAVE_UBSAN 1 into
config.h.
-rwxr-xr-x | configure | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -1210,6 +1210,27 @@ else printf "done\n" fi +printf "Checking for undefined behavior sanitizer (\"ubsan\") being in effect ... " + +cat > conftest.c <<! +#include <stdio.h> + +int main(void) +{ + return 0; +} +! +if conftest ; then + if strings conftest | grep -q -i ubsan ; then + printf "yes\n" + printf "#define HAVE_UBSAN 1\n" >> config.h + else + printf "no\n" + fi +else + printf "failed\n" +fi + # # Detect Apple environment. We need _DARWIN_C_SOURCE. # |