2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 18:08:23 +00:00

Use AC_PATH_PROGS_FEATURE_CHECK to find mandoc/nroff.

We don't use the NROFFPROG or MANDOCPROG any longer so no need
to set those.
This commit is contained in:
Todd C. Miller 2022-12-06 12:18:26 -07:00
parent dd1eb1f6c5
commit 1b76f76122
2 changed files with 77 additions and 129 deletions

115
configure vendored
View File

@ -673,8 +673,6 @@ PYTHON
FLEX FLEX
YFLAGS YFLAGS
YACC YACC
NROFFPROG
MANDOCPROG
TRPROG TRPROG
UNAMEPROG UNAMEPROG
SHA1SUM SHA1SUM
@ -6497,10 +6495,6 @@ printf "%s\n" "$as_me: WARNING: ignoring unknown argument to --enable-log-host:
;; ;;
esac esac
else case e in #(
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; } ;;
esac
fi fi
@ -17387,19 +17381,16 @@ printf "%s\n" "no" >&6; }
fi fi
# Extract the first word of "mandoc", so it can be a program name with args. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mandoc or nroff" >&5
set dummy mandoc; ac_word=$2 printf %s "checking for mandoc or nroff... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 if test ${ac_cv_path_NROFF+y}
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_MANDOCPROG+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else case e in #( else case e in #(
e) case $MANDOCPROG in e)
[\\/]* | ?:[\\/]*) if test -z "$NROFF"; then
ac_cv_path_MANDOCPROG="$MANDOCPROG" # Let the user override the test with a path. ac_path_NROFF_found=false
;; # Loop through the user's path and test for each of PROGNAME-LIST
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH for as_dir in $PATH
do do
@ -17409,81 +17400,37 @@ do
*/) ;; */) ;;
*) as_dir=$as_dir/ ;; *) as_dir=$as_dir/ ;;
esac esac
for ac_prog in mandoc nroff
do
for ac_exec_ext in '' $ac_executable_extensions; do for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_path_NROFF="$as_dir$ac_prog$ac_exec_ext"
ac_cv_path_MANDOCPROG="$as_dir$ac_word$ac_exec_ext" as_fn_executable_p "$ac_path_NROFF" || continue
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 ac_cv_path_NROFF="$ac_path_NROFF"
break 2 $ac_path_NROFF_found && break 3
fi done
done done
done done
IFS=$as_save_IFS IFS=$as_save_IFS
if test -z "$ac_cv_path_NROFF"; then
ac_cv_path_NROFF=no
fi
else
ac_cv_path_NROFF=$NROFF
fi
test -z "$ac_cv_path_MANDOCPROG" && ac_cv_path_MANDOCPROG="mandoc"
;; ;;
esac ;;
esac esac
fi fi
MANDOCPROG=$ac_cv_path_MANDOCPROG { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_NROFF" >&5
if test -n "$MANDOCPROG"; then printf "%s\n" "$ac_cv_path_NROFF" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANDOCPROG" >&5 case "$ac_cv_path_NROFF" in
printf "%s\n" "$MANDOCPROG" >&6; } *mandoc|no)
else # Prefer mdoc format for mandoc (or when no formatter is present).
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "$MANDOCPROG" != "mandoc"; then
: ${MANTYPE='mdoc'} : ${MANTYPE='mdoc'}
else
# Extract the first word of "nroff", so it can be a program name with args.
set dummy nroff; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_NROFFPROG+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) case $NROFFPROG in
[\\/]* | ?:[\\/]*)
ac_cv_path_NROFFPROG="$NROFFPROG" # Let the user override the test with a path.
;; ;;
*) *)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR # Check whether nroff supports -mdoc, this may produce incorrect
for as_dir in $PATH # results when cross-compiling.
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_NROFFPROG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac ;;
esac
fi
NROFFPROG=$ac_cv_path_NROFFPROG
if test -n "$NROFFPROG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NROFFPROG" >&5
printf "%s\n" "$NROFFPROG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test -n "$NROFFPROG"; then
test -n "$MANTYPE" && sudo_cv_var_mantype="$MANTYPE" test -n "$MANTYPE" && sudo_cv_var_mantype="$MANTYPE"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which macro set to use for manual pages" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which macro set to use for manual pages" >&5
printf %s "checking which macro set to use for manual pages... " >&6; } printf %s "checking which macro set to use for manual pages... " >&6; }
@ -17498,7 +17445,7 @@ else case e in #(
echo ".Nd sudo" >> conftest echo ".Nd sudo" >> conftest
echo ".Sh DESCRIPTION" >> conftest echo ".Sh DESCRIPTION" >> conftest
echo "sudo" >> conftest echo "sudo" >> conftest
if $NROFFPROG -mdoc conftest >/dev/null 2>&1; then if $ac_cv_path_NROFF -mdoc conftest >/dev/null 2>&1; then
sudo_cv_var_mantype="mdoc" sudo_cv_var_mantype="mdoc"
fi fi
rm -f conftest rm -f conftest
@ -17509,10 +17456,8 @@ fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_mantype" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_mantype" >&5
printf "%s\n" "$sudo_cv_var_mantype" >&6; } printf "%s\n" "$sudo_cv_var_mantype" >&6; }
MANTYPE="$sudo_cv_var_mantype" MANTYPE="$sudo_cv_var_mantype"
else ;;
: ${MANTYPE='mdoc'} esac
fi
fi
if test -n "$sudo_cv_prev_host"; then if test -n "$sudo_cv_prev_host"; then
if test "$sudo_cv_prev_host" != "$host"; then if test "$sudo_cv_prev_host" != "$host"; then

