Mon Jan 31 16:07:58 1994 Stan Shebs (shebs@andros.cygnus.com)
[external/binutils.git] / mpw-configure
1 # Configuration script
2
3 ### This script (and its config.in fragments) must NOT use any 8-bit chars!
4
5 Set savedir "`Directory`"
6
7 #Set Echo 1
8
9 Set thisscript "{0}"
10
11 Set srcroot "--------"
12
13 Set srcdir ":"
14
15 Set objdir ":"
16
17 Set hostalias "m68k-apple-mpw"
18
19 Set targetalias {hostalias}
20
21 Set verify 0
22 Set verifystr ""
23
24 # Parse arguments.
25
26 Loop
27         Break If {#} == 0
28         If "{1}" =~ /--prefix/
29                 Set prefix "{2}"
30                 Shift 1
31         Else If "{1}" =~ /--srcdir/
32                 Set srcdir "{2}"
33                 Shift 1
34         Else If "{1}" =~ /--srcroot/
35                 Set srcroot "{2}"
36                 Shift 1
37         Else If "{1}" =~ /--target/
38                 Set targetalias "{2}"
39                 Shift 1
40         Else If "{1}" =~ /-v/
41                 Set verify 1
42                 Set verifystr "-v"
43                 Shift 1
44         Else
45                 Echo "{1}" is not a valid argument
46                 Exit 1
47         End If
48         Shift 1
49 End Loop
50
51 Set Exit 0
52
53 # (should interpret aliases if not in canonical form)
54
55 Set target_canonical "{targetalias}"
56
57 Set configdirs ""
58
59 If "{srcroot}" =~ /--------/
60         Set srcroot "{srcdir}"
61 End If
62 If "`Exists "{srcdir}"`" == ""
63         Echo Source directory {srcdir} does not exist!
64         Exit 1
65 End If
66 If "`Exists "{srcroot}"`" == ""
67         Echo Top-level source directory {srcroot} does not exist!
68         Exit 1
69 End If
70
71 If "`Exists "{srcdir}"mpw-config.in`" != ""
72         Execute "{srcdir}"mpw-config.in
73 End If
74 If "`Exists "{srcdir}"mpw-xconfig.in`" != ""
75         Execute "{srcdir}"mpw-xconfig.in
76 End If
77
78 If "`Exists "{srcdir}"mpw-make.in`" != ""
79         Echo "# This Makefile produced by mpw-configure.  Changes may get lost!" > "{objdir}"Makefile.tem
80         Echo "srcroot = " {srcroot} >> "{objdir}"Makefile.tem
81         Echo "topsrcdir = " {srcroot} >> "{objdir}"Makefile.tem
82         Echo "srcdir = " {srcdir} >> "{objdir}"Makefile.tem
83         Echo "target_canonical = " {target_canonical} >> "{objdir}"Makefile.tem
84         Echo "mdname = " {mdname} >> "{objdir}"Makefile.tem
85         Echo "EMUL = " {emulname} >> "{objdir}"Makefile.tem
86         Echo "host_makefile_frag = " >> "{objdir}"Makefile.tem
87         Echo "target_makefile_frag = " >> "{objdir}"Makefile.tem
88         mpw-7to8 "{srcroot}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
89         mpw-7to8 "{srcdir}"mpw-make.in >>"{objdir}"Makefile.tem
90         MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
91         If {verify} == 1
92                 Echo Created Makefile in "`Directory`"
93         End If
94 End If
95
96 If "`Exists "{srcdir}"mpw-build.in`" != ""
97         Echo "Set srcroot " {srcroot} > "{objdir}"mpw-build.tem
98         Echo "Set srcdir " {srcdir} >> "{objdir}"mpw-build.tem
99         Echo "Set target_canonical " {target_canonical} >> "{objdir}"mpw-build.tem
100         mpw-7to8 "{srcdir}"mpw-build.in >>"{objdir}"mpw-build.tem
101         MoveIfChange "{objdir}"mpw-build.tem "{objdir}"mpw-build
102         If {verify} == 1
103                 Echo Created mpw-build in "`Directory`"
104         End If
105 End If
106
107 For subdir In {configdirs}
108         Set savedir "`Directory`"
109         If "`Exists "{srcdir}{subdir}:"`" == ""
110                 Echo Strange, no {subdir} in {srcdir}
111                 Continue
112         End If
113         If {verify} == 1
114                 Echo Configuring {subdir}...
115         End If
116         If "`Exists "{objdir}{subdir}:"`" == ""
117                 NewFolder "{objdir}{subdir}"
118         End If
119         SetDirectory "{objdir}{subdir}:"
120         "{thisscript}" --target "{target_canonical}" --srcdir "{srcdir}{subdir}:" --srcroot "{srcroot}" {verifystr}
121         SetDirectory "{savedir}"
122 End For
123
124 Echo "# This directory was configured as follows:" >config.status
125 Echo "mpw-configure --host {hostalias} --target {targetalias} --srcdir {srcdir}" >>config.status
126
127 SetDirectory "{savedir}"