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.

157 lines
5.2KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_config_feature.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CONFIG_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION, DEFINE, DEFINE-DESCRIPTION, [ACTION-IF-ENABLED [, ACTION-IF-NOT-ENABLED]])
  8. #
  9. # DESCRIPTION
  10. #
  11. # AX_CONFIG_FEATURE is a simple wrapper for AC_ARG_ENABLE, it enables the
  12. # feature FEATURE-NAME and AC_DEFINEs the passed DEFINE, depending on the
  13. # user choice. DESCRIPTION will be used for AC_DEFINEs. ACTION-IF-ENABLED
  14. # and ACTION-IF-NOT-ENABLED are the actions that will be run. A feature is
  15. # enabled by default, in order to change this behaviour use the
  16. # AX_CONFIG_FEATURE_DEFAULT_ENABLED and AX_CONFIG_FEATURE_DEFAULT_DISABLED
  17. # macros.
  18. #
  19. # A simple example:
  20. #
  21. # AX_CONFIG_FEATURE_DEFAULT_ENABLED
  22. # AX_CONFIG_FEATURE(feature_xxxxx, [turns on/off XXXXX support],
  23. # HAVE_XXXXX, [Define if you want XXXXX support])
  24. #
  25. # ...
  26. #
  27. # AX_CONFIG_FEATURE_DEFAULT_DISABLED
  28. # AX_CONFIG_FEATURE(feature_yyyyy, [turns on/off YYYYY support],
  29. # HAVE_YYYYY, [Define if you want YYYYY support],
  30. # [enable_yyyyy="yes"], [enable_yyyyy="no"])
  31. # AM_CONDITIONAL(YYYYY, [test "$enable_yyyyy" = "yes"])
  32. #
  33. # AX_CONFIG_FEATURE_DEFAULT_ENABLED
  34. # AX_CONFIG_FEATURE(...)
  35. #
  36. # ...
  37. #
  38. # If you have lot of features and you want a verbose dumping of each user
  39. # selection use AX_CONFIG_FEATURE_VERBOSE. Use AX_CONFIG_FEATURE_SILENT in
  40. # order to remove a previously AX_CONFIG_FEATURE_VERBOSE. By default
  41. # features are silent.
  42. #
  43. # Use AX_CONFIG_FEATURE_ENABLE or AX_CONFIG_FEATURE_DISABLE in order to
  44. # enable or disable a specific feature.
  45. #
  46. # Another simple example:
  47. #
  48. # AS_IF([some_test_here],[AX_CONFIG_FEATURE_ENABLE(feature_xxxxx)],[])
  49. #
  50. # AX_CONFIG_FEATURE(feature_xxxxx, [turns on/off XXXXX support],
  51. # HAVE_XXXXX, [Define if you want XXXXX support])
  52. # AX_CONFIG_FEATURE(feature_yyyyy, [turns on/off YYYYY support],
  53. # HAVE_YYYYY, [Define if you want YYYYY support],
  54. # [enable_yyyyy="yes"], [enable_yyyyy="no"])
  55. #
  56. # ...
  57. #
  58. # NOTE: AX_CONFIG_FEATURE_ENABLE() must be placed first of the relative
  59. # AX_CONFIG_FEATURE() macro ...
  60. #
  61. # LICENSE
  62. #
  63. # Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
  64. #
  65. # This program is free software; you can redistribute it and/or modify it
  66. # under the terms of the GNU General Public License as published by the
  67. # Free Software Foundation; either version 2 of the License, or (at your
  68. # option) any later version.
  69. #
  70. # This program is distributed in the hope that it will be useful, but
  71. # WITHOUT ANY WARRANTY; without even the implied warranty of
  72. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  73. # Public License for more details.
  74. #
  75. # You should have received a copy of the GNU General Public License along
  76. # with this program. If not, see <https://www.gnu.org/licenses/>.
  77. #
  78. # As a special exception, the respective Autoconf Macro's copyright owner
  79. # gives unlimited permission to copy, distribute and modify the configure
  80. # scripts that are the output of Autoconf when processing the Macro. You
  81. # need not follow the terms of the GNU General Public License when using
  82. # or distributing such scripts, even though portions of the text of the
  83. # Macro appear in them. The GNU General Public License (GPL) does govern
  84. # all other use of the material that constitutes the Autoconf Macro.
  85. #
  86. # This special exception to the GPL applies to versions of the Autoconf
  87. # Macro released by the Autoconf Archive. When you make and distribute a
  88. # modified version of the Autoconf Macro, you may extend this special
  89. # exception to the GPL to apply to your modified version as well.
  90. #serial 11
  91. AC_DEFUN([AX_CONFIG_FEATURE],[ dnl
  92. m4_pushdef([FEATURE], patsubst([$1], -, _))dnl
  93. AC_ARG_ENABLE([$1],AS_HELP_STRING([--enable-$1],[$2]),[
  94. case "${enableval}" in
  95. yes)
  96. ax_config_feature_[]FEATURE[]="yes"
  97. ;;
  98. no)
  99. ax_config_feature_[]FEATURE[]="no"
  100. ;;
  101. *)
  102. AC_MSG_ERROR([bad value ${enableval} for feature --$1])
  103. ;;
  104. esac
  105. ])
  106. AS_IF([test "$ax_config_feature_[]FEATURE[]" = yes],[ dnl
  107. AC_DEFINE([$3])
  108. $5
  109. AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl
  110. AC_MSG_NOTICE([Feature $1 is enabled])
  111. ])
  112. ],[ dnl
  113. $6
  114. AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl
  115. AC_MSG_NOTICE([Feature $1 is disabled])
  116. ])
  117. ])
  118. AH_TEMPLATE([$3],[$4])
  119. m4_popdef([FEATURE])dnl
  120. ])
  121. dnl Feature global
  122. AC_DEFUN([AX_CONFIG_FEATURE_VERBOSE],[ dnl
  123. ax_config_feature_verbose=yes
  124. ])
  125. dnl Feature global
  126. AC_DEFUN([AX_CONFIG_FEATURE_SILENT],[ dnl
  127. ax_config_feature_verbose=no
  128. ])
  129. dnl Feature specific
  130. AC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_ENABLED], [
  131. ax_config_feature_[]FEATURE[]_default=yes
  132. ])
  133. dnl Feature specific
  134. AC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_DISABLED], [
  135. ax_config_feature_[]FEATURE[]_default=no
  136. ])
  137. dnl Feature specific
  138. AC_DEFUN([AX_CONFIG_FEATURE_ENABLE],[ dnl
  139. ax_config_feature_[]patsubst([$1], -, _)[]=yes
  140. ])
  141. dnl Feature specific
  142. AC_DEFUN([AX_CONFIG_FEATURE_DISABLE],[ dnl
  143. ax_config_feature_[]patsubst([$1], -, _)[]=no
  144. ])