Mon Apr 28 21:25:32 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
[deliverable/binutils-gdb.git] / mpw-configure
CommitLineData
5db7ecb7 1# Configuration script
a2e72689 2# Copyright (C) 1994, 1995 Free Software Foundation, Inc.
5db7ecb7 3
a2e72689
SS
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 (and mpw-config.in fragments) 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.
5db7ecb7
SS
24
25Set savedir "`Directory`"
26
27#Set Echo 1
28
aa8f28af 29Set ThisScript "{0}"
5db7ecb7
SS
30
31Set srcroot "--------"
32
33Set srcdir ":"
34
35Set objdir ":"
36
4ac27a60
SS
37Set prefix "{MPW}":GNUTools:
38
39Set exec_prefix ""
aa8f28af 40
a2e72689
SS
41Set host_alias "m68k-apple-mpw"
42
43Set target_alias {host_alias}
5db7ecb7 44
a2e72689 45Set host_cc "mpwc"
5db7ecb7 46
4ac27a60 47Set with_gnu_ld 0
aa8f28af 48
5db7ecb7
SS
49Set verify 0
50Set verifystr ""
51
52# Parse arguments.
53
54Loop
55 Break If {#} == 0
a2e72689
SS
56 If "{1}" =~ /--cc/
57 Set host_cc "{2}"
58 Shift 1
4ac27a60
SS
59 Else If "{1}" =~ /--enable/
60 Set "{2}" 1
61 Shift 1
62 Else If "{1}" =~ /--exec-prefix/
63 Set exec_prefix "{2}"
64 Shift 1
a2e72689
SS
65 Else If "{1}" =~ /--host/
66 Set host_alias "{2}"
67 Shift 1
68 Else If "{1}" =~ /--prefix/
5db7ecb7
SS
69 Set prefix "{2}"
70 Shift 1
71 Else If "{1}" =~ /--srcdir/
72 Set srcdir "{2}"
73 Shift 1
74 Else If "{1}" =~ /--srcroot/
75 Set srcroot "{2}"
76 Shift 1
77 Else If "{1}" =~ /--target/
a2e72689 78 Set target_alias "{2}"
5db7ecb7
SS
79 Shift 1
80 Else If "{1}" =~ /-v/
81 Set verify 1
82 Set verifystr "-v"
4ac27a60
SS
83 Else If "{1}" =~ /--with-gnu-ld/
84 Set with_gnu_ld 1
5db7ecb7
SS
85 Else
86 Echo "{1}" is not a valid argument
87 Exit 1
88 End If
89 Shift 1
90End Loop
91
92Set Exit 0
93
4ac27a60 94# Default exec_prefix from prefix.
5db7ecb7 95
4ac27a60
SS
96If "{exec_prefix}" == ""
97 Set exec_prefix "{prefix}"
98End If
a2e72689
SS
99
100# Point to the correct set of tools to use with the chosen compiler.
101
102If "{host_cc}" =~ /mpwc/
4ac27a60 103 Set host_alias "m68k-apple-mpw"
a2e72689
SS
104 Set cc_name '{CC_MPW_C}'
105 Set segment_flag '-s {Default}'
106 Set ar_name '{AR_LIB}'
107 Set ranlib_name '{RANLIB_NULL}'
108 Set cc_ld_name '{CC_LD_LINK}'
109 Set prog_ext_name '{PROG_EXT_68K}'
110 Set extralibs_name '{EXTRALIBS_C}'
111 Set makepef_name '{MAKEPEF_NULL}'
112 Set rez_name '{REZ_68K}'
113Else If "{host_cc}" =~ /sc68k/
4ac27a60 114 Set host_alias "m68k-apple-mpw"
a2e72689
SS
115 Set cc_name '{CC_SC}'
116 Set segment_flag '-s {Default}'
117 Set ar_name '{AR_LIB}'
118 Set ranlib_name '{RANLIB_NULL}'
119 Set cc_ld_name '{CC_LD_LINK}'
120 Set prog_ext_name '{PROG_EXT_68K}'
121 Set extralibs_name '{EXTRALIBS_C}'
122 Set makepef_name '{MAKEPEF_NULL}'
123 Set rez_name '{REZ_68K}'
124Else If "{host_cc}" =~ /mwc68k/
4ac27a60 125 Set host_alias "m68k-apple-mpw"
a2e72689
SS
126 Set cc_name '{CC_MWC68K}'
127 Set segment_flag '-s {Default}'
128 Set ar_name '{AR_MWLINK68K}'
129 Set ranlib_name '{RANLIB_NULL}'
130 Set cc_ld_name '{CC_LD_MWLINK68K}'
131 Set prog_ext_name '{PROG_EXT_68K}'
132 Set extralibs_name '{EXTRALIBS_C}'
133 Set makepef_name '{MAKEPEF_NULL}'
134 Set rez_name '{REZ_PPC}'
135Else If "{host_cc}" =~ /gcc68k/
4ac27a60 136 Set host_alias "m68k-apple-mpw"
a2e72689
SS
137 Set cc_name '{CC_68K_GCC}'
138 Set segment_flag '-s {Default}'
139 Set ar_name '{AR_68K_AR}'
140 Set ranlib_name '{RANLIB_RANLIB}'
141 Set cc_ld_name '{CC_68K_GCC}'
142 Set prog_ext_name '{PROG_EXT_68K}'
143 Set extralibs_name '{EXTRALIBS_C}'
144 Set makepef_name '{MAKEPEF_NULL}'
145 Set rez_name '{REZ_68K}'
146Else If "{host_cc}" =~ /ppcc/
4ac27a60 147 Set host_alias "powerpc-apple-mpw"
a2e72689
SS
148 Set cc_name '{CC_PPCC}'
149 Set segment_flag ''
150 Set ar_name '{AR_PPCLINK}'
151 Set ranlib_name '{RANLIB_NULL}'
152 Set cc_ld_name '{CC_LD_PPCLINK}'
153 Set prog_ext_name '{PROG_EXT_XCOFF}'
154 Set extralibs_name '{EXTRALIBS_PPC}'
155 Set makepef_name '{MAKEPEF_PPC}'
156 Set rez_name '{REZ_PPC}'
157Else If "{host_cc}" =~ /mrc/
4ac27a60 158 Set host_alias "powerpc-apple-mpw"
a2e72689
SS
159 Set cc_name '{CC_MRC}'
160 Set segment_flag ''
161 Set ar_name '{AR_PPCLINK}'
162 Set ranlib_name '{RANLIB_NULL}'
163 Set cc_ld_name '{CC_LD_PPCLINK}'
164 Set prog_ext_name '{PROG_EXT_XCOFF}'
165 Set extralibs_name '{EXTRALIBS_PPC}'
166 Set makepef_name '{MAKEPEF_PPC}'
167 Set rez_name '{REZ_PPC}'
168Else If "{host_cc}" =~ /scppc/
4ac27a60 169 Set host_alias "powerpc-apple-mpw"
a2e72689
SS
170 Set cc_name '{CC_SC}'
171 Set segment_flag ''
172 Set ar_name '{AR_PPCLINK}'
173 Set ranlib_name '{RANLIB_NULL}'
174 Set cc_ld_name '{CC_LD_PPCLINK}'
175 Set prog_ext_name '{PROG_EXT_XCOFF}'
176 Set extralibs_name '{EXTRALIBS_PPC}'
177 Set makepef_name '{MAKEPEF_PPC}'
178 Set rez_name '{REZ_PPC}'
179Else If "{host_cc}" =~ /mwcppc/
4ac27a60 180 Set host_alias "powerpc-apple-mpw"
a2e72689
SS
181 Set cc_name '{CC_MWCPPC}'
182 Set segment_flag ''
183 Set ar_name '{AR_MWLINKPPC}'
184 Set ranlib_name '{RANLIB_NULL}'
185 Set cc_ld_name '{CC_LD_MWLINKPPC}'
186 # Misleading, but we don't need a PEF step.
187 Set prog_ext_name '{PROG_EXT_68K}'
188 Set extralibs_name '{EXTRALIBS_MWCPPC}'
189 Set makepef_name '{MAKEPEF_NULL}'
190 Set rez_name '{REZ_PPC}'
191Else If "{host_cc}" =~ /gccppc/
4ac27a60 192 Set host_alias "powerpc-apple-mpw"
a2e72689
SS
193 Set cc_name '{CC_PPC_GCC}'
194 Set segment_flag ''
195 Set ar_name '{AR_PPCLINK}'
196 Set ranlib_name '{RANLIB_RANLIB}'
4ac27a60
SS
197 If {with_gnu_ld} == 1
198 Set cc_ld_name '{CC_LD_GLD}'
199 Else
200 Set cc_ld_name '{CC_LD_PPCLINK}'
201 End If
a2e72689
SS
202 Set prog_ext_name '{PROG_EXT_XCOFF}'
203 Set extralibs_name '{EXTRALIBS_PPC}'
204 Set makepef_name '{MAKEPEF_PPC}'
205 Set rez_name '{REZ_PPC}'
206Else
4ac27a60 207 Echo "{host_cc}" is not a known MPW compiler type
a2e72689 208End If
68c2f070 209
4ac27a60
SS
210# (should interpret aliases if not in canonical form)
211
212Set host_canonical "{host_alias}"
213
214Set target_canonical "{target_alias}"
215
5db7ecb7
SS
216Set configdirs ""
217
218If "{srcroot}" =~ /--------/
219 Set srcroot "{srcdir}"
220End If
221If "`Exists "{srcdir}"`" == ""
222 Echo Source directory {srcdir} does not exist!
223 Exit 1
224End If
225If "`Exists "{srcroot}"`" == ""
226 Echo Top-level source directory {srcroot} does not exist!
227 Exit 1
228End If
229
a2e72689
SS
230Set target_cpu "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`"
231Set target_vendor "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`"
232Set target_os "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`"
233
234# Create a file that is guaranteed to be older than any other here.
235
236If "`Exists "{objdir}"_oldest`" == ""
237 mpw-touch _oldest
238End If
239
240# Record this before creating any files, makefiles sometimes mention
241# dependencies on config.status.
242
243Echo "# This directory was configured as follows:" >config.new
244Echo "{ThisScript} --host {host_alias} --target {target_alias} --srcdir {srcdir} --srcroot {srcroot} --prefix {prefix} --cc {host_cc}" >>config.new
245MoveIfChange config.new config.status
246
5db7ecb7 247If "`Exists "{srcdir}"mpw-config.in`" != ""
a2e72689
SS
248 tr-7to8 "{srcdir}"mpw-config.in >"{objdir}"mpw-config.in
249 Execute "{objdir}"mpw-config.in
250End If
251
252# Start Makefile construction by defining all the variables chosen by
253# configuration.
254
255Echo "# This Makefile produced by mpw-configure. Changes may get lost!" > "{objdir}"Makefile.tem
256Echo "srcroot = " {srcroot} >> "{objdir}"Makefile.tem
257Echo "topsrcdir = " {srcroot} >> "{objdir}"Makefile.tem
258Echo "srcdir = " {srcdir} >> "{objdir}"Makefile.tem
259Echo "mpw_prefix = " {prefix} >> "{objdir}"Makefile.tem
4ac27a60 260Echo "mpw_exec_prefix = " {exec_prefix} >> "{objdir}"Makefile.tem
a2e72689
SS
261Echo "host_alias = " {host_alias} >> "{objdir}"Makefile.tem
262Echo "target_alias = " {target_alias} >> "{objdir}"Makefile.tem
263Echo "target_cpu = " {target_cpu} >> "{objdir}"Makefile.tem
264Echo "target_vendor = " {target_vendor} >> "{objdir}"Makefile.tem
265Echo "target_os = " {target_os} >> "{objdir}"Makefile.tem
266Echo "target_canonical = " {target_canonical} >> "{objdir}"Makefile.tem
267Echo "host_makefile_frag = " >> "{objdir}"Makefile.tem
268Echo "target_makefile_frag = " >> "{objdir}"Makefile.tem
269Echo "CC = " {cc_name} >> "{objdir}"Makefile.tem
270Echo "AR = " {ar_name} >> "{objdir}"Makefile.tem
271Echo "RANLIB = " {ranlib_name} >> "{objdir}"Makefile.tem
272Echo "CC_LD = " {cc_ld_name} >> "{objdir}"Makefile.tem
273Echo "PROG_EXT = " {prog_ext_name} >> "{objdir}"Makefile.tem
274Echo "EXTRALIBS = " {extralibs_name} >> "{objdir}"Makefile.tem
275Echo "MAKEPEF = " {makepef_name} >> "{objdir}"Makefile.tem
276Echo "REZ = " {rez_name} >> "{objdir}"Makefile.tem
277
278# Append the master set of definitions for the various compilers.
279
280If "`Exists "{srcdir}"config:mpw-mh-mpw`" != ""
281 tr-7to8 "{srcdir}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
282Else If "`Exists "{srcroot}"config:mpw-mh-mpw`" != ""
283 tr-7to8 "{srcroot}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
284Else
285 Echo "can't find a host config file!"
286 Exit 0
5db7ecb7 287End If
a2e72689
SS
288
289# Append anything produced by the directory's mpw-config.in.
290
291If "`Exists "{objdir}"mk.tmp`" != ""
292 Catenate "{objdir}"mk.tmp >>"{objdir}"Makefile.tem
293 # An mpw-config.in might change so as not to create this
294 # anymore, so get rid of it now to be safe.
295 Delete -i -y "{objdir}"mk.tmp
5db7ecb7
SS
296End If
297
4ac27a60 298# If there are sed scripts to edit the Unix Makefile.in, use them; otherwise
a2e72689
SS
299# use an mpw-make.in if present.
300
301If "`Exists "{srcdir}"mpw-make.sed`" != ""
4ac27a60
SS
302 If "`Exists "{objdir}"hacked_Makefile.in`" != ""
303 Set MakefileIn "{objdir}"hacked_Makefile.in
304 Else
305 Set MakefileIn "{srcdir}"Makefile.in
306 End If
307 If "`Exists "{srcroot}"utils:mpw:g-mpw-make.sed`" != ""
308 sed -f "{srcroot}"utils:mpw:g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1
309 Else
310 Catenate "{MakefileIn}" >"{objdir}"Makefile.tem1
311 End If
a2e72689 312 sed -f "{srcdir}"mpw-make.sed "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
4ac27a60
SS
313 sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' -e 's/^exec_prefix = .*$/exec_prefix = {mpw_exec_prefix}/g' "{objdir}"Makefile.tem2 >"{objdir}"Makefile.tem3
314 sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem3 >"{objdir}"mpw-make.in
a2e72689
SS
315 tr-7to8 "{objdir}"mpw-make.in >>"{objdir}"Makefile.tem
316 MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
317 Delete -i -y "{objdir}"Makefile.tem[12]
318 If {verify} == 1
319 Echo Created Makefile in "`Directory`"
68c2f070 320 End If
a2e72689
SS
321Else If "`Exists "{srcdir}"mpw-make.in`" != ""
322 sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' "{srcdir}"mpw-make.in >"{objdir}"Makefile.tem1
323 sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
324 tr-7to8 "{objdir}"Makefile.tem2 >>"{objdir}"Makefile.tem
325 MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
326 Delete -i -y "{objdir}"Makefile.tem[12]
5db7ecb7
SS
327 If {verify} == 1
328 Echo Created Makefile in "`Directory`"
329 End If
330End If
331
a2e72689
SS
332# Produce a build script if the source is defined.
333
5db7ecb7
SS
334If "`Exists "{srcdir}"mpw-build.in`" != ""
335 Echo "Set srcroot " {srcroot} > "{objdir}"mpw-build.tem
336 Echo "Set srcdir " {srcdir} >> "{objdir}"mpw-build.tem
337 Echo "Set target_canonical " {target_canonical} >> "{objdir}"mpw-build.tem
aa8f28af 338 Echo "Set prefix " {prefix} >> "{objdir}"mpw-build.tem
a2e72689 339 tr-7to8 "{srcdir}"mpw-build.in >>"{objdir}"mpw-build.tem
5db7ecb7
SS
340 MoveIfChange "{objdir}"mpw-build.tem "{objdir}"mpw-build
341 If {verify} == 1
342 Echo Created mpw-build in "`Directory`"
343 End If
344End If
345
346For subdir In {configdirs}
347 Set savedir "`Directory`"
348 If "`Exists "{srcdir}{subdir}:"`" == ""
349 Echo Strange, no {subdir} in {srcdir}
350 Continue
351 End If
352 If {verify} == 1
353 Echo Configuring {subdir}...
354 End If
355 If "`Exists "{objdir}{subdir}:"`" == ""
356 NewFolder "{objdir}{subdir}"
357 End If
358 SetDirectory "{objdir}{subdir}:"
a2e72689 359 "{ThisScript}" --target "{target_canonical}" --srcdir "{srcdir}{subdir}:" --srcroot "{srcroot}" --prefix "{prefix}" --cc "{host_cc}" {verifystr}
5db7ecb7
SS
360 SetDirectory "{savedir}"
361End For
362
5db7ecb7 363SetDirectory "{savedir}"
This page took 0.1306 seconds and 4 git commands to generate.