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.

177 lines
6.8KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_cond_with_level.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_COND_WITH_LEVEL(PACKAGE [,DEFAULT [,YESLEVEL]])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Actually used after an AC_ARG_WITH(PKG,...) option-directive, where
  12. # AC_ARG_WITH is a part of the standard autoconf to define a `configure`
  13. # --with-PKG option.
  14. #
  15. # This macros works almost like AC_COND_WITH(PACKAGE [,DEFAULT]), but the
  16. # definition is set to a numeric value. The level of a simple "yes" is
  17. # given (or assumed "2" if absent), otherwise the level can be given in
  18. # mnemonic names, being:
  19. #
  20. # 1 = some
  21. # 2 = many
  22. # 3 = all
  23. # 4 = extra
  24. # 5 = extrasome more
  25. # 6 = extramany muchmore much
  26. # 7 = super everything
  27. # 8 = ultra experimental
  28. # 9 = insane
  29. #
  30. # this macro is most handily it making Makefile.in/Makefile.am that have a
  31. # set of with-level declarations, especially optimization-levels
  32. #
  33. # the $withval shell-variable is set for further examination (it carries
  34. # the numeric value of the various mnemonics above)
  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 11
  66. AU_ALIAS([AC_COND_WITH_LEVEL], [AX_COND_WITH_LEVEL])
  67. AC_DEFUN([AX_COND_WITH_LEVEL],
  68. [dnl the names to be defined...
  69. pushdef([WITH_VAR], patsubst(with_$1, -, _))dnl
  70. pushdef([VAR_WITH], patsubst(translit(with_$1, [a-z], [A-Z]), -, _))dnl
  71. pushdef([VAR_WITHOUT], patsubst(translit(without_$1, [a-z], [A-Z]), -, _))dnl
  72. pushdef([VAR_WITHVAL], patsubst(translit(withval_$1, [a-z], [A-Z]), -, _))dnl
  73. pushdef([VAR_WITHDEF], patsubst(translit(withdef_$1, [a-z], [A-Z]), -, _))dnl
  74. AC_SUBST(VAR_WITH)
  75. AC_SUBST(VAR_WITHOUT)
  76. AC_SUBST(VAR_WITHVAL)
  77. AC_SUBST(VAR_WITHDEF)
  78. if test -z "$WITH_VAR"
  79. then WITH_VAR=`echo ifelse([$2], , no, [$2])`
  80. fi
  81. if test "$WITH_VAR" = "yes"
  82. then WITH_VAR=`echo ifelse([$3], , some, [$3])`
  83. fi
  84. if test "$WITH_VAR" != "no"; then
  85. VAR_WITH= ; VAR_WITHOUT='#'
  86. case "$WITH_VAR" in
  87. 9|9,*|ultrasome|ultrasome,*|insane) withval=9
  88. VAR_WITHVAL=9 ; VAR_WITHDEF="-D""VAR_WITH=9" ;;
  89. 8|8,*|ultra|ultra,*|experimental) withval=8
  90. VAR_WITHVAL=8 ; VAR_WITHDEF="-D""VAR_WITH=8" ;;
  91. 7|7,*|muchmore|somemanymore|somemanymore,*|all) withval=7
  92. VAR_WITHVAL=7 ; VAR_WITHDEF="-D""VAR_WITH=7" ;;
  93. 6|6,*|manymore|manymore,*|most) withval=6
  94. VAR_WITHVAL=6 ; VAR_WITHDEF="-D""VAR_WITH=6" ;;
  95. 5|5,*|somemore|somemore,*|almost) withval=5
  96. VAR_WITHVAL=5 ; VAR_WITHDEF="-D""VAR_WITH=5" ;;
  97. 4|4,*|more|more,*) withval=4
  98. VAR_WITHVAL=4 ; VAR_WITHDEF="-D""VAR_WITH=4" ;;
  99. 3|3,*|much|somemany,*) withval=3
  100. VAR_WITHVAL=3 ; VAR_WITHDEF="-D""VAR_WITH=3" ;;
  101. 2|2,*|many|many,*) withval=2
  102. VAR_WITHVAL=2 ; VAR_WITHDEF="-D""VAR_WITH=2" ;;
  103. 1|1,*|some|some,*) withval=1
  104. VAR_WITHVAL=1 ; VAR_WITHDEF="-D""VAR_WITH=1" ;;
  105. *) withval=-
  106. AC_MSG_ERROR([dnl
  107. bad value of --with-$1 option, choose a number or some|many|more|all... ])
  108. esac
  109. else withval=0
  110. VAR_WITH='#' ; VAR_WITHOUT=""
  111. VAR_WITHVAL=0 ; VAR_WITHDEF=""
  112. fi
  113. popdef([VAR_WITH])dnl
  114. popdef([VAR_WITHOUT])dnl
  115. popdef([VAR_WITHVAL])dnl
  116. popdef([VAR_WITHDEF])dnl
  117. popdef([WITH_VAR])dnl
  118. ])
  119. dnl and the same as AX_COND_WITH_LEVEL with an AC_DEFINE in the end...
  120. AC_DEFUN([AX_COND_WITH_LEVEL_DEFINE],
  121. [dnl the names to be defined...
  122. pushdef([WITH_VAR], patsubst(with_$1, -, _))dnl
  123. pushdef([VAR_WITH], patsubst(translit(with_$1, [a-z], [A-Z]), -, _))dnl
  124. pushdef([VAR_WITHOUT], patsubst(translit(without_$1, [a-z], [A-Z]), -, _))dnl
  125. pushdef([VAR_WITHVAL], patsubst(translit(withval_$1, [a-z], [A-Z]), -, _))dnl
  126. pushdef([VAR_WITHDEF], patsubst(translit(withdef_$1, [a-z], [A-Z]), -, _))dnl
  127. AC_SUBST(VAR_WITH)
  128. AC_SUBST(VAR_WITHOUT)
  129. AC_SUBST(VAR_WITHVAL)
  130. AC_SUBST(VAR_WITHDEF)
  131. if test -z "$WITH_VAR"
  132. then WITH_VAR=`echo ifelse([$2], , no, [$2])`
  133. fi
  134. if test "$WITH_VAR" = "yes"
  135. then WITH_VAR=`echo ifelse([$3], , some, [$3])`
  136. fi
  137. if test "$WITH_VAR" != "no"; then
  138. VAR_WITH= ; VAR_WITHOUT='#'
  139. case "$WITH_VAR" in
  140. 9|9,*|ultrasome|ultrasome,*|insane) withval=9
  141. VAR_WITHVAL=9 ; VAR_WITHDEF="-D""VAR_WITH=9" ;;
  142. 8|8,*|ultra|ultra,*|experimental) withval=8
  143. VAR_WITHVAL=8 ; VAR_WITHDEF="-D""VAR_WITH=8" ;;
  144. 7|7,*|muchmore|somemanymore|somemanymore,*|all) withval=7
  145. VAR_WITHVAL=7 ; VAR_WITHDEF="-D""VAR_WITH=7" ;;
  146. 6|6,*|manymore|manymore,*|most) withval=6
  147. VAR_WITHVAL=6 ; VAR_WITHDEF="-D""VAR_WITH=6" ;;
  148. 5|5,*|somemore|somemore,*|almost) withval=5
  149. VAR_WITHVAL=5 ; VAR_WITHDEF="-D""VAR_WITH=5" ;;
  150. 4|4,*|more|more,*) withval=4
  151. VAR_WITHVAL=4 ; VAR_WITHDEF="-D""VAR_WITH=4" ;;
  152. 3|3,*|much|somemany,*) withval=3
  153. VAR_WITHVAL=3 ; VAR_WITHDEF="-D""VAR_WITH=3" ;;
  154. 2|2,*|many|many,*) withval=2
  155. VAR_WITHVAL=2 ; VAR_WITHDEF="-D""VAR_WITH=2" ;;
  156. 1|1,*|some|some,*) withval=1
  157. VAR_WITHVAL=1 ; VAR_WITHDEF="-D""VAR_WITH=1" ;;
  158. *) withval=-
  159. AC_MSG_ERROR([dnl
  160. bad value of --with-$1 option, choose a number or some|many|more|all... ])
  161. esac
  162. dnl -- the additional line is here --
  163. AC_DEFINE_UNQUOTED(VAR_WITH,$VAR_WITHVAL,"--with-$1=level")
  164. else withval=0
  165. VAR_WITH='#' ; VAR_WITHOUT=""
  166. VAR_WITHVAL=0 ; VAR_WITHDEF=""
  167. fi
  168. popdef([VAR_WITH])dnl
  169. popdef([VAR_WITHOUT])dnl
  170. popdef([VAR_WITHVAL])dnl
  171. popdef([VAR_WITHDEF])dnl
  172. popdef([WITH_VAR])dnl
  173. ])