View File

@ -1270,7 +1270,7 @@ AC_ARG_ENABLE(log-host,
*) AC_MSG_WARN([ignoring unknown argument to --enable-log-host: $enableval]) *) AC_MSG_WARN([ignoring unknown argument to --enable-log-host: $enableval])
;; ;;
esac esac
], AC_MSG_RESULT(no)) ])
AC_ARG_ENABLE(noargs-shell, AC_ARG_ENABLE(noargs-shell,
[AS_HELP_STRING([--enable-noargs-shell], [If sudo is given no arguments run a shell])], [AS_HELP_STRING([--enable-noargs-shell], [If sudo is given no arguments run a shell])],
@ -1739,12 +1739,17 @@ dnl
AC_PATH_PROG(SHA1SUM, [sha1sum], [openssl dgst -sha1]) AC_PATH_PROG(SHA1SUM, [sha1sum], [openssl dgst -sha1])
AC_PATH_PROG(UNAMEPROG, [uname], [uname]) AC_PATH_PROG(UNAMEPROG, [uname], [uname])
AC_PATH_PROG(TRPROG, [tr], [tr]) AC_PATH_PROG(TRPROG, [tr], [tr])
AC_PATH_PROG(MANDOCPROG, [mandoc], [mandoc]) AC_CACHE_CHECK([for mandoc or nroff], [ac_cv_path_NROFF], [
if test "$MANDOCPROG" != "mandoc"; then AC_PATH_PROGS_FEATURE_CHECK([NROFF], [mandoc nroff], [ac_cv_path_NROFF="$ac_path_NROFF"], [ac_cv_path_NROFF=no])
])
case "$ac_cv_path_NROFF" in
*mandoc|no)
# Prefer mdoc format for mandoc (or when no formatter is present).
: ${MANTYPE='mdoc'} : ${MANTYPE='mdoc'}
else ;;
AC_PATH_PROG(NROFFPROG, [nroff]) *)
if test -n "$NROFFPROG"; then # Check whether nroff supports -mdoc, this may produce incorrect
# results when cross-compiling.
test -n "$MANTYPE" && sudo_cv_var_mantype="$MANTYPE" test -n "$MANTYPE" && sudo_cv_var_mantype="$MANTYPE"
AC_CACHE_CHECK([which macro set to use for manual pages], AC_CACHE_CHECK([which macro set to use for manual pages],
[sudo_cv_var_mantype], [sudo_cv_var_mantype],
@ -1755,17 +1760,15 @@ else
echo ".Nd sudo" >> conftest echo ".Nd sudo" >> conftest
echo ".Sh DESCRIPTION" >> conftest echo ".Sh DESCRIPTION" >> conftest
echo "sudo" >> conftest echo "sudo" >> conftest
if $NROFFPROG -mdoc conftest >/dev/null 2>&1; then if $ac_cv_path_NROFF -mdoc conftest >/dev/null 2>&1; then
sudo_cv_var_mantype="mdoc" sudo_cv_var_mantype="mdoc"
fi fi
rm -f conftest rm -f conftest
] ]
) )
MANTYPE="$sudo_cv_var_mantype" MANTYPE="$sudo_cv_var_mantype"
else ;;
: ${MANTYPE='mdoc'} esac
fi
fi
dnl dnl
dnl If a config.cache exists make sure it matches the current host. dnl If a config.cache exists make sure it matches the current host.