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