summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-13 17:36:57 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-13 17:36:57 +0300
commitc55ed43cd52dcd32fe1c3cd5a9d41f856dd4fe51 (patch)
tree81481e7e4871d65ce22d1945efe22386689e6423
parent0e184a35c76ac02d58467da556e665cd45083557 (diff)
downloadevol-hercules-c55ed43cd52dcd32fe1c3cd5a9d41f856dd4fe51.tar.gz
evol-hercules-c55ed43cd52dcd32fe1c3cd5a9d41f856dd4fe51.tar.bz2
evol-hercules-c55ed43cd52dcd32fe1c3cd5a9d41f856dd4fe51.tar.xz
evol-hercules-c55ed43cd52dcd32fe1c3cd5a9d41f856dd4fe51.zip
Add configure option --enable-sanitize.
-rwxr-xr-xbuild.sh2
-rw-r--r--configure.ac20
-rw-r--r--src/Makefile.am8
3 files changed, 27 insertions, 3 deletions
diff --git a/build.sh b/build.sh
index e927c39..e5f99f7 100755
--- a/build.sh
+++ b/build.sh
@@ -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"