[cpp-xmltooling] 06/22: Discover log4shib/log4cpp, xerces, xmlsec, openssl, curl and zlib via pkg-config

Scott Cantor cantor.2 at osu.edu
Thu Jun 21 14:57:22 EDT 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository cpp-xmltooling.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=4a624bb9581c41002310433d121d41d9898c8145

commit 4a624bb9581c41002310433d121d41d9898c8145
Author: Ferenc Wágner <wferi at niif.hu>
AuthorDate: Mon Jun 20 11:11:46 2016 +0200

    Discover log4shib/log4cpp, xerces, xmlsec, openssl, curl and zlib via pkg-config
    
    Also: - separate use of independent flags
          - propagate requirements into our pkg-config files
---
 Makefile.am                    |   8 +-
 configure.ac                   | 263 +++++-------------------------
 m4/ax_create_pkgconfig_info.m4 | 351 -----------------------------------------
 m4/ax_pkg_check_modules.m4     |  69 ++++++++
 m4/ax_restore_flags.m4         |  52 ++++++
 m4/ax_save_flags.m4            |  71 +++++++++
 xmltooling-lite.pc.in          |  13 ++
 xmltooling.pc.in               |  13 ++
 xmltooling/Makefile.am         |   9 +-
 xmltoolingtest/Makefile.am     |   3 +-
 10 files changed, 266 insertions(+), 586 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 5edea2e..24d5289 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,12 +5,6 @@ include doxygen.am
 
 MOSTLYCLEANFILES = $(DX_CLEANFILES)
 
-DISTCLEANFILES = \
-	@PACKAGE_NAME at .pc \
-	@PACKAGE_NAME at .pc.in \
-	@PACKAGE_NAME at -uninstalled.pc \
-	@PACKAGE_NAME at -uninstalled.sh
-
 SUBDIRS = doc schemas @PACKAGE_NAME@ xmltoolingtest
 
 if DX_COND_doc
@@ -20,7 +14,7 @@ all-local:
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = @PACKAGE_NAME at .pc
+pkgconfig_DATA = @PACKAGE_NAME at .pc @PACKAGE_NAME at -lite.pc
 
 GENFILES = @PACKAGE_NAME at .spec
 
diff --git a/configure.ac b/configure.ac
index 037bc72..5931c77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ else
 fi
 
 AC_CONFIG_HEADERS([config.h xmltooling/config_pub.h])
-AC_CONFIG_FILES([xmltooling.spec])
+AC_CONFIG_FILES([xmltooling.spec xmltooling.pc xmltooling-lite.pc])
 AC_CONFIG_FILES([Makefile xmltooling/Makefile xmltoolingtest/Makefile schemas/Makefile doc/Makefile])
 
 AC_PROG_CC([gcc gcc3 cc])
@@ -71,7 +71,11 @@ AC_HEADER_DIRENT
 # Checks for library functions.
 AC_CHECK_FUNCS([strchr strdup strstr timegm gmtime_r strcasecmp])
 AC_CHECK_HEADERS([dlfcn.h])
+AX_SAVE_FLAGS
+LIBS=""
 AC_SEARCH_LIBS([dlopen],[dl],,[AC_MSG_ERROR([cannot find dlopen() function])])
+AC_SUBST([dlopen_LIBS],[$LIBS])
+AX_RESTORE_FLAGS
 
 # checks for pthreads
 AX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
@@ -79,13 +83,14 @@ if test $enable_threads != "pthread"; then
     AC_MSG_ERROR([unable to find pthreads, currently this is required])
 else
     AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])
-	AM_CONDITIONAL(BUILD_PTHREAD,test "$enable_threads" = "pthread")
+    AX_SAVE_FLAGS
     LIBS="$PTHREAD_LIBS $LIBS"
     CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
-    CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
+    AC_CHECK_FUNCS([pthread_rwlock_init])
+    AX_RESTORE_FLAGS
 fi
 
-AC_CHECK_FUNCS([pthread_rwlock_init])
+AM_CONDITIONAL(BUILD_PTHREAD,test "$enable_threads" = "pthread")
 
 AC_LANG([C++])
 
@@ -102,7 +107,6 @@ BOOST_POINTER_CONTAINER
 BOOST_SMART_PTR
 BOOST_STRING_ALGO
 BOOST_TOKENIZER
-CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
 
 # are covariant methods allowed?
 AC_LINK_IFELSE(
@@ -118,232 +122,41 @@ AC_COMPILE_IFELSE(
     [AC_LANG_PROGRAM([[#include <cstddef>]],[[const char* ptr = nullptr;]])],
     [AC_DEFINE([HAVE_NULLPTR],[1],[Define to 1 if C++ compiler supports nullptr keyword.])])
 
-# log4shib settings (favor this version over the log4cpp code)
-AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
-AC_ARG_WITH(log4shib,
-    AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]),
-    [
-    LOG4SHIB_CONFIG="${with_log4shib}"
-    if ! test -f "${LOG4SHIB_CONFIG}" ; then
-    	LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
-    fi
-    ])
-if test -f "${LOG4SHIB_CONFIG}" ; then
-    LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
-    CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
-    AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
-    AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
-#include <log4shib/CategoryStream.hh>]],
-            [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
-        [AC_DEFINE([XMLTOOLING_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
-        [AC_MSG_ERROR([unable to link with log4shib])])
-else
-    AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
-    AC_MSG_WARN([will look for original log4cpp library])
-    
-    # log4cpp settings
-    AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
-    AC_ARG_WITH(log4cpp,
-        AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]),
-        [
-        LOG4CPP_CONFIG="${with_log4cpp}"
-        if ! test -f "${LOG4CPP_CONFIG}" ; then
-        	LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
-        fi
-        ])
-    if test -f "${LOG4CPP_CONFIG}"; then
-        AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
-        LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
-        CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
-        AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
-        AC_LINK_IFELSE(
-            [AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
-#include <log4cpp/CategoryStream.hh>]],
-                [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
-            [AC_DEFINE([XMLTOOLING_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
-            [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
-	else
-	    AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
-	fi
-fi
-
-# 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])])
+AX_PKG_CHECK_MODULES([log4shib],,[log4shib],
+    [AC_DEFINE([XMLTOOLING_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
+    [AX_PKG_CHECK_MODULES([log4cpp],,[log4cpp >= 1],
+        [AC_DEFINE([XMLTOOLING_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])
+	 AC_MSG_WARN([using log4cpp, note that most non-Internet2 supplied versions are not thread-safe])],,
+        [XMLTOOLING_LITE_REQUIRES],[XMLTOOLING_LITE_REQUIRES_PRIVATE])],,
+    [XMLTOOLING_LITE_REQUIRES],[XMLTOOLING_LITE_REQUIRES_PRIVATE])
 
-AC_LINK_IFELSE(
-    [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],
-        [[xercesc::XMLPlatformUtils::Initialize()]])],
-    ,[AC_MSG_ERROR([unable to link with Xerces])])
+AX_PKG_CHECK_MODULES([xerces],,[xerces-c >= 3],,,
+    [XMLTOOLING_LITE_REQUIRES],[XMLTOOLING_LITE_REQUIRES_PRIVATE])
 
-# XML-Security settings
 AC_ARG_WITH(xmlsec,
-    AS_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
-    [with_xmlsec=/usr])
-
-if test x_$with_xmlsec != x_no; then
-
-    # OpenSSL settings (need to do this first in case it's in a different spot from xmlsec)
-    AC_ARG_WITH(openssl,
-        AS_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
-        [if test x_$with_openssl != x_/usr; then
-            SSLFLAGS="-I${with_openssl}/include"
-            SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
-        else
-            SSLLIBS="-lcrypto -lssl"
-        fi])
-    
-    if test "x$SSLLIBS" = "x" ; then
-        AC_PATH_PROG(PKG_CONFIG, pkg-config)
-        if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
-            if pkg-config openssl ; then
-                SSLLIBS="`$PKG_CONFIG --libs openssl`"
-                SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
-            else
-                AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
-            fi
-        fi
-    fi
-    
-    if test "x$SSLLIBS" = "x" ; then
-        SSLLIBS="-lcrypto -lssl"
-    fi
-    
-    AC_MSG_CHECKING(for OpenSSL cflags)
-    AC_MSG_RESULT($SSLFLAGS)
-    CPPFLAGS="$CPPFLAGS $SSLFLAGS"
-    AC_MSG_CHECKING(for OpenSSL libraries)
-    AC_MSG_RESULT($SSLLIBS)
-    XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS"
-
-    # save and append master libs
-    save_LIBS="$LIBS"
-    LIBS="$XMLSEC_LIBS $LIBS"
-    
-    AC_CHECK_HEADER([openssl/pem.h],,AC_MSG_ERROR([unable to find openssl header files]))
-    AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
-    AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,AC_MSG_ERROR([unable to link with openssl libraries]))
-    AC_MSG_RESULT(yes)
-
-    # restore master libs
-    LIBS="$save_LIBS"
-
-    if test x_$with_xmlsec != x_/usr; then
-        CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
-        XMLSEC_LIBS="-L${with_xmlsec}/lib -lxml-security-c $XMLSEC_LIBS"
-    else
-        XMLSEC_LIBS="-lxml-security-c $XMLSEC_LIBS"
-    fi
-    
-    # save and append master libs
-    save_LIBS="$LIBS"
-    LIBS="$XMLSEC_LIBS $LIBS"
-    
-    AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
-    AC_MSG_CHECKING([XML-Security version])
-    AC_PREPROC_IFELSE(
-	    [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
-        [#if XSEC_VERSION_MAJOR >= 2
-int i = 0;
-#else
-#error need version 2.0.0 or later
-#endif])],
-        [AC_MSG_RESULT(OK)],
-        [AC_MSG_FAILURE([XML-Security version 2.0.0 or greater is required.])])
-        
-    AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
-            [[XSECPlatformUtils::Initialise()]])],,
-        [AC_MSG_ERROR([unable to link with XML-Security])])
-
-    # restore master libs
-    LIBS="$save_LIBS"
-
-    # libcurl settings
-    AC_PATH_PROG(CURL_CONFIG,curl-config)
-    AC_ARG_WITH(curl,
-        AS_HELP_STRING([--with-curl=PATH], [where curl-config is installed]),
-        [
-        CURL_CONFIG="${with_curl}"
-        if ! test -f "${CURL_CONFIG}" ; then
-            CURL_CONFIG="${with_curl}/bin/curl-config"
-        fi
-        ])
-    if test -f "${CURL_CONFIG}" ; then
-        CPPFLAGS="`${CURL_CONFIG} --cflags` $CPPFLAGS"
-        XMLSEC_LIBS="`${CURL_CONFIG} --libs` $XMLSEC_LIBS"
-    else
-        AC_MSG_ERROR([curl-config not found, may need to use --with-curl option])
-    fi
-
-    # save and append master libs
-    save_LIBS="$LIBS"
-    LIBS="$XMLSEC_LIBS $LIBS"
-	
-    AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([unable to find libcurl header files]))
-    AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([[#include <curl/curl.h>]],
-            [[curl_global_init(CURL_GLOBAL_ALL)]])],,
-        [AC_MSG_ERROR([unable to link with libcurl])])
+    AS_HELP_STRING([--with-xmlsec],
+        [include signature/encryption support via Apache Santuario (XML Security) @<:@default=check@:>@]),,
+    [with_xmlsec=check])
+
+AS_IF([test "x$with_xmlsec" != xno],
+    [AX_PKG_CHECK_MODULES([XMLSEC],,[xml-security-c >= 2 libcurl openssl zlib],
+        [AX_SAVE_FLAGS
+         CXXFLAGS="$XMLSEC_CFLAGS $CXXFLAGS"
+         LIBS="$XMLSEC_LIBS $LIBS"
          AC_CHECK_DECLS([CURLOPT_ACCEPT_ENCODING,CURLINFO_TLS_SSL_PTR],,,[[#include <curl/curl.h>]])
          AC_CHECK_DECL([CURLOPT_SSL_CTX_FUNCTION],,[AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])],[[#include <curl/curl.h>]])
          AC_CHECK_TYPE([curl_off_t],[AC_DEFINE([HAVE_CURL_OFF_T],[1],[Define to 1 if you have the 'curl_off_t' type.])],,[[#include <curl/curl.h>]])
+         AX_RESTORE_FLAGS
+        ],
+        [AS_IF([test "x$with_xmlsec" = xcheck],
+             [AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
+              AC_DEFINE([XMLTOOLING_NO_XMLSEC],[1],
+                  [Define to 1 if you wish to disable XML-Security-dependent features.])],
+             [AC_MSG_FAILURE([--with-xmlsec was given, but the package was not found])])
+        ],[XMLTOOLING_REQUIRES],[XMLTOOLING_REQUIRES_PRIVATE])
+    ])
 
-    # restore master libs
-    LIBS="$save_LIBS"
-    
-    # zlib settings
-    AC_ARG_WITH(zlib,
-        AS_HELP_STRING([--with-zlib=PATH],[where zlib is installed]),
-        [
-            if test -d "$withval" ; then
-                CPPFLAGS="${CPPFLAGS} -I$withval/include"
-                XMLSEC_LIBS="$XMLSEC_LIBS -L$withval/lib"
-            fi
-        ]
-    )
-    XMLSEC_LIBS="$XMLSEC_LIBS -lz"
-
-    # save and append master libs
-    save_LIBS="$LIBS"
-    LIBS="$XMLSEC_LIBS $LIBS"
-    
-    AC_CHECK_HEADER([zlib.h],,AC_MSG_ERROR([unable to find zlib header files]))
-    AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([[#include <zlib.h>]],
-            [[zlibVersion()]])],,
-        [AC_MSG_ERROR([unable to link with zlib])])
-
-    # restore master libs
-    LIBS="$save_LIBS"
-    
-    AC_SUBST(XMLSEC_LIBS)
-else
-    AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
-    AC_DEFINE([XMLTOOLING_NO_XMLSEC],[1],[Define to 1 if you wish to disable XML-Security-dependent features.])
-fi
-AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
+AM_CONDITIONAL(BUILD_XMLSEC,test "x$XMLSEC_LIBS" != x)
 
 # Does the STL in use help or screw us?
 AC_LINK_IFELSE(
@@ -358,7 +171,5 @@ AC_ARG_VAR([CXXTEST], [override the cxxtestgen executable and options])
 AC_CHECK_PROGS([CXXTEST], [cxxtestgen cxxtestgen.pl], [false])
 AM_CONDITIONAL([BUILD_UNITTEST], [test "x${CXXTEST}" != xfalse])
 
-AX_CREATE_PKGCONFIG_INFO(,,[$XMLSEC_LIBS -lxmltooling],[OpenSAML XMLTooling-C library])
-
 # output packaging and makefiles
 AC_OUTPUT
diff --git a/m4/ax_create_pkgconfig_info.m4 b/m4/ax_create_pkgconfig_info.m4
deleted file mode 100644
index 35f0213..0000000
--- a/m4/ax_create_pkgconfig_info.m4
+++ /dev/null
@@ -1,351 +0,0 @@
-# =============================================================================
-#  https://www.gnu.org/software/autoconf-archive/ax_create_pkgconfig_info.html
-# =============================================================================
-#
-# SYNOPSIS
-#
-#   AX_CREATE_PKGCONFIG_INFO [(outputfile, [requires [,libs [,summary [,cflags [, ldflags]]]]])]
-#
-# DESCRIPTION
-#
-#   Defaults:
-#
-#     $1 = $PACKAGE_NAME.pc
-#     $2 = (empty)
-#     $3 = $PACKAGE_LIBS $LIBS (as set at that point in configure.ac)
-#     $4 = $PACKAGE_SUMMARY (or $1 Library)
-#     $5 = $PACKAGE_CFLAGS (as set at the point in configure.ac)
-#     $6 = $PACKAGE_LDFLAGS (as set at the point in configure.ac)
-#
-#     PACKAGE_NAME defaults to $PACKAGE if not set.
-#     PACKAGE_LIBS defaults to -l$PACKAGE_NAME if not set.
-#
-#   The resulting file is called $PACKAGE.pc.in / $PACKAGE.pc
-#
-#   You will find this macro most useful in conjunction with
-#   ax_spec_defaults that can read good initializers from the .spec file. In
-#   consequence, most of the generatable installable stuff can be made from
-#   information being updated in a single place for the whole project.
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Guido U. Draheim <guidod at gmx.de>
-#   Copyright (c) 2008 Sven Verdoolaege <skimo at kotnet.org>
-#
-#   This program is free software; you can redistribute it and/or modify it
-#   under the terms of the GNU General Public License as published by the
-#   Free Software Foundation; either version 3 of the License, or (at your
-#   option) any later version.
-#
-#   This program 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 General
-#   Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <https://www.gnu.org/licenses/>.
-#
-#   As a special exception, the respective Autoconf Macro's copyright owner
-#   gives unlimited permission to copy, distribute and modify the configure
-#   scripts that are the output of Autoconf when processing the Macro. You
-#   need not follow the terms of the GNU General Public License when using
-#   or distributing such scripts, even though portions of the text of the
-#   Macro appear in them. The GNU General Public License (GPL) does govern
-#   all other use of the material that constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the Autoconf
-#   Macro released by the Autoconf Archive. When you make and distribute a
-#   modified version of the Autoconf Macro, you may extend this special
-#   exception to the GPL to apply to your modified version as well.
-
-#serial 16
-
-AC_DEFUN([AX_CREATE_PKGCONFIG_INFO],[dnl
-AS_VAR_PUSHDEF([PKGCONFIG_suffix],[ax_create_pkgconfig_suffix])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_libdir],[ax_create_pkgconfig_libdir])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_libfile],[ax_create_pkgconfig_libfile])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_libname],[ax_create_pkgconfig_libname])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_version],[ax_create_pkgconfig_version])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_description],[ax_create_pkgconfig_description])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_requires],[ax_create_pkgconfig_requires])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_pkglibs],[ax_create_pkgconfig_pkglibs])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_libs],[ax_create_pkgconfig_libs])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_ldflags],[ax_create_pkgconfig_ldflags])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_cppflags],[ax_create_pkgconfig_cppflags])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_generate],[ax_create_pkgconfig_generate])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_src_libdir],[ax_create_pkgconfig_src_libdir])dnl
-AS_VAR_PUSHDEF([PKGCONFIG_src_headers],[ax_create_pkgconfig_src_headers])dnl
-
-# we need the expanded forms...
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-AC_MSG_CHECKING(our pkgconfig libname)
-test ".$PKGCONFIG_libname" != "." || \
-PKGCONFIG_libname="ifelse($1,,${PACKAGE_NAME},`basename $1 .pc`)"
-test ".$PKGCONFIG_libname" != "." || \
-PKGCONFIG_libname="$PACKAGE"
-PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"`
-PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"`
-AC_MSG_RESULT($PKGCONFIG_libname)
-
-AC_MSG_CHECKING(our pkgconfig version)
-test ".$PKGCONFIG_version" != "." || \
-PKGCONFIG_version="${PACKAGE_VERSION}"
-test ".$PKGCONFIG_version" != "." || \
-PKGCONFIG_version="$VERSION"
-PKGCONFIG_version=`eval echo "$PKGCONFIG_version"`
-PKGCONFIG_version=`eval echo "$PKGCONFIG_version"`
-AC_MSG_RESULT($PKGCONFIG_version)
-
-AC_MSG_CHECKING(our pkgconfig_libdir)
-test ".$pkgconfig_libdir" = "." && \
-pkgconfig_libdir='${libdir}/pkgconfig'
-PKGCONFIG_libdir=`eval echo "$pkgconfig_libdir"`
-PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"`
-PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"`
-AC_MSG_RESULT($pkgconfig_libdir)
-test "$pkgconfig_libdir" != "$PKGCONFIG_libdir" && (
-AC_MSG_RESULT(expanded our pkgconfig_libdir... $PKGCONFIG_libdir))
-AC_SUBST([pkgconfig_libdir])
-
-AC_MSG_CHECKING(our pkgconfig_libfile)
-test ".$pkgconfig_libfile" != "." || \
-pkgconfig_libfile="ifelse($1,,$PKGCONFIG_libname.pc,`basename $1`)"
-PKGCONFIG_libfile=`eval echo "$pkgconfig_libfile"`
-PKGCONFIG_libfile=`eval echo "$PKGCONFIG_libfile"`
-AC_MSG_RESULT($pkgconfig_libfile)
-test "$pkgconfig_libfile" != "$PKGCONFIG_libfile" && (
-AC_MSG_RESULT(expanded our pkgconfig_libfile... $PKGCONFIG_libfile))
-AC_SUBST([pkgconfig_libfile])
-
-AC_MSG_CHECKING(our package / suffix)
-PKGCONFIG_suffix="$program_suffix"
-test ".$PKGCONFIG_suffix" != .NONE || PKGCONFIG_suffix=""
-AC_MSG_RESULT(${PACKAGE_NAME} / ${PKGCONFIG_suffix})
-
-AC_MSG_CHECKING(our pkgconfig description)
-PKGCONFIG_description="ifelse($4,,$PACKAGE_SUMMARY,$4)"
-test ".$PKGCONFIG_description" != "." || \
-PKGCONFIG_description="$PKGCONFIG_libname Library"
-PKGCONFIG_description=`eval echo "$PKGCONFIG_description"`
-PKGCONFIG_description=`eval echo "$PKGCONFIG_description"`
-AC_MSG_RESULT($PKGCONFIG_description)
-
-AC_MSG_CHECKING(our pkgconfig requires)
-PKGCONFIG_requires="ifelse($2,,$PACKAGE_REQUIRES,$2)"
-PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"`
-PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"`
-AC_MSG_RESULT($PKGCONFIG_requires)
-
-AC_MSG_CHECKING(our pkgconfig ext libs)
-PKGCONFIG_pkglibs="$PACKAGE_LIBS"
-test ".$PKGCONFIG_pkglibs" != "." || PKGCONFIG_pkglibs="-l$PKGCONFIG_libname"
-PKGCONFIG_libs="ifelse($3,,$PKGCONFIG_pkglibs $LIBS,$3)"
-PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"`
-PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"`
-AC_MSG_RESULT($PKGCONFIG_libs)
-
-AC_MSG_CHECKING(our pkgconfig cppflags)
-PKGCONFIG_cppflags="ifelse($5,,$PACKAGE_CFLAGS,$5)"
-PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"`
-PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"`
-AC_MSG_RESULT($PKGCONFIG_cppflags)
-
-AC_MSG_CHECKING(our pkgconfig ldflags)
-PKGCONFIG_ldflags="ifelse($6,,$PACKAGE_LDFLAGS,$6)"
-PKGCONFIG_ldflags=`eval echo "$PKGCONFIG_ldflags"`
-PKGCONFIG_ldflags=`eval echo "$PKGCONFIG_ldflags"`
-AC_MSG_RESULT($PKGCONFIG_ldflags)
-
-test ".$PKGCONFIG_generate" != "." || \
-PKGCONFIG_generate="ifelse($1,,$PKGCONFIG_libname.pc,$1)"
-PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"`
-PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"`
-test "$pkgconfig_libfile" != "$PKGCONFIG_generate" && (
-AC_MSG_RESULT(generate the pkgconfig later... $PKGCONFIG_generate))
-
-if test ".$PKGCONFIG_src_libdir" = "." ; then
-PKGCONFIG_src_libdir=`pwd`
-PKGCONFIG_src_libdir=`AS_DIRNAME("$PKGCONFIG_src_libdir/$PKGCONFIG_generate")`
-test ! -d $PKGCONFIG_src_libdir/src || \
-PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/src"
-case ".$objdir" in
-*libs) PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/$objdir" ;; esac
-AC_MSG_RESULT(noninstalled pkgconfig -L $PKGCONFIG_src_libdir)
-fi
-
-if test ".$PKGCONFIG_src_headers" = "." ; then
-PKGCONFIG_src_headers=`pwd`
-v="$ac_top_srcdir" ;
-test ".$v" != "." || v="$ax_spec_dir"
-test ".$v" != "." || v="$srcdir"
-case "$v" in /*) PKGCONFIG_src_headers="" ;; esac
-PKGCONFIG_src_headers=`AS_DIRNAME("$PKGCONFIG_src_headers/$v/x")`
-test ! -d $PKGCONFIG_src_headers/incl[]ude || \
-PKGCONFIG_src_headers="$PKGCONFIG_src_headers/incl[]ude"
-AC_MSG_RESULT(noninstalled pkgconfig -I $PKGCONFIG_src_headers)
-fi
-
-
-dnl AC_CONFIG_COMMANDS crap disallows to use $PKGCONFIG_libfile here...
-AC_CONFIG_COMMANDS([$ax_create_pkgconfig_generate],[
-pkgconfig_generate="$ax_create_pkgconfig_generate"
-if test ! -f "$pkgconfig_generate.in"
-then generate="true"
-elif grep ' generated by configure ' $pkgconfig_generate.in >/dev/null
-then generate="true"
-else generate="false";
-fi
-if $generate ; then
-AC_MSG_NOTICE(creating $pkgconfig_generate.in)
-cat > $pkgconfig_generate.in <<AXEOF
-# generated by configure / remove this line to disable regeneration
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
-datarootdir=@datarootdir@
-datadir=@datadir@
-sysconfdir=@sysconfdir@
-includedir=@includedir@
-package=@PACKAGE@
-suffix=@suffix@
-
-Name: @PACKAGE_NAME@
-Description: @PACKAGE_DESCRIPTION@
-Version: @PACKAGE_VERSION@
-Requires: @PACKAGE_REQUIRES@
-Libs: -L\${libdir} @LDFLAGS@ @LIBS@
-Cflags: -I\${includedir} @CPPFLAGS@
-AXEOF
-fi # DONE generate $pkgconfig_generate.in
-AC_MSG_NOTICE(creating $pkgconfig_generate)
-cat >conftest.sed <<AXEOF
-s|@prefix@|${pkgconfig_prefix}|
-s|@exec_prefix@|${pkgconfig_execprefix}|
-s|@bindir@|${pkgconfig_bindir}|
-s|@libdir@|${pkgconfig_libdir}|
-s|@datarootdir@|${pkgconfig_datarootdir}|
-s|@datadir@|${pkgconfig_datadir}|
-s|@sysconfdir@|${pkgconfig_sysconfdir}|
-s|@includedir@|${pkgconfig_includedir}|
-s|@suffix@|${pkgconfig_suffix}|
-s|@PACKAGE@|${pkgconfig_package}|
-s|@PACKAGE_NAME@|${pkgconfig_libname}|
-s|@PACKAGE_DESCRIPTION@|${pkgconfig_description}|
-s|@PACKAGE_VERSION@|${pkgconfig_version}|
-s|@PACKAGE_REQUIRES@|${pkgconfig_requires}|
-s|@LIBS@|${pkgconfig_libs}|
-s|@LDFLAGS@|${pkgconfig_ldflags}|
-s|@CPPFLAGS@|${pkgconfig_cppflags}|
-AXEOF
-sed -f conftest.sed  $pkgconfig_generate.in > $pkgconfig_generate
-if test ! -s $pkgconfig_generate ; then
-    AC_MSG_ERROR([$pkgconfig_generate is empty])
-fi ; rm conftest.sed # DONE generate $pkgconfig_generate
-pkgconfig_uninstalled=`echo $pkgconfig_generate |sed 's/.pc$/-uninstalled.pc/'`
-AC_MSG_NOTICE(creating $pkgconfig_uninstalled)
-cat >conftest.sed <<AXEOF
-s|@prefix@|${pkgconfig_prefix}|
-s|@exec_prefix@|${pkgconfig_execprefix}|
-s|@bindir@|${pkgconfig_bindir}|
-s|@libdir@|${pkgconfig_src_libdir}|
-s|@datarootdir@|${pkgconfig_datarootdir}|
-s|@datadir@|${pkgconfig_datadir}|
-s|@sysconfdir@|${pkgconfig_sysconfdir}|
-s|@includedir@|${pkgconfig_src_headers}|
-s|@suffix@|${pkgconfig_suffix}|
-s|@PACKAGE@|${pkgconfig_package}|
-s|@PACKAGE_NAME@|${pkgconfig_libname}|
-s|@PACKAGE_DESCRIPTION@|${pkgconfig_description}|
-s|@PACKAGE_VERSION@|${pkgconfig_version}|
-s|@PACKAGE_REQUIRES@|${pkgconfig_requires}|
-s|@LIBS@|${pkgconfig_libs}|
-s|@LDFLAGS@|${pkgconfig_ldflags}|
-s|@CPPFLAGS@|${pkgconfig_cppflags}|
-AXEOF
-sed -f conftest.sed $pkgconfig_generate.in > $pkgconfig_uninstalled
-if test ! -s $pkgconfig_uninstalled ; then
-    AC_MSG_ERROR([$pkgconfig_uninstalled is empty])
-fi ; rm conftest.sed # DONE generate $pkgconfig_uninstalled
-           pkgconfig_requires_add=`echo ${pkgconfig_requires}`
-if test ".$pkgconfig_requires_add" != "." ; then
-           pkgconfig_requires_add="pkg-config $pkgconfig_requires_add"
-    else   pkgconfig_requires_add=":" ; fi
-pkgconfig_uninstalled=`echo $pkgconfig_generate |sed 's/.pc$/-uninstalled.sh/'`
-AC_MSG_NOTICE(creating $pkgconfig_uninstalled)
-cat >conftest.sed <<AXEOF
-s|@prefix@|\"${pkgconfig_prefix}\"|
-s|@exec_prefix@|\"${pkgconfig_execprefix}\"|
-s|@bindir@|\"${pkgconfig_bindir}\"|
-s|@libdir@|\"${pkgconfig_src_libdir}\"|
-s|@datarootdir@|\"${pkgconfig_datarootdir}\"|
-s|@datadir@|\"${pkgconfig_datadir}\"|
-s|@sysconfdir@|\"${pkgconfig_sysconfdir}\"|
-s|@includedir@|\"${pkgconfig_src_headers}\"|
-s|@suffix@|\"${pkgconfig_suffix}\"|
-s|@PACKAGE@|\"${pkgconfig_package}\"|
-s|@PACKAGE_NAME@|\"${pkgconfig_libname}\"|
-s|@PACKAGE_DESCRIPTION@|\"${pkgconfig_description}\"|
-s|@PACKAGE_VERSION@|\"${pkgconfig_version}\"|
-s|@PACKAGE_REQUIRES@|\"${pkgconfig_requires}\"|
-s|@LIBS@|\"${pkgconfig_libs}\"|
-s|@LDFLAGS@|\"${pkgconfig_ldflags}\"|
-s|@CPPFLAGS@|\"${pkgconfig_cppflags}\"|
-s>Name:>for option\\; do case \"\$option\" in --list-all|--name) echo >
-s>Description: *>\\;\\; --help) pkg-config --help \\; echo Buildscript Of >
-s>Version: *>\\;\\; --modversion|--version) echo >
-s>Requires:>\\;\\; --requires) echo $pkgconfig_requires_add>
-s>Libs: *>\\;\\; --libs) echo >
-s>Cflags: *>\\;\\; --cflags) echo >
-/--libs)/a\\
-       $pkgconfig_requires_add
-/--cflags)/a\\
-       $pkgconfig_requires_add\\
-;; --variable=*) eval echo '\$'\`echo \$option | sed -e 's/.*=//'\`\\
-;; --uninstalled) exit 0 \\
-;; *) ;; esac done
-AXEOF
-sed -f conftest.sed  $pkgconfig_generate.in > $pkgconfig_uninstalled
-if test ! -s $pkgconfig_uninstalled ; then
-    AC_MSG_ERROR([$pkgconfig_uninstalled is empty])
-fi ; rm conftest.sed # DONE generate $pkgconfig_uninstalled
-],[
-dnl AC_CONFIG_COMMANDS crap, the AS_PUSHVAR defines are invalid here...
-ax_create_pkgconfig_generate="$ax_create_pkgconfig_generate"
-pkgconfig_prefix='$prefix'
-pkgconfig_execprefix='$exec_prefix'
-pkgconfig_bindir='$bindir'
-pkgconfig_libdir='$libdir'
-pkgconfig_includedir='$includedir'
-pkgconfig_datarootdir='$datarootdir'
-pkgconfig_datadir='$datadir'
-pkgconfig_sysconfdir='$sysconfdir'
-pkgconfig_suffix='$ax_create_pkgconfig_suffix'
-pkgconfig_package='$PACKAGE_NAME'
-pkgconfig_libname='$ax_create_pkgconfig_libname'
-pkgconfig_description='$ax_create_pkgconfig_description'
-pkgconfig_version='$ax_create_pkgconfig_version'
-pkgconfig_requires='$ax_create_pkgconfig_requires'
-pkgconfig_libs='$ax_create_pkgconfig_libs'
-pkgconfig_ldflags='$ax_create_pkgconfig_ldflags'
-pkgconfig_cppflags='$ax_create_pkgconfig_cppflags'
-pkgconfig_src_libdir='$ax_create_pkgconfig_src_libdir'
-pkgconfig_src_headers='$ax_create_pkgconfig_src_headers'
-])dnl
-AS_VAR_POPDEF([PKGCONFIG_suffix])dnl
-AS_VAR_POPDEF([PKGCONFIG_libdir])dnl
-AS_VAR_POPDEF([PKGCONFIG_libfile])dnl
-AS_VAR_POPDEF([PKGCONFIG_libname])dnl
-AS_VAR_POPDEF([PKGCONFIG_version])dnl
-AS_VAR_POPDEF([PKGCONFIG_description])dnl
-AS_VAR_POPDEF([PKGCONFIG_requires])dnl
-AS_VAR_POPDEF([PKGCONFIG_pkglibs])dnl
-AS_VAR_POPDEF([PKGCONFIG_libs])dnl
-AS_VAR_POPDEF([PKGCONFIG_ldflags])dnl
-AS_VAR_POPDEF([PKGCONFIG_cppflags])dnl
-AS_VAR_POPDEF([PKGCONFIG_generate])dnl
-AS_VAR_POPDEF([PKGCONFIG_src_libdir])dnl
-AS_VAR_POPDEF([PKGCONFIG_src_headers])dnl
-])
diff --git a/m4/ax_pkg_check_modules.m4 b/m4/ax_pkg_check_modules.m4
new file mode 100644
index 0000000..0ddaad8
--- /dev/null
+++ b/m4/ax_pkg_check_modules.m4
@@ -0,0 +1,69 @@
+# ===========================================================================
+#   https://www.gnu.org/software/autoconf-archive/ax_pkg_check_modules.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PKG_CHECK_MODULES(PREFIX, PUBLIC-MODULES, PRIVATE-MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [PUBLIC-VARIABLE], [PRIVATE-VARIABLE])
+#
+# DESCRIPTION
+#
+#   A wrapper around PKG_CHECK_MODULES which splits the list of modules into
+#   public and private dependencies, and produces two variables listing the
+#   dependencies across all invocations of AX_PKG_CHECK_MODULES. These two
+#   variables are exposed via AC_SUBST, and should be used in a pkg-config
+#   file as the substituted values for Requires and Requires.private.
+#
+#   The PREFIX, PUBLIC-MODULES and PRIVATE-MODULES arguments should be
+#   specified as for PKG_CHECK_MODULES, with the concatenation of
+#   PUBLIC-MODULES and PRIVATE-MODULES equaling the LIST-OF-MODULES from
+#   PKG_CHECK_MODULES.  The ACTION-IF-FOUND and ACTION-IF-NOT-FOUND
+#   arguments are optional, and should also be specified as for
+#   PKG_CHECK_MODULES.  ACTION-IF-FOUND is evaluated if the full
+#   LIST-OF-MODULES is found; ACTION-IF-NOT-FOUND similarly.
+#
+#   PUBLIC-VARIABLE defaults to AX_PACKAGE_REQUIRES, and PRIVATE-VARIABLE
+#   defaults to AX_PACKAGE_REQUIRES_PRIVATE.  Both variables are AC_SUBST-ed
+#   by this macro.
+#
+#   For example:
+#
+#     AX_PKG_CHECK_MODULES([GLIB],[glib-2.0 gio-2.0],[gthread-2.0])
+#     AX_PKG_CHECK_MODULES([DBUS],[],[dbus-glib-1 >= 0.98 dbus-1])
+#
+#   results in the substitutions:
+#
+#     AX_PACKAGE_REQUIRES="glib-2.0 gio-2.0"
+#     AX_PACKAGE_REQUIRES_PRIVATE="gthread-2.0 dbus-glib-1 >= 0.98 dbus-1"
+#
+#   and can be used with a template pkg-config file (.pc.in) using:
+#
+#     Requires: @AX_PACKAGE_REQUIRES@
+#     Requires.private: @AX_PACKAGE_REQUIRES_PRIVATE@
+#
+# LICENSE
+#
+#   Copyright (c) 2014 Philip Withnall <philip at tecnocode.co.uk>
+#
+#   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 4 (changed as https://bugs.freedesktop.org/show_bug.cgi?id=87154)
+
+AC_DEFUN([AX_PKG_CHECK_MODULES],[
+    m4_define([ax_package_requires],
+              [m4_default_quoted([$6],[AX_PACKAGE_REQUIRES])])
+    m4_define([ax_package_requires_private],
+              [m4_default_quoted([$7],[AX_PACKAGE_REQUIRES_PRIVATE])])
+
+    PKG_CHECK_MODULES([$1],[$2 $3],[
+        ax_package_requires="$[]ax_package_requires m4_normalize($2)"
+        ax_package_requires_private="$[]ax_package_requires_private m4_normalize($3)"
+        $4],[$5])
+
+    # Substitute output.
+    AC_SUBST(ax_package_requires)
+    AC_SUBST(ax_package_requires_private)
+])dnl AX_PKG_CHECK_MODULES
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/xmltooling-lite.pc.in b/xmltooling-lite.pc.in
new file mode 100644
index 0000000..fb9c73e
--- /dev/null
+++ b/xmltooling-lite.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@ (lite version)
+Description: OpenSAML XMLTooling-C library (lite version)
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lxmltooling-lite
+Libs.private: @dlopen_LIBS@ @PTHREAD_LIBS@
+Cflags: -I${includedir} @BOOST_CPPFLAGS@ @PTHREAD_CFLAGS@
+Requires: @XMLTOOLING_LITE_REQUIRES@
+Requires.private: @XMLTOOLING_LITE_REQUIRES_PRIVATE@
diff --git a/xmltooling.pc.in b/xmltooling.pc.in
new file mode 100644
index 0000000..a2ac965
--- /dev/null
+++ b/xmltooling.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: OpenSAML XMLTooling-C library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lxmltooling
+Libs.private: @dlopen_LIBS@ @PTHREAD_LIBS@
+Cflags: -I${includedir} @BOOST_CPPFLAGS@ @PTHREAD_CFLAGS@
+Requires: @XMLTOOLING_REQUIRES@ @XMLTOOLING_LITE_REQUIRES@
+Requires.private: @XMLTOOLING_REQUIRES_PRIVATE@ @XMLTOOLING_LITE_REQUIRES_PRIVATE@
diff --git a/xmltooling/Makefile.am b/xmltooling/Makefile.am
index a32811b..4d230a1 100644
--- a/xmltooling/Makefile.am
+++ b/xmltooling/Makefile.am
@@ -213,16 +213,23 @@ common_sources = \
 	validation/ValidatorSuite.cpp \
 	$(thread_sources)
 
+common_CXXFLAGS = $(xerces_CFLAGS) $(log4shib_CFLAGS) $(log4cpp_CFLAGS) $(PTHREAD_CFLAGS) $(BOOST_CPPFLAGS)
+common_LIBADD   = $(xerces_LIBS)   $(log4shib_LIBS)   $(log4cpp_LIBS)   $(PTHREAD_LIBS)   $(dlopen_LIBS)
+
 libxmltooling_lite_la_SOURCES = \
 	${common_sources}
 libxmltooling_lite_la_CPPFLAGS = -DXMLTOOLING_LITE
+libxmltooling_lite_la_CXXFLAGS = $(common_CXXFLAGS)
 libxmltooling_lite_la_LDFLAGS = -version-info 8:0:0
+libxmltooling_lite_la_LIBADD = $(common_LIBADD)
 
 if BUILD_XMLSEC
 libxmltooling_la_SOURCES = \
 	${common_sources} \
 	${xmlsec_sources}
-libxmltooling_la_LDFLAGS = $(XMLSEC_LIBS) -version-info 8:0:0
+libxmltooling_la_LDFLAGS = -version-info 8:0:0
+libxmltooling_la_CXXFLAGS = $(XMLSEC_CFLAGS) $(common_CXXFLAGS)
+libxmltooling_la_LIBADD   = $(XMLSEC_LIBS)   $(common_LIBADD)
 endif
 
 install-exec-hook:
diff --git a/xmltoolingtest/Makefile.am b/xmltoolingtest/Makefile.am
index 6ee6790..c917f19 100644
--- a/xmltoolingtest/Makefile.am
+++ b/xmltoolingtest/Makefile.am
@@ -5,7 +5,8 @@ if BUILD_UNITTEST
 bin_PROGRAMS = xmltoolingtest
 xmltoolingtest_CXXFLAGS = $(CXXTESTFLAGS)
 if BUILD_XMLSEC
-xmltoolingtest_LDFLAGS = $(XMLSEC_LIBS)
+xmltoolingtest_CPPFLAGS = $(xerces_CFLAGS) $(XMLSEC_CFLAGS)
+xmltoolingtest_LDFLAGS  = $(xerces_LIBS)   $(XMLSEC_LIBS)
 xmltoolingtest_LDADD = $(top_builddir)/xmltooling/libxmltooling.la
 else
 xmltoolingtest_LDADD = $(top_builddir)/xmltooling/libxmltooling-lite.la

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list