blob: 70dcc145649f9b9145afa407f6f8f8c98128bea3 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001dnl @synopsis AC_CXX_HAVE_NAMESPACES
2dnl
3dnl If the compiler can prevent names clashes using namespaces, define
4dnl HAVE_NAMESPACES.
5dnl
6dnl @category Cxx
7dnl @author Todd Veldhuizen
8dnl @author Luc Maisonobe <luc@spaceroots.org>
9dnl @version 2004-02-04
10dnl @license AllPermissive
11
12AC_DEFUN([AC_CXX_HAVE_NAMESPACES],
13[AC_CACHE_CHECK(whether the compiler implements namespaces,
14ac_cv_cxx_have_namespaces,
15[AC_LANG_SAVE
16 AC_LANG_CPLUSPLUS
17 AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
18 [using namespace Outer::Inner; return i;],
19 ac_cv_cxx_have_namespaces=yes, ac_cv_cxx_have_namespaces=no)
20 AC_LANG_RESTORE
21])
22if test "$ac_cv_cxx_have_namespaces" = yes; then
23 AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
24fi
25])