Skip to content
Snippets Groups Projects
Commit 8e405770 authored by Aki Tuomi's avatar Aki Tuomi Committed by aki.tuomi
Browse files

m4: dovecot.m4 - Sync with core

parent a1c1ca78
No related branches found
No related tags found
Loading
dnl dovecot.m4 - Check presence of dovecot -*-Autoconf-*-
dnl
dnl Copyright (C) 2010 Dennis Schridded
dnl Copyright (C) 2010 Dennis Schridde
dnl
dnl This file is free software; the authors give
dnl unlimited permission to copy and/or distribute it, with or without
dnl modifications, as long as this notice is preserved.
# serial 30
# serial 32
dnl
dnl Check for support for D_FORTIFY_SOURCE=2
......@@ -69,14 +69,6 @@ AC_DEFUN([DC_DOVECOT_CFLAGS],[
])
])
AS_IF([test "$have_clang" = "yes"], [
dnl clang specific options
AS_IF([test "$want_devel_checks" = "yes"], [
dnl FIXME: enable once md[45], sha[12] can be compiled without
dnl CFLAGS="$CFLAGS -fsanitize=integer,undefined -ftrapv"
:
])
])
])
AC_DEFUN([AC_LD_WHOLE_ARCHIVE], [
......@@ -197,7 +189,7 @@ dnl
AC_DEFUN([AC_CC_RETPOLINE],[
AC_ARG_WITH(retpoline,
AS_HELP_STRING([--with-retpoline=<choice>], [Retpoline migitation choice (default: keep)]),
AS_HELP_STRING([--with-retpoline=<choice>], [Retpoline mitigation choice (default: keep)]),
with_retpoline=$withval,
with_retpoline=keep)
......@@ -299,9 +291,9 @@ else
trap "rm -f \$test_out" 0 1 2 3 15
supp_path="\$top_srcdir/run-test-valgrind.supp"
if test -r "\$supp_path"; then
valgrind -q \$trace_children --leak-check=full --gen-suppressions=all --suppressions="\$supp_path" --log-file=\$test_out \$noundef \$[*]
valgrind -q \$trace_children --error-exitcode=213 --leak-check=full --gen-suppressions=all --suppressions="\$supp_path" --log-file=\$test_out \$noundef \$[*]
else
valgrind -q \$trace_children --leak-check=full --gen-suppressions=all --log-file=\$test_out \$noundef \$[*]
valgrind -q \$trace_children --error-exitcode=213 --leak-check=full --gen-suppressions=all --log-file=\$test_out \$noundef \$[*]
fi
ret=\$?
if test -s \$test_out; then
......@@ -340,6 +332,7 @@ AC_DEFUN([DC_DOVECOT_HARDENING],[
AC_CC_D_FORTIFY_SOURCE
AC_CC_RETPOLINE
AC_LD_RELRO
DOVECOT_WANT_UBSAN
])
AC_DEFUN([DC_DOVECOT],[
......@@ -549,3 +542,45 @@ AC_DEFUN([CC_CLANG],[
])
AC_MSG_RESULT([$have_clang])
])
AC_DEFUN([DOVECOT_WANT_UBSAN], [
AC_ARG_ENABLE(ubsan,
AS_HELP_STRING([--enable-ubsan], [Enable undefined behaviour sanitizes (default=no)]),
[want_ubsan=yes], [want_ubsan=no])
AC_MSG_CHECKING([whether we want undefined behaviour sanitizer])
AC_MSG_RESULT([$want_ubsan])
AS_IF([test x$want_ubsan = xyes], [
san_flags=""
gl_COMPILER_OPTION_IF([-fsanitize=undefined], [
san_flags="$san_flags -fsanitize=undefined"
AC_DEFINE([HAVE_FSANITIZE_UNDEFINED], [1], [Define if your compiler has -fsanitize=undefined])
])
gl_COMPILER_OPTION_IF([-fno-sanitize=nonnull-attribute], [
san_flags="$san_flags -fno-sanitize=nonnull-attribute"
AC_DEFINE([HAVE_FNO_SANITIZE_NONNULL_ATTRIBUTE], [1], [Define if your compiler has -fno-sanitize=nonnull-attribute])
])
gl_COMPILER_OPTION_IF([-fsanitize=implicit-integer-truncation], [
san_flags="$san_flags -fsanitize=implicit-integer-truncation"
AC_DEFINE([HAVE_FSANITIZE_IMPLICIT_INTEGER_TRUNCATION], [1], [Define if your compiler has -fsanitize=implicit-integer-truncation])
])
gl_COMPILER_OPTION_IF([-fsanitize=local-bounds], [
san_flags="$san_flags -fsanitize=local-bounds"
AC_DEFINE([HAVE_FSANITIZE_LOCAL_BOUNDS], [1], [Define if your compiler has -fsanitize=local-bounds])
])
gl_COMPILER_OPTION_IF([-fsanitize=integer], [
san_flags="$san_flags -fsanitize=integer"
AC_DEFINE([HAVE_FSANITIZE_INTEGER], [1], [Define if your compiler has -fsanitize=integer])
])
gl_COMPILER_OPTION_IF([-fsanitize=nullability], [
san_flags="$san_flags -fsanitize=nullability"
AC_DEFINE([HAVE_FSANITIZE_NULLABILITY], [1], [Define if your compiler has -fsanitize=nullability])
])
AS_IF([test "$san_flags" != "" ], [
EXTRA_CFLAGS="$EXTRA_CFLAGS $san_flags -U_FORTIFY_SOURCE -g -ggdb3 -O0 -fno-omit-frame-pointer"
AC_DEFINE([HAVE_UNDEFINED_SANITIZER], [1], [Define if your compiler supports undefined sanitizers])
], [
AC_MSG_ERROR([No undefined sanitizer support in your compiler])
])
san_flags=""
])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.