]> git.tdb.fi Git - ext/sigc++-2.0.git/blob - _build/cxx.m4
Add MSP build files
[ext/sigc++-2.0.git] / _build / cxx.m4
1 dnl
2 dnl SIGC_CXX_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD()
3 dnl
4 dnl
5 AC_DEFUN([SIGC_CXX_GCC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD],[
6 AC_MSG_CHECKING([if C++ compiler supports the use of a particular specialization when calling operator() template methods.])
7 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
8 [[
9   #include <iostream>
10
11   class Thing
12   {
13     public:
14     Thing()
15     {}
16
17     template <class T>
18     void operator()(T a, T b)
19     {
20       T c = a + b;
21       std::cout << c << std::endl;
22     }
23   };
24
25   template<class T2>
26   class OtherThing
27   {
28   public:
29     void do_something()
30     {
31        Thing thing_;
32        thing_.template operator()<T2>(1, 2);
33        //This fails with or without the template keyword, on SUN Forte C++ 5.3, 5.4, and 5.5:
34     }
35   };
36 ]],
37 [[
38   OtherThing<int> thing;
39   thing.do_something();
40 ]])],
41 [
42   sigcm_cxx_gcc_template_specialization_operator_overload=yes
43   AC_DEFINE([SIGC_GCC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD],[1],[does the C++ compiler support the use of a particular specialization when calling operator() template methods.])
44 ],[
45   sigcm_cxx_gcc_template_specialization_operator_overload=no
46 ])
47 AC_MSG_RESULT([$sigcm_cxx_gcc_template_specialization_operator_overload])
48 ])
49
50 AC_DEFUN([SIGC_CXX_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD],[
51 AC_MSG_CHECKING([if C++ compiler supports the use of a particular specialization when calling operator() template methods omitting the template keyword.])
52 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
53 [[
54   #include <iostream>
55
56   class Thing
57   {
58     public:
59     Thing()
60     {}
61
62     template <class T>
63     void operator()(T a, T b)
64     {
65       T c = a + b;
66       std::cout << c << std::endl;
67     }
68   };
69
70   template<class T2>
71   class OtherThing
72   {
73   public:
74     void do_something()
75     {
76        Thing thing_;
77        thing_.operator()<T2>(1, 2);
78        //This fails with or without the template keyword, on SUN Forte C++ 5.3, 5.4, and 5.5:
79     }
80   };
81 ]],
82 [[
83   OtherThing<int> thing;
84   thing.do_something();
85 ]])],
86 [
87   sigcm_cxx_msvc_template_specialization_operator_overload=yes
88   AC_DEFINE([SIGC_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD],[1],[does the C++ compiler support the use of a particular specialization when calling operator() template methods omitting the template keyword.])
89 ],[
90   sigcm_cxx_msvc_template_specialization_operator_overload=no
91 ])
92 AC_MSG_RESULT([$sigcm_cxx_msvc_template_specialization_operator_overload])
93 ])
94
95 dnl
96 dnl SIGC_CXX_PRAGMA_PUSH_POP_MACRO
97 dnl
98 dnl TODO: When we can break ABI, delete this. It's used when nil is
99 dnl temporarily undefined. See comment in functor_trait.h.
100 dnl
101 AC_DEFUN([SIGC_CXX_PRAGMA_PUSH_POP_MACRO],[
102 AC_MSG_CHECKING([if C++ preprocessor supports pragma push_macro() and pop_macro().])
103 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
104 [[
105   #define BEGIN {
106   #define END   }
107   #pragma push_macro("BEGIN")
108   #pragma push_macro("END")
109   #undef BEGIN
110   #undef END
111
112   // BEGIN and END are not prepreprocessor macros
113   struct Test1
114   {
115     int BEGIN;
116     double END;
117   };
118
119   #pragma pop_macro("BEGIN")
120   #pragma pop_macro("END")
121
122   // BEGIN and END are prepreprocessor macros
123   struct Test2
124   BEGIN
125     int i;
126     double d;
127   END;
128
129   void func1(Test1& x);
130   void func2(Test2& x);
131 ]],
132 [[
133   Test1 test1;
134   Test2 test2;
135   func1(test1);
136   func2(test2);
137 ]])],
138 [
139   sigcm_cxx_pragma_push_pop_macro=yes
140   AC_DEFINE([SIGC_PRAGMA_PUSH_POP_MACRO],[1],[does the C++ preprocessor support pragma push_macro() and pop_macro().])
141 ],[
142   sigcm_cxx_pragma_push_pop_macro=no
143 ])
144 AC_MSG_RESULT([$sigcm_cxx_pragma_push_pop_macro])
145 ])