[xiph-cvs] cvs commit: icecast/src main.c source.c

Brendan brendan at xiph.org
Wed May 28 08:04:53 PDT 2003



brendan     03/05/28 11:04:53

  Modified:    .        configure.in
               src      main.c source.c
  Log:
  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).

Revision  Changes    Path
1.32      +27 -7     icecast/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/icecast/configure.in,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -p -u -r1.31 -r1.32
--- configure.in	28 May 2003 03:45:57 -0000	1.31
+++ configure.in	28 May 2003 15:04:53 -0000	1.32
@@ -105,7 +105,7 @@ AC_CHECK_FUNCS(getnameinfo getaddrinfo i
 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 <curl/curl.h>])], [
-  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 <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
 

<p><p>1.27      +3 -3      icecast/src/main.c

Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -p -u -r1.26 -r1.27
--- main.c	17 Apr 2003 03:23:18 -0000	1.26
+++ main.c	28 May 2003 15:04:53 -0000	1.27
@@ -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();

<p><p>1.53      +18 -14    icecast/src/source.c

Index: source.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -p -u -r1.52 -r1.53
--- source.c	15 May 2003 21:03:32 -0000	1.52
+++ source.c	28 May 2003 15:04:53 -0000	1.53
@@ -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, vo
 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; i<source->num_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;i<config->num_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;i<source->num_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 *s
     return 1;
 }
 
-#ifdef HAVE_CURL
+#ifdef USE_YP
 static void _add_yp_info(source_t *source, char *stat_name, 
             void *info, int type)
 {

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list