Annotation of embedaddon/sudo/configure.in, revision 1.1.1.5

1.1       misho       1: dnl
                      2: dnl Process this file with GNU autoconf to produce a configure script.
                      3: dnl
1.1.1.4   misho       4: dnl Copyright (c) 1994-1996,1998-2013 Todd C. Miller <Todd.Miller@courtesan.com>
1.1       misho       5: dnl
1.1.1.5 ! misho       6: AC_INIT([sudo], [1.8.8], [http://www.sudo.ws/bugs/], [sudo])
1.1       misho       7: AC_CONFIG_HEADER([config.h pathnames.h])
                      8: dnl
                      9: dnl Note: this must come after AC_INIT
                     10: dnl
                     11: AC_MSG_NOTICE([Configuring Sudo version $PACKAGE_VERSION])
                     12: dnl
                     13: dnl Variables that get substituted in the Makefile and man pages
                     14: dnl
                     15: AC_SUBST([HAVE_BSM_AUDIT])
                     16: AC_SUBST([SHELL])
                     17: AC_SUBST([LIBTOOL])
                     18: AC_SUBST([CFLAGS])
                     19: AC_SUBST([PROGS])
                     20: AC_SUBST([CPPFLAGS])
                     21: AC_SUBST([LDFLAGS])
                     22: AC_SUBST([SUDOERS_LDFLAGS])
1.1.1.3   misho      23: AC_SUBST([LT_LDFLAGS])
                     24: AC_SUBST([LT_LDMAP])
                     25: AC_SUBST([LT_LDOPT])
                     26: AC_SUBST([LT_LDDEP])
                     27: AC_SUBST([LT_LDEXPORTS])
1.1       misho      28: AC_SUBST([COMMON_OBJS])
                     29: AC_SUBST([SUDOERS_OBJS])
                     30: AC_SUBST([SUDO_OBJS])
                     31: AC_SUBST([LIBS])
                     32: AC_SUBST([SUDO_LIBS])
                     33: AC_SUBST([SUDOERS_LIBS])
                     34: AC_SUBST([NET_LIBS])
                     35: AC_SUBST([AFS_LIBS])
                     36: AC_SUBST([REPLAY_LIBS])
                     37: AC_SUBST([GETGROUPS_LIB])
                     38: AC_SUBST([OSDEFS])
                     39: AC_SUBST([AUTH_OBJS])
                     40: AC_SUBST([MANTYPE])
1.1.1.3   misho      41: AC_SUBST([MANDIRTYPE])
                     42: AC_SUBST([MANCOMPRESS])
                     43: AC_SUBST([MANCOMPRESSEXT])
                     44: AC_SUBST([SHLIB_MODE])
1.1.1.5 ! misho      45: AC_SUBST([SHLIB_EXT])
1.1       misho      46: AC_SUBST([SUDOERS_MODE])
                     47: AC_SUBST([SUDOERS_UID])
                     48: AC_SUBST([SUDOERS_GID])
1.1.1.2   misho      49: AC_SUBST([DEVEL])
1.1       misho      50: AC_SUBST([BAMAN])
                     51: AC_SUBST([LCMAN])
1.1.1.3   misho      52: AC_SUBST([PSMAN])
1.1       misho      53: AC_SUBST([SEMAN])
                     54: AC_SUBST([devdir])
                     55: AC_SUBST([mansectsu])
                     56: AC_SUBST([mansectform])
                     57: AC_SUBST([mansrcdir])
                     58: AC_SUBST([NOEXECFILE])
                     59: AC_SUBST([NOEXECDIR])
                     60: AC_SUBST([SOEXT])
                     61: AC_SUBST([noexec_file])
1.1.1.4   misho      62: AC_SUBST([sesh_file])
1.1       misho      63: AC_SUBST([INSTALL_NOEXEC])
                     64: AC_SUBST([DONT_LEAK_PATH_INFO])
                     65: AC_SUBST([BSDAUTH_USAGE])
                     66: AC_SUBST([SELINUX_USAGE])
                     67: AC_SUBST([LDAP])
                     68: AC_SUBST([LOGINCAP_USAGE])
                     69: AC_SUBST([ZLIB])
                     70: AC_SUBST([ZLIB_SRC])
                     71: AC_SUBST([LIBTOOL_DEPS])
                     72: AC_SUBST([ac_config_libobj_dir])
                     73: AC_SUBST([CONFIGURE_ARGS])
                     74: AC_SUBST([LIBDL])
                     75: AC_SUBST([LT_STATIC])
                     76: AC_SUBST([LIBINTL])
                     77: AC_SUBST([SUDO_NLS])
1.1.1.4   misho      78: AC_SUBST([LOCALEDIR_SUFFIX])
1.1.1.2   misho      79: AC_SUBST([COMPAT_TEST_PROGS])
1.1.1.3   misho      80: AC_SUBST([CROSS_COMPILING])
                     81: AC_SUBST([PIE_LDFLAGS])
                     82: AC_SUBST([PIE_CFLAGS])
1.1.1.4   misho      83: AC_SUBST([SSP_LDFLAGS])
                     84: AC_SUBST([SSP_CFLAGS])
1.1.1.3   misho      85: AC_SUBST([NO_VIZ])
1.1       misho      86: dnl
                     87: dnl Variables that get substituted in docs (not overridden by environment)
                     88: dnl
                     89: AC_SUBST([iolog_dir])dnl real initial value from SUDO_IO_LOGDIR
                     90: AC_SUBST([timedir])dnl real initial value from SUDO_TIMEDIR
                     91: AC_SUBST([timeout])
                     92: AC_SUBST([password_timeout])
                     93: AC_SUBST([sudo_umask])
                     94: AC_SUBST([umask_override])
                     95: AC_SUBST([passprompt])
                     96: AC_SUBST([long_otp_prompt])
                     97: AC_SUBST([lecture])
                     98: AC_SUBST([logfac])
                     99: AC_SUBST([goodpri])
                    100: AC_SUBST([badpri])
                    101: AC_SUBST([loglen])
                    102: AC_SUBST([ignore_dot])
                    103: AC_SUBST([mail_no_user])
                    104: AC_SUBST([mail_no_host])
                    105: AC_SUBST([mail_no_perms])
                    106: AC_SUBST([mailto])
                    107: AC_SUBST([mailsub])
                    108: AC_SUBST([badpass_message])
                    109: AC_SUBST([fqdn])
                    110: AC_SUBST([runas_default])
                    111: AC_SUBST([env_editor])
                    112: AC_SUBST([env_reset])
                    113: AC_SUBST([passwd_tries])
                    114: AC_SUBST([tty_tickets])
                    115: AC_SUBST([insults])
                    116: AC_SUBST([root_sudo])
                    117: AC_SUBST([path_info])
                    118: AC_SUBST([ldap_conf])
                    119: AC_SUBST([ldap_secret])
1.1.1.3   misho     120: AC_SUBST([sssd_lib])
1.1       misho     121: AC_SUBST([nsswitch_conf])
                    122: AC_SUBST([netsvc_conf])
                    123: AC_SUBST([secure_path])
                    124: AC_SUBST([editor])
1.1.1.4   misho     125: AC_SUBST([pam_session])
1.1.1.5 ! misho     126: AC_SUBST([pam_login_service])
1.1.1.4   misho     127: AC_SUBST([PLUGINDIR])
1.1       misho     128: #
                    129: # Begin initial values for man page substitution
                    130: #
                    131: iolog_dir=/var/log/sudo-io
                    132: timedir=/var/adm/sudo
                    133: timeout=5
                    134: password_timeout=5
                    135: sudo_umask=0022
                    136: umask_override=off
                    137: passprompt="Password:"
                    138: long_otp_prompt=off
                    139: lecture=once
                    140: logfac=auth
                    141: goodpri=notice
                    142: badpri=alert
                    143: loglen=80
                    144: ignore_dot=off
                    145: mail_no_user=on
                    146: mail_no_host=off
                    147: mail_no_perms=off
                    148: mailto=root
                    149: mailsub="*** SECURITY information for %h ***"
                    150: badpass_message="Sorry, try again."
                    151: fqdn=off
                    152: runas_default=root
                    153: env_editor=off
                    154: env_reset=on
                    155: editor=vi
                    156: passwd_tries=3
                    157: tty_tickets=on
                    158: insults=off
                    159: root_sudo=on
                    160: path_info=on
                    161: ldap_conf=/etc/ldap.conf
                    162: ldap_secret=/etc/ldap.secret
                    163: netsvc_conf=/etc/netsvc.conf
1.1.1.4   misho     164: noexec_file=/usr/local/libexec/sudo/sudo_noexec.so
                    165: sesh_file=/usr/local/libexec/sudo/sesh
1.1       misho     166: nsswitch_conf=/etc/nsswitch.conf
                    167: secure_path="not set"
1.1.1.4   misho     168: pam_session=on
1.1.1.5 ! misho     169: pam_login_service=sudo
1.1.1.4   misho     170: PLUGINDIR=/usr/local/libexec/sudo
1.1       misho     171: #
                    172: # End initial values for man page substitution
                    173: #
                    174: dnl
                    175: dnl Initial values for Makefile variables listed above
                    176: dnl May be overridden by environment variables..
                    177: dnl
                    178: INSTALL_NOEXEC=
                    179: devdir='$(srcdir)'
                    180: PROGS="sudo"
1.1.1.3   misho     181: : ${MANDIRTYPE='man'}
1.1       misho     182: : ${mansrcdir='.'}
1.1.1.3   misho     183: : ${SHLIB_MODE='0644'}
1.1       misho     184: : ${SUDOERS_MODE='0440'}
                    185: : ${SUDOERS_UID='0'}
                    186: : ${SUDOERS_GID='0'}
1.1.1.2   misho     187: DEVEL=
1.1       misho     188: LDAP="#"
                    189: BAMAN=0
                    190: LCMAN=0
1.1.1.3   misho     191: PSMAN=0
1.1       misho     192: SEMAN=0
                    193: LIBINTL=
                    194: ZLIB=
                    195: ZLIB_SRC=
                    196: AUTH_OBJS=
                    197: AUTH_REG=
                    198: AUTH_EXCL=
                    199: AUTH_EXCL_DEF=
                    200: AUTH_DEF=passwd
                    201: SUDO_NLS=disabled
1.1.1.4   misho     202: LOCALEDIR_SUFFIX=
1.1.1.3   misho     203: LT_LDEXPORTS="-export-symbols \$(shlib_exp)"
                    204: LT_LDDEP="\$(shlib_exp)"
1.1.1.4   misho     205: NO_VIZ="-DNO_VIZ"
                    206: OS_INIT=os_init_common
1.1       misho     207: 
                    208: dnl
                    209: dnl Other vaiables
                    210: dnl
                    211: CHECKSHADOW=true
                    212: shadow_defs=
                    213: shadow_funcs=
                    214: shadow_libs=
                    215: shadow_libs_optional=
                    216: CONFIGURE_ARGS="$@"
                    217: 
                    218: dnl
1.1.1.2   misho     219: dnl LD_PRELOAD equivalents
                    220: dnl
                    221: RTLD_PRELOAD_VAR="LD_PRELOAD"
                    222: RTLD_PRELOAD_ENABLE_VAR=
                    223: RTLD_PRELOAD_DELIM=":"
                    224: RTLD_PRELOAD_DEFAULT=
                    225: 
                    226: dnl
1.1       misho     227: dnl libc replacement functions live in compat
                    228: dnl
                    229: AC_CONFIG_LIBOBJ_DIR(compat)
                    230: 
1.1.1.4   misho     231: #
                    232: # Prior to sudo 1.8.7, sudo stored libexec files in $libexecdir.
                    233: # Starting with sudo 1.8.7, $libexecdir/sudo is used so strip
                    234: # off an extraneous "/sudo" from libexecdir.
                    235: #
                    236: case "$libexecdir" in
                    237:     */sudo)
                    238:        AC_MSG_WARN([libexecdir should not include the "sudo" subdirectory])
                    239:        libexecdir=`expr "$libexecdir" : '\\(.*\\)/sudo$'`
                    240:        ;;
                    241: esac
                    242: 
1.1       misho     243: dnl
                    244: dnl Deprecated --with options (these all warn or generate an error)
                    245: dnl
                    246: 
                    247: AC_ARG_WITH(otp-only, [AS_HELP_STRING([--with-otp-only], [deprecated])],
                    248: [case $with_otp_only in
                    249:     yes)       with_passwd="no"
                    250:                AC_MSG_NOTICE([--with-otp-only option deprecated, treating as --without-passwd])
                    251:                ;;
                    252: esac])
                    253: 
                    254: AC_ARG_WITH(alertmail, [AS_HELP_STRING([--with-alertmail], [deprecated])],
                    255: [case $with_alertmail in
                    256:     *)         with_mailto="$with_alertmail"
                    257:                AC_MSG_NOTICE([--with-alertmail option deprecated, treating as --mailto])
                    258:                ;;
                    259: esac])
                    260: 
                    261: dnl
                    262: dnl Options for --with
                    263: dnl
                    264: 
                    265: AC_ARG_WITH(devel, [AS_HELP_STRING([--with-devel], [add development options])],
                    266: [case $with_devel in
                    267:     yes)       AC_MSG_NOTICE([Setting up for development: -Wall, flex, yacc])
                    268:                OSDEFS="${OSDEFS} -DSUDO_DEVEL"
1.1.1.2   misho     269:                DEVEL="true"
1.1       misho     270:                devdir=.
                    271:                ;;
                    272:     no)                ;;
                    273:     *)         AC_MSG_WARN([Ignoring unknown argument to --with-devel: $with_devel])
                    274:                ;;
                    275: esac])
                    276: 
                    277: AC_ARG_WITH(CC, [AS_HELP_STRING([--with-CC], [C compiler to use])],
                    278: [case $with_CC in
                    279:     *)         AC_MSG_ERROR([the --with-CC option is no longer supported, please set the CC environment variable instead.])
                    280:                ;;
                    281: esac])
                    282: 
1.1.1.4   misho     283: AC_ARG_WITH(rpath, [AS_HELP_STRING([--with-rpath], [deprecated, use --disable-rpath])],
                    284: [AC_MSG_WARN([--with-rpath deprecated, rpath is now the default])])
1.1       misho     285: 
1.1.1.4   misho     286: AC_ARG_WITH(blibpath, [AS_HELP_STRING([--with-blibpath[=PATH]], [deprecated])],
                    287: [AC_MSG_WARN([--with-blibpath deprecated, use --with-libpath])])
1.1       misho     288: 
                    289: dnl
                    290: dnl Handle BSM auditing support.
                    291: dnl
                    292: AC_ARG_WITH(bsm-audit, [AS_HELP_STRING([--with-bsm-audit], [enable BSM audit support])],
                    293: [case $with_bsm_audit in
                    294:     yes)       AC_DEFINE(HAVE_BSM_AUDIT)
                    295:                SUDOERS_LIBS="${SUDOERS_LIBS} -lbsm"
                    296:                SUDOERS_OBJS="${SUDOERS_OBJS} bsm_audit.lo"
                    297:                ;;
                    298:     no)                ;;
                    299:     *)         AC_MSG_ERROR(["--with-bsm-audit does not take an argument."])
                    300:                ;;
                    301: esac])
                    302: 
                    303: dnl
                    304: dnl Handle Linux auditing support.
                    305: dnl
                    306: AC_ARG_WITH(linux-audit, [AS_HELP_STRING([--with-linux-audit], [enable Linux audit support])],
                    307: [case $with_linux_audit in
                    308:     yes)       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libaudit.h>]], [[int i = AUDIT_USER_CMD; (void)i;]])], [
                    309:                    AC_DEFINE(HAVE_LINUX_AUDIT)
                    310:                    SUDO_LIBS="${SUDO_LIBS} -laudit"
                    311:                    SUDOERS_LIBS="${SUDO_LIBS} -laudit"
                    312:                    SUDOERS_OBJS="${SUDOERS_OBJS} linux_audit.lo"
                    313:                ], [
                    314:                    AC_MSG_ERROR([unable to find AUDIT_USER_CMD in libaudit.h for --with-linux-audit])
                    315:                ])
                    316:                ;;
                    317:     no)                ;;
                    318:     *)         AC_MSG_ERROR(["--with-linux-audit does not take an argument."])
                    319:                ;;
                    320: esac])
                    321: 
1.1.1.3   misho     322: dnl
                    323: dnl Handle SSSD support.
                    324: dnl
                    325: AC_ARG_WITH(sssd, [AS_HELP_STRING([--with-sssd], [enable SSSD support])],
                    326: [case $with_sssd in
                    327:     yes)       SUDOERS_OBJS="${SUDOERS_OBJS} sssd.lo"
                    328:                AC_DEFINE(HAVE_SSSD)
                    329:                ;;
                    330:     no)                ;;
                    331:     *)         AC_MSG_ERROR(["--with-sssd does not take an argument."])
                    332:                ;;
                    333: esac])
                    334: 
                    335: AC_ARG_WITH(sssd-lib, [AS_HELP_STRING([--with-sssd-lib], [path to the SSSD library])])
                    336: sssd_lib="\"LIBDIR\""
                    337: test -n "$with_sssd_lib" && sssd_lib="$with_sssd_lib"
                    338: SUDO_DEFINE_UNQUOTED(_PATH_SSSD_LIB, "$sssd_lib", [Path to the SSSD library])
                    339: 
1.1       misho     340: AC_ARG_WITH(incpath, [AS_HELP_STRING([--with-incpath], [additional places to look for include files])],
                    341: [case $with_incpath in
                    342:     yes)       AC_MSG_ERROR(["must give --with-incpath an argument."])
                    343:                ;;
                    344:     no)                AC_MSG_ERROR(["--without-incpath not supported."])
                    345:                ;;
                    346:     *)         AC_MSG_NOTICE([Adding ${with_incpath} to CPPFLAGS])
                    347:                for i in ${with_incpath}; do
