summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-08-09 12:06:25 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2023-08-09 12:15:47 -0700
commitcc0a30a876adffa5ec110df9f4e0f21097f6d73e (patch)
tree024bc0acb8de48aebed591b25aeb02508038272d /configure.ac
parent020b5d7fefd255117ab4fca636146b5b59c8fb84 (diff)
downloademacs-cc0a30a876adffa5ec110df9f4e0f21097f6d73e.tar.gz
Adjust to random-seed move
For some time, GNU/Linux systems have put their random-seed file somewhere other than where src/filelock.c looks for it. Catch up to this by having 'configure' scout for it. * configure.ac (BOOT_TIME_FILE): Define this at configure-time. * nt/inc/ms-w32.h (BOOT_TIME_FILE): Override 'configure'. * src/filelock.c (BOOT_TIME_FILE): Remove default definition, since 'configure' defaults it now.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac31
1 files changed, 31 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 6e080c1c666..56c8cf1ae05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2625,6 +2625,37 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
fi
AC_SUBST([AUTO_DEPEND])
+AC_CACHE_CHECK([for old but post-boot file],
+ [emacs_cv_boot_time_file],
+ [AS_CASE([$opsys],
+ [*bsd|darwin|dragonfly],
+ [emacs_cv_boot_time_file='not needed'],
+ [emacs_cv_boot_time_file=unknown
+ AS_IF([test $cross_compiling = no],
+ [# systemd puts it in /var/lib/systemd.
+ # initscripts puts it in /var/lib/urandom (previously /var/lib).
+ # Linux drivers/char/random.c before 2022-02-21 suggests /var/run.
+ for file in \
+ /var/lib/systemd/random-seed \
+ /var/lib/urandom/random-seed \
+ /var/lib/random-seed \
+ /var/run/random-seed
+ do
+ test -f $file && { emacs_cv_boot_time_file=$file; break; }
+ done])])])
+AS_CASE([$emacs_cv_boot_time_file],
+ [/*|*:*], [BOOT_TIME_FILE=\"$emacs_cv_boot_time_file\"],
+ [NULL|nullptr|0], [BOOT_TIME_FILE=$emacs_cv_boot_time_file],
+ ['not needed'], [BOOT_TIME_FILE=NULL],
+ [# Guess systemd if unknown.
+ # If guess is wrong, Emacs falls back on something else.
+ BOOT_TIME_FILE=\"/var/lib/systemd/random-seed\"])
+AC_DEFINE_UNQUOTED([BOOT_TIME_FILE], [$BOOT_TIME_FILE],
+ [Name of file that, if it exists, postdates boot and predates
+ the first Emacs invocation; or a null pointer if no such file is known.
+ This file is used only on GNU/Linux and other systems
+ that lack the FreeBSD-style sysctl with KERN_BOOTTIME.])
+
#### Choose a window system.
## We leave window_system equal to none if