OSDN Git Service

Makesure the result shell script is writable
[pf3gnuchains/gcc-fork.git] / gcc / fixinc / mkfixinc.sh
1 #! /bin/sh
2
3 machine=$1
4 if [ -z "$machine" ]
5 then
6         echo No machine name given
7         exit 1
8 fi
9
10 target=../fixinc.sh
11
12 echo constructing ${target} for $machine
13 fixincludes="${target}"
14
15 case $machine in
16         i[34567]86-*-linux-gnu*)
17                 fixincludes=fixinc.x86-linux-gnu
18                 ;;
19
20         *-*-sysv4*)
21                 fixincludes=fixinc.svr4
22                 ;;
23
24         mips-dec-bsd*)
25                 :
26                 ;;
27
28         i[34567]86-*-sysv5* | \
29         i[34567]86-*-udk* | \
30         i[34567]86-*-solaris2.[0-4] | \
31         powerpcle-*-solaris2.[0-4] | \
32         sparc-*-solaris2.[0-4] )
33                 fixincludes=fixinc.svr4
34                 ;;
35
36         i[34567]86-*-interix* | \
37         alpha-*-interix*)
38                 fixincludes=fixinc.interix
39                 ;;
40
41         *-*-netbsd* | \
42         alpha*-*-linux-gnulibc1* | \
43         i[34567]86-*-freebsd* | \
44         i[34567]86-*-netbsd* | i[34567]86-*-openbsd* | \
45         i[34567]86-*-solaris2* | \
46         sparcv9-*-solaris2* | \
47         powerpcle-*-solaris2*  | \
48         sparc-*-solaris2* )
49                 fixincludes=fixinc.wrap
50                 ;;
51
52         alpha*-*-winnt* | \
53         i[34567]86-*-winnt3*)
54                 fixincludes=fixinc.winnt
55                 ;;
56
57         i[34567]86-sequent-ptx* | i[34567]86-sequent-sysv[34]*)
58                 fixincludes=fixinc.ptx
59                 ;;
60
61         i[34567]86-dg-dgux* | \
62         m88k-dg-dgux*)
63                 fixincludes=fixinc.dgux
64                 ;;
65
66         i[34567]86-*-sco3.2v5* | \
67         i[34567]86-*-sco3.2v4*)
68                 fixincludes=fixinc.sco
69                 ;;
70
71         alpha*-*-linux-gnu* | \
72         alpha*-dec-vms* | \
73         arm-semi-aout | armel-semi-aout | \
74         arm-semi-aof | armel-semi-aof | \
75         arm-*-gnu* | \
76         c*-convex-* | \
77         hppa1.1-*-osf* | \
78         hppa1.0-*-osf* | \
79         hppa1.1-*-bsd* | \
80         hppa1.0-*-bsd* | \
81         hppa*-*-lites* | \
82         *-*-linux-gnu* | \
83         i[34567]86-moss-msdos* | i[34567]86-*-moss* | \
84         i[34567]86-*-osf1* | \
85         i[34567]86-*-win32 | \
86         i[34567]86-*-pe | i[34567]86-*-cygwin* | \
87         i[34567]86-*-mingw32* | \
88         mips-sgi-irix5cross64 | \
89         powerpc-*-eabiaix* | \
90         powerpc-*-eabisim* | \
91         powerpc-*-eabi*    | \
92         powerpc-*-rtems*   | \
93         powerpcle-*-eabisim* | \
94         powerpcle-*-eabi*  | \
95         powerpcle-*-winnt* | \
96         powerpcle-*-pe | powerpcle-*-cygwin* | \
97         thumb-*-coff* | thumbel-*-coff* )
98                 fixincludes=
99                 ;;
100
101         *-sgi-irix*)
102                 fixincludes=fixinc.irix
103                 ;;
104 esac
105
106 #  IF there is no include fixing,
107 #  THEN create a no-op fixer and exit
108 #
109 if test -z "$fixincludes"
110 then
111     (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
112     chmod 755 ${target}
113     exit 0
114 fi
115
116 #  IF the fixer is supplied in our source directory,
117 #  THEN copy that into place
118 #
119 if test -f ${srcdir}/"${fixincludes}"
120 then
121     echo copying ${srcdir}/$fixincludes to ${target}
122     cp ${srcdir}/$fixincludes ${target}
123     chmod 755 ${target}
124     exit 0
125 fi
126
127 #  OK.  We gotta make the thing.
128 #
129 echo $MAKE SHELL=\"$SHELL\" install
130
131 #  make and install either the binary or the default script
132 #
133 $MAKE SHELL="$SHELL" install && chmod 755 ${target} && exit 0
134
135 #  Where is our inclhack script?  That is the backup
136 #  in case we are unable to make a working binary.
137 #
138 if test -f ./inclhack.sh
139 then
140     INCLHACK=./inclhack.sh
141 else
142     INCLHACK=${srcdir}/inclhack.sh
143 fi
144
145 echo Could not install binary fixincludes.
146 echo Installing shell script instead.
147
148 cp ${INCLHACK} ${target}
149 chmod 755 ${target}