ax_save_flags.m4 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # ===========================================================================
  2. # http://www.gnu.org/software/autoconf-archive/ax_save_flags.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_SAVE_FLAGS([NAMESPACE])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Save common compilation flags into temporary variables.
  12. #
  13. # Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
  14. # OBJCFLAGS.
  15. #
  16. # By default these flags are saved to a global (empty) namespace, but user
  17. # could specify a specific NAMESPACE to AX_SAVE_FLAGS macro and latter
  18. # restore it by using AX_RESTORE_FLAGS(NAMESPACE).
  19. #
  20. # AX_SAVE_FLAGS(mypackage)
  21. # CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
  22. # dnl .. do some detection ...
  23. # AX_RESTORE_FLAGS(mypackage)
  24. #
  25. # LICENSE
  26. #
  27. # Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
  28. # Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
  29. # Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
  30. # Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
  31. #
  32. # Copying and distribution of this file, with or without modification, are
  33. # permitted in any medium without royalty provided the copyright notice
  34. # and this notice are preserved. This file is offered as-is, without any
  35. # warranty.
  36. #serial 7
  37. # list of flag to save
  38. AC_DEFUN([_AX_SAVE_FLAGS_LIST],[dnl
  39. [CCASFLAGS],dnl
  40. [CFLAGS],dnl
  41. [CPPFLAGS],dnl
  42. [CXXFLAGS],dnl
  43. [ERLCFLAGS],dnl
  44. [FCFLAGS],dnl
  45. [FCLIBS],dnl
  46. [FFLAGS],dnl
  47. [FLIBS],dnl
  48. [GCJFLAGS],dnl
  49. [JAVACFLAGS],dnl
  50. [LDFLAGS],dnl
  51. [LIBS],dnl
  52. [OBJCFLAGS],dnl
  53. [OBJCXXFLAGS],dnl
  54. [UPCFLAGS],dnl
  55. [VALAFLAGS]dnl
  56. ])
  57. # save one flag in name space
  58. AC_DEFUN([_AX_SAVE_ONE_FLAG],[
  59. AS_VAR_PUSHDEF([_ax_save_flag_var], [$2[]_$1[]_ax_save_flags])
  60. AS_VAR_COPY(_ax_save_flag_var, $2[])
  61. AS_VAR_POPDEF([_ax_save_flag_var])
  62. ])
  63. AC_DEFUN([AX_SAVE_FLAGS],[dnl
  64. m4_foreach([FLAG], dnl
  65. [_AX_SAVE_FLAGS_LIST()], dnl
  66. [_AX_SAVE_ONE_FLAG([$1],FLAG)])
  67. ])