1.1.1.4   misho     348:                    SUDO_APPEND_CPPFLAGS(-I${i})
1.1       misho     349:                done
                    350:                ;;
                    351: esac])
                    352: 
                    353: AC_ARG_WITH(libpath, [AS_HELP_STRING([--with-libpath], [additional places to look for libraries])],
                    354: [case $with_libpath in
                    355:     yes)       AC_MSG_ERROR(["must give --with-libpath an argument."])
                    356:                ;;
                    357:     no)                AC_MSG_ERROR(["--without-libpath not supported."])
                    358:                ;;
                    359:     *)         AC_MSG_NOTICE([Adding ${with_libpath} to LDFLAGS])
                    360:                ;;
                    361: esac])
                    362: 
                    363: AC_ARG_WITH(libraries, [AS_HELP_STRING([--with-libraries], [additional libraries to link with])],
                    364: [case $with_libraries in
                    365:     yes)       AC_MSG_ERROR(["must give --with-libraries an argument."])
                    366:                ;;
                    367:     no)                AC_MSG_ERROR(["--without-libraries not supported."])
                    368:                ;;
                    369:     *)         AC_MSG_NOTICE([Adding ${with_libraries} to LIBS])
                    370:                ;;
                    371: esac])
                    372: 
                    373: AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence], [link with -lefence for malloc() debugging])],
                    374: [case $with_efence in
                    375:     yes)       AC_MSG_NOTICE([Sudo will link with -lefence (Electric Fence)])
                    376:                LIBS="${LIBS} -lefence"
                    377:                if test -f /usr/local/lib/libefence.a; then
                    378:                    with_libpath="${with_libpath} /usr/local/lib"
                    379:                fi
                    380:                ;;
                    381:     no)                ;;
                    382:     *)         AC_MSG_WARN([Ignoring unknown argument to --with-efence: $with_efence])
                    383:                ;;
                    384: esac])
                    385: 
                    386: AC_ARG_WITH(csops, [AS_HELP_STRING([--with-csops], [add CSOps standard options])],
                    387: [case $with_csops in
                    388:     yes)       AC_MSG_NOTICE([Adding CSOps standard options])
                    389:                CHECKSIA=false
                    390:                with_ignore_dot=yes
                    391:                insults=on
                    392:                with_classic_insults=yes
                    393:                with_csops_insults=yes
                    394:                with_env_editor=yes
                    395:                : ${mansectsu='8'}
                    396:                : ${mansectform='5'}
                    397:                ;;
                    398:     no)                ;;
                    399:     *)         AC_MSG_WARN([Ignoring unknown argument to --with-csops: $with_csops])
                    400:                ;;
                    401: esac])
                    402: 
                    403: AC_ARG_WITH(passwd, [AS_HELP_STRING([--without-passwd], [don't use passwd/shadow file for authentication])],
                    404: [case $with_passwd in
                    405:     yes|no)    AC_MSG_CHECKING(whether to use shadow/passwd file authentication)
                    406:                AC_MSG_RESULT($with_passwd)
                    407:                AUTH_DEF=""
                    408:                test "$with_passwd" = "yes" && AUTH_REG="$AUTH_REG passwd"
                    409:                ;;
                    410:     *)         AC_MSG_ERROR(["Sorry, --with-passwd does not take an argument."])
                    411:                ;;
                    412: esac])
                    413: 
                    414: AC_ARG_WITH(skey, [AS_HELP_STRING([--with-skey[=DIR]], [enable S/Key support ])],
                    415: [case $with_skey in
                    416:     no)                ;;
                    417:     *)         AC_DEFINE(HAVE_SKEY)
                    418:                AC_MSG_CHECKING(whether to try S/Key authentication)
                    419:                AC_MSG_RESULT(yes)
                    420:                AUTH_REG="$AUTH_REG S/Key"
                    421:                ;;
                    422: esac])
                    423: 
                    424: AC_ARG_WITH(opie, [AS_HELP_STRING([--with-opie[=DIR]], [enable OPIE support ])],
                    425: [case $with_opie in
                    426:     no)                ;;
                    427:     *)         AC_DEFINE(HAVE_OPIE)
                    428:                AC_MSG_CHECKING(whether to try NRL OPIE authentication)
                    429:                AC_MSG_RESULT(yes)
                    430:                AUTH_REG="$AUTH_REG NRL_OPIE"
                    431:                ;;
                    432: esac])
                    433: 
                    434: AC_ARG_WITH(long-otp-prompt, [AS_HELP_STRING([--with-long-otp-prompt], [use a two line OTP (skey/opie) prompt])],
                    435: [case $with_long_otp_prompt in
                    436:     yes)       AC_DEFINE(LONG_OTP_PROMPT)
                    437:                AC_MSG_CHECKING(whether to use a two line prompt for OTP authentication)
                    438:                AC_MSG_RESULT(yes)
                    439:                long_otp_prompt=on
                    440:                ;;
                    441:     no)                long_otp_prompt=off
                    442:                ;;
                    443:     *)         AC_MSG_ERROR(["--with-long-otp-prompt does not take an argument."])
                    444:                ;;
                    445: esac])
                    446: 
                    447: AC_ARG_WITH(SecurID, [AS_HELP_STRING([--with-SecurID[[=DIR]]], [enable SecurID support])],
                    448: [case $with_SecurID in
                    449:     no)                ;;
                    450:     *)         AC_DEFINE(HAVE_SECURID)
                    451:                AC_MSG_CHECKING(whether to use SecurID for authentication)
                    452:                AC_MSG_RESULT(yes)
                    453:                AUTH_EXCL="$AUTH_EXCL SecurID"
                    454:                ;;
                    455: esac])
                    456: 
                    457: AC_ARG_WITH(fwtk, [AS_HELP_STRING([--with-fwtk[[=DIR]]], [enable FWTK AuthSRV support])],
                    458: [case $with_fwtk in
                    459:     no)                ;;
                    460:     *)         AC_DEFINE(HAVE_FWTK)
                    461:                AC_MSG_CHECKING(whether to use FWTK AuthSRV for authentication)
                    462:                AC_MSG_RESULT(yes)
                    463:                AUTH_EXCL="$AUTH_EXCL FWTK"
                    464:                ;;
                    465: esac])
                    466: 
                    467: AC_ARG_WITH(kerb5, [AS_HELP_STRING([--with-kerb5[[=DIR]]], [enable Kerberos V support])],
                    468: [case $with_kerb5 in
                    469:     no)                ;;
                    470:     *)         AC_MSG_CHECKING(whether to try Kerberos V authentication)
                    471:                AC_MSG_RESULT(yes)
                    472:                AUTH_REG="$AUTH_REG kerb5"
                    473:                ;;
                    474: esac])
                    475: 
                    476: AC_ARG_WITH(aixauth, [AS_HELP_STRING([--with-aixauth], [enable AIX general authentication support])],
                    477: [case $with_aixauth in
                    478:     yes)       AUTH_EXCL="$AUTH_EXCL AIX_AUTH";;
                    479:     no)                ;;
                    480:     *)         AC_MSG_ERROR(["--with-aixauth does not take an argument."])
                    481:                ;;
                    482: esac])
                    483: 
                    484: AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [enable PAM support])],
                    485: [case $with_pam in
                    486:     yes)       AUTH_EXCL="$AUTH_EXCL PAM";;
                    487:     no)                ;;
                    488:     *)         AC_MSG_ERROR(["--with-pam does not take an argument."])
                    489:                ;;
                    490: esac])
                    491: 
                    492: AC_ARG_WITH(AFS, [AS_HELP_STRING([--with-AFS], [enable AFS support])],
                    493: [case $with_AFS in
                    494:     yes)       AC_DEFINE(HAVE_AFS)
                    495:                AC_MSG_CHECKING(whether to try AFS (kerberos) authentication)
                    496:                AC_MSG_RESULT(yes)
                    497:                AUTH_REG="$AUTH_REG AFS"
                    498:                ;;
                    499:     no)                ;;
                    500:     *)         AC_MSG_ERROR(["--with-AFS does not take an argument."])
                    501:                ;;
                    502: esac])
                    503: 
                    504: AC_ARG_WITH(DCE, [AS_HELP_STRING([--with-DCE], [enable DCE support])],
                    505: [case $with_DCE in
                    506:     yes)       AC_DEFINE(HAVE_DCE)
                    507:                AC_MSG_CHECKING(whether to try DCE (kerberos) authentication)
                    508:                AC_MSG_RESULT(yes)
                    509:                AUTH_REG="$AUTH_REG DCE"
                    510:                ;;
                    511:     no)                ;;
                    512:     *)         AC_MSG_ERROR(["--with-DCE does not take an argument."])
                    513:                ;;
                    514: esac])
                    515: 
                    516: AC_ARG_WITH(logincap, [AS_HELP_STRING([--with-logincap], [enable BSD login class support])],
                    517: [case $with_logincap in
                    518:     yes|no)    ;;
                    519:     *)         AC_MSG_ERROR(["--with-logincap does not take an argument."])
                    520:                ;;
                    521: esac])
                    522: 
                    523: AC_ARG_WITH(bsdauth, [AS_HELP_STRING([--with-bsdauth], [enable BSD authentication support])],
                    524: [case $with_bsdauth in
                    525:     yes)       AUTH_EXCL="$AUTH_EXCL BSD_AUTH";;
                    526:     no)                ;;
                    527:     *)         AC_MSG_ERROR(["--with-bsdauth does not take an argument."])
                    528:                ;;
                    529: esac])
                    530: 
                    531: AC_ARG_WITH(project, [AS_HELP_STRING([--with-project], [enable Solaris project support])],
                    532: [case $with_project in
                    533:     yes|no)    ;;
                    534:     no)        ;;
                    535:     *)         AC_MSG_ERROR(["--with-project does not take an argument."])
                    536:                ;;
                    537: esac])
                    538: 
                    539: AC_MSG_CHECKING(whether to lecture users the first time they run sudo)
                    540: AC_ARG_WITH(lecture, [AS_HELP_STRING([--without-lecture], [don't print lecture for first-time sudoer])],
                    541: [case $with_lecture in
                    542:     yes|short|always)  lecture=once
                    543:                ;;
                    544:     no|none|never)     lecture=never
                    545:                ;;
                    546:     *)         AC_MSG_ERROR(["unknown argument to --with-lecture: $with_lecture"])
                    547:                ;;
                    548: esac])
                    549: if test "$lecture" = "once"; then
                    550:     AC_MSG_RESULT(yes)
                    551: else
                    552:     AC_DEFINE(NO_LECTURE)
                    553:     AC_MSG_RESULT(no)
                    554: fi
                    555: 
                    556: AC_MSG_CHECKING(whether sudo should log via syslog or to a file by default)
                    557: AC_ARG_WITH(logging, [AS_HELP_STRING([--with-logging], [log via syslog, file, or both])],
                    558: [case $with_logging in
                    559:     yes)       AC_MSG_ERROR(["must give --with-logging an argument."])
                    560:                ;;
                    561:     no)                AC_MSG_ERROR(["--without-logging not supported."])
                    562:                ;;
                    563:     syslog)    AC_DEFINE(LOGGING, SLOG_SYSLOG)
                    564:                AC_MSG_RESULT(syslog)
                    565:                ;;
                    566:     file)      AC_DEFINE(LOGGING, SLOG_FILE)
                    567:                AC_MSG_RESULT(file)
                    568:                ;;
                    569:     both)      AC_DEFINE(LOGGING, SLOG_BOTH)
                    570:                AC_MSG_RESULT(both)
                    571:                ;;
                    572:     *)         AC_MSG_ERROR(["unknown argument to --with-logging: $with_logging"])
                    573:                ;;
                    574: esac], [AC_DEFINE(LOGGING, SLOG_SYSLOG) AC_MSG_RESULT(syslog)])
                    575: 
                    576: AC_ARG_WITH(logfac, [AS_HELP_STRING([--with-logfac], [syslog facility to log with (default is "auth")])],
                    577: [case $with_logfac in
                    578:     yes)       AC_MSG_ERROR(["must give --with-logfac an argument."])
                    579:                ;;
                    580:     no)                AC_MSG_ERROR(["--without-logfac not supported."])
                    581:                ;;
                    582:     authpriv|auth|daemon|user|local0|local1|local2|local3|local4|local5|local6|local7)         logfac=$with_logfac
                    583:                ;;
                    584:     *)         AC_MSG_ERROR(["$with_logfac is not a supported syslog facility."])
                    585:                ;;
                    586: esac])
                    587: 
                    588: AC_MSG_CHECKING(at which syslog priority to log commands)
                    589: AC_ARG_WITH(goodpri, [AS_HELP_STRING([--with-goodpri], [syslog priority for commands (def is "notice")])],
                    590: [case $with_goodpri in
                    591:     yes)       AC_MSG_ERROR(["must give --with-goodpri an argument."])
                    592:                ;;
                    593:     no)                AC_MSG_ERROR(["--without-goodpri not supported."])
                    594:                ;;
                    595:     alert|crit|debug|emerg|err|info|notice|warning)
                    596:                goodpri=$with_goodpri
                    597:                ;;
                    598:     *)         AC_MSG_ERROR(["$with_goodpri is not a supported syslog priority."])
                    599:                ;;
                    600: esac])
                    601: AC_DEFINE_UNQUOTED(PRI_SUCCESS, "$goodpri", [The syslog priority sudo will use for successful attempts.])
                    602: AC_MSG_RESULT($goodpri)
                    603: 
                    604: AC_MSG_CHECKING(at which syslog priority to log failures)
                    605: AC_ARG_WITH(badpri, [AS_HELP_STRING([--with-badpri], [syslog priority for failures (def is "alert")])],
                    606: [case $with_badpri in
                    607:     yes)       AC_MSG_ERROR(["must give --with-badpri an argument."])
                    608:                ;;
                    609:     no)                AC_MSG_ERROR(["--without-badpri not supported."])
                    610:                ;;
                    611:     alert|crit|debug|emerg|err|info|notice|warning)
                    612:                badpri=$with_badpri
                    613:                ;;
                    614:     *)         AC_MSG_ERROR([$with_badpri is not a supported syslog priority.])
                    615:                ;;
                    616: esac])
                    617: AC_DEFINE_UNQUOTED(PRI_FAILURE, "$badpri", [The syslog priority sudo will use for unsuccessful attempts/errors.])
                    618: AC_MSG_RESULT($badpri)
                    619: 
                    620: AC_ARG_WITH(logpath, [AS_HELP_STRING([--with-logpath], [path to the sudo log file])],
                    621: [case $with_logpath in
                    622:     yes)       AC_MSG_ERROR(["must give --with-logpath an argument."])
                    623:                ;;
                    624:     no)                AC_MSG_ERROR(["--without-logpath not supported."])
                    625:                ;;
                    626: esac])
                    627: 
                    628: AC_MSG_CHECKING(how long a line in the log file should be)
                    629: AC_ARG_WITH(loglen, [AS_HELP_STRING([--with-loglen], [maximum length of a log file line (default is 80)])],
                    630: [case $with_loglen in
                    631:     yes)       AC_MSG_ERROR(["must give --with-loglen an argument."])
                    632:                ;;
                    633:     no)                AC_MSG_ERROR(["--without-loglen not supported."])
                    634:                ;;
                    635:     [[0-9]]*)  loglen=$with_loglen
                    636:                ;;
                    637:     *)         AC_MSG_ERROR(["you must enter a number, not $with_loglen"])
                    638:                ;;
                    639: esac])
                    640: AC_DEFINE_UNQUOTED(MAXLOGFILELEN, $loglen, [The max number of chars per log file line (for line wrapping).])
                    641: AC_MSG_RESULT($loglen)
                    642: 
                    643: AC_MSG_CHECKING(whether sudo should ignore '.' or '' in \$PATH)
                    644: AC_ARG_WITH(ignore-dot, [AS_HELP_STRING([--with-ignore-dot], [ignore '.' in the PATH])],
                    645: [case $with_ignore_dot in
                    646:     yes)       ignore_dot=on
                    647:                ;;
                    648:     no)                ignore_dot=off
                    649:                ;;
                    650:     *)         AC_MSG_ERROR(["--with-ignore-dot does not take an argument."])
                    651:                ;;
                    652: esac])
                    653: if test "$ignore_dot" = "on"; then
                    654:     AC_DEFINE(IGNORE_DOT_PATH)
                    655:     AC_MSG_RESULT(yes)
                    656: else
                    657:     AC_MSG_RESULT(no)
                    658: fi
                    659: 
                    660: AC_MSG_CHECKING(whether to send mail when a user is not in sudoers)
                    661: AC_ARG_WITH(mail-if-no-user, [AS_HELP_STRING([--without-mail-if-no-user], [do not send mail if user not in sudoers])],
                    662: [case $with_mail_if_no_user in
                    663:     yes)       mail_no_user=on
                    664:                ;;
                    665:     no)                mail_no_user=off
                    666:                ;;
                    667:     *)         AC_MSG_ERROR(["--with-mail-if-no-user does not take an argument."])
                    668:                ;;
                    669: esac])
                    670: if test "$mail_no_user" = "on"; then
                    671:     AC_DEFINE(SEND_MAIL_WHEN_NO_USER)
                    672:     AC_MSG_RESULT(yes)
                    673: else
                    674:     AC_MSG_RESULT(no)
                    675: fi
                    676: 
                    677: AC_MSG_CHECKING(whether to send mail when user listed but not for this host)
                    678: 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])],
                    679: [case $with_mail_if_no_host in
                    680:     yes)       mail_no_host=on
                    681:                ;;
                    682:     no)                mail_no_host=off
                    683:                ;;
                    684:     *)         AC_MSG_ERROR(["--with-mail-if-no-host does not take an argument."])
                    685:                ;;
                    686: esac])
                    687: if test "$mail_no_host" = "on"; then
                    688:     AC_DEFINE(SEND_MAIL_WHEN_NO_HOST)
                    689:     AC_MSG_RESULT(yes)
                    690: else
                    691:     AC_MSG_RESULT(no)
                    692: fi
                    693: 
                    694: AC_MSG_CHECKING(whether to send mail when a user tries a disallowed command)
                    695: AC_ARG_WITH(mail-if-noperms, [AS_HELP_STRING([--with-mail-if-noperms], [send mail if user not allowed to run command])],
                    696: [case $with_mail_if_noperms in
                    697:     yes)       mail_noperms=on
                    698:                ;;
                    699:     no)                mail_noperms=off
                    700:                ;;
                    701:     *)         AC_MSG_ERROR(["--with-mail-if-noperms does not take an argument."])
                    702:                ;;
                    703: esac])
                    704: if test "$mail_noperms" = "on"; then
                    705:     AC_DEFINE(SEND_MAIL_WHEN_NOT_OK)
                    706:     AC_MSG_RESULT(yes)
                    707: else
                    708:     AC_MSG_RESULT(no)
                    709: fi
                    710: 
                    711: AC_MSG_CHECKING(who should get the mail that sudo sends)
                    712: AC_ARG_WITH(mailto, [AS_HELP_STRING([--with-mailto], [who should get sudo mail (default is "root")])],
                    713: [case $with_mailto in
                    714:     yes)       AC_MSG_ERROR(["must give --with-mailto an argument."])
                    715:                ;;
                    716:     no)                AC_MSG_ERROR(["--without-mailto not supported."])
                    717:                ;;
                    718:     *)         mailto=$with_mailto
                    719:                ;;
                    720: esac])
                    721: AC_DEFINE_UNQUOTED(MAILTO, "$mailto", [The user or email address that sudo mail is sent to.])
                    722: AC_MSG_RESULT([$mailto])
                    723: 
                    724: AC_ARG_WITH(mailsubject, [AS_HELP_STRING([--with-mailsubject], [subject of sudo mail])],
                    725: [case $with_mailsubject in
                    726:     yes)       AC_MSG_ERROR(["must give --with-mailsubject an argument."])
                    727:                ;;
                    728:     no)                AC_MSG_WARN([Sorry, --without-mailsubject not supported.])
                    729:                ;;
                    730:     *)         mailsub="$with_mailsubject"
                    731:                AC_MSG_CHECKING(sudo mail subject)
                    732:                AC_MSG_RESULT([Using alert mail subject: $mailsub])
                    733:                ;;
                    734: esac])
                    735: AC_DEFINE_UNQUOTED(MAILSUBJECT, "$mailsub", [The subject of the mail sent by sudo to the MAILTO user/address.])
                    736: 
                    737: AC_MSG_CHECKING(for bad password prompt)
                    738: AC_ARG_WITH(passprompt, [AS_HELP_STRING([--with-passprompt], [default password prompt])],
                    739: [case $with_passprompt in
                    740:     yes)       AC_MSG_ERROR(["must give --with-passprompt an argument."])
                    741:                ;;
                    742:     no)                AC_MSG_WARN([Sorry, --without-passprompt not supported.])
                    743:                ;;
                    744:     *)         passprompt="$with_passprompt"
                    745: esac])
                    746: AC_MSG_RESULT($passprompt)
                    747: AC_DEFINE_UNQUOTED(PASSPROMPT, "$passprompt", [The default password prompt.])
                    748: 
                    749: AC_MSG_CHECKING(for bad password message)
                    750: AC_ARG_WITH(badpass-message, [AS_HELP_STRING([--with-badpass-message], [message the user sees when the password is wrong])],
                    751: [case $with_badpass_message in
                    752:     yes)       AC_MSG_ERROR(["Must give --with-badpass-message an argument."])
                    753:                ;;
                    754:     no)                AC_MSG_WARN([Sorry, --without-badpass-message not supported.])
                    755:                ;;
                    756:     *)         badpass_message="$with_badpass_message"
                    757:                ;;
                    758: esac])
                    759: AC_DEFINE_UNQUOTED(INCORRECT_PASSWORD, "$badpass_message", [The message given when a bad password is entered.])
                    760: AC_MSG_RESULT([$badpass_message])
                    761: 
                    762: AC_MSG_CHECKING(whether to expect fully qualified hosts in sudoers)
                    763: AC_ARG_WITH(fqdn, [AS_HELP_STRING([--with-fqdn], [expect fully qualified hosts in sudoers])],
                    764: [case $with_fqdn in
                    765:     yes)       fqdn=on
                    766:                ;;
                    767:     no)                fqdn=off
                    768:                ;;
                    769:     *)         AC_MSG_ERROR(["--with-fqdn does not take an argument."])
                    770:                ;;
                    771: esac])
                    772: if test "$fqdn" = "on"; then
                    773:     AC_DEFINE(FQDN)
                    774:     AC_MSG_RESULT(yes)
                    775: else
                    776:     AC_MSG_RESULT(no)
                    777: fi
                    778: 
                    779: AC_ARG_WITH(timedir, [AS_HELP_STRING([--with-timedir], [path to the sudo timestamp dir])],
                    780: [case $with_timedir in
                    781:     yes)       AC_MSG_ERROR(["must give --with-timedir an argument."])
                    782:                ;;
                    783:     no)                AC_MSG_ERROR(["--without-timedir not supported."])
                    784:                ;;
                    785: esac])
                    786: 
                    787: AC_ARG_WITH(iologdir, [AS_HELP_STRING([--with-iologdir=DIR], [directory to store sudo I/O log files in])],
                    788: [case $with_iologdir in
                    789:     yes)    ;;
                    790:     no)     AC_MSG_ERROR(["--without-iologdir not supported."])
                    791:            ;;
                    792: esac])
                    793: 
                    794: AC_ARG_WITH(sendmail, [AS_HELP_STRING([--with-sendmail], [set path to sendmail])
                    795: AS_HELP_STRING([--without-sendmail], [do not send mail at all])],
                    796: [case $with_sendmail in
                    797:     yes)       with_sendmail=""
                    798:                ;;
                    799:     no)                ;;
                    800:     *)         SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SENDMAIL, "$with_sendmail")
                    801:                ;;
                    802: esac])
                    803: 
                    804: AC_ARG_WITH(sudoers-mode, [AS_HELP_STRING([--with-sudoers-mode], [mode of sudoers file (defaults to 0440)])],
                    805: [case $with_sudoers_mode in
                    806:     yes)       AC_MSG_ERROR(["must give --with-sudoers-mode an argument."])
                    807:                ;;
                    808:     no)                AC_MSG_ERROR(["--without-sudoers-mode not supported."])
                    809:                ;;
                    810:     [[1-9]]*)  SUDOERS_MODE=0${with_sudoers_mode}
                    811:                ;;
                    812:     0*)                SUDOERS_MODE=$with_sudoers_mode
                    813:                ;;
                    814:     *)         AC_MSG_ERROR(["you must use an octal mode, not a name."])
                    815:                ;;
                    816: esac])
                    817: 
                    818: AC_ARG_WITH(sudoers-uid, [AS_HELP_STRING([--with-sudoers-uid], [uid that owns sudoers file (defaults to 0)])],
                    819: [case $with_sudoers_uid in
                    820:     yes)       AC_MSG_ERROR(["must give --with-sudoers-uid an argument."])
                    821:                ;;
                    822:     no)                AC_MSG_ERROR(["--without-sudoers-uid not supported."])
                    823:                ;;
                    824:     [[0-9]]*)  SUDOERS_UID=$with_sudoers_uid
                    825:                ;;
                    826:     *)         AC_MSG_ERROR(["you must use an unsigned numeric uid, not a name."])
                    827:                ;;
                    828: esac])
                    829: 
                    830: AC_ARG_WITH(sudoers-gid, [AS_HELP_STRING([--with-sudoers-gid], [gid that owns sudoers file (defaults to 0)])],
                    831: [case $with_sudoers_gid in
                    832:     yes)       AC_MSG_ERROR(["must give --with-sudoers-gid an argument."])
                    833:                ;;
                    834:     no)                AC_MSG_ERROR(["--without-sudoers-gid not supported."])
                    835:                ;;
                    836:     [[0-9]]*)  SUDOERS_GID=$with_sudoers_gid
                    837:                ;;
                    838:     *)         AC_MSG_ERROR(["you must use an unsigned numeric gid, not a name."])
                    839:                ;;
                    840: esac])
                    841: 
                    842: AC_MSG_CHECKING(for umask programs should be run with)
                    843: AC_ARG_WITH(umask, [AS_HELP_STRING([--with-umask], [umask with which the prog should run (default is 022)])
                    844: AS_HELP_STRING([--without-umask], [Preserves the umask of the user invoking sudo.])],
                    845: [case $with_umask in
                    846:     yes)       AC_MSG_ERROR(["must give --with-umask an argument."])
                    847:                ;;
                    848:     no)                sudo_umask=0777
                    849:                ;;
                    850:     [[0-9]]*)  sudo_umask=$with_umask
                    851:                ;;
                    852:     *)         AC_MSG_ERROR(["you must enter a numeric mask."])
                    853:                ;;
                    854: esac])
                    855: AC_DEFINE_UNQUOTED(SUDO_UMASK, $sudo_umask, [The umask that the sudo-run prog should use.])
                    856: if test "$sudo_umask" = "0777"; then
                    857:     AC_MSG_RESULT(user)
                    858: else
                    859:     AC_MSG_RESULT($sudo_umask)
                    860: fi
                    861: 
                    862: 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.])],
                    863: [case $with_umask_override in
                    864:     yes)       AC_DEFINE(UMASK_OVERRIDE)
                    865:                umask_override=on
                    866:                ;;
                    867:     no)                umask_override=off
                    868:                ;;
                    869:     *)         AC_MSG_ERROR(["--with-umask-override does not take an argument."])
                    870:                ;;
                    871: esac])
                    872: 
                    873: AC_MSG_CHECKING(for default user to run commands as)
                    874: AC_ARG_WITH(runas-default, [AS_HELP_STRING([--with-runas-default], [User to run commands as (default is "root")])],
                    875: [case $with_runas_default in
                    876:     yes)       AC_MSG_ERROR(["must give --with-runas-default an argument."])
                    877:                ;;
                    878:     no)                AC_MSG_ERROR(["--without-runas-default not supported."])
                    879:                ;;
                    880:     *)         runas_default="$with_runas_default"
                    881:                ;;
                    882: esac])
                    883: AC_DEFINE_UNQUOTED(RUNAS_DEFAULT, "$runas_default", [The user sudo should run commands as by default.])
                    884: AC_MSG_RESULT([$runas_default])
                    885: 
                    886: AC_ARG_WITH(exempt, [AS_HELP_STRING([--with-exempt=group], [no passwd needed for users in this group])],
                    887: [case $with_exempt in
                    888:     yes)       AC_MSG_ERROR(["must give --with-exempt an argument."])
                    889:                ;;
                    890:     no)                AC_MSG_ERROR(["--without-exempt not supported."])
                    891:                ;;
                    892:     *)         AC_DEFINE_UNQUOTED(EXEMPTGROUP, "$with_exempt", [If defined, users in this group need not enter a passwd (ie "sudo").])
                    893:                AC_MSG_CHECKING(for group to be exempt from password)
                    894:                AC_MSG_RESULT([$with_exempt])
                    895:                ;;
                    896: esac])
                    897: 
                    898: AC_MSG_CHECKING(for editor that visudo should use)
                    899: AC_ARG_WITH(editor, [AS_HELP_STRING([--with-editor=path], [Default editor for visudo (defaults to vi)])],
                    900: [case $with_editor in
                    901:     yes)       AC_MSG_ERROR(["must give --with-editor an argument."])
                    902:                ;;
                    903:     no)                AC_MSG_ERROR(["--without-editor not supported."])
                    904:                ;;
                    905:     *)         AC_DEFINE_UNQUOTED(EDITOR, "$with_editor", [A colon-separated list of pathnames to be used as the editor for visudo.])
                    906:                AC_MSG_RESULT([$with_editor])
                    907:                editor="$with_editor"
                    908:                ;;
                    909: esac], [AC_DEFINE(EDITOR, _PATH_VI) AC_MSG_RESULT(vi)])
                    910: 
                    911: AC_MSG_CHECKING(whether to obey EDITOR and VISUAL environment variables)
                    912: AC_ARG_WITH(env-editor, [AS_HELP_STRING([--with-env-editor], [Use the environment variable EDITOR for visudo])],
                    913: [case $with_env_editor in
                    914:     yes)       env_editor=on
                    915:                ;;
                    916:     no)                env_editor=off
                    917:                ;;
                    918:     *)         AC_MSG_ERROR(["--with-env-editor does not take an argument."])
                    919:                ;;
                    920: esac])
                    921: if test "$env_editor" = "on"; then
                    922:     AC_DEFINE(ENV_EDITOR)
                    923:     AC_MSG_RESULT(yes)
                    924: else
                    925:     AC_MSG_RESULT(no)
                    926: fi
                    927: 
                    928: AC_MSG_CHECKING(number of tries a user gets to enter their password)
                    929: AC_ARG_WITH(passwd-tries, [AS_HELP_STRING([--with-passwd-tries], [number of tries to enter password (default is 3)])],
                    930: [case $with_passwd_tries in
                    931:     yes)       ;;
                    932:     no)                AC_MSG_ERROR(["--without-editor not supported."])
                    933:                ;;
                    934:     [[1-9]]*)  passwd_tries=$with_passwd_tries
                    935:                ;;
                    936:     *)         AC_MSG_ERROR(["you must enter the numer of tries, > 0"])
                    937:                ;;
                    938: esac])
                    939: AC_DEFINE_UNQUOTED(TRIES_FOR_PASSWORD, $passwd_tries, [The number of tries a user gets to enter their password.])
                    940: AC_MSG_RESULT($passwd_tries)
                    941: 
                    942: AC_MSG_CHECKING(time in minutes after which sudo will ask for a password again)
                    943: AC_ARG_WITH(timeout, [AS_HELP_STRING([--with-timeout], [minutes before sudo asks for passwd again (def is 5 minutes)])],
                    944: [case $with_timeout in
                    945:     yes)       ;;
                    946:     no)                timeout=0
                    947:                ;;
                    948:     [[0-9]]*)  timeout=$with_timeout
                    949:                ;;
                    950:     *)         AC_MSG_ERROR(["you must enter the numer of minutes."])
                    951:                ;;
                    952: esac])
                    953: AC_DEFINE_UNQUOTED(TIMEOUT, $timeout, [The number of minutes before sudo asks for a password again.])
                    954: AC_MSG_RESULT($timeout)
                    955: 
                    956: AC_MSG_CHECKING(time in minutes after the password prompt will time out)
                    957: AC_ARG_WITH(password-timeout, [AS_HELP_STRING([--with-password-timeout], [passwd prompt timeout in minutes (default is 5 minutes)])],
                    958: [case $with_password_timeout in
                    959:     yes)       ;;
                    960:     no)                password_timeout=0
                    961:                ;;
                    962:     [[0-9]]*)  password_timeout=$with_password_timeout
                    963:                ;;
                    964:     *)         AC_MSG_ERROR(["you must enter the numer of minutes."])
                    965:                ;;
                    966: esac])
                    967: AC_DEFINE_UNQUOTED(PASSWORD_TIMEOUT, $password_timeout, [The passwd prompt timeout (in minutes).])
                    968: AC_MSG_RESULT($password_timeout)
                    969: 
                    970: AC_MSG_CHECKING(whether to use per-tty ticket files)
                    971: AC_ARG_WITH(tty-tickets, [AS_HELP_STRING([--with-tty-tickets], [use a different ticket file for each tty])],
                    972: [case $with_tty_tickets in
                    973:     yes)       tty_tickets=on
                    974:                ;;
                    975:     no)                tty_tickets=off
                    976:                ;;
                    977:     *)         AC_MSG_ERROR(["--with-tty-tickets does not take an argument."])
                    978:                ;;
                    979: esac])
                    980: if test "$tty_tickets" = "off"; then
                    981:     AC_DEFINE(NO_TTY_TICKETS)
                    982:     AC_MSG_RESULT(no)
                    983: else
                    984:     AC_MSG_RESULT(yes)
                    985: fi
                    986: 
                    987: AC_MSG_CHECKING(whether to include insults)
                    988: AC_ARG_WITH(insults, [AS_HELP_STRING([--with-insults], [insult the user for entering an incorrect password])],
                    989: [case $with_insults in
                    990:     yes)       insults=on
                    991:                with_classic_insults=yes
                    992:                with_csops_insults=yes
                    993:                ;;
                    994:     disabled)  insults=off
                    995:                with_classic_insults=yes
                    996:                with_csops_insults=yes
                    997:                ;;
                    998:     no)                insults=off
                    999:                ;;
                   1000:     *)         AC_MSG_ERROR(["--with-insults does not take an argument."])
                   1001:                ;;
                   1002: esac])
                   1003: if test "$insults" = "on"; then
                   1004:     AC_DEFINE(USE_INSULTS)
                   1005:     AC_MSG_RESULT(yes)
                   1006: else
                   1007:     AC_MSG_RESULT(no)
                   1008: fi
                   1009: 
                   1010: AC_ARG_WITH(all-insults, [AS_HELP_STRING([--with-all-insults], [include all the sudo insult sets])],
                   1011: [case $with_all_insults in
                   1012:     yes)       with_classic_insults=yes
                   1013:                with_csops_insults=yes
                   1014:                with_hal_insults=yes
                   1015:                with_goons_insults=yes
                   1016:                ;;
                   1017:     no)                ;;
                   1018:     *)         AC_MSG_ERROR(["--with-all-insults does not take an argument."])
                   1019:                ;;
                   1020: esac])
                   1021: 
                   1022: AC_ARG_WITH(classic-insults, [AS_HELP_STRING([--with-classic-insults], [include the insults from the "classic" sudo])],
                   1023: [case $with_classic_insults in
                   1024:     yes)       AC_DEFINE(CLASSIC_INSULTS)
                   1025:                ;;
                   1026:     no)                ;;
                   1027:     *)         AC_MSG_ERROR(["--with-classic-insults does not take an argument."])
                   1028:                ;;
                   1029: esac])
                   1030: 
                   1031: AC_ARG_WITH(csops-insults, [AS_HELP_STRING([--with-csops-insults], [include CSOps insults])],
                   1032: [case $with_csops_insults in
                   1033:     yes)       AC_DEFINE(CSOPS_INSULTS)
                   1034:                ;;
                   1035:     no)                ;;
                   1036:     *)         AC_MSG_ERROR(["--with-csops-insults does not take an argument."])
                   1037:                ;;
                   1038: esac])
                   1039: 
                   1040: AC_ARG_WITH(hal-insults, [AS_HELP_STRING([--with-hal-insults], [include 2001-like insults])],
                   1041: [case $with_hal_insults in
                   1042:     yes)       AC_DEFINE(HAL_INSULTS)
                   1043:                ;;
                   1044:     no)                ;;
                   1045:     *)         AC_MSG_ERROR(["--with-hal-insults does not take an argument."])
                   1046:                ;;
                   1047: esac])
                   1048: 
                   1049: AC_ARG_WITH(goons-insults, [AS_HELP_STRING([--with-goons-insults], [include the insults from the "Goon Show"])],
                   1050: [case $with_goons_insults in
                   1051:     yes)       AC_DEFINE(GOONS_INSULTS)
                   1052:                ;;
                   1053:     no)                ;;
                   1054:     *)         AC_MSG_ERROR(["--with-goons-insults does not take an argument."])
                   1055:                ;;
                   1056: esac])
                   1057: 
                   1058: AC_ARG_WITH(nsswitch, [AS_HELP_STRING([--with-nsswitch[[=PATH]]], [path to nsswitch.conf])],
                   1059: [case $with_nsswitch in
                   1060:     no)                ;;
                   1061:     yes)       with_nsswitch="/etc/nsswitch.conf"
                   1062:                ;;
                   1063:     *)         ;;
                   1064: esac])
                   1065: 
                   1066: AC_ARG_WITH(ldap, [AS_HELP_STRING([--with-ldap[[=DIR]]], [enable LDAP support])],
                   1067: [case $with_ldap in
                   1068:     no)                ;;
                   1069:     *)         AC_DEFINE(HAVE_LDAP)
                   1070:                AC_MSG_CHECKING(whether to use sudoers from LDAP)
                   1071:                AC_MSG_RESULT(yes)
                   1072:                ;;
                   1073: esac])
                   1074: 
                   1075: AC_ARG_WITH(ldap-conf-file, [AS_HELP_STRING([--with-ldap-conf-file], [path to LDAP configuration file])])
                   1076: test -n "$with_ldap_conf_file" && ldap_conf="$with_ldap_conf_file"
                   1077: SUDO_DEFINE_UNQUOTED(_PATH_LDAP_CONF, "$ldap_conf", [Path to the ldap.conf file])
                   1078: 
                   1079: AC_ARG_WITH(ldap-secret-file, [AS_HELP_STRING([--with-ldap-secret-file], [path to LDAP secret password file])])
                   1080: test -n "$with_ldap_secret_file" && ldap_secret="$with_ldap_secret_file"
                   1081: SUDO_DEFINE_UNQUOTED(_PATH_LDAP_SECRET, "$ldap_secret", [Path to the ldap.secret file])
                   1082: 
                   1083: AC_ARG_WITH(pc-insults, [AS_HELP_STRING([--with-pc-insults], [replace politically incorrect insults with less offensive ones])],
                   1084: [case $with_pc_insults in
                   1085:     yes)       AC_DEFINE(PC_INSULTS)
                   1086:                ;;
                   1087:     no)                ;;
                   1088:     *)         AC_MSG_ERROR(["--with-pc-insults does not take an argument."])
                   1089:                ;;
                   1090: esac])
                   1091: 
                   1092: dnl include all insult sets on one line
                   1093: if test "$insults" = "on"; then
                   1094:     AC_MSG_CHECKING(which insult sets to include)
                   1095:     i=""
                   1096:     test "$with_goons_insults" = "yes" && i="goons ${i}"
                   1097:     test "$with_hal_insults" = "yes" && i="hal ${i}"
                   1098:     test "$with_csops_insults" = "yes" && i="csops ${i}"
                   1099:     test "$with_classic_insults" = "yes" && i="classic ${i}"
                   1100:     AC_MSG_RESULT([$i])
                   1101: fi
                   1102: 
                   1103: AC_MSG_CHECKING(whether to override the user's path)
                   1104: AC_ARG_WITH(secure-path, [AS_HELP_STRING([--with-secure-path], [override the user's path with a built-in one])],
                   1105: [case $with_secure_path in
                   1106:     yes)       with_secure_path="/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
                   1107:                AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
                   1108:                AC_MSG_RESULT([$with_secure_path])
                   1109:                secure_path="set to $with_secure_path"
                   1110:                ;;
                   1111:     no)                AC_MSG_RESULT(no)
                   1112:                ;;
                   1113:     *)         AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
                   1114:                AC_MSG_RESULT([$with_secure_path])
                   1115:                secure_path="set to F<$with_secure_path>"
                   1116:                ;;
                   1117: esac], AC_MSG_RESULT(no))
                   1118: 
                   1119: AC_MSG_CHECKING(whether to get ip addresses from the network interfaces)
                   1120: AC_ARG_WITH(interfaces, [AS_HELP_STRING([--without-interfaces], [don't try to read the ip addr of ether interfaces])],
                   1121: [case $with_interfaces in
                   1122:     yes)       AC_MSG_RESULT(yes)
                   1123:                ;;
                   1124:     no)                AC_DEFINE(STUB_LOAD_INTERFACES)
                   1125:                AC_MSG_RESULT(no)
                   1126:                ;;
                   1127:     *)         AC_MSG_ERROR(["--with-interfaces does not take an argument."])
                   1128:                ;;
                   1129: esac], AC_MSG_RESULT(yes))
                   1130: 
1.1.1.3   misho    1131: AC_ARG_WITH(stow, [AS_HELP_STRING([--with-stow], [deprecated])],
1.1       misho    1132: [case $with_stow in
1.1.1.3   misho    1133:     *)         AC_MSG_NOTICE([--with-stow option deprecated, now is defalt behavior])
1.1       misho    1134:                ;;
1.1.1.3   misho    1135: esac])
1.1       misho    1136: 
                   1137: AC_MSG_CHECKING(whether to use an askpass helper)
                   1138: AC_ARG_WITH(askpass, [AS_HELP_STRING([--with-askpass=PATH], [Fully qualified pathname of askpass helper])],
                   1139: [case $with_askpass in
                   1140:     yes)       AC_MSG_ERROR(["--with-askpass takes a path as an argument."])
                   1141:                ;;
                   1142:     no)                ;;
