aboutsummaryrefslogtreecommitdiffhomepage
path: root/tvmet-1.7.1/config/ac_cxx_have_mutable.m4
blob: 47d5d8ab98d729fcca024976c9bc7d11304bdd21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
dnl $Id: ac_cxx_have_mutable.m4,v 1.2 2004/04/23 23:41:52 opetzold Exp $
dnl
dnl If the compiler allows modifying data members of classes flagged with
dnl the mutable keyword even in const objects, define HAVE_MUTABLE.
dnl

AC_DEFUN([AC_CXX_HAVE_MUTABLE],
[AC_CACHE_CHECK(for mutable,
ac_cv_cxx_mutable,
[AC_LANG_PUSH([C++])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
class Foo {
  mutable int i;
public:
  int bar (int n) const { i = n; return i; }
};
]], [[Foo foo; return foo.bar(1);]])],[ac_cv_cxx_mutable=yes],[ac_cv_cxx_mutable=no])
 AC_LANG_POP([C++])
])
if test "$ac_cv_cxx_mutable" = yes; then
  AC_DEFINE(HAVE_MUTABLE,,[Define if the compiler supports the mutable keyword])
fi
])