fix segfault on ppc
Fixes : #401153
---
 compiler/Makefile          |    6 +++++-
 include/platform/aclinux.h |    7 ++++++-
 tools/acpiexec/Makefile    |    6 +++++-
 tools/acpisrc/Makefile     |    5 ++++-
 tools/acpixtract/Makefile  |    5 ++++-
 5 files changed, 24 insertions(+), 5 deletions(-)

Index: b/compiler/Makefile
===================================================================
--- a/compiler/Makefile	2010-06-26 14:48:00.591141108 +0900
+++ b/compiler/Makefile	2010-06-26 14:50:53.258626803 +0900
@@ -125,7 +125,8 @@
 	../osunixxf.c
 
 NOMAN=	YES
-CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include -I../compiler
+MK_CFLAGS = -DACPI_ASL_COMPILER -I../include -I../compiler
+CFLAGS= -Wall -Wstrict-prototypes -O2
 
 #YACC=	yacc
 YACC=	bison
@@ -141,6 +142,9 @@
 
 LDLIBS = -lpthread -lrt
 
+%.o: %.c
+	$(CC) $(MK_CFLAGS) $(CFLAGS) -c -o $@ $<
+
 aslmain : $(patsubst %.c,%.o, $(SRCS))
 	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \
 		$(LOADLIBES) $(LDLIBS) -o iasl
Index: b/include/platform/aclinux.h
===================================================================
--- a/include/platform/aclinux.h	2010-06-26 14:48:00.571140998 +0900
+++ b/include/platform/aclinux.h	2010-06-26 14:50:53.262626326 +0900
@@ -156,13 +156,14 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <unistd.h>
+#include <endian.h>
 
 /* Host-dependent types and defines for user-space ACPICA */
 
 #define ACPI_FLUSH_CPU_CACHE()
 #define ACPI_THREAD_ID              pthread_t
 
-#if defined(__ia64__) || defined(__x86_64__)
+#if defined(__ia64__) || defined(__x86_64__) || defined(__alpha__)
 #define ACPI_MACHINE_WIDTH          64
 #define COMPILER_DEPENDENT_INT64    long
 #define COMPILER_DEPENDENT_UINT64   unsigned long
@@ -173,6 +174,10 @@
 #define ACPI_USE_NATIVE_DIVIDE
 #endif
 
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ACPI_BIG_ENDIAN
+#endif
+
 #ifndef __cdecl
 #define __cdecl
 #endif
Index: b/tools/acpiexec/Makefile
===================================================================
--- a/tools/acpiexec/Makefile	2010-06-26 14:48:00.667140142 +0900
+++ b/tools/acpiexec/Makefile	2010-06-26 14:50:53.262626326 +0900
@@ -139,8 +139,12 @@
 	../../osunixxf.c
 
 
-CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED -Wstrict-prototypes -I../../include 
+MK_CFLAGS = -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED \
+            -I../../include
+CFLAGS = -Wall -Wstrict-prototypes -O2 -g
 
+%.o: %.c
+	$(CC) $(MK_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 acpiexec : $(patsubst %.c,%.o, $(SRCS))
 	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -lrt -lpthread -o $(PROG)
Index: b/tools/acpisrc/Makefile
===================================================================
--- a/tools/acpisrc/Makefile	2010-06-26 14:48:00.639142251 +0900
+++ b/tools/acpisrc/Makefile	2010-06-26 14:50:53.262626326 +0900
@@ -4,8 +4,11 @@
 SRCS=	ascase.c asconvrt.c asfile.c asmain.c asremove.c astable.c \
         asutils.c osunixdir.c ../../common/getopt.c
 
-CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include 
+MK_CFLAGS= -DACPI_APPLICATION -I../../include
+CFLAGS= -Wall -Wstrict-prototypes -O2
 
+%.o: %.c
+	$(CC) $(MK_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 aslmain : $(patsubst %.c,%.o, $(SRCS))
 	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
Index: b/tools/acpixtract/Makefile
===================================================================
--- a/tools/acpixtract/Makefile	2010-06-26 14:48:00.615127746 +0900
+++ b/tools/acpixtract/Makefile	2010-06-26 14:50:53.262626326 +0900
@@ -3,8 +3,11 @@
 PROG=	acpixtract
 SRCS=	acpixtract.c
 
-CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include 
+MK_CFLAGS= -DACPI_APPLICATION -I../../include
+CFLAGS= -Wall -Wstrict-prototypes -O2
 
+%.o: %.c
+	$(CC) $(MK_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 acpixtract : $(patsubst %.c,%.o, $(SRCS))
 	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
