2014-07-15 22:18:59 +02:00
|
|
|
AC_DEFUN([AC_PROG_CC_PIE], [
|
|
|
|
AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
|
|
|
|
echo 'void f(){}' > conftest.c
|
|
|
|
if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
|
|
|
|
ac_cv_prog_cc_pie=yes
|
|
|
|
else
|
|
|
|
ac_cv_prog_cc_pie=no
|
|
|
|
fi
|
|
|
|
rm -rf conftest*
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2019-01-11 18:32:54 +01:00
|
|
|
AC_DEFUN([AC_PROG_CC_ASAN], [
|
|
|
|
AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=address], ac_cv_prog_cc_asan, [
|
|
|
|
echo 'void f(){}' > conftest.c
|
|
|
|
if test -z "`${CC-cc} -fsanitize=address -c conftest.c 2>&1`"; then
|
|
|
|
ac_cv_prog_cc_asan=yes
|
|
|
|
else
|
|
|
|
ac_cv_prog_cc_asan=no
|
|
|
|
fi
|
|
|
|
rm -rf conftest*
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([AC_PROG_CC_LSAN], [
|
|
|
|
AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=leak], ac_cv_prog_cc_lsan, [
|
|
|
|
echo 'void f(){}' > conftest.c
|
|
|
|
if test -z "`${CC-cc} -fsanitize=leak -c conftest.c 2>&1`"; then
|
|
|
|
ac_cv_prog_cc_lsan=yes
|
|
|
|
else
|
|
|
|
ac_cv_prog_cc_lsan=no
|
|
|
|
fi
|
|
|
|
rm -rf conftest*
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([AC_PROG_CC_UBSAN], [
|
|
|
|
AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=undefined], ac_cv_prog_cc_ubsan, [
|
|
|
|
echo 'void f(){}' > conftest.c
|
|
|
|
if test -z "`${CC-cc} -fsanitize=undefined -c conftest.c 2>&1`"; then
|
|
|
|
ac_cv_prog_cc_ubsan=yes
|
|
|
|
else
|
|
|
|
ac_cv_prog_cc_ubsan=no
|
|
|
|
fi
|
|
|
|
rm -rf conftest*
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2014-07-15 22:18:59 +02:00
|
|
|
AC_DEFUN([COMPILER_FLAGS], [
|
|
|
|
if (test "${CFLAGS}" = ""); then
|
2018-10-04 10:27:42 +02:00
|
|
|
CFLAGS="-Wall -O2 -fsigned-char -fno-exceptions"
|
2014-08-01 16:47:33 +02:00
|
|
|
CFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
|
2014-07-15 22:18:59 +02:00
|
|
|
fi
|
|
|
|
if (test "$USE_MAINTAINER_MODE" = "yes"); then
|
|
|
|
CFLAGS+=" -Werror -Wextra"
|
|
|
|
CFLAGS+=" -Wno-unused-parameter"
|
|
|
|
CFLAGS+=" -Wno-missing-field-initializers"
|
|
|
|
CFLAGS+=" -Wdeclaration-after-statement"
|
|
|
|
CFLAGS+=" -Wmissing-declarations"
|
|
|
|
CFLAGS+=" -Wredundant-decls"
|
2019-03-28 09:13:26 +01:00
|
|
|
CFALGS+=" -Wvariadic-macros"
|
2018-12-07 10:05:51 +01:00
|
|
|
CFLAGS+=" -Wformat -Wformat-security"
|
2016-12-16 13:50:10 +01:00
|
|
|
if ( $CC -v 2>/dev/null | grep "gcc version" ); then
|
|
|
|
CFLAGS+=" -Wcast-align"
|
|
|
|
fi
|
2014-07-15 22:18:59 +02:00
|
|
|
fi
|
|
|
|
])
|