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

Annotation of src/usr.bin/sudo/acsite.m4, Revision 1.3

1.1       millert     1: dnl Local m4 macors for autoconf (used by sudo)
                      2: dnl
                      3: dnl Copyright (c) 1994-1996,1998-1999 Todd C. Miller <Todd.Miller@courtesan.com>
                      4: dnl
                      5: dnl XXX - should cache values in all cases!!!
                      6: dnl
                      7: dnl checks for programs
                      8:
                      9: dnl
                     10: dnl check for sendmail
                     11: dnl
                     12: AC_DEFUN(SUDO_PROG_SENDMAIL, [AC_MSG_CHECKING(for sendmail)
                     13: if test -f "/usr/sbin/sendmail"; then
                     14:     AC_MSG_RESULT(/usr/sbin/sendmail)
                     15:     AC_DEFINE(_PATH_SENDMAIL, "/usr/sbin/sendmail")
                     16: elif test -f "/usr/lib/sendmail"; then
                     17:     AC_MSG_RESULT(/usr/lib/sendmail)
                     18:     AC_DEFINE(_PATH_SENDMAIL, "/usr/lib/sendmail")
                     19: elif test -f "/usr/etc/sendmail"; then
                     20:     AC_MSG_RESULT(/usr/etc/sendmail)
                     21:     AC_DEFINE(_PATH_SENDMAIL, "/usr/etc/sendmail")
                     22: elif test -f "/usr/ucblib/sendmail"; then
                     23:     AC_MSG_RESULT(/usr/ucblib/sendmail)
                     24:     AC_DEFINE(_PATH_SENDMAIL, "/usr/ucblib/sendmail")
                     25: elif test -f "/usr/local/lib/sendmail"; then
                     26:     AC_MSG_RESULT(/usr/local/lib/sendmail)
                     27:     AC_DEFINE(_PATH_SENDMAIL, "/usr/local/lib/sendmail")
                     28: elif test -f "/usr/local/bin/sendmail"; then
                     29:     AC_MSG_RESULT(/usr/local/bin/sendmail)
                     30:     AC_DEFINE(_PATH_SENDMAIL, "/usr/local/bin/sendmail")
                     31: else
                     32:     AC_MSG_RESULT(not found)
                     33: fi
                     34: ])dnl
                     35:
                     36: dnl
                     37: dnl check for vi
                     38: dnl
                     39: AC_DEFUN(SUDO_PROG_VI, [AC_MSG_CHECKING(for vi)
                     40: if test -f "/usr/bin/vi"; then
                     41:     AC_MSG_RESULT(/usr/bin/vi)
                     42:     AC_DEFINE(_PATH_VI, "/usr/bin/vi")
                     43: elif test -f "/usr/ucb/vi"; then
                     44:     AC_MSG_RESULT(/usr/ucb/vi)
                     45:     AC_DEFINE(_PATH_VI, "/usr/ucb/vi")
                     46: elif test -f "/usr/bsd/vi"; then
                     47:     AC_MSG_RESULT(/usr/bsd/vi)
                     48:     AC_DEFINE(_PATH_VI, "/usr/bsd/vi")
                     49: elif test -f "/bin/vi"; then
                     50:     AC_MSG_RESULT(/bin/vi)
                     51:     AC_DEFINE(_PATH_VI, "/bin/vi")
                     52: elif test -f "/usr/local/bin/vi"; then
                     53:     AC_MSG_RESULT(/usr/local/bin/vi)
                     54:     AC_DEFINE(_PATH_VI, "/usr/local/bin/vi")
                     55: else
                     56:     AC_MSG_RESULT(not found)
                     57: fi
                     58: ])dnl
                     59:
                     60: dnl
                     61: dnl check for mv
                     62: dnl
                     63: AC_DEFUN(SUDO_PROG_MV, [AC_MSG_CHECKING(for mv)
                     64: if test -f "/usr/bin/mv"; then
                     65:     AC_MSG_RESULT(/usr/bin/mv)
                     66:     AC_DEFINE(_PATH_MV, "/usr/bin/mv")
                     67: elif test -f "/bin/mv"; then
                     68:     AC_MSG_RESULT(/bin/mv)
                     69:     AC_DEFINE(_PATH_MV, "/bin/mv")
                     70: elif test -f "/usr/ucb/mv"; then
                     71:     AC_MSG_RESULT(/usr/ucb/mv)
                     72:     AC_DEFINE(_PATH_MV, "/usr/ucb/mv")
                     73: elif test -f "/usr/sbin/mv"; then
                     74:     AC_MSG_RESULT(/usr/sbin/mv)
                     75:     AC_DEFINE(_PATH_MV, "/usr/sbin/mv")
                     76: else
                     77:     AC_MSG_RESULT(not found)
                     78: fi
                     79: ])dnl
                     80:
                     81: dnl
                     82: dnl check for bourne shell
                     83: dnl
                     84: AC_DEFUN(SUDO_PROG_BSHELL, [AC_MSG_CHECKING(for bourne shell)
                     85: if test -f "/bin/sh"; then
                     86:     AC_MSG_RESULT(/bin/sh)
                     87:     AC_DEFINE(_PATH_BSHELL, "/bin/sh")
                     88: elif test -f "/usr/bin/sh"; then
                     89:     AC_MSG_RESULT(/usr/bin/sh)
                     90:     AC_DEFINE(_PATH_BSHELL, "/usr/bin/sh")
                     91: elif test -f "/sbin/sh"; then
                     92:     AC_MSG_RESULT(/sbin/sh)
                     93:     AC_DEFINE(_PATH_BSHELL, "/sbin/sh")
                     94: elif test -f "/usr/sbin/sh"; then
                     95:     AC_MSG_RESULT(/usr/sbin/sh)
                     96:     AC_DEFINE(_PATH_BSHELL, "/usr/sbin/sh")
                     97: elif test -f "/bin/ksh"; then
                     98:     AC_MSG_RESULT(/bin/ksh)
                     99:     AC_DEFINE(_PATH_BSHELL, "/bin/ksh")
                    100: elif test -f "/usr/bin/ksh"; then
                    101:     AC_MSG_RESULT(/usr/bin/ksh)
                    102:     AC_DEFINE(_PATH_BSHELL, "/usr/bin/ksh")
                    103: elif test -f "/bin/bash"; then
                    104:     AC_MSG_RESULT(/bin/bash)
                    105:     AC_DEFINE(_PATH_BSHELL, "/bin/bash")
                    106: elif test -f "/usr/bin/bash"; then
                    107:     AC_MSG_RESULT(/usr/bin/bash)
                    108:     AC_DEFINE(_PATH_BSHELL, "/usr/bin/bash")
                    109: else
                    110:     AC_MSG_RESULT(not found)
                    111: fi
                    112: ])dnl
                    113:
                    114: dnl
                    115: dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm
                    116: dnl
                    117: AC_DEFUN(SUDO_LOGFILE, [AC_MSG_CHECKING(for log file location)
                    118: if test -n "$with_logpath"; then
                    119:     AC_MSG_RESULT($with_logpath)
                    120:     AC_DEFINE_UNQUOTED(_PATH_SUDO_LOGFILE, "$with_logpath")
                    121: elif test -d "/var/log"; then
                    122:     AC_MSG_RESULT(/var/log/sudo.log)
                    123:     AC_DEFINE(_PATH_SUDO_LOGFILE, "/var/log/sudo.log")
                    124: elif test -d "/var/adm"; then
                    125:     AC_MSG_RESULT(/var/adm/sudo.log)
                    126:     AC_DEFINE(_PATH_SUDO_LOGFILE, "/var/adm/sudo.log")
                    127: elif test -d "/usr/adm"; then
                    128:     AC_MSG_RESULT(/usr/adm/sudo.log)
                    129:     AC_DEFINE(_PATH_SUDO_LOGFILE, "/usr/adm/sudo.log")
                    130: else
                    131:     AC_MSG_RESULT(unknown, you will have to set _PATH_SUDO_LOGFILE by hand)
                    132: fi
                    133: ])dnl
                    134:
                    135: dnl
                    136: dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm
                    137: dnl
                    138: AC_DEFUN(SUDO_TIMEDIR, [AC_MSG_CHECKING(for timestamp file location)
                    139: if test -n "$with_timedir"; then
                    140:     AC_MSG_RESULT($with_timedir)
                    141:     AC_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$with_timedir")
1.3     ! millert   142:     TIMEDIR="$with_timedir"
1.1       millert   143: elif test -d "/var/run"; then
                    144:     AC_MSG_RESULT(/var/run/sudo)
                    145:     AC_DEFINE(_PATH_SUDO_TIMEDIR, "/var/run/sudo")
1.3     ! millert   146:     TIMEDIR="/var/run/sudo"
        !           147: else
1.1       millert   148:     AC_MSG_RESULT(/tmp/.odus)
                    149:     AC_DEFINE(_PATH_SUDO_TIMEDIR, "/tmp/.odus")
1.3     ! millert   150:     TIMEDIR="/tmp/.odus"
1.1       millert   151: fi
                    152: ])dnl
                    153:
                    154: dnl
                    155: dnl check for fullly working void
                    156: dnl
                    157: AC_DEFUN(SUDO_FULL_VOID, [AC_MSG_CHECKING(for full void implementation)
                    158: AC_TRY_COMPILE(, [void *foo;
                    159: foo = (void *)0; (void *)"test";], AC_DEFINE(VOID, void)
                    160: AC_MSG_RESULT(yes), AC_DEFINE(VOID, char)
                    161: AC_MSG_RESULT(no))])
                    162:
                    163: dnl
                    164: dnl SUDO_CHECK_TYPE(TYPE, DEFAULT)
                    165: dnl XXX - should require the check for unistd.h...
                    166: dnl
                    167: AC_DEFUN(SUDO_CHECK_TYPE,
                    168: [AC_REQUIRE([AC_HEADER_STDC])dnl
                    169: AC_MSG_CHECKING(for $1)
                    170: AC_CACHE_VAL(sudo_cv_type_$1,
                    171: [AC_EGREP_CPP($1, [#include <sys/types.h>
                    172: #if STDC_HEADERS
                    173: #include <stdlib.h>
                    174: #endif
                    175: #if HAVE_UNISTD_H
                    176: #include <unistd.h>
                    177: #endif], sudo_cv_type_$1=yes, sudo_cv_type_$1=no)])dnl
                    178: AC_MSG_RESULT($sudo_cv_type_$1)
                    179: if test $sudo_cv_type_$1 = no; then
                    180:   AC_DEFINE($1, $2)
                    181: fi
                    182: ])
                    183:
                    184: dnl
                    185: dnl Check for size_t declation
                    186: dnl
                    187: AC_DEFUN(SUDO_TYPE_SIZE_T,
                    188: [SUDO_CHECK_TYPE(size_t, int)])
                    189:
                    190: dnl
                    191: dnl Check for ssize_t declation
                    192: dnl
                    193: AC_DEFUN(SUDO_TYPE_SSIZE_T,
                    194: [SUDO_CHECK_TYPE(ssize_t, int)])
                    195:
                    196: dnl
                    197: dnl Check for dev_t declation
                    198: dnl
                    199: AC_DEFUN(SUDO_TYPE_DEV_T,
                    200: [SUDO_CHECK_TYPE(dev_t, int)])
                    201:
                    202: dnl
                    203: dnl Check for ino_t declation
                    204: dnl
                    205: AC_DEFUN(SUDO_TYPE_INO_T,
                    206: [SUDO_CHECK_TYPE(ino_t, unsigned int)])
                    207:
                    208: dnl
                    209: dnl check for POSIX utime() using struct utimbuf
                    210: dnl
                    211: AC_DEFUN(SUDO_FUNC_UTIME_POSIX,
                    212: [AC_MSG_CHECKING(for POSIX utime)
                    213: AC_CACHE_VAL(sudo_cv_func_utime_posix,
                    214: [rm -f conftestdata; > conftestdata
                    215: AC_TRY_RUN([#include <sys/types.h>
                    216: #include <sys/time.h>
                    217: #include <utime.h>
                    218: main() {
                    219: struct utimbuf ut;
                    220: ut.actime = ut.modtime = time(0);
                    221: utime("conftestdata", &ut);
                    222: exit(0);
                    223: }], sudo_cv_func_utime_posix=yes, sudo_cv_func_utime_posix=no,
                    224:   sudo_cv_func_utime_posix=no)
                    225: rm -f core core.* *.core])dnl
                    226: AC_MSG_RESULT($sudo_cv_func_utime_posix)
                    227: if test $sudo_cv_func_utime_posix = yes; then
                    228:   AC_DEFINE(HAVE_UTIME_POSIX)
                    229: fi
                    230: ])
                    231:
                    232: dnl
                    233: dnl check for working fnmatch(3)
                    234: dnl
                    235: AC_DEFUN(SUDO_FUNC_FNMATCH,
1.3     ! millert   236: [AC_MSG_CHECKING(for working fnmatch with FNM_CASEFOLD)
1.1       millert   237: AC_CACHE_VAL(sudo_cv_func_fnmatch,
                    238: [rm -f conftestdata; > conftestdata
1.2       millert   239: AC_TRY_RUN([#include <fnmatch.h>
1.3     ! millert   240: main() { exit(fnmatch("/*/bin/echo *", "/usr/bin/echo just a test", FNM_CASEFOLD)); }
1.2       millert   241: ], sudo_cv_func_fnmatch=yes, sudo_cv_func_fnmatch=no,
1.1       millert   242:   sudo_cv_func_fnmatch=no)
                    243: rm -f core core.* *.core])dnl
                    244: AC_MSG_RESULT($sudo_cv_func_fnmatch)
                    245: if test $sudo_cv_func_fnmatch = yes; then
                    246:   [$1]
                    247: else
                    248:   [$2]
                    249: fi
                    250: ])
                    251:
                    252: dnl
                    253: dnl check for sa_len field in struct sockaddr
                    254: dnl
                    255: AC_DEFUN(SUDO_SOCK_SA_LEN,
                    256: [AC_MSG_CHECKING(for sa_len field in struct sockaddr)
                    257: AC_CACHE_VAL(sudo_cv_sock_sa_len,
                    258: [AC_TRY_RUN([#include <sys/types.h>
                    259: #include <sys/socket.h>
                    260: main() {
                    261: struct sockaddr s;
                    262: s.sa_len = 0;
                    263: exit(0);
                    264: }], sudo_cv_sock_sa_len=yes, sudo_cv_sock_sa_len=no,
                    265:   sudo_cv_sock_sa_len=no)
                    266: rm -f core core.* *.core])dnl
                    267: AC_MSG_RESULT($sudo_cv_sock_sa_len)
                    268: if test $sudo_cv_sock_sa_len = yes; then
                    269:   AC_DEFINE(HAVE_SA_LEN)
                    270: fi
                    271: ])
                    272:
                    273: dnl
                    274: dnl check for max length of uid_t in string representation.
                    275: dnl we can't really trust UID_MAX or MAXUID since they may exist
                    276: dnl only for backwards compatibility.
                    277: dnl
                    278: AC_DEFUN(SUDO_UID_T_LEN,
                    279: [AC_REQUIRE([AC_TYPE_UID_T])
                    280: AC_MSG_CHECKING(max length of uid_t)
                    281: AC_CACHE_VAL(sudo_cv_uid_t_len,
                    282: [rm -f conftestdata
                    283: AC_TRY_RUN(
                    284: [#include <stdio.h>
                    285: #include <pwd.h>
                    286: #include <limits.h>
                    287: #include <sys/types.h>
                    288: #include <sys/param.h>
                    289: main() {
                    290:   FILE *f;
                    291:   char b[1024];
                    292:   uid_t u = (uid_t) -1;
                    293:
                    294:   if ((f = fopen("conftestdata", "w")) == NULL)
                    295:     exit(1);
                    296:
                    297:   (void) sprintf(b, "%u", u);
                    298:   (void) fprintf(f, "%d\n", strlen(b));
                    299:   (void) fclose(f);
                    300:   exit(0);
                    301: }], sudo_cv_uid_t_len=`cat conftestdata`, sudo_cv_uid_t_len=10)
                    302: ])
                    303: rm -f conftestdata
                    304: AC_MSG_RESULT($sudo_cv_uid_t_len)
                    305: AC_DEFINE_UNQUOTED(MAX_UID_T_LEN, $sudo_cv_uid_t_len)
                    306: ])
                    307:
                    308: dnl
                    309: dnl check for "long long"
                    310: dnl XXX hard to cache since it includes 2 tests
                    311: dnl
                    312: AC_DEFUN(SUDO_LONG_LONG, [AC_MSG_CHECKING(for long long support)
                    313: AC_TRY_LINK(, [long long foo = 1000; foo /= 10;], AC_DEFINE(HAVE_LONG_LONG)
                    314: [AC_TRY_RUN([main() {if (sizeof(long long) == sizeof(long)) exit(0); else exit(1);}], AC_DEFINE(LONG_IS_QUAD))]
                    315: AC_MSG_RESULT(yes), AC_MSG_RESULT(no))])