From 511156f37bbd1f0a8ae9deb98d2b3eea7586dfa1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 21 Jun 2015 11:06:11 +0000 Subject: support gnurl's curl.h being in include/gnurl/ OR include/curl/ --- configure.ac | 32 +++++++++++++++++++++------- m4/libgnurl.m4 | 16 ++++++++++++++ po/POTFILES.in | 2 ++ src/gns/gnunet-gns-proxy.c | 4 ++++ src/gns/test_gns_proxy.c | 7 ++++-- src/hostlist/gnunet-daemon-hostlist_client.c | 5 +++++ src/pt/test_gns_vpn.c | 4 ++++ src/pt/test_gnunet_vpn.c | 4 ++++ src/transport/plugin_transport_http.h | 4 ++++ src/transport/plugin_transport_http_client.c | 4 ++++ 10 files changed, 72 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 8473f8830..37c03f720 100644 --- a/configure.ac +++ b/configure.ac @@ -461,18 +461,35 @@ else AM_CONDITIONAL(HAVE_LIBGNURL, false) fi +SAVE_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$LIBGNURL_CPPFLAGS $LIBCURL_CPPFLAGS $CPPFLAGS" +LIBS="$LIBGNURL $LIBCURL $LIBS" + # libcurl-gnutls LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false]) if test "x$curl" = xtrue then + AC_CHECK_HEADERS([curl/curl.h], - AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include ]]), - [curl=false]) + AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include ]]), + [curl=false]) + AC_CHECK_HEADERS([gnurl/curl.h], + AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],,[[#include ]])) # need libcurl-gnutls.so, everything else is not acceptable AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],,[curl=false]) # cURL must support CURLINFO_TLS_SESSION, version >= 7.34 - fi + +# Check for curl/curl.h and gnurl/curl.h so we can use #ifdef +# HAVE_CURL_CURL_H later (the above LIBCURL_CHECK_CONFIG accepted +# *either* header set). +AC_CHECK_HEADERS([curl/curl.h],, + curl=false + AC_CHECK_HEADERS([gnurl/curl.h],, + gnurl=false)) + + + if test x$curl = xfalse then AM_CONDITIONAL(HAVE_LIBCURL, false) @@ -486,10 +503,9 @@ else fi - -# restore LIBS +# restore LIBS & CPPFLAGS LIBS=$SAVE_LIBS - +CPPFLAGS=$SAVE_CPPFLAGS AC_CHECK_HEADERS([glpk.h],[glpk=true],[gplk=false]) # GLPK must support glpk_init_env, version >= 4.43 @@ -1641,9 +1657,9 @@ then fi # libgnurl -if test "x$gnurl" = "x0" +if test "x$gnurl" = "xfalse" then - if test "x$curl" = "x0" + if test "x$curl" = "xfalse" then AC_MSG_NOTICE([NOTICE: libgnurl not found. http client support will not be compiled.]) AC_MSG_WARN([ERROR: libgnurl not found. hostlist daemon will not be compiled, and you probably WANT the hostlist daemon]) diff --git a/m4/libgnurl.m4 b/m4/libgnurl.m4 index 69aa16605..da72e5e87 100644 --- a/m4/libgnurl.m4 +++ b/m4/libgnurl.m4 @@ -159,6 +159,22 @@ x=CURLOPT_STDERR; x=CURLOPT_VERBOSE; ])],libgnurl_cv_lib_gnurl_usable=yes,libgnurl_cv_lib_gnurl_usable=no) +# BEGIN Changes from original libcurl.m4: +# Give it a 2nd shot using 'gnurl/curl.h' + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],[ +/* Try and use a few common options to force a failure if we are + missing symbols or can't link. */ +int x; +curl_easy_setopt(NULL,CURLOPT_URL,NULL); +x=CURL_ERROR_SIZE; +x=CURLOPT_WRITEFUNCTION; +x=CURLOPT_FILE; +x=CURLOPT_ERRORBUFFER; +x=CURLOPT_STDERR; +x=CURLOPT_VERBOSE; +])],libgnurl_cv_lib_gnurl_usable=yes) +# END Changes from original libcurl.m4: + CPPFLAGS=$_libgnurl_save_cppflags LIBS=$_libgnurl_save_libs unset _libgnurl_save_cppflags diff --git a/po/POTFILES.in b/po/POTFILES.in index dd166adcc..a9015c08b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -229,6 +229,7 @@ src/nat/gnunet-nat-server.c src/nat/nat_auto.c src/nat/nat.c src/nat/nat_mini.c +src/nat/nat_stun.c src/nat/nat_test.c src/nse/gnunet-nse.c src/nse/gnunet-nse-profiler.c @@ -458,6 +459,7 @@ src/include/gnunet_common.h src/include/gnunet_mq_lib.h src/include/gnunet_postgres_lib.h src/include/gnunet_time_lib.h +src/nat/test_stun.h src/rps/rps-test_util.h src/scalarproduct/scalarproduct.h src/testbed/testbed_api.h diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 08cfdf4df..d5ccd81e7 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -29,7 +29,11 @@ */ #include "platform.h" #include +#if HAVE_CURL_CURL_H #include +#elif HAVE_GNURL_CURL_H +#include +#endif #include #include #include diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c index 7411c9bc9..fb6d01fcd 100644 --- a/src/gns/test_gns_proxy.c +++ b/src/gns/test_gns_proxy.c @@ -24,7 +24,11 @@ * @author Martin Schanzenbach */ #include "platform.h" +#if HAVE_CURL_CURL_H #include +#elif HAVE_GNURL_CURL_H +#include +#endif #include #include "gnunet_namestore_service.h" #include "gnunet_gns_service.h" @@ -246,7 +250,7 @@ static void start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_asprintf (&url, - "http://%s:%d/hello_world", + "http://%s:%d/hello_world", TEST_DOMAIN, PORT); curl = curl_easy_init (); curl_easy_setopt (curl, CURLOPT_URL, url); @@ -475,4 +479,3 @@ main (int argc, char *const *argv) } /* end of test_gns_vpn.c */ - diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index 004a77c02..ba7bdb2cc 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c @@ -29,7 +29,12 @@ #include "gnunet_statistics_service.h" #include "gnunet_transport_service.h" #include "gnunet-daemon-hostlist.h" +#if HAVE_CURL_CURL_H #include +#elif HAVE_GNURL_CURL_H +#include +#endif + /** diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c index 28e83009f..2ac41d810 100644 --- a/src/pt/test_gns_vpn.c +++ b/src/pt/test_gns_vpn.c @@ -24,7 +24,11 @@ * @author Martin Schanzenbach */ #include "platform.h" +#if HAVE_CURL_CURL_H #include +#elif HAVE_GNURL_CURL_H +#include +#endif #include #include "gnunet_identity_service.h" #include "gnunet_namestore_service.h" diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c index 4a223e595..29c087106 100644 --- a/src/pt/test_gnunet_vpn.c +++ b/src/pt/test_gnunet_vpn.c @@ -24,7 +24,11 @@ * @author Christian Grothoff */ #include "platform.h" +#if HAVE_CURL_CURL_H #include +#elif HAVE_GNURL_CURL_H +#include +#endif #include #include "gnunet_vpn_service.h" #include "gnunet_testing_lib.h" diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h index 5655d7d6f..683f33f50 100644 --- a/src/transport/plugin_transport_http.h +++ b/src/transport/plugin_transport_http.h @@ -41,7 +41,11 @@ #include "gnunet_os_lib.h" #include "gnunet_nat_lib.h" #include "microhttpd.h" +#if HAVE_CURL_CURL_H #include +#elif HAVE_GNURL_CURL_H +#include +#endif #define DEBUG_HTTP GNUNET_EXTRA_LOGGING diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 7d935b4f0..ad669d20e 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -49,7 +49,11 @@ #include "gnunet_protocols.h" #include "gnunet_transport_plugin.h" #include "plugin_transport_http_common.h" +#if HAVE_CURL_CURL_H #include +#elif HAVE_GNURL_CURL_H +#include +#endif #define LOG(kind,...) GNUNET_log_from(kind, PLUGIN_NAME, __VA_ARGS__) -- cgit v1.2.3