Commit 494f8fc2 authored by brendan's avatar brendan

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
parent 018d0a27
...@@ -105,7 +105,7 @@ AC_CHECK_FUNCS(getnameinfo getaddrinfo inet_pton inet_aton) ...@@ -105,7 +105,7 @@ AC_CHECK_FUNCS(getnameinfo getaddrinfo inet_pton inet_aton)
dnl -- configure options -- dnl -- configure options --
AC_ARG_WITH(xslt-config, 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" [if ! test -x "$with_xslt_config"
then then
AC_MSG_ERROR([$with_xslt_config cannot be executed]) AC_MSG_ERROR([$with_xslt_config cannot be executed])
...@@ -164,14 +164,34 @@ fi ...@@ -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_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))) 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([ AM_PATH_CURL([
AC_CHECK_DECL([CURLOPT_NOSIGNAL], AC_CHECK_DECL([CURLOPT_NOSIGNAL], [
[ICECAST_OBJECTS="$ICECAST_OBJECTS geturl.o yp.o"], AC_DEFINE([USE_YP], 1, [Define to compile in YP support code])
[AC_MSG_NOTICE([Your libcurl is too old (7.10 or above required), YP disabled])], ICECAST_OBJECTS="$ICECAST_OBJECTS geturl.o yp.o"
[#include <curl/curl.h>])], [ ], [
AC_MSG_NOTICE([libcurl not found, YP disabled]) 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 <curl/curl.h>])
], [
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 dnl Make substitutions
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "logging.h" #include "logging.h"
#include "xslt.h" #include "xslt.h"
#include "fserve.h" #include "fserve.h"
#ifdef HAVE_CURL #ifdef USE_YP
#include "geturl.h" #include "geturl.h"
#endif #endif
...@@ -75,14 +75,14 @@ static void _initialize_subsystems(void) ...@@ -75,14 +75,14 @@ static void _initialize_subsystems(void)
global_initialize(); global_initialize();
refbuf_initialize(); refbuf_initialize();
xslt_initialize(); xslt_initialize();
#ifdef HAVE_CURL #ifdef USE_YP
curl_initialize(); curl_initialize();
#endif #endif
} }
static void _shutdown_subsystems(void) static void _shutdown_subsystems(void)
{ {
#ifdef HAVE_CURL #ifdef USE_YP
curl_shutdown(); curl_shutdown();
#endif #endif
fserve_shutdown(); fserve_shutdown();
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "logging.h" #include "logging.h"
#include "config.h" #include "config.h"
#include "util.h" #include "util.h"
#ifdef HAVE_CURL #ifdef USE_YP
#include "geturl.h" #include "geturl.h"
#endif #endif
#include "source.h" #include "source.h"
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
static int _compare_clients(void *compare_arg, void *a, void *b); static int _compare_clients(void *compare_arg, void *a, void *b);
static int _free_client(void *key); static int _free_client(void *key);
static int _parse_audio_info(source_t *source, char *s); 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, static void _add_yp_info(source_t *source, char *stat_name,
void *info, int type); void *info, int type);
#endif #endif
...@@ -146,7 +146,9 @@ int source_compare_sources(void *arg, void *a, void *b) ...@@ -146,7 +146,9 @@ int source_compare_sources(void *arg, void *a, void *b)
int source_free_source(void *key) int source_free_source(void *key)
{ {
source_t *source = key; source_t *source = key;
int i=0; #ifdef USE_YP
int i;
#endif
free(source->mount); free(source->mount);
free(source->fallback_mount); free(source->fallback_mount);
...@@ -154,7 +156,7 @@ int source_free_source(void *key) ...@@ -154,7 +156,7 @@ int source_free_source(void *key)
avl_tree_free(source->pending_tree, _free_client); avl_tree_free(source->pending_tree, _free_client);
avl_tree_free(source->client_tree, _free_client); avl_tree_free(source->client_tree, _free_client);
source->format->free_plugin(source->format); source->format->free_plugin(source->format);
#ifdef HAVE_CURL #ifdef USE_YP
for (i=0; i<source->num_yp_directories; i++) { for (i=0; i<source->num_yp_directories; i++) {
yp_destroy_ypdata(source->ypdata[i]); yp_destroy_ypdata(source->ypdata[i]);
} }
...@@ -195,17 +197,19 @@ void *source_main(void *arg) ...@@ -195,17 +197,19 @@ void *source_main(void *arg)
int ret, timeout; int ret, timeout;
client_t *client; client_t *client;
avl_node *client_node; avl_node *client_node;
char *s;
long current_time;
char current_song[256];
refbuf_t *refbuf, *abuf; refbuf_t *refbuf, *abuf;
int data_done; int data_done;
int listeners = 0; int listeners = 0;
int i=0; #ifdef USE_YP
char *s;
long current_time;
char current_song[256];
int i;
int suppress_yp = 0; int suppress_yp = 0;
char *ai; char *ai;
#endif
long queue_limit; long queue_limit;
ice_config_t *config; ice_config_t *config;
...@@ -219,7 +223,7 @@ void *source_main(void *arg) ...@@ -219,7 +223,7 @@ void *source_main(void *arg)
hostname = config->hostname; hostname = config->hostname;
port = config->port; port = config->port;
#ifdef HAVE_CURL #ifdef USE_YP
for (i=0;i<config->num_yp_directories;i++) { for (i=0;i<config->num_yp_directories;i++) {
if (config->yp_url[i]) { if (config->yp_url[i]) {
source->ypdata[source->num_yp_directories] = yp_create_ypdata(); source->ypdata[source->num_yp_directories] = yp_create_ypdata();
...@@ -269,7 +273,7 @@ void *source_main(void *arg) ...@@ -269,7 +273,7 @@ void *source_main(void *arg)
source->listeners = 0; source->listeners = 0;
stats_event(source->mount, "listeners", "0"); stats_event(source->mount, "listeners", "0");
stats_event(source->mount, "type", source->format->format_description); stats_event(source->mount, "type", source->format->format_description);
#ifdef HAVE_CURL #ifdef USE_YP
if ((s = httpp_getvar(source->parser, "ice-name"))) { if ((s = httpp_getvar(source->parser, "ice-name"))) {
_add_yp_info(source, "server_name", s, YP_SERVER_NAME); _add_yp_info(source, "server_name", s, YP_SERVER_NAME);
} }
...@@ -341,7 +345,7 @@ void *source_main(void *arg) ...@@ -341,7 +345,7 @@ void *source_main(void *arg)
DEBUG0("Source creation complete"); DEBUG0("Source creation complete");
while (global.running == ICE_RUNNING && source->running) { while (global.running == ICE_RUNNING && source->running) {
#ifdef HAVE_CURL #ifdef USE_YP
if(!suppress_yp) { if(!suppress_yp) {
current_time = time(NULL); current_time = time(NULL);
for (i=0;i<source->num_yp_directories;i++) { for (i=0;i<source->num_yp_directories;i++) {
...@@ -357,7 +361,7 @@ void *source_main(void *arg) ...@@ -357,7 +361,7 @@ void *source_main(void *arg)
strncat(current_song, " - ", 3); 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) if (strlen(current_song) + strlen(s)
< sizeof(current_song) -1) < sizeof(current_song) -1)
{ {
...@@ -588,7 +592,7 @@ done: ...@@ -588,7 +592,7 @@ done:
INFO1("Source \"%s\" exiting", source->mount); INFO1("Source \"%s\" exiting", source->mount);
#ifdef HAVE_CURL #ifdef USE_YP
if(!suppress_yp) { if(!suppress_yp) {
yp_remove(source); yp_remove(source);
} }
...@@ -728,7 +732,7 @@ static int _parse_audio_info(source_t *source, char *s) ...@@ -728,7 +732,7 @@ static int _parse_audio_info(source_t *source, char *s)
return 1; return 1;
} }
#ifdef HAVE_CURL #ifdef USE_YP
static void _add_yp_info(source_t *source, char *stat_name, static void _add_yp_info(source_t *source, char *stat_name,
void *info, int type) void *info, int type)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment