Make MDNS mandatory and Avahi the default (and only) backend

This commit is contained in:
Julien BLACHE 2009-04-01 16:20:53 +02:00
parent 185864e799
commit eb5cccca06
5 changed files with 11 additions and 50 deletions

View File

@ -8,6 +8,7 @@ AC_USE_SYSTEM_EXTENSIONS
dnl Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
dnl AC_PROG_YACC
dnl AM_PROG_LEX
AC_PROG_LIBTOOL
@ -37,7 +38,6 @@ fi
AC_DEFINE_UNQUOTED(CONFFILE,"${CONFFILE}",Where the config file is)
rend_avahi=false
db_sqlite3=false
use_ffmpeg=false;
use_upnp=false;
@ -66,25 +66,9 @@ AC_ARG_ENABLE(sqlite3,[ --enable-sqlite3 Enable sqlite3 db backend],
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sqlite3);;
esac ])
AC_ARG_ENABLE(mdns,[ --enable-mdns Enable mDNS support],
[ case "${enableval}" in
yes) ;;
no) rend_avahi=false; CPPFLAGS="${CPPFLAGS} -DWITHOUT_MDNS";;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-mdns);;
esac ])
AC_ARG_ENABLE(nslu2,[ --enable-nslu2 Build for NSLU2/uNSLUng],
CFLAGS="${CFLAGS} -DNSLU2")
AC_ARG_ENABLE(avahi,[ --enable-avahi Use avahi 0.6 or later],
[ case "${enableval}" in
yes) PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6 ]);
rend_avahi=true; LDFLAGS="${LDFLAGS} $AVAHI_LIBS";
CPPFLAGS="${CPPFLAGS} $AVAHI_CFLAGS -DWITH_AVAHI";;
no) rend_avahi=false;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-avahi);;
esac ])
AC_ARG_ENABLE(oggvorbis,[ --enable-oggvorbis Enable Ogg/Vorbis support],
[ case "${enableval}" in
yes) use_oggvorbis=true;
@ -110,7 +94,6 @@ AC_ARG_ENABLE(upnp,[ --enable-upnp Enable upnp support],
AC_ARG_ENABLE(ssl,[ --enable-ssl Enable SSL support in web server],
CPPFLAGS="${CPPFLAGS} -DUSE_SSL"; use_ssl=true; )
AM_CONDITIONAL(COND_REND_AVAHI, test x$rend_avahi = xtrue)
AM_CONDITIONAL(COND_OGGVORBIS, test x$use_oggvorbis = xtrue)
AM_CONDITIONAL(COND_FLAC, test x$use_flac = xtrue)
AM_CONDITIONAL(COND_MUSEPACK, test x$use_musepack = xtrue)
@ -142,6 +125,8 @@ echo Host type is $host
CPPFLAGS="$CPPFLAGS -DHOST='\"$host\"'"
dnl Checks for libraries.
PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6.24 ])
AC_ARG_WITH(static-libs,
[--with-static-libs[[=DIR]] use static libs in DIR],[
if test "$withval" != "no" -a "$withval" != "yes"; then

View File

@ -5,12 +5,6 @@ SUBDIRS = plugins
sbin_PROGRAMS = mt-daapd
bin_PROGRAMS = wavstreamer
LDADD=
if COND_REND_AVAHI
ARENDSRC=rend-avahi.c
endif
if COND_OGGVORBIS
OGGVORBISSRC=scan-ogg.c
endif
@ -38,6 +32,8 @@ endif
wavstreamer_SOURCES = wavstreamer.c
mt_daapd_CPPFLAGS = @AVAHI_CFLAGS@
mt_daapd_LDADD = @AVAHI_LIBS@
mt_daapd_SOURCES = main.c daapd.h rend.h webserver.c \
webserver.h configfile.c configfile.h err.c err.h restart.c restart.h \
mp3-scanner.h mp3-scanner.c \
@ -49,7 +45,8 @@ mt_daapd_SOURCES = main.c daapd.h rend.h webserver.c \
os-unix.h os-unix.c os.h plugin.c plugin.h db-sql-updates.c \
ssl.h io.h io.c io-errors.h io-plugin.h \
bsd-snprintf.c bsd-snprintf.h \
$(ARENDSRC) $(OGGVORBISSRC) \
rend-avahi.c \
$(OGGVORBISSRC) \
$(FLACSRC) $(MUSEPACKSRC) $(SQLITE3DB) $(SQLDB) \
$(UPNP)

View File

@ -59,10 +59,7 @@
#include "restart.h"
#include "xml-rpc.h"
#include "upnp.h"
#ifndef WITHOUT_MDNS
# include "rend.h"
#endif
#include "rend.h"
/*
@ -661,10 +658,8 @@ void config_emit_literal(WS_CONNINFO *pwsc, void *value, char *arg) {
* \param arg any args passwd with the meta command. Also unused
*/
void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) {
#ifndef WITHOUT_MDNS
int mdns_running;
char *html;
#endif
char buf[256];
int r_days, r_hours, r_mins, r_secs;
int scanning;
@ -674,7 +669,7 @@ void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) {
ws_writefd(pwsc,"<th align=\"left\">Status</th><th align=\"left\">Control</th></tr>\n");
ws_writefd(pwsc,"<tr><td>Rendezvous</td>");
#ifndef WITHOUT_MDNS
if(config.use_mdns) {
mdns_running=!rend_running();
@ -689,9 +684,6 @@ void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) {
} else {
ws_writefd(pwsc,"<td>Not configured</td><td>&nbsp;</td></tr>\n");
}
#else
ws_writefd(pwsc,"<td>No Support</td><td>&nbsp;</td></tr>\n");
#endif
ws_writefd(pwsc,"<tr><td>DAAP Server</td><td>%s</td>",config.stop ? "Stopping":"Running");
if(config.stop) {

View File

@ -89,15 +89,13 @@
#include "plugin.h"
#include "util.h"
#include "upnp.h"
#include "rend.h"
#include "io.h"
#ifdef HAVE_GETOPT_H
# include "getopt.h"
#endif
#ifndef WITHOUT_MDNS
# include "rend.h"
#endif
/** Seconds to sleep before checking for a shutdown or reload */
#define MAIN_SLEEP_INTERVAL 2
@ -485,7 +483,6 @@ int main(int argc, char *argv[]) {
runas = conf_alloc_string("general","runas","nobody");
#ifndef WITHOUT_MDNS
if(config.use_mdns) {
DPRINTF(E_LOG,L_MAIN,"Starting rendezvous daemon\n");
if(rend_init(runas)) {
@ -493,7 +490,6 @@ int main(int argc, char *argv[]) {
strerror(errno));
}
}
#endif
if(!os_init(config.foreground,runas)) {
DPRINTF(E_LOG,L_MAIN,"Could not initialize server\n");
@ -514,11 +510,9 @@ int main(int argc, char *argv[]) {
if(err) {
DPRINTF(E_LOG,L_MAIN|L_DB,"Error opening db: %s\n",perr);
#ifndef WITHOUT_MDNS
if(config.use_mdns) {
rend_stop();
}
#endif
os_deinit();
exit(EXIT_FAILURE);
}
@ -582,7 +576,6 @@ int main(int argc, char *argv[]) {
ws_registerhandler(config.server, "/",main_handler,main_auth,
0,1);
#ifndef WITHOUT_MDNS
if(config.use_mdns) { /* register services */
servername = conf_get_servername();
@ -618,7 +611,6 @@ int main(int argc, char *argv[]) {
free(servername);
free(iface);
}
#endif
end_time=(int) time(NULL);
@ -676,12 +668,10 @@ int main(int argc, char *argv[]) {
DPRINTF(E_LOG,L_MAIN,"Stopping gracefully\n");
#ifndef WITHOUT_MDNS
if(config.use_mdns) {
DPRINTF(E_LOG,L_MAIN|L_REND,"Stopping rendezvous daemon\n");
rend_stop();
}
#endif
#ifdef UPNP
upnp_deinit();

View File

@ -530,15 +530,12 @@ void xml_get_stats(WS_CONNINFO *pwsc) {
xml_output(pxml,"name","Rendezvous");
#ifndef WITHOUT_MDNS
if(config.use_mdns) {
xml_output(pxml,"status",rend_running() ? "Running" : "Stopped"); /* ??? */
} else {
xml_output(pxml,"status","Disabled");
}
#else
ws_writefd(pwsc,"<td>No Support</td><td>&nbsp;</td></tr>\n");
#endif
xml_pop(pxml); /* service */
xml_push(pxml,"service");