source: synfigstudio/trunk/fuentes/m4/cxx_macros.m4 @ 481

Last change on this file since 481 was 481, checked in by jrpelegrina, 4 years ago

First release to xenial

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1AC_DEFUN([AC_CXX_FUNCTION_NONTYPE_PARAMETERS],
2[AC_CACHE_CHECK(whether the compiler supports function templates with non-type parameters,
3ac_cv_cxx_function_nontype_parameters,
4[AC_LANG_SAVE
5 AC_LANG_CPLUSPLUS
6 AC_TRY_COMPILE([
7template<class T, int N> class A {};
8template<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])
13if 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])
16fi
17])
18
19AC_DEFUN([AC_CXX_NAMESPACES],
20[AC_CACHE_CHECK(whether the compiler implements namespaces,
21ac_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])
29if test "$ac_cv_cxx_namespaces" = yes; then
30  AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
31fi
32])
33
34AC_DEFUN([AC_CXX_HAVE_COMPLEX],
35[AC_CACHE_CHECK(whether the compiler has complex<T>,
36ac_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
42using 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])
47if test "$ac_cv_cxx_have_complex" = yes; then
48  AC_DEFINE(HAVE_COMPLEX,,[define if the compiler has complex<T>])
49fi
50])
51
52AC_DEFUN([AC_CXX_HAVE_SSTREAM],
53[AC_CACHE_CHECK(whether the compiler has stringstream,
54ac_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
60using 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])
65if test "$ac_cv_cxx_have_sstream" = yes; then
66  AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream])
67fi
68])
69
70AC_DEFUN([AC_CXX_MUTABLE],
71[AC_CACHE_CHECK(whether the compiler supports the mutable keyword,
72ac_cv_cxx_mutable,
73[AC_LANG_SAVE
74 AC_LANG_CPLUSPLUS
75 AC_TRY_COMPILE([
76class 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])
84if test "$ac_cv_cxx_mutable" = yes; then
85  AC_DEFINE(HAVE_MUTABLE,,[define if the compiler supports the mutable keyword])
86fi
87])
88
Note: See TracBrowser for help on using the repository browser.