]>
Commit | Line | Data |
---|---|---|
79c06341 JL |
1 | #!/bin/sh |
2 | ||
3 | ### WARNING: this file contains embedded tabs. Do not run untabify on this file. | |
4 | ||
5 | # Configuration script | |
6 | # Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997 | |
7 | # Free Software Foundation, Inc. | |
8 | ||
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the GNU General Public License as published by | |
11 | # the Free Software Foundation; either version 2 of the License, or | |
12 | # (at your option) any later version. | |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # GNU General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU General Public License | |
20 | # along with this program; if not, write to the Free Software | |
21 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
22 | ||
23 | # This file was originally written by K. Richard Pixley. | |
24 | ||
25 | # | |
26 | # Shell script to create proper links to machine-dependent files in | |
27 | # preparation for compilation. | |
28 | # | |
29 | # If configure succeeds, it leaves its status in config.status. | |
30 | # If configure fails after disturbing the status quo, | |
31 | # config.status is removed. | |
32 | # | |
33 | ||
34 | export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$) | |
35 | ||
36 | remove=rm | |
37 | hard_link=ln | |
38 | symbolic_link='ln -s' | |
39 | ||
40 | #for Test | |
41 | #remove="echo rm" | |
42 | #hard_link="echo ln" | |
43 | #symbolic_link="echo ln -s" | |
44 | ||
45 | # clear some things potentially inherited from environment. | |
46 | ||
47 | Makefile=Makefile | |
48 | Makefile_in=Makefile.in | |
49 | arguments= | |
50 | build_alias= | |
51 | cache_file=config.cache | |
52 | cache_file_option= | |
53 | configdirs= | |
5d4a5ee6 JL |
54 | extraconfigdirs= |
55 | diroptions= | |
79c06341 JL |
56 | exec_prefix= |
57 | exec_prefixoption= | |
58 | fatal= | |
59 | floating_point=default | |
60 | gas=default | |
f1943b77 MH |
61 | gcc_version= |
62 | gcc_version_trigger= | |
79c06341 JL |
63 | host_alias=NOHOST |
64 | host_makefile_frag= | |
65 | moveifchange= | |
66 | norecursion= | |
67 | other_options= | |
68 | package_makefile_frag= | |
59739e3c | 69 | package_makefile_rules_frag= |
79c06341 JL |
70 | prefix=/usr/local |
71 | progname= | |
72 | program_prefix= | |
73 | program_prefixoption= | |
74 | program_suffix= | |
75 | program_suffixoption= | |
76 | program_transform_name= | |
77 | program_transform_nameoption= | |
5d4a5ee6 | 78 | redirect= |
79c06341 JL |
79 | removing= |
80 | site= | |
81 | site_makefile_frag= | |
82 | site_option= | |
83 | srcdir= | |
84 | srctrigger= | |
85 | subdirs= | |
86 | target_alias=NOTARGET | |
87 | target_makefile_frag= | |
88 | undefs=NOUNDEFS | |
59739e3c | 89 | version="$Revision: 1.22 $" |
79c06341 | 90 | x11=default |
5d4a5ee6 JL |
91 | bindir='${exec_prefix}/bin' |
92 | sbindir='${exec_prefix}/sbin' | |
93 | libexecdir='${exec_prefix}/libexec' | |
94 | datadir='${prefix}/share' | |
95 | sysconfdir='${prefix}/etc' | |
96 | sharedstatedir='${prefix}/com' | |
97 | localstatedir='${prefix}/var' | |
98 | libdir='${exec_prefix}/lib' | |
99 | includedir='${prefix}/include' | |
100 | oldincludedir='/usr/include' | |
101 | infodir='${prefix}/info' | |
102 | mandir='${prefix}/man' | |
79c06341 JL |
103 | |
104 | ### we might need to use some other shell than /bin/sh for running subshells | |
105 | ||
106 | ### If we are on Windows, search for the shell. This will permit people | |
107 | ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure | |
108 | ### without also having to set CONFIG_SHELL. This code will work when | |
109 | ### using bash, which sets OSTYPE. | |
110 | case "${OSTYPE}" in | |
111 | *win32*) | |
112 | if [ x${CONFIG_SHELL} = x ]; then | |
113 | if [ ! -f /bin/sh ]; then | |
114 | if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then | |
115 | CONFIG_SHELL=${SHELL} | |
116 | export CONFIG_SHELL | |
117 | else | |
118 | for prog in sh sh.exe bash bash.exe; do | |
119 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
120 | for dir in $PATH; do | |
121 | test -z "$dir" && dir=. | |
122 | if test -f $dir/$prog; then | |
123 | CONFIG_SHELL=$dir/$prog | |
124 | export CONFIG_SHELL | |
125 | break | |
126 | fi | |
127 | done | |
128 | IFS="$save_ifs" | |
129 | test -n "${CONFIG_SHELL}" && break | |
130 | done | |
131 | fi | |
132 | fi | |
133 | fi | |
134 | ;; | |
135 | esac | |
136 | ||
137 | config_shell=${CONFIG_SHELL-/bin/sh} | |
138 | ||
139 | NO_EDIT="This file was generated automatically by configure. Do not edit." | |
140 | ||
141 | ## this is a little touchy and won't always work, but... | |
142 | ## | |
143 | ## if the argv[0] starts with a slash then it is an absolute name that can (and | |
144 | ## must) be used as is. | |
145 | ## | |
146 | ## otherwise, if argv[0] has no slash in it, we can assume that it is on the | |
147 | ## path. Since PATH might include "." we also add `pwd` to the end of PATH. | |
148 | ## | |
149 | ||
150 | progname=$0 | |
151 | # if PWD already has a value, it is probably wrong. | |
152 | if [ -n "$PWD" ]; then PWD=`pwd`; fi | |
153 | ||
154 | case "${progname}" in | |
155 | /*) ;; | |
156 | */*) ;; | |
157 | *) | |
158 | PATH=$PATH:${PWD=`pwd`} ; export PATH | |
159 | ;; | |
160 | esac | |
161 | ||
162 | # Loop over all args | |
163 | ||
164 | while : | |
165 | do | |
166 | ||
167 | # Break out if there are no more args | |
168 | case $# in | |
169 | 0) | |
170 | break | |
171 | ;; | |
172 | esac | |
173 | ||
174 | # Get the first arg, and shuffle | |
175 | option=$1 | |
176 | shift | |
177 | ||
178 | # Make all options have two hyphens | |
179 | orig_option=$option # Save original for error messages | |
180 | case $option in | |
181 | --*) ;; | |
182 | -*) option=-$option ;; | |
183 | esac | |
184 | ||
185 | # Split out the argument for options that take them | |
186 | case $option in | |
187 | --*=*) | |
188 | optarg=`echo $option | sed -e 's/^[^=]*=//'` | |
189 | arguments="$arguments $option" | |
190 | ;; | |
191 | # These options have mandatory values. Since we didn't find an = sign, | |
192 | # the value must be in the next argument | |
193 | --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*) | |
194 | optarg=$1 | |
195 | shift | |
196 | arguments="$arguments $option=$optarg" | |
197 | ;; | |
198 | --v) | |
199 | arguments="$arguments -v" | |
200 | ;; | |
201 | --*) | |
202 | arguments="$arguments $option" | |
203 | ;; | |
204 | esac | |
205 | ||
206 | # Now, process the options | |
207 | case $option in | |
208 | ||
5d4a5ee6 JL |
209 | --bi*) |
210 | bindir=$optarg | |
211 | diroptions="$diroptions --bindir=$optarg" | |
212 | ;; | |
79c06341 JL |
213 | --build* | --bu*) |
214 | case "$build_alias" in | |
215 | "") build_alias=$optarg ;; | |
216 | *) echo '***' Can only configure for one build machine at a time. 1>&2 | |
217 | fatal=yes | |
218 | ;; | |
219 | esac | |
220 | ;; | |
221 | --cache*) | |
222 | cache_file=$optarg | |
223 | ;; | |
5d4a5ee6 JL |
224 | --da*) |
225 | datadir=$optarg | |
226 | diroptions="$diroptions --datadir=$optarg" | |
227 | ;; | |
79c06341 JL |
228 | --disable-*) |
229 | enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` | |
230 | eval $enableopt=no | |
231 | disableoptions="$disableoptions $option" | |
232 | ;; | |
233 | --enable-*) | |
234 | case "$option" in | |
235 | *=*) ;; | |
236 | *) optarg=yes ;; | |
237 | esac | |
238 | ||
239 | enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
240 | eval "$enableopt='$optarg'" | |
241 | enableoptions="$enableoptions '$option'" | |
242 | ;; | |
243 | --exec-prefix* | --ex*) | |
244 | exec_prefix=$optarg | |
245 | exec_prefixoption="--exec-prefix=$optarg" | |
246 | ;; | |
247 | --gas | --g*) | |
248 | gas=yes | |
249 | ;; | |
250 | --help | --he*) | |
251 | fatal=yes | |
252 | ;; | |
253 | --host* | --ho*) | |
254 | case $host_alias in | |
255 | NOHOST) host_alias=$optarg ;; | |
256 | *) echo '***' Can only configure for one host at a time. 1>&2 | |
257 | fatal=yes | |
258 | ;; | |
259 | esac | |
260 | ;; | |
5d4a5ee6 JL |
261 | --inc*) |
262 | includedir=$optarg | |
263 | diroptions="$diroptions --includedir=$optarg" | |
264 | ;; | |
265 | --inf*) | |
266 | infodir=$optarg | |
267 | diroptions="$diroptions --infodir=$optarg" | |
268 | ;; | |
269 | --libd*) | |
270 | libdir=$optarg | |
271 | diroptions="$diroptions --libdir=$optarg" | |
272 | ;; | |
273 | --libe*) | |
274 | libexecdir=$optarg | |
275 | diroptions="$diroptions --libexecdir=$optarg" | |
276 | ;; | |
277 | --lo*) | |
278 | localstatedir=$optarg | |
279 | diroptions="$diroptions --localstatedir=$optarg" | |
280 | ;; | |
281 | --ma*) | |
282 | mandir=$optarg | |
283 | diroptions="$diroptions --mandir=$optarg" | |
284 | ;; | |
79c06341 JL |
285 | --nfp | --nf*) |
286 | floating_point=no | |
287 | floating_pointoption="--nfp" | |
288 | ;; | |
289 | --norecursion | --no*) | |
290 | norecursion=yes | |
291 | ;; | |
5d4a5ee6 JL |
292 | --ol*) |
293 | oldincludedir=$optarg | |
294 | diroptions="$diroptions --oldincludedir=$optarg" | |
295 | ;; | |
79c06341 JL |
296 | --prefix* | --pre*) |
297 | prefix=$optarg | |
298 | prefixoption="--prefix=$optarg" | |
299 | ;; | |
300 | --program-prefix* | --program-p*) | |
301 | program_prefix=$optarg | |
302 | program_prefixoption="--program-prefix=$optarg" | |
303 | ;; | |
304 | --program-suffix* | --program-s*) | |
305 | program_suffix=$optarg | |
306 | program_suffixoption="--program-suffix=$optarg" | |
307 | ;; | |
308 | --program-transform-name* | --program-t*) | |
309 | # Double any backslashes or dollar signs in the argument | |
310 | program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`" | |
311 | program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'" | |
312 | ;; | |
313 | --rm) | |
314 | removing=--rm | |
315 | ;; | |
5d4a5ee6 JL |
316 | --sb*) |
317 | sbindir=$optarg | |
318 | diroptions="$diroptions --sbindir=$optarg" | |
319 | ;; | |
320 | --sh*) | |
321 | sharedstatedir=$optarg | |
322 | diroptions="$diroptions --sharedstatedir=$optarg" | |
323 | ;; | |
79c06341 JL |
324 | --silent | --sil* | --quiet | --q*) |
325 | redirect=">/dev/null" | |
326 | verbose=--silent | |
327 | ;; | |
328 | --site* | --sit*) | |
329 | site=$optarg | |
330 | site_option="--site=$optarg" | |
331 | ;; | |
332 | --srcdir*/ | --sr*/) | |
333 | # Remove trailing slashes. Otherwise, when the file name gets | |
334 | # bolted into an object file as debug info, it has two slashes | |
335 | # in it. Ordinarily this is ok, but emacs takes double slash | |
336 | # to mean "forget the first part". | |
337 | srcdir=`echo $optarg | sed -e 's:/$::'` | |
338 | ;; | |
339 | --srcdir* | --sr*) | |
340 | srcdir=$optarg | |
341 | ;; | |
5d4a5ee6 JL |
342 | --sy*) |
343 | sysconfdir=$optarg | |
344 | diroptions="$diroptions --sysconfdir=$optarg" | |
345 | ;; | |
79c06341 JL |
346 | --target* | --ta*) |
347 | case $target_alias in | |
348 | NOTARGET) target_alias=$optarg ;; | |
349 | *) echo '***' Can only configure for one target at a time. 1>&2 | |
350 | fatal=yes | |
351 | ;; | |
352 | esac | |
353 | ;; | |
354 | --tmpdir* | --tm*) | |
355 | TMPDIR=$optarg | |
356 | tmpdiroption="--tmpdir=$optarg" | |
357 | ;; | |
358 | --verbose | --v | --verb*) | |
359 | redirect= | |
360 | verbose=--verbose | |
361 | ;; | |
362 | --version | --V | --vers*) | |
363 | echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'` | |
364 | exit 0 | |
365 | ;; | |
366 | --with-*) | |
367 | case "$option" in | |
368 | *=*) ;; | |
369 | *) optarg=yes ;; | |
370 | esac | |
371 | ||
372 | withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
373 | eval $withopt="$optarg" | |
374 | withoptions="$withoptions $option" | |
375 | ;; | |
376 | --without-*) | |
377 | withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` | |
378 | eval $withopt=no | |
379 | withoutoptions="$withoutoptions $option" | |
380 | ;; | |
381 | --x) with_x=yes | |
382 | withoptions="$withoptions --with-x" | |
383 | ;; | |
384 | --x-i* | --x-l*) other_options="$other_options $orig_option" | |
385 | ;; | |
79c06341 JL |
386 | --*) |
387 | echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2 | |
388 | exit 1 | |
389 | ;; | |
390 | *) | |
391 | case $undefs in | |
392 | NOUNDEFS) undefs=$option ;; | |
393 | *) echo '***' Can only configure for one host and one target at a time. 1>&2 | |
394 | fatal=yes | |
395 | ;; | |
396 | esac | |
397 | ;; | |
398 | esac | |
399 | done | |
400 | ||
401 | # process host and target | |
402 | ||
403 | # Do some error checking and defaulting for the host and target type. | |
404 | # The inputs are: | |
405 | # configure --host=HOST --target=TARGET UNDEFS | |
406 | # | |
407 | # The rules are: | |
408 | # 1. You aren't allowed to specify --host, --target, and undefs at the | |
409 | # same time. | |
410 | # 2. Host defaults to undefs. | |
411 | # 3. If undefs is not specified, then host defaults to the current host, | |
412 | # as determined by config.guess. | |
413 | # 4. Target defaults to undefs. | |
414 | # 5. If undefs is not specified, then target defaults to host. | |
415 | ||
416 | case "${fatal}" in | |
417 | "") | |
418 | # Make sure that host, target & undefs aren't all specified at the | |
419 | # same time. | |
420 | case $host_alias---$target_alias---$undefs in | |
421 | NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS) | |
422 | ;; | |
423 | *) echo '***' Can only configure for one host and one target at a time. 1>&2 | |
424 | fatal=yes | |
425 | break 2 | |
426 | ;; | |
427 | esac | |
428 | ||
429 | # Now, do defaulting for host. | |
430 | case $host_alias in | |
431 | NOHOST) | |
432 | case $undefs in | |
433 | NOUNDEFS) | |
434 | # Neither --host option nor undefs were present. | |
435 | # Call config.guess. | |
436 | guesssys=`echo ${progname} | sed 's/configure$/config.guess/'` | |
437 | if host_alias=`${config_shell} ${guesssys}` | |
438 | then | |
439 | # If the string we are going to use for | |
440 | # the target is a prefix of the string | |
441 | # we just guessed for the host, then | |
442 | # assume we are running native, and force | |
443 | # the same string for both target and host. | |
444 | case $target_alias in | |
445 | NOTARGET) ;; | |
446 | *) | |
447 | if expr $host_alias : $target_alias >/dev/null | |
448 | then | |
449 | host_alias=$target_alias | |
450 | fi | |
451 | ;; | |
452 | esac | |
453 | echo "Configuring for a ${host_alias} host." 1>&2 | |
454 | arguments="--host=$host_alias $arguments" | |
455 | else | |
456 | echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2 | |
457 | fatal=yes | |
458 | fi | |
459 | ;; | |
460 | *) | |
461 | host_alias=$undefs | |
462 | arguments="--host=$host_alias $arguments" | |
463 | undefs=NOUNDEFS | |
464 | ;; | |
465 | esac | |
466 | esac | |
467 | ||
468 | # Do defaulting for target. If --target option isn't present, default | |
469 | # to undefs. If undefs isn't present, default to host. | |
470 | case $target_alias in | |
471 | NOTARGET) | |
472 | case $undefs in | |
473 | NOUNDEFS) | |
474 | target_alias=$host_alias | |
475 | ;; | |
476 | *) | |
477 | target_alias=$undefs | |
478 | arguments="--target=$target_alias $arguments" | |
479 | ;; | |
480 | esac | |
481 | esac | |
482 | ;; | |
483 | *) ;; | |
484 | esac | |
485 | ||
486 | if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then | |
487 | exec 1>&2 | |
488 | echo Usage: configure [OPTIONS] [HOST] | |
489 | echo | |
490 | echo Options: [defaults in brackets] | |
491 | echo ' --prefix=MYDIR install into MYDIR [/usr/local]' | |
492 | echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]' | |
493 | echo ' --help print this message [normal config]' | |
494 | echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]' | |
495 | echo ' --host=HOST configure for HOST [determined via config.guess]' | |
496 | echo ' --norecursion configure this directory only [recurse]' | |
497 | echo ' --program-prefix=FOO prepend FOO to installed program names [""]' | |
498 | echo ' --program-suffix=FOO append FOO to installed program names [""]' | |
499 | echo ' --program-transform-name=P transform installed names by sed pattern P [""]' | |
500 | echo ' --site=SITE configure with site-specific makefile for SITE' | |
501 | echo ' --srcdir=DIR find the sources in DIR [. or ..]' | |
502 | echo ' --target=TARGET configure for TARGET [TARGET=HOST]' | |
503 | echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]' | |
504 | echo ' --nfp configure for software floating point [hard float]' | |
505 | echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)' | |
506 | echo ' --without-FOO package FOO is NOT available' | |
507 | echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)' | |
508 | echo ' --disable-FOO do not include feature FOO' | |
509 | echo | |
510 | echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.' | |
511 | echo | |
512 | if [ -r config.status ] ; then | |
513 | cat config.status | |
514 | fi | |
515 | ||
516 | exit 1 | |
517 | fi | |
518 | ||
519 | configsub=`echo ${progname} | sed 's/configure$/config.sub/'` | |
520 | moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'` | |
f1943b77 | 521 | topsrcdir=`cd \`dirname ${progname}\`; pwd` |
79c06341 | 522 | |
5d4a5ee6 | 523 | |
79c06341 JL |
524 | # this is a hack. sun4 must always be a valid host alias or this will fail. |
525 | if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then | |
526 | true | |
527 | else | |
528 | echo '***' cannot find config.sub. 1>&2 | |
529 | exit 1 | |
530 | fi | |
531 | ||
532 | touch config.junk | |
533 | if ${config_shell} ${moveifchange} config.junk config.trash ; then | |
534 | true | |
535 | else | |
536 | echo '***' cannot find move-if-change. 1>&2 | |
537 | exit 1 | |
538 | fi | |
539 | rm -f config.junk config.trash | |
540 | ||
541 | case "${srcdir}" in | |
542 | "") | |
543 | if [ -r configure.in ] ; then | |
544 | srcdir=. | |
545 | else | |
546 | if [ -r ${progname}.in ] ; then | |
547 | srcdir=`echo ${progname} | sed 's:/configure$::'` | |
548 | else | |
549 | echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2 | |
550 | exit 1 | |
551 | fi | |
552 | fi | |
553 | ;; | |
554 | *) | |
555 | # Set srcdir to "." if that's what it is. | |
556 | # This is important for multilib support. | |
557 | if [ ! -d ${srcdir} ] ; then | |
558 | echo "Invalid source directory ${srcdir}" >&2 | |
559 | exit 1 | |
560 | fi | |
561 | pwd=`pwd` | |
562 | srcpwd=`cd ${srcdir} ; pwd` | |
563 | if [ "${pwd}" = "${srcpwd}" ] ; then | |
564 | srcdir=. | |
565 | fi | |
566 | esac | |
567 | ||
568 | ### warn about some conflicting configurations. | |
569 | ||
570 | case "${srcdir}" in | |
571 | ".") ;; | |
572 | *) | |
573 | if [ -f ${srcdir}/config.status ] ; then | |
574 | echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2 | |
575 | exit 1 | |
576 | fi | |
577 | esac | |
578 | ||
579 | # default exec_prefix | |
580 | case "${exec_prefixoption}" in | |
581 | "") exec_prefix="\$(prefix)" ;; | |
582 | *) ;; | |
583 | esac | |
584 | ||
f1943b77 MH |
585 | # Define the trigger file to make sure configure will re-run whenever |
586 | # the gcc version number changes. | |
587 | if [ "${with_gcc_version_trigger+set}" = set ]; then | |
588 | gcc_version_trigger="$with_gcc_version_trigger" | |
589 | gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${with_gcc_version_trigger}` | |
590 | else | |
591 | # If gcc's sources are available, define the trigger file. | |
592 | if [ -f ${topsrcdir}/gcc/version.c ] ; then | |
593 | gcc_version_trigger=${topsrcdir}/gcc/version.c | |
594 | gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}` | |
595 | case "$arguments" in | |
596 | *--with-gcc-version-trigger=$gcc_version_trigger* ) | |
597 | ;; | |
598 | * ) | |
599 | # Make sure configure.in knows about this. | |
600 | arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments" | |
601 | ;; | |
602 | esac | |
603 | withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions" | |
604 | fi | |
605 | fi | |
606 | ||
79c06341 JL |
607 | ### break up ${srcdir}/configure.in. |
608 | case "`grep '^# per\-host:' ${srcdir}/configure.in`" in | |
609 | "") | |
610 | echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2 | |
611 | # Check for a directory that's been converted to use autoconf since | |
612 | # it was last configured. | |
613 | if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then | |
614 | echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2 | |
615 | if [ -r ${srcdir}/configure ] ; then | |
616 | echo '***' Running the local configure script. 1>&2 | |
617 | case "${cache_file}" in | |
618 | "") cache_file_option= ;; | |
619 | *) cache_file_option="--cache-file=${cache_file}" ;; | |
620 | esac | |
621 | srcdiroption="--srcdir=${srcdir}" | |
622 | case "${build_alias}" in | |
623 | "") buildopt= ;; | |
624 | *) buildopt="--build=${build_alias}" ;; | |
625 | esac | |
626 | eval exec ${config_shell} ${srcdir}/configure ${verbose} \ | |
627 | ${buildopt} --host=${host_alias} --target=${target_alias} \ | |
628 | ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \ | |
5d4a5ee6 | 629 | ${srcdiroption} ${diroptions} \ |
79c06341 JL |
630 | ${program_prefixoption} ${program_suffixoption} \ |
631 | ${program_transform_nameoption} ${site_option} \ | |
632 | ${withoptions} ${withoutoptions} \ | |
633 | ${enableoptions} ${disableoptions} ${floating_pointoption} \ | |
634 | ${cache_file_option} ${removing} ${other_options} ${redirect} | |
635 | else | |
636 | echo '***' There is no configure script present though. 1>&2 | |
637 | fi | |
638 | fi | |
639 | exit 1 | |
640 | ;; | |
641 | *) ;; | |
642 | esac | |
643 | ||
644 | case "`grep '^# per\-target:' ${srcdir}/configure.in`" in | |
645 | "") | |
646 | echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2 | |
647 | exit 1 | |
648 | ;; | |
649 | *) ;; | |
650 | esac | |
651 | ||
652 | case "${TMPDIR}" in | |
653 | "") TMPDIR=/tmp ; export TMPDIR ;; | |
654 | *) ;; | |
655 | esac | |
656 | ||
657 | # keep this filename short for &%*%$*# 14 char file names | |
658 | tmpfile=${TMPDIR}/cONf$$ | |
659 | # Note that under many versions of sh a trap handler for 0 will *override* any | |
660 | # exit status you explicitly specify! At this point, the only non-error exit | |
661 | # is at the end of the script; these actions are duplicated there, minus | |
662 | # the "exit 1". Don't use "exit 0" anywhere after this without resetting the | |
663 | # trap handler, or you'll lose. | |
664 | trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15 | |
665 | ||
666 | # split ${srcdir}/configure.in into common, per-host, per-target, | |
667 | # and post-target parts. Post-target is optional. | |
668 | sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com | |
669 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst | |
670 | if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then | |
671 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt | |
672 | sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos | |
673 | else | |
674 | sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt | |
675 | echo >${tmpfile}.pos | |
676 | fi | |
677 | ||
678 | ### do common part of configure.in | |
679 | ||
680 | . ${tmpfile}.com | |
681 | ||
682 | # some sanity checks on configure.in | |
683 | case "${srctrigger}" in | |
684 | "") | |
685 | echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2 | |
686 | exit 1 | |
687 | ;; | |
688 | *) ;; | |
689 | esac | |
690 | ||
691 | case "${build_alias}" in | |
692 | "") | |
693 | if result=`${config_shell} ${configsub} ${host_alias}` ; then | |
694 | build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` | |
695 | build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` | |
696 | build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` | |
697 | build=${build_cpu}-${build_vendor}-${build_os} | |
698 | build_alias=${host_alias} | |
699 | fi | |
700 | ;; | |
701 | *) | |
702 | if result=`${config_shell} ${configsub} ${build_alias}` ; then | |
703 | buildopt="--build=${build_alias}" | |
704 | build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` | |
705 | build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` | |
706 | build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` | |
707 | build=${build_cpu}-${build_vendor}-${build_os} | |
708 | else | |
709 | echo "Unrecognized build system name ${build_alias}." 1>&2 | |
710 | exit 1 | |
711 | fi | |
712 | ;; | |
713 | esac | |
714 | ||
715 | if result=`${config_shell} ${configsub} ${host_alias}` ; then | |
716 | true | |
717 | else | |
718 | echo "Unrecognized host system name ${host_alias}." 1>&2 | |
719 | exit 1 | |
720 | fi | |
721 | host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` | |
722 | host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` | |
723 | host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` | |
724 | host=${host_cpu}-${host_vendor}-${host_os} | |
725 | ||
726 | . ${tmpfile}.hst | |
727 | ||
728 | if result=`${config_shell} ${configsub} ${target_alias}` ; then | |
729 | true | |
730 | else | |
731 | echo "Unrecognized target system name ${target_alias}." 1>&2 | |
732 | exit 1 | |
733 | fi | |
734 | target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` | |
735 | target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` | |
736 | target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` | |
737 | target=${target_cpu}-${target_vendor}-${target_os} | |
738 | ||
739 | . ${tmpfile}.tgt | |
740 | ||
741 | # Find the source files, if location was not specified. | |
742 | case "${srcdir}" in | |
743 | "") | |
744 | srcdirdefaulted=1 | |
745 | srcdir=. | |
746 | if [ ! -r ${srctrigger} ] ; then | |
747 | srcdir=.. | |
748 | fi | |
749 | ;; | |
750 | *) ;; | |
751 | esac | |
752 | ||
753 | if [ ! -r ${srcdir}/${srctrigger} ] ; then | |
754 | case "${srcdirdefaulted}" in | |
755 | "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;; | |
756 | *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;; | |
757 | esac | |
758 | ||
759 | echo '***' \(At least ${srctrigger} is missing.\) 1>&2 | |
760 | exit 1 | |
761 | fi | |
762 | ||
763 | # Some systems (e.g., one of the i386-aix systems the gas testers are | |
764 | # using) don't handle "\$" correctly, so don't use it here. | |
765 | tooldir='$(exec_prefix)'/${target_alias} | |
766 | ||
767 | if [ "${host_alias}" != "${target_alias}" ] ; then | |
768 | if [ "${program_prefixoption}" = "" ] ; then | |
769 | if [ "${program_suffixoption}" = "" ] ; then | |
770 | if [ "${program_transform_nameoption}" = "" ] ; then | |
771 | program_prefix=${target_alias}- ; | |
772 | fi | |
773 | fi | |
774 | fi | |
775 | fi | |
776 | ||
777 | # Merge program_prefix and program_suffix onto program_transform_name. | |
778 | # (program_suffix used to use $, but it's hard to preserve $ through both | |
779 | # make and sh.) | |
780 | if [ "${program_suffix}" != "" ] ; then | |
781 | program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}" | |
782 | fi | |
783 | ||
784 | if [ "${program_prefix}" != "" ] ; then | |
785 | program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}" | |
786 | fi | |
787 | ||
788 | # If CC and CXX are not set in the environment, and the Makefile | |
789 | # exists, try to extract them from it. This is to handle running | |
790 | # ./config.status by hand. | |
5d4a5ee6 | 791 | if [ -z "${CC}" ] && [ -r Makefile ]; then |
79c06341 JL |
792 | sed -n -e ':loop |
793 | /\\$/ N | |
794 | s/\\\n//g | |
795 | t loop | |
796 | /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc | |
797 | CC=`tail -1 Makefile.cc` | |
798 | rm -f Makefile.cc | |
799 | fi | |
800 | ||
5d4a5ee6 | 801 | if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then |
79c06341 JL |
802 | sed -n -e ':loop |
803 | /\\$/ N | |
804 | s/\\\n//g | |
805 | t loop | |
806 | /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc | |
807 | CFLAGS=`tail -1 Makefile.cc` | |
808 | rm -f Makefile.cc | |
809 | fi | |
810 | ||
5d4a5ee6 | 811 | if [ -z "${CXX}" ] && [ -r Makefile ]; then |
79c06341 JL |
812 | sed -n -e ':loop |
813 | /\\$/ N | |
814 | s/\\\n//g | |
815 | t loop | |
816 | /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc | |
817 | CXX=`tail -1 Makefile.cc` | |
818 | rm -f Makefile.cc | |
819 | fi | |
820 | ||
5d4a5ee6 | 821 | if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then |
79c06341 JL |
822 | sed -n -e ':loop |
823 | /\\$/ N | |
824 | s/\\\n//g | |
825 | t loop | |
826 | /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc | |
827 | CXXFLAGS=`tail -1 Makefile.cc` | |
828 | rm -f Makefile.cc | |
829 | fi | |
830 | ||
831 | # Generate a default definition for YACC. This is used if the makefile can't | |
832 | # locate bison or byacc in objdir. | |
833 | ||
834 | for prog in 'bison -y' byacc yacc | |
835 | do | |
836 | set dummy $prog; tmp=$2 | |
837 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
838 | for dir in $PATH; do | |
839 | test -z "$dir" && dir=. | |
840 | if test -f $dir/$tmp; then | |
841 | DEFAULT_YACC="$prog" | |
842 | break | |
843 | fi | |
844 | done | |
845 | IFS="$save_ifs" | |
846 | ||
847 | test -n "$DEFAULT_YACC" && break | |
848 | done | |
849 | ||
ec8d6ddc KW |
850 | # Generate a default definition for M4. This is used if the makefile can't |
851 | # locate m4 in objdir. | |
852 | ||
853 | for prog in gm4 gnum4 m4 | |
854 | do | |
855 | set dummy $prog; tmp=$2 | |
856 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
857 | for dir in $PATH; do | |
858 | test -z "$dir" && dir=. | |
859 | if test -f $dir/$tmp; then | |
860 | DEFAULT_M4="$prog" | |
861 | break | |
862 | fi | |
863 | done | |
864 | IFS="$save_ifs" | |
865 | ||
866 | test -n "$DEFAULT_M4" && break | |
867 | done | |
868 | ||
79c06341 JL |
869 | # Generate a default definition for LEX. This is used if the makefile can't |
870 | # locate flex in objdir. | |
871 | ||
872 | for prog in flex lex | |
873 | do | |
874 | set dummy $prog; tmp=$2 | |
875 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
876 | for dir in $PATH; do | |
877 | test -z "$dir" && dir=. | |
878 | if test -f $dir/$tmp; then | |
879 | DEFAULT_LEX="$prog" | |
880 | break | |
881 | fi | |
882 | done | |
883 | IFS="$save_ifs" | |
884 | ||
885 | test -n "$DEFAULT_LEX" && break | |
886 | done | |
887 | ||
888 | if [ "${build}" != "${host}" ]; then | |
889 | # If we are doing a Canadian Cross, in which the host and build systems | |
890 | # are not the same, we set reasonable default values for the tools. | |
891 | ||
892 | tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD" | |
893 | tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET" | |
894 | tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX" | |
895 | tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM" | |
896 | tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET" | |
897 | tools="${tools} WINDRES WINDRES_FOR_TARGET YACC" | |
898 | ||
899 | for var in ${tools}; do | |
5d4a5ee6 | 900 | if [ -z "`eval 'echo $'"${var}"`" ] && [ -r Makefile ]; then |
79c06341 JL |
901 | sed -n -e ':loop |
902 | /\\$/ N | |
903 | s/\\\n//g | |
904 | t loop | |
905 | /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \ | |
906 | < Makefile > Makefile.v | |
907 | t=`tail -1 Makefile.v` | |
908 | if [ -n "${t}" ]; then | |
909 | eval "${var}='${t}'" | |
910 | fi | |
911 | rm -f Makefile.v | |
912 | fi | |
913 | done | |
914 | ||
915 | AR=${AR-${host_alias}-ar} | |
916 | AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar} | |
917 | AS=${AS-${host_alias}-as} | |
918 | AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as} | |
919 | BISON=${BISON-bison} | |
920 | CC=${CC-${host_alias}-gcc} | |
921 | CFLAGS=${CFLAGS-"-g -O2"} | |
922 | CXX=${CXX-${host_alias}-c++} | |
923 | CXXFLAGS=${CXXFLAGS-"-g -O2"} | |
924 | CC_FOR_BUILD=${CC_FOR_BUILD-gcc} | |
925 | CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc} | |
926 | CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++} | |
927 | DLLTOOL=${DLLTOOL-${host_alias}-dlltool} | |
928 | DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool} | |
929 | GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}} | |
930 | HOST_PREFIX=${build_alias}- | |
931 | HOST_PREFIX_1=${build_alias}- | |
932 | LD=${LD-${host_alias}-ld} | |
933 | LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld} | |
934 | MAKEINFO=${MAKEINFO-makeinfo} | |
935 | NM=${NM-${host_alias}-nm} | |
936 | NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm} | |
937 | RANLIB=${RANLIB-${host_alias}-ranlib} | |
938 | RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib} | |
939 | WINDRES=${WINDRES-${host_alias}-windres} | |
940 | WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres} | |
941 | ||
942 | if [ -z "${YACC}" ]; then | |
943 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
944 | for dir in $PATH; do | |
945 | test -z "$dir" && dir=. | |
946 | if test -f $dir/bison; then | |
947 | YACC="bison -y" | |
948 | break | |
949 | fi | |
950 | if test -f $dir/byacc; then | |
951 | YACC=byacc | |
952 | break | |
953 | fi | |
954 | if test -f $dir/yacc; then | |
955 | YACC=yacc | |
956 | break | |
957 | fi | |
958 | done | |
959 | IFS="$save_ifs" | |
960 | if [ -z "${YACC}" ]; then | |
961 | YACC="bison -y" | |
962 | fi | |
963 | fi | |
964 | ||
965 | if [ -z "${LEX}" ]; then | |
966 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
967 | for dir in $PATH; do | |
968 | test -z "$dir" && dir=. | |
969 | if test -f $dir/flex; then | |
970 | LEX=flex | |
971 | break | |
972 | fi | |
973 | if test -f $dir/lex; then | |
974 | LEX=lex | |
975 | break | |
976 | fi | |
977 | done | |
978 | IFS="$save_ifs" | |
979 | LEX=${LEX-flex} | |
980 | fi | |
981 | ||
982 | # Export variables which autoconf might try to set. | |
983 | export AS | |
984 | export AR | |
985 | export CC_FOR_BUILD | |
986 | export DLLTOOL | |
987 | export LD | |
988 | export NM | |
989 | export RANLIB | |
990 | export WINDRES | |
991 | else | |
992 | # If CC is still not set, try to get gcc. | |
993 | if [ -z "${CC}" ]; then | |
994 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
995 | for dir in $PATH; do | |
996 | test -z "$dir" && dir=. | |
997 | if test -f $dir/gcc; then | |
998 | CC="gcc" | |
999 | echo 'void f(){}' > conftest.c | |
1000 | if test -z "`${CC} -g -c conftest.c 2>&1`"; then | |
1001 | CFLAGS=${CFLAGS-"-g -O2"} | |
62441128 | 1002 | CXXFLAGS=${CXXFLAGS-"-g -O2"} |
79c06341 JL |
1003 | else |
1004 | CFLAGS=${CFLAGS-"-O2"} | |
62441128 | 1005 | CXXFLAGS=${CXXFLAGS-"-O2"} |
79c06341 JL |
1006 | fi |
1007 | rm -f conftest* | |
1008 | break | |
1009 | fi | |
1010 | done | |
1011 | IFS="$save_ifs" | |
1012 | CC=${CC-cc} | |
5d4a5ee6 JL |
1013 | else |
1014 | if test -z "${CFLAGS}"; then | |
1015 | # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC | |
1016 | # is set to a version of gcc. | |
1017 | case "${CC}" in | |
1018 | *gcc) | |
1019 | echo 'void f(){}' > conftest.c | |
1020 | if test -z "`${CC} -g -c conftest.c 2>&1`"; then | |
1021 | CFLAGS=${CFLAGS-"-g -O2"} | |
1022 | CXXFLAGS=${CXXFLAGS-"-g -O2"} | |
1023 | else | |
1024 | CFLAGS=${CFLAGS-"-O2"} | |
1025 | CXXFLAGS=${CXXFLAGS-"-O2"} | |
1026 | fi | |
1027 | rm -f conftest* | |
1028 | ;; | |
1029 | esac | |
1030 | fi | |
79c06341 JL |
1031 | fi |
1032 | ||
1033 | CXX=${CXX-"c++"} | |
1034 | CFLAGS=${CFLAGS-"-g"} | |
1035 | CXXFLAGS=${CXXFLAGS-"-g -O2"} | |
1036 | fi | |
1037 | ||
1038 | export CC | |
1039 | export CXX | |
1040 | export CFLAGS | |
1041 | export CXXFLAGS | |
1042 | ||
1043 | # FIXME: This should be in configure.in, not configure | |
1044 | case "$host" in | |
1045 | *go32*) | |
1046 | enable_gdbtk=no ;; | |
1047 | *msdosdjgpp*) | |
1048 | enable_gdbtk=no ;; | |
1049 | *cygwin32*) | |
1050 | enable_gdbtk=no ;; | |
1051 | esac | |
1052 | ||
1053 | # FIXME: This should be in configure.in, not configure | |
1054 | # Determine whether gdb needs tk/tcl or not. | |
1055 | if [ "$enable_gdbtk" != "no" ]; then | |
1056 | GDB_TK="all-tcl all-tk all-itcl all-tix" | |
1057 | else | |
1058 | GDB_TK="" | |
1059 | fi | |
1060 | ||
1061 | for subdir in . ${subdirs} ; do | |
1062 | ||
1063 | # ${subdir} is relative path from . to the directory we're currently | |
1064 | # configuring. | |
1065 | # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed. | |
1066 | invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'` | |
1067 | ||
1068 | ### figure out what to do with srcdir | |
1069 | case "${srcdir}" in | |
1070 | ".") # no -srcdir option. We're building in place. | |
1071 | makesrcdir=. ;; | |
1072 | /*) # absolute path | |
1073 | makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'` | |
1074 | ;; | |
1075 | *) # otherwise relative | |
1076 | case "${subdir}" in | |
1077 | .) makesrcdir=${srcdir} ;; | |
1078 | *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;; | |
1079 | esac | |
1080 | ;; | |
1081 | esac | |
1082 | ||
1083 | if [ "${subdir}/" != "./" ] ; then | |
1084 | Makefile=${subdir}/Makefile | |
1085 | fi | |
1086 | ||
1087 | if [ ! -d ${subdir} ] ; then | |
1088 | if mkdir ${subdir} ; then | |
1089 | true | |
1090 | else | |
1091 | echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2 | |
1092 | exit 1 | |
1093 | fi | |
1094 | fi | |
1095 | ||
1096 | case "${removing}" in | |
1097 | "") | |
1098 | case "${subdir}" in | |
1099 | .) ;; | |
1100 | *) eval echo Building in ${subdir} ${redirect} ;; | |
1101 | esac | |
1102 | ||
1103 | # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest) | |
1104 | # Set up the list of links to be made. | |
1105 | # ${links} is the list of link names, and ${files} is the list of names to link to. | |
1106 | ||
1107 | # Make the links. | |
1108 | configlinks="${links}" | |
1109 | if [ -r ${subdir}/config.status ] ; then | |
1110 | mv -f ${subdir}/config.status ${subdir}/config.back | |
1111 | fi | |
1112 | while [ -n "${files}" ] ; do | |
1113 | # set file to car of files, files to cdr of files | |
1114 | set ${files}; file=$1; shift; files=$* | |
1115 | set ${links}; link=$1; shift; links=$* | |
1116 | ||
1117 | if [ ! -r ${srcdir}/${file} ] ; then | |
bd064fd5 L |
1118 | if [ ! -r ${file} ] ; then |
1119 | ||
79c06341 JL |
1120 | echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 |
1121 | echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2 | |
1122 | exit 1 | |
bd064fd5 L |
1123 | else |
1124 | srcfile=${file} | |
1125 | fi | |
1126 | else | |
1127 | srcfile=${srcdir}/${file} | |
79c06341 JL |
1128 | fi |
1129 | ||
1130 | ${remove} -f ${link} | |
1131 | # Make a symlink if possible, otherwise try a hard link | |
bd064fd5 | 1132 | if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then |
79c06341 JL |
1133 | true |
1134 | else | |
1135 | # We need to re-remove the file because Lynx leaves a | |
1136 | # very strange directory there when it fails an NFS symlink. | |
1137 | ${remove} -r -f ${link} | |
bd064fd5 | 1138 | ${hard_link} ${srcfile} ${link} |
79c06341 JL |
1139 | fi |
1140 | if [ ! -r ${link} ] ; then | |
bd064fd5 | 1141 | echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2 |
79c06341 JL |
1142 | exit 1 |
1143 | fi | |
1144 | ||
bd064fd5 | 1145 | echo "Linked \"${link}\" to \"${srcfile}\"." |
79c06341 JL |
1146 | done |
1147 | ||
1148 | # Create a .gdbinit file which runs the one in srcdir | |
1149 | # and tells GDB to look there for source files. | |
1150 | ||
1151 | if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then | |
1152 | case ${srcdir} in | |
1153 | .) ;; | |
1154 | *) cat > ${subdir}/.gdbinit <<EOF | |
1155 | # ${NO_EDIT} | |
1156 | dir ${makesrcdir} | |
1157 | dir . | |
1158 | source ${makesrcdir}/.gdbinit | |
1159 | EOF | |
1160 | ;; | |
1161 | esac | |
1162 | fi | |
1163 | ||
1164 | # Install a makefile, and make it set VPATH | |
1165 | # if necessary so that the sources are found. | |
1166 | # Also change its value of srcdir. | |
1167 | # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has | |
1168 | # been somewhat optimized and is perhaps a bit twisty. | |
1169 | ||
1170 | # code is order so as to try to sed the smallest input files we know. | |
59739e3c | 1171 | # so do these separately because I don't trust the order of sed -e expressions. |
79c06341 | 1172 | |
59739e3c MH |
1173 | # the five makefile fragments MUST end up in the resulting Makefile in this order: |
1174 | # package macros, target, host, site, and package rules. | |
79c06341 JL |
1175 | |
1176 | if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then | |
1177 | ||
59739e3c MH |
1178 | # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem. |
1179 | rm -f ${subdir}/${Makefile}.tem | |
1180 | case "${package_makefile_rules_frag}" in | |
1181 | "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;; | |
1182 | *) | |
1183 | if [ ! -f ${package_makefile_rules_frag} ] ; then | |
1184 | package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag} | |
1185 | fi | |
1186 | if [ -f ${package_makefile_rules_frag} ] ; then | |
1187 | sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem | |
1188 | else | |
1189 | echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2 | |
1190 | echo '***' is missing in ${PWD=`pwd`}. 1>&2 | |
1191 | cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem | |
1192 | fi | |
1193 | esac | |
1194 | # working copy now in ${Makefile}.tem | |
1195 | ||
79c06341 JL |
1196 | # Conditionalize for this site. |
1197 | rm -f ${Makefile} | |
59739e3c MH |
1198 | case "${site}" in |
1199 | "") mv ${subdir}/Makefile.tem ${Makefile} ;; | |
79c06341 JL |
1200 | *) |
1201 | site_makefile_frag=${srcdir}/config/ms-${site} | |
1202 | ||
1203 | if [ -f ${site_makefile_frag} ] ; then | |
59739e3c MH |
1204 | sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \ |
1205 | > ${Makefile} | |
79c06341 | 1206 | else |
59739e3c | 1207 | mv ${subdir}/Makefile.tem ${Makefile} |
79c06341 JL |
1208 | site_makefile_frag= |
1209 | fi | |
1210 | ;; | |
1211 | esac | |
1212 | # working copy now in ${Makefile} | |
1213 | ||
1214 | # Conditionalize the makefile for this host. | |
1215 | rm -f ${subdir}/Makefile.tem | |
1216 | case "${host_makefile_frag}" in | |
1217 | "") mv ${Makefile} ${subdir}/Makefile.tem ;; | |
1218 | *) | |
1219 | if [ ! -f ${host_makefile_frag} ] ; then | |
1220 | host_makefile_frag=${srcdir}/${host_makefile_frag} | |
1221 | fi | |
1222 | if [ -f ${host_makefile_frag} ] ; then | |
1223 | sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem | |
1224 | else | |
1225 | echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2 | |
1226 | echo '***' is missing in ${PWD=`pwd`}. 1>&2 | |
1227 | mv ${Makefile} ${subdir}/Makefile.tem | |
1228 | fi | |
1229 | esac | |
1230 | # working copy now in ${subdir)/Makefile.tem | |
1231 | ||
1232 | # Conditionalize the makefile for this target. | |
1233 | rm -f ${Makefile} | |
1234 | case "${target_makefile_frag}" in | |
1235 | "") mv ${subdir}/Makefile.tem ${Makefile} ;; | |
1236 | *) | |
1237 | if [ ! -f ${target_makefile_frag} ] ; then | |
1238 | target_makefile_frag=${srcdir}/${target_makefile_frag} | |
1239 | fi | |
1240 | if [ -f ${target_makefile_frag} ] ; then | |
1241 | sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile} | |
1242 | else | |
1243 | mv ${subdir}/Makefile.tem ${Makefile} | |
1244 | target_makefile_frag= | |
1245 | fi | |
1246 | ;; | |
1247 | esac | |
efd4c0ba MH |
1248 | # working copy now in ${Makefile} |
1249 | ||
59739e3c MH |
1250 | # Emit the default values of this package's macros. |
1251 | rm -f ${subdir}/Makefile.tem | |
efd4c0ba MH |
1252 | case "${package_makefile_frag}" in |
1253 | "") mv ${Makefile} ${subdir}/Makefile.tem ;; | |
1254 | *) | |
1255 | if [ ! -f ${package_makefile_frag} ] ; then | |
1256 | package_makefile_frag=${srcdir}/${package_makefile_frag} | |
1257 | fi | |
1258 | if [ -f ${package_makefile_frag} ] ; then | |
59739e3c | 1259 | sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem |
efd4c0ba | 1260 | else |
59739e3c | 1261 | echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2 |
efd4c0ba MH |
1262 | echo '***' is missing in ${PWD=`pwd`}. 1>&2 |
1263 | mv ${Makefile} ${subdir}/Makefile.tem | |
1264 | fi | |
1265 | esac | |
79c06341 JL |
1266 | # real copy now in ${subdir}/Makefile.tem |
1267 | ||
1268 | # prepend warning about editting, and a bunch of variables. | |
1269 | rm -f ${Makefile} | |
1270 | cat > ${Makefile} <<EOF | |
1271 | # ${NO_EDIT} | |
1272 | VPATH = ${makesrcdir} | |
1273 | links = ${configlinks} | |
1274 | host_alias = ${host_alias} | |
1275 | host_cpu = ${host_cpu} | |
1276 | host_vendor = ${host_vendor} | |
1277 | host_os = ${host_os} | |
1278 | host_canonical = ${host_cpu}-${host_vendor}-${host_os} | |
1279 | target_alias = ${target_alias} | |
1280 | target_cpu = ${target_cpu} | |
1281 | target_vendor = ${target_vendor} | |
1282 | target_os = ${target_os} | |
1283 | target_canonical = ${target_cpu}-${target_vendor}-${target_os} | |
1284 | EOF | |
1285 | case "${build}" in | |
1286 | "") ;; | |
1287 | *) cat >> ${Makefile} << EOF | |
1288 | build_alias = ${build_alias} | |
1289 | build_cpu = ${build_cpu} | |
1290 | build_vendor = ${build_vendor} | |
1291 | build_os = ${build_os} | |
1292 | build_canonical = ${build_cpu}-${build_vendor}-${build_os} | |
1293 | EOF | |
1294 | esac | |
1295 | ||
1296 | case "${package_makefile_frag}" in | |
1297 | "") ;; | |
1298 | /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;; | |
1299 | *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;; | |
1300 | esac | |
1301 | ||
1302 | case "${target_makefile_frag}" in | |
1303 | "") ;; | |
1304 | /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;; | |
1305 | *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;; | |
1306 | esac | |
1307 | ||
1308 | case "${host_makefile_frag}" in | |
1309 | "") ;; | |
1310 | /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;; | |
1311 | *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;; | |
1312 | esac | |
1313 | ||
1314 | if [ "${site_makefile_frag}" != "" ] ; then | |
1315 | echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile} | |
1316 | fi | |
1317 | ||
1318 | # provide a proper gxx_include_dir to all subdirs. | |
1319 | # Note, if you change the default, make sure to fix both here | |
1320 | # and in the gcc subdirectory. | |
0ce065bd MH |
1321 | # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. |
1322 | gxx_include_dir= | |
1323 | if test -n "${with_gxx_include_dir}"; then | |
1324 | case "${with_gxx_include_dir}" in | |
1325 | yes ) | |
1326 | echo "configure: error: bad value ${withval} given for g++ include directory" 1>&2 | |
1327 | exit 1 | |
1328 | ;; | |
1329 | no ) | |
1330 | ;; | |
1331 | * ) | |
1332 | gxx_include_dir=${with_gxx_include_dir} | |
1333 | ;; | |
1334 | esac | |
1335 | fi | |
1336 | if test x${gxx_include_dir} = x; then | |
e0cb250f MH |
1337 | if test x${enable_version_specific_runtime_libs} = xyes; then |
1338 | echo gxx_include_dir = '${libsubdir}/include/g++' >> ${Makefile} | |
1339 | else | |
a3cbd105 L |
1340 | . ${topsrcdir}/config.if |
1341 | echo gxx_include_dir = '${prefix}/include/g++'-${libstdcxx_interface} >> ${Makefile} | |
e0cb250f | 1342 | fi |
79c06341 | 1343 | else |
0ce065bd | 1344 | echo gxx_include_dir = ${gxx_include_dir} >> ${Makefile} |
79c06341 JL |
1345 | fi |
1346 | ||
4e77e8f1 MH |
1347 | # record if we want to build shared libs. |
1348 | if test -z "${enable_shared}"; then | |
1349 | echo enable_shared = no >> ${Makefile} | |
1350 | else | |
1351 | echo enable_shared = ${enable_shared} >> ${Makefile} | |
1352 | fi | |
e0cb250f MH |
1353 | # record if we want to rumtime library stuff installed in libsubdir. |
1354 | if test -z "${enable_version_specific_runtime_libs}"; then | |
1355 | echo enable_version_specific_runtime_libs = no >> ${Makefile} | |
1356 | else | |
1357 | echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile} | |
1358 | fi | |
4e77e8f1 | 1359 | |
f1943b77 MH |
1360 | # Emit a macro which describes the file containing gcc's |
1361 | # version number. | |
1362 | echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile} | |
1363 | # And emit a macro defining gcc's version number. | |
0ce2489a MH |
1364 | echo gcc_version = ${gcc_version} >> ${Makefile} |
1365 | ||
79c06341 JL |
1366 | # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS, |
1367 | # remove any form feeds. | |
1368 | if [ -z "${subdirs}" ]; then | |
1369 | rm -f ${subdir}/Makefile.tm2 | |
1370 | sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \ | |
1371 | -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \ | |
1372 | ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2 | |
1373 | rm -f ${subdir}/Makefile.tem | |
1374 | mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem | |
1375 | fi | |
1376 | sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \ | |
1377 | -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \ | |
5d4a5ee6 JL |
1378 | -e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \ |
1379 | -e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \ | |
1380 | -e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \ | |
1381 | -e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \ | |
1382 | -e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \ | |
1383 | -e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \ | |
1384 | -e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \ | |
1385 | -e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \ | |
1386 | -e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \ | |
1387 | -e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \ | |
1388 | -e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \ | |
1389 | -e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \ | |
79c06341 JL |
1390 | -e "/^CC[ ]*=/{ |
1391 | :loop1 | |
1392 | /\\\\$/ N | |
1393 | s/\\\\\\n//g | |
1394 | t loop1 | |
1395 | s%^CC[ ]*=.*$%CC = ${CC}% | |
1396 | }" \ | |
1397 | -e "/^CXX[ ]*=/{ | |
1398 | :loop2 | |
1399 | /\\\\$/ N | |
1400 | s/\\\\\\n//g | |
1401 | t loop2 | |
1402 | s%^CXX[ ]*=.*$%CXX = ${CXX}% | |
1403 | }" \ | |
1404 | -e "/^CFLAGS[ ]*=/{ | |
1405 | :loop3 | |
1406 | /\\\\$/ N | |
1407 | s/\\\\\\n//g | |
1408 | t loop3 | |
1409 | s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}% | |
1410 | }" \ | |
1411 | -e "/^CXXFLAGS[ ]*=/{ | |
1412 | :loop4 | |
1413 | /\\\\$/ N | |
1414 | s/\\\\\\n//g | |
1415 | t loop4 | |
1416 | s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}% | |
1417 | }" \ | |
1418 | -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \ | |
1419 | -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" \ | |
1420 | -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \ | |
1421 | -e "s/\f//" \ | |
1422 | -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \ | |
1423 | -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \ | |
1424 | -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \ | |
1425 | -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \ | |
1426 | -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \ | |
1427 | -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \ | |
ec8d6ddc | 1428 | -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \ |
79c06341 JL |
1429 | ${subdir}/Makefile.tem >> ${Makefile} |
1430 | ||
1431 | # If this is a Canadian Cross, preset the values of many more | |
1432 | # tools. | |
1433 | if [ "${build}" != "${host}" ]; then | |
1434 | for var in ${tools}; do | |
1435 | val=`eval 'echo $'"${var}"` | |
1436 | sed -e "/^${var}[ ]*=/{ | |
1437 | :loop1 | |
1438 | /\\\\$/ N | |
1439 | /\\\\$/ b loop1 | |
1440 | s/\\\\\\n//g | |
1441 | s%^${var}[ ]*=.*$%${var} = ${val}% | |
1442 | }" ${Makefile} > ${Makefile}.tem | |
1443 | mv -f ${Makefile}.tem ${Makefile} | |
1444 | done | |
1445 | fi | |
1446 | ||
1447 | # final copy now in ${Makefile} | |
1448 | ||
1449 | else | |
1450 | echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2 | |
1451 | fi | |
1452 | ||
1453 | rm -f ${subdir}/Makefile.tem | |
1454 | ||
1455 | case "${host_makefile_frag}" in | |
1456 | "") using= ;; | |
1457 | *) using="and \"${host_makefile_frag}\"" ;; | |
1458 | esac | |
1459 | ||
1460 | case "${target_makefile_frag}" in | |
1461 | "") ;; | |
1462 | *) using="${using} and \"${target_makefile_frag}\"" ;; | |
1463 | esac | |
1464 | ||
1465 | case "${site_makefile_frag}" in | |
1466 | "") ;; | |
1467 | *) using="${using} and \"${site_makefile_frag}\"" ;; | |
1468 | esac | |
1469 | ||
1470 | newusing=`echo "${using}" | sed 's/and/using/'` | |
1471 | using=${newusing} | |
1472 | echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using} | |
1473 | ||
1474 | . ${tmpfile}.pos | |
1475 | ||
1476 | # describe the chosen configuration in config.status. | |
1477 | # Make that file a shellscript which will reestablish | |
1478 | # the same configuration. Used in Makefiles to rebuild | |
1479 | # Makefiles. | |
1480 | ||
1481 | case "${norecursion}" in | |
1482 | "") arguments="${arguments} --norecursion" ;; | |
1483 | *) ;; | |
1484 | esac | |
1485 | ||
1486 | if [ ${subdir} = . ] ; then | |
1487 | echo "#!/bin/sh | |
1488 | # ${NO_EDIT} | |
1489 | # This directory was configured as follows: | |
1490 | ${progname}" ${arguments} " | |
1491 | # ${using}" > ${subdir}/config.new | |
1492 | else | |
1493 | echo "#!/bin/sh | |
1494 | # ${NO_EDIT} | |
1495 | # This directory was configured as follows: | |
1496 | cd ${invsubdir} | |
1497 | ${progname}" ${arguments} " | |
1498 | # ${using}" > ${subdir}/config.new | |
1499 | fi | |
1500 | chmod a+x ${subdir}/config.new | |
1501 | if [ -r ${subdir}/config.back ] ; then | |
1502 | mv -f ${subdir}/config.back ${subdir}/config.status | |
1503 | fi | |
1504 | ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status | |
1505 | ;; | |
1506 | ||
1507 | *) rm -f ${Makefile} ${subdir}/config.status ${links} ;; | |
1508 | esac | |
1509 | done | |
1510 | ||
1511 | # If there are subdirectories, then recur. | |
5d4a5ee6 JL |
1512 | if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then |
1513 | for configdir in ${configdirs} ${extraconfigdirs} ; do | |
1514 | ||
1515 | # If configdir contains ',' it is | |
1516 | # srcdir,builddir,target_alias | |
1517 | # These come from extraconfigdirs. | |
1518 | case ${configdir} in | |
1519 | *,*) | |
1520 | eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'` | |
1521 | ;; | |
1522 | *) | |
1523 | cfg_dir=${configdir} | |
1524 | bld_dir=${configdir} | |
1525 | tgt_alias=${target_alias} | |
1526 | ;; | |
1527 | esac | |
79c06341 | 1528 | |
5d4a5ee6 | 1529 | if [ -d ${srcdir}/${cfg_dir} ] ; then |
79c06341 JL |
1530 | eval echo Configuring ${configdir}... ${redirect} |
1531 | case "${srcdir}" in | |
1532 | ".") ;; | |
1533 | *) | |
5d4a5ee6 JL |
1534 | if [ ! -d ./${bld_dir} ] ; then |
1535 | if mkdir ./${bld_dir} ; then | |
79c06341 JL |
1536 | true |
1537 | else | |
5d4a5ee6 | 1538 | echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2 |
79c06341 JL |
1539 | exit 1 |
1540 | fi | |
1541 | fi | |
1542 | ;; | |
1543 | esac | |
1544 | ||
1545 | POPDIR=${PWD=`pwd`} | |
5d4a5ee6 | 1546 | cd ${bld_dir} |
79c06341 JL |
1547 | |
1548 | ### figure out what to do with srcdir | |
1549 | case "${srcdir}" in | |
1550 | ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place. | |
1551 | /*) # absolute path | |
5d4a5ee6 | 1552 | newsrcdir=${srcdir}/${cfg_dir} |
79c06341 JL |
1553 | srcdiroption="--srcdir=${newsrcdir}" |
1554 | ;; | |
1555 | ?:*) # absolute path on win32 | |
5d4a5ee6 | 1556 | newsrcdir=${srcdir}/${cfg_dir} |
79c06341 JL |
1557 | srcdiroption="--srcdir=${newsrcdir}" |
1558 | ;; | |
1559 | *) # otherwise relative | |
5d4a5ee6 | 1560 | newsrcdir=../${srcdir}/${cfg_dir} |
79c06341 JL |
1561 | srcdiroption="--srcdir=${newsrcdir}" |
1562 | ;; | |
1563 | esac | |
1564 | ||
1565 | # Handle --cache-file=../XXX | |
1566 | case "${cache_file}" in | |
1567 | "") # empty | |
1568 | ;; | |
1569 | /*) # absolute path | |
1570 | cache_file_option="--cache-file=${cache_file}" | |
1571 | ;; | |
1572 | ?:*) # absolute path on win32 | |
1573 | cache_file_option="--cache-file=${cache_file}" | |
1574 | ;; | |
1575 | *) # relative path | |
1576 | cache_file_option="--cache-file=../${cache_file}" | |
1577 | ;; | |
1578 | esac | |
1579 | ||
1580 | ### check for guested configure, otherwise fix possibly relative progname | |
1581 | if [ -f ${newsrcdir}/configure ] ; then | |
1582 | recprog=${newsrcdir}/configure | |
1583 | elif [ -f ${newsrcdir}/configure.in ] ; then | |
1584 | case "${progname}" in | |
1585 | /*) recprog=${progname} ;; | |
1586 | ?:*) recprog=${progname} ;; | |
1587 | *) recprog=../${progname} ;; | |
1588 | esac | |
1589 | else | |
5d4a5ee6 | 1590 | eval echo No configuration information in ${cfg_dir} ${redirect} |
79c06341 JL |
1591 | recprog= |
1592 | fi | |
1593 | ||
1594 | ### The recursion line is here. | |
1595 | if [ ! -z "${recprog}" ] ; then | |
5d4a5ee6 | 1596 | if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \ |
79c06341 | 1597 | ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \ |
5d4a5ee6 | 1598 | ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then |
79c06341 JL |
1599 | true |
1600 | else | |
1601 | echo Configure in `pwd` failed, exiting. 1>&2 | |
1602 | exit 1 | |
1603 | fi | |
1604 | fi | |
1605 | ||
1606 | cd ${POPDIR} | |
1607 | fi | |
1608 | done | |
1609 | fi | |
1610 | ||
1611 | # Perform the same cleanup as the trap handler, minus the "exit 1" of course, | |
1612 | # and reset the trap handler. | |
1613 | rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos | |
1614 | trap 0 | |
1615 | ||
1616 | exit 0 | |
1617 | ||
1618 | # | |
1619 | # Local Variables: | |
1620 | # fill-column: 131 | |
1621 | # End: | |
1622 | # | |
1623 | ||
1624 | # end of configure |