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