Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.7KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_cflags_sun_option.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CFLAGS_SUN_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
  8. #
  9. # DESCRIPTION
  10. #
  11. # AX_CFLAGS_SUN_OPTION(+xtreme) would show a message as like "checking
  12. # CFLAGS for sun/cc +xtreme ... yes" and adds the optionflag to CFLAGS if
  13. # it is understood. You can override the shellvar-default of CFLAGS of
  14. # course. The order of arguments stems from the explicit macros like
  15. # AX_CFLAGS_WARN_ALL.
  16. #
  17. # The cousin AX_CXXFLAGS_SUN_OPTION would check for an option to add to
  18. # CXXFLAGS - and it uses the autoconf setup for C++ instead of C (since it
  19. # is possible to use different compilers for C and C++).
  20. #
  21. # The macro is a lot simpler than any special AX_CFLAGS_* macro (or
  22. # ax_cxx_rtti.m4 macro) but allows to check for arbitrary options.
  23. # However, if you use this macro in a few places, it would be great if you
  24. # would make up a new function-macro and submit it to the ac-archive.
  25. #
  26. # - $1 option-to-check-for : required ("-option" as non-value)
  27. # - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
  28. # - $3 action-if-found : add value to shellvariable
  29. # - $4 action-if-not-found : nothing
  30. #
  31. # note: in earlier versions, $1-$2 were swapped. We try to detect the
  32. # situation and accept a $2=~/-/ as being the old option-to-check-for.
  33. #
  34. # see also: AX_CFLAGS_GCC_OPTION for the widely used original variant.
  35. #
  36. # LICENSE
  37. #
  38. # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  39. #
  40. # This program is free software; you can redistribute it and/or modify it
  41. # under the terms of the GNU General Public License as published by the
  42. # Free Software Foundation; either version 3 of the License, or (at your
  43. # option) any later version.
  44. #
  45. # This program is distributed in the hope that it will be useful, but
  46. # WITHOUT ANY WARRANTY; without even the implied warranty of
  47. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  48. # Public License for more details.
  49. #
  50. # You should have received a copy of the GNU General Public License along
  51. # with this program. If not, see <https://www.gnu.org/licenses/>.
  52. #
  53. # As a special exception, the respective Autoconf Macro's copyright owner
  54. # gives unlimited permission to copy, distribute and modify the configure
  55. # scripts that are the output of Autoconf when processing the Macro. You
  56. # need not follow the terms of the GNU General Public License when using
  57. # or distributing such scripts, even though portions of the text of the
  58. # Macro appear in them. The GNU General Public License (GPL) does govern
  59. # all other use of the material that constitutes the Autoconf Macro.
  60. #
  61. # This special exception to the GPL applies to versions of the Autoconf
  62. # Macro released by the Autoconf Archive. When you make and distribute a
  63. # modified version of the Autoconf Macro, you may extend this special
  64. # exception to the GPL to apply to your modified version as well.
  65. #serial 15
  66. AC_DEFUN([AX_FLAGS_SUN_OPTION_PRIVATE], [dnl
  67. AX_CHECK_COMPILE_FLAG([$1], [flag_ok="yes"], [flag_ok="no"], [+xstrconst -Xc])
  68. AS_CASE([".$flag_ok"],
  69. [.ok|.ok,*], [$3],
  70. [.|.no|.no,*], [$4],
  71. [m4_default($3,[AX_APPEND_FLAG([$1],[$2])])])
  72. ])
  73. AC_DEFUN([AX_CFLAGS_SUN_OPTION],[
  74. AC_LANG_PUSH([C])
  75. AX_FLAGS_SUN_OPTION_PRIVATE(ifelse(m4_bregexp([$2],[-]),-1,[[$1],[$2]],[[$2],[$1]]),[$3],[$4])
  76. AC_LANG_POP
  77. ])
  78. AC_DEFUN([AX_CXXFLAGS_SUN_OPTION],[
  79. AC_LANG_PUSH([C++])
  80. AX_FLAGS_SUN_OPTION_PRIVATE(ifelse(m4_bregexp([$2],[-]),-1,[[$1],[$2]],[[$2],[$1]]),[$3],[$4])
  81. AC_LANG_POP
  82. ])