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