1.1.1.4   misho    1143:     *)         ;;
                   1144: esac], [
                   1145:     with_askpass=no
                   1146:     AC_MSG_RESULT(no)
                   1147: ])
                   1148: if test X"$with_askpass" != X"no"; then
                   1149:     SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, "$with_askpass")
                   1150: else
                   1151:     SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, NULL)
                   1152: fi
1.1       misho    1153: 
                   1154: AC_ARG_WITH(plugindir, [AS_HELP_STRING([--with-plugindir], [set directory to load plugins from])],
                   1155: [case $with_plugindir in
                   1156:     no)                AC_MSG_ERROR(["illegal argument: --without-plugindir."])
                   1157:                ;;
                   1158:     *)         ;;
1.1.1.4   misho    1159: esac], [with_plugindir="$libexecdir/sudo"])
1.1       misho    1160: 
1.1.1.3   misho    1161: AC_ARG_WITH(man, [AS_HELP_STRING([--with-man], [manual pages use man macros])],
                   1162: [case $with_man in
                   1163:     yes)       MANTYPE=man
                   1164:                ;;
                   1165:     no)                AC_MSG_ERROR(["--without-man not supported."])
                   1166:                ;;
                   1167:     *)         AC_MSG_ERROR(["ignoring unknown argument to --with-man: $with_man."])
                   1168:                ;;
                   1169: esac])
                   1170: 
                   1171: AC_ARG_WITH(mdoc, [AS_HELP_STRING([--with-mdoc], [manual pages use mdoc macros])],
                   1172: [case $with_mdoc in
                   1173:     yes)       MANTYPE=mdoc
                   1174:                ;;
                   1175:     no)                AC_MSG_ERROR(["--without-mdoc not supported."])
                   1176:                ;;
                   1177:     *)         AC_MSG_ERROR(["ignoring unknown argument to --with-mdoc: $with_mdoc."])
                   1178:                ;;
                   1179: esac])
                   1180: 
1.1       misho    1181: dnl
                   1182: dnl Options for --enable
                   1183: dnl
                   1184: 
                   1185: AC_MSG_CHECKING(whether to do user authentication by default)
                   1186: AC_ARG_ENABLE(authentication,
                   1187: [AS_HELP_STRING([--disable-authentication], [Do not require authentication by default])],
                   1188: [ case "$enableval" in
                   1189:     yes)       AC_MSG_RESULT(yes)
                   1190:                ;;
                   1191:     no)                AC_MSG_RESULT(no)
                   1192:                AC_DEFINE(NO_AUTHENTICATION)
                   1193:                ;;
                   1194:     *)         AC_MSG_RESULT(no)
                   1195:                AC_MSG_WARN([Ignoring unknown argument to --enable-authentication: $enableval])
                   1196:                ;;
                   1197:   esac
                   1198: ], AC_MSG_RESULT(yes))
                   1199: 
                   1200: AC_MSG_CHECKING(whether to disable running the mailer as root)
                   1201: AC_ARG_ENABLE(root-mailer,
                   1202: [AS_HELP_STRING([--disable-root-mailer], [Don't run the mailer as root, run as the user])],
                   1203: [ case "$enableval" in
                   1204:     yes)       AC_MSG_RESULT(no)
                   1205:                ;;
                   1206:     no)                AC_MSG_RESULT(yes)
                   1207:                AC_DEFINE(NO_ROOT_MAILER)
                   1208:                ;;
                   1209:     *)         AC_MSG_RESULT(no)
                   1210:                AC_MSG_WARN([Ignoring unknown argument to --enable-root-mailer: $enableval])
                   1211:                ;;
                   1212:   esac
                   1213: ], AC_MSG_RESULT(no))
                   1214: 
                   1215: AC_ARG_ENABLE(setreuid,
                   1216: [AS_HELP_STRING([--disable-setreuid], [Don't try to use the setreuid() function])],
                   1217: [ case "$enableval" in
                   1218:     no)                SKIP_SETREUID=yes
                   1219:                ;;
                   1220:     *)         ;;
                   1221:   esac
                   1222: ])
                   1223: 
                   1224: AC_ARG_ENABLE(setresuid,
                   1225: [AS_HELP_STRING([--disable-setresuid], [Don't try to use the setresuid() function])],
                   1226: [ case "$enableval" in
                   1227:     no)                SKIP_SETRESUID=yes
                   1228:                ;;
                   1229:     *)         ;;
                   1230:   esac
                   1231: ])
                   1232: 
                   1233: AC_MSG_CHECKING(whether to disable shadow password support)
                   1234: AC_ARG_ENABLE(shadow,
                   1235: [AS_HELP_STRING([--disable-shadow], [Never use shadow passwords])],
                   1236: [ case "$enableval" in
                   1237:     yes)       AC_MSG_RESULT(no)
                   1238:                ;;
                   1239:     no)                AC_MSG_RESULT(yes)
                   1240:                CHECKSHADOW="false"
                   1241:                ;;
                   1242:     *)         AC_MSG_RESULT(no)
                   1243:                AC_MSG_WARN([Ignoring unknown argument to --enable-shadow: $enableval])
                   1244:                ;;
                   1245:   esac
                   1246: ], AC_MSG_RESULT(no))
                   1247: 
                   1248: AC_MSG_CHECKING(whether root should be allowed to use sudo)
                   1249: AC_ARG_ENABLE(root-sudo,
                   1250: [AS_HELP_STRING([--disable-root-sudo], [Don't allow root to run sudo])],
                   1251: [ case "$enableval" in
                   1252:     yes)       AC_MSG_RESULT(yes)
                   1253:                ;;
                   1254:     no)                AC_DEFINE(NO_ROOT_SUDO)
                   1255:                AC_MSG_RESULT(no)
                   1256:                root_sudo=off
                   1257:                ;;
                   1258:     *)         AC_MSG_ERROR(["--enable-root-sudo does not take an argument."])
                   1259:                ;;
                   1260:   esac
                   1261: ], AC_MSG_RESULT(yes))
                   1262: 
                   1263: AC_MSG_CHECKING(whether to log the hostname in the log file)
                   1264: AC_ARG_ENABLE(log-host,
                   1265: [AS_HELP_STRING([--enable-log-host], [Log the hostname in the log file])],
                   1266: [ case "$enableval" in
                   1267:     yes)       AC_MSG_RESULT(yes)
                   1268:                AC_DEFINE(HOST_IN_LOG)
                   1269:                ;;
                   1270:     no)                AC_MSG_RESULT(no)
                   1271:                ;;
                   1272:     *)         AC_MSG_RESULT(no)
                   1273:                AC_MSG_WARN([Ignoring unknown argument to --enable-log-host: $enableval])
                   1274:                ;;
                   1275:   esac
                   1276: ], AC_MSG_RESULT(no))
                   1277: 
                   1278: AC_MSG_CHECKING(whether to invoke a shell if sudo is given no arguments)
                   1279: AC_ARG_ENABLE(noargs-shell,
                   1280: [AS_HELP_STRING([--enable-noargs-shell], [If sudo is given no arguments run a shell])],
                   1281: [ case "$enableval" in
                   1282:     yes)       AC_MSG_RESULT(yes)
                   1283:                AC_DEFINE(SHELL_IF_NO_ARGS)
                   1284:                ;;
                   1285:     no)                AC_MSG_RESULT(no)
                   1286:                ;;
                   1287:     *)         AC_MSG_RESULT(no)
                   1288:                AC_MSG_WARN([Ignoring unknown argument to --enable-noargs-shell: $enableval])
                   1289:                ;;
                   1290:   esac
                   1291: ], AC_MSG_RESULT(no))
                   1292: 
                   1293: AC_MSG_CHECKING(whether to set \$HOME to target user in shell mode)
                   1294: AC_ARG_ENABLE(shell-sets-home,
                   1295: [AS_HELP_STRING([--enable-shell-sets-home], [Set $HOME to target user in shell mode])],
                   1296: [ case "$enableval" in
                   1297:     yes)       AC_MSG_RESULT(yes)
                   1298:                AC_DEFINE(SHELL_SETS_HOME)
                   1299:                ;;
                   1300:     no)                AC_MSG_RESULT(no)
                   1301:                ;;
                   1302:     *)         AC_MSG_RESULT(no)
                   1303:                AC_MSG_WARN([Ignoring unknown argument to --enable-shell-sets-home: $enableval])
                   1304:                ;;
                   1305:   esac
                   1306: ], AC_MSG_RESULT(no))
                   1307: 
                   1308: AC_MSG_CHECKING(whether to disable 'command not found' messages)
                   1309: AC_ARG_ENABLE(path_info,
                   1310: [AS_HELP_STRING([--disable-path-info], [Print 'command not allowed' not 'command not found'])],
                   1311: [ case "$enableval" in
                   1312:     yes)       AC_MSG_RESULT(no)
                   1313:                ;;
                   1314:     no)                AC_MSG_RESULT(yes)
                   1315:                AC_DEFINE(DONT_LEAK_PATH_INFO)
                   1316:                path_info=off
                   1317:                ;;
                   1318:     *)         AC_MSG_RESULT(no)
                   1319:                AC_MSG_WARN([Ignoring unknown argument to --enable-path-info: $enableval])
                   1320:                ;;
                   1321:   esac
                   1322: ], AC_MSG_RESULT(no))
                   1323: 
                   1324: AC_MSG_CHECKING(whether to enable environment debugging)
                   1325: AC_ARG_ENABLE(env_debug,
                   1326: [AS_HELP_STRING([--enable-env-debug], [Whether to enable environment debugging.])],
                   1327: [ case "$enableval" in
                   1328:     yes)       AC_MSG_RESULT(yes)
                   1329:                AC_DEFINE(ENV_DEBUG)
                   1330:                ;;
                   1331:     no)                AC_MSG_RESULT(no)
                   1332:                ;;
                   1333:     *)         AC_MSG_RESULT(no)
                   1334:                AC_MSG_WARN([Ignoring unknown argument to --enable-env-debug: $enableval])
                   1335:                ;;
                   1336:   esac
                   1337: ], AC_MSG_RESULT(no))
                   1338: 
                   1339: AC_ARG_ENABLE(zlib,
                   1340: [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])],
                   1341: [], [enable_zlib=yes])
                   1342: 
                   1343: AC_MSG_CHECKING(whether to enable environment resetting by default)
                   1344: AC_ARG_ENABLE(env_reset,
                   1345: [AS_HELP_STRING([--enable-env-reset], [Whether to enable environment resetting by default.])],
                   1346: [ case "$enableval" in
                   1347:     yes)       env_reset=on
                   1348:                ;;
                   1349:     no)                env_reset=off
                   1350:                ;;
                   1351:     *)         env_reset=on
                   1352:                AC_MSG_WARN([Ignoring unknown argument to --enable-env-reset: $enableval])
                   1353:                ;;
                   1354:   esac
                   1355: ])
                   1356: if test "$env_reset" = "on"; then
                   1357:     AC_MSG_RESULT(yes)
1.1.1.2   misho    1358:     AC_DEFINE(ENV_RESET, 1)
1.1       misho    1359: else
                   1360:     AC_MSG_RESULT(no)
1.1.1.2   misho    1361:     AC_DEFINE(ENV_RESET, 0)
1.1       misho    1362: fi
                   1363: 
                   1364: AC_ARG_ENABLE(warnings,
                   1365: [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])],
                   1366: [ case "$enableval" in
                   1367:     yes)    ;;
                   1368:     no)            ;;
                   1369:     *)     AC_MSG_WARN([Ignoring unknown argument to --enable-warnings: $enableval])
                   1370:            ;;
                   1371:   esac
                   1372: ])
                   1373: 
                   1374: AC_ARG_ENABLE(werror,
                   1375: [AS_HELP_STRING([--enable-werror], [Whether to enable the -Werror compiler option])],
                   1376: [ case "$enableval" in
                   1377:     yes)    ;;
                   1378:     no)            ;;
                   1379:     *)     AC_MSG_WARN([Ignoring unknown argument to --enable-werror: $enableval])
                   1380:            ;;
                   1381:   esac
                   1382: ])
                   1383: 
1.1.1.3   misho    1384: AC_ARG_ENABLE(hardening,
                   1385: [AS_HELP_STRING([--disable-hardening], [Do not use compiler/linker exploit mitigation options])],
                   1386: [], [enable_hardening=yes])
                   1387: 
                   1388: AC_ARG_ENABLE(pie,
1.1.1.4   misho    1389: [AS_HELP_STRING([--enable-pie], [Build sudo as a position independent executable.])])
1.1.1.3   misho    1390: 
1.1       misho    1391: AC_ARG_ENABLE(admin-flag,
                   1392: [AS_HELP_STRING([--enable-admin-flag], [Whether to create a Ubuntu-style admin flag file])],
                   1393: [ case "$enableval" in
                   1394:     yes)    AC_DEFINE(USE_ADMIN_FLAG)
                   1395:            ;;
                   1396:     no)            ;;
                   1397:     *)     AC_MSG_WARN([Ignoring unknown argument to --enable-admin-flag: $enableval])
                   1398:            ;;
                   1399:   esac
                   1400: ])
                   1401: 
                   1402: AC_ARG_ENABLE(nls,
                   1403: [AS_HELP_STRING([--disable-nls], [Disable natural language support using gettext])],
                   1404: [], [enable_nls=yes])
                   1405: 
1.1.1.4   misho    1406: AC_ARG_ENABLE(rpath,
                   1407: [AS_HELP_STRING([--disable-rpath], [Disable passing of -Rpath to the linker])],
                   1408: [], [enable_rpath=yes])
                   1409: 
1.1       misho    1410: AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])],
                   1411: [case $with_selinux in
                   1412:     yes)       SELINUX_USAGE="[[-r role]] [[-t type]] "
                   1413:                AC_DEFINE(HAVE_SELINUX)
                   1414:                SUDO_LIBS="${SUDO_LIBS} -lselinux"
                   1415:                SUDO_OBJS="${SUDO_OBJS} selinux.o"
                   1416:                PROGS="${PROGS} sesh"
                   1417:                SEMAN=1
                   1418:                AC_CHECK_LIB([selinux], [setkeycreatecon],
                   1419:                    [AC_DEFINE(HAVE_SETKEYCREATECON)])
                   1420:                ;;
                   1421:     no)                ;;
                   1422:     *)         AC_MSG_ERROR(["--with-selinux does not take an argument."])
                   1423:                ;;
1.1.1.4   misho    1424: esac], [with_selinux=no])
1.1       misho    1425: 
                   1426: dnl
                   1427: dnl gss_krb5_ccache_name() may not work on Heimdal so we don't use it by default
                   1428: dnl
                   1429: AC_ARG_ENABLE(gss_krb5_ccache_name,
                   1430: [AS_HELP_STRING([--enable-gss-krb5-ccache-name], [Use GSS-API to set the Kerberos V cred cache name])],
                   1431: [check_gss_krb5_ccache_name=$enableval], [check_gss_krb5_ccache_name=no])
                   1432: 
                   1433: dnl
                   1434: dnl C compiler checks
                   1435: dnl
                   1436: AC_SEARCH_LIBS([strerror], [cposix])
                   1437: AC_PROG_CPP
                   1438: AC_CHECK_TOOL(AR, ar, false)
                   1439: AC_CHECK_TOOL(RANLIB, ranlib, :)
                   1440: if test X"$AR" = X"false"; then
                   1441:     AC_MSG_ERROR([the "ar" utility is required to build sudo])
                   1442: fi
                   1443: 
                   1444: if test "x$ac_cv_prog_cc_c89" = "xno"; then
                   1445:     AC_MSG_ERROR([Sudo version $PACKAGE_VERSION requires an ANSI C compiler to build.])
                   1446: fi
                   1447: 
                   1448: dnl
                   1449: dnl If the user specified --disable-static, override them or we'll
                   1450: dnl be unable to build the executables in the sudoers plugin dir.
                   1451: dnl
                   1452: if test "$enable_static" = "no"; then
                   1453:     AC_MSG_WARN([Ignoring --disable-static, sudo does not install static libs])
                   1454:     enable_static=yes
                   1455: fi
                   1456: 
                   1457: dnl
                   1458: dnl Libtool setup, we require libtool 2.2.6b or higher
                   1459: dnl
                   1460: AC_CANONICAL_HOST
                   1461: AC_CONFIG_MACRO_DIR([m4])
                   1462: LT_PREREQ([2.2.6b])
                   1463: LT_INIT([dlopen])
                   1464: 
                   1465: dnl
1.1.1.4   misho    1466: dnl Allow the user to specify an alternate libtool.
                   1467: dnl XXX - should be able to skip LT_INIT if we are using a different libtool
                   1468: dnl
                   1469: AC_ARG_WITH(libtool, [AS_HELP_STRING([--with-libtool=PATH], [specify path to libtool])],
                   1470: [case $with_libtool in
                   1471:     yes|builtin) ;;
                   1472:     no)                AC_MSG_ERROR(["--without-libtool not supported."])
                   1473:                ;;
                   1474:     system)    LIBTOOL=libtool
                   1475:                ;;
                   1476:     *)         LIBTOOL="$with_libtool"
                   1477:                ;;
                   1478: esac])
                   1479: 
                   1480: dnl
1.1       misho    1481: dnl Defer with_noexec until after libtool magic runs
                   1482: dnl
                   1483: if test "$enable_shared" = "no"; then
                   1484:     with_noexec=no
                   1485:     enable_dlopen=no
                   1486:     lt_cv_dlopen=none
                   1487:     lt_cv_dlopen_libs=
1.1.1.2   misho    1488:     ac_cv_func_dlopen=no
1.1.1.4   misho    1489:     LT_LDFLAGS=-static
1.1       misho    1490: else
                   1491:     eval _shrext="$shrext_cmds"
                   1492:     # Darwin uses .dylib for libraries but .so for modules
                   1493:     if test X"$_shrext" = X".dylib"; then
                   1494:        SOEXT=".so"
1.1.1.5 ! misho    1495:        SHLIB_EXT=".dylib"
1.1       misho    1496:     else
                   1497:        SOEXT="$_shrext"
1.1.1.5 ! misho    1498:        SHLIB_EXT="$_shrext"
1.1       misho    1499:     fi
                   1500: fi
                   1501: AC_MSG_CHECKING(path to sudo_noexec.so)
                   1502: AC_ARG_WITH(noexec, [AS_HELP_STRING([--with-noexec[=PATH]], [fully qualified pathname of sudo_noexec.so])],
                   1503: [case $with_noexec in
1.1.1.4   misho    1504:     yes)       with_noexec="$libexecdir/sudo/sudo_noexec.so"
1.1       misho    1505:                ;;
                   1506:     no)                ;;
                   1507:     *)         ;;
1.1.1.4   misho    1508: esac], [with_noexec="$libexecdir/sudo/sudo_noexec.so"])
1.1       misho    1509: AC_MSG_RESULT($with_noexec)
1.1.1.4   misho    1510: NOEXECFILE="sudo_noexec.so"
1.1.1.3   misho    1511: NOEXECDIR="`echo $with_noexec|sed -e 's:^${\([[^}]]*\)}:$(\1):' -e 's:^\(.*\)/[[^/]]*:\1:'`"
1.1       misho    1512: 
                   1513: dnl
                   1514: dnl Find programs we use
                   1515: dnl
1.1.1.3   misho    1516: AC_PATH_PROG(UNAMEPROG, [uname], [uname])
                   1517: AC_PATH_PROG(TRPROG, [tr], [tr])
                   1518: AC_PATH_PROG(MANDOCPROG, [mandoc], [mandoc])
                   1519: if test "$MANDOCPROG" != "mandoc"; then
                   1520:     : ${MANTYPE='mdoc'}
1.1       misho    1521: else
1.1.1.3   misho    1522:     AC_PATH_PROG(NROFFPROG, [nroff])
                   1523:     if test -n "$NROFFPROG"; then
                   1524:        test -n "$MANTYPE" && sudo_cv_var_mantype="$MANTYPE"
                   1525:        AC_CACHE_CHECK([which macro set to use for manual pages],
                   1526:            [sudo_cv_var_mantype],
                   1527:            [
                   1528:                sudo_cv_var_mantype="man"
                   1529:                echo ".Sh NAME" > conftest
                   1530:                echo ".Nm sudo" >> conftest
                   1531:                echo ".Nd sudo" >> conftest
                   1532:                echo ".Sh DESCRIPTION" >> conftest
                   1533:                echo "sudo" >> conftest
                   1534:                if $NROFFPROG -mdoc conftest >/dev/null 2>&1; then
                   1535:                    sudo_cv_var_mantype="mdoc"
                   1536:                fi
                   1537:                rm -f conftest
                   1538:            ]
                   1539:        )
                   1540:        MANTYPE="$sudo_cv_var_mantype"
                   1541:     else
                   1542:        MANTYPE=cat
                   1543:        MANDIRTYPE=cat
                   1544:        mansrcdir='$(srcdir)'
                   1545:     fi
1.1       misho    1546: fi
                   1547: 
                   1548: dnl
                   1549: dnl What kind of beastie are we being run on?
                   1550: dnl Barf if config.cache was generated on another host.
                   1551: dnl
                   1552: if test -n "$sudo_cv_prev_host"; then
                   1553:     if test "$sudo_cv_prev_host" != "$host"; then
                   1554:        AC_MSG_ERROR([config.cache was created on a different host; remove it and re-run configure.])
                   1555:     else
                   1556:        AC_MSG_CHECKING(previous host type)
                   1557:        AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
                   1558:        AC_MSG_RESULT([$sudo_cv_prev_host])
                   1559:     fi
                   1560: else
                   1561:     # this will produce no output since there is no cached value
                   1562:     AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
                   1563: fi
                   1564: 
                   1565: dnl
                   1566: dnl We want to be able to differentiate between different rev's
                   1567: dnl
                   1568: if test -n "$host_os"; then
                   1569:     OS=`echo $host_os | sed 's/[[0-9]].*//'`
                   1570:     OSREV=`echo $host_os | sed 's/^[[^0-9\.]]*\([[0-9\.]]*\).*$/\1/'`
                   1571:     OSMAJOR=`echo $OSREV | sed 's/\..*$//'`
                   1572: else
                   1573:     OS="unknown"
                   1574:     OSREV=0
                   1575:     OSMAJOR=0
                   1576: fi
                   1577: 
                   1578: case "$host" in
                   1579:     *-*-sunos4*)
1.1.1.2   misho    1580:                # LD_PRELOAD is space-delimited
                   1581:                RTLD_PRELOAD_DELIM=" "
                   1582: 
1.1       misho    1583:                # getcwd(3) opens a pipe to getpwd(1)!?!
                   1584:                BROKEN_GETCWD=1
                   1585: 
                   1586:                # system headers lack prototypes but gcc helps...
                   1587:                if test -n "$GCC"; then
                   1588:                    OSDEFS="${OSDEFS} -D__USE_FIXED_PROTOTYPES__"
                   1589:                fi
                   1590: 
                   1591:                shadow_funcs="getpwanam issecure"
                   1592:                ;;
                   1593:     *-*-solaris2*)
1.1.1.2   misho    1594:                # LD_PRELOAD is space-delimited
                   1595:                RTLD_PRELOAD_DELIM=" "
                   1596: 
1.1.1.4   misho    1597:                # Solaris-specific initialization
                   1598:                OS_INIT=os_init_solaris
                   1599:                SUDO_OBJS="${SUDO_OBJS} solaris.o"
                   1600: 
1.1       misho    1601:                # To get the crypt(3) prototype (so we pass -Wall)
                   1602:                OSDEFS="${OSDEFS} -D__EXTENSIONS__"
                   1603:                # AFS support needs -lucb
                   1604:                if test "$with_AFS" = "yes"; then
                   1605:                    AFS_LIBS="-lc -lucb"
                   1606:                fi
                   1607:                : ${mansectsu='1m'}
                   1608:                : ${mansectform='4'}
                   1609:                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1.1.1.3   misho    1610:                AC_CHECK_FUNCS(priv_set, [PSMAN=1])
1.1       misho    1611:                ;;
                   1612:     *-*-aix*)
                   1613:                # To get all prototypes (so we pass -Wall)
                   1614:                OSDEFS="${OSDEFS} -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT"
                   1615:                SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} -Wl,-bI:\$(srcdir)/aixcrypt.exp"
                   1616: 
                   1617:                # On AIX 6 and higher default to PAM, else default to LAM
                   1618:                if test $OSMAJOR -ge 6; then
                   1619:                    if test X"$with_pam" = X""; then
                   1620:                        AUTH_EXCL_DEF="PAM"
                   1621:                    fi
                   1622:                else
                   1623:                    if test X"$with_aixauth" = X""; then
                   1624:                        AC_CHECK_FUNCS(authenticate, [AUTH_EXCL_DEF="AIX_AUTH"])
                   1625:                    fi
                   1626:                fi
                   1627: 
                   1628:                # AIX analog of nsswitch.conf, enabled by default
                   1629:                AC_ARG_WITH(netsvc, [AS_HELP_STRING([--with-netsvc[[=PATH]]], [path to netsvc.conf])],
                   1630:                [case $with_netsvc in
                   1631:                    no)         ;;
                   1632:                    yes)        with_netsvc="/etc/netsvc.conf"
                   1633:                                ;;
                   1634:                    *)          ;;
                   1635:                esac])
                   1636:                if test -z "$with_nsswitch" -a -z "$with_netsvc"; then
                   1637:                    with_netsvc="/etc/netsvc.conf"
                   1638:                fi
                   1639: 
                   1640:                # LDR_PRELOAD is only supported in AIX 5.3 and later
                   1641:                if test $OSMAJOR -lt 5; then
                   1642:                    with_noexec=no
1.1.1.2   misho    1643:                else
                   1644:                    RTLD_PRELOAD_VAR="LDR_PRELOAD"
1.1       misho    1645:                fi
                   1646: 
                   1647:                # AIX-specific functions
1.1.1.4   misho    1648:                AC_CHECK_FUNCS(getuserattr setauthdb setrlimit64)
1.1       misho    1649:                COMMON_OBJS="$COMMON_OBJS aix.lo"
                   1650:                ;;
                   1651:     *-*-hiuxmpp*)
                   1652:                : ${mansectsu='1m'}
                   1653:                : ${mansectform='4'}
1.1.1.3   misho    1654: 
                   1655:                # HP-UX shared libs must be executable
                   1656:                SHLIB_MODE=0755
1.1       misho    1657:                ;;
                   1658:     *-*-hpux*)
                   1659:                # AFS support needs -lBSD
                   1660:                if test "$with_AFS" = "yes"; then
                   1661:                    AFS_LIBS="-lc -lBSD"
                   1662:                fi
                   1663:                : ${mansectsu='1m'}
                   1664:                : ${mansectform='4'}
                   1665: 
1.1.1.3   misho    1666:                # HP-UX shared libs must be executable
                   1667:                SHLIB_MODE=0755
                   1668: 
1.1       misho    1669:                # The HP bundled compiler cannot generate shared libs
                   1670:                if test -z "$GCC"; then
                   1671:                    AC_CACHE_CHECK([for HP bundled C compiler],
                   1672:                        [sudo_cv_var_hpccbundled],
                   1673:                        [if $CC -V 2>&1 | grep '^(Bundled)' >/dev/null 2>&1; then
                   1674:                            sudo_cv_var_hpccbundled=yes
                   1675:                        else
                   1676:                            sudo_cv_var_hpccbundled=no
                   1677:                        fi]
                   1678:                    )
                   1679:                    if test "$sudo_cv_var_hpccbundled" = "yes"; then
                   1680:                        AC_MSG_ERROR([The HP bundled C compiler is unable to build Sudo, you must use gcc or the HP ANSI C compiler instead.])
                   1681:                    fi
                   1682:                fi
                   1683: 
                   1684:                # Build PA-RISC1.1 objects for better portability
                   1685:                case "$host_cpu" in
                   1686:                    hppa[[2-9]]*)
                   1687:                        _CFLAGS="$CFLAGS"
                   1688:                        if test -n "$GCC"; then
                   1689:                            portable_flag="-march=1.1"
                   1690:                        else
                   1691:                            portable_flag="+DAportable"
                   1692:                        fi
                   1693:                        CFLAGS="$CFLAGS $portable_flag"
                   1694:                        AC_CACHE_CHECK([whether $CC understands $portable_flag],
                   1695:                            [sudo_cv_var_daportable],
                   1696:                            [AC_LINK_IFELSE(
                   1697:                                [AC_LANG_PROGRAM([[]], [[]])],
                   1698:                                    [sudo_cv_var_daportable=yes],
                   1699:                                    [sudo_cv_var_daportable=no]
                   1700:                                )
                   1701:                            ]
                   1702:                        )
                   1703:                        if test X"$sudo_cv_var_daportable" != X"yes"; then
                   1704:                            CFLAGS="$_CFLAGS"
                   1705:                        fi
                   1706:                        ;;
                   1707:                esac
                   1708: 
1.1.1.4   misho    1709:                case "$host_os" in
                   1710:                        hpux[[1-8]].*)
1.1       misho    1711:                            AC_DEFINE(BROKEN_SYSLOG)
                   1712:                        ;;
1.1.1.4   misho    1713:                        hpux9.*)
1.1       misho    1714:                            AC_DEFINE(BROKEN_SYSLOG)
                   1715: 
                   1716:                            shadow_funcs="getspwuid"
                   1717: 
                   1718:                            # DCE support (requires ANSI C compiler)
                   1719:                            if test "$with_DCE" = "yes"; then
                   1720:                                # order of libs in 9.X is important. -lc_r must be last
                   1721:                                SUDOERS_LIBS="${SUDOERS_LIBS} -ldce -lM -lc_r"
                   1722:                                LIBS="${LIBS} -ldce -lM -lc_r"
1.1.1.4   misho    1723:                                SUDO_APPEND_CPPFLAGS(-D_REENTRANT)
                   1724:                                SUDO_APPEND_CPPFLAGS(-I/usr/include/reentrant)
1.1       misho    1725:                            fi
                   1726:                        ;;
1.1.1.4   misho    1727:                        hpux10.*)
1.1       misho    1728:                            shadow_funcs="getprpwnam iscomsec"
                   1729:                            shadow_libs="-lsec"
                   1730:                            # HP-UX 10.20 libc has an incompatible getline
                   1731:                            ac_cv_func_getline="no"
                   1732:                        ;;
                   1733:                        *)
                   1734:                            shadow_funcs="getspnam iscomsec"
                   1735:                            shadow_libs="-lsec"
                   1736:                            test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                   1737:                        ;;
                   1738:                esac
1.1.1.4   misho    1739:                AC_CHECK_FUNCS(pstat_getproc)
1.1       misho    1740:                ;;
                   1741:     *-dec-osf*)
                   1742:                # ignore envariables wrt dynamic lib path
1.1.1.3   misho    1743:                # XXX - sudo LDFLAGS instead?
1.1       misho    1744:                SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} -Wl,-no_library_replacement"
                   1745: 
                   1746:                : ${CHECKSIA='true'}
                   1747:                AC_MSG_CHECKING(whether to disable sia support on Digital UNIX)
                   1748:                AC_ARG_ENABLE(sia,
                   1749:                [AS_HELP_STRING([--disable-sia], [Disable SIA on Digital UNIX])],
                   1750:                [ case "$enableval" in
                   1751:                    yes)        AC_MSG_RESULT(no)
                   1752:                                CHECKSIA=true
                   1753:                                ;;
                   1754:                    no)         AC_MSG_RESULT(yes)
                   1755:                                CHECKSIA=false
                   1756:                                ;;
                   1757:                    *)          AC_MSG_RESULT(no)
                   1758:                                AC_MSG_WARN([Ignoring unknown argument to --enable-sia: $enableval])
                   1759:                                ;;
                   1760:                  esac
                   1761:                ], AC_MSG_RESULT(no))
                   1762: 
                   1763:                shadow_funcs="getprpwnam dispcrypt"
                   1764:                # OSF/1 4.x and higher need -ldb too
                   1765:                if test $OSMAJOR -lt 4; then
                   1766:                    shadow_libs="-lsecurity -laud -lm"
                   1767:                else
                   1768:                    shadow_libs="-lsecurity -ldb -laud -lm"
                   1769:                fi
                   1770: 
                   1771:                # use SIA by default, if we have it
                   1772:                test "$CHECKSIA" = "true" && AUTH_EXCL_DEF="SIA"
                   1773: 
                   1774:                #
                   1775:                # Some versions of Digital Unix ship with a broken
                   1776:                # copy of prot.h, which we need for shadow passwords.
                   1777:                # XXX - make should remove this as part of distclean
                   1778:                #
                   1779:                AC_MSG_CHECKING([for broken prot.h])
                   1780:                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
                   1781: #include <sys/types.h>
                   1782: #include <sys/security.h>
                   1783: #include <prot.h>
                   1784:                ]], [[exit(0);]])], [AC_MSG_RESULT(no)], [AC_MSG_RESULT([yes, fixing locally])
                   1785:                sed 's:<acl.h>:<sys/acl.h>:g' < /usr/include/prot.h > prot.h
                   1786:                ])
1.1.1.2   misho    1787:                # ":DEFAULT" must be appended to _RLD_LIST
                   1788:                RTLD_PRELOAD_VAR="_RLD_LIST"
                   1789:                RTLD_PRELOAD_DEFAULT="DEFAULT"
1.1       misho    1790:                : ${mansectsu='8'}
                   1791:                : ${mansectform='4'}
                   1792:                ;;
                   1793:     *-*-irix*)
                   1794:                OSDEFS="${OSDEFS} -D_BSD_TYPES"
                   1795:                if test -z "$NROFFPROG"; then
                   1796:                    if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
                   1797:                        if test -d /usr/share/catman/local; then
                   1798:                            mandir="/usr/share/catman/local"
                   1799:                        else
                   1800:                            mandir="/usr/catman/local"
                   1801:                        fi
                   1802:                    fi
1.1.1.3   misho    1803:                    # Compress cat pages with pack
                   1804:                    MANCOMPRESS='pack'
                   1805:                    MANCOMPRESSEXT='.z'
1.1       misho    1806:                else
                   1807:                    if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
                   1808:                        if test -d "/usr/share/man/local"; then
                   1809:                            mandir="/usr/share/man/local"
                   1810:                        else
                   1811:                            mandir="/usr/man/local"
                   1812:                        fi
                   1813:                    fi
                   1814:                fi
                   1815:                # IRIX <= 4 needs -lsun
                   1816:                if test "$OSMAJOR" -le 4; then
                   1817:                    AC_CHECK_LIB(sun, getpwnam, [LIBS="${LIBS} -lsun"])
                   1818:                fi
1.1.1.2   misho    1819:                # ":DEFAULT" must be appended to _RLD_LIST
                   1820:                RTLD_PRELOAD_VAR="_RLD_LIST"
                   1821:                RTLD_PRELOAD_DEFAULT="DEFAULT"
1.1       misho    1822:                : ${mansectsu='1m'}
                   1823:                : ${mansectform='4'}
                   1824:                ;;
                   1825:     *-*-linux*|*-*-k*bsd*-gnu)
                   1826:                OSDEFS="${OSDEFS} -D_GNU_SOURCE"
                   1827:                # Some Linux versions need to link with -lshadow
                   1828:                shadow_funcs="getspnam"
                   1829:                shadow_libs_optional="-lshadow"
                   1830:                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                   1831:                ;;
                   1832:     *-convex-bsd*)
                   1833:                OSDEFS="${OSDEFS} -D_CONVEX_SOURCE"
                   1834:                if test -z "$GCC"; then
                   1835:                    CFLAGS="${CFLAGS} -D__STDC__"
                   1836:                fi
                   1837: 
                   1838:                shadow_defs="-D_AUDIT -D_ACL -DSecureWare"
                   1839:                shadow_funcs="getprpwnam"
                   1840:                shadow_libs="-lprot"
                   1841:                ;;
                   1842:     *-*-ultrix*)
                   1843:                OS="ultrix"
                   1844:                shadow_funcs="getauthuid"
                   1845:                shadow_libs="-lauth"
                   1846:                ;;
                   1847:     *-*-riscos*)
                   1848:                LIBS="${LIBS} -lsun -lbsd"
1.1.1.4   misho    1849:                SUDO_APPEND_CPPFLAGS(-I/usr/include)
                   1850:                SUDO_APPEND_CPPFLAGS(-I/usr/include/bsd)
1.1       misho    1851:                OSDEFS="${OSDEFS} -D_MIPS"
                   1852:                : ${mansectsu='1m'}
                   1853:                : ${mansectform='4'}
                   1854:                ;;
                   1855:     *-*-isc*)
                   1856:                OSDEFS="${OSDEFS} -D_ISC"
                   1857:                LIB_CRYPT=1
                   1858:                SUDOERS_LIBS="${SUDOERS_LIBS} -lcrypt"
                   1859: 
                   1860:                shadow_funcs="getspnam"
                   1861:                shadow_libs="-lsec"
                   1862: 
                   1863:                : ${mansectsu='1m'}
                   1864:                : ${mansectform='4'}
                   1865:                ;;
                   1866:     *-*-sco*|*-sco-*)
                   1867:                shadow_funcs="getprpwnam"
                   1868:                shadow_libs="-lprot -lx"
                   1869:                : ${mansectsu='1m'}
                   1870:                : ${mansectform='4'}
                   1871:                ;;
                   1872:     m88k-motorola-sysv*)
                   1873:                # motorolla's cc (a variant of gcc) does -O but not -O2
                   1874:                CFLAGS=`echo $CFLAGS | sed 's/-O2/-O/g'`
                   1875:                : ${mansectsu='1m'}
                   1876:                : ${mansectform='4'}
                   1877:                ;;
                   1878:     *-sequent-sysv*)
                   1879:                shadow_funcs="getspnam"
                   1880:                shadow_libs="-lsec"
                   1881:                : ${mansectsu='1m'}
                   1882:                : ${mansectform='4'}
                   1883:                ;;
                   1884:     *-ncr-sysv4*|*-ncr-sysvr4*)
                   1885:                AC_CHECK_LIB(c89, strcasecmp, [LIBS="${LIBS} -lc89"])
                   1886:                : ${mansectsu='1m'}
                   1887:                : ${mansectform='4'}
                   1888:                ;;
                   1889:     *-ccur-sysv4*|*-ccur-sysvr4*)
                   1890:                LIBS="${LIBS} -lgen"
                   1891:                : ${mansectsu='1m'}
                   1892:                : ${mansectform='4'}
                   1893:                ;;
                   1894:     *-*-bsdi*)
                   1895:                SKIP_SETREUID=yes
                   1896:                # Check for newer BSD auth API
                   1897:                if test -z "$with_bsdauth"; then
                   1898:                    AC_CHECK_FUNCS(auth_challenge, [AUTH_EXCL_DEF="BSD_AUTH"])
                   1899:                fi
                   1900:                ;;
                   1901:     *-*-freebsd*)
                   1902:                # FreeBSD has a real setreuid(2) starting with 2.1 and
                   1903:                # backported to 2.0.5.  We just take 2.1 and above...
                   1904:                case "$OSREV" in
                   1905:                0.*|1.*|2.0*)
                   1906:                    SKIP_SETREUID=yes
                   1907:                    ;;
                   1908:                esac
                   1909:                OSDEFS="${OSDEFS} -D_BSD_SOURCE"
                   1910:                if test "${with_skey-'no'}" = "yes"; then
                   1911:                     SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
                   1912:                fi
                   1913:                CHECKSHADOW="false"
                   1914:                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                   1915:                : ${with_logincap='maybe'}
                   1916:                ;;
                   1917:     *-*-*openbsd*)
1.1.1.4   misho    1918:                # OpenBSD-specific initialization
                   1919:                OS_INIT=os_init_openbsd
                   1920:                SUDO_OBJS="${SUDO_OBJS} openbsd.o"
                   1921: 
1.1       misho    1922:                # OpenBSD has a real setreuid(2) starting with 3.3 but
                   1923:                # we will use setresuid(2) instead.
                   1924:                SKIP_SETREUID=yes
                   1925:                OSDEFS="${OSDEFS} -D_BSD_SOURCE"
                   1926:                CHECKSHADOW="false"
                   1927:                # OpenBSD >= 3.0 supports BSD auth
                   1928:                if test -z "$with_bsdauth"; then
                   1929:                    if test "$OSMAJOR" -ge 3; then
                   1930:                        AUTH_EXCL_DEF="BSD_AUTH"
                   1931:                    fi
                   1932:                fi
                   1933:                : ${with_logincap='maybe'}
                   1934:                ;;
                   1935:     *-*-*netbsd*)
                   1936:                # NetBSD has a real setreuid(2) starting with 1.3.2
                   1937:                case "$OSREV" in
                   1938:                0.9*|1.[[012]]*|1.3|1.3.1)
                   1939:                    SKIP_SETREUID=yes
                   1940:                    ;;
                   1941:                esac
                   1942:                CHECKSHADOW="false"
                   1943:                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                   1944:                : ${with_logincap='maybe'}
                   1945:                ;;
                   1946:     *-*-dragonfly*)
                   1947:                OSDEFS="${OSDEFS} -D_BSD_SOURCE"
                   1948:                if test "${with_skey-'no'}" = "yes"; then
                   1949:                     SUDOERS_LIBS="${SUDOERS_LIBS} -lmd"
                   1950:                fi
                   1951:                CHECKSHADOW="false"
                   1952:                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                   1953:                : ${with_logincap='yes'}
                   1954:                ;;
                   1955:     *-*-*bsd*)
                   1956:                CHECKSHADOW="false"
                   1957:                ;;
                   1958:     *-*-darwin*)
                   1959:                # Darwin has a real setreuid(2) starting with 9.0
                   1960:                if test $OSMAJOR -lt 9; then
                   1961:                    SKIP_SETREUID=yes
                   1962:                fi
                   1963:                CHECKSHADOW="false"
                   1964:                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                   1965:                : ${with_logincap='yes'}
1.1.1.5 ! misho    1966:                # Darwin 8 and above can interpose library symbols cleanly
        !          1967:                if test $OSMAJOR -ge 8; then
        !          1968:                    AC_DEFINE(HAVE___INTERPOSE)
        !          1969:                    dlyld_interpose=yes
        !          1970:                else
        !          1971:                    RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
        !          1972:                fi
1.1.1.2   misho    1973:                RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
1.1       misho    1974:                ;;
                   1975:     *-*-nextstep*)
                   1976:                # lockf() on is broken on the NeXT -- use flock instead
                   1977:                ac_cv_func_lockf=no
                   1978:                ac_cv_func_flock=yes
1.1.1.2   misho    1979:                RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
                   1980:                RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
1.1       misho    1981:                ;;
                   1982:     *-*-*sysv4*)
                   1983:                : ${mansectsu='1m'}
                   1984:                : ${mansectform='4'}
                   1985:                ;;
                   1986:     *-*-sysv*)
                   1987:                : ${mansectsu='1m'}
                   1988:                : ${mansectform='4'}
                   1989:                ;;
                   1990:     *-gnu*)
                   1991:                OSDEFS="${OSDEFS} -D_GNU_SOURCE"
                   1992:                ;;
                   1993: esac
                   1994: 
                   1995: dnl
1.1.1.2   misho    1996: dnl Library preloading to support NOEXEC
                   1997: dnl
                   1998: if test -n "$with_noexec"; then
                   1999:     SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_VAR, "$RTLD_PRELOAD_VAR")
                   2000:     SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_DELIM, "$RTLD_PRELOAD_DELIM")
                   2001:     if test -n "$RTLD_PRELOAD_DEFAULT"; then
                   2002:        SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_DEFAULT, "$RTLD_PRELOAD_DEFAULT")
                   2003:     fi
                   2004:     if test -n "$RTLD_PRELOAD_ENABLE_VAR"; then
                   2005:        SUDO_DEFINE_UNQUOTED(RTLD_PRELOAD_ENABLE_VAR, "$RTLD_PRELOAD_ENABLE_VAR")
                   2006:     fi
                   2007: fi
                   2008: 
                   2009: dnl
1.1       misho    2010: dnl Check for mixing mutually exclusive and regular auth methods
                   2011: dnl
                   2012: AUTH_REG=${AUTH_REG# }
                   2013: AUTH_EXCL=${AUTH_EXCL# }
                   2014: if test -n "$AUTH_EXCL"; then
                   2015:     set -- $AUTH_EXCL
                   2016:     if test $# != 1; then
                   2017:        AC_MSG_ERROR([More than one mutually exclusive authentication method specified: $AUTH_EXCL])
                   2018:     fi
                   2019:     if test -n "$AUTH_REG"; then
                   2020:        AC_MSG_ERROR([Cannot mix mutually exclusive ($AUTH_EXCL) and regular ($AUTH_REG) authentication methods])
                   2021:     fi
                   2022: fi
                   2023: dnl
                   2024: dnl Only one of S/Key and OPIE may be specified
                   2025: dnl
                   2026: if test X"${with_skey}${with_opie}" = X"yesyes"; then
                   2027:     AC_MSG_ERROR(["cannot use both S/Key and OPIE"])
                   2028: fi
                   2029: 
                   2030: dnl
                   2031: dnl Use BSD-style man sections by default
                   2032: dnl
                   2033: : ${mansectsu='8'}
                   2034: : ${mansectform='5'}
                   2035: 
                   2036: dnl
                   2037: dnl Add in any libpaths or libraries specified via configure
                   2038: dnl
                   2039: if test -n "$with_libpath"; then
                   2040:     for i in ${with_libpath}; do
                   2041:        SUDO_APPEND_LIBPATH(LDFLAGS, [$i])
                   2042:     done
                   2043: fi
                   2044: if test -n "$with_libraries"; then
                   2045:     for i in ${with_libraries}; do
                   2046:        case $i in
                   2047:            -l*)        ;;
                   2048:            *.a)        ;;
                   2049:            *.o)        ;;
                   2050:            *)  i="-l${i}";;
                   2051:        esac
                   2052:        LIBS="${LIBS} ${i}"
                   2053:     done
                   2054: fi
                   2055: 
                   2056: dnl
                   2057: dnl C compiler checks (to be done after os checks)
                   2058: dnl
                   2059: AC_PROG_GCC_TRADITIONAL
                   2060: AC_C_CONST
                   2061: AC_C_VOLATILE
1.1.1.2   misho    2062: # Check for variadic macro support in cpp
                   2063: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                   2064: AC_INCLUDES_DEFAULT
                   2065: #if defined(__GNUC__) && __GNUC__ == 2
                   2066: # define sudo_fprintf(fp, fmt...) fprintf((fp), (fmt))
                   2067: #else
                   2068: # define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
                   2069: #endif
                   2070: ], [sudo_fprintf(stderr, "a %s", "test");])], [], [AC_MSG_ERROR([Your C compiler doesn't support variadic macros, try building with gcc instead])])
1.1.1.3   misho    2071: 
1.1       misho    2072: dnl
                   2073: dnl Program checks
                   2074: dnl
                   2075: AC_PROG_YACC
                   2076: AC_PATH_PROG([FLEX], [flex], [flex])
                   2077: SUDO_PROG_MV
                   2078: SUDO_PROG_BSHELL
                   2079: if test -z "$with_sendmail"; then
                   2080:     SUDO_PROG_SENDMAIL
                   2081: fi
                   2082: SUDO_PROG_VI
                   2083: dnl
                   2084: dnl Check for authpriv support in syslog
                   2085: dnl
                   2086: AC_MSG_CHECKING(which syslog facility sudo should log with)
                   2087: if test X"$with_logfac" = X""; then
                   2088:     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <syslog.h>]], [[int i = LOG_AUTHPRIV; (void)i;]])], [logfac=authpriv])
                   2089: fi
                   2090: AC_DEFINE_UNQUOTED(LOGFAC, "$logfac", [The syslog facility sudo will use.])
                   2091: AC_MSG_RESULT($logfac)
                   2092: dnl
                   2093: dnl Header file checks
                   2094: dnl
                   2095: AC_HEADER_STDC
                   2096: AC_HEADER_DIRENT
                   2097: AC_HEADER_TIME
1.1.1.2   misho    2098: AC_HEADER_STDBOOL
                   2099: AC_HEADER_MAJOR
                   2100: 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)
1.1.1.4   misho    2101: AC_CHECK_HEADERS([endian.h] [sys/endian.h] [machine/endian.h], [break])
1.1.1.2   misho    2102: AC_CHECK_HEADERS([procfs.h] [sys/procfs.h], [AC_CHECK_MEMBERS(struct psinfo.pr_ttydev, [AC_CHECK_FUNCS(_ttyname_dev)], [], [AC_INCLUDES_DEFAULT
                   2103: #ifdef HAVE_PROCFS_H
                   2104: #include <procfs.h>
                   2105: #endif
                   2106: #ifdef HAVE_SYS_PROCFS_H
                   2107: #include <sys/procfs.h>
                   2108: #endif
                   2109: ])]
                   2110: break)
1.1       misho    2111: dnl
                   2112: dnl Check for large file support.  HP-UX 11.23 has a broken sys/type.h
                   2113: dnl when large files support is enabled so work around it.
                   2114: dnl
                   2115: AC_SYS_LARGEFILE
1.1.1.4   misho    2116: case "$host_os" in
                   2117:     hpux11.*)
1.1       misho    2118:        AC_CACHE_CHECK([whether sys/types.h needs _XOPEN_SOURCE_EXTENDED], [sudo_cv_xopen_source_extended],
                   2119:        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
                   2120:        #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=no], [
                   2121:            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _XOPEN_SOURCE_EXTENDED
                   2122:            AC_INCLUDES_DEFAULT
                   2123:            #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=yes],
                   2124:            [sudo_cv_xopen_source_extended=error])
                   2125:        ])])
                   2126:        if test "$sudo_cv_xopen_source_extended" = "yes"; then
                   2127:            OSDEFS="${OSDEFS} -D_XOPEN_SOURCE_EXTENDED"
                   2128:            SUDO_DEFINE(_XOPEN_SOURCE_EXTENDED)
                   2129:        fi
                   2130:        ;;
                   2131: esac
                   2132: AC_SYS_POSIX_TERMIOS
                   2133: if test "$ac_cv_sys_posix_termios" != "yes"; then
                   2134:     AC_MSG_ERROR([Must have POSIX termios to build sudo])
                   2135: fi
                   2136: SUDO_MAILDIR
                   2137: if test ${with_logincap-'no'} != "no"; then
1.1.1.5 ! misho    2138:     AC_CHECK_HEADERS(login_cap.h, [LOGINCAP_USAGE='[[-c class]] '; LCMAN=1
1.1       misho    2139:        case "$OS" in
                   2140:            freebsd|netbsd)
                   2141:                SUDO_LIBS="${SUDO_LIBS} -lutil"
                   2142:                SUDOERS_LIBS="${SUDOERS_LIBS} -lutil"
                   2143:                ;;
                   2144:        esac
                   2145:     ])
                   2146: fi
                   2147: if test ${with_project-'no'} != "no"; then
                   2148:     AC_CHECK_HEADER(project.h, [
                   2149:        AC_CHECK_LIB(project, setproject, [
                   2150:            AC_DEFINE(HAVE_PROJECT_H)
                   2151:            SUDO_LIBS="${SUDO_LIBS} -lproject"
                   2152:        ])
                   2153:     ], [])
                   2154: fi
                   2155: dnl
                   2156: dnl typedef checks
1.1.1.5 ! misho    2157: dnl We need to define __STDC_WANT_LIB_EXT1__ for errno_t and rsize_t
1.1       misho    2158: dnl
1.1.1.5 ! misho    2159: SUDO_APPEND_CPPFLAGS(-D__STDC_WANT_LIB_EXT1__=1)
1.1       misho    2160: AC_TYPE_MODE_T
                   2161: AC_TYPE_UID_T
                   2162: AC_CHECK_TYPE([__signed char], [], [AC_CHECK_TYPE([signed char], [AC_DEFINE(__signed, signed)], [AC_DEFINE(__signed, [])])])
                   2163: AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include <sys/types.h>
                   2164: #include <signal.h>])
1.1.1.2   misho    2165: AC_CHECK_TYPES([sigaction_t], [], [], [#include <sys/types.h>
1.1       misho    2166: #include <signal.h>])
1.1.1.2   misho    2167: AC_CHECK_TYPES([struct timespec], [], [], [#include <sys/types.h>
1.1       misho    2168: #if TIME_WITH_SYS_TIME
                   2169: # include <sys/time.h>
                   2170: #endif
                   2171: #include <time.h>])
1.1.1.2   misho    2172: AC_CHECK_TYPES([struct in6_addr], [], [], [#include <sys/types.h>
1.1       misho    2173: #include <netinet/in.h>])
                   2174: AC_TYPE_LONG_LONG_INT
1.1.1.4   misho    2175: if test X"$ac_cv_type_long_long_int" != X"yes"; then
                   2176:     AC_MSG_ERROR(["C compiler does not appear have required long long support"])
                   2177: fi
1.1       misho    2178: AC_CHECK_SIZEOF([long int])
1.1.1.5 ! misho    2179: AC_CHECK_TYPE(id_t, unsigned int)
1.1.1.2   misho    2180: AC_CHECK_TYPE(size_t, unsigned int)
                   2181: AC_CHECK_TYPE(ssize_t, int)
                   2182: AC_CHECK_TYPE(dev_t, int)
                   2183: AC_CHECK_TYPE(ino_t, unsigned int)
1.1.1.4   misho    2184: AC_CHECK_TYPE(uint8_t, unsigned char)
                   2185: AC_CHECK_TYPE(uint32_t, unsigned int)
                   2186: AC_CHECK_TYPE(uint64_t, unsigned long long)
1.1.1.2   misho    2187: AC_CHECK_TYPE(socklen_t, [], [AC_DEFINE(socklen_t, unsigned int)], [
                   2188: AC_INCLUDES_DEFAULT
                   2189: #include <sys/socket.h>])
1.1.1.5 ! misho    2190: AC_CHECK_TYPE(rsize_t, size_t)
        !          2191: AC_CHECK_TYPE(errno_t, int)
1.1       misho    2192: SUDO_UID_T_LEN
                   2193: SUDO_SOCK_SA_LEN
                   2194: dnl
                   2195: dnl Check for utmp/utmpx struct members.
                   2196: dnl We need to include OSDEFS for glibc which only has __e_termination
                   2197: dnl visible when _GNU_SOURCE is *not* defined.
                   2198: dnl
                   2199: _CFLAGS="$CFLAGS"
                   2200: CFLAGS="$CFLAGS $OSDEFS"
                   2201: if test $ac_cv_header_utmpx_h = "yes"; then
                   2202:     AC_CHECK_MEMBERS([struct utmpx.ut_id, struct utmpx.ut_pid, struct utmpx.ut_tv, struct utmpx.ut_type], [], [], [
                   2203:        #include <sys/types.h>
                   2204:        #include <utmpx.h>
                   2205:     ])
                   2206:     dnl
                   2207:     dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
                   2208:     dnl
                   2209:     AC_CHECK_MEMBERS([struct utmpx.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [
                   2210:        AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [], [
                   2211:            #include <sys/types.h>
                   2212:            #include <utmpx.h>
                   2213:        ])
                   2214:     ], [
                   2215:        #include <sys/types.h>
                   2216:        #include <utmpx.h>
                   2217:     ])
                   2218: else
                   2219:     AC_CHECK_MEMBERS([struct utmp.ut_id, struct utmp.ut_pid, struct utmp.ut_tv, struct utmp.ut_type, struct utmp.ut_user], [], [], [
                   2220:        #include <sys/types.h>
                   2221:        #include <utmp.h>
                   2222:     ])
                   2223:     dnl
                   2224:     dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
                   2225:     dnl
                   2226:     AC_CHECK_MEMBERS([struct utmp.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [
                   2227:        AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [], [
                   2228:            #include <sys/types.h>
                   2229:            #include <utmp.h>
                   2230:        ])
                   2231:     ], [
                   2232:        #include <sys/types.h>
                   2233:        #include <utmp.h>
                   2234:     ])
                   2235: fi
                   2236: CFLAGS="$_CFLAGS"
                   2237: 
                   2238: dnl
                   2239: dnl Function checks
                   2240: dnl
                   2241: AC_FUNC_GETGROUPS
1.1.1.4   misho    2242: AC_CHECK_FUNCS(glob nl_langinfo regcomp setenv strftime strrchr strtoll \
                   2243:               sysconf tzset)
                   2244: AC_CHECK_FUNCS(getgrouplist, [], [
                   2245:     case "$host_os" in
                   2246:     aix*)
                   2247:        AC_CHECK_FUNCS(getgrset)
                   2248:        ;;
                   2249:     *)
                   2250:        AC_CHECK_FUNC(nss_search, [
                   2251:            AC_CHECK_FUNC(_nss_XbyY_buf_alloc, [
                   2252:                # Solaris
                   2253:                AC_CHECK_FUNC(_nss_initf_group, [
                   2254:                    AC_CHECK_HEADERS(nss_dbdefs.h)
                   2255:                    AC_DEFINE([HAVE_NSS_SEARCH])
                   2256:                    AC_DEFINE([HAVE__NSS_XBYY_BUF_ALLOC])
                   2257:                    AC_DEFINE([HAVE__NSS_INITF_GROUP])
                   2258:                ])
                   2259:            ], [
                   2260:                # HP-UX
                   2261:                AC_CHECK_FUNC(__nss_XbyY_buf_alloc, [
                   2262:                    AC_CHECK_FUNC(__nss_initf_group, [
                   2263:                        AC_CHECK_HEADERS(nss_dbdefs.h)
                   2264:                        AC_DEFINE([HAVE_NSS_SEARCH])
                   2265:                        AC_DEFINE([HAVE___NSS_XBYY_BUF_ALLOC])
                   2266:                        AC_DEFINE([HAVE___NSS_INITF_GROUP])
                   2267:                    ])
                   2268:                ])
                   2269:            ])
                   2270:        ])
                   2271:        ;;
                   2272:     esac
                   2273:     AC_LIBOBJ(getgrouplist)
                   2274: ])
1.1       misho    2275: AC_CHECK_FUNCS(getline, [], [
                   2276:     AC_LIBOBJ(getline)
                   2277:     AC_CHECK_FUNCS(fgetln)
                   2278: ])
1.1.1.2   misho    2279: dnl
                   2280: dnl If libc supports _FORTIFY_SOURCE check functions, use it.
                   2281: dnl
1.1.1.3   misho    2282: if test "$enable_hardening" != "no"; then
                   2283:     O_CPPFLAGS="$CPPFLAGS"
                   2284:     CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
                   2285:     AC_CHECK_FUNC(__sprintf_chk, [
                   2286:        AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[char buf[4]; (void)sprintf(buf, "%s", "foo");]])], [OSDEFS="${OSDEFS} -D_FORTIFY_SOURCE=2"], [])
                   2287:     ], [])
                   2288:     CPPFLAGS="$O_CPPFLAGS"
                   2289: fi
1.1.1.2   misho    2290: 
1.1       misho    2291: utmp_style=LEGACY
                   2292: AC_CHECK_FUNCS(getutxid getutid, [utmp_style=POSIX; break])
                   2293: if test "$utmp_style" = "LEGACY"; then
                   2294:     AC_CHECK_FUNCS(getttyent ttyslot, [break])
1.1.1.3   misho    2295:     AC_CHECK_FUNCS(fseeko)
1.1       misho    2296: fi
                   2297: 
1.1.1.2   misho    2298: AC_CHECK_FUNCS(sysctl, [AC_CHECK_MEMBERS([struct kinfo_proc.ki_tdev], [],
                   2299:     [
                   2300:        AC_CHECK_MEMBERS([struct kinfo_proc2.p_tdev], [], [
                   2301:            AC_CHECK_MEMBERS([struct kinfo_proc.p_tdev], [], [
                   2302:                AC_CHECK_MEMBERS([struct kinfo_proc.kp_eproc.e_tdev], [], [], [
                   2303:                    #include <sys/param.h>
                   2304:                    #include <sys/sysctl.h>
                   2305:                ])
                   2306:            ], [
                   2307:                #include <sys/param.h>
                   2308:                #include <sys/sysctl.h>
                   2309:            ])
                   2310:        ],
                   2311:        [
                   2312:            #include <sys/param.h>
                   2313:            #include <sys/sysctl.h>
                   2314:        ])
                   2315:     ],
                   2316:     [
                   2317:        #include <sys/param.h>
                   2318:        #include <sys/sysctl.h>
                   2319:        #include <sys/user.h>
                   2320:     ])
                   2321: ])
                   2322: 
1.1       misho    2323: AC_CHECK_FUNCS(openpty, [AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])], [
                   2324:     AC_CHECK_LIB(util, openpty, [
                   2325:        AC_CHECK_HEADERS(libutil.h util.h pty.h, [break])
                   2326:        case "$SUDO_LIBS" in
                   2327:            *-lutil*) ;;
                   2328:            *) SUDO_LIBS="${SUDO_LIBS} -lutil";;
                   2329:        esac
                   2330:        AC_DEFINE(HAVE_OPENPTY)
                   2331:     ], [
                   2332:        AC_CHECK_FUNCS(_getpty, [], [
                   2333:            AC_CHECK_FUNCS(grantpt, [
                   2334:                AC_CHECK_FUNCS(posix_openpt)
                   2335:            ], [
                   2336:                AC_CHECK_FUNCS(revoke)
                   2337:            ])
                   2338:        ])
                   2339:     ])
                   2340: ])
1.1.1.2   misho    2341: AC_CHECK_FUNCS(unsetenv, [SUDO_FUNC_UNSETENV_VOID], [])
                   2342: SUDO_FUNC_PUTENV_CONST
1.1       misho    2343: if test -z "$SKIP_SETRESUID"; then
                   2344:     AC_CHECK_FUNCS(setresuid, [
                   2345:        SKIP_SETREUID=yes
                   2346:        AC_CHECK_FUNCS(getresuid)
                   2347:     ])
                   2348: fi
                   2349: if test -z "$SKIP_SETREUID"; then
1.1.1.4   misho    2350:     AC_CHECK_FUNCS(setreuid)
1.1       misho    2351: fi
1.1.1.4   misho    2352: AC_CHECK_FUNCS(seteuid)
1.1       misho    2353: if test X"$with_interfaces" != X"no"; then
                   2354:     AC_CHECK_FUNCS(getifaddrs, [AC_CHECK_FUNCS(freeifaddrs)])
                   2355: fi
                   2356: if test -z "$BROKEN_GETCWD"; then
                   2357:     AC_REPLACE_FUNCS(getcwd)
                   2358: fi
                   2359: AC_CHECK_FUNCS(lockf flock, [break])
                   2360: AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]])
                   2361: AC_CHECK_FUNCS(utimes, [AC_CHECK_FUNCS(futimes futimesat, [break])], [AC_CHECK_FUNCS(futime) AC_LIBOBJ(utimes)])
                   2362: AC_CHECK_FUNCS(killpg, [], [AC_LIBOBJ(killpg)])
1.1.1.2   misho    2363: SUDO_FUNC_FNMATCH([AC_DEFINE(HAVE_FNMATCH)], [AC_LIBOBJ(fnmatch)
                   2364:     COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }fnm_test"
                   2365: ])
1.1       misho    2366: SUDO_FUNC_ISBLANK
1.1.1.5 ! misho    2367: AC_REPLACE_FUNCS(memrchr memset_s pw_dup strlcpy strlcat)
1.1       misho    2368: AC_CHECK_FUNCS(nanosleep, [], [
                   2369:     # On Solaris, nanosleep is in librt
                   2370:     AC_CHECK_LIB(rt, nanosleep, [REPLAY_LIBS="${REPLAY_LIBS} -lrt"], [AC_LIBOBJ(nanosleep)])
                   2371: ])
1.1.1.5 ! misho    2372: AC_CHECK_FUNCS(getopt_long, [], [AC_LIBOBJ(getopt_long)
        !          2373:     AC_MSG_CHECKING([for optreset])
        !          2374:     AC_CACHE_VAL(sudo_cv_optreset, [
        !          2375:     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern int optreset; optreset = 1; return optreset;]])], [sudo_cv_optreset=yes], [sudo_cv_optreset=no])])
        !          2376:     if test "$sudo_cv_optreset" = "yes"; then
        !          2377:        AC_DEFINE(HAVE_OPTRESET)
        !          2378:     fi
        !          2379:     AC_MSG_RESULT($sudo_cv_optreset)
        !          2380: ])
1.1       misho    2381: AC_CHECK_FUNCS(closefrom, [], [AC_LIBOBJ(closefrom)
                   2382:     AC_CHECK_DECL(F_CLOSEM, AC_DEFINE(HAVE_FCNTL_CLOSEM), [],
                   2383:        [ #include <limits.h>
                   2384:          #include <fcntl.h> ])
                   2385: ])
                   2386: AC_CHECK_FUNCS(mkstemps mkdtemp, [], [
                   2387:     AC_CHECK_FUNCS(random lrand48, [break])
                   2388:     AC_LIBOBJ(mktemp)
                   2389: ])
                   2390: AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf, , [NEED_SNPRINTF=1])
                   2391: if test X"$ac_cv_type_struct_timespec" != X"no"; then
                   2392:     AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)]
                   2393:        [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))],
                   2394:        [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))])
                   2395: fi
                   2396: dnl
1.1.1.5 ! misho    2397: dnl Function checks for sudo_noexec
        !          2398: dnl
        !          2399: if test X"$with_noexec" != X"no"; then
        !          2400:     # Check for underscore versions of standard exec functions
        !          2401:     # unless we are using dyld symbole interposition
        !          2402:     if test X"$dlyld_interpose" != X"yes"; then
        !          2403:        AC_CHECK_FUNCS(_execl __execl)
        !          2404:        AC_CHECK_FUNCS(_execle __execle)
        !          2405:        AC_CHECK_FUNCS(_execlp __execlp)
        !          2406:        AC_CHECK_FUNCS(_execv __execv)
        !          2407:        AC_CHECK_FUNCS(_execve __execve)
        !          2408:        AC_CHECK_FUNCS(_execvp __execvp)
        !          2409:     fi
        !          2410:     # Check for non-standard exec functions including underscore versions
        !          2411:     AC_CHECK_FUNCS(exect, [
        !          2412:        if test X"$dlyld_interpose" != X"yes"; then
        !          2413:            AC_CHECK_FUNCS(_exect __exect)
        !          2414:        fi
        !          2415:     ])
        !          2416:     AC_CHECK_FUNCS(execvP, [
        !          2417:        if test X"$dlyld_interpose" != X"yes"; then
        !          2418:            AC_CHECK_FUNCS(_execvP __execvP)
        !          2419:        fi
        !          2420:     ])
        !          2421:     AC_CHECK_FUNCS(execvpe, [
        !          2422:        if test X"$dlyld_interpose" != X"yes"; then
        !          2423:            AC_CHECK_FUNCS(_execvpe __execvpe)
        !          2424:        fi
        !          2425:     ])
        !          2426:     AC_CHECK_FUNCS(fexecve, [
        !          2427:        if test X"$dlyld_interpose" != X"yes"; then
        !          2428:            AC_CHECK_FUNCS(_fexecve __fexecve)
        !          2429:        fi
        !          2430:     ])
        !          2431:     # Check for posix_spawn, posix_spawnp and any underscore versions
        !          2432:     AC_CHECK_FUNCS(posix_spawn, [
        !          2433:        if test X"$dlyld_interpose" != X"yes"; then
        !          2434:            AC_CHECK_FUNCS(_posix_spawn __posix_spawn)
        !          2435:        fi
        !          2436:     ])
        !          2437:     AC_CHECK_FUNCS(posix_spawnp, [
        !          2438:        if test X"$dlyld_interpose" != X"yes"; then
        !          2439:            AC_CHECK_FUNCS(_posix_spawnp __posix_spawnp)
        !          2440:        fi
        !          2441:     ])
        !          2442: fi
        !          2443: 
        !          2444: dnl
1.1       misho    2445: dnl Check for the dirfd function/macro.  If not found, look for dd_fd in DIR.
                   2446: dnl
                   2447: AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
                   2448: #include <$ac_header_dirent>]], [[DIR *d; (void)dirfd(d);]])], [AC_DEFINE(HAVE_DIRFD)], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
                   2449: #include <$ac_header_dirent>]], [[DIR d; memset(&d, 0, sizeof(d)); return(d.dd_fd);]])], [AC_DEFINE(HAVE_DD_FD)], [])])
1.1.1.2   misho    2450: AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [
                   2451: AC_INCLUDES_DEFAULT
                   2452: #include <$ac_header_dirent>
                   2453: ])
1.1       misho    2454: dnl
                   2455: dnl If NEED_SNPRINTF is set, add snprintf.c to LIBOBJS
                   2456: dnl (it contains snprintf, vsnprintf, asprintf, and vasprintf)
                   2457: dnl
                   2458: if test -n "$NEED_SNPRINTF"; then
                   2459:     AC_LIBOBJ(snprintf)
                   2460: fi
                   2461: dnl
                   2462: dnl If socket(2) not in libc, check -lsocket and -linet
                   2463: dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
                   2464: dnl
1.1.1.2   misho    2465: AC_CHECK_FUNC(socket, [], [
                   2466:     for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
                   2467:        _libs=
                   2468:        for lib in $libs; do
                   2469:            case "$NET_LIBS" in
                   2470:                *"$lib"*)   ;;
                   2471:                *)          _libs="$_libs $lib";;
                   2472:            esac
                   2473:        done
                   2474:        libs="${_libs# }"
                   2475:        test -z "$libs" && continue
                   2476:        lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
                   2477:        extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
                   2478:        SUDO_CHECK_LIB($lib, socket, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
                   2479:     done
                   2480: ])
1.1       misho    2481: dnl
                   2482: dnl If inet_addr(3) not in libc, check -lnsl and -linet
                   2483: dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
                   2484: dnl
1.1.1.2   misho    2485: AC_CHECK_FUNC(inet_addr, [], [
                   2486:     AC_CHECK_FUNC(__inet_addr, [], [
                   2487:        for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
                   2488:            _libs=
                   2489:            for lib in $libs; do
                   2490:                case "$NET_LIBS" in
                   2491:                    *"$lib"*)   ;;
                   2492:                    *)          _libs="$_libs $lib";;
                   2493:                esac
                   2494:            done
                   2495:            libs="${_libs# }"
                   2496:            test -z "$libs" && continue
                   2497:            lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
                   2498:            extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
                   2499:            SUDO_CHECK_LIB($lib, inet_addr, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
                   2500:        done
                   2501:     ])
                   2502: ])
1.1       misho    2503: dnl
                   2504: dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet
                   2505: dnl
1.1.1.2   misho    2506: AC_CHECK_FUNC(syslog, [], [
                   2507:     for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
                   2508:        _libs=
                   2509:        for lib in $libs; do
                   2510:            case "$NET_LIBS" in
                   2511:                *"$lib"*)   ;;
                   2512:                *)          _libs="$_libs $lib";;
                   2513:            esac
                   2514:        done
                   2515:        libs="${_libs# }"
                   2516:        test -z "$libs" && continue
                   2517:        lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
                   2518:        extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
                   2519:        SUDO_CHECK_LIB($lib, syslog, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; break], [], [$extralibs])
                   2520:     done
                   2521: ])
                   2522: dnl
                   2523: dnl If getaddrinfo(3) not in libc, check -lsocket and -linet
                   2524: dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols.
                   2525: dnl
                   2526: AC_CHECK_FUNCS(getaddrinfo, [], [
                   2527:     found=no
                   2528:     for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
                   2529:        _libs=
                   2530:        for lib in $libs; do
                   2531:            case "$NET_LIBS" in
                   2532:                *"$lib"*)   ;;
                   2533:                *)          _libs="$_libs $lib";;
                   2534:            esac
                   2535:        done
                   2536:        libs="${_libs# }"
                   2537:        test -z "$libs" && continue
                   2538:        lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
                   2539:        extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
                   2540:        SUDO_CHECK_LIB($lib, getaddrinfo, [NET_LIBS="${NET_LIBS} $libs"; LIBS="${LIBS} $libs"; found=yes; break], [], [$extralibs])
                   2541:     done
                   2542:     if test X"$found" != X"no"; then
                   2543:        AC_DEFINE(HAVE_GETADDRINFO)
                   2544:     fi
                   2545: ])
1.1       misho    2546: dnl
                   2547: dnl Check for getprogname() or __progname
                   2548: dnl
                   2549: AC_CHECK_FUNCS(getprogname, , [
                   2550:     AC_MSG_CHECKING([for __progname])
                   2551:     AC_CACHE_VAL(sudo_cv___progname, [
                   2552:     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; (void)puts(__progname);]])], [sudo_cv___progname=yes], [sudo_cv___progname=no])])
                   2553:     if test "$sudo_cv___progname" = "yes"; then
                   2554:        AC_DEFINE(HAVE___PROGNAME)
                   2555:     else
                   2556:        AC_LIBOBJ(getprogname)
                   2557:     fi
                   2558:     AC_MSG_RESULT($sudo_cv___progname)
                   2559: ])
1.1.1.2   misho    2560: dnl
                   2561: dnl Check for __func__ or __FUNCTION__
                   2562: dnl
                   2563: AC_MSG_CHECKING([for __func__])
                   2564: AC_CACHE_VAL(sudo_cv___func__, [
                   2565: AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void)puts(__func__);]])], [sudo_cv___func__=yes], [sudo_cv___func__=no])])
                   2566: AC_MSG_RESULT($sudo_cv___func__)
                   2567: if test "$sudo_cv___func__" = "yes"; then
                   2568:     AC_DEFINE(HAVE___FUNC__)
                   2569: elif test -n "$GCC"; then
                   2570:     AC_MSG_CHECKING([for __FUNCTION__])
                   2571:     AC_CACHE_VAL(sudo_cv___FUNCTION__, [
                   2572:     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void)puts(__FUNCTION__);]])], [sudo_cv___FUNCTION__=yes], [sudo_cv___FUNCTION__=no])])
                   2573:     AC_MSG_RESULT($sudo_cv___FUNCTION__)
                   2574:     if test "$sudo_cv___FUNCTION__" = "yes"; then
                   2575:        AC_DEFINE(HAVE___FUNC__)
1.1.1.4   misho    2576:        AC_DEFINE(__func__, __FUNCTION__, [Define to __FUNCTION__ if your compiler supports __FUNCTION__ but not __func__])
1.1.1.2   misho    2577:     fi
                   2578: fi
1.1       misho    2579: 
                   2580: # gettext() and friends may be located in libc (Linux and Solaris)
                   2581: # or in libintl.  However, it is possible to have libintl installed
                   2582: # even when gettext() is present in libc.  In the case of GNU libintl,
                   2583: # gettext() will be defined to gettext_libintl in libintl.h.
                   2584: # Since gcc prefers /usr/local/include to /usr/include, we need to
                   2585: # make sure we use the gettext() that matches the include file.
                   2586: if test "$enable_nls" != "no"; then
                   2587:     if test "$enable_nls" != "yes"; then
1.1.1.4   misho    2588:        SUDO_APPEND_CPPFLAGS(-I${enable_nls}/include)
1.1       misho    2589:        SUDO_APPEND_LIBPATH(LDFLAGS, [$enable_nls/lib])
                   2590:     fi
                   2591:     OLIBS="$LIBS"
                   2592:     for l in "libc" "-lintl" "-lintl -liconv"; do
                   2593:        if test "$l" = "libc"; then
                   2594:            # If user specified a dir for libintl ignore libc
                   2595:            if test "$enable_nls" != "yes"; then
                   2596:                continue
                   2597:            fi
                   2598:            gettext_name=sudo_cv_gettext
                   2599:            AC_MSG_CHECKING([for gettext])
                   2600:        else
                   2601:            LIBS="$OLIBS $l"
                   2602:            gettext_name=sudo_cv_gettext"`echo $l|sed -e 's/ //g' -e 's/-/_/g'`"
                   2603:            AC_MSG_CHECKING([for gettext in $l])
                   2604:        fi
                   2605:        AC_CACHE_VAL($gettext_name, [
                   2606:                AC_LINK_IFELSE(
                   2607:                    [
                   2608:                        AC_LANG_PROGRAM([[#include <libintl.h>]], [(void)gettext((char *)0);])
                   2609:                    ], [eval $gettext_name=yes], [eval $gettext_name=no]
                   2610:                )
                   2611:        ])
                   2612:        eval gettext_result="\$$gettext_name"
                   2613:        AC_MSG_RESULT($gettext_result)
1.1.1.3   misho    2614:        if test "$gettext_result" = "yes"; then
                   2615:            AC_CHECK_FUNCS(ngettext)
                   2616:            break
                   2617:        fi
1.1       misho    2618:     done
                   2619:     LIBS="$OLIBS"
                   2620: 
                   2621:     if test "$sudo_cv_gettext" = "yes"; then
                   2622:        AC_DEFINE(HAVE_LIBINTL_H)
                   2623:        SUDO_NLS=enabled
1.1.1.4   misho    2624:        # For Solaris we need links from lang to lang.UTF-8 in localedir
                   2625:        case "$host_os" in
                   2626:            solaris2*) LOCALEDIR_SUFFIX=".UTF-8";;
                   2627:        esac
1.1       misho    2628:     elif test "$sudo_cv_gettext_lintl" = "yes"; then
                   2629:        AC_DEFINE(HAVE_LIBINTL_H)
                   2630:        SUDO_NLS=enabled
                   2631:        LIBINTL="-lintl"
                   2632:     elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
                   2633:        AC_DEFINE(HAVE_LIBINTL_H)
                   2634:        SUDO_NLS=enabled
                   2635:        LIBINTL="-lintl -liconv"
                   2636:     fi
                   2637: fi
                   2638: 
                   2639: dnl
                   2640: dnl Deferred zlib option processing.
                   2641: dnl By default we use the system zlib if it is present.
1.1.1.2   misho    2642: dnl If a directory was specified for zlib (or we are use sudo's version),
                   2643: dnl prepend the include dir to make sure we get the right zlib header.
1.1       misho    2644: dnl
                   2645: case "$enable_zlib" in
                   2646:     yes)
                   2647:        AC_CHECK_LIB(z, gzdopen, [
                   2648:            AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"], [enable_zlib=builtin])
                   2649:        ])
                   2650:        ;;
                   2651:     no)
                   2652:        ;;
                   2653:     system)
                   2654:        AC_DEFINE(HAVE_ZLIB_H)
                   2655:        ZLIB="-lz"
                   2656:        ;;
                   2657:     builtin)
                   2658:        # handled below
                   2659:        ;;
                   2660:     *)
                   2661:        AC_DEFINE(HAVE_ZLIB_H)
1.1.1.4   misho    2662:        SUDO_APPEND_CPPFLAGS(-I${enable_zlib}/include)
1.1       misho    2663:        SUDO_APPEND_LIBPATH(ZLIB, [$enable_zlib/lib])
                   2664:        ZLIB="${ZLIB} -lz"
                   2665:        ;;
                   2666: esac
                   2667: if test X"$enable_zlib" = X"builtin"; then
                   2668:     AC_DEFINE(HAVE_ZLIB_H)
1.1.1.2   misho    2669:     CPPFLAGS='-I$(top_builddir)/zlib -I$(top_srcdir)/zlib '"${CPPFLAGS}"
1.1       misho    2670:     ZLIB="${ZLIB}"' $(top_builddir)/zlib/libz.la'
                   2671:     ZLIB_SRC=zlib
                   2672:     AC_CONFIG_HEADER([zlib/zconf.h])
                   2673:     AC_CONFIG_FILES([zlib/Makefile])
                   2674: fi
                   2675: 
                   2676: dnl
                   2677: dnl Check for errno declaration in errno.h
                   2678: dnl
                   2679: AC_CHECK_DECLS([errno], [], [], [
                   2680: AC_INCLUDES_DEFAULT
                   2681: #include <errno.h>
                   2682: ])
                   2683: 
                   2684: dnl
1.1.1.2   misho    2685: dnl Check for h_errno declaration in netdb.h
                   2686: dnl
                   2687: AC_CHECK_DECLS([h_errno], [], [], [
                   2688: AC_INCLUDES_DEFAULT
                   2689: #include <netdb.h>
                   2690: ])
                   2691: 
                   2692: dnl
1.1       misho    2693: dnl Check for strsignal() or sys_siglist
                   2694: dnl
                   2695: AC_CHECK_FUNCS(strsignal, [], [
                   2696:     AC_LIBOBJ(strsignal)
                   2697:     HAVE_SIGLIST="false"
                   2698:     AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], [
                   2699:        HAVE_SIGLIST="true"
                   2700:        break
                   2701:     ], [ ], [
                   2702: AC_INCLUDES_DEFAULT
                   2703: #include <signal.h>
                   2704:     ])
                   2705:     if test "$HAVE_SIGLIST" != "true"; then
                   2706:        AC_LIBOBJ(siglist)
                   2707:     fi
                   2708: ])
                   2709: 
                   2710: dnl
1.1.1.3   misho    2711: dnl Check for sig2str(), sys_signame or sys_sigabbrev
                   2712: dnl
                   2713: AC_CHECK_FUNCS(sig2str, [], [
                   2714:     AC_LIBOBJ(sig2str)
                   2715:     HAVE_SIGNAME="false"
                   2716:     AC_CHECK_DECLS([sys_signame, _sys_signame, __sys_signame, sys_sigabbrev], [
                   2717:        HAVE_SIGNAME="true"
                   2718:        break
                   2719:     ], [ ], [
                   2720: AC_INCLUDES_DEFAULT
                   2721: #include <signal.h>
                   2722:     ])
                   2723:     if test "$HAVE_SIGNAME" != "true"; then
                   2724:        AC_CACHE_CHECK([for undeclared sys_sigabbrev],
                   2725:            [sudo_cv_var_sys_sigabbrev],
                   2726:            [AC_LINK_IFELSE(
                   2727:                [AC_LANG_PROGRAM([[extern char **sys_sigabbrev;]], [[return sys_sigabbrev[1];]])],
                   2728:                    [sudo_cv_var_sys_sigabbrev=yes],
                   2729:                    [sudo_cv_var_sys_sigabbrev=no]
                   2730:                )
                   2731:            ]
                   2732:        )
                   2733:        if test "$sudo_cv_var_sys_sigabbrev" = yes; then
                   2734:            AC_DEFINE(HAVE_SYS_SIGABBREV)
                   2735:        else
                   2736:            AC_LIBOBJ(signame)
                   2737:        fi
                   2738:     fi
                   2739: ])
                   2740: 
                   2741: dnl
1.1       misho    2742: dnl nsswitch.conf and its equivalents
                   2743: dnl
                   2744: if test ${with_netsvc-"no"} != "no"; then
                   2745:     SUDO_DEFINE_UNQUOTED(_PATH_NETSVC_CONF, "${with_netsvc-/etc/netsvc.conf}")
                   2746:     netsvc_conf=${with_netsvc-/etc/netsvc.conf}
                   2747: elif test ${with_nsswitch-"yes"} != "no"; then
                   2748:     SUDO_DEFINE_UNQUOTED(_PATH_NSSWITCH_CONF, "${with_nsswitch-/etc/nsswitch.conf}")
                   2749:     nsswitch_conf=${with_nsswitch-/etc/nsswitch.conf}
                   2750: fi
                   2751: 
                   2752: dnl
                   2753: dnl Mutually exclusive auth checks come first, followed by
                   2754: dnl non-exclusive ones.  Note: passwd must be last of all!
                   2755: dnl
                   2756: 
                   2757: dnl
                   2758: dnl Convert default authentication methods to with_* if
                   2759: dnl no explicit authentication scheme was specified.
                   2760: dnl
                   2761: if test -z "${AUTH_EXCL}${AUTH_REG}" -a -n "$AUTH_EXCL_DEF"; then
                   2762:     for auth in $AUTH_EXCL_DEF; do
                   2763:        case $auth in
                   2764:            AIX_AUTH)   with_aixauth=maybe;;
                   2765:            BSD_AUTH)   with_bsdauth=maybe;;
                   2766:            PAM)        with_pam=maybe;;
                   2767:            SIA)        CHECKSIA=true;;
                   2768:        esac
                   2769:     done
                   2770: fi
                   2771: 
                   2772: dnl
                   2773: dnl PAM support.  Systems that use PAM by default set with_pam=default
                   2774: dnl and we do the actual tests here.
                   2775: dnl
                   2776: if test ${with_pam-"no"} != "no"; then
1.1.1.2   misho    2777:     #
                   2778:     # Check for pam_start() in libpam first, then for pam_appl.h.
                   2779:     #
                   2780:     found_pam_lib=no
                   2781:     AC_CHECK_LIB(pam, pam_start, [found_pam_lib=yes], [], [$lt_cv_dlopen_libs])
                   2782:     #
                   2783:     # Some PAM implementations (MacOS X for example) put the PAM headers
                   2784:     # in /usr/include/pam instead of /usr/include/security...
                   2785:     #
                   2786:     found_pam_hdrs=no
                   2787:     AC_CHECK_HEADERS([security/pam_appl.h] [pam/pam_appl.h], [found_pam_hdrs=yes; break])
                   2788:     if test "$found_pam_lib" = "yes" -a "$found_pam_hdrs" = "yes"; then
                   2789:        # Found both PAM libs and headers
                   2790:        with_pam=yes
                   2791:     elif test "$with_pam" = "yes"; then
                   2792:        if test "$found_pam_lib" = "no"; then
                   2793:            AC_MSG_ERROR(["--with-pam specified but unable to locate PAM development library."])
                   2794:        fi
                   2795:        if test "$found_pam_hdrs" = "no"; then
                   2796:            AC_MSG_ERROR(["--with-pam specified but unable to locate PAM development headers."])
                   2797:        fi
                   2798:     elif test "$found_pam_lib" != "$found_pam_hdrs"; then
                   2799:        if test "$found_pam_lib" = "no"; then
                   2800:            AC_MSG_ERROR(["found PAM headers but no PAM development library; specify --without-pam to build without PAM"])
                   2801:        fi
                   2802:        if test "$found_pam_hdrs" = "no"; then
                   2803:            AC_MSG_ERROR(["found PAM library but no PAM development headers; specify --without-pam to build without PAM"])
                   2804:        fi
                   2805:     fi
1.1       misho    2806: 
                   2807:     if test "$with_pam" = "yes"; then
1.1.1.2   misho    2808:        # Older PAM implementations lack pam_getenvlist
                   2809:        OLIBS="$LIBS"
                   2810:        LIBS="$LIBS -lpam $lt_cv_dlopen_libs"
                   2811:        AC_CHECK_FUNCS(pam_getenvlist)
                   2812:        LIBS="$OLIBS"
                   2813: 
                   2814:        # We already link with -ldl if needed (see LIBDL below)
                   2815:        SUDOERS_LIBS="${SUDOERS_LIBS} -lpam"
1.1       misho    2816:        AC_DEFINE(HAVE_PAM)
                   2817:        AUTH_OBJS="$AUTH_OBJS pam.lo";
                   2818:        AUTH_EXCL=PAM
                   2819: 
                   2820:        AC_ARG_WITH(pam-login, [AS_HELP_STRING([--with-pam-login], [enable specific PAM session for sudo -i])],
                   2821:        [case $with_pam_login in
                   2822:            yes)        AC_DEFINE([HAVE_PAM_LOGIN])
                   2823:                        AC_MSG_CHECKING(whether to use PAM login)
                   2824:                        AC_MSG_RESULT(yes)
1.1.1.5 ! misho    2825:                        pam_login_service="sudo-i"
1.1       misho    2826:                        ;;
                   2827:            no)         ;;
                   2828:            *)          AC_MSG_ERROR(["--with-pam-login does not take an argument."])
                   2829:                        ;;
                   2830:        esac])
                   2831: 
                   2832:        AC_MSG_CHECKING(whether to use PAM session support)
                   2833:        AC_ARG_ENABLE(pam_session,
                   2834:        [AS_HELP_STRING([--disable-pam-session], [Disable PAM session support])],
                   2835:            [ case "$enableval" in
                   2836:                yes)    AC_MSG_RESULT(yes)
                   2837:                        ;;
1.1.1.4   misho    2838:                no)     AC_MSG_RESULT(no)
                   2839:                        AC_DEFINE(NO_PAM_SESSION)
                   2840:                        pam_session=off
                   2841:                        ;;
                   2842:                *)      AC_MSG_RESULT(no)
                   2843:                        AC_MSG_WARN([Ignoring unknown argument to --enable-pam-session: $enableval])
                   2844:                        ;;
1.1       misho    2845:            esac], AC_MSG_RESULT(yes))
                   2846:     fi
                   2847: fi
                   2848: 
                   2849: dnl
                   2850: dnl AIX general authentication
                   2851: dnl If set to "maybe" only enable if no other exclusive method in use.
                   2852: dnl
                   2853: if test ${with_aixauth-'no'} != "no"; then
                   2854:     if test X"$with_aixauth" != X"maybe" -o X"$AUTH_EXCL" = X""; then
                   2855:        AC_MSG_NOTICE([using AIX general authentication])
                   2856:        AC_DEFINE(HAVE_AIXAUTH)
                   2857:        AUTH_OBJS="$AUTH_OBJS aix_auth.lo";
                   2858:        SUDOERS_LIBS="${SUDOERS_LIBS} -ls"
                   2859:        AUTH_EXCL=AIX_AUTH
                   2860:     fi
                   2861: fi
                   2862: 
                   2863: dnl
                   2864: dnl BSD authentication
                   2865: dnl If set to "maybe" only enable if no other exclusive method in use.
                   2866: dnl
                   2867: if test ${with_bsdauth-'no'} != "no"; then
                   2868:     AC_CHECK_HEADER(bsd_auth.h, AC_DEFINE(HAVE_BSD_AUTH_H)
                   2869:        [AUTH_OBJS="$AUTH_OBJS bsdauth.lo"]
1.1.1.5 ! misho    2870:        [BSDAUTH_USAGE='[[-a type]] ']
1.1       misho    2871:        [AUTH_EXCL=BSD_AUTH; BAMAN=1],
                   2872:        [AC_MSG_ERROR([BSD authentication was specified but bsd_auth.h could not be found])])
                   2873: fi
                   2874: 
                   2875: dnl
                   2876: dnl SIA authentication for Tru64 Unix
                   2877: dnl
                   2878: if test ${CHECKSIA-'false'} = "true"; then
                   2879:     AC_CHECK_FUNCS(sia_ses_init, [found=true], [found=false])
                   2880:     if test "$found" = "true"; then
                   2881:        AUTH_EXCL=SIA
                   2882:        AUTH_OBJS="$AUTH_OBJS sia.lo"
                   2883:     fi
                   2884: fi
                   2885: 
                   2886: dnl
                   2887: dnl extra FWTK libs + includes
                   2888: dnl
                   2889: if test ${with_fwtk-'no'} != "no"; then
                   2890:     if test "$with_fwtk" != "yes"; then
                   2891:        SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_fwtk}])
1.1.1.4   misho    2892:        SUDO_APPEND_CPPFLAGS(-I${with_fwtk})
1.1       misho    2893:        with_fwtk=yes
                   2894:     fi
                   2895:     SUDOERS_LIBS="${SUDOERS_LIBS} -lauth -lfwall"
                   2896:     AUTH_OBJS="$AUTH_OBJS fwtk.lo"
                   2897: fi
                   2898: 
                   2899: dnl
                   2900: dnl extra SecurID lib + includes
                   2901: dnl
                   2902: if test ${with_SecurID-'no'} != "no"; then
                   2903:     if test "$with_SecurID" != "yes"; then
                   2904:        :
                   2905:     elif test -d /usr/ace/examples; then
                   2906:        with_SecurID=/usr/ace/examples
                   2907:     else
                   2908:        with_SecurID=/usr/ace
                   2909:     fi
1.1.1.4   misho    2910:     SUDO_APPEND_CPPFLAGS(-I${with_SecurID})
                   2911:     SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_SecurID}])
1.1.1.2   misho    2912:     SUDOERS_LIBS="${SUDOERS_LIBS} -laceclnt -lpthread"
                   2913:     AUTH_OBJS="$AUTH_OBJS securid5.lo";
1.1       misho    2914: fi
                   2915: 
                   2916: dnl
                   2917: dnl Non-mutually exclusive auth checks come next.
                   2918: dnl Note: passwd must be last of all!
                   2919: dnl
                   2920: 
                   2921: dnl
                   2922: dnl Convert default authentication methods to with_* if
                   2923: dnl no explicit authentication scheme was specified.
                   2924: dnl
                   2925: if test -z "${AUTH_EXCL}" -a -n "$AUTH_DEF"; then
                   2926:     for auth in $AUTH_DEF; do
                   2927:        case $auth in
                   2928:            passwd)     : ${with_passwd='maybe'};;
                   2929:        esac
                   2930:     done
                   2931: fi
                   2932: 
                   2933: dnl
                   2934: dnl Kerberos V
                   2935: dnl There is an easy way and a hard way...
                   2936: dnl
                   2937: if test ${with_kerb5-'no'} != "no"; then
                   2938:     AC_CHECK_PROG(KRB5CONFIG, krb5-config, yes, "")
                   2939:     if test -n "$KRB5CONFIG"; then
                   2940:        AC_DEFINE(HAVE_KERB5)
                   2941:        AUTH_OBJS="$AUTH_OBJS kerb5.lo"
                   2942:        CPPFLAGS="$CPPFLAGS `krb5-config --cflags`"
                   2943:        SUDOERS_LIBS="$SUDOERS_LIBS `krb5-config --libs`"
                   2944:        dnl
                   2945:        dnl Try to determine whether we have Heimdal or MIT Kerberos
                   2946:        dnl
                   2947:        AC_MSG_CHECKING(whether we are using Heimdal)
                   2948:        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
                   2949:                AC_MSG_RESULT(yes)
                   2950:                AC_DEFINE(HAVE_HEIMDAL)
                   2951:            ], [
                   2952:                AC_MSG_RESULT(no)
                   2953:            ]
                   2954:        )
                   2955:     else
                   2956:        AC_DEFINE(HAVE_KERB5)
                   2957:        dnl
                   2958:        dnl Use the specified directory, if any, else search for correct inc dir
                   2959:        dnl
                   2960:        if test "$with_kerb5" = "yes"; then
                   2961:            found=no
                   2962:            O_CPPFLAGS="$CPPFLAGS"
                   2963:            for dir in "" "kerberosV/" "krb5/" "kerberos5/" "kerberosv5/"; do
                   2964:                CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
                   2965:                AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]])], [found=yes; break])
                   2966:            done
                   2967:            if test X"$found" = X"no"; then
                   2968:                CPPFLAGS="$O_CPPFLAGS"
                   2969:                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])
                   2970:            fi
                   2971:        else
                   2972:            dnl XXX - try to include krb5.h here too
                   2973:            SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_kerb5}/lib])
1.1.1.4   misho    2974:            SUDO_APPEND_CPPFLAGS(-I${with_kerb5}/include)
1.1       misho    2975:        fi
                   2976: 
                   2977:        dnl
                   2978:        dnl Try to determine whether we have Heimdal or MIT Kerberos
                   2979:        dnl
                   2980:        AC_MSG_CHECKING(whether we are using Heimdal)
                   2981:        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
                   2982:                AC_MSG_RESULT(yes)
                   2983:                AC_DEFINE(HAVE_HEIMDAL)
                   2984:                # XXX - need to check whether -lcrypo is needed!
                   2985:                SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5 -lcrypto -ldes -lcom_err -lasn1"
                   2986:                AC_CHECK_LIB(roken, main, [SUDOERS_LIBS="${SUDOERS_LIBS} -lroken"])
                   2987:            ], [
                   2988:                AC_MSG_RESULT(no)
                   2989:                SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5 -lk5crypto -lcom_err"
                   2990:                AC_CHECK_LIB(krb5support, main, [SUDOERS_LIBS="${SUDOERS_LIBS} -lkrb5support"])
                   2991:        ])
                   2992:        AUTH_OBJS="$AUTH_OBJS kerb5.lo"
                   2993:     fi
                   2994:     _LIBS="$LIBS"
                   2995:     LIBS="${LIBS} ${SUDOERS_LIBS}"
                   2996:     AC_CHECK_FUNCS(krb5_verify_user krb5_init_secure_context)
                   2997:     AC_CHECK_FUNCS(krb5_get_init_creds_opt_alloc, [
                   2998:        AC_CACHE_CHECK([whether krb5_get_init_creds_opt_free takes a context],
                   2999:            sudo_cv_krb5_get_init_creds_opt_free_two_args, [
                   3000:                AC_COMPILE_IFELSE(
                   3001:                    [AC_LANG_PROGRAM(
                   3002:                        [[#include <krb5.h>]],
                   3003:                        [[krb5_get_init_creds_opt_free(NULL, NULL);]]
                   3004:                    )],
                   3005:                    [sudo_cv_krb5_get_init_creds_opt_free_two_args=yes],
                   3006:                    [sudo_cv_krb5_get_init_creds_opt_free_two_args=no]
                   3007:                )
                   3008:            ]
                   3009:        )
                   3010:     ])
                   3011:     if test X"$sudo_cv_krb5_get_init_creds_opt_free_two_args" = X"yes"; then
                   3012:        AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS)
                   3013:     fi
                   3014:     LIBS="$_LIBS"
1.1.1.2   misho    3015:     AC_MSG_CHECKING(whether to use an instance name for Kerberos V)
                   3016:     AC_ARG_ENABLE(kerb5-instance,
                   3017:     [AS_HELP_STRING([--enable-kerb5-instance], [instance string to append to the username (separated by a slash)])],
                   3018:        [ case "$enableval" in
                   3019:            yes)        AC_MSG_ERROR(["must give --enable-kerb5-instance an argument."])
                   3020:                        ;;
                   3021:            no)         AC_MSG_RESULT(no)
                   3022:                        ;;
                   3023:            *)          SUDO_DEFINE_UNQUOTED(SUDO_KRB5_INSTANCE, "$enableval")
                   3024:                        AC_MSG_RESULT([$enableval])
                   3025:                        ;;
                   3026:        esac], AC_MSG_RESULT(no))
1.1       misho    3027: fi
                   3028: 
                   3029: dnl
                   3030: dnl extra AFS libs and includes
                   3031: dnl
                   3032: if test ${with_AFS-'no'} = "yes"; then
                   3033: 
                   3034:     # looks like the "standard" place for AFS libs is /usr/afsws/lib
                   3035:     AFSLIBDIRS="/usr/lib/afs /usr/afsws/lib /usr/afsws/lib/afs"
                   3036:     for i in $AFSLIBDIRS; do
                   3037:        if test -d ${i}; then
                   3038:            SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [$i])
                   3039:            FOUND_AFSLIBDIR=true
                   3040:        fi
                   3041:     done
                   3042:     if test -z "$FOUND_AFSLIBDIR"; then
                   3043:        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.])
                   3044:     fi
                   3045: 
                   3046:     # Order is important here.  Note that we build AFS_LIBS from right to left
                   3047:     # since AFS_LIBS may be initialized with BSD compat libs that must go last
                   3048:     AFS_LIBS="-laudit ${AFS_LIBS}"
                   3049:     for i in $AFSLIBDIRS; do
                   3050:        if test -f ${i}/util.a; then
                   3051:            AFS_LIBS="${i}/util.a ${AFS_LIBS}"
                   3052:            FOUND_UTIL_A=true
                   3053:            break;
                   3054:        fi
                   3055:     done
                   3056:     if test -z "$FOUND_UTIL_A"; then
                   3057:        AFS_LIBS="-lutil ${AFS_LIBS}"
                   3058:     fi
                   3059:     AFS_LIBS="-lkauth -lprot -lubik -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err ${AFS_LIBS}"
                   3060: 
                   3061:     # AFS includes may live in /usr/include on some machines...
                   3062:     for i in /usr/afsws/include; do
                   3063:        if test -d ${i}; then
1.1.1.4   misho    3064:            SUDO_APPEND_CPPFLAGS(-I${i})
1.1       misho    3065:            FOUND_AFSINCDIR=true
                   3066:        fi
                   3067:     done
                   3068: 
                   3069:     if test -z "$FOUND_AFSLIBDIR"; then
                   3070:        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.])
                   3071:     fi
                   3072: 
                   3073:     AUTH_OBJS="$AUTH_OBJS afs.lo"
                   3074: fi
                   3075: 
                   3076: dnl
                   3077: dnl extra DCE obj + lib
                   3078: dnl Order of libs in HP-UX 10.x is important, -ldce must be last.
                   3079: dnl
                   3080: if test ${with_DCE-'no'} = "yes"; then
                   3081:     DCE_OBJS="${DCE_OBJS} dce_pwent.o"
                   3082:     SUDOERS_LIBS="${SUDOERS_LIBS} -ldce"
                   3083:     AUTH_OBJS="$AUTH_OBJS dce.lo"
                   3084: fi
                   3085: 
                   3086: dnl
                   3087: dnl extra S/Key lib and includes
                   3088: dnl
                   3089: if test "${with_skey-'no'}" = "yes"; then
                   3090:     O_LDFLAGS="$LDFLAGS"
                   3091:     if test "$with_skey" != "yes"; then
1.1.1.4   misho    3092:        SUDO_APPEND_CPPFLAGS(-I${with_skey}/include)
                   3093:        LDFLAGS="$LDFLAGS -L${with_skey}/lib"
1.1       misho    3094:        SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_skey}/lib])
                   3095:        AC_CHECK_HEADER([skey.h], [found=yes], [found=no], [#include <stdio.h>])
                   3096:     else
                   3097:        found=no
                   3098:        O_CPPFLAGS="$CPPFLAGS"
                   3099:        for dir in "" "/usr/local" "/usr/contrib"; do
                   3100:            test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
                   3101:            AC_CHECK_HEADER([skey.h], [found=yes; break], [],
1.1.1.3   misho    3102:                [#include <stdio.h>])
1.1       misho    3103:        done
                   3104:        if test "$found" = "no" -o -z "$dir"; then
                   3105:            CPPFLAGS="$O_CPPFLAGS"
                   3106:        else
1.1.1.4   misho    3107:            LDFLAGS="$LDFLAGS -L${dir}/lib"
1.1       misho    3108:            SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${dir}/lib])
                   3109:        fi
                   3110:        if test "$found" = "no"; then
                   3111:            AC_MSG_WARN([Unable to locate skey.h, you will have to edit the Makefile and add -I/path/to/skey/includes to CPPFLAGS])
                   3112:        fi
                   3113:     fi
                   3114:     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])])
                   3115:     AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS))
                   3116: 
                   3117:     AC_MSG_CHECKING([for RFC1938-compliant skeychallenge])
                   3118:     AC_COMPILE_IFELSE(
                   3119:        [AC_LANG_PROGRAM(
                   3120:            [[#include <stdio.h>
                   3121:            #include <skey.h>]],
                   3122:            [[skeychallenge(NULL, NULL, NULL, 0);]]
                   3123:        )], [
                   3124:            AC_DEFINE(HAVE_RFC1938_SKEYCHALLENGE)
                   3125:            AC_MSG_RESULT([yes])
                   3126:        ], [
                   3127:            AC_MSG_RESULT([no])
                   3128:        ]
                   3129:     )
                   3130: 
                   3131:     LDFLAGS="$O_LDFLAGS"
                   3132:     SUDOERS_LIBS="${SUDOERS_LIBS} -lskey"
                   3133:     AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
                   3134: fi
                   3135: 
                   3136: dnl
                   3137: dnl extra OPIE lib and includes
                   3138: dnl
                   3139: if test "${with_opie-'no'}" = "yes"; then
                   3140:     O_LDFLAGS="$LDFLAGS"
                   3141:     if test "$with_opie" != "yes"; then
1.1.1.4   misho    3142:        SUDO_APPEND_CPPFLAGS(-I${with_opie}/include)
                   3143:        LDFLAGS="$LDFLAGS -L${with_opie}/lib"
1.1       misho    3144:        SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_opie}/lib])
                   3145:        AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes], [found=no])
                   3146:     else
                   3147:        found=no
                   3148:        O_CPPFLAGS="$CPPFLAGS"
                   3149:        for dir in "" "/usr/local" "/usr/contrib"; do
                   3150:            test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
                   3151:            AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <opie.h>]])], [found=yes; break])
                   3152:        done
                   3153:        if test "$found" = "no" -o -z "$dir"; then
                   3154:            CPPFLAGS="$O_CPPFLAGS"
                   3155:        else
1.1.1.4   misho    3156:            LDFLAGS="$LDFLAGS -L${dir}/lib"
1.1       misho    3157:            SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${dir}/lib])
                   3158:        fi
                   3159:        if test "$found" = "no"; then
                   3160:            AC_MSG_WARN([Unable to locate opie.h, you will have to edit the Makefile and add -I/path/to/opie/includes to CPPFLAGS])
                   3161:        fi
                   3162:     fi
                   3163:     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])])
                   3164:     LDFLAGS="$O_LDFLAGS"
                   3165:     SUDOERS_LIBS="${SUDOERS_LIBS} -lopie"
                   3166:     AUTH_OBJS="$AUTH_OBJS rfc1938.lo"
                   3167: fi
                   3168: 
                   3169: dnl
                   3170: dnl Check for shadow password routines if we have not already done so.
                   3171: dnl If there is a specific list of functions to check we do that first.
                   3172: dnl Otherwise, we check for SVR4-style and then SecureWare-style.
                   3173: dnl
                   3174: if test ${with_passwd-'no'} != "no"; then
                   3175:     dnl
                   3176:     dnl if crypt(3) not in libc, look elsewhere
                   3177:     dnl
                   3178:     if test -z "$LIB_CRYPT"; then
                   3179:        _LIBS="$LIBS"
                   3180:        AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [test -n "$ac_lib" && SUDOERS_LIBS="${SUDOERS_LIBS} $ac_res"])
                   3181:        LIBS="$_LIBS"
                   3182:     fi
                   3183: 
                   3184:     if test "$CHECKSHADOW" = "true" -a -n "$shadow_funcs"; then
                   3185:        _LIBS="$LIBS"
                   3186:        LIBS="$LIBS $shadow_libs"
                   3187:        found=no
                   3188:        AC_CHECK_FUNCS($shadow_funcs, [found=yes])
                   3189:        if test "$found" = "yes"; then
                   3190:            SUDOERS_LIBS="$SUDOERS_LIBS $shadow_libs"
                   3191:        elif test -n "$shadow_libs_optional"; then
                   3192:            LIBS="$LIBS $shadow_libs_optional"
                   3193:            AC_CHECK_FUNCS($shadow_funcs, [found=yes])
                   3194:            if test "$found" = "yes"; then
                   3195:                SUDOERS_LIBS="$SUDOERS_LIBS $shadow_libs $shadow_libs_optional"
                   3196:            fi
                   3197:        fi
                   3198:        if test "$found" = "yes"; then
                   3199:            case "$shadow_funcs" in
                   3200:                *getprpwnam*) SECUREWARE=1;;
                   3201:            esac
                   3202:            test -n "$shadow_defs" && OSDEFS="${OSDEFS} $shadow_defs"
                   3203:        else
                   3204:            LIBS="$_LIBS"
                   3205:        fi
                   3206:        CHECKSHADOW=false
                   3207:     fi
                   3208:     if test "$CHECKSHADOW" = "true"; then
                   3209:        AC_SEARCH_LIBS([getspnam], [gen], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && SUDOERS_LIBS="${SUDOERS_LIBS} $ac_res"])
                   3210:     fi
                   3211:     if test "$CHECKSHADOW" = "true"; then
                   3212:        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"])
                   3213:     fi
                   3214:     if test -n "$SECUREWARE"; then
                   3215:        AC_CHECK_FUNCS(bigcrypt set_auth_parameters initprivs)
                   3216:        AUTH_OBJS="$AUTH_OBJS secureware.lo"
                   3217:     fi
                   3218: fi
                   3219: 
                   3220: dnl
                   3221: dnl extra lib and .o file for LDAP support
                   3222: dnl
                   3223: if test ${with_ldap-'no'} != "no"; then
1.1.1.4   misho    3224:     O_LDFLAGS="$LDFLAGS"
1.1       misho    3225:     if test "$with_ldap" != "yes"; then
                   3226:        SUDO_APPEND_LIBPATH(SUDOERS_LDFLAGS, [${with_ldap}/lib])
1.1.1.4   misho    3227:        LDFLAGS="$LDFLAGS -L${with_ldap}/lib"
                   3228:        SUDO_APPEND_CPPFLAGS(-I${with_ldap}/include)
1.1       misho    3229:        with_ldap=yes
                   3230:     fi
                   3231:     SUDOERS_OBJS="${SUDOERS_OBJS} ldap.lo"
                   3232:     LDAP=""
                   3233: 
                   3234:     _LIBS="$LIBS"
1.1.1.4   misho    3235:     LDAP_LIBS=""
                   3236:     IBMLDAP_EXTRA=""
1.1       misho    3237:     found=no
1.1.1.4   misho    3238:     # On HP-UX, libibmldap has a hidden dependency on libCsup
                   3239:     case "$host_os" in
                   3240:        hpux*) AC_CHECK_LIB(Csup, main, [IBMLDAP_EXTRA=" -lCsup"]);;
                   3241:     esac
                   3242:     AC_SEARCH_LIBS(ldap_init, "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}", [
                   3243:        test "$ac_res" != "none required" && LDAP_LIBS="$ac_res"
                   3244:        found=yes
                   3245:     ])
                   3246:     # If nothing linked, try -lldap and hope for the best
1.1       misho    3247:     if test "$found" = "no"; then
                   3248:        LDAP_LIBS="-lldap"
                   3249:     fi
1.1.1.4   misho    3250:     LIBS="${_LIBS} ${LDAP_LIBS}"
1.1       misho    3251:     dnl check if we need to link with -llber for ber_set_option
                   3252:     OLIBS="$LIBS"
                   3253:     AC_SEARCH_LIBS([ber_set_option], [lber], [found=yes], [found=no])
                   3254:     if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
                   3255:        LDAP_LIBS="$LDAP_LIBS -llber"
                   3256:     fi
                   3257:     dnl check if ldap.h includes lber.h for us
                   3258:     AC_MSG_CHECKING([whether lber.h is needed])
                   3259:     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
                   3260:     #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [AC_MSG_RESULT([no])], [
                   3261:     AC_MSG_RESULT([yes])
                   3262:     AC_DEFINE(HAVE_LBER_H)])
                   3263: 
1.1.1.4   misho    3264:     AC_CHECK_HEADERS([sasl/sasl.h] [sasl.h], [
                   3265:        AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s)
                   3266:        break
                   3267:     ])
1.1       misho    3268:     AC_CHECK_HEADERS([ldap_ssl.h] [mps/ldap_ssl.h], [break], [], [#include <ldap.h>])
1.1.1.3   misho    3269:     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)
1.1       misho    3270:     AC_CHECK_FUNCS(ldap_search_ext_s ldap_search_st, [break])
                   3271: 
                   3272:     if test X"$check_gss_krb5_ccache_name" = X"yes"; then
                   3273:        AC_CHECK_LIB(gssapi, gss_krb5_ccache_name,
                   3274:            AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
                   3275:            [LDAP_LIBS="${LDAP_LIBS} -lgssapi"],
                   3276:            AC_CHECK_LIB(gssapi_krb5, gss_krb5_ccache_name,
                   3277:                AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
                   3278:                [LDAP_LIBS="${LDAP_LIBS} -lgssapi_krb5"])
                   3279:        )
                   3280: 
                   3281:        # gssapi headers may be separate or part of Kerberos V
                   3282:        found=no
                   3283:        O_CPPFLAGS="$CPPFLAGS"
                   3284:        for dir in "" "kerberosV" "krb5" "kerberos5" "kerberosv5"; do
                   3285:            test X"$dir" != X"" && CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
                   3286:            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])])
                   3287:        done
                   3288:        if test X"$found" != X"no"; then
                   3289:            AC_CHECK_HEADERS([$found])
                   3290:            if test X"$found" = X"gssapi/gssapi.h"; then
                   3291:                AC_CHECK_HEADERS([gssapi/gssapi_krb5.h])
                   3292:            fi
                   3293:        else
                   3294:            CPPFLAGS="$O_CPPFLAGS"
                   3295:            AC_MSG_WARN([Unable to locate gssapi.h, you will have to edit the Makefile and add -I/path/to/gssapi/includes to CPPFLAGS])
                   3296:        fi
                   3297:     fi
                   3298: 
                   3299:     SUDOERS_LIBS="${SUDOERS_LIBS} ${LDAP_LIBS}"
                   3300:     LIBS="$_LIBS"
1.1.1.4   misho    3301:     LDFLAGS="$O_LDFLAGS"
1.1       misho    3302: fi
                   3303: 
                   3304: #
                   3305: # How to do dynamic object loading.
                   3306: # We support dlopen() and sh_load(), else fall back to static loading.
                   3307: #
                   3308: case "$lt_cv_dlopen" in
                   3309:     dlopen)
                   3310:        AC_DEFINE(HAVE_DLOPEN)
1.1.1.4   misho    3311:        SUDO_OBJS="$SUDO_OBJS locale_stub.o"
1.1       misho    3312:        LT_STATIC="--tag=disable-static"
                   3313:        ;;
                   3314:     shl_load)
                   3315:        AC_DEFINE(HAVE_SHL_LOAD)
1.1.1.4   misho    3316:        SUDO_OBJS="$SUDO_OBJS locale_stub.o"
1.1       misho    3317:        LT_STATIC="--tag=disable-static"
                   3318:        AC_LIBOBJ(dlopen)
                   3319:        ;;
                   3320:     *)
                   3321:        if test X"${ac_cv_func_dlopen}" = X"yes"; then
                   3322:            AC_MSG_ERROR(["dlopen present but libtool doesn't appear to support your platform."])
                   3323:        fi
                   3324:        # Preload sudoers module symbols
                   3325:        SUDO_OBJS="${SUDO_OBJS} preload.o"
                   3326:        SUDO_LIBS="${SUDO_LIBS} \$(top_builddir)/plugins/sudoers/sudoers.la"
                   3327:        LT_STATIC=""
                   3328:        AC_LIBOBJ(dlopen)
                   3329:        ;;
                   3330: esac
                   3331: 
                   3332: #
                   3333: # Add library needed for dynamic loading, if any.
                   3334: #
                   3335: LIBDL="$lt_cv_dlopen_libs"
                   3336: if test X"$LIBDL" != X""; then
                   3337:     SUDO_LIBS="${SUDO_LIBS} $LIBDL"
                   3338:     SUDOERS_LIBS="${SUDOERS_LIBS} $LIBDL"
                   3339: fi
                   3340: 
1.1.1.3   misho    3341: # On HP-UX, you cannot dlopen() a shared object that uses pthreads unless
                   3342: # the main program is linked against -lpthread.  We have no knowledge of
                   3343: # what libraries a plugin may depend on (e.g. HP-UX LDAP which uses pthreads)
                   3344: # so always link against -lpthread on HP-UX if it is available.
1.1       misho    3345: # This check should go after all other libraries tests.
1.1.1.4   misho    3346: case "$host_os" in
                   3347:     hpux*)
1.1       misho    3348:        AC_CHECK_LIB(pthread, main, [SUDO_LIBS="${SUDO_LIBS} -lpthread"])
1.1.1.4   misho    3349:        OSDEFS="${OSDEFS} -D_REENTRANT"
1.1       misho    3350:        ;;
                   3351: esac
                   3352: 
                   3353: dnl
                   3354: dnl Check for log file, timestamp and iolog locations
                   3355: dnl
                   3356: if test "$utmp_style" = "LEGACY"; then
                   3357:     SUDO_PATH_UTMP
                   3358: fi
                   3359: SUDO_LOGFILE
                   3360: SUDO_TIMEDIR
                   3361: SUDO_IO_LOGDIR
                   3362: 
                   3363: dnl
1.1.1.3   misho    3364: dnl Turn warnings into errors.
                   3365: dnl All compiler/loader tests after this point will fail if
                   3366: dnl a warning is displayed (nornally, warnings are not fata).
                   3367: dnl
                   3368: AC_LANG_WERROR
                   3369: 
                   3370: dnl
                   3371: dnl If compiler supports the -static-libgcc flag use it unless we have
                   3372: dnl GNU ld (which can avoid linking in libgcc when it is not needed).
                   3373: dnl This test relies on AC_LANG_WERROR
                   3374: dnl
                   3375: if test -n "$GCC" -a "$lt_cv_prog_gnu_ld" != "yes" -a -n "$GCC"; then
                   3376:     AX_CHECK_COMPILE_FLAG([-static-libgcc], [LT_LDFLAGS="$LT_LDFLAGS -Wc,-static-libgcc"])
                   3377: fi
                   3378: 
                   3379: dnl
                   3380: dnl Check for symbol visibility support.
                   3381: dnl This test relies on AC_LANG_WERROR
                   3382: dnl
1.1.1.4   misho    3383: if test -n "$GCC"; then
                   3384:     AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
                   3385:        AC_DEFINE(HAVE_DSO_VISIBILITY)
                   3386:        CFLAGS="${CFLAGS} -fvisibility=hidden"
                   3387:        LT_LDEXPORTS=
                   3388:        LT_LDDEP=
                   3389:        NO_VIZ=
                   3390:     ])
                   3391: else
                   3392:     case "$host_os" in
                   3393:        hpux*)
                   3394:            AX_CHECK_COMPILE_FLAG([-Bhidden_def], [
                   3395:                AC_DEFINE(HAVE_DSO_VISIBILITY)
                   3396:                CFLAGS="${CFLAGS} -Bhidden_def"
                   3397:                LT_LDEXPORTS=
                   3398:                LT_LDDEP=
                   3399:            ])
                   3400:            ;;
                   3401:        solaris2*)
                   3402:            AX_CHECK_COMPILE_FLAG([-xldscope=hidden], [
                   3403:                AC_DEFINE(HAVE_DSO_VISIBILITY)
                   3404:                CFLAGS="${CFLAGS} -xldscope=hidden"
                   3405:                LT_LDEXPORTS=
                   3406:                LT_LDDEP=
                   3407:            ])
                   3408:            ;;
                   3409:     esac
                   3410: fi
1.1.1.3   misho    3411: 
                   3412: dnl
                   3413: dnl If the compiler doesn't have symbol visibility support, it may
                   3414: dnl support version scripts (only GNU and Solaris ld).
                   3415: dnl This test relies on AC_LANG_WERROR
                   3416: dnl
                   3417: if test -n "$LT_LDEXPORTS"; then
                   3418:     if test "$lt_cv_prog_gnu_ld" = "yes"; then
                   3419:        AC_CACHE_CHECK([whether ld supports anonymous map files],
                   3420:            [sudo_cv_var_gnu_ld_anon_map],
                   3421:            [
1.1.1.4   misho    3422:                sudo_cv_var_gnu_ld_anon_map=no
1.1.1.3   misho    3423:                cat > conftest.map <<-EOF
                   3424:                {
                   3425:                    global: foo;
                   3426:                    local:  *;
                   3427:                };
                   3428: EOF
                   3429:                _CFLAGS="$CFLAGS"
                   3430:                CFLAGS="$CFLAGS $lt_prog_compiler_pic"
                   3431:                _LDFLAGS="$LDFLAGS"
                   3432:                LDFLAGS="$LDFLAGS -fpic -shared -Wl,--version-script,./conftest.map"
1.1.1.4   misho    3433:                AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
                   3434:                    [sudo_cv_var_gnu_ld_anon_map=yes])
1.1.1.3   misho    3435:                CFLAGS="$_CFLAGS"
                   3436:                LDFLAGS="$_LDFLAGS"
                   3437:            ]
                   3438:        )
                   3439:        if test "$sudo_cv_var_gnu_ld_anon_map" = "yes"; then
                   3440:            LT_LDEXPORTS=; LT_LDDEP="\$(shlib_map)"; LT_LDMAP="-Wl,--version-script,\$(shlib_map)"
                   3441:        fi
                   3442:     else
1.1.1.4   misho    3443:        case "$host_os" in
                   3444:            solaris2*)
1.1.1.3   misho    3445:                AC_CACHE_CHECK([whether ld supports anonymous map files],
                   3446:                    [sudo_cv_var_solaris_ld_anon_map],
                   3447:                    [
1.1.1.4   misho    3448:                        sudo_cv_var_solaris_ld_anon_map=no
1.1.1.3   misho    3449:                        cat > conftest.map <<-EOF
                   3450:                        {
                   3451:                            global: foo;
                   3452:                            local:  *;
                   3453:                        };
                   3454: EOF
                   3455:                        _CFLAGS="$CFLAGS"
                   3456:                        CFLAGS="$CFLAGS $lt_prog_compiler_pic"
                   3457:                        _LDFLAGS="$LDFLAGS"
                   3458:                        LDFLAGS="$LDFLAGS -shared -Wl,-M,./conftest.map"
1.1.1.4   misho    3459:                        AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
                   3460:                            [sudo_cv_var_solaris_ld_anon_map=yes])
1.1.1.3   misho    3461:                        CFLAGS="$_CFLAGS"
                   3462:                        LDFLAGS="$_LDFLAGS"
                   3463:                    ]
                   3464:                )
                   3465:                if test "$sudo_cv_var_solaris_ld_anon_map" = "yes"; then
                   3466:                    LT_LDEXPORTS=; LT_LDDEP="\$(shlib_map)"; LT_LDMAP="-Wl,-M,\$(shlib_map)"
                   3467:                fi
                   3468:                ;;
1.1.1.4   misho    3469:            hpux*)
1.1.1.3   misho    3470:                AC_CACHE_CHECK([whether ld supports controlling exported symbols],
                   3471:                    [sudo_cv_var_hpux_ld_symbol_export],
                   3472:                    [
1.1.1.4   misho    3473:                        sudo_cv_var_hpux_ld_symbol_export=no
1.1.1.3   misho    3474:                        echo "+e foo" > conftest.opt
                   3475:                        _CFLAGS="$CFLAGS"
                   3476:                        CFLAGS="$CFLAGS $lt_prog_compiler_pic"
                   3477:                        _LDFLAGS="$LDFLAGS"
                   3478:                        if test -n "$GCC"; then
                   3479:                            LDFLAGS="$LDFLAGS -shared -Wl,-c,./conftest.opt"
                   3480:                        else
                   3481:                            LDFLAGS="$LDFLAGS -Wl,-b -Wl,-c,./conftest.opt"
                   3482:                        fi
1.1.1.4   misho    3483:                        AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
                   3484:                            [sudo_cv_var_hpux_ld_symbol_export=yes])
1.1.1.3   misho    3485:                        CFLAGS="$_CFLAGS"
                   3486:                        LDFLAGS="$_LDFLAGS"
1.1.1.4   misho    3487:                        rm -f conftest.opt
1.1.1.3   misho    3488:                    ]
                   3489:                )
                   3490:                if test "$sudo_cv_var_hpux_ld_symbol_export" = "yes"; then
                   3491:                    LT_LDEXPORTS=; LT_LDDEP="\$(shlib_opt)"; LT_LDOPT="-Wl,-c,\$(shlib_opt)"
                   3492:                fi
                   3493:                ;;
                   3494:        esac
                   3495:     fi
                   3496: fi
                   3497: 
                   3498: dnl
                   3499: dnl Check for PIE executable support if using gcc.
                   3500: dnl This test relies on AC_LANG_WERROR
                   3501: dnl
1.1.1.4   misho    3502: if test -n "$GCC"; then
                   3503:     if test -z "$enable_pie"; then
                   3504:        case "$host_os" in
                   3505:            linux*)
                   3506:                # Attempt to build with PIE support
                   3507:                enable_pie="maybe"
                   3508:                ;;
                   3509:        esac
                   3510:     fi
                   3511:     if test -n "$enable_pie"; then
                   3512:        if test "$enable_pie" = "no"; then
                   3513:            AX_CHECK_COMPILE_FLAG([-fno-pie], [
                   3514:                _CFLAGS="$CFLAGS"
                   3515:                CFLAGS="$CFLAGS -fno-pie"
                   3516:                AX_CHECK_LINK_FLAG([-nopie], [
                   3517:                    PIE_CFLAGS="-fno-pie"
                   3518:                    PIE_LDFLAGS="-nopie"
                   3519:                ])
                   3520:                CFLAGS="$_CFLAGS"
                   3521:            ])
                   3522:        else
                   3523:            AX_CHECK_COMPILE_FLAG([-fPIE], [
                   3524:                _CFLAGS="$CFLAGS"
                   3525:                CFLAGS="$CFLAGS -fPIE"
                   3526:                AX_CHECK_LINK_FLAG([-pie], [
                   3527:                    if test "$enable_pie" = "maybe"; then
                   3528:                        SUDO_WORKING_PIE([enable_pie=yes], [])
                   3529:                    fi
                   3530:                    if test "$enable_pie" = "yes"; then
                   3531:                        PIE_CFLAGS="-fPIE"
                   3532:                        PIE_LDFLAGS="-Wc,-fPIE -pie"
                   3533:                    fi
                   3534:                ])
                   3535:                CFLAGS="$_CFLAGS"
                   3536:            ])
                   3537:        fi
                   3538:     fi
                   3539: fi
                   3540: if test "$enable_pie" != "yes"; then
                   3541:     # Solaris 11.1 and higher supports tagging binaries to use ASLR
                   3542:     case "$host_os" in
                   3543:        solaris2.1[[1-9]]|solaris2.[[2-9]][[0-9]])
                   3544:            AX_CHECK_LINK_FLAG([-Wl,-z,aslr], [PIE_LDFLAGS="${PIE_LDFLAGS}${PIE_LDFLAGS+ }-Wl,-z,aslr"])
                   3545:            ;;
                   3546:     esac
1.1.1.3   misho    3547: fi
                   3548: 
                   3549: dnl
                   3550: dnl Check for -fstack-protector and -z relro support
                   3551: dnl This test relies on AC_LANG_WERROR
                   3552: dnl
                   3553: if test "$enable_hardening" != "no"; then
1.1.1.4   misho    3554:     if test -n "$GCC"; then
                   3555:        AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [
                   3556:            AX_CHECK_LINK_FLAG([-fstack-protector-all], [
                   3557:                SSP_CFLAGS="-fstack-protector-all"
                   3558:                SSP_LDFLAGS="-Wc,-fstack-protector-all"
                   3559:            ])
1.1.1.3   misho    3560:        ])
1.1.1.4   misho    3561:        if test -z "$SSP_CFLAGS"; then
                   3562:            AX_CHECK_COMPILE_FLAG([-fstack-protector], [
                   3563:                AX_CHECK_LINK_FLAG([-fstack-protector], [
                   3564:                    SSP_CFLAGS="-fstack-protector"
                   3565:                    SSP_LDFLAGS="-Wc,-fstack-protector"
                   3566:                ])
                   3567:            ])
                   3568:        fi
                   3569:     fi
1.1.1.3   misho    3570:     AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="${LDFLAGS} -Wl,-z,relro"])
                   3571: fi
                   3572: 
                   3573: dnl
1.1       misho    3574: dnl Use passwd auth module?
                   3575: dnl
                   3576: case "$with_passwd" in
                   3577: yes|maybe)
                   3578:     AUTH_OBJS="$AUTH_OBJS getspwuid.lo passwd.lo"
                   3579:     ;;
                   3580: *)
                   3581:     AC_DEFINE(WITHOUT_PASSWD)
                   3582:     if test -z "$AUTH_OBJS"; then
                   3583:        AC_MSG_ERROR([no authentication methods defined.])
                   3584:     fi
                   3585:     ;;
                   3586: esac
                   3587: AUTH_OBJS=${AUTH_OBJS# }
                   3588: _AUTH=`echo "$AUTH_OBJS" | sed -e 's/\.lo//g' -e 's/getspwuid *//'`
                   3589: AC_MSG_NOTICE([using the following authentication methods: $_AUTH])
                   3590: 
                   3591: dnl
                   3592: dnl LIBS may contain duplicates from SUDO_LIBS, SUDOERS_LIBS, or NET_LIBS
                   3593: dnl
                   3594: if test -n "$LIBS"; then
                   3595:     L="$LIBS"
                   3596:     LIBS=
                   3597:     for l in ${L}; do
                   3598:        dupe=0
                   3599:        for sl in ${SUDO_LIBS} ${SUDOERS_LIBS} ${NET_LIBS}; do
                   3600:            test $l = $sl && dupe=1
                   3601:        done
                   3602:        test $dupe = 0 && LIBS="${LIBS} $l"
                   3603:     done
                   3604: fi
                   3605: 
                   3606: dnl
1.1.1.4   misho    3607: dnl OS-specific initialization
                   3608: dnl
                   3609: AC_DEFINE_UNQUOTED(os_init, $OS_INIT, [Define to an OS-specific initialization function or `os_init_common'.])
                   3610: 
                   3611: dnl
1.1       misho    3612: dnl We add -Wall and -Werror after all tests so they don't cause failures
                   3613: dnl
                   3614: if test -n "$GCC"; then
                   3615:     if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
                   3616:        CFLAGS="${CFLAGS} -Wall"
                   3617:     fi
                   3618:     if test X"$enable_werror" = X"yes"; then
                   3619:        CFLAGS="${CFLAGS} -Werror"
                   3620:     fi
                   3621: fi
                   3622: 
                   3623: dnl
1.1.1.3   misho    3624: dnl Skip regress tests and sudoers sanity check if cross compiling.
                   3625: dnl
                   3626: CROSS_COMPILING="$cross_compiling"
                   3627: 
                   3628: dnl
1.1       misho    3629: dnl Set exec_prefix
                   3630: dnl
                   3631: test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
                   3632: 
                   3633: dnl
                   3634: dnl Defer setting _PATH_SUDO_NOEXEC until after exec_prefix is set
                   3635: dnl XXX - this is gross!
                   3636: dnl
1.1.1.4   misho    3637: if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no" -o "$enabled_shared" != X"no"; then
1.1       misho    3638:     oexec_prefix="$exec_prefix"
                   3639:     if test "$exec_prefix" = '$(prefix)'; then
                   3640:        if test "$prefix" = "NONE"; then
                   3641:            exec_prefix="$ac_default_prefix"
                   3642:        else
                   3643:            exec_prefix="$prefix"
                   3644:        fi
                   3645:     fi
                   3646:     if test X"$with_noexec" != X"no"; then
                   3647:        PROGS="${PROGS} libsudo_noexec.la"
                   3648:        INSTALL_NOEXEC="install-noexec"
                   3649: 
1.1.1.2   misho    3650:        noexec_file="$with_noexec"
                   3651:        _noexec_file=
                   3652:        while test X"$noexec_file" != X"$_noexec_file"; do
                   3653:            _noexec_file="$noexec_file"
                   3654:            eval noexec_file="$_noexec_file"
                   3655:        done
1.1       misho    3656:        SUDO_DEFINE_UNQUOTED(_PATH_SUDO_NOEXEC, "$noexec_file", [The fully qualified pathname of sudo_noexec.so])
                   3657:     fi
                   3658:     if test X"$with_selinux" != X"no"; then
1.1.1.4   misho    3659:        sesh_file="$libexecdir/sudo/sesh"
1.1.1.2   misho    3660:        _sesh_file=
                   3661:        while test X"$sesh_file" != X"$_sesh_file"; do
                   3662:            _sesh_file="$sesh_file"
                   3663:            eval sesh_file="$_sesh_file"
                   3664:        done
1.1.1.4   misho    3665:        SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SESH, "$sesh_file")
                   3666:     fi
                   3667:     if test X"$enable_shared" != X"no"; then
                   3668:        PLUGINDIR="$with_plugindir"
                   3669:        _PLUGINDIR=
                   3670:        while test X"$PLUGINDIR" != X"$_PLUGINDIR"; do
                   3671:            _PLUGINDIR="$PLUGINDIR"
                   3672:            eval PLUGINDIR="$_PLUGINDIR"
                   3673:        done
                   3674:        SUDO_DEFINE_UNQUOTED(_PATH_SUDO_PLUGIN_DIR, "$PLUGINDIR/")
                   3675:        SUDO_DEFINE_UNQUOTED(SUDOERS_PLUGIN, "sudoers.so")
1.1       misho    3676:     fi
                   3677:     exec_prefix="$oexec_prefix"
                   3678: fi
1.1.1.4   misho    3679: if test X"$with_selinux" = X"no"; then
                   3680:     SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SESH, NULL)
                   3681: fi
                   3682: 
                   3683: dnl
                   3684: dnl Add -R options to LDFLAGS, etc.
                   3685: dnl
                   3686: if test X"$LDFLAGS_R" != X""; then
                   3687:     LDFLAGS="$LDFLAGS $LDFLAGS_R"
                   3688: fi
                   3689: if test X"$SUDOERS_LDFLAGS_R" != X""; then
                   3690:     SUDOERS_LDFLAGS="$SUDOERS_LDFLAGS $SUDOERS_LDFLAGS_R"
                   3691: fi
                   3692: if test X"$ZLIB_R" != X""; then
                   3693:     ZLIB="$ZLIB_R $ZLIB"
                   3694: fi
1.1       misho    3695: 
                   3696: dnl
                   3697: dnl Override default configure dirs for the Makefile
                   3698: dnl
                   3699: if test X"$prefix" = X"NONE"; then
                   3700:     test "$mandir" = '${datarootdir}/man' && mandir='$(prefix)/man'
                   3701: else
                   3702:     test "$mandir" = '${datarootdir}/man' && mandir='$(datarootdir)/man'
                   3703: fi
                   3704: test "$bindir" = '${exec_prefix}/bin' && bindir='$(exec_prefix)/bin'
                   3705: test "$sbindir" = '${exec_prefix}/sbin' && sbindir='$(exec_prefix)/sbin'
                   3706: test "$libexecdir" = '${exec_prefix}/libexec' && libexecdir='$(exec_prefix)/libexec'
                   3707: test "$includedir" = '${prefix}/include' && includedir='$(prefix)/include'
                   3708: test "$datarootdir" = '${prefix}/share' && datarootdir='$(prefix)/share'
                   3709: test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}' && docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)'
1.1.1.3   misho    3710: test "$localedir" = '${datarootdir}/locale' && localedir='$(datarootdir)/locale'
                   3711: test "$localstatedir" = '${prefix}/var' && localstatedir='$(prefix)/var'
1.1       misho    3712: test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/etc'
                   3713: 
                   3714: dnl
                   3715: dnl Substitute into the Makefile and man pages
                   3716: dnl
1.1.1.4   misho    3717: 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])
1.1       misho    3718: AC_OUTPUT
                   3719: 
                   3720: dnl
                   3721: dnl Spew any text the user needs to know about
                   3722: dnl
                   3723: if test "$with_pam" = "yes"; then
1.1.1.4   misho    3724:     case $host_os in
                   3725:        hpux*)
1.1.1.2   misho    3726:            if test -f /usr/lib/security/libpam_hpsec.so.1; then
                   3727:                AC_MSG_NOTICE([You may wish to add the following line to /etc/pam.conf])
                   3728:                AC_MSG_NOTICE([sudo session required libpam_hpsec.so.1 bypass_umask bypass_last_login])
                   3729:            fi
                   3730:            ;;
1.1.1.4   misho    3731:        linux*)
1.1       misho    3732:            AC_MSG_NOTICE([You will need to customize sample.pam and install it as /etc/pam.d/sudo])
                   3733:            ;;
                   3734:     esac
                   3735: fi
                   3736: 
                   3737: dnl
                   3738: dnl Autoheader templates
                   3739: dnl
                   3740: AH_TEMPLATE(BROKEN_SYSLOG, [Define to 1 if the `syslog' function returns a non-zero int to denote failure.])
                   3741: AH_TEMPLATE(CLASSIC_INSULTS, [Define to 1 if you want the insults from the "classic" version sudo.])
                   3742: AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twisted minds of CSOps.])
                   3743: AH_TEMPLATE(SUDOERS_PLUGIN, [The name of the sudoers plugin, including extension.])
                   3744: 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.])
                   3745: AH_TEMPLATE(ENV_DEBUG, [Define to 1 to enable environment function debugging.])
                   3746: AH_TEMPLATE(ENV_EDITOR, [Define to 1 if you want visudo to honor the EDITOR and VISUAL env variables.])
                   3747: AH_TEMPLATE(FQDN, [Define to 1 if you want to require fully qualified hosts in sudoers.])
                   3748: AH_TEMPLATE(ENV_RESET, [Define to 1 to enable environment resetting by default.])
                   3749: AH_TEMPLATE(GOONS_INSULTS, [Define to 1 if you want insults from the "Goon Show".])
                   3750: AH_TEMPLATE(HAL_INSULTS, [Define to 1 if you want 2001-like insults.])
                   3751: AH_TEMPLATE(HAVE_AFS, [Define to 1 if you use AFS.])
                   3752: AH_TEMPLATE(HAVE_AIXAUTH, [Define to 1 if you use AIX general authentication.])
                   3753: AH_TEMPLATE(HAVE_BSD_AUTH_H, [Define to 1 if you use BSD authentication.])
                   3754: AH_TEMPLATE(HAVE_BSM_AUDIT, [Define to 1 to enable BSM audit support.])
                   3755: AH_TEMPLATE(HAVE_DCE, [Define to 1 if you use OSF DCE.])
                   3756: AH_TEMPLATE(HAVE_DD_FD, [Define to 1 if your `DIR' contains dd_fd.])
                   3757: AH_TEMPLATE(HAVE_DIRFD, [Define to 1 if you have the `dirfd' function or macro.])
                   3758: AH_TEMPLATE(HAVE_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.])
                   3759: AH_TEMPLATE(HAVE_DLOPEN, [Define to 1 if you have the `dlopen' function.])
                   3760: AH_TEMPLATE(HAVE_FCNTL_CLOSEM, [Define to 1 if your system has the F_CLOSEM fcntl.])
                   3761: AH_TEMPLATE(HAVE_FNMATCH, [Define to 1 if you have the `fnmatch' function.])
                   3762: AH_TEMPLATE(HAVE_FWTK, [Define to 1 if you use the FWTK authsrv daemon.])
1.1.1.4   misho    3763: AH_TEMPLATE(HAVE_GETAUTHUID, [Define to 1 if you have the `getauthuid' function. (ULTRIX 4.x  shadow passwords).])
                   3764: AH_TEMPLATE(HAVE_GETPRPWNAM, [Define to 1 if you have the `getprpwnam' function.  (SecureWare-style shadow passwords).])
                   3765: AH_TEMPLATE(HAVE_GETPWANAM, [Define to 1 if you have the `getpwanam' function. (SunOS 4.x shadow passwords).])
                   3766: AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR4-style shadow passwords).])
                   3767: AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords).])
1.1       misho    3768: AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.])
                   3769: AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.])
1.1.1.4   misho    3770: AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled).])
                   3771: AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled).])
1.1       misho    3772: AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.])
                   3773: AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC, [Define to 1 if you have the `krb5_get_init_creds_opt_alloc' function.])
                   3774: 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.])
                   3775: AH_TEMPLATE(HAVE_KRB5_INIT_SECURE_CONTEXT, [Define to 1 if you have the `krb5_init_secure_context' function.])
                   3776: AH_TEMPLATE(HAVE_KRB5_VERIFY_USER, [Define to 1 if you have the `krb5_verify_user' function.])
1.1.1.4   misho    3777: AH_TEMPLATE(HAVE_LBER_H, [Define to 1 if your LDAP needs <lber.h>. (OpenLDAP does not).])
1.1       misho    3778: AH_TEMPLATE(HAVE_LDAP, [Define to 1 if you use LDAP for sudoers.])
                   3779: AH_TEMPLATE(HAVE_LIBINTL_H, [Define to 1 if you have the <libintl.h> header file.])
                   3780: AH_TEMPLATE(HAVE_LINUX_AUDIT, [Define to 1 to enable Linux audit support.])
1.1.1.3   misho    3781: AH_TEMPLATE(HAVE_SSSD, [Define to 1 to enable SSSD support.])
1.1       misho    3782: AH_TEMPLATE(HAVE_OPIE, [Define to 1 if you use NRL OPIE.])
1.1.1.5 ! misho    3783: AH_TEMPLATE(HAVE_OPTRESET, [Define to 1 if you have the `optreset' symbol.])
1.1       misho    3784: AH_TEMPLATE(HAVE_PAM, [Define to 1 if you use PAM authentication.])
                   3785: AH_TEMPLATE(HAVE_PAM_LOGIN, [Define to 1 if you use a specific PAM session for sudo -i.])
                   3786: AH_TEMPLATE(HAVE_PROJECT_H, [Define to 1 if you have the <project.h> header file.])
                   3787: AH_TEMPLATE(HAVE_SECURID, [Define to 1 if you use SecurID for authentication.])
                   3788: AH_TEMPLATE(HAVE_SELINUX, [Define to 1 to enable SELinux RBAC support.])
                   3789: AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.])
                   3790: AH_TEMPLATE(HAVE_SHL_LOAD, [Define to 1 if you have the `shl_load' function.])
                   3791: AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.])
                   3792: AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().])
1.1.1.4   misho    3793: AH_TEMPLATE(HAVE_RFC1938_SKEYCHALLENGE, [Define to 1 if the skeychallenge() function is RFC1938-compliant and takes 4 arguments.])
                   3794: AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union.])
                   3795: AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member.])
                   3796: AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member.])
1.1       misho    3797: AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.])
                   3798: AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.])
1.1.1.4   misho    3799: AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements.])
1.1       misho    3800: AH_TEMPLATE(LOGGING, [Define to SLOG_SYSLOG, SLOG_FILE, or SLOG_BOTH.])
                   3801: AH_TEMPLATE(LONG_OTP_PROMPT, [Define to 1 if you want a two line OTP (S/Key or OPIE) prompt.])
                   3802: AH_TEMPLATE(NO_AUTHENTICATION, [Define to 1 if you don't want sudo to prompt for a password by default.])
                   3803: AH_TEMPLATE(NO_LECTURE, [Define to 1 if you don't want users to get the lecture the first they user sudo.])
1.1.1.4   misho    3804: AH_TEMPLATE(NO_PAM_SESSION, [Define to 1 if you don't want to use sudo's PAM session support.])
1.1       misho    3805: AH_TEMPLATE(NO_ROOT_MAILER, [Define to avoid runing the mailer as root.])
                   3806: AH_TEMPLATE(NO_ROOT_SUDO, [Define to 1 if root should not be allowed to use sudo.])
                   3807: AH_TEMPLATE(NO_TTY_TICKETS, [Define to 1 if you want a single ticket file instead of per-tty files.])
                   3808: AH_TEMPLATE(PC_INSULTS, [Define to 1 to replace politically incorrect insults with less offensive ones.])
                   3809: AH_TEMPLATE(SECURE_PATH, [Define to 1 to override the user's path with a built-in one.])
                   3810: AH_TEMPLATE(SEND_MAIL_WHEN_NOT_OK, [Define to 1 to send mail when the user is not allowed to run a command.])
                   3811: 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.])
                   3812: AH_TEMPLATE(SEND_MAIL_WHEN_NO_USER, [Define to 1 to send mail when the user is not in the sudoers file.])
                   3813: AH_TEMPLATE(SHELL_IF_NO_ARGS, [Define to 1 if you want sudo to start a shell if given no arguments.])
                   3814: AH_TEMPLATE(SHELL_SETS_HOME, [Define to 1 if you want sudo to set $HOME in shell mode.])
                   3815: AH_TEMPLATE(STUB_LOAD_INTERFACES, [Define to 1 if the code in interfaces.c does not compile for you.])
                   3816: 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.])
                   3817: 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.])
                   3818: AH_TEMPLATE(USE_INSULTS, [Define to 1 if you want to insult the user for entering an incorrect password.])
                   3819: AH_TEMPLATE(USE_STOW, [Define to 1 if you use GNU stow packaging.])
                   3820: AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for authentication.])
                   3821: AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
                   3822: AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
1.1.1.2   misho    3823: AH_TEMPLATE(socklen_t, [Define to `unsigned int' if <sys/socket.h> doesn't define.])
1.1       misho    3824: AH_TEMPLATE(HAVE_STRUCT_UTMP_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmp'.])
                   3825: AH_TEMPLATE(HAVE_STRUCT_UTMPX_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmpx'.])
1.1.1.2   misho    3826: AH_TEMPLATE(HAVE___FUNC__, [Define to 1 if the compiler supports the C99 __func__ variable.])
1.1.1.5 ! misho    3827: AH_TEMPLATE(HAVE___INTERPOSE, [Define to 1 if you have dyld with __interpose attribute support.])
1.1.1.4   misho    3828: AH_TEMPLATE(SUDO_KRB5_INSTANCE, [An instance string to append to the username (separated by a slash) for Kerberos V authentication.])
1.1.1.2   misho    3829: AH_TEMPLATE(RTLD_PRELOAD_VAR, [The environment variable that controls preloading of dynamic objects.])
                   3830: AH_TEMPLATE(RTLD_PRELOAD_ENABLE_VAR, [An extra environment variable that is required to enable preloading (if any).])
                   3831: AH_TEMPLATE(RTLD_PRELOAD_DELIM, [The delimiter to use when defining multiple preloaded objects.])
                   3832: AH_TEMPLATE(RTLD_PRELOAD_DEFAULT, [The default value of preloaded objects (if any).])
1.1.1.3   misho    3833: AH_TEMPLATE(HAVE_DSO_VISIBILITY, [Define to 1 if the compiler supports the __visibility__ attribute.])
                   3834: AH_TEMPLATE(HAVE_SYS_SIGABBREV, [Define to 1 if your libc has the `sys_sigabbrev' symbol.])
1.1.1.4   misho    3835: AH_TEMPLATE(HAVE_NSS_SEARCH, [Define to 1 if you have the `nss_search' function.])
                   3836: AH_TEMPLATE(HAVE__NSS_INITF_GROUP, [Define to 1 if you have the `_nss_initf_group' function.])
                   3837: AH_TEMPLATE(HAVE___NSS_INITF_GROUP, [Define to 1 if you have the `__nss_initf_group' function.])
                   3838: AH_TEMPLATE(HAVE__NSS_XBYY_BUF_ALLOC, [Define to 1 if you have the `_nss_XbyY_buf_alloc' function.])
                   3839: AH_TEMPLATE(HAVE___NSS_XBYY_BUF_ALLOC, [Define to 1 if you have the `__nss_XbyY_buf_alloc' function.])
1.1       misho    3840: 
                   3841: dnl
                   3842: dnl Bits to copy verbatim into config.h.in
                   3843: dnl
                   3844: AH_TOP([#ifndef _SUDO_CONFIG_H
                   3845: #define _SUDO_CONFIG_H])
                   3846: 
                   3847: AH_BOTTOM([/*
                   3848:  * Macros to convert ctime and mtime into timevals.
                   3849:  */
                   3850: #define timespec2timeval(_ts, _tv) do {                                        \
                   3851:     (_tv)->tv_sec = (_ts)->tv_sec;                                     \
                   3852:     (_tv)->tv_usec = (_ts)->tv_nsec / 1000;                            \
                   3853: } while (0)
                   3854: 
                   3855: #ifdef HAVE_ST_MTIM
                   3856: # ifdef HAVE_ST__TIM
                   3857: #  define ctim_get(_x, _y)     timespec2timeval(&(_x)->st_ctim.st__tim, (_y))
                   3858: #  define mtim_get(_x, _y)     timespec2timeval(&(_x)->st_mtim.st__tim, (_y))
                   3859: # else
                   3860: #  define ctim_get(_x, _y)     timespec2timeval(&(_x)->st_ctim, (_y))
                   3861: #  define mtim_get(_x, _y)     timespec2timeval(&(_x)->st_mtim, (_y))
                   3862: # endif
                   3863: #else
                   3864: # ifdef HAVE_ST_MTIMESPEC
                   3865: #  define ctim_get(_x, _y)     timespec2timeval(&(_x)->st_ctimespec, (_y))
                   3866: #  define mtim_get(_x, _y)     timespec2timeval(&(_x)->st_mtimespec, (_y))
                   3867: # else
                   3868: #  define ctim_get(_x, _y)     do { (_y)->tv_sec = (_x)->st_ctime; (_y)->tv_usec = 0; } while (0)
                   3869: #  define mtim_get(_x, _y)     do { (_y)->tv_sec = (_x)->st_mtime; (_y)->tv_usec = 0; } while (0)
                   3870: # endif /* HAVE_ST_MTIMESPEC */
                   3871: #endif /* HAVE_ST_MTIM */
                   3872: 
1.1.1.2   misho    3873: #ifdef __GNUC__
                   3874: # define ignore_result(x) do {                                                \
                   3875:     __typeof__(x) y = (x);                                                    \
                   3876:     (void)y;                                                                  \
                   3877: } while(0)
                   3878: #else
                   3879: # define ignore_result(x)      (void)(x)
                   3880: #endif
                   3881: 
1.1       misho    3882: /* BSD compatibility on some SVR4 systems. */
                   3883: #ifdef __svr4__
                   3884: # define BSD_COMP
                   3885: #endif /* __svr4__ */
                   3886: 
                   3887: #endif /* _SUDO_CONFIG_H */])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>