[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib changes to conform to Autoconf 2.59c rules for 'exit'
From: |
Paul Eggert |
Subject: |
gnulib changes to conform to Autoconf 2.59c rules for 'exit' |
Date: |
Mon, 24 Apr 2006 00:38:01 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Autoconf 2.60 won't declare 'exit' for you automatically, due to severe
portability hassles in trying to do this. I installed the following
changes to gnulib to accommodate this. These changes also fix some
related portability problems that I discovered in the neighborhood,
e.g., other undeclared functions.
I'll install this into coreutils shortly.
2006-04-24 Paul Eggert <address@hidden>
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Use return, not exit.
Don't assume that exit status -1 is valid.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise.
* m4/putenv.m4 (gl_FUNC_PUTENV): Likewise.
* m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Likewise.
* m4/readdir.m4 (GL_FUNC_READDIR): Include <stdlib.h>.
* m4/rename.m4 (vb_FUNC_RENAME): Likewise.
* m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Use AC_RUN_IFELSE,
not AC_TRY_RUN. Use return, not exit. Don't assume that
functions can be used without declaring them, or that you can
exit with status -1.
* m4/utimes-null.m4 (gl_FUNC_UTIMES_NULL): Likewise.
Index: m4/fsusage.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/fsusage.m4,v
retrieving revision 1.22
diff -p -u -r1.22 fsusage.m4
--- m4/fsusage.m4 2 Jul 2005 09:58:35 -0000 1.22
+++ m4/fsusage.m4 24 Apr 2006 07:34:27 -0000
@@ -1,7 +1,7 @@
-#serial 16
+#serial 17
# Obtaining file system usage information.
-# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005 Free Software
+# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@@ -78,7 +78,7 @@ if test $ac_fsusage_space = no; then
{
struct statfs fsd;
fsd.f_fsize = 0;
- exit (statfs (".", &fsd, sizeof (struct statfs)));
+ return statfs (".", &fsd, sizeof (struct statfs)) != 0;
}],
fu_cv_sys_stat_statfs3_osf1=yes,
fu_cv_sys_stat_statfs3_osf1=no,
@@ -110,7 +110,7 @@ member (AIX, 4.3BSD)])
{
struct statfs fsd;
fsd.f_bsize = 0;
- exit (statfs (".", &fsd));
+ return statfs (".", &fsd) != 0;
}],
fu_cv_sys_stat_statfs2_bsize=yes,
fu_cv_sys_stat_statfs2_bsize=no,
@@ -133,7 +133,7 @@ if test $ac_fsusage_space = no; then
main ()
{
struct statfs fsd;
- exit (statfs (".", &fsd, sizeof fsd, 0));
+ return statfs (".", &fsd, sizeof fsd, 0) != 0;
}],
fu_cv_sys_stat_statfs4=yes,
fu_cv_sys_stat_statfs4=no,
@@ -162,7 +162,7 @@ member (4.4BSD and NetBSD)])
{
struct statfs fsd;
fsd.f_fsize = 0;
- exit (statfs (".", &fsd));
+ return statfs (".", &fsd) != 0;
}],
fu_cv_sys_stat_statfs2_fsize=yes,
fu_cv_sys_stat_statfs2_fsize=no,
@@ -195,7 +195,7 @@ if test $ac_fsusage_space = no; then
struct fs_data fsd;
/* Ultrix's statfs returns 1 for success,
0 for not mounted, -1 for failure. */
- exit (statfs (".", &fsd) != 1);
+ return statfs (".", &fsd) != 1;
}],
fu_cv_sys_stat_fs_data=yes,
fu_cv_sys_stat_fs_data=no,
Index: m4/nanosleep.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/nanosleep.m4,v
retrieving revision 1.22
diff -p -u -r1.22 nanosleep.m4
--- m4/nanosleep.m4 2 Mar 2006 07:36:41 -0000 1.22
+++ m4/nanosleep.m4 24 Apr 2006 07:34:27 -0000
@@ -1,4 +1,4 @@
-#serial 15
+#serial 16
dnl From Jim Meyering.
dnl Check for the nanosleep function.
@@ -51,7 +51,7 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
struct timespec ts_sleep, ts_remaining;
ts_sleep.tv_sec = 0;
ts_sleep.tv_nsec = 1;
- exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1);
+ return nanosleep (&ts_sleep, &ts_remaining) != 0;
}
],
jm_cv_func_nanosleep_works=yes,
Index: m4/putenv.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/putenv.m4,v
retrieving revision 1.16
diff -p -u -r1.16 putenv.m4
--- m4/putenv.m4 23 Sep 2005 04:15:13 -0000 1.16
+++ m4/putenv.m4 24 Apr 2006 07:34:27 -0000
@@ -1,5 +1,5 @@
-# putenv.m4 serial 10
-dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# putenv.m4 serial 11
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -17,17 +17,17 @@ AC_DEFUN([gl_FUNC_PUTENV],
{
/* Put it in env. */
if (putenv ("CONFTEST_putenv=val"))
- exit (1);
+ return 1;
/* Try to remove it. */
if (putenv ("CONFTEST_putenv"))
- exit (1);
+ return 1;
/* Make sure it was deleted. */
if (getenv ("CONFTEST_putenv") != 0)
- exit (1);
+ return 1;
- exit (0);
+ return 0;
}
],
jm_cv_func_svid_putenv=yes,
Index: m4/readdir.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/readdir.m4,v
retrieving revision 1.13
diff -p -u -r1.13 readdir.m4
--- m4/readdir.m4 23 Jan 2005 08:06:57 -0000 1.13
+++ m4/readdir.m4 24 Apr 2006 07:34:27 -0000
@@ -1,6 +1,6 @@
-#serial 8
+#serial 9
-# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003 Free Software
+# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2006 Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@@ -33,6 +33,7 @@ AC_CACHE_CHECK([for working readdir], gl
AC_TRY_RUN(
[# include <stdio.h>
+# include <stdlib.h>
# include <sys/types.h>
# include <string.h>
Index: m4/rename.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/rename.m4,v
retrieving revision 1.11
diff -p -u -r1.11 rename.m4
--- m4/rename.m4 2 Jun 2005 20:41:08 -0000 1.11
+++ m4/rename.m4 24 Apr 2006 07:34:27 -0000
@@ -1,6 +1,6 @@
-#serial 8
+#serial 9
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -23,6 +23,7 @@ AC_DEFUN([vb_FUNC_RENAME],
AC_MSG_ERROR([cannot create temporary directory])
AC_TRY_RUN([
# include <stdio.h>
+# include <stdlib.h>
int
main ()
{
Index: m4/rmdir-errno.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/rmdir-errno.m4,v
retrieving revision 1.5
diff -p -u -r1.5 rmdir-errno.m4
--- m4/rmdir-errno.m4 2 May 2005 07:00:50 -0000 1.5
+++ m4/rmdir-errno.m4 24 Apr 2006 07:34:27 -0000
@@ -1,6 +1,6 @@
-#serial 5
+#serial 6
-# Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -32,7 +32,7 @@ extern int errno;
val = errno;
s = fopen ("confdir2/errno", "w");
fprintf (s, "%d\n", val);
- exit (0);
+ return 0;
}
],
gl_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`,
Index: m4/unlink-busy.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/unlink-busy.m4,v
retrieving revision 1.5
diff -p -u -r1.5 unlink-busy.m4
--- m4/unlink-busy.m4 23 Jan 2005 08:06:57 -0000 1.5
+++ m4/unlink-busy.m4 24 Apr 2006 07:34:27 -0000
@@ -1,10 +1,10 @@
-#serial 8
+#serial 9
dnl From J. David Anglin.
dnl HPUX and other systems can't unlink shared text that is being executed.
-# Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -14,16 +14,16 @@ AC_DEFUN([gl_FUNC_UNLINK_BUSY_TEXT],
AC_CACHE_CHECK([whether a running program can be unlinked],
jm_cv_func_unlink_busy_text,
[
- AC_TRY_RUN([
- main (argc, argv)
- int argc;
- char **argv;
- {
- if (!argc)
- exit (-1);
- exit (unlink (argv[0]));
- }
- ],
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [AC_INCLUDES_DEFAULT
+ int
+ main (argc, argv)
+ int argc;
+ char **argv;
+ {
+ return !argc || unlink (argv[0]) != 0;
+ }])],
jm_cv_func_unlink_busy_text=yes,
jm_cv_func_unlink_busy_text=no,
jm_cv_func_unlink_busy_text=no
Index: m4/utimes-null.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/utimes-null.m4,v
retrieving revision 1.3
diff -p -u -r1.3 utimes-null.m4
--- m4/utimes-null.m4 23 Jan 2005 08:06:57 -0000 1.3
+++ m4/utimes-null.m4 24 Apr 2006 07:34:27 -0000
@@ -1,6 +1,8 @@
-#serial 6
+#serial 7
+
+# Copyright (C) 1998, 1999, 2001, 2003, 2004, 2006 Free Software
+# Foundation, Inc.
-# Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,13 +18,15 @@ AC_TRY_RUN([
#undef stat
#include <sys/types.h>
#include <sys/stat.h>
-main() {
+#include <sys/time.h>
+int
+main () {
struct stat s, t;
-exit(!(stat ("conftest.data", &s) == 0
- && utimes("conftest.data", (long *)0) == 0
- && stat("conftest.data", &t) == 0
- && t.st_mtime >= s.st_mtime
- && t.st_mtime - s.st_mtime < 120));
+return ! (stat ("conftest.data", &s) == 0
+ && utimes ("conftest.data", 0) == 0
+ && stat ("conftest.data", &t) == 0
+ && t.st_mtime >= s.st_mtime
+ && t.st_mtime - s.st_mtime < 120));
}],
ac_cv_func_utimes_null=yes,
ac_cv_func_utimes_null=no,
- gnulib changes to conform to Autoconf 2.59c rules for 'exit',
Paul Eggert <=