bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more OpenBSD 3.4 porting fixes for coreutils


From: Paul Eggert
Subject: more OpenBSD 3.4 porting fixes for coreutils
Date: Wed, 04 Aug 2004 16:11:08 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I installed these patches, which complete the little fixes needed to
get coreutils CVS running on OpenBSD 3.4.

2004-08-04  Paul Eggert  <address@hidden>

        OpenBSD porting fixes.
        * lib/getndelim2.c: Sync from gnulib.
        * lib/mountlist.c (SIZE_MAX): Define after including files, to avoid
        a collision on OpenBSD 3.4.

        * m4/boottime.m4: Add copyright notice.
        (GNULIB_BOOT_TIME): Include sys/param.h before testing
        for sys/sysctl.h.
        * m4/fsusage.m4: Add copyright notice.
        (gl_FSUSAGE): Include sys/param.h before checking for sys/mount.h.
        * m4/jm-macros.m4: Include copyright notice.
        (gl_MACROS): Use the _ONCE variants when appropriate.
        Include sys/param.h before testing for sys/sysctl.h and sys/mount.h.
        * m4/ls-mntd-fs.m4: Include copyright notice.
        (gl_LIST_MOUNTED_FILE_SYSTEMS): Include sys/param.h before
        testing for sys/mount.h.
        * m4/stat-prog.m4: Include copyright notice.
        (cu_PREREQ_STAT_PROG): Use the _ONCE variants when appropriate.
        Include sys/param.h before testing for sys/mount.h.

        * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
        Define to a concatenation of string literals, not to an expression;
        needed for concatenation contexts.
        (INTMAX_MAX, INTMAX_MIN): New macros.

Index: lib/getndelim2.c
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/getndelim2.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -p -u -r1.6 -r1.7
--- lib/getndelim2.c    17 May 2004 13:20:25 -0000      1.6
+++ lib/getndelim2.c    4 Aug 2004 20:58:57 -0000       1.7
@@ -27,6 +27,7 @@
 #include "getndelim2.h"
 
 #include <stdlib.h>
+#include <stddef.h>
 
 #include "unlocked-io.h"
 
Index: lib/mountlist.c
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/mountlist.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -p -u -r1.47 -r1.48
--- lib/mountlist.c     2 Aug 2004 20:27:45 -0000       1.47
+++ lib/mountlist.c     4 Aug 2004 22:08:33 -0000       1.48
@@ -26,10 +26,6 @@
 
 #include "xalloc.h"
 
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
 #ifndef strstr
 char *strstr ();
 #endif
@@ -139,6 +135,10 @@ char *strstr ();
 
 #include "mountlist.h"
 #include "unlocked-io.h"
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
 
 #if MOUNTED_GETMNTINFO
 
Index: m4/boottime.m4
===================================================================
RCS file: /home/eggert/coreutils/cu/m4/boottime.m4,v
retrieving revision 1.1
retrieving revision 1.2
diff -p -u -r1.1 -r1.2
--- m4/boottime.m4      17 Jul 2002 10:47:46 -0000      1.1
+++ m4/boottime.m4      4 Aug 2004 22:26:42 -0000       1.2
@@ -1,11 +1,33 @@
+# boottime.m4 serial 2
 # Determine whether this system has infrastructure for obtaining the boot time.
 
