Skip to content
Snippets Groups Projects
Commit a6a8b7e3 authored by Karl Fleischmann's avatar Karl Fleischmann
Browse files

m4: Update dovecot.m4

Copied verbatim from dovecot/core project.
parent 5a77196e
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ 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 36
# serial 37
dnl
dnl Check for support for D_FORTIFY_SOURCE=2
......@@ -30,56 +30,56 @@ AC_DEFUN([AC_CC_D_FORTIFY_SOURCE],[
dnl * gcc specific options
AC_DEFUN([DC_DOVECOT_CFLAGS],[
AC_PROG_CC_C99
AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [
AC_MSG_ERROR(C99 capable compiler required)
])
m4_version_prereq(2.70, [AC_PROG_CC], [AC_PROG_CC_C99])
AC_MSG_CHECKING([Which $CC -std flag to use])
old_cflags=$CFLAGS
std=
for mystd in gnu11 gnu99 c11 c99; do
CFLAGS="-std=$mystd"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()
], [
CFLAGS="$CFLAGS $old_cflags"
std=$mystd
break
], [
CFLAGS="$old_cflags"
])
done
AC_MSG_RESULT($std)
AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
dnl -Wcast-qual -Wcast-align -Wconversion -Wunreachable-code # too many warnings
dnl -Wstrict-prototypes -Wredundant-decls # may give warnings in some systems
dnl -Wmissing-format-attribute -Wmissing-noreturn -Wwrite-strings # a couple of warnings
CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast"
AS_IF([test "$have_clang" = "yes"], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3)
# error new clang
#endif
]], [[]])],[],[
dnl clang 3.3+ unfortunately this gives warnings with hash.h
CFLAGS="$CFLAGS -Wno-duplicate-decl-specifier"
])
], [
dnl This is simply to avoid warning when building strftime() wrappers..
CFLAGS="$CFLAGS -fno-builtin-strftime"
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if __GNUC__ < 4
# error old gcc
#endif
]], [[]])],[
dnl gcc4
CFLAGS="$CFLAGS -Wstrict-aliasing=2"
],[])
AS_IF([test "$ac_prog_cc_stdc" = "c89" || test "$ac_prog_cc_std" = "no" || test "$ac_cv_prog_cc_c99" = "no"], [
AC_MSG_ERROR(C99 capable compiler required)
])
AC_MSG_CHECKING([Which $CC -std flag to use])
old_cflags=$CFLAGS
std=
for mystd in gnu11 gnu99 c11 c99; do
CFLAGS="-std=$mystd"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()
], [
CFLAGS="$CFLAGS $old_cflags"
std=$mystd
break
], [
CFLAGS="$old_cflags"
])
done
AC_MSG_RESULT($std)
AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
dnl -Wcast-qual -Wcast-align -Wconversion -Wunreachable-code # too many warnings
dnl -Wstrict-prototypes -Wredundant-decls # may give warnings in some systems
dnl -Wmissing-format-attribute -Wmissing-noreturn -Wwrite-strings # a couple of warnings
CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast"
AS_IF([test "$have_clang" = "yes"], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3)
# error new clang
#endif
]], [[]])],[],[
dnl clang 3.3+ unfortunately this gives warnings with hash.h
CFLAGS="$CFLAGS -Wno-duplicate-decl-specifier"
])
], [
dnl This is simply to avoid warning when building strftime() wrappers..
CFLAGS="$CFLAGS -fno-builtin-strftime"
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if __GNUC__ < 4
# error old gcc
#endif
]], [[]])],[
dnl gcc4
CFLAGS="$CFLAGS -Wstrict-aliasing=2"
],[])
])
])
......
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.