[avahi] Re: paths in config.h.in (autoheader)

Trent Lloyd lathiat at bur.st
Wed Jul 6 16:07:51 EST 2005


On Wed, Jul 06, 2005 at 12:24:37AM +0200, Sebastien Estienne wrote:
> here is a patch implementing this
> and fixing AVAHI_RUNTIME_DIR
> if noone has objections, i'll commit.
> to sum up, it allows fully dynamic prefix:
> 
> make prefix=/home/sebest/avahi install

Not really sure about the argument of having this vs how it is, but it
looks fine to me.

with make prefix=, how are the paths compiled into the files modified?
(or are they recompiled when you specify a prefix and re-run isntall)

> On a side note, has anyone objections against renaming avahi in
> avahi-daemon and fixing this in init scripts ?

You mean rename avahi to avahi-daemon in the avahi-daemon dir?

If so, i guess that could be done.


Cheers,
Trent

> 
> 2005/7/4, Sebastien Estienne <sebastien.estienne at gmail.com>:
> > Hello,
> > 
> > Even if it seems to be a common practice to to use config.h to define
> > path for socket or pid file, it also seems to be a "bad" practice as i
> > learnt here:
> > http://www.delorie.com/gnu/docs/autoconf/autoconf_24.html :
> > From this page:
> > " A corollary is that you should not use these variables except in
> > Makefiles. For instance, instead of trying to evaluate datadir in
> > `configure' and hard-coding it in Makefiles using e.g.,
> > `AC_DEFINE_UNQUOTED(DATADIR, "$datadir")', you should add
> > `-DDATADIR="$(datadir)"' to your CPPFLAGS. "
> > 
> > So if noone has objections i'll fix these small problems, following
> > the autoconf manual recommendations
> > 
> > --
> > Sebastien Estienne
> > 
> 
> 
> -- 
> Sebastien Estienne

> Index: avahi-dnsconfd/Makefile.am
> ===================================================================
> --- avahi-dnsconfd/Makefile.am	(revision 163)
> +++ avahi-dnsconfd/Makefile.am	(working copy)
> @@ -21,6 +21,8 @@
>  
>  AM_CFLAGS= \
>  	-I$(top_srcdir) \
> +	-DAVAHI_RUNTIME_DIR=\"$(avahi_runtime_dir)/\" \
> +	-DAVAHI_SOCKET=\"$(avahi_socket)\" \
>  	-DAVAHI_DNSCONF_SCRIPT=\"$(pkgsysconfdir)/dnsconf.action\"
>  
>  # GLIB 2.0
> Index: avahi-daemon/main.c
> ===================================================================
> --- avahi-daemon/main.c	(revision 163)
> +++ avahi-daemon/main.c	(working copy)
> @@ -625,7 +625,7 @@
>  }
>  
>  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 @@
>      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;
>      }
>  
> Index: avahi-daemon/Makefile.am
> ===================================================================
> --- avahi-daemon/Makefile.am	(revision 163)
> +++ avahi-daemon/Makefile.am	(working copy)
> @@ -22,6 +22,8 @@
>  
>  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\"
>  
> Index: configure.ac
> ===================================================================
> --- configure.ac	(revision 163)
> +++ configure.ac	(working copy)
> @@ -90,13 +90,7 @@
>          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
> @@ -219,11 +213,11 @@
>  #
>  # 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 
>  avahi-core.pc 
> Index: avahi-discover/main.c
> ===================================================================
> --- avahi-discover/main.c	(revision 163)
> +++ avahi-discover/main.c	(working copy)
> @@ -253,7 +253,7 @@
>      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);
>      
> Index: avahi-discover/Makefile.am
> ===================================================================
> --- avahi-discover/Makefile.am	(revision 163)
> +++ avahi-discover/Makefile.am	(working copy)
> @@ -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)

> _______________________________________________
> avahi mailing list
> avahi at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi


-- 
Trent Lloyd <lathiat at bur.st>
Bur.st Networking Inc.


More information about the avahi mailing list