Port to C99, which requires that 'exit' be declared.

This commit is contained in:
Paul Eggert 2004-05-03 20:15:44 +00:00
parent b3b81694da
commit 11ee0ab5f5
6 changed files with 41 additions and 43 deletions

View File

@ -1,3 +1,17 @@
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

View File

@ -983,9 +983,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
])], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=no])],
[# It does not; compile a test program.
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[int
main ()
{
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
/* Are we little or big endian? From Harbison&Steele. */
union
{
@ -994,7 +992,7 @@ main ()
} u;
u.l = 1;
exit (u.c[sizeof (long int) - 1] == 1);
}]])],
]])],
[ac_cv_c_bigendian=no],
[ac_cv_c_bigendian=yes],
[# try to guess the endianness by grepping values into an object file

View File

@ -279,7 +279,8 @@ fi
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;
@ -1387,11 +1388,7 @@ AN_FUNCTION([setpgrp], [AC_FUNC_SETPGRP])
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. */
@ -1462,7 +1459,10 @@ AC_DEFUN([AC_FUNC_STRTOD],
[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()
{
@ -1609,7 +1609,7 @@ AC_CACHE_CHECK(whether setvbuf arguments are reversed,
# 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. */
@ -1699,7 +1699,7 @@ AN_FUNCTION([fork], [AC_FUNC_FORK])
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
@ -1742,21 +1742,17 @@ fi
# -------------
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
@ -1765,14 +1761,8 @@ AC_DEFUN([_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
@ -1909,10 +1899,9 @@ Remove this `AC_FUNC_WAIT3' and adjust your code to use `waitpid' instead.])dnl
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 ()

View File

@ -589,6 +589,7 @@ if test $ac_cv_header_stdc = yes; then
# /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))
@ -608,7 +609,7 @@ main ()
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])

View File

@ -255,18 +255,14 @@ old systems that lack `sigaction' and `SA_RESTART'. Don't bother with
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

View File

@ -253,7 +253,7 @@ AC_DEFUN([AC_TYPE_GETGROUPS],
AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,
[AC_RUN_IFELSE([AC_LANG_SOURCE(
[[/* Thanks to Mike Rendell for this test. */
#include <sys/types.h>
]AC_INCLUDES_DEFAULT[
#define NGID 256
#undef MAX
#define MAX(x, y) ((x) > (y) ? (x) : (y))