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