Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_07_rc2 / config / cxx_macros.m4
1 AC_DEFUN([AC_CXX_FUNCTION_NONTYPE_PARAMETERS],
2 [AC_CACHE_CHECK(whether the compiler supports function templates with non-type parameters,
3 ac_cv_cxx_function_nontype_parameters,
4 [AC_LANG_SAVE
5  AC_LANG_CPLUSPLUS
6  AC_TRY_COMPILE([
7 template<class T, int N> class A {};
8 template<class T, int N> int f(const A<T,N>& x) { return 0; }
9 ],[A<double, 17> z; return f(z);],
10  ac_cv_cxx_function_nontype_parameters=yes, ac_cv_cxx_function_nontype_parameters=no)
11  AC_LANG_RESTORE
12 ])
13 if test "$ac_cv_cxx_function_nontype_parameters" = yes; then
14   AC_DEFINE(HAVE_FUNCTION_NONTYPE_PARAMETERS,,
15             [define if the compiler supports function templates with non-type parameters])
16 fi
17 ])
18
19 AC_DEFUN([AC_CXX_NAMESPACES],
20 [AC_CACHE_CHECK(whether the compiler implements namespaces,
21 ac_cv_cxx_namespaces,
22 [AC_LANG_SAVE
23  AC_LANG_CPLUSPLUS
24  AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
25                 [using namespace Outer::Inner; return i;],
26  ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
27  AC_LANG_RESTORE
28 ])
29 if test "$ac_cv_cxx_namespaces" = yes; then
30   AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
31 fi
32 ])
33
34 AC_DEFUN([AC_CXX_HAVE_COMPLEX],
35 [AC_CACHE_CHECK(whether the compiler has complex<T>,
36 ac_cv_cxx_have_complex,
37 [AC_REQUIRE([AC_CXX_NAMESPACES])
38  AC_LANG_SAVE
39  AC_LANG_CPLUSPLUS
40  AC_TRY_COMPILE([#include <complex>
41 #ifdef HAVE_NAMESPACES
42 using namespace std;
43 #endif],[complex<float> a; complex<double> b; return 0;],
44  ac_cv_cxx_have_complex=yes, ac_cv_cxx_have_complex=no)
45  AC_LANG_RESTORE
46 ])
47 if test "$ac_cv_cxx_have_complex" = yes; then
48   AC_DEFINE(HAVE_COMPLEX,,[define if the compiler has complex<T>])
49 fi
50 ])
51
52 AC_DEFUN([AC_CXX_HAVE_SSTREAM],
53 [AC_CACHE_CHECK(whether the compiler has stringstream,
54 ac_cv_cxx_have_sstream,
55 [AC_REQUIRE([AC_CXX_NAMESPACES])
56  AC_LANG_SAVE
57  AC_LANG_CPLUSPLUS
58  AC_TRY_COMPILE([#include <sstream>
59 #ifdef HAVE_NAMESPACES
60 using namespace std;
61 #endif],[stringstream message; message << "Hello"; return 0;],
62  ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no)
63  AC_LANG_RESTORE
64 ])
65 if test "$ac_cv_cxx_have_sstream" = yes; then
66   AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream])
67 fi
68 ])
69
70 AC_DEFUN([AC_CXX_MUTABLE],
71 [AC_CACHE_CHECK(whether the compiler supports the mutable keyword,
72 ac_cv_cxx_mutable,
73 [AC_LANG_SAVE
74  AC_LANG_CPLUSPLUS
75  AC_TRY_COMPILE([
76 class A { mutable int i;
77           public:
78           int f (int n) const { i = n; return i; }
79         };
80 ],[A a; return a.f (1);],
81  ac_cv_cxx_mutable=yes, ac_cv_cxx_mutable=no)
82  AC_LANG_RESTORE
83 ])
84 if test "$ac_cv_cxx_mutable" = yes; then
85   AC_DEFINE(HAVE_MUTABLE,,[define if the compiler supports the mutable keyword])
86 fi
87 ])
88