[cpp-opensaml] 07/19: Use pkg-config for Xerces
Scott Cantor
cantor.2 at osu.edu
Tue Jun 26 19:28:05 EDT 2018
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository cpp-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-opensaml.git;a=commit;h=4aeb658ea3e2e7f8d7098889aa81df49c7836848
commit 4aeb658ea3e2e7f8d7098889aa81df49c7836848
Author: Ferenc Wágner <wferi at niif.hu>
AuthorDate: Mon Jul 11 11:59:10 2016 +0200
Use pkg-config for Xerces
---
configure.ac | 28 ++------------------
m4/ax_restore_flags.m4 | 52 ++++++++++++++++++++++++++++++++++++
m4/ax_save_flags.m4 | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++
saml/Makefile.am | 2 ++
samlsign/Makefile.am | 2 ++
samltest/Makefile.am | 2 ++
6 files changed, 131 insertions(+), 26 deletions(-)
diff --git a/configure.ac b/configure.ac
index 58a2bf1..d8b40f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,32 +91,8 @@ AX_PKG_CHECK_MODULES([log4shib],,[log4shib],
[AX_PKG_CHECK_MODULES([log4cpp],,[log4cpp],
[AC_DEFINE([OPENSAML_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])])])
-# Xerces settings
-AC_ARG_WITH(xerces,
- AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),,
- [with_xerces=/usr])
-if test x_$with_xerces != x_/usr; then
- CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
- LIBS="-L${with_xerces}/lib -lxerces-c $LIBS"
-else
- LIBS="-lxerces-c $LIBS"
-fi
-
-AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
-AC_MSG_CHECKING([Xerces version])
-AC_PREPROC_IFELSE(
- [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
-[#if _XERCES_VERSION >= 30000
-int i = 0;
-#else
-#error cannot use version 1.x or 2.x
-#endif])],
- [AC_MSG_RESULT(OK)],
- [AC_MSG_FAILURE([Xerces-C 3.x is required])])
-
-AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],[[xercesc::XMLPlatformUtils::Initialize()]])],
- ,[AC_MSG_ERROR([unable to link with Xerces])])
+# Xerces-C v2.6.0 has bugs that inhibit use with signed XML
+AX_PKG_CHECK_MODULES([xerces],,[xerces-c != 3.0])
# XML-Security settings
AC_ARG_WITH(xmlsec,
diff --git a/m4/ax_restore_flags.m4 b/m4/ax_restore_flags.m4
new file mode 100644
index 0000000..aafd363
--- /dev/null
+++ b/m4/ax_restore_flags.m4
@@ -0,0 +1,52 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_restore_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_RESTORE_FLAGS([namespace])
+#
+# DESCRIPTION
+#
+# Restore common compilation flags from temporary variables.
+#
+# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
+# OBJCFLAGS.
+#
+# By default these flags are restored to a global (empty) namespace, but
+# user could restore from specific NAMESPACE by using
+# AX_RESTORE_FLAGS(NAMESPACE) macro.
+#
+# Typical usage is like:
+#
+# AX_SAVE_FLAGS(mypackage)
+# CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
+# dnl ... do some detection ...
+# AX_RESTORE_FLAGS(mypackage)
+#
+# LICENSE
+#
+# Copyright (c) 2009 Filippo Giunchedi <filippo at esaurito.net>
+# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
+# Copyright (c) 2011 Russ Allbery <rra at stanford.edu>
+# Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf at gmail.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 6
+
+# save one flag in name space
+AC_DEFUN([_AX_RESTORE_ONE_FLAG],[dnl
+ AS_VAR_PUSHDEF([_ax_restore_flag_var], [$2[]_$1[]_ax_save_flags])
+ AS_VAR_COPY($2[],_ax_restore_flag_var)
+ AS_VAR_POPDEF([_ax_restore_flag_var])
+])
+
+AC_DEFUN([AX_RESTORE_FLAGS], [dnl
+ m4_foreach([FLAG], dnl
+ [_AX_SAVE_FLAGS_LIST()], dnl
+ [_AX_RESTORE_ONE_FLAG([$1],FLAG)])
+])
diff --git a/m4/ax_save_flags.m4 b/m4/ax_save_flags.m4
new file mode 100644
index 0000000..39f45be
--- /dev/null
+++ b/m4/ax_save_flags.m4
@@ -0,0 +1,71 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_save_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_SAVE_FLAGS([NAMESPACE])
+#
+# DESCRIPTION
+#
+# Save common compilation flags into temporary variables.
+#
+# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
+# OBJCFLAGS.
+#
+# By default these flags are saved to a global (empty) namespace, but user
+# could specify a specific NAMESPACE to AX_SAVE_FLAGS macro and latter
+# restore it by using AX_RESTORE_FLAGS(NAMESPACE).
+#
+# AX_SAVE_FLAGS(mypackage)
+# CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
+# dnl .. do some detection ...
+# AX_RESTORE_FLAGS(mypackage)
+#
+# LICENSE
+#
+# Copyright (c) 2009 Filippo Giunchedi <filippo at esaurito.net>
+# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
+# Copyright (c) 2011 Russ Allbery <rra at stanford.edu>
+# Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf at gmail.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 7
+
+# list of flag to save
+AC_DEFUN([_AX_SAVE_FLAGS_LIST],[dnl
+[CCASFLAGS],dnl
+[CFLAGS],dnl
+[CPPFLAGS],dnl
+[CXXFLAGS],dnl
+[ERLCFLAGS],dnl
+[FCFLAGS],dnl
+[FCLIBS],dnl
+[FFLAGS],dnl
+[FLIBS],dnl
+[GCJFLAGS],dnl
+[JAVACFLAGS],dnl
+[LDFLAGS],dnl
+[LIBS],dnl
+[OBJCFLAGS],dnl
+[OBJCXXFLAGS],dnl
+[UPCFLAGS],dnl
+[VALAFLAGS]dnl
+])
+
+# save one flag in name space
+AC_DEFUN([_AX_SAVE_ONE_FLAG],[
+ AS_VAR_PUSHDEF([_ax_save_flag_var], [$2[]_$1[]_ax_save_flags])
+ AS_VAR_COPY(_ax_save_flag_var, $2[])
+ AS_VAR_POPDEF([_ax_save_flag_var])
+])
+
+AC_DEFUN([AX_SAVE_FLAGS],[dnl
+ m4_foreach([FLAG], dnl
+ [_AX_SAVE_FLAGS_LIST()], dnl
+ [_AX_SAVE_ONE_FLAG([$1],FLAG)])
+])
diff --git a/saml/Makefile.am b/saml/Makefile.am
index 768d197..2f60e7e 100644
--- a/saml/Makefile.am
+++ b/saml/Makefile.am
@@ -184,10 +184,12 @@ libsaml_la_CPPFLAGS = \
$(BOOST_CPPFLAGS)
libsaml_la_CXXFLAGS = \
$(PTHREAD_CFLAGS) \
+ $(xerces_CFLAGS) \
$(xmltooling_CFLAGS) \
$(log4shib_CFLAGS) $(log4cpp_CFLAGS)
libsaml_la_LIBADD = \
$(PTHREAD_LIBS) \
+ $(xerces_LIBS) \
$(xmltooling_LIBS) \
$(log4shib_LIBS) $(log4cpp_LIBS)
diff --git a/samlsign/Makefile.am b/samlsign/Makefile.am
index cdc2fb6..53be23e 100644
--- a/samlsign/Makefile.am
+++ b/samlsign/Makefile.am
@@ -6,9 +6,11 @@ samlsign_SOURCES = samlsign.cpp
samlsign_LDADD = $(top_builddir)/saml/libsaml.la
samlsign_CXXFLAGS = \
+ $(xerces_CFLAGS) \
$(xmltooling_CFLAGS) \
$(log4shib_CFLAGS) $(log4cpp_CFLAGS)
samlsign_LDADD += \
+ $(xerces_LIBS) \
$(xmltooling_LIBS) \
$(log4shib_LIBS) $(log4cpp_LIBS)
diff --git a/samltest/Makefile.am b/samltest/Makefile.am
index a6de42c..1f89b64 100644
--- a/samltest/Makefile.am
+++ b/samltest/Makefile.am
@@ -122,8 +122,10 @@ $(nodist_samltest_SOURCES): %.cpp: %.h
$(MAKE) do-cxxtestgen HFILE=$< CPPFILE=$@
samltest_CXXFLAGS = \
+ $(xerces_CFLAGS) \
$(xmltooling_CFLAGS)
samltest_LDADD = $(top_builddir)/saml/libsaml.la \
+ $(xerces_LIBS) \
$(xmltooling_LIBS)
EXTRA_DIST = data
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list