]>
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. | |
99a42820 | 52 | ansi= |
f2e91404 RP |
53 | hostsubdir= |
54 | norecurse= | |
55 | removing= | |
a9c7e163 | 56 | srcdir= |
f2e91404 RP |
57 | target= |
58 | targetsubdir= | |
59 | template= | |
99a42820 RP |
60 | |
61 | for arg in $*; | |
62 | do | |
63 | case $arg in | |
64 | -ansi | +ansi) | |
65 | ansi=true | |
66 | ;; | |
f2e91404 RP |
67 | -forcesubdirs | +f*) |
68 | forcesubdirs=${arg} | |
99a42820 RP |
69 | ;; |
70 | -host=* | +host=* | +hos=* | +ho=* | +h=*) | |
71 | host=`echo $arg | sed 's/[+-]h[a-z]*=//'` | |
72 | ;; | |
a9c7e163 RP |
73 | -languages=* | +languages=* | +language=* | +languag=* \ |
74 | | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \ | |
75 | | +l=*) | |
99a42820 RP |
76 | languages="$languages `echo $arg | sed 's/[+-]l[a-z]*=//'`" |
77 | ;; | |
78 | -gas | +gas | +ga | +g) | |
79 | gas=yes | |
80 | ;; | |
81 | -nfp | +nfp | +nf | +n) | |
82 | nfp=yes | |
83 | ;; | |
f2e91404 RP |
84 | -norecurse | +norecurse) |
85 | norecurse=true | |
86 | ;; | |
87 | -rm | +rm) | |
88 | removing=$arg | |
89 | ;; | |
90 | -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) | |
91 | srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` | |
92 | ;; | |
93 | -template=* | +template=*) | |
94 | template=`echo $arg | sed 's/[+-]template=//'` | |
95 | ;; | |
99a42820 RP |
96 | *) |
97 | # Allow configure HOST TARGET | |
98 | if [ x$host = x ] ; then host=$target ; fi | |
99 | target=$arg | |
100 | ;; | |
101 | esac | |
102 | done | |
103 | ||
f2e91404 | 104 | # process host and target only if not rebuilding configure itself or removing. |
a9c7e163 | 105 | if [ -z "$template" -a -z "$removing" ] |
99a42820 RP |
106 | then |
107 | # Complain if an arg is missing | |
a9c7e163 | 108 | if [ -z "$target" ] |
99a42820 RP |
109 | then |
110 | echo "Usage: $progname [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] TARGET" | |
111 | echo -n "Where HOST and TARGET are something like " | |
112 | echo "\`vax', \`sun3', \`encore', etc." | |
113 | if [ -r config.status ] | |
114 | then | |
115 | cat config.status | |
116 | fi | |
117 | exit 1 | |
118 | fi | |
f2e91404 | 119 | fi |
99a42820 | 120 | |
f2e91404 RP |
121 | # Default other arg |
122 | if [ -z "$host" ] | |
123 | then | |
124 | host=$target | |
99a42820 RP |
125 | fi |
126 | ||
a9c7e163 RP |
127 | #### configure.in files come in here. |
128 | # This file is a shell script that supplies the information necessary | |
129 | # to tailor a template configure script into the configure script | |
130 | # appropriate for this directory. For more information, check any | |
131 | # existing configure script. | |
132 | ||
133 | srctrigger=libbfd.c | |
134 | srcname="bfd" | |
135 | files= | |
136 | links= | |
99a42820 RP |
137 | ### end of configure.in |
138 | ||
139 | # are we rebuilding config itself? | |
140 | if [ -n "$template" ] | |
141 | then | |
142 | if [ ! -r $template ] | |
143 | then | |
144 | echo "Can't find template ${template}." | |
145 | exit 1 | |
146 | fi | |
147 | ||
148 | mv configure configure.old | |
149 | echo "#!/bin/sh" > configure | |
a9c7e163 RP |
150 | echo "# Please do not edit this file. It is generated automatically from" >> configure |
151 | echo "# configure.in and a configure template." >> configure | |
99a42820 RP |
152 | echo "configdirs=" >> configure |
153 | echo >> configure | |
154 | ||
155 | if [ -r configure.in ] | |
156 | then | |
157 | sed -e "/^####/ r configure.in" $template >> configure | |
158 | else | |
159 | cat $template >> configure | |
160 | fi | |
161 | ||
162 | chmod a+x configure | |
163 | rm configure.old | |
99a42820 RP |
164 | echo Rebuilt configure in `pwd` |
165 | ||
166 | if [ x$norecurse = x ] | |
167 | then | |
168 | while [ -n "$configdirs" ] | |
169 | do | |
170 | # set configdir to car of configdirs, configdirs to cdr of configdirs | |
171 | set $configdirs; configdir=$1; shift; configdirs=$* | |
172 | ||
173 | if [ "`echo ${configdir}.*`" != "${configdir}.*" ] | |
174 | then | |
175 | targetspecificdirs=${configdir}.* | |
176 | else | |
177 | targetspecificdirs= | |
178 | fi | |
179 | ||
180 | for i in ${configdir} ${targetspecificdirs} | |
181 | do | |
182 | if [ -r $i/configure ] | |
183 | then | |
184 | (cd $i ; | |
185 | configure +template=${template}) | |
186 | else | |
187 | echo No configure script in `pwd`/$i | |
188 | fi | |
189 | done | |
190 | done | |
191 | fi | |
192 | ||
193 | exit 0 | |
194 | fi | |
195 | ||
196 | # Temporarily, we support only direct subdir builds. | |
f2e91404 RP |
197 | hostsubdir=Host-${host} |
198 | targetsubdir=Target-${target} | |
99a42820 | 199 | |
f2e91404 | 200 | if [ -n "${removing}" ] |
99a42820 | 201 | then |
f2e91404 RP |
202 | if [ -d "${hostsubdir}/${targetsubdir}" ] |
203 | then | |
204 | rm -rf ${hostsubdir}/${targetsubdir} | |
99a42820 | 205 | |
f2e91404 RP |
206 | if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] |
207 | then | |
208 | rm -rf ${hostsubdir} | |
209 | fi | |
210 | else | |
211 | rm -f .gdbinit Makefile config.status $links | |
212 | fi | |
a9c7e163 | 213 | else |
f2e91404 RP |
214 | if [ -n "$forcesubdirs" ] |
215 | then | |
216 | # check for existing status before allowing forced subdirs. | |
217 | if [ -f Makefile ] | |
218 | then | |
219 | echo "Makefile already exists in source directory. `pwd` not configured." | |
220 | exit 1 | |
221 | fi | |
222 | ||
223 | if [ ! -d $hostsubdir ] ; then mkdir $hostsubdir ; fi | |
224 | cd $hostsubdir | |
225 | ||
226 | if [ ! -d $targetsubdir ] ; then mkdir $targetsubdir ; fi | |
227 | cd $targetsubdir | |
228 | ||
229 | srcdir=../.. | |
230 | else | |
231 | # if not subdir builds, then make sure none exist. | |
232 | if [ -n "`(ls .) 2>&1 | grep Host-`" ] | |
233 | then | |
234 | echo "Configured subdirs exist. `pwd` not configured." | |
235 | exit 1 | |
236 | fi | |
237 | fi | |
99a42820 | 238 | |
a9c7e163 RP |
239 | # Find the source files, if location was not specified. |
240 | if [ x$srcdir = x ] | |
241 | then | |
242 | srcdirdefaulted=1 | |
243 | srcdir=. | |
244 | if [ ! -r ${srctrigger} ] | |
245 | then | |
246 | srcdir=.. | |
247 | fi | |
248 | fi | |
249 | ||
250 | if [ ! -r ${srcdir}/${srctrigger} ] | |
251 | then | |
252 | if [ -z "$srcdirdefaulted" ] | |
253 | then | |
254 | echo "$progname: Can't find ${srcname} sources in \`${srcdir}'." 1>&2 | |
255 | else | |
256 | echo "$progname: Can't find ${srcname} sources in \`.' or \`..'." 1>&2 | |
257 | fi | |
258 | exit 1 | |
259 | fi | |
99a42820 RP |
260 | |
261 | # Set up the list of links to be made. | |
262 | # $links is the list of link names, and $files is the list of names to link to. | |
263 | ||
264 | # Make the links. | |
265 | while [ -n "$files" ] | |
266 | do | |
267 | # set file to car of files, files to cdr of files | |
268 | set $files; file=$1; shift; files=$* | |
269 | set $links; link=$1; shift; links=$* | |
270 | ||
a9c7e163 | 271 | if [ ! -r ${srcdir}/${file} ] |
99a42820 | 272 | then |
a9c7e163 RP |
273 | echo "$progname: cannot create a link \"${link}\"," 1>&2 |
274 | echo "since the file \"$file\" does not exist." 1>&2 | |
99a42820 RP |
275 | exit 1 |
276 | fi | |
277 | ||
278 | $remove -f $link | |
279 | rm -f config.status | |
280 | # Make a symlink if possible, otherwise try a hard link | |
a9c7e163 | 281 | $symbolic_link ${srcdir}/$file $link 2>/dev/null || $hard_link ${srcdir}/$file $link |
99a42820 RP |
282 | |
283 | if [ ! -r $link ] | |
284 | then | |
a9c7e163 | 285 | echo "$progname: unable to link \"$link\" to \"${srcdir}/$file\"." 1>&2 |
99a42820 RP |
286 | exit 1 |
287 | fi | |
a9c7e163 | 288 | echo "Linked \"$link\" to \"${srcdir}/${file}\"." |
99a42820 RP |
289 | done |
290 | ||
f2e91404 | 291 | # Create a .gdbinit file which runs the one in srcdir |
99a42820 | 292 | # and tells GDB to look there for source files. |
f2e91404 | 293 | |
99a42820 RP |
294 | case $srcdir in |
295 | .) | |
296 | ;; | |
297 | *) | |
99a42820 RP |
298 | echo "dir ." > .gdbinit |
299 | echo "dir ${srcdir}" >> .gdbinit | |
300 | echo "source ${srcdir}/.gdbinit" >> .gdbinit | |
301 | ;; | |
302 | esac | |
303 | ||
f2e91404 RP |
304 | # Install a makefile, and make it set VPATH |
305 | # if necessary so that the sources are found. | |
306 | # Also change its value of srcdir. | |
307 | ||
308 | # FIXME-someday: This business of always writing to .tem and mv back | |
309 | # is so that I don't screw things up while developing. Once this | |
310 | # template is stable, these should be optimized. xoxorich. | |
311 | ||
312 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. | |
313 | if [ x$host != x$target ] | |
314 | then | |
315 | echo "CROSS=-DCROSS_COMPILE" > Makefile | |
316 | echo "ALL=start.encap" >> Makefile | |
317 | else | |
318 | echo "ALL=all.internal" > Makefile | |
319 | fi | |
320 | ||
321 | # set target, host, VPATH | |
322 | echo "host = $host" >> Makefile | |
323 | echo "target = $target" >> Makefile | |
324 | ||
325 | if [ -n "${forcesubdirs}" ] | |
326 | then | |
327 | echo "subdir = /${hostsubdir}/${targetsubdir}" >> Makefile | |
328 | else | |
329 | echo "subdir =" >> Makefile | |
330 | fi | |
331 | ||
332 | # echo "workdir = `pwd`" >> Makefile | |
333 | echo "VPATH = ${srcdir}" >> Makefile | |
334 | ||
335 | # add Makefile.in | |
336 | cat ${srcdir}/Makefile.in >> Makefile | |
337 | ||
338 | # and shake thoroughly. | |
99a42820 RP |
339 | host_var_file=hmake-${host} |
340 | target_var_file=tmake-${target} | |
341 | ||
342 | # Conditionalize the makefile for this machine. | |
343 | if [ -f ${srcdir}/config/${host_var_file} ] | |
344 | then | |
f2e91404 RP |
345 | sed -e "/^####/ r ${srcdir}/config/${host_var_file}" Makefile > Makefile.tem |
346 | mv Makefile.tem Makefile | |
99a42820 RP |
347 | fi |
348 | ||
349 | if [ -f ${srcdir}/config/${target_var_file} ] | |
350 | then | |
f2e91404 RP |
351 | sed -e "/^####/ r ${srcdir}/config/${target_var_file}" Makefile > Makefile.tem |
352 | mv Makefile.tem Makefile | |
99a42820 RP |
353 | fi |
354 | ||
f2e91404 RP |
355 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" Makefile > Makefile.tem |
356 | mv Makefile.tem Makefile | |
357 | ||
99a42820 | 358 | # Remove all formfeeds, since some Makes get confused by them. |
f2e91404 RP |
359 | sed "s/\f//" Makefile >> Makefile.tem |
360 | mv Makefile.tem Makefile | |
99a42820 RP |
361 | |
362 | # reset SUBDIRS | |
f2e91404 RP |
363 | sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile > Makefile.tem |
364 | mv Makefile.tem Makefile | |
99a42820 RP |
365 | |
366 | # reset NONSUBDIRS | |
f2e91404 RP |
367 | sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile > Makefile.tem |
368 | mv Makefile.tem Makefile | |
99a42820 RP |
369 | |
370 | using= | |
371 | if [ -f ${srcdir}/config/${host_var_file} ] | |
372 | then | |
373 | using=" using \"${host_var_file}\"" | |
374 | fi | |
375 | ||
376 | if [ -f ${srcdir}/config/${target_var_file} ] | |
377 | then | |
378 | if [ -z "${using}" ] | |
379 | then | |
380 | andusing=" using \"${target_var_file}\"" | |
381 | else | |
382 | andusing="${using} and \"${target_var_file}\"" | |
383 | fi | |
384 | else | |
385 | andusing=${using} | |
386 | fi | |
387 | ||
388 | echo "Created \"Makefile\""${andusing}. | |
389 | ||
390 | if [ x$host = x$target ] | |
391 | then | |
392 | echo "Links are now set up for use with a $target." \ | |
a9c7e163 RP |
393 | > config.status |
394 | # | tee ${srcdir}/config.status | |
99a42820 RP |
395 | else |
396 | echo "Links are now set up for host $host and target $target." \ | |
a9c7e163 RP |
397 | > config.status |
398 | # | tee ${srcdir}/config.status | |
99a42820 RP |
399 | fi |
400 | ||
f2e91404 | 401 | originaldir=`pwd` |
99a42820 RP |
402 | cd ${srcdir} |
403 | fi | |
404 | ||
405 | # If there are subdirectories, then recurse. | |
406 | ||
a9c7e163 | 407 | if [ -n "$norecurse" ] ; then exit 0 ; fi |
99a42820 RP |
408 | |
409 | while [ -n "$configdirs" ] | |
410 | do | |
411 | # set configdir to car of configdirs, configdirs to cdr of configdirs | |
412 | set $configdirs; configdir=$1; shift; configdirs=$* | |
413 | ||
414 | # check for target override | |
415 | targetspecificdir=${configdir}.${target} | |
416 | if [ -d ${targetspecificdir} ] | |
417 | then | |
418 | configdir=${targetspecificdir} | |
419 | fi | |
420 | ||
421 | echo Configuring ${configdir}... | |
422 | (cd ${configdir} ; | |
f2e91404 | 423 | ./configure ${forcesubdirs} ${removing} +host=${host} ${target}) \ |
99a42820 RP |
424 | | sed 's/^/ /' |
425 | done | |
426 | ||
427 | exit 0 | |
a9c7e163 RP |
428 | |
429 | # | |
430 | # $Log$ | |
f2e91404 RP |
431 | # Revision 1.3 1991/04/10 22:56:14 rich |
432 | # Cut 2. Subdirs. | |
a9c7e163 RP |
433 | # |
434 | # | |
435 | # | |
436 | ||
437 | ||
438 | # end of configure.template |