[BACK]Return to configure.in CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Annotation of src/usr.bin/sudo/configure.in, Revision 1.5

1.1       millert     1: dnl
                      2: dnl Process this file with GNU autoconf to produce a configure script.
1.5     ! millert     3: dnl $Sudo: configure.in,v 1.310 2000/03/24 20:14:04 millert Exp $
1.1       millert     4: dnl
                      5: dnl Copyright (c) 1994-1996,1998-1999 Todd C. Miller <Todd.Miller@courtesan.com>
                      6: dnl
                      7: AC_INIT(sudo.h)
                      8: AC_CONFIG_HEADER(config.h pathnames.h)
                      9: dnl
                     10: dnl This won't work before AC_INIT()
                     11: dnl
1.5     ! millert    12: echo "Configuring Sudo version 1.6.3"
1.1       millert    13: dnl
                     14: dnl Variables that get substituted in the Makefile
                     15: dnl
1.5     ! millert    16: AC_SUBST(CFLAGS)dnl
1.1       millert    17: AC_SUBST(PROGS)dnl
                     18: AC_SUBST(CPPFLAGS)dnl
                     19: AC_SUBST(LDFLAGS)dnl
                     20: AC_SUBST(SUDO_LDFLAGS)dnl
                     21: AC_SUBST(LIBS)dnl
                     22: AC_SUBST(SUDO_LIBS)dnl
                     23: AC_SUBST(NET_LIBS)dnl
                     24: AC_SUBST(AFS_LIBS)dnl
                     25: AC_SUBST(OSDEFS)dnl
                     26: AC_SUBST(AUTH_OBJS)dnl
                     27: AC_SUBST(LIBOBJS)dnl
                     28: AC_SUBST(MANTYPE)dnl
                     29: AC_SUBST(MAN_POSTINSTALL)dnl
                     30: AC_SUBST(SUDOERS_MODE)dnl
                     31: AC_SUBST(SUDOERS_UID)dnl
                     32: AC_SUBST(SUDOERS_GID)dnl
1.5     ! millert    33: AC_SUBST(TIMEDIR)
        !            34: AC_SUBST(DEV)
        !            35: AC_SUBST(mansectsu)
        !            36: AC_SUBST(mansectform)
        !            37: AC_SUBST(mansrcdir)
        !            38: dnl
        !            39: dnl Initial values for Makefile variables listed above
        !            40: dnl Some may be overridden by environment variables..
        !            41: dnl
        !            42: PROGS="sudo visudo"
        !            43: test -n "$MANTYPE" || MANTYPE="man"
        !            44: test -n "$mansrcdir" || mansrcdir="."
        !            45: test -n "$SUDOERS_MODE" || SUDOERS_MODE=0440
        !            46: test -n "$SUDOERS_UID" || SUDOERS_UID=0
        !            47: test -n "$SUDOERS_GID" || SUDOERS_GID=0
1.1       millert    48: DEV="#"
1.5     ! millert    49:
        !            50: dnl
        !            51: dnl Other vaiables
        !            52: dnl
1.1       millert    53: CHECKSHADOW=true
                     54: CHECKSIA=true
                     55:
                     56: dnl
                     57: dnl Override default configure dirs...
                     58: dnl
                     59: test "$mandir" = '${prefix}/man' && mandir='$(prefix)/man'
                     60: test "$bindir" = '${exec_prefix}/bin' && bindir='$(exec_prefix)/bin'
                     61: test "$sbindir" = '${exec_prefix}/sbin' && sbindir='$(exec_prefix)/sbin'
                     62: test "$sysconfdir" = '${prefix}/etc' && sysconfdir='/etc'
                     63:
                     64: dnl
                     65: dnl Deprecated --with options (these all warn or generate an error)
                     66: dnl
                     67:
                     68: AC_ARG_WITH(otp-only, [  --with-otp-only         deprecated],
                     69: [case $with_otp_only in
                     70:     yes)       with_passwd=no
                     71:                AC_DEFINE(WITHOUT_PASSWD)
                     72:                AC_MSG_WARN([--with-otp-only option deprecated, treating as --without-passwd])
                     73:                ;;
                     74: esac])
                     75:
                     76: AC_ARG_WITH(alertmail, [  --with-alertmail        deprecated],
                     77: [case $with_alertmail in
                     78:     *)         with_mailto="$with_alertmail"
                     79:                AC_DEFINE(WITHOUT_PASSWD)
                     80:                AC_MSG_WARN([--with-alertmail option deprecated, treating as --mailto])
                     81:                ;;
                     82: esac])
                     83:
                     84: dnl
                     85: dnl Options for --with
                     86: dnl
                     87:
                     88: AC_ARG_WITH(CC, [  --with-CC               C compiler to use],
                     89: [case $with_CC in
                     90:     yes)       AC_MSG_ERROR(["must give --with-CC an argument."])
                     91:                ;;
                     92:     no)                AC_MSG_ERROR(["illegal argument: --without-CC."])
                     93:                ;;
                     94:     *)         CC=$with_CC
                     95:                ;;
                     96: esac])
                     97:
                     98: AC_ARG_WITH(incpath, [  --with-incpath          additional places to look for include files],
                     99: [case $with_incpath in
                    100:     yes)       AC_MSG_ERROR(["must give --with-incpath an argument."])
                    101:                ;;
                    102:     no)                AC_MSG_ERROR(["--without-incpath not supported."])
                    103:                ;;
                    104:     *)         echo "Adding ${with_incpath} to CPPFLAGS"
                    105:                for i in ${with_incpath}; do
                    106:                    CPPFLAGS="${CPPFLAGS} -I${i}"
                    107:                done
                    108:                ;;
                    109: esac])
                    110:
                    111: AC_ARG_WITH(libpath, [  --with-libpath          additional places to look for libraries],
                    112: [case $with_libpath in
                    113:     yes)       AC_MSG_ERROR(["must give --with-libpath an argument."])
                    114:                ;;
                    115:     no)                AC_MSG_ERROR(["--without-libpath not supported."])
                    116:                ;;
                    117:     *)         echo "Adding ${with_libpath} to LDFLAGS"
                    118:                for i in ${with_libpath}; do
                    119:                    LDFLAGS="${LDFLAGS} -L${i}"
                    120:                done
                    121:                ;;
                    122: esac])
                    123:
                    124: AC_ARG_WITH(libraries, [  --with-libraries        additional libraries to link with],
                    125: [case $with_libraries in
                    126:     yes)       AC_MSG_ERROR(["must give --with-libraries an argument."])
                    127:                ;;
                    128:     no)                AC_MSG_ERROR(["--without-libraries not supported."])
                    129:                ;;
                    130:     *)         echo "Adding ${with_libraries} to LIBS"
                    131:                for i in ${with_libraries}; do
                    132:                    case $i in
                    133:                        -l*)    ;;
                    134:                        *.a)    ;;
                    135:                        *.o)    ;;
                    136:                        *)      i="-l${i}";;
                    137:                    esac
                    138:                    LIBS="${LIBS} ${i}"
                    139:                done
                    140:                ;;
                    141: esac])
                    142:
                    143: AC_ARG_WITH(devel, [  --with-devel            add developement options],
                    144: [case $with_devel in
                    145:     yes)       echo 'Setting up for developement: -Wall, flex, yacc'
                    146:                PROGS="${PROGS} testsudoers"
                    147:                OSDEFS="${OSDEFS} -DSUDO_DEVEL"
                    148:                DEV=""
                    149:                ;;
                    150:     no)                ;;
1.5     ! millert   151:     *)         echo "Ignoring unknown argument to --with-devel: $with_devel"
1.1       millert   152:                ;;
                    153: esac])
                    154:
                    155: AC_ARG_WITH(csops, [  --with-csops            add CSOps standard options],
                    156: [case $with_csops in
                    157:     yes)       echo 'Adding CSOps standard options'
                    158:                CHECKSIA=false
                    159:                with_ignore_dot=yes
                    160:                with_insults=yes
                    161:                with_classic_insults=yes
                    162:                with_csops_insults=yes
                    163:                with_env_editor=yes
                    164:                ;;
                    165:     no)                ;;
                    166:     *)         echo "Ignoring unknown argument to --with-csops: $with_csops"
                    167:                ;;
                    168: esac])
                    169:
                    170: AC_ARG_WITH(passwd, [  --without-passwd        don't use passwd/shadow file for authentication],
                    171: [case $with_passwd in
                    172:     yes)       ;;
                    173:     no)                AC_DEFINE(WITHOUT_PASSWD)
                    174:                AC_MSG_CHECKING(whether to use shadow/passwd file authentication)
                    175:                AC_MSG_RESULT(no)
                    176:                ;;
                    177:     *)         AC_MSG_ERROR(["Sorry, --with-passwd does not take an argument."])
                    178:                ;;
                    179: esac])
                    180:
                    181: AC_ARG_WITH(skey, [  --with-skey             enable S/Key support ],
                    182: [case $with_skey in
                    183:     yes)       if test -n "$with_opie"; then
                    184:                    AC_MSG_ERROR(["cannot use both S/Key and OPIE"])
                    185:                fi
                    186:                AC_DEFINE(HAVE_SKEY)
                    187:                AC_MSG_CHECKING(whether to try S/Key authentication)
                    188:                AC_MSG_RESULT(yes)
                    189:                AUTH_OBJS="${AUTH_OBJS} rfc1938.o"
                    190:                ;;
                    191:     no)                ;;
                    192:     *)         echo "Ignoring unknown argument to --with-skey: $with_skey"
                    193:                ;;
                    194: esac])
                    195:
                    196: AC_ARG_WITH(opie, [  --with-opie             enable OPIE support ],
                    197: [case $with_opie in
                    198:     yes)       if test -n "$with_skey"; then
                    199:                    AC_MSG_ERROR(["cannot use both S/Key and OPIE"])
                    200:                fi
                    201:                AC_DEFINE(HAVE_OPIE)
                    202:                AC_MSG_CHECKING(whether to try NRL OPIE authentication)
                    203:                AC_MSG_RESULT(yes)
                    204:                AUTH_OBJS="${AUTH_OBJS} rfc1938.o"
                    205:                ;;
                    206:     no)                ;;
                    207:     *)         echo "Ignoring unknown argument to --with-opie: $with_opie"
                    208:                ;;
                    209: esac])
                    210:
                    211: AC_ARG_WITH(long-otp-prompt, [  --with-long-otp-prompt  use a two line OTP (skey/opie) prompt],
                    212: [case $with_long_otp_prompt in
                    213:     yes)       AC_DEFINE(LONG_OTP_PROMPT)
                    214:                AC_MSG_CHECKING(whether to use a two line prompt for OTP authentication)
                    215:                AC_MSG_RESULT(yes)
                    216:                ;;
                    217:     no)                ;;
                    218:     *)         AC_MSG_ERROR(["--with-long-otp-prompt does not take an argument."])
                    219:                ;;
                    220: esac])
                    221:
                    222: AC_ARG_WITH(SecurID, [  --with-SecurID          enable SecurID support],
                    223: [case $with_SecurID in
                    224:     no)                ;;
                    225:     *)         AC_DEFINE(HAVE_SECURID)
                    226:                AC_MSG_CHECKING(whether to use SecurID for authentication)
                    227:                AC_MSG_RESULT(yes)
                    228:                with_passwd=no
                    229:                AUTH_OBJS="securid.o"
                    230:                ;;
                    231: esac])
                    232:
                    233: AC_ARG_WITH(fwtk, [  --with-fwtk             enable FWTK AuthSRV support],
                    234: [case $with_fwtk in
                    235:     yes)       AC_DEFINE(HAVE_FWTK)
                    236:                AC_MSG_CHECKING(whether to use FWTK AuthSRV for authentication)
                    237:                AC_MSG_RESULT(yes)
                    238:                with_passwd=no
                    239:                AUTH_OBJS="fwtk.o"
                    240:                ;;
                    241:     no)                ;;
                    242:     *)         AC_DEFINE(HAVE_FWTK)
                    243:                AC_MSG_CHECKING(whether to use FWTK AuthSRV for authentication)
                    244:                AC_MSG_RESULT(yes)
                    245:                SUDO_LDFLAGS="${SUDO_LDFLAGS} -L${with_fwtk}"
                    246:                CPPFLAGS="${CPPFLAGS} -I${with_fwtk}"
                    247:                with_passwd=no
                    248:                AUTH_OBJS="fwtk.o"
                    249:                with_fwtk=yes
                    250:                ;;
                    251: esac])
                    252:
                    253: AC_ARG_WITH(kerb4, [  --with-kerb4            enable kerberos v4 support],
                    254: [case $with_kerb4 in
                    255:     yes)       AC_MSG_CHECKING(whether to try Kerberos 4 authentication)
                    256:                AC_MSG_RESULT(yes)
                    257:                ;;
                    258:     no)                ;;
                    259:     *)         AC_MSG_ERROR(["--with-kerb4 does not take an argument."])
                    260:                ;;
                    261: esac])
                    262:
                    263: AC_ARG_WITH(kerb5, [  --with-kerb5            enable kerberos v5 support],
                    264: [case $with_kerb5 in
                    265:     yes)       AC_MSG_CHECKING(whether to try Kerberos 5 authentication)
                    266:                AC_MSG_RESULT(yes)
                    267:                ;;
                    268:     no)                ;;
                    269:     *)         AC_MSG_ERROR(["--with-kerb5 does not take an argument."])
                    270:                ;;
                    271: esac])
                    272:
                    273: AC_ARG_WITH(authenticate, [  --with-authenticate     enable AIX general authentication support],
                    274: [case $with_authenticate in
                    275:     yes)       AC_DEFINE(HAVE_AUTHENTICATE)
                    276:                AC_MSG_CHECKING(whether to use AIX general authentication)
                    277:                AC_MSG_RESULT(yes)
                    278:                with_passwd=no
                    279:                AUTH_OBJS="aix_auth.o"
                    280:                ;;
                    281:     no)                ;;
                    282:     *)         AC_MSG_ERROR(["--with-authenticate does not take an argument."])
                    283:                ;;
                    284: esac])
                    285:
                    286: AC_ARG_WITH(pam, [  --with-pam              enable PAM support],
                    287: [case $with_pam in
                    288:     yes)       AC_DEFINE(HAVE_PAM)
                    289:                AC_MSG_CHECKING(whether to use PAM authentication)
                    290:                AC_MSG_RESULT(yes)
                    291:                with_passwd=no
                    292:                AUTH_OBJS="pam.o"
                    293:                ;;
                    294:     no)                ;;
                    295:     *)         AC_MSG_ERROR(["--with-pam does not take an argument."])
                    296:                ;;
                    297: esac])
                    298:
                    299: AC_ARG_WITH(AFS, [  --with-AFS              enable AFS support],
                    300: [case $with_AFS in
                    301:     yes)       AC_DEFINE(HAVE_AFS)
                    302:                AC_MSG_CHECKING(whether to try AFS (kerberos) authentication)
                    303:                AC_MSG_RESULT(yes)
                    304:                AUTH_OBJS="${AUTH_OBJS} afs.o"
                    305:                ;;
                    306:     no)                ;;
                    307:     *)         AC_MSG_ERROR(["--with-AFS does not take an argument."])
                    308:                ;;
                    309: esac])
                    310:
                    311: AC_ARG_WITH(DCE, [  --with-DCE              enable DCE support],
                    312: [case $with_DCE in
                    313:     yes)       AC_DEFINE(HAVE_DCE)
                    314:                AC_MSG_CHECKING(whether to try DCE (kerberos) authentication)
                    315:                AC_MSG_RESULT(yes)
                    316:                AUTH_OBJS="${AUTH_OBJS} dce.o"
                    317:                ;;
                    318:     no)                ;;
                    319:     *)         AC_MSG_ERROR(["--with-DCE does not take an argument."])
                    320:                ;;
                    321: esac])
                    322:
