gdb-3.3
[deliverable/binutils-gdb.git] / gdb / config.gdb
1 #!/bin/sh
2
3 #
4 # Shell script to do machine-dependent things in
5 # preparation for compiling gdb.
6 #
7 # Usage: config.gdb machine [operating-system]
8 #
9 # If config.gdb succeeds, it leaves its status in config.status.
10 # If config.gdb fails after disturbing the status quo,
11 # config.status is removed.
12 #
13 # Note: if making something gives errors like "unable to make target
14 # 1-dep.c", this means that the compiler has put in a builtin define
15 # and there is a "-U" missing from makedefine in this file.
16 #
17
18 progname=$0
19
20 case $# in
21 1)
22 machine=$1
23 os=""
24 ;;
25 2)
26 machine=$1
27 os=$2
28 ;;
29 *)
30 echo "Usage: $progname machine [operating-system]"
31 echo "Available machine types:"
32 echo m-*.h | sed 's/m-//g' | sed 's/\.h//g'
33 if [ -r config.status ]
34 then
35 cat config.status
36 fi
37 exit 1
38 ;;
39 esac
40
41 # cannonicalize the machine name.
42 case $machine in
43 news)
44 case $os in
45 os3|newsos3)
46 $machine=newsos3
47 $os=""
48 ;;
49 esac
50 ;;
51 sun2)
52 case $os in
53 os4|sunos4)
54 $machine=sun2os4
55 $os=""
56 ;;
57 os2|sunos2)
58 $machine=sun2os2
59 $os=""
60 ;;
61 esac
62 ;;
63 sun3)
64 case $os in
65 os4|sunos4)
66 $machine=sun3os4
67 $os=""
68 ;;
69 os3|sunos3)
70 $machine=sun3os3
71 $os=""
72 ;;
73 esac
74 ;;
75 sparc|sun4)
76 case $os in
77 os4|sunos4)
78 $machine=sun4os4
79 $os=""
80 ;;
81 esac
82 ;;
83 esac
84
85 paramfile=m-${machine}${os}.h
86 pinsnfile=${machine}${os}-pinsn.c
87 opcodefile=${machine}${os}-opcode.h
88 # Set up a define for purposes of editing the makefile.
89 makedefine=
90 if [ -r ${machine}${os}-dep.c ]
91 then
92 depfile=${machine}${os}-dep.c
93 else
94 depfile=default-dep.c
95 fi
96
97 #
98 # Special cases.
99 # If a file is not needed, set the file name to something.
100 # It must be linked to something, or else make will try to make it.
101 # /dev/null will not work because on systems without symbolic links,
102 # it will complain that /dev/null is on a different file system.
103 #
104 case $machine in
105 altos)
106 makedefine="-DM_REGEX=regex.o -DM_SYSV -DM_BSD_NM"
107 pinsnfile=m68k-pinsn.c
108 opcodefile=m68k-opcode.h
109 ;;
110 altosgas)
111 echo "Use of the coff encapsulation features require the GNU binutils utilities"
112 echo "To be ahead of their System V counterparts in your path."
113 makedefine="-DM_REGEX=regex.o -DM_SYSV -DM_BSD_NM"
114 pinsnfile=m68k-pinsn.c
115 depfile=altos-dep.c
116 opcodefile=m68k-opcode.h
117 ;;
118 vax)
119 echo
120 echo "/bin/cc has been known to fail on readline.c on VAXen running BSD4.3"
121 echo "If this occurs, use gcc "
122 echo " (but see comments in Makefile.dist about compiling with gcc)."
123 echo
124 pinsnfile=vax-pinsn.c
125 opcodefile=vax-opcode.h
126 ;;
127 hp9k320)
128 # The headers in the directory hp-include override system headers
129 # and tell GDB to use BSD executable file format (hence -Ihp-include)
130 makedefine="-DM_SYSV -DM_BSD_NM -DM_REGEX=regex.o
131 -DM_ALLOCA=alloca.o -DM_CFLAGS=-Ihp-include"
132 # The following is true because gcc uses a different .o file format
133 # than the native HPUX compiler
134 echo
135 echo "If you compile GDB with GCC on HPUX, you must make sure"
136 echo "that the \`nm' used in \`munch' is GNU nm"
137 echo
138 pinsnfile=m68k-pinsn.c
139 opcodefile=m68k-opcode.h
140 ;;
141 hp300bsd)
142 # Not sure what makefile editing (if any) is necessary for this machine.
143 pinsnfile=m68k-pinsn.c
144 opcodefile=m68k-opcode.h
145 ;;
146 isi)
147 # ISI running bsd4.2
148 pinsnfile=m68k-pinsn.c
149 opcodefile=m68k-opcode.h
150 ;;
151 i386)
152 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
153 # The following is a lie, but a necessary one. See comment at beginning
154 # of this file about unneeded files.
155 opcodefile=m-i386.h
156 ;;
157 i386gas)
158 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
159 echo
160 echo "Use of the coff encapsulation features requires the GNU binary utilities"
161 echo "to be ahead of their System V counterparts in your path."
162 echo
163 pinsnfile=i386-pinsn.c
164 depfile=i386-dep.c
165 # The following is a lie, but a necessary one. See comment at beginning
166 # of this file about unneeded files.
167 opcodefile=m-i386.h
168 ;;
169 i386-sysv3.2)
170 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
171 pinsnfile=i386-pinsn.c
172 depfile=i386-dep.c
173 opcodefile=/dev/null
174 ;;
175 i386gas-sysv3.2)
176 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
177 echo
178 echo "Use of the coff encapsulation features requires the GNU binary utilities"
179 echo "to be ahead of their System V counterparts in your path."
180 echo
181 pinsnfile=i386-pinsn.c
182 depfile=i386-dep.c
183 opcodefile=/dev/null
184 ;;
185 merlin)
186 pinsnfile=ns32k-pinsn.c
187 opcodefile=ns32k-opcode.h
188 ;;
189 news)
190 pinsnfile=m68k-pinsn.c
191 opcodefile=m68k-opcode.h
192 ;;
193 newsos3)
194 pinsnfile=m68k-pinsn.c
195 opcodefile=m68k-opcode.h
196 depfile=news-dep.c
197 ;;
198 npl)
199 pinsnfile=gld-pinsn.c
200 ;;
201 pn)
202 pinsnfile=gld-pinsn.c
203 ;;
204 sun2)
205 depfile=sun3-dep.c
206 pinsnfile=m68k-pinsn.c
207 opcodefile=m68k-opcode.h
208 ;;
209 sun2os2|sun2-os2)
210 depfile=default-dep.c
211 paramfile=m-sun2.h
212 pinsnfile=m68k-pinsn.c
213 opcodefile=m68k-opcode.h
214 ;;
215 sun2os4|sun2-os4)
216 # Compile GDB without shared libraries so that it can be run on itself.
217 makedefine=-DM_CFLAGS=-Bstatic
218 echo
219 echo "Make sure to compile any program on which you want to run gdb"
220 echo " without shared libraries (cc -Bstatic)"
221 echo
222 paramfile=m-sun2os4.h
223 depfile=sun3-dep.c
224 pinsnfile=m68k-pinsn.c
225 opcodefile=m68k-opcode.h
226 ;;
227 sun3os3)
228 paramfile=m-sun3.h
229 depfile=sun3-dep.c
230 pinsnfile=m68k-pinsn.c
231 opcodefile=m68k-opcode.h
232 ;;
233 sun3os4|sun3-os4)
234 # Compile GDB without shared libraries so that it can be run on itself.
235 makedefine=-DM_CFLAGS=-Bstatic
236 echo
237 echo "Make sure to compile any program on which you want to run gdb"
238 echo " without shared libraries (cc -Bstatic)"
239 echo
240 paramfile=m-sun3os4.h
241 pinsnfile=m68k-pinsn.c
242 opcodefile=m68k-opcode.h
243 depfile=sun3-dep.c
244 ;;
245 sun4os4|sun4-os4)
246 # Compile GDB without shared libraries so that it can be run on itself.
247 # Undefine sparc to avoid changing sparc-dep.c to 1-dep.c
248 makedefine="-DM_CFLAGS=-Bstatic -Usparc"
249 echo
250 echo "Make sure to compile any program on which you want to run gdb"
251 echo " without shared libraries (cc -Bstatic)"
252 echo
253 paramfile=m-sun4os4.h
254 pinsnfile=sparc-pinsn.c
255 opcodefile=sparc-opcode.h
256 depfile=sparc-dep.c
257 ;;
258 symmetry)
259 pinsnfile=i386-pinsn.c
260 # Need *some* opcode file to keep make from trying to make opcode.h
261 opcodefile=/dev/null
262 ;;
263 umax)
264 pinsnfile=ns32k-pinsn.c
265 opcodefile=ns32k-opcode.h
266 ;;
267 sparc|sun4|sun4os3|sun4-os3)
268 paramfile=m-sparc.h
269 # Undefine sparc to avoid changing sparc-dep.c to 1-dep.c
270 makedefine=-Usparc
271 pinsnfile=sparc-pinsn.c
272 opcodefile=sparc-opcode.h
273 depfile=sparc-dep.c
274 ;;
275 convex)
276 ;;
277 test)
278 paramfile=one
279 pinsnfile=three
280 opcodefile=four
281 ;;
282 *)
283 echo "Unknown machine type: \`$machine'"
284 echo "Available types:"
285 echo m-*.h | sed 's/m-//g' | sed 's/\.h//g'
286 exit 1
287 ;;
288 esac
289
290 files="$paramfile $pinsnfile $opcodefile $depfile"
291 links="param.h pinsn.c opcode.h dep.c"
292
293 rm -f config.status
294 while [ -n "$files" ]
295 do
296 # set file to car of files, files to cdr of files
297 set $files; file=$1; shift; files=$*
298 set $links; link=$1; shift; links=$*
299
300 if [ "$file" != skip ]
301 then
302 if [ ! -r $file ]
303 then
304 echo "$progname: cannot create a link \`$link',"
305 echo "since the file \`$file' does not exist."
306 exit 1
307 fi
308
309 echo "Linking \`$link' to \`$file'."
310 rm -f $link
311 # Make a symlink if possible, otherwise try a hard link
312 ln -s $file $link 2>/dev/null || ln $file $link
313
314 if [ ! -r $link ]
315 then
316 echo "$progname: unable to link \`$link' to \`$file'."
317 exit 1
318 fi
319 fi
320 done
321
322 # edit the makefile
323 echo "Editing Makefile"
324 cp Makefile.dist tmp.c
325 cc -E >Makefile tmp.c $makedefine -DM_MAKEDEFINE="$makedefine"
326 rm -f tmp.c
327
328 echo "GDB is now set up for use with a $machine." \
329 | tee config.status
330 exit 0
331
This page took 0.036695 seconds and 4 git commands to generate.