2 dnl Process this file with GNU autoconf to produce a configure script.
4 dnl Copyright (c) 1994-1996,1998-2013 Todd C. Miller <Todd.Miller@courtesan.com>
6 AC_INIT([sudo], [1.8.7], [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])
23 AC_SUBST([LT_LDFLAGS])
27 AC_SUBST([LT_LDEXPORTS])
28 AC_SUBST([COMMON_OBJS])
29 AC_SUBST([SUDOERS_OBJS])
33 AC_SUBST([SUDOERS_LIBS])
36 AC_SUBST([REPLAY_LIBS])
37 AC_SUBST([GETGROUPS_LIB])
41 AC_SUBST([MANDIRTYPE])
42 AC_SUBST([MANCOMPRESS])
43 AC_SUBST([MANCOMPRESSEXT])
44 AC_SUBST([SHLIB_MODE])
45 AC_SUBST([SUDOERS_MODE])
46 AC_SUBST([SUDOERS_UID])
47 AC_SUBST([SUDOERS_GID])
55 AC_SUBST([mansectform])
57 AC_SUBST([NOEXECFILE])
60 AC_SUBST([noexec_file])
62 AC_SUBST([INSTALL_NOEXEC])
63 AC_SUBST([DONT_LEAK_PATH_INFO])
64 AC_SUBST([BSDAUTH_USAGE])
65 AC_SUBST([SELINUX_USAGE])
67 AC_SUBST([LOGINCAP_USAGE])
70 AC_SUBST([LIBTOOL_DEPS])
71 AC_SUBST([ac_config_libobj_dir])
72 AC_SUBST([CONFIGURE_ARGS])
77 AC_SUBST([LOCALEDIR_SUFFIX])
78 AC_SUBST([COMPAT_TEST_PROGS])
79 AC_SUBST([CROSS_COMPILING])
80 AC_SUBST([PIE_LDFLAGS])
81 AC_SUBST([PIE_CFLAGS])
82 AC_SUBST([SSP_LDFLAGS])
83 AC_SUBST([SSP_CFLAGS])
86 dnl Variables that get substituted in docs (not overridden by environment)
88 AC_SUBST([iolog_dir])dnl real initial value from SUDO_IO_LOGDIR
89 AC_SUBST([timedir])dnl real initial value from SUDO_TIMEDIR
91 AC_SUBST([password_timeout])
92 AC_SUBST([sudo_umask])
93 AC_SUBST([umask_override])
94 AC_SUBST([passprompt])
95 AC_SUBST([long_otp_prompt])
101 AC_SUBST([ignore_dot])
102 AC_SUBST([mail_no_user])
103 AC_SUBST([mail_no_host])
104 AC_SUBST([mail_no_perms])
107 AC_SUBST([badpass_message])
109 AC_SUBST([runas_default])
110 AC_SUBST([env_editor])
111 AC_SUBST([env_reset])
112 AC_SUBST([passwd_tries])
113 AC_SUBST([tty_tickets])
115 AC_SUBST([root_sudo])
116 AC_SUBST([path_info])
117 AC_SUBST([ldap_conf])
118 AC_SUBST([ldap_secret])
120 AC_SUBST([nsswitch_conf])
121 AC_SUBST([netsvc_conf])
122 AC_SUBST([secure_path])
124 AC_SUBST([pam_session])
125 AC_SUBST([PLUGINDIR])
127 # Begin initial values for man page substitution
129 iolog_dir=/var/log/sudo-io
130 timedir=/var/adm/sudo
135 passprompt="Password:"
147 mailsub="*** SECURITY information for %h ***"
148 badpass_message="Sorry, try again."
159 ldap_conf=/etc/ldap.conf
160 ldap_secret=/etc/ldap.secret
161 netsvc_conf=/etc/netsvc.conf
162 noexec_file=/usr/local/libexec/sudo/sudo_noexec.so
163 sesh_file=/usr/local/libexec/sudo/sesh
164 nsswitch_conf=/etc/nsswitch.conf
165 secure_path="not set"
167 PLUGINDIR=/usr/local/libexec/sudo
169 # End initial values for man page substitution
172 dnl Initial values for Makefile variables listed above
173 dnl May be overridden by environment variables..
178 : ${MANDIRTYPE='man'}
180 : ${SHLIB_MODE='0644'}
181 : ${SUDOERS_MODE='0440'}
200 LT_LDEXPORTS="-export-symbols \$(shlib_exp)"
201 LT_LDDEP="\$(shlib_exp)"
203 OS_INIT=os_init_common
212 shadow_libs_optional=
216 dnl LD_PRELOAD equivalents
218 RTLD_PRELOAD_VAR="LD_PRELOAD"
219 RTLD_PRELOAD_ENABLE_VAR=
220 RTLD_PRELOAD_DELIM=":"
221 RTLD_PRELOAD_DEFAULT=
224 dnl libc replacement functions live in compat
226 AC_CONFIG_LIBOBJ_DIR(compat)
229 # Prior to sudo 1.8.7, sudo stored libexec files in $libexecdir.
230 # Starting with sudo 1.8.7, $libexecdir/sudo is used so strip
231 # off an extraneous "/sudo" from libexecdir.
233 case "$libexecdir" in
235 AC_MSG_WARN([libexecdir should not include the "sudo" subdirectory])
236 libexecdir=`expr "$libexecdir" : '\\(.*\\)/sudo$'`
241 dnl Deprecated --with options (these all warn or generate an error)
244 AC_ARG_WITH(otp-only, [AS_HELP_STRING([--with-otp-only], [deprecated])],
245 [case $with_otp_only in
246 yes) with_passwd="no"
247 AC_MSG_NOTICE([--with-otp-only option deprecated, treating as --without-passwd])
251 AC_ARG_WITH(alertmail, [AS_HELP_STRING([--with-alertmail], [deprecated])],
252 [case $with_alertmail in
253 *) with_mailto="$with_alertmail"
254 AC_MSG_NOTICE([--with-alertmail option deprecated, treating as --mailto])
259 dnl Options for --with
262 AC_ARG_WITH(devel, [AS_HELP_STRING([--with-devel], [add development options])],
264 yes) AC_MSG_NOTICE([Setting up for development: -Wall, flex, yacc])
265 OSDEFS="${OSDEFS} -DSUDO_DEVEL"
270 *) AC_MSG_WARN([Ignoring unknown argument to --with-devel: $with_devel])
274 AC_ARG_WITH(CC, [AS_HELP_STRING([--with-CC], [C compiler to use])],
276 *) AC_MSG_ERROR([the --with-CC option is no longer supported, please set the CC environment variable instead.])
280 AC_ARG_WITH(rpath, [AS_HELP_STRING([--with-rpath], [deprecated, use --disable-rpath])],
281 [AC_MSG_WARN([--with-rpath deprecated, rpath is now the default])])
283 AC_ARG_WITH(blibpath, [AS_HELP_STRING([--with-blibpath[=PATH]], [deprecated])],
284 [AC_MSG_WARN([--with-blibpath deprecated, use --with-libpath])])
287 dnl Handle BSM auditing support.
289 AC_ARG_WITH(bsm-audit, [AS_HELP_STRING([--with-bsm-audit], [enable BSM audit support])],
290 [case $with_bsm_audit in
291 yes) AC_DEFINE(HAVE_BSM_AUDIT)
292 SUDOERS_LIBS="${SUDOERS_LIBS} -lbsm"
293 SUDOERS_OBJS="${SUDOERS_OBJS} bsm_audit.lo"
296 *) AC_MSG_ERROR(["--with-bsm-audit does not take an argument."])
301 dnl Handle Linux auditing support.
303 AC_ARG_WITH(linux-audit, [AS_HELP_STRING([--with-linux-audit], [enable Linux audit support])],
304 [case $with_linux_audit in
305 yes) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libaudit.h>]], [[int i = AUDIT_USER_CMD; (void)i;]])], [
306 AC_DEFINE(HAVE_LINUX_AUDIT)
307 SUDO_LIBS="${SUDO_LIBS} -laudit"
308 SUDOERS_LIBS="${SUDO_LIBS} -laudit"
309 SUDOERS_OBJS="${SUDOERS_OBJS} linux_audit.lo"
311 AC_MSG_ERROR([unable to find AUDIT_USER_CMD in libaudit.h for --with-linux-audit])
315 *) AC_MSG_ERROR(["--with-linux-audit does not take an argument."])
320 dnl Handle SSSD support.
322 AC_ARG_WITH(sssd, [AS_HELP_STRING([--with-sssd], [enable SSSD support])],
324 yes) SUDOERS_OBJS="${SUDOERS_OBJS} sssd.lo"
328 *) AC_MSG_ERROR(["--with-sssd does not take an argument."])
332 AC_ARG_WITH(sssd-lib, [AS_HELP_STRING([--with-sssd-lib], [path to the SSSD library])])
333 sssd_lib="\"LIBDIR\""
334 test -n "$with_sssd_lib" && sssd_lib="$with_sssd_lib"
335 SUDO_DEFINE_UNQUOTED(_PATH_SSSD_LIB, "$sssd_lib", [Path to the SSSD library])
337 AC_ARG_WITH(incpath, [AS_HELP_STRING([--with-incpath], [additional places to look for include files])],
338 [case $with_incpath in
339 yes) AC_MSG_ERROR(["must give --with-incpath an argument."])
341 no) AC_MSG_ERROR(["--without-incpath not supported."])
343 *) AC_MSG_NOTICE([Adding ${with_incpath} to CPPFLAGS])
344 for i in ${with_incpath}; do
345 SUDO_APPEND_CPPFLAGS(-I${i})
350 AC_ARG_WITH(libpath, [AS_HELP_STRING([--with-libpath], [additional places to look for libraries])],
351 [case $with_libpath in
352 yes) AC_MSG_ERROR(["must give --with-libpath an argument."])
354 no) AC_MSG_ERROR(["--without-libpath not supported."])
356 *) AC_MSG_NOTICE([Adding ${with_libpath} to LDFLAGS])
360 AC_ARG_WITH(libraries, [AS_HELP_STRING([--with-libraries], [additional libraries to link with])],
361 [case $with_libraries in
362 yes) AC_MSG_ERROR(["must give --with-libraries an argument."])
364 no) AC_MSG_ERROR(["--without-libraries not supported."])
366 *) AC_MSG_NOTICE([Adding ${with_libraries} to LIBS])
370 AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence], [link with -lefence for malloc() debugging])],
371 [case $with_efence in
372 yes) AC_MSG_NOTICE([Sudo will link with -lefence (Electric Fence)])
373 LIBS="${LIBS} -lefence"
374 if test -f /usr/local/lib/libefence.a; then
375 with_libpath="${with_libpath} /usr/local/lib"
379 *) AC_MSG_WARN([Ignoring unknown argument to --with-efence: $with_efence])
383 AC_ARG_WITH(csops, [AS_HELP_STRING([--with-csops], [add CSOps standard options])],
385 yes) AC_MSG_NOTICE([Adding CSOps standard options])
389 with_classic_insults=yes
390 with_csops_insults=yes
396 *) AC_MSG_WARN([Ignoring unknown argument to --with-csops: $with_csops])
400 AC_ARG_WITH(passwd, [AS_HELP_STRING([--without-passwd], [don't use passwd/shadow file for authentication])],
401 [case $with_passwd in
402 yes|no) AC_MSG_CHECKING(whether to use shadow/passwd file authentication)
403 AC_MSG_RESULT($with_passwd)
405 test "$with_passwd" = "yes" && AUTH_REG="$AUTH_REG passwd"
407 *) AC_MSG_ERROR(["Sorry, --with-passwd does not take an argument."])
411 AC_ARG_WITH(skey, [AS_HELP_STRING([--with-skey[=DIR]], [enable S/Key support ])],
414 *) AC_DEFINE(HAVE_SKEY)
415 AC_MSG_CHECKING(whether to try S/Key authentication)
417 AUTH_REG="$AUTH_REG S/Key"
421 AC_ARG_WITH(opie, [AS_HELP_STRING([--with-opie[=DIR]], [enable OPIE support ])],
424 *) AC_DEFINE(HAVE_OPIE)
425 AC_MSG_CHECKING(whether to try NRL OPIE authentication)
427 AUTH_REG="$AUTH_REG NRL_OPIE"
431 AC_ARG_WITH(long-otp-prompt, [AS_HELP_STRING([--with-long-otp-prompt], [use a two line OTP (skey/opie) prompt])],
432 [case $with_long_otp_prompt in
433 yes) AC_DEFINE(LONG_OTP_PROMPT)
434 AC_MSG_CHECKING(whether to use a two line prompt for OTP authentication)
438 no) long_otp_prompt=off
440 *) AC_MSG_ERROR(["--with-long-otp-prompt does not take an argument."])
444 AC_ARG_WITH(SecurID, [AS_HELP_STRING([--with-SecurID[[=DIR]]], [enable SecurID support])],
445 [case $with_SecurID in
447 *) AC_DEFINE(HAVE_SECURID)
448 AC_MSG_CHECKING(whether to use SecurID for authentication)
450 AUTH_EXCL="$AUTH_EXCL SecurID"
454 AC_ARG_WITH(fwtk, [AS_HELP_STRING([--with-fwtk[[=DIR]]], [enable FWTK AuthSRV support])],
457 *) AC_DEFINE(HAVE_FWTK)
458 AC_MSG_CHECKING(whether to use FWTK AuthSRV for authentication)
460 AUTH_EXCL="$AUTH_EXCL FWTK"
464 AC_ARG_WITH(kerb5, [AS_HELP_STRING([--with-kerb5[[=DIR]]], [enable Kerberos V support])],
467 *) AC_MSG_CHECKING(whether to try Kerberos V authentication)
469 AUTH_REG="$AUTH_REG kerb5"
473 AC_ARG_WITH(aixauth, [AS_HELP_STRING([--with-aixauth], [enable AIX general authentication support])],
474 [case $with_aixauth in
475 yes) AUTH_EXCL="$AUTH_EXCL AIX_AUTH";;
477 *) AC_MSG_ERROR(["--with-aixauth does not take an argument."])
481 AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [enable PAM support])],
483 yes) AUTH_EXCL="$AUTH_EXCL PAM";;
485 *) AC_MSG_ERROR(["--with-pam does not take an argument."])
489 AC_ARG_WITH(AFS, [AS_HELP_STRING([--with-AFS], [enable AFS support])],
491 yes) AC_DEFINE(HAVE_AFS)
492 AC_MSG_CHECKING(whether to try AFS (kerberos) authentication)
494 AUTH_REG="$AUTH_REG AFS"
497 *) AC_MSG_ERROR(["--with-AFS does not take an argument."])
501 AC_ARG_WITH(DCE, [AS_HELP_STRING([--with-DCE], [enable DCE support])],
503 yes) AC_DEFINE(HAVE_DCE)
504 AC_MSG_CHECKING(whether to try DCE (kerberos) authentication)
506 AUTH_REG="$AUTH_REG DCE"
509 *) AC_MSG_ERROR(["--with-DCE does not take an argument."])
513 AC_ARG_WITH(logincap, [AS_HELP_STRING([--with-logincap], [enable BSD login class support])],
514 [case $with_logincap in
516 *) AC_MSG_ERROR(["--with-logincap does not take an argument."])
520 AC_ARG_WITH(bsdauth, [AS_HELP_STRING([--with-bsdauth], [enable BSD authentication support])],
521 [case $with_bsdauth in
522 yes) AUTH_EXCL="$AUTH_EXCL BSD_AUTH";;
524 *) AC_MSG_ERROR(["--with-bsdauth does not take an argument."])
528 AC_ARG_WITH(project, [AS_HELP_STRING([--with-project], [enable Solaris project support])],
529 [case $with_project in
532 *) AC_MSG_ERROR(["--with-project does not take an argument."])
536 AC_MSG_CHECKING(whether to lecture users the first time they run sudo)
537 AC_ARG_WITH(lecture, [AS_HELP_STRING([--without-lecture], [don't print lecture for first-time sudoer])],
538 [case $with_lecture in
539 yes|short|always) lecture=once
541 no|none|never) lecture=never
543 *) AC_MSG_ERROR(["unknown argument to --with-lecture: $with_lecture"])
546 if test "$lecture" = "once"; then
549 AC_DEFINE(NO_LECTURE)
553 AC_MSG_CHECKING(whether sudo should log via syslog or to a file by default)
554 AC_ARG_WITH(logging, [AS_HELP_STRING([--with-logging], [log via syslog, file, or both])],
555 [case $with_logging in
556 yes) AC_MSG_ERROR(["must give --with-logging an argument."])
558 no) AC_MSG_ERROR(["--without-logging not supported."])
560 syslog) AC_DEFINE(LOGGING, SLOG_SYSLOG)
561 AC_MSG_RESULT(syslog)
563 file) AC_DEFINE(LOGGING, SLOG_FILE)
566 both) AC_DEFINE(LOGGING, SLOG_BOTH)
569 *) AC_MSG_ERROR(["unknown argument to --with-logging: $with_logging"])
571 esac], [AC_DEFINE(LOGGING, SLOG_SYSLOG) AC_MSG_RESULT(syslog)])
573 AC_ARG_WITH(logfac, [AS_HELP_STRING([--with-logfac], [syslog facility to log with (default is "auth")])],
574 [case $with_logfac in
575 yes) AC_MSG_ERROR(["must give --with-logfac an argument."])
577 no) AC_MSG_ERROR(["--without-logfac not supported."])
579 authpriv|auth|daemon|user|local0|local1|local2|local3|local4|local5|local6|local7) logfac=$with_logfac
581 *) AC_MSG_ERROR(["$with_logfac is not a supported syslog facility."])
585 AC_MSG_CHECKING(at which syslog priority to log commands)
586 AC_ARG_WITH(goodpri, [AS_HELP_STRING([--with-goodpri], [syslog priority for commands (def is "notice")])],
587 [case $with_goodpri in
588 yes) AC_MSG_ERROR(["must give --with-goodpri an argument."])
590 no) AC_MSG_ERROR(["--without-goodpri not supported."])
592 alert|crit|debug|emerg|err|info|notice|warning)
593 goodpri=$with_goodpri
595 *) AC_MSG_ERROR(["$with_goodpri is not a supported syslog priority."])
598 AC_DEFINE_UNQUOTED(PRI_SUCCESS, "$goodpri", [The syslog priority sudo will use for successful attempts.])
599 AC_MSG_RESULT($goodpri)
601 AC_MSG_CHECKING(at which syslog priority to log failures)
602 AC_ARG_WITH(badpri, [AS_HELP_STRING([--with-badpri], [syslog priority for failures (def is "alert")])],
603 [case $with_badpri in
604 yes) AC_MSG_ERROR(["must give --with-badpri an argument."])
606 no) AC_MSG_ERROR(["--without-badpri not supported."])
608 alert|crit|debug|emerg|err|info|notice|warning)
611 *) AC_MSG_ERROR([$with_badpri is not a supported syslog priority.])
614 AC_DEFINE_UNQUOTED(PRI_FAILURE, "$badpri", [The syslog priority sudo will use for unsuccessful attempts/errors.])
615 AC_MSG_RESULT($badpri)
617 AC_ARG_WITH(logpath, [AS_HELP_STRING([--with-logpath], [path to the sudo log file])],
618 [case $with_logpath in
619 yes) AC_MSG_ERROR(["must give --with-logpath an argument."])
621 no) AC_MSG_ERROR(["--without-logpath not supported."])
625 AC_MSG_CHECKING(how long a line in the log file should be)
626 AC_ARG_WITH(loglen, [AS_HELP_STRING([--with-loglen], [maximum length of a log file line (default is 80)])],
627 [case $with_loglen in
628 yes) AC_MSG_ERROR(["must give --with-loglen an argument."])
630 no) AC_MSG_ERROR(["--without-loglen not supported."])
632 [[0-9]]*) loglen=$with_loglen
634 *) AC_MSG_ERROR(["you must enter a number, not $with_loglen"])
637 AC_DEFINE_UNQUOTED(MAXLOGFILELEN, $loglen, [The max number of chars per log file line (for line wrapping).])
638 AC_MSG_RESULT($loglen)
640 AC_MSG_CHECKING(whether sudo should ignore '.' or '' in \$PATH)
641 AC_ARG_WITH(ignore-dot, [AS_HELP_STRING([--with-ignore-dot], [ignore '.' in the PATH])],
642 [case $with_ignore_dot in
647 *) AC_MSG_ERROR(["--with-ignore-dot does not take an argument."])
650 if test "$ignore_dot" = "on"; then
651 AC_DEFINE(IGNORE_DOT_PATH)
657 AC_MSG_CHECKING(whether to send mail when a user is not in sudoers)
658 AC_ARG_WITH(mail-if-no-user, [AS_HELP_STRING([--without-mail-if-no-user], [do not send mail if user not in sudoers])],
659 [case $with_mail_if_no_user in
664 *) AC_MSG_ERROR(["--with-mail-if-no-user does not take an argument."])
667 if test "$mail_no_user" = "on"; then
668 AC_DEFINE(SEND_MAIL_WHEN_NO_USER)
674 AC_MSG_CHECKING(whether to send mail when user listed but not for this host)
675 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])],
676 [case $with_mail_if_no_host in
681 *) AC_MSG_ERROR(["--with-mail-if-no-host does not take an argument."])
684 if test "$mail_no_host" = "on"; then
685 AC_DEFINE(SEND_MAIL_WHEN_NO_HOST)
691 AC_MSG_CHECKING(whether to send mail when a user tries a disallowed command)
692 AC_ARG_WITH(mail-if-noperms, [AS_HELP_STRING([--with-mail-if-noperms], [send mail if user not allowed to run command])],
693 [case $with_mail_if_noperms in
698 *) AC_MSG_ERROR(["--with-mail-if-noperms does not take an argument."])
701 if test "$mail_noperms" = "on"; then
702 AC_DEFINE(SEND_MAIL_WHEN_NOT_OK)
708 AC_MSG_CHECKING(who should get the mail that sudo sends)
709 AC_ARG_WITH(mailto, [AS_HELP_STRING([--with-mailto], [who should get sudo mail (default is "root")])],
710 [case $with_mailto in
711 yes) AC_MSG_ERROR(["must give --with-mailto an argument."])
713 no) AC_MSG_ERROR(["--without-mailto not supported."])
715 *) mailto=$with_mailto
718 AC_DEFINE_UNQUOTED(MAILTO, "$mailto", [The user or email address that sudo mail is sent to.])
719 AC_MSG_RESULT([$mailto])
721 AC_ARG_WITH(mailsubject, [AS_HELP_STRING([--with-mailsubject], [subject of sudo mail])],
722 [case $with_mailsubject in
723 yes) AC_MSG_ERROR(["must give --with-mailsubject an argument."])
725 no) AC_MSG_WARN([Sorry, --without-mailsubject not supported.])
727 *) mailsub="$with_mailsubject"
728 AC_MSG_CHECKING(sudo mail subject)
729 AC_MSG_RESULT([Using alert mail subject: $mailsub])
732 AC_DEFINE_UNQUOTED(MAILSUBJECT, "$mailsub", [The subject of the mail sent by sudo to the MAILTO user/address.])
734 AC_MSG_CHECKING(for bad password prompt)
735 AC_ARG_WITH(passprompt, [AS_HELP_STRING([--with-passprompt], [default password prompt])],
736 [case $with_passprompt in
737 yes) AC_MSG_ERROR(["must give --with-passprompt an argument."])
739 no) AC_MSG_WARN([Sorry, --without-passprompt not supported.])
741 *) passprompt="$with_passprompt"
743 AC_MSG_RESULT($passprompt)
744 AC_DEFINE_UNQUOTED(PASSPROMPT, "$passprompt", [The default password prompt.])
746 AC_MSG_CHECKING(for bad password message)
747 AC_ARG_WITH(badpass-message, [AS_HELP_STRING([--with-badpass-message], [message the user sees when the password is wrong])],
748 [case $with_badpass_message in
749 yes) AC_MSG_ERROR(["Must give --with-badpass-message an argument."])
751 no) AC_MSG_WARN([Sorry, --without-badpass-message not supported.])
753 *) badpass_message="$with_badpass_message"
756 AC_DEFINE_UNQUOTED(INCORRECT_PASSWORD, "$badpass_message", [The message given when a bad password is entered.])
757 AC_MSG_RESULT([$badpass_message])
759 AC_MSG_CHECKING(whether to expect fully qualified hosts in sudoers)
760 AC_ARG_WITH(fqdn, [AS_HELP_STRING([--with-fqdn], [expect fully qualified hosts in sudoers])],
766 *) AC_MSG_ERROR(["--with-fqdn does not take an argument."])
769 if test "$fqdn" = "on"; then
776 AC_ARG_WITH(timedir, [AS_HELP_STRING([--with-timedir], [path to the sudo timestamp dir])],
777 [case $with_timedir in
778 yes) AC_MSG_ERROR(["must give --with-timedir an argument."])
780 no) AC_MSG_ERROR(["--without-timedir not supported."])
784 AC_ARG_WITH(iologdir, [AS_HELP_STRING([--with-iologdir=DIR], [directory to store sudo I/O log files in])],
785 [case $with_iologdir in
787 no) AC_MSG_ERROR(["--without-iologdir not supported."])
791 AC_ARG_WITH(sendmail, [AS_HELP_STRING([--with-sendmail], [set path to sendmail])
792 AS_HELP_STRING([--without-sendmail], [do not send mail at all])],
793 [case $with_sendmail in
794 yes) with_sendmail=""
797 *) SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SENDMAIL, "$with_sendmail")
801 AC_ARG_WITH(sudoers-mode, [AS_HELP_STRING([--with-sudoers-mode], [mode of sudoers file (defaults to 0440)])],
802 [case $with_sudoers_mode in
803 yes) AC_MSG_ERROR(["must give --with-sudoers-mode an argument."])
805 no) AC_MSG_ERROR(["--without-sudoers-mode not supported."])
807 [[1-9]]*) SUDOERS_MODE=0${with_sudoers_mode}
809 0*) SUDOERS_MODE=$with_sudoers_mode
811 *) AC_MSG_ERROR(["you must use an octal mode, not a name."])
815 AC_ARG_WITH(sudoers-uid, [AS_HELP_STRING([--with-sudoers-uid], [uid that owns sudoers file (defaults to 0)])],
816 [case $with_sudoers_uid in
817 yes) AC_MSG_ERROR(["must give --with-sudoers-uid an argument."])
819 no) AC_MSG_ERROR(["--without-sudoers-uid not supported."])
821 [[0-9]]*) SUDOERS_UID=$with_sudoers_uid
823 *) AC_MSG_ERROR(["you must use an unsigned numeric uid, not a name."])
827 AC_ARG_WITH(sudoers-gid, [AS_HELP_STRING([--with-sudoers-gid], [gid that owns sudoers file (defaults to 0)])],
828 [case $with_sudoers_gid in
829 yes) AC_MSG_ERROR(["must give --with-sudoers-gid an argument."])
831 no) AC_MSG_ERROR(["--without-sudoers-gid not supported."])
833 [[0-9]]*) SUDOERS_GID=$with_sudoers_gid
835 *) AC_MSG_ERROR(["you must use an unsigned numeric gid, not a name."])
839 AC_MSG_CHECKING(for umask programs should be run with)
840 AC_ARG_WITH(umask, [AS_HELP_STRING([--with-umask], [umask with which the prog should run (default is 022)])
841 AS_HELP_STRING([--without-umask], [Preserves the umask of the user invoking sudo.])],
843 yes) AC_MSG_ERROR(["must give --with-umask an argument."])
847 [[0-9]]*) sudo_umask=$with_umask
849 *) AC_MSG_ERROR(["you must enter a numeric mask."])
852 AC_DEFINE_UNQUOTED(SUDO_UMASK, $sudo_umask, [The umask that the sudo-run prog should use.])
853 if test "$sudo_umask" = "0777"; then
856 AC_MSG_RESULT($sudo_umask)
859 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.])],
860 [case $with_umask_override in
861 yes) AC_DEFINE(UMASK_OVERRIDE)
864 no) umask_override=off
866 *) AC_MSG_ERROR(["--with-umask-override does not take an argument."])
870 AC_MSG_CHECKING(for default user to run commands as)
871 AC_ARG_WITH(runas-default, [AS_HELP_STRING([--with-runas-default], [User to run commands as (default is "root")])],
872 [case $with_runas_default in
873 yes) AC_MSG_ERROR(["must give --with-runas-default an argument."])
875 no) AC_MSG_ERROR(["--without-runas-default not supported."])
877 *) runas_default="$with_runas_default"
880 AC_DEFINE_UNQUOTED(RUNAS_DEFAULT, "$runas_default", [The user sudo should run commands as by default.])
881 AC_MSG_RESULT([$runas_default])
883 AC_ARG_WITH(exempt, [AS_HELP_STRING([--with-exempt=group], [no passwd needed for users in this group])],
884 [case $with_exempt in
885 yes) AC_MSG_ERROR(["must give --with-exempt an argument."])
887 no) AC_MSG_ERROR(["--without-exempt not supported."])
889 *) AC_DEFINE_UNQUOTED(EXEMPTGROUP, "$with_exempt", [If defined, users in this group need not enter a passwd (ie "sudo").])
890 AC_MSG_CHECKING(for group to be exempt from password)
891 AC_MSG_RESULT([$with_exempt])
895 AC_MSG_CHECKING(for editor that visudo should use)
896 AC_ARG_WITH(editor, [AS_HELP_STRING([--with-editor=path], [Default editor for visudo (defaults to vi)])],
897 [case $with_editor in
898 yes) AC_MSG_ERROR(["must give --with-editor an argument."])
900 no) AC_MSG_ERROR(["--without-editor not supported."])
902 *) AC_DEFINE_UNQUOTED(EDITOR, "$with_editor", [A colon-separated list of pathnames to be used as the editor for visudo.])
903 AC_MSG_RESULT([$with_editor])
904 editor="$with_editor"
906 esac], [AC_DEFINE(EDITOR, _PATH_VI) AC_MSG_RESULT(vi)])
908 AC_MSG_CHECKING(whether to obey EDITOR and VISUAL environment variables)
909 AC_ARG_WITH(env-editor, [AS_HELP_STRING([--with-env-editor], [Use the environment variable EDITOR for visudo])],
910 [case $with_env_editor in
915 *) AC_MSG_ERROR(["--with-env-editor does not take an argument."])
918 if test "$env_editor" = "on"; then
919 AC_DEFINE(ENV_EDITOR)
925 AC_MSG_CHECKING(number of tries a user gets to enter their password)
926 AC_ARG_WITH(passwd-tries, [AS_HELP_STRING([--with-passwd-tries], [number of tries to enter password (default is 3)])],
927 [case $with_passwd_tries in
929 no) AC_MSG_ERROR(["--without-editor not supported."])
931 [[1-9]]*) passwd_tries=$with_passwd_tries
933 *) AC_MSG_ERROR(["you must enter the numer of tries, > 0"])
936 AC_DEFINE_UNQUOTED(TRIES_FOR_PASSWORD, $passwd_tries, [The number of tries a user gets to enter their password.])
937 AC_MSG_RESULT($passwd_tries)
939 AC_MSG_CHECKING(time in minutes after which sudo will ask for a password again)
940 AC_ARG_WITH(timeout, [AS_HELP_STRING([--with-timeout], [minutes before sudo asks for passwd again (def is 5 minutes)])],
941 [case $with_timeout in
945 [[0-9]]*) timeout=$with_timeout
947 *) AC_MSG_ERROR(["you must enter the numer of minutes."])
950 AC_DEFINE_UNQUOTED(TIMEOUT, $timeout, [The number of minutes before sudo asks for a password again.])
951 AC_MSG_RESULT($timeout)
953 AC_MSG_CHECKING(time in minutes after the password prompt will time out)
954 AC_ARG_WITH(password-timeout, [AS_HELP_STRING([--with-password-timeout], [passwd prompt timeout in minutes (default is 5 minutes)])],
955 [case $with_password_timeout in
957 no) password_timeout=0
959 [[0-9]]*) password_timeout=$with_password_timeout
961 *) AC_MSG_ERROR(["you must enter the numer of minutes."])
964 AC_DEFINE_UNQUOTED(PASSWORD_TIMEOUT, $password_timeout, [The passwd prompt timeout (in minutes).])
965 AC_MSG_RESULT($password_timeout)
967 AC_MSG_CHECKING(whether to use per-tty ticket files)
968 AC_ARG_WITH(tty-tickets, [AS_HELP_STRING([--with-tty-tickets], [use a different ticket file for each tty])],
969 [case $with_tty_tickets in
974 *) AC_MSG_ERROR(["--with-tty-tickets does not take an argument."])
977 if test "$tty_tickets" = "off"; then
978 AC_DEFINE(NO_TTY_TICKETS)
984 AC_MSG_CHECKING(whether to include insults)
985 AC_ARG_WITH(insults, [AS_HELP_STRING([--with-insults], [insult the user for entering an incorrect password])],
986 [case $with_insults in
988 with_classic_insults=yes
989 with_csops_insults=yes
991 disabled) insults=off
992 with_classic_insults=yes
993 with_csops_insults=yes
997 *) AC_MSG_ERROR(["--with-insults does not take an argument."])
1000 if test "$insults" = "on"; then
1001 AC_DEFINE(USE_INSULTS)
1007 AC_ARG_WITH(all-insults, [AS_HELP_STRING([--with-all-insults], [include all the sudo insult sets])],
1008 [case $with_all_insults in
1009 yes) with_classic_insults=yes
1010 with_csops_insults=yes
1011 with_hal_insults=yes
1012 with_goons_insults=yes
1015 *) AC_MSG_ERROR(["--with-all-insults does not take an argument."])
1019 AC_ARG_WITH(classic-insults, [AS_HELP_STRING([--with-classic-insults], [include the insults from the "classic" sudo])],
1020 [case $with_classic_insults in
1021 yes) AC_DEFINE(CLASSIC_INSULTS)
1024 *) AC_MSG_ERROR(["--with-classic-insults does not take an argument."])
1028 AC_ARG_WITH(csops-insults, [AS_HELP_STRING([--with-csops-insults], [include CSOps insults])],
1029 [case $with_csops_insults in
1030 yes) AC_DEFINE(CSOPS_INSULTS)
1033 *) AC_MSG_ERROR(["--with-csops-insults does not take an argument."])
1037 AC_ARG_WITH(hal-insults, [AS_HELP_STRING([--with-hal-insults], [include 2001-like insults])],
1038 [case $with_hal_insults in
1039 yes) AC_DEFINE(HAL_INSULTS)
1042 *) AC_MSG_ERROR(["--with-hal-insults does not take an argument."])
1046 AC_ARG_WITH(goons-insults, [AS_HELP_STRING([--with-goons-insults], [include the insults from the "Goon Show"])],
1047 [case $with_goons_insults in
1048 yes) AC_DEFINE(GOONS_INSULTS)
1051 *) AC_MSG_ERROR(["--with-goons-insults does not take an argument."])
1055 AC_ARG_WITH(nsswitch, [AS_HELP_STRING([--with-nsswitch[[=PATH]]], [path to nsswitch.conf])],
1056 [case $with_nsswitch in
1058 yes) with_nsswitch="/etc/nsswitch.conf"
1063 AC_ARG_WITH(ldap, [AS_HELP_STRING([--with-ldap[[=DIR]]], [enable LDAP support])],
1066 *) AC_DEFINE(HAVE_LDAP)
1067 AC_MSG_CHECKING(whether to use sudoers from LDAP)
1072 AC_ARG_WITH(ldap-conf-file, [AS_HELP_STRING([--with-ldap-conf-file], [path to LDAP configuration file])])
1073 test -n "$with_ldap_conf_file" && ldap_conf="$with_ldap_conf_file"
1074 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_CONF, "$ldap_conf", [Path to the ldap.conf file])
1076 AC_ARG_WITH(ldap-secret-file, [AS_HELP_STRING([--with-ldap-secret-file], [path to LDAP secret password file])])
1077 test -n "$with_ldap_secret_file" && ldap_secret="$with_ldap_secret_file"
1078 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_SECRET, "$ldap_secret", [Path to the ldap.secret file])
1080 AC_ARG_WITH(pc-insults, [AS_HELP_STRING([--with-pc-insults], [replace politically incorrect insults with less offensive ones])],
1081 [case $with_pc_insults in
1082 yes) AC_DEFINE(PC_INSULTS)
1085 *) AC_MSG_ERROR(["--with-pc-insults does not take an argument."])
1089 dnl include all insult sets on one line
1090 if test "$insults" = "on"; then
1091 AC_MSG_CHECKING(which insult sets to include)
1093 test "$with_goons_insults" = "yes" && i="goons ${i}"
1094 test "$with_hal_insults" = "yes" && i="hal ${i}"
1095 test "$with_csops_insults" = "yes" && i="csops ${i}"
1096 test "$with_classic_insults" = "yes" && i="classic ${i}"
1100 AC_MSG_CHECKING(whether to override the user's path)
1101 AC_ARG_WITH(secure-path, [AS_HELP_STRING([--with-secure-path], [override the user's path with a built-in one])],
1102 [case $with_secure_path in
1103 yes) with_secure_path="/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
1104 AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1105 AC_MSG_RESULT([$with_secure_path])
1106 secure_path="set to $with_secure_path"
1108 no) AC_MSG_RESULT(no)
1110 *) AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1111 AC_MSG_RESULT([$with_secure_path])
1112 secure_path="set to F<$with_secure_path>"
1114 esac], AC_MSG_RESULT(no))
1116 AC_MSG_CHECKING(whether to get ip addresses from the network interfaces)
1117 AC_ARG_WITH(interfaces, [AS_HELP_STRING([--without-interfaces], [don't try to read the ip addr of ether interfaces])],
1118 [case $with_interfaces in
1119 yes) AC_MSG_RESULT(yes)
1121 no) AC_DEFINE(STUB_LOAD_INTERFACES)
1124 *) AC_MSG_ERROR(["--with-interfaces does not take an argument."])
1126 esac], AC_MSG_RESULT(yes))
1128 AC_ARG_WITH(stow, [AS_HELP_STRING([--with-stow], [deprecated])],
1130 *) AC_MSG_NOTICE([--with-stow option deprecated, now is defalt behavior])
1134 AC_MSG_CHECKING(whether to use an askpass helper)
1135 AC_ARG_WITH(askpass, [AS_HELP_STRING([--with-askpass=PATH], [Fully qualified pathname of askpass helper])],
1136 [case $with_askpass in
1137 yes) AC_MSG_ERROR(["--with-askpass takes a path as an argument."])
1145 if test X"$with_askpass" != X"no"; then
1146 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, "$with_askpass")
1148 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, NULL)
1151 AC_ARG_WITH(plugindir, [AS_HELP_STRING([--with-plugindir], [set directory to load plugins from])],
1152 [case $with_plugindir in
1153 no) AC_MSG_ERROR(["illegal argument: --without-plugindir."])
1156 esac], [with_plugindir="$libexecdir/sudo"])
1158 AC_ARG_WITH(man, [AS_HELP_STRING([--with-man], [manual pages use man macros])],
1162 no) AC_MSG_ERROR(["--without-man not supported."])
1164 *) AC_MSG_ERROR(["ignoring unknown argument to --with-man: $with_man."])
1168 AC_ARG_WITH(mdoc, [AS_HELP_STRING([--with-mdoc], [manual pages use mdoc macros])],
1172 no) AC_MSG_ERROR(["--without-mdoc not supported."])
1174 *) AC_MSG_ERROR(["ignoring unknown argument to --with-mdoc: $with_mdoc."])
1179 dnl Options for --enable
1182 AC_MSG_CHECKING(whether to do user authentication by default)
1183 AC_ARG_ENABLE(authentication,
1184 [AS_HELP_STRING([--disable-authentication], [Do not require authentication by default])],
1185 [ case "$enableval" in
1186 yes) AC_MSG_RESULT(yes)
1188 no) AC_MSG_RESULT(no)
1189 AC_DEFINE(NO_AUTHENTICATION)
1191 *) AC_MSG_RESULT(no)
1192 AC_MSG_WARN([Ignoring unknown argument to --enable-authentication: $enableval])
1195 ], AC_MSG_RESULT(yes))
1197 AC_MSG_CHECKING(whether to disable running the mailer as root)
1198 AC_ARG_ENABLE(root-mailer,
1199 [AS_HELP_STRING([--disable-root-mailer], [Don't run the mailer as root, run as the user])],
1200 [ case "$enableval" in
1201 yes) AC_MSG_RESULT(no)
1203 no) AC_MSG_RESULT(yes)
1204 AC_DEFINE(NO_ROOT_MAILER)
1206 *) AC_MSG_RESULT(no)
1207 AC_MSG_WARN([Ignoring unknown argument to --enable-root-mailer: $enableval])
1210 ], AC_MSG_RESULT(no))
1212 AC_ARG_ENABLE(setreuid,
1213 [AS_HELP_STRING([--disable-setreuid], [Don't try to use the setreuid() function])],
1214 [ case "$enableval" in
1215 no) SKIP_SETREUID=yes
1221 AC_ARG_ENABLE(setresuid,
1222 [AS_HELP_STRING([--disable-setresuid], [Don't try to use the setresuid() function])],
1223 [ case "$enableval" in
1224 no) SKIP_SETRESUID=yes
1230 AC_MSG_CHECKING(whether to disable shadow password support)
1231 AC_ARG_ENABLE(shadow,
1232 [AS_HELP_STRING([--disable-shadow], [Never use shadow passwords])],
1233 [ case "$enableval" in
1234 yes) AC_MSG_RESULT(no)
1236 no) AC_MSG_RESULT(yes)
1239 *) AC_MSG_RESULT(no)
1240 AC_MSG_WARN([Ignoring unknown argument to --enable-shadow: $enableval])
1243 ], AC_MSG_RESULT(no))
1245 AC_MSG_CHECKING(whether root should be allowed to use sudo)
1246 AC_ARG_ENABLE(root-sudo,
1247 [AS_HELP_STRING([--disable-root-sudo], [Don't allow root to run sudo])],
1248 [ case "$enableval" in
1249 yes) AC_MSG_RESULT(yes)
1251 no) AC_DEFINE(NO_ROOT_SUDO)
1255 *) AC_MSG_ERROR(["--enable-root-sudo does not take an argument."])
1258 ], AC_MSG_RESULT(yes))
1260 AC_MSG_CHECKING(whether to log the hostname in the log file)
1261 AC_ARG_ENABLE(log-host,
1262 [AS_HELP_STRING([--enable-log-host], [Log the hostname in the log file])],
1263 [ case "$enableval" in
1264 yes) AC_MSG_RESULT(yes)
1265 AC_DEFINE(HOST_IN_LOG)
1267 no) AC_MSG_RESULT(no)
1269 *) AC_MSG_RESULT(no)
1270 AC_MSG_WARN([Ignoring unknown argument to --enable-log-host: $enableval])
1273 ], AC_MSG_RESULT(no))
1275 AC_MSG_CHECKING(whether to invoke a shell if sudo is given no arguments)
1276 AC_ARG_ENABLE(noargs-shell,
1277 [AS_HELP_STRING([--enable-noargs-shell], [If sudo is given no arguments run a shell])],
1278 [ case "$enableval" in
1279 yes) AC_MSG_RESULT(yes)
1280 AC_DEFINE(SHELL_IF_NO_ARGS)
1282 no) AC_MSG_RESULT(no)
1284 *) AC_MSG_RESULT(no)
1285 AC_MSG_WARN([Ignoring unknown argument to --enable-noargs-shell: $enableval])
1288 ], AC_MSG_RESULT(no))
1290 AC_MSG_CHECKING(whether to set \$HOME to target user in shell mode)
1291 AC_ARG_ENABLE(shell-sets-home,
1292 [AS_HELP_STRING([--enable-shell-sets-home], [Set $HOME to target user in shell mode])],
1293 [ case "$enableval" in
1294 yes) AC_MSG_RESULT(yes)
1295 AC_DEFINE(SHELL_SETS_HOME)
1297 no) AC_MSG_RESULT(no)
1299 *) AC_MSG_RESULT(no)
1300 AC_MSG_WARN([Ignoring unknown argument to --enable-shell-sets-home: $enableval])
1303 ], AC_MSG_RESULT(no))
1305 AC_MSG_CHECKING(whether to disable 'command not found' messages)
1306 AC_ARG_ENABLE(path_info,
1307 [AS_HELP_STRING([--disable-path-info], [Print 'command not allowed' not 'command not found'])],
1308 [ case "$enableval" in
1309 yes) AC_MSG_RESULT(no)
1311 no) AC_MSG_RESULT(yes)
1312 AC_DEFINE(DONT_LEAK_PATH_INFO)
1315 *) AC_MSG_RESULT(no)
1316 AC_MSG_WARN([Ignoring unknown argument to --enable-path-info: $enableval])
1319 ], AC_MSG_RESULT(no))
1321 AC_MSG_CHECKING(whether to enable environment debugging)
1322 AC_ARG_ENABLE(env_debug,
1323 [AS_HELP_STRING([--enable-env-debug], [Whether to enable environment debugging.])],
1324 [ case "$enableval" in
1325 yes) AC_MSG_RESULT(yes)
1326 AC_DEFINE(ENV_DEBUG)
1328 no) AC_MSG_RESULT(no)
1330 *) AC_MSG_RESULT(no)
1331 AC_MSG_WARN([Ignoring unknown argument to --enable-env-debug: $enableval])
1334 ], AC_MSG_RESULT(no))
1337 [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])],
1338 [], [enable_zlib=yes])
1340 AC_MSG_CHECKING(whether to enable environment resetting by default)
1341 AC_ARG_ENABLE(env_reset,
1342 [AS_HELP_STRING([--enable-env-reset], [Whether to enable environment resetting by default.])],
1343 [ case "$enableval" in
1349 AC_MSG_WARN([Ignoring unknown argument to --enable-env-reset: $enableval])
1353 if test "$env_reset" = "on"; then
1355 AC_DEFINE(ENV_RESET, 1)
1358 AC_DEFINE(ENV_RESET, 0)
1361 AC_ARG_ENABLE(warnings,
1362 [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])],
1363 [ case "$enableval" in
1366 *) AC_MSG_WARN([Ignoring unknown argument to --enable-warnings: $enableval])
1371 AC_ARG_ENABLE(werror,
1372 [AS_HELP_STRING([--enable-werror], [Whether to enable the -Werror compiler option])],
1373 [ case "$enableval" in
1376 *) AC_MSG_WARN([Ignoring unknown argument to --enable-werror: $enableval])
1381 AC_ARG_ENABLE(hardening,
1382 [AS_HELP_STRING([--disable-hardening], [Do not use compiler/linker exploit mitigation options])],
1383 [], [enable_hardening=yes])
1386 [AS_HELP_STRING([--enable-pie], [Build sudo as a position independent executable.])])
1388 AC_ARG_ENABLE(admin-flag,
1389 [AS_HELP_STRING([--enable-admin-flag], [Whether to create a Ubuntu-style admin flag file])],
1390 [ case "$enableval" in
1391 yes) AC_DEFINE(USE_ADMIN_FLAG)
1394 *) AC_MSG_WARN([Ignoring unknown argument to --enable-admin-flag: $enableval])
1400 [AS_HELP_STRING([--disable-nls], [Disable natural language support using gettext])],
1401 [], [enable_nls=yes])
1403 AC_ARG_ENABLE(rpath,
1404 [AS_HELP_STRING([--disable-rpath], [Disable passing of -Rpath to the linker])],
1405 [], [enable_rpath=yes])
1407 AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])],
1408 [case $with_selinux in
1409 yes) SELINUX_USAGE="[[-r role]] [[-t type]] "
1410 AC_DEFINE(HAVE_SELINUX)
1411 SUDO_LIBS="${SUDO_LIBS} -lselinux"
1412 SUDO_OBJS="${SUDO_OBJS} selinux.o"
1413 PROGS="${PROGS} sesh"
1415 AC_CHECK_LIB([selinux], [setkeycreatecon],
1416 [AC_DEFINE(HAVE_SETKEYCREATECON)])
1419 *) AC_MSG_ERROR(["--with-selinux does not take an argument."])
1421 esac], [with_selinux=no])
1424 dnl gss_krb5_ccache_name() may not work on Heimdal so we don't use it by default
1426 AC_ARG_ENABLE(gss_krb5_ccache_name,
1427 [AS_HELP_STRING([--enable-gss-krb5-ccache-name], [Use GSS-API to set the Kerberos V cred cache name])],
1428 [check_gss_krb5_ccache_name=$enableval], [check_gss_krb5_ccache_name=no])
1431 dnl C compiler checks
1433 AC_SEARCH_LIBS([strerror], [cposix])
1435 AC_CHECK_TOOL(AR, ar, false)
1436 AC_CHECK_TOOL(RANLIB, ranlib, :)
1437 if test X"$AR" = X"false"; then
1438 AC_MSG_ERROR([the "ar" utility is required to build sudo])
1441 if test "x$ac_cv_prog_cc_c89" = "xno"; then
1442 AC_MSG_ERROR([Sudo version $PACKAGE_VERSION requires an ANSI C compiler to build.])
1446 dnl If the user specified --disable-static, override them or we'll
1447 dnl be unable to build the executables in the sudoers plugin dir.
1449 if test "$enable_static" = "no"; then
1450 AC_MSG_WARN([Ignoring --disable-static, sudo does not install static libs])
1455 dnl Libtool setup, we require libtool 2.2.6b or higher
1458 AC_CONFIG_MACRO_DIR([m4])
1463 dnl Allow the user to specify an alternate libtool.
1464 dnl XXX - should be able to skip LT_INIT if we are using a different libtool
1466 AC_ARG_WITH(libtool, [AS_HELP_STRING([--with-libtool=PATH], [specify path to libtool])],
1467 [case $with_libtool in
1469 no) AC_MSG_ERROR(["--without-libtool not supported."])
1471 system) LIBTOOL=libtool
1473 *) LIBTOOL="$with_libtool"
1478 dnl Defer with_noexec until after libtool magic runs
1480 if test "$enable_shared" = "no"; then
1485 ac_cv_func_dlopen=no
1488 eval _shrext="$shrext_cmds"
1489 # Darwin uses .dylib for libraries but .so for modules
1490 if test X"$_shrext" = X".dylib"; then
1496 AC_MSG_CHECKING(path to sudo_noexec.so)
1497 AC_ARG_WITH(noexec, [AS_HELP_STRING([--with-noexec[=PATH]], [fully qualified pathname of sudo_noexec.so])],
1498 [case $with_noexec in
1499 yes) with_noexec="$libexecdir/sudo/sudo_noexec.so"
1503 esac], [with_noexec="$libexecdir/sudo/sudo_noexec.so"])
1504 AC_MSG_RESULT($with_noexec)
1505 NOEXECFILE="sudo_noexec.so"
1506 NOEXECDIR="`echo $with_noexec|sed -e 's:^${\([[^}]]*\)}:$(\1):' -e 's:^\(.*\)/[[^/]]*:\1:'`"
1509 dnl Find programs we use
1511 AC_PATH_PROG(UNAMEPROG, [uname], [uname])
1512 AC_PATH_PROG(TRPROG, [tr], [tr])
1513 AC_PATH_PROG(MANDOCPROG, [mandoc], [mandoc])
1514 if test "$MANDOCPROG" != "mandoc"; then
1517 AC_PATH_PROG(NROFFPROG, [nroff])
1518 if test -n "$NROFFPROG"; then
1519 test -n "$MANTYPE" && sudo_cv_var_mantype="$MANTYPE"
1520 AC_CACHE_CHECK([which macro set to use for manual pages],
1521 [sudo_cv_var_mantype],
1523 sudo_cv_var_mantype="man"
1524 echo ".Sh NAME" > conftest
1525 echo ".Nm sudo" >> conftest
1526 echo ".Nd sudo" >> conftest
1527 echo ".Sh DESCRIPTION" >> conftest
1528 echo "sudo" >> conftest
1529 if $NROFFPROG -mdoc conftest >/dev/null 2>&1; then
1530 sudo_cv_var_mantype="mdoc"
1535 MANTYPE="$sudo_cv_var_mantype"
1539 mansrcdir='$(srcdir)'
1544 dnl What kind of beastie are we being run on?
1545 dnl Barf if config.cache was generated on another host.
1547 if test -n "$sudo_cv_prev_host"; then
1548 if test "$sudo_cv_prev_host" != "$host"; then
1549 AC_MSG_ERROR([config.cache was created on a different host; remove it and re-run configure.])
1551 AC_MSG_CHECKING(previous host type)
1552 AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1553 AC_MSG_RESULT([$sudo_cv_prev_host])
1556 # this will produce no output since there is no cached value
1557 AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1561 dnl We want to be able to differentiate between different rev's
1563 if test -n "$host_os"; then
1564 OS=`echo $host_os | sed 's/[[0-9]].*//'`
1565 OSREV=`echo $host_os | sed 's/^[[^0-9\.]]*\([[0-9\.]]*\).*$/\1/'`
1566 OSMAJOR=`echo $OSREV | sed 's/\..*$//'`
1575 # LD_PRELOAD is space-delimited
1576 RTLD_PRELOAD_DELIM=" "
1578 # getcwd(3) opens a pipe to getpwd(1)!?!
1581 # system headers lack prototypes but gcc helps...
1582 if test -n "$GCC"; then
1583 OSDEFS="${OSDEFS} -D__USE_FIXED_PROTOTYPES__"
1586 shadow_funcs="getpwanam issecure"
1589 # LD_PRELOAD is space-delimited
1590 RTLD_PRELOAD_DELIM=" "
1592 # Solaris-specific initialization
1593 OS_INIT=os_init_solaris
1594 SUDO_OBJS="${SUDO_OBJS} solaris.o"
1596 # To get the crypt(3) prototype (so we pass -Wall)
1597 OSDEFS="${OSDEFS} -D__EXTENSIONS__"
1598 # AFS support needs -lucb
1599 if test "$with_AFS" = "yes"; then
1600 AFS_LIBS="-lc -lucb"
1603 : ${mansectform='4'}
1604 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1605 AC_CHECK_FUNCS(priv_set, [PSMAN=1])
1608 # To get all prototypes (so we pass -Wall)
1609 OSDEFS="${OSDEFS} -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT"
1610 SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} -Wl,-bI:\$(srcdir)/aixcrypt.exp"
1612 # On AIX 6 and higher default to PAM, else default to LAM
1613 if test $OSMAJOR -ge 6; then
1614 if test X"$with_pam" = X""; then
1618 if test X"$with_aixauth" = X""; then
1619 AC_CHECK_FUNCS(authenticate, [AUTH_EXCL_DEF="AIX_AUTH"])
1623 # AIX analog of nsswitch.conf, enabled by default
1624 AC_ARG_WITH(netsvc, [AS_HELP_STRING([--with-netsvc[[=PATH]]], [path to netsvc.conf])],
1625 [case $with_netsvc in
1627 yes) with_netsvc="/etc/netsvc.conf"
1631 if test -z "$with_nsswitch" -a -z "$with_netsvc"; then
1632 with_netsvc="/etc/netsvc.conf"
1635 # LDR_PRELOAD is only supported in AIX 5.3 and later
1636 if test $OSMAJOR -lt 5; then
1639 RTLD_PRELOAD_VAR="LDR_PRELOAD"
1642 # AIX-specific functions
1643 AC_CHECK_FUNCS(getuserattr setauthdb setrlimit64)
1644 COMMON_OBJS="$COMMON_OBJS aix.lo"
1648 : ${mansectform='4'}
1650 # HP-UX shared libs must be executable
1654 # AFS support needs -lBSD
1655 if test "$with_AFS" = "yes"; then
1656 AFS_LIBS="-lc -lBSD"
1659 : ${mansectform='4'}
1661 # HP-UX shared libs must be executable
1664 # The HP bundled compiler cannot generate shared libs
1665 if test -z "$GCC"; then
1666 AC_CACHE_CHECK([for HP bundled C compiler],
1667 [sudo_cv_var_hpccbundled],
1668 [if $CC -V 2>&1 | grep '^(Bundled)' >/dev/null 2>&1; then
1669 sudo_cv_var_hpccbundled=yes
1671 sudo_cv_var_hpccbundled=no
1674 if test "$sudo_cv_var_hpccbundled" = "yes"; then
1675 AC_MSG_ERROR([The HP bundled C compiler is unable to build Sudo, you must use gcc or the HP ANSI C compiler instead.])
1679 # Build PA-RISC1.1 objects for better portability
1683 if test -n "$GCC"; then
1684 portable_flag="-march=1.1"
1686 portable_flag="+DAportable"
1688 CFLAGS="$CFLAGS $portable_flag"
1689 AC_CACHE_CHECK([whether $CC understands $portable_flag],
1690 [sudo_cv_var_daportable],
1692 [AC_LANG_PROGRAM([[]], [[]])],
1693 [sudo_cv_var_daportable=yes],
1694 [sudo_cv_var_daportable=no]
1698 if test X"$sudo_cv_var_daportable" != X"yes"; then
1706 AC_DEFINE(BROKEN_SYSLOG)
1709 AC_DEFINE(BROKEN_SYSLOG)
1711 shadow_funcs="getspwuid"
1713 # DCE support (requires ANSI C compiler)
1714 if test "$with_DCE" = "yes"; then
1715 # order of libs in 9.X is important. -lc_r must be last
1716 SUDOERS_LIBS="${SUDOERS_LIBS} -ldce -lM -lc_r"
1717 LIBS="${LIBS} -ldce -lM -lc_r"
1718 SUDO_APPEND_CPPFLAGS(-D_REENTRANT)
1719 SUDO_APPEND_CPPFLAGS(-I/usr/include/reentrant)
1723 shadow_funcs="getprpwnam iscomsec"
1725 # HP-UX 10.20 libc has an incompatible getline
1726 ac_cv_func_getline="no"
1729 shadow_funcs="getspnam iscomsec"
1731 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1734 AC_CHECK_FUNCS(pstat_getproc)
1737 # ignore envariables wrt dynamic lib path
1738 # XXX - sudo LDFLAGS instead?
1739 SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} -Wl,-no_library_replacement"
1741 : ${CHECKSIA='true'}
1742 AC_MSG_CHECKING(whether to disable sia support on Digital UNIX)
1744 [AS_HELP_STRING([--disable-sia], [Disable SIA on Digital UNIX])],
1745 [ case "$enableval" in
1746 yes) AC_MSG_RESULT(no)
1749 no) AC_MSG_RESULT(yes)
1752 *) AC_MSG_RESULT(no)
1753 AC_MSG_WARN([Ignoring unknown argument to --enable-sia: $enableval])
1756 ], AC_MSG_RESULT(no))
1758 shadow_funcs="getprpwnam dispcrypt"
1759 # OSF/1 4.x and higher need -ldb too
1760 if test $OSMAJOR -lt 4; then
1761 shadow_libs="-lsecurity -laud -lm"
1763 shadow_libs="-lsecurity -ldb -laud -lm"
1766 # use SIA by default, if we have it
1767 test "$CHECKSIA" = "true" && AUTH_EXCL_DEF="SIA"
1770 # Some versions of Digital Unix ship with a broken
1771 # copy of prot.h, which we need for shadow passwords.
1772 # XXX - make should remove this as part of distclean
1774 AC_MSG_CHECKING([for broken prot.h])
1775 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1776 #include <sys/types.h>
1777 #include <sys/security.h>
1779 ]], [[exit(0);]])], [AC_MSG_RESULT(no)], [AC_MSG_RESULT([yes, fixing locally])
1780 sed 's:<acl.h>:<sys/acl.h>:g' < /usr/include/prot.h > prot.h
1782 # ":DEFAULT" must be appended to _RLD_LIST
1783 RTLD_PRELOAD_VAR="_RLD_LIST"
1784 RTLD_PRELOAD_DEFAULT="DEFAULT"
1786 : ${mansectform='4'}
1789 OSDEFS="${OSDEFS} -D_BSD_TYPES"
1790 if test -z "$NROFFPROG"; then
1791 if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1792 if test -d /usr/share/catman/local; then
1793 mandir="/usr/share/catman/local"
1795 mandir="/usr/catman/local"
1798 # Compress cat pages with pack
1802 if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1803 if test -d "/usr/share/man/local"; then
1804 mandir="/usr/share/man/local"
1806 mandir="/usr/man/local"
1810 # IRIX <= 4 needs -lsun
1811 if test "$OSMAJOR" -le 4; then
1812 AC_CHECK_LIB(sun, getpwnam, [LIBS="${LIBS} -lsun"])
1814 # ":DEFAULT" must be appended to _RLD_LIST
1815 RTLD_PRELOAD_VAR="_RLD_LIST"
1816 RTLD_PRELOAD_DEFAULT="DEFAULT"
1818 : ${mansectform='4'}
1820 *-*-linux*|*-*-k*bsd*-gnu)
1821 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1822 # Some Linux versions need to link with -lshadow
1823 shadow_funcs="getspnam"
1824 shadow_libs_optional="-lshadow"
1825 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1828 OSDEFS="${OSDEFS} -D_CONVEX_SOURCE"
1829 if test -z "$GCC"; then
1830 CFLAGS="${CFLAGS} -D__STDC__"
1833 shadow_defs="-D_AUDIT -D_ACL -DSecureWare"
1834 shadow_funcs="getprpwnam"
1835 shadow_libs="-lprot"
1839 shadow_funcs="getauthuid"
1840 shadow_libs="-lauth"
1843 LIBS="${LIBS} -lsun -lbsd"
1844 SUDO_APPEND_CPPFLAGS(-I/usr/include)
1845 SUDO_APPEND_CPPFLAGS(-I/usr/include/bsd)
1846 OSDEFS="${OSDEFS} -D_MIPS"
1848 : ${mansectform='4'}
1851 OSDEFS="${OSDEFS} -D_ISC"
1853 SUDOERS_LIBS="${SUDOERS_LIBS} -lcrypt"
1855 shadow_funcs="getspnam"
1859 : ${mansectform='4'}
1862 shadow_funcs="getprpwnam"
1863 shadow_libs="-lprot -lx"
1865 : ${mansectform='4'}
1867 m88k-motorola-sysv*)
1868 # motorolla's cc (a variant of gcc) does -O but not -O2
1869 CFLAGS=`echo $CFLAGS | sed 's/-O2/-O/g'`
1871 : ${mansectform='4'}
1874 shadow_funcs="getspnam"
1877 : ${mansectform='4'}
1879 *-ncr-sysv4*|*-ncr-sysvr4*)
1880 AC_CHECK_LIB(c89, strcasecmp, [LIBS="${LIBS} -lc89"])
1882 : ${mansectform='4'}
1884 *-ccur-sysv4*|*-ccur-sysvr4*)
1885 LIBS="${LIBS} -lgen"
1887 : ${mansectform='4'}
1891 # Check for newer BSD auth API
1892 if test -z "$with_bsdauth"; then
1893 AC_CHECK_FUNCS(auth_challenge, [AUTH_EXCL_DEF="BSD_AUTH"])
1897 # FreeBSD has a real setreuid(2) starting with 2.1 and
1898 # backported to 2.0.5. We just take 2.1 and above...
1904 OSDEFS="${OSDEFS} -D_BSD_SOURCE"
1905 if test "${with_skey-'no'}" = "yes"; then
1906 SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
1909 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1910 : ${with_logincap='maybe'}
1913 # OpenBSD-specific initialization
1914 OS_INIT=os_init_openbsd
1915 SUDO_OBJS="${SUDO_OBJS} openbsd.o"
1917 # OpenBSD has a real setreuid(2) starting with 3.3 but
1918 # we will use setresuid(2) instead.
1920 OSDEFS="${OSDEFS} -D_BSD_SOURCE"
1922 # OpenBSD >= 3.0 supports BSD auth
1923 if test -z "$with_bsdauth"; then
1924 if test "$OSMAJOR" -ge 3; then
1925 AUTH_EXCL_DEF="BSD_AUTH"
1928 : ${with_logincap='maybe'}
1931 # NetBSD has a real setreuid(2) starting with 1.3.2
1933 0.9*|1.[[012]]*|1.3|1.3.1)
1938 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1939 : ${with_logincap='maybe'}
1942 OSDEFS="${OSDEFS} -D_BSD_SOURCE"
1943 if test "${with_skey-'no'}" = "yes"; then
1944 SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
1947 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1948 : ${with_logincap='yes'}
1954 # Darwin has a real setreuid(2) starting with 9.0
1955 if test $OSMAJOR -lt 9; then
1959 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1960 : ${with_logincap='yes'}
1961 RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
1962 RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
1965 # lockf() on is broken on the NeXT -- use flock instead
1967 ac_cv_func_flock=yes
1968 RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
1969 RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
1973 : ${mansectform='4'}
1977 : ${mansectform='4'}
1980 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1985 dnl Library preloading to support NOEXEC
1987 if test -n "$with_noexec"; then
1988 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_VAR, "$RTLD_PRELOAD_VAR")
1989 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_DELIM, "$RTLD_PRELOAD_DELIM")
1990 if test -n "$RTLD_PRELOAD_DEFAULT"; then
1991 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_DEFAULT, "$RTLD_PRELOAD_DEFAULT")
1993 if test -n "$RTLD_PRELOAD_ENABLE_VAR"; then
1994 SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_ENABLE_VAR, "$RTLD_PRELOAD_ENABLE_VAR")
1999 dnl Check for mixing mutually exclusive and regular auth methods
2001 AUTH_REG=${AUTH_REG# }
2002 AUTH_EXCL=${AUTH_EXCL# }
2003 if test -n "$AUTH_EXCL"; then
2005 if test $# != 1; then
2006 AC_MSG_ERROR([More than one mutually exclusive authentication method specified: $AUTH_EXCL])
2008 if test -n "$AUTH_REG"; then
2009 AC_MSG_ERROR([Cannot mix mutually exclusive ($AUTH_EXCL) and regular ($AUTH_REG) authentication methods])
2013 dnl Only one of S/Key and OPIE may be specified
2015 if test X"${with_skey}${with_opie}" = X"yesyes"; then
2016 AC_MSG_ERROR(["cannot use both S/Key and OPIE"])
2020 dnl Use BSD-style man sections by default
2023 : ${mansectform='5'}
2026 dnl Add in any libpaths or libraries specified via configure
2028 if test -n "$with_libpath"; then
2029 for i in ${with_libpath}; do
2030 SUDO_APPEND_LIBPATH(LDFLAGS, [$i])
2033 if test -n "$with_libraries"; then
2034 for i in ${with_libraries}; do
2046 dnl C compiler checks (to be done after os checks)
2048 AC_PROG_GCC_TRADITIONAL
2051 # Check for variadic macro support in cpp
2052 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
2054 #if defined(__GNUC__) && __GNUC__ == 2
2055 # define sudo_fprintf(fp, fmt...) fprintf((fp), (fmt))
2057 # define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
2059 ], [sudo_fprintf(stderr, "a %s", "test");])], [], [AC_MSG_ERROR([Your C compiler doesn't support variadic macros, try building with gcc instead])])
2065 AC_PATH_PROG([FLEX], [flex], [flex])
2068 if test -z "$with_sendmail"; then
2073 dnl Check for authpriv support in syslog
2075 AC_MSG_CHECKING(which syslog facility sudo should log with)
2076 if test X"$with_logfac" = X""; then
2077 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <syslog.h>]], [[int i = LOG_AUTHPRIV; (void)i;]])], [logfac=authpriv])
2079 AC_DEFINE_UNQUOTED(LOGFAC, "$logfac", [The syslog facility sudo will use.])
2080 AC_MSG_RESULT($logfac)
2082 dnl Header file checks
2089 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)
2090 AC_CHECK_HEADERS([endian.h] [sys/endian.h] [machine/endian.h], [break])
2091 AC_CHECK_HEADERS([procfs.h] [sys/procfs.h], [AC_CHECK_MEMBERS(struct psinfo.pr_ttydev, [AC_CHECK_FUNCS(_ttyname_dev)], [], [AC_INCLUDES_DEFAULT
2092 #ifdef HAVE_PROCFS_H
2095 #ifdef HAVE_SYS_PROCFS_H
2096 #include <sys/procfs.h>
2101 dnl Check for large file support. HP-UX 11.23 has a broken sys/type.h
2102 dnl when large files support is enabled so work around it.
2107 AC_CACHE_CHECK([whether sys/types.h needs _XOPEN_SOURCE_EXTENDED], [sudo_cv_xopen_source_extended],
2108 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
2109 #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=no], [
2110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _XOPEN_SOURCE_EXTENDED
2112 #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=yes],
2113 [sudo_cv_xopen_source_extended=error])
2115 if test "$sudo_cv_xopen_source_extended" = "yes"; then
2116 OSDEFS="${OSDEFS} -D_XOPEN_SOURCE_EXTENDED"
2117 SUDO_DEFINE(_XOPEN_SOURCE_EXTENDED)
2121 AC_SYS_POSIX_TERMIOS
2122 if test "$ac_cv_sys_posix_termios" != "yes"; then
2123 AC_MSG_ERROR([Must have POSIX termios to build sudo])
2126 if test ${with_logincap-'no'} != "no"; then
2127 AC_CHECK_HEADERS(login_cap.h, [LOGINCAP_USAGE='[[-c class|-]] '; LCMAN=1
2130 SUDO_LIBS="${SUDO_LIBS} -lutil"
2131 SUDOERS_LIBS="${SUDOERS_LIBS} -lutil"
2136 if test ${with_project-'no'} != "no"; then
2137 AC_CHECK_HEADER(project.h, [
2138 AC_CHECK_LIB(project, setproject, [
2139 AC_DEFINE(HAVE_PROJECT_H)
2140 SUDO_LIBS="${SUDO_LIBS} -lproject"
2149 AC_CHECK_TYPE([__signed char], [], [AC_CHECK_TYPE([signed char], [AC_DEFINE(__signed, signed)], [AC_DEFINE(__signed, [])])])
2150 AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include <sys/types.h>
2151 #include <signal.h>])
2152 AC_CHECK_TYPES([sigaction_t], [], [], [#include <sys/types.h>
2153 #include <signal.h>])
2154 AC_CHECK_TYPES([struct timespec], [], [], [#include <sys/types.h>
2155 #if TIME_WITH_SYS_TIME
2156 # include <sys/time.h>
2159 AC_CHECK_TYPES([struct in6_addr], [], [], [#include <sys/types.h>
2160 #include <netinet/in.h>])
2161 AC_TYPE_LONG_LONG_INT
2162 if test X"$ac_cv_type_long_long_int" != X"yes"; then
2163 AC_MSG_ERROR(["C compiler does not appear have required long long support"])
2165 AC_CHECK_SIZEOF([long int])
2166 AC_CHECK_TYPE(size_t, unsigned int)
2167 AC_CHECK_TYPE(ssize_t, int)
2168 AC_CHECK_TYPE(dev_t, int)
2169 AC_CHECK_TYPE(ino_t, unsigned int)
2170 AC_CHECK_TYPE(uint8_t, unsigned char)
2171 AC_CHECK_TYPE(uint32_t, unsigned int)
2172 AC_CHECK_TYPE(uint64_t, unsigned long long)
2173 AC_CHECK_TYPE(socklen_t, [], [AC_DEFINE(socklen_t, unsigned int)], [
2175 #include <sys/socket.h>])
2179 dnl Check for utmp/utmpx struct members.
2180 dnl We need to include OSDEFS for glibc which only has __e_termination
2181 dnl visible when _GNU_SOURCE is *not* defined.
2184 CFLAGS="$CFLAGS $OSDEFS"
2185 if test $ac_cv_header_utmpx_h = "yes"; then
2186 AC_CHECK_MEMBERS([struct utmpx.ut_id, struct utmpx.ut_pid, struct utmpx.ut_tv, struct utmpx.ut_type], [], [], [
2187 #include <sys/types.h>
2191 dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
2193 AC_CHECK_MEMBERS([struct utmpx.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [
2194 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [], [
2195 #include <sys/types.h>
2199 #include <sys/types.h>
2203 AC_CHECK_MEMBERS([struct utmp.ut_id, struct utmp.ut_pid, struct utmp.ut_tv, struct utmp.ut_type, struct utmp.ut_user], [], [], [
2204 #include <sys/types.h>
2208 dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
2210 AC_CHECK_MEMBERS([struct utmp.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [
2211 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [], [
2212 #include <sys/types.h>
2216 #include <sys/types.h>
2226 AC_CHECK_FUNCS(glob nl_langinfo regcomp setenv strftime strrchr strtoll \
2228 AC_CHECK_FUNCS(getgrouplist, [], [
2231 AC_CHECK_FUNCS(getgrset)
2234 AC_CHECK_FUNC(nss_search, [
2235 AC_CHECK_FUNC(_nss_XbyY_buf_alloc, [
2237 AC_CHECK_FUNC(_nss_initf_group, [
2238 AC_CHECK_HEADERS(nss_dbdefs.h)
2239 AC_DEFINE([HAVE_NSS_SEARCH])
2240 AC_DEFINE([HAVE__NSS_XBYY_BUF_ALLOC])
2241 AC_DEFINE([HAVE__NSS_INITF_GROUP])
2245 AC_CHECK_FUNC(__nss_XbyY_buf_alloc, [
2246 AC_CHECK_FUNC(__nss_initf_group, [
2247 AC_CHECK_HEADERS(nss_dbdefs.h)
2248 AC_DEFINE([HAVE_NSS_SEARCH])
2249 AC_DEFINE([HAVE___NSS_XBYY_BUF_ALLOC])
2250 AC_DEFINE([HAVE___NSS_INITF_GROUP])
2257 AC_LIBOBJ(getgrouplist)
2259 AC_CHECK_FUNCS(getline, [], [
2261 AC_CHECK_FUNCS(fgetln)
2264 dnl If libc supports _FORTIFY_SOURCE check functions, use it.
2266 if test "$enable_hardening" != "no"; then
2267 O_CPPFLAGS="$CPPFLAGS"
2268 CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
2269 AC_CHECK_FUNC(__sprintf_chk, [
2270 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[char buf[4]; (void)sprintf(buf, "%s", "foo");]])], [OSDEFS="${OSDEFS} -D_FORTIFY_SOURCE=2"], [])
2272 CPPFLAGS="$O_CPPFLAGS"
2276 AC_CHECK_FUNCS(getutxid getutid, [utmp_style=POSIX; break])
2277 if test "$utmp_style" = "LEGACY"; then
2278 AC_CHECK_FUNCS(getttyent ttyslot, [break])
2279 AC_CHECK_FUNCS(fseeko)
2282 AC_CHECK_FUNCS(sysctl, [AC_CHECK_MEMBERS([struct kinfo_proc.ki_tdev], [],
2284 AC_CHECK_MEMBERS([struct kinfo_proc2.p_tdev], [], [
2285 AC_CHECK_MEMBERS([struct kinfo_proc.p_tdev], [], [
2286 AC_CHECK_MEMBERS([struct kinfo_proc.kp_eproc.e_tdev], [], [], [
2287 #include <sys/param.h>
2288 #include <sys/sysctl.h>
2291 #include <sys/param.h>
2292 #include <sys/sysctl.h>
2296 #include <sys/param.h>
2297 #include <sys/sysctl.h>
2301 #include <sys/param.h>
2302 #include <sys/sysctl.h>
2303 #include <sys/user.h>
2307 AC_CHECK_FUNCS(openpty, [AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])], [
2308 AC_CHECK_LIB(util, openpty, [
2309 AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])
2310 case "$SUDO_LIBS" in
2312 *) SUDO_LIBS="${SUDO_LIBS} -lutil";;
2314 AC_DEFINE(HAVE_OPENPTY)
2316 AC_CHECK_FUNCS(_getpty, [], [
2317 AC_CHECK_FUNCS(grantpt, [
2318 AC_CHECK_FUNCS(posix_openpt)
2320 AC_CHECK_FUNCS(revoke)
2325 AC_CHECK_FUNCS(unsetenv, [SUDO_FUNC_UNSETENV_VOID], [])
2326 SUDO_FUNC_PUTENV_CONST
2327 if test -z "$SKIP_SETRESUID"; then
2328 AC_CHECK_FUNCS(setresuid, [
2330 AC_CHECK_FUNCS(getresuid)
2333 if test -z "$SKIP_SETREUID"; then
2334 AC_CHECK_FUNCS(setreuid)
2336 AC_CHECK_FUNCS(seteuid)
2337 if test X"$with_interfaces" != X"no"; then
2338 AC_CHECK_FUNCS(getifaddrs, [AC_CHECK_FUNCS(freeifaddrs)])
2340 if test -z "$BROKEN_GETCWD"; then
2341 AC_REPLACE_FUNCS(getcwd)
2343 AC_CHECK_FUNCS(lockf flock, [break])
2344 AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]])
2345 AC_CHECK_FUNCS(utimes, [AC_CHECK_FUNCS(futimes futimesat, [break])], [AC_CHECK_FUNCS(futime) AC_LIBOBJ(utimes)])
2346 AC_CHECK_FUNCS(killpg, [], [AC_LIBOBJ(killpg)])
2347 SUDO_FUNC_FNMATCH([AC_DEFINE(HAVE_FNMATCH)], [AC_LIBOBJ(fnmatch)
2348 COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }fnm_test"
2351 AC_REPLACE_FUNCS(memrchr pw_dup strlcpy strlcat)
2352 AC_CHECK_FUNCS(nanosleep, [], [
2353 # On Solaris, nanosleep is in librt
2354 AC_CHECK_LIB(rt, nanosleep, [REPLAY_LIBS="${REPLAY_LIBS} -lrt"], [AC_LIBOBJ(nanosleep)])
2356 AC_CHECK_FUNCS(closefrom, [], [AC_LIBOBJ(closefrom)
2357 AC_CHECK_DECL(F_CLOSEM, AC_DEFINE(HAVE_FCNTL_CLOSEM), [],
2358 [ #include <limits.h>
2359 #include <fcntl.h> ])
2361 AC_CHECK_FUNCS(mkstemps mkdtemp, [], [
2362 AC_CHECK_FUNCS(random lrand48, [break])
2365 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf, , [NEED_SNPRINTF=1])
2366 if test X"$ac_cv_type_struct_timespec" != X"no"; then
2367 AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)]
2368 [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))],
2369 [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))])
2372 dnl Check for the dirfd function/macro. If not found, look for dd_fd in DIR.
2374 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2375 #include <$ac_header_dirent>]], [[DIR *d; (void)dirfd(d);]])], [AC_DEFINE(HAVE_DIRFD)], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2376 #include <$ac_header_dirent>]], [[DIR d; memset(&d, 0, sizeof(d)); return(d.dd_fd);]])], [AC_DEFINE(HAVE_DD_FD)], [])])
2377 AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [
2379 #include <$ac_header_dirent>
2382 dnl If NEED_SNPRINTF is set, add snprintf.c to LIBOBJS
2383 dnl (it contains snprintf, vsnprintf, asprintf, and vasprintf)
2385 if test -n "$NEED_SNPRINTF"; then
2389 dnl If socket(2) not in libc, check -lsocket and -linet
2390 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2392 AC_CHECK_FUNC(socket, [], [
2393 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2395 for lib in $libs; do
2398 *) _libs="$_libs $lib";;
2402 test -z "$libs" && continue
2403 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2404 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2405 SUDO_CHECK_LIB($lib, socket, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
2409 dnl If inet_addr(3) not in libc, check -lnsl and -linet
2410 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2412 AC_CHECK_FUNC(inet_addr, [], [
2413 AC_CHECK_FUNC(__inet_addr, [], [
2414 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2416 for lib in $libs; do
2419 *) _libs="$_libs $lib";;
2423 test -z "$libs" && continue
2424 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2425 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2426 SUDO_CHECK_LIB($lib, inet_addr, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
2431 dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet
2433 AC_CHECK_FUNC(syslog, [], [
2434 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2436 for lib in $libs; do
2439 *) _libs="$_libs $lib";;
2443 test -z "$libs" && continue
2444 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2445 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2446 SUDO_CHECK_LIB($lib, syslog, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
2450 dnl If getaddrinfo(3) not in libc, check -lsocket and -linet
2451 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols.
2453 AC_CHECK_FUNCS(getaddrinfo, [], [
2455 for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
2457 for lib in $libs; do
2460 *) _libs="$_libs $lib";;
2464 test -z "$libs" && continue
2465 lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
2466 extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
2467 SUDO_CHECK_LIB($lib, getaddrinfo, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; found=yes; break], [], [$extralibs])
2469 if test X"$found" != X"no"; then
2470 AC_DEFINE(HAVE_GETADDRINFO)
2474 dnl Check for getprogname() or __progname
2476 AC_CHECK_FUNCS(getprogname, , [
2477 AC_MSG_CHECKING([for __progname])
2478 AC_CACHE_VAL(sudo_cv___progname, [
2479 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; (void)puts(__progname);]])], [sudo_cv___progname=yes], [sudo_cv___progname=no])])
2480 if test "$sudo_cv___progname" = "yes"; then
2481 AC_DEFINE(HAVE___PROGNAME)
2483 AC_LIBOBJ(getprogname)
2485 AC_MSG_RESULT($sudo_cv___progname)
2488 dnl Check for __func__ or __FUNCTION__
2490 AC_MSG_CHECKING([for __func__])
2491 AC_CACHE_VAL(sudo_cv___func__, [
2492 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void)puts(__func__);]])], [sudo_cv___func__=yes], [sudo_cv___func__=no])])
2493 AC_MSG_RESULT($sudo_cv___func__)
2494 if test "$sudo_cv___func__" = "yes"; then
2495 AC_DEFINE(HAVE___FUNC__)
2496 elif test -n "$GCC"; then
2497 AC_MSG_CHECKING([for __FUNCTION__])
2498 AC_CACHE_VAL(sudo_cv___FUNCTION__, [
2499 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void)puts(__FUNCTION__);]])], [sudo_cv___FUNCTION__=yes], [sudo_cv___FUNCTION__=no])])
2500 AC_MSG_RESULT($sudo_cv___FUNCTION__)
2501 if test "$sudo_cv___FUNCTION__" = "yes"; then
2502 AC_DEFINE(HAVE___FUNC__)
2503 AC_DEFINE(__func__, __FUNCTION__, [Define to __FUNCTION__ if your compiler supports __FUNCTION__ but not __func__])
2507 # gettext() and friends may be located in libc (Linux and Solaris)
2508 # or in libintl. However, it is possible to have libintl installed
2509 # even when gettext() is present in libc. In the case of GNU libintl,
2510 # gettext() will be defined to gettext_libintl in libintl.h.
2511 # Since gcc prefers /usr/local/include to /usr/include, we need to
2512 # make sure we use the gettext() that matches the include file.
2513 if test "$enable_nls" != "no"; then
2514 if test "$enable_nls" != "yes"; then
2515 SUDO_APPEND_CPPFLAGS(-I${enable_nls}/include)
2516 SUDO_APPEND_LIBPATH(LDFLAGS, [$enable_nls/lib])
2519 for l in "libc" "-lintl" "-lintl -liconv"; do
2520 if test "$l" = "libc"; then
2521 # If user specified a dir for libintl ignore libc
2522 if test "$enable_nls" != "yes"; then
2525 gettext_name=sudo_cv_gettext
2526 AC_MSG_CHECKING([for gettext])
2529 gettext_name=sudo_cv_gettext"`echo $l|sed -e 's/ //g' -e 's/-/_/g'`"
2530 AC_MSG_CHECKING([for gettext in $l])
2532 AC_CACHE_VAL($gettext_name, [
2535 AC_LANG_PROGRAM([[#include <libintl.h>]], [(void)gettext((char *)0);])
2536 ], [eval $gettext_name=yes], [eval $gettext_name=no]
2539 eval gettext_result="\$$gettext_name"
2540 AC_MSG_RESULT($gettext_result)
2541 if test "$gettext_result" = "yes"; then
2542 AC_CHECK_FUNCS(ngettext)
2548 if test "$sudo_cv_gettext" = "yes"; then
2549 AC_DEFINE(HAVE_LIBINTL_H)
2551 # For Solaris we need links from lang to lang.UTF-8 in localedir
2553 solaris2*) LOCALEDIR_SUFFIX=".UTF-8";;
2555 elif test "$sudo_cv_gettext_lintl" = "yes"; then
2556 AC_DEFINE(HAVE_LIBINTL_H)
2559 elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
2560 AC_DEFINE(HAVE_LIBINTL_H)
2562 LIBINTL="-lintl -liconv"
2567 dnl Deferred zlib option processing.
2568 dnl By default we use the system zlib if it is present.
2569 dnl If a directory was specified for zlib (or we are use sudo's version),
2570 dnl prepend the include dir to make sure we get the right zlib header.
2572 case "$enable_zlib" in
2574 AC_CHECK_LIB(z, gzdopen, [
2575 AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"], [enable_zlib=builtin])
2581 AC_DEFINE(HAVE_ZLIB_H)
2588 AC_DEFINE(HAVE_ZLIB_H)
2589 SUDO_APPEND_CPPFLAGS(-I${enable_zlib}/include)
2590 SUDO_APPEND_LIBPATH(ZLIB, [$enable_zlib/lib])
2594 if test X"$enable_zlib" = X"builtin"; then
2595 AC_DEFINE(HAVE_ZLIB_H)
2596 CPPFLAGS='-I$(top_builddir)/zlib -I$(top_srcdir)/zlib '"${CPPFLAGS}"
2597 ZLIB="${ZLIB}"' $(top_builddir)/zlib/libz.la'
2599 AC_CONFIG_HEADER([zlib/zconf.h])
2600 AC_CONFIG_FILES([zlib/Makefile])
2604 dnl Check for errno declaration in errno.h
2606 AC_CHECK_DECLS([errno], [], [], [
2612 dnl Check for h_errno declaration in netdb.h
2614 AC_CHECK_DECLS([h_errno], [], [], [
2620 dnl Check for strsignal() or sys_siglist
2622 AC_CHECK_FUNCS(strsignal, [], [
2623 AC_LIBOBJ(strsignal)
2624 HAVE_SIGLIST="false"
2625 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], [
2632 if test "$HAVE_SIGLIST" != "true"; then
2638 dnl Check for sig2str(), sys_signame or sys_sigabbrev
2640 AC_CHECK_FUNCS(sig2str, [], [
2642 HAVE_SIGNAME="false"
2643 AC_CHECK_DECLS([sys_signame, _sys_signame, __sys_signame, sys_sigabbrev], [
2650 if test "$HAVE_SIGNAME" != "true"; then
2651 AC_CACHE_CHECK([for undeclared sys_sigabbrev],
2652 [sudo_cv_var_sys_sigabbrev],
2654 [AC_LANG_PROGRAM([[extern char **sys_sigabbrev;]], [[return sys_sigabbrev[1];]])],
2655 [sudo_cv_var_sys_sigabbrev=yes],
2656 [sudo_cv_var_sys_sigabbrev=no]
2660 if test "$sudo_cv_var_sys_sigabbrev" = yes; then
2661 AC_DEFINE(HAVE_SYS_SIGABBREV)
2669 dnl nsswitch.conf and its equivalents
2671 if test ${with_netsvc-"no"} != "no"; then
2672 SUDO_DEFINE_UNQUOTED(_PATH_NETSVC_CONF, "${with_netsvc-/etc/netsvc.conf}")
2673 netsvc_conf=${with_netsvc-/etc/netsvc.conf}
2674 elif test ${with_nsswitch-"yes"} != "no"; then
2675 SUDO_DEFINE_UNQUOTED(_PATH_NSSWITCH_CONF, "${with_nsswitch-/etc/nsswitch.conf}")
2676 nsswitch_conf=${with_nsswitch-/etc/nsswitch.conf}
2680 dnl Mutually exclusive auth checks come first, followed by
2681 dnl non-exclusive ones. Note: passwd must be last of all!
2685 dnl Convert default authentication methods to with_* if
2686 dnl no explicit authentication scheme was specified.
2688 if test -z "${AUTH_EXCL}${AUTH_REG}" -a -n "$AUTH_EXCL_DEF"; then
2689 for auth in $AUTH_EXCL_DEF; do
2691 AIX_AUTH) with_aixauth=maybe;;
2692 BSD_AUTH) with_bsdauth=maybe;;
2693 PAM) with_pam=maybe;;
2694 SIA) CHECKSIA=true;;
2700 dnl PAM support. Systems that use PAM by default set with_pam=default
2701 dnl and we do the actual tests here.
2703 if test ${with_pam-"no"} != "no"; then
2705 # Check for pam_start() in libpam first, then for pam_appl.h.
2708 AC_CHECK_LIB(pam, pam_start, [found_pam_lib=yes], [], [$lt_cv_dlopen_libs])
2710 # Some PAM implementations (MacOS X for example) put the PAM headers
2711 # in /usr/include/pam instead of /usr/include/security...
2714 AC_CHECK_HEADERS([security/pam_appl.h] [pam/pam_appl.h], [found_pam_hdrs=yes; break])
2715 if test "$found_pam_lib" = "yes" -a "$found_pam_hdrs" = "yes"; then
2716 # Found both PAM libs and headers
2718 elif test "$with_pam" = "yes"; then
2719 if test "$found_pam_lib" = "no"; then
2720 AC_MSG_ERROR(["--with-pam specified but unable to locate PAM development library."])
2722 if test "$found_pam_hdrs" = "no"; then
2723 AC_MSG_ERROR(["--with-pam specified but unable to locate PAM development headers."])
2725 elif test "$found_pam_lib" != "$found_pam_hdrs"; then
2726 if test "$found_pam_lib" = "no"; then
2727 AC_MSG_ERROR(["found PAM headers but no PAM development library; specify --without-pam to build without PAM"])
2729 if test "$found_pam_hdrs" = "no"; then
2730 AC_MSG_ERROR(["found PAM library but no PAM development headers; specify --without-pam to build without PAM"])
2734 if test "$with_pam" = "yes"; then
2735 # Older PAM implementations lack pam_getenvlist
2737 LIBS="$LIBS -lpam $lt_cv_dlopen_libs"
2738 AC_CHECK_FUNCS(pam_getenvlist)
2741 # We already link with -ldl if needed (see LIBDL below)
2742 SUDOERS_LIBS="${SUDOERS_LIBS} -lpam"
2744 AUTH_OBJS="$AUTH_OBJS pam.lo";
2747 AC_ARG_WITH(pam-login, [AS_HELP_STRING([--with-pam-login], [enable specific PAM session for sudo -i])],
2748 [case $with_pam_login in
2749 yes) AC_DEFINE([HAVE_PAM_LOGIN])
2750 AC_MSG_CHECKING(whether to use PAM login)
2754 *) AC_MSG_ERROR(["--with-pam-login does not take an argument."])
2758 AC_MSG_CHECKING(whether to use PAM session support)
2759 AC_ARG_ENABLE(pam_session,
2760 [AS_HELP_STRING([--disable-pam-session], [Disable PAM session support])],
2761 [ case "$enableval" in
2762 yes) AC_MSG_RESULT(yes)
2764 no) AC_MSG_RESULT(no)
2765 AC_DEFINE(NO_PAM_SESSION)
2768 *) AC_MSG_RESULT(no)
2769 AC_MSG_WARN([Ignoring unknown argument to --enable-pam-session: $enableval])
2771 esac], AC_MSG_RESULT(yes))
2776 dnl AIX general authentication
2777 dnl If set to "maybe" only enable if no other exclusive method in use.
2779 if test ${with_aixauth-'no'} != "no"; then
2780 if test X"$with_aixauth" != X"maybe" -o X"$AUTH_EXCL" = X""; then
2781 AC_MSG_NOTICE([using AIX general authentication])
2782 AC_DEFINE(HAVE_AIXAUTH)
2783 AUTH_OBJS="$AUTH_OBJS aix_auth.lo";
2784 SUDOERS_LIBS="${SUDOERS_LIBS} -ls"
2790 dnl BSD authentication
2791 dnl If set to "maybe" only enable if no other exclusive method in use.
2793 if test ${with_bsdauth-'no'} != "no"; then
2794 AC_CHECK_HEADER(bsd_auth.h, AC_DEFINE(HAVE_BSD_AUTH_H)
2795 [AUTH_OBJS="$AUTH_OBJS bsdauth.lo"]
2796 [BSDAUTH_USAGE='[[-a auth_type]] ']
2797 [AUTH_EXCL=BSD_AUTH; BAMAN=1],
2798 [AC_MSG_ERROR([BSD authentication was specified but bsd_auth.h could not be found])])
2802 dnl SIA authentication for Tru64 Unix
2804 if test ${CHECKSIA-'false'} = "true"; then
2805 AC_CHECK_FUNCS(sia_ses_init, [found=true], [found=false])
2806 if test "$found" = "true"; then
2808 AUTH_OBJS="$AUTH_OBJS sia.lo"
2813 dnl extra FWTK libs + includes
2815 if test ${with_fwtk-'no'} != "no"; then
2816 if test "$with_fwtk" != "yes"; then
2817 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_fwtk}])
2818 SUDO_APPEND_CPPFLAGS(-I${with_fwtk})
2821 SUDOERS_LIBS="${SUDOERS_LIBS} -lauth -lfwall"
2822 AUTH_OBJS="$AUTH_OBJS fwtk.lo"
2826 dnl extra SecurID lib + includes
2828 if test ${with_SecurID-'no'} != "no"; then
2829 if test "$with_SecurID" != "yes"; then
2831 elif test -d /usr/ace/examples; then
2832 with_SecurID=/usr/ace/examples
2834 with_SecurID=/usr/ace
2836 SUDO_APPEND_CPPFLAGS(-I${with_SecurID})
2837 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_SecurID}])
2838 SUDOERS_LIBS="${SUDOERS_LIBS} -laceclnt -lpthread"
2839 AUTH_OBJS="$AUTH_OBJS securid5.lo";
2843 dnl Non-mutually exclusive auth checks come next.
2844 dnl Note: passwd must be last of all!
2848 dnl Convert default authentication methods to with_* if
2849 dnl no explicit authentication scheme was specified.
2851 if test -z "${AUTH_EXCL}" -a -n "$AUTH_DEF"; then
2852 for auth in $AUTH_DEF; do
2854 passwd) : ${with_passwd='maybe'};;
2861 dnl There is an easy way and a hard way...
2863 if test ${with_kerb5-'no'} != "no"; then
2864 AC_CHECK_PROG(KRB5CONFIG, krb5-config, yes, "")
2865 if test -n "$KRB5CONFIG"; then
2866 AC_DEFINE(HAVE_KERB5)
2867 AUTH_OBJS="$AUTH_OBJS kerb5.lo"
2868 CPPFLAGS="$CPPFLAGS `krb5-config --cflags`"
2869 SUDOERS_LIBS="$SUDOERS_LIBS `krb5-config --libs`"
2871 dnl Try to determine whether we have Heimdal or MIT Kerberos
2873 AC_MSG_CHECKING(whether we are using Heimdal)
2874 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2876 AC_DEFINE(HAVE_HEIMDAL)
2882 AC_DEFINE(HAVE_KERB5)
2884 dnl Use the specified directory, if any, else search for correct inc dir
2886 if test "$with_kerb5" = "yes"; then
2888 O_CPPFLAGS="$CPPFLAGS"
2889 for dir in "" "kerberosV/" "krb5/" "kerberos5/" "kerberosv5/"; do
2890 CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2891 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]])], [found=yes; break])
2893 if test X"$found" = X"no"; then
2894 CPPFLAGS="$O_CPPFLAGS"
2895 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])
2898 dnl XXX - try to include krb5.h here too
2899 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_kerb5}/lib])
2900 SUDO_APPEND_CPPFLAGS(-I${with_kerb5}/include)
2904 dnl Try to determine whether we have Heimdal or MIT Kerberos
2906 AC_MSG_CHECKING(whether we are using Heimdal)
2907 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2909 AC_DEFINE(HAVE_HEIMDAL)
2910 # XXX - need to check whether -lcrypo is needed!
2911 SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5 -lcrypto -ldes -lcom_err -lasn1"
2912 AC_CHECK_LIB(roken, main, [SUDOERS_LIBS="${SUDOERS_LIBS} -lroken"])
2915 SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5 -lk5crypto -lcom_err"
2916 AC_CHECK_LIB(krb5support, main, [SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5support"])
2918 AUTH_OBJS="$AUTH_OBJS kerb5.lo"
2921 LIBS="${LIBS} ${SUDOERS_LIBS}"
2922 AC_CHECK_FUNCS(krb5_verify_user krb5_init_secure_context)
2923 AC_CHECK_FUNCS(krb5_get_init_creds_opt_alloc, [
2924 AC_CACHE_CHECK([whether krb5_get_init_creds_opt_free takes a context],
2925 sudo_cv_krb5_get_init_creds_opt_free_two_args, [
2928 [[#include <krb5.h>]],
2929 [[krb5_get_init_creds_opt_free(NULL, NULL);]]
2931 [sudo_cv_krb5_get_init_creds_opt_free_two_args=yes],
2932 [sudo_cv_krb5_get_init_creds_opt_free_two_args=no]
2937 if test X"$sudo_cv_krb5_get_init_creds_opt_free_two_args" = X"yes"; then
2938 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS)
2941 AC_MSG_CHECKING(whether to use an instance name for Kerberos V)
2942 AC_ARG_ENABLE(kerb5-instance,
2943 [AS_HELP_STRING([--enable-kerb5-instance], [instance string to append to the username (separated by a slash)])],
2944 [ case "$enableval" in
2945 yes) AC_MSG_ERROR(["must give --enable-kerb5-instance an argument."])
2947 no) AC_MSG_RESULT(no)
2949 *) SUDO_DEFINE_UNQUOTED(SUDO_KRB5_INSTANCE, "$enableval")
2950 AC_MSG_RESULT([$enableval])
2952 esac], AC_MSG_RESULT(no))
2956 dnl extra AFS libs and includes
2958 if test ${with_AFS-'no'} = "yes"; then
2960 # looks like the "standard" place for AFS libs is /usr/afsws/lib
2961 AFSLIBDIRS="/usr/lib/afs /usr/afsws/lib /usr/afsws/lib/afs"
2962 for i in $AFSLIBDIRS; do
2963 if test -d ${i}; then
2964 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [$i])
2965 FOUND_AFSLIBDIR=true
2968 if test -z "$FOUND_AFSLIBDIR"; then
2969 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.])
2972 # Order is important here. Note that we build AFS_LIBS from right to left
2973 # since AFS_LIBS may be initialized with BSD compat libs that must go last
2974 AFS_LIBS="-laudit ${AFS_LIBS}"
2975 for i in $AFSLIBDIRS; do
2976 if test -f ${i}/util.a; then
2977 AFS_LIBS="${i}/util.a ${AFS_LIBS}"
2982 if test -z "$FOUND_UTIL_A"; then
2983 AFS_LIBS="-lutil ${AFS_LIBS}"
2985 AFS_LIBS="-lkauth -lprot -lubik -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err ${AFS_LIBS}"
2987 # AFS includes may live in /usr/include on some machines...
2988 for i in /usr/afsws/include; do
2989 if test -d ${i}; then
2990 SUDO_APPEND_CPPFLAGS(-I${i})
2991 FOUND_AFSINCDIR=true
2995 if test -z "$FOUND_AFSLIBDIR"; then
2996 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.])
2999 AUTH_OBJS="$AUTH_OBJS afs.lo"
3003 dnl extra DCE obj + lib
3004 dnl Order of libs in HP-UX 10.x is important, -ldce must be last.
3006 if test ${with_DCE-'no'} = "yes"; then
3007 DCE_OBJS="${DCE_OBJS} dce_pwent.o"
3008 SUDOERS_LIBS="${SUDOERS_LIBS} -ldce"
3009 AUTH_OBJS="$AUTH_OBJS dce.lo"
3013 dnl extra S/Key lib and includes
3015 if test "${with_skey-'no'}" = "yes"; then
3016 O_LDFLAGS="$LDFLAGS"
3017 if test "$with_skey" != "yes"; then
3018 SUDO_APPEND_CPPFLAGS(-I${with_skey}/include)
3019 LDFLAGS="$LDFLAGS -L${with_skey}/lib"
3020 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_skey}/lib])
3021 AC_CHECK_HEADER([skey.h], [found=yes], [found=no], [#include <stdio.h>])
3024 O_CPPFLAGS="$CPPFLAGS"
3025 for dir in "" "/usr/local" "/usr/contrib"; do
3026 test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
3027 AC_CHECK_HEADER([skey.h], [found=yes; break], [],
3028 [#include <stdio.h>])
3030 if test "$found" = "no" -o -z "$dir"; then
3031 CPPFLAGS="$O_CPPFLAGS"
3033 LDFLAGS="$LDFLAGS -L${dir}/lib"
3034 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${dir}/lib])
3036 if test "$found" = "no"; then
3037 AC_MSG_WARN([Unable to locate skey.h, you will have to edit the Makefile and add -I/path/to/skey/includes to CPPFLAGS])
3040 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])])
3041 AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS))
3043 AC_MSG_CHECKING([for RFC1938-compliant skeychallenge])
3046 [[#include <stdio.h>
3047 #include <skey.h>]],
3048 [[skeychallenge(NULL, NULL, NULL, 0);]]
3050 AC_DEFINE(HAVE_RFC1938_SKEYCHALLENGE)
3051 AC_MSG_RESULT([yes])
3057 LDFLAGS="$O_LDFLAGS"
3058 SUDOERS_LIBS="${SUDOERS_LIBS} -lskey"
3059 AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
3063 dnl extra OPIE lib and includes
3065 if test "${with_opie-'no'}" = "yes"; then
3066 O_LDFLAGS="$LDFLAGS"
3067 if test "$with_opie" != "yes"; then
3068 SUDO_APPEND_CPPFLAGS(-I${with_opie}/include)
3069 LDFLAGS="$LDFLAGS -L${with_opie}/lib"
3070 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_opie}/lib])
3071 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes], [found=no])
3074 O_CPPFLAGS="$CPPFLAGS"
3075 for dir in "" "/usr/local" "/usr/contrib"; do
3076 test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
3077 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes; break])
3079 if test "$found" = "no" -o -z "$dir"; then
3080 CPPFLAGS="$O_CPPFLAGS"
3082 LDFLAGS="$LDFLAGS -L${dir}/lib"
3083 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${dir}/lib])
3085 if test "$found" = "no"; then
3086 AC_MSG_WARN([Unable to locate opie.h, you will have to edit the Makefile and add -I/path/to/opie/includes to CPPFLAGS])
3089 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])])
3090 LDFLAGS="$O_LDFLAGS"
3091 SUDOERS_LIBS="${SUDOERS_LIBS} -lopie"
3092 AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
3096 dnl Check for shadow password routines if we have not already done so.
3097 dnl If there is a specific list of functions to check we do that first.
3098 dnl Otherwise, we check for SVR4-style and then SecureWare-style.
3100 if test ${with_passwd-'no'} != "no"; then
3102 dnl if crypt(3) not in libc, look elsewhere
3104 if test -z "$LIB_CRYPT"; then
3106 AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [test -n "$ac_lib" && SUDOERS_LIBS="${SUDOERS_LIBS} $ac_res"])
3110 if test "$CHECKSHADOW" = "true" -a -n "$shadow_funcs"; then
3112 LIBS="$LIBS $shadow_libs"
3114 AC_CHECK_FUNCS($shadow_funcs, [found=yes])
3115 if test "$found" = "yes"; then
3116 SUDOERS_LIBS="$SUDOERS_LIBS $shadow_libs"
3117 elif test -n "$shadow_libs_optional"; then
3118 LIBS="$LIBS $shadow_libs_optional"
3119 AC_CHECK_FUNCS($shadow_funcs, [found=yes])
3120 if test "$found" = "yes"; then
3121 SUDOERS_LIBS="$SUDOERS_LIBS $shadow_libs $shadow_libs_optional"
3124 if test "$found" = "yes"; then
3125 case "$shadow_funcs" in
3126 *getprpwnam*) SECUREWARE=1;;
3128 test -n "$shadow_defs" && OSDEFS="${OSDEFS} $shadow_defs"
3134 if test "$CHECKSHADOW" = "true"; then
3135 AC_SEARCH_LIBS([getspnam], [gen], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && SUDOERS_LIBS="${SUDOERS_LIBS} $ac_res"])
3137 if test "$CHECKSHADOW" = "true"; then
3138 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"])
3140 if test -n "$SECUREWARE"; then
3141 AC_CHECK_FUNCS(bigcrypt set_auth_parameters initprivs)
3142 AUTH_OBJS="$AUTH_OBJS secureware.lo"
3147 dnl extra lib and .o file for LDAP support
3149 if test ${with_ldap-'no'} != "no"; then
3150 O_LDFLAGS="$LDFLAGS"
3151 if test "$with_ldap" != "yes"; then
3152 SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_ldap}/lib])
3153 LDFLAGS="$LDFLAGS -L${with_ldap}/lib"
3154 SUDO_APPEND_CPPFLAGS(-I${with_ldap}/include)
3157 SUDOERS_OBJS="${SUDOERS_OBJS} ldap.lo"
3164 # On HP-UX, libibmldap has a hidden dependency on libCsup
3166 hpux*) AC_CHECK_LIB(Csup, main, [IBMLDAP_EXTRA=" -lCsup"]);;
3168 AC_SEARCH_LIBS(ldap_init, "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}", [
3169 test "$ac_res" != "none required" && LDAP_LIBS="$ac_res"
3172 # If nothing linked, try -lldap and hope for the best
3173 if test "$found" = "no"; then
3176 LIBS="${_LIBS} ${LDAP_LIBS}"
3177 dnl check if we need to link with -llber for ber_set_option
3179 AC_SEARCH_LIBS([ber_set_option], [lber], [found=yes], [found=no])
3180 if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
3181 LDAP_LIBS="$LDAP_LIBS -llber"
3183 dnl check if ldap.h includes lber.h for us
3184 AC_MSG_CHECKING([whether lber.h is needed])
3185 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3186 #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [AC_MSG_RESULT([no])], [
3187 AC_MSG_RESULT([yes])
3188 AC_DEFINE(HAVE_LBER_H)])
3190 AC_CHECK_HEADERS([sasl/sasl.h] [sasl.h], [
3191 AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s)
3194 AC_CHECK_HEADERS([ldap_ssl.h] [mps/ldap_ssl.h], [break], [], [#include <ldap.h>])
3195 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_init ldap_ssl_client_init ldap_start_tls_s_np)
3196 AC_CHECK_FUNCS(ldap_search_ext_s ldap_search_st, [break])
3198 if test X"$check_gss_krb5_ccache_name" = X"yes"; then
3199 AC_CHECK_LIB(gssapi, gss_krb5_ccache_name,
3200 AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
3201 [LDAP_LIBS="${LDAP_LIBS} -lgssapi"],
3202 AC_CHECK_LIB(gssapi_krb5, gss_krb5_ccache_name,
3203 AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
3204 [LDAP_LIBS="${LDAP_LIBS} -lgssapi_krb5"])
3207 # gssapi headers may be separate or part of Kerberos V
3209 O_CPPFLAGS="$CPPFLAGS"
3210 for dir in "" "kerberosV" "krb5" "kerberos5" "kerberosv5"; do
3211 test X"$dir" != X"" && CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
3212 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])])
3214 if test X"$found" != X"no"; then
3215 AC_CHECK_HEADERS([$found])
3216 if test X"$found" = X"gssapi/gssapi.h"; then
3217 AC_CHECK_HEADERS([gssapi/gssapi_krb5.h])
3220 CPPFLAGS="$O_CPPFLAGS"
3221 AC_MSG_WARN([Unable to locate gssapi.h, you will have to edit the Makefile and add -I/path/to/gssapi/includes to CPPFLAGS])
3225 SUDOERS_LIBS="${SUDOERS_LIBS} ${LDAP_LIBS}"
3227 LDFLAGS="$O_LDFLAGS"
3231 # How to do dynamic object loading.
3232 # We support dlopen() and sh_load(), else fall back to static loading.
3234 case "$lt_cv_dlopen" in
3236 AC_DEFINE(HAVE_DLOPEN)
3237 SUDO_OBJS="$SUDO_OBJS locale_stub.o"
3238 LT_STATIC="--tag=disable-static"
3241 AC_DEFINE(HAVE_SHL_LOAD)
3242 SUDO_OBJS="$SUDO_OBJS locale_stub.o"
3243 LT_STATIC="--tag=disable-static"
3247 if test X"${ac_cv_func_dlopen}" = X"yes"; then
3248 AC_MSG_ERROR(["dlopen present but libtool doesn't appear to support your platform."])
3250 # Preload sudoers module symbols
3251 SUDO_OBJS="${SUDO_OBJS} preload.o"
3252 SUDO_LIBS="${SUDO_LIBS} \$(top_builddir)/plugins/sudoers/sudoers.la"
3259 # Add library needed for dynamic loading, if any.
3261 LIBDL="$lt_cv_dlopen_libs"
3262 if test X"$LIBDL" != X""; then
3263 SUDO_LIBS="${SUDO_LIBS} $LIBDL"
3264 SUDOERS_LIBS="${SUDOERS_LIBS} $LIBDL"
3267 # On HP-UX, you cannot dlopen() a shared object that uses pthreads unless
3268 # the main program is linked against -lpthread. We have no knowledge of
3269 # what libraries a plugin may depend on (e.g. HP-UX LDAP which uses pthreads)
3270 # so always link against -lpthread on HP-UX if it is available.
3271 # This check should go after all other libraries tests.
3274 AC_CHECK_LIB(pthread, main, [SUDO_LIBS="${SUDO_LIBS} -lpthread"])
3275 OSDEFS="${OSDEFS} -D_REENTRANT"
3280 dnl Check for log file, timestamp and iolog locations
3282 if test "$utmp_style" = "LEGACY"; then
3290 dnl Turn warnings into errors.
3291 dnl All compiler/loader tests after this point will fail if
3292 dnl a warning is displayed (nornally, warnings are not fata).
3297 dnl If compiler supports the -static-libgcc flag use it unless we have
3298 dnl GNU ld (which can avoid linking in libgcc when it is not needed).
3299 dnl This test relies on AC_LANG_WERROR
3301 if test -n "$GCC" -a "$lt_cv_prog_gnu_ld" != "yes" -a -n "$GCC"; then
3302 AX_CHECK_COMPILE_FLAG([-static-libgcc], [LT_LDFLAGS="$LT_LDFLAGS -Wc,-static-libgcc"])
3306 dnl Check for symbol visibility support.
3307 dnl This test relies on AC_LANG_WERROR
3309 if test -n "$GCC"; then
3310 AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
3311 AC_DEFINE(HAVE_DSO_VISIBILITY)
3312 CFLAGS="${CFLAGS} -fvisibility=hidden"
3320 AX_CHECK_COMPILE_FLAG([-Bhidden_def], [
3321 AC_DEFINE(HAVE_DSO_VISIBILITY)
3322 CFLAGS="${CFLAGS} -Bhidden_def"
3328 AX_CHECK_COMPILE_FLAG([-xldscope=hidden], [
3329 AC_DEFINE(HAVE_DSO_VISIBILITY)
3330 CFLAGS="${CFLAGS} -xldscope=hidden"
3339 dnl If the compiler doesn't have symbol visibility support, it may
3340 dnl support version scripts (only GNU and Solaris ld).
3341 dnl This test relies on AC_LANG_WERROR
3343 if test -n "$LT_LDEXPORTS"; then
3344 if test "$lt_cv_prog_gnu_ld" = "yes"; then
3345 AC_CACHE_CHECK([whether ld supports anonymous map files],
3346 [sudo_cv_var_gnu_ld_anon_map],
3348 sudo_cv_var_gnu_ld_anon_map=no
3349 cat > conftest.map <<-EOF
3356 CFLAGS="$CFLAGS $lt_prog_compiler_pic"
3358 LDFLAGS="$LDFLAGS -fpic -shared -Wl,--version-script,./conftest.map"
3359 AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
3360 [sudo_cv_var_gnu_ld_anon_map=yes])
3365 if test "$sudo_cv_var_gnu_ld_anon_map" = "yes"; then
3366 LT_LDEXPORTS=; LT_LDDEP="\$(shlib_map)"; LT_LDMAP="-Wl,--version-script,\$(shlib_map)"
3371 AC_CACHE_CHECK([whether ld supports anonymous map files],
3372 [sudo_cv_var_solaris_ld_anon_map],
3374 sudo_cv_var_solaris_ld_anon_map=no
3375 cat > conftest.map <<-EOF
3382 CFLAGS="$CFLAGS $lt_prog_compiler_pic"
3384 LDFLAGS="$LDFLAGS -shared -Wl,-M,./conftest.map"
3385 AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
3386 [sudo_cv_var_solaris_ld_anon_map=yes])
3391 if test "$sudo_cv_var_solaris_ld_anon_map" = "yes"; then
3392 LT_LDEXPORTS=; LT_LDDEP="\$(shlib_map)"; LT_LDMAP="-Wl,-M,\$(shlib_map)"
3396 AC_CACHE_CHECK([whether ld supports controlling exported symbols],
3397 [sudo_cv_var_hpux_ld_symbol_export],
3399 sudo_cv_var_hpux_ld_symbol_export=no
3400 echo "+e foo" > conftest.opt
3402 CFLAGS="$CFLAGS $lt_prog_compiler_pic"
3404 if test -n "$GCC"; then
3405 LDFLAGS="$LDFLAGS -shared -Wl,-c,./conftest.opt"
3407 LDFLAGS="$LDFLAGS -Wl,-b -Wl,-c,./conftest.opt"
3409 AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
3410 [sudo_cv_var_hpux_ld_symbol_export=yes])
3416 if test "$sudo_cv_var_hpux_ld_symbol_export" = "yes"; then
3417 LT_LDEXPORTS=; LT_LDDEP="\$(shlib_opt)"; LT_LDOPT="-Wl,-c,\$(shlib_opt)"
3425 dnl Check for PIE executable support if using gcc.
3426 dnl This test relies on AC_LANG_WERROR
3428 if test -n "$GCC"; then
3429 if test -z "$enable_pie"; then
3432 # Attempt to build with PIE support
3437 if test -n "$enable_pie"; then
3438 if test "$enable_pie" = "no"; then
3439 AX_CHECK_COMPILE_FLAG([-fno-pie], [
3441 CFLAGS="$CFLAGS -fno-pie"
3442 AX_CHECK_LINK_FLAG([-nopie], [
3443 PIE_CFLAGS="-fno-pie"
3444 PIE_LDFLAGS="-nopie"
3449 AX_CHECK_COMPILE_FLAG([-fPIE], [
3451 CFLAGS="$CFLAGS -fPIE"
3452 AX_CHECK_LINK_FLAG([-pie], [
3453 if test "$enable_pie" = "maybe"; then
3454 SUDO_WORKING_PIE([enable_pie=yes], [])
3456 if test "$enable_pie" = "yes"; then
3458 PIE_LDFLAGS="-Wc,-fPIE -pie"
3466 if test "$enable_pie" != "yes"; then
3467 # Solaris 11.1 and higher supports tagging binaries to use ASLR
3469 solaris2.1[[1-9]]|solaris2.[[2-9]][[0-9]])
3470 AX_CHECK_LINK_FLAG([-Wl,-z,aslr], [PIE_LDFLAGS="${PIE_LDFLAGS}${PIE_LDFLAGS+ }-Wl,-z,aslr"])
3476 dnl Check for -fstack-protector and -z relro support
3477 dnl This test relies on AC_LANG_WERROR
3479 if test "$enable_hardening" != "no"; then
3480 if test -n "$GCC"; then
3481 AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [
3482 AX_CHECK_LINK_FLAG([-fstack-protector-all], [
3483 SSP_CFLAGS="-fstack-protector-all"
3484 SSP_LDFLAGS="-Wc,-fstack-protector-all"
3487 if test -z "$SSP_CFLAGS"; then
3488 AX_CHECK_COMPILE_FLAG([-fstack-protector], [
3489 AX_CHECK_LINK_FLAG([-fstack-protector], [
3490 SSP_CFLAGS="-fstack-protector"
3491 SSP_LDFLAGS="-Wc,-fstack-protector"
3496 AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="${LDFLAGS} -Wl,-z,relro"])
3500 dnl Use passwd auth module?
3502 case "$with_passwd" in
3504 AUTH_OBJS="$AUTH_OBJS getspwuid.lo passwd.lo"
3507 AC_DEFINE(WITHOUT_PASSWD)
3508 if test -z "$AUTH_OBJS"; then
3509 AC_MSG_ERROR([no authentication methods defined.])
3513 AUTH_OBJS=${AUTH_OBJS# }
3514 _AUTH=`echo "$AUTH_OBJS" | sed -e 's/\.lo//g' -e 's/getspwuid *//'`
3515 AC_MSG_NOTICE([using the following authentication methods: $_AUTH])
3518 dnl LIBS may contain duplicates from SUDO_LIBS, SUDOERS_LIBS, or NET_LIBS
3520 if test -n "$LIBS"; then
3525 for sl in ${SUDO_LIBS} ${SUDOERS_LIBS} ${NET_LIBS}; do
3526 test $l = $sl && dupe=1
3528 test $dupe = 0 && LIBS="${LIBS} $l"
3533 dnl OS-specific initialization
3535 AC_DEFINE_UNQUOTED(os_init, $OS_INIT, [Define to an OS-specific initialization function or `os_init_common'.])
3538 dnl We add -Wall and -Werror after all tests so they don't cause failures
3540 if test -n "$GCC"; then
3541 if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
3542 CFLAGS="${CFLAGS} -Wall"
3544 if test X"$enable_werror" = X"yes"; then
3545 CFLAGS="${CFLAGS} -Werror"
3550 dnl Skip regress tests and sudoers sanity check if cross compiling.
3552 CROSS_COMPILING="$cross_compiling"
3557 test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
3560 dnl Defer setting _PATH_SUDO_NOEXEC until after exec_prefix is set
3561 dnl XXX - this is gross!
3563 if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no" -o "$enabled_shared" != X"no"; then
3564 oexec_prefix="$exec_prefix"
3565 if test "$exec_prefix" = '$(prefix)'; then
3566 if test "$prefix" = "NONE"; then
3567 exec_prefix="$ac_default_prefix"
3569 exec_prefix="$prefix"
3572 if test X"$with_noexec" != X"no"; then
3573 PROGS="${PROGS} libsudo_noexec.la"
3574 INSTALL_NOEXEC="install-noexec"
3576 noexec_file="$with_noexec"
3578 while test X"$noexec_file" != X"$_noexec_file"; do
3579 _noexec_file="$noexec_file"
3580 eval noexec_file="$_noexec_file"
3582 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_NOEXEC, "$noexec_file", [The fully qualified pathname of sudo_noexec.so])
3584 if test X"$with_selinux" != X"no"; then
3585 sesh_file="$libexecdir/sudo/sesh"
3587 while test X"$sesh_file" != X"$_sesh_file"; do
3588 _sesh_file="$sesh_file"
3589 eval sesh_file="$_sesh_file"
3591 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SESH, "$sesh_file")
3593 if test X"$enable_shared" != X"no"; then
3594 PLUGINDIR="$with_plugindir"
3596 while test X"$PLUGINDIR" != X"$_PLUGINDIR"; do
3597 _PLUGINDIR="$PLUGINDIR"
3598 eval PLUGINDIR="$_PLUGINDIR"
3600 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_PLUGIN_DIR, "$PLUGINDIR/")
3601 SUDO_DEFINE_UNQUOTED(SUDOERS_PLUGIN, "sudoers.so")
3603 exec_prefix="$oexec_prefix"
3605 if test X"$with_selinux" = X"no"; then
3606 SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SESH, NULL)
3610 dnl Add -R options to LDFLAGS, etc.
3612 if test X"$LDFLAGS_R" != X""; then
3613 LDFLAGS="$LDFLAGS $LDFLAGS_R"
3615 if test X"$SUDOERS_LDFLAGS_R" != X""; then
3616 SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS $SUDOERS_LDFLAGS_R"
3618 if test X"$ZLIB_R" != X""; then
3619 ZLIB="$ZLIB_R $ZLIB"
3623 dnl Override default configure dirs for the Makefile
3625 if test X"$prefix" = X"NONE"; then
3626 test "$mandir" = '${datarootdir}/man' && mandir='$(prefix)/man'
3628 test "$mandir" = '${datarootdir}/man' && mandir='$(datarootdir)/man'
3630 test "$bindir" = '${exec_prefix}/bin' && bindir='$(exec_prefix)/bin'
3631 test "$sbindir" = '${exec_prefix}/sbin' && sbindir='$(exec_prefix)/sbin'
3632 test "$libexecdir" = '${exec_prefix}/libexec' && libexecdir='$(exec_prefix)/libexec'
3633 test "$includedir" = '${prefix}/include' && includedir='$(prefix)/include'
3634 test "$datarootdir" = '${prefix}/share' && datarootdir='$(prefix)/share'
3635 test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}' && docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)'
3636 test "$localedir" = '${datarootdir}/locale' && localedir='$(datarootdir)/locale'
3637 test "$localstatedir" = '${prefix}/var' && localstatedir='$(prefix)/var'
3638 test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/etc'
3641 dnl Substitute into the Makefile and man pages
3643 AC_CONFIG_FILES([Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/group_file/Makefile plugins/system_group/Makefile plugins/sudoers/Makefile plugins/sudoers/sudoers])
3647 dnl Spew any text the user needs to know about
3649 if test "$with_pam" = "yes"; then
3652 if test -f /usr/lib/security/libpam_hpsec.so.1; then
3653 AC_MSG_NOTICE([You may wish to add the following line to /etc/pam.conf])
3654 AC_MSG_NOTICE([sudo session required libpam_hpsec.so.1 bypass_umask bypass_last_login])
3658 AC_MSG_NOTICE([You will need to customize sample.pam and install it as /etc/pam.d/sudo])
3664 dnl Autoheader templates
3666 AH_TEMPLATE(BROKEN_SYSLOG, [Define to 1 if the `syslog' function returns a non-zero int to denote failure.])
3667 AH_TEMPLATE(CLASSIC_INSULTS, [Define to 1 if you want the insults from the "classic" version sudo.])
3668 AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twisted minds of CSOps.])
3669 AH_TEMPLATE(SUDOERS_PLUGIN, [The name of the sudoers plugin, including extension.])
3670 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.])
3671 AH_TEMPLATE(ENV_DEBUG, [Define to 1 to enable environment function debugging.])
3672 AH_TEMPLATE(ENV_EDITOR, [Define to 1 if you want visudo to honor the EDITOR and VISUAL env variables.])
3673 AH_TEMPLATE(FQDN, [Define to 1 if you want to require fully qualified hosts in sudoers.])
3674 AH_TEMPLATE(ENV_RESET, [Define to 1 to enable environment resetting by default.])
3675 AH_TEMPLATE(GOONS_INSULTS, [Define to 1 if you want insults from the "Goon Show".])
3676 AH_TEMPLATE(HAL_INSULTS, [Define to 1 if you want 2001-like insults.])
3677 AH_TEMPLATE(HAVE_AFS, [Define to 1 if you use AFS.])
3678 AH_TEMPLATE(HAVE_AIXAUTH, [Define to 1 if you use AIX general authentication.])
3679 AH_TEMPLATE(HAVE_BSD_AUTH_H, [Define to 1 if you use BSD authentication.])
3680 AH_TEMPLATE(HAVE_BSM_AUDIT, [Define to 1 to enable BSM audit support.])
3681 AH_TEMPLATE(HAVE_DCE, [Define to 1 if you use OSF DCE.])
3682 AH_TEMPLATE(HAVE_DD_FD, [Define to 1 if your `DIR' contains dd_fd.])
3683 AH_TEMPLATE(HAVE_DIRFD, [Define to 1 if you have the `dirfd' function or macro.])
3684 AH_TEMPLATE(HAVE_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.])
3685 AH_TEMPLATE(HAVE_DLOPEN, [Define to 1 if you have the `dlopen' function.])
3686 AH_TEMPLATE(HAVE_FCNTL_CLOSEM, [Define to 1 if your system has the F_CLOSEM fcntl.])
3687 AH_TEMPLATE(HAVE_FNMATCH, [Define to 1 if you have the `fnmatch' function.])
3688 AH_TEMPLATE(HAVE_FWTK, [Define to 1 if you use the FWTK authsrv daemon.])
3689 AH_TEMPLATE(HAVE_GETAUTHUID, [Define to 1 if you have the `getauthuid' function. (ULTRIX 4.x shadow passwords).])
3690 AH_TEMPLATE(HAVE_GETPRPWNAM, [Define to 1 if you have the `getprpwnam' function. (SecureWare-style shadow passwords).])
3691 AH_TEMPLATE(HAVE_GETPWANAM, [Define to 1 if you have the `getpwanam' function. (SunOS 4.x shadow passwords).])
3692 AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR4-style shadow passwords).])
3693 AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords).])
3694 AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.])
3695 AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.])
3696 AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled).])
3697 AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled).])
3698 AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.])
3699 AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC, [Define to 1 if you have the `krb5_get_init_creds_opt_alloc' function.])
3700 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.])
3701 AH_TEMPLATE(HAVE_KRB5_INIT_SECURE_CONTEXT, [Define to 1 if you have the `krb5_init_secure_context' function.])
3702 AH_TEMPLATE(HAVE_KRB5_VERIFY_USER, [Define to 1 if you have the `krb5_verify_user' function.])
3703 AH_TEMPLATE(HAVE_LBER_H, [Define to 1 if your LDAP needs <lber.h>. (OpenLDAP does not).])
3704 AH_TEMPLATE(HAVE_LDAP, [Define to 1 if you use LDAP for sudoers.])
3705 AH_TEMPLATE(HAVE_LIBINTL_H, [Define to 1 if you have the <libintl.h> header file.])
3706 AH_TEMPLATE(HAVE_LINUX_AUDIT, [Define to 1 to enable Linux audit support.])
3707 AH_TEMPLATE(HAVE_SSSD, [Define to 1 to enable SSSD support.])
3708 AH_TEMPLATE(HAVE_OPIE, [Define to 1 if you use NRL OPIE.])
3709 AH_TEMPLATE(HAVE_PAM, [Define to 1 if you use PAM authentication.])
3710 AH_TEMPLATE(HAVE_PAM_LOGIN, [Define to 1 if you use a specific PAM session for sudo -i.])
3711 AH_TEMPLATE(HAVE_PROJECT_H, [Define to 1 if you have the <project.h> header file.])
3712 AH_TEMPLATE(HAVE_SECURID, [Define to 1 if you use SecurID for authentication.])
3713 AH_TEMPLATE(HAVE_SELINUX, [Define to 1 to enable SELinux RBAC support.])
3714 AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.])
3715 AH_TEMPLATE(HAVE_SHL_LOAD, [Define to 1 if you have the `shl_load' function.])
3716 AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.])
3717 AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().])
3718 AH_TEMPLATE(HAVE_RFC1938_SKEYCHALLENGE, [Define to 1 if the skeychallenge() function is RFC1938-compliant and takes 4 arguments.])
3719 AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union.])
3720 AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member.])
3721 AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member.])
3722 AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.])
3723 AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.])
3724 AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements.])
3725 AH_TEMPLATE(LOGGING, [Define to SLOG_SYSLOG, SLOG_FILE, or SLOG_BOTH.])
3726 AH_TEMPLATE(LONG_OTP_PROMPT, [Define to 1 if you want a two line OTP (S/Key or OPIE) prompt.])
3727 AH_TEMPLATE(NO_AUTHENTICATION, [Define to 1 if you don't want sudo to prompt for a password by default.])
3728 AH_TEMPLATE(NO_LECTURE, [Define to 1 if you don't want users to get the lecture the first they user sudo.])
3729 AH_TEMPLATE(NO_PAM_SESSION, [Define to 1 if you don't want to use sudo's PAM session support.])
3730 AH_TEMPLATE(NO_ROOT_MAILER, [Define to avoid runing the mailer as root.])
3731 AH_TEMPLATE(NO_ROOT_SUDO, [Define to 1 if root should not be allowed to use sudo.])
3732 AH_TEMPLATE(NO_TTY_TICKETS, [Define to 1 if you want a single ticket file instead of per-tty files.])
3733 AH_TEMPLATE(PC_INSULTS, [Define to 1 to replace politically incorrect insults with less offensive ones.])
3734 AH_TEMPLATE(SECURE_PATH, [Define to 1 to override the user's path with a built-in one.])
3735 AH_TEMPLATE(SEND_MAIL_WHEN_NOT_OK, [Define to 1 to send mail when the user is not allowed to run a command.])
3736 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.])
3737 AH_TEMPLATE(SEND_MAIL_WHEN_NO_USER, [Define to 1 to send mail when the user is not in the sudoers file.])
3738 AH_TEMPLATE(SHELL_IF_NO_ARGS, [Define to 1 if you want sudo to start a shell if given no arguments.])
3739 AH_TEMPLATE(SHELL_SETS_HOME, [Define to 1 if you want sudo to set $HOME in shell mode.])
3740 AH_TEMPLATE(STUB_LOAD_INTERFACES, [Define to 1 if the code in interfaces.c does not compile for you.])
3741 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.])
3742 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.])
3743 AH_TEMPLATE(USE_INSULTS, [Define to 1 if you want to insult the user for entering an incorrect password.])
3744 AH_TEMPLATE(USE_STOW, [Define to 1 if you use GNU stow packaging.])
3745 AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for authentication.])
3746 AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
3747 AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
3748 AH_TEMPLATE(socklen_t, [Define to `unsigned int' if <sys/socket.h> doesn't define.])
3749 AH_TEMPLATE(HAVE_STRUCT_UTMP_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmp'.])
3750 AH_TEMPLATE(HAVE_STRUCT_UTMPX_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmpx'.])
3751 AH_TEMPLATE(HAVE___FUNC__, [Define to 1 if the compiler supports the C99 __func__ variable.])
3752 AH_TEMPLATE(SUDO_KRB5_INSTANCE, [An instance string to append to the username (separated by a slash) for Kerberos V authentication.])
3753 AH_TEMPLATE(RTLD_PRELOAD_VAR, [The environment variable that controls preloading of dynamic objects.])
3754 AH_TEMPLATE(RTLD_PRELOAD_ENABLE_VAR, [An extra environment variable that is required to enable preloading (if any).])
3755 AH_TEMPLATE(RTLD_PRELOAD_DELIM, [The delimiter to use when defining multiple preloaded objects.])
3756 AH_TEMPLATE(RTLD_PRELOAD_DEFAULT, [The default value of preloaded objects (if any).])
3757 AH_TEMPLATE(HAVE_DSO_VISIBILITY, [Define to 1 if the compiler supports the __visibility__ attribute.])
3758 AH_TEMPLATE(HAVE_SYS_SIGABBREV, [Define to 1 if your libc has the `sys_sigabbrev' symbol.])
3759 AH_TEMPLATE(HAVE_NSS_SEARCH, [Define to 1 if you have the `nss_search' function.])
3760 AH_TEMPLATE(HAVE__NSS_INITF_GROUP, [Define to 1 if you have the `_nss_initf_group' function.])
3761 AH_TEMPLATE(HAVE___NSS_INITF_GROUP, [Define to 1 if you have the `__nss_initf_group' function.])
3762 AH_TEMPLATE(HAVE__NSS_XBYY_BUF_ALLOC, [Define to 1 if you have the `_nss_XbyY_buf_alloc' function.])
3763 AH_TEMPLATE(HAVE___NSS_XBYY_BUF_ALLOC, [Define to 1 if you have the `__nss_XbyY_buf_alloc' function.])
3766 dnl Bits to copy verbatim into config.h.in
3768 AH_TOP([#ifndef _SUDO_CONFIG_H
3769 #define _SUDO_CONFIG_H])
3772 * Macros to convert ctime and mtime into timevals.
3774 #define timespec2timeval(_ts, _tv) do { \
3775 (_tv)->tv_sec = (_ts)->tv_sec; \
3776 (_tv)->tv_usec = (_ts)->tv_nsec / 1000; \
3780 # ifdef HAVE_ST__TIM
3781 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim.st__tim, (_y))
3782 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim.st__tim, (_y))
3784 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctim, (_y))
3785 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtim, (_y))
3788 # ifdef HAVE_ST_MTIMESPEC
3789 # define ctim_get(_x, _y) timespec2timeval(&(_x)->st_ctimespec, (_y))
3790 # define mtim_get(_x, _y) timespec2timeval(&(_x)->st_mtimespec, (_y))
3792 # define ctim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_ctime; (_y)->tv_usec = 0; } while (0)
3793 # define mtim_get(_x, _y) do { (_y)->tv_sec = (_x)->st_mtime; (_y)->tv_usec = 0; } while (0)
3794 # endif /* HAVE_ST_MTIMESPEC */
3795 #endif /* HAVE_ST_MTIM */
3798 # define ignore_result(x) do { \
3799 __typeof__(x) y = (x); \
3803 # define ignore_result(x) (void)(x)
3806 /* BSD compatibility on some SVR4 systems. */
3809 #endif /* __svr4__ */
3811 #endif /* _SUDO_CONFIG_H */])