ax_switch_flags.m4 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # ===========================================================================
  2. # http://www.gnu.org/software/autoconf-archive/ax_switch_flags.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_SWITCH_FLAGS(newnamespace,[oldnamespace])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Switch common compilation flags from temporary variables between two
  12. # compilation namespace.
  13. #
  14. # Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
  15. # OBJCFLAGS.
  16. #
  17. # By default these flags are restored to a global (empty) namespace, but
  18. # user could restore from specific NAMESPACE by using
  19. # AX_RESTORE_FLAGS(NAMESPACE) macro.
  20. #
  21. # Typical usage is like:
  22. #
  23. # AX_SAVE_FLAGS(beginprogram)
  24. # CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
  25. # AX_SWITCH_FLAGS(mypackage,beginprogram)
  26. #
  27. # LICENSE
  28. #
  29. # Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
  30. # Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
  31. # Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
  32. #
  33. # Copying and distribution of this file, with or without modification, are
  34. # permitted in any medium without royalty provided the copyright notice
  35. # and this notice are preserved. This file is offered as-is, without any
  36. # warranty.
  37. #serial 2
  38. AC_DEFUN([AX_SWITCH_FLAGS], [
  39. AC_REQUIRE(AX_SAVE_FLAGS)
  40. AC_REQUIRE(AX_RESTORE_FLAGS)
  41. AS_IF([test "X$1" = "X"], AC_MSG_ERROR(newnamespace is empty)]
  42. AX_SAVE_FLAGS($1[])
  43. AX_RESTORE_FLAGS($2[])
  44. ])