]> granicus.if.org Git - postgresql/blob - config/cxx.m4
Throw error if Ant is not found and Java is requested. Remove redundant
[postgresql] / config / cxx.m4
1 # Macros to detect certain C++ features
2 # $Header: /cvsroot/pgsql/config/Attic/cxx.m4,v 1.1 2000/06/11 11:39:46 petere Exp $
3
4
5 # PGAC_CLASS_STRING
6 # -----------------
7 # Look for class `string'. First look for the <string> header. If this
8 # is found a <string> header then it's probably safe to assume that
9 # class string exists.  If not, check to make sure that <string.h>
10 # defines class `string'.
11 AC_DEFUN([PGAC_CLASS_STRING],
12 [AC_LANG_SAVE
13 AC_LANG_CPLUSPLUS
14 AC_CHECK_HEADER(string,
15   [AC_DEFINE(HAVE_CXX_STRING_HEADER)])
16
17 if test x"$ac_cv_header_string" != xyes ; then
18   AC_CACHE_CHECK([for class string in <string.h>],
19     [pgac_cv_class_string_in_string_h],
20     [AC_TRY_COMPILE([#include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 ],
24       [string foo = "test"],
25       [pgac_cv_class_string_in_string_h=yes],
26       [pgac_cv_class_string_in_string_h=no])])
27
28   if test x"$pgac_cv_class_string_in_string_h" != xyes ; then
29     AC_MSG_ERROR([neither <string> nor <string.h> seem to define the C++ class \`string\'])
30   fi
31 fi
32 AC_LANG_RESTORE])# PGAC_CLASS_STRING
33
34
35 # PGAC_CXX_NAMESPACE_STD
36 # ----------------------
37 # Check whether the C++ compiler understands `using namespace std'.
38 #
39 # Note 1: On at least some compilers, it will not work until you've
40 # included a header that mentions namespace std. Thus, include the
41 # usual suspects before trying it.
42 #
43 # Note 2: This test does not actually reveal whether the C++ compiler
44 # properly understands namespaces in all generality. (GNU C++ 2.8.1
45 # is one that doesn't.) However, we don't care.
46 AC_DEFUN([PGAC_CXX_NAMESPACE_STD],
47 [AC_REQUIRE([PGAC_CLASS_STRING])
48 AC_CACHE_CHECK([for namespace std in C++],
49 pgac_cv_cxx_namespace_std,
50 [
51 AC_LANG_SAVE
52 AC_LANG_CPLUSPLUS
53 AC_TRY_COMPILE(
54 [#include <stdio.h>
55 #include <stdlib.h>
56 #ifdef HAVE_CXX_STRING_HEADER
57 #include <string>
58 #endif
59 using namespace std;
60 ], [],
61 [pgac_cv_cxx_namespace_std=yes],
62 [pgac_cv_cxx_namespace_std=no])
63 AC_LANG_RESTORE])
64
65 if test $pgac_cv_cxx_namespace_std = yes ; then
66     AC_DEFINE(HAVE_NAMESPACE_STD, 1, [Define to 1 if the C++ compiler understands `using namespace std'])
67 fi])# PGAC_CXX_NAMESPACE_STD