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