mhd_find_add_cc_ldflag_ifelse.m4 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # SYNOPSIS
  2. #
  3. # MHD_FIND_ADD_CC_LDFLAG_IFELSE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
  4. # [VARIABLE-TO-EXTEND],
  5. # [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
  6. #
  7. # DESCRIPTION
  8. #
  9. # This macro checks whether the specific compiler flags are supported.
  10. # The flags are checked one-by-one. The checking is stopped when the first
  11. # supported flag found.
  12. # The checks are performing by appending FLAGx-TO-TEST to the value of
  13. # VARIABLE-TO-EXTEND (LDFLAGS if not specified), then prepending result to
  14. # LDFLAGS (unless VARIABLE-TO-EXTEND is LDFLAGS), and then performing compile
  15. # and link test. If test succeed without warnings, then the flag is added to
  16. # VARIABLE-TO-EXTEND and next flags are not checked. If compile-link cycle
  17. # cannot be performed without warning with all tested flags, no flag is
  18. # added to the VARIABLE-TO-EXTEND.
  19. # If any suitable flag is found, ACTION-IF-FOUND is executed otherwise
  20. # ACTION-IF-NOT-FOUND is executed. Found flag (if any) is available as
  21. # value of shell variable $mhd_cc_found_flag during action execution.
  22. #
  23. # Example usage:
  24. #
  25. # MHD_CHECK_CC_LDFLAG([],[AC_MSG_WARN([Stripping is not supported]),
  26. # [additional_LDFLAGS],
  27. # [-Wl,--strip-all], [-Wl,--strip-debug])
  28. #
  29. # Note: Unlike others MHD_CHECK_*CC_LDFLAG* macro, this macro uses another
  30. # order of parameters.
  31. #
  32. # LICENSE
  33. #
  34. # Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
  35. #
  36. # Copying and distribution of this file, with or without modification, are
  37. # permitted in any medium without royalty provided the copyright notice
  38. # and this notice are preserved. This file is offered as-is, without any
  39. # warranty.
  40. #serial 1
  41. AC_DEFUN([MHD_FIND_ADD_CC_LDFLAG_IFELSE],[dnl
  42. _MHD_FIND_ADD_CC_XFLAG([[LDFLAGS]],$@)])