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