From aab15b8d9a9d5d869659915c3d0995929ae4179b Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Thu, 30 Jun 2005 22:55:20 +0000 Subject: [PATCH] * moved AVAHI_RUNTIME_DIR and AVAHI_SOCKET in configure.ac * avahi-dnsconf and avahi use them for pid and socket file * check that ${prefix} is fully expanded in config.h * cosmetic changes in configure.ac git-svn-id: file:///home/lennart/svn/public/avahi/trunk@158 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/Makefile.am | 6 +++--- avahi-daemon/simple-protocol.c | 8 +++----- avahi-dnsconfd/Makefile.am | 4 +--- configure.ac | 24 +++++++++++++++--------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am index 4c943e4..6ad5421 100644 --- a/avahi-daemon/Makefile.am +++ b/avahi-daemon/Makefile.am @@ -19,14 +19,13 @@ pkgsysconfdir=$(sysconfdir)/avahi servicedir=$(pkgsysconfdir)/services -dbusservicedir=$(DBUS_SYS_DIR) AM_CFLAGS= \ -I$(top_srcdir) \ -D_GNU_SOURCE \ -DAVAHI_SERVICE_DIRECTORY=\"$(servicedir)\" \ - -DAVAHI_CONFIG_FILE=\"$(pkgsysconfdir)/avahi.conf\" \ - -DAVAHI_RUNTIME_DIR=\"$(localstatedir)/run/avahi\" + -DAVAHI_CONFIG_FILE=\"$(pkgsysconfdir)/avahi.conf\" + AM_LDADD=-lexpat @@ -67,6 +66,7 @@ pkgdata_DATA = \ if ENABLE_DBUS avahi_SOURCES += dbus-protocol.c dbus-protocol.h +dbusservicedir = $(DBUS_SYS_DIR) dbusservice_DATA = avahi-dbus.conf EXTRA_DIST = $(dbusservice_DATA) diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c index 274568c..87c9ee6 100644 --- a/avahi-daemon/simple-protocol.c +++ b/avahi-daemon/simple-protocol.c @@ -41,8 +41,6 @@ #define BUFFER_SIZE (20*1024) -#define UNIX_SOCKET AVAHI_RUNTIME_DIR "/socket" - #define CLIENTS_MAX 50 typedef struct Client Client; @@ -423,14 +421,14 @@ int simple_protocol_setup(GMainContext *c) { memset(&sa, 0, sizeof(sa)); sa.sun_family = AF_LOCAL; - strncpy(sa.sun_path, UNIX_SOCKET, sizeof(sa.sun_path)-1); + strncpy(sa.sun_path, AVAHI_SOCKET, sizeof(sa.sun_path)-1); /* We simply remove existing UNIX sockets under this name. The Avahi daemons makes sure that it runs only once on a host, therefore sockets that already exist are stale and may be removed without any ill effects */ - unlink(UNIX_SOCKET); + unlink(AVAHI_SOCKET); if (bind(server->fd, &sa, sizeof(sa)) < 0) { avahi_log_warn("bind(): %s", strerror(errno)); @@ -471,7 +469,7 @@ void simple_protocol_shutdown(void) { client_free(server->clients); if (server->bind_successful) - unlink(UNIX_SOCKET); + unlink(AVAHI_SOCKET); if (server->fd >= 0) close(server->fd); diff --git a/avahi-dnsconfd/Makefile.am b/avahi-dnsconfd/Makefile.am index 8a0787a..d3bd833 100644 --- a/avahi-dnsconfd/Makefile.am +++ b/avahi-dnsconfd/Makefile.am @@ -22,9 +22,7 @@ pkgsysconfdir=$(sysconfdir)/avahi AM_CFLAGS= \ -I$(top_srcdir) \ -D_GNU_SOURCE \ - -DAVAHI_DNSCONF_SCRIPT=\"$(pkgsysconfdir)/dnsconf.action\" \ - -DAVAHI_SOCKET=\"$(localstatedir)/run/avahi/socket\" \ - -DAVAHI_RUNTIME_DIR=\"$(localstatedir)/run\" + -DAVAHI_DNSCONF_SCRIPT=\"$(pkgsysconfdir)/dnsconf.action\" # GLIB 2.0 AM_CFLAGS+=$(GLIB20_CFLAGS) diff --git a/configure.ac b/configure.ac index 1cedd10..05b48c1 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,7 @@ AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +AC_PROG_GCC_TRADITIONAL # libtool stuff AC_PROG_LIBTOOL @@ -51,11 +52,12 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stdlib.h AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME +AC_HEADER_SYS_WAIT # Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_SELECT_ARGTYPES -AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strerror strrchr strstr uname setresuid setreuid]) +AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid]) AC_FUNC_CHOWN AC_FUNC_STAT @@ -89,14 +91,12 @@ if test "x$ENABLE_GTK" = "xyes"; then DATADIRNAME=share if test "x${prefix}" = "xNONE"; then - AC_DEFINE_UNQUOTED(INTERFACES_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/interfaces/", [path where glade files will be installed]) interfacesdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/interfaces/" - AC_SUBST(interfacesdir) else - AC_DEFINE_UNQUOTED(INTERFACES_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}/interfaces/", [path where glade files will be installed]) interfacesdir="${prefix}/${DATADIRNAME}/${PACKAGE}/interfaces/" - AC_SUBST(interfacesdir) fi + AC_DEFINE_UNQUOTED(INTERFACES_DIR, "${interfacesdir}", [path where glade files will be installed]) + AC_SUBST(interfacesdir) fi AM_CONDITIONAL(ENABLE_GTK, test "x$ENABLE_GTK" = "xyes") @@ -134,7 +134,7 @@ if test "x$ENABLE_DBUS" = "xyes"; then DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d" fi AC_SUBST(DBUS_SYS_DIR) - AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, "$DBUS_SYS_DIR", [Where system.d dir for DBUS is]) + AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, `eval echo $DBUS_SYS_DIR` , [Where system.d dir for DBUS is]) if pkg-config dbus-1 --atleast-version=0.30 ; then AC_DEFINE(DBUS_USE_NEW_API, 1, [Whether to use the new API for DBUS 0.30]) @@ -184,9 +184,7 @@ if test "z$with_distro" = "z"; then exit 1 else case $with_distro in - debian) - ;; - gentoo) + debian|gentoo) ;; *) echo "Your distribution (${with_distro}) is not yet supported! (patches welcome)" @@ -222,6 +220,14 @@ fi AC_SUBST(AVAHI_GROUP) AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi]) +# +# Avahi runtime dir +# +avahi_runtime_dir=`eval echo ${localstatedir}/run/avahi` +AC_DEFINE_UNQUOTED(AVAHI_RUNTIME_DIR, "${avahi_runtime_dir}", [path where pid and socket will be stored]) +AC_DEFINE_UNQUOTED(AVAHI_SOCKET, "${avahi_runtime_dir}/socket", [path for avahi socket]) + + AC_CONFIG_FILES([ Makefile avahi-core.pc -- 2.39.5