[cpp-xmltooling] 04/22: Use AC_CHECK_DECL(S) for the cURL feature tests
Scott Cantor
cantor.2 at osu.edu
Thu Jun 21 14:57:20 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=9e1df150649bf26c8b33948c60fccd69fd8a6842
commit 9e1df150649bf26c8b33948c60fccd69fd8a6842
Author: Ferenc Wágner <wferi at niif.hu>
AuthorDate: Tue Jul 5 13:20:35 2016 +0200
Use AC_CHECK_DECL(S) for the cURL feature tests
This is more concise and correctly prints all the test results.
config_win32.h needs to be regenerated.
---
config_win32.h | 4 ++--
configure.ac | 16 ++++------------
xmltooling/soap/impl/CURLSOAPTransport.cpp | 8 ++++----
xmltooling/util/CurlURLInputStream.cpp | 2 +-
4 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/config_win32.h b/config_win32.h
index d190ba8..29985dc 100644
--- a/config_win32.h
+++ b/config_win32.h
@@ -91,10 +91,10 @@
#define HAVE_CURL_OFF_T 1
/* Define to 1 if you have support for the CURLINFO_TLS_SSL_PTR feature. */
-#define HAVE_CURLINFO_TLS_SSL_PTR 1
+#define HAVE_DECL_CURLINFO_TLS_SSL_PTR 1
/* Define to 1 if you have support for the CURLOPT_ACCEPT_ENCODING option. */
-#define HAVE_CURLOPT_ACCEPT_ENCODING 1
+#define HAVE_DECL_CURLOPT_ACCEPT_ENCODING 1
/* Name of package */
#define PACKAGE "xmltooling"
diff --git a/configure.ac b/configure.ac
index 11ccc04..5a56c1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -306,18 +306,10 @@ int i = 0;
[AC_LANG_PROGRAM([[#include <curl/curl.h>]],
[[curl_global_init(CURL_GLOBAL_ALL)]])],,
[AC_MSG_ERROR([unable to link with libcurl])])
- AC_MSG_CHECKING([for CURLOPT_ACCEPT_ENCODING in curl.h])
- AC_EGREP_HEADER([CURLOPT_ACCEPT_ENCODING], [curl/curl.h],
- [AC_DEFINE([HAVE_CURLOPT_ACCEPT_ENCODING],[1],[Define to 1 if you have support for the CURLOPT_ACCEPT_ENCODING option.])])
- AC_MSG_CHECKING([for CURLOPT_SSL_CTX_FUNCTION in curl.h])
- AC_EGREP_HEADER([CURLOPT_SSL_CTX_FUNCTION], [curl/curl.h],
- [AC_MSG_RESULT(yes)],
- [AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])])
- 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>]])
- AC_MSG_CHECKING([for CURLINFO_TLS_SSL_PTR in curl.h])
- AC_EGREP_HEADER([CURLINFO_TLS_SSL_PTR], [curl/curl.h],
- [AC_DEFINE([HAVE_CURLINFO_TLS_SSL_PTR],[1],[Define to 1 if you have support for the CURLINFO_TLS_SSL_PTR feature.])])
-
+ 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>]])
+
# restore master libs
LIBS="$save_LIBS"
diff --git a/xmltooling/soap/impl/CURLSOAPTransport.cpp b/xmltooling/soap/impl/CURLSOAPTransport.cpp
index 0d1d359..a7148aa 100644
--- a/xmltooling/soap/impl/CURLSOAPTransport.cpp
+++ b/xmltooling/soap/impl/CURLSOAPTransport.cpp
@@ -74,7 +74,7 @@ namespace xmltooling {
CURLSOAPTransport(const Address& addr)
: m_sender(addr.m_from ? addr.m_from : ""), m_peerName(addr.m_to ? addr.m_to : ""), m_endpoint(addr.m_endpoint),
m_handle(nullptr), m_keepHandle(false), m_headers(nullptr),
-#ifdef HAVE_CURLINFO_TLS_SSL_PTR
+#if HAVE_DECL_CURLINFO_TLS_SSL_PTR
m_cipherLogged(false),
#endif
#ifndef XMLTOOLING_NO_XMLSEC
@@ -120,7 +120,7 @@ namespace xmltooling {
bool setAcceptEncoding(const char *value)
{
-#ifdef HAVE_CURLOPT_ACCEPT_ENCODING
+#if HAVE_DECL_CURLOPT_ACCEPT_ENCODING
return (curl_easy_setopt(m_handle, CURLOPT_ACCEPT_ENCODING, value) == CURLE_OK);
#else
return (curl_easy_setopt(m_handle, CURLOPT_ENCODING, value) == CURLE_OK);
@@ -235,7 +235,7 @@ namespace xmltooling {
string m_useragent;
map<string,vector<string> > m_response_headers;
vector<string> m_saved_options;
-#ifdef HAVE_CURLINFO_TLS_SSL_PTR
+#if HAVE_DECL_CURLINFO_TLS_SSL_PTR
bool m_cipherLogged;
#endif
#ifndef XMLTOOLING_NO_XMLSEC
@@ -615,7 +615,7 @@ size_t xmltooling::curl_header_hook(void* ptr, size_t size, size_t nmemb, void*
{
CURLSOAPTransport* ctx = reinterpret_cast<CURLSOAPTransport*>(stream);
-#ifdef HAVE_CURLINFO_TLS_SSL_PTR
+#if HAVE_DECL_CURLINFO_TLS_SSL_PTR
if (!ctx->m_cipherLogged) {
Category& log = Category::getInstance(XMLTOOLING_LOGCAT ".SOAPTransport.CURL");
if (log.isDebugEnabled()) {
diff --git a/xmltooling/util/CurlURLInputStream.cpp b/xmltooling/util/CurlURLInputStream.cpp
index 5962f2c..42f229e 100644
--- a/xmltooling/util/CurlURLInputStream.cpp
+++ b/xmltooling/util/CurlURLInputStream.cpp
@@ -275,7 +275,7 @@ void CurlURLInputStream::init(const DOMElement* e)
curl_easy_setopt(fEasy, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(fEasy, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(fEasy, CURLOPT_FAILONERROR, 1);
-#ifdef HAVE_CURLOPT_ACCEPT_ENCODING
+#if HAVE_DECL_CURLOPT_ACCEPT_ENCODING
curl_easy_setopt(fEasy, CURLOPT_ACCEPT_ENCODING, "");
#else
curl_easy_setopt(fEasy, CURLOPT_ENCODING, "");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list