2 dnl Process this file with GNU autoconf to produce a configure script.
4 dnl Copyright (c) 1994-1996,1998-2012 Todd C. Miller <Todd.Miller@courtesan.com>
6 AC_INIT([sudo], [1.8.5p2], [http://www.sudo.ws/bugs/], [sudo])
7 AC_CONFIG_HEADER([config.h pathnames.h])
9 dnl Note: this must come after AC_INIT
11 AC_MSG_NOTICE([Configuring Sudo version $PACKAGE_VERSION])
13 dnl Variables that get substituted in the Makefile and man pages
15 AC_SUBST([HAVE_BSM_AUDIT])
22 AC_SUBST([SUDOERS_LDFLAGS])
24 AC_SUBST([COMMON_OBJS])
25 AC_SUBST([SUDOERS_OBJS])
29 AC_SUBST([SUDOERS_LIBS])
32 AC_SUBST([REPLAY_LIBS])
33 AC_SUBST([GETGROUPS_LIB])
37 AC_SUBST([MAN_POSTINSTALL])
38 AC_SUBST([SUDOERS_MODE])
39 AC_SUBST([SUDOERS_UID])
40 AC_SUBST([SUDOERS_GID])
47 AC_SUBST([mansectform])
49 AC_SUBST([NOEXECFILE])
53 AC_SUBST([noexec_file])
54 AC_SUBST([INSTALL_NOEXEC])
55 AC_SUBST([DONT_LEAK_PATH_INFO])
56 AC_SUBST([BSDAUTH_USAGE])
57 AC_SUBST([SELINUX_USAGE])
59 AC_SUBST([LOGINCAP_USAGE])
62 AC_SUBST([LIBTOOL_DEPS])
63 AC_SUBST([ac_config_libobj_dir])
64 AC_SUBST([CONFIGURE_ARGS])
69 AC_SUBST([COMPAT_TEST_PROGS])
71 dnl Variables that get substituted in docs (not overridden by environment)
73 AC_SUBST([iolog_dir])dnl real initial value from SUDO_IO_LOGDIR
74 AC_SUBST([timedir])dnl real initial value from SUDO_TIMEDIR
76 AC_SUBST([password_timeout])
77 AC_SUBST([sudo_umask])
78 AC_SUBST([umask_override])
79 AC_SUBST([passprompt])
80 AC_SUBST([long_otp_prompt])
86 AC_SUBST([ignore_dot])
87 AC_SUBST([mail_no_user])
88 AC_SUBST([mail_no_host])
89 AC_SUBST([mail_no_perms])
92 AC_SUBST([badpass_message])
94 AC_SUBST([runas_default])
95 AC_SUBST([env_editor])
97 AC_SUBST([passwd_tries])
98 AC_SUBST([tty_tickets])
100 AC_SUBST([root_sudo])
101 AC_SUBST([path_info])
102 AC_SUBST([ldap_conf])
103 AC_SUBST([ldap_secret])
104 AC_SUBST([nsswitch_conf])
105 AC_SUBST([netsvc_conf])
106 AC_SUBST([secure_path])
109 # Begin initial values for man page substitution
111 iolog_dir=/var/log/sudo-io
112 timedir=/var/adm/sudo
117 passprompt="Password:"
129 mailsub="*** SECURITY information for %h ***"
130 badpass_message="Sorry, try again."
141 ldap_conf=/etc/ldap.conf
142 ldap_secret=/etc/ldap.secret
143 netsvc_conf=/etc/netsvc.conf
144 noexec_file=/usr/local/libexec/sudo_noexec.so
145 nsswitch_conf=/etc/nsswitch.conf
146 secure_path="not set"
148 # End initial values for man page substitution
151 dnl Initial values for Makefile variables listed above
152 dnl May be overridden by environment variables..
159 : ${SUDOERS_MODE='0440'}
184 shadow_libs_optional=
188 dnl LD_PRELOAD equivalents
190 RTLD_PRELOAD_VAR="LD_PRELOAD"
191 RTLD_PRELOAD_ENABLE_VAR=
192 RTLD_PRELOAD_DELIM=":"
193 RTLD_PRELOAD_DEFAULT=
196 dnl libc replacement functions live in compat
198 AC_CONFIG_LIBOBJ_DIR(compat)
201 dnl Deprecated --with options (these all warn or generate an error)
204 AC_ARG_WITH(otp-only, [AS_HELP_STRING([--with-otp-only], [deprecated])],
205 [case $with_otp_only in
206 yes) with_passwd="no"
207 AC_MSG_NOTICE([--with-otp-only option deprecated, treating as --without-passwd])
211 AC_ARG_WITH(alertmail, [AS_HELP_STRING([--with-alertmail], [deprecated])],
212 [case $with_alertmail in
213 *) with_mailto="$with_alertmail"
214 AC_MSG_NOTICE([--with-alertmail option deprecated, treating as --mailto])
219 dnl Options for --with
222 AC_ARG_WITH(devel, [AS_HELP_STRING([--with-devel], [add development options])],
224 yes) AC_MSG_NOTICE([Setting up for development: -Wall, flex, yacc])
225 OSDEFS="${OSDEFS} -DSUDO_DEVEL"
230 *) AC_MSG_WARN([Ignoring unknown argument to --with-devel: $with_devel])
234 AC_ARG_WITH(CC, [AS_HELP_STRING([--with-CC], [C compiler to use])],
236 *) AC_MSG_ERROR([the --with-CC option is no longer supported, please set the CC environment variable instead.])
240 AC_ARG_WITH(rpath, [AS_HELP_STRING([--with-rpath], [pass -R flag in addition to -L for lib paths])],
243 *) AC_MSG_ERROR(["--with-rpath does not take an argument."])
247 AC_ARG_WITH(blibpath, [AS_HELP_STRING([--with-blibpath[=PATH]], [pass -blibpath flag to ld for additional lib paths])],
248 [case $with_blibpath in
250 *) AC_MSG_NOTICE([will pass -blibpath:${with_blibpath} to the loader.])
255 dnl Handle BSM auditing support.
257 AC_ARG_WITH(bsm-audit, [AS_HELP_STRING([--with-bsm-audit], [enable BSM audit support])],
258 [case $with_bsm_audit in
259 yes) AC_DEFINE(HAVE_BSM_AUDIT)
260 SUDOERS_LIBS="${SUDOERS_LIBS} -lbsm"
261 SUDOERS_OBJS="${SUDOERS_OBJS} bsm_audit.lo"
264 *) AC_MSG_ERROR(["--with-bsm-audit does not take an argument."])
269 dnl Handle Linux auditing support.
271 AC_ARG_WITH(linux-audit, [AS_HELP_STRING([--with-linux-audit], [enable Linux audit support])],
272 [case $with_linux_audit in
273 yes) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libaudit.h>]], [[int i = AUDIT_USER_CMD; (void)i;]])], [
274 AC_DEFINE(HAVE_LINUX_AUDIT)
275 SUDO_LIBS="${SUDO_LIBS} -laudit"
276 SUDOERS_LIBS="${SUDO_LIBS} -laudit"
277 SUDOERS_OBJS="${SUDOERS_OBJS} linux_audit.lo"
279 AC_MSG_ERROR([unable to find AUDIT_USER_CMD in libaudit.h for --with-linux-audit])
283 *) AC_MSG_ERROR(["--with-linux-audit does not take an argument."])
287 AC_ARG_WITH(incpath, [AS_HELP_STRING([--with-incpath], [additional places to look for include files])],
288 [case $with_incpath in
289 yes) AC_MSG_ERROR(["must give --with-incpath an argument."])
291 no) AC_MSG_ERROR(["--without-incpath not supported."])
293 *) AC_MSG_NOTICE([Adding ${with_incpath} to CPPFLAGS])
294 for i in ${with_incpath}; do
295 CPPFLAGS="${CPPFLAGS} -I${i}"
300 AC_ARG_WITH(libpath, [AS_HELP_STRING([--with-libpath], [additional places to look for libraries])],
301 [case $with_libpath in
302 yes) AC_MSG_ERROR(["must give --with-libpath an argument."])
304 no) AC_MSG_ERROR(["--without-libpath not supported."])
306 *) AC_MSG_NOTICE([Adding ${with_libpath} to LDFLAGS])
310 AC_ARG_WITH(libraries, [AS_HELP_STRING([--with-libraries], [additional libraries to link with])],
311 [case $with_libraries in
312 yes) AC_MSG_ERROR(["must give --with-libraries an argument."])
314 no) AC_MSG_ERROR(["--without-libraries not supported."])
316 *) AC_MSG_NOTICE([Adding ${with_libraries} to LIBS])
320 AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence], [link with -lefence for malloc() debugging])],
321 [case $with_efence in
322 yes) AC_MSG_NOTICE([Sudo will link with -lefence (Electric Fence)])
323 LIBS="${LIBS} -lefence"
324 if test -f /usr/local/lib/libefence.a; then
325 with_libpath="${with_libpath} /usr/local/lib"
329 *) AC_MSG_WARN([Ignoring unknown argument to --with-efence: $with_efence])
333 AC_ARG_WITH(csops, [AS_HELP_STRING([--with-csops], [add CSOps standard options])],
335 yes) AC_MSG_NOTICE([Adding CSOps standard options])
339 with_classic_insults=yes
340 with_csops_insults=yes
346 *) AC_MSG_WARN([Ignoring unknown argument to --with-csops: $with_csops])
350 AC_ARG_WITH(passwd, [AS_HELP_STRING([--without-passwd], [don't use passwd/shadow file for authentication])],
351 [case $with_passwd in
352 yes|no) AC_MSG_CHECKING(whether to use shadow/passwd file authentication)
353 AC_MSG_RESULT($with_passwd)
355 test "$with_passwd" = "yes" && AUTH_REG="$AUTH_REG passwd"
357 *) AC_MSG_ERROR(["Sorry, --with-passwd does not take an argument."])
361 AC_ARG_WITH(skey, [AS_HELP_STRING([--with-skey[=DIR]], [enable S/Key support ])],
364 *) AC_DEFINE(HAVE_SKEY)
365 AC_MSG_CHECKING(whether to try S/Key authentication)
367 AUTH_REG="$AUTH_REG S/Key"
371 AC_ARG_WITH(opie, [AS_HELP_STRING([--with-opie[=DIR]], [enable OPIE support ])],
374 *) AC_DEFINE(HAVE_OPIE)
375 AC_MSG_CHECKING(whether to try NRL OPIE authentication)
377 AUTH_REG="$AUTH_REG NRL_OPIE"
381 AC_ARG_WITH(long-otp-prompt, [AS_HELP_STRING([--with-long-otp-prompt], [use a two line OTP (skey/opie) prompt])],
382 [case $with_long_otp_prompt in
383 yes) AC_DEFINE(LONG_OTP_PROMPT)
384 AC_MSG_CHECKING(whether to use a two line prompt for OTP authentication)
388 no) long_otp_prompt=off
390 *) AC_MSG_ERROR(["--with-long-otp-prompt does not take an argument."])
394 AC_ARG_WITH(SecurID, [AS_HELP_STRING([--with-SecurID[[=DIR]]], [enable SecurID support])],
395 [case $with_SecurID in
397 *) AC_DEFINE(HAVE_SECURID)
398 AC_MSG_CHECKING(whether to use SecurID for authentication)
400 AUTH_EXCL="$AUTH_EXCL SecurID"
404 AC_ARG_WITH(fwtk, [AS_HELP_STRING([--with-fwtk[[=DIR]]], [enable FWTK AuthSRV support])],
407 *) AC_DEFINE(HAVE_FWTK)
408 AC_MSG_CHECKING(whether to use FWTK AuthSRV for authentication)
410 AUTH_EXCL="$AUTH_EXCL FWTK"
414 AC_ARG_WITH(kerb5, [AS_HELP_STRING([--with-kerb5[[=DIR]]], [enable Kerberos V support])],
417 *) AC_MSG_CHECKING(whether to try Kerberos V authentication)
419 AUTH_REG="$AUTH_REG kerb5"
423 AC_ARG_WITH(aixauth, [AS_HELP_STRING([--with-aixauth], [enable AIX general authentication support])],
424 [case $with_aixauth in
425 yes) AUTH_EXCL="$AUTH_EXCL AIX_AUTH";;
427 *) AC_MSG_ERROR(["--with-aixauth does not take an argument."])
431 AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [enable PAM support])],
433 yes) AUTH_EXCL="$AUTH_EXCL PAM";;
435 *) AC_MSG_ERROR(["--with-pam does not take an argument."])
439 AC_ARG_WITH(AFS, [AS_HELP_STRING([--with-AFS], [enable AFS support])],
441 yes) AC_DEFINE(HAVE_AFS)
442 AC_MSG_CHECKING(whether to try AFS (kerberos) authentication)
444 AUTH_REG="$AUTH_REG AFS"
447 *) AC_MSG_ERROR(["--with-AFS does not take an argument."])
451 AC_ARG_WITH(DCE, [AS_HELP_STRING([--with-DCE], [enable DCE support])],
453 yes) AC_DEFINE(HAVE_DCE)
454 AC_MSG_CHECKING(whether to try DCE (kerberos) authentication)
456 AUTH_REG="$AUTH_REG DCE"
459 *) AC_MSG_ERROR(["--with-DCE does not take an argument."])
463 AC_ARG_WITH(logincap, [AS_HELP_STRING([--with-logincap], [enable BSD login class support])],
464 [case $with_logincap in
466 *) AC_MSG_ERROR(["--with-logincap does not take an argument."])
470 AC_ARG_WITH(bsdauth, [AS_HELP_STRING([--with-bsdauth], [enable BSD authentication support])],
471 [case $with_bsdauth in
472 yes) AUTH_EXCL="$AUTH_EXCL BSD_AUTH";;
474 *) AC_MSG_ERROR(["--with-bsdauth does not take an argument."])
478 AC_ARG_WITH(project, [AS_HELP_STRING([--with-project], [enable Solaris project support])],
479 [case $with_project in
482 *) AC_MSG_ERROR(["--with-project does not take an argument."])
486 AC_MSG_CHECKING(whether to lecture users the first time they run sudo)
487 AC_ARG_WITH(lecture, [AS_HELP_STRING([--without-lecture], [don't print lecture for first-time sudoer])],
488 [case $with_lecture in
489 yes|short|always) lecture=once
491 no|none|never) lecture=never
493 *) AC_MSG_ERROR(["unknown argument to --with-lecture: $with_lecture"])
496 if test "$lecture" = "once"; then
499 AC_DEFINE(NO_LECTURE)
503 AC_MSG_CHECKING(whether sudo should log via syslog or to a file by default)
504 AC_ARG_WITH(logging, [AS_HELP_STRING([--with-logging], [log via syslog, file, or both])],
505 [case $with_logging in
506 yes) AC_MSG_ERROR(["must give --with-logging an argument."])
508 no) AC_MSG_ERROR(["--without-logging not supported."])
510 syslog) AC_DEFINE(LOGGING, SLOG_SYSLOG)
511 AC_MSG_RESULT(syslog)
513 file) AC_DEFINE(LOGGING, SLOG_FILE)
516 both) AC_DEFINE(LOGGING, SLOG_BOTH)
519 *) AC_MSG_ERROR(["unknown argument to --with-logging: $with_logging"])
521 esac], [AC_DEFINE(LOGGING, SLOG_SYSLOG) AC_MSG_RESULT(syslog)])
523 AC_ARG_WITH(logfac, [AS_HELP_STRING([--with-logfac], [syslog facility to log with (default is "auth")])],
524 [case $with_logfac in
525 yes) AC_MSG_ERROR(["must give --with-logfac an argument."])
527 no) AC_MSG_ERROR(["--without-logfac not supported."])
529 authpriv|auth|daemon|user|local0|local1|local2|local3|local4|local5|local6|local7) logfac=$with_logfac
531 *) AC_MSG_ERROR(["$with_logfac is not a supported syslog facility."])
535 AC_MSG_CHECKING(at which syslog priority to log commands)
536 AC_ARG_WITH(goodpri, [AS_HELP_STRING([--with-goodpri], [syslog priority for commands (def is "notice")])],
537 [case $with_goodpri in
538 yes) AC_MSG_ERROR(["must give --with-goodpri an argument."])
540 no) AC_MSG_ERROR(["--without-goodpri not supported."])
542 alert|crit|debug|emerg|err|info|notice|warning)
543 goodpri=$with_goodpri
545 *) AC_MSG_ERROR(["$with_goodpri is not a supported syslog priority."])
548 AC_DEFINE_UNQUOTED(PRI_SUCCESS, "$goodpri", [The syslog priority sudo will use for successful attempts.])
549 AC_MSG_RESULT($goodpri)
551 AC_MSG_CHECKING(at which syslog priority to log failures)
552 AC_ARG_WITH(badpri, [AS_HELP_STRING([--with-badpri], [syslog priority for failures (def is "alert")])],
553 [case $with_badpri in
554 yes) AC_MSG_ERROR(["must give --with-badpri an argument."])
556 no) AC_MSG_ERROR(["--without-badpri not supported."])
558 alert|crit|debug|emerg|err|info|notice|warning)
561 *) AC_MSG_ERROR([$with_badpri is not a supported syslog priority.])
564 AC_DEFINE_UNQUOTED(PRI_FAILURE, "$badpri", [The syslog priority sudo will use for unsuccessful attempts/errors.])
565 AC_MSG_RESULT($badpri)
567 AC_ARG_WITH(logpath, [AS_HELP_STRING([--with-logpath], [path to the sudo log file])],
568 [case $with_logpath in
569 yes) AC_MSG_ERROR(["must give --with-logpath an argument."])
571 no) AC_MSG_ERROR(["--without-logpath not supported."])
575 AC_MSG_CHECKING(how long a line in the log file should be)
576 AC_ARG_WITH(loglen, [AS_HELP_STRING([--with-loglen], [maximum length of a log file line (default is 80)])],
577 [case $with_loglen in
578 yes) AC_MSG_ERROR(["must give --with-loglen an argument."])
580 no) AC_MSG_ERROR(["--without-loglen not supported."])
582 [[0-9]]*) loglen=$with_loglen
584 *) AC_MSG_ERROR(["you must enter a number, not $with_loglen"])
587 AC_DEFINE_UNQUOTED(MAXLOGFILELEN, $loglen, [The max number of chars per log file line (for line wrapping).])
588 AC_MSG_RESULT($loglen)
590 AC_MSG_CHECKING(whether sudo should ignore '.' or '' in \$PATH)
591 AC_ARG_WITH(ignore-dot, [AS_HELP_STRING([--with-ignore-dot], [ignore '.' in the PATH])],
592 [case $with_ignore_dot in
597 *) AC_MSG_ERROR(["--with-ignore-dot does not take an argument."])
600 if test "$ignore_dot" = "on"; then
601 AC_DEFINE(IGNORE_DOT_PATH)
607 AC_MSG_CHECKING(whether to send mail when a user is not in sudoers)
608 AC_ARG_WITH(mail-if-no-user, [AS_HELP_STRING([--without-mail-if-no-user], [do not send mail if user not in sudoers])],
609 [case $with_mail_if_no_user in
614 *) AC_MSG_ERROR(["--with-mail-if-no-user does not take an argument."])
617 if test "$mail_no_user" = "on"; then
618 AC_DEFINE(SEND_MAIL_WHEN_NO_USER)
624 AC_MSG_CHECKING(whether to send mail when user listed but not for this host)
625 AC_ARG_WITH(mail-if-no-host, [AS_HELP_STRING([--with-mail-if-no-host], [send mail if user in sudoers but not for this host])],
626 [case $with_mail_if_no_host in
631 *) AC_MSG_ERROR(["--with-mail-if-no-host does not take an argument."])
634 if test "$mail_no_host" = "on"; then
635 AC_DEFINE(SEND_MAIL_WHEN_NO_HOST)
641 AC_MSG_CHECKING(whether to send mail when a user tries a disallowed command)
642 AC_ARG_WITH(mail-if-noperms, [AS_HELP_STRING([--with-mail-if-noperms], [send mail if user not allowed to run command])],
643 [case $with_mail_if_noperms in
648 *) AC_MSG_ERROR(["--with-mail-if-noperms does not take an argument."])
651 if test "$mail_noperms" = "on"; then
652 AC_DEFINE(SEND_MAIL_WHEN_NOT_OK)
658 AC_MSG_CHECKING(who should get the mail that sudo sends)
659 AC_ARG_WITH(mailto, [AS_HELP_STRING([--with-mailto], [who should get sudo mail (default is "root")])],
660 [case $with_mailto in
661 yes) AC_MSG_ERROR(["must give --with-mailto an argument."])
663 no) AC_MSG_ERROR(["--without-mailto not supported."])
665 *) mailto=$with_mailto
668 AC_DEFINE_UNQUOTED(MAILTO, "$mailto", [The user or email address that sudo mail is sent to.])
669 AC_MSG_RESULT([$mailto])
671 AC_ARG_WITH(mailsubject, [AS_HELP_STRING([--with-mailsubject], [subject of sudo mail])],
672 [case $with_mailsubject in
673 yes) AC_MSG_ERROR(["must give --with-mailsubject an argument."])
675 no) AC_MSG_WARN([Sorry, --without-mailsubject not supported.])
677 *) mailsub="$with_mailsubject"
678 AC_MSG_CHECKING(sudo mail subject)
679 AC_MSG_RESULT([Using alert mail subject: $mailsub])
682 AC_DEFINE_UNQUOTED(MAILSUBJECT, "$mailsub", [The subject of the mail sent by sudo to the MAILTO user/address.])
684 AC_MSG_CHECKING(for bad password prompt)
685 AC_ARG_WITH(passprompt, [AS_HELP_STRING([--with-passprompt], [default password prompt])],
686 [case $with_passprompt in
687 yes) AC_MSG_ERROR(["must give --with-passprompt an argument."])
689 no) AC_MSG_WARN([Sorry, --without-passprompt not supported.])
691 *) passprompt="$with_passprompt"
693 AC_MSG_RESULT($passprompt)
694 AC_DEFINE_UNQUOTED(PASSPROMPT, "$passprompt", [The default password prompt.])
696 AC_MSG_CHECKING(for bad password message)
697 AC_ARG_WITH(badpass-message, [AS_HELP_STRING([--with-badpass-message], [message the user sees when the password is wrong])],
698 [case $with_badpass_message in
699 yes) AC_MSG_ERROR(["Must give --with-badpass-message an argument."])
701 no) AC_MSG_WARN([Sorry, --without-badpass-message not supported.])
703 *) badpass_message="$with_badpass_message"
706 AC_DEFINE_UNQUOTED(INCORRECT_PASSWORD, "$badpass_message", [The message given when a bad password is entered.])
707 AC_MSG_RESULT([$badpass_message])
709 AC_MSG_CHECKING(whether to expect fully qualified hosts in sudoers)
710 AC_ARG_WITH(fqdn, [AS_HELP_STRING([--with-fqdn], [expect fully qualified hosts in sudoers])],
716 *) AC_MSG_ERROR(["--with-fqdn does not take an argument."])
719 if test "$fqdn" = "on"; then
726 AC_ARG_WITH(timedir, [AS_HELP_STRING([--with-timedir], [path to the sudo timestamp dir])],
727 [case $with_timedir in
728 yes) AC_MSG_ERROR(["must give --with-timedir an argument."])
730 no) AC_MSG_ERROR(["--without-timedir not supported."])
734 AC_ARG_WITH(iologdir, [AS_HELP_STRING([--with-iologdir=DIR], [directory to store sudo I/O log files in])],
735 [case $with_iologdir in
737 no) AC_MSG_ERROR(["--without-iologdir not supported."])
741 AC_ARG_WITH(sendmail, [AS_HELP_STRING([--with-sendmail], [set path to sendmail])
742 AS_HELP_STRING([--without-sendmail], [do not send mail at all])],
743 [case $with_sendmail in
744 yes) with_sendmail=""
747 *) SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SENDMAIL, "$with_sendmail")
751 AC_ARG_WITH(sudoers-mode, [AS_HELP_STRING([--with-sudoers-mode], [mode of sudoers file (defaults to 0440)])],
752 [case $with_sudoers_mode in
753 yes) AC_MSG_ERROR(["must give --with-sudoers-mode an argument."])
755 no) AC_MSG_ERROR(["--without-sudoers-mode not supported."])
757 [[1-9]]*) SUDOERS_MODE=0${with_sudoers_mode}
759 0*) SUDOERS_MODE=$with_sudoers_mode
761 *) AC_MSG_ERROR(["you must use an octal mode, not a name."])
765 AC_ARG_WITH(sudoers-uid, [AS_HELP_STRING([--with-sudoers-uid], [uid that owns sudoers file (defaults to 0)])],
766 [case $with_sudoers_uid in
767 yes) AC_MSG_ERROR(["must give --with-sudoers-uid an argument."])
769 no) AC_MSG_ERROR(["--without-sudoers-uid not supported."])
771 [[0-9]]*) SUDOERS_UID=$with_sudoers_uid
773 *) AC_MSG_ERROR(["you must use an unsigned numeric uid, not a name."])
777 AC_ARG_WITH(sudoers-gid, [AS_HELP_STRING([--with-sudoers-gid], [gid that owns sudoers file (defaults to 0)])],
778 [case $with_sudoers_gid in
779 yes) AC_MSG_ERROR(["must give --with-sudoers-gid an argument."])
781 no) AC_MSG_ERROR(["--without-sudoers-gid not supported."])
783 [[0-9]]*) SUDOERS_GID=$with_sudoers_gid
785 *) AC_MSG_ERROR(["you must use an unsigned numeric gid, not a name."])
789 AC_MSG_CHECKING(for umask programs should be run with)
790 AC_ARG_WITH(umask, [AS_HELP_STRING([--with-umask], [umask with which the prog should run (default is 022)])
791 AS_HELP_STRING([--without-umask], [Preserves the umask of the user invoking sudo.])],
793 yes) AC_MSG_ERROR(["must give --with-umask an argument."])
797 [[0-9]]*) sudo_umask=$with_umask
799 *) AC_MSG_ERROR(["you must enter a numeric mask."])
802 AC_DEFINE_UNQUOTED(SUDO_UMASK, $sudo_umask, [The umask that the sudo-run prog should use.])
803 if test "$sudo_umask" = "0777"; then
806 AC_MSG_RESULT($sudo_umask)
809 AC_ARG_WITH(umask-override, [AS_HELP_STRING([--with-umask-override], [Use the umask specified in sudoers even if it is less restrictive than the user's.])],
810 [case $with_umask_override in
811 yes) AC_DEFINE(UMASK_OVERRIDE)
814 no) umask_override=off
816 *) AC_MSG_ERROR(["--with-umask-override does not take an argument."])
820 AC_MSG_CHECKING(for default user to run commands as)
821 AC_ARG_WITH(runas-default, [AS_HELP_STRING([--with-runas-default], [User to run commands as (default is "root")])],
822 [case $with_runas_default in
823 yes) AC_MSG_ERROR(["must give --with-runas-default an argument."])
825 no) AC_MSG_ERROR(["--without-runas-default not supported."])
827 *) runas_default="$with_runas_default"
830 AC_DEFINE_UNQUOTED(RUNAS_DEFAULT, "$runas_default", [The user sudo should run commands as by default.])
831 AC_MSG_RESULT([$runas_default])
833 AC_ARG_WITH(exempt, [AS_HELP_STRING([--with-exempt=group], [no passwd needed for users in this group])],
834 [case $with_exempt in
835 yes) AC_MSG_ERROR(["must give --with-exempt an argument."])
837 no) AC_MSG_ERROR(["--without-exempt not supported."])
839 *) AC_DEFINE_UNQUOTED(EXEMPTGROUP, "$with_exempt", [If defined, users in this group need not enter a passwd (ie "sudo").])
840 AC_MSG_CHECKING(for group to be exempt from password)
841 AC_MSG_RESULT([$with_exempt])
845 AC_MSG_CHECKING(for editor that visudo should use)
846 AC_ARG_WITH(editor, [AS_HELP_STRING([--with-editor=path], [Default editor for visudo (defaults to vi)])],
847 [case $with_editor in
848 yes) AC_MSG_ERROR(["must give --with-editor an argument."])
850 no) AC_MSG_ERROR(["--without-editor not supported."])
852 *) AC_DEFINE_UNQUOTED(EDITOR, "$with_editor", [A colon-separated list of pathnames to be used as the editor for visudo.])
853 AC_MSG_RESULT([$with_editor])
854 editor="$with_editor"
856 esac], [AC_DEFINE(EDITOR, _PATH_VI) AC_MSG_RESULT(vi)])
858 AC_MSG_CHECKING(whether to obey EDITOR and VISUAL environment variables)
859 AC_ARG_WITH(env-editor, [AS_HELP_STRING([--with-env-editor], [Use the environment variable EDITOR for visudo])],
860 [case $with_env_editor in
865 *) AC_MSG_ERROR(["--with-env-editor does not take an argument."])
868 if test "$env_editor" = "on"; then
869 AC_DEFINE(ENV_EDITOR)
875 AC_MSG_CHECKING(number of tries a user gets to enter their password)
876 AC_ARG_WITH(passwd-tries, [AS_HELP_STRING([--with-passwd-tries], [number of tries to enter password (default is 3)])],
877 [case $with_passwd_tries in
879 no) AC_MSG_ERROR(["--without-editor not supported."])
881 [[1-9]]*) passwd_tries=$with_passwd_tries
883 *) AC_MSG_ERROR(["you must enter the numer of tries, > 0"])
886 AC_DEFINE_UNQUOTED(TRIES_FOR_PASSWORD, $passwd_tries, [The number of tries a user gets to enter their password.])
887 AC_MSG_RESULT($passwd_tries)
889 AC_MSG_CHECKING(time in minutes after which sudo will ask for a password again)
890 AC_ARG_WITH(timeout, [AS_HELP_STRING([--with-timeout], [minutes before sudo asks for passwd again (def is 5 minutes)])],
891 [case $with_timeout in
895 [[0-9]]*) timeout=$with_timeout
897 *) AC_MSG_ERROR(["you must enter the numer of minutes."])
900 AC_DEFINE_UNQUOTED(TIMEOUT, $timeout, [The number of minutes before sudo asks for a password again.])
901 AC_MSG_RESULT($timeout)
903 AC_MSG_CHECKING(time in minutes after the password prompt will time out)
904 AC_ARG_WITH(password-timeout, [AS_HELP_STRING([--with-password-timeout], [passwd prompt timeout in minutes (default is 5 minutes)])],
905 [case $with_password_timeout in
907 no) password_timeout=0
909 [[0-9]]*) password_timeout=$with_password_timeout
911 *) AC_MSG_ERROR(["you must enter the numer of minutes."])
914 AC_DEFINE_UNQUOTED(PASSWORD_TIMEOUT, $password_timeout, [The passwd prompt timeout (in minutes).])
915 AC_MSG_RESULT($password_timeout)
917 AC_MSG_CHECKING(whether to use per-tty ticket files)
918 AC_ARG_WITH(tty-tickets, [AS_HELP_STRING([--with-tty-tickets], [use a different ticket file for each tty])],
919 [case $with_tty_tickets in
924 *) AC_MSG_ERROR(["--with-tty-tickets does not take an argument."])
927 if test "$tty_tickets" = "off"; then
928 AC_DEFINE(NO_TTY_TICKETS)
934 AC_MSG_CHECKING(whether to include insults)
935 AC_ARG_WITH(insults, [AS_HELP_STRING([--with-insults], [insult the user for entering an incorrect password])],
936 [case $with_insults in
938 with_classic_insults=yes
939 with_csops_insults=yes
941 disabled) insults=off
942 with_classic_insults=yes
943 with_csops_insults=yes
947 *) AC_MSG_ERROR(["--with-insults does not take an argument."])
950 if test "$insults" = "on"; then
951 AC_DEFINE(USE_INSULTS)
957 AC_ARG_WITH(all-insults, [AS_HELP_STRING([--with-all-insults], [include all the sudo insult sets])],
958 [case $with_all_insults in
959 yes) with_classic_insults=yes
960 with_csops_insults=yes
962 with_goons_insults=yes
965 *) AC_MSG_ERROR(["--with-all-insults does not take an argument."])
969 AC_ARG_WITH(classic-insults, [AS_HELP_STRING([--with-classic-insults], [include the insults from the "classic" sudo])],
970 [case $with_classic_insults in
971 yes) AC_DEFINE(CLASSIC_INSULTS)
974 *) AC_MSG_ERROR(["--with-classic-insults does not take an argument."])
978 AC_ARG_WITH(csops-insults, [AS_HELP_STRING([--with-csops-insults], [include CSOps insults])],
979 [case $with_csops_insults in
980 yes) AC_DEFINE(CSOPS_INSULTS)
983 *) AC_MSG_ERROR(["--with-csops-insults does not take an argument."])
987 AC_ARG_WITH(hal-insults, [AS_HELP_STRING([--with-hal-insults], [include 2001-like insults])],
988 [case $with_hal_insults in
989 yes) AC_DEFINE(HAL_INSULTS)
992 *) AC_MSG_ERROR(["--with-hal-insults does not take an argument."])
996 AC_ARG_WITH(goons-insults, [AS_HELP_STRING([--with-goons-insults], [include the insults from the "Goon Show"])],
997 [case $with_goons_insults in
998 yes) AC_DEFINE(GOONS_INSULTS)
1001 *) AC_MSG_ERROR(["--with-goons-insults does not take an argument."])
1005 AC_ARG_WITH(nsswitch, [AS_HELP_STRING([--with-nsswitch[[=PATH]]], [path to nsswitch.conf])],
1006 [case $with_nsswitch in
1008 yes) with_nsswitch="/etc/nsswitch.conf"
1013 AC_ARG_WITH(ldap, [AS_HELP_STRING([--with-ldap[[=DIR]]], [enable LDAP support])],
1016 *) AC_DEFINE(HAVE_LDAP)
1017 AC_MSG_CHECKING(whether to use sudoers from LDAP)
1022 AC_ARG_WITH(ldap-conf-file, [AS_HELP_STRING([--with-ldap-conf-file], [path to LDAP configuration file])])
1023 test -n "$with_ldap_conf_file" && ldap_conf="$with_ldap_conf_file"
1024 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_CONF, "$ldap_conf", [Path to the ldap.conf file])
1026 AC_ARG_WITH(ldap-secret-file, [AS_HELP_STRING([--with-ldap-secret-file], [path to LDAP secret password file])])
1027 test -n "$with_ldap_secret_file" && ldap_secret="$with_ldap_secret_file"
1028 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_SECRET, "$ldap_secret", [Path to the ldap.secret file])
1030 AC_ARG_WITH(pc-insults, [AS_HELP_STRING([--with-pc-insults], [replace politically incorrect insults with less offensive ones])],
1031 [case $with_pc_insults in
1032 yes) AC_DEFINE(PC_INSULTS)
1035 *) AC_MSG_ERROR(["--with-pc-insults does not take an argument."])
1039 dnl include all insult sets on one line
1040 if test "$insults" = "on"; then
1041 AC_MSG_CHECKING(which insult sets to include)
1043 test "$with_goons_insults" = "yes" && i="goons ${i}"
1044 test "$with_hal_insults" = "yes" && i="hal ${i}"
1045 test "$with_csops_insults" = "yes" && i="csops ${i}"
1046 test "$with_classic_insults" = "yes" && i="classic ${i}"
1050 AC_MSG_CHECKING(whether to override the user's path)
1051 AC_ARG_WITH(secure-path, [AS_HELP_STRING([--with-secure-path], [override the user's path with a built-in one])],
1052 [case $with_secure_path in
1053 yes) with_secure_path="/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
1054 AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1055 AC_MSG_RESULT([$with_secure_path])
1056 secure_path="set to $with_secure_path"
1058 no) AC_MSG_RESULT(no)
1060 *) AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1061 AC_MSG_RESULT([$with_secure_path])
1062 secure_path="set to F<$with_secure_path>"
1064 esac], AC_MSG_RESULT(no))
1066 AC_MSG_CHECKING(whether to get ip addresses from the network interfaces)
1067 AC_ARG_WITH(interfaces, [AS_HELP_STRING([--without-interfaces], [don't try to read the ip addr of ether interfaces])],
1068 [case $with_interfaces in
1069 yes) AC_MSG_RESULT(yes)
1071 no) AC_DEFINE(STUB_LOAD_INTERFACES)
1074 *) AC_MSG_ERROR(["--with-interfaces does not take an argument."])
1076 esac], AC_MSG_RESULT(yes))
1078 AC_MSG_CHECKING(whether stow should be used)
1079 AC_ARG_WITH(stow, [AS_HELP_STRING([--with-stow], [properly handle GNU stow packaging])],
1081 yes) AC_MSG_RESULT(yes)
1084 no) AC_MSG_RESULT(no)
1086 *) AC_MSG_ERROR(["--with-stow does not take an argument."])
1088 esac], AC_MSG_RESULT(no))
1090 AC_MSG_CHECKING(whether to use an askpass helper)
1091 AC_ARG_WITH(askpass, [AS_HELP_STRING([--with-askpass=PATH], [Fully qualified pathname of askpass helper])],
1092 [case $with_askpass in
1093 yes) AC_MSG_ERROR(["--with-askpass takes a path as an argument."])
1096 *) SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, "$with_askpass", [The fully qualified pathname of askpass])
1098 esac], AC_MSG_RESULT(no))
1100 AC_ARG_WITH(plugindir, [AS_HELP_STRING([--with-plugindir], [set directory to load plugins from])],
1101 [case $with_plugindir in
1102 no) AC_MSG_ERROR(["illegal argument: --without-plugindir."])
1105 esac], [with_plugindir="$libexecdir"])
1108 dnl Options for --enable
1111 AC_MSG_CHECKING(whether to do user authentication by default)
1112 AC_ARG_ENABLE(authentication,
1113 [AS_HELP_STRING([--disable-authentication], [Do not require authentication by default])],
1114 [ case "$enableval" in
1115 yes) AC_MSG_RESULT(yes)
1117 no) AC_MSG_RESULT(no)
1118 AC_DEFINE(NO_AUTHENTICATION)
1120 *) AC_MSG_RESULT(no)
1121 AC_MSG_WARN([Ignoring unknown argument to --enable-authentication: $enableval])
1124 ], AC_MSG_RESULT(yes))
1126 AC_MSG_CHECKING(whether to disable running the mailer as root)
1127 AC_ARG_ENABLE(root-mailer,
1128 [AS_HELP_STRING([--disable-root-mailer], [Don't run the mailer as root, run as the user])],
1129 [ case "$enableval" in
1130 yes) AC_MSG_RESULT(no)
1132 no) AC_MSG_RESULT(yes)
1133 AC_DEFINE(NO_ROOT_MAILER)
1135 *) AC_MSG_RESULT(no)
1136 AC_MSG_WARN([Ignoring unknown argument to --enable-root-mailer: $enableval])
1139 ], AC_MSG_RESULT(no))
1141 AC_ARG_ENABLE(setreuid,
1142 [AS_HELP_STRING([--disable-setreuid], [Don't try to use the setreuid() function])],
1143 [ case "$enableval" in
1144 no) SKIP_SETREUID=yes
1150 AC_ARG_ENABLE(setresuid,
1151 [AS_HELP_STRING([--disable-setresuid], [Don't try to use the setresuid() function])],
1152 [ case "$enableval" in
1153 no) SKIP_SETRESUID=yes
1159 AC_MSG_CHECKING(whether to disable shadow password support)
1160 AC_ARG_ENABLE(shadow,
1161 [AS_HELP_STRING([--disable-shadow], [Never use shadow passwords])],
1162 [ case "$enableval" in
1163 yes) AC_MSG_RESULT(no)
1165 no) AC_MSG_RESULT(yes)
1168 *) AC_MSG_RESULT(no)
1169 AC_MSG_WARN([Ignoring unknown argument to --enable-shadow: $enableval])
1172 ], AC_MSG_RESULT(no))
1174 AC_MSG_CHECKING(whether root should be allowed to use sudo)
1175 AC_ARG_ENABLE(root-sudo,
1176 [AS_HELP_STRING([--disable-root-sudo], [Don't allow root to run sudo])],
1177 [ case "$enableval" in
1178 yes) AC_MSG_RESULT(yes)
1180 no) AC_DEFINE(NO_ROOT_SUDO)
1184 *) AC_MSG_ERROR(["--enable-root-sudo does not take an argument."])
1187 ], AC_MSG_RESULT(yes))
1189 AC_MSG_CHECKING(whether to log the hostname in the log file)
1190 AC_ARG_ENABLE(log-host,
1191 [AS_HELP_STRING([--enable-log-host], [Log the hostname in the log file])],
1192 [ case "$enableval" in
1193 yes) AC_MSG_RESULT(yes)
1194 AC_DEFINE(HOST_IN_LOG)
1196 no) AC_MSG_RESULT(no)
1198 *) AC_MSG_RESULT(no)
1199 AC_MSG_WARN([Ignoring unknown argument to --enable-log-host: $enableval])
1202 ], AC_MSG_RESULT(no))
1204 AC_MSG_CHECKING(whether to invoke a shell if sudo is given no arguments)
1205 AC_ARG_ENABLE(noargs-shell,
1206 [AS_HELP_STRING([--enable-noargs-shell], [If sudo is given no arguments run a shell])],
1207 [ case "$enableval" in
1208 yes) AC_MSG_RESULT(yes)
1209 AC_DEFINE(SHELL_IF_NO_ARGS)
1211 no) AC_MSG_RESULT(no)
1213 *) AC_MSG_RESULT(no)
1214 AC_MSG_WARN([Ignoring unknown argument to --enable-noargs-shell: $enableval])
1217 ], AC_MSG_RESULT(no))
1219 AC_MSG_CHECKING(whether to set \$HOME to target user in shell mode)
1220 AC_ARG_ENABLE(shell-sets-home,
1221 [AS_HELP_STRING([--enable-shell-sets-home], [Set $HOME to target user in shell mode])],
1222 [ case "$enableval" in
1223 yes) AC_MSG_RESULT(yes)
1224 AC_DEFINE(SHELL_SETS_HOME)
1226 no) AC_MSG_RESULT(no)
1228 *) AC_MSG_RESULT(no)
1229 AC_MSG_WARN([Ignoring unknown argument to --enable-shell-sets-home: $enableval])
1232 ], AC_MSG_RESULT(no))
1234 AC_MSG_CHECKING(whether to disable 'command not found' messages)
1235 AC_ARG_ENABLE(path_info,
1236 [AS_HELP_STRING([--disable-path-info], [Print 'command not allowed' not 'command not found'])],
1237 [ case "$enableval" in
1238 yes) AC_MSG_RESULT(no)
1240 no) AC_MSG_RESULT(yes)
1241 AC_DEFINE(DONT_LEAK_PATH_INFO)
1244 *) AC_MSG_RESULT(no)
1245 AC_MSG_WARN([Ignoring unknown argument to --enable-path-info: $enableval])
1248 ], AC_MSG_RESULT(no))
1250 AC_MSG_CHECKING(whether to enable environment debugging)
1251 AC_ARG_ENABLE(env_debug,
1252 [AS_HELP_STRING([--enable-env-debug], [Whether to enable environment debugging.])],
1253 [ case "$enableval" in
1254 yes) AC_MSG_RESULT(yes)
1255 AC_DEFINE(ENV_DEBUG)
1257 no) AC_MSG_RESULT(no)
1259 *) AC_MSG_RESULT(no)
1260 AC_MSG_WARN([Ignoring unknown argument to --enable-env-debug: $enableval])
1263 ], AC_MSG_RESULT(no))
1266 [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])],
1267 [], [enable_zlib=yes])
1269 AC_MSG_CHECKING(whether to enable environment resetting by default)
1270 AC_ARG_ENABLE(env_reset,
1271 [AS_HELP_STRING([--enable-env-reset], [Whether to enable environment resetting by default.])],
1272 [ case "$enableval" in
1278 AC_MSG_WARN([Ignoring unknown argument to --enable-env-reset: $enableval])
1282 if test "$env_reset" = "on"; then
1284 AC_DEFINE(ENV_RESET, 1)
1287 AC_DEFINE(ENV_RESET, 0)
1290 AC_ARG_ENABLE(warnings,
1291 [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])],
1292 [ case "$enableval" in
1295 *) AC_MSG_WARN([Ignoring unknown argument to --enable-warnings: $enableval])
1300 AC_ARG_ENABLE(werror,
1301 [AS_HELP_STRING([--enable-werror], [Whether to enable the -Werror compiler option])],
1302 [ case "$enableval" in
1305 *) AC_MSG_WARN([Ignoring unknown argument to --enable-werror: $enableval])
1310 AC_ARG_ENABLE(admin-flag,
1311 [AS_HELP_STRING([--enable-admin-flag], [Whether to create a Ubuntu-style admin flag file])],
1312 [ case "$enableval" in
1313 yes) AC_DEFINE(USE_ADMIN_FLAG)
1316 *) AC_MSG_WARN([Ignoring unknown argument to --enable-admin-flag: $enableval])
1322 [AS_HELP_STRING([--disable-nls], [Disable natural language support using gettext])],
1323 [], [enable_nls=yes])
1325 AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])],
1326 [case $with_selinux in
1327 yes) SELINUX_USAGE="[[-r role]] [[-t type]] "
1328 AC_DEFINE(HAVE_SELINUX)
1329 SUDO_LIBS="${SUDO_LIBS} -lselinux"
1330 SUDO_OBJS="${SUDO_OBJS} selinux.o"
1331 PROGS="${PROGS} sesh"
1333 AC_CHECK_LIB([selinux], [setkeycreatecon],
1334 [AC_DEFINE(HAVE_SETKEYCREATECON)])
1337 *) AC_MSG_ERROR(["--with-selinux does not take an argument."])
1342 dnl gss_krb5_ccache_name() may not work on Heimdal so we don't use it by default
1344 AC_ARG_ENABLE(gss_krb5_ccache_name,
1345 [AS_HELP_STRING([--enable-gss-krb5-ccache-name], [Use GSS-API to set the Kerberos V cred cache name])],
1346 [check_gss_krb5_ccache_name=$enableval], [check_gss_krb5_ccache_name=no])
1349 dnl C compiler checks
1351 AC_SEARCH_LIBS([strerror], [cposix])
1353 AC_CHECK_TOOL(AR, ar, false)
1354 AC_CHECK_TOOL(RANLIB, ranlib, :)
1355 if test X"$AR" = X"false"; then
1356 AC_MSG_ERROR([the "ar" utility is required to build sudo])
1359 if test "x$ac_cv_prog_cc_c89" = "xno"; then
1360 AC_MSG_ERROR([Sudo version $PACKAGE_VERSION requires an ANSI C compiler to build.])
1364 dnl If the user specified --disable-static, override them or we'll
1365 dnl be unable to build the executables in the sudoers plugin dir.
1367 if test "$enable_static" = "no"; then
1368 AC_MSG_WARN([Ignoring --disable-static, sudo does not install static libs])
1373 dnl Libtool setup, we require libtool 2.2.6b or higher
1376 AC_CONFIG_MACRO_DIR([m4])
1381 dnl Defer with_noexec until after libtool magic runs
1383 if test "$enable_shared" = "no"; then
1388 ac_cv_func_dlopen=no
1390 eval _shrext="$shrext_cmds"
1391 # Darwin uses .dylib for libraries but .so for modules
1392 if test X"$_shrext" = X".dylib"; then
1398 AC_MSG_CHECKING(path to sudo_noexec.so)
1399 AC_ARG_WITH(noexec, [AS_HELP_STRING([--with-noexec[=PATH]], [fully qualified pathname of sudo_noexec.so])],
1400 [case $with_noexec in
1401 yes) with_noexec="$libexecdir/sudo_noexec$_shrext"
1405 esac], [with_noexec="$libexecdir/sudo_noexec$_shrext"])
1406 AC_MSG_RESULT($with_noexec)
1407 NOEXECFILE="sudo_noexec$_shrext"
1408 NOEXECDIR="`echo $with_noexec|sed 's:^\(.*\)/[[^/]]*:\1:'`"
1411 dnl Find programs we use
1413 AC_CHECK_PROG(UNAMEPROG, [uname], [uname])
1414 AC_CHECK_PROG(TRPROG, [tr], [tr])
1415 AC_CHECK_PROGS(NROFFPROG, [nroff mandoc])
1416 if test -n "$NROFFPROG"; then
1417 AC_CACHE_CHECK([whether $NROFFPROG supports the -c option],
1418 [sudo_cv_var_nroff_opt_c],
1419 [if $NROFFPROG -c </dev/null >/dev/null 2>&1; then
1420 sudo_cv_var_nroff_opt_c=yes
1422 sudo_cv_var_nroff_opt_c=no
1425 if test "$sudo_cv_var_nroff_opt_c" = "yes"; then
1426 NROFFPROG="$NROFFPROG -c"
1428 AC_CACHE_CHECK([whether $NROFFPROG supports the -Tascii option],
1429 [sudo_cv_var_nroff_opt_Tascii],
1430 [if $NROFFPROG -Tascii </dev/null >/dev/null 2>&1; then
1431 sudo_cv_var_nroff_opt_Tascii=yes
1433 sudo_cv_var_nroff_opt_Tascii=no
1435 if test "$sudo_cv_var_nroff_opt_Tascii" = "yes"; then
1436 NROFFPROG="$NROFFPROG -Tascii"
1441 mansrcdir='$(srcdir)'
1445 dnl What kind of beastie are we being run on?
1446 dnl Barf if config.cache was generated on another host.
1448 if test -n "$sudo_cv_prev_host"; then
1449 if test "$sudo_cv_prev_host" != "$host"; then
1450 AC_MSG_ERROR([config.cache was created on a different host; remove it and re-run configure.])
1452 AC_MSG_CHECKING(previous host type)
1453 AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1454 AC_MSG_RESULT([$sudo_cv_prev_host])
1457 # this will produce no output since there is no cached value
1458 AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1462 dnl We want to be able to differentiate between different rev's
1464 if test -n "$host_os"; then
1465 OS=`echo $host_os | sed 's/[[0-9]].*//'`
1466 OSREV=`echo $host_os | sed 's/^[[^0-9\.]]*\([[0-9\.]]*\).*$/\1/'`
1467 OSMAJOR=`echo $OSREV | sed 's/\..*$//'`
1476 # LD_PRELOAD is space-delimited
1477 RTLD_PRELOAD_DELIM=" "
1479 # getcwd(3) opens a pipe to getpwd(1)!?!
1482 # system headers lack prototypes but gcc helps...
1483 if test -n "$GCC"; then
1484 OSDEFS="${OSDEFS} -D__USE_FIXED_PROTOTYPES__"
1487 shadow_funcs="getpwanam issecure"
1490 # LD_PRELOAD is space-delimited
1491 RTLD_PRELOAD_DELIM=" "
1493 # To get the crypt(3) prototype (so we pass -Wall)
1494 OSDEFS="${OSDEFS} -D__EXTENSIONS__"
1495 # AFS support needs -lucb
1496 if test "$with_AFS" = "yes"; then
1497 AFS_LIBS="-lc -lucb"
1500 : ${mansectform='4'}
1501 : ${with_rpath='yes'}
1502 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1503 AC_CHECK_FUNCS(priv_set)
1506 # To get all prototypes (so we pass -Wall)
1507 OSDEFS="${OSDEFS} -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT"
1508 SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} -Wl,-bI:\$(srcdir)/aixcrypt.exp"
1509 if test X"$with_blibpath" != X"no"; then
1510 AC_MSG_CHECKING([if linker accepts -Wl,-blibpath])
1511 O_LDFLAGS="$LDFLAGS"
1512 LDFLAGS="$O_LDFLAGS -Wl,-blibpath:/usr/lib:/lib"
1513 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [
1514 if test -n "$with_blibpath" -a "$with_blibpath" != "yes"; then
1515 blibpath="$with_blibpath"
1516 elif test -n "$GCC"; then
1517 blibpath="/usr/lib:/lib:/usr/local/lib"
1519 blibpath="/usr/lib:/lib"
1522 ], [AC_MSG_RESULT(no)])
1524 LDFLAGS="$O_LDFLAGS"
1526 # On AIX 6 and higher default to PAM, else default to LAM
1527 if test $OSMAJOR -ge 6; then
1528 if test X"$with_pam" = X""; then
1532 if test X"$with_aixauth" = X""; then
1533 AC_CHECK_FUNCS(authenticate, [AUTH_EXCL_DEF="AIX_AUTH"])
1537 # AIX analog of nsswitch.conf, enabled by default
1538 AC_ARG_WITH(netsvc, [AS_HELP_STRING([--with-netsvc[[=PATH]]], [path to netsvc.conf])],
1539 [case $with_netsvc in
1541 yes) with_netsvc="/etc/netsvc.conf"
1545 if test -z "$with_nsswitch" -a -z "$with_netsvc"; then
1546 with_netsvc="/etc/netsvc.conf"
1549 # For implementing getgrouplist()
1550 AC_CHECK_FUNCS(getgrset)
1552 # LDR_PRELOAD is only supported in AIX 5.3 and later
1553 if test $OSMAJOR -lt 5; then
1556 RTLD_PRELOAD_VAR="LDR_PRELOAD"
1559 # AIX-specific functions
1560 AC_CHECK_FUNCS(getuserattr setauthdb)
1561 COMMON_OBJS="$COMMON_OBJS aix.lo"
1565 : ${mansectform='4'}
1568 # AFS support needs -lBSD
1569 if test "$with_AFS" = "yes"; then
1570 AFS_LIBS="-lc -lBSD"
1573 : ${mansectform='4'}
1575 # The HP bundled compiler cannot generate shared libs
1576 if test -z "$GCC"; then
1577 AC_CACHE_CHECK([for HP bundled C compiler],
1578 [sudo_cv_var_hpccbundled],
1579 [if $CC -V 2>&1 | grep '^(Bundled)' >/dev/null 2>&1; then
1580 sudo_cv_var_hpccbundled=yes
1582 sudo_cv_var_hpccbundled=no
1585 if test "$sudo_cv_var_hpccbundled" = "yes"; then
1586 AC_MSG_ERROR([The HP bundled C compiler is unable to build Sudo, you must use gcc or the HP ANSI C compiler instead.])
1590 # Build PA-RISC1.1 objects for better portability
1594 if test -n "$GCC"; then
1595 portable_flag="-march=1.1"
1597 portable_flag="+DAportable"
1599 CFLAGS="$CFLAGS $portable_flag"
1600 AC_CACHE_CHECK([whether $CC understands $portable_flag],
1601 [sudo_cv_var_daportable],
1603 [AC_LANG_PROGRAM([[]], [[]])],
1604 [sudo_cv_var_daportable=yes],
1605 [sudo_cv_var_daportable=no]
1609 if test X"$sudo_cv_var_daportable" != X"yes"; then
1617 AC_DEFINE(BROKEN_SYSLOG)
1620 AC_DEFINE(BROKEN_SYSLOG)
1622 shadow_funcs="getspwuid"
1624 # DCE support (requires ANSI C compiler)
1625 if test "$with_DCE" = "yes"; then
1626 # order of libs in 9.X is important. -lc_r must be last
1627 SUDOERS_LIBS="${SUDOERS_LIBS} -ldce -lM -lc_r"
1628 LIBS="${LIBS} -ldce -lM -lc_r"
1629 CPPFLAGS="${CPPFLAGS} -D_REENTRANT -I/usr/include/reentrant"
1633 shadow_funcs="getprpwnam iscomsec"
1635 # HP-UX 10.20 libc has an incompatible getline
1636 ac_cv_func_getline="no"
1639 shadow_funcs="getspnam iscomsec"
1641 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1646 # ignore envariables wrt dynamic lib path
1647 SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} -Wl,-no_library_replacement"
1649 : ${CHECKSIA='true'}
1650 AC_MSG_CHECKING(whether to disable sia support on Digital UNIX)
1652 [AS_HELP_STRING([--disable-sia], [Disable SIA on Digital UNIX])],
1653 [ case "$enableval" in
1654 yes) AC_MSG_RESULT(no)
1657 no) AC_MSG_RESULT(yes)
1660 *) AC_MSG_RESULT(no)
1661 AC_MSG_WARN([Ignoring unknown argument to --enable-sia: $enableval])
1664 ], AC_MSG_RESULT(no))
1666 shadow_funcs="getprpwnam dispcrypt"
1667 # OSF/1 4.x and higher need -ldb too
1668 if test $OSMAJOR -lt 4; then
1669 shadow_libs="-lsecurity -laud -lm"
1671 shadow_libs="-lsecurity -ldb -laud -lm"
1674 # use SIA by default, if we have it
1675 test "$CHECKSIA" = "true" && AUTH_EXCL_DEF="SIA"
1678 # Some versions of Digital Unix ship with a broken
1679 # copy of prot.h, which we need for shadow passwords.
1680 # XXX - make should remove this as part of distclean
1682 AC_MSG_CHECKING([for broken prot.h])
1683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1684 #include <sys/types.h>
1685 #include <sys/security.h>
1687 ]], [[exit(0);]])], [AC_MSG_RESULT(no)], [AC_MSG_RESULT([yes, fixing locally])
1688 sed 's:<acl.h>:<sys/acl.h>:g' < /usr/include/prot.h > prot.h
1690 # ":DEFAULT" must be appended to _RLD_LIST
1691 RTLD_PRELOAD_VAR="_RLD_LIST"
1692 RTLD_PRELOAD_DEFAULT="DEFAULT"
1694 : ${mansectform='4'}
1697 OSDEFS="${OSDEFS} -D_BSD_TYPES"
1698 if test -z "$NROFFPROG"; then
1699 MAN_POSTINSTALL=' /bin/rm -f $(mandirsu)/sudo.$(mansectsu).z $(mandirsu)/visudo.$(mansectsu).z $(mandirform)/sudoers.$(mansectform).z ; /usr/bin/pack $(mandirsu)/sudo.$(mansectsu) $(mandirsu)/visudo.$(mansectsu) $(mandirform)/sudoers.$(mansectform)'
1700 if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1701 if test -d /usr/share/catman/local; then
1702 mandir="/usr/share/catman/local"
1704 mandir="/usr/catman/local"
1708 if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1709 if test -d "/usr/share/man/local"; then
1710 mandir="/usr/share/man/local"
1712 mandir="/usr/man/local"
1716 # IRIX <= 4 needs -lsun
1717 if test "$OSMAJOR" -le 4; then
1718 AC_CHECK_LIB(sun, getpwnam, [LIBS="${LIBS} -lsun"])
1720 # ":DEFAULT" must be appended to _RLD_LIST
1721 RTLD_PRELOAD_VAR="_RLD_LIST"
1722 RTLD_PRELOAD_DEFAULT="DEFAULT"
1724 : ${mansectform='4'}
1726 *-*-linux*|*-*-k*bsd*-gnu)
1727 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1728 # Some Linux versions need to link with -lshadow
1729 shadow_funcs="getspnam"
1730 shadow_libs_optional="-lshadow"
1731 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1734 OSDEFS="${OSDEFS} -D_CONVEX_SOURCE"
1735 if test -z "$GCC"; then
1736 CFLAGS="${CFLAGS} -D__STDC__"
1739 shadow_defs="-D_AUDIT -D_ACL -DSecureWare"
1740 shadow_funcs="getprpwnam"
1741 shadow_libs="-lprot"
1745 shadow_funcs="getauthuid"
1746 shadow_libs="-lauth"
1749 LIBS="${LIBS} -lsun -lbsd"
1750 CPPFLAGS="${CPPFLAGS} -I/usr/include -I/usr/include/bsd"
1751 OSDEFS="${OSDEFS} -D_MIPS"
1753 : ${mansectform='4'}
1756 OSDEFS="${OSDEFS} -D_ISC"
1758 SUDOERS_LIBS="${SUDOERS_LIBS} -lcrypt"
1760 shadow_funcs="getspnam"
1764 : ${mansectform='4'}
1767 shadow_funcs="getprpwnam"
1768 shadow_libs="-lprot -lx"
1770 : ${mansectform='4'}
1772 m88k-motorola-sysv*)
1773 # motorolla's cc (a variant of gcc) does -O but not -O2
1774 CFLAGS=`echo $CFLAGS | sed 's/-O2/-O/g'`
1776 : ${mansectform='4'}
1779 shadow_funcs="getspnam"
1782 : ${mansectform='4'}
1783 : ${with_rpath='yes'}
1785 *-ncr-sysv4*|*-ncr-sysvr4*)
1786 AC_CHECK_LIB(c89, strcasecmp, [LIBS="${LIBS} -lc89"])
1788 : ${mansectform='4'}
1789 : ${with_rpath='yes'}
1791 *-ccur-sysv4*|*-ccur-sysvr4*)
1792 LIBS="${LIBS} -lgen"
1794 : ${mansectform='4'}
1795 : ${with_rpath='yes'}
1799 # Check for newer BSD auth API
1800 if test -z "$with_bsdauth"; then
1801 AC_CHECK_FUNCS(auth_challenge, [AUTH_EXCL_DEF="BSD_AUTH"])
1805 # FreeBSD has a real setreuid(2) starting with 2.1 and
1806 # backported to 2.0.5. We just take 2.1 and above...
1812 OSDEFS="${OSDEFS} -D_BSD_SOURCE"
1813 if test "${with_skey-'no'}" = "yes"; then
1814 SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
1817 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1818 : ${with_logincap='maybe'}
1821 # OpenBSD has a real setreuid(2) starting with 3.3 but
1822 # we will use setresuid(2) instead.
1824 OSDEFS="${OSDEFS} -D_BSD_SOURCE"
1826 # OpenBSD >= 3.0 supports BSD auth
1827 if test -z "$with_bsdauth"; then
1828 if test "$OSMAJOR" -ge 3; then
1829 AUTH_EXCL_DEF="BSD_AUTH"
1832 : ${with_logincap='maybe'}
1835 # NetBSD has a real setreuid(2) starting with 1.3.2
1837 0.9*|1.[[012]]*|1.3|1.3.1)
1842 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1843 : ${with_logincap='maybe'}
1846 OSDEFS="${OSDEFS} -D_BSD_SOURCE"
1847 if test "${with_skey-'no'}" = "yes"; then
1848 SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
1851 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1852 : ${with_logincap='yes'}
1858 # Darwin has a real setreuid(2) starting with 9.0
1859 if test $OSMAJOR -lt 9; then
1863 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1864 : ${with_logincap='yes'}
1865 RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
1866 RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
1869 # lockf() on is broken on the NeXT -- use flock instead
1871 ac_cv_func_flock=yes
1872 RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
1873 RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
1877 : ${mansectform='4'}
1878 : ${with_rpath='yes'}
1882 : ${mansectform='4'}
1885 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1890 dnl Library preloading to support NOEXEC
1892 if test -n "$with_noexec"; then
1893 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_VAR, "$RTLD_PRELOAD_VAR")
1894 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_DELIM, "$RTLD_PRELOAD_DELIM")
1895 if test -n "$RTLD_PRELOAD_DEFAULT"; then
1896 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_DEFAULT, "$RTLD_PRELOAD_DEFAULT")
1898 if test -n "$RTLD_PRELOAD_ENABLE_VAR"; then
1899 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_ENABLE_VAR, "$RTLD_PRELOAD_ENABLE_VAR")
1904 dnl Check for mixing mutually exclusive and regular auth methods
1906 AUTH_REG=${AUTH_REG# }
1907 AUTH_EXCL=${AUTH_EXCL# }
1908 if test -n "$AUTH_EXCL"; then
1910 if test $# != 1; then
1911 AC_MSG_ERROR([More than one mutually exclusive authentication method specified: $AUTH_EXCL])
1913 if test -n "$AUTH_REG"; then
1914 AC_MSG_ERROR([Cannot mix mutually exclusive ($AUTH_EXCL) and regular ($AUTH_REG) authentication methods])
1918 dnl Only one of S/Key and OPIE may be specified
1920 if test X"${with_skey}${with_opie}" = X"yesyes"; then
1921 AC_MSG_ERROR(["cannot use both S/Key and OPIE"])
1925 dnl Use BSD-style man sections by default
1928 : ${mansectform='5'}
1931 dnl Add in any libpaths or libraries specified via configure
1933 if test -n "$with_libpath"; then
1934 for i in ${with_libpath}; do
1935 SUDO_APPEND_LIBPATH(LDFLAGS, [$i])
1938 if test -n "$with_libraries"; then
1939 for i in ${with_libraries}; do
1951 dnl C compiler checks (to be done after os checks)
1953 AC_PROG_GCC_TRADITIONAL
1956 # Check for variadic macro support in cpp
1957 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1959 #if defined(__GNUC__) && __GNUC__ == 2
1960 # define sudo_fprintf(fp, fmt...) fprintf((fp), (fmt))
1962 # define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
1964 ], [sudo_fprintf(stderr, "a %s", "test");])], [], [AC_MSG_ERROR([Your C compiler doesn't support variadic macros, try building with gcc instead])])
1965 if test X"$with_gnu_ld" != "yes" -a -n "$GCC"; then
1967 CFLAGS="$CFLAGS -static-libgcc"
1968 AC_CACHE_CHECK([whether $CC understands -static-libgcc],
1969 [sudo_cv_var_gcc_static_libgcc],
1971 [AC_LANG_PROGRAM([[]], [[]])],
1972 [sudo_cv_var_gcc_static_libgcc=yes],
1973 [sudo_cv_var_gcc_static_libgcc=no]
1978 if test "$sudo_cv_var_gcc_static_libgcc" = "yes"; then
1979 LTLDFLAGS="$LTLDFLAGS -Wc,-static-libgcc"
1986 AC_PATH_PROG([FLEX], [flex], [flex])
1989 if test -z "$with_sendmail"; then
1994 dnl Check for authpriv support in syslog
1996 AC_MSG_CHECKING(which syslog facility sudo should log with)
1997 if test X"$with_logfac" = X""; then
1998 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <syslog.h>]], [[int i = LOG_AUTHPRIV; (void)i;]])], [logfac=authpriv])
2000 AC_DEFINE_UNQUOTED(LOGFAC, "$logfac", [The syslog facility sudo will use.])
2001 AC_MSG_RESULT($logfac)
2003 dnl Header file checks
2010 AC_CHECK_HEADERS(malloc.h netgroup.h paths.h spawn.h utime.h utmpx.h sys/sockio.h sys/bsdtypes.h sys/select.h sys/stropts.h sys/sysmacros.h)
2011 AC_CHECK_HEADERS([procfs.h] [sys/procfs.h], [AC_CHECK_MEMBERS(struct psinfo.pr_ttydev, [AC_CHECK_FUNCS(_ttyname_dev)], [], [AC_INCLUDES_DEFAULT
2012 #ifdef HAVE_PROCFS_H
2015 #ifdef HAVE_SYS_PROCFS_H
2016 #include <sys/procfs.h>
2021 dnl Check for large file support. HP-UX 11.23 has a broken sys/type.h
2022 dnl when large files support is enabled so work around it.
2027 AC_CACHE_CHECK([whether sys/types.h needs _XOPEN_SOURCE_EXTENDED], [sudo_cv_xopen_source_extended],
2028 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
2029 #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=no], [
2030 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _XOPEN_SOURCE_EXTENDED
2032 #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=yes],
2033 [sudo_cv_xopen_source_extended=error])
2035 if test "$sudo_cv_xopen_source_extended" = "yes"; then
2036 OSDEFS="${OSDEFS} -D_XOPEN_SOURCE_EXTENDED"
2037 SUDO_DEFINE(_XOPEN_SOURCE_EXTENDED)
2041 AC_SYS_POSIX_TERMIOS
2042 if test "$ac_cv_sys_posix_termios" != "yes"; then
2043 AC_MSG_ERROR([Must have POSIX termios to build sudo])
2046 if test ${with_logincap-'no'} != "no"; then
2047 AC_CHECK_HEADERS(login_cap.h, [LOGINCAP_USAGE='[[-c class|-]] '; LCMAN=1
2050 SUDO_LIBS="${SUDO_LIBS} -lutil"
2051 SUDOERS_LIBS="${SUDOERS_LIBS} -lutil"
2056 if test ${with_project-'no'} != "no"; then
2057 AC_CHECK_HEADER(project.h, [
2058 AC_CHECK_LIB(project, setproject, [
2059 AC_DEFINE(HAVE_PROJECT_H)
2060 SUDO_LIBS="${SUDO_LIBS} -lproject"
2069 AC_CHECK_TYPE([__signed char], [], [AC_CHECK_TYPE([signed char], [AC_DEFINE(__signed, signed)], [AC_DEFINE(__signed, [])])])
2070 AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include <sys/types.h>
2071 #include <signal.h>])
2072 AC_CHECK_TYPES([sigaction_t], [], [], [#include <sys/types.h>
2073 #include <signal.h>])
2074 AC_CHECK_TYPES([struct timespec], [], [], [#include <sys/types.h>
2075 #if TIME_WITH_SYS_TIME
2076 # include <sys/time.h>
2079 AC_CHECK_TYPES([struct in6_addr], [], [], [#include <sys/types.h>
2080 #include <netinet/in.h>])
2081 AC_TYPE_LONG_LONG_INT
2082 AC_CHECK_SIZEOF([long int])
2083 AC_CHECK_TYPE(size_t, unsigned int)
2084 AC_CHECK_TYPE(ssize_t, int)
2085 AC_CHECK_TYPE(dev_t, int)
2086 AC_CHECK_TYPE(ino_t, unsigned int)
2087 AC_CHECK_TYPE(socklen_t, [], [AC_DEFINE(socklen_t, unsigned int)], [
2089 #include <sys/socket.h>])
2093 dnl Check for utmp/utmpx struct members.
2094 dnl We need to include OSDEFS for glibc which only has __e_termination
2095 dnl visible when _GNU_SOURCE is *not* defined.
2098 CFLAGS="$CFLAGS $OSDEFS"
2099 if test $ac_cv_header_utmpx_h = "yes"; then
2100 AC_CHECK_MEMBERS([struct utmpx.ut_id, struct utmpx.ut_pid, struct utmpx.ut_tv, struct utmpx.ut_type], [], [], [
2101 #include <sys/types.h>
2105 dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
2107 AC_CHECK_MEMBERS([struct utmpx.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [
2108 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [], [
2109 #include <sys/types.h>
2113 #include <sys/types.h>
2117 AC_CHECK_MEMBERS([struct utmp.ut_id, struct utmp.ut_pid, struct utmp.ut_tv, struct utmp.ut_type, struct utmp.ut_user], [], [], [
2118 #include <sys/types.h>
2122 dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
2124 AC_CHECK_MEMBERS([struct utmp.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [
2125 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [], [
2126 #include <sys/types.h>
2130 #include <sys/types.h>
2140 AC_CHECK_FUNCS(glob strrchr sysconf tzset strftime setenv \
2141 regcomp setlocale nl_langinfo mbr_check_membership \
2143 AC_REPLACE_FUNCS(getgrouplist)
2144 AC_CHECK_FUNCS(getline, [], [
2146 AC_CHECK_FUNCS(fgetln)
2149 dnl If libc supports _FORTIFY_SOURCE check functions, use it.
2151 O_CPPFLAGS="$CPPFLAGS"
2152 CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
2153 AC_CHECK_FUNC(__sprintf_chk, [
2154 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[char buf[4]; (void)sprintf(buf, "%s", "foo");]])], [OSDEFS="${OSDEFS} -D_FORTIFY_SOURCE=2"], [])
2156 CPPFLAGS="$O_CPPFLAGS"
2159 AC_CHECK_FUNCS(getutxid getutid, [utmp_style=POSIX; break])
2160 if test "$utmp_style" = "LEGACY"; then
2161 AC_CHECK_FUNCS(getttyent ttyslot, [break])
2164 AC_CHECK_FUNCS(sysctl, [AC_CHECK_MEMBERS([struct kinfo_proc.ki_tdev], [],
2166 AC_CHECK_MEMBERS([struct kinfo_proc2.p_tdev], [], [
2167 AC_CHECK_MEMBERS([struct kinfo_proc.p_tdev], [], [
2168 AC_CHECK_MEMBERS([struct kinfo_proc.kp_eproc.e_tdev], [], [], [
2169 #include <sys/param.h>
2170 #include <sys/sysctl.h>
2173 #include <sys/param.h>
2174 #include <sys/sysctl.h>
2178 #include <sys/param.h>
2179 #include <sys/sysctl.h>
2183 #include <sys/param.h>
2184 #include <sys/sysctl.h>
2185 #include <sys/user.h>
2189 AC_CHECK_FUNCS(openpty, [AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])], [
2190 AC_CHECK_LIB(util, openpty, [
2191 AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])
2192 case "$SUDO_LIBS" in
2194 *) SUDO_LIBS="${SUDO_LIBS} -lutil";;
2196 AC_DEFINE(HAVE_OPENPTY)
2198 AC_CHECK_FUNCS(_getpty, [], [
2199 AC_CHECK_FUNCS(grantpt, [
2200 AC_CHECK_FUNCS(posix_openpt)
2202 AC_CHECK_FUNCS(revoke)
2207 AC_CHECK_FUNCS(unsetenv, [SUDO_FUNC_UNSETENV_VOID], [])
2208 SUDO_FUNC_PUTENV_CONST
2209 if test -z "$SKIP_SETRESUID"; then
2210 AC_CHECK_FUNCS(setresuid, [
2212 AC_CHECK_FUNCS(getresuid)
2215 if test -z "$SKIP_SETREUID"; then
2216 AC_CHECK_FUNCS(setreuid, [SKIP_SETEUID=yes])
2218 if test -z "$SKIP_SETEUID"; then
2219 AC_CHECK_FUNCS(seteuid)
2221 if test X"$with_interfaces" != X"no"; then
2222 AC_CHECK_FUNCS(getifaddrs, [AC_CHECK_FUNCS(freeifaddrs)])
2224 if test -z "$BROKEN_GETCWD"; then
2225 AC_REPLACE_FUNCS(getcwd)
2227 AC_CHECK_FUNCS(lockf flock, [break])
2228 AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]])
2229 AC_CHECK_FUNCS(utimes, [AC_CHECK_FUNCS(futimes futimesat, [break])], [AC_CHECK_FUNCS(futime) AC_LIBOBJ(utimes)])
2230 AC_CHECK_FUNCS(killpg, [], [AC_LIBOBJ(killpg)])
2231 SUDO_FUNC_FNMATCH([AC_DEFINE(HAVE_FNMATCH)], [AC_LIBOBJ(fnmatch)
2232 COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }fnm_test"
2235 AC_REPLACE_FUNCS(memrchr pw_dup strlcpy strlcat)
2236 AC_CHECK_FUNCS(nanosleep, [], [
2237 # On Solaris, nanosleep is in librt
2238 AC_CHECK_LIB(rt, nanosleep, [REPLAY_LIBS="${REPLAY_LIBS} -lrt"], [AC_LIBOBJ(nanosleep)])
2240 AC_CHECK_FUNCS(closefrom, [], [AC_LIBOBJ(closefrom)
2241 AC_CHECK_DECL(F_CLOSEM, AC_DEFINE(HAVE_FCNTL_CLOSEM), [],
2242 [ #include <limits.h>
2243 #include <fcntl.h> ])
2245 AC_CHECK_FUNCS(mkstemps mkdtemp, [], [
2246 AC_CHECK_FUNCS(random lrand48, [break])
2249 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf, , [NEED_SNPRINTF=1])
2250 if test X"$ac_cv_type_struct_timespec" != X"no"; then
2251 AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)]
2252 [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))],
2253 [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))])
2256 dnl Check for the dirfd function/macro. If not found, look for dd_fd in DIR.
2258 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2259 #include <$ac_header_dirent>]], [[DIR *d; (void)dirfd(d);]])], [AC_DEFINE(HAVE_DIRFD)], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2260 #include <$ac_header_dirent>]], [[DIR d; memset(&d, 0, sizeof(d)); return(d.dd_fd);]])], [AC_DEFINE(HAVE_DD_FD)], [])])
2261 AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [
2263 #include <$ac_header_dirent>
2266 dnl If NEED_SNPRINTF is set, add snprintf.c to LIBOBJS
2267 dnl (it contains snprintf, vsnprintf, asprintf, and vasprintf)
2269 if test -n "$NEED_SNPRINTF"; then
2273 dnl If socket(2) not in libc, check -lsocket and -linet
2274 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2276 AC_CHECK_FUNC(socket, [], [
2277 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2279 for lib in $libs; do
2282 *) _libs="$_libs $lib";;
2286 test -z "$libs" && continue
2287 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2288 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2289 SUDO_CHECK_LIB($lib, socket, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
2293 dnl If inet_addr(3) not in libc, check -lnsl and -linet
2294 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2296 AC_CHECK_FUNC(inet_addr, [], [
2297 AC_CHECK_FUNC(__inet_addr, [], [
2298 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2300 for lib in $libs; do
2303 *) _libs="$_libs $lib";;
2307 test -z "$libs" && continue
2308 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2309 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2310 SUDO_CHECK_LIB($lib, inet_addr, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
2315 dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet
2317 AC_CHECK_FUNC(syslog, [], [
2318 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2320 for lib in $libs; do
2323 *) _libs="$_libs $lib";;
2327 test -z "$libs" && continue
2328 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2329 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2330 SUDO_CHECK_LIB($lib, syslog, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
2334 dnl If getaddrinfo(3) not in libc, check -lsocket and -linet
2335 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols.
2337 AC_CHECK_FUNCS(getaddrinfo, [], [
2339 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2341 for lib in $libs; do
2344 *) _libs="$_libs $lib";;
2348 test -z "$libs" && continue
2349 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2350 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2351 SUDO_CHECK_LIB($lib, getaddrinfo, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; found=yes; break], [], [$extralibs])
2353 if test X"$found" != X"no"; then
2354 AC_DEFINE(HAVE_GETADDRINFO)
2358 dnl Check for getprogname() or __progname
2360 AC_CHECK_FUNCS(getprogname, , [
2361 AC_MSG_CHECKING([for __progname])
2362 AC_CACHE_VAL(sudo_cv___progname, [
2363 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; (void)puts(__progname);]])], [sudo_cv___progname=yes], [sudo_cv___progname=no])])
2364 if test "$sudo_cv___progname" = "yes"; then
2365 AC_DEFINE(HAVE___PROGNAME)
2367 AC_LIBOBJ(getprogname)
2369 AC_MSG_RESULT($sudo_cv___progname)
2372 dnl Check for __func__ or __FUNCTION__
2374 AC_MSG_CHECKING([for __func__])
2375 AC_CACHE_VAL(sudo_cv___func__, [
2376 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void)puts(__func__);]])], [sudo_cv___func__=yes], [sudo_cv___func__=no])])
2377 AC_MSG_RESULT($sudo_cv___func__)
2378 if test "$sudo_cv___func__" = "yes"; then
2379 AC_DEFINE(HAVE___FUNC__)
2380 elif test -n "$GCC"; then
2381 AC_MSG_CHECKING([for __FUNCTION__])
2382 AC_CACHE_VAL(sudo_cv___FUNCTION__, [
2383 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void)puts(__FUNCTION__);]])], [sudo_cv___FUNCTION__=yes], [sudo_cv___FUNCTION__=no])])
2384 AC_MSG_RESULT($sudo_cv___FUNCTION__)
2385 if test "$sudo_cv___FUNCTION__" = "yes"; then
2386 AC_DEFINE(HAVE___FUNC__)
2387 AC_DEFINE(__func__, __FUNCTION__, [Define to __FUNCTION__ if your compiler support __FUNCTION__ but not __func__])
2391 # gettext() and friends may be located in libc (Linux and Solaris)
2392 # or in libintl. However, it is possible to have libintl installed
2393 # even when gettext() is present in libc. In the case of GNU libintl,
2394 # gettext() will be defined to gettext_libintl in libintl.h.
2395 # Since gcc prefers /usr/local/include to /usr/include, we need to
2396 # make sure we use the gettext() that matches the include file.
2397 if test "$enable_nls" != "no"; then
2398 if test "$enable_nls" != "yes"; then
2399 CPPFLAGS="${CPPFLAGS} -I${enable_nls}/include"
2400 SUDO_APPEND_LIBPATH(LDFLAGS, [$enable_nls/lib])
2403 for l in "libc" "-lintl" "-lintl -liconv"; do
2404 if test "$l" = "libc"; then
2405 # If user specified a dir for libintl ignore libc
2406 if test "$enable_nls" != "yes"; then
2409 gettext_name=sudo_cv_gettext
2410 AC_MSG_CHECKING([for gettext])
2413 gettext_name=sudo_cv_gettext"`echo $l|sed -e 's/ //g' -e 's/-/_/g'`"
2414 AC_MSG_CHECKING([for gettext in $l])
2416 AC_CACHE_VAL($gettext_name, [
2419 AC_LANG_PROGRAM([[#include <libintl.h>]], [(void)gettext((char *)0);])
2420 ], [eval $gettext_name=yes], [eval $gettext_name=no]
2423 eval gettext_result="\$$gettext_name"
2424 AC_MSG_RESULT($gettext_result)
2425 test "$gettext_result" = "yes" && break
2429 if test "$sudo_cv_gettext" = "yes"; then
2430 AC_DEFINE(HAVE_LIBINTL_H)
2432 elif test "$sudo_cv_gettext_lintl" = "yes"; then
2433 AC_DEFINE(HAVE_LIBINTL_H)
2436 elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
2437 AC_DEFINE(HAVE_LIBINTL_H)
2439 LIBINTL="-lintl -liconv"
2444 dnl Deferred zlib option processing.
2445 dnl By default we use the system zlib if it is present.
2446 dnl If a directory was specified for zlib (or we are use sudo's version),
2447 dnl prepend the include dir to make sure we get the right zlib header.
2449 case "$enable_zlib" in
2451 AC_CHECK_LIB(z, gzdopen, [
2452 AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"], [enable_zlib=builtin])
2458 AC_DEFINE(HAVE_ZLIB_H)
2465 AC_DEFINE(HAVE_ZLIB_H)
2466 CPPFLAGS="-I${enable_zlib}/include ${CPPFLAGS}"
2467 SUDO_APPEND_LIBPATH(ZLIB, [$enable_zlib/lib])
2471 if test X"$enable_zlib" = X"builtin"; then
2472 AC_DEFINE(HAVE_ZLIB_H)
2473 CPPFLAGS='-I$(top_builddir)/zlib -I$(top_srcdir)/zlib '"${CPPFLAGS}"
2474 ZLIB="${ZLIB}"' $(top_builddir)/zlib/libz.la'
2476 AC_CONFIG_HEADER([zlib/zconf.h])
2477 AC_CONFIG_FILES([zlib/Makefile])
2481 dnl Check for errno declaration in errno.h
2483 AC_CHECK_DECLS([errno], [], [], [
2489 dnl Check for h_errno declaration in netdb.h
2491 AC_CHECK_DECLS([h_errno], [], [], [
2497 dnl Check for strsignal() or sys_siglist
2499 AC_CHECK_FUNCS(strsignal, [], [
2500 AC_LIBOBJ(strsignal)
2501 HAVE_SIGLIST="false"
2502 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], [
2509 if test "$HAVE_SIGLIST" != "true"; then
2515 dnl nsswitch.conf and its equivalents
2517 if test ${with_netsvc-"no"} != "no"; then
2518 SUDO_DEFINE_UNQUOTED(_PATH_NETSVC_CONF, "${with_netsvc-/etc/netsvc.conf}")
2519 netsvc_conf=${with_netsvc-/etc/netsvc.conf}
2520 elif test ${with_nsswitch-"yes"} != "no"; then
2521 SUDO_DEFINE_UNQUOTED(_PATH_NSSWITCH_CONF, "${with_nsswitch-/etc/nsswitch.conf}")
2522 nsswitch_conf=${with_nsswitch-/etc/nsswitch.conf}
2526 dnl Mutually exclusive auth checks come first, followed by
2527 dnl non-exclusive ones. Note: passwd must be last of all!
2531 dnl Convert default authentication methods to with_* if
2532 dnl no explicit authentication scheme was specified.
2534 if test -z "${AUTH_EXCL}${AUTH_REG}" -a -n "$AUTH_EXCL_DEF"; then
2535 for auth in $AUTH_EXCL_DEF; do
2537 AIX_AUTH) with_aixauth=maybe;;
2538 BSD_AUTH) with_bsdauth=maybe;;
2539 PAM) with_pam=maybe;;
2540 SIA) CHECKSIA=true;;
2546 dnl PAM support. Systems that use PAM by default set with_pam=default
2547 dnl and we do the actual tests here.
2549 if test ${with_pam-"no"} != "no"; then
2551 # Check for pam_start() in libpam first, then for pam_appl.h.
2554 AC_CHECK_LIB(pam, pam_start, [found_pam_lib=yes], [], [$lt_cv_dlopen_libs])
2556 # Some PAM implementations (MacOS X for example) put the PAM headers
2557 # in /usr/include/pam instead of /usr/include/security...
2560 AC_CHECK_HEADERS([security/pam_appl.h] [pam/pam_appl.h], [found_pam_hdrs=yes; break])
2561 if test "$found_pam_lib" = "yes" -a "$found_pam_hdrs" = "yes"; then
2562 # Found both PAM libs and headers
2564 elif test "$with_pam" = "yes"; then
2565 if test "$found_pam_lib" = "no"; then
2566 AC_MSG_ERROR(["--with-pam specified but unable to locate PAM development library."])
2568 if test "$found_pam_hdrs" = "no"; then
2569 AC_MSG_ERROR(["--with-pam specified but unable to locate PAM development headers."])
2571 elif test "$found_pam_lib" != "$found_pam_hdrs"; then
2572 if test "$found_pam_lib" = "no"; then
2573 AC_MSG_ERROR(["found PAM headers but no PAM development library; specify --without-pam to build without PAM"])
2575 if test "$found_pam_hdrs" = "no"; then
2576 AC_MSG_ERROR(["found PAM library but no PAM development headers; specify --without-pam to build without PAM"])
2580 if test "$with_pam" = "yes"; then
2581 # Older PAM implementations lack pam_getenvlist
2583 LIBS="$LIBS -lpam $lt_cv_dlopen_libs"
2584 AC_CHECK_FUNCS(pam_getenvlist)
2587 # We already link with -ldl if needed (see LIBDL below)
2588 SUDOERS_LIBS="${SUDOERS_LIBS} -lpam"
2590 AUTH_OBJS="$AUTH_OBJS pam.lo";
2593 AC_ARG_WITH(pam-login, [AS_HELP_STRING([--with-pam-login], [enable specific PAM session for sudo -i])],
2594 [case $with_pam_login in
2595 yes) AC_DEFINE([HAVE_PAM_LOGIN])
2596 AC_MSG_CHECKING(whether to use PAM login)
2600 *) AC_MSG_ERROR(["--with-pam-login does not take an argument."])
2604 AC_MSG_CHECKING(whether to use PAM session support)
2605 AC_ARG_ENABLE(pam_session,
2606 [AS_HELP_STRING([--disable-pam-session], [Disable PAM session support])],
2607 [ case "$enableval" in
2608 yes) AC_MSG_RESULT(yes)
2610 no) AC_MSG_RESULT(no)
2611 AC_DEFINE(NO_PAM_SESSION)
2613 *) AC_MSG_RESULT(no)
2614 AC_MSG_WARN([Ignoring unknown argument to --enable-pam-session: $enableval])
2616 esac], AC_MSG_RESULT(yes))
2621 dnl AIX general authentication
2622 dnl If set to "maybe" only enable if no other exclusive method in use.
2624 if test ${with_aixauth-'no'} != "no"; then
2625 if test X"$with_aixauth" != X"maybe" -o X"$AUTH_EXCL" = X""; then
2626 AC_MSG_NOTICE([using AIX general authentication])
2627 AC_DEFINE(HAVE_AIXAUTH)
2628 AUTH_OBJS="$AUTH_OBJS aix_auth.lo";
2629 SUDOERS_LIBS="${SUDOERS_LIBS} -ls"
2635 dnl BSD authentication
2636 dnl If set to "maybe" only enable if no other exclusive method in use.
2638 if test ${with_bsdauth-'no'} != "no"; then
2639 AC_CHECK_HEADER(bsd_auth.h, AC_DEFINE(HAVE_BSD_AUTH_H)
2640 [AUTH_OBJS="$AUTH_OBJS bsdauth.lo"]
2641 [BSDAUTH_USAGE='[[-a auth_type]] ']
2642 [AUTH_EXCL=BSD_AUTH; BAMAN=1],
2643 [AC_MSG_ERROR([BSD authentication was specified but bsd_auth.h could not be found])])
2647 dnl SIA authentication for Tru64 Unix
2649 if test ${CHECKSIA-'false'} = "true"; then
2650 AC_CHECK_FUNCS(sia_ses_init, [found=true], [found=false])
2651 if test "$found" = "true"; then
2653 AUTH_OBJS="$AUTH_OBJS sia.lo"
2658 dnl extra FWTK libs + includes
2660 if test ${with_fwtk-'no'} != "no"; then
2661 if test "$with_fwtk" != "yes"; then
2662 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_fwtk}])
2663 CPPFLAGS="${CPPFLAGS} -I${with_fwtk}"
2666 SUDOERS_LIBS="${SUDOERS_LIBS} -lauth -lfwall"
2667 AUTH_OBJS="$AUTH_OBJS fwtk.lo"
2671 dnl extra SecurID lib + includes
2673 if test ${with_SecurID-'no'} != "no"; then
2674 if test "$with_SecurID" != "yes"; then
2676 elif test -d /usr/ace/examples; then
2677 with_SecurID=/usr/ace/examples
2679 with_SecurID=/usr/ace
2681 CPPFLAGS="${CPPFLAGS} -I${with_SecurID}"
2682 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_SecurID}])
2683 SUDOERS_LIBS="${SUDOERS_LIBS} -laceclnt -lpthread"
2684 AUTH_OBJS="$AUTH_OBJS securid5.lo";
2688 dnl Non-mutually exclusive auth checks come next.
2689 dnl Note: passwd must be last of all!
2693 dnl Convert default authentication methods to with_* if
2694 dnl no explicit authentication scheme was specified.
2696 if test -z "${AUTH_EXCL}" -a -n "$AUTH_DEF"; then
2697 for auth in $AUTH_DEF; do
2699 passwd) : ${with_passwd='maybe'};;
2706 dnl There is an easy way and a hard way...
2708 if test ${with_kerb5-'no'} != "no"; then
2709 AC_CHECK_PROG(KRB5CONFIG, krb5-config, yes, "")
2710 if test -n "$KRB5CONFIG"; then
2711 AC_DEFINE(HAVE_KERB5)
2712 AUTH_OBJS="$AUTH_OBJS kerb5.lo"
2713 CPPFLAGS="$CPPFLAGS `krb5-config --cflags`"
2714 SUDOERS_LIBS="$SUDOERS_LIBS `krb5-config --libs`"
2716 dnl Try to determine whether we have Heimdal or MIT Kerberos
2718 AC_MSG_CHECKING(whether we are using Heimdal)
2719 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2721 AC_DEFINE(HAVE_HEIMDAL)
2727 AC_DEFINE(HAVE_KERB5)
2729 dnl Use the specified directory, if any, else search for correct inc dir
2731 if test "$with_kerb5" = "yes"; then
2733 O_CPPFLAGS="$CPPFLAGS"
2734 for dir in "" "kerberosV/" "krb5/" "kerberos5/" "kerberosv5/"; do
2735 CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2736 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]])], [found=yes; break])
2738 if test X"$found" = X"no"; then
2739 CPPFLAGS="$O_CPPFLAGS"
2740 AC_MSG_WARN([Unable to locate Kerberos V include files, you will have to edit the Makefile and add -I/path/to/krb/includes to CPPFLAGS])
2743 dnl XXX - try to include krb5.h here too
2744 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_kerb5}/lib])
2745 CPPFLAGS="$CPPFLAGS -I${with_kerb5}/include"
2749 dnl Try to determine whether we have Heimdal or MIT Kerberos
2751 AC_MSG_CHECKING(whether we are using Heimdal)
2752 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2754 AC_DEFINE(HAVE_HEIMDAL)
2755 # XXX - need to check whether -lcrypo is needed!
2756 SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5 -lcrypto -ldes -lcom_err -lasn1"
2757 AC_CHECK_LIB(roken, main, [SUDOERS_LIBS="${SUDOERS_LIBS} -lroken"])
2760 SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5 -lk5crypto -lcom_err"
2761 AC_CHECK_LIB(krb5support, main, [SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5support"])
2763 AUTH_OBJS="$AUTH_OBJS kerb5.lo"
2766 LIBS="${LIBS} ${SUDOERS_LIBS}"
2767 AC_CHECK_FUNCS(krb5_verify_user krb5_init_secure_context)
2768 AC_CHECK_FUNCS(krb5_get_init_creds_opt_alloc, [
2769 AC_CACHE_CHECK([whether krb5_get_init_creds_opt_free takes a context],
2770 sudo_cv_krb5_get_init_creds_opt_free_two_args, [
2773 [[#include <krb5.h>]],
2774 [[krb5_get_init_creds_opt_free(NULL, NULL);]]
2776 [sudo_cv_krb5_get_init_creds_opt_free_two_args=yes],
2777 [sudo_cv_krb5_get_init_creds_opt_free_two_args=no]
2782 if test X"$sudo_cv_krb5_get_init_creds_opt_free_two_args" = X"yes"; then
2783 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS)
2786 AC_MSG_CHECKING(whether to use an instance name for Kerberos V)
2787 AC_ARG_ENABLE(kerb5-instance,
2788 [AS_HELP_STRING([--enable-kerb5-instance], [instance string to append to the username (separated by a slash)])],
2789 [ case "$enableval" in
2790 yes) AC_MSG_ERROR(["must give --enable-kerb5-instance an argument."])
2792 no) AC_MSG_RESULT(no)
2794 *) SUDO_DEFINE_UNQUOTED(SUDO_KRB5_INSTANCE, "$enableval")
2795 AC_MSG_RESULT([$enableval])
2797 esac], AC_MSG_RESULT(no))
2801 dnl extra AFS libs and includes
2803 if test ${with_AFS-'no'} = "yes"; then
2805 # looks like the "standard" place for AFS libs is /usr/afsws/lib
2806 AFSLIBDIRS="/usr/lib/afs /usr/afsws/lib /usr/afsws/lib/afs"
2807 for i in $AFSLIBDIRS; do
2808 if test -d ${i}; then
2809 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [$i])
2810 FOUND_AFSLIBDIR=true
2813 if test -z "$FOUND_AFSLIBDIR"; then
2814 AC_MSG_WARN([Unable to locate AFS libraries, you will have to edit the Makefile and add -L/path/to/afs/libs to SUDOERS_LDFLAGS or rerun configure with the --with-libpath options.])
2817 # Order is important here. Note that we build AFS_LIBS from right to left
2818 # since AFS_LIBS may be initialized with BSD compat libs that must go last
2819 AFS_LIBS="-laudit ${AFS_LIBS}"
2820 for i in $AFSLIBDIRS; do
2821 if test -f ${i}/util.a; then
2822 AFS_LIBS="${i}/util.a ${AFS_LIBS}"
2827 if test -z "$FOUND_UTIL_A"; then
2828 AFS_LIBS="-lutil ${AFS_LIBS}"
2830 AFS_LIBS="-lkauth -lprot -lubik -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err ${AFS_LIBS}"
2832 # AFS includes may live in /usr/include on some machines...
2833 for i in /usr/afsws/include; do
2834 if test -d ${i}; then
2835 CPPFLAGS="${CPPFLAGS} -I${i}"
2836 FOUND_AFSINCDIR=true
2840 if test -z "$FOUND_AFSLIBDIR"; then
2841 AC_MSG_WARN([Unable to locate AFS include dir, you may have to edit the Makefile and add -I/path/to/afs/includes to CPPFLAGS or rerun configure with the --with-incpath options.])
2844 AUTH_OBJS="$AUTH_OBJS afs.lo"
2848 dnl extra DCE obj + lib
2849 dnl Order of libs in HP-UX 10.x is important, -ldce must be last.
2851 if test ${with_DCE-'no'} = "yes"; then
2852 DCE_OBJS="${DCE_OBJS} dce_pwent.o"
2853 SUDOERS_LIBS="${SUDOERS_LIBS} -ldce"
2854 AUTH_OBJS="$AUTH_OBJS dce.lo"
2858 dnl extra S/Key lib and includes
2860 if test "${with_skey-'no'}" = "yes"; then
2861 O_LDFLAGS="$LDFLAGS"
2862 if test "$with_skey" != "yes"; then
2863 CPPFLAGS="${CPPFLAGS} -I${with_skey}/include"
2864 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_skey}/lib])
2865 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_skey}/lib])
2866 AC_CHECK_HEADER([skey.h], [found=yes], [found=no], [#include <stdio.h>])
2869 O_CPPFLAGS="$CPPFLAGS"
2870 for dir in "" "/usr/local" "/usr/contrib"; do
2871 test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
2872 AC_CHECK_HEADER([skey.h], [found=yes; break], [],
2873 [#include <stdio.h>])
2875 if test "$found" = "no" -o -z "$dir"; then
2876 CPPFLAGS="$O_CPPFLAGS"
2878 SUDO_APPEND_LIBPATH(LDFLAGS, [${dir}/lib])
2879 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${dir}/lib])
2881 if test "$found" = "no"; then
2882 AC_MSG_WARN([Unable to locate skey.h, you will have to edit the Makefile and add -I/path/to/skey/includes to CPPFLAGS])
2885 AC_CHECK_LIB(skey, main, [found=yes], [AC_MSG_WARN([Unable to locate libskey.a, you will have to edit the Makefile and add -L/path/to/skey/lib to SUDOERS_LDFLAGS])])
2886 AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS))
2888 AC_MSG_CHECKING([for RFC1938-compliant skeychallenge])
2891 [[#include <stdio.h>
2892 #include <skey.h>]],
2893 [[skeychallenge(NULL, NULL, NULL, 0);]]
2895 AC_DEFINE(HAVE_RFC1938_SKEYCHALLENGE)
2896 AC_MSG_RESULT([yes])
2902 LDFLAGS="$O_LDFLAGS"
2903 SUDOERS_LIBS="${SUDOERS_LIBS} -lskey"
2904 AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
2908 dnl extra OPIE lib and includes
2910 if test "${with_opie-'no'}" = "yes"; then
2911 O_LDFLAGS="$LDFLAGS"
2912 if test "$with_opie" != "yes"; then
2913 CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
2914 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_opie}/lib])
2915 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_opie}/lib])
2916 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes], [found=no])
2919 O_CPPFLAGS="$CPPFLAGS"
2920 for dir in "" "/usr/local" "/usr/contrib"; do
2921 test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
2922 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes; break])
2924 if test "$found" = "no" -o -z "$dir"; then
2925 CPPFLAGS="$O_CPPFLAGS"
2927 SUDO_APPEND_LIBPATH(LDFLAGS, [${dir}/lib])
2928 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${dir}/lib])
2930 if test "$found" = "no"; then
2931 AC_MSG_WARN([Unable to locate opie.h, you will have to edit the Makefile and add -I/path/to/opie/includes to CPPFLAGS])
2934 AC_CHECK_LIB(opie, main, [found=yes], [AC_MSG_WARN([Unable to locate libopie.a, you will have to edit the Makefile and add -L/path/to/opie/lib to SUDOERS_LDFLAGS])])
2935 LDFLAGS="$O_LDFLAGS"
2936 SUDOERS_LIBS="${SUDOERS_LIBS} -lopie"
2937 AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
2941 dnl Check for shadow password routines if we have not already done so.
2942 dnl If there is a specific list of functions to check we do that first.
2943 dnl Otherwise, we check for SVR4-style and then SecureWare-style.
2945 if test ${with_passwd-'no'} != "no"; then
2947 dnl if crypt(3) not in libc, look elsewhere
2949 if test -z "$LIB_CRYPT"; then
2951 AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [test -n "$ac_lib" && SUDOERS_LIBS="${SUDOERS_LIBS} $ac_res"])
2955 if test "$CHECKSHADOW" = "true" -a -n "$shadow_funcs"; then
2957 LIBS="$LIBS $shadow_libs"
2959 AC_CHECK_FUNCS($shadow_funcs, [found=yes])
2960 if test "$found" = "yes"; then
2961 SUDOERS_LIBS="$SUDOERS_LIBS $shadow_libs"
2962 elif test -n "$shadow_libs_optional"; then
2963 LIBS="$LIBS $shadow_libs_optional"
2964 AC_CHECK_FUNCS($shadow_funcs, [found=yes])
2965 if test "$found" = "yes"; then
2966 SUDOERS_LIBS="$SUDOERS_LIBS $shadow_libs $shadow_libs_optional"
2969 if test "$found" = "yes"; then
2970 case "$shadow_funcs" in
2971 *getprpwnam*) SECUREWARE=1;;
2973 test -n "$shadow_defs" && OSDEFS="${OSDEFS} $shadow_defs"
2979 if test "$CHECKSHADOW" = "true"; then
2980 AC_SEARCH_LIBS([getspnam], [gen], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && SUDOERS_LIBS="${SUDOERS_LIBS} $ac_res"])
2982 if test "$CHECKSHADOW" = "true"; then
2983 AC_SEARCH_LIBS([getprpwnam], [sec security prot], [AC_DEFINE(HAVE_GETPRPWNAM)] [CHECKSHADOW=false; SECUREWARE=1; test -n "$ac_lib" && SUDOERS_LIBS="${SUDOERS_LIBS} $ac_res"])
2985 if test -n "$SECUREWARE"; then
2986 AC_CHECK_FUNCS(bigcrypt set_auth_parameters initprivs)
2987 AUTH_OBJS="$AUTH_OBJS secureware.lo"
2992 dnl extra lib and .o file for LDAP support
2994 if test ${with_ldap-'no'} != "no"; then
2996 if test "$with_ldap" != "yes"; then
2997 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_ldap}/lib])
2998 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_ldap}/lib])
2999 CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include"
3002 SUDOERS_OBJS="${SUDOERS_OBJS} ldap.lo"
3005 AC_MSG_CHECKING([for LDAP libraries])
3009 for l in -lldap -llber '-lssl -lcrypto'; do
3011 LDAP_LIBS="${LDAP_LIBS} $l"
3012 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3014 #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [found=yes; break])
3016 if test "$found" = "no"; then
3019 for l in -libmldap -lidsldif; do
3021 LDAP_LIBS="${LDAP_LIBS} $l"
3022 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3024 #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [found=yes; break])
3027 dnl if nothing linked just try with -lldap
3028 if test "$found" = "no"; then
3029 LIBS="${_LIBS} -lldap"
3031 AC_MSG_RESULT([not found, using -lldap])
3033 AC_MSG_RESULT([$LDAP_LIBS])
3035 dnl check if we need to link with -llber for ber_set_option
3037 AC_SEARCH_LIBS([ber_set_option], [lber], [found=yes], [found=no])
3038 if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
3039 LDAP_LIBS="$LDAP_LIBS -llber"
3041 dnl check if ldap.h includes lber.h for us
3042 AC_MSG_CHECKING([whether lber.h is needed])
3043 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3044 #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [AC_MSG_RESULT([no])], [
3045 AC_MSG_RESULT([yes])
3046 AC_DEFINE(HAVE_LBER_H)])
3048 AC_CHECK_HEADERS([sasl/sasl.h] [sasl.h], [AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s)], [break])
3049 AC_CHECK_HEADERS([ldap_ssl.h] [mps/ldap_ssl.h], [break], [], [#include <ldap.h>])
3050 AC_CHECK_FUNCS(ldap_initialize ldap_start_tls_s ldapssl_init ldapssl_set_strength ldap_unbind_ext_s ldap_str2dn ldap_create ldap_sasl_bind_s ldap_ssl_client_init ldap_start_tls_s_np)
3051 AC_CHECK_FUNCS(ldap_search_ext_s ldap_search_st, [break])
3053 if test X"$check_gss_krb5_ccache_name" = X"yes"; then
3054 AC_CHECK_LIB(gssapi, gss_krb5_ccache_name,
3055 AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
3056 [LDAP_LIBS="${LDAP_LIBS} -lgssapi"],
3057 AC_CHECK_LIB(gssapi_krb5, gss_krb5_ccache_name,
3058 AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
3059 [LDAP_LIBS="${LDAP_LIBS} -lgssapi_krb5"])
3062 # gssapi headers may be separate or part of Kerberos V
3064 O_CPPFLAGS="$CPPFLAGS"
3065 for dir in "" "kerberosV" "krb5" "kerberos5" "kerberosv5"; do
3066 test X"$dir" != X"" && CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
3067 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <gssapi/gssapi.h>]])], [found="gssapi/gssapi.h"; break], [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <gssapi.h>]])], [found="gssapi.h"; break])])
3069 if test X"$found" != X"no"; then
3070 AC_CHECK_HEADERS([$found])
3071 if test X"$found" = X"gssapi/gssapi.h"; then
3072 AC_CHECK_HEADERS([gssapi/gssapi_krb5.h])
3075 CPPFLAGS="$O_CPPFLAGS"
3076 AC_MSG_WARN([Unable to locate gssapi.h, you will have to edit the Makefile and add -I/path/to/gssapi/includes to CPPFLAGS])
3080 SUDOERS_LIBS="${SUDOERS_LIBS} ${LDAP_LIBS}"
3086 # How to do dynamic object loading.
3087 # We support dlopen() and sh_load(), else fall back to static loading.
3089 case "$lt_cv_dlopen" in
3091 AC_DEFINE(HAVE_DLOPEN)
3092 SUDOERS_OBJS="$SUDOERS_OBJS plugin_error.lo"
3093 LT_STATIC="--tag=disable-static"
3096 AC_DEFINE(HAVE_SHL_LOAD)
3097 SUDOERS_OBJS="$SUDOERS_OBJS plugin_error.lo"
3098 LT_STATIC="--tag=disable-static"
3102 if test X"${ac_cv_func_dlopen}" = X"yes"; then
3103 AC_MSG_ERROR(["dlopen present but libtool doesn't appear to support your platform."])
3105 # Preload sudoers module symbols
3106 SUDO_OBJS="${SUDO_OBJS} preload.o"
3107 SUDO_LIBS="${SUDO_LIBS} \$(top_builddir)/plugins/sudoers/sudoers.la"
3114 # Add library needed for dynamic loading, if any.
3116 LIBDL="$lt_cv_dlopen_libs"
3117 if test X"$LIBDL" != X""; then
3118 SUDO_LIBS="${SUDO_LIBS} $LIBDL"
3119 SUDOERS_LIBS="${SUDOERS_LIBS} $LIBDL"
3122 # On HP-UX, you cannot dlopen() a shared object that uses pthreads
3123 # unless the main program is linked against -lpthread. Since we
3124 # have no knowledge what libraries a plugin may depend on, we always
3125 # link against -lpthread on HP-UX if it is available.
3126 # This check should go after all other libraries tests.
3129 AC_CHECK_LIB(pthread, main, [SUDO_LIBS="${SUDO_LIBS} -lpthread"])
3134 dnl Add $blibpath to SUDOERS_LDFLAGS if specified by the user or if we
3135 dnl added -L dirpaths to SUDOERS_LDFLAGS.
3137 if test -n "$blibpath"; then
3138 if test -n "$blibpath_add"; then
3139 SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS -Wl,-blibpath:${blibpath}${blibpath_add}"
3140 elif test -n "$with_blibpath" -a "$with_blibpath" != "yes"; then
3141 SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS -Wl,-blibpath:${blibpath}"
3146 dnl Check for log file, timestamp and iolog locations
3148 if test "$utmp_style" = "LEGACY"; then
3156 dnl Use passwd auth module?
3158 case "$with_passwd" in
3160 AUTH_OBJS="$AUTH_OBJS getspwuid.lo passwd.lo"
3163 AC_DEFINE(WITHOUT_PASSWD)
3164 if test -z "$AUTH_OBJS"; then
3165 AC_MSG_ERROR([no authentication methods defined.])
3169 AUTH_OBJS=${AUTH_OBJS# }
3170 _AUTH=`echo "$AUTH_OBJS" | sed -e 's/\.lo//g' -e 's/getspwuid *//'`
3171 AC_MSG_NOTICE([using the following authentication methods: $_AUTH])
3174 dnl LIBS may contain duplicates from SUDO_LIBS, SUDOERS_LIBS, or NET_LIBS
3176 if test -n "$LIBS"; then
3181 for sl in ${SUDO_LIBS} ${SUDOERS_LIBS} ${NET_LIBS}; do
3182 test $l = $sl && dupe=1
3184 test $dupe = 0 && LIBS="${LIBS} $l"
3189 dnl We add -Wall and -Werror after all tests so they don't cause failures
3191 if test -n "$GCC"; then
3192 if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
3193 CFLAGS="${CFLAGS} -Wall"
3195 if test X"$enable_werror" = X"yes"; then
3196 CFLAGS="${CFLAGS} -Werror"
3203 test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
3206 dnl Defer setting _PATH_SUDO_NOEXEC until after exec_prefix is set
3207 dnl XXX - this is gross!
3209 if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no"; then
3210 oexec_prefix="$exec_prefix"
3211 if test "$exec_prefix" = '$(prefix)'; then
3212 if test "$prefix" = "NONE"; then
3213 exec_prefix="$ac_default_prefix"
3215 exec_prefix="$prefix"
3218 if test X"$with_noexec" != X"no"; then
3219 PROGS="${PROGS} libsudo_noexec.la"
3220 INSTALL_NOEXEC="install-noexec"
3222 noexec_file="$with_noexec"
3224 while test X"$noexec_file" != X"$_noexec_file"; do
3225 _noexec_file="$noexec_file"
3226 eval noexec_file="$_noexec_file"
3228 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_NOEXEC, "$noexec_file", [The fully qualified pathname of sudo_noexec.so])
3230 if test X"$with_selinux" != X"no"; then
3231 sesh_file="$libexecdir/sesh"
3233 while test X"$sesh_file" != X"$_sesh_file"; do
3234 _sesh_file="$sesh_file"
3235 eval sesh_file="$_sesh_file"
3237 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SESH, "$sesh_file", [The fully qualified pathname of sesh])
3239 PLUGINDIR="$with_plugindir"
3241 while test X"$PLUGINDIR" != X"$_PLUGINDIR"; do
3242 _PLUGINDIR="$PLUGINDIR"
3243 eval PLUGINDIR="$_PLUGINDIR"
3245 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_PLUGIN_DIR, "$PLUGINDIR/")
3246 SUDO_DEFINE_UNQUOTED(SUDOERS_PLUGIN, "sudoers${SOEXT}")
3247 exec_prefix="$oexec_prefix"
3251 dnl Override default configure dirs for the Makefile
3253 if test X"$prefix" = X"NONE"; then
3254 test "$mandir" = '${datarootdir}/man' && mandir='$(prefix)/man'
3256 test "$mandir" = '${datarootdir}/man' && mandir='$(datarootdir)/man'
3258 test "$bindir" = '${exec_prefix}/bin' && bindir='$(exec_prefix)/bin'
3259 test "$sbindir" = '${exec_prefix}/sbin' && sbindir='$(exec_prefix)/sbin'
3260 test "$libexecdir" = '${exec_prefix}/libexec' && libexecdir='$(exec_prefix)/libexec'
3261 test "$includedir" = '${prefix}/include' && includedir='$(prefix)/include'
3262 test "$datarootdir" = '${prefix}/share' && datarootdir='$(prefix)/share'
3263 test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}' && docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)'
3264 test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/etc'
3267 dnl Substitute into the Makefile and man pages
3269 dnl AC_CONFIG_FILES([doc/sudo.man doc/visudo.man doc/sudoers.man doc/sudoers.ldap.man doc/sudoreplay.man src/Makefile src/sudo_usage.h])
3270 AC_CONFIG_FILES([Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/sample_group/Makefile plugins/system_group/Makefile plugins/sudoers/Makefile plugins/sudoers/sudoers])
3274 dnl Spew any text the user needs to know about
3276 if test "$with_pam" = "yes"; then
3279 if test -f /usr/lib/security/libpam_hpsec.so.1; then
3280 AC_MSG_NOTICE([You may wish to add the following line to /etc/pam.conf])
3281 AC_MSG_NOTICE([sudo session required libpam_hpsec.so.1 bypass_umask bypass_last_login])
3285 AC_MSG_NOTICE([You will need to customize sample.pam and install it as /etc/pam.d/sudo])
3291 dnl Autoheader templates
3293 AH_TEMPLATE(BROKEN_SYSLOG, [Define to 1 if the `syslog' function returns a non-zero int to denote failure.])
3294 AH_TEMPLATE(CLASSIC_INSULTS, [Define to 1 if you want the insults from the "classic" version sudo.])
3295 AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twisted minds of CSOps.])
3296 AH_TEMPLATE(SUDOERS_PLUGIN, [The name of the sudoers plugin, including extension.])
3297 AH_TEMPLATE(DONT_LEAK_PATH_INFO, [Define to 1 if you want sudo to display "command not allowed" instead of "command not found" when a command cannot be found.])
3298 AH_TEMPLATE(ENV_DEBUG, [Define to 1 to enable environment function debugging.])
3299 AH_TEMPLATE(ENV_EDITOR, [Define to 1 if you want visudo to honor the EDITOR and VISUAL env variables.])
3300 AH_TEMPLATE(FQDN, [Define to 1 if you want to require fully qualified hosts in sudoers.])
3301 AH_TEMPLATE(ENV_RESET, [Define to 1 to enable environment resetting by default.])
3302 AH_TEMPLATE(GOONS_INSULTS, [Define to 1 if you want insults from the "Goon Show".])
3303 AH_TEMPLATE(HAL_INSULTS, [Define to 1 if you want 2001-like insults.])
3304 AH_TEMPLATE(HAVE_AFS, [Define to 1 if you use AFS.])
3305 AH_TEMPLATE(HAVE_AIXAUTH, [Define to 1 if you use AIX general authentication.])
3306 AH_TEMPLATE(HAVE_BSD_AUTH_H, [Define to 1 if you use BSD authentication.])
3307 AH_TEMPLATE(HAVE_BSM_AUDIT, [Define to 1 to enable BSM audit support.])
3308 AH_TEMPLATE(HAVE_DCE, [Define to 1 if you use OSF DCE.])
3309 AH_TEMPLATE(HAVE_DD_FD, [Define to 1 if your `DIR' contains dd_fd.])
3310 AH_TEMPLATE(HAVE_DIRFD, [Define to 1 if you have the `dirfd' function or macro.])
3311 AH_TEMPLATE(HAVE_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.])
3312 AH_TEMPLATE(HAVE_DLOPEN, [Define to 1 if you have the `dlopen' function.])
3313 AH_TEMPLATE(HAVE_FCNTL_CLOSEM, [Define to 1 if your system has the F_CLOSEM fcntl.])
3314 AH_TEMPLATE(HAVE_FNMATCH, [Define to 1 if you have the `fnmatch' function.])
3315 AH_TEMPLATE(HAVE_FWTK, [Define to 1 if you use the FWTK authsrv daemon.])
3316 AH_TEMPLATE(HAVE_GETAUTHUID, [Define to 1 if you have the `getauthuid' function. (ULTRIX 4.x shadow passwords)])
3317 AH_TEMPLATE(HAVE_GETPRPWNAM, [Define to 1 if you have the `getprpwnam' function. (SecureWare-style shadow passwords)])
3318 AH_TEMPLATE(HAVE_GETPWANAM, [Define to 1 if you have the `getpwanam' function. (SunOS 4.x shadow passwords)])
3319 AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR4-style shadow passwords)])
3320 AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords)])
3321 AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.])
3322 AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.])
3323 AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled)])
3324 AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled)])
3325 AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.])
3326 AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC, [Define to 1 if you have the `krb5_get_init_creds_opt_alloc' function.])
3327 AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS, [Define to 1 if your `krb5_get_init_creds_opt_free' function takes two arguments.])
3328 AH_TEMPLATE(HAVE_KRB5_INIT_SECURE_CONTEXT, [Define to 1 if you have the `krb5_init_secure_context' function.])
3329 AH_TEMPLATE(HAVE_KRB5_VERIFY_USER, [Define to 1 if you have the `krb5_verify_user' function.])
3330 AH_TEMPLATE(HAVE_LBER_H, [Define to 1 if your LDAP needs <lber.h>. (OpenLDAP does not)])
3331 AH_TEMPLATE(HAVE_LDAP, [Define to 1 if you use LDAP for sudoers.])
3332 AH_TEMPLATE(HAVE_LIBINTL_H, [Define to 1 if you have the <libintl.h> header file.])
3333 AH_TEMPLATE(HAVE_LINUX_AUDIT, [Define to 1 to enable Linux audit support.])
3334 AH_TEMPLATE(HAVE_OPIE, [Define to 1 if you use NRL OPIE.])
3335 AH_TEMPLATE(HAVE_PAM, [Define to 1 if you use PAM authentication.])
3336 AH_TEMPLATE(HAVE_PAM_LOGIN, [Define to 1 if you use a specific PAM session for sudo -i.])
3337 AH_TEMPLATE(HAVE_PROJECT_H, [Define to 1 if you have the <project.h> header file.])
3338 AH_TEMPLATE(HAVE_SECURID, [Define to 1 if you use SecurID for authentication.])
3339 AH_TEMPLATE(HAVE_SELINUX, [Define to 1 to enable SELinux RBAC support.])
3340 AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.])
3341 AH_TEMPLATE(HAVE_SHL_LOAD, [Define to 1 if you have the `shl_load' function.])
3342 AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.])
3343 AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().])
3344 AH_TEMPLATE(HAVE_RFC1938_SKEYCHALLENGE, [Define to 1 if the skeychallenge() function is RFC1938-compliant and takes 4 arguments])
3345 AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union])
3346 AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member])
3347 AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member])
3348 AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.])
3349 AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.])
3350 AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements])
3351 AH_TEMPLATE(LOGGING, [Define to SLOG_SYSLOG, SLOG_FILE, or SLOG_BOTH.])
3352 AH_TEMPLATE(LONG_OTP_PROMPT, [Define to 1 if you want a two line OTP (S/Key or OPIE) prompt.])
3353 AH_TEMPLATE(NO_AUTHENTICATION, [Define to 1 if you don't want sudo to prompt for a password by default.])
3354 AH_TEMPLATE(NO_LECTURE, [Define to 1 if you don't want users to get the lecture the first they user sudo.])
3355 AH_TEMPLATE(NO_PAM_SESSION, [Define to 1 if you don't want to use sudo's PAM session support])
3356 AH_TEMPLATE(NO_ROOT_MAILER, [Define to avoid runing the mailer as root.])
3357 AH_TEMPLATE(NO_ROOT_SUDO, [Define to 1 if root should not be allowed to use sudo.])
3358 AH_TEMPLATE(NO_TTY_TICKETS, [Define to 1 if you want a single ticket file instead of per-tty files.])
3359 AH_TEMPLATE(PC_INSULTS, [Define to 1 to replace politically incorrect insults with less offensive ones.])
3360 AH_TEMPLATE(SECURE_PATH, [Define to 1 to override the user's path with a built-in one.])
3361 AH_TEMPLATE(SEND_MAIL_WHEN_NOT_OK, [Define to 1 to send mail when the user is not allowed to run a command.])
3362 AH_TEMPLATE(SEND_MAIL_WHEN_NO_HOST, [Define to 1 to send mail when the user is not allowed to run sudo on this host.])
3363 AH_TEMPLATE(SEND_MAIL_WHEN_NO_USER, [Define to 1 to send mail when the user is not in the sudoers file.])
3364 AH_TEMPLATE(SHELL_IF_NO_ARGS, [Define to 1 if you want sudo to start a shell if given no arguments.])
3365 AH_TEMPLATE(SHELL_SETS_HOME, [Define to 1 if you want sudo to set $HOME in shell mode.])
3366 AH_TEMPLATE(STUB_LOAD_INTERFACES, [Define to 1 if the code in interfaces.c does not compile for you.])
3367 AH_TEMPLATE(UMASK_OVERRIDE, [Define to 1 to use the umask specified in sudoers even when it is less restrictive than the invoking user's.])
3368 AH_TEMPLATE(USE_ADMIN_FLAG, [Define to 1 if you want to create ~/.sudo_as_admin_successful if the user is in the admin group the first time they run sudo.])
3369 AH_TEMPLATE(USE_INSULTS, [Define to 1 if you want to insult the user for entering an incorrect password.])
3370 AH_TEMPLATE(USE_STOW, [Define to 1 if you use GNU stow packaging.])
3371 AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for authentication.])
3372 AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
3373 AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
3374 AH_TEMPLATE(socklen_t, [Define to `unsigned int' if <sys/socket.h> doesn't define.])
3375 AH_TEMPLATE(HAVE_STRUCT_UTMP_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmp'.])
3376 AH_TEMPLATE(HAVE_STRUCT_UTMPX_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmpx'.])
3377 AH_TEMPLATE(HAVE___FUNC__, [Define to 1 if the compiler supports the C99 __func__ variable.])
3378 AH_TEMPLATE(SUDO_KRB5_INSTANCE, [An instance string to append to the username (separated by a slash) for Kerberos V authentication])
3379 AH_TEMPLATE(RTLD_PRELOAD_VAR, [The environment variable that controls preloading of dynamic objects.])
3380 AH_TEMPLATE(RTLD_PRELOAD_ENABLE_VAR, [An extra environment variable that is required to enable preloading (if any).])
3381 AH_TEMPLATE(RTLD_PRELOAD_DELIM, [The delimiter to use when defining multiple preloaded objects.])
3382 AH_TEMPLATE(RTLD_PRELOAD_DEFAULT, [The default value of preloaded objects (if any).])
3385 dnl Bits to copy verbatim into config.h.in
3387 AH_TOP([#ifndef _SUDO_CONFIG_H
3388 #define _SUDO_CONFIG_H])
3391 * Macros to convert ctime and mtime into timevals.
3393 #define timespec2timeval(_ts, _tv) do { \
3394 (_tv)->tv_sec = (_ts)->tv_sec; \
3395 (_tv)->tv_usec = (_ts)->tv_nsec / 1000; \
3399 # ifdef HAVE_ST__TIM
3400 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim.st__tim, (_y))
3401 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim.st__tim, (_y))
3403 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim, (_y))
3404 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim, (_y))
3407 # ifdef HAVE_ST_MTIMESPEC
3408 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctimespec, (_y))
3409 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtimespec, (_y))
3411 # define ctim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_ctime; (_y)->tv_usec = 0; } while (0)
3412 # define mtim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_mtime; (_y)->tv_usec = 0; } while (0)
3413 # endif /* HAVE_ST_MTIMESPEC */
3414 #endif /* HAVE_ST_MTIM */
3417 # define ignore_result(x) do { \
3418 __typeof__(x) y = (x); \
3422 # define ignore_result(x) (void)(x)
3425 /* GNU stow needs /etc/sudoers to be a symlink. */
3427 # define stat_sudoers stat
3429 # define stat_sudoers lstat
3432 /* Macros to set/clear/test flags. */
3434 #define SET(t, f) ((t) |= (f))
3436 #define CLR(t, f) ((t) &= ~(f))
3438 #define ISSET(t, f) ((t) & (f))
3440 /* ANSI-style OS defs for HP-UX and ConvexOS. */
3441 #if defined(hpux) && !defined(__hpux)
3445 #if defined(convex) && !defined(__convex__)
3446 # define __convex__ 1
3449 /* BSD compatibility on some SVR4 systems. */
3452 #endif /* __svr4__ */
3454 #endif /* _SUDO_CONFIG_H */])