1.5     ! millert   323: AC_ARG_WITH(logincap, [  --with-logincap         enable login class support],
        !           324: [case $with_logincap in
        !           325:     yes)       AC_DEFINE(HAVE_LOGINCAP)
        !           326:                AC_MSG_CHECKING(whether to try BSD login capabilities database)
        !           327:                AC_MSG_RESULT(yes)
        !           328:                ;;
        !           329:     no)                ;;
        !           330:     *)         AC_MSG_ERROR(["--with-logincap does not take an argument."])
        !           331:                ;;
        !           332: esac])
        !           333:
1.1       millert   334: AC_MSG_CHECKING(whether to lecture users the first time they run sudo)
                    335: AC_ARG_WITH(lecture, [  --without-lecture       don't print lecture for first-time sudoer],
                    336: [case $with_lecture in
                    337:     yes|short) AC_MSG_RESULT(yes)
                    338:                ;;
                    339:     no|none)   AC_DEFINE(NO_LECTURE)
                    340:                AC_MSG_RESULT(no)
                    341:                ;;
                    342:     *)         AC_MSG_ERROR(["unknown argument to --with-lecture: $with_lecture"])
                    343:                ;;
                    344: esac], [AC_MSG_RESULT(yes)])
                    345:
                    346: AC_MSG_CHECKING(whether sudo should log via syslog or to a file by default)
                    347: AC_ARG_WITH(logging, [  --with-logging          log via syslog, file, or both],
                    348: [case $with_logging in
                    349:     yes)       AC_MSG_ERROR(["must give --with-logging an argument."])
                    350:                ;;
                    351:     no)                AC_MSG_ERROR(["--without-logging not supported."])
                    352:                ;;
                    353:     syslog)    AC_DEFINE(LOGGING, SLOG_SYSLOG)
                    354:                AC_MSG_RESULT(syslog)
                    355:                ;;
                    356:     file)      AC_DEFINE(LOGGING, SLOG_FILE)
                    357:                AC_MSG_RESULT(file)
                    358:                ;;
                    359:     both)      AC_DEFINE(LOGGING, SLOG_BOTH)
                    360:                AC_MSG_RESULT(both)
                    361:                ;;
                    362:     *)         AC_MSG_ERROR(["unknown argument to --with-logging: $with_logging"])
                    363:                ;;
                    364: esac], [AC_DEFINE(LOGGING, SLOG_SYSLOG) AC_MSG_RESULT(syslog)])
                    365:
                    366: AC_MSG_CHECKING(which syslog facility sudo should log with)
                    367: AC_ARG_WITH(logfac, [  --with-logfac           syslog facility to log with (default is local2)],
                    368: [case $with_logfac in
                    369:     yes)       AC_MSG_ERROR(["must give --with-logfac an argument."])
                    370:                ;;
                    371:     no)                AC_MSG_ERROR(["--without-logfac not supported."])
                    372:                ;;
                    373:     authpriv|auth|daemon|user|local0|local1|local2|local3|local4|local5|local6|local7)         AC_DEFINE_UNQUOTED(LOGFAC, "$with_logfac")
                    374:                AC_MSG_RESULT([$with_logfac])
                    375:                ;;
                    376:     *)         AC_MSG_ERROR(["$with_logfac is not a supported syslog facility."])
                    377:                ;;
                    378: esac], [AC_DEFINE_UNQUOTED(LOGFAC, "local2") AC_MSG_RESULT("local2")])
                    379:
                    380: AC_MSG_CHECKING(at which syslog priority to log commands)
                    381: AC_ARG_WITH(goodpri, [  --with-goodpri          syslog priority for commands (def is notice)],
                    382: [case $with_goodpri in
                    383:     yes)       AC_MSG_ERROR(["must give --with-goodpri an argument."])
                    384:                ;;
                    385:     no)                AC_MSG_ERROR(["--without-goodpri not supported."])
                    386:                ;;
                    387:     alert|crit|debug|emerg|err|info|notice|warning)            AC_DEFINE_UNQUOTED(PRI_SUCCESS, "$with_goodpri")
                    388:                AC_MSG_RESULT([$with_goodpri])
                    389:                ;;
                    390:     *)         AC_MSG_ERROR(["$with_goodpri is not a supported syslog priority."])
                    391:                ;;
                    392: esac], [AC_DEFINE_UNQUOTED(PRI_SUCCESS, "notice") AC_MSG_RESULT("notice")])
                    393:
                    394: AC_MSG_CHECKING(at which syslog priority to log failures)
                    395: AC_ARG_WITH(badpri, [  --with-badpri           syslog priority for failures (def is LOG_ALERT)],
                    396: [case $with_badpri in
                    397:     yes)       AC_MSG_ERROR(["must give --with-badpri an argument."])
                    398:                ;;
                    399:     no)                AC_MSG_ERROR(["--without-badpri not supported."])
                    400:                ;;
                    401:     alert|crit|debug|emerg|err|info|notice|warning)            AC_DEFINE_UNQUOTED(PRI_FAILURE, "$with_badpri")
                    402:                AC_MSG_RESULT([$with_badpri])
                    403:                ;;
                    404:     *)         AC_MSG_ERROR([$with_badpri is not a supported syslog priority.])
                    405:                ;;
                    406: esac], [AC_DEFINE_UNQUOTED(PRI_FAILURE, "alert") AC_MSG_RESULT("alert")])
                    407:
                    408: AC_ARG_WITH(logpath, [  --with-logpath          path to the sudo log file],
                    409: [case $with_logpath in
                    410:     yes)       AC_MSG_ERROR(["must give --with-logpath an argument."])
                    411:                ;;
                    412:     no)                AC_MSG_ERROR(["--without-logpath not supported."])
                    413:                ;;
                    414: esac])
                    415:
                    416: AC_MSG_CHECKING(how long a line in the log file should be)
                    417: AC_ARG_WITH(loglen, [  --with-loglen           maximum length of a log file line (default is 80)],
                    418: [case $with_loglen in
                    419:     yes)       AC_MSG_ERROR(["must give --with-loglen an argument."])
                    420:                ;;
                    421:     no)                AC_MSG_ERROR(["--without-loglen not supported."])
                    422:                ;;
                    423:     [[0-9]]*)  AC_DEFINE_UNQUOTED(MAXLOGFILELEN, $with_loglen)
                    424:                AC_MSG_RESULT([$with_loglen])
                    425:                ;;
                    426:     *)         AC_MSG_ERROR(["you must enter a number, not $with_loglen"])
                    427:                ;;
                    428: esac], [AC_DEFINE(MAXLOGFILELEN, 80) AC_MSG_RESULT(80)])
                    429:
                    430: AC_MSG_CHECKING(whether sudo should ignore '.' or '' in \$PATH)
                    431: AC_ARG_WITH(ignore-dot, [  --with-ignore-dot       ignore '.' in the PATH],
                    432: [case $with_ignore_dot in
                    433:     yes)       AC_DEFINE(IGNORE_DOT_PATH)
                    434:                AC_MSG_RESULT(yes)
                    435:                ;;
                    436:     no)                AC_MSG_RESULT(no)
                    437:                ;;
                    438:     *)         AC_MSG_ERROR(["--with-ignore-dot does not take an argument."])
                    439:                ;;
                    440: esac], AC_MSG_RESULT(no))
                    441:
                    442: AC_MSG_CHECKING(who should get the mail that sudo sends)
                    443: AC_ARG_WITH(mailto, [  --with-mailto           who should get sudo mail (default is "root")],
                    444: [case $with_mailto in
                    445:     yes)       AC_MSG_ERROR(["must give --with-mailto an argument."])
                    446:                ;;
                    447:     no)                AC_MSG_ERROR(["--without-mailto not supported."])
                    448:                ;;
                    449:     *)         AC_DEFINE_UNQUOTED(MAILTO, "$with_mailto")
                    450:                AC_MSG_RESULT([$with_mailto])
                    451:                ;;
                    452: esac], [AC_DEFINE(MAILTO, "root") AC_MSG_RESULT(root)])
                    453:
                    454: AC_ARG_WITH(mailsubject, [  --with-mailsubject      subject of sudo mail],
                    455: [case $with_mailsubject in
                    456:     yes)       AC_MSG_ERROR(["must give --with-mailsubject an argument."])
                    457:                ;;
                    458:     no)                echo "Sorry, --without-mailsubject not supported."
                    459:                ;;
                    460:     *)         AC_DEFINE_UNQUOTED(MAILSUBJECT, "$with_mailsubject")
                    461:                AC_MSG_CHECKING(sudo mail subject)
                    462:                AC_MSG_RESULT([Using alert mail subject: $with_mailsubject])
                    463:                ;;
                    464: esac], AC_DEFINE(MAILSUBJECT, "*** SECURITY information for %h ***"))
                    465:
                    466: AC_MSG_CHECKING(whether to send mail when a user is not in sudoers)
                    467: AC_ARG_WITH(mail-if-no-user, [  --without-mail-if-no-user do not send mail if user not in sudoers],
                    468: [case $with_mail_if_no_user in
                    469:     yes)       AC_DEFINE(SEND_MAIL_WHEN_NO_USER)
                    470:                AC_MSG_RESULT(yes)
                    471:                ;;
                    472:     no)                AC_MSG_RESULT(no)
                    473:                ;;
                    474:     *)         AC_MSG_ERROR(["unknown argument to --with-mail-if-no-user: $with_mail_if_no_user"])
                    475:                ;;
                    476: esac], [AC_DEFINE(SEND_MAIL_WHEN_NO_USER) AC_MSG_RESULT(yes)])
                    477:
                    478: AC_MSG_CHECKING(whether to send mail when user listed but not for this host)
                    479: AC_ARG_WITH(mail-if-no-host, [  --with-mail-if-no-host  send mail if user in sudoers but not for this host],
                    480: [case $with_mail_if_no_host in
                    481:     yes)       AC_DEFINE(SEND_MAIL_WHEN_NO_HOST)
                    482:                AC_MSG_RESULT(yes)
                    483:                ;;
                    484:     no)                AC_MSG_RESULT(no)
                    485:                ;;
                    486:     *)         AC_MSG_ERROR(["unknown argument to --with-mail-if-no-host: $with_mail_if_no_host"])
                    487:                ;;
                    488: esac], AC_MSG_RESULT(no))
                    489:
                    490: AC_MSG_CHECKING(whether to send mail when a user tries a disallowed command)
                    491: AC_ARG_WITH(mail-if-noperms, [  --with-mail-if-noperms  send mail if user not allowed to run command],
                    492: [case $with_mail_if_noperms in
                    493:     yes)       AC_DEFINE(SEND_MAIL_WHEN_NOT_OK)
                    494:                AC_MSG_RESULT(yes)
                    495:                ;;
                    496:     no)                AC_MSG_RESULT(no)
                    497:                ;;
                    498:     *)         AC_MSG_ERROR(["unknown argument to --with-mail-if-noperms: $with_mail_if_noperms"])
                    499:                ;;
                    500: esac], AC_MSG_RESULT(no))
                    501:
                    502: AC_MSG_CHECKING(for bad password prompt)
                    503: AC_ARG_WITH(passprompt, [  --with-passprompt       default password prompt],
                    504: [case $with_passprompt in
                    505:     yes)       AC_MSG_ERROR(["must give --with-passprompt an argument."])
                    506:                ;;
                    507:     no)                echo "Sorry, --without-passprompt not supported."
                    508:                ;;
                    509:     *)         AC_DEFINE_UNQUOTED(PASSPROMPT, "$with_passprompt")
                    510:                AC_MSG_RESULT([$with_passprompt])
                    511:                ;;
                    512: esac], [AC_DEFINE(PASSPROMPT, "Password:") AC_MSG_RESULT(Password:)])
                    513:
                    514: AC_MSG_CHECKING(for bad password message)
                    515: AC_ARG_WITH(badpass-message, [  --with-badpass-message  message the user sees when the password is wrong],
                    516: [case $with_badpass_message in
                    517:     yes)       AC_MSG_ERROR(["Must give --with-badpass-message an argument."])
                    518:                ;;
                    519:     no)                echo "Sorry, --without-badpass-message not supported."
                    520:                ;;
                    521:     *)         AC_DEFINE_UNQUOTED(INCORRECT_PASSWORD, "$with_badpass_message")
                    522:                AC_MSG_RESULT([$with_badpass_message])
                    523:                ;;
                    524: esac], [AC_DEFINE(INCORRECT_PASSWORD, ["Sorry, try again."]) AC_MSG_RESULT([Sorry, try again.])])
                    525:
                    526: AC_MSG_CHECKING(whether to expect fully qualified hosts in sudoers)
                    527: AC_ARG_WITH(fqdn, [  --with-fqdn             expect fully qualified hosts in sudoers],
                    528: [case $with_fqdn in
                    529:     yes)       AC_DEFINE(FQDN)
                    530:                AC_MSG_RESULT(yes)
                    531:                ;;
                    532:     no)                AC_MSG_RESULT(no)
                    533:                ;;
                    534:     *)         AC_MSG_ERROR(["--with-fqdn does not take an argument."])
                    535:                ;;
                    536: esac], AC_MSG_RESULT(no))
                    537:
                    538: AC_ARG_WITH(timedir, [  --with-timedir          path to the sudo timestamp dir],
                    539: [case $with_timedir in
                    540:     yes)       AC_MSG_ERROR(["must give --with-timedir an argument."])
                    541:                ;;
                    542:     no)                AC_MSG_ERROR(["--without-timedir not supported."])
                    543:                ;;
                    544: esac])
                    545:
                    546: AC_ARG_WITH(sendmail, [  --with-sendmail=path    set path to sendmail
                    547:   --without-sendmail      do not send mail at all],
                    548: [case $with_sendmail in
                    549:     yes)       with_sendmail=""
                    550:                ;;
                    551:     no)                ;;
                    552:     *)         AC_DEFINE_UNQUOTED(_PATH_SENDMAIL, "$with_sendmail")
                    553:                ;;
                    554: esac])
                    555:
                    556: AC_ARG_WITH(sudoers-mode, [  --with-sudoers-mode     mode of sudoers file (defaults to 0440)],
                    557: [case $with_sudoers_mode in
                    558:     yes)       AC_MSG_ERROR(["must give --with-sudoers-mode an argument."])
                    559:                ;;
                    560:     no)                AC_MSG_ERROR(["--without-sudoers-mode not supported."])
                    561:                ;;
                    562:     [[1-9]]*)  SUDOERS_MODE=0${with_sudoers_mode}
                    563:                ;;
                    564:     0*)                SUDOERS_MODE=$with_sudoers_mode
                    565:                ;;
                    566:     *)         AC_MSG_ERROR(["you must use a numeric uid, not a name."])
                    567:                ;;
                    568: esac])
                    569:
                    570: AC_ARG_WITH(sudoers-uid, [  --with-sudoers-uid      uid that owns sudoers file (defaults to 0)],
                    571: [case $with_sudoers_uid in
                    572:     yes)       AC_MSG_ERROR(["must give --with-sudoers-uid an argument."])
                    573:                ;;
                    574:     no)                AC_MSG_ERROR(["--without-sudoers-uid not supported."])
                    575:                ;;
                    576:     [[0-9]]*)  SUDOERS_UID=$with_sudoers_uid
                    577:                ;;
                    578:     *)         AC_MSG_ERROR(["you must use a numeric uid, not a name."])
                    579:                ;;
                    580: esac])
                    581:
                    582: AC_ARG_WITH(sudoers-gid, [  --with-sudoers-gid      gid that owns sudoers file (defaults to 0)],
                    583: [case $with_sudoers_gid in
                    584:     yes)       AC_MSG_ERROR(["must give --with-sudoers-gid an argument."])
                    585:                ;;
                    586:     no)                AC_MSG_ERROR(["--without-sudoers-gid not supported."])
                    587:                ;;
                    588:     [[0-9]]*)  SUDOERS_GID=$with_sudoers_gid
                    589:                ;;
                    590:     *)         AC_MSG_ERROR(["you must use a numeric gid, not a name."])
                    591:                ;;
                    592: esac])
                    593:
                    594: AC_MSG_CHECKING(for umask programs should be run with)
                    595: AC_ARG_WITH(umask, [  --with-umask            umask with which the prog should run (default is 0022)
                    596:   --without-umask         Preserves the umask of the user invoking sudo.],
                    597: [case $with_umask in
                    598:     yes)       AC_MSG_ERROR(["must give --with-umask an argument."])
                    599:                ;;
                    600:     no)                AC_MSG_RESULT(user)
                    601:                ;;
                    602:     [[0-9]]*)  AC_DEFINE_UNQUOTED(SUDO_UMASK, $with_umask)
                    603:                AC_MSG_RESULT([$with_umask])
                    604:                ;;
                    605:     *)         AC_MSG_ERROR(["you must enter a numeric mask."])
                    606:                ;;
                    607: esac], [AC_DEFINE(SUDO_UMASK, 0022) AC_MSG_RESULT(0022)])
                    608:
                    609: AC_MSG_CHECKING(for default user to run commands as)
                    610: AC_ARG_WITH(runas-default, [  --with-runas-default    User to run commands as (default is "root"],
                    611: [case $with_runas_default in
                    612:     yes)       AC_MSG_ERROR(["must give --with-runas-default an argument."])
                    613:                ;;
                    614:     no)                AC_MSG_ERROR(["--without-runas-default not supported."])
                    615:                ;;
                    616:     *)         AC_DEFINE_UNQUOTED(RUNAS_DEFAULT, "$with_runas_default")
                    617:                AC_MSG_RESULT([$with_runas_default])
                    618:                ;;
                    619: esac], [AC_DEFINE(RUNAS_DEFAULT, "root") AC_MSG_RESULT(root)])
                    620:
                    621: AC_ARG_WITH(exempt, [  --with-exempt=group     no passwd needed for users in this group],
                    622: [case $with_exempt in
                    623:     yes)       AC_MSG_ERROR(["must give --with-exempt an argument."])
                    624:                ;;
                    625:     no)                AC_MSG_ERROR(["--without-exempt not supported."])
                    626:                ;;
                    627:     *)         AC_DEFINE_UNQUOTED(EXEMPTGROUP, "$with_exempt")
                    628:                AC_MSG_CHECKING(for group to be exempt from password)
                    629:                AC_MSG_RESULT([$with_exempt])
                    630:                ;;
                    631: esac])
                    632:
                    633: AC_MSG_CHECKING(for editor that visudo should use)
                    634: AC_ARG_WITH(editor, [  --with-editor=path      Default editor for visudo (defaults to vi)],
                    635: [case $with_editor in
                    636:     yes)       AC_MSG_ERROR(["must give --with-editor an argument."])
                    637:                ;;
                    638:     no)                AC_MSG_ERROR(["--without-editor not supported."])
                    639:                ;;
                    640:     *)         AC_DEFINE_UNQUOTED(EDITOR, "$with_editor")
                    641:                AC_MSG_RESULT([$with_editor])
                    642:                ;;
                    643: esac], [AC_DEFINE(EDITOR, _PATH_VI) AC_MSG_RESULT(vi)])
                    644:
                    645: AC_MSG_CHECKING(whether to obey EDITOR and VISUAL environment variables)
                    646: AC_ARG_WITH(env-editor, [  --with-env-editor       Use the environment variable EDITOR for visudo],
                    647: [case $with_env_editor in
                    648:     yes)       AC_DEFINE(ENV_EDITOR)
                    649:                AC_MSG_RESULT(yes)
                    650:                ;;
                    651:     no)                AC_MSG_RESULT(no)
                    652:                ;;
                    653:     *)         AC_MSG_ERROR(["--with-env-editor does not take an argument."])
                    654:                ;;
                    655: esac], AC_MSG_RESULT(no))
                    656:
                    657: AC_MSG_CHECKING(number of tries a user gets to enter their password)
                    658: AC_ARG_WITH(passwd-tries, [  --with-passwd-tries     number of tries to enter password (default is 3)],
                    659: [case $with_passwd_tries in
                    660:     yes)       AC_DEFINE(TRIES_FOR_PASSWORD, 3)
                    661:                AC_MSG_RESULT(3)
                    662:                ;;
                    663:     no)                AC_MSG_ERROR(["--without-editor not supported."])
                    664:                ;;
                    665:     [[1-9]]*)  AC_DEFINE_UNQUOTED(TRIES_FOR_PASSWORD, $with_passwd_tries)
                    666:                AC_MSG_RESULT([$with_passwd_tries])
                    667:                ;;
                    668:     *)         AC_MSG_ERROR(["you must enter the numer of tries, > 0"])
                    669:                ;;
                    670: esac], [AC_DEFINE(TRIES_FOR_PASSWORD, 3) AC_MSG_RESULT(3)])
                    671:
                    672: AC_MSG_CHECKING(time in minutes after which sudo will ask for a password again)
                    673: AC_ARG_WITH(timeout, [  --with-timeout          minutes before sudo asks for passwd again (def is 5)],
                    674: [echo $with_timeout; case $with_timeout in
                    675:     yes)       AC_DEFINE(TIMEOUT, 5)
                    676:                AC_MSG_RESULT(5)
                    677:                ;;
                    678:     no)                AC_DEFINE(TIMEOUT, 0)
                    679:                AC_MSG_RESULT([no timeout])
                    680:                ;;
                    681:     [[0-9]]*)  AC_DEFINE_UNQUOTED(TIMEOUT, $with_timeout)
                    682:                AC_MSG_RESULT([$with_timeout])
                    683:                ;;
                    684:     *)         AC_MSG_ERROR(["you must enter the numer of minutes."])
                    685:                ;;
                    686: esac], [AC_DEFINE(TIMEOUT, 5) AC_MSG_RESULT(5)])
                    687:
                    688: AC_MSG_CHECKING(time in minutes after the password prompt will time out)
                    689: AC_ARG_WITH(password-timeout, [  --with-password-timeout passwd prompt timeout in minutes (default is 5)],
                    690: [case $with_password_timeout in
                    691:     yes)       AC_DEFINE(PASSWORD_TIMEOUT, 5)
                    692:                AC_MSG_RESULT(5)
                    693:                ;;
                    694:     no)                AC_DEFINE(PASSWORD_TIMEOUT, 0)
                    695:                AC_MSG_RESULT([no timeout])
                    696:                ;;
                    697:     [[0-9]]*)  AC_DEFINE_UNQUOTED(PASSWORD_TIMEOUT, $with_password_timeout)
                    698:                AC_MSG_RESULT([$with_password_timeout])
                    699:                ;;
                    700:     *)         AC_MSG_ERROR(["you must enter the numer of minutes."])
                    701:                ;;
                    702: esac], [AC_DEFINE(PASSWORD_TIMEOUT, 5) AC_MSG_RESULT(5)])
                    703:
                    704: AC_MSG_CHECKING(whether to use execvp or execv)
                    705: AC_ARG_WITH(execv, [  --with-execv            use execv() instead of execvp()],
                    706: [case $with_execv in
                    707:     yes)       AC_DEFINE(USE_EXECV)
                    708:                AC_MSG_RESULT(execv)
                    709:                ;;
                    710:     no)                AC_MSG_RESULT(execvp)
                    711:                ;;
                    712:     *)         AC_MSG_ERROR(["--with-execv does not take an argument."])
                    713:                ;;
                    714: esac], AC_MSG_RESULT(execvp))
                    715:
                    716: AC_MSG_CHECKING(whether to use per-tty ticket files)
                    717: AC_ARG_WITH(tty-tickets, [  --with-tty-tickets      use a different ticket file for each tty],
                    718: [case $with_tty_tickets in
                    719:     yes)       AC_DEFINE(USE_TTY_TICKETS)
                    720:                AC_MSG_RESULT(yes)
                    721:                ;;
                    722:     no)                AC_MSG_RESULT(no)
                    723:                ;;
                    724:     *)         AC_MSG_ERROR(["--with-tty-tickets does not take an argument."])
                    725:                ;;
                    726: esac], AC_MSG_RESULT(no))
                    727:
                    728: AC_MSG_CHECKING(whether to include insults)
                    729: AC_ARG_WITH(insults, [  --with-insults          insult the user for entering an incorrect password],
                    730: [case $with_insults in
                    731:     yes)       AC_DEFINE(USE_INSULTS)
                    732:                AC_MSG_RESULT(yes)
                    733:                with_classic_insults=yes
                    734:                with_csops_insults=yes
                    735:                ;;
                    736:     no)                AC_MSG_RESULT(no)
                    737:                ;;
                    738:     *)         AC_MSG_ERROR(["--with-insults does not take an argument."])
                    739:                ;;
                    740: esac], AC_MSG_RESULT(no))
                    741:
                    742: AC_ARG_WITH(all-insults, [  --with-all-insults      include all the sudo insult sets],
                    743: [case $with_all_insults in
                    744:     yes)       with_classic_insults=yes
                    745:                with_csops_insults=yes
                    746:                with_hal_insults=yes
                    747:                with_goons_insults=yes
                    748:                ;;
                    749:     no)                ;;
                    750:     *)         AC_MSG_ERROR(["--with-all-insults does not take an argument."])
                    751:                ;;
                    752: esac])
                    753:
                    754: AC_ARG_WITH(classic-insults, [  --with-classic-insults  include the insults from the "classic" sudo],
                    755: [case $with_classic_insults in
                    756:     yes)       AC_DEFINE(CLASSIC_INSULTS)
                    757:                ;;
                    758:     no)                ;;
                    759:     *)         AC_MSG_ERROR(["--with-classic-insults does not take an argument."])
                    760:                ;;
                    761: esac])
                    762:
                    763: AC_ARG_WITH(csops-insults, [  --with-csops-insults    include CSOps insults],
                    764: [case $with_csops_insults in
                    765:     yes)       AC_DEFINE(CSOPS_INSULTS)
                    766:                ;;
                    767:     no)                ;;
                    768:     *)         AC_MSG_ERROR(["--with-csops-insults does not take an argument."])
                    769:                ;;
                    770: esac])
                    771:
                    772: AC_ARG_WITH(hal-insults, [  --with-hal-insults      include 2001-like insults],
                    773: [case $with_hal_insults in
                    774:     yes)       AC_DEFINE(HAL_INSULTS)
                    775:                ;;
                    776:     no)                ;;
                    777:     *)         AC_MSG_ERROR(["--with-hal-insults does not take an argument."])
                    778:                ;;
                    779: esac])
                    780:
                    781: AC_ARG_WITH(goons-insults, [  --with-goons-insults    include the insults from the \"Goon Show\"],
                    782: [case $with_goons_insults in
                    783:     yes)       AC_DEFINE(GOONS_INSULTS)
                    784:                ;;
                    785:     no)                ;;
                    786:     *)         AC_MSG_ERROR(["--with-goons-insults does not take an argument."])
                    787:                ;;
                    788: esac])
                    789:
                    790: dnl include all insult sets on one line
                    791: if test "$with_insults" = "yes"; then
                    792:     AC_MSG_CHECKING(which insult sets to include)
                    793:     i=""
                    794:     test "$with_goons_insults" = "yes" && i="goons ${i}"
                    795:     test "$with_hal_insults" = "yes" && i="hal ${i}"
                    796:     test "$with_csops_insults" = "yes" && i="csops ${i}"
                    797:     test "$with_classic_insults" = "yes" && i="classic ${i}"
                    798:     AC_MSG_RESULT([$i])
                    799: fi
                    800:
                    801: AC_MSG_CHECKING(whether to override the user's path)
                    802: AC_ARG_WITH(secure-path, [  --with-secure-path      override the user's path with a builtin one],
                    803: [case $with_secure_path in
                    804:     yes)       AC_DEFINE_UNQUOTED(SECURE_PATH, "/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc")
                    805:                AC_MSG_RESULT([:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc])
                    806:                ;;
                    807:     no)                AC_MSG_RESULT(no)
                    808:                ;;
                    809:     *)         AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
                    810:                AC_MSG_RESULT([$with_secure_path])
                    811:                ;;
                    812: esac], AC_MSG_RESULT(no))
                    813:
                    814: AC_MSG_CHECKING(whether to get ip addresses from the network interfaces)
                    815: AC_ARG_WITH(interfaces, [  --without-interfaces    don't try to read the ip addr of ether interfaces],
                    816: [case $with_interfaces in
                    817:     yes)       AC_MSG_RESULT(yes)
                    818:                ;;
                    819:     no)                AC_DEFINE(STUB_LOAD_INTERFACES)
                    820:                AC_MSG_RESULT(no)
                    821:                ;;
                    822:     *)         AC_MSG_ERROR(["--with-interfaces does not take an argument."])
                    823:                ;;
                    824: esac], AC_MSG_RESULT(yes))
                    825:
                    826: dnl
                    827: dnl Options for --enable
                    828: dnl
                    829:
                    830: AC_MSG_CHECKING(whether to do user authentication by default)
                    831: AC_ARG_ENABLE(authentication,
                    832: [  --disable-authentication
                    833:                           Do not require authentication by default],
                    834: [ case "$enableval" in
                    835:     yes)       AC_MSG_RESULT(yes)
                    836:                ;;
                    837:     no)                AC_MSG_RESULT(no)
                    838:                AC_DEFINE(NO_AUTHENTICATION)
                    839:                ;;
                    840:     *)         AC_MSG_RESULT(no)
                    841:                echo "Ignoring unknown argument to --enable-authentication: $enableval"
                    842:                ;;
                    843:   esac
                    844: ], AC_MSG_RESULT(yes))
                    845:
                    846: AC_MSG_CHECKING(whether to disable shadow password support)
                    847: AC_ARG_ENABLE(shadow,
                    848: [  --disable-shadow        Never use shadow passwords],
                    849: [ case "$enableval" in
                    850:     yes)       AC_MSG_RESULT(no)
                    851:                ;;
                    852:     no)                AC_MSG_RESULT(yes)
                    853:                CHECKSHADOW="false"
                    854:                ;;
                    855:     *)         AC_MSG_RESULT(no)
                    856:                echo "Ignoring unknown argument to --enable-shadow: $enableval"
                    857:                ;;
                    858:   esac
                    859: ], AC_MSG_RESULT(no))
                    860:
                    861: AC_MSG_CHECKING(whether root should be allowed to use sudo)
                    862: AC_ARG_ENABLE(root-sudo,
                    863: [  --disable-root-sudo     don't allow root to run sudo],
                    864: [ case "$enableval" in
                    865:     yes)       AC_MSG_RESULT(yes)
                    866:                ;;
                    867:     no)                AC_DEFINE(NO_ROOT_SUDO)
                    868:                AC_MSG_RESULT(no)
                    869:                ;;
                    870:     *)         AC_MSG_ERROR(["--enable-root-sudo does not take an argument."])
                    871:                ;;
                    872:   esac
                    873: ], AC_MSG_RESULT(yes))
                    874:
                    875: AC_MSG_CHECKING(whether to log the hostname in the log file)
                    876: AC_ARG_ENABLE(log-host,
                    877: [  --enable-log-host       Log the hostname in the log file],
                    878: [ case "$enableval" in
                    879:     yes)       AC_MSG_RESULT(yes)
                    880:                AC_DEFINE(HOST_IN_LOG)
                    881:                ;;
                    882:     no)                AC_MSG_RESULT(no)
                    883:                ;;
                    884:     *)         AC_MSG_RESULT(no)
                    885:                echo "Ignoring unknown argument to --enable-log-host: $enableval"
                    886:                ;;
                    887:   esac
                    888: ], AC_MSG_RESULT(no))
                    889:
                    890: AC_MSG_CHECKING(whether to invoke a shell if sudo is given no arguments)
                    891: AC_ARG_ENABLE(noargs-shell,
                    892: [  --enable-noargs-shell   If sudo is given no arguments run a shell],
                    893: [ case "$enableval" in
                    894:     yes)       AC_MSG_RESULT(yes)
                    895:                AC_DEFINE(SHELL_IF_NO_ARGS)
                    896:                ;;
                    897:     no)                AC_MSG_RESULT(no)
                    898:                ;;
                    899:     *)         AC_MSG_RESULT(no)
                    900:                echo "Ignoring unknown argument to --enable-noargs-shell: $enableval"
                    901:                ;;
                    902:   esac
                    903: ], AC_MSG_RESULT(no))
                    904:
                    905: AC_MSG_CHECKING(whether to set \$HOME to target user in shell mode)
                    906: AC_ARG_ENABLE(shell-sets-home,
                    907: [  --enable-shell-sets-home
                    908:                           set \$HOME to target user in shell mode],
                    909: [ case "$enableval" in
                    910:     yes)       AC_MSG_RESULT(yes)
                    911:                AC_DEFINE(SHELL_SETS_HOME)
                    912:                ;;
                    913:     no)                AC_MSG_RESULT(no)
                    914:                ;;
                    915:     *)         AC_MSG_RESULT(no)
                    916:                echo "Ignoring unknown argument to --enable-shell-sets-home: $enableval"
                    917:                ;;
                    918:   esac
                    919: ], AC_MSG_RESULT(no))
                    920:
                    921: AC_MSG_CHECKING(whether to disable 'command not found' messages)
                    922: AC_ARG_ENABLE(path_info,
                    923: [  --disable-path-info     Print 'command not allowed' not 'command not found'],
                    924: [ case "$enableval" in
                    925:     yes)       AC_MSG_RESULT(no)
                    926:                ;;
                    927:     no)                AC_MSG_RESULT(yes)
                    928:                AC_DEFINE(DONT_LEAK_PATH_INFO)
                    929:                ;;
                    930:     *)         AC_MSG_RESULT(no)
                    931:                echo "Ignoring unknown argument to --enable-path-info: $enableval"
                    932:                ;;
                    933:   esac
                    934: ], AC_MSG_RESULT(no))
                    935:
                    936: dnl
                    937: dnl If we don't have egrep we can't do anything...
                    938: dnl
                    939: AC_CHECK_PROG(EGREPPROG, egrep, egrep, )
                    940: if test -z "$EGREPPROG"; then
                    941:     echo "Sorry, configure requires egrep to run."
                    942:     exit
                    943: fi
                    944:
                    945: dnl
                    946: dnl C compiler checks
                    947: dnl XXX - the cross-compiler check gets false positives so we override it
                    948: dnl
                    949: ac_cv_prog_cc_cross="no"
                    950: cross_compiling="no"
                    951: AC_PROG_CC
                    952: ac_cv_prog_cc_cross="no"
                    953: cross_compiling="no"
                    954: AC_PROG_CPP
                    955: AC_ISC_POSIX
                    956:
                    957: dnl
                    958: dnl It is now safe to modify CFLAGS and CPPFLAGS
                    959: dnl
                    960: if test "$with_devel" = "yes" -a -n "$GCC"; then
                    961:     CFLAGS="${CFLAGS} -Wall"
                    962: fi
                    963:
                    964: dnl
                    965: dnl Find programs we use
                    966: dnl
                    967: AC_CHECK_PROG(UNAMEPROG, uname, uname, )
                    968: AC_CHECK_PROG(TRPROG, tr, tr, )
                    969: AC_CHECK_PROG(SEDPROG, sed, sed, )
                    970: AC_CHECK_PROG(NROFFPROG, nroff, nroff, )
                    971: if test -z "$NROFFPROG"; then
                    972:     MANTYPE="cat"
1.5     ! millert   973:     mansrcdir='$(srcdir)'
1.1       millert   974: fi
                    975:
                    976: dnl
                    977: dnl What kind of beastie are we being run on?
                    978: dnl Barf if config.cache was generated on another host.
                    979: dnl
                    980: AC_CANONICAL_HOST
                    981: if test -n "$sudo_cv_prev_host"; then
                    982:     if test "$sudo_cv_prev_host" != "$host"; then
                    983:        echo ""
                    984:        echo "Fatal Error: config.cache exists from another platform!"
                    985:        echo "Please remove it and re-run configure."
                    986:        echo ""
                    987:        exit 1
                    988:     else
                    989:        AC_MSG_CHECKING(previous host type)
                    990:        AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
                    991:        echo $sudo_cv_prev_host
                    992:     fi
                    993: else
                    994:     # this will produce no output since there is no cached value
                    995:     AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
                    996: fi
                    997:
                    998: dnl
                    999: dnl We want to be able to differentiate between different rev's
                   1000: dnl
                   1001: if test -n "$host_os"; then
                   1002:     OS=`echo $host_os | sed 's/[[0-9]].*//'`
                   1003:     OSREV=`echo $host_os | sed 's/^[[^0-9]]*\([[0-9]][[0-9]]*\).*$/\1/'`
                   1004: else
                   1005:     OS="unknown"
                   1006:     OSREV=0
                   1007: fi
                   1008:
                   1009: case "$host" in
                   1010:     *-*-sunos4*)
                   1011:                # getcwd(3) opens a pipe to getpwd(1)!?!
                   1012:                BROKEN_GETCWD=1
                   1013:
                   1014:                # system headers lack prototypes but gcc helps...
                   1015:                if test -n "$GCC"; then
                   1016:                    CPPFLAGS="${CPPFLAGS} -D__USE_FIXED_PROTOTYPES__"
                   1017:                fi
                   1018:
                   1019:                # check for password adjunct functions (shadow passwords)
                   1020:                if test "$CHECKSHADOW" = "true"; then
                   1021:                    AC_CHECK_FUNC(getpwanam, AC_DEFINE(HAVE_GETPWANAM) AC_CHECK_FUNCS(issecure))
                   1022:                    CHECKSHADOW="false"
                   1023:                fi
                   1024:                ;;
                   1025:     *-*-solaris2*)
                   1026:                # To get the crypt(3) prototype (so we pass -Wall)
                   1027:                CPPFLAGS="${CPPFLAGS} -D__EXTENSIONS__"
                   1028:                # AFS support needs -lucb
                   1029:                if test "$with_AFS" = "yes"; then
                   1030:                    AFS_LIBS="-lc -lucb"
                   1031:                fi
