]> gcc.gnu.org Git - gcc.git/blob - mpw-configure
regmove.c: Fix various minor formatting problems.
[gcc.git] / mpw-configure
1 # Configuration script
2 # Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 ### WARNING
19 ### This script must NOT use any 8-bit chars!
20 ### WARNING
21
22 # This is an MPW Shell script that sets everything up for compilation,
23 # mainly creating directories, and editing copies of files.
24
25 Set savedir "`Directory`"
26
27 #Set Echo 1
28
29 Set ThisScript "{0}"
30
31 Set srcroot "--------"
32
33 Set srcdir ":"
34
35 Set objdir ":"
36
37 Set prefix "{MPW}":GNUTools:
38
39 Set exec_prefix ""
40
41 Set bindir ""
42
43 Set host_alias "m68k-apple-mpw"
44
45 Set target_alias {host_alias}
46
47 Set host_cc "mpwc"
48
49 Set with_gnu_ld 0
50
51 Set helpoutput 0
52
53 Set recurse 1
54
55 Set verify 0
56 Set verifystr ""
57
58 Set enable_options ""
59 Set disable_options ""
60
61 # Parse arguments.
62
63 Loop
64 Break If {#} == 0
65 If "{1}" =~ /--cc/
66 Set host_cc "{2}"
67 Shift 1
68 Else If "{1}" =~ /--bindir/
69 Set bindir "{2}"
70 Shift 1
71 Else If "{1}" =~ /--disable-?+/
72 Set `Echo {1} | sed -e 's/--disable-/enable_/'` no
73 Set disable_options "{disable_options} '{1}'"
74 Else If "{1}" =~ /--enable-?+/
75 Set `Echo {1} | sed -e 's/--enable-/enable_/'` yes
76 Set enable_options "{enable_options} '{1}'"
77 Else If "{1}" =~ /--exec-prefix/
78 Set exec_prefix "{2}"
79 Shift 1
80 Else If "{1}" =~ /--help/
81 Set helpoutput 1
82 Else If "{1}" =~ /--host/
83 Set host_alias "{2}"
84 Shift 1
85 Else If "{1}" =~ /--norecursion/
86 Set recurse 0
87 Else If "{1}" =~ /--prefix/
88 Set prefix "{2}"
89 Shift 1
90 Else If "{1}" =~ /--srcdir/
91 Set srcdir "{2}"
92 Shift 1
93 Else If "{1}" =~ /--srcroot/
94 Set srcroot "{2}"
95 Shift 1
96 Else If "{1}" =~ /--target/
97 Set target_alias "{2}"
98 Shift 1
99 Else If "{1}" =~ /-v/
100 Set verify 1
101 Set verifystr "-v"
102 Else If "{1}" =~ /--with-gnu-ld/
103 Set with_gnu_ld 1
104 Else
105 Echo -n 'mpw-configure: Unrecognized option: "'
106 Echo -n "{1}"
107 Echo '"; use --help for usage.'
108 Exit 1
109 End If
110 Shift 1
111 End Loop
112
113 If {helpoutput} == 1
114 Echo "Usage: mpw-configure [OPTIONS]"
115 Echo ""
116 Echo "Options: [defaults in brackets]"
117 Echo "--bindir DIR directory for binaries []"
118 Echo "--cc CC use C compiler CC [mpwc]"
119 Echo "--disable-FOO do not include feature FOO"
120 Echo "--enable-FOO include feature FOO"
121 Echo "--exec-prefix DIR install host-dependent files into DIR []"
122 Echo "--help print this message"
123 Echo "--host HOST configure for HOST [m68k-apple-mpw]"
124 Echo "--norecursion configure this directory only [recurse]"
125 Echo "--prefix DIR install into DIR [{MPW}:GNUTools:]"
126 Echo "--srcdir DIR find the sources in DIR [:]"
127 Echo "--srcroot DIR find the toplevel sources in DIR [:]"
128 Echo "--target TARGET configure for TARGET [TARGET=HOST]"
129 Echo "-v verbose"
130 Echo "--with-gnu-ld link using GNU ld [no]"
131 Exit 0
132 End If
133
134 Set Exit 0
135
136 # Default exec_prefix from prefix.
137
138 If "{exec_prefix}" == ""
139 Set exec_prefix "{prefix}"
140 End If
141
142 If "{bindir}" == ""
143 Set bindir "{prefix}"bin:
144 End If
145
146 # Point to the correct set of tools to use with the chosen compiler.
147
148 If "{host_cc}" =~ /mpwc/
149 Set host_alias "m68k-apple-mpw"
150 Set cc_name '{CC_MPW_C}'
151 Set segment_flag '-s '
152 Set ar_name '{AR_LIB}'
153 Set ranlib_name '{RANLIB_NULL}'
154 Set cc_ld_name '{CC_LD_LINK}'
155 Set prog_ext_name '{PROG_EXT_68K}'
156 Set extralibs_name '{EXTRALIBS_C}'
157 Set makepef_name '{MAKEPEF_NULL}'
158 Set rez_name '{REZ_68K}'
159 Else If "{host_cc}" =~ /sc68k/
160 Set host_alias "m68k-apple-mpw"
161 Set cc_name '{CC_SC}'
162 Set segment_flag '-s '
163 Set ar_name '{AR_LIB}'
164 Set ranlib_name '{RANLIB_NULL}'
165 Set cc_ld_name '{CC_LD_LINK}'
166 Set prog_ext_name '{PROG_EXT_68K}'
167 Set extralibs_name '{EXTRALIBS_C}'
168 Set makepef_name '{MAKEPEF_NULL}'
169 Set rez_name '{REZ_68K}'
170 Else If "{host_cc}" =~ /mwc68k/
171 Set host_alias "m68k-apple-mpw"
172 Set cc_name '{CC_MWC68K}'
173 Set segment_flag '-s '
174 Set ar_name '{AR_MWLINK68K}'
175 Set ranlib_name '{RANLIB_NULL}'
176 Set cc_ld_name '{CC_LD_MWLINK68K}'
177 Set prog_ext_name '{PROG_EXT_68K}'
178 Set extralibs_name '{EXTRALIBS_MWC68K}'
179 Set makepef_name '{MAKEPEF_NULL}'
180 Set rez_name '{REZ_68K}'
181 Else If "{host_cc}" =~ /gcc68k/
182 Set host_alias "m68k-apple-mpw"
183 Set cc_name '{CC_68K_GCC}'
184 Set segment_flag '-s '
185 Set ar_name '{AR_68K_AR}'
186 Set ranlib_name '{RANLIB_RANLIB}'
187 Set cc_ld_name '{CC_68K_GCC}'
188 Set prog_ext_name '{PROG_EXT_68K}'
189 Set extralibs_name '{EXTRALIBS_C}'
190 Set makepef_name '{MAKEPEF_NULL}'
191 Set rez_name '{REZ_68K}'
192 Else If "{host_cc}" =~ /ppcc/
193 Set host_alias "powerpc-apple-mpw"
194 Set cc_name '{CC_PPCC}'
195 Set segment_flag '-d ___s_e_g___='
196 Set ar_name '{AR_PPCLINK}'
197 Set ranlib_name '{RANLIB_NULL}'
198 Set cc_ld_name '{CC_LD_PPCLINK}'
199 Set prog_ext_name '{PROG_EXT_XCOFF}'
200 Set extralibs_name '{EXTRALIBS_PPC}'
201 Set makepef_name '{MAKEPEF_PPC}'
202 Set rez_name '{REZ_PPC}'
203 Else If "{host_cc}" =~ /mrc/
204 Set host_alias "powerpc-apple-mpw"
205 Set cc_name '{CC_MRC}'
206 Set segment_flag '-d ___s_e_g___='
207 Set ar_name '{AR_PPCLINK}'
208 Set ranlib_name '{RANLIB_NULL}'
209 Set cc_ld_name '{CC_LD_PPCLINK}'
210 Set prog_ext_name '{PROG_EXT_XCOFF}'
211 Set extralibs_name '{EXTRALIBS_PPC}'
212 Set makepef_name '{MAKEPEF_PPC}'
213 Set rez_name '{REZ_PPC}'
214 Else If "{host_cc}" =~ /scppc/
215 Set host_alias "powerpc-apple-mpw"
216 Set cc_name '{CC_SC}'
217 Set segment_flag '-d ___s_e_g___='
218 Set ar_name '{AR_PPCLINK}'
219 Set ranlib_name '{RANLIB_NULL}'
220 Set cc_ld_name '{CC_LD_PPCLINK}'
221 Set prog_ext_name '{PROG_EXT_XCOFF}'
222 Set extralibs_name '{EXTRALIBS_PPC}'
223 Set makepef_name '{MAKEPEF_PPC}'
224 Set rez_name '{REZ_PPC}'
225 Else If "{host_cc}" =~ /mwcppc/
226 Set host_alias "powerpc-apple-mpw"
227 Set cc_name '{CC_MWCPPC}'
228 Set segment_flag '-d ___s_e_g___='
229 Set ar_name '{AR_MWLINKPPC}'
230 Set ranlib_name '{RANLIB_NULL}'
231 Set cc_ld_name '{CC_LD_MWLINKPPC}'
232 # Misleading, but we don't need a PEF step.
233 Set prog_ext_name '{PROG_EXT_68K}'
234 Set extralibs_name '{EXTRALIBS_MWCPPC}'
235 Set makepef_name '{MAKEPEF_NULL}'
236 Set rez_name '{REZ_PPC}'
237 Else If "{host_cc}" =~ /gccppc/
238 Set host_alias "powerpc-apple-mpw"
239 Set cc_name '{CC_PPC_GCC}'
240 Set segment_flag '-d ___s_e_g___='
241 Set ar_name '{AR_PPCLINK}'
242 If {with_gnu_ld} == 1
243 Set ranlib_name '{RANLIB_RANLIB}'
244 Set cc_ld_name '{CC_LD_GLD}'
245 Else
246 Set ranlib_name '{RANLIB_NULL}'
247 Set cc_ld_name '{CC_LD_PPCLINK}'
248 End If
249 Set prog_ext_name '{PROG_EXT_XCOFF}'
250 Set extralibs_name '{EXTRALIBS_PPC}'
251 Set makepef_name '{MAKEPEF_PPC}'
252 Set rez_name '{REZ_PPC}'
253 Else
254 Echo "{host_cc}" is not a known MPW compiler type
255 End If
256
257 Set dash_c_flag ''
258 If "{host_cc}" =~ /gcc68k/
259 Set dash_c_flag '-c'
260 Else If "{host_cc}" =~ /gccppc/
261 Set dash_c_flag '-c'
262 End If
263
264 # (should interpret aliases if not in canonical form)
265
266 Set host_canonical "{host_alias}"
267
268 Set target_canonical "{target_alias}"
269
270 Set configdirs ""
271
272 If "{srcroot}" =~ /--------/
273 Set srcroot "{srcdir}"
274 End If
275 If "`Exists "{srcdir}"`" == ""
276 Echo Source directory {srcdir} does not exist!
277 Exit 1
278 End If
279 If "`Exists "{srcroot}"`" == ""
280 Echo Top-level source directory {srcroot} does not exist!
281 Exit 1
282 End If
283
284 Set target_cpu "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`"
285 Set target_vendor "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`"
286 Set target_os "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`"
287
288 # Create a file that is guaranteed to be older than any other here.
289
290 If "`Exists "{objdir}"_oldest`" == ""
291 mpw-touch _oldest
292 End If
293
294 # Record this before creating any files, makefiles sometimes mention
295 # dependencies on config.status.
296
297 Echo "# This directory was configured as follows:" >config.new
298 Echo "{ThisScript} --host {host_alias} --target {target_alias} --srcdir {srcdir} --srcroot {srcroot} --prefix {prefix} --cc {host_cc} {verifystr} {enable_options} {disable_options} --norecursion" >>config.new
299 MoveIfChange config.new config.status
300
301 If "`Exists "{srcdir}"mpw-config.in`" != ""
302 tr-7to8 "{srcdir}"mpw-config.in >"{objdir}"mpw-config.in
303 Execute "{objdir}"mpw-config.in
304 End If
305
306 # Start Makefile construction by defining all the variables chosen by
307 # configuration.
308
309 Echo "# This Makefile produced by mpw-configure. Changes may get lost!" > "{objdir}"Makefile.tem
310 Echo "srcroot = " {srcroot} >> "{objdir}"Makefile.tem
311 Echo "topsrcdir = " {srcroot} >> "{objdir}"Makefile.tem
312 Echo "srcdir = " {srcdir} >> "{objdir}"Makefile.tem
313 Echo "mpw_prefix = " {prefix} >> "{objdir}"Makefile.tem
314 Echo "mpw_exec_prefix = " {exec_prefix} >> "{objdir}"Makefile.tem
315 Echo "mpw_bindir = " {bindir} >> "{objdir}"Makefile.tem
316 Echo "host_alias = " {host_alias} >> "{objdir}"Makefile.tem
317 Echo "target_alias = " {target_alias} >> "{objdir}"Makefile.tem
318 Echo "target_cpu = " {target_cpu} >> "{objdir}"Makefile.tem
319 Echo "target_vendor = " {target_vendor} >> "{objdir}"Makefile.tem
320 Echo "target_os = " {target_os} >> "{objdir}"Makefile.tem
321 Echo "target_canonical = " {target_canonical} >> "{objdir}"Makefile.tem
322 Echo "host_makefile_frag = " >> "{objdir}"Makefile.tem
323 Echo "target_makefile_frag = " >> "{objdir}"Makefile.tem
324 Echo "CC = " {cc_name} >> "{objdir}"Makefile.tem
325 Echo "AR = " {ar_name} >> "{objdir}"Makefile.tem
326 Echo "RANLIB = " {ranlib_name} >> "{objdir}"Makefile.tem
327 Echo "CC_LD = " {cc_ld_name} >> "{objdir}"Makefile.tem
328 Echo "PROG_EXT = " {prog_ext_name} >> "{objdir}"Makefile.tem
329 Echo "EXTRALIBS = " {extralibs_name} >> "{objdir}"Makefile.tem
330 Echo "MAKEPEF = " {makepef_name} >> "{objdir}"Makefile.tem
331 Echo "REZ = " {rez_name} >> "{objdir}"Makefile.tem
332
333 If {host_cc} =~ /gccppc/
334 Echo -n "dq =\Option-d\Option-d\Option-d" > "{objdir}"Makefile.tem0
335 Echo '"' >> "{objdir}"Makefile.tem0
336 tr-7to8 "{objdir}"Makefile.tem0 >>"{objdir}"Makefile.tem
337 Else
338 Echo -n "dq ='" >> "{objdir}"Makefile.tem
339 Echo -n '"' >> "{objdir}"Makefile.tem
340 Echo "'" >> "{objdir}"Makefile.tem
341 End If
342
343 # Append the master set of definitions for the various compilers.
344
345 If "`Exists "{srcdir}"config:mpw-mh-mpw`" != ""
346 tr-7to8 "{srcdir}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
347 Else If "`Exists "{srcroot}"config:mpw-mh-mpw`" != ""
348 tr-7to8 "{srcroot}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
349 Else
350 Echo "can't find a host config file!"
351 Exit 0
352 End If
353
354 # Append anything produced by the directory's mpw-config.in.
355
356 If "`Exists "{objdir}"mk.tmp`" != ""
357 Catenate "{objdir}"mk.tmp >>"{objdir}"Makefile.tem
358 # An mpw-config.in might change so as not to create this
359 # anymore, so get rid of it now to be safe.
360 Delete -i -y "{objdir}"mk.tmp
361 End If
362
363 # If there are sed scripts to edit the Unix Makefile.in, use them; otherwise
364 # use an mpw-make.in if present.
365
366 If "`Exists "{srcdir}"mpw-make.sed`" != ""
367 If "`Exists "{objdir}"hacked_Makefile.in`" != ""
368 Set MakefileIn "{objdir}"hacked_Makefile.in
369 Else
370 Set MakefileIn "{srcdir}"Makefile.in
371 End If
372 # Find the generic makefile editing script.
373 If "`Exists "{srcroot}"config:mpw:g-mpw-make.sed`" != ""
374 sed -f "{srcroot}"config:mpw:g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1
375 Else If "`Exists "{srcroot}"utils:mpw:g-mpw-make.sed`" != ""
376 sed -f "{srcroot}"utils:mpw:g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1
377 Else If "`Exists "{srcdir}"g-mpw-make.sed`" != ""
378 sed -f "{srcdir}"g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1
379 Else
380 Echo Warning: g-mpw-make.sed not found, copying "{MakefileIn}" verbatim...
381 Catenate "{MakefileIn}" >"{objdir}"Makefile.tem1
382 End If
383 sed -f "{srcdir}"mpw-make.sed "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
384 sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' -e 's/^exec_prefix = .*$/exec_prefix = {mpw_exec_prefix}/g' -e 's/^bindir = @bindir@/bindir = {mpw_bindir}/g' "{objdir}"Makefile.tem2 >"{objdir}"Makefile.tem3
385 sed -e "s/@DASH_C_FLAG@/{dash_c_flag}/" -e "s/@SEGMENT_FLAG(\([^)]*\))@/{segment_flag}\1/" "{objdir}"Makefile.tem3 >"{objdir}"mpw-make.in
386 tr-7to8 "{objdir}"mpw-make.in >>"{objdir}"Makefile.tem
387 If "`Exists "{objdir}"mk.sed`" != ""
388 sed -f "{objdir}"mk.sed "{objdir}"Makefile.tem >"{objdir}"Makefile.tem2
389 Rename -y "{objdir}"Makefile.tem2 "{objdir}"Makefile.tem
390 End If
391 MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
392 Delete -i -y "{objdir}"Makefile.tem[12]
393 If {verify} == 1
394 Echo Created Makefile in "`Directory`"
395 End If
396 Else If "`Exists "{srcdir}"mpw-make.in`" != ""
397 sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' "{srcdir}"mpw-make.in >"{objdir}"Makefile.tem1
398 sed -e "s/@DASH_C_FLAG@/{dash_c_flag}/" -e "s/@SEGMENT_FLAG(\([^)]*\))@/{segment_flag}}\1/" "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
399 tr-7to8 "{objdir}"Makefile.tem2 >>"{objdir}"Makefile.tem
400 If "`Exists "{objdir}"mk.sed`" != ""
401 sed -f "{objdir}"mk.sed "{objdir}"Makefile.tem >"{objdir}"Makefile.tem2
402 Rename -y "{objdir}"Makefile.tem2 "{objdir}"Makefile.tem
403 End If
404 MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
405 Delete -i -y "{objdir}"Makefile.tem[12]
406 If {verify} == 1
407 Echo Created Makefile in "`Directory`"
408 End If
409 End If
410
411 # Produce a build script if the source is defined.
412
413 If "`Exists "{srcdir}"mpw-build.in`" != ""
414 Echo "Set srcroot " {srcroot} > "{objdir}"mpw-build.tem
415 Echo "Set srcdir " {srcdir} >> "{objdir}"mpw-build.tem
416 Echo "Set target_canonical " {target_canonical} >> "{objdir}"mpw-build.tem
417 Echo "Set prefix " {prefix} >> "{objdir}"mpw-build.tem
418 tr-7to8 "{srcdir}"mpw-build.in >>"{objdir}"mpw-build.tem
419 MoveIfChange "{objdir}"mpw-build.tem "{objdir}"mpw-build
420 If {verify} == 1
421 Echo Created mpw-build in "`Directory`"
422 End If
423 End If
424
425 # Apply ourselves recursively to the list of subdirectories to configure.
426
427 If {recurse} == 1
428 For subdir In {configdirs}
429 Set savedir "`Directory`"
430 If "`Exists "{srcdir}{subdir}:"`" == ""
431 If {verify} == 1
432 Echo No "{srcdir}{subdir}:" found, skipping
433 End If
434 Continue
435 End If
436 If {verify} == 1
437 Echo Configuring {subdir}...
438 End If
439 If "`Exists "{objdir}{subdir}:"`" == ""
440 NewFolder "{objdir}{subdir}"
441 End If
442 SetDirectory "{objdir}{subdir}:"
443 "{ThisScript}" --target "{target_canonical}" --srcdir "{srcdir}{subdir}:" --srcroot "{srcroot}" --prefix "{prefix}" --cc "{host_cc}" {verifystr} {enable_options} {disable_options}
444 SetDirectory "{savedir}"
445 End For
446 End If
447
448 SetDirectory "{savedir}"
This page took 0.054728 seconds and 5 git commands to generate.