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.

97 lines
3.4KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_var_push.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_VAR_PUSHVALUE(VARIABLE, [VALUE])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Stores a copy of variable_name's value and assigns it to 'value' If no
  12. # value is given, its original value is kept. Compile, link and running
  13. # tests usually require the programmer to provide additional flags.
  14. # However, it is strongly recommended not to override flags defined by the
  15. # user through the configure command. AX_VAR_PUSHVALUE and AX_VAR_POPVALUE
  16. # are clean way to temporarily store a variable's value and restore it
  17. # later, using a stack-like behaviour. This macro supports nesting.
  18. #
  19. # Example:
  20. #
  21. # AX_VAR_PUSHVALUE([CXXFLAGS],["my test flags"])
  22. # perform some checks with CXXFLAGS...
  23. # CXXFLAGS value will be "my test flags"
  24. # AX_VAR_POPVALUE([CXXFLAGS])
  25. # CXXFLAGS is restored to its original value
  26. #
  27. # LICENSE
  28. #
  29. # Copyright (c) 2015 Jorge Bellon <jbelloncastro@gmail.com>
  30. #
  31. # This program is free software: you can redistribute it and/or modify it
  32. # under the terms of the GNU General Public License as published by the
  33. # Free Software Foundation, either version 3 of the License, or (at your
  34. # option) any later version.
  35. #
  36. # This program is distributed in the hope that it will be useful, but
  37. # WITHOUT ANY WARRANTY; without even the implied warranty of
  38. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  39. # Public License for more details.
  40. #
  41. # You should have received a copy of the GNU General Public License along
  42. # with this program. If not, see <https://www.gnu.org/licenses/>.
  43. #
  44. # As a special exception, the respective Autoconf Macro's copyright owner
  45. # gives unlimited permission to copy, distribute and modify the configure
  46. # scripts that are the output of Autoconf when processing the Macro. You
  47. # need not follow the terms of the GNU General Public License when using
  48. # or distributing such scripts, even though portions of the text of the
  49. # Macro appear in them. The GNU General Public License (GPL) does govern
  50. # all other use of the material that constitutes the Autoconf Macro.
  51. #
  52. # This special exception to the GPL applies to versions of the Autoconf
  53. # Macro released by the Autoconf Archive. When you make and distribute a
  54. # modified version of the Autoconf Macro, you may extend this special
  55. # exception to the GPL to apply to your modified version as well.
  56. #serial 2
  57. AC_DEFUN([AX_VAR_PUSHVALUE],[
  58. increment([$1_counter])
  59. AS_VAR_PUSHDEF([variable],[$1]) dnl
  60. AS_VAR_PUSHDEF([backup],[save_$1_]$1_counter) dnl
  61. AS_VAR_SET(backup,$variable) dnl
  62. AS_VAR_SET(variable,["]m4_default($2,$variable)["]) dnl
  63. AS_VAR_POPDEF([variable]) dnl
  64. AS_VAR_POPDEF([backup]) dnl
  65. ])dnl AX_PUSH_VAR
  66. AC_DEFUN([AX_VAR_POPVALUE],[
  67. AS_VAR_PUSHDEF([variable],[$1]) dnl
  68. AS_VAR_PUSHDEF([backup],[save_$1_]$1_counter) dnl
  69. AS_VAR_SET(variable,$backup) dnl
  70. decrement([$1_counter])
  71. AS_VAR_POPDEF([variable]) dnl
  72. AS_VAR_POPDEF([backup]) dnl
  73. ])dnl AX_POP_VAR
  74. # -------------------------
  75. # Auxiliary macro
  76. # -------------------------
  77. # increment(counter_name)
  78. #
  79. # Increment the value of a named counter.
  80. # Initialize to 1 if not defined
  81. # -------------------------
  82. m4_define([increment],[dnl
  83. m4_ifdef([$1],dnl
  84. [m4_define([$1],m4_incr($1))],dnl
  85. [m4_define([$1],[1])]dnl
  86. )dnl
  87. ])dnl