From 92e5d81943c890d3ea4b9c140d968563c63b8309 Mon Sep 17 00:00:00 2001
From: Evan Anderson <evan@eaanderson.com>
Date: Sun, 6 Sep 2020 14:30:54 -0500
Subject: [PATCH] configure: Fix runstatedir handling for distros that do not
 support it

runstatedir was added in yet-to-be released autoconf 2.70. Some distros
are shipping this addition in their autoconf packages, but others, such as Fedora,
are not. This causes the rundir variable to be set incorrectly if the configure script
is regenerated with an unpatched autoconf since the runstatedir variable set is deleted
after regeneration. This change works around that problem by checking that runstatedir
is non-empty before potentially using it to set the rundir variable
---
 configure  | 2 +-
 m4/sudo.m4 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 0f6ceb16c..2e0838e01 100755
--- a/configure
+++ b/configure
@@ -26718,7 +26718,7 @@ EOF
 $as_echo_n "checking for sudo run dir location... " >&6; }
 if test -n "$with_rundir"; then
     rundir="$with_rundir"
-elif test "$runstatedir" != '${localstatedir}/run'; then
+elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
     rundir="$runstatedir/sudo"
 else
     # No --with-rundir or --runstatedir specified
diff --git a/m4/sudo.m4 b/m4/sudo.m4
index a5a972b3c..b3a40b208 100644
--- a/m4/sudo.m4
+++ b/m4/sudo.m4
@@ -120,7 +120,7 @@ dnl
 AC_DEFUN([SUDO_RUNDIR], [AC_MSG_CHECKING(for sudo run dir location)
 if test -n "$with_rundir"; then
     rundir="$with_rundir"
-elif test "$runstatedir" != '${localstatedir}/run'; then
+elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
     rundir="$runstatedir/sudo"
 else
     # No --with-rundir or --runstatedir specified
