(chown_cmd): reorder command arguments to match code. Based on patch
[arla.git] / lwp / make-process.o.sh.in
blob84d5da31e11ce5f376c305043ac69f0d15712d71
1 #!/bin/sh
3 # make-process.o.sh
4 # Try to make process.o various ways.
6 # $Id$
9 srcdir=@srcdir@
11 CC=${CC-"@CC@"}
12 GCC=${GCC-"@GCC@"}
13 CPP=${CPP-"@CPP@"}
14 AS=${AS-"@AS@"}
15 RM=rm
16 HOST_CPU="$1"
17 HOST_OS="@host_os@"
18 LN_S="@LN_S@"
19 LWP_O="@LWP_O@"
22 # Here is a test to check if we manage to build process.o
23 # (use this because some sh doesn't have functions)
25 # $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
26 # $RM -f process.o
29 # Options that you may need to override for your CPU/OS
32 PROCESS_S="undefined_you_lose"
33 USE_AS="no"
34 MYDEF="-DUSING_ASM"
36 #make sure we build for the right cpu
37 @MACOSX_TRUE@CC="${CC} -arch $HOST_CPU"
40 # Clean out the process.o
43 $RM -f process.o process.S foo.c
46 # Add PROCESS_S you need
49 case "$HOST_CPU" in
50 arm*) PROCESS_S="process.arm.S" ;;
51 sparc*) PROCESS_S="process.sparc.S" ;;
52 i*86*) PROCESS_S="process.i386.S" ;;
53 m68k) PROCESS_S="process.m68k.S" ;;
54 mips*) PROCESS_S="process.mips.S" ;;
55 alpha*) PROCESS_S="process.alpha.S" ;;
56 hppa*) PROCESS_S="process.hpux.S" ;;
57 powerpc|ppc) PROCESS_S="process.ppc.S" ;;
58 rs6000) PROCESS_S="process.rios.S" ;;
59 vax) PROCESS_S="process.vax.S" ;;
60 s390*) PROCESS_S="process.s390.S" ;;
61 x86_64|amd_64|amd64) PROCESS_S="process.x86_64.S" ;;
62 f301) ;;
63 *) echo "Unknown host_cpu, good luck" ;;
64 esac
67 # Add OSDEF your OS need
70 case "$HOST_OS" in
71 *bsd*) OSDEF="-DHAVE_PIC -DAFS_BSD_ENV" ;;
72 *darwin*) OSDEF="-DHAVE_PIC -DAFS_DARWIN_ENV -DAFS_BSD_ENV" ;;
73 *dux* | *osf*) OSDEF="-DAFS_OSF_ENV" ;;
74 *linux*) OSDEF="-DAFS_LINUX_ENV" ;;
75 *solaris*) OSDEF="-DAFS_SUN5_ENV -D_ASM" USE_AS="yes" ;;
76 *irix*) OSDEF="-Dsgi -n32 -DHAVE_PIC"; ASDEF="-n32" ;;
77 *hpux*) OSDEF="-DAFS_HPUX_ENV" ;;
78 aix*) CPUDEF=""; OSDEF="" ;;
79 uxpv*)
80 $CPP $MYDEF -P ${srcdir}/process-vpp.s > foo.s
81 $AS -o process.o foo.s && $RM -f foo.s && exit 0
82 $RM -f foo.s
83 exit 1
85 *) ;;
86 esac
89 # Now try to do the magic stuff.
92 $LN_S ${srcdir}/${PROCESS_S} process.S
95 # Can we use $CC to do the asm for us ? (GCC)
98 if test "X$GCC" = "Xyes" -a "X$USE_AS" = "Xno"; then
99 ${CC} -I../include -I$srcdir -DASSEMBLER $MYDEF $CPUDEF $OSDEF -c process.S
101 # process.o there ?
102 $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
103 $RM -f process.o
107 # Try to use $AS -P for assably
110 $AS -P -I../include -I$srcdir -DASSEMBLER $MYDEF $CPUDEF $OSDEF process.S -o process.o
112 # process.o there ?
113 $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
114 $RM -f process.o
118 # Some $AS does "interesting" things, like ignorings the -o flag
119 # and creats a .i file that is preprocessed. (Digital Unix)
122 if test -s process.i ; then
123 $AS $ASDEF process.i -o process.o
124 $RM -f process.i
126 # process.o there ?
127 $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
128 $RM -f process.o
132 # Try to use $AS (without -P) for assably
135 $AS -I../include -I$srcdir -DASSEMBLER $MYDEF $CPUDEF $OSDEF process.S -o process.o
137 # process.o there ?
138 $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
139 $RM -f process.o
143 # Some $AS does "intresting" things, like ignorings the -o flag
144 # and creats a .i file that is preprocessed. (Digital Unix)
147 if test -s process.i ; then
148 $AS process.i -o process.o
149 $RM -f process.i
151 # process.o there ?
152 $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
153 $RM -f process.o
158 # Try to use $CPP to preprocess
161 $CPP -I../include -I$srcdir $MYDEF $CPUDEF $OSDEF process.S > process.ss
162 $AS process.ss -o process.o
163 $RM -f process.ss
165 # process.o there ?
166 $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
167 $RM -f process.o
170 # Try to fool $CC by adding a .c extension.
173 $LN_S process.S foo.c
174 $CPP -I../include -I$srcdir $MYDEF $CPUDEF $OSDEF foo.c > process.ss
175 $RM -f foo.c
176 $AS process.ss -o process.o
177 $RM -f process.ss
179 # process.o there ?
180 $CC -o testprocess testprocess.o process.o preempt.o ${LWP_O} && exit 0
181 $RM -f process.o
183 echo "WE HAVE NO process.o !"
184 exit 1