1.5     ! millert  1032:                mansectsu=1m
        !          1033:                mansectform=4
1.1       millert  1034:                ;;
                   1035:     *-*-aix*)
                   1036:                # To get all prototypes (so we pass -Wall)
                   1037:                CPPFLAGS="${CPPFLAGS} -D_XOPEN_EXTENDED_SOURCE"
                   1038:                AC_DEFINE(_ALL_SOURCE)
                   1039:                SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-bI:\$(srcdir)/aixcrypt.exp"
                   1040:                ;;
                   1041:     *-*-hiuxmpp*)
                   1042:                if test "$CHECKSHADOW" = "true"; then
                   1043:                    AC_CHECK_LIB(sec, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [SUDO_LIBS="${SUDO_LIBS} -lsec"; LIBS="${LIBS} -lsec"; SECUREWARE=1], AC_CHECK_LIB(security, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [SUDO_LIBS="${SUDO_LIBS} -lsecurity"; LIBS="${LIBS} -lsecurity"; SECUREWARE=1]))
                   1044:                    CHECKSHADOW="false"
                   1045:                fi
1.5     ! millert  1046:                mansectsu=1m
        !          1047:                mansectform=4
1.1       millert  1048:                ;;
                   1049:     *-*-hpux1[[0-9]]*)
                   1050:                # uncomment this for a statically linked sudo
                   1051:                # (XXX - should be an option to configure)
                   1052:                #STATIC_SUDO=true
                   1053:
