diff --git a/acinclude.m4 b/acinclude.m4 index 77bf110a..5350d315 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -48,8 +48,7 @@ AC_DEFUN([AC_PROG_CC_UBSAN], [ AC_DEFUN([COMPILER_FLAGS], [ if (test "${CFLAGS}" = ""); then - CFLAGS="-Wall -O2 -fsigned-char -fno-exceptions" - CFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" + CFLAGS="-Wall -fsigned-char -fno-exceptions" fi if (test "$USE_MAINTAINER_MODE" = "yes"); then CFLAGS+=" -Werror -Wextra" diff --git a/configure.ac b/configure.ac index cb576a62..1d10f9df 100644 --- a/configure.ac +++ b/configure.ac @@ -37,10 +37,15 @@ LT_INIT([disable-static]) AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization], [disable code optimization through compiler]), [ if (test "${enableval}" = "no"); then - CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -O0" + CFLAGS="$CFLAGS -O0" fi ]) +if (test "${enable_optimization}" != "no"); then + CFLAGS="$CFLAGS -O2" + CFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" +fi + AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [ if (test "${enableval}" = "yes" &&