autoheader.m4 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # This file is part of Autoconf. -*- Autoconf -*-
  2. # Interface with autoheader.
  3. # Copyright (C) 1992-1996, 1998-2002, 2008-2012 Free Software
  4. # Foundation, Inc.
  5. # This file is part of Autoconf. This program is free
  6. # software; you can redistribute it and/or modify it under the
  7. # terms of the GNU General Public License as published by the
  8. # Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # Under Section 7 of GPL version 3, you are granted additional
  17. # permissions described in the Autoconf Configure Script Exception,
  18. # version 3.0, as published by the Free Software Foundation.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # and a copy of the Autoconf Configure Script Exception along with
  22. # this program; see the files COPYINGv3 and COPYING.EXCEPTION
  23. # respectively. If not, see <http://www.gnu.org/licenses/>.
  24. # Written by David MacKenzie, with help from
  25. # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
  26. # Roland McGrath, Noah Friedman, david d zuhn, and many others.
  27. # AH_OUTPUT(KEY, TEXT)
  28. # --------------------
  29. # Pass TEXT to autoheader.
  30. # This macro is `read' only via `autoconf --trace', it outputs nothing.
  31. m4_define([AH_OUTPUT], [])
  32. # AH_VERBATIM(KEY, TEMPLATE)
  33. # --------------------------
  34. # If KEY is direct (i.e., no indirection such as in KEY=$my_func which
  35. # may occur if there is AC_CHECK_FUNCS($my_func)), issue an autoheader
  36. # TEMPLATE associated to the KEY. Otherwise, do nothing. TEMPLATE is
  37. # output as is, with no formatting.
  38. #
  39. # Quote for Perl '' strings, which are those used by Autoheader.
  40. m4_define([AH_VERBATIM],
  41. [AS_LITERAL_WORD_IF([$1],
  42. [AH_OUTPUT(_m4_expand([$1]), AS_ESCAPE([[$2]], [\']))])])
  43. # AH_TEMPLATE(KEY, DESCRIPTION)
  44. # -----------------------------
  45. # Issue an autoheader template for KEY, i.e., a comment composed of
  46. # DESCRIPTION (properly wrapped), and then #undef KEY.
  47. m4_define([AH_TEMPLATE],
  48. [AH_VERBATIM([$1],
  49. m4_text_wrap([$2 */], [ ], [/* ])[
  50. @%:@undef ]_m4_expand([$1]))])
  51. # AH_TOP(TEXT)
  52. # ------------
  53. # Output TEXT at the top of `config.h.in'.
  54. m4_define([AH_TOP],
  55. [m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl
  56. AH_VERBATIM([0000]_AH_COUNTER, [$1])])
  57. # AH_BOTTOM(TEXT)
  58. # ---------------
  59. # Output TEXT at the bottom of `config.h.in'.
  60. m4_define([AH_BOTTOM],
  61. [m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl
  62. AH_VERBATIM([zzzz]_AH_COUNTER, [$1])])
  63. # Initialize.
  64. m4_define([_AH_COUNTER], [0])