bug-gnu-utils
[Top][All Lists]
Advanced

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

Patch for coreutils 4.5.7 on Mac OS X


From: Petter Reinholdtsen
Subject: Patch for coreutils 4.5.7 on Mac OS X
Date: Thu, 20 Feb 2003 14:27:29 +0100

Hello

I had to apply the following patches to get coreutils 4.5.7 to compile
on Max os X.

If fixes the following problems

 - Make sure u_int32_t is available when <sys/dirent.h> needs it.

 - Correct #ifdef in code enabling UNAME_HARDWARE_PLATFORM and
   UNAME_PROCESSOR, to work around the fact that <sysctl.h> is missing
   on Mac OS X.  Why is <sys/param.h> protected by HAVE_SYSCTL_H?

 - Mac OS X is broken and to not return a sensible value for
   sysctl({CTL_HW,HW_MACHINE_ARCH}, ...).  Implemented workaround.  I
   need to make sure 'uname -p' return a sensible value to keep
   config.guess/configure happy when compiling some source.

Please include these patches in the next version of coreutils.

diff -ur src-4.5.7/lib/ftw.c src-4.5.7-local/lib/ftw.c
--- src-4.5.7/lib/ftw.c 2003-02-08 19:18:20.000000000 +0100
+++ src-4.5.7-local/lib/ftw.c   2003-02-20 13:29:31.000000000 +0100
@@ -36,6 +36,11 @@
 # endif
 #endif
 
+#if HAVE_SYS_TYPES_H
+/* Needed by sys/dirent.h on Mac OS X to find u_int32_t */
+# include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
 #if defined _LIBC
 # include <dirent.h>
 # define NAMLEN(dirent) _D_EXACT_NAMLEN (dirent)
diff -ur src-4.5.7/src/uname.c src-4.5.7-local/src/uname.c
--- src-4.5.7/src/uname.c       2002-12-06 16:40:55.000000000 +0100
+++ src-4.5.7-local/src/uname.c 2003-02-20 16:17:16.000000000 +0100
@@ -29,7 +29,12 @@
 # include <sys/systeminfo.h>
 #endif
 
-#if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
+/*
+ * Mac OS X got <sys/param.h> but is missing <sysctl.h>, but behaves
+ * almost like FreeBSD, except that HW_MACHINE_ARCH returns error from
+ * sysctl.
+ */
+#if HAVE_SYS_PARAM_H && HAVE_SYS_SYSCTL_H
 # include <sys/param.h> /* needed for OpenBSD 3.0 */
 # include <sys/sysctl.h>
 # ifdef HW_MODEL
@@ -255,6 +260,11 @@
          static int mib[] = { CTL_HW, UNAME_PROCESSOR };
          if (sysctl (mib, 2, processor, &s, 0, 0) >= 0)
            element = processor;
+#ifdef __POWERPC__
+         /* Mac OS X is broken, so we hardcode this here */
+         else
+           element = "powerpc";
+#endif
        }
 #endif
       print_element (element);




reply via email to

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