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