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.

46 lines
1.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_cxx_mutable.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CXX_MUTABLE
  8. #
  9. # DESCRIPTION
  10. #
  11. # If the compiler allows modifying class data members flagged with the
  12. # mutable keyword even in const objects (for example in the body of a
  13. # const member function), define HAVE_MUTABLE.
  14. #
  15. # LICENSE
  16. #
  17. # Copyright (c) 2008 Todd Veldhuizen
  18. # Copyright (c) 2008 Luc Maisonobe <luc@spaceroots.org>
  19. #
  20. # Copying and distribution of this file, with or without modification, are
  21. # permitted in any medium without royalty provided the copyright notice
  22. # and this notice are preserved. This file is offered as-is, without any
  23. # warranty.
  24. #serial 7
  25. AU_ALIAS([AC_CXX_MUTABLE], [AX_CXX_MUTABLE])
  26. AC_DEFUN([AX_CXX_MUTABLE],
  27. [AC_CACHE_CHECK(whether the compiler supports the mutable keyword,
  28. ax_cv_cxx_mutable,
  29. [AC_LANG_SAVE
  30. AC_LANG_CPLUSPLUS
  31. AC_TRY_COMPILE([
  32. class A { mutable int i;
  33. public:
  34. int f (int n) const { i = n; return i; }
  35. };
  36. ],[A a; return a.f (1);],
  37. ax_cv_cxx_mutable=yes, ax_cv_cxx_mutable=no)
  38. AC_LANG_RESTORE
  39. ])
  40. if test "$ax_cv_cxx_mutable" = yes; then
  41. AC_DEFINE(HAVE_MUTABLE,,[define if the compiler supports the mutable keyword])
  42. fi
  43. ])