Make path checks in sudo.m4 cachable.

This commit is contained in:
Todd C. Miller
2022-12-06 13:40:12 -07:00
parent 1b76f76122
commit 3cdd044c68
2 changed files with 401 additions and 281 deletions

382
configure vendored
View File

@@ -20208,9 +20208,16 @@ printf "%s\n" "$sudo_cv_xopen_source_extended" >&6; }
;;
esac
maildir=no
if test X"$ac_cv_header_paths_h" = X"yes"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the user mail spool directory" >&5
printf %s "checking for the user mail spool directory... " >&6; }
if test ${sudo_cv_mail_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_mail_dir=no
if test X"$ac_cv_header_paths_h" = X"yes"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#include <paths.h>
@@ -20224,48 +20231,59 @@ char *p = _PATH_MAILDIR;
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
maildir=yes
sudo_cv_mail_dir="paths.h"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
if test $maildir = no; then
# Solaris has maillock.h which defines MAILDIR
for ac_header in maillock.h
fi
if test $sudo_cv_mail_dir = no; then
# Solaris has maillock.h which defines MAILDIR
for ac_header in maillock.h
do :
ac_fn_c_check_header_compile "$LINENO" "maillock.h" "ac_cv_header_maillock_h" "$ac_includes_default"
if test "x$ac_cv_header_maillock_h" = xyes
then :
printf "%s\n" "#define HAVE_MAILLOCK_H 1" >>confdefs.h
sudo_cv_mail_dir=maillock.h
else case e in #(
e)
sudo_cv_mail_dir=/var/mail
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
sudo_cv_mail_dir="$d"
break
fi
done
;;
esac
fi
done
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_mail_dir" >&5
printf "%s\n" "$sudo_cv_mail_dir" >&6; }
case "$sudo_cv_mail_dir" in
paths.h)
# _PATH_MAILDIR already present in paths.h.
;;
maillock.h)
# Use MAILDIR from maillock.h
cat >>confdefs.h <<\EOF
#define _PATH_MAILDIR MAILDIR
EOF
maildir=yes
fi
done
if test $maildir = no; then
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
maildir=yes
cat >>confdefs.h <<EOF
#define _PATH_MAILDIR "$d"
;;
*)
cat >>confdefs.h <<EOF
#define _PATH_MAILDIR "$sudo_cv_mail_dir"
EOF
break
fi
done
if test $maildir = no; then
# unable to find mail dir, hope for the best
cat >>confdefs.h <<EOF
#define _PATH_MAILDIR "/var/mail"
EOF
fi
fi
fi
;;
esac
if test ${with_logincap-'no'} != "no"; then
for ac_header in login_cap.h
@@ -31228,180 +31246,260 @@ fi
esac
if test "$utmp_style" = "LEGACY"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for utmp file path" >&5
printf %s "checking for utmp file path... " >&6; }
found=no
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
if test -r "$p"; then
found=yes
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $p" >&5
printf "%s\n" "$p" >&6; }
if test ${sudo_cv_path_UTMP+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_path_UTMP=no
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
if test -r "$p"; then
sudo_cv_path_UTMP="$p"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_path_UTMP" >&5
printf "%s\n" "$sudo_cv_path_UTMP" >&6; }
if test X"$sudo_cv_path_UTMP" != X"no"; then
cat >>confdefs.h <<EOF
#define _PATH_UTMP "$p"
#define _PATH_UTMP "$sudo_cv_path_UTMP"
EOF
break
fi
done
if test X"$found" != X"yes"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
printf "%s\n" "not found" >&6; }
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log dir location" >&5
printf %s "checking for log dir location... " >&6; }
if test "${with_logdir-yes}" != "yes"; then
log_dir="$with_logdir"
else
# Default value of log_dir set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
log_dir="$d"
break
fi
done
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log dir location" >&5
printf %s "checking for log dir location... " >&6; }
if test ${sudo_cv_log_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of log_dir set in configure.ac
sudo_cv_log_dir="$log_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_log_dir="$d"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_log_dir" >&5
printf "%s\n" "$sudo_cv_log_dir" >&6; }
log_dir="$sudo_cv_log_dir"
fi
if test "${with_logdir}" != "no"; then
cat >>confdefs.h <<EOF
cat >>confdefs.h <<EOF
#define _PATH_SUDO_LOGDIR "$log_dir"
EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $log_dir" >&5
printf "%s\n" "$log_dir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5
printf %s "checking for log file location... " >&6; }
if test "${with_logpath-yes}" != "yes"; then
if test -n "$with_logpath"; then
logpath="$with_logpath"
else
# Default value of logpath set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
logpath="$d/sudo.log"
break
fi
done
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5
printf %s "checking for log file location... " >&6; }
if test ${sudo_cv_log_path+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of logpath set in configure.ac
sudo_cv_log_path="$logpath"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_log_path="$d/sudo.log"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_log_path" >&5
printf "%s\n" "$sudo_cv_log_path" >&6; }
logpath="$sudo_cv_log_path"
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $logpath" >&5
printf "%s\n" "$logpath" >&6; }
cat >>confdefs.h <<EOF
#define _PATH_SUDO_LOGFILE "$logpath"
EOF
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo_logsrvd relay dir location" >&5
printf %s "checking for sudo_logsrvd relay dir location... " >&6; }
if test "${with_relaydir-yes}" != "yes"; then
relay_dir="$with_relaydir"
else
# Default value of relay_dir set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
relay_dir="$d/sudo_logsrvd"
break
fi
done
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo_logsrvd relay dir location" >&5
printf %s "checking for sudo_logsrvd relay dir location... " >&6; }
if test ${sudo_cv_relay_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of relay_dir set in configure.ac
sudo_cv_relay_dir="$relay_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_relay_dir="$d/sudo_logsrvd"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_relay_dir" >&5
printf "%s\n" "$sudo_cv_relay_dir" >&6; }
relay_dir="$sudo_cv_relay_dir"
fi
if test "${with_relaydir}" != "no"; then
cat >>confdefs.h <<EOF
cat >>confdefs.h <<EOF
#define _PATH_SUDO_RELAY_DIR "$relay_dir"
EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $relay_dir" >&5
printf "%s\n" "$relay_dir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo run dir location" >&5
if test -n "$with_rundir"; then
rundir="$with_rundir"
elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
rundir="$runstatedir/sudo"
else
# No --with-rundir or --runstatedir specified
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo run dir location" >&5
printf %s "checking for sudo run dir location... " >&6; }
if test -n "$with_rundir"; then
rundir="$with_rundir"
elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
rundir="$runstatedir/sudo"
else
# No --with-rundir or --runstatedir specified
for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
rundir="$d/sudo"
break
fi
done
if test ${sudo_cv_run_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_run_dir=no
for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_run_dir="$d/sudo"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $rundir" >&5
printf "%s\n" "$rundir" >&6; }
cat >>confdefs.h <<EOF
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_run_dir" >&5
printf "%s\n" "$sudo_cv_run_dir" >&6; }
rundir="$sudo_cv_run_dir"
fi
if test X"$rundir" != X"no"; then
cat >>confdefs.h <<EOF
#define _PATH_SUDO_TIMEDIR "$rundir/ts"
EOF
cat >>confdefs.h <<EOF
cat >>confdefs.h <<EOF
#define _PATH_SUDO_LOGSRVD_PID "$rundir/sudo_logsrvd.pid"
EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo var dir location" >&5
if test -n "$with_vardir"; then
vardir="$with_vardir"
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo var dir location" >&5
printf %s "checking for sudo var dir location... " >&6; }
vardir="$with_vardir"
if test -z "$vardir"; then
for d in /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
vardir="$d/sudo"
break
fi
done
if test ${sudo_cv_var_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_var_dir=no
for d in /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_var_dir="$d/sudo"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vardir" >&5
printf "%s\n" "$vardir" >&6; }
cat >>confdefs.h <<EOF
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_dir" >&5
printf "%s\n" "$sudo_cv_var_dir" >&6; }
vardir="$sudo_cv_var_dir"
fi
if test X"$vardir" != X"no"; then
cat >>confdefs.h <<EOF
#define _PATH_SUDO_LECTURE_DIR "$vardir/lectured"
EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for I/O log dir location" >&5
printf %s "checking for I/O log dir location... " >&6; }
if test "${with_iologdir-yes}" != "yes"; then
iolog_dir="$with_iologdir"
else
# Default value of iolog_dir set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
iolog_dir="$d/sudo-io"
break
fi
done
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for I/O log dir location" >&5
printf %s "checking for I/O log dir location... " >&6; }
if test ${sudo_cv_iolog_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of iolog_dir set in configure.ac
sudo_cv_iolog_dir="$iolog_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_iolog_dir="$d/sudo-io"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_iolog_dir" >&5
printf "%s\n" "$sudo_cv_iolog_dir" >&6; }
iolog_dir="$sudo_cv_iolog_dir"
fi
if test "${with_iologdir}" != "no"; then
cat >>confdefs.h <<EOF
cat >>confdefs.h <<EOF
#define _PATH_SUDO_IO_LOGDIR "$iolog_dir"
EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $iolog_dir" >&5
printf "%s\n" "$iolog_dir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking time zone data directory" >&5
if test -n "$with_tzdir"; then
tzdir="$with_tzdir"
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking time zone data directory" >&5
printf %s "checking time zone data directory... " >&6; }
tzdir="$with_tzdir"
if test -z "$tzdir"; then
tzdir=no
for d in /usr/share /usr/share/lib /usr/lib /etc; do
if test -d "$d/zoneinfo"; then
tzdir="$d/zoneinfo"
break
fi
done
if test ${sudo_cv_tz_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_tz_dir=no
for d in /usr/share /usr/share/lib /usr/lib /etc; do
if test -d "$d/zoneinfo"; then
sudo_cv_tz_dir="$d/zoneinfo"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tzdir" >&5
printf "%s\n" "$tzdir" >&6; }
if test "${tzdir}" != "no"; then
cat >>confdefs.h <<EOF
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_tz_dir" >&5
printf "%s\n" "$sudo_cv_tz_dir" >&6; }
tzdir="$sudo_cv_tz_dir"
fi
if test X"$tzdir" != X"no"; then
cat >>confdefs.h <<EOF
#define _PATH_ZONEINFO "$tzdir"
EOF
fi
fi

