gdb-3.5
[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 *)
74 # Arguably, the default should be sun3os4, but in that case we'd want
75 # to change the list of machine types given by "config.gdb" so it
76 # doesn't list "sun3 sun3os4".
77 machine=sun3os3
78 os=""
79 ;;
80 esac
81 ;;
82 sparc|sun4)
83 case $os in
84 os4|sunos4)
85 machine=sun4os4
86 os=""
87 ;;
88 *)
89 # Arguably, the default should be sun4os4, but in that case we'd want
90 # to change the list of machine types given by "config.gdb" so it
91 # doesn't list "sun4 sun4os4".
92 machine=sun4os3
93 os=""
94 ;;
95 esac
96 ;;
97 # GCC accepts sequent-i386 or symmetry, so be consistent.
98 sequent-i386)
99 machine=symmetry
100 os=""
101 ;;
102 esac
103
104 paramfile=m-${machine}${os}.h
105 pinsnfile=${machine}${os}-pinsn.c
106 opcodefile=${machine}${os}-opcode.h
107 # Set up a define for purposes of editing the makefile.
108 makedefine=
109 if [ -r ${machine}${os}-dep.c ]
110 then
111 depfile=${machine}${os}-dep.c
112 else
113 depfile=default-dep.c
114 fi
115
116 #
117 # Special cases.
118 # If a file is not needed, set the file name to something.
119 # It must be linked to something, or else make will try to make it.
120 # /dev/null will not work because on systems without symbolic links,
121 # it will complain that /dev/null is on a different file system.
122 #
123 case $machine in
124 altos)
125 makedefine="-DM_REGEX=regex.o -DM_SYSV -DM_BSD_NM"
126 pinsnfile=m68k-pinsn.c
127 opcodefile=m68k-opcode.h
128 ;;
129 altosgas)
130 echo "Use of the coff encapsulation features require the GNU binutils utilities"
131 echo "To be ahead of their System V counterparts in your path."
132 makedefine="-DM_REGEX=regex.o -DM_SYSV -DM_BSD_NM"
133 pinsnfile=m68k-pinsn.c
134 depfile=altos-dep.c
135 opcodefile=m68k-opcode.h
136 ;;
137 pyramid)
138 echo
139 echo "Note that GDB on Pyramids only works with GCC."
140 echo
141 ;;
142 vax)
143 echo
144 # The following types of /bin/cc failures have been observed:
145 # 1. Something in readline.c which I have never seen
146 # 2. ``"values.c", line 816: compiler error: schain botch''
147 echo "/bin/cc has been known to fail on VAXen running BSD4.3"
148 echo "If this occurs, use gcc "
149 echo " (but see comments in Makefile.dist about compiling with gcc)."
150 echo
151 pinsnfile=vax-pinsn.c
152 opcodefile=vax-opcode.h
153 ;;
154 hp9k320)
155 # The headers in the directory hp-include override system headers
156 # and tell GDB to use BSD executable file format (hence -Ihp-include)
157 makedefine="-DM_SYSV -DM_BSD_NM -DM_REGEX=regex.o
158 -DM_ALLOCA=alloca.o -DM_CFLAGS=-Ihp-include"
159 # The following is true because gcc uses a different .o file format
160 # than the native HPUX compiler
161 echo
162 echo "If you compile GDB with GCC on HPUX, you must make sure"
163 echo "that the \`nm' used in \`munch' is GNU nm"
164 echo
165 pinsnfile=m68k-pinsn.c
166 opcodefile=m68k-opcode.h
167 ;;
168 hp300bsd)
169 pinsnfile=m68k-pinsn.c
170 opcodefile=m68k-opcode.h
171 ;;
172 isi)
173 # ISI running bsd4.2
174 pinsnfile=m68k-pinsn.c
175 opcodefile=m68k-opcode.h
176 ;;
177 i386)
178 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
179 # The following is a lie, but a necessary one. See comment at beginning
180 # of this file about unneeded files.
181 opcodefile=m-i386.h
182 ;;
183 i386gas)
184 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
185 echo
186 echo "Use of the coff encapsulation features requires the GNU binary utilities"
187 echo "to be ahead of their System V counterparts in your path."
188 echo
189 pinsnfile=i386-pinsn.c
190 depfile=i386-dep.c
191 # The following is a lie, but a necessary one. See comment at beginning
192 # of this file about unneeded files.
193 opcodefile=m-i386.h
194 ;;
195 # These names are short and cryptic due to the @#$#!@#$@! System V
196 # 14 character file name limit.
197 i386-sv32)
198 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
199 pinsnfile=i386-pinsn.c
200 depfile=i386-dep.c
201 # The following is a lie, but a necessary one. See comment at beginning
202 # of this file about unneeded files.
203 opcodefile=m-i386.h
204 ;;
205 i386g-sv32)
206 makedefine="-DM_CLIBS=-lPW -DM_SYSV -DM_REGEX=regex.o"
207 echo
208 echo "Use of the coff encapsulation features requires the GNU binary utilities"
209 echo "to be ahead of their System V counterparts in your path."
210 echo
211 pinsnfile=i386-pinsn.c
212 depfile=i386-dep.c
213 # The following is a lie, but a necessary one. See comment at beginning
214 # of this file about unneeded files.
215 opcodefile=m-i386.h
216 ;;
217 merlin)
218 echo ""
219 echo "To install GDB on this machine you must copy /bin/sh"
220 echo "to /usr/local/lib/gdb-sh, and make it world readable"
221 echo "and writeable. For example:"
222 echo " cp /bin/sh /usr/local/lib/gdb-sh"
223 echo " chmod ogu+rw /usr/local/lib/gdb-sh"
224 echo "If you want to put it somewhere other than /usr/local/lib,"
225 echo "edit the definition of SHELL_FILE in m-merlin.h"
226 echo ""
227 pinsnfile=ns32k-pinsn.c
228 opcodefile=ns32k-opcode.h
229 ;;
230 news)
231 pinsnfile=m68k-pinsn.c
232 opcodefile=m68k-opcode.h
233 ;;
234 newsos3)
235 pinsnfile=m68k-pinsn.c
236 opcodefile=m68k-opcode.h
237 depfile=news-dep.c
238 ;;
239 npl)
240 pinsnfile=gld-pinsn.c
241 ;;
242 pn)
243 pinsnfile=gld-pinsn.c
244 ;;
245 sun2)
246 depfile=sun3-dep.c
247 pinsnfile=m68k-pinsn.c
248 opcodefile=m68k-opcode.h
249 ;;
250 sun2os2|sun2-os2)
251 depfile=default-dep.c
252 paramfile=m-sun2.h
253 pinsnfile=m68k-pinsn.c
254 opcodefile=m68k-opcode.h
255 ;;
256 sun2os4|sun2-os4)
257 # Compile GDB without shared libraries so that it can be run on itself.
258 # -Bstatic is the right flag for cc.
259 # For gcc, -Bstatic is (probably) a no-op, and -g (which is specified by
260 # Makefile.dist prevents use of shared libraries).
261 makedefine=-DM_CFLAGS=-Bstatic
262 echo
263 echo "Make sure to compile any program on which you want to run gdb"
264 echo " without shared libraries (cc -Bstatic)"
265 echo
266 paramfile=m-sun2os4.h
267 depfile=sun3-dep.c
268 pinsnfile=m68k-pinsn.c
269 opcodefile=m68k-opcode.h
270 ;;
271 sun3os3)
272 paramfile=m-sun3.h
273 depfile=sun3-dep.c
274 pinsnfile=m68k-pinsn.c
275 opcodefile=m68k-opcode.h
276 ;;
277 sun3os4|sun3-os4)
278 # Compile GDB without shared libraries so that it can be run on itself.
279 makedefine=-DM_CFLAGS=-Bstatic
280 echo
281 echo "Make sure to compile any program on which you want to run gdb"
282 echo " without shared libraries (cc -Bstatic)"
283 echo
284 paramfile=m-sun3os4.h
285 pinsnfile=m68k-pinsn.c
286 opcodefile=m68k-opcode.h
287 depfile=sun3-dep.c
288 ;;
289 sun4os4|sun4-os4)
290 # Compile GDB without shared libraries so that it can be run on itself.
291 # Undefine sparc to avoid changing sparc-dep.c to 1-dep.c
292 makedefine="-DM_CFLAGS=-Bstatic -Usparc"
293 echo
294 echo "Make sure to compile any program on which you want to run gdb"
295 echo " without shared libraries (cc -Bstatic)"
296 echo
297 paramfile=m-sun4os4.h
298 pinsnfile=sparc-pinsn.c
299 opcodefile=sparc-opcode.h
300 depfile=sparc-dep.c
301 ;;
302 symmetry)
303 paramfile=m-symmetry.h
304 depfile=symmetry-dep.c
305 pinsnfile=i386-pinsn.c
306 # The following is a lie, but a necessary one. See comment at beginning
307 # of this file about unneeded files.
308 opcodefile=m-i386.h
309 ;;
310 umax)
311 pinsnfile=ns32k-pinsn.c
312 opcodefile=ns32k-opcode.h
313 ;;
314 sparc|sun4|sun4os3|sun4-os3)
315 paramfile=m-sparc.h
316 # Undefine sparc to avoid changing sparc-dep.c to 1-dep.c
317 makedefine=-Usparc
318 pinsnfile=sparc-pinsn.c
319 opcodefile=sparc-opcode.h
320 depfile=sparc-dep.c
321 ;;
322 convex)
323 ;;
324 test)
325 paramfile=one
326 pinsnfile=three
327 opcodefile=four
328 ;;
329 *)
330 echo "Unknown machine type: \`$machine'"
331 echo "Available types:"
332 echo m-*.h | sed 's/m-//g' | sed 's/\.h//g'
333 exit 1
334 ;;
335 esac
336
337 files="$paramfile $pinsnfile $opcodefile $depfile"
338 links="param.h pinsn.c opcode.h dep.c"
339
340 rm -f config.status
341 while [ -n "$files" ]
342 do
343 # set file to car of files, files to cdr of files
344 set $files; file=$1; shift; files=$*
345 set $links; link=$1; shift; links=$*
346
347 if [ "$file" != skip ]
348 then
349 if [ ! -r $file ]
350 then
351 echo "$progname: cannot create a link \`$link',"
352 echo "since the file \`$file' does not exist."
353 exit 1
354 fi
355
356 echo "Linking \`$link' to \`$file'."
357 rm -f $link
358 # Make a symlink if possible, otherwise try a hard link
359 ln -s $file $link 2>/dev/null || ln $file $link
360
361 if [ ! -r $link ]
362 then
363 echo "$progname: unable to link \`$link' to \`$file'."
364 exit 1
365 fi
366 fi
367 done
368
369 # edit the makefile
370 echo "Editing Makefile"
371 cp Makefile.dist tmp.c
372 cc -E >Makefile tmp.c $makedefine -DM_MAKEDEFINE="$makedefine"
373 rm -f tmp.c
374
375 echo "GDB is now set up for use with a $machine." \
376 | tee config.status
377 exit 0
378
This page took 0.074654 seconds and 4 git commands to generate.