Skip to content

Commit 58dbe5c

Browse files
author
Kjell Ahlstedt
committed
Add LIBXMLXX_HAVE_EXCEPTION_PTR
* build/.gitignore: New file. * build/cxx_std.m4: New file with LIBXMLXX_CXX_HAS_EXCEPTION_PTR autoconf macro. Defines LIBXMLXX_HAVE_EXCEPTION_PTR if std::exception_ptr exists. * .gitignore: Move some lines to build/.gitignore. * configure.ac: Store some build files in the build directory, like most mm packages. Don't use the macros directory. * libxml++config.h.in: Add LIBXMLXX_HAVE_EXCEPTION_PTR. * Makefile.am: * docs/Makefile.am: macros -> build. Bug #757042. Thanks to Daniel Trebbien <dtrebbien@gmail.com>, who supplied a patch with the test code in LIBXMLXX_HAVE_EXCEPTION_PTR.
1 parent add8c88 commit 58dbe5c

File tree

7 files changed

+74
-24
lines changed

7 files changed

+74
-24
lines changed

.gitignore

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,6 @@ stamp-h?
6565
/examples/*/make_check.sh.trs
6666
/examples/test-suite.log
6767

68-
# macros
69-
/macros/compile
70-
/macros/compile-binding.am
71-
/macros/config.guess
72-
/macros/config.sub
73-
/macros/depcomp
74-
/macros/dist-changelog.am
75-
/macros/doc-reference.am
76-
/macros/generate-binding.am
77-
/macros/install-sh
78-
/macros/libtool.m4
79-
/macros/ltmain.sh
80-
/macros/ltoptions.m4
81-
/macros/ltsugar.m4
82-
/macros/ltversion.m4
83-
/macros/lt~obsolete.m4
84-
/macros/missing
85-
/macros/test-driver
86-
8768
# tests
8869
/tests/*/test
8970
/tests/*/test.log

Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## This file is part of libxml++.
22

3-
ACLOCAL_AMFLAGS = -I macros ${ACLOCAL_FLAGS}
3+
ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS}
44
DISTCHECK_CONFIGURE_FLAGS = --enable-warnings=fatal
55

66
if ENABLE_DOCUMENTATION
@@ -25,4 +25,4 @@ dist_noinst_SCRIPTS = autogen.sh
2525
DISTCLEANFILES = MSVC_Net2010/libxml++/libxml++config.h
2626

2727
# Optional: auto-generate the ChangeLog file from the git log on make dist
28-
include $(top_srcdir)/macros/dist-changelog.am
28+
include $(top_srcdir)/build/dist-changelog.am

build/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/compile
2+
/compile-binding.am
3+
/config.*
4+
/depcomp
5+
/dist-changelog.am
6+
/doc-reference.am
7+
/generate-binding.am
8+
/install-sh
9+
/libtool.m4
10+
/lt*.m4
11+
/ltmain.sh
12+
/missing
13+
/test-driver

build/cxx_std.m4

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
])

configure.ac

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ AC_INIT([libxml++], [2.91.1],
66
AC_PREREQ([2.59])
77

88
AC_CONFIG_SRCDIR([libxml++/libxml++.h])
9-
AC_CONFIG_AUX_DIR([macros])
10-
AC_CONFIG_MACRO_DIR([macros])
9+
AC_CONFIG_AUX_DIR([build])
10+
AC_CONFIG_MACRO_DIR([build])
1111
AC_CONFIG_HEADERS([config.h libxml++config.h])
1212

1313
AM_INIT_AUTOMAKE([1.9 -Wno-portability dist-bzip2 no-define nostdinc subdir-objects])
@@ -39,6 +39,7 @@ PKG_CHECK_MODULES([LIBXMLXX], [$LIBXMLXX_MODULES])
3939

4040
AC_LANG([C++])
4141
AC_CHECK_HEADERS([string list map], [], [AC_MSG_ERROR([required headers not found])])
42+
LIBXMLXX_CXX_HAS_EXCEPTION_PTR
4243

4344
MM_ARG_ENABLE_DOCUMENTATION
4445
MM_ARG_WITH_TAGFILE_DOC([libstdc++.tag], [mm-common-libstdc++])

docs/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ book_name = $(LIBXMLXX_MODULE_NAME)
1919
doc_input = $(addprefix $(top_srcdir)/libxml++/,$(h_sources_public))
2020

2121
# Sets dist_noinst_DATA, DISTCLEANFILES and MAINTAINERCLEANFILES
22-
include $(top_srcdir)/macros/doc-reference.am
22+
include $(top_srcdir)/build/doc-reference.am
2323

2424
manual/libxml++.xml: manual/libxml++_without_code.xml manual/insert_example_code.pl
2525
$(AM_V_GEN)$(PERL) -- manual/insert_example_code.pl ../examples $< >$@

libxml++config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
/* Define to omit deprecated API from the library. */
77
#undef LIBXMLXX_DISABLE_DEPRECATED
88

9+
/* Defined if the C++ library supports std::exception_ptr. */
10+
#undef LIBXMLXX_HAVE_EXCEPTION_PTR
11+
912
/* Major version number of libxml++. */
1013
#undef LIBXMLXX_MAJOR_VERSION
1114

0 commit comments

Comments
 (0)