1.3       millert  1054:                # If using cc, run in ANSI mode if possible
                   1055:                if test -z "$GCC"; then
                   1056:                    $CC -Aa 2>&1 | grep 'A option is available only' >conftest.out
                   1057:                    if test ! -s conftest.out; then
                   1058:                        CPPFLAGS="${CPPFLAGS} -Aa"
                   1059:                    fi
                   1060:                    rm -f conftest.out
                   1061:                fi
                   1062:
                   1063:                # Add -D_HPUX_SOURCE so we don't get strict ANSI headers
                   1064:                CPPFLAGS="${CPPFLAGS} -D_HPUX_SOURCE"
                   1065:
1.1       millert  1066:                if test "$CHECKSHADOW" = "true"; then
                   1067:                    AC_CHECK_LIB(sec, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) AC_CHECK_LIB(sec, iscomsec, AC_DEFINE(HAVE_ISCOMSEC)) [SUDO_LIBS="${SUDO_LIBS} -lsec"; LIBS="${LIBS} -lsec"; SECUREWARE=1])
                   1068:                    CHECKSHADOW="false"
                   1069:                fi
                   1070:
                   1071:                if test -n "$STATIC_SUDO"; then
                   1072:                    if test -n "$GCC"; then
                   1073:                        SUDO_LDFLAGS="${SUDO_LDFLAGS} -static"
                   1074:                    else
                   1075:                        SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-a,archive"
                   1076:                    fi
                   1077:                fi
                   1078:
                   1079:                # AFS support needs -lBSD
                   1080:                if test "$with_AFS" = "yes"; then
                   1081:                    AFS_LIBS="-lc -lBSD"
                   1082:                fi
1.5     ! millert  1083:                mansectsu=1m
        !          1084:                mansectform=4
1.1       millert  1085:                ;;
                   1086:     *-*-hpux9*)
                   1087:                # uncomment this for a statically linked sudo
                   1088:                # (XXX - should be an option to configure)
                   1089:                #STATIC_SUDO=true
                   1090:
1.3       millert  1091:                # If using cc, run in ANSI mode if possible
                   1092:                if test -z "$GCC"; then
                   1093:                    $CC -Aa 2>&1 | grep 'A option is available only' >conftest.out
                   1094:                    if test ! -s conftest.out; then
                   1095:                        CPPFLAGS="${CPPFLAGS} -Aa"
                   1096:                    fi
                   1097:                    rm -f conftest.out
                   1098:                fi
                   1099:
                   1100:                # Add -D_HPUX_SOURCE so we don't get strict ANSI headers
                   1101:                CPPFLAGS="${CPPFLAGS} -D_HPUX_SOURCE"
                   1102:
1.1       millert  1103:                AC_DEFINE(BROKEN_SYSLOG)
                   1104:
                   1105:                if test "$CHECKSHADOW" = "true"; then
                   1106:                    AC_CHECK_FUNCS(getspwuid)
                   1107:                    CHECKSHADOW="false"
                   1108:                fi
                   1109:
                   1110:                if test -n "$STATIC_SUDO"; then
                   1111:                    if test -n "$GCC"; then
                   1112:                        SUDO_LDFLAGS="${SUDO_LDFLAGS} -static"
                   1113:                    else
                   1114:                        SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-a,archive"
                   1115:                    fi
                   1116:                fi
                   1117:
                   1118:                # DCE support (requires ANSI C compiler)
                   1119:                if test "$with_DCE" = "yes"; then
                   1120:                    # order of libs in 9.X is important. -lc_r must be last
                   1121:                    SUDO_LIBS="${SUDO_LIBS} -ldce -lM -lc_r"
                   1122:                    LIBS="${LIBS} -ldce -lM -lc_r"
