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