[libxml++/libxml++-2-40] Add LIBXMLXX_HAVE_EXCEPTION_PTR



commit a77aef9d93efd630f8da7b0c4a337dd0706a7fef
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Mon Oct 26 18:35:30 2015 +0100

    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.

 .gitignore          |   19 ------------------
 Makefile.am         |    4 +-
 build/.gitignore    |   13 ++++++++++++
 build/cxx_std.m4    |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.ac        |    5 ++-
 docs/Makefile.am    |    2 +-
 libxml++config.h.in |    3 ++
 7 files changed, 74 insertions(+), 24 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 2c27b84..c53baa9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,25 +65,6 @@ stamp-h?
 /examples/*/make_check.sh.trs
 /examples/test-suite.log
 
-# macros
-/macros/compile
-/macros/compile-binding.am
-/macros/config.guess
-/macros/config.sub
-/macros/depcomp
-/macros/dist-changelog.am
-/macros/doc-reference.am
-/macros/generate-binding.am
-/macros/install-sh
-/macros/libtool.m4
-/macros/ltmain.sh
-/macros/ltoptions.m4
-/macros/ltsugar.m4
-/macros/ltversion.m4
-/macros/lt~obsolete.m4
-/macros/missing
-/macros/test-driver
-
 # tests
 /tests/*/test
 /tests/*/test.log
diff --git a/Makefile.am b/Makefile.am
index 2779bb7..9f02ec4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ## This file is part of libxml++.
 
-ACLOCAL_AMFLAGS = -I macros ${ACLOCAL_FLAGS}
+ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS}
 DISTCHECK_CONFIGURE_FLAGS = --enable-warnings=fatal
 
 if ENABLE_DOCUMENTATION
@@ -25,4 +25,4 @@ dist_noinst_SCRIPTS = autogen.sh
 DISTCLEANFILES = MSVC_Net2010/libxml++/libxml++config.h
 
 # Optional: auto-generate the ChangeLog file from the git log on make dist
-include $(top_srcdir)/macros/dist-changelog.am
+include $(top_srcdir)/build/dist-changelog.am
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..189b364
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1,13 @@
+/compile
+/compile-binding.am
+/config.*
+/depcomp
+/dist-changelog.am
+/doc-reference.am
+/generate-binding.am
+/install-sh
+/libtool.m4
+/lt*.m4
+/ltmain.sh
+/missing
+/test-driver
diff --git a/build/cxx_std.m4 b/build/cxx_std.m4
new file mode 100644
index 0000000..7977f9b
--- /dev/null
+++ b/build/cxx_std.m4
@@ -0,0 +1,52 @@
+## Copyright (C) 2015 The libxml++ development team
+##
+## This file is part of libxml++.
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+## LIBXMLXX_CXX_HAS_EXCEPTION_PTR()
+##
+## Test whether std::exception_ptr, std::current_exception() and
+## std::rethrow_exception() are defined.
+##
+## On success, #define LIBXMLXX_HAVE_EXCEPTION_PTR to 1.
+##
+AC_DEFUN([LIBXMLXX_CXX_HAS_EXCEPTION_PTR],
+[
+  AC_CACHE_CHECK(
+    [whether C++ library supports std::exception_ptr],
+    [libxmlxx_cv_cxx_has_exception_ptr],
+  [
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+    [[
+      #include <exception>
+    ]],[[
+      try
+      {
+        throw "custom error";
+      }
+      catch(...)
+      {
+        std::exception_ptr ep = std::current_exception();
+        std::rethrow_exception(ep);
+      }
+    ]])],
+      [libxmlxx_cv_cxx_has_exception_ptr='yes'],
+      [libxmlxx_cv_cxx_has_exception_ptr='no']
+    )
+  ])
+
+  AS_IF([test "x${libxmlxx_cv_cxx_has_exception_ptr}" = 'xyes'],
+  [AC_DEFINE([LIBXMLXX_HAVE_EXCEPTION_PTR], [1], [Defined if the C++ library supports std::exception_ptr.])])
+])
diff --git a/configure.ac b/configure.ac
index a91cad0..6e657ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,8 +4,8 @@ AC_INIT([libxml++], [2.40.0],
 AC_PREREQ([2.59])
 
 AC_CONFIG_SRCDIR([libxml++/libxml++.h])
-AC_CONFIG_AUX_DIR([macros])
-AC_CONFIG_MACRO_DIR([macros])
+AC_CONFIG_AUX_DIR([build])
+AC_CONFIG_MACRO_DIR([build])
 AC_CONFIG_HEADERS([config.h libxml++config.h])
 
 AM_INIT_AUTOMAKE([1.9 -Wno-portability dist-bzip2 no-define nostdinc subdir-objects])
@@ -35,6 +35,7 @@ PKG_CHECK_MODULES([LIBXMLXX], [$LIBXMLXX_MODULES])
 
 AC_LANG([C++])
 AC_CHECK_HEADERS([string list map], [], [AC_MSG_ERROR([required headers not found])])
+LIBXMLXX_CXX_HAS_EXCEPTION_PTR
 
 MM_ARG_ENABLE_DOCUMENTATION
 MM_ARG_WITH_TAGFILE_DOC([libstdc++.tag], [mm-common-libstdc++])
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 9458f00..edd69f4 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -19,7 +19,7 @@ book_name = $(LIBXMLXX_MODULE_NAME)
 doc_input = $(addprefix $(top_srcdir)/libxml++/,$(h_sources_public))
 
 # Sets dist_noinst_DATA, DISTCLEANFILES and MAINTAINERCLEANFILES
-include $(top_srcdir)/macros/doc-reference.am
+include $(top_srcdir)/build/doc-reference.am
 
 manual/libxml++.xml: manual/libxml++_without_code.xml manual/insert_example_code.pl
        $(AM_V_GEN)$(PERL) -- manual/insert_example_code.pl ../examples $< >$@
diff --git a/libxml++config.h.in b/libxml++config.h.in
index fa36073..ecb27b6 100755
--- a/libxml++config.h.in
+++ b/libxml++config.h.in
@@ -6,6 +6,9 @@
 /* Define to omit deprecated API from the library. */
 #undef LIBXMLXX_DISABLE_DEPRECATED
 
+/* Defined if the C++ library supports std::exception_ptr. */
+#undef LIBXMLXX_HAVE_EXCEPTION_PTR
+
 /* This is always set. This is only for backwards compatibility. */
 #undef LIBXMLCPP_EXCEPTIONS_ENABLED
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]