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)
- ])
+ AC_PROG_CC_C99
+ AS_IF([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"
- ],[])
+ 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"
+ ],[])
])
])