summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-08 20:01:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-08 20:01:10 +0300
commitd8a93ff67917fdc02f2539ba6f03edc09870f535 (patch)
tree0546deb2654c085c8a8abaccae17c1864510c8c6
parent3a79f91a7792425855b3cf0bd1fe66cbba506848 (diff)
downloadhercules-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.
-rwxr-xr-xconfigure73
-rw-r--r--configure.in56
2 files changed, 128 insertions, 1 deletions
diff --git a/configure b/configure
index 52551bbe9..815b7d21a 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in f354000.
+# From configure.in 3a79f91.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -701,6 +701,7 @@ enable_rdtsc
enable_profiler
enable_64bit
enable_lto
+enable_sanitize
enable_renewal
with_maxconn
with_mysql
@@ -1351,6 +1352,8 @@ Optional Features:
--disable-64bit Enforce 32bit output on x86_64 systems.
--enable-lto Enables or Disables Linktime Code Optimization (LTO
is enabled by default)
+ --enable-sanitize Enables or Disables Sanitize Address Checking
+ (SANITIZE is disabled by default)
--disable-renewal Disable Ragnarok Renewal support (override settings
in src/config/renewal.h)
@@ -3657,6 +3660,26 @@ fi
#
+# adress sanitize
+#
+# Check whether --enable-sanitize was given.
+if test "${enable_sanitize+set}" = set; then :
+ enableval=$enable_sanitize;
+ enable_sanitize="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) as_fn_error $? "invalid argument --enable-sanitize=$disableval... stopping" "$LINENO" 5;;
+ esac
+
+else
+ enable_sanitize="no"
+
+fi
+
+
+
+#
# Renewal
#
# Check whether --enable-renewal was given.
@@ -5007,6 +5030,54 @@ fi
fi
+#
+# sanitize Support test
+#
+if test "$enable_sanitize" != "no" ; then
+
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=address"
+
+ OLD_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -fsanitize=address"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=address" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=address... " >&6; }
+ if test "$cross_compiling" = yes; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: guessing no" >&5
+$as_echo "guessing no" >&6; }
+
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ int main(int argc, char **argv){
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+ LDFLAGS="$OLD_LDFLAGS"
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+
+
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])