View File

@@ -2,7 +2,7 @@ dnl Local m4 macros for autoconf (used by sudo)
dnl
dnl SPDX-License-Identifier: ISC
dnl
dnl Copyright (c) 1994-1996, 1998-2005, 2007-2015
dnl Copyright (c) 1994-1996, 1998-2005, 2007-2022
dnl Todd C. Miller <Todd.Miller@sudo.ws>
dnl
dnl Permission to use, copy, modify, and distribute this software for any
@@ -17,9 +17,6 @@ dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl
dnl XXX - should cache values in all cases!!!
dnl
dnl checks for programs
dnl
dnl check for sendmail in well-known locations
@@ -58,100 +55,117 @@ AC_DEFUN([SUDO_PROG_BSHELL], [
])dnl
dnl
dnl check for utmp file
dnl Check for path to utmp file if not using getutid(), etc.
dnl
AC_DEFUN([SUDO_PATH_UTMP], [AC_MSG_CHECKING([for utmp file path])
found=no
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
if test -r "$p"; then
found=yes
AC_MSG_RESULT([$p])
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$p")
break
AC_DEFUN([SUDO_PATH_UTMP], [
AC_CACHE_CHECK([for utmp file path], [sudo_cv_path_UTMP], [
sudo_cv_path_UTMP=no
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
if test -r "$p"; then
sudo_cv_path_UTMP="$p"
break
fi
done
])
if test X"$sudo_cv_path_UTMP" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$sudo_cv_path_UTMP")
fi
done
if test X"$found" != X"yes"; then
AC_MSG_RESULT([not found])
fi
])dnl
])
dnl
dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm
dnl
AC_DEFUN([SUDO_LOGFILE], [AC_MSG_CHECKING(for log file location)
if test "${with_logpath-yes}" != "yes"; then
AC_DEFUN([SUDO_LOGFILE], [
if test -n "$with_logpath"; then
logpath="$with_logpath"
else
# Default value of logpath set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
logpath="$d/sudo.log"
break
fi
done
AC_CACHE_CHECK([for log file location], [sudo_cv_log_path], [
# Default value of logpath set in configure.ac
sudo_cv_log_path="$logpath"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_log_path="$d/sudo.log"
break
fi
done
])
logpath="$sudo_cv_log_path"
fi
AC_MSG_RESULT($logpath)
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGFILE, "$logpath")
])dnl
])
dnl
dnl Detect time zone file directory, if any.
dnl
AC_DEFUN([SUDO_TZDIR], [AC_MSG_CHECKING(time zone data directory)
tzdir="$with_tzdir"
if test -z "$tzdir"; then
tzdir=no
for d in /usr/share /usr/share/lib /usr/lib /etc; do
if test -d "$d/zoneinfo"; then
tzdir="$d/zoneinfo"
break
fi
done
fi
AC_MSG_RESULT([$tzdir])
if test "${tzdir}" != "no"; then
SUDO_DEFINE_UNQUOTED(_PATH_ZONEINFO, "$tzdir")
fi
])dnl
AC_DEFUN([SUDO_TZDIR], [
if test -n "$with_tzdir"; then
tzdir="$with_tzdir"
else
AC_CACHE_CHECK([time zone data directory], [sudo_cv_tz_dir], [
sudo_cv_tz_dir=no
for d in /usr/share /usr/share/lib /usr/lib /etc; do
if test -d "$d/zoneinfo"; then
sudo_cv_tz_dir="$d/zoneinfo"
break
fi
done
])
tzdir="$sudo_cv_tz_dir"
fi
if test X"$tzdir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_ZONEINFO, "$tzdir")
fi
])
dnl
dnl Parent directory for time stamp dir.
dnl
AC_DEFUN([SUDO_RUNDIR], [AC_MSG_CHECKING(for sudo run dir location)
if test -n "$with_rundir"; then
rundir="$with_rundir"
elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
rundir="$runstatedir/sudo"
else
# No --with-rundir or --runstatedir specified
for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
rundir="$d/sudo"
break
fi
done
fi
AC_MSG_RESULT([$rundir])
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$rundir/ts")
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGSRVD_PID, "$rundir/sudo_logsrvd.pid")
])dnl
AC_DEFUN([SUDO_RUNDIR], [
if test -n "$with_rundir"; then
rundir="$with_rundir"
elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
rundir="$runstatedir/sudo"
else
# No --with-rundir or --runstatedir specified
AC_CACHE_CHECK([for sudo run dir location], [sudo_cv_run_dir], [
sudo_cv_run_dir=no
for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_run_dir="$d/sudo"
break
fi
done
])
rundir="$sudo_cv_run_dir"
fi
if test X"$rundir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$rundir/ts")
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGSRVD_PID, "$rundir/sudo_logsrvd.pid")
fi
])
dnl
dnl Parent directory for the lecture status dir.
dnl
AC_DEFUN([SUDO_VARDIR], [AC_MSG_CHECKING(for sudo var dir location)
vardir="$with_vardir"
if test -z "$vardir"; then
for d in /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
vardir="$d/sudo"
break
fi
done
fi
AC_MSG_RESULT([$vardir])
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LECTURE_DIR, "$vardir/lectured")
])dnl
AC_DEFUN([SUDO_VARDIR], [
if test -n "$with_vardir"; then
vardir="$with_vardir"
else
AC_CACHE_CHECK([for sudo var dir location], [sudo_cv_var_dir], [
sudo_cv_var_dir=no
for d in /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_var_dir="$d/sudo"
break
fi
done
])
vardir="$sudo_cv_var_dir"
fi
if test X"$vardir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LECTURE_DIR, "$vardir/lectured")
fi
])
dnl
dnl Where the sudo_logsrvd relay temporary log files go, use
@@ -159,68 +173,68 @@ dnl /var/log/sudo_logsrvd if /var/log exists, else
dnl /{var,usr}/adm/sudo_logsrvd
dnl
AC_DEFUN([SUDO_RELAY_DIR], [
AC_MSG_CHECKING(for sudo_logsrvd relay dir location)
if test "${with_relaydir-yes}" != "yes"; then
relay_dir="$with_relaydir"
else
# Default value of relay_dir set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
relay_dir="$d/sudo_logsrvd"
break
fi
done
AC_CACHE_CHECK([for sudo_logsrvd relay dir location], [sudo_cv_relay_dir], [
# Default value of relay_dir set in configure.ac
sudo_cv_relay_dir="$relay_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_relay_dir="$d/sudo_logsrvd"
break
fi
done
])
relay_dir="$sudo_cv_relay_dir"
fi
if test "${with_relaydir}" != "no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_RELAY_DIR, "$relay_dir")
fi
AC_MSG_RESULT($relay_dir)
])dnl
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_RELAY_DIR, "$relay_dir")
])
dnl
dnl Where the I/O log files go, use /var/log/sudo-io if
dnl /var/log exists, else /{var,usr}/adm/sudo-io
dnl
AC_DEFUN([SUDO_IO_LOGDIR], [
AC_MSG_CHECKING(for I/O log dir location)
if test "${with_iologdir-yes}" != "yes"; then
iolog_dir="$with_iologdir"
else
# Default value of iolog_dir set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
iolog_dir="$d/sudo-io"
break
fi
done
AC_CACHE_CHECK([for I/O log dir location], [sudo_cv_iolog_dir], [
# Default value of iolog_dir set in configure.ac
sudo_cv_iolog_dir="$iolog_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_iolog_dir="$d/sudo-io"
break
fi
done
])
iolog_dir="$sudo_cv_iolog_dir"
fi
if test "${with_iologdir}" != "no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_IO_LOGDIR, "$iolog_dir")
fi
AC_MSG_RESULT($iolog_dir)
])dnl
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_IO_LOGDIR, "$iolog_dir")
])
dnl
dnl Where the log files go, use /var/log if it exists, else /{var,usr}/adm
dnl
AC_DEFUN([SUDO_LOGDIR], [
AC_MSG_CHECKING(for log dir location)
if test "${with_logdir-yes}" != "yes"; then
log_dir="$with_logdir"
else
# Default value of log_dir set in configure.ac
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
log_dir="$d"
break
fi
done
AC_CACHE_CHECK([for log dir location], [sudo_cv_log_dir], [
# Default value of log_dir set in configure.ac
sudo_cv_log_dir="$log_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_log_dir="$d"
break
fi
done
])
log_dir="$sudo_cv_log_dir"
fi
if test "${with_logdir}" != "no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGDIR, "$log_dir")
fi
AC_MSG_RESULT($log_dir)
])dnl
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGDIR, "$log_dir")
])
dnl
dnl check for working fnmatch(3)
@@ -520,32 +534,40 @@ dnl Determine the mail spool location
dnl NOTE: must be run *after* check for paths.h
dnl
AC_DEFUN([SUDO_MAILDIR], [
maildir=no
if test X"$ac_cv_header_paths_h" = X"yes"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
AC_CACHE_CHECK([for the user mail spool directory], [sudo_cv_mail_dir], [
sudo_cv_mail_dir=no
if test X"$ac_cv_header_paths_h" = X"yes"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
#include <paths.h>],
[char *p = _PATH_MAILDIR;])], [maildir=yes], [])
fi
if test $maildir = no; then
# Solaris has maillock.h which defines MAILDIR
AC_CHECK_HEADERS(maillock.h, [
SUDO_DEFINE(_PATH_MAILDIR, MAILDIR)
maildir=yes
])
if test $maildir = no; then
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
maildir=yes
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "$d")
break
fi
done
if test $maildir = no; then
# unable to find mail dir, hope for the best
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "/var/mail")
[char *p = _PATH_MAILDIR;])], [sudo_cv_mail_dir="paths.h"], [])
fi
fi
fi
if test $sudo_cv_mail_dir = no; then
# Solaris has maillock.h which defines MAILDIR
AC_CHECK_HEADERS(maillock.h, [
sudo_cv_mail_dir=maillock.h
], [
sudo_cv_mail_dir=/var/mail
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
sudo_cv_mail_dir="$d"
break
fi
done
])
fi
])
case "$sudo_cv_mail_dir" in
paths.h)
# _PATH_MAILDIR already present in paths.h.
;;
maillock.h)
# Use MAILDIR from maillock.h
SUDO_DEFINE(_PATH_MAILDIR, MAILDIR)
;;
*)
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "$sudo_cv_mail_dir")
;;
esac
])
dnl