changeset 13490:40c5d0508a1a

[gaim-migrate @ 15866] This is a refactoring of the dbus service directory detection stuff. It was originally taken from guifications and that version had problem when a prefix was specificed to configure. Basically it would always try to install into the system directory regardless of --prefix. Anyways, this new code takes that into consideration. Also, I changed the way gaim.service is generated. It's now created from a .in file and has been relocated to the top of the source tree. committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Sun, 12 Mar 2006 21:09:16 +0000
parents 8b28c8bfb3c0
children 0dbab0e08f2a
files .cvsignore Makefile.am configure.ac gaim.service.in src/.cvsignore src/Makefile.am
diffstat 6 files changed, 58 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/.cvsignore	Sun Mar 12 01:15:54 2006 +0000
+++ b/.cvsignore	Sun Mar 12 21:09:16 2006 +0000
@@ -30,6 +30,7 @@
 win32-install-dir
 .temp-gettextize
 gaim.pc
+gaim.service
 *.apspec
 intltool-extract
 intltool-extract.in
--- a/Makefile.am	Sun Mar 12 01:15:54 2006 +0000
+++ b/Makefile.am	Sun Mar 12 21:09:16 2006 +0000
@@ -5,6 +5,7 @@
 		gaim.spec.in \
 		gaim.apspec.in \
 		gaim.desktop.in \
+		gaim.service.in \
 		gaim-installer.nsi \
 		HACKING \
 		intltool-extract.in \
@@ -31,6 +32,11 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gaim.pc
 
+if ENABLE_DBUS
+dbus_servicedir=$(DBUS_SERVICES_DIR)
+dbus_service_DATA=gaim.service
+endif
+
 dist-hook: gaim.spec
 	cp gaim.spec $(distdir)
 
--- a/configure.ac	Sun Mar 12 01:15:54 2006 +0000
+++ b/configure.ac	Sun Mar 12 21:09:16 2006 +0000
@@ -671,38 +671,55 @@
 	fi
 fi
 
-dnl  Here we locate the directory containing DBus .service files for
-dnl  the session bus.  Adapted from the guifications project.
-
-AC_ARG_WITH(dbus-session-dir, [  --with-dbus-session-dir=<dir>   Location of the D-BUS session directory.])
+dnl ###########################################################################
+dnl # Find the D-Bus services dir.
+dnl #
+dnl # This is a 3 step process that
+dnl #
+dnl # 1. checks if --with-dbus-services was set, if so use that.
+dnl # 2. checks if --prefix was given, if so use that.
+dnl # 3. fallbacks to installing into what should be the correct system
+dnl #    directories.
+dnl #
+dnl # This is still prone to error if one of the legacy directories exist
+dnl # although a newer dbus is installed.  But I have tried to order the
+dnl # directory searching to keep this situation at a minimum.
+dnl ###########################################################################
+AC_ARG_WITH(dbus-services, [  --with-dbus-services=<dir>   Where the D-Bus services directory is located.])
 
