2 dnl Process this file with GNU autoconf to produce a configure script.
4 dnl Copyright (c) 1994-1996,1998-2011 Todd C. Miller <Todd.Miller@courtesan.com>
6 AC_INIT([sudo], [1.7.6p1], [http://www.sudo.ws/bugs/], [sudo])
7 AC_CONFIG_HEADER(config.h pathnames.h zlib/zconf.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([COMMON_OBJS])
23 AC_SUBST([SUDO_LDFLAGS])
29 AC_SUBST([GETGROUPS_LIB])
33 AC_SUBST([MAN_POSTINSTALL])
34 AC_SUBST([SUDOERS_MODE])
35 AC_SUBST([SUDOERS_UID])
36 AC_SUBST([SUDOERS_GID])
43 AC_SUBST([mansectform])
45 AC_SUBST([NOEXECFILE])
47 AC_SUBST([noexec_file])
48 AC_SUBST([INSTALL_NOEXEC])
49 AC_SUBST([DONT_LEAK_PATH_INFO])
50 AC_SUBST([BSDAUTH_USAGE])
51 AC_SUBST([SELINUX_USAGE])
54 AC_SUBST([LOGINCAP_USAGE])
57 AC_SUBST([CONFIGURE_ARGS])
59 dnl Variables that get substituted in docs (not overridden by environment)
61 AC_SUBST([iolog_dir])dnl real initial value from SUDO_IO_LOGDIR
62 AC_SUBST([timedir])dnl real initial value from SUDO_TIMEDIR
64 AC_SUBST([password_timeout])
65 AC_SUBST([sudo_umask])
66 AC_SUBST([umask_override])
67 AC_SUBST([passprompt])
68 AC_SUBST([long_otp_prompt])
74 AC_SUBST([ignore_dot])
75 AC_SUBST([mail_no_user])
76 AC_SUBST([mail_no_host])
77 AC_SUBST([mail_no_perms])
80 AC_SUBST([badpass_message])
82 AC_SUBST([runas_default])
83 AC_SUBST([env_editor])
85 AC_SUBST([passwd_tries])
86 AC_SUBST([tty_tickets])
91 AC_SUBST([ldap_secret])
92 AC_SUBST([nsswitch_conf])
93 AC_SUBST([netsvc_conf])
94 AC_SUBST([secure_path])
97 # Begin initial values for man page substitution
99 iolog_dir=/var/log/sudo-io
100 timedir=/var/adm/sudo
105 passprompt="Password:"
117 mailsub="*** SECURITY information for %h ***"
118 badpass_message="Sorry, try again."
129 ldap_conf=/etc/ldap.conf
130 ldap_secret=/etc/ldap.secret
131 netsvc_conf=/etc/netsvc.conf
132 noexec_file=/usr/local/libexec/sudo_noexec.so
133 nsswitch_conf=/etc/nsswitch.conf
134 secure_path="not set"
136 # End initial values for man page substitution
139 dnl Initial values for Makefile variables listed above
140 dnl May be overridden by environment variables..
147 : ${SUDOERS_MODE='0440'}
171 shadow_libs_optional=
176 dnl Deprecated --with options (these all warn or generate an error)
179 AC_ARG_WITH(otp-only, [AS_HELP_STRING([--with-otp-only], [deprecated])],
180 [case $with_otp_only in
181 yes) with_passwd="no"
182 AC_MSG_NOTICE([--with-otp-only option deprecated, treating as --without-passwd])
186 AC_ARG_WITH(alertmail, [AS_HELP_STRING([--with-alertmail], [deprecated])],
187 [case $with_alertmail in
188 *) with_mailto="$with_alertmail"
189 AC_MSG_NOTICE([--with-alertmail option deprecated, treating as --mailto])
194 dnl Options for --with
197 AC_ARG_WITH(devel, [AS_HELP_STRING([--with-devel], [add development options])],
199 yes) AC_MSG_NOTICE([Setting up for development: -Wall, flex, yacc])
200 PROGS="${PROGS} testsudoers"
201 OSDEFS="${OSDEFS} -DSUDO_DEVEL"
206 *) AC_MSG_WARN([Ignoring unknown argument to --with-devel: $with_devel])
210 AC_ARG_WITH(CC, [AS_HELP_STRING([--with-CC], [C compiler to use])],
212 yes) AC_MSG_ERROR(["must give --with-CC an argument."])
214 no) AC_MSG_ERROR(["illegal argument: --without-CC."])
220 AC_ARG_WITH(rpath, [AS_HELP_STRING([--with-rpath], [pass -R flag in addition to -L for lib paths])],
223 *) AC_MSG_ERROR(["--with-rpath does not take an argument."])
227 AC_ARG_WITH(blibpath, [AS_HELP_STRING([--with-blibpath[=PATH]], [pass -blibpath flag to ld for additional lib paths])],
228 [case $with_blibpath in
230 *) AC_MSG_NOTICE([will pass -blibpath:${with_blibpath} to the loader.])
235 dnl Handle BSM auditing support.
237 AC_ARG_WITH(bsm-audit, [AS_HELP_STRING([--with-bsm-audit], [enable BSM audit support])],
238 [case $with_bsm_audit in
239 yes) AC_DEFINE(HAVE_BSM_AUDIT)
240 SUDO_LIBS="${SUDO_LIBS} -lbsm"
241 SUDO_OBJS="${SUDO_OBJS} bsm_audit.o"
244 *) AC_MSG_ERROR(["--with-bsm-audit does not take an argument."])
249 dnl Handle Linux auditing support.
251 AC_ARG_WITH(linux-audit, [AS_HELP_STRING([--with-linux-audit], [enable Linux audit support])],
252 [case $with_linux_audit in
253 yes) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libaudit.h>]], [[int i = AUDIT_USER_CMD; (void)i;]])], [
254 AC_DEFINE(HAVE_LINUX_AUDIT)
255 SUDO_LIBS="${SUDO_LIBS} -laudit"
256 SUDO_OBJS="${SUDO_OBJS} linux_audit.o"
258 AC_MSG_ERROR([unable to find AUDIT_USER_CMD in libaudit.h for --with-linux-audit])
262 *) AC_MSG_ERROR(["--with-linux-audit does not take an argument."])
266 AC_ARG_WITH(incpath, [AS_HELP_STRING([--with-incpath], [additional places to look for include files])],
267 [case $with_incpath in
268 yes) AC_MSG_ERROR(["must give --with-incpath an argument."])
270 no) AC_MSG_ERROR(["--without-incpath not supported."])
272 *) AC_MSG_NOTICE([Adding ${with_incpath} to CPPFLAGS])
273 for i in ${with_incpath}; do
274 CPPFLAGS="${CPPFLAGS} -I${i}"
279 AC_ARG_WITH(libpath, [AS_HELP_STRING([--with-libpath], [additional places to look for libraries])],
280 [case $with_libpath in
281 yes) AC_MSG_ERROR(["must give --with-libpath an argument."])
283 no) AC_MSG_ERROR(["--without-libpath not supported."])
285 *) AC_MSG_NOTICE([Adding ${with_libpath} to LDFLAGS])
289 AC_ARG_WITH(libraries, [AS_HELP_STRING([--with-libraries], [additional libraries to link with])],
290 [case $with_libraries in
291 yes) AC_MSG_ERROR(["must give --with-libraries an argument."])
293 no) AC_MSG_ERROR(["--without-libraries not supported."])
295 *) AC_MSG_NOTICE([Adding ${with_libraries} to LIBS])
299 AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence], [link with -lefence for malloc() debugging])],
300 [case $with_efence in
301 yes) AC_MSG_NOTICE([Sudo will link with -lefence (Electric Fence)])
302 LIBS="${LIBS} -lefence"
303 if test -f /usr/local/lib/libefence.a; then
304 with_libpath="${with_libpath} /usr/local/lib"
308 *) AC_MSG_WARN([Ignoring unknown argument to --with-efence: $with_efence])
312 AC_ARG_WITH(csops, [AS_HELP_STRING([--with-csops], [add CSOps standard options])],
314 yes) AC_MSG_NOTICE([Adding CSOps standard options])
318 with_classic_insults=yes
319 with_csops_insults=yes
325 *) AC_MSG_WARN([Ignoring unknown argument to --with-csops: $with_csops])
329 AC_ARG_WITH(passwd, [AS_HELP_STRING([--without-passwd], [don't use passwd/shadow file for authentication])],
330 [case $with_passwd in
331 yes|no) AC_MSG_CHECKING(whether to use shadow/passwd file authentication)
332 AC_MSG_RESULT($with_passwd)
334 test "$with_passwd" = "yes" && AUTH_REG="$AUTH_REG passwd"
336 *) AC_MSG_ERROR(["Sorry, --with-passwd does not take an argument."])
340 AC_ARG_WITH(skey, [AS_HELP_STRING([--with-skey[=DIR]], [enable S/Key support ])],
343 *) AC_DEFINE(HAVE_SKEY)
344 AC_MSG_CHECKING(whether to try S/Key authentication)
346 AUTH_REG="$AUTH_REG S/Key"
350 AC_ARG_WITH(opie, [AS_HELP_STRING([--with-opie[=DIR]], [enable OPIE support ])],
353 *) AC_DEFINE(HAVE_OPIE)
354 AC_MSG_CHECKING(whether to try NRL OPIE authentication)
356 AUTH_REG="$AUTH_REG NRL_OPIE"
360 AC_ARG_WITH(long-otp-prompt, [AS_HELP_STRING([--with-long-otp-prompt], [use a two line OTP (skey/opie) prompt])],
361 [case $with_long_otp_prompt in
362 yes) AC_DEFINE(LONG_OTP_PROMPT)
363 AC_MSG_CHECKING(whether to use a two line prompt for OTP authentication)
367 no) long_otp_prompt=off
369 *) AC_MSG_ERROR(["--with-long-otp-prompt does not take an argument."])
373 AC_ARG_WITH(SecurID, [AS_HELP_STRING([--with-SecurID[[=DIR]]], [enable SecurID support])],
374 [case $with_SecurID in
376 *) AC_DEFINE(HAVE_SECURID)
377 AC_MSG_CHECKING(whether to use SecurID for authentication)
379 AUTH_EXCL="$AUTH_EXCL SecurID"
383 AC_ARG_WITH(fwtk, [AS_HELP_STRING([--with-fwtk[[=DIR]]], [enable FWTK AuthSRV support])],
386 *) AC_DEFINE(HAVE_FWTK)
387 AC_MSG_CHECKING(whether to use FWTK AuthSRV for authentication)
389 AUTH_EXCL="$AUTH_EXCL FWTK"
393 AC_ARG_WITH(kerb4, [AS_HELP_STRING([--with-kerb4[[=DIR]]], [enable Kerberos IV support])],
396 *) AC_MSG_CHECKING(whether to try kerberos IV authentication)
398 AUTH_REG="$AUTH_REG kerb4"
402 AC_ARG_WITH(kerb5, [AS_HELP_STRING([--with-kerb5[[=DIR]]], [enable Kerberos V support])],
405 *) AC_MSG_CHECKING(whether to try Kerberos V authentication)
407 AUTH_REG="$AUTH_REG kerb5"
411 AC_ARG_WITH(aixauth, [AS_HELP_STRING([--with-aixauth], [enable AIX general authentication support])],
412 [case $with_aixauth in
413 yes) AUTH_EXCL="$AUTH_EXCL AIX_AUTH";;
415 *) AC_MSG_ERROR(["--with-aixauth does not take an argument."])
419 AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [enable PAM support])],
421 yes) AUTH_EXCL="$AUTH_EXCL PAM";;
423 *) AC_MSG_ERROR(["--with-pam does not take an argument."])
427 AC_ARG_WITH(AFS, [AS_HELP_STRING([--with-AFS], [enable AFS support])],
429 yes) AC_DEFINE(HAVE_AFS)
430 AC_MSG_CHECKING(whether to try AFS (kerberos) authentication)
432 AUTH_REG="$AUTH_REG AFS"
435 *) AC_MSG_ERROR(["--with-AFS does not take an argument."])
439 AC_ARG_WITH(DCE, [AS_HELP_STRING([--with-DCE], [enable DCE support])],
441 yes) AC_DEFINE(HAVE_DCE)
442 AC_MSG_CHECKING(whether to try DCE (kerberos) authentication)
444 AUTH_REG="$AUTH_REG DCE"
447 *) AC_MSG_ERROR(["--with-DCE does not take an argument."])
451 AC_ARG_WITH(logincap, [AS_HELP_STRING([--with-logincap], [enable BSD login class support])],
452 [case $with_logincap in
454 *) AC_MSG_ERROR(["--with-logincap does not take an argument."])
458 AC_ARG_WITH(bsdauth, [AS_HELP_STRING([--with-bsdauth], [enable BSD authentication support])],
459 [case $with_bsdauth in
460 yes) AUTH_EXCL="$AUTH_EXCL BSD_AUTH";;
462 *) AC_MSG_ERROR(["--with-bsdauth does not take an argument."])
466 AC_ARG_WITH(project, [AS_HELP_STRING([--with-project], [enable Solaris project support])],
467 [case $with_project in
470 *) AC_MSG_ERROR(["--with-project does not take an argument."])
474 AC_MSG_CHECKING(whether to lecture users the first time they run sudo)
475 AC_ARG_WITH(lecture, [AS_HELP_STRING([--without-lecture], [don't print lecture for first-time sudoer])],
476 [case $with_lecture in
477 yes|short|always) lecture=once
479 no|none|never) lecture=never
481 *) AC_MSG_ERROR(["unknown argument to --with-lecture: $with_lecture"])
484 if test "$lecture" = "once"; then
487 AC_DEFINE(NO_LECTURE)
491 AC_MSG_CHECKING(whether sudo should log via syslog or to a file by default)
492 AC_ARG_WITH(logging, [AS_HELP_STRING([--with-logging], [log via syslog, file, or both])],
493 [case $with_logging in
494 yes) AC_MSG_ERROR(["must give --with-logging an argument."])
496 no) AC_MSG_ERROR(["--without-logging not supported."])
498 syslog) AC_DEFINE(LOGGING, SLOG_SYSLOG)
499 AC_MSG_RESULT(syslog)
501 file) AC_DEFINE(LOGGING, SLOG_FILE)
504 both) AC_DEFINE(LOGGING, SLOG_BOTH)
507 *) AC_MSG_ERROR(["unknown argument to --with-logging: $with_logging"])
509 esac], [AC_DEFINE(LOGGING, SLOG_SYSLOG) AC_MSG_RESULT(syslog)])
511 AC_ARG_WITH(logfac, [AS_HELP_STRING([--with-logfac], [syslog facility to log with (default is "auth")])],
512 [case $with_logfac in
513 yes) AC_MSG_ERROR(["must give --with-logfac an argument."])
515 no) AC_MSG_ERROR(["--without-logfac not supported."])
517 authpriv|auth|daemon|user|local0|local1|local2|local3|local4|local5|local6|local7) logfac=$with_logfac
519 *) AC_MSG_ERROR(["$with_logfac is not a supported syslog facility."])
523 AC_MSG_CHECKING(at which syslog priority to log commands)
524 AC_ARG_WITH(goodpri, [AS_HELP_STRING([--with-goodpri], [syslog priority for commands (def is "notice")])],
525 [case $with_goodpri in
526 yes) AC_MSG_ERROR(["must give --with-goodpri an argument."])
528 no) AC_MSG_ERROR(["--without-goodpri not supported."])
530 alert|crit|debug|emerg|err|info|notice|warning)
531 goodpri=$with_goodpri
533 *) AC_MSG_ERROR(["$with_goodpri is not a supported syslog priority."])
536 AC_DEFINE_UNQUOTED(PRI_SUCCESS, "$goodpri", [The syslog priority sudo will use for successful attempts.])
537 AC_MSG_RESULT($goodpri)
539 AC_MSG_CHECKING(at which syslog priority to log failures)
540 AC_ARG_WITH(badpri, [AS_HELP_STRING([--with-badpri], [syslog priority for failures (def is "alert")])],
541 [case $with_badpri in
542 yes) AC_MSG_ERROR(["must give --with-badpri an argument."])
544 no) AC_MSG_ERROR(["--without-badpri not supported."])
546 alert|crit|debug|emerg|err|info|notice|warning)
549 *) AC_MSG_ERROR([$with_badpri is not a supported syslog priority.])
552 AC_DEFINE_UNQUOTED(PRI_FAILURE, "$badpri", [The syslog priority sudo will use for unsuccessful attempts/errors.])
553 AC_MSG_RESULT($badpri)
555 AC_ARG_WITH(logpath, [AS_HELP_STRING([--with-logpath], [path to the sudo log file])],
556 [case $with_logpath in
557 yes) AC_MSG_ERROR(["must give --with-logpath an argument."])
559 no) AC_MSG_ERROR(["--without-logpath not supported."])
563 AC_MSG_CHECKING(how long a line in the log file should be)
564 AC_ARG_WITH(loglen, [AS_HELP_STRING([--with-loglen], [maximum length of a log file line (default is 80)])],
565 [case $with_loglen in
566 yes) AC_MSG_ERROR(["must give --with-loglen an argument."])
568 no) AC_MSG_ERROR(["--without-loglen not supported."])
570 [[0-9]]*) loglen=$with_loglen
572 *) AC_MSG_ERROR(["you must enter a number, not $with_loglen"])
575 AC_DEFINE_UNQUOTED(MAXLOGFILELEN, $loglen, [The max number of chars per log file line (for line wrapping).])
576 AC_MSG_RESULT($loglen)
578 AC_MSG_CHECKING(whether sudo should ignore '.' or '' in \$PATH)
579 AC_ARG_WITH(ignore-dot, [AS_HELP_STRING([--with-ignore-dot], [ignore '.' in the PATH])],
580 [case $with_ignore_dot in
585 *) AC_MSG_ERROR(["--with-ignore-dot does not take an argument."])
588 if test "$ignore_dot" = "on"; then
589 AC_DEFINE(IGNORE_DOT_PATH)
595 AC_MSG_CHECKING(whether to send mail when a user is not in sudoers)
596 AC_ARG_WITH(mail-if-no-user, [AS_HELP_STRING([--without-mail-if-no-user], [do not send mail if user not in sudoers])],
597 [case $with_mail_if_no_user in
602 *) AC_MSG_ERROR(["--with-mail-if-no-user does not take an argument."])
605 if test "$mail_no_user" = "on"; then
606 AC_DEFINE(SEND_MAIL_WHEN_NO_USER)
612 AC_MSG_CHECKING(whether to send mail when user listed but not for this host)
613 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])],
614 [case $with_mail_if_no_host in
619 *) AC_MSG_ERROR(["--with-mail-if-no-host does not take an argument."])
622 if test "$mail_no_host" = "on"; then
623 AC_DEFINE(SEND_MAIL_WHEN_NO_HOST)
629 AC_MSG_CHECKING(whether to send mail when a user tries a disallowed command)
630 AC_ARG_WITH(mail-if-noperms, [AS_HELP_STRING([--with-mail-if-noperms], [send mail if user not allowed to run command])],
631 [case $with_mail_if_noperms in
636 *) AC_MSG_ERROR(["--with-mail-if-noperms does not take an argument."])
639 if test "$mail_noperms" = "on"; then
640 AC_DEFINE(SEND_MAIL_WHEN_NOT_OK)
646 AC_MSG_CHECKING(who should get the mail that sudo sends)
647 AC_ARG_WITH(mailto, [AS_HELP_STRING([--with-mailto], [who should get sudo mail (default is "root")])],
648 [case $with_mailto in
649 yes) AC_MSG_ERROR(["must give --with-mailto an argument."])
651 no) AC_MSG_ERROR(["--without-mailto not supported."])
653 *) mailto=$with_mailto
656 AC_DEFINE_UNQUOTED(MAILTO, "$mailto", [The user or email address that sudo mail is sent to.])
657 AC_MSG_RESULT([$mailto])
659 AC_ARG_WITH(mailsubject, [AS_HELP_STRING([--with-mailsubject], [subject of sudo mail])],
660 [case $with_mailsubject in
661 yes) AC_MSG_ERROR(["must give --with-mailsubject an argument."])
663 no) AC_MSG_WARN([Sorry, --without-mailsubject not supported.])
665 *) mailsub="$with_mailsubject"
666 AC_MSG_CHECKING(sudo mail subject)
667 AC_MSG_RESULT([Using alert mail subject: $mailsub])
670 AC_DEFINE_UNQUOTED(MAILSUBJECT, "$mailsub", [The subject of the mail sent by sudo to the MAILTO user/address.])
672 AC_MSG_CHECKING(for bad password prompt)
673 AC_ARG_WITH(passprompt, [AS_HELP_STRING([--with-passprompt], [default password prompt])],
674 [case $with_passprompt in
675 yes) AC_MSG_ERROR(["must give --with-passprompt an argument."])
677 no) AC_MSG_WARN([Sorry, --without-passprompt not supported.])
679 *) passprompt="$with_passprompt"
681 AC_MSG_RESULT($passprompt)
682 AC_DEFINE_UNQUOTED(PASSPROMPT, "$passprompt", [The default password prompt.])
684 AC_MSG_CHECKING(for bad password message)
685 AC_ARG_WITH(badpass-message, [AS_HELP_STRING([--with-badpass-message], [message the user sees when the password is wrong])],
686 [case $with_badpass_message in
687 yes) AC_MSG_ERROR(["Must give --with-badpass-message an argument."])
689 no) AC_MSG_WARN([Sorry, --without-badpass-message not supported.])
691 *) badpass_message="$with_badpass_message"
694 AC_DEFINE_UNQUOTED(INCORRECT_PASSWORD, "$badpass_message", [The message given when a bad password is entered.])
695 AC_MSG_RESULT([$badpass_message])
697 AC_MSG_CHECKING(whether to expect fully qualified hosts in sudoers)
698 AC_ARG_WITH(fqdn, [AS_HELP_STRING([--with-fqdn], [expect fully qualified hosts in sudoers])],
704 *) AC_MSG_ERROR(["--with-fqdn does not take an argument."])
707 if test "$fqdn" = "on"; then
714 AC_ARG_WITH(timedir, [AS_HELP_STRING([--with-timedir], [path to the sudo timestamp dir])],
715 [case $with_timedir in
716 yes) AC_MSG_ERROR(["must give --with-timedir an argument."])
718 no) AC_MSG_ERROR(["--without-timedir not supported."])
722 AC_ARG_WITH(iologdir, [AS_HELP_STRING([--with-iologdir=DIR], [directory to store sudo I/O log files in])],
723 [case $with_iologdir in
728 AC_ARG_WITH(sendmail, [AS_HELP_STRING([--with-sendmail], [set path to sendmail])
729 AS_HELP_STRING([--without-sendmail], [do not send mail at all])],
730 [case $with_sendmail in
731 yes) with_sendmail=""
734 *) SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SENDMAIL, "$with_sendmail")
738 AC_ARG_WITH(sudoers-mode, [AS_HELP_STRING([--with-sudoers-mode], [mode of sudoers file (defaults to 0440)])],
739 [case $with_sudoers_mode in
740 yes) AC_MSG_ERROR(["must give --with-sudoers-mode an argument."])
742 no) AC_MSG_ERROR(["--without-sudoers-mode not supported."])
744 [[1-9]]*) SUDOERS_MODE=0${with_sudoers_mode}
746 0*) SUDOERS_MODE=$with_sudoers_mode
748 *) AC_MSG_ERROR(["you must use an octal mode, not a name."])
752 AC_ARG_WITH(sudoers-uid, [AS_HELP_STRING([--with-sudoers-uid], [uid that owns sudoers file (defaults to 0)])],
753 [case $with_sudoers_uid in
754 yes) AC_MSG_ERROR(["must give --with-sudoers-uid an argument."])
756 no) AC_MSG_ERROR(["--without-sudoers-uid not supported."])
758 [[0-9]]*) SUDOERS_UID=$with_sudoers_uid
760 *) AC_MSG_ERROR(["you must use an unsigned numeric uid, not a name."])
764 AC_ARG_WITH(sudoers-gid, [AS_HELP_STRING([--with-sudoers-gid], [gid that owns sudoers file (defaults to 0)])],
765 [case $with_sudoers_gid in
766 yes) AC_MSG_ERROR(["must give --with-sudoers-gid an argument."])
768 no) AC_MSG_ERROR(["--without-sudoers-gid not supported."])
770 [[0-9]]*) SUDOERS_GID=$with_sudoers_gid
772 *) AC_MSG_ERROR(["you must use an unsigned numeric gid, not a name."])
776 AC_MSG_CHECKING(for umask programs should be run with)
777 AC_ARG_WITH(umask, [AS_HELP_STRING([--with-umask], [umask with which the prog should run (default is 022)])
778 AS_HELP_STRING([--without-umask], [Preserves the umask of the user invoking sudo.])],
780 yes) AC_MSG_ERROR(["must give --with-umask an argument."])
784 [[0-9]]*) sudo_umask=$with_umask
786 *) AC_MSG_ERROR(["you must enter a numeric mask."])
789 AC_DEFINE_UNQUOTED(SUDO_UMASK, $sudo_umask, [The umask that the sudo-run prog should use.])
790 if test "$sudo_umask" = "0777"; then
793 AC_MSG_RESULT($sudo_umask)
796 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.])],
797 [case $with_umask_override in
798 yes) AC_DEFINE(UMASK_OVERRIDE)
801 no) umask_override=off
803 *) AC_MSG_ERROR(["--with-umask-override does not take an argument."])
807 AC_MSG_CHECKING(for default user to run commands as)
808 AC_ARG_WITH(runas-default, [AS_HELP_STRING([--with-runas-default], [User to run commands as (default is "root")])],
809 [case $with_runas_default in
810 yes) AC_MSG_ERROR(["must give --with-runas-default an argument."])
812 no) AC_MSG_ERROR(["--without-runas-default not supported."])
814 *) runas_default="$with_runas_default"
817 AC_DEFINE_UNQUOTED(RUNAS_DEFAULT, "$runas_default", [The user sudo should run commands as by default.])
818 AC_MSG_RESULT([$runas_default])
820 AC_ARG_WITH(exempt, [AS_HELP_STRING([--with-exempt=group], [no passwd needed for users in this group])],
821 [case $with_exempt in
822 yes) AC_MSG_ERROR(["must give --with-exempt an argument."])
824 no) AC_MSG_ERROR(["--without-exempt not supported."])
826 *) AC_DEFINE_UNQUOTED(EXEMPTGROUP, "$with_exempt", [If defined, users in this group need not enter a passwd (ie "sudo").])
827 AC_MSG_CHECKING(for group to be exempt from password)
828 AC_MSG_RESULT([$with_exempt])
832 AC_MSG_CHECKING(for editor that visudo should use)
833 AC_ARG_WITH(editor, [AS_HELP_STRING([--with-editor=path], [Default editor for visudo (defaults to vi)])],
834 [case $with_editor in
835 yes) AC_MSG_ERROR(["must give --with-editor an argument."])
837 no) AC_MSG_ERROR(["--without-editor not supported."])
839 *) AC_DEFINE_UNQUOTED(EDITOR, "$with_editor", [A colon-separated list of pathnames to be used as the editor for visudo.])
840 AC_MSG_RESULT([$with_editor])
841 editor="$with_editor"
843 esac], [AC_DEFINE(EDITOR, _PATH_VI) AC_MSG_RESULT(vi)])
845 AC_MSG_CHECKING(whether to obey EDITOR and VISUAL environment variables)
846 AC_ARG_WITH(env-editor, [AS_HELP_STRING([--with-env-editor], [Use the environment variable EDITOR for visudo])],
847 [case $with_env_editor in
852 *) AC_MSG_ERROR(["--with-env-editor does not take an argument."])
855 if test "$env_editor" = "on"; then
856 AC_DEFINE(ENV_EDITOR)
862 AC_MSG_CHECKING(number of tries a user gets to enter their password)
863 AC_ARG_WITH(passwd-tries, [AS_HELP_STRING([--with-passwd-tries], [number of tries to enter password (default is 3)])],
864 [case $with_passwd_tries in
866 no) AC_MSG_ERROR(["--without-editor not supported."])
868 [[1-9]]*) passwd_tries=$with_passwd_tries
870 *) AC_MSG_ERROR(["you must enter the numer of tries, > 0"])
873 AC_DEFINE_UNQUOTED(TRIES_FOR_PASSWORD, $passwd_tries, [The number of tries a user gets to enter their password.])
874 AC_MSG_RESULT($passwd_tries)
876 AC_MSG_CHECKING(time in minutes after which sudo will ask for a password again)
877 AC_ARG_WITH(timeout, [AS_HELP_STRING([--with-timeout], [minutes before sudo asks for passwd again (def is 5 minutes)])],
878 [case $with_timeout in
882 [[0-9]]*) timeout=$with_timeout
884 *) AC_MSG_ERROR(["you must enter the numer of minutes."])
887 AC_DEFINE_UNQUOTED(TIMEOUT, $timeout, [The number of minutes before sudo asks for a password again.])
888 AC_MSG_RESULT($timeout)
890 AC_MSG_CHECKING(time in minutes after the password prompt will time out)
891 AC_ARG_WITH(password-timeout, [AS_HELP_STRING([--with-password-timeout], [passwd prompt timeout in minutes (default is 5 minutes)])],
892 [case $with_password_timeout in
894 no) password_timeout=0
896 [[0-9]]*) password_timeout=$with_password_timeout
898 *) AC_MSG_ERROR(["you must enter the numer of minutes."])
901 AC_DEFINE_UNQUOTED(PASSWORD_TIMEOUT, $password_timeout, [The passwd prompt timeout (in minutes).])
902 AC_MSG_RESULT($password_timeout)
904 AC_MSG_CHECKING(whether to use per-tty ticket files)
905 AC_ARG_WITH(tty-tickets, [AS_HELP_STRING([--with-tty-tickets], [use a different ticket file for each tty])],
906 [case $with_tty_tickets in
911 *) AC_MSG_ERROR(["--with-tty-tickets does not take an argument."])
914 if test "$tty_tickets" = "off"; then
915 AC_DEFINE(NO_TTY_TICKETS)
921 AC_MSG_CHECKING(whether to include insults)
922 AC_ARG_WITH(insults, [AS_HELP_STRING([--with-insults], [insult the user for entering an incorrect password])],
923 [case $with_insults in
925 with_classic_insults=yes
926 with_csops_insults=yes
928 disabled) insults=off
929 with_classic_insults=yes
930 with_csops_insults=yes
934 *) AC_MSG_ERROR(["--with-insults does not take an argument."])
937 if test "$insults" = "on"; then
938 AC_DEFINE(USE_INSULTS)
944 AC_ARG_WITH(all-insults, [AS_HELP_STRING([--with-all-insults], [include all the sudo insult sets])],
945 [case $with_all_insults in
946 yes) with_classic_insults=yes
947 with_csops_insults=yes
949 with_goons_insults=yes
952 *) AC_MSG_ERROR(["--with-all-insults does not take an argument."])
956 AC_ARG_WITH(classic-insults, [AS_HELP_STRING([--with-classic-insults], [include the insults from the "classic" sudo])],
957 [case $with_classic_insults in
958 yes) AC_DEFINE(CLASSIC_INSULTS)
961 *) AC_MSG_ERROR(["--with-classic-insults does not take an argument."])
965 AC_ARG_WITH(csops-insults, [AS_HELP_STRING([--with-csops-insults], [include CSOps insults])],
966 [case $with_csops_insults in
967 yes) AC_DEFINE(CSOPS_INSULTS)
970 *) AC_MSG_ERROR(["--with-csops-insults does not take an argument."])
974 AC_ARG_WITH(hal-insults, [AS_HELP_STRING([--with-hal-insults], [include 2001-like insults])],
975 [case $with_hal_insults in
976 yes) AC_DEFINE(HAL_INSULTS)
979 *) AC_MSG_ERROR(["--with-hal-insults does not take an argument."])
983 AC_ARG_WITH(goons-insults, [AS_HELP_STRING([--with-goons-insults], [include the insults from the "Goon Show"])],
984 [case $with_goons_insults in
985 yes) AC_DEFINE(GOONS_INSULTS)
988 *) AC_MSG_ERROR(["--with-goons-insults does not take an argument."])
992 AC_ARG_WITH(nsswitch, [AS_HELP_STRING([--with-nsswitch[[=PATH]]], [path to nsswitch.conf])],
993 [case $with_nsswitch in
995 yes) with_nsswitch="/etc/nsswitch.conf"
1000 AC_ARG_WITH(ldap, [AS_HELP_STRING([--with-ldap[[=DIR]]], [enable LDAP support])],
1003 *) AC_DEFINE(HAVE_LDAP)
1004 AC_MSG_CHECKING(whether to use sudoers from LDAP)
1009 AC_ARG_WITH(ldap-conf-file, [AS_HELP_STRING([--with-ldap-conf-file], [path to LDAP configuration file])])
1010 test -n "$with_ldap_conf_file" && ldap_conf="$with_ldap_conf_file"
1011 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_CONF, "$ldap_conf", [Path to the ldap.conf file])
1013 AC_ARG_WITH(ldap-secret-file, [AS_HELP_STRING([--with-ldap-secret-file], [path to LDAP secret password file])])
1014 test -n "$with_ldap_secret_file" && ldap_secret="$with_ldap_secret_file"
1015 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_SECRET, "$ldap_secret", [Path to the ldap.secret file])
1017 AC_ARG_WITH(pc-insults, [AS_HELP_STRING([--with-pc-insults], [replace politically incorrect insults with less offensive ones])],
1018 [case $with_pc_insults in
1019 yes) AC_DEFINE(PC_INSULTS)
1022 *) AC_MSG_ERROR(["--with-pc-insults does not take an argument."])
1026 dnl include all insult sets on one line
1027 if test "$insults" = "on"; then
1028 AC_MSG_CHECKING(which insult sets to include)
1030 test "$with_goons_insults" = "yes" && i="goons ${i}"
1031 test "$with_hal_insults" = "yes" && i="hal ${i}"
1032 test "$with_csops_insults" = "yes" && i="csops ${i}"
1033 test "$with_classic_insults" = "yes" && i="classic ${i}"
1037 AC_MSG_CHECKING(whether to override the user's path)
1038 AC_ARG_WITH(secure-path, [AS_HELP_STRING([--with-secure-path], [override the user's path with a built-in one])],
1039 [case $with_secure_path in
1040 yes) with_secure_path="/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
1041 AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1042 AC_MSG_RESULT([$with_secure_path])
1043 secure_path="set to $with_secure_path"
1045 no) AC_MSG_RESULT(no)
1047 *) AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1048 AC_MSG_RESULT([$with_secure_path])
1049 secure_path="set to F<$with_secure_path>"
1051 esac], AC_MSG_RESULT(no))
1053 AC_MSG_CHECKING(whether to get ip addresses from the network interfaces)
1054 AC_ARG_WITH(interfaces, [AS_HELP_STRING([--without-interfaces], [don't try to read the ip addr of ether interfaces])],
1055 [case $with_interfaces in
1056 yes) AC_MSG_RESULT(yes)
1058 no) AC_DEFINE(STUB_LOAD_INTERFACES)
1061 *) AC_MSG_ERROR(["--with-interfaces does not take an argument."])
1063 esac], AC_MSG_RESULT(yes))
1065 AC_MSG_CHECKING(whether stow should be used)
1066 AC_ARG_WITH(stow, [AS_HELP_STRING([--with-stow], [properly handle GNU stow packaging])],
1068 yes) AC_MSG_RESULT(yes)
1071 no) AC_MSG_RESULT(no)
1073 *) AC_MSG_ERROR(["--with-stow does not take an argument."])
1075 esac], AC_MSG_RESULT(no))
1077 AC_MSG_CHECKING(whether to use an askpass helper)
1078 AC_ARG_WITH(askpass, [AS_HELP_STRING([--with-askpass=PATH], [Fully qualified pathname of askpass helper])],
1079 [case $with_askpass in
1080 yes) AC_MSG_ERROR(["--with-askpass takes a path as an argument."])
1083 *) SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, "$with_askpass", [The fully qualified pathname of askpass])
1085 esac], AC_MSG_RESULT(no))
1088 dnl If enabled, set LIBVAS_SO, LIBVAS_RPATH and USING_NONUNIX_GROUPS
1090 AC_ARG_WITH(libvas, [AS_HELP_STRING([--with-libvas=NAME], [Name of the libvas shared library (default=libvas.so)])],
1091 [case $with_libvas in
1092 yes) with_libvas=libvas.so
1095 *) AC_DEFINE_UNQUOTED([LIBVAS_SO], ["$with_libvas"], [The name of libvas.so])
1098 if test X"$with_libvas" != X"no"; then
1099 AC_DEFINE_UNQUOTED([LIBVAS_SO], ["$with_libvas"], [The name of libvas.so])
1100 AC_DEFINE(USING_NONUNIX_GROUPS)
1101 COMMON_OBJS="$COMMON_OBJS vasgroups.o"
1102 AC_ARG_WITH([libvas-rpath],
1103 [AS_HELP_STRING([--with-libvas-rpath=PATH],
1104 [Path to look for libvas in [default=/opt/quest/lib]])],
1105 [LIBVAS_RPATH=$withval],
1106 [LIBVAS_RPATH=/opt/quest/lib])
1108 dnl Some platforms require libdl for dlopen()
1110 AC_CHECK_LIB([dl], [main])
1115 dnl Options for --enable
1118 AC_MSG_CHECKING(whether to do user authentication by default)
1119 AC_ARG_ENABLE(authentication,
1120 [AS_HELP_STRING([--disable-authentication], [Do not require authentication by default])],
1121 [ case "$enableval" in
1122 yes) AC_MSG_RESULT(yes)
1124 no) AC_MSG_RESULT(no)
1125 AC_DEFINE(NO_AUTHENTICATION)
1127 *) AC_MSG_RESULT(no)
1128 AC_MSG_WARN([Ignoring unknown argument to --enable-authentication: $enableval])
1131 ], AC_MSG_RESULT(yes))
1133 AC_MSG_CHECKING(whether to disable running the mailer as root)
1134 AC_ARG_ENABLE(root-mailer,
1135 [AS_HELP_STRING([--disable-root-mailer], [Don't run the mailer as root, run as the user])],
1136 [ case "$enableval" in
1137 yes) AC_MSG_RESULT(no)
1139 no) AC_MSG_RESULT(yes)
1140 AC_DEFINE(NO_ROOT_MAILER)
1142 *) AC_MSG_RESULT(no)
1143 AC_MSG_WARN([Ignoring unknown argument to --enable-root-mailer: $enableval])
1146 ], AC_MSG_RESULT(no))
1148 AC_ARG_ENABLE(setreuid,
1149 [AS_HELP_STRING([--disable-setreuid], [Don't try to use the setreuid() function])],
1150 [ case "$enableval" in
1151 no) SKIP_SETREUID=yes
1157 AC_ARG_ENABLE(setresuid,
1158 [AS_HELP_STRING([--disable-setresuid], [Don't try to use the setresuid() function])],
1159 [ case "$enableval" in
1160 no) SKIP_SETRESUID=yes
1166 AC_MSG_CHECKING(whether to disable shadow password support)
1167 AC_ARG_ENABLE(shadow,
1168 [AS_HELP_STRING([--disable-shadow], [Never use shadow passwords])],
1169 [ case "$enableval" in
1170 yes) AC_MSG_RESULT(no)
1172 no) AC_MSG_RESULT(yes)
1175 *) AC_MSG_RESULT(no)
1176 AC_MSG_WARN([Ignoring unknown argument to --enable-shadow: $enableval])
1179 ], AC_MSG_RESULT(no))
1181 AC_MSG_CHECKING(whether root should be allowed to use sudo)
1182 AC_ARG_ENABLE(root-sudo,
1183 [AS_HELP_STRING([--disable-root-sudo], [Don't allow root to run sudo])],
1184 [ case "$enableval" in
1185 yes) AC_MSG_RESULT(yes)
1187 no) AC_DEFINE(NO_ROOT_SUDO)
1191 *) AC_MSG_ERROR(["--enable-root-sudo does not take an argument."])
1194 ], AC_MSG_RESULT(yes))
1196 AC_MSG_CHECKING(whether to log the hostname in the log file)
1197 AC_ARG_ENABLE(log-host,
1198 [AS_HELP_STRING([--enable-log-host], [Log the hostname in the log file])],
1199 [ case "$enableval" in
1200 yes) AC_MSG_RESULT(yes)
1201 AC_DEFINE(HOST_IN_LOG)
1203 no) AC_MSG_RESULT(no)
1205 *) AC_MSG_RESULT(no)
1206 AC_MSG_WARN([Ignoring unknown argument to --enable-log-host: $enableval])
1209 ], AC_MSG_RESULT(no))
1211 AC_MSG_CHECKING(whether to invoke a shell if sudo is given no arguments)
1212 AC_ARG_ENABLE(noargs-shell,
1213 [AS_HELP_STRING([--enable-noargs-shell], [If sudo is given no arguments run a shell])],
1214 [ case "$enableval" in
1215 yes) AC_MSG_RESULT(yes)
1216 AC_DEFINE(SHELL_IF_NO_ARGS)
1218 no) AC_MSG_RESULT(no)
1220 *) AC_MSG_RESULT(no)
1221 AC_MSG_WARN([Ignoring unknown argument to --enable-noargs-shell: $enableval])
1224 ], AC_MSG_RESULT(no))
1226 AC_MSG_CHECKING(whether to set \$HOME to target user in shell mode)
1227 AC_ARG_ENABLE(shell-sets-home,
1228 [AS_HELP_STRING([--enable-shell-sets-home], [Set $HOME to target user in shell mode])],
1229 [ case "$enableval" in
1230 yes) AC_MSG_RESULT(yes)
1231 AC_DEFINE(SHELL_SETS_HOME)
1233 no) AC_MSG_RESULT(no)
1235 *) AC_MSG_RESULT(no)
1236 AC_MSG_WARN([Ignoring unknown argument to --enable-shell-sets-home: $enableval])
1239 ], AC_MSG_RESULT(no))
1241 AC_MSG_CHECKING(whether to disable 'command not found' messages)
1242 AC_ARG_ENABLE(path_info,
1243 [AS_HELP_STRING([--disable-path-info], [Print 'command not allowed' not 'command not found'])],
1244 [ case "$enableval" in
1245 yes) AC_MSG_RESULT(no)
1247 no) AC_MSG_RESULT(yes)
1248 AC_DEFINE(DONT_LEAK_PATH_INFO)
1251 *) AC_MSG_RESULT(no)
1252 AC_MSG_WARN([Ignoring unknown argument to --enable-path-info: $enableval])
1255 ], AC_MSG_RESULT(no))
1257 AC_MSG_CHECKING(whether to enable environment debugging)
1258 AC_ARG_ENABLE(env_debug,
1259 [AS_HELP_STRING([--enable-env-debug], [Whether to enable environment debugging.])],
1260 [ case "$enableval" in
1261 yes) AC_MSG_RESULT(yes)
1262 AC_DEFINE(ENV_DEBUG)
1264 no) AC_MSG_RESULT(no)
1266 *) AC_MSG_RESULT(no)
1267 AC_MSG_WARN([Ignoring unknown argument to --enable-env-debug: $enableval])
1270 ], AC_MSG_RESULT(no))
1272 AC_MSG_CHECKING(whether to enable environment resetting by default)
1273 AC_ARG_ENABLE(env_reset,
1274 [AS_HELP_STRING([--enable-env-reset], [Whether to enable environment resetting by default.])],
1275 [ case "$enableval" in
1281 AC_MSG_WARN([Ignoring unknown argument to --enable-env-reset: $enableval])
1285 if test "$env_reset" = "on"; then
1287 AC_DEFINE(ENV_RESET, TRUE)
1290 AC_DEFINE(ENV_RESET, FALSE)
1293 AC_ARG_ENABLE(warnings,
1294 [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])],
1295 [ case "$enableval" in
1296 yes) if test X"$with_devel" != X"yes" -a -n "$GCC"; then
1297 CFLAGS="${CFLAGS} -Wall"
1301 *) AC_MSG_WARN([Ignoring unknown argument to --enable-warnings: $enableval])
1306 AC_ARG_ENABLE(admin-flag,
1307 [AS_HELP_STRING([--enable-admin-flag], [Whether to create a Ubuntu-style admin flag file])],
1308 [ case "$enableval" in
1309 yes) AC_DEFINE(USE_ADMIN_FLAG)
1312 *) AC_MSG_WARN([Ignoring unknown argument to --enable-admin-flag: $enableval])
1317 AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])],
1318 [case $with_selinux in
1319 yes) SELINUX_USAGE="[[-r role]] [[-t type]] "
1320 AC_DEFINE(HAVE_SELINUX)
1321 SUDO_LIBS="${SUDO_LIBS} -lselinux"
1322 SUDO_OBJS="${SUDO_OBJS} selinux.o"
1323 PROGS="${PROGS} sesh"
1325 AC_CHECK_LIB([selinux], [setkeycreatecon],
1326 [AC_DEFINE(HAVE_SETKEYCREATECON)])
1329 *) AC_MSG_ERROR(["--with-selinux does not take an argument."])
1334 dnl gss_krb5_ccache_name() may not work on Heimdal so we don't use it by default
1336 AC_ARG_ENABLE(gss_krb5_ccache_name,
1337 [AS_HELP_STRING([--enable-gss-krb5-ccache-name], [Use GSS-API to set the Kerberos V cred cache name])],
1338 [check_gss_krb5_ccache_name=$enableval], [check_gss_krb5_ccache_name=no])
1341 dnl C compiler checks
1343 AC_SEARCH_LIBS([strerror], [cposix])
1345 AC_CHECK_TOOL(AR, ar, false)
1346 AC_CHECK_TOOL(RANLIB, ranlib, :)
1347 if test X"$AR" = X"false"; then
1348 AC_MSG_ERROR([the "ar" utility is required to build sudo])
1352 dnl Libtool setup, we require libtool 2.2.6b or higher
1355 AC_CONFIG_MACRO_DIR([m4])
1360 dnl Defer with_noexec until after libtool magic runs
1362 if test "$enable_shared" = "no"; then
1365 eval _shrext="$shrext_cmds"
1367 AC_MSG_CHECKING(path to sudo_noexec.so)
1368 AC_ARG_WITH(noexec, [AS_HELP_STRING([--with-noexec[=PATH]], [fully qualified pathname of sudo_noexec.so])],
1369 [case $with_noexec in
1370 yes) with_noexec="$libexecdir/sudo_noexec$_shrext"
1374 esac], [with_noexec="$libexecdir/sudo_noexec$_shrext"])
1375 AC_MSG_RESULT($with_noexec)
1376 NOEXECFILE="sudo_noexec$_shrext"
1377 NOEXECDIR="`echo $with_noexec|sed 's:^\(.*\)/[[^/]]*:\1:'`"
1380 dnl It is now safe to modify CFLAGS and CPPFLAGS
1382 if test X"$with_devel" = X"yes" -a -n "$GCC"; then
1383 CFLAGS="${CFLAGS} -Wall"
1387 dnl Find programs we use
1389 AC_CHECK_PROG(UNAMEPROG, [uname], [uname])
1390 AC_CHECK_PROG(TRPROG, [tr], [tr])
1391 AC_CHECK_PROGS(NROFFPROG, [nroff mandoc])
1392 if test -z "$NROFFPROG"; then
1394 mansrcdir='$(srcdir)'
1398 dnl What kind of beastie are we being run on?
1399 dnl Barf if config.cache was generated on another host.
1401 if test -n "$sudo_cv_prev_host"; then
1402 if test "$sudo_cv_prev_host" != "$host"; then
1403 AC_MSG_ERROR([config.cache was created on a different host; remove it and re-run configure.])
1405 AC_MSG_CHECKING(previous host type)
1406 AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1407 AC_MSG_RESULT([$sudo_cv_prev_host])
1410 # this will produce no output since there is no cached value
1411 AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1415 dnl We want to be able to differentiate between different rev's
1417 if test -n "$host_os"; then
1418 OS=`echo $host_os | sed 's/[[0-9]].*//'`
1419 OSREV=`echo $host_os | sed 's/^[[^0-9\.]]*\([[0-9\.]]*\).*$/\1/'`
1420 OSMAJOR=`echo $OSREV | sed 's/\..*$//'`
1429 # getcwd(3) opens a pipe to getpwd(1)!?!
1432 # system headers lack prototypes but gcc helps...
1433 if test -n "$GCC"; then
1434 OSDEFS="${OSDEFS} -D__USE_FIXED_PROTOTYPES__"
1437 shadow_funcs="getpwanam issecure"
1440 # To get the crypt(3) prototype (so we pass -Wall)
1441 OSDEFS="${OSDEFS} -D__EXTENSIONS__"
1442 # AFS support needs -lucb
1443 if test "$with_AFS" = "yes"; then
1444 AFS_LIBS="-lc -lucb"
1447 : ${mansectform='4'}
1448 : ${with_rpath='yes'}
1449 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1452 # To get all prototypes (so we pass -Wall)
1453 OSDEFS="${OSDEFS} -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT"
1454 SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-bI:\$(srcdir)/aixcrypt.exp"
1455 if test X"$with_blibpath" != X"no"; then
1456 AC_MSG_CHECKING([if linker accepts -Wl,-blibpath])
1457 O_LDFLAGS="$LDFLAGS"
1458 LDFLAGS="$O_LDFLAGS -Wl,-blibpath:/usr/lib:/lib"
1459 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [
1460 if test -n "$with_blibpath" -a "$with_blibpath" != "yes"; then
1461 blibpath="$with_blibpath"
1462 elif test -n "$GCC"; then
1463 blibpath="/usr/lib:/lib:/usr/local/lib"
1465 blibpath="/usr/lib:/lib"
1468 ], [AC_MSG_RESULT(no)])
1470 LDFLAGS="$O_LDFLAGS"
1472 # Use authenticate(3) as the default authentication method
1473 if test X"$with_aixauth" = X""; then
1474 AC_CHECK_FUNCS(authenticate, [AUTH_EXCL_DEF="AIX_AUTH"])
1477 # AIX analog of nsswitch.conf, enabled by default
1478 AC_ARG_WITH(netsvc, [AS_HELP_STRING([--with-netsvc[[=PATH]]], [path to netsvc.conf])],
1479 [case $with_netsvc in
1481 yes) with_netsvc="/etc/netsvc.conf"
1485 if test -z "$with_nsswitch" -a -z "$with_netsvc"; then
1486 with_netsvc="/etc/netsvc.conf"
1489 # AIX-specific functions
1490 AC_CHECK_FUNCS(getuserattr setauthdb)
1491 COMMON_OBJS="$COMMON_OBJS aix.o"
1495 : ${mansectform='4'}
1498 # AFS support needs -lBSD
1499 if test "$with_AFS" = "yes"; then
1500 AFS_LIBS="-lc -lBSD"
1503 : ${mansectform='4'}
1505 if test -z "$GCC"; then
1506 # HP-UX bundled compiler can't generate shared objects
1507 if test "x$ac_cv_prog_cc_c89" = "xno"; then
1511 # Use the +DAportable flag on hppa if it is supported
1515 CFLAGS="$CFLAGS +DAportable"
1516 AC_CACHE_CHECK([whether $CC understands +DAportable],
1517 [sudo_cv_var_daportable],
1519 [AC_LANG_PROGRAM([[]], [[]])],
1520 [sudo_cv_var_daportable=yes],
1521 [sudo_cv_var_daportable=no]
1525 if test X"$sudo_cv_var_daportable" != X"yes"; then
1534 AC_DEFINE(BROKEN_SYSLOG)
1536 # Not sure if setuid binaries are safe in < 9.x
1537 if test -n "$GCC"; then
1538 SUDO_LDFLAGS="${SUDO_LDFLAGS} -static"
1540 SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-a,archive"
1544 AC_DEFINE(BROKEN_SYSLOG)
1546 shadow_funcs="getspwuid"
1548 # DCE support (requires ANSI C compiler)
1549 if test "$with_DCE" = "yes"; then
1550 # order of libs in 9.X is important. -lc_r must be last
1551 SUDO_LIBS="${SUDO_LIBS} -ldce -lM -lc_r"
1552 LIBS="${LIBS} -ldce -lM -lc_r"
1553 CPPFLAGS="${CPPFLAGS} -D_REENTRANT -I/usr/include/reentrant"
1557 shadow_funcs="getprpwnam iscomsec"
1559 # HP-UX 10.20 libc has an incompatible getline
1560 ac_cv_func_getline="no"
1563 shadow_funcs="getspnam iscomsec"
1565 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1570 # ignore envariables wrt dynamic lib path
1571 SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-no_library_replacement"
1573 : ${CHECKSIA='true'}
1574 AC_MSG_CHECKING(whether to disable sia support on Digital UNIX)
1576 [AS_HELP_STRING([--disable-sia], [Disable SIA on Digital UNIX])],
1577 [ case "$enableval" in
1578 yes) AC_MSG_RESULT(no)
1581 no) AC_MSG_RESULT(yes)
1584 *) AC_MSG_RESULT(no)
1585 AC_MSG_WARN([Ignoring unknown argument to --enable-sia: $enableval])
1588 ], AC_MSG_RESULT(no))
1590 shadow_funcs="getprpwnam dispcrypt"
1591 # OSF/1 4.x and higher need -ldb too
1592 if test $OSMAJOR -lt 4; then
1593 shadow_libs="-lsecurity -laud -lm"
1595 shadow_libs="-lsecurity -ldb -laud -lm"
1598 # use SIA by default, if we have it
1599 test "$CHECKSIA" = "true" && AUTH_EXCL_DEF="SIA"
1602 # Some versions of Digital Unix ship with a broken
1603 # copy of prot.h, which we need for shadow passwords.
1604 # XXX - make should remove this as part of distclean
1606 AC_MSG_CHECKING([for broken prot.h])
1607 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1608 #include <sys/types.h>
1609 #include <sys/security.h>
1611 ]], [[exit(0);]])], [AC_MSG_RESULT(no)], [AC_MSG_RESULT([yes, fixing locally])
1612 sed 's:<acl.h>:<sys/acl.h>:g' < /usr/include/prot.h > prot.h
1615 : ${mansectform='4'}
1618 OSDEFS="${OSDEFS} -D_BSD_TYPES"
1619 if test -z "$NROFFPROG"; then
1620 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)'
1621 if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1622 if test -d /usr/share/catman/local; then
1623 mandir="/usr/share/catman/local"
1625 mandir="/usr/catman/local"
1629 if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1630 if test -d "/usr/share/man/local"; then
1631 mandir="/usr/share/man/local"
1633 mandir="/usr/man/local"
1637 # IRIX <= 4 needs -lsun
1638 if test "$OSMAJOR" -le 4; then
1639 AC_CHECK_LIB(sun, getpwnam, [LIBS="${LIBS} -lsun"])
1642 : ${mansectform='4'}
1644 *-*-linux*|*-*-k*bsd*-gnu)
1645 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1646 # Some Linux versions need to link with -lshadow
1647 shadow_funcs="getspnam"
1648 shadow_libs_optional="-lshadow"
1649 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1652 OSDEFS="${OSDEFS} -D_CONVEX_SOURCE"
1653 if test -z "$GCC"; then
1654 CFLAGS="${CFLAGS} -D__STDC__"
1657 shadow_defs="-D_AUDIT -D_ACL -DSecureWare"
1658 shadow_funcs="getprpwnam"
1659 shadow_libs="-lprot"
1663 shadow_funcs="getauthuid"
1664 shadow_libs="-lauth"
1667 LIBS="${LIBS} -lsun -lbsd"
1668 CPPFLAGS="${CPPFLAGS} -I/usr/include -I/usr/include/bsd"
1669 OSDEFS="${OSDEFS} -D_MIPS"
1671 : ${mansectform='4'}
1674 OSDEFS="${OSDEFS} -D_ISC"
1676 SUDO_LIBS="${SUDO_LIBS} -lcrypt"
1677 LIBS="${LIBS} -lcrypt"
1679 shadow_funcs="getspnam"
1683 : ${mansectform='4'}
1686 shadow_funcs="getprpwnam"
1687 shadow_libs="-lprot -lx"
1689 : ${mansectform='4'}
1691 m88k-motorola-sysv*)
1692 # motorolla's cc (a variant of gcc) does -O but not -O2
1693 CFLAGS=`echo $CFLAGS | sed 's/-O2/-O/g'`
1695 : ${mansectform='4'}
1698 shadow_funcs="getspnam"
1701 : ${mansectform='4'}
1702 : ${with_rpath='yes'}
1704 *-ncr-sysv4*|*-ncr-sysvr4*)
1705 AC_CHECK_LIB(c89, strcasecmp, AC_DEFINE(HAVE_STRCASECMP) [LIBS="${LIBS} -lc89"; ac_cv_func_strcasecmp=yes])
1707 : ${mansectform='4'}
1708 : ${with_rpath='yes'}
1710 *-ccur-sysv4*|*-ccur-sysvr4*)
1711 LIBS="${LIBS} -lgen"
1712 SUDO_LIBS="${SUDO_LIBS} -lgen"
1714 : ${mansectform='4'}
1715 : ${with_rpath='yes'}
1719 # Use shlicc for BSD/OS [23].x unless asked to do otherwise
1720 if test "${with_CC+set}" != set -a "$ac_cv_prog_CC" = gcc; then
1722 2|3) AC_MSG_NOTICE([using shlicc as CC])
1723 ac_cv_prog_CC=shlicc
1728 # Check for newer BSD auth API (just check for >= 3.0?)
1729 if test -z "$with_bsdauth"; then
1730 AC_CHECK_FUNCS(auth_challenge, [AUTH_EXCL_DEF="BSD_AUTH"])
1734 # FreeBSD has a real setreuid(2) starting with 2.1 and
1735 # backported to 2.0.5. We just take 2.1 and above...
1741 if test "${with_skey-'no'}" = "yes"; then
1742 SUDO_LIBS="${SUDO_LIBS} -lmd"
1745 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1746 : ${with_logincap='maybe'}
1749 # OpenBSD has a real setreuid(2) starting with 3.3 but
1750 # we will use setreuid(2) instead.
1753 # OpenBSD >= 3.0 supports BSD auth
1754 if test -z "$with_bsdauth"; then
1759 AUTH_EXCL_DEF="BSD_AUTH"
1763 : ${with_logincap='maybe'}
1766 # NetBSD has a real setreuid(2) starting with 1.3.2
1768 0.9*|1.[012]*|1.3|1.3.1)
1773 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1774 : ${with_logincap='maybe'}
1777 if test "${with_skey-'no'}" = "yes"; then
1778 SUDO_LIBS="${SUDO_LIBS} -lmd"
1781 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1782 : ${with_logincap='yes'}
1788 # Darwin has a real setreuid(2) starting with 9.0
1789 if test $OSMAJOR -lt 9; then
1793 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1794 : ${with_logincap='yes'}
1797 # lockf() on is broken on the NeXT -- use flock instead
1799 ac_cv_func_flock=yes
1803 : ${mansectform='4'}
1804 : ${with_rpath='yes'}
1808 : ${mansectform='4'}
1811 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1816 dnl Check for mixing mutually exclusive and regular auth methods
1818 AUTH_REG=${AUTH_REG# }
1819 AUTH_EXCL=${AUTH_EXCL# }
1820 if test -n "$AUTH_EXCL"; then
1822 if test $# != 1; then
1823 AC_MSG_ERROR([More than one mutually exclusive authentication method specified: $AUTH_EXCL])
1825 if test -n "$AUTH_REG"; then
1826 AC_MSG_ERROR([Cannot mix mutually exclusive ($AUTH_EXCL) and regular ($AUTH_REG) authentication methods])
1830 dnl Only one of S/Key and OPIE may be specified
1832 if test X"${with_skey}${with_opie}" = X"yesyes"; then
1833 AC_MSG_ERROR(["cannot use both S/Key and OPIE"])
1837 dnl Use BSD-style man sections by default
1840 : ${mansectform='5'}
1843 dnl Add in any libpaths or libraries specified via configure
1845 if test -n "$with_libpath"; then
1846 for i in ${with_libpath}; do
1847 SUDO_APPEND_LIBPATH(LDFLAGS, [$i])
1850 if test -n "$with_libraries"; then
1851 for i in ${with_libraries}; do
1863 dnl C compiler checks (to be done after os checks)
1865 AC_PROG_GCC_TRADITIONAL
1872 AC_PATH_PROG([FLEX], [flex], [flex])
1875 if test -z "$with_sendmail"; then
1878 if test -z "$with_editor"; then
1882 dnl Check for authpriv support in syslog
1884 AC_MSG_CHECKING(which syslog facility sudo should log with)
1885 if test X"$with_logfac" = X""; then
1886 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <syslog.h>]], [[int i = LOG_AUTHPRIV; (void)i;]])], [logfac=authpriv])
1888 AC_DEFINE_UNQUOTED(LOGFAC, "$logfac", [The syslog facility sudo will use.])
1889 AC_MSG_RESULT($logfac)
1891 dnl Header file checks
1896 AC_CHECK_HEADERS(malloc.h paths.h utime.h netgroup.h sys/sockio.h sys/bsdtypes.h sys/select.h sys/stropts.h sys/sysmacros.h)
1898 dnl Check for large file support. HP-UX 11.23 has a broken sys/type.h
1899 dnl when large files support is enabled so work around it.
1904 AC_CACHE_CHECK([whether sys/types.h needs _XOPEN_SOURCE_EXTENDED], [sudo_cv_xopen_source_extended],
1905 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
1906 #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=no], [
1907 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _XOPEN_SOURCE_EXTENDED
1909 #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=yes],
1910 [sudo_cv_xopen_source_extended=error])
1912 if test "$sudo_cv_xopen_source_extended" = "yes"; then
1913 OSDEFS="${OSDEFS} -D_XOPEN_SOURCE_EXTENDED"
1914 SUDO_DEFINE(_XOPEN_SOURCE_EXTENDED)
1918 AC_SYS_POSIX_TERMIOS
1919 if test "$ac_cv_sys_posix_termios" = "yes"; then
1920 AC_DEFINE(HAVE_TERMIOS_H)
1922 AC_CHECK_HEADERS(termio.h)
1925 if test ${with_logincap-'no'} != "no"; then
1926 AC_CHECK_HEADERS(login_cap.h, [LOGINCAP_USAGE='[[-c class|-]] '; LCMAN=1
1928 freebsd|netbsd) SUDO_LIBS="${SUDO_LIBS} -lutil"
1933 if test ${with_project-'no'} != "no"; then
1934 AC_CHECK_HEADER(project.h, AC_DEFINE(HAVE_PROJECT_H)
1935 [SUDO_LIBS="${SUDO_LIBS} -lproject"], -)
1942 AC_CHECK_TYPE([__signed char], [], [AC_CHECK_TYPE([signed char], [AC_DEFINE(__signed, signed)], [AC_DEFINE(__signed, [])])])
1943 AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include <sys/types.h>
1944 #include <signal.h>])
1945 AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T)], [], [#include <sys/types.h>
1946 #include <signal.h>])
1947 AC_CHECK_TYPE([struct timespec], [AC_DEFINE(HAVE_TIMESPEC)], [], [#include <sys/types.h>
1948 #if TIME_WITH_SYS_TIME
1949 # include <sys/time.h>
1952 AC_CHECK_TYPES([struct in6_addr], [AC_DEFINE(HAVE_IN6_ADDR)], [], [#include <sys/types.h>
1953 #include <netinet/in.h>])
1954 AC_TYPE_LONG_LONG_INT
1955 AC_CHECK_SIZEOF([long int])
1963 dnl only set RETSIGTYPE if it is not set already
1973 AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf tzset \
1974 strftime setrlimit initgroups getgroups fstat gettimeofday \
1975 regcomp setlocale nl_langinfo getaddrinfo setenv \
1976 mbr_check_membership setrlimit64)
1977 AC_CHECK_FUNCS(getline, [], [
1979 AC_CHECK_FUNCS(fgetln)
1981 AC_CHECK_FUNCS(setsid, [], [
1986 AC_CHECK_FUNCS(sysctl getutxid getutid, [break])
1988 AC_CHECK_FUNCS(openpty, [AC_CHECK_HEADERS(util.h pty.h, [break])], [
1989 AC_CHECK_LIB(util, openpty, [
1990 AC_CHECK_HEADERS(util.h pty.h, [break])
1991 SUDO_LIBS="${SUDO_LIBS} -lutil"
1992 AC_DEFINE(HAVE_OPENPTY)
1994 AC_CHECK_FUNCS(_getpty, [], [
1995 AC_CHECK_FUNCS(grantpt, [
1996 AC_CHECK_FUNCS(posix_openpt)
1998 AC_CHECK_FUNCS(revoke)
2003 AC_CHECK_FUNCS(unsetenv, SUDO_FUNC_UNSETENV_VOID)
2004 SUDO_FUNC_PUTENV_CONST
2005 if test -z "$SKIP_SETRESUID"; then
2006 AC_CHECK_FUNCS(setresuid, [SKIP_SETREUID=yes])
2008 if test -z "$SKIP_SETREUID"; then
2009 AC_CHECK_FUNCS(setreuid, [SKIP_SETEUID=yes])
2011 if test -z "$SKIP_SETEUID"; then
2012 AC_CHECK_FUNCS(seteuid)
2014 if test X"$with_interfaces" != X"no"; then
2015 AC_CHECK_FUNCS(getifaddrs, [AC_CHECK_FUNCS(freeifaddrs)])
2017 if test -z "$BROKEN_GETCWD"; then
2018 AC_REPLACE_FUNCS(getcwd)
2020 AC_CHECK_FUNCS(glob, [AC_MSG_CHECKING(for GLOB_BRACE and GLOB_TILDE in glob.h)
2021 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <glob.h>]], [[int i = GLOB_BRACE | GLOB_TILDE; (void)i;]])], [AC_DEFINE(HAVE_EXTENDED_GLOB)
2022 AC_MSG_RESULT(yes)], [AC_LIBOBJ(glob)
2023 AC_MSG_RESULT(no)])], [AC_LIBOBJ(glob)])
2024 AC_CHECK_FUNCS(lockf flock, [break])
2025 AC_CHECK_FUNCS(waitpid wait3, [break])
2026 AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]])
2027 AC_CHECK_FUNCS(utimes, [AC_CHECK_FUNCS(futimes futimesat, [break])], [AC_CHECK_FUNCS(futime) AC_LIBOBJ(utimes)])
2028 AC_CHECK_FUNCS(killpg, [], [AC_LIBOBJ(killpg)])
2029 SUDO_FUNC_FNMATCH([AC_DEFINE(HAVE_FNMATCH)], [AC_LIBOBJ(fnmatch)])
2031 AC_REPLACE_FUNCS(memrchr strerror strcasecmp sigaction strlcpy strlcat)
2032 AC_CHECK_FUNCS(nanosleep, [], [
2033 # On Solaris, nanosleep is in librt
2034 AC_CHECK_LIB(rt, nanosleep, [LIBS="${LIBS} -lrt"], [AC_LIBOBJ(nanosleep)])
2036 AC_CHECK_FUNCS(closefrom, [], [AC_LIBOBJ(closefrom)
2037 AC_CHECK_DECL(F_CLOSEM, AC_DEFINE(HAVE_FCNTL_CLOSEM), [],
2038 [ #include <limits.h>
2039 #include <fcntl.h> ])
2041 AC_CHECK_FUNCS(mkstemps, [], [SUDO_OBJS="${SUDO_OBJS} mkstemps.o"
2042 AC_CHECK_FUNCS(random lrand48, [break])
2044 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf, , [NEED_SNPRINTF=1])
2045 if test X"$ac_cv_type_struct_timespec" != X"no"; then
2046 AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)]
2047 [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))],
2048 [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))])
2051 dnl Check for the dirfd function/macro. If not found, look for dd_fd in DIR.
2053 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2054 #include <$ac_header_dirent>]], [[DIR *d; (void)dirfd(d);]])], [AC_DEFINE(HAVE_DIRFD)], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2055 #include <$ac_header_dirent>]], [[DIR d; memset(&d, 0, sizeof(d)); return(d.dd_fd);]])], [AC_DEFINE(HAVE_DD_FD)], [])])
2057 dnl If NEED_SNPRINTF is set, add snprintf.c to LIBOBJS
2058 dnl (it contains snprintf, vsnprintf, asprintf, and vasprintf)
2060 if test -n "$NEED_SNPRINTF"; then
2064 dnl If socket(2) not in libc, check -lsocket and -linet
2065 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2066 dnl In this case we look for main(), not socket() to avoid using a cached value
2068 AC_CHECK_FUNC(socket, , [AC_CHECK_LIB(socket, socket, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(inet, socket, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"], AC_MSG_WARN(unable to find socket() trying -lsocket -lnsl)
2069 AC_CHECK_LIB(socket, socket, [NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"], , -lnsl)))])
2071 dnl If inet_addr(3) not in libc, check -lnsl and -linet
2072 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2074 AC_CHECK_FUNC(inet_addr, , [AC_CHECK_FUNC(__inet_addr, , AC_CHECK_LIB(nsl, inet_addr, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, inet_addr, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"], AC_MSG_WARN(unable to find inet_addr() trying -lsocket -lnsl)
2075 AC_CHECK_LIB(socket, inet_addr, [NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"], , -lnsl))))])
2077 dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet
2079 AC_CHECK_FUNC(syslog, , [AC_CHECK_LIB(socket, syslog, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(nsl, syslog, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, syslog, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"])))])
2081 dnl Check for getprogname() or __progname
2083 AC_CHECK_FUNCS(getprogname, , [
2084 AC_MSG_CHECKING([for __progname])
2085 AC_CACHE_VAL(sudo_cv___progname, [
2086 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; (void)puts(__progname);]])], [sudo_cv___progname=yes], [sudo_cv___progname=no])])
2087 if test "$sudo_cv___progname" = "yes"; then
2088 AC_DEFINE(HAVE___PROGNAME)
2090 AC_LIBOBJ(getprogname)
2092 AC_MSG_RESULT($sudo_cv___progname)
2096 dnl Check for strsignal() or sys_siglist
2098 AC_CHECK_FUNCS(strsignal, [], [
2099 AC_LIBOBJ(strsignal)
2100 HAVE_SIGLIST="false"
2101 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], [
2108 if test "$HAVE_SIGLIST" != "true"; then
2114 dnl nsswitch.conf and its equivalents
2116 if test ${with_netsvc-"no"} != "no"; then
2117 SUDO_DEFINE_UNQUOTED(_PATH_NETSVC_CONF, "${with_netsvc-/etc/netsvc.conf}")
2118 netsvc_conf=${with_netsvc-/etc/netsvc.conf}
2119 elif test ${with_nsswitch-"yes"} != "no"; then
2120 SUDO_DEFINE_UNQUOTED(_PATH_NSSWITCH_CONF, "${with_nsswitch-/etc/nsswitch.conf}")
2121 nsswitch_conf=${with_nsswitch-/etc/nsswitch.conf}
2125 dnl Mutually exclusive auth checks come first, followed by
2126 dnl non-exclusive ones. Note: passwd must be last of all!
2130 dnl Convert default authentication methods to with_* if
2131 dnl no explicit authentication scheme was specified.
2133 if test -z "${AUTH_EXCL}${AUTH_REG}" -a -n "$AUTH_EXCL_DEF"; then
2134 for auth in $AUTH_EXCL_DEF; do
2136 AIX_AUTH) with_aixauth=maybe;;
2137 BSD_AUTH) with_bsdauth=maybe;;
2138 PAM) with_pam=maybe;;
2139 SIA) CHECKSIA=true;;
2145 dnl PAM support. Systems that use PAM by default set with_pam=default
2146 dnl and we do the actual tests here.
2148 if test ${with_pam-"no"} != "no"; then
2150 dnl Some platforms need libdl for dlopen
2153 *-ldl*) SUDO_LIBS="${SUDO_LIBS} -lpam"
2155 *) AC_CHECK_LIB([dl], [main], [SUDO_LIBS="${SUDO_LIBS} -lpam -ldl"], [SUDO_LIBS="${SUDO_LIBS} -lpam"])
2156 ac_cv_lib_dl=ac_cv_lib_dl_main
2161 dnl Some PAM implementations (MacOS X for example) put the PAM headers
2162 dnl in /usr/include/pam instead of /usr/include/security...
2164 AC_CHECK_HEADERS([security/pam_appl.h] [pam/pam_appl.h], [with_pam=yes; break])
2165 if test "$with_pam" = "yes"; then
2167 AUTH_OBJS="$AUTH_OBJS pam.o";
2170 AC_ARG_WITH(pam-login, [AS_HELP_STRING([--with-pam-login], [enable specific PAM session for sudo -i])],
2171 [case $with_pam_login in
2172 yes) AC_DEFINE([HAVE_PAM_LOGIN])
2173 AC_MSG_CHECKING(whether to use PAM login)
2177 *) AC_MSG_ERROR(["--with-pam-login does not take an argument."])
2181 AC_MSG_CHECKING(whether to use PAM session support)
2182 AC_ARG_ENABLE(pam_session,
2183 [AS_HELP_STRING([--disable-pam-session], [Disable PAM session support])],
2184 [ case "$enableval" in
2185 yes) AC_MSG_RESULT(yes)
2187 no) AC_MSG_RESULT(no)
2188 AC_DEFINE([NO_PAM_SESSION], [], [PAM session support disabled])
2190 *) AC_MSG_RESULT(no)
2191 AC_MSG_WARN([Ignoring unknown argument to --enable-pam-session: $enableval])
2193 esac], AC_MSG_RESULT(yes))
2196 *-*-linux*|*-*-solaris*)
2197 # dgettext() may be defined to dgettext_libintl in the
2198 # header file, so first check that it links w/ additional
2199 # libs, then try with -lintl
2200 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2201 [[#include <libintl.h>]], [(void)dgettext((char *)0, (char *)0);])],
2202 [AC_DEFINE(HAVE_DGETTEXT)],
2203 [AC_CHECK_LIB(intl, dgettext, [LIBS="${LIBS} -lintl"]
2204 [AC_DEFINE(HAVE_DGETTEXT)])])
2211 dnl AIX general authentication
2212 dnl If set to "maybe" only enable if no other exclusive method in use.
2214 if test ${with_aixauth-'no'} != "no"; then
2215 if test X"$with_aixauth" != X"maybe" -o X"$AUTH_EXCL" = X""; then
2216 AC_MSG_NOTICE([using AIX general authentication])
2217 AC_DEFINE(HAVE_AIXAUTH)
2218 AUTH_OBJS="$AUTH_OBJS aix_auth.o";
2219 SUDO_LIBS="${SUDO_LIBS} -ls"
2225 dnl BSD authentication
2226 dnl If set to "maybe" only enable if no other exclusive method in use.
2228 if test ${with_bsdauth-'no'} != "no"; then
2229 AC_CHECK_HEADER(bsd_auth.h, AC_DEFINE(HAVE_BSD_AUTH_H)
2230 [AUTH_OBJS="$AUTH_OBJS bsdauth.o"]
2231 [BSDAUTH_USAGE='[[-a auth_type]] ']
2232 [AUTH_EXCL=BSD_AUTH; BAMAN=1],
2233 [AC_MSG_ERROR([BSD authentication was specified but bsd_auth.h could not be found])])
2237 dnl SIA authentication for Tru64 Unix
2239 if test ${CHECKSIA-'false'} = "true"; then
2240 AC_CHECK_FUNCS(sia_ses_init, [found=true], [found=false])
2241 if test "$found" = "true"; then
2243 AUTH_OBJS="$AUTH_OBJS sia.o"
2248 dnl extra FWTK libs + includes
2250 if test ${with_fwtk-'no'} != "no"; then
2251 if test "$with_fwtk" != "yes"; then
2252 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_fwtk}])
2253 CPPFLAGS="${CPPFLAGS} -I${with_fwtk}"
2256 SUDO_LIBS="${SUDO_LIBS} -lauth -lfwall"
2257 AUTH_OBJS="$AUTH_OBJS fwtk.o"
2261 dnl extra SecurID lib + includes
2263 if test ${with_SecurID-'no'} != "no"; then
2264 if test "$with_SecurID" != "yes"; then
2266 elif test -d /usr/ace/examples; then
2267 with_SecurID=/usr/ace/examples
2269 with_SecurID=/usr/ace
2271 CPPFLAGS="${CPPFLAGS} -I${with_SecurID}"
2272 _LDFLAGS="${LDFLAGS}"
2273 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_SecurID}])
2275 # Determine whether to use the new or old SecurID API
2277 AC_CHECK_LIB(aceclnt, SD_Init,
2279 AUTH_OBJS="$AUTH_OBJS securid5.o";
2280 SUDO_LIBS="${SUDO_LIBS} -laceclnt -lpthread"
2283 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_SecurID}])
2285 AUTH_OBJS="$AUTH_OBJS securid.o";
2286 SUDO_LIBS="${SUDO_LIBS} ${with_SecurID}/sdiclient.a"
2292 LDFLAGS="${_LDFLAGS}"
2296 dnl Non-mutually exclusive auth checks come next.
2297 dnl Note: passwd must be last of all!
2301 dnl Convert default authentication methods to with_* if
2302 dnl no explicit authentication scheme was specified.
2304 if test -z "${AUTH_EXCL}" -a -n "$AUTH_DEF"; then
2305 for auth in $AUTH_DEF; do
2307 passwd) : ${with_passwd='maybe'};;
2315 if test ${with_kerb4-'no'} != "no"; then
2316 AC_DEFINE(HAVE_KERB4)
2318 dnl Use the specified directory, if any, else search for correct inc dir
2320 O_LDFLAGS="$LDFLAGS"
2321 if test "$with_kerb4" = "yes"; then
2323 O_CPPFLAGS="$CPPFLAGS"
2324 for dir in "" "kerberosIV/" "krb4/" "kerberos4/" "kerberosv4/"; do
2325 CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2326 AC_PREPROC_IFELSE([#include <krb.h>], [found=yes; break])
2328 test X"$found" = X"no" && CPPFLAGS="$O_CPPFLAGS"
2330 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_kerb4}/lib])
2331 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_kerb4}/lib])
2332 CPPFLAGS="$CPPFLAGS -I${with_kerb4}/include"
2333 AC_CHECK_HEADER([krb.h], [found=yes], [found=no])
2335 if test X"$found" = X"no"; then
2336 AC_MSG_WARN([Unable to locate Kerberos IV include files, you will have to edit the Makefile and add -I/path/to/krb/includes to CPPFLAGS])
2340 dnl Check for -ldes vs. -ldes425
2342 AC_CHECK_LIB(des, des_cbc_encrypt, [K4LIBS="-ldes"], [
2343 AC_CHECK_LIB(des425, des_cbc_encrypt, [K4LIBS="-ldes425"], [K4LIBS=""])
2346 dnl Try to determine whether we have KTH or MIT/CNS Kerberos IV
2348 AC_MSG_CHECKING(whether we are using KTH Kerberos IV)
2349 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>]], [[const char *tmp = krb4_version;]])], [
2351 K4LIBS="${K4LIBS} -lcom_err"
2352 AC_CHECK_LIB(roken, main, [K4LIBS="${K4LIBS} -lroken"])
2358 dnl The actual Kerberos IV lib might be -lkrb or -lkrb4
2360 AC_CHECK_LIB(krb, main, [K4LIBS="-lkrb $K4LIBS"], [
2361 AC_CHECK_LIB(krb4, main, [K4LIBS="-lkrb4 $K4LIBS"],
2362 [K4LIBS="-lkrb $K4LIBS"]
2363 [AC_MSG_WARN([Unable to locate Kerberos IV libraries, you will have to edit the Makefile and add -L/path/to/krb/libs to SUDO_LDFLAGS and possibly add Kerberos libs to SUDO_LIBS])]
2366 LDFLAGS="$O_LDFLAGS"
2367 SUDO_LIBS="${SUDO_LIBS} $K4LIBS"
2368 AUTH_OBJS="$AUTH_OBJS kerb4.o"
2373 dnl There is an easy way and a hard way...
2375 if test ${with_kerb5-'no'} != "no"; then
2376 AC_CHECK_PROG(KRB5CONFIG, krb5-config, yes, "")
2377 if test -n "$KRB5CONFIG"; then
2378 AC_DEFINE(HAVE_KERB5)
2379 AUTH_OBJS="$AUTH_OBJS kerb5.o"
2380 CPPFLAGS="$CPPFLAGS `krb5-config --cflags`"
2381 SUDO_LIBS="$SUDO_LIBS `krb5-config --libs`"
2383 dnl Try to determine whether we have Heimdal or MIT Kerberos
2385 AC_MSG_CHECKING(whether we are using Heimdal)
2386 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2388 AC_DEFINE(HAVE_HEIMDAL)
2395 if test ${with_kerb5-'no'} != "no" -a -z "$KRB5CONFIG"; then
2396 AC_DEFINE(HAVE_KERB5)
2398 dnl Use the specified directory, if any, else search for correct inc dir
2400 if test "$with_kerb5" = "yes"; then
2402 O_CPPFLAGS="$CPPFLAGS"
2403 for dir in "" "kerberosV/" "krb5/" "kerberos5/" "kerberosv5/"; do
2404 CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2405 AC_PREPROC_IFELSE([#include <krb5.h>], [found=yes; break])
2407 if test X"$found" = X"no"; then
2408 CPPFLAGS="$O_CPPFLAGS"
2409 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])
2412 dnl XXX - try to include krb5.h here too
2413 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_kerb5}/lib])
2414 CPPFLAGS="$CPPFLAGS -I${with_kerb5}/include"
2418 dnl Try to determine whether we have Heimdal or MIT Kerberos
2420 AC_MSG_CHECKING(whether we are using Heimdal)
2421 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2423 AC_DEFINE(HAVE_HEIMDAL)
2424 # XXX - need to check whether -lcrypo is needed!
2425 SUDO_LIBS="${SUDO_LIBS} -lkrb5 -lcrypto -ldes -lcom_err -lasn1"
2426 AC_CHECK_LIB(roken, main, [SUDO_LIBS="${SUDO_LIBS} -lroken"])
2429 SUDO_LIBS="${SUDO_LIBS} -lkrb5 -lk5crypto -lcom_err"
2430 AC_CHECK_LIB(krb5support, main, [SUDO_LIBS="${SUDO_LIBS} -lkrb5support"])
2432 AUTH_OBJS="$AUTH_OBJS kerb5.o"
2434 LIBS="${LIBS} ${SUDO_LIBS}"
2435 AC_CHECK_FUNCS(krb5_verify_user krb5_init_secure_context)
2436 AC_CHECK_FUNCS(krb5_get_init_creds_opt_alloc, [
2437 AC_CACHE_CHECK([whether krb5_get_init_creds_opt_free takes a context],
2438 sudo_cv_krb5_get_init_creds_opt_free_two_args, [
2441 [[#include <krb5.h>]],
2442 [[krb5_get_init_creds_opt_free(NULL, NULL);]]
2444 [sudo_cv_krb5_get_init_creds_opt_free_two_args=yes],
2445 [sudo_cv_krb5_get_init_creds_opt_free_two_args=no]
2450 if test X"$sudo_cv_krb5_get_init_creds_opt_free_two_args" = X"yes"; then
2451 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS)
2457 dnl extra AFS libs and includes
2459 if test ${with_AFS-'no'} = "yes"; then
2461 # looks like the "standard" place for AFS libs is /usr/afsws/lib
2462 AFSLIBDIRS="/usr/lib/afs /usr/afsws/lib /usr/afsws/lib/afs"
2463 for i in $AFSLIBDIRS; do
2464 if test -d ${i}; then
2465 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [$i])
2466 FOUND_AFSLIBDIR=true
2469 if test -z "$FOUND_AFSLIBDIR"; then
2470 AC_MSG_WARN([Unable to locate AFS libraries, you will have to edit the Makefile and add -L/path/to/afs/libs to SUDO_LDFLAGS or rerun configure with the --with-libpath options.])
2473 # Order is important here. Note that we build AFS_LIBS from right to left
2474 # since AFS_LIBS may be initialized with BSD compat libs that must go last
2475 AFS_LIBS="-laudit ${AFS_LIBS}"
2476 for i in $AFSLIBDIRS; do
2477 if test -f ${i}/util.a; then
2478 AFS_LIBS="${i}/util.a ${AFS_LIBS}"
2483 if test -z "$FOUND_UTIL_A"; then
2484 AFS_LIBS="-lutil ${AFS_LIBS}"
2486 AFS_LIBS="-lkauth -lprot -lubik -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err ${AFS_LIBS}"
2488 # AFS includes may live in /usr/include on some machines...
2489 for i in /usr/afsws/include; do
2490 if test -d ${i}; then
2491 CPPFLAGS="${CPPFLAGS} -I${i}"
2492 FOUND_AFSINCDIR=true
2496 if test -z "$FOUND_AFSLIBDIR"; then
2497 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.])
2500 AUTH_OBJS="$AUTH_OBJS afs.o"
2504 dnl extra DCE obj + lib
2505 dnl Order of libs in HP-UX 10.x is important, -ldce must be last.
2507 if test ${with_DCE-'no'} = "yes"; then
2508 DCE_OBJS="${DCE_OBJS} dce_pwent.o"
2509 SUDO_LIBS="${SUDO_LIBS} -ldce"
2510 AUTH_OBJS="$AUTH_OBJS dce.o"
2514 dnl extra S/Key lib and includes
2516 if test "${with_skey-'no'}" = "yes"; then
2517 O_LDFLAGS="$LDFLAGS"
2518 if test "$with_skey" != "yes"; then
2519 CPPFLAGS="${CPPFLAGS} -I${with_skey}/include"
2520 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_skey}/lib])
2521 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_skey}/lib])
2522 AC_PREPROC_IFELSE([#include <skey.h>], [found=yes], [found=no])
2525 O_CPPFLAGS="$CPPFLAGS"
2526 for dir in "" "/usr/local" "/usr/contrib"; do
2527 test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
2528 AC_PREPROC_IFELSE([#include <skey.h>], [found=yes; break])
2530 if test "$found" = "no" -o -z "$dir"; then
2531 CPPFLAGS="$O_CPPFLAGS"
2533 SUDO_APPEND_LIBPATH(LDFLAGS, [${dir}/lib])
2534 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${dir}/lib])
2537 if test "$found" = "no"; then
2538 AC_MSG_WARN([Unable to locate skey.h, you will have to edit the Makefile and add -I/path/to/skey/includes to CPPFLAGS])
2540 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 SUDO_LDFLAGS])])
2541 AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS))
2542 LDFLAGS="$O_LDFLAGS"
2543 SUDO_LIBS="${SUDO_LIBS} -lskey"
2544 AUTH_OBJS="$AUTH_OBJS rfc1938.o"
2548 dnl extra OPIE lib and includes
2550 if test "${with_opie-'no'}" = "yes"; then
2551 O_LDFLAGS="$LDFLAGS"
2552 if test "$with_opie" != "yes"; then
2553 CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
2554 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_opie}/lib])
2555 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_opie}/lib])
2556 AC_PREPROC_IFELSE([#include <opie.h>], [found=yes], [found=no])
2559 O_CPPFLAGS="$CPPFLAGS"
2560 for dir in "" "/usr/local" "/usr/contrib"; do
2561 test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
2562 AC_PREPROC_IFELSE([#include <opie.h>], [found=yes; break])
2564 if test "$found" = "no" -o -z "$dir"; then
2565 CPPFLAGS="$O_CPPFLAGS"
2567 SUDO_APPEND_LIBPATH(LDFLAGS, [${dir}/lib])
2568 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${dir}/lib])
2571 if test "$found" = "no"; then
2572 AC_MSG_WARN([Unable to locate opie.h, you will have to edit the Makefile and add -I/path/to/opie/includes to CPPFLAGS])
2574 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 SUDO_LDFLAGS])])
2575 LDFLAGS="$O_LDFLAGS"
2576 SUDO_LIBS="${SUDO_LIBS} -lopie"
2577 AUTH_OBJS="$AUTH_OBJS rfc1938.o"
2581 dnl Check for shadow password routines if we have not already done so.
2582 dnl If there is a specific list of functions to check we do that first.
2583 dnl Otherwise, we check for SVR4-style and then SecureWare-style.
2585 if test ${with_passwd-'no'} != "no"; then
2587 dnl if crypt(3) not in libc, look elsewhere
2589 if test -z "$LIB_CRYPT"; then
2590 AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [test -n "$ac_lib" && SUDO_LIBS="${SUDO_LIBS} $ac_res"])
2593 if test "$CHECKSHADOW" = "true" -a -n "$shadow_funcs"; then
2595 LIBS="$LIBS $shadow_libs"
2597 AC_CHECK_FUNCS($shadow_funcs, [found=yes])
2598 if test "$found" = "yes"; then
2599 SUDO_LIBS="$SUDO_LIBS $shadow_libs"
2600 elif test -n "$shadow_libs_optional"; then
2601 LIBS="$LIBS $shadow_libs_optional"
2602 AC_CHECK_FUNCS($shadow_funcs, [found=yes])
2603 if test "$found" = "yes"; then
2604 SUDO_LIBS="$SUDO_LIBS $shadow_libs $shadow_libs_optional"
2607 if test "$found" = "yes"; then
2608 case "$shadow_funcs" in
2609 *getprpwnam*) SECUREWARE=1;;
2611 test -n "$shadow_defs" && OSDEFS="${OSDEFS} $shadow_defs"
2617 if test "$CHECKSHADOW" = "true"; then
2618 AC_SEARCH_LIBS([getspnam], [gen], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && SUDO_LIBS="${SUDO_LIBS} $ac_res"])
2620 if test "$CHECKSHADOW" = "true"; then
2621 AC_SEARCH_LIBS([getprpwnam], [sec security prot], [AC_DEFINE(HAVE_GETPRPWNAM)] [CHECKSHADOW=false; SECUREWARE=1; test -n "$ac_lib" && SUDO_LIBS="${SUDO_LIBS} $ac_res"])
2623 if test -n "$SECUREWARE"; then
2624 AC_CHECK_FUNCS(bigcrypt set_auth_parameters initprivs)
2625 AUTH_OBJS="$AUTH_OBJS secureware.o"
2630 dnl extra lib and .o file for LDAP support
2632 if test ${with_ldap-'no'} != "no"; then
2634 if test "$with_ldap" != "yes"; then
2635 SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_ldap}/lib])
2636 SUDO_APPEND_LIBPATH(LDFLAGS, [${with_ldap}/lib])
2637 CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include"
2640 SUDO_OBJS="${SUDO_OBJS} ldap.o"
2643 AC_MSG_CHECKING([for LDAP libraries])
2647 for l in -lldap -llber '-lssl -lcrypto'; do
2649 LDAP_LIBS="${LDAP_LIBS} $l"
2650 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2652 #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [found=yes; break])
2654 dnl if nothing linked just try with -lldap
2655 if test "$found" = "no"; then
2656 LIBS="${_LIBS} -lldap"
2658 AC_MSG_RESULT([not found, using -lldap])
2660 AC_MSG_RESULT([$LDAP_LIBS])
2662 dnl check if we need to link with -llber for ber_set_option
2664 AC_SEARCH_LIBS([ber_set_option], [lber], [found=yes], [found=no])
2665 if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
2666 LDAP_LIBS="$LDAP_LIBS -llber"
2668 dnl check if ldap.h includes lber.h for us
2669 AC_MSG_CHECKING([whether lber.h is needed])
2670 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2671 #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [AC_MSG_RESULT([no])], [
2672 AC_MSG_RESULT([yes])
2673 AC_DEFINE(HAVE_LBER_H)])
2675 AC_CHECK_HEADERS([sasl/sasl.h] [sasl.h], [AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s)], [break])
2676 AC_CHECK_HEADERS([ldap_ssl.h] [mps/ldap_ssl.h], [break], [], [#include <ldap.h>])
2677 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)
2678 AC_CHECK_FUNCS(ldap_search_ext_s ldap_search_st, [break])
2680 if test X"$check_gss_krb5_ccache_name" = X"yes"; then
2681 AC_CHECK_LIB(gssapi, gss_krb5_ccache_name,
2682 AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
2683 [LDAP_LIBS="${LDAP_LIBS} -lgssapi"],
2684 AC_CHECK_LIB(gssapi_krb5, gss_krb5_ccache_name,
2685 AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
2686 [LDAP_LIBS="${LDAP_LIBS} -lgssapi_krb5"])
2689 # gssapi headers may be separate or part of Kerberos V
2691 O_CPPFLAGS="$CPPFLAGS"
2692 for dir in "" "kerberosV" "krb5" "kerberos5" "kerberosv5"; do
2693 test X"$dir" != X"" && CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2694 AC_PREPROC_IFELSE([#include <gssapi/gssapi.h>], [found="gssapi/gssapi.h"; break], [AC_PREPROC_IFELSE([#include <gssapi.h>], [found="gssapi.h"; break])])
2696 if test X"$found" != X"no"; then
2697 AC_CHECK_HEADERS([$found])
2698 if test X"$found" = X"gssapi/gssapi.h"; then
2699 AC_CHECK_HEADERS([gssapi/gssapi_krb5.h])
2702 CPPFLAGS="$O_CPPFLAGS"
2703 AC_MSG_WARN([Unable to locate gssapi.h, you will have to edit the Makefile and add -I/path/to/gssapi/includes to CPPFLAGS])
2707 SUDO_LIBS="${SUDO_LIBS} ${LDAP_LIBS}"
2713 dnl Add LIBVAS_RPATH to LDFLAGS
2714 dnl GNU ld accepts -R/path/ as an alias for -rpath /path/
2716 if test X"$LIBVAS_RPATH" != X""; then
2717 if test -n "$blibpath"; then
2718 blibpath_add="${blibpath_add}:$LIBVAS_RPATH"
2721 *-*-hpux*) LDFLAGS="$LDFLAGS -Wl,+b,$LIBVAS_RPATH"
2723 *) LDFLAGS="$LDFLAGS -Wl,-R$LIBVAS_RPATH"
2730 dnl Add $blibpath to SUDO_LDFLAGS if specified by the user or if we
2731 dnl added -L dirpaths to SUDO_LDFLAGS.
2733 if test -n "$blibpath"; then
2734 if test -n "$blibpath_add"; then
2735 SUDO_LDFLAGS="$SUDO_LDFLAGS -Wl,-blibpath:${blibpath}${blibpath_add}"
2736 elif test -n "$with_blibpath" -a "$with_blibpath" != "yes"; then
2737 SUDO_LDFLAGS="$SUDO_LDFLAGS -Wl,-blibpath:${blibpath}"
2742 dnl Check for log file, timestamp and iolog locations
2749 dnl If I/O logging is enabled, build sudoreplay and exec_pty get_pty.o iolog.o
2751 if test "${with_iologdir-yes}" != "no"; then
2752 # Require POSIX job control for I/O log support
2753 AC_CHECK_FUNCS(tcsetpgrp, [
2754 SUDO_OBJS="${SUDO_OBJS} exec_pty.o get_pty.o iolog.o"
2755 PROGS="$PROGS sudoreplay"
2759 [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])], [])
2760 case ${enable_zlib-"yes"} in
2762 AC_CHECK_LIB(z, gzdopen, [
2763 AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"], [enable_zlib=builtin])
2769 AC_DEFINE(HAVE_ZLIB_H)
2776 AC_DEFINE(HAVE_ZLIB_H)
2777 CPPFLAGS="${CPPFLAGS} -I${enable_zlib}/include"
2778 SUDO_APPEND_LIBPATH(ZLIB, [$enable_zlib/lib])
2782 if test X"$enable_zlib" = X"builtin"; then
2783 AC_DEFINE(HAVE_ZLIB_H)
2784 CPPFLAGS="${CPPFLAGS}"' -I$(srcdir)/zlib'
2785 ZLIB="${ZLIB} libz.a"
2789 AC_MSG_WARN([Disabling I/O log support due to lack of tcsetpgrp function])
2795 dnl Use passwd auth module?
2797 case "$with_passwd" in
2799 AUTH_OBJS="$AUTH_OBJS getspwuid.o passwd.o"
2802 AC_DEFINE(WITHOUT_PASSWD)
2803 if test -z "$AUTH_OBJS"; then
2804 AC_MSG_ERROR([no authentication methods defined.])
2808 AUTH_OBJS=${AUTH_OBJS# }
2809 _AUTH=`echo "$AUTH_OBJS" | sed -e 's/\.o//g' -e 's/getspwuid *//'`
2810 AC_MSG_NOTICE([using the following authentication methods: $_AUTH])
2813 dnl LIBS may contain duplicates from SUDO_LIBS or NET_LIBS so prune it.
2815 if test -n "$LIBS"; then
2820 for sl in ${SUDO_LIBS} ${NET_LIBS}; do
2821 test $l = $sl && dupe=1
2823 test $dupe = 0 && LIBS="${LIBS} $l"
2830 test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
2833 dnl Defer setting _PATH_SUDO_NOEXEC until after exec_prefix is set
2834 dnl XXX - this is gross!
2836 if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no"; then
2837 oexec_prefix="$exec_prefix"
2838 if test "$exec_prefix" = '$(prefix)'; then
2839 if test "$prefix" = "NONE"; then
2840 exec_prefix="$ac_default_prefix"
2842 exec_prefix="$prefix"
2845 if test X"$with_noexec" != X"no"; then
2846 PROGS="${PROGS} libsudo_noexec.la"
2847 INSTALL_NOEXEC="install-noexec"
2849 eval noexec_file="$with_noexec"
2850 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_NOEXEC, "$noexec_file", [The fully qualified pathname of sudo_noexec.so])
2852 if test X"$with_selinux" != X"no"; then
2853 eval sesh_file="$libexecdir/sesh"
2854 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SESH, "$sesh_file", [The fully qualified pathname of sesh])
2856 exec_prefix="$oexec_prefix"
2860 dnl Override default configure dirs for the Makefile
2862 if test X"$prefix" = X"NONE"; then
2863 test "$mandir" = '${datarootdir}/man' && mandir='$(prefix)/man'
2865 test "$mandir" = '${datarootdir}/man' && mandir='$(datarootdir)/man'
2867 test "$bindir" = '${exec_prefix}/bin' && bindir='$(exec_prefix)/bin'
2868 test "$sbindir" = '${exec_prefix}/sbin' && sbindir='$(exec_prefix)/sbin'
2869 test "$libexecdir" = '${exec_prefix}/libexec' && libexecdir='$(exec_prefix)/libexec'
2870 test "$includedir" = '${prefix}/include' && includedir='$(prefix)/include'
2871 test "$datarootdir" = '${prefix}/share' && datarootdir='$(prefix)/share'
2872 test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}' && docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)'
2873 test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/etc'
2876 dnl Substitute into the Makefile and man pages
2878 AC_CONFIG_FILES([Makefile sudo.man visudo.man sudoers.man sudoers.ldap.man sudoreplay.man sudo_usage.h sudoers])
2882 dnl Spew any text the user needs to know about
2884 if test "$with_pam" = "yes"; then
2887 AC_MSG_NOTICE([You will need to customize sample.pam and install it as /etc/pam.d/sudo])
2893 dnl Autoheader templates
2895 AH_TEMPLATE(BROKEN_SYSLOG, [Define to 1 if the `syslog' function returns a non-zero int to denote failure.])
2896 AH_TEMPLATE(CLASSIC_INSULTS, [Define to 1 if you want the insults from the "classic" version sudo.])
2897 AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twisted minds of CSOps.])
2898 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.])
2899 AH_TEMPLATE(ENV_EDITOR, [Define to 1 if you want visudo to honor the EDITOR and VISUAL env variables.])
2900 AH_TEMPLATE(ENV_DEBUG, [Define to 1 to enable environment function debugging.])
2901 AH_TEMPLATE(ENV_RESET, [Define to 1 to enable environment resetting by default.])
2902 AH_TEMPLATE(FQDN, [Define to 1 if you want to require fully qualified hosts in sudoers.])
2903 AH_TEMPLATE(GOONS_INSULTS, [Define to 1 if you want insults from the "Goon Show".])
2904 AH_TEMPLATE(HAL_INSULTS, [Define to 1 if you want 2001-like insults.])
2905 AH_TEMPLATE(HAVE_AFS, [Define to 1 if you use AFS.])
2906 AH_TEMPLATE(HAVE_AIXAUTH, [Define to 1 if you use AIX general authentication.])
2907 AH_TEMPLATE(HAVE_BSD_AUTH_H, [Define to 1 if you use BSD authentication.])
2908 AH_TEMPLATE(HAVE_BSM_AUDIT, [Define to 1 to enable BSM audit support.])
2909 AH_TEMPLATE(HAVE_DCE, [Define to 1 if you use OSF DCE.])
2910 AH_TEMPLATE(HAVE_DD_FD, [Define to 1 if your `DIR' contains dd_fd.])
2911 AH_TEMPLATE(HAVE_DIRFD, [Define to 1 if you have the `dirfd' function or macro.])
2912 AH_TEMPLATE(HAVE_DGETTEXT, [Define to 1 if you have the `dgettext' function.])
2913 AH_TEMPLATE(HAVE_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.])
2914 AH_TEMPLATE(HAVE_EXTENDED_GLOB, [Define to 1 if your glob.h defines the GLOB_BRACE and GLOB_TILDE flags.])
2915 AH_TEMPLATE(HAVE_FCNTL_CLOSEM, [Define to 1 if your system has the F_CLOSEM fcntl.])
2916 AH_TEMPLATE(HAVE_FNMATCH, [Define to 1 if you have the `fnmatch' function.])
2917 AH_TEMPLATE(HAVE_FWTK, [Define to 1 if you use the FWTK authsrv daemon.])
2918 AH_TEMPLATE(HAVE_GETAUTHUID, [Define to 1 if you have the `getauthuid' function. (ULTRIX 4.x shadow passwords)])
2919 AH_TEMPLATE(HAVE_GETPRPWNAM, [Define to 1 if you have the `getprpwnam' function. (SecureWare-style shadow passwords)])
2920 AH_TEMPLATE(HAVE_GETPWANAM, [Define to 1 if you have the `getpwanam' function. (SunOS 4.x shadow passwords)])
2921 AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR4-style shadow passwords)])
2922 AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords)])
2923 AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.])
2924 AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.])
2925 AH_TEMPLATE(HAVE_IN6_ADDR, [Define to 1 if <netinet/in.h> contains struct in6_addr.])
2926 AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled)])
2927 AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled)])
2928 AH_TEMPLATE(HAVE_KERB4, [Define to 1 if you use Kerberos IV.])
2929 AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.])
2930 AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC, [Define to 1 if you have the `krb5_get_init_creds_opt_alloc' function.])
2931 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.])
2932 AH_TEMPLATE(HAVE_KRB5_INIT_SECURE_CONTEXT, [Define to 1 if you have the `krb5_init_secure_context' function.])
2933 AH_TEMPLATE(HAVE_KRB5_VERIFY_USER, [Define to 1 if you have the `krb5_verify_user' function.])
2934 AH_TEMPLATE(HAVE_LBER_H, [Define to 1 if your LDAP needs <lber.h>. (OpenLDAP does not)])
2935 AH_TEMPLATE(HAVE_LDAP, [Define to 1 if you use LDAP for sudoers.])
2936 AH_TEMPLATE(HAVE_LINUX_AUDIT, [Define to 1 to enable Linux audit support.])
2937 AH_TEMPLATE(HAVE_OPIE, [Define to 1 if you use NRL OPIE.])
2938 AH_TEMPLATE(HAVE_PAM, [Define to 1 if you use PAM authentication.])
2939 AH_TEMPLATE(HAVE_PAM_LOGIN, [Define to 1 if you use a specific PAM session for sudo -i.])
2940 AH_TEMPLATE(HAVE_PROJECT_H, [Define to 1 if you have the <project.h> header file.])
2941 AH_TEMPLATE(HAVE_SECURID, [Define to 1 if you use SecurID for authentication.])
2942 AH_TEMPLATE(HAVE_SELINUX, [Define to 1 to enable SELinux RBAC support.])
2943 AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.])
2944 AH_TEMPLATE(HAVE_SIGACTION_T, [Define to 1 if <signal.h> has the sigaction_t typedef.])
2945 AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.])
2946 AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().])
2947 AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union])
2948 AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member])
2949 AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member])
2950 AH_TEMPLATE(HAVE_TERMIOS_H, [Define to 1 if you have the <termios.h> header file and the `tcgetattr' function.])
2951 AH_TEMPLATE(HAVE_TIMESPEC, [Define to 1 if you have struct timespec in sys/time.h])
2952 AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.])
2953 AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.])
2954 AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements])
2955 AH_TEMPLATE(LOGGING, [Define to SLOG_SYSLOG, SLOG_FILE, or SLOG_BOTH.])
2956 AH_TEMPLATE(LONG_OTP_PROMPT, [Define to 1 if you want a two line OTP (S/Key or OPIE) prompt.])
2957 AH_TEMPLATE(NO_AUTHENTICATION, [Define to 1 if you don't want sudo to prompt for a password by default.])
2958 AH_TEMPLATE(NO_LECTURE, [Define to 1 if you don't want users to get the lecture the first they user sudo.])
2959 AH_TEMPLATE(NO_PAM_SESSION, [Define to 1 if you don't want to use sudo's PAM session support])
2960 AH_TEMPLATE(NO_ROOT_MAILER, [Define to avoid runing the mailer as root.])
2961 AH_TEMPLATE(NO_ROOT_SUDO, [Define to 1 if root should not be allowed to use sudo.])
2962 AH_TEMPLATE(NO_TTY_TICKETS, [Define to 1 if you want a single ticket file instead of per-tty files.])
2963 AH_TEMPLATE(PC_INSULTS, [Define to 1 to replace politically incorrect insults with less offensive ones.])
2964 AH_TEMPLATE(SECURE_PATH, [Define to 1 to override the user's path with a built-in one.])
2965 AH_TEMPLATE(SEND_MAIL_WHEN_NOT_OK, [Define to 1 to send mail when the user is not allowed to run a command.])
2966 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.])
2967 AH_TEMPLATE(SEND_MAIL_WHEN_NO_USER, [Define to 1 to send mail when the user is not in the sudoers file.])
2968 AH_TEMPLATE(SHELL_IF_NO_ARGS, [Define to 1 if you want sudo to start a shell if given no arguments.])
2969 AH_TEMPLATE(SHELL_SETS_HOME, [Define to 1 if you want sudo to set $HOME in shell mode.])
2970 AH_TEMPLATE(STUB_LOAD_INTERFACES, [Define to 1 if the code in interfaces.c does not compile for you.])
2971 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.])
2972 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.])
2973 AH_TEMPLATE(USE_INSULTS, [Define to 1 if you want to insult the user for entering an incorrect password.])
2974 AH_TEMPLATE(USE_STOW, [Define to 1 if you use GNU stow packaging.])
2975 AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for authentication.])
2976 AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
2977 AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
2978 AH_TEMPLATE(USING_NONUNIX_GROUPS, [Define to 1 if using a non-Unix group lookup implementation.])
2981 dnl Bits to copy verbatim into config.h.in
2983 AH_TOP([#ifndef _SUDO_CONFIG_H
2984 #define _SUDO_CONFIG_H])
2987 * Macros to convert ctime and mtime into timevals.
2989 #define timespec2timeval(_ts, _tv) do { \
2990 (_tv)->tv_sec = (_ts)->tv_sec; \
2991 (_tv)->tv_usec = (_ts)->tv_nsec / 1000; \
2995 # ifdef HAVE_ST__TIM
2996 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim.st__tim, (_y))
2997 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim.st__tim, (_y))
2999 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim, (_y))
3000 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim, (_y))
3003 # ifdef HAVE_ST_MTIMESPEC
3004 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctimespec, (_y))
3005 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtimespec, (_y))
3007 # define ctim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_ctime; (_y)->tv_usec = 0; } while (0)
3008 # define mtim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_mtime; (_y)->tv_usec = 0; } while (0)
3009 # endif /* HAVE_ST_MTIMESPEC */
3010 #endif /* HAVE_ST_MTIM */
3013 * Emulate a subset of waitpid() if we don't have it.
3016 # define sudo_waitpid(p, s, o) waitpid(p, s, o)
3019 # define sudo_waitpid(p, s, o) wait3(s, o, NULL)
3023 /* GNU stow needs /etc/sudoers to be a symlink. */
3025 # define stat_sudoers stat
3027 # define stat_sudoers lstat
3030 /* Macros to set/clear/test flags. */
3032 #define SET(t, f) ((t) |= (f))
3034 #define CLR(t, f) ((t) &= ~(f))
3036 #define ISSET(t, f) ((t) & (f))
3038 /* New ANSI-style OS defs for HP-UX and ConvexOS. */
3039 #if defined(hpux) && !defined(__hpux)
3043 #if defined(convex) && !defined(__convex__)
3044 # define __convex__ 1
3047 /* BSD compatibility on some SVR4 systems. */
3050 #endif /* __svr4__ */
3052 #endif /* _SUDO_CONFIG_H */])