0b7a49e2 |
1 | # |
2e20c3e1 |
2 | # Copyright (c) 1998 Etienne Bernard |
3 | # Copyright (c) 2002 Clinton Ebadi |
4 | # |
5 | |
6 | # Check if we have a decent C++ compiler |
7 | # that supports Standard Template Library (STL) |
55f2215d |
8 | AC_DEFUN([AC_CPP_STL], |
2e20c3e1 |
9 | [ |
10 | AC_MSG_CHECKING([for STL support]) |
11 | |
12 | AC_CACHE_VAL(ac_cv_cpp_stl, |
13 | [ |
14 | AC_LANG_CPLUSPLUS |
15 | cat > conftest.$ac_ext <<EOF |
16 | #include <list> |
17 | int main() { |
18 | std::list<int> l; |
19 | return 0; |
20 | }; |
21 | EOF |
22 | |
23 | |
24 | if AC_TRY_EVAL(ac_link) && test -s conftest; then |
25 | ac_cv_cpp_stl="have_stl=yes" |
26 | else |
27 | ac_cv_cpp_stl="have_stl=no" |
28 | fi |
29 | rm -f conftest* |
30 | ])dnl |
31 | eval "$ac_cv_cpp_stl" |
32 | |
33 | AC_MSG_RESULT([$have_stl]) |
34 | |
35 | if test "$have_stl" != "yes"; then |
36 | AC_MSG_ERROR([Sorry, you need STL support with your compiler]) |
37 | fi |
38 | ]) |
39 | |
40 | |
41 | # Check is compiler has ios_base |
55f2215d |
42 | AC_DEFUN([AC_CPP_STL_IOSBASE], |
2e20c3e1 |
43 | [ |
44 | AC_MSG_CHECKING([for std::ios_base in iostreams]) |
45 | |
46 | AC_CACHE_VAL(ac_cv_cpp_iosbase, |
47 | [ |
48 | AC_LANG_CPLUSPLUS |
49 | cat > conftest.$ac_ext <<EOF |
50 | #include <iostream> |
51 | #include <fstream> |
52 | int main() { |
53 | std::ifstream file ("README", std::ios_base::in); |
54 | return 0; |
55 | }; |
56 | EOF |
57 | |
58 | if AC_TRY_EVAL(ac_link) && test -s conftest; then |
59 | ac_cv_cpp_iosbase="have_iosbase=yes" |
60 | else |
61 | ac_cv_cpp_iosbase="have_iosbase=no" |
62 | fi |
63 | rm -f conftest* |
64 | ])dnl |
65 | eval "$ac_cv_cpp_iosbase" |
66 | |
67 | AC_MSG_RESULT([$have_iosbase]) |
68 | |
69 | if test "$have_iosbase" = "yes"; then |
70 | HAVE_IOSBASE="-DHAVE_IOSBASE" |
0cfbc2d9 |
71 | AC_DEFINE(HAVE_IOSBASE,1, [std::ios_base]) |
2e20c3e1 |
72 | else |
73 | AC_DEFINE(HAVE_IOSBASE,0) |
74 | fi |
75 | ]) |
76 | |
77 | # Check if STL elements support the clear() method |
55f2215d |
78 | AC_DEFUN([AC_CPP_STL_CLEAR], |
2e20c3e1 |
79 | [ |
80 | AC_MSG_CHECKING([for clear() method in STL objects]) |
81 | |
82 | AC_CACHE_VAL(ac_cv_cpp_stl_clear, |
83 | [ |
84 | AC_LANG_CPLUSPLUS |
85 | cat > conftest.$ac_ext <<EOF |
86 | #include <map> |
87 | int main() { |
88 | std::map<int, int, std::less<int> > m; |
89 | m.clear(); |
90 | return 0; |
91 | }; |
92 | EOF |
93 | |
94 | if AC_TRY_EVAL(ac_link) && test -s conftest; then |
95 | ac_cv_cpp_stl_clear="have_stl_clear=yes" |
96 | else |
97 | ac_cv_cpp_stl_clear="have_stl_clear=no" |
98 | fi |
99 | rm -f conftest* |
100 | ])dnl |
101 | eval "$ac_cv_cpp_stl_clear" |
102 | |
103 | AC_MSG_RESULT([$have_stl_clear]) |
104 | |
105 | if test "$have_stl_clear" = "yes"; then |
106 | HAVE_STL_CLEAR="-DHAVE_STL_CLEAR" |
0cfbc2d9 |
107 | AC_DEFINE(HAVE_STL_CLEAR,1, [STL Objects have a clear method]) |
2e20c3e1 |
108 | fi |
109 | ]) |