diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-08 20:01:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-08 20:01:10 +0300 |
commit | d8a93ff67917fdc02f2539ba6f03edc09870f535 (patch) | |
tree | 0546deb2654c085c8a8abaccae17c1864510c8c6 /configure.in | |
parent | 3a79f91a7792425855b3cf0bd1fe66cbba506848 (diff) | |
download | hercules-d8a93ff67917fdc02f2539ba6f03edc09870f535.tar.gz hercules-d8a93ff67917fdc02f2539ba6f03edc09870f535.tar.bz2 hercules-d8a93ff67917fdc02f2539ba6f03edc09870f535.tar.xz hercules-d8a93ff67917fdc02f2539ba6f03edc09870f535.zip |
In configure add option --enable-sanitize
This option add run time checks for buffer overflows and some other
memory related things.
Not recommended for production.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/configure.in b/configure.in index e236c25fe..6b0604e07 100644 --- a/configure.in +++ b/configure.in @@ -272,6 +272,29 @@ AC_ARG_ENABLE( # +# adress sanitize +# +AC_ARG_ENABLE( + [sanitize], + AC_HELP_STRING( + [--enable-sanitize], + [ + Enables or Disables Sanitize Address Checking (SANITIZE is disabled by default) + ] + ), + [ + enable_sanitize="$enableval" + case $enableval in + "no");; + "yes");; + *) AC_MSG_ERROR([[invalid argument --enable-sanitize=$disableval... stopping]]);; + esac + ], + [enable_sanitize="no"] +) + + +# # Renewal # AC_ARG_ENABLE( @@ -575,6 +598,39 @@ if test "$enable_lto" != "no" ; then fi +# +# sanitize Support test +# +if test "$enable_sanitize" != "no" ; then + + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=address" + + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=address" + + AC_MSG_CHECKING([whether $CC supports -fsanitize=address]) + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + int main(int argc, char **argv){ + return 0; + } + ])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + ], + [ + AC_MSG_RESULT([guessing no]) + ] + ) +fi + + AC_DEFUN(AC_CHECK_COMPILER_WFLAG, [ AC_MSG_CHECKING([whether $CC supports -W$1]) |