1.3       millert  1123:                    CPPFLAGS="${CPPFLAGS} -D_REENTRANT -I/usr/include/reentrant"
1.1       millert  1124:                fi
                   1125:
                   1126:                # AFS support needs -lBSD
                   1127:                if test "$with_AFS" = "yes"; then
                   1128:                    AFS_LIBS="-lc -lBSD"
                   1129:                fi
1.5     ! millert  1130:                mansectsu=1m
        !          1131:                mansectform=4
1.1       millert  1132:                ;;
                   1133:     *-*-hpux*)
                   1134:
                   1135:                AC_DEFINE(BROKEN_SYSLOG)
                   1136:
                   1137:                # Not sure if setuid binaries are safe in < 9.x
                   1138:                if test -n "$GCC"; then
                   1139:                    SUDO_LDFLAGS="${SUDO_LDFLAGS} -static"
                   1140:                else
                   1141:                    SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-a,archive"
                   1142:                fi
                   1143:
                   1144:                # AFS support needs -lBSD
                   1145:                if test "$with_AFS" = "yes"; then
                   1146:                    AFS_LIBS="-lc -lBSD"
                   1147:                fi
1.5     ! millert  1148:                mansectsu=1m
        !          1149:                mansectform=4
1.1       millert  1150:                ;;
                   1151:     *-dec-osf*)
                   1152:                # ignore envariables wrt dynamic lib path
                   1153:                SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-no_library_replacement"
                   1154:
                   1155:                AC_MSG_CHECKING(whether to disable sia support on Digital UNIX)
                   1156:                AC_ARG_ENABLE(sia,
                   1157:                [  --disable-sia           Never use SIA on Digital UNIX],
                   1158:                [ case "$enableval" in
                   1159:                    yes)        AC_MSG_RESULT(no)
                   1160:                                ;;
                   1161:                    no)         AC_MSG_RESULT(yes)
                   1162:                                CHECKSIA=false
                   1163:                                ;;
                   1164:                    *)          AC_MSG_RESULT(no)
                   1165:                                echo "Ignoring unknown argument to --enable-sia: $enableval"
                   1166:                                ;;
                   1167:                  esac
                   1168:                ], AC_MSG_RESULT(no))
                   1169:
                   1170:                # use SIA by default, if we have it, else SecureWare
                   1171:                # unless overridden on the command line
                   1172:                if test "$CHECKSIA" = "true"; then
                   1173:                    AC_CHECK_FUNC(sia_ses_init, AC_DEFINE(HAVE_SIA) [
                   1174:                    if test -n "$with_skey" -o -n "$with_opie" -o -n "$with_otp_only" -o -n "$with_long_otp_prompt" -o -n "$with_SecurID" -o -n "$with_fwtk" -o -n "$with_kerb4" -o -n "$with_kerb5" -o -n "$with_pam" -o -n "$with_AFS" -o -n "$with_DCE"; then
                   1175:                        AC_MSG_ERROR(["you cannot mix SIA and other authentication schemes.  You can turn off SIA support via the --disable-sia option"])
                   1176:                    fi]; CHECKSHADOW=false)
                   1177:                fi
                   1178:                if test "$CHECKSHADOW" = "true"; then
                   1179:                    AC_CHECK_LIB(security, getprpwnam, SECUREWARE=1)
                   1180:                    CHECKSHADOW="false"
                   1181:                fi
                   1182:
                   1183:                if test -n "$SECUREWARE"; then
                   1184:                    AC_DEFINE(HAVE_GETPRPWNAM)
                   1185:                    # -ldb includes bogus versions of snprintf/vsnprintf
                   1186:                    AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF), NEED_SNPRINTF=1)
                   1187:                    AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF), NEED_SNPRINTF=1)
                   1188:                    # 4.x and higher need -ldb too...
                   1189:                    AC_CHECK_LIB(db, dbopen, [SUDO_LIBS="${SUDO_LIBS} -lsecurity -ldb -laud -lm"; LIBS="${LIBS} -lsecurity -ldb -laud -lm"], [SUDO_LIBS="${SUDO_LIBS} -lsecurity -ldb -laud -lm"; LIBS="${LIBS} -lsecurity -ldb -laud -lm"])
                   1190:                    AC_CHECK_FUNCS(dispcrypt)
                   1191:                    AC_MSG_CHECKING([for broken /usr/include/prot.h])
                   1192:                    AC_TRY_COMPILE([
                   1193: #include <sys/types.h>
                   1194: #include <sys/security.h>
                   1195: #include <prot.h>
                   1196:                    ], [exit(0);], AC_MSG_RESULT(no),
                   1197:                    [AC_MSG_RESULT([yes, fixing locally])
                   1198:                    sed 's:<acl.h>:<sys/acl.h>:g' < /usr/include/prot.h > prot.h
                   1199:                    ])
                   1200:                else
                   1201:                    with_passwd=no
                   1202:                    AUTH_OBJS="sia.o"
                   1203:                fi
1.5     ! millert  1204:                mansectsu=8
        !          1205:                mansectform=4
1.1       millert  1206:                ;;
                   1207:     *-*-irix*)
                   1208:                # configure may not think irix has stdc headers
                   1209:                # but it's good enough for sudo
                   1210:                AC_DEFINE(STDC_HEADERS)
                   1211:                CPPFLAGS="${CPPFLAGS} -D_BSD_TYPES"
                   1212:                if test -z "$NROFFPROG"; then
                   1213:                    MAN_POSTINSTALL='   /bin/rm -f $(mandir8)/sudo.$(mansect8).z $(mandir8)/visudo.$(mansect8).z $(mandir5)/sudoers.$(mansect5).z ; /usr/bin/pack $(mandir8)/sudo.$(mansect8) $(mandir8)/visudo.$(mansect8) $(mandir5)/sudoers.$(mansect5)'
                   1214:                    if test "$prefix" = "/usr/local" -a "$mandir" = '$(prefix)/man'; then
                   1215:                        if test -d /usr/share/catman/local; then
                   1216:                            mandir="/usr/share/catman/local"
                   1217:                        else
                   1218:                            mandir="/usr/catman/local"
                   1219:                        fi
                   1220:                    fi
                   1221:                else
                   1222:                    if test "$prefix" = "/usr/local" -a "$mandir" = '$(prefix)/man'; then
                   1223:                        if test -d "/usr/share/man/local"; then
                   1224:                            mandir="/usr/share/man/local"
                   1225:                        else
                   1226:                            mandir="/usr/man/local"
                   1227:                        fi
                   1228:                    fi
                   1229:                fi
                   1230:                # IRIX <= 4 needs -lsun
                   1231:                if test "$OSREV" -le 4; then
                   1232:                    AC_CHECK_LIB(sun, getpwnam, [LIBS="${LIBS} -lsun"])
                   1233:                fi
1.5     ! millert  1234:                mansectsu=1m
        !          1235:                mansectform=4
1.1       millert  1236:                ;;
                   1237:     *-*-linux*)
                   1238:                # To get crypt(3) and vasprintf() prototypes (so we pass -Wall)
                   1239:                AC_DEFINE(_GNU_SOURCE)
                   1240:
                   1241:                # Some Linux versions need to link with -lshadow
                   1242:                if test "$CHECKSHADOW" = "true"; then
                   1243:                    AC_CHECK_FUNC(getspnam, AC_DEFINE(HAVE_GETSPNAM), AC_CHECK_LIB(shadow, getspnam, AC_DEFINE(HAVE_GETSPNAM) [SUDO_LIBS="${SUDO_LIBS} -lshadow"; LIBS="${LIBS} -lshadow"]))
                   1244:                    CHECKSHADOW="false"
                   1245:                fi
                   1246:                ;;
                   1247:     *-convex-bsd*)
                   1248:                AC_DEFINE(_CONVEX_SOURCE)
                   1249:                if test -z "$GCC"; then
                   1250:                    CFLAGS="${CFLAGS} -D__STDC__"
                   1251:                fi
                   1252:
                   1253:                if test "$CHECKSHADOW" = "true"; then
                   1254:                    AC_CHECK_LIB(sec, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [SUDO_LIBS="${SUDO_LIBS} -lprot"; LIBS="${LIBS} -lprot"; OSDEFS="${OSDEFS} -D_AUDIT -D_ACL -DSecureWare"; SECUREWARE=1])
                   1255:                    CHECKSHADOW="false"
                   1256:                fi
                   1257:                ;;
                   1258:     *-*-ultrix*)
                   1259:                OS="ultrix"
                   1260:                if test "$CHECKSHADOW" = "true"; then
                   1261:                    AC_CHECK_LIB(auth, getauthuid, AC_DEFINE(HAVE_GETAUTHUID) [SUDO_LIBS="${SUDO_LIBS} -lauth"; LIBS="${LIBS} -lauth"])
                   1262:                    CHECKSHADOW="false"
                   1263:                fi
                   1264:                ;;
                   1265:     *-*-riscos*)
                   1266:                LIBS="${LIBS} -lsun -lbsd"
                   1267:                CPPFLAGS="${CPPFLAGS} -I/usr/include -I/usr/include/bsd"
                   1268:                OSDEFS="${OSDEFS} -D_MIPS"
1.5     ! millert  1269:                mansectsu=1m
        !          1270:                mansectform=4
1.1       millert  1271:                ;;
                   1272:     *-*-isc*)
                   1273:                OSDEFS="${OSDEFS} -D_ISC"
                   1274:                LIB_CRYPT=1
                   1275:                SUDO_LIBS="${SUDO_LIBS} -lcrypt"
                   1276:                LIBS="${LIBS} -lcrypt"
                   1277:
                   1278:                if test "$CHECKSHADOW" = "true"; then
                   1279:                    AC_CHECK_LIB(sec, getspnam, AC_DEFINE(HAVE_GETSPNAM) [SUDO_LIBS="${SUDO_LIBS} -lsec"; LIBS="${LIBS} -lsec"])
                   1280:                    CHECKSHADOW="false"
                   1281:                fi
1.5     ! millert  1282:                mansectsu=1m
        !          1283:                mansectform=4
1.1       millert  1284:                ;;
                   1285:     *-*-sco*)
                   1286:                if test "$CHECKSHADOW" = "true"; then
                   1287:                    AC_CHECK_LIB(prot, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [SUDO_LIBS="${SUDO_LIBS} -lprot -lx"; LIBS="${LIBS} -lprot -lx"; SECUREWARE=1], , -lx)
                   1288:                    AC_CHECK_LIB(gen, getspnam, AC_DEFINE(HAVE_GETSPNAM) [SUDO_LIBS="${SUDO_LIBS} -lgen"; LIBS="${LIBS} -lgen"])
                   1289:                    CHECKSHADOW="false"
                   1290:                fi
1.5     ! millert  1291:                mansectsu=1m
        !          1292:                mansectform=4
1.1       millert  1293:                ;;
                   1294:     *-sequent-sysv*)
                   1295:                if test "$CHECKSHADOW" = "true"; then
                   1296:                    AC_CHECK_LIB(sec, getspnam, AC_DEFINE(HAVE_GETSPNAM) [SUDO_LIBS="${SUDO_LIBS} -lsec"; LIBS="${LIBS} -lsec"])
                   1297:                    CHECKSHADOW="false"
                   1298:                fi
1.5     ! millert  1299:                mansectsu=1m
        !          1300:                mansectform=4
1.1       millert  1301:                ;;
                   1302:     *-ccur-sysv4|*-ccur-sysvr4)
                   1303:                LIBS="${LIBS} -lgen"
                   1304:                SUDO_LIBS="${SUDO_LIBS} -lgen"
1.5     ! millert  1305:                mansectsu=1m
        !          1306:                mansectform=4
1.1       millert  1307:                ;;
                   1308:     *-*-bsdi*)
