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