combine unreleased changelog entries
[debian/sudo] / aclocal.m4
index e6c29943e6a591e22c822df76f181de88722933e..1a6d9904931fa66f450f84d43fa17b448c99ec50 100644 (file)
@@ -1,6 +1,7 @@
-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-2003 Todd C. Miller <Todd.Miller@courtesan.com>
+dnl Copyright (c) 1994-1996, 1998-2005, 2007-2009
+dnl    Todd C. Miller <Todd.Miller@courtesan.com>
 dnl
 dnl XXX - should cache values in all cases!!!
 dnl
@@ -155,15 +156,6 @@ else
 fi
 ])dnl
 
-dnl
-dnl check for fullly working void
-dnl
-AC_DEFUN(SUDO_FULL_VOID, [AC_MSG_CHECKING(for full void implementation)
-AC_TRY_COMPILE(, [void *foo;
-foo = (void *)0; (void *)"test";], AC_DEFINE(VOID, void, [Define to "void" if your compiler supports void pointers, else use "char"].)
-AC_MSG_RESULT(yes), AC_DEFINE(VOID, char)
-AC_MSG_RESULT(no))])
-
 dnl
 dnl SUDO_CHECK_TYPE(TYPE, DEFAULT)
 dnl XXX - should require the check for unistd.h...
@@ -214,32 +206,65 @@ 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_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
+])
+
+dnl
+dnl check unsetenv() return value
+dnl
+AC_DEFUN([SUDO_FUNC_UNSETENV_VOID],
+  [AC_CACHE_CHECK([whether unsetenv returns void], [sudo_cv_func_unsetenv_void],
+    [AC_RUN_IFELSE([AC_LANG_PROGRAM(
+      [AC_INCLUDES_DEFAULT
+        int unsetenv();
+      ], [
+        [return unsetenv("FOO") != 0;]
+      ])
+    ],
+    [sudo_cv_func_unsetenv_void=no],
+    [sudo_cv_func_unsetenv_void=yes],
+    [sudo_cv_func_unsetenv_void=yes])])
+    if test $sudo_cv_func_unsetenv_void = yes; then
+      AC_DEFINE(UNSETENV_VOID, 1,
+        [Define to 1 if the `unsetenv' function returns void instead of `int'.])
+    fi
+  ])
+
+dnl
+dnl check putenv() argument for const
+dnl
+AC_DEFUN([SUDO_FUNC_PUTENV_CONST],
+[AC_CACHE_CHECK([whether putenv has a const argument],
+sudo_cv_func_putenv_const,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
+int putenv(const char *string) {return 0;}], [])],
+    [sudo_cv_func_putenv_const=yes],
+    [sudo_cv_func_putenv_const=no])
+  ])
+  if test $sudo_cv_func_putenv_const = yes; then
+    AC_DEFINE(PUTENV_CONST, 1, [Define to 1 if the `putenv' has a const argument.])
   fi
 ])
 
@@ -300,13 +325,24 @@ 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_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))])
+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
 dnl append a libpath to an LDFLAGS style variable