1.5     ! millert  1309:                # Use shlicc for BSD/OS [23].x unless asked to do otherwise
        !          1310:                if test "${with_CC+set}" != set -a "$ac_cv_prog_CC" = gcc; then
        !          1311:                    case "$OSREV" in
        !          1312:                        2|3)    echo 'using shlicc as CC'
        !          1313:                                ac_cv_prog_CC=shlicc
        !          1314:                                CC="$ac_cv_prog_CC"
        !          1315:                                ;;
        !          1316:                    esac
        !          1317:                fi
        !          1318:                ;;
        !          1319:     *-*-freebsd*)
        !          1320:                if test "$with_skey" = "yes"; then
        !          1321:                     SUDO_LIBS="${SUDO_LIBS} -lmd"
        !          1322:                fi
        !          1323:                if test "$CHECKSHADOW" = "true"; then
        !          1324:                    CHECKSHADOW="false"
1.1       millert  1325:                fi
                   1326:                ;;
                   1327:     *-*-*bsd*)
                   1328:                if test "$CHECKSHADOW" = "true"; then
                   1329:                    CHECKSHADOW="false"
                   1330:                fi
                   1331:                ;;
1.5     ! millert  1332:     *-*-sysv*)
        !          1333:                mansectsu=1m
        !          1334:                mansectform=4
        !          1335:                ;;
1.1       millert  1336: esac
                   1337:
                   1338: dnl
1.5     ! millert  1339: dnl Use BSD-style man sections by default
        !          1340: dnl
        !          1341: test -n "$mansectsu" || mansectsu=8
        !          1342: test -n "$mansectform" || mansectform=5
        !          1343:
        !          1344: dnl
1.1       millert  1345: dnl Check for shadow password routines if we have not already done so.
                   1346: dnl We check for SVR4-style first and then SecureWare-style.
                   1347: dnl
                   1348: if test "$CHECKSHADOW" = "true"; then
                   1349:     AC_CHECK_FUNC(getspnam, AC_DEFINE(HAVE_GETSPNAM) [CHECKSHADOW="false"])
                   1350: fi
                   1351: if test "$CHECKSHADOW" = "true"; then
                   1352:     AC_CHECK_FUNC(getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [CHECKSHADOW="false"; SECUREWARE=1], AC_CHECK_LIB(sec, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [CHECKSHADOW="false"; SECUREWARE=1; SUDO_LIBS="${SUDO_LIBS} -lsec"; LIBS="${LIBS} -lsec"], AC_CHECK_LIB(security, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [CHECKSHADOW="false"; SECUREWARE=1; SUDO_LIBS="${SUDO_LIBS} -lsecurity"; LIBS="${LIBS} -lsecurity"], AC_CHECK_LIB(prot, getprpwnam, AC_DEFINE(HAVE_GETPRPWNAM) [CHECKSHADOW="false"; SECUREWARE=1; SUDO_LIBS="${SUDO_LIBS} -lprot"; LIBS="${LIBS} -lprot"]))))
                   1353: fi
                   1354:
                   1355: dnl
                   1356: dnl C compiler checks (to be done after os checks)
                   1357: dnl
                   1358: AC_PROG_GCC_TRADITIONAL
                   1359: AC_C_CONST
                   1360: dnl
                   1361: dnl Program checks
                   1362: dnl
                   1363: AC_PROG_YACC
                   1364: if test -z "$with_sendmail"; then
                   1365:     SUDO_PROG_SENDMAIL
                   1366: fi
                   1367: SUDO_PROG_MV
                   1368: SUDO_PROG_BSHELL
                   1369: SUDO_PROG_VI
                   1370: dnl
                   1371: dnl Header file checks
                   1372: dnl
                   1373: AC_HEADER_STDC
                   1374: AC_HEADER_DIRENT
1.2       millert  1375: AC_CHECK_HEADERS(string.h strings.h unistd.h malloc.h paths.h utime.h netgroup.h sys/sockio.h sys/bsdtypes.h sys/select.h)
1.1       millert  1376: dnl ultrix termio/termios are broken
                   1377: if test "$OS" != "ultrix"; then
                   1378:     AC_CHECK_HEADERS(termio.h)
                   1379:     AC_CHECK_HEADERS(termios.h, AC_CHECK_FUNCS(tcgetattr))
                   1380: fi
                   1381: dnl
                   1382: dnl typedef checks
                   1383: dnl
                   1384: AC_TYPE_MODE_T
                   1385: AC_TYPE_UID_T
                   1386: SUDO_TYPE_SIZE_T
                   1387: SUDO_TYPE_SSIZE_T
                   1388: SUDO_TYPE_DEV_T
                   1389: SUDO_TYPE_INO_T
                   1390: SUDO_FULL_VOID
                   1391: SUDO_UID_T_LEN
                   1392: SUDO_LONG_LONG
                   1393: SUDO_SOCK_SA_LEN
                   1394: dnl
                   1395: dnl only set RETSIGTYPE if it is not set already
                   1396: dnl
                   1397: case "$DEFS" in
                   1398:     *"RETSIGTYPE"*)    ;;
                   1399:     *)                 AC_TYPE_SIGNAL;;
                   1400: esac
                   1401: dnl
                   1402: dnl Function checks
                   1403: dnl
