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