-if test "x$enable_dbus" = "xyes" ; then
-    AC_MSG_CHECKING([location of the D-BUS session directory])
-    if ! test -z "$with_dbus_session_dir"; then
-		if ! test -d "$with_dbus_session_dir"; then
-			AC_MSG_WARN([$with_dbus_session_dir does not exist, if this is the correct location please make sure that it exists.])
-			enable_dbus=no
+AC_MSG_CHECKING([location of the D-Bus services directory])
+if ! test -z "$with_dbus_services" ; then
+	if ! test -d "$with_dbus_services" ; then
+		AC_MSG_ERROR([$with_dbus_services does not exist, if this is the correct location please make sure that it exists.])
+	fi
+
+	DBUS_SERVICES_DIR="$with_dbus_services"
+else
+	if test x"$prefix" = x"NONE" ; then
+		dnl # no prefix given, so we look for the correct dbus system paths.
+		dnl # if a prefix is given, we use it.
+
+		serviceprefixes="$datadir $libdir /usr/share /usr/local/share"
+		DBUS_SERVICES_DIR=""
+
+		for d in $serviceprefixes ; do
+			dir="$d/dbus-1/services"
+			if test -d $dir ; then
+				DBUS_SERVICES_DIR="$dir"
+				break
+			fi
+		done
+
+		if test -z $DBUS_SERVICES_DIR ; then
+			AC_MSG_ERROR([D-Bus services directory was not found!  Please use --with-dbus-services and specify it's location.])
 		fi
-		DBUS_SESSION_DIR="$with_dbus_session_dir"
-    else
-	dnl # add more to this as needed
-	servicesprefixes="$DATADIR $LIBDIR /usr/share /usr/local/share"
-	DBUS_SESSION_DIR=""
+	else
+		DBUS_SERVICES_DIR="$datadir/dbus-1/services"
+	fi
+fi
+AC_MSG_RESULT([$DBUS_SERVICES_DIR])
+AC_SUBST(DBUS_SERVICES_DIR)
 
-	for p in $servicesprefixes; do
-	    dir="$p/dbus-1/services"
-	    if test -d $dir; then
-		DBUS_SESSION_DIR="$dir"
-		break
-	    fi
-	done
-
-	if test -z $DBUS_SESSION_DIR; then
-	    AC_MSG_WARN([D-BUS session directory was not found!  Please use --with-dbus-session-dir and specify its location.])
-	    enable_dbus=no
-	fi
-    fi
-fi
 
 if test "x$enable_dbus" = "xyes" ; then
     AC_MSG_RESULT([$DBUS_SESSION_DIR])
@@ -715,11 +732,6 @@
 
 AM_CONDITIONAL(ENABLE_DBUS, test "x$enable_dbus" = "xyes")
 
-
-
-
-
-
 dnl #######################################################################
 dnl # Check for startup notification
 dnl #######################################################################
@@ -1695,6 +1707,7 @@
 AC_OUTPUT([Makefile
 		   Doxyfile
 		   gaim.apspec
+		   gaim.service
 		   doc/Makefile
 		   doc/gaim.1
 		   m4macros/Makefile
@@ -1759,7 +1772,7 @@
 echo Build with GtkSpell support... : $enable_gtkspell
 echo Build with DBUS support....... : $enable_dbus
 if test x$enable_dbus = xyes ; then
-echo DBUS session directory........ : $DBUS_SESSION_DIR
+echo DBUS servies directory........ : $DBUS_SERVICES_DIR
 fi
 echo Build with Cyrus SASL support. : $enable_cyrus_sasl
 echo Has you....................... : yes
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gaim.service.in	Sun Mar 12 21:09:16 2006 +0000
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gaim.GaimService
+Exec=@bindir@/gaim
--- a/src/.cvsignore	Sun Mar 12 01:15:54 2006 +0000
+++ b/src/.cvsignore	Sun Mar 12 21:09:16 2006 +0000
@@ -9,7 +9,6 @@
 gaim.def
 gaim.lib
 gaim.dll
-gaim.service
 gaim-client-bindings.*
 gaim-client-example
 .*.swp
--- a/src/Makefile.am	Sun Mar 12 01:15:54 2006 +0000
+++ b/src/Makefile.am	Sun Mar 12 21:09:16 2006 +0000
@@ -157,8 +157,6 @@
 	xmlnode.h \
 	whiteboard.h
 
-
-
 if ENABLE_DBUS
 
 CLEANFILES = \
@@ -208,7 +206,6 @@
 
 $(libgaim_client_la_OBJECTS): gaim-client-bindings.h gaim-client-bindings.c
 
-
 # gaim-client-example
 
 gaim_client_example_SOURCES = gaim-client-example.c
@@ -229,19 +226,6 @@
 
 bin_SCRIPTS = gaim-remote.py gaim-notifications-example.py gaim-send gaim-send-async
 
-
-# gaim.service
-
-gaim.service:
-	echo "[Gaim]" > $@
-	echo "Name=net.sf.gaim.GaimService" >> $@
-	echo "Exec=$(bindir)/gaim" >> $@
-
-#Ideally, this directory should be autodetected, and the user should
-#be able to specify it as an option to "configure"
-dbus_sessiondir = $(DBUS_SESSION_DIR)
-dbus_session_DATA = gaim.service
-
 endif
 
 bin_PROGRAMS = gaim $(gaim_clientbP)