mhd_check_add_cc_cflags.m4 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # SYNOPSIS
  2. #
  3. # MHD_CHECK_ADD_CC_CFLAGS([FLAGS-TO-TEST], [VARIABLE-TO-EXTEND])
  4. #
  5. # DESCRIPTION
  6. #
  7. # This macro checks whether the specific compiler flags are supported.
  8. # The FLAGS-TO-TEST parameter is whitespace-separated flagto to test.
  9. # The flags are tested one-by-one, all supported flags are added to the
  10. # VARIABLE-TO-EXTEND.
  11. # Every flag check is performing by appending one flag to the value of
  12. # VARIABLE-TO-EXTEND (CFLAGS if not specified), then prepending result to
  13. # CFLAGS (unless VARIABLE-TO-EXTEND is CFLAGS), and then performing compile
  14. # and link test. If test succeed without warnings, then the flag is added to
  15. # VARIABLE-TO-EXTEND. Otherwise, if compile and link without test flag cannot
  16. # be done without any warning, the flag is considered to be unsuppoted.
  17. #
  18. # Example usage:
  19. #
  20. # MHD_CHECK_ADD_CC_CFLAGS([-Wshadow -Walloc-zero -Winit-self],
  21. # [additional_CFLAGS])
  22. #
  23. #
  24. # LICENSE
  25. #
  26. # Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
  27. #
  28. # Copying and distribution of this file, with or without modification, are
  29. # permitted in any medium without royalty provided the copyright notice
  30. # and this notice are preserved. This file is offered as-is, without any
  31. # warranty.
  32. #serial 1
  33. AC_DEFUN([MHD_CHECK_ADD_CC_CFLAGS],[dnl
  34. m4_foreach_w([test_flag],[$1],
  35. [MHD_CHECK_ADD_CC_CFLAG([test_flag],[$2])
  36. ])dnl
  37. ])