1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

New configure option --with-systemduserunitdir

* configure.ac (systemduserunitdir): New variable and option.
* Makefile.in (systemduserunitdir): New, set by configure.
(install-etc, uninstall): Don't install emacs.service when
systemduserunitdir is unspecified.
* etc/NEWS: Announce the new configure option.  (Bug#76924)
This commit is contained in:
Ulrich Müller 2025-03-13 21:06:01 +01:00
parent f2f1fb7fe0
commit 5dc0981875
3 changed files with 32 additions and 13 deletions

View file

@ -160,7 +160,7 @@ sharedstatedir=@sharedstatedir@
# a subdirectory of this.
libexecdir=@libexecdir@
# Currently only used for the systemd service file.
# Where to install object code libraries. Used for ELN_DESTDIR.
libdir=@libdir@
# Where to install emacs-module.h.
@ -207,15 +207,7 @@ desktopdir=$(datarootdir)/applications
metainfodir=$(datarootdir)/metainfo
# Where the etc/emacs.service file is to be installed.
# The system value (typically /usr/lib/systemd/user) can be
# obtained with: pkg-config --variable=systemduserunitdir systemd
# but that does not respect configure's prefix.
# It is not clear where we should install this file when
# prefix != /usr (or /usr/local?) (eg for non-root installs).
# Other options include ~/.config/systemd/user/,
# $XDG_RUNTIME_DIR/systemd/user/
# It seems the user may end up having to make a manual link...
systemdunitdir=$(libdir)/systemd/user
systemduserunitdir=@systemduserunitdir@
# Where the etc/images/icons/hicolor directory is to be installed.
icondir=$(datarootdir)/icons
@ -886,14 +878,16 @@ install-etc:
${srcdir}/etc/emacs.metainfo.xml > $${tmp}; \
${INSTALL_DATA} $${tmp} "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"; \
rm -f $${tmp}
umask 022; $(MKDIR_P) "$(DESTDIR)$(systemdunitdir)"
ifneq ($(systemduserunitdir),)
umask 022; $(MKDIR_P) "$(DESTDIR)$(systemduserunitdir)"
tmp=etc/emacs.tmpservice; rm -f $${tmp}; \
sed -e '/^##/d' \
-e "/^Documentation/ s/emacs(1)/${EMACS_NAME}(1)/" \
-e "/^ExecStart/ s|emacs|${bindir}/${EMACS}|" \
${srcdir}/etc/emacs.service > $${tmp}; \
$(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"; \
$(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemduserunitdir)/${EMACS_NAME}.service"; \
rm -f $${tmp}
endif
thisdir=`pwd -P`; \
cd ${iconsrcdir} || exit 1; umask 022 ; \
for dir in */*/apps */*/mimetypes; do \
@ -977,7 +971,9 @@ uninstall: uninstall-$(NTDIR) uninstall-doc uninstall-gsettings-schemas
fi)
-rm -f "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"
-rm -f "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"
-rm -f "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"
ifneq ($(systemduserunitdir),)
-rm -f "$(DESTDIR)$(systemduserunitdir)/${EMACS_NAME}.service"
endif
ifneq (,$(use_gamedir))
for file in snake-scores tetris-scores; do \
file="$(DESTDIR)${gamedir}/$${file}"; \

View file

@ -481,6 +481,24 @@ AC_SUBST([HAVE_PDUMPER])
DUMPING=$with_dumping
AC_SUBST([DUMPING])
dnl Where the etc/emacs.service file is to be installed.
dnl We use $(prefix)/lib/systemd/user as default, but this may not be
dnl in systemd's search path when prefix is neither /usr nor /usr/local.
dnl In that case (e.g. for non-root installs) the location can be
dnl specified with the configure option.
dnl See https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#id-1.8.5
dnl for documentation of systemd's unit file load path.
AC_ARG_WITH([systemduserunitdir],
[AS_HELP_STRING([--with-systemduserunitdir=DIR],
[directory for systemd user unit file;
default 'PREFIX/usr/lib/systemd/user'])],
[systemduserunitdir=${withval}],
[systemduserunitdir='${prefix}/lib/systemd/user'])
if test "${systemduserunitdir}" = "no"; then
systemduserunitdir=''
fi
AC_SUBST([systemduserunitdir])
dnl FIXME currently it is not the last.
dnl This should be the last --with option, because --with-x is
dnl added later on when we find the file name of X, and it's best to

View file

@ -37,6 +37,11 @@ host system supports SSE2) or '-fno-tree-sra' (if not). These GCC
options work around GCC bug 58416, which can cause Emacs to behave
incorrectly in rare cases.
---
** New configure option '--with-systemduserunitdir'.
This allows to specify the directory where the user unit file for
systemd is installed; default is '${prefix}/usr/lib/systemd/user'.
* Startup Changes in Emacs 31.1