summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"