1.3       millert  1404: AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf sigaction tzset seteuid strftime setrlimit initgroups fstat)
1.1       millert  1405: if test -n "$SECUREWARE"; then
                   1406:     AC_CHECK_FUNCS(bigcrypt)
                   1407:     AC_CHECK_FUNCS(set_auth_parameters)
                   1408:     AC_CHECK_FUNCS(initprivs)
                   1409: fi
                   1410: if test -z "$BROKEN_GETCWD"; then
                   1411:     AC_CHECK_FUNC(getcwd, AC_DEFINE(HAVE_GETCWD), LIBOBJS="$LIBOBJS getcwd.o")
                   1412: fi
                   1413: AC_CHECK_FUNC(lockf, AC_DEFINE(HAVE_LOCKF), AC_CHECK_FUNCS(flock))
                   1414: AC_CHECK_FUNC(waitpid, AC_DEFINE(HAVE_WAITPID), AC_CHECK_FUNCS(wait3))
                   1415: AC_CHECK_FUNC(innetgr, AC_DEFINE(HAVE_INNETGR) AC_CHECK_FUNCS(getdomainname))
                   1416: AC_CHECK_FUNC(lsearch, AC_DEFINE(HAVE_LSEARCH), AC_CHECK_LIB(compat, lsearch, AC_CHECK_HEADER(search.h, AC_DEFINE(HAVE_LSEARCH) [LIBS="${LIBS} -lcompat"], LIBOBJS="$LIBOBJS lsearch.o"), LIBOBJS="$LIBOBJS lsearch.o"))
                   1417: AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV), AC_FUNC_CHECK(putenv, AC_DEFINE(HAVE_PUTENV), LIBOBJS="$LIBOBJS putenv.o"))
                   1418: AC_CHECK_FUNC(utime, AC_DEFINE(HAVE_UTIME)
                   1419: SUDO_FUNC_UTIME_POSIX, LIBOBJS="$LIBOBJS utime.o")
                   1420: SUDO_FUNC_FNMATCH(AC_DEFINE(HAVE_FNMATCH), LIBOBJS="$LIBOBJS fnmatch.o")
                   1421: AC_REPLACE_FUNCS(strerror strcasecmp)
                   1422: AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF), NEED_SNPRINTF=1)
                   1423: AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF), NEED_SNPRINTF=1)
                   1424: AC_CHECK_FUNC(asprintf, AC_DEFINE(HAVE_ASPRINTF), NEED_SNPRINTF=1)
                   1425: AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF), NEED_SNPRINTF=1)
                   1426: dnl
                   1427: dnl If NEED_SNPRINTF is set, add snprintf.c to LIBOBJS
                   1428: dnl (it contains snprintf, vsnprintf, asprintf, and vasprintf)
                   1429: dnl
                   1430: if test -n "$NEED_SNPRINTF"; then
                   1431:     LIBOBJS="$LIBOBJS snprintf.o"
                   1432: fi
                   1433: dnl
                   1434: dnl if crypt(3) not in libc, look elsewhere
                   1435: dnl
                   1436: if test -z "$LIB_CRYPT"; then
                   1437:     AC_CHECK_FUNC(crypt, ,AC_CHECK_LIB(crypt, crypt, [SUDO_LIBS="${SUDO_LIBS} -lcrypt"; LIBS="${LIBS} -lcrypt"], AC_CHECK_LIB(crypt_d, crypt, [SUDO_LIBS="${SUDO_LIBS} -lcrypt_d"; LIBS="${LIBS} -lcrypt_d"], AC_CHECK_LIB(ufc, crypt, [SUDO_LIBS="${SUDO_LIBS} -lufc"; LIBS="${LIBS} -lufc"]))))
                   1438: fi
                   1439: dnl
                   1440: dnl If socket(2) not in libc, check -lsocket and -linet
                   1441: dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
                   1442: dnl In this case we look for main(), not socket() to avoid using a cached value
                   1443: dnl
                   1444: AC_CHECK_FUNC(socket, ,AC_CHECK_LIB(socket, socket, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(inet, socket, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"], AC_MSG_WARN(unable to find socket() trying -lsocket -lnsl)
                   1445: AC_CHECK_LIB(socket, socket, [NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"], , -lnsl))))
                   1446: dnl
                   1447: dnl If inet_addr(3) not in libc, check -lnsl and -linet
                   1448: dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
                   1449: dnl
1.5     ! millert  1450: AC_CHECK_FUNC(inet_addr, , AC_CHECK_FUNC(__inet_addr, , AC_CHECK_LIB(nsl, inet_addr, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, inet_addr, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"], AC_MSG_WARN(unable to find inet_addr() trying -lsocket -lnsl)
        !          1451: AC_CHECK_LIB(socket, inet_addr, [NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"], , -lnsl)))))
1.1       millert  1452: dnl
                   1453: dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet
                   1454: dnl
                   1455: AC_CHECK_FUNC(syslog, ,AC_CHECK_LIB(socket, syslog, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(nsl, syslog, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, syslog, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"]))))
                   1456: dnl
                   1457: dnl Bison and DCE use alloca(3), if not in libc, use the sudo one (from gcc)
                   1458: dnl (gcc includes its own alloca(3) but other compilers may not)
                   1459: dnl
                   1460: if test "$with_DCE" = "yes" -o "$ac_cv_prog_YACC" = "bison -y"; then
                   1461:     AC_FUNC_ALLOCA
                   1462: fi
                   1463:
                   1464: dnl
                   1465: dnl Kerberos 5
                   1466: dnl
                   1467: if test "$with_kerb5" = "yes"; then
                   1468:     AC_DEFINE(HAVE_KERB5)
                   1469:     if test -f "/usr/local/include/krb5.h"; then
                   1470:        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
                   1471:     elif test -f "/usr/local/kerberos/include/krb5.h"; then
                   1472:        CPPFLAGS="$CPPFLAGS -I/usr/local/kerberos/include"
                   1473:     elif test -f "/usr/local/krb5/include/krb5.h"; then
                   1474:        CPPFLAGS="$CPPFLAGS -I/usr/local/krb5/include"
                   1475:     else
                   1476:        echo 'Unable to locate kerberos 5 include files, you will have to edit the Makefile and add -I/path/to/krb/includes to CPPFLAGS'
                   1477:     fi
                   1478:
                   1479:     if test -f "/usr/local/lib/libkrb5.a"; then
                   1480:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/local/lib"
                   1481:     elif test -f "/usr/local/kerberos/lib/libkrb5.a"; then
                   1482:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/local/kerberos/lib"
                   1483:     elif test -f "/usr/local/krb5/lib/libkrb5.a"; then
                   1484:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/local/krb5/lib"
                   1485:     else
                   1486:        echo 'Unable to locate kerberos 5 libraries, you will have to edit the Makefile and add -L/path/to/krb/libs to SUDO_LDFLAGS'
                   1487:     fi
                   1488:
                   1489:     SUDO_LIBS="${SUDO_LIBS} -lkrb5 -lk5crypto -lcom_err"
                   1490:     AUTH_OBJS="${AUTH_OBJS} kerb5.o"
                   1491: fi
                   1492:
                   1493: dnl
1.4       millert  1494: dnl PAM libs
                   1495: dnl
                   1496: if test "$with_pam" = "yes"; then
                   1497:     AC_HAVE_LIBRARY(dl, SUDO_LIBS="${SUDO_LIBS} -ldl -lpam", SUDO_LIBS="${SUDO_LIBS} -lpam")
                   1498: fi
                   1499:
                   1500: dnl
1.1       millert  1501: dnl Find kerberos 4 includes and libs or complain
                   1502: dnl
                   1503: if test "$with_kerb4" = "yes"; then
                   1504:     AC_DEFINE(HAVE_KERB4)
                   1505:     if test -f "/usr/include/kerberosIV/krb.h"; then
                   1506:        CPPFLAGS="${CPPFLAGS} -I/usr/include/kerberosIV"
                   1507:     elif test -f "/usr/local/include/kerberosIV/krb.h"; then
                   1508:        CPPFLAGS="${CPPFLAGS} -I/usr/local/include/kerberosIV"
                   1509:     elif test -f "/usr/kerberos/include/krb.h"; then
                   1510:        CPPFLAGS="${CPPFLAGS} -I/usr/kerberos/include"
                   1511:     elif test -f "/usr/local/kerberos/include/krb.h"; then
                   1512:        CPPFLAGS="${CPPFLAGS} -I/usr/local/kerberos/include"
                   1513:     else
                   1514:        echo 'Unable to locate kerberos 4 include files, you will have to edit the Makefile and add -I/path/to/krb/includes to CPPFLAGS'
                   1515:     fi
                   1516:
                   1517:     if test -d "/usr/kerberos/lib"; then
                   1518:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/kerberos/lib"
                   1519:     elif test -d "/usr/lib/kerberos"; then
                   1520:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/lib/kerberos"
                   1521:     elif test -f "/usr/local/lib/libkrb.a"; then
                   1522:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/local/lib"
                   1523:     elif test ! -f "/usr/lib/libkrb.a"; then
                   1524:        echo 'Unable to locate kerberos 4 libraries, you will have to edit the Makefile and add -L/path/to/krb/libs to SUDO_LDFLAGS'
                   1525:     fi
                   1526:
                   1527:     AC_HAVE_LIBRARY(des, SUDO_LIBS="${SUDO_LIBS} -lkrb -ldes", SUDO_LIBS="${SUDO_LIBS} -lkrb")
                   1528:     AUTH_OBJS="${AUTH_OBJS} kerb4.o"
                   1529: fi
                   1530:
                   1531: dnl
                   1532: dnl extra AFS libs and includes
                   1533: dnl
                   1534: if test "$with_AFS" = "yes"; then
                   1535:
                   1536:     # looks like the "standard" place for AFS libs is /usr/afsws/lib
                   1537:     AFSLIBDIRS="/usr/lib/afs /usr/afsws/lib /usr/afsws/lib/afs"
                   1538:     for i in $AFSLIBDIRS; do
                   1539:        if test -d ${i}; then
                   1540:            SUDO_LDFLAGS="${SUDO_LDFLAGS} -L${i}"
                   1541:            FOUND_AFSLIBDIR=true
                   1542:        fi
                   1543:     done
                   1544:     if test -z "$FOUND_AFSLIBDIR"; then
                   1545:        echo 'Unable to locate AFS libraries, you will have to edit the Makefile and add -L/path/to/afs/libs to SUDO_LDFLAGS or rerun configure with the --with-libpath options.'
                   1546:     fi
                   1547:
                   1548:     # Order is important here.  Note that we build AFS_LIBS from right to left
                   1549:     # since AFS_LIBS may be initialized with BSD compat libs that must go last
                   1550:     AFS_LIBS="-laudit ${AFS_LIBS}"
                   1551:     for i in $AFSLIBDIRS; do
                   1552:        if test -f ${i}/util.a; then
                   1553:            AFS_LIBS="${i}/util.a ${AFS_LIBS}"
                   1554:            FOUND_UTIL_A=true
                   1555:            break;
                   1556:        fi
                   1557:     done
                   1558:     if test -z "$FOUND_UTIL_A"; then
                   1559:        AFS_LIBS="-lutil ${AFS_LIBS}"
                   1560:     fi
                   1561:     AFS_LIBS="-lkauth -lprot -lubik -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err ${AFS_LIBS}"
                   1562:
                   1563:     # AFS includes may live in /usr/include on some machines...
                   1564:     for i in /usr/afsws/include; do
                   1565:        if test -d ${i}; then
                   1566:            CPPFLAGS="${CPPFLAGS} -I${i}"
                   1567:            FOUND_AFSINCDIR=true
                   1568:        fi
                   1569:     done
                   1570:
                   1571:     if test -z "$FOUND_AFSLIBDIR"; then
                   1572:        echo '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.'
                   1573:     fi
                   1574: fi
                   1575:
                   1576: dnl
                   1577: dnl extra DCE obj + lib
                   1578: dnl Order of libs in HP-UX 10.x is important, -ldce must be last.
                   1579: dnl
                   1580: if test "$with_DCE" = "yes"; then
                   1581:     DCE_OBJS="${DCE_OBJS} dce_pwent.o"
                   1582:     SUDO_LIBS="${SUDO_LIBS} -ldce"
                   1583: fi
                   1584:
                   1585: dnl
1.5     ! millert  1586: dnl extra login capabilities libs and includes
        !          1587: dnl
        !          1588: if test "$with_logincap" = "yes"; then
        !          1589:     SUDO_LIBS="${SUDO_LIBS} -lutil"
        !          1590:     if test -f /usr/include/login_cap.h -a -f /usr/include/sys/types.h -a -f /usr/lib/libutil.a; then
        !          1591:        :
        !          1592:     else
        !          1593:        echo 'Unable to locate libutil.a and/or login_cap.h, you will have to edit the Makefile and add -L/path/to/libutil to SUDO_LDFLAGS and/or -I/path/to/login_cap.h to CPPFLAGS'
        !          1594:     fi
        !          1595: fi
        !          1596:
        !          1597: dnl
1.1       millert  1598: dnl extra S/Key lib and includes
                   1599: dnl
                   1600: if test "$with_skey" = "yes"; then
                   1601:     SUDO_LIBS="${SUDO_LIBS} -lskey"
                   1602:     if test -f /usr/include/skey.h -a -f /usr/lib/libskey.a; then
                   1603:        :
                   1604:     elif test -f /usr/local/include/skey.h; then
                   1605:        CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
                   1606:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/local/lib"
                   1607:     elif test "$with_csops" = "yes" -a -f /tools/cs/skey/include/skey.h -a -f /tools/cs/skey/lib/libskey.a; then
                   1608:        CPPFLAGS="${CPPFLAGS} -I/tools/cs/skey/include"
                   1609:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/tools/cs/skey/lib"
                   1610:     else
                   1611:        echo 'Unable to locate libskey.a and/or skey.h, you will have to edit the Makefile and add -L/path/to/skey/lib to SUDO_LDFLAGS and/or -I/path/to/skey.h to CPPFLAGS'
                   1612:     fi
                   1613: fi
                   1614:
                   1615: dnl
                   1616: dnl extra OPIE lib and includes
                   1617: dnl
                   1618: if test "$with_opie" = "yes"; then
                   1619:     SUDO_LIBS="${SUDO_LIBS} -lopie"
                   1620:     if test -f /usr/include/opie.h -a -f /usr/lib/libopie.a; then
                   1621:        :
                   1622:     elif test -f /usr/local/include/opie.h; then
                   1623:        CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
                   1624:        SUDO_LDFLAGS="${SUDO_LDFLAGS} -L/usr/local/lib"
                   1625:     else
                   1626:        echo 'Unable to locate libopie.a and/or opie.h, you will have to edit the Makefile and add -L/path/to/opie/lib to SUDO_LDFLAGS and/or -I/path/to/opie.h to CPPFLAGS'
                   1627:     fi
                   1628: fi
                   1629:
                   1630: dnl
                   1631: dnl extra SecurID lib + includes
                   1632: dnl
                   1633: if test -n "$with_SecurID" -a "$with_SecurID" != "no"; then
                   1634:     if test "$with_SecurID" != "yes"; then
                   1635:        SUDO_LIBS="${SUDO_LIBS} ${with_SecurID}/sdiclient.a"
                   1636:        CPPFLAGS="${CPPFLAGS} -I${with_SecurID}"
                   1637:     elif test -f /usr/ace/examples/sdiclient.a; then
                   1638:        SUDO_LIBS="${SUDO_LIBS} /usr/ace/examples/sdiclient.a"
                   1639:        CPPFLAGS="${CPPFLAGS} -I/usr/ace/examples"
                   1640:     else
                   1641:        SUDO_LIBS="${SUDO_LIBS} /usr/ace/sdiclient.a"
                   1642:        CPPFLAGS="${CPPFLAGS} -I/usr/ace"
                   1643:     fi
                   1644: fi
                   1645:
                   1646: dnl
                   1647: dnl extra FWTK libs + includes
                   1648: dnl
                   1649: if test "$with_fwtk" = "yes"; then
                   1650:     SUDO_LIBS="${SUDO_LIBS} -lauth -lfwall"
                   1651: fi
                   1652:
                   1653: dnl
                   1654: dnl extra 'authenticate' lib (AIX only?)
                   1655: dnl
                   1656: if test "$with_authenticate" = "yes"; then
                   1657:     SUDO_LIBS="${SUDO_LIBS} -ls"
                   1658: fi
                   1659:
                   1660: dnl
                   1661: dnl Check for log file and timestamp locations
                   1662: dnl
                   1663: SUDO_LOGFILE
                   1664: SUDO_TIMEDIR
                   1665:
                   1666: dnl
                   1667: dnl Use passwd (and secureware) auth modules?
                   1668: dnl
                   1669: if test "$with_passwd" = "no"; then
                   1670:     AC_DEFINE(WITHOUT_PASSWD)
                   1671:     if test -z "$AUTH_OBJS"; then
                   1672:        AC_MSG_ERROR([no authentication methods defined.])
                   1673:     fi
                   1674: else
                   1675:     if test -n "$SECUREWARE"; then
                   1676:        AUTH_OBJS="${AUTH_OBJS} passwd.o secureware.o"
                   1677:     else
                   1678:        AUTH_OBJS="${AUTH_OBJS} passwd.o"
                   1679:     fi
                   1680: fi
                   1681:
                   1682: dnl
                   1683: dnl LIBS may contain duplicates from SUDO_LIBS or NET_LIBS so prune it.
                   1684: dnl
                   1685: if test -n "$LIBS"; then
                   1686:     L="$LIBS"
                   1687:     LIBS=
                   1688:     for l in ${L}; do
                   1689:        dupe=0
                   1690:        for sl in ${SUDO_LIBS} ${NET_LIBS}; do
                   1691:            test $l = $sl && dupe=1
                   1692:        done
                   1693:        test $dupe = 0 && LIBS="${LIBS} $l"
                   1694:     done
                   1695: fi
                   1696:
                   1697: dnl
                   1698: dnl Set exec_prefix
                   1699: dnl
                   1700: test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
                   1701:
                   1702: dnl
1.5     ! millert  1703: dnl Substitute into the Makefile and man pages
1.1       millert  1704: dnl
1.5     ! millert  1705: AC_OUTPUT([Makefile sudo.man visudo.man sudoers.man])
1.1       millert  1706:
                   1707: dnl
                   1708: dnl Spew any text the user needs to know about
                   1709: dnl
                   1710: if test "$with_pam" = "yes"; then
                   1711:     echo ""
                   1712:     case $host in
                   1713:        *-*-linux*)
                   1714:            echo "You will need to customize sample.pam and install it as /etc/pam.d/sudo"
                   1715:            ;;
                   1716:     esac
                   1717:     echo ""
                   1718: fi