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