Browse Source

support gnurl's curl.h being in include/gnurl/ OR include/curl/

Christian Grothoff 8 years ago
parent
commit
511156f37b

+ 24 - 8
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/curl.h>]]),
-   [curl=false])
+  AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include <curl/curl.h>]]),
+  [curl=false])
+ AC_CHECK_HEADERS([gnurl/curl.h],
+  AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],,[[#include <gnurl/curl.h>]]))
  # 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])

+ 16 - 0
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 <gnurl/curl.h>],[
+/* 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

+ 2 - 0
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

+ 4 - 0
src/gns/gnunet-gns-proxy.c

@@ -29,7 +29,11 @@
  */
 #include "platform.h"
 #include <microhttpd.h>
+#if HAVE_CURL_CURL_H
 #include <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 #include <gnutls/abstract.h>

+ 5 - 2
src/gns/test_gns_proxy.c

@@ -24,7 +24,11 @@
  * @author Martin Schanzenbach
  */
 #include "platform.h"
+#if HAVE_CURL_CURL_H
 #include <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
 #include <microhttpd.h>
 #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 */
-

+ 5 - 0
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 <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
+
 
 
 /**

+ 4 - 0
src/pt/test_gns_vpn.c

@@ -24,7 +24,11 @@
  * @author Martin Schanzenbach
  */
 #include "platform.h"
+#if HAVE_CURL_CURL_H
 #include <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
 #include <microhttpd.h>
 #include "gnunet_identity_service.h"
 #include "gnunet_namestore_service.h"

+ 4 - 0
src/pt/test_gnunet_vpn.c

@@ -24,7 +24,11 @@
  * @author Christian Grothoff
  */
 #include "platform.h"
+#if HAVE_CURL_CURL_H
 #include <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
 #include <microhttpd.h>
 #include "gnunet_vpn_service.h"
 #include "gnunet_testing_lib.h"

+ 4 - 0
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 <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
 
 
 #define DEBUG_HTTP GNUNET_EXTRA_LOGGING

+ 4 - 0
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 <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
 
 
 #define LOG(kind,...) GNUNET_log_from(kind, PLUGIN_NAME, __VA_ARGS__)