+2004-05-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ Port to C99, which requires that 'exit' be declared.
+
+ * lib/autoconf/c.m4 (AC_C_BIGENDIAN): Use AC_INCLUDES_DEFAULT
+ to ensure that stdlib.h is included.
+ * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA, AC_FUNC_SETPGRP,
+ AC_FUNC_STRTOD, AC_FUNC_SETVBUF_REVERSED, AC_FUNC_FORK, _AC_FUNC_FORK,
+ _AC_FUNC_VFORK, AC_FUNC_WAIT3): Likewise.
+ * lib/autoconf/specific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Likewise.
+ * lib/autoconf/types.m4 (AC_TYPE_GETGROUPS): Likewise.
+ * lib/autoconf/headers.m4 (AC_HEADER_STDC): Include <stdlib.h>
+ when using 'exit' in a test; C99 requires that 'exit' be declared.
+
2004-05-02 Paul Eggert <eggert@cs.ucla.edu>
* doc/autoconf.texi (Particular Programs): AC_PROG_GREP
AC_CACHE_CHECK([stack direction for C alloca],
[ac_cv_c_stack_direction],
[AC_RUN_IFELSE([AC_LANG_SOURCE(
-[int
+[AC_INCLUDES_DEFAULT
+int
find_stack_direction ()
{
static char *addr = 0;
AC_DEFUN([AC_FUNC_SETPGRP],
[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
[AC_RUN_IFELSE(
-[AC_LANG_PROGRAM(
-[#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-],
+[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[/* If this system has a BSD-style setpgrp which takes arguments,
setpgrp(1, 1) will fail with ESRCH and return -1, in that case
exit successfully. */
[AC_SUBST(POW_LIB)dnl
AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod,
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
+]AC_INCLUDES_DEFAULT[
+#ifndef strtod
double strtod ();
+#endif
int
main()
{
# Try running it.
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <stdio.h>]],
+ [AC_INCLUDES_DEFAULT],
[[/* This call has the arguments reversed.
A reversed system may check and see that the address of buf
is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */
AN_FUNCTION([vfork], [AC_FUNC_FORK])
AC_DEFUN([AC_FUNC_FORK],
[AC_REQUIRE([AC_TYPE_PID_T])dnl
-AC_CHECK_HEADERS(unistd.h vfork.h)
+AC_CHECK_HEADERS(vfork.h)
AC_CHECK_FUNCS(fork vfork)
if test "x$ac_cv_func_fork" = xyes; then
_AC_FUNC_FORK
# -------------
AC_DEFUN([_AC_FUNC_FORK],
[AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
- [AC_RUN_IFELSE([/* By Ruediger Kuhlmann. */
- #include <sys/types.h>
- #if HAVE_UNISTD_H
- # include <unistd.h>
- #endif
- /* Some systems only have a dummy stub for fork() */
- int main ()
- {
- if (fork() < 0)
- exit (1);
- exit (0);
- }],
- [ac_cv_func_fork_works=yes],
- [ac_cv_func_fork_works=no],
- [ac_cv_func_fork_works=cross])])]
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [
+ /* By Ruediger Kuhlmann. */
+ if (fork() < 0)
+ exit (1);
+ exit (0);
+ ])],
+ [ac_cv_func_fork_works=yes],
+ [ac_cv_func_fork_works=no],
+ [ac_cv_func_fork_works=cross])])]
)# _AC_FUNC_FORK
AC_DEFUN([_AC_FUNC_VFORK],
[AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
[AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Thanks to Paul Eggert for this test. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+]AC_INCLUDES_DEFAULT[
#include <sys/wait.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
#if HAVE_VFORK_H
# include <vfork.h>
#endif
AC_CACHE_CHECK([for wait3 that fills in rusage],
[ac_cv_func_wait3_rusage],
[AC_RUN_IFELSE([AC_LANG_SOURCE(
-[[#include <sys/types.h>
+[AC_INCLUDES_DEFAULT[
#include <sys/time.h>
#include <sys/resource.h>
-#include <stdio.h>
/* HP-UX has wait3 but does not fill in rusage at all. */
int
main ()
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
AC_RUN_IFELSE([AC_LANG_SOURCE(
[[#include <ctype.h>
+#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
- exit(2);
+ exit (2);
exit (0);
}]])], , ac_cv_header_stdc=no, :)
fi])
this macro unless you need to support very old systems like 4.2BSD and
SVR3.])dnl
AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl
-AC_CHECK_HEADERS(unistd.h)
AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
[AC_RUN_IFELSE([AC_LANG_SOURCE(
[/* Exit 0 (true) if wait returns something other than -1,
i.e. the pid of the child, which means that wait was restarted
after getting the signal. */
-#include <sys/types.h>
+AC_INCLUDES_DEFAULT
#include <signal.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif