File: ac_cxx_namespaces.m4

package info (click to toggle)
gsmartcontrol 1.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 5,000 kB
  • sloc: cpp: 185,389; sh: 4,261; makefile: 397
file content (47 lines) | stat: -rw-r--r-- 1,336 bytes parent folder | download | duplicates (6)
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
# ===========================================================================
#           http://autoconf-archive.cryp.to/ac_cxx_namespaces.html
# ===========================================================================
#
# SYNOPSIS
#
#   AC_CXX_NAMESPACES
#
# DESCRIPTION
#
#   If the compiler can prevent names clashes using namespaces, define
#   HAVE_NAMESPACES.
#
# LAST MODIFICATION
#
#   2008-04-12
#
# COPYLEFT
#
#   Copyright (c) 2008 Todd Veldhuizen
#   Copyright (c) 2008 Luc Maisonobe <luc@spaceroots.org>
#
#   Copying and distribution of this file, with or without modification, are
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved.

AC_DEFUN([AC_CXX_NAMESPACES],
[AC_CACHE_CHECK(whether the compiler implements namespaces,
	ac_cv_cxx_namespaces,
	[AC_LANG_PUSH([C++])
		AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
			[[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_POP([])
	])
	if test "$ac_cv_cxx_namespaces" = yes; then
		AC_DEFINE(HAVE_NAMESPACES, 1,
			[defined to 1 if the compiler implements namespaces, 0 otherwise])
	else
		AC_DEFINE(HAVE_NAMESPACES, 0,
			[defined to 1 if the compiler implements namespaces, 0 otherwise])
	fi
])