dnl These macros have been taken from http://ac-archive.sourceforge.net/ AC_DEFUN([AC_CXX_NAMESPACES], [AC_CACHE_CHECK(whether the compiler implements namespaces, ac_cv_cxx_namespaces, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], [using namespace Outer::Inner; return i;], ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_namespaces" = yes; then AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) fi ]) AC_DEFUN([AC_CXX_HAVE_SSTREAM], [AC_CACHE_CHECK(whether the compiler has stringstream, ac_cv_cxx_have_sstream, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #ifdef HAVE_NAMESPACES using namespace std; #endif],[stringstream message; message << "Hello"; return 0;], ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_sstream" = yes; then AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream]) fi ]) AC_DEFUN([AC_CXX_STATIC_CAST], [AC_CACHE_CHECK(whether the compiler supports static_cast<>, ac_cv_cxx_static_cast, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include class Base { public : Base () {} virtual void f () = 0; }; class Derived : public Base { public : Derived () {} virtual void f () {} }; int g (Derived&) { return 0; }],[ Derived d; Base& b = d; Derived& s = static_cast (b); return g (s);], ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_static_cast" = yes; then AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>]) fi ]) AC_DEFUN([AC_CXX_CONST_CAST], [AC_CACHE_CHECK(whether the compiler supports const_cast<>, ac_cv_cxx_const_cast, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast(y);return z;], ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_const_cast" = yes; then AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>]) fi ]) AC_DEFUN([AC_CXX_TEMPLATES], [AC_CACHE_CHECK(whether the compiler supports basic templates, ac_cv_cxx_templates, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([template class A {public:A(){}}; template void f(const A& ){}],[ A d; A i; f(d); f(i); return 0;], ac_cv_cxx_templates=yes, ac_cv_cxx_templates=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_templates" = yes; then AC_DEFINE(HAVE_TEMPLATES,,[define if the compiler supports basic templates]) fi ]) AC_DEFUN([AC_CXX_BOOL], [AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type, ac_cv_cxx_bool, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ int f(int x){return 1;} int f(char x){return 1;} int f(bool x){return 1;} ],[bool b = true; return f(b);], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_bool" = yes; then AC_DEFINE(HAVE_BOOL,,[define if bool is a built-in type]) fi ]) AC_DEFUN([AC_CXX_HAVE_STD], [AC_CACHE_CHECK(whether the compiler supports ISO C++ standard library, ac_cv_cxx_have_std, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #include #include #include #ifdef HAVE_NAMESPACES using namespace std; #endif],[return 0;], ac_cv_cxx_have_std=yes, ac_cv_cxx_have_std=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_std" = yes; then AC_DEFINE(HAVE_STD,,[define if the compiler supports ISO C++ standard library]) fi ])