]>
Commit | Line | Data |
---|---|---|
99a42820 | 1 | #!/bin/sh |
a9c7e163 RP |
2 | # Please do not edit this file. It is generated automatically from |
3 | # configure.in and a configure template. | |
99a42820 RP |
4 | configdirs= |
5 | ||
6 | #!/bin/sh | |
99a42820 RP |
7 | |
8 | # Configuration script template | |
9 | # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc. | |
10 | ||
11 | #This file is part of GNU. | |
12 | ||
13 | #GNU CC is free software; you can redistribute it and/or modify | |
14 | #it under the terms of the GNU General Public License as published by | |
15 | #the Free Software Foundation; either version 1, or (at your option) | |
16 | #any later version. | |
17 | ||
18 | #GNU CC is distributed in the hope that it will be useful, | |
19 | #but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | #GNU General Public License for more details. | |
22 | ||
23 | #You should have received a copy of the GNU General Public License | |
24 | #along with GNU CC; see the file COPYING. If not, write to | |
25 | #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
26 | ||
a9c7e163 RP |
27 | # $Id$ |
28 | ||
99a42820 RP |
29 | # |
30 | # Shell script to create proper links to machine-dependent files in | |
31 | # preparation for compiling gcc. | |
32 | # | |
33 | # Usage: configure [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] TARGET | |
34 | # | |
35 | # If configure succeeds, it leaves its status in config.status. | |
36 | # If configure fails after disturbing the status quo, | |
37 | # config.status is removed. | |
38 | # | |
39 | ||
40 | progname=$0 | |
41 | ||
42 | remove=rm | |
43 | hard_link=ln | |
44 | symbolic_link='ln -s' | |
45 | ||
46 | #for Test | |
47 | #remove="echo rm" | |
48 | #hard_link="echo ln" | |
49 | #symbolic_link="echo ln -s" | |
50 | ||
51 | # clear some things potentially inherited from environment. | |
52 | target= | |
53 | template= | |
54 | removing= | |
55 | norecurse= | |
56 | ansi= | |
a9c7e163 | 57 | srcdir= |
99a42820 RP |
58 | |
59 | for arg in $*; | |
60 | do | |
61 | case $arg in | |
62 | -ansi | +ansi) | |
63 | ansi=true | |
64 | ;; | |
65 | -template=* | +template=*) | |
66 | template=`echo $arg | sed 's/[+-]template=//'` | |
67 | ;; | |
68 | -norecurse | +norecurse) | |
69 | norecurse=true | |
70 | ;; | |
71 | -rm | +rm) | |
72 | removing=$arg | |
73 | ;; | |
74 | -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) | |
75 | srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` | |
76 | ;; | |
77 | -host=* | +host=* | +hos=* | +ho=* | +h=*) | |
78 | host=`echo $arg | sed 's/[+-]h[a-z]*=//'` | |
79 | ;; | |
a9c7e163 RP |
80 | -languages=* | +languages=* | +language=* | +languag=* \ |
81 | | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \ | |
82 | | +l=*) | |
99a42820 RP |
83 | languages="$languages `echo $arg | sed 's/[+-]l[a-z]*=//'`" |
84 | ;; | |
85 | -gas | +gas | +ga | +g) | |
86 | gas=yes | |
87 | ;; | |
88 | -nfp | +nfp | +nf | +n) | |
89 | nfp=yes | |
90 | ;; | |
91 | *) | |
92 | # Allow configure HOST TARGET | |
93 | if [ x$host = x ] ; then host=$target ; fi | |
94 | target=$arg | |
95 | ;; | |
96 | esac | |
97 | done | |
98 | ||
99 | # process host and target only if not rebuilding configure itself. | |
a9c7e163 | 100 | if [ -z "$template" -a -z "$removing" ] |
99a42820 RP |
101 | then |
102 | # Complain if an arg is missing | |
a9c7e163 | 103 | if [ -z "$target" ] |
99a42820 RP |
104 | then |
105 | echo "Usage: $progname [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] TARGET" | |
106 | echo -n "Where HOST and TARGET are something like " | |
107 | echo "\`vax', \`sun3', \`encore', etc." | |
108 | if [ -r config.status ] | |
109 | then | |
110 | cat config.status | |
111 | fi | |
112 | exit 1 | |
113 | fi | |
114 | ||
115 | # Default other arg | |
a9c7e163 | 116 | if [ -z "$host" ] |
99a42820 RP |
117 | then |
118 | host=$target | |
119 | fi | |
120 | ||
99a42820 RP |
121 | fi |
122 | ||
a9c7e163 RP |
123 | #### configure.in files come in here. |
124 | # This file is a shell script that supplies the information necessary | |
125 | # to tailor a template configure script into the configure script | |
126 | # appropriate for this directory. For more information, check any | |
127 | # existing configure script. | |
128 | ||
129 | srctrigger=libbfd.c | |
130 | srcname="bfd" | |
131 | files= | |
132 | links= | |
99a42820 RP |
133 | ### end of configure.in |
134 | ||
135 | # are we rebuilding config itself? | |
136 | if [ -n "$template" ] | |
137 | then | |
138 | if [ ! -r $template ] | |
139 | then | |
140 | echo "Can't find template ${template}." | |
141 | exit 1 | |
142 | fi | |
143 | ||
144 | mv configure configure.old | |
145 | echo "#!/bin/sh" > configure | |
a9c7e163 RP |
146 | echo "# Please do not edit this file. It is generated automatically from" >> configure |
147 | echo "# configure.in and a configure template." >> configure | |
99a42820 RP |
148 | echo "configdirs=" >> configure |
149 | echo >> configure | |
150 | ||
151 | if [ -r configure.in ] | |
152 | then | |
153 | sed -e "/^####/ r configure.in" $template >> configure | |
154 | else | |
155 | cat $template >> configure | |
156 | fi | |
157 | ||
158 | chmod a+x configure | |
159 | rm configure.old | |
99a42820 RP |
160 | echo Rebuilt configure in `pwd` |
161 | ||
162 | if [ x$norecurse = x ] | |
163 | then | |
164 | while [ -n "$configdirs" ] | |
165 | do | |
166 | # set configdir to car of configdirs, configdirs to cdr of configdirs | |
167 | set $configdirs; configdir=$1; shift; configdirs=$* | |
168 | ||
169 | if [ "`echo ${configdir}.*`" != "${configdir}.*" ] | |
170 | then | |
171 | targetspecificdirs=${configdir}.* | |
172 | else | |
173 | targetspecificdirs= | |
174 | fi | |
175 | ||
176 | for i in ${configdir} ${targetspecificdirs} | |
177 | do | |
178 | if [ -r $i/configure ] | |
179 | then | |
180 | (cd $i ; | |
181 | configure +template=${template}) | |
182 | else | |
183 | echo No configure script in `pwd`/$i | |
184 | fi | |
185 | done | |
186 | done | |
187 | fi | |
188 | ||
189 | exit 0 | |
190 | fi | |
191 | ||
192 | # Temporarily, we support only direct subdir builds. | |
193 | hostsubdir=Host-$host | |
194 | targetsubdir=Target-$target | |
195 | ||
196 | if [ -n "$removing" ] | |
197 | then | |
a9c7e163 RP |
198 | # rm -rf $hostsubdir/$targetsubdir |
199 | # | |
200 | # if [ -z "`(ls $hostsubdir) 2>&1 | grep Target-`" ] | |
201 | # then | |
202 | # rm -rf $hostsubdir | |
203 | # fi | |
99a42820 | 204 | |
a9c7e163 | 205 | rm -f .gdbinit Makefile config.status $links |
99a42820 | 206 | |
a9c7e163 RP |
207 | else |
208 | # if [ ! -d $hostsubdir ] ; then mkdir $hostsubdir ; fi | |
209 | # cd $hostsubdir | |
210 | # | |
211 | # if [ ! -d $targetsubdir ] ; then mkdir $targetsubdir ; fi | |
212 | # cd $targetsubdir | |
213 | # | |
214 | # srcdir=../.. | |
99a42820 | 215 | |
a9c7e163 RP |
216 | # Find the source files, if location was not specified. |
217 | if [ x$srcdir = x ] | |
218 | then | |
219 | srcdirdefaulted=1 | |
220 | srcdir=. | |
221 | if [ ! -r ${srctrigger} ] | |
222 | then | |
223 | srcdir=.. | |
224 | fi | |
225 | fi | |
226 | ||
227 | if [ ! -r ${srcdir}/${srctrigger} ] | |
228 | then | |
229 | if [ -z "$srcdirdefaulted" ] | |
230 | then | |
231 | echo "$progname: Can't find ${srcname} sources in \`${srcdir}'." 1>&2 | |
232 | else | |
233 | echo "$progname: Can't find ${srcname} sources in \`.' or \`..'." 1>&2 | |
234 | fi | |
235 | exit 1 | |
236 | fi | |
99a42820 RP |
237 | |
238 | # Set up the list of links to be made. | |
239 | # $links is the list of link names, and $files is the list of names to link to. | |
240 | ||
241 | # Make the links. | |
242 | while [ -n "$files" ] | |
243 | do | |
244 | # set file to car of files, files to cdr of files | |
245 | set $files; file=$1; shift; files=$* | |
246 | set $links; link=$1; shift; links=$* | |
247 | ||
a9c7e163 | 248 | if [ ! -r ${srcdir}/${file} ] |
99a42820 | 249 | then |
a9c7e163 RP |
250 | echo "$progname: cannot create a link \"${link}\"," 1>&2 |
251 | echo "since the file \"$file\" does not exist." 1>&2 | |
99a42820 RP |
252 | exit 1 |
253 | fi | |
254 | ||
255 | $remove -f $link | |
256 | rm -f config.status | |
257 | # Make a symlink if possible, otherwise try a hard link | |
a9c7e163 | 258 | $symbolic_link ${srcdir}/$file $link 2>/dev/null || $hard_link ${srcdir}/$file $link |
99a42820 RP |
259 | |
260 | if [ ! -r $link ] | |
261 | then | |
a9c7e163 | 262 | echo "$progname: unable to link \"$link\" to \"${srcdir}/$file\"." 1>&2 |
99a42820 RP |
263 | exit 1 |
264 | fi | |
a9c7e163 | 265 | echo "Linked \"$link\" to \"${srcdir}/${file}\"." |
99a42820 RP |
266 | done |
267 | ||
268 | # Install a makefile, and make it set VPATH | |
269 | # if necessary so that the sources are found. | |
270 | # Also change its value of srcdir. | |
271 | # Also create a .gdbinit file which runs the one in srcdir | |
272 | # and tells GDB to look there for source files. | |
273 | case $srcdir in | |
274 | .) | |
275 | ;; | |
276 | *) | |
277 | echo "VPATH = ${srcdir}" > x | |
278 | cat x ${srcdir}/Makefile.in | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.in | |
279 | rm x | |
280 | echo "dir ." > .gdbinit | |
281 | echo "dir ${srcdir}" >> .gdbinit | |
282 | echo "source ${srcdir}/.gdbinit" >> .gdbinit | |
283 | ;; | |
284 | esac | |
285 | ||
286 | host_var_file=hmake-${host} | |
287 | target_var_file=tmake-${target} | |
288 | ||
289 | # Conditionalize the makefile for this machine. | |
290 | if [ -f ${srcdir}/config/${host_var_file} ] | |
291 | then | |
292 | sed -e "/^####/ r ${srcdir}/config/${host_var_file}" Makefile.in > Makefile.tem | |
293 | else | |
294 | cp Makefile.in Makefile.tem | |
295 | fi | |
296 | ||
297 | if [ -f ${srcdir}/config/${target_var_file} ] | |
298 | then | |
299 | sed -e "/^####/ r ${srcdir}/config/${target_var_file}" Makefile.tem > Makefile.tem1 | |
300 | mv Makefile.tem1 Makefile.tem | |
301 | fi | |
302 | ||
303 | # Remove all formfeeds, since some Makes get confused by them. | |
304 | sed "s/\f//" Makefile.tem >> Makefile.tem1 | |
305 | mv Makefile.tem1 Makefile.tem | |
306 | ||
307 | # reset SUBDIRS | |
308 | sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile.tem > Makefile.tem1 | |
309 | mv Makefile.tem1 Makefile.tem | |
310 | ||
311 | # reset NONSUBDIRS | |
312 | sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile.tem > Makefile.tem1 | |
313 | mv Makefile.tem1 Makefile.tem | |
314 | ||
315 | # Delete the intermediate files | |
316 | if [ x$srcdir != x. ] ; then rm Makefile.in ; fi | |
317 | ||
318 | rm -f Makefile | |
319 | ||
320 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. | |
321 | if [ x$host != x$target ] | |
322 | then | |
323 | echo "CROSS=-DCROSS_COMPILE" > Makefile | |
324 | echo "ALL=start.encap" >> Makefile | |
325 | else | |
326 | echo "ALL=all.internal" > Makefile | |
327 | fi | |
328 | ||
329 | # set target and host | |
330 | echo "host = $host" >> Makefile | |
331 | echo "target = $target" >> Makefile | |
332 | ||
333 | cat Makefile.tem >> Makefile | |
334 | rm Makefile.tem | |
335 | ||
336 | using= | |
337 | if [ -f ${srcdir}/config/${host_var_file} ] | |
338 | then | |
339 | using=" using \"${host_var_file}\"" | |
340 | fi | |
341 | ||
342 | if [ -f ${srcdir}/config/${target_var_file} ] | |
343 | then | |
344 | if [ -z "${using}" ] | |
345 | then | |
346 | andusing=" using \"${target_var_file}\"" | |
347 | else | |
348 | andusing="${using} and \"${target_var_file}\"" | |
349 | fi | |
350 | else | |
351 | andusing=${using} | |
352 | fi | |
353 | ||
354 | echo "Created \"Makefile\""${andusing}. | |
355 | ||
356 | if [ x$host = x$target ] | |
357 | then | |
358 | echo "Links are now set up for use with a $target." \ | |
a9c7e163 RP |
359 | > config.status |
360 | # | tee ${srcdir}/config.status | |
99a42820 RP |
361 | else |
362 | echo "Links are now set up for host $host and target $target." \ | |
a9c7e163 RP |
363 | > config.status |
364 | # | tee ${srcdir}/config.status | |
99a42820 RP |
365 | fi |
366 | ||
367 | cd ${srcdir} | |
368 | fi | |
369 | ||
370 | # If there are subdirectories, then recurse. | |
371 | ||
a9c7e163 | 372 | if [ -n "$norecurse" ] ; then exit 0 ; fi |
99a42820 RP |
373 | |
374 | while [ -n "$configdirs" ] | |
375 | do | |
376 | # set configdir to car of configdirs, configdirs to cdr of configdirs | |
377 | set $configdirs; configdir=$1; shift; configdirs=$* | |
378 | ||
379 | # check for target override | |
380 | targetspecificdir=${configdir}.${target} | |
381 | if [ -d ${targetspecificdir} ] | |
382 | then | |
383 | configdir=${targetspecificdir} | |
384 | fi | |
385 | ||
386 | echo Configuring ${configdir}... | |
a9c7e163 RP |
387 | # (cd ${configdir} ; |
388 | # configure +host=${host} ${target} ${removing}) \ | |
389 | # | sed 's/^/ /' | |
390 | ||
99a42820 | 391 | (cd ${configdir} ; |
a9c7e163 | 392 | ./configure +host=${host} ${target} ${removing}) \ |
99a42820 RP |
393 | | sed 's/^/ /' |
394 | done | |
395 | ||
396 | exit 0 | |
a9c7e163 RP |
397 | |
398 | # | |
399 | # $Log$ | |
400 | # Revision 1.2 1991/04/09 23:20:12 rich | |
401 | # First minimally usable checkin. | |
402 | # | |
403 | # | |
404 | # | |
405 | ||
406 | ||
407 | # end of configure.template |