+# Copyright (C) 1996, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 # GNULIB_BOOT_TIME([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
 * ----------------------------------------------------------
 AC_DEFUN([GNULIB_BOOT_TIME],
 [
   AC_CHECK_FUNCS(sysctl)
-  AC_CHECK_HEADERS(sys/sysctl.h)
+  AC_CHECK_HEADERS_ONCE(sys/param.h)
+  AC_CHECK_HEADERS(sys/sysctl.h, [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif]])
   AC_CACHE_CHECK(
     [whether we can get the system boot time],
     [gnulib_cv_have_boot_time],
@@ -14,7 +36,9 @@ AC_DEFUN([GNULIB_BOOT_TIME],
        [AC_LANG_PROGRAM(
 [AC_INCLUDES_DEFAULT
 #if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
-# include <sys/param.h> /* needed for OpenBSD 3.0 */
+# if HAVE_SYS_PARAM_H
+#  include <sys/param.h> /* needed for OpenBSD 3.0 */
+# endif
 # include <sys/sysctl.h>
 #endif
 #ifdef HAVE_UTMPX_H
Index: m4/fsusage.m4
===================================================================
RCS file: /home/eggert/coreutils/cu/m4/fsusage.m4,v
retrieving revision 1.18
retrieving revision 1.19
diff -p -u -r1.18 -r1.19
--- m4/fsusage.m4       30 Jun 2004 22:43:06 -0000      1.18
+++ m4/fsusage.m4       4 Aug 2004 22:27:00 -0000       1.19
@@ -1,11 +1,34 @@
-#serial 12
+# fsusage.m4 serial 13
+# Obtaining file system usage information.
 
-# From fileutils/configure.in
+# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Written by Jim Meyering.
 
 AC_DEFUN([gl_FSUSAGE],
 [
   AC_CHECK_HEADERS_ONCE(sys/param.h)
-  AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h)
+  AC_CHECK_HEADERS_ONCE(sys/vfs.h sys/fs_types.h)
+  AC_CHECK_HEADERS(sys/mount.h, [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif]])
   gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
   if test $gl_cv_fs_space = yes; then
     AC_LIBOBJ(fsusage)
Index: m4/jm-macros.m4
===================================================================
RCS file: /home/eggert/coreutils/cu/m4/jm-macros.m4,v
retrieving revision 1.197
retrieving revision 1.198
diff -p -u -r1.197 -r1.198
--- m4/jm-macros.m4     2 Aug 2004 05:22:57 -0000       1.197
+++ m4/jm-macros.m4     4 Aug 2004 22:27:12 -0000       1.198
@@ -1,6 +1,25 @@
-#serial 74   -*- autoconf -*-
+#serial 75   -*- autoconf -*-
 
-dnl Misc type-related macros for fileutils, sh-utils, textutils.
+dnl Misc type-related macros for coreutils.
+
+# Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Written by Jim Meyering.
 
 AC_DEFUN([gl_MACROS],
 [
@@ -73,14 +92,14 @@ AC_DEFUN([gl_MACROS],
 
   # used by sleep and shred
   AC_REQUIRE([gl_CLOCK_TIME])
-  AC_CHECK_FUNCS(gettimeofday)
+  AC_CHECK_FUNCS_ONCE(gettimeofday)
   AC_FUNC_GETTIMEOFDAY_CLOBBER
   # used by shred
-  AC_CHECK_FUNCS(directio)
+  AC_CHECK_FUNCS_ONCE(directio)
 
   AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
 
-  AC_CHECK_FUNCS( \
+  AC_CHECK_FUNCS_ONCE( \
     endgrent \
     endpwent \
     ftruncate \
@@ -165,7 +184,7 @@ AC_DEFUN([gl_MACROS],
 # See the definition of ac_includes_default in `configure'.
 AC_DEFUN([gl_CHECK_ALL_HEADERS],
 [
-  AC_CHECK_HEADERS( \
+  AC_CHECK_HEADERS_ONCE( \
     errno.h  \
     fcntl.h \
     float.h \
@@ -186,13 +205,11 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS],
     sys/fstyp.h \
     sys/ioctl.h \
     sys/mntent.h \
-    sys/mount.h \
     sys/param.h \
     sys/resource.h \
     sys/socket.h \
     sys/statfs.h \
     sys/statvfs.h \
-    sys/sysctl.h \
     sys/systeminfo.h \
     sys/time.h \
     sys/timeb.h \
@@ -203,6 +220,11 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS],
     unistd.h \
     utime.h \
   )
+  AC_CHECK_HEADERS(sys/mount.h sys/sysctl.h, [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif]])
 ])
 
 # This macro must be invoked before any tests that run the compiler.
Index: m4/ls-mntd-fs.m4
===================================================================
RCS file: /home/eggert/coreutils/cu/m4/ls-mntd-fs.m4,v
retrieving revision 1.28
retrieving revision 1.29
diff -p -u -r1.28 -r1.29
--- m4/ls-mntd-fs.m4    30 Jun 2004 22:44:10 -0000      1.28
+++ m4/ls-mntd-fs.m4    4 Aug 2004 22:27:24 -0000       1.29
@@ -1,9 +1,27 @@
-#serial 16
+#serial 17
+# How to list mounted file systems.
+
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 dnl From Jim Meyering.
 dnl
 dnl This is not pretty.  I've just taken the autoconf code and wrapped
-dnl it in an AC_DEFUN.
+dnl it in an AC_DEFUN and made some other fixes.
 dnl
 
 # gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
@@ -16,7 +34,13 @@ AC_CHECK_HEADERS_ONCE(sys/param.h)
 # NGROUPS (as the array dimension for a struct member) without a definition.
 AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>])
 
-AC_CHECK_HEADERS(mntent.h sys/mount.h sys/fs_types.h)
+AC_CHECK_HEADERS(sys/mount.h, [], [],
+  [AC_INCLUDES_DEFAULT
+   [#if HAVE_SYS_PARAM_H
+     #include <sys/param.h>
+    #endif]])
+
+AC_CHECK_HEADERS(mntent.h sys/fs_types.h)
     getfsstat_includes="\
 $ac_includes_default
 #if HAVE_SYS_PARAM_H
Index: m4/stat-prog.m4
===================================================================
RCS file: /home/eggert/coreutils/cu/m4/stat-prog.m4,v
retrieving revision 1.2
retrieving revision 1.4
diff -p -u -r1.2 -r1.4
--- m4/stat-prog.m4     14 Apr 2004 08:41:15 -0000      1.2
+++ m4/stat-prog.m4     4 Aug 2004 22:35:37 -0000       1.4
@@ -1,11 +1,33 @@
-#serial 1
+# stat-prog.m4 serial 2
 # Record the prerequisites of src/stat.c from the coreutils package.
 
+# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Written by Jim Meyering.
+
 AC_DEFUN([cu_PREREQ_STAT_PROG],
 [
-  AC_CHECK_HEADERS(sys/sysmacros.h sys/statvfs.h sys/vfs.h)
-  AC_CHECK_HEADERS(sys/param.h sys/mount.h)
-  AC_CHECK_FUNCS(statvfs)
+  AC_CHECK_HEADERS_ONCE(sys/param.h sys/sysmacros.h sys/statvfs.h sys/vfs.h)
+  AC_CHECK_HEADERS(sys/mount.h, [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif]])
+  AC_CHECK_FUNCS_ONCE(statvfs)
 
   # For `struct statfs' on Ultrix 4.4.
   AC_CHECK_HEADERS([netinet/in.h nfs/nfs_clnt.h nfs/vfs.h],,,
Index: src/system.h
===================================================================
RCS file: /home/eggert/coreutils/cu/src/system.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -p -u -r1.92 -r1.93
--- src/system.h        2 Aug 2004 05:26:19 -0000       1.92
+++ src/system.h        4 Aug 2004 22:26:23 -0000       1.93
@@ -369,21 +369,28 @@ initialize_exit_failure (int status)
 # include <stdint.h>
 #endif
 
-#if !defined PRIdMAX || PRI_MACROS_BROKEN
-# undef PRIdMAX
-# define PRIdMAX (sizeof (uintmax_t) == sizeof (long int) ? "ld" : "lld")
+#if ULONG_MAX < ULLONG_MAX
+# define LONGEST_MODIFIER "ll"
+#else
+# define LONGEST_MODIFIER "l"
 #endif
-#if !defined PRIoMAX || PRI_MACROS_BROKEN
+#if PRI_MACROS_BROKEN
+# undef PRIdMAX
 # undef PRIoMAX
-# define PRIoMAX (sizeof (uintmax_t) == sizeof (long int) ? "lo" : "llo")
-#endif
-#if !defined PRIuMAX || PRI_MACROS_BROKEN
 # undef PRIuMAX
-# define PRIuMAX (sizeof (uintmax_t) == sizeof (long int) ? "lu" : "llu")
-#endif
-#if !defined PRIxMAX || PRI_MACROS_BROKEN
 # undef PRIxMAX
-# define PRIxMAX (sizeof (uintmax_t) == sizeof (long int) ? "lx" : "llx")
+#endif
+#ifndef PRIdMAX
+# define PRIdMAX LONGEST_MODIFIER "d"
+#endif
+#ifndef PRIoMAX
+# define PRIoMAX LONGEST_MODIFIER "o"
+#endif
+#ifndef PRIuMAX
+# define PRIuMAX LONGEST_MODIFIER "u"
+#endif
+#ifndef PRIxMAX
+# define PRIxMAX LONGEST_MODIFIER "x"
 #endif
 
 #include <ctype.h>
@@ -681,6 +688,14 @@ enum
 
 #ifndef INT_MIN
 # define INT_MIN TYPE_MINIMUM (int)
+#endif
+
+#ifndef INTMAX_MAX
+# define INTMAX_MAX TYPE_MAXIMUM (intmax_t)
+#endif
+
+#ifndef INTMAX_MIN
+# define INTMAX_MIN TYPE_MINIMUM (intmax_t)
 #endif
 
 #ifndef UINT_MAX




reply via email to

[Prev in Thread] Current Thread [Next in Thread]