]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Port to C99, which requires that 'exit' be declared.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 May 2004 20:15:44 +0000 (20:15 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 May 2004 20:15:44 +0000 (20:15 +0000)
ChangeLog
lib/autoconf/c.m4
lib/autoconf/functions.m4
lib/autoconf/headers.m4
lib/autoconf/specific.m4
lib/autoconf/types.m4

index 2d99530d27c32fcf39e04de603b6a0a7d86fb9ef..6e799fb3dec55312b1b786e8de2634c8ea94e8f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 0d2d7ddc64b37b539421c84a4bac255c7218300c..a2d67a4ad28367e3b192196d64a5e2ddaf3117e5 100644 (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
index 861183ccfeeaed1ebdb9e2dcce718d09f113b362..e5a38f52fcdbf66925e2eb6f44379df3b025b7b3 100644 (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 ()
index 4f9b84e290242d4ca51c665ad790654be16afe4d..c17b65011513c57a0f15747f3e33782f06696ee4 100644 (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])
index 6e9d96470cd65f59dd1cb15f24e62c7ef307a2c0..6f553fd6b870cd60e54198b40d801bf43401e758 100644 (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
index 34cc528d352c253d06ad20bdf970cd087e137833..85c5fd93716d2c4cc5fe37a99c14a85d4c6dc1f4 100644 (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))