From 22fe7d9e72e7b021da82c2bd16f4d1e120046260 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 12 Jun 2007 18:47:53 +0200 Subject: [PATCH] unixsock plugin: Set default path of the UNIX socket to $localstatedir. For this purpose LOCALSTATEDIR is defined to $localstatedir during compilation. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- src/Makefile.am | 3 ++- src/collectd.h | 4 ++++ src/unixsock.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 1007dbc5..f7168a99 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,6 +25,7 @@ collectd_SOURCES = collectd.c collectd.h \ collectd_CPPFLAGS = $(LTDLINCL) collectd_CPPFLAGS += -DPREFIX='"${prefix}"' collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' +collectd_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"' collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"' if BUILD_FEATURE_DAEMON collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"' @@ -527,7 +528,7 @@ endif if BUILD_MODULE_UNIXSOCK pkglib_LTLIBRARIES += unixsock.la unixsock_la_SOURCES = unixsock.c -unixsock_la_CPPFLAGS = -DPREFIX='"${prefix}"' +unixsock_la_CPPFLAGS = -DLOCALSTATEDIR='"${localstatedir}"' unixsock_la_LDFLAGS = -module -avoid-version -lpthread collectd_LDADD += "-dlopen" unixsock.la collectd_DEPENDENCIES += unixsock.la diff --git a/src/collectd.h b/src/collectd.h index ac755161..282e6325 100644 --- a/src/collectd.h +++ b/src/collectd.h @@ -182,6 +182,10 @@ #define CONFIGFILE SYSCONFDIR"/collectd.conf" #endif +#ifndef LOCALSTATEDIR +#define LOCALSTATEDIR PREFIX "/var" +#endif + #ifndef PKGLOCALSTATEDIR #define PKGLOCALSTATEDIR PREFIX "/var/lib/" PACKAGE_NAME #endif diff --git a/src/unixsock.c b/src/unixsock.c index 215abdd0..6302b17f 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -36,7 +36,7 @@ # define UNIX_PATH_MAX sizeof (((struct sockaddr_un *)0)->sun_path) #endif -#define US_DEFAULT_PATH PREFIX"/var/run/"PACKAGE_NAME"-unixsock" +#define US_DEFAULT_PATH LOCALSTATEDIR"/run/"PACKAGE_NAME"-unixsock" /* * Private data structures -- 2.30.2