1
1
dnl Local m4 macros for autoconf (used by sudo)
3
dnl Copyright (c) 1994-1996, 1998-2005, 2007-2009
3
dnl Copyright (c) 1994-1996, 1998-2005, 2007-2011
4
4
dnl Todd C. Miller <Todd.Miller@courtesan.com>
6
6
dnl XXX - should cache values in all cases!!!
11
11
dnl check for sendmail in well-known locations
13
AC_DEFUN(SUDO_PROG_SENDMAIL, [AC_MSG_CHECKING([for sendmail])
13
AC_DEFUN([SUDO_PROG_SENDMAIL], [AC_MSG_CHECKING([for sendmail])
15
15
for p in "/usr/sbin/sendmail" "/usr/lib/sendmail" "/usr/etc/sendmail" "/usr/ucblib/sendmail" "/usr/local/lib/sendmail" "/usr/local/bin/sendmail"; do
16
16
if test -f "$p"; then
29
29
dnl check for vi in well-known locations
31
AC_DEFUN(SUDO_PROG_VI, [AC_MSG_CHECKING([for vi])
31
AC_DEFUN([SUDO_PROG_VI], [AC_MSG_CHECKING([for vi])
33
33
for editor in "/usr/bin/vi" "/bin/vi" "/usr/ucb/vi" "/usr/bsd/vi" "/usr/local/bin/vi"; do
34
34
if test -f "$editor"; then
47
47
dnl check for mv in well-known locations
49
AC_DEFUN(SUDO_PROG_MV, [AC_MSG_CHECKING([for mv])
49
AC_DEFUN([SUDO_PROG_MV], [AC_MSG_CHECKING([for mv])
51
51
for p in "/usr/bin/mv" "/bin/mv" "/usr/ucb/mv" "/usr/sbin/mv"; do
52
52
if test -f "$p"; then
65
65
dnl check for bourne shell in well-known locations
67
AC_DEFUN(SUDO_PROG_BSHELL, [AC_MSG_CHECKING([for bourne shell])
67
AC_DEFUN([SUDO_PROG_BSHELL], [AC_MSG_CHECKING([for bourne shell])
69
69
for p in "/bin/sh" "/usr/bin/sh" "/sbin/sh" "/usr/sbin/sh" "/bin/ksh" "/usr/bin/ksh" "/bin/bash" "/usr/bin/bash"; do
70
70
if test -f "$p"; then
83
dnl check for utmp file
85
AC_DEFUN([SUDO_PATH_UTMP], [AC_MSG_CHECKING([for utmp file path])
87
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
91
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$p")
95
if test X"$found" != X"yes"; then
96
AC_MSG_RESULT([not found])
83
101
dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm
85
AC_DEFUN(SUDO_LOGFILE, [AC_MSG_CHECKING(for log file location)
103
AC_DEFUN([SUDO_LOGFILE], [AC_MSG_CHECKING(for log file location)
86
104
if test -n "$with_logpath"; then
87
105
AC_MSG_RESULT($with_logpath)
88
106
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGFILE, "$with_logpath")
104
122
dnl Where the timestamp files go.
106
AC_DEFUN(SUDO_TIMEDIR, [AC_MSG_CHECKING(for timestamp file location)
124
AC_DEFUN([SUDO_TIMEDIR], [AC_MSG_CHECKING(for timestamp file location)
107
125
timedir="$with_timedir"
108
126
if test -z "$timedir"; then
109
127
for d in /var/db /var/lib /var/adm /usr/adm; do
121
139
dnl Where the I/O log files go, use /var/log/sudo-io if
122
140
dnl /var/log exists, else /{var,usr}/adm/sudo-io
124
AC_DEFUN(SUDO_IO_LOGDIR, [
142
AC_DEFUN([SUDO_IO_LOGDIR], [
125
143
AC_MSG_CHECKING(for I/O log dir location)
126
144
if test "${with_iologdir-yes}" != "yes"; then
145
iolog_dir="$with_iologdir"
128
146
elif test -d "/var/log"; then
129
with_iologdir="/var/log/sudo-io"
147
iolog_dir="/var/log/sudo-io"
130
148
elif test -d "/var/adm"; then
131
with_iologdir="/var/adm/sudo-io"
149
iolog_dir="/var/adm/sudo-io"
133
with_iologdir="/usr/adm/sudo-io"
135
if test "${with_iologdir-yes}" != "no"; then
136
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_IO_LOGDIR, "$with_iologdir")
138
AC_MSG_RESULT($with_iologdir)
151
iolog_dir="/usr/adm/sudo-io"
153
if test "${with_iologdir}" != "no"; then
154
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_IO_LOGDIR, "$iolog_dir")
156
AC_MSG_RESULT($iolog_dir)
142
160
dnl SUDO_CHECK_TYPE(TYPE, DEFAULT)
143
161
dnl XXX - should require the check for unistd.h...
145
AC_DEFUN(SUDO_CHECK_TYPE,
163
AC_DEFUN([SUDO_CHECK_TYPE],
146
164
[AC_REQUIRE([AC_HEADER_STDC])dnl
147
165
AC_MSG_CHECKING(for $1)
148
166
AC_CACHE_VAL(sudo_cv_type_$1,
164
182
dnl Check for size_t declation
166
AC_DEFUN(SUDO_TYPE_SIZE_T,
184
AC_DEFUN([SUDO_TYPE_SIZE_T],
167
185
[SUDO_CHECK_TYPE(size_t, int)])
170
188
dnl Check for ssize_t declation
172
AC_DEFUN(SUDO_TYPE_SSIZE_T,
190
AC_DEFUN([SUDO_TYPE_SSIZE_T],
173
191
[SUDO_CHECK_TYPE(ssize_t, int)])
176
194
dnl Check for dev_t declation
178
AC_DEFUN(SUDO_TYPE_DEV_T,
196
AC_DEFUN([SUDO_TYPE_DEV_T],
179
197
[SUDO_CHECK_TYPE(dev_t, int)])
182
200
dnl Check for ino_t declation
184
AC_DEFUN(SUDO_TYPE_INO_T,
202
AC_DEFUN([SUDO_TYPE_INO_T],
185
203
[SUDO_CHECK_TYPE(ino_t, unsigned int)])
188
206
dnl check for working fnmatch(3)
190
AC_DEFUN(SUDO_FUNC_FNMATCH,
208
AC_DEFUN([SUDO_FUNC_FNMATCH],
191
209
[AC_MSG_CHECKING([for working fnmatch with FNM_CASEFOLD])
192
210
AC_CACHE_VAL(sudo_cv_func_fnmatch,
193
211
[rm -f conftestdata; > conftestdata
238
dnl check putenv() argument for const
240
AC_DEFUN([SUDO_FUNC_PUTENV_CONST],
241
[AC_CACHE_CHECK([whether putenv has a const argument],
242
sudo_cv_func_putenv_const,
243
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
244
int putenv(const char *string) {return 0;}], [])],
245
[sudo_cv_func_putenv_const=yes],
246
[sudo_cv_func_putenv_const=no])
248
if test $sudo_cv_func_putenv_const = yes; then
249
AC_DEFINE(PUTENV_CONST, 1, [Define to 1 if the `putenv' has a const argument.])
254
256
dnl check for sa_len field in struct sockaddr
256
AC_DEFUN(SUDO_SOCK_SA_LEN, [
258
AC_DEFUN([SUDO_SOCK_SA_LEN], [
257
259
AC_CHECK_MEMBER([struct sockaddr.sa_len],
258
260
[AC_DEFINE(HAVE_SA_LEN, 1, [Define if your struct sockadr has an sa_len field.])],
266
268
dnl we can't really trust UID_MAX or MAXUID since they may exist
267
269
dnl only for backwards compatibility.
269
AC_DEFUN(SUDO_UID_T_LEN,
271
AC_DEFUN([SUDO_UID_T_LEN],
270
272
[AC_REQUIRE([AC_TYPE_UID_T])
271
273
AC_MSG_CHECKING(max length of uid_t)
272
274
AC_CACHE_VAL(sudo_cv_uid_t_len,
300
302
dnl append a libpath to an LDFLAGS style variable
302
AC_DEFUN(SUDO_APPEND_LIBPATH, [
304
AC_DEFUN([SUDO_APPEND_LIBPATH], [
303
305
if test X"$with_rpath" = X"yes"; then
305
307
*-*-hpux*) $1="${$1} -L$2 -Wl,+b,$2"
319
321
dnl Determine the mail spool location
320
322
dnl NOTE: must be run *after* check for paths.h
322
AC_DEFUN(SUDO_MAILDIR, [
324
AC_DEFUN([SUDO_MAILDIR], [
324
326
if test X"$ac_cv_header_paths_h" = X"yes"; then
325
327
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
327
int main() {char *p = _PATH_MAILDIR;}], [])], [maildir=yes], [])
329
[char *p = _PATH_MAILDIR;])], [maildir=yes], [])
329
331
if test $maildir = no; then
330
332
# Solaris has maillock.h which defines MAILDIR