Imported Upstream version 1.6.9p16
[debian/sudo] / aclocal.m4
index 8a156b0fe618e7b5e7d57b6fc97616addf850f55..b751eeb8fcdf74801f37dcac58a00632ce05df55 100644 (file)
@@ -1,6 +1,6 @@
-dnl Local m4 macors for autoconf (used by sudo)
+dnl Local m4 macros for autoconf (used by sudo)
 dnl
-dnl Copyright (c) 1994-1996,1998-2002 Todd C. Miller <Todd.Miller@courtesan.com>
+dnl Copyright (c) 1994-1996,1998-2007 Todd C. Miller <Todd.Miller@courtesan.com>
 dnl
 dnl XXX - should cache values in all cases!!!
 dnl
@@ -144,10 +144,14 @@ elif test -d "/var/run"; then
     AC_MSG_RESULT(/var/run/sudo)
     SUDO_DEFINE(_PATH_SUDO_TIMEDIR, "/var/run/sudo")
     timedir="/var/run/sudo"
+elif test -d "/var/adm"; then
+    AC_MSG_RESULT(/var/adm/sudo)
+    SUDO_DEFINE(_PATH_SUDO_TIMEDIR, "/var/adm/sudo")
+    timedir="/var/adm/sudo"
 else
-    AC_MSG_RESULT(/tmp/.odus)
-    SUDO_DEFINE(_PATH_SUDO_TIMEDIR, "/tmp/.odus")
-    timedir="/tmp/.odus"
+    AC_MSG_RESULT(/usr/adm/sudo)
+    SUDO_DEFINE(_PATH_SUDO_TIMEDIR, "/usr/adm/sudo")
+    timedir="/usr/adm/sudo"
 fi
 ])dnl
 
@@ -206,56 +210,26 @@ dnl
 AC_DEFUN(SUDO_TYPE_INO_T,
 [SUDO_CHECK_TYPE(ino_t, unsigned int)])
 
-dnl
-dnl check for POSIX utime() using struct utimbuf
-dnl
-AC_DEFUN(SUDO_FUNC_UTIME_POSIX,
-[AC_MSG_CHECKING(for POSIX utime)
-AC_CACHE_VAL(sudo_cv_func_utime_posix,
-[rm -f conftestdata; > conftestdata
-AC_TRY_RUN([#include <sys/types.h>
-#include <sys/time.h>
-#include <utime.h>
-main() {
-struct utimbuf ut;
-ut.actime = ut.modtime = time(0);
-utime("conftestdata", &ut);
-exit(0);
-}], sudo_cv_func_utime_posix=yes, sudo_cv_func_utime_posix=no,
-  sudo_cv_func_utime_posix=no)
-rm -f core core.* *.core])dnl
-AC_MSG_RESULT($sudo_cv_func_utime_posix)
-if test $sudo_cv_func_utime_posix = yes; then
-  AC_DEFINE(HAVE_UTIME_POSIX, 1, [Define if you have a POSIX utime() (uses struct utimbuf).])
-fi
-])
-
 dnl
 dnl check for working fnmatch(3)
 dnl
 AC_DEFUN(SUDO_FUNC_FNMATCH,
-[AC_MSG_CHECKING(for working fnmatch with FNM_CASEFOLD)
+[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])dnl
+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)
-if test $sudo_cv_func_fnmatch = yes; then
-  [$1]
-else
-  [$2]
-fi
-])
+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>], [(void)isblank(1);],
+    [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
@@ -308,7 +282,7 @@ main() {
   if ((f = fopen("conftestdata", "w")) == NULL)
     exit(1);
 
-  (void) sprintf(b, "%u", u);
+  (void) sprintf(b, "%lu", (unsigned long) u);
   (void) fprintf(f, "%d\n", strlen(b));
   (void) fclose(f);
   exit(0);
@@ -320,13 +294,38 @@ AC_DEFINE_UNQUOTED(MAX_UID_T_LEN, $sudo_cv_uid_t_len, [Define to the max length
 ])
 
 dnl
-dnl check for "long long"
-dnl XXX hard to cache since it includes 2 tests
+dnl Check for presence of long long and for sizeof(long long) == sizeof(long)
+dnl
+AC_DEFUN(SUDO_TYPE_LONG_LONG,
+[AC_CHECK_TYPES(long long, [AC_DEFINE(HAVE_LONG_LONG, 1, [Define if your compiler supports the "long long" type.])]
+[AC_MSG_CHECKING(for long and long long equivalence)
+AC_CACHE_VAL(sudo_cv_type_long_is_quad,
+[AC_TRY_RUN([
+main() {
+if (sizeof(long long) == sizeof(long)) exit(0);
+else exit(1);
+}], [sudo_cv_type_long_is_quad=yes],
+[sudo_cv_type_long_is_quad=no], [sudo_cv_type_long_is_quad=no])
+rm -f core core.* *.core])dnl
+AC_MSG_RESULT($sudo_cv_type_long_is_quad)
+if test $sudo_cv_type_long_is_quad = yes; then
+  AC_DEFINE(LONG_IS_QUAD, 1, [Define if sizeof(long) == sizeof(long long).])
+fi
+])])
+
 dnl
-AC_DEFUN(SUDO_LONG_LONG, [AC_MSG_CHECKING(for long long support)
-AC_TRY_LINK(, [long long foo = 1000; foo /= 10;], AC_DEFINE(HAVE_LONG_LONG, 1, [Define if your compiler supports the "long long" type.])
-[AC_TRY_RUN([main() {if (sizeof(long long) == sizeof(long)) exit(0); else exit(1);}], AC_DEFINE(LONG_IS_QUAD, 1, [Define if sizeof(long) == sizeof(long long).]))]
-AC_MSG_RESULT(yes), AC_MSG_RESULT(no))])
+dnl append a libpath to an LDFLAGS style variable
+dnl
+AC_DEFUN(SUDO_APPEND_LIBPATH, [
+    if test X"$with_rpath" = X"yes"; then
+       $1="${$1} -L$2 -R$2"
+    else
+       $1="${$1} -L$2"
+    fi
+    if test X"$blibpath" != X"" -a "$1" = "SUDO_LDFLAGS"; then
+       blibpath_add="${blibpath_add}:$2"
+    fi
+])
 
 dnl
 dnl private versions of AC_DEFINE and AC_DEFINE_UNQUOTED that don't support