summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-10-07 23:24:08 +0100
committerColin Watson <cjwatson@debian.org>2022-10-07 23:24:08 +0100
commitb43aff9cb18f1b52c1340d4fbfa3044b762ea5f7 (patch)
treec3ed223473204a0a84c0677eb87229445e9d7202 /m4
parent297e0cdd7240ef51bd8145d13e70065914bba18d (diff)
Default to --disable-cache-owner on systems without getuid
* m4/man-arg-cache-owner.m4 (MAN_ARG_CACHE_OWNER): If the system doesn't have `getuid`, force cache files to have unconstrained cache ownership, and issue a warning if `--enable-cache-owner` was given.
Diffstat (limited to 'm4')
-rw-r--r--m4/man-arg-cache-owner.m433
1 files changed, 23 insertions, 10 deletions
diff --git a/m4/man-arg-cache-owner.m4 b/m4/man-arg-cache-owner.m4
index e267fef2..29970166 100644
--- a/m4/man-arg-cache-owner.m4
+++ b/m4/man-arg-cache-owner.m4
@@ -1,9 +1,10 @@
-# man-arg-cache-owner.m4 serial 2
+# man-arg-cache-owner.m4 serial 3
dnl MAN_ARG_CACHE_OWNER
dnl Add an --enable-cache-owner option.
AC_DEFUN([MAN_ARG_CACHE_OWNER],
[
+AC_REQUIRE([gl_IDPRIV])
AC_ARG_ENABLE([cache-owner],
[AS_HELP_STRING([--enable-cache-owner[=ARG]], [make system-wide cache files be owned by user ARG [arg=man]])
AS_HELP_STRING([--disable-cache-owner], [don't constrain ownership of system-wide cache files])],
@@ -14,18 +15,30 @@ AS_HELP_STRING([--disable-cache-owner], [don't constrain ownership of system-wid
if test "$enableval" = "no"
then
man_owner=
- cache_top_owner=root
- AC_MSG_NOTICE([System-wide cache files will have unconstrained ownership])
else
man_owner=$enableval
- cache_top_owner=$enableval
- AC_MSG_NOTICE([System-wide cache files will be owned by $enableval])
- AC_DEFINE_UNQUOTED([MAN_OWNER], ["$man_owner"],
- [Define as the owner of system-wide cache files.])
fi],
- [man_owner=man
- cache_top_owner=man
- AC_DEFINE_UNQUOTED([MAN_OWNER], ["$man_owner"])])
+ [if test "$ac_cv_func_getuid" = yes
+ then
+ man_owner=man
+ else
+ man_owner=
+ fi])
+if test "$man_owner" && test "$ac_cv_func_getuid" != yes
+then
+ AC_MSG_WARN([--enable-cache-owner is not implemented on this platform])
+ man_owner=
+fi
+if test "$man_owner"
+then
+ cache_top_owner="$man_owner"
+ AC_MSG_NOTICE([System-wide cache files will be owned by $man_owner])
+ AC_DEFINE_UNQUOTED([MAN_OWNER], ["$man_owner"],
+ [Define as the owner of system-wide cache files.])
+else
+ cache_top_owner=root
+ AC_MSG_NOTICE([System-wide cache files will have unconstrained ownership])
+fi
AC_SUBST([man_owner])
AC_SUBST([cache_top_owner])
])