Package: xmltooling / 1.6.0-4+deb9u2

Use-pkg-config-for-log4shib-log4cpp.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@niif.hu>
Date: Mon, 20 Jun 2016 11:11:46 +0200
Subject: Use pkg-config for log4shib/log4cpp

---
 configure.ac           | 53 ++++----------------------------------------------
 xmltooling/Makefile.am |  4 ++++
 2 files changed, 8 insertions(+), 49 deletions(-)

diff --git a/configure.ac b/configure.ac
index f1cfa29..227b3b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,55 +117,10 @@ 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
+PKG_CHECK_MODULES([log4shib], [log4shib],
+    [AC_DEFINE([XMLTOOLING_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
+    [PKG_CHECK_MODULES([log4cpp], [log4cpp],
+        [AC_DEFINE([XMLTOOLING_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])])])
 
 # Xerces settings
 AC_ARG_WITH(xerces,
diff --git a/xmltooling/Makefile.am b/xmltooling/Makefile.am
index f265007..701c8fd 100644
--- a/xmltooling/Makefile.am
+++ b/xmltooling/Makefile.am
@@ -207,12 +207,16 @@ libxmltooling_lite_la_SOURCES = \
 	${common_sources}
 libxmltooling_lite_la_CPPFLAGS = -DXMLTOOLING_LITE
 libxmltooling_lite_la_LDFLAGS = -version-info 7:0:0
+libxmltooling_lite_la_CPPFLAGS += $(log4shib_CFLAGS) $(log4cpp_CFLAGS)
+libxmltooling_lite_la_LDFLAGS += $(log4shib_LIBS) $(log4cpp_LIBS)
 
 if BUILD_XMLSEC
 libxmltooling_la_SOURCES = \
 	${common_sources} \
 	${xmlsec_sources}
 libxmltooling_la_LDFLAGS = $(XMLSEC_LIBS) -version-info 7:0:0
+libxmltooling_la_CFLAGS = $(log4shib_CFLAGS) $(log4cpp_CFLAGS)
+libxmltooling_la_LDFLAGS += $(log4shib_LIBS) $(log4cpp_LIBS)
 endif
 
 install-exec-hook: