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

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

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