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