version 1.1, 2012/02/21 16:23:01
|
version 1.1.1.5, 2014/06/15 16:12:53
|
Line 1
|
Line 1
|
dnl Local m4 macros for autoconf (used by sudo) | # generated automatically by aclocal 1.11.6 -*- Autoconf -*- |
dnl | |
dnl Copyright (c) 1994-1996, 1998-2005, 2007-2011 | |
dnl Todd C. Miller <Todd.Miller@courtesan.com> | |
dnl | |
dnl XXX - should cache values in all cases!!! | |
dnl | |
dnl checks for programs | |
|
|
dnl | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
dnl check for sendmail in well-known locations | # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, |
dnl | # Inc. |
AC_DEFUN([SUDO_PROG_SENDMAIL], [AC_MSG_CHECKING([for sendmail]) | # This file is free software; the Free Software Foundation |
found=no | # gives unlimited permission to copy and/or distribute it, |
for p in "/usr/sbin/sendmail" "/usr/lib/sendmail" "/usr/etc/sendmail" "/usr/ucblib/sendmail" "/usr/local/lib/sendmail" "/usr/local/bin/sendmail"; do | # with or without modifications, as long as this notice is preserved. |
if test -f "$p"; then | |
found=yes | |
AC_MSG_RESULT([$p]) | |
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SENDMAIL, "$p") | |
break | |
fi | |
done | |
if test X"$found" != X"yes"; then | |
AC_MSG_RESULT([not found]) | |
fi | |
])dnl | |
|
|
dnl | # This program is distributed in the hope that it will be useful, |
dnl check for vi in well-known locations | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
dnl | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
AC_DEFUN([SUDO_PROG_VI], [AC_MSG_CHECKING([for vi]) | # PARTICULAR PURPOSE. |
found=no | |
for editor in "/usr/bin/vi" "/bin/vi" "/usr/ucb/vi" "/usr/bsd/vi" "/usr/local/bin/vi"; do | |
if test -f "$editor"; then | |
found=yes | |
AC_MSG_RESULT([$editor]) | |
SUDO_DEFINE_UNQUOTED(_PATH_VI, "$editor") | |
break | |
fi | |
done | |
if test X"$found" != X"yes"; then | |
AC_MSG_RESULT([not found]) | |
fi | |
])dnl | |
|
|
dnl | # longlong.m4 serial 17 |
dnl check for mv in well-known locations | dnl Copyright (C) 1999-2007, 2009-2012 Free Software Foundation, Inc. |
dnl | dnl This file is free software; the Free Software Foundation |
AC_DEFUN([SUDO_PROG_MV], [AC_MSG_CHECKING([for mv]) | dnl gives unlimited permission to copy and/or distribute it, |
found=no | dnl with or without modifications, as long as this notice is preserved. |
for p in "/usr/bin/mv" "/bin/mv" "/usr/ucb/mv" "/usr/sbin/mv"; do | |
if test -f "$p"; then | |
found=yes | |
AC_MSG_RESULT([$p]) | |
SUDO_DEFINE_UNQUOTED(_PATH_MV, "$p") | |
break | |
fi | |
done | |
if test X"$found" != X"yes"; then | |
AC_MSG_RESULT([not found]) | |
fi | |
])dnl | |
|
|
dnl | dnl From Paul Eggert. |
dnl check for bourne shell in well-known locations | |
dnl | |
AC_DEFUN([SUDO_PROG_BSHELL], [AC_MSG_CHECKING([for bourne shell]) | |
found=no | |
for p in "/bin/sh" "/usr/bin/sh" "/sbin/sh" "/usr/sbin/sh" "/bin/ksh" "/usr/bin/ksh" "/bin/bash" "/usr/bin/bash"; do | |
if test -f "$p"; then | |
found=yes | |
AC_MSG_RESULT([$p]) | |
SUDO_DEFINE_UNQUOTED(_PATH_BSHELL, "$p") | |
break | |
fi | |
done | |
if test X"$found" != X"yes"; then | |
AC_MSG_RESULT([not found]) | |
fi | |
])dnl | |
|
|
dnl | # Define HAVE_LONG_LONG_INT if 'long long int' works. |
dnl check for utmp file | # This fixes a bug in Autoconf 2.61, and can be faster |
dnl | # than what's in Autoconf 2.62 through 2.68. |
AC_DEFUN([SUDO_PATH_UTMP], [AC_MSG_CHECKING([for utmp file path]) | |
found=no | |
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do | |
if test -r "$p"; then | |
found=yes | |
AC_MSG_RESULT([$p]) | |
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$p") | |
break | |
fi | |
done | |
if test X"$found" != X"yes"; then | |
AC_MSG_RESULT([not found]) | |
fi | |
])dnl | |
|
|
dnl | # Note: If the type 'long long int' exists but is only 32 bits large |
dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm | # (as on some very old compilers), HAVE_LONG_LONG_INT will not be |
dnl | # defined. In this case you can treat 'long long int' like 'long int'. |
AC_DEFUN([SUDO_LOGFILE], [AC_MSG_CHECKING(for log file location) | |
if test -n "$with_logpath"; then | |
AC_MSG_RESULT($with_logpath) | |
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGFILE, "$with_logpath") | |
elif test -d "/var/log"; then | |
AC_MSG_RESULT(/var/log/sudo.log) | |
SUDO_DEFINE(_PATH_SUDO_LOGFILE, "/var/log/sudo.log") | |
elif test -d "/var/adm"; then | |
AC_MSG_RESULT(/var/adm/sudo.log) | |
SUDO_DEFINE(_PATH_SUDO_LOGFILE, "/var/adm/sudo.log") | |
elif test -d "/usr/adm"; then | |
AC_MSG_RESULT(/usr/adm/sudo.log) | |
SUDO_DEFINE(_PATH_SUDO_LOGFILE, "/usr/adm/sudo.log") | |
else | |
AC_MSG_RESULT(unknown, you will have to set _PATH_SUDO_LOGFILE by hand) | |
fi | |
])dnl | |
|
|
dnl | AC_DEFUN([AC_TYPE_LONG_LONG_INT], |
dnl Where the timestamp files go. | [ |
dnl | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) |
AC_DEFUN([SUDO_TIMEDIR], [AC_MSG_CHECKING(for timestamp file location) | AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], |
timedir="$with_timedir" | [ac_cv_type_long_long_int=yes |
if test -z "$timedir"; then | if test "x${ac_cv_prog_cc_c99-no}" = xno; then |
for d in /var/db /var/lib /var/adm /usr/adm; do | ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int |
if test -d "$d"; then | if test $ac_cv_type_long_long_int = yes; then |
timedir="$d/sudo" | dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. |
break | dnl If cross compiling, assume the bug is not important, since |
fi | dnl nobody cross compiles for this platform as far as we know. |
done | AC_RUN_IFELSE( |
fi | [AC_LANG_PROGRAM( |
AC_MSG_RESULT([$timedir]) | [[@%:@include <limits.h> |
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$timedir") | @%:@ifndef LLONG_MAX |
])dnl | @%:@ define HALF \ |
| (1LL << (sizeof (long long int) * CHAR_BIT - 2)) |
dnl | @%:@ define LLONG_MAX (HALF - 1 + HALF) |
dnl Where the I/O log files go, use /var/log/sudo-io if | @%:@endif]], |
dnl /var/log exists, else /{var,usr}/adm/sudo-io | [[long long int n = 1; |
dnl | int i; |
AC_DEFUN([SUDO_IO_LOGDIR], [ | for (i = 0; ; i++) |
AC_MSG_CHECKING(for I/O log dir location) | { |
if test "${with_iologdir-yes}" != "yes"; then | long long int m = n << i; |
iolog_dir="$with_iologdir" | if (m >> i != n) |
elif test -d "/var/log"; then | return 1; |
iolog_dir="/var/log/sudo-io" | if (LLONG_MAX / 2 < m) |
elif test -d "/var/adm"; then | break; |
iolog_dir="/var/adm/sudo-io" | } |
else | return 0;]])], |
iolog_dir="/usr/adm/sudo-io" | [], |
fi | [ac_cv_type_long_long_int=no], |
if test "${with_iologdir}" != "no"; then | [:]) |
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_IO_LOGDIR, "$iolog_dir") | fi |
fi | fi]) |
AC_MSG_RESULT($iolog_dir) | if test $ac_cv_type_long_long_int = yes; then |
])dnl | AC_DEFINE([HAVE_LONG_LONG_INT], [1], |
| [Define to 1 if the system has the type 'long long int'.]) |
dnl | fi |
dnl SUDO_CHECK_TYPE(TYPE, DEFAULT) | |
dnl XXX - should require the check for unistd.h... | |
dnl | |
AC_DEFUN([SUDO_CHECK_TYPE], | |
[AC_REQUIRE([AC_HEADER_STDC])dnl | |
AC_MSG_CHECKING(for $1) | |
AC_CACHE_VAL(sudo_cv_type_$1, | |
[AC_EGREP_CPP($1, [#include <sys/types.h> | |
#include <stdio.h> | |
#if STDC_HEADERS | |
#include <stdlib.h> | |
#endif | |
#if HAVE_UNISTD_H | |
#include <unistd.h> | |
#endif], sudo_cv_type_$1=yes, sudo_cv_type_$1=no)])dnl | |
AC_MSG_RESULT($sudo_cv_type_$1) | |
if test $sudo_cv_type_$1 = no; then | |
AC_DEFINE($1, $2, [Define if your system lacks the $1 type.]) | |
fi | |
]) |
]) |
|
|
dnl | # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. |
dnl Check for size_t declation | # This fixes a bug in Autoconf 2.61, and can be faster |
dnl | # than what's in Autoconf 2.62 through 2.68. |
AC_DEFUN([SUDO_TYPE_SIZE_T], | |
[SUDO_CHECK_TYPE(size_t, int)]) | |
|
|
dnl | # Note: If the type 'unsigned long long int' exists but is only 32 bits |
dnl Check for ssize_t declation | # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT |
dnl | # will not be defined. In this case you can treat 'unsigned long long int' |
AC_DEFUN([SUDO_TYPE_SSIZE_T], | # like 'unsigned long int'. |
[SUDO_CHECK_TYPE(ssize_t, int)]) | |
|
|
dnl | AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], |
dnl Check for dev_t declation | [ |
dnl | AC_CACHE_CHECK([for unsigned long long int], |
AC_DEFUN([SUDO_TYPE_DEV_T], | [ac_cv_type_unsigned_long_long_int], |
[SUDO_CHECK_TYPE(dev_t, int)]) | [ac_cv_type_unsigned_long_long_int=yes |
| if test "x${ac_cv_prog_cc_c99-no}" = xno; then |
dnl | AC_LINK_IFELSE( |
dnl Check for ino_t declation | [_AC_TYPE_LONG_LONG_SNIPPET], |
dnl | [], |
AC_DEFUN([SUDO_TYPE_INO_T], | [ac_cv_type_unsigned_long_long_int=no]) |
[SUDO_CHECK_TYPE(ino_t, unsigned int)]) | fi]) |
| if test $ac_cv_type_unsigned_long_long_int = yes; then |
dnl | AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], |
dnl check for working fnmatch(3) | [Define to 1 if the system has the type 'unsigned long long int'.]) |
dnl | |
AC_DEFUN([SUDO_FUNC_FNMATCH], | |
[AC_MSG_CHECKING([for working fnmatch with FNM_CASEFOLD]) | |
AC_CACHE_VAL(sudo_cv_func_fnmatch, | |
[rm -f conftestdata; > conftestdata | |
AC_TRY_RUN([#include <fnmatch.h> | |
main() { exit(fnmatch("/*/bin/echo *", "/usr/bin/echo just a test", FNM_CASEFOLD)); }], [sudo_cv_func_fnmatch=yes], [sudo_cv_func_fnmatch=no], | |
[sudo_cv_func_fnmatch=no]) | |
rm -f core core.* *.core]) | |
AC_MSG_RESULT($sudo_cv_func_fnmatch) | |
AS_IF([test $sudo_cv_func_fnmatch = yes], [$1], [$2])]) | |
| |
dnl | |
dnl check for isblank(3) | |
dnl | |
AC_DEFUN([SUDO_FUNC_ISBLANK], | |
[AC_CACHE_CHECK([for isblank], [sudo_cv_func_isblank], | |
[AC_TRY_LINK([#include <ctype.h>], [return (isblank('a'));], | |
sudo_cv_func_isblank=yes, sudo_cv_func_isblank=no)]) | |
] [ | |
if test "$sudo_cv_func_isblank" = "yes"; then | |
AC_DEFINE(HAVE_ISBLANK, 1, [Define if you have isblank(3).]) | |
else | |
AC_LIBOBJ(isblank) | |
fi |
fi |
]) |
]) |
|
|
dnl | # Expands to a C program that can be used to test for simultaneous support |
dnl check unsetenv() return value | # of 'long long' and 'unsigned long long'. We don't want to say that |
dnl | # 'long long' is available if 'unsigned long long' is not, or vice versa, |
AC_DEFUN([SUDO_FUNC_UNSETENV_VOID], | # because too many programs rely on the symmetry between signed and unsigned |
[AC_CACHE_CHECK([whether unsetenv returns void], [sudo_cv_func_unsetenv_void], | # integer types (excluding 'bool'). |
[AC_RUN_IFELSE([AC_LANG_PROGRAM( | AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], |
[AC_INCLUDES_DEFAULT | [ |
int unsetenv(); | AC_LANG_PROGRAM( |
], [ | [[/* For now, do not test the preprocessor; as of 2007 there are too many |
[return unsetenv("FOO") != 0;] | implementations with broken preprocessors. Perhaps this can |
]) | be revisited in 2012. In the meantime, code should not expect |
], | #if to work with literals wider than 32 bits. */ |
[sudo_cv_func_unsetenv_void=no], | /* Test literals. */ |
[sudo_cv_func_unsetenv_void=yes], | long long int ll = 9223372036854775807ll; |
[sudo_cv_func_unsetenv_void=no])]) | long long int nll = -9223372036854775807LL; |
if test $sudo_cv_func_unsetenv_void = yes; then | unsigned long long int ull = 18446744073709551615ULL; |
AC_DEFINE(UNSETENV_VOID, 1, | /* Test constant expressions. */ |
[Define to 1 if the `unsetenv' function returns void instead of `int'.]) | typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) |
fi | ? 1 : -1)]; |
]) | typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 |
| ? 1 : -1)]; |
dnl | int i = 63;]], |
dnl check for sa_len field in struct sockaddr | [[/* Test availability of runtime routines for shift and division. */ |
dnl | long long int llmax = 9223372036854775807ll; |
AC_DEFUN([SUDO_SOCK_SA_LEN], [ | unsigned long long int ullmax = 18446744073709551615ull; |
AC_CHECK_MEMBER([struct sockaddr.sa_len], | return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) |
[AC_DEFINE(HAVE_SA_LEN, 1, [Define if your struct sockadr has an sa_len field.])], | | (llmax / ll) | (llmax % ll) |
[], | | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) |
[ #include <sys/types.h> | | (ullmax / ull) | (ullmax % ull));]]) |
#include <sys/socket.h>] | |
)] | |
) | |
dnl | |
dnl check for max length of uid_t in string representation. | |
dnl we can't really trust UID_MAX or MAXUID since they may exist | |
dnl only for backwards compatibility. | |
dnl | |
AC_DEFUN([SUDO_UID_T_LEN], | |
[AC_REQUIRE([AC_TYPE_UID_T]) | |
AC_MSG_CHECKING(max length of uid_t) | |
AC_CACHE_VAL(sudo_cv_uid_t_len, | |
[rm -f conftestdata | |
AC_TRY_RUN( | |
[#include <stdio.h> | |
#include <pwd.h> | |
#include <limits.h> | |
#include <sys/types.h> | |
#include <sys/param.h> | |
main() { | |
FILE *f; | |
char b[1024]; | |
uid_t u = (uid_t) -1; | |
| |
if ((f = fopen("conftestdata", "w")) == NULL) | |
exit(1); | |
| |
(void) sprintf(b, "%lu", (unsigned long) u); | |
(void) fprintf(f, "%d\n", strlen(b)); | |
(void) fclose(f); | |
exit(0); | |
}], sudo_cv_uid_t_len=`cat conftestdata`, sudo_cv_uid_t_len=10, sudo_cv_uid_t_len=10) | |
]) |
]) |
rm -f conftestdata |
|
AC_MSG_RESULT($sudo_cv_uid_t_len) |
|
AC_DEFINE_UNQUOTED(MAX_UID_T_LEN, $sudo_cv_uid_t_len, [Define to the max length of a uid_t in string context (excluding the NUL).]) |
|
]) |
|
|
|
dnl | m4_include([m4/ax_check_compile_flag.m4]) |
dnl append a libpath to an LDFLAGS style variable | m4_include([m4/ax_check_link_flag.m4]) |
dnl | m4_include([m4/ax_func_getaddrinfo.m4]) |
AC_DEFUN([SUDO_APPEND_LIBPATH], [ | m4_include([m4/ax_func_snprintf.m4]) |
if test X"$with_rpath" = X"yes"; then | m4_include([m4/libtool.m4]) |
case "$host" in | m4_include([m4/ltoptions.m4]) |
*-*-hpux*) $1="${$1} -L$2 -Wl,+b,$2" | m4_include([m4/ltsugar.m4]) |
;; | m4_include([m4/ltversion.m4]) |
*) $1="${$1} -L$2 -Wl,-R$2" | m4_include([m4/lt~obsolete.m4]) |
;; | m4_include([m4/sudo.m4]) |
esac | |
else | |
$1="${$1} -L$2" | |
fi | |
if test X"$blibpath" != X"" -a "$1" = "SUDO_LDFLAGS"; then | |
blibpath_add="${blibpath_add}:$2" | |
fi | |
]) | |
| |
dnl | |
dnl Determine the mail spool location | |
dnl NOTE: must be run *after* check for paths.h | |
dnl | |
AC_DEFUN([SUDO_MAILDIR], [ | |
maildir=no | |
if test X"$ac_cv_header_paths_h" = X"yes"; then | |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT | |
#include <paths.h>], | |
[char *p = _PATH_MAILDIR;])], [maildir=yes], []) | |
fi | |
if test $maildir = no; then | |
# Solaris has maillock.h which defines MAILDIR | |
AC_CHECK_HEADERS(maillock.h, [ | |
SUDO_DEFINE(_PATH_MAILDIR, MAILDIR) | |
maildir=yes | |
]) | |
if test $maildir = no; then | |
for d in /var/mail /var/spool/mail /usr/spool/mail; do | |
if test -d "$d"; then | |
maildir=yes | |
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "$d") | |
break | |
fi | |
done | |
if test $maildir = no; then | |
# unable to find mail dir, hope for the best | |
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "/var/mail") | |
fi | |
fi | |
fi | |
]) | |
| |
dnl | |
dnl private versions of AC_DEFINE and AC_DEFINE_UNQUOTED that don't support | |
dnl tracing that we use to define paths for pathnames.h so autoheader doesn't | |
dnl put them in config.h.in. An awful hack. | |
dnl | |
m4_define([SUDO_DEFINE], | |
[cat >>confdefs.h <<\EOF | |
[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) | |
EOF | |
]) | |
| |
m4_define([SUDO_DEFINE_UNQUOTED], | |
[cat >>confdefs.h <<EOF | |
[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) | |
EOF | |
]) | |
| |
dnl | |
dnl Pull in libtool macros | |
dnl | |
m4_include([libtool.m4]) | |
m4_include([ltoptions.m4]) | |
m4_include([ltsugar.m4]) | |
m4_include([ltversion.m4]) | |
m4_include([lt~obsolete.m4]) | |