From 31ff9fc39c18666132f58223a96d5d987c1b01c4 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Sat, 30 Oct 2004 16:42:20 +0000 Subject: [PATCH] add --disable-mdns configure option, in prep for win32 build --- configure.in | 16 ++++++++++++---- src/Makefile.am | 8 ++++---- src/configfile.c | 9 ++++++++- src/main.c | 12 +++++++++++- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/configure.in b/configure.in index 54240758..cbba06b6 100644 --- a/configure.in +++ b/configure.in @@ -14,6 +14,7 @@ AM_PROG_LEX AC_CANONICAL_HOST AM_CONDITIONAL(COND_REND_OSX,false) +rend_posix=true STATIC_LIBS=no CPPFLAGS="${CPPFLAGS} -g" @@ -26,20 +27,27 @@ AC_ARG_ENABLE(debug,[ --enable-debug Enable debugging features], CPPFLAGS="${CPPFLAGS} -Wall") AC_ARG_ENABLE(debug-memory,[ --enable-debug-memory Enable mem leak debugging], CPPFLAGS="${CPPFLAGS} -DDEBUG_MEMORY") +AC_ARG_ENABLE(mdns,[ --enable-mdns Enable mDNS support], + [ case "${enableval}" in + yes) ;; + no) rend_posix=false; rend_howl=false; CPPFLAGS="${CPPFLAGS} -DWITHOUT_MDNS";; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-mdns);; + esac ]) + AC_ARG_ENABLE(efence,[ --enable-efence Enable electric fence], LDFLAGS="${LDFLAGS} -lefence") AC_ARG_ENABLE(nslu2,[ --enable-nslu2 Build for NSLU2/uNSLUng], CFLAGS="${CFLAGS} -DNSLU2") -AC_ARG_ENABLE(new-howl,[ --enable-new-howl Use howl 0.9.2 or later], +AC_ARG_ENABLE(howl,[ --enable-howl Use howl 0.9.2 or later], [ case "${enableval}" in - yes) rend_howl=true; LDFLAGS="${LDFLAGS} -lhowl"; + yes) rend_howl=true; rend_posix=false; LDFLAGS="${LDFLAGS} -lhowl"; CPPFLAGS="${CPPFLAGS} -DWITH_HOWL";; no) rend_howl=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-howl);; esac ],[rend_howl=false]) -AC_ARG_ENABLE(howl,[ --enable-howl Use the howl mDNS library], +AC_ARG_ENABLE(old-howl,[ --enable-old-howl Use the howl mDNS library (pre 0.9.2)], [ case "${enableval}" in yes) rend_howl=true; LDFLAGS="${LDFLAGS} -lrendezvous -lcorby -lsalt"; CPPFLAGS="${CPPFLAGS} -DWITH_HOWL";; @@ -48,7 +56,7 @@ AC_ARG_ENABLE(howl,[ --enable-howl Use the howl mDNS library], esac ],[rend_howl=false]) AM_CONDITIONAL(COND_REND_HOWL, test x$rend_howl = xtrue) -AM_CONDITIONAL(COND_REND_POSIX, test x$rend_howl = xfalse) +AM_CONDITIONAL(COND_REND_POSIX, test x$rend_posix = xtrue) AM_CONDITIONAL(COND_NEED_STRCASESTR,false) AM_CONDITIONAL(COND_NEED_STRSEP,false) diff --git a/src/Makefile.am b/src/Makefile.am index 35f70abf..bef55ae3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,21 +7,21 @@ AM_YFLAGS=-d sbin_PROGRAMS = mt-daapd if COND_REND_POSIX -PRENDSRC=mDNS.c mDNSClientAPI.h mDNSDebug.h mDNSPosix.c mDNSUNP.c rend-posix.c mDNSPlatformFunctions.h +PRENDSRC=mDNS.c mDNSClientAPI.h mDNSDebug.h mDNSPosix.c mDNSUNP.c rend-posix.c mDNSPlatformFunctions.h rend-unix.c endif if COND_REND_HOWL -HRENDSRC=rend-howl.c +HRENDSRC=rend-howl.c rend-unix.c endif if COND_REND_OSX -ORENDSRC=rend-osx.c +ORENDSRC=rend-osx.c rend-unix.c endif mt_daapd_SOURCES = main.c daapd.h rend.h uici.c uici.h webserver.c \ webserver.h configfile.c configfile.h err.c err.h restart.c restart.h \ daap-proto.c daap-proto.h daap.c daap.h db-gdbm.c db-memory.h \ - mp3-scanner.h mp3-scanner.c playlist.c playlist.h rend-unix.c \ + mp3-scanner.h mp3-scanner.c playlist.c playlist.h \ rend-unix.h lexer.l parser.y strcasestr.c strcasestr.h strsep.c \ redblack.c redblack.h dynamic-art.c dynamic-art.h query.c query.h \ $(PRENDSRC) $(ORENDSRC) $(HRENDSRC) diff --git a/src/configfile.c b/src/configfile.c index 06e5d267..fde7d528 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -43,6 +42,10 @@ #include "configfile.h" #include "err.h" +#ifndef WITHOUT_MDNS +# include "rend.h" +#endif + /* * Forwards @@ -550,6 +553,7 @@ void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) { ws_writefd(pwsc,"StatusControl\n"); ws_writefd(pwsc,"Rendezvous"); +#ifndef WITHOUT_MDNS if(config.use_mdns) { mdns_running=!rend_running(); @@ -564,6 +568,9 @@ void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) { } else { ws_writefd(pwsc,"Not configured \n"); } +#else + ws_writefd(pwsc,"No Support \n"); +#endif ws_writefd(pwsc,"DAAP Server%s",config.stop ? "Stopping":"Running"); if(config.stop) { diff --git a/src/main.c b/src/main.c index 6f5369c1..1077fc3c 100644 --- a/src/main.c +++ b/src/main.c @@ -46,11 +46,15 @@ #include "daap-proto.h" #include "err.h" #include "mp3-scanner.h" -#include "rend.h" #include "webserver.h" #include "playlist.h" #include "dynamic-art.h" +#ifndef WITHOUT_MDNS +# include "rend.h" +#endif + + #ifndef DEFAULT_CONFIGFILE #ifdef NSLU2 #define DEFAULT_CONFIGFILE "/opt/etc/mt-daapd.conf" @@ -652,12 +656,14 @@ int main(int argc, char *argv[]) { } +#ifndef WITHOUT_MDNS if((config.use_mdns) && (!parseonly)) { DPRINTF(ERR_LOG,"Starting rendezvous daemon\n"); if(rend_init(config.runas)) { DPRINTF(ERR_FATAL,"Error in rend_init: %s\n",strerror(errno)); } } +#endif /* DWB: we want to detach before we drop privs so the pid file can be created with the original permissions. This has the @@ -731,11 +737,13 @@ int main(int argc, char *argv[]) { ws_registerhandler(server,"^/logout$",daap_handler,NULL,0); ws_registerhandler(server,"^/databases/.*",daap_handler,NULL,0); +#ifndef WITHOUT_MDNS if(config.use_mdns) { /* register services */ DPRINTF(ERR_LOG,"Registering rendezvous names\n"); rend_register(config.servername,"_daap._tcp",config.port); rend_register(config.servername,"_http._tcp",config.port); } +#endif end_time=time(NULL); @@ -773,10 +781,12 @@ int main(int argc, char *argv[]) { DPRINTF(ERR_LOG,"Stopping gracefully\n"); +#ifndef WITHOUT_MDNS if(config.use_mdns) { DPRINTF(ERR_LOG,"Stopping rendezvous daemon\n"); rend_stop(); } +#endif DPRINTF(ERR_LOG,"Stopping web server\n"); ws_stop(server);