ax_restore_flags.m4 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # ===========================================================================
  2. # http://www.gnu.org/software/autoconf-archive/ax_restore_flags.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_RESTORE_FLAGS([namespace])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Restore common compilation flags from temporary variables.
  12. #
  13. # Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
  14. # OBJCFLAGS.
  15. #
  16. # By default these flags are restored to a global (empty) namespace, but
  17. # user could restore from specific NAMESPACE by using
  18. # AX_RESTORE_FLAGS(NAMESPACE) macro.
  19. #
  20. # Typical usage is like:
  21. #
  22. # AX_SAVE_FLAGS(mypackage)
  23. # CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
  24. # dnl ... do some detection ...
  25. # AX_RESTORE_FLAGS(mypackage)
  26. #
  27. # LICENSE
  28. #
  29. # Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
  30. # Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
  31. # Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
  32. # Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
  33. #
  34. # Copying and distribution of this file, with or without modification, are
  35. # permitted in any medium without royalty provided the copyright notice
  36. # and this notice are preserved. This file is offered as-is, without any
  37. # warranty.
  38. #serial 6
  39. # save one flag in name space
  40. AC_DEFUN([_AX_RESTORE_ONE_FLAG],[dnl
  41. AS_VAR_PUSHDEF([_ax_restore_flag_var], [$2[]_$1[]_ax_save_flags])
  42. AS_VAR_COPY($2[],_ax_restore_flag_var)
  43. AS_VAR_POPDEF([_ax_restore_flag_var])
  44. ])
  45. AC_DEFUN([AX_RESTORE_FLAGS], [dnl
  46. m4_foreach([FLAG], dnl
  47. [_AX_SAVE_FLAGS_LIST()], dnl
  48. [_AX_RESTORE_ONE_FLAG([$1],FLAG)])
  49. ])