You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/02/08 17:47:19 UTC
[trafficserver] branch master updated: Configure option to disable
CURL
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 80dd670 Configure option to disable CURL
80dd670 is described below
commit 80dd6702931e175230cdb0ba118201ba3e515876
Author: Bryan Call <bc...@apache.org>
AuthorDate: Mon Jan 30 16:23:02 2017 -0800
Configure option to disable CURL
---
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 4bfe34f..305e432 100644
--- a/configure.ac
+++ b/configure.ac
@@ -220,6 +220,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
#
@@ -1085,13 +1098,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
@@ -1476,6 +1482,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" <co...@trafficserver.apache.org>'].