trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] branch 7.1.x updated: Configure option to disable CURL
Date Wed, 03 May 2017 02:23:47 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/7.1.x by this push:
       new  6ff7931   Configure option to disable CURL
6ff7931 is described below

commit 6ff7931a63fc54585c008d2d3a0c3d13f90b12c3
Author: Bryan Call <bcall@apache.org>
AuthorDate: Mon Jan 30 16:23:02 2017 -0800

    Configure option to disable CURL
    
    (cherry picked from commit 80dd6702931e175230cdb0ba118201ba3e515876)
---
 cmd/traffic_top/stats.h        |  8 +++++++-
 cmd/traffic_top/traffic_top.cc | 14 ++++++++++++++
 configure.ac                   | 23 ++++++++++++++++-------
 3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/cmd/traffic_top/stats.h b/cmd/traffic_top/stats.h
index f1877c6..ffb1c1e 100644
--- a/cmd/traffic_top/stats.h
+++ b/cmd/traffic_top/stats.h
@@ -20,14 +20,16 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 */
-
+#if HAS_CURL
 #include <curl/curl.h>
+#endif
 #include <map>
 #include <string>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <inttypes.h>
+#include <sys/time.h>
 #include "mgmtapi.h"
 
 using namespace std;
@@ -44,7 +46,9 @@ struct LookupItem {
   int type;
 };
 extern size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream);
+#if HAS_CURL
 extern char curl_error[CURL_ERROR_SIZE];
+#endif
 extern string response;
 
 namespace constant
@@ -289,6 +293,7 @@ public:
       _now       = now;
       _time_diff = _now - _old_time;
     } else {
+#if HAS_CURL
       CURL *curl;
       CURLcode res;
 
@@ -328,6 +333,7 @@ public:
         /* always cleanup */
         curl_easy_cleanup(curl);
       }
+#endif
     }
   }
 
diff --git a/cmd/traffic_top/traffic_top.cc b/cmd/traffic_top/traffic_top.cc
index 34a5fb1..568b0fe 100644
--- a/cmd/traffic_top/traffic_top.cc
+++ b/cmd/traffic_top/traffic_top.cc
@@ -54,7 +54,9 @@
 #include "stats.h"
 
 using namespace std;
+#if HAS_CURL
 char curl_error[CURL_ERROR_SIZE];
+#endif
 string response;
 
 namespace colorPair
@@ -263,7 +265,11 @@ help(const string &host, const string &version)
 static void
 usage()
 {
+#if HAS_CURL
   fprintf(stderr, "Usage: traffic_top [-s seconds] [URL|hostname|hostname:port]\n");
+#else
+  fprintf(stderr, "Usage: traffic_top [-s seconds]\n");
+#endif
   exit(1);
 }
 
@@ -400,9 +406,17 @@ main(int argc, char **argv)
   }
 
   string url = "";
+#if HAS_CURL
   if (optind >= argc) {
+#else
+  if (1) {
+#endif
     if (TS_ERR_OKAY != TSInit(nullptr, static_cast<TSInitOptionT>(TS_MGMT_OPT_NO_EVENTS
| TS_MGMT_OPT_NO_SOCK_TESTS))) {
+#if HAS_CURL
       fprintf(stderr, "Error: missing URL on command line or error connecting to the local
manager\n");
+#else
+      fprintf(stderr, "Error: error connecting to the local manager\n");
+#endif
       usage();
     }
   } else {
diff --git a/configure.ac b/configure.ac
index 5a5b69f..7b1a897 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,6 +228,19 @@ AC_ARG_ENABLE([fast-sdk],
 AC_MSG_RESULT([$enable_fast_sdk])
 TS_ARG_ENABLE_VAR([use], [fast-sdk])
 
+# Curl support for traffic_top
+AC_MSG_CHECKING([whether to enable CURL])
+AC_ARG_ENABLE([curl],
+  [AS_HELP_STRING([--disable-curl],[turn off CURL support for traffic_top])],
+  [],
+  [enable_curl=yes]
+)
+AC_MSG_RESULT([$enable_curl])
+
+if test "x${enable_curl}" = "xyes"; then
+AX_LIB_CURL([7.19], [AC_DEFINE([HAS_CURL], [1], [Define if libcurl >= 7.19.])])
+fi
+
 #
 # Diags
 #
@@ -1088,13 +1101,6 @@ TS_REMOVEFROM(CFLAGS, -Werror)
 AX_WITH_CURSES
 CFLAGS="$__saved_CFLAGS"
 
-AX_LIB_CURL([7.19], [
-    AM_CONDITIONAL([BUILD_TRAFFIC_TOP], [test "x$ax_cv_curses" = "xyes"])
-  ], [
-    AM_CONDITIONAL([BUILD_TRAFFIC_TOP], [false])
-  ]
-)
-
 #
 # Check for SSL presence and usability
 TS_CHECK_CRYPTO
@@ -1479,6 +1485,9 @@ AC_SUBST([LUAJIT_CPPFLAGS], ['-I$(abs_top_srcdir)/lib/luajit/src'])
 # We should be able to build http_load if epoll(2) is available.
 AM_CONDITIONAL([BUILD_HTTP_LOAD], [test x"$ac_cv_func_epoll_ctl" = x"yes"])
 
+# We should only build traffic_top if we have curses
+AM_CONDITIONAL([BUILD_TRAFFIC_TOP], [test "x$ax_cv_curses" = "xyes"])
+
 AC_CHECK_HEADERS([mysql/mysql.h], [has_mysql=1],[has_mysql=0])
 AC_CHECK_LIB([mysqlclient],[mysql_info],[AC_SUBST([LIB_MYSQLCLIENT],["-lmysqlclient"])],[has_mysql=0])
 AC_SUBST(has_mysql)

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message