provide switches for TCP and unix sockets
autoconf flags for enabling and disabling TCP and unix domain socket support. Embedded machines without a TCP stack may be better off without TCP support. git-svn-id: https://svn.musicpd.org/mpd/trunk@7236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
d4f319deaf
commit
86d6ba077b
36
configure.ac
36
configure.ac
|
@ -65,6 +65,8 @@ AC_ARG_ENABLE(ao,[ --enable-ao enable support for libao (default: d
|
||||||
AC_ARG_ENABLE(shout,[ --disable-shout disable support for streaming through shout (default: enable)],[enable_shout=$enableval],[enable_shout=yes])
|
AC_ARG_ENABLE(shout,[ --disable-shout disable support for streaming through shout (default: enable)],[enable_shout=$enableval],[enable_shout=yes])
|
||||||
AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support (default: enable)],[enable_iconv=$enableval],[enable_iconv=yes])
|
AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support (default: enable)],[enable_iconv=$enableval],[enable_iconv=yes])
|
||||||
AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support (default: enable)],[enable_ipv6=$enableval],[enable_ipv6=yes])
|
AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support (default: enable)],[enable_ipv6=$enableval],[enable_ipv6=yes])
|
||||||
|
AC_ARG_ENABLE(tcp,[ --disable-tcp disable support for clients connecting via TCP (default: enable)],[enable_tcp=$enableval],[enable_tcp=yes])
|
||||||
|
AC_ARG_ENABLE(un,[ --enable-un enable support for clients connecting via unix domain sockets (default: disable)],[enable_un=$enableval],[enable_un=no])
|
||||||
AC_ARG_ENABLE(oss,[ --disable-oss disable OSS support (default: enable)],[enable_oss=$enableval],[enable_oss=yes])
|
AC_ARG_ENABLE(oss,[ --disable-oss disable OSS support (default: enable)],[enable_oss=$enableval],[enable_oss=yes])
|
||||||
AC_ARG_ENABLE(alsa,[ --disable-alsa disable ALSA support (default: enable)],[enable_alsa=$enableval],[enable_alsa=yes])
|
AC_ARG_ENABLE(alsa,[ --disable-alsa disable ALSA support (default: enable)],[enable_alsa=$enableval],[enable_alsa=yes])
|
||||||
AC_ARG_ENABLE(jack,[ --disable-jack disable jack support (default: enable)],[enable_jack=$enableval],[enable_jack=yes])
|
AC_ARG_ENABLE(jack,[ --disable-jack disable jack support (default: enable)],[enable_jack=$enableval],[enable_jack=yes])
|
||||||
|
@ -132,6 +134,11 @@ dnl AC_CHECK_HEADER(langinfo.h,[enable_langinfo=yes;AC_DEFINE(HAVE_LANGINFO,1,[D
|
||||||
AM_LANGINFO_CODESET
|
AM_LANGINFO_CODESET
|
||||||
AC_CHECK_HEADER(locale.h,[enable_locale=yes;AC_DEFINE(HAVE_LOCALE,1,[Define if locale.h is present])],enable_locale=no)
|
AC_CHECK_HEADER(locale.h,[enable_locale=yes;AC_DEFINE(HAVE_LOCALE,1,[Define if locale.h is present])],enable_locale=no)
|
||||||
|
|
||||||
|
if test x$enable_tcp = xno; then
|
||||||
|
# if we don't support TCP, we don't need IPv6 either
|
||||||
|
enable_ipv6=no
|
||||||
|
fi
|
||||||
|
|
||||||
if test x$enable_ipv6 = xyes; then
|
if test x$enable_ipv6 = xyes; then
|
||||||
AC_MSG_CHECKING(for ipv6)
|
AC_MSG_CHECKING(for ipv6)
|
||||||
AC_EGREP_CPP([AP_maGiC_VALUE],
|
AC_EGREP_CPP([AP_maGiC_VALUE],
|
||||||
|
@ -151,6 +158,14 @@ AP_maGiC_VALUE
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x$enable_tcp = xyes; then
|
||||||
|
AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x$enable_un = xyes; then
|
||||||
|
AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
|
||||||
|
fi
|
||||||
|
|
||||||
enable_osx=no
|
enable_osx=no
|
||||||
case $host in
|
case $host in
|
||||||
*-darwin*)
|
*-darwin*)
|
||||||
|
@ -638,6 +653,27 @@ echo ""
|
||||||
echo "########### MPD CONFIGURATION ############"
|
echo "########### MPD CONFIGURATION ############"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
echo " Client Support:"
|
||||||
|
if test x$enable_tcp = xyes; then
|
||||||
|
echo " TCP support ...................enabled"
|
||||||
|
else
|
||||||
|
echo " TCP support ...................disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x$enable_un = xyes; then
|
||||||
|
echo " Unix domain socket support ....enabled"
|
||||||
|
else
|
||||||
|
echo " Unix domain socket support ....disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if
|
||||||
|
test x$enable_tcp = xno &&
|
||||||
|
test x$enable_un = xno; then
|
||||||
|
AC_MSG_ERROR([No client interfaces configured!])
|
||||||
|
fi
|
||||||
|
|
||||||
echo " Playback Support:"
|
echo " Playback Support:"
|
||||||
if test x$enable_ao = xyes; then
|
if test x$enable_ao = xyes; then
|
||||||
echo " libao support .................enabled"
|
echo " libao support .................enabled"
|
||||||
|
|
|
@ -245,6 +245,7 @@ void openAInterface(int fd, struct sockaddr *addr)
|
||||||
} else {
|
} else {
|
||||||
const char *hostname;
|
const char *hostname;
|
||||||
switch (addr->sa_family) {
|
switch (addr->sa_family) {
|
||||||
|
#ifdef HAVE_TCP
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
hostname = (const char *)inet_ntoa(((struct sockaddr_in *)
|
hostname = (const char *)inet_ntoa(((struct sockaddr_in *)
|
||||||
addr)->sin_addr);
|
addr)->sin_addr);
|
||||||
|
@ -267,9 +268,12 @@ void openAInterface(int fd, struct sockaddr *addr)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* HAVE_TCP */
|
||||||
|
#ifdef HAVE_UN
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
hostname = "local connection";
|
hostname = "local connection";
|
||||||
break;
|
break;
|
||||||
|
#endif /* HAVE_UN */
|
||||||
default:
|
default:
|
||||||
hostname = "unknown";
|
hostname = "unknown";
|
||||||
}
|
}
|
||||||
|
|
16
src/listen.c
16
src/listen.c
|
@ -74,6 +74,7 @@ static int establishListen(const struct sockaddr *addrp, socklen_t addrlen)
|
||||||
int allowReuse = ALLOW_REUSE;
|
int allowReuse = ALLOW_REUSE;
|
||||||
|
|
||||||
switch (addrp->sa_family) {
|
switch (addrp->sa_family) {
|
||||||
|
#ifdef HAVE_TCP
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
pf = PF_INET;
|
pf = PF_INET;
|
||||||
break;
|
break;
|
||||||
|
@ -82,9 +83,12 @@ static int establishListen(const struct sockaddr *addrp, socklen_t addrlen)
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* HAVE_TCP */
|
||||||
|
#ifdef HAVE_UN
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
pf = PF_UNIX;
|
pf = PF_UNIX;
|
||||||
break;
|
break;
|
||||||
|
#endif /* HAVE_UN */
|
||||||
default:
|
default:
|
||||||
FATAL("unknown address family: %i\n", addrp->sa_family);
|
FATAL("unknown address family: %i\n", addrp->sa_family);
|
||||||
}
|
}
|
||||||
|
@ -123,6 +127,7 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
|
||||||
{
|
{
|
||||||
const struct sockaddr *addrp;
|
const struct sockaddr *addrp;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
|
#ifdef HAVE_TCP
|
||||||
struct sockaddr_in sin4;
|
struct sockaddr_in sin4;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
struct sockaddr_in6 sin6;
|
struct sockaddr_in6 sin6;
|
||||||
|
@ -135,8 +140,10 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
|
||||||
memset(&sin4, 0, sizeof(struct sockaddr_in));
|
memset(&sin4, 0, sizeof(struct sockaddr_in));
|
||||||
sin4.sin_port = htons(port);
|
sin4.sin_port = htons(port);
|
||||||
sin4.sin_family = AF_INET;
|
sin4.sin_family = AF_INET;
|
||||||
|
#endif /* HAVE_TCP */
|
||||||
|
|
||||||
if (!param || 0 == strcmp(param->value, "any")) {
|
if (!param || 0 == strcmp(param->value, "any")) {
|
||||||
|
#ifdef HAVE_TCP
|
||||||
DEBUG("binding to any address\n");
|
DEBUG("binding to any address\n");
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
if (useIpv6) {
|
if (useIpv6) {
|
||||||
|
@ -157,6 +164,10 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
|
||||||
#endif
|
#endif
|
||||||
BINDERROR();
|
BINDERROR();
|
||||||
}
|
}
|
||||||
|
#else /* HAVE_TCP */
|
||||||
|
FATAL("TCP support is disabled\n");
|
||||||
|
#endif /* HAVE_TCP */
|
||||||
|
#ifdef HAVE_UN
|
||||||
} else if (param->value[0] == '/') {
|
} else if (param->value[0] == '/') {
|
||||||
size_t path_length;
|
size_t path_length;
|
||||||
struct sockaddr_un sun;
|
struct sockaddr_un sun;
|
||||||
|
@ -173,7 +184,9 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
|
||||||
|
|
||||||
if (establishListen(addrp, addrlen) < 0)
|
if (establishListen(addrp, addrlen) < 0)
|
||||||
BINDERROR();
|
BINDERROR();
|
||||||
|
#endif /* HAVE_UN */
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef HAVE_TCP
|
||||||
struct hostent *he;
|
struct hostent *he;
|
||||||
DEBUG("binding to address for %s\n", param->value);
|
DEBUG("binding to address for %s\n", param->value);
|
||||||
if (!(he = gethostbyname(param->value))) {
|
if (!(he = gethostbyname(param->value))) {
|
||||||
|
@ -207,6 +220,9 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
|
||||||
|
|
||||||
if (establishListen(addrp, addrlen) < 0)
|
if (establishListen(addrp, addrlen) < 0)
|
||||||
BINDERROR();
|
BINDERROR();
|
||||||
|
#else /* HAVE_TCP */
|
||||||
|
FATAL("TCP support is disabled\n");
|
||||||
|
#endif /* HAVE_TCP */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/un.h>
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -75,4 +74,8 @@
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_UN
|
||||||
|
#include <sys/un.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* OS_COMPAT_H */
|
#endif /* OS_COMPAT_H */
|
||||||
|
|
Loading…
Reference in New Issue