[avahi] [PATCH] make building with --disable-static and DBUS work

Nix nix at esperi.org.uk
Wed Nov 23 17:33:12 PST 2005

Right now (well, as of Avahi 0.6), avahi's building two libraries for
libdbus-common; one with -fPIC enabled and one not. It's building both
of these with --all-static in an apparent attempt to force a convenience
library build.

However, that's not what --all-static does; you end up with a library
which when --disable-static is specified is *empty*, so avahi-daemon and
avahi-client fail to build.

This patch fixes that, ditches the mostly useless no-fpic version (who
cares if a tiny bit of rarely-executed code in a root daemon is PIC?
Most distributors these days will build network-exposed daemons such as
Avahi as position-independent executables anyway) and renames the
libraries to something more obviously Avahiish. (You might not want the
latter; I did it out of paranoia in case my changes led to the library
somehow being installed ;) )

(as an aside, it would be nice if there were some way to email patches
like this without first having to subscribe to a mailing list. This is
the only piece of free software I've ever used that doesn't have *some*
non-subscription email contact address for patches and the like. Even
the rejection message is unfriendly, saying that I am `not allowed' to
send messages to the list, but not saying that this is because I'm not

Index: avahi-daemon/Makefile.am
--- avahi-daemon/Makefile.am	(revision 1025)
+++ avahi-daemon/Makefile.am	(working copy)
@@ -101,7 +101,7 @@
 avahi_daemon_LDADD += \
-	../avahi-common/libdbus-common.la \
+	../avahi-common/libavahi-dbus-common.la \
 avahi_daemon_CFLAGS += $(DBUS_CFLAGS)
Index: avahi-client/Makefile.am
--- avahi-client/Makefile.am	(revision 1025)
+++ avahi-client/Makefile.am	(working copy)
@@ -50,7 +50,7 @@
 	xdg-config.c xdg-config.h
-libavahi_client_la_LIBADD = $(AM_LDADD) $(DBUS_LIBS) ../avahi-common/libavahi-common.la ../avahi-common/libdbus-common-pic.la
+libavahi_client_la_LIBADD = $(AM_LDADD) $(DBUS_LIBS) ../avahi-common/libavahi-common.la ../avahi-common/libavahi-dbus-common.la
 libavahi_client_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_CLIENT_VERSION_INFO)
 client_test_SOURCES = client-test.c
Index: avahi-common/Makefile.am
--- avahi-common/Makefile.am	(revision 1025)
+++ avahi-common/Makefile.am	(working copy)
@@ -108,18 +108,13 @@
 noinst_LTLIBRARIES = \
-	libdbus-common.la \
-	libdbus-common-pic.la
+	libavahi-dbus-common.la
-libdbus_common_la_SOURCES = \
+libavahi_dbus_common_la_SOURCES = \
 	dbus-watch-glue.h dbus-watch-glue.c \
 	dbus.h dbus.c
-libdbus_common_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
-libdbus_common_la_LDFLAGS = $(AM_LDFLAGS) -all-static
+libavahi_dbus_common_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
+libavahi_dbus_common_la_LDFLAGS = $(AM_LDFLAGS)
-libdbus_common_pic_la_SOURCES = $(libdbus_common_la_SOURCES)
-libdbus_common_pic_la_CFLAGS = $(libdbus_common_la_CFLAGS) -fPIC
-libdbus_common_pic_la_LDFLAGS = $(libdbus_common_la_LDFLAGS)

`Y'know, London's nice at this time of year. If you like your cities
 freezing cold and full of surly gits.' --- David Damerell

More information about the avahi mailing list