c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainendnl * gcc specific options
c25356d5978632df6203437e1953bcb29e0c736fTimo SirainenAC_DEFUN([DOVECOT_CFLAGS],[
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
e34d170f8f0e084bd94bfbc1a7085ece67e508dfTimo Sirainen # -Wcast-qual -Wcast-align -Wconversion -Wunreachable-code # too many warnings
e34d170f8f0e084bd94bfbc1a7085ece67e508dfTimo Sirainen # -Wstrict-prototypes -Wredundant-decls # may give warnings in some systems
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen # -Wmissing-format-attribute -Wmissing-noreturn -Wwrite-strings # a couple of warnings
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast"
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen if test "$have_clang" = "yes"; then
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen AC_TRY_COMPILE([
88c2db95c4a0f8f7986a63cd57cf4b6850d76543Timo Sirainen #if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3)
88c2db95c4a0f8f7986a63cd57cf4b6850d76543Timo Sirainen # error new clang
88c2db95c4a0f8f7986a63cd57cf4b6850d76543Timo Sirainen #endif
88c2db95c4a0f8f7986a63cd57cf4b6850d76543Timo Sirainen ],,,[
88c2db95c4a0f8f7986a63cd57cf4b6850d76543Timo Sirainen # clang 3.3+ unfortunately this gives warnings with hash.h
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen CFLAGS="$CFLAGS -Wno-duplicate-decl-specifier"
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen ])
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen else
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen # This is simply to avoid warning when building strftime() wrappers..
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen CFLAGS="$CFLAGS -fno-builtin-strftime"
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen fi
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen AC_TRY_COMPILE([
#if __GNUC__ < 4
# error old gcc
#endif
],,[
# gcc4
CFLAGS="$CFLAGS -Wstrict-aliasing=2"
])
# Use std=gnu99 if we have new enough gcc
old_cflags=$CFLAGS
CFLAGS="-std=gnu99"
AC_TRY_COMPILE([
],, [
CFLAGS="$CFLAGS $old_cflags"
], [
CFLAGS="$old_cflags"
])
fi
if test "$have_clang" = "yes"; then
# clang specific options
if test "$want_devel_checks" = "yes"; then
# FIXME: enable once md[45], sha[12] can be compiled without
#CFLAGS="$CFLAGS -fsanitize=integer,undefined -ftrapv"
:
fi
fi
])