diff options
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | src/Makefile.am | 8 |
3 files changed, 27 insertions, 3 deletions
@@ -3,7 +3,7 @@ mkdir build autoreconf -i cd build -../configure +../configure --enable-sanitize make -j3 cd - exit $? diff --git a/configure.ac b/configure.ac index f21bc47..1ed1511 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,26 @@ AC_ENABLE_SHARED AC_DISABLE_STATIC 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"] +) +AM_CONDITIONAL(ENABLE_SANITIZE, test x$enable_sanitize = xyes) + +AC_ARG_ENABLE( [static], AC_HELP_STRING( [--enable-static], diff --git a/src/Makefile.am b/src/Makefile.am index be513e7..a00b5b9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,9 +21,13 @@ MAP_SRC = map/dummy.c \ map/session.h \ map/sessionext.h -SHARED_CFLAGS = -pipe -ffast-math -Wall -Wextra -Wno-sign-compare -fsanitize=address +SHARED_CFLAGS = -pipe -ffast-math -Wall -Wextra -Wno-sign-compare +SHARED_LDFLAGS = -avoid-version -Wl,--no-undefined -SHARED_LDFLAGS = -avoid-version -Wl,--no-undefined -lasan +if ENABLE_SANITIZE +SHARED_CFLAGS += -fsanitize=address +SHARED_LDFLAGS = -lasan +endif if ENABLE_STATIC SHARED_CFLAGS += "-static-libgcc" |