From aaa1c563f5f89f3f1e333a031cf71056fdc50e5e Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Wed, 6 Jul 2005 15:46:31 +0000 Subject: [PATCH] * cleaned configure.ac * fix Avahi runtime dir * use AM_CFLAGS instead of config.h.in to define paths (interfaces, socket, pid) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@165 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/Makefile.am | 2 ++ avahi-daemon/main.c | 12 ++++++------ avahi-discover/Makefile.am | 3 ++- avahi-discover/main.c | 2 +- avahi-dnsconfd/Makefile.am | 2 ++ configure.ac | 17 +++++------------ 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am index 3762ba5..2f09490 100644 --- a/avahi-daemon/Makefile.am +++ b/avahi-daemon/Makefile.am @@ -22,6 +22,8 @@ servicedir=$(pkgsysconfdir)/services AM_CFLAGS= \ -I$(top_srcdir) \ + -DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \ + -DAVAHI_SOCKET=\"$(avahi_socket)\" \ -DAVAHI_SERVICE_DIRECTORY=\"$(servicedir)\" \ -DAVAHI_CONFIG_FILE=\"$(pkgsysconfdir)/avahi.conf\" diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index ce82664..ab17a9c 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -625,7 +625,7 @@ static gint drop_root(void) { } static const char* pid_file_proc(void) { - return AVAHI_RUNTIME_DIR"/avahi-daemon.pid"; + return AVAHI_DAEMON_RUNTIME_DIR"/pid"; } static gint make_runtime_dir(void) { @@ -649,20 +649,20 @@ static gint make_runtime_dir(void) { u = umask(0000); reset_umask = TRUE; - if (mkdir(AVAHI_RUNTIME_DIR, 0755) < 0 && errno != EEXIST) { - avahi_log_error("mkdir(\""AVAHI_RUNTIME_DIR"\"): %s", strerror(errno)); + if (mkdir(AVAHI_DAEMON_RUNTIME_DIR, 0755) < 0 && errno != EEXIST) { + avahi_log_error("mkdir(\""AVAHI_DAEMON_RUNTIME_DIR"\"): %s", strerror(errno)); goto fail; } - chown(AVAHI_RUNTIME_DIR, pw->pw_uid, gr->gr_gid); + chown(AVAHI_DAEMON_RUNTIME_DIR, pw->pw_uid, gr->gr_gid); - if (stat(AVAHI_RUNTIME_DIR, &st) < 0) { + if (stat(AVAHI_DAEMON_RUNTIME_DIR, &st) < 0) { avahi_log_error("stat(): %s\n", strerror(errno)); goto fail; } if (!S_ISDIR(st.st_mode) || st.st_uid != pw->pw_uid || st.st_gid != gr->gr_gid) { - avahi_log_error("Failed to create runtime directory "AVAHI_RUNTIME_DIR"."); + avahi_log_error("Failed to create runtime directory "AVAHI_DAEMON_RUNTIME_DIR"."); goto fail; } diff --git a/avahi-discover/Makefile.am b/avahi-discover/Makefile.am index 338f528..7890522 100644 --- a/avahi-discover/Makefile.am +++ b/avahi-discover/Makefile.am @@ -17,7 +17,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. -AM_CFLAGS=-I$(top_srcdir) +AM_CFLAGS=-I$(top_srcdir) \ + -DAVAHI_INTERFACES_DIR=\"$(interfacesdir)\" AM_CFLAGS+=$(GLIB20_CFLAGS) $(GTK20_CFLAGS) $(GLADE20_CFLAGS) AM_LDADD=$(GLIB20_LIBS) $(GTK20_LIBS) $(GLADE20_LIBS) diff --git a/avahi-discover/main.c b/avahi-discover/main.c index 05ad967..5e99bf8 100644 --- a/avahi-discover/main.c +++ b/avahi-discover/main.c @@ -253,7 +253,7 @@ int main(int argc, char *argv[]) { gtk_init(&argc, &argv); glade_init(); - xml = glade_xml_new(INTERFACES_DIR"avahi-discover.glade", NULL, NULL); + xml = glade_xml_new(AVAHI_INTERFACES_DIR"avahi-discover.glade", NULL, NULL); main_window = glade_xml_get_widget(xml, "main_window"); g_signal_connect(main_window, "delete-event", (GCallback) main_window_on_delete_event, NULL); diff --git a/avahi-dnsconfd/Makefile.am b/avahi-dnsconfd/Makefile.am index 7a2185f..3b3c79e 100644 --- a/avahi-dnsconfd/Makefile.am +++ b/avahi-dnsconfd/Makefile.am @@ -21,6 +21,8 @@ pkgsysconfdir=$(sysconfdir)/avahi AM_CFLAGS= \ -I$(top_srcdir) \ + -DAVAHI_RUNTIME_DIR=\"$(avahi_runtime_dir)/\" \ + -DAVAHI_SOCKET=\"$(avahi_socket)\" \ -DAVAHI_DNSCONF_SCRIPT=\"$(pkgsysconfdir)/dnsconf.action\" # GLIB 2.0 diff --git a/configure.ac b/configure.ac index d477743..e64fcde 100644 --- a/configure.ac +++ b/configure.ac @@ -90,13 +90,7 @@ if test "x$ENABLE_GTK" = "xyes"; then AC_SUBST(GLADE20_CFLAGS) AC_SUBST(GLADE20_LIBS) - DATADIRNAME=share - if test "x${prefix}" = "xNONE"; then - interfacesdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/interfaces/" - else - interfacesdir="${prefix}/${DATADIRNAME}/${PACKAGE}/interfaces/" - fi - AC_DEFINE_UNQUOTED(INTERFACES_DIR, "${interfacesdir}", [path where glade files will be installed]) + interfacesdir="${datadir}/${PACKAGE}/interfaces/" AC_SUBST(interfacesdir) fi @@ -135,7 +129,6 @@ 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, `eval echo $DBUS_SYS_DIR` , [Where system.d dir for DBUS is]) AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) @@ -219,10 +212,10 @@ 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]) - +avahi_runtime_dir="${localstatedir}/run" +avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket" +AC_SUBST(avahi_runtime_dir) +AC_SUBST(avahi_socket) AC_CONFIG_FILES([ Makefile -- 2.39.5