mc-cflags.m4 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. dnl @synopsis MC_CHECK_CFLAGS
  2. dnl
  3. dnl Check flags supported by compilator
  4. dnl
  5. dnl @author Slava Zanko <slavazanko@gmail.com>
  6. dnl @version 2009-10-29
  7. dnl @license GPL
  8. dnl @copyright Free Software Foundation, Inc.
  9. AC_DEFUN([MC_CHECK_ONE_CFLAG],[
  10. AC_MSG_CHECKING([whether gcc accepts $1])
  11. safe_CFLAGS=$CFLAGS
  12. CFLAGS="$1"
  13. AC_TRY_COMPILE(, [
  14. return 0;
  15. ],
  16. [
  17. mc_check_one_cflag=yes
  18. ],
  19. [
  20. mc_check_one_cflag=no
  21. ])
  22. CFLAGS=$safe_CFLAGS
  23. AC_MSG_RESULT([$mc_check_one_cflag])
  24. if test x$mc_check_one_cflag = xyes; then
  25. mc_configured_cflags="$mc_configured_cflags $1"
  26. fi
  27. ])
  28. AC_DEFUN([MC_CHECK_CFLAGS],[
  29. mc_configured_cflags=""
  30. dnl Sorted -f options:
  31. dnl AC_MSG_CHECKING([CC is $CC])
  32. case "$CC" in
  33. gcc*)
  34. MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
  35. dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector])
  36. ;;
  37. *)
  38. ;;
  39. esac
  40. dnl Sorted -W options:
  41. dnl MC_CHECK_ONE_CFLAG([-Wbad-function-cast])
  42. MC_CHECK_ONE_CFLAG([-Wcomment])
  43. MC_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
  44. MC_CHECK_ONE_CFLAG([-Wfloat-equal])
  45. MC_CHECK_ONE_CFLAG([-Wformat])
  46. MC_CHECK_ONE_CFLAG([-Wformat-security])
  47. MC_CHECK_ONE_CFLAG([-Wimplicit])
  48. MC_CHECK_ONE_CFLAG([-Wignored-qualifiers])
  49. MC_CHECK_ONE_CFLAG([-Wmissing-braces])
  50. MC_CHECK_ONE_CFLAG([-Wmissing-declarations])
  51. MC_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
  52. MC_CHECK_ONE_CFLAG([-Wmissing-prototypes])
  53. MC_CHECK_ONE_CFLAG([-Wnested-externs])
  54. MC_CHECK_ONE_CFLAG([-Wno-long-long])
  55. MC_CHECK_ONE_CFLAG([-Wno-unreachable-code])
  56. MC_CHECK_ONE_CFLAG([-Wparentheses])
  57. MC_CHECK_ONE_CFLAG([-Wpointer-sign])
  58. MC_CHECK_ONE_CFLAG([-Wreturn-type])
  59. MC_CHECK_ONE_CFLAG([-Wsequence-point])
  60. MC_CHECK_ONE_CFLAG([-Wshadow])
  61. MC_CHECK_ONE_CFLAG([-Wsign-compare])
  62. dnl MC_CHECK_ONE_CFLAG([-Wstrict-aliasing])
  63. MC_CHECK_ONE_CFLAG([-Wswitch])
  64. MC_CHECK_ONE_CFLAG([-Wtype-limits])
  65. MC_CHECK_ONE_CFLAG([-Wuninitialized])
  66. dnl MC_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
  67. MC_CHECK_ONE_CFLAG([-Wunused-function])
  68. MC_CHECK_ONE_CFLAG([-Wunused-label])
  69. MC_CHECK_ONE_CFLAG([-Wunused-parameter])
  70. MC_CHECK_ONE_CFLAG([-Wunused-result])
  71. MC_CHECK_ONE_CFLAG([-Wunused-value])
  72. MC_CHECK_ONE_CFLAG([-Wunused-variable])
  73. MC_CHECK_ONE_CFLAG([-Wwrite-strings])
  74. ])