From 494f8fc2b6f4e4fb09458dd977cec67263e677fa Mon Sep 17 00:00:00 2001 From: brendan Date: Wed, 28 May 2003 15:04:53 +0000 Subject: [PATCH] Fix curl version test. YP is enabled by default but automatically turned off if the curl test fails (unless --enable-yp is explicitly passed to configure, in which case configure will fail if the curl test fails). svn path=/trunk/icecast/; revision=4831 --- configure.in | 34 +++++++++++++++++++++++++++------- src/main.c | 6 +++--- src/source.c | 32 ++++++++++++++++++-------------- 3 files changed, 48 insertions(+), 24 deletions(-) diff --git a/configure.in b/configure.in index 1bddfcfd..7ba3834a 100644 --- a/configure.in +++ b/configure.in @@ -105,7 +105,7 @@ AC_CHECK_FUNCS(getnameinfo getaddrinfo inet_pton inet_aton) dnl -- configure options -- AC_ARG_WITH(xslt-config, - [ --with-xslt-config=PATH use xslt-config in PATH to find libxslt ], + [ --with-xslt-config=PATH use xslt-config in PATH to find libxslt ], [if ! test -x "$with_xslt_config" then AC_MSG_ERROR([$with_xslt_config cannot be executed]) @@ -164,14 +164,34 @@ fi AM_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!(Perhaps you need --with-ogg-prefix=/usr/local))) AM_PATH_VORBIS(, AC_MSG_ERROR(must have Vorbis installed!(Perhaps you need --with-vorbis-prefix=/usr/local))) +ACX_PTHREAD(, AC_MSG_ERROR([POSIX threads missing])) + +dnl -- YP support -- +AC_ARG_ENABLE([yp], + [ --disable-yp disable YP directory support]) +if test "x$enable_yp" != "xno" +then AM_PATH_CURL([ - AC_CHECK_DECL([CURLOPT_NOSIGNAL], - [ICECAST_OBJECTS="$ICECAST_OBJECTS geturl.o yp.o"], - [AC_MSG_NOTICE([Your libcurl is too old (7.10 or above required), YP disabled])], - [#include ])], [ - AC_MSG_NOTICE([libcurl not found, YP disabled]) + AC_CHECK_DECL([CURLOPT_NOSIGNAL], [ + AC_DEFINE([USE_YP], 1, [Define to compile in YP support code]) + ICECAST_OBJECTS="$ICECAST_OBJECTS geturl.o yp.o" + ], [ + if test "x$enable_yp" != "xyes" + then + AC_MSG_NOTICE([Your curl dev files are too old (7.10 or above required), YP disabled]) + else + AC_MSG_ERROR([Your curl dev files are too old (7.10 or above required)]) + fi + ], [#include ]) + ], [ + if test "x$enable_yp" != "xyes" + then + AC_MSG_NOTICE([libcurl not found, YP disabled]) + else + AC_MSG_ERROR([libcurl not found]) + fi ]) -ACX_PTHREAD(, AC_MSG_ERROR([POSIX threads missing])) +fi dnl Make substitutions diff --git a/src/main.c b/src/main.c index 416c9e42..c7e62db9 100644 --- a/src/main.c +++ b/src/main.c @@ -29,7 +29,7 @@ #include "logging.h" #include "xslt.h" #include "fserve.h" -#ifdef HAVE_CURL +#ifdef USE_YP #include "geturl.h" #endif @@ -75,14 +75,14 @@ static void _initialize_subsystems(void) global_initialize(); refbuf_initialize(); xslt_initialize(); -#ifdef HAVE_CURL +#ifdef USE_YP curl_initialize(); #endif } static void _shutdown_subsystems(void) { -#ifdef HAVE_CURL +#ifdef USE_YP curl_shutdown(); #endif fserve_shutdown(); diff --git a/src/source.c b/src/source.c index a88e0fb2..3337d425 100644 --- a/src/source.c +++ b/src/source.c @@ -29,7 +29,7 @@ #include "logging.h" #include "config.h" #include "util.h" -#ifdef HAVE_CURL +#ifdef USE_YP #include "geturl.h" #endif #include "source.h" @@ -54,7 +54,7 @@ static int _compare_clients(void *compare_arg, void *a, void *b); static int _free_client(void *key); static int _parse_audio_info(source_t *source, char *s); -#ifdef HAVE_CURL +#ifdef USE_YP static void _add_yp_info(source_t *source, char *stat_name, void *info, int type); #endif @@ -146,7 +146,9 @@ int source_compare_sources(void *arg, void *a, void *b) int source_free_source(void *key) { source_t *source = key; - int i=0; +#ifdef USE_YP + int i; +#endif free(source->mount); free(source->fallback_mount); @@ -154,7 +156,7 @@ int source_free_source(void *key) avl_tree_free(source->pending_tree, _free_client); avl_tree_free(source->client_tree, _free_client); source->format->free_plugin(source->format); -#ifdef HAVE_CURL +#ifdef USE_YP for (i=0; inum_yp_directories; i++) { yp_destroy_ypdata(source->ypdata[i]); } @@ -195,17 +197,19 @@ void *source_main(void *arg) int ret, timeout; client_t *client; avl_node *client_node; - char *s; - long current_time; - char current_song[256]; refbuf_t *refbuf, *abuf; int data_done; int listeners = 0; - int i=0; +#ifdef USE_YP + char *s; + long current_time; + char current_song[256]; + int i; int suppress_yp = 0; char *ai; +#endif long queue_limit; ice_config_t *config; @@ -219,7 +223,7 @@ void *source_main(void *arg) hostname = config->hostname; port = config->port; -#ifdef HAVE_CURL +#ifdef USE_YP for (i=0;inum_yp_directories;i++) { if (config->yp_url[i]) { source->ypdata[source->num_yp_directories] = yp_create_ypdata(); @@ -269,7 +273,7 @@ void *source_main(void *arg) source->listeners = 0; stats_event(source->mount, "listeners", "0"); stats_event(source->mount, "type", source->format->format_description); -#ifdef HAVE_CURL +#ifdef USE_YP if ((s = httpp_getvar(source->parser, "ice-name"))) { _add_yp_info(source, "server_name", s, YP_SERVER_NAME); } @@ -341,7 +345,7 @@ void *source_main(void *arg) DEBUG0("Source creation complete"); while (global.running == ICE_RUNNING && source->running) { -#ifdef HAVE_CURL +#ifdef USE_YP if(!suppress_yp) { current_time = time(NULL); for (i=0;inum_yp_directories;i++) { @@ -357,7 +361,7 @@ void *source_main(void *arg) strncat(current_song, " - ", 3); } } - if (s = stats_get_value(source->mount, "title")) { + if ((s = stats_get_value(source->mount, "title"))) { if (strlen(current_song) + strlen(s) < sizeof(current_song) -1) { @@ -588,7 +592,7 @@ done: INFO1("Source \"%s\" exiting", source->mount); -#ifdef HAVE_CURL +#ifdef USE_YP if(!suppress_yp) { yp_remove(source); } @@ -728,7 +732,7 @@ static int _parse_audio_info(source_t *source, char *s) return 1; } -#ifdef HAVE_CURL +#ifdef USE_YP static void _add_yp_info(source_t *source, char *stat_name, void *info, int type) { -- GitLab