aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Müller2025-03-13 21:06:01 +0100
committerUlrich Müller2025-03-14 08:01:47 +0100
commit5dc0981875b64f2ffe38e59871cc34db05ab5f18 (patch)
tree54f6f29322fb11dd2acf367125e6c200edec3864
parentf2f1fb7fe00d6d69fc081f423c1f9dff0f618e36 (diff)
downloademacs-5dc0981875b64f2ffe38e59871cc34db05ab5f18.tar.gz
emacs-5dc0981875b64f2ffe38e59871cc34db05ab5f18.zip
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)
-rw-r--r--Makefile.in22
-rw-r--r--configure.ac18
-rw-r--r--etc/NEWS5
3 files changed, 32 insertions, 13 deletions
diff --git a/Makefile.in b/Makefile.in
index ca6d991bce6..0ba11c9aa5b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -160,7 +160,7 @@ sharedstatedir=@sharedstatedir@
160# a subdirectory of this. 160# a subdirectory of this.
161libexecdir=@libexecdir@ 161libexecdir=@libexecdir@
162 162
163# Currently only used for the systemd service file. 163# Where to install object code libraries. Used for ELN_DESTDIR.
164libdir=@libdir@ 164libdir=@libdir@
165 165
166# Where to install emacs-module.h. 166# Where to install emacs-module.h.
@@ -207,15 +207,7 @@ desktopdir=$(datarootdir)/applications
207metainfodir=$(datarootdir)/metainfo 207metainfodir=$(datarootdir)/metainfo
208 208
209# Where the etc/emacs.service file is to be installed. 209# Where the etc/emacs.service file is to be installed.
210# The system value (typically /usr/lib/systemd/user) can be 210systemduserunitdir=@systemduserunitdir@
211# obtained with: pkg-config --variable=systemduserunitdir systemd
212# but that does not respect configure's prefix.
213# It is not clear where we should install this file when
214# prefix != /usr (or /usr/local?) (eg for non-root installs).
215# Other options include ~/.config/systemd/user/,
216# $XDG_RUNTIME_DIR/systemd/user/
217# It seems the user may end up having to make a manual link...
218systemdunitdir=$(libdir)/systemd/user
219 211
220# Where the etc/images/icons/hicolor directory is to be installed. 212# Where the etc/images/icons/hicolor directory is to be installed.
221icondir=$(datarootdir)/icons 213icondir=$(datarootdir)/icons
@@ -886,14 +878,16 @@ install-etc:
886 ${srcdir}/etc/emacs.metainfo.xml > $${tmp}; \ 878 ${srcdir}/etc/emacs.metainfo.xml > $${tmp}; \
887 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"; \ 879 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"; \
888 rm -f $${tmp} 880 rm -f $${tmp}
889 umask 022; $(MKDIR_P) "$(DESTDIR)$(systemdunitdir)" 881 ifneq ($(systemduserunitdir),)
882 umask 022; $(MKDIR_P) "$(DESTDIR)$(systemduserunitdir)"
890 tmp=etc/emacs.tmpservice; rm -f $${tmp}; \ 883 tmp=etc/emacs.tmpservice; rm -f $${tmp}; \
891 sed -e '/^##/d' \ 884 sed -e '/^##/d' \
892 -e "/^Documentation/ s/emacs(1)/${EMACS_NAME}(1)/" \ 885 -e "/^Documentation/ s/emacs(1)/${EMACS_NAME}(1)/" \
893 -e "/^ExecStart/ s|emacs|${bindir}/${EMACS}|" \ 886 -e "/^ExecStart/ s|emacs|${bindir}/${EMACS}|" \
894 ${srcdir}/etc/emacs.service > $${tmp}; \ 887 ${srcdir}/etc/emacs.service > $${tmp}; \
895 $(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"; \ 888 $(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemduserunitdir)/${EMACS_NAME}.service"; \
896 rm -f $${tmp} 889 rm -f $${tmp}
890 endif
897 thisdir=`pwd -P`; \ 891 thisdir=`pwd -P`; \
898 cd ${iconsrcdir} || exit 1; umask 022 ; \ 892 cd ${iconsrcdir} || exit 1; umask 022 ; \
899 for dir in */*/apps */*/mimetypes; do \ 893 for dir in */*/apps */*/mimetypes; do \
@@ -977,7 +971,9 @@ uninstall: uninstall-$(NTDIR) uninstall-doc uninstall-gsettings-schemas
977 fi) 971 fi)
978 -rm -f "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop" 972 -rm -f "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"
979 -rm -f "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml" 973 -rm -f "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"
980 -rm -f "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service" 974 ifneq ($(systemduserunitdir),)
975 -rm -f "$(DESTDIR)$(systemduserunitdir)/${EMACS_NAME}.service"
976 endif
981 ifneq (,$(use_gamedir)) 977 ifneq (,$(use_gamedir))
982 for file in snake-scores tetris-scores; do \ 978 for file in snake-scores tetris-scores; do \
983 file="$(DESTDIR)${gamedir}/$${file}"; \ 979 file="$(DESTDIR)${gamedir}/$${file}"; \
diff --git a/configure.ac b/configure.ac
index 4a7f326ab2b..81a247a696c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -481,6 +481,24 @@ AC_SUBST([HAVE_PDUMPER])
481DUMPING=$with_dumping 481DUMPING=$with_dumping
482AC_SUBST([DUMPING]) 482AC_SUBST([DUMPING])
483 483
484dnl Where the etc/emacs.service file is to be installed.
485dnl We use $(prefix)/lib/systemd/user as default, but this may not be
486dnl in systemd's search path when prefix is neither /usr nor /usr/local.
487dnl In that case (e.g. for non-root installs) the location can be
488dnl specified with the configure option.
489dnl See https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#id-1.8.5
490dnl for documentation of systemd's unit file load path.
491AC_ARG_WITH([systemduserunitdir],
492 [AS_HELP_STRING([--with-systemduserunitdir=DIR],
493 [directory for systemd user unit file;
494 default 'PREFIX/usr/lib/systemd/user'])],
495 [systemduserunitdir=${withval}],
496 [systemduserunitdir='${prefix}/lib/systemd/user'])
497if test "${systemduserunitdir}" = "no"; then
498 systemduserunitdir=''
499fi
500AC_SUBST([systemduserunitdir])
501
484dnl FIXME currently it is not the last. 502dnl FIXME currently it is not the last.
485dnl This should be the last --with option, because --with-x is 503dnl This should be the last --with option, because --with-x is
486dnl added later on when we find the file name of X, and it's best to 504dnl added later on when we find the file name of X, and it's best to
diff --git a/etc/NEWS b/etc/NEWS
index 9515ac993ee..7467af6055c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -37,6 +37,11 @@ host system supports SSE2) or '-fno-tree-sra' (if not). These GCC
37options work around GCC bug 58416, which can cause Emacs to behave 37options work around GCC bug 58416, which can cause Emacs to behave
38incorrectly in rare cases. 38incorrectly in rare cases.
39 39
40---
41** New configure option '--with-systemduserunitdir'.
42This allows to specify the directory where the user unit file for
43systemd is installed; default is '${prefix}/usr/lib/systemd/user'.
44
40 45
41* Startup Changes in Emacs 31.1 46* Startup Changes in Emacs 31.1
42 47