Commit Diff


commit - d5661a8dff651a11b68c13c7bc10d7b2d993c633
commit + 80ade98ab2e3c593262e675cbd724b31cde3b3fd
blob - 29f855b28020d5be47ee56d07efd1a16ce28d9b5
blob + 6273d27f293e809e76a2d2c89604382100441a31
--- util.c
+++ util.c
@@ -344,6 +344,7 @@ mprintf(const char *fmt, ...)
 int
 get_cpu_information()
 {
+#ifndef __linux__
 	char buf[50];
 	int mib[2];
 	size_t len;
@@ -358,13 +359,22 @@ get_cpu_information()
 		return(CPU_TYPE_X86);
 	else if (strncmp(buf, "Power Macintosh", 15) == 0)
 		return(CPU_TYPE_POWERPC);
-
+#else /* __linux__ */
+#if defined __x86_64__
+		return(CPU_TYPE_X86);
+#elif defined __i386__
+		return(CPU_TYPE_I386);
+#else
+#		error "Cannot determine local CPU type"
+#endif
+#endif /* __linux__ */
 	return(-1);
 }
 
 int
 get_bo_information()
 {
+#ifndef __linux__
 	int mib[2], bo;
 	size_t len;
 	
@@ -378,6 +388,15 @@ get_bo_information()
 		return(LE);
 	else if (bo == 4321)
 		return(BE);
+#else /* __linux__ */
+#if defined(__BIG_ENDIAN)
+		return(BE);
+#elif defined(__LITTLE_ENDIAN)
+		return(LE);
+#else
+#		error "Cannot determine local byte order"
+#endif /* byte order */
+#endif /* __linux__ */
 
 	return(-1);
 }