Imported Upstream version 2.91.2
[platform/upstream/libxml++.git] / build / cxx_std.m4
1 ## Copyright (C) 2015 The libxml++ development team
2 ##
3 ## This file is part of libxml++.
4 ##
5 ## This library is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU Lesser General Public
7 ## License as published by the Free Software Foundation; either
8 ## version 2.1 of the License, or (at your option) any later version.
9 ##
10 ## This library is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 ## Lesser General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU Lesser General Public
16 ## License along with this library. If not, see <http://www.gnu.org/licenses/>.
17
18 ## LIBXMLXX_CXX_HAS_EXCEPTION_PTR()
19 ##
20 ## Test whether std::exception_ptr, std::current_exception() and
21 ## std::rethrow_exception() are defined.
22 ##
23 ## On success, #define LIBXMLXX_HAVE_EXCEPTION_PTR to 1.
24 ##
25 AC_DEFUN([LIBXMLXX_CXX_HAS_EXCEPTION_PTR],
26 [
27   AC_CACHE_CHECK(
28     [whether C++ library supports std::exception_ptr],
29     [libxmlxx_cv_cxx_has_exception_ptr],
30   [
31     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
32     [[
33       #include <exception>
34     ]],[[
35       try
36       {
37         throw "custom error";
38       }
39       catch(...)
40       {
41         std::exception_ptr ep = std::current_exception();
42         std::rethrow_exception(ep);
43       }
44     ]])],
45       [libxmlxx_cv_cxx_has_exception_ptr='yes'],
46       [libxmlxx_cv_cxx_has_exception_ptr='no']
47     )
48   ])
49
50   AS_IF([test "x${libxmlxx_cv_cxx_has_exception_ptr}" = 'xyes'],
51   [AC_DEFINE([LIBXMLXX_HAVE_EXCEPTION_PTR], [1], [Defined if the C++ library supports std::exception_ptr.])])
52 ])