]>
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 | |
9336e47e | 20 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
eb02fd64 | 21 | |
49b10446 RP |
22 | # Please email any bugs, comments, and/or additions to this file to: |
23 | # [email protected] | |
24 | ||
c1e4672c RP |
25 | # This file was written by K. Richard Pixley. |
26 | ||
eb02fd64 RP |
27 | # |
28 | # Shell script to create proper links to machine-dependent files in | |
0df06ca0 | 29 | # preparation for compilation. |
eb02fd64 RP |
30 | # |
31 | # If configure succeeds, it leaves its status in config.status. | |
32 | # If configure fails after disturbing the status quo, | |
73f1f5ba | 33 | # config.status is removed. |
eb02fd64 RP |
34 | # |
35 | ||
4d714963 | 36 | export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$) |
c297d71e | 37 | |
eb02fd64 RP |
38 | remove=rm |
39 | hard_link=ln | |
40 | symbolic_link='ln -s' | |
41 | ||
42 | #for Test | |
43 | #remove="echo rm" | |
44 | #hard_link="echo ln" | |
45 | #symbolic_link="echo ln -s" | |
46 | ||
47 | # clear some things potentially inherited from environment. | |
6f8ac2d9 RP |
48 | |
49 | Makefile=Makefile | |
50 | Makefile_in=Makefile.in | |
b8f8fddc | 51 | arguments=$* |
24845456 | 52 | build_alias= |
6f8ac2d9 | 53 | configdirs= |
c1e4672c RP |
54 | exec_prefix= |
55 | exec_prefixoption= | |
0df06ca0 | 56 | fatal= |
4d714963 RP |
57 | floating_point=default |
58 | gas=default | |
24845456 | 59 | host_alias=NOHOST |
3a07a6ac | 60 | host_makefile_frag= |
a98e98d3 | 61 | moveifchange= |
46766962 | 62 | norecursion= |
9336e47e | 63 | other_options= |
34bdab16 | 64 | package_makefile_frag= |
4d714963 | 65 | prefix=/usr/local |
49b10446 | 66 | progname= |
c1e4672c | 67 | program_prefix= |
c5108322 ILT |
68 | program_prefixoption= |
69 | program_suffix= | |
70 | program_suffixoption= | |
71 | program_transform_name= | |
72 | program_transform_nameoption= | |
a98e98d3 RP |
73 | redirect=">/dev/null" |
74 | removing= | |
0e693d0b | 75 | site= |
3a07a6ac | 76 | site_makefile_frag= |
a98e98d3 | 77 | site_option= |
74cc5508 | 78 | srcdir= |
ec342d7d | 79 | srctrigger= |
8becd045 | 80 | subdirs= |
24845456 | 81 | target_alias=NOTARGET |
3a07a6ac | 82 | target_makefile_frag= |
24845456 | 83 | undefs=NOUNDEFS |
0c72405d | 84 | version="$Revision$" |
4d714963 RP |
85 | x11=default |
86 | ||
eb4b02ae DZ |
87 | ### we might need to use some other shell than /bin/sh for running subshells |
88 | # | |
dbb0309d | 89 | config_shell=${CONFIG_SHELL-/bin/sh} |
eb4b02ae | 90 | |
4d714963 RP |
91 | NO_EDIT="This file was generated automatically by configure. Do not edit." |
92 | ||
93 | ## this is a little touchy and won't always work, but... | |
94 | ## | |
c1e4672c RP |
95 | ## if the argv[0] starts with a slash then it is an absolute name that can (and |
96 | ## must) be used as is. | |
4d714963 RP |
97 | ## |
98 | ## otherwise, if argv[0] has no slash in it, we can assume that it is on the | |
99 | ## path. Since PATH might include "." we also add `pwd` to the end of PATH. | |
100 | ## | |
4d714963 | 101 | |
c1e4672c | 102 | progname=$0 |
5cc24596 PB |
103 | # if PWD already has a value, it is probably wrong. |
104 | if [ -n "$PWD" ]; then PWD=`pwd`; fi | |
4d714963 | 105 | |
c1e4672c RP |
106 | case "${progname}" in |
107 | /*) ;; | |
108 | */*) ;; | |
109 | *) | |
73f1f5ba DZ |
110 | PATH=$PATH:${PWD=`pwd`} ; export PATH |
111 | ;; | |
c1e4672c | 112 | esac |
4d714963 | 113 | |
24845456 SG |
114 | # Loop over all args |
115 | ||
116 | while : | |
eb02fd64 | 117 | do |
3509822c | 118 | |
24845456 SG |
119 | # Break out if there are no more args |
120 | case $# in | |
121 | 0) | |
00f56390 | 122 | break |
24845456 SG |
123 | ;; |
124 | esac | |
125 | ||
126 | # Get the first arg, and shuffle | |
127 | option=$1 | |
128 | shift | |
129 | ||
130 | # Make all options have two hyphens | |
131 | orig_option=$option # Save original for error messages | |
132 | case $option in | |
133 | --*) ;; | |
134 | -*) option=-$option ;; | |
135 | esac | |
136 | ||
137 | # Split out the argument for options that take them | |
138 | case $option in | |
139 | --*=*) | |
140 | optarg=`echo $option | sed -e 's/^[^=]*=//'` | |
141 | ;; | |
142 | # These options have mandatory values. Since we didn't find an = sign, | |
143 | # the value must be in the next argument | |
0ffb871e | 144 | --b* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*) |
24845456 SG |
145 | optarg=$1 |
146 | shift | |
147 | ;; | |
148 | esac | |
149 | ||
150 | # Now, process the options | |
151 | case $option in | |
152 | ||
153 | --build* | --b*) | |
154 | case "$build_alias" in | |
155 | "") build_alias=$optarg ;; | |
156 | *) echo '***' Can only configure for one build machine at a time. 1>&2 | |
157 | fatal=yes | |
158 | ;; | |
159 | esac | |
160 | ;; | |
bfb08994 DM |
161 | --disable-*) |
162 | enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` | |
163 | eval $enableopt=no | |
164 | disableoptions="$disableoptions $option" | |
165 | ;; | |
00f56390 DM |
166 | --enable-*) |
167 | case "$option" in | |
168 | *=*) ;; | |
169 | *) optarg=yes ;; | |
170 | esac | |
171 | ||
172 | enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
173 | eval $enableopt="$optarg" | |
174 | enableoptions="$enableoptions $option" | |
175 | ;; | |
176 | --exec-prefix* | --ex*) | |
24845456 SG |
177 | exec_prefix=$optarg |
178 | exec_prefixoption="--exec-prefix=$optarg" | |
179 | ;; | |
180 | --gas | --g*) | |
181 | gas=yes | |
182 | ;; | |
183 | --help | --he*) | |
00f56390 | 184 | fatal=yes |
24845456 SG |
185 | ;; |
186 | --host* | --ho*) | |
187 | case $host_alias in | |
188 | NOHOST) host_alias=$optarg ;; | |
189 | *) echo '***' Can only configure for one host at a time. 1>&2 | |
190 | fatal=yes | |
191 | ;; | |
192 | esac | |
193 | ;; | |
194 | --nfp | --nf*) | |
195 | floating_point=no | |
196 | ;; | |
197 | --norecursion | --no*) | |
00f56390 | 198 | norecursion=yes |
24845456 SG |
199 | ;; |
200 | --prefix* | --pre*) | |
201 | prefix=$optarg | |
202 | prefixoption="--prefix=$optarg" | |
203 | ;; | |
204 | --program-prefix* | --program-p*) | |
205 | program_prefix=$optarg | |
206 | program_prefixoption="--program-prefix=$optarg" | |
207 | ;; | |
208 | --program-suffix* | --program-s*) | |
209 | program_suffix=$optarg | |
210 | program_suffixoption="--program-suffix=$optarg" | |
211 | ;; | |
212 | --program-transform-name* | --program-t*) | |
213 | # Double any backslashes or dollar signs in the argument | |
214 | program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`" | |
215 | program_transform_nameoption="--program-transform-nameoption='$optarg'" | |
216 | ;; | |
217 | --rm) | |
218 | removing=--rm | |
219 | ;; | |
d2d324f8 DM |
220 | --silent | --sil* | --quiet | --q*) |
221 | redirect=">/dev/null" | |
222 | verbose=--silent | |
223 | ;; | |
224 | --site* | --sit*) | |
24845456 SG |
225 | site=$optarg |
226 | site_option="--site=$optarg" | |
227 | ;; | |
228 | --srcdir*/ | --sr*/) | |
229 | # Remove trailing slashes. Otherwise, when the file name gets | |
d2d324f8 DM |
230 | # bolted into an object file as debug info, it has two slashes |
231 | # in it. Ordinarily this is ok, but emacs takes double slash | |
232 | # to mean "forget the first part". | |
24845456 SG |
233 | srcdir=`echo $optarg | sed -e 's:/$::'` |
234 | ;; | |
235 | --srcdir* | --sr*) | |
236 | srcdir=$optarg | |
237 | ;; | |
238 | --target* | --ta*) | |
239 | case $target_alias in | |
240 | NOTARGET) target_alias=$optarg ;; | |
241 | *) echo '***' Can only configure for one target at a time. 1>&2 | |
242 | fatal=yes | |
243 | ;; | |
244 | esac | |
245 | ;; | |
246 | --tmpdir* | --tm*) | |
247 | TMPDIR=$optarg | |
248 | tmpdiroption="--tmpdir=$optarg" | |
249 | ;; | |
250 | --verbose | --v | --verb*) | |
251 | redirect= | |
252 | verbose=--verbose | |
253 | ;; | |
254 | --version | --V | --vers*) | |
255 | echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'` | |
256 | exit 0 | |
257 | ;; | |
258 | --with-*) | |
259 | case "$option" in | |
260 | *=*) ;; | |
261 | *) optarg=yes ;; | |
262 | esac | |
263 | ||
264 | withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
265 | eval $withopt="$optarg" | |
266 | withoptions="$withoptions $option" | |
267 | ;; | |
268 | --without-*) | |
bfb08994 | 269 | withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` |
24845456 SG |
270 | eval $withopt=no |
271 | withoutoptions="$withoutoptions $option" | |
272 | ;; | |
9336e47e DM |
273 | --x) with_x=yes |
274 | withoptions="$withoptions --with-x" | |
275 | ;; | |
0ffb871e DM |
276 | --x-i* | --x-l*) other_options="$other_options $orig_option" |
277 | ;; | |
24845456 | 278 | --*) |
d237841c BC |
279 | echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2 |
280 | exit 1 | |
24845456 SG |
281 | ;; |
282 | *) | |
283 | case $undefs in | |
284 | NOUNDEFS) undefs=$option ;; | |
285 | *) echo '***' Can only configure for one host and one target at a time. 1>&2 | |
286 | fatal=yes | |
287 | ;; | |
288 | esac | |
289 | ;; | |
290 | esac | |
eb02fd64 RP |
291 | done |
292 | ||
4d714963 | 293 | # process host and target |
24845456 | 294 | |
00f56390 DM |
295 | # Do some error checking and defaulting for the host and target type. |
296 | # The inputs are: | |
297 | # configure --host=HOST --target=TARGET UNDEFS | |
24845456 | 298 | # |
00f56390 DM |
299 | # The rules are: |
300 | # 1. You aren't allowed to specify --host, --target, and undefs at the | |
301 | # same time. | |
302 | # 2. Host defaults to undefs. | |
303 | # 3. If undefs is not specified, then host defaults to the current host, | |
304 | # as determined by config.guess. | |
305 | # 4. Target defaults to undefs. | |
306 | # 5. If undefs is not specified, then target defaults to host. | |
24845456 | 307 | |
a98bbe58 RP |
308 | case "${fatal}" in |
309 | "") | |
24845456 SG |
310 | # Make sure that host, target & undefs aren't all specified at the |
311 | # same time. | |
312 | case $host_alias---$target_alias---$undefs in | |
313 | NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS) | |
314 | ;; | |
315 | *) echo '***' Can only configure for one host and one target at a time. 1>&2 | |
316 | fatal=yes | |
317 | break 2 | |
318 | ;; | |
319 | esac | |
320 | ||
321 | # Now, do defaulting for host. | |
322 | case $host_alias in | |
323 | NOHOST) | |
324 | case $undefs in | |
325 | NOUNDEFS) | |
326 | # Neither --host option nor undefs were present. | |
327 | # Call config.guess. | |
328 | guesssys=`echo ${progname} | sed 's/configure$/config.guess/'` | |
329 | if host_alias=`${guesssys}` | |
330 | then | |
331 | echo "Configuring for a ${host_alias} host." 1>&2 | |
332 | arguments="--host=$host_alias $arguments" | |
333 | else | |
334 | echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2 | |
335 | fatal=yes | |
336 | fi | |
337 | ;; | |
338 | *) | |
339 | host_alias=$undefs | |
340 | ;; | |
341 | esac | |
342 | esac | |
343 | ||
344 | # Do defaulting for target. If --target option isn't present, default | |
345 | # to undefs. If undefs isn't present, default to host. | |
346 | case $target_alias in | |
347 | NOTARGET) | |
348 | case $undefs in | |
349 | NOUNDEFS) | |
350 | target_alias=$host_alias | |
351 | ;; | |
352 | *) | |
353 | target_alias=$undefs | |
354 | ;; | |
355 | esac | |
356 | esac | |
357 | ;; | |
a98bbe58 RP |
358 | *) ;; |
359 | esac | |
eb02fd64 | 360 | |
c1e4672c | 361 | if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then |
24845456 | 362 | exec 1>&2 |
d237841c | 363 | echo Usage: configure [OPTIONS] HOST |
24845456 SG |
364 | echo |
365 | echo Options: [defaults in brackets] | |
00f56390 | 366 | echo ' --prefix=MYDIR configure for installation of host independent files into MYDIR. ["/usr/local"]' |
24845456 SG |
367 | echo ' --exec-prefix=MYDIR configure for installation of host dependent files into MYDIR. ["/usr/local"]' |
368 | echo ' --help print this message. [normal config]' | |
369 | echo ' --build=BUILD configure for building on BUILD. [BUILD=HOST]' | |
370 | echo ' --host=HOST configure for HOST. [determined via config.guess]' | |
371 | echo ' --norecursion configure this directory only. [recurse]' | |
372 | echo ' --program-prefix=FOO install programs with FOO prepended to their names. [ "" ]' | |
373 | echo ' --program-suffix=FOO install programs with FOO appended to their names. [ "" ]' | |
374 | echo ' --program-transform-name=FOO install programs with names transformed by sed pattern FOO. [ "" ]' | |
375 | echo ' --site=SITE configure with site specific makefile for SITE' | |
376 | echo ' --srcdir=DIR find the sources in DIR. ["." or ".."]' | |
377 | echo ' --target=TARGET configure for TARGET. [TARGET = HOST]' | |
378 | echo ' --tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = "/tmp" ]' | |
379 | echo ' --nfp configure the compilers default to soft floating point. [hard float]' | |
00f56390 DM |
380 | echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)' |
381 | echo ' --without-FOO package FOO is NOT available' | |
382 | echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)' | |
bfb08994 | 383 | echo ' --disable-FOO do not include feature FOO' |
24845456 | 384 | echo |
d237841c | 385 | echo 'Where HOST and TARGET are something like "sun4", "decstation", "encore", etc.' |
24845456 SG |
386 | echo |
387 | if [ -r config.status ] ; then | |
388 | cat config.status | |
389 | fi | |
390 | ||
391 | exit 1 | |
eb02fd64 RP |
392 | fi |
393 | ||
0c72405d | 394 | configsub=`echo ${progname} | sed 's/configure$/config.sub/'` |
196377ee | 395 | moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'` |
7da1d334 | 396 | |
94c7ae21 RP |
397 | # this is a hack. sun4 must always be a valid host alias or this will fail. |
398 | if ${configsub} sun4 >/dev/null 2>&1 ; then | |
73f1f5ba | 399 | true |
7da1d334 | 400 | else |
73f1f5ba DZ |
401 | echo '***' cannot find config.sub. 1>&2 |
402 | exit 1 | |
7da1d334 RP |
403 | fi |
404 | ||
196377ee RP |
405 | touch config.junk |
406 | if ${moveifchange} config.junk config.trash ; then | |
73f1f5ba | 407 | true |
196377ee | 408 | else |
73f1f5ba DZ |
409 | echo '***' cannot find move-if-change. 1>&2 |
410 | exit 1 | |
196377ee RP |
411 | fi |
412 | rm -f config.junk config.trash | |
413 | ||
a98bbe58 RP |
414 | case "${srcdir}" in |
415 | "") | |
73f1f5ba DZ |
416 | if [ -r configure.in ] ; then |
417 | srcdir=. | |
418 | else | |
419 | if [ -r ${progname}.in ] ; then | |
420 | srcdir=`echo ${progname} | sed 's:/configure$::'` | |
421 | else | |
24845456 | 422 | echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2 |
73f1f5ba DZ |
423 | exit 1 |
424 | fi | |
425 | fi | |
426 | ;; | |
a98bbe58 RP |
427 | *) ;; |
428 | esac | |
eb02fd64 | 429 | |
8fd24008 RP |
430 | ### warn about some conflicting configurations. |
431 | ||
432 | case "${srcdir}" in | |
433 | ".") ;; | |
434 | *) | |
73f1f5ba DZ |
435 | if [ -f ${srcdir}/config.status ] ; then |
436 | echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2 | |
437 | exit 1 | |
438 | fi | |
8fd24008 | 439 | esac |
bc58b41d | 440 | |
c1e4672c RP |
441 | # default exec_prefix |
442 | case "${exec_prefix}" in | |
8becd045 | 443 | "") exec_prefix="\$(prefix)" ;; |
3a07a6ac RP |
444 | *) ;; |
445 | esac | |
446 | ||
4d714963 | 447 | ### break up ${srcdir}/configure.in. |
a98bbe58 RP |
448 | case "`grep '^# per\-host:' ${srcdir}/configure.in`" in |
449 | "") | |
dbb0309d | 450 | echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2 |
73f1f5ba DZ |
451 | exit 1 |
452 | ;; | |
a98bbe58 RP |
453 | *) ;; |
454 | esac | |
49b10446 | 455 | |
a98bbe58 RP |
456 | case "`grep '^# per\-target:' ${srcdir}/configure.in`" in |
457 | "") | |
dbb0309d | 458 | echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2 |
73f1f5ba DZ |
459 | exit 1 |
460 | ;; | |
a98bbe58 RP |
461 | *) ;; |
462 | esac | |
c5ae5678 | 463 | |
a98bbe58 RP |
464 | case "${TMPDIR}" in |
465 | "") TMPDIR=/tmp ; export TMPDIR ;; | |
466 | *) ;; | |
467 | esac | |
eb02fd64 | 468 | |
4d714963 RP |
469 | # keep this filename short for &%*%$*# 14 char file names |
470 | tmpfile=${TMPDIR}/cONf$$ | |
471 | trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0 | |
472 | ||
473 | # split ${srcdir}/configure.in into common, per-host, per-target, | |
474 | # and post-target parts. Post-target is optional. | |
475 | sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com | |
476 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst | |
477 | if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then | |
478 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt | |
479 | sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos | |
c297d71e | 480 | else |
4d714963 RP |
481 | sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt |
482 | echo >${tmpfile}.pos | |
c297d71e | 483 | fi |
eb02fd64 | 484 | |
c297d71e | 485 | ### do common part of configure.in |
eb02fd64 | 486 | |
c5ae5678 | 487 | . ${tmpfile}.com |
eb02fd64 | 488 | |
ec342d7d | 489 | # some sanity checks on configure.in |
a98bbe58 RP |
490 | case "${srctrigger}" in |
491 | "") | |
73f1f5ba DZ |
492 | echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2 |
493 | exit 1 | |
494 | ;; | |
a98bbe58 RP |
495 | *) ;; |
496 | esac | |
ec342d7d | 497 | |
24845456 SG |
498 | case "${build_alias}" in |
499 | "") ;; | |
500 | *) | |
501 | result=`${configsub} ${build_alias}` | |
502 | buildopt="--build=${build_alias}" | |
503 | build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` | |
504 | build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
505 | build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
506 | build=${build_cpu}-${build_vendor}-${build_os} | |
507 | ;; | |
508 | esac | |
509 | ||
c1e4672c RP |
510 | result=`${configsub} ${host_alias}` |
511 | host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` | |
512 | host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
513 | host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
514 | host=${host_cpu}-${host_vendor}-${host_os} | |
6c18e393 | 515 | |
c1e4672c | 516 | . ${tmpfile}.hst |
eb02fd64 | 517 | |
c1e4672c RP |
518 | result=`${configsub} ${target_alias}` |
519 | target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` | |
520 | target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
521 | target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
522 | target=${target_cpu}-${target_vendor}-${target_os} | |
eb02fd64 | 523 | |
c1e4672c | 524 | . ${tmpfile}.tgt |
49b10446 | 525 | |
c1e4672c RP |
526 | # Find the source files, if location was not specified. |
527 | case "${srcdir}" in | |
528 | "") | |
73f1f5ba DZ |
529 | srcdirdefaulted=1 |
530 | srcdir=. | |
531 | if [ ! -r ${srctrigger} ] ; then | |
532 | srcdir=.. | |
533 | fi | |
534 | ;; | |
c1e4672c RP |
535 | *) ;; |
536 | esac | |
eb02fd64 | 537 | |
c1e4672c | 538 | if [ ! -r ${srcdir}/${srctrigger} ] ; then |
73f1f5ba DZ |
539 | case "${srcdirdefaulted}" in |
540 | "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;; | |
541 | *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;; | |
542 | esac | |
eb02fd64 | 543 | |
73f1f5ba DZ |
544 | echo '***' \(At least ${srctrigger} is missing.\) 1>&2 |
545 | exit 1 | |
c1e4672c | 546 | fi |
131a3881 | 547 | |
0ed316a0 DZ |
548 | # Some systems (e.g., one of the i386-aix systems the gas testers are |
549 | # using) don't handle "\$" correctly, so don't use it here. | |
550 | tooldir='$(exec_prefix)'/${target_alias} | |
c5108322 ILT |
551 | |
552 | if [ "${host_alias}" != "${target_alias}" ] ; then | |
d6d49c64 PB |
553 | if [ "${program_prefixoption}" = "" ] ; then |
554 | if [ "${program_suffixoption}" = "" ] ; then | |
555 | if [ "${program_transform_nameoption}" = "" ] ; then | |
73f1f5ba DZ |
556 | program_prefix=${target_alias}- ; |
557 | fi | |
558 | fi | |
c5108322 ILT |
559 | fi |
560 | fi | |
561 | ||
562 | # Merge program_prefix and program_suffix onto program_transform_name | |
563 | # Use a double $ so that make ignores it | |
564 | if [ "${program_suffix}" != "" ] ; then | |
24845456 | 565 | program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}" |
c5108322 ILT |
566 | fi |
567 | ||
568 | if [ "${program_prefix}" != "" ] ; then | |
24845456 | 569 | program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}" |
c5108322 ILT |
570 | fi |
571 | ||
8becd045 | 572 | for subdir in . ${subdirs} ; do |
eb02fd64 | 573 | |
8becd045 PB |
574 | # ${subdir} is relative path from . to the directory we're currently |
575 | # configuring. | |
576 | # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed. | |
577 | invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'` | |
131a3881 | 578 | |
8becd045 PB |
579 | ### figure out what to do with srcdir |
580 | case "${srcdir}" in | |
73f1f5ba DZ |
581 | ".") # no -srcdir option. We're building in place. |
582 | makesrcdir=. ;; | |
583 | /*) # absolute path | |
584 | makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'` | |
585 | ;; | |
586 | *) # otherwise relative | |
587 | case "${subdir}" in | |
588 | .) makesrcdir=${srcdir} ;; | |
589 | *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;; | |
590 | esac | |
591 | ;; | |
8becd045 | 592 | esac |
131a3881 | 593 | |
8becd045 | 594 | if [ "${subdir}/" != "./" ] ; then |
73f1f5ba | 595 | Makefile=${subdir}/Makefile |
8becd045 | 596 | fi |
131a3881 | 597 | |
9546e9b4 | 598 | if [ ! -d ${subdir} ] ; then |
73f1f5ba DZ |
599 | if mkdir ${subdir} ; then |
600 | true | |
09e0b992 | 601 | else |
73f1f5ba DZ |
602 | echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2 |
603 | exit 1 | |
09e0b992 | 604 | fi |
9546e9b4 RP |
605 | fi |
606 | ||
8becd045 PB |
607 | case "${removing}" in |
608 | "") | |
73f1f5ba DZ |
609 | case "${subdir}" in |
610 | .) ;; | |
611 | *) eval echo Building in ${subdir} ${redirect} ;; | |
612 | esac | |
613 | ||
614 | # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest) | |
615 | # Set up the list of links to be made. | |
616 | # ${links} is the list of link names, and ${files} is the list of names to link to. | |
617 | ||
618 | # Make the links. | |
619 | configlinks="${links}" | |
620 | if [ -r ${subdir}/config.status ] ; then | |
621 | mv -f ${subdir}/config.status ${subdir}/config.back | |
622 | fi | |
623 | while [ -n "${files}" ] ; do | |
624 | # set file to car of files, files to cdr of files | |
625 | set ${files}; file=$1; shift; files=$* | |
626 | set ${links}; link=$1; shift; links=$* | |
627 | ||
628 | if [ ! -r ${srcdir}/${file} ] ; then | |
629 | echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 | |
630 | echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2 | |
631 | exit 1 | |
632 | fi | |
633 | ||
634 | ${remove} -f ${link} | |
d237841c BC |
635 | # Make a symlink if possible, otherwise try a hard link |
636 | if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then | |
637 | true | |
638 | else | |
639 | # We need to re-remove the file because Lynx leaves a | |
640 | # very strange directory there when it fails an NFS symlink. | |
641 | ${remove} -r -f ${link} | |
642 | ${hard_link} ${srcdir}/${file} ${link} | |
643 | fi | |
73f1f5ba DZ |
644 | if [ ! -r ${link} ] ; then |
645 | echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 | |
646 | exit 1 | |
647 | fi | |
648 | ||
649 | echo "Linked \"${link}\" to \"${srcdir}/${file}\"." | |
650 | done | |
651 | ||
652 | # Create a .gdbinit file which runs the one in srcdir | |
653 | # and tells GDB to look there for source files. | |
654 | ||
655 | if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then | |
656 | case ${srcdir} in | |
657 | .) ;; | |
658 | *) cat > ${subdir}/.gdbinit <<EOF | |
8becd045 | 659 | # ${NO_EDIT} |
3a07a6ac | 660 | dir . |
8becd045 PB |
661 | dir ${makesrcdir} |
662 | source ${makesrcdir}/.gdbinit | |
3a07a6ac | 663 | EOF |
73f1f5ba DZ |
664 | ;; |
665 | esac | |
666 | fi | |
0df06ca0 | 667 | |
73f1f5ba DZ |
668 | # Install a makefile, and make it set VPATH |
669 | # if necessary so that the sources are found. | |
670 | # Also change its value of srcdir. | |
671 | # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has | |
672 | # been somewhat optimized and is perhaps a bit twisty. | |
0df06ca0 | 673 | |
73f1f5ba | 674 | # code is order so as to try to sed the smallest input files we know. |
0df06ca0 | 675 | |
73f1f5ba | 676 | # the four makefile fragments MUST end up in the resulting Makefile in this order: |
34bdab16 DZ |
677 | # package, target, host, and site. so do these separately because I don't trust the |
678 | # order of sed -e expressions. | |
131a3881 | 679 | |
73f1f5ba DZ |
680 | if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then |
681 | ||
e5c6be8f DZ |
682 | # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem |
683 | rm -f ${subdir}/Makefile.tem | |
684 | case "${site}" in | |
685 | "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;; | |
686 | *) | |
687 | site_makefile_frag=${srcdir}/config/ms-${site} | |
688 | ||
689 | if [ -f ${site_makefile_frag} ] ; then | |
690 | sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \ | |
691 | > ${subdir}/Makefile.tem | |
692 | else | |
693 | cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem | |
694 | site_makefile_frag= | |
695 | fi | |
696 | ;; | |
697 | esac | |
698 | # working copy now in ${subdir}/Makefile.tem | |
699 | ||
700 | # Conditionalize the makefile for this host. | |
701 | rm -f ${Makefile} | |
702 | case "${host_makefile_frag}" in | |
703 | "") mv ${subdir}/Makefile.tem ${Makefile} ;; | |
704 | *) | |
705 | if [ ! -f ${host_makefile_frag} ] ; then | |
706 | host_makefile_frag=${srcdir}/${host_makefile_frag} | |
707 | fi | |
708 | if [ -f ${host_makefile_frag} ] ; then | |
709 | sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile} | |
710 | else | |
711 | echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2 | |
712 | echo '***' is missing in ${PWD=`pwd`}. 1>&2 | |
713 | mv ${subdir}/Makefile.tem ${Makefile} | |
714 | fi | |
715 | esac | |
716 | # working copy now in ${Makefile} | |
717 | ||
718 | # Conditionalize the makefile for this target. | |
719 | rm -f ${subdir}/Makefile.tem | |
720 | case "${target_makefile_frag}" in | |
721 | "") mv ${Makefile} ${subdir}/Makefile.tem ;; | |
722 | *) | |
723 | if [ ! -f ${target_makefile_frag} ] ; then | |
724 | target_makefile_frag=${srcdir}/${target_makefile_frag} | |
725 | fi | |
726 | if [ -f ${target_makefile_frag} ] ; then | |
727 | sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem | |
728 | else | |
729 | mv ${Makefile} ${subdir}/Makefile.tem | |
730 | target_makefile_frag= | |
731 | fi | |
732 | ;; | |
733 | esac | |
734 | # real copy now in ${subdir}/Makefile.tem | |
735 | ||
736 | # Conditionalize the makefile for this package. | |
737 | rm -f ${Makefile} | |
738 | case "${package_makefile_frag}" in | |
739 | "") mv ${subdir}/Makefile.tem ${Makefile} ;; | |
740 | *) | |
741 | if [ ! -f ${package_makefile_frag} ] ; then | |
742 | package_makefile_frag=${srcdir}/${package_makefile_frag} | |
743 | fi | |
744 | if [ -f ${package_makefile_frag} ] ; then | |
745 | sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile} | |
746 | else | |
747 | echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2 | |
748 | echo '***' is missing in ${PWD=`pwd`}. 1>&2 | |
749 | mv ${subdir}/Makefile.tem ${Makefile} | |
750 | fi | |
751 | esac | |
752 | # working copy now in ${Makefile} | |
753 | ||
754 | mv ${Makefile} ${subdir}/Makefile.tem | |
755 | ||
756 | # real copy now in ${subdir}/Makefile.tem | |
757 | ||
d237841c BC |
758 | # Remove patch suffixes from host name. |
759 | # See similar code in configure.in. | |
760 | # Example: 'sparc-sun-sunos4.1.3_U1' | |
761 | host_osnop=`echo ${host_os} | sed '/sunos/s/_U1//'` | |
762 | ||
e5c6be8f DZ |
763 | # prepend warning about editting, and a bunch of variables. |
764 | rm -f ${Makefile} | |
765 | cat > ${Makefile} <<EOF | |
3a07a6ac | 766 | # ${NO_EDIT} |
8becd045 PB |
767 | VPATH = ${makesrcdir} |
768 | links = ${configlinks} | |
3a07a6ac RP |
769 | host_alias = ${host_alias} |
770 | host_cpu = ${host_cpu} | |
771 | host_vendor = ${host_vendor} | |
772 | host_os = ${host_os} | |
d237841c | 773 | host_canonical = ${host_cpu}-${host_vendor}-${host_osnop} |
3a07a6ac RP |
774 | target_alias = ${target_alias} |
775 | target_cpu = ${target_cpu} | |
776 | target_vendor = ${target_vendor} | |
777 | target_os = ${target_os} | |
5cc24596 | 778 | target_canonical = ${target_cpu}-${target_vendor}-${target_os} |
3a07a6ac | 779 | EOF |
24845456 SG |
780 | case "${build}" in |
781 | "") ;; | |
d237841c BC |
782 | *) build_osnop=`echo ${build_os} | sed '/sunos/s/_U1//'` |
783 | cat >> ${Makefile} << EOF | |
24845456 SG |
784 | build_alias = ${build_alias} |
785 | build_cpu = ${build_cpu} | |
786 | build_vendor = ${build_vendor} | |
787 | build_os = ${build_os} | |
d237841c | 788 | build_canonical = ${build_cpu}-${build_vendor}-${build_osnop} |
24845456 SG |
789 | EOF |
790 | esac | |
791 | ||
e5c6be8f DZ |
792 | case "${package_makefile_frag}" in |
793 | "") ;; | |
794 | /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;; | |
795 | *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;; | |
796 | esac | |
797 | ||
798 | case "${target_makefile_frag}" in | |
799 | "") ;; | |
800 | /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;; | |
801 | *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;; | |
802 | esac | |
803 | ||
804 | case "${host_makefile_frag}" in | |
805 | "") ;; | |
806 | /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;; | |
807 | *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;; | |
808 | esac | |
809 | ||
810 | if [ "${site_makefile_frag}" != "" ] ; then | |
811 | echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile} | |
812 | fi | |
813 | ||
03abfb2c DZ |
814 | # make sure that some sort of reasonable default exists for these |
815 | # two variables | |
816 | CXX=${CXX-"g++ -O"} | |
817 | CC=${CC-cc} | |
818 | ||
e5c6be8f DZ |
819 | # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS, |
820 | # remove any form feeds. | |
821 | if [ -z "${subdirs}" ]; then | |
822 | rm -f ${subdir}/Makefile.tem2 | |
70d3fab7 DZ |
823 | sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \ |
824 | -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \ | |
e5c6be8f DZ |
825 | ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2 |
826 | rm -f ${subdir}/Makefile.tem | |
827 | mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem | |
828 | fi | |
70d3fab7 DZ |
829 | sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \ |
830 | -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \ | |
dbb0309d | 831 | -e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \ |
70d3fab7 | 832 | -e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \ |
e5c6be8f | 833 | -e "s/\f//" \ |
70d3fab7 DZ |
834 | -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \ |
835 | -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \ | |
26e4818b | 836 | -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \ |
70d3fab7 | 837 | -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \ |
e5c6be8f DZ |
838 | ${subdir}/Makefile.tem >> ${Makefile} |
839 | # final copy now in ${Makefile} | |
840 | ||
841 | else | |
26e4818b | 842 | echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2 |
e5c6be8f | 843 | fi |
73f1f5ba DZ |
844 | |
845 | rm -f ${subdir}/Makefile.tem | |
846 | ||
847 | case "${host_makefile_frag}" in | |
848 | "") using= ;; | |
849 | *) using="and \"${host_makefile_frag}\"" ;; | |
850 | esac | |
851 | ||
852 | case "${target_makefile_frag}" in | |
853 | "") ;; | |
854 | *) using="${using} and \"${target_makefile_frag}\"" ;; | |
855 | esac | |
856 | ||
857 | case "${site_makefile_frag}" in | |
858 | "") ;; | |
859 | *) using="${using} and \"${site_makefile_frag}\"" ;; | |
860 | esac | |
861 | ||
862 | newusing=`echo "${using}" | sed 's/and/using/'` | |
863 | using=${newusing} | |
864 | echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using} | |
865 | ||
866 | . ${tmpfile}.pos | |
867 | ||
868 | # describe the chosen configuration in config.status. | |
869 | # Make that file a shellscript which will reestablish | |
870 | # the same configuration. Used in Makefiles to rebuild | |
871 | # Makefiles. | |
872 | ||
873 | case "${norecursion}" in | |
24845456 | 874 | "") arguments="${arguments} --norecursion" ;; |
73f1f5ba DZ |
875 | *) ;; |
876 | esac | |
877 | ||
878 | if [ ${subdir} = . ] ; then | |
879 | echo "#!/bin/sh | |
4d714963 | 880 | # ${NO_EDIT} |
4347369f | 881 | # This directory was configured as follows: |
4d714963 | 882 | ${progname}" ${arguments} " |
196377ee | 883 | # ${using}" > ${subdir}/config.new |
73f1f5ba DZ |
884 | else |
885 | echo "#!/bin/sh | |
8becd045 | 886 | # ${NO_EDIT} |
4347369f | 887 | # This directory was configured as follows: |
8becd045 PB |
888 | cd ${invsubdir} |
889 | ${progname}" ${arguments} " | |
196377ee | 890 | # ${using}" > ${subdir}/config.new |
73f1f5ba DZ |
891 | fi |
892 | chmod a+x ${subdir}/config.new | |
893 | if [ -r ${subdir}/config.back ] ; then | |
894 | mv -f ${subdir}/config.back ${subdir}/config.status | |
895 | fi | |
896 | ${moveifchange} ${subdir}/config.new ${subdir}/config.status | |
897 | ;; | |
8becd045 | 898 | |
73f1f5ba | 899 | *) rm -f ${Makefile} ${subdir}/config.status ${links} ;; |
8becd045 PB |
900 | esac |
901 | done | |
c1e4672c RP |
902 | |
903 | # If there are subdirectories, then recur. | |
904 | if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then | |
73f1f5ba DZ |
905 | for configdir in ${configdirs} ; do |
906 | ||
907 | if [ -d ${srcdir}/${configdir} ] ; then | |
908 | eval echo Configuring ${configdir}... ${redirect} | |
909 | case "${srcdir}" in | |
910 | ".") ;; | |
911 | *) | |
912 | if [ ! -d ./${configdir} ] ; then | |
913 | if mkdir ./${configdir} ; then | |
914 | true | |
915 | else | |
916 | echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2 | |
917 | exit 1 | |
918 | fi | |
919 | fi | |
920 | ;; | |
921 | esac | |
922 | ||
923 | POPDIR=${PWD=`pwd`} | |
924 | cd ${configdir} | |
c1e4672c RP |
925 | |
926 | ### figure out what to do with srcdir | |
73f1f5ba DZ |
927 | case "${srcdir}" in |
928 | ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place. | |
929 | /*) # absolute path | |
930 | newsrcdir=${srcdir}/${configdir} | |
24845456 | 931 | srcdiroption="--srcdir=${newsrcdir}" |
73f1f5ba DZ |
932 | ;; |
933 | *) # otherwise relative | |
934 | newsrcdir=../${srcdir}/${configdir} | |
24845456 | 935 | srcdiroption="--srcdir=${newsrcdir}" |
73f1f5ba DZ |
936 | ;; |
937 | esac | |
c1e4672c RP |
938 | |
939 | ### check for guested configure, otherwise fix possibly relative progname | |
73f1f5ba DZ |
940 | if [ -f ${newsrcdir}/configure ] ; then |
941 | recprog=${newsrcdir}/configure | |
eb4b02ae | 942 | elif [ -f ${newsrcdir}/configure.in ] ; then |
73f1f5ba DZ |
943 | case "${progname}" in |
944 | /*) recprog=${progname} ;; | |
945 | *) recprog=../${progname} ;; | |
946 | esac | |
eb4b02ae | 947 | else |
c0c70966 | 948 | eval echo No configuration information in ${configdir} ${redirect} |
eb4b02ae | 949 | recprog= |
73f1f5ba | 950 | fi |
4d714963 RP |
951 | |
952 | ### The recursion line is here. | |
eb4b02ae | 953 | if [ ! -z "${recprog}" ] ; then |
24845456 | 954 | if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \ |
eb4b02ae | 955 | ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \ |
bfb08994 | 956 | ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then |
eb4b02ae DZ |
957 | true |
958 | else | |
00f56390 | 959 | echo Configure in `pwd` failed, exiting. 1>&2 |
eb4b02ae DZ |
960 | exit 1 |
961 | fi | |
962 | fi | |
73f1f5ba DZ |
963 | |
964 | cd ${POPDIR} | |
965 | fi | |
966 | done | |
c1e4672c | 967 | fi |
eb02fd64 | 968 | |
eb02fd64 | 969 | exit 0 |
74cc5508 | 970 | |
0df06ca0 RP |
971 | # |
972 | # Local Variables: | |
973 | # fill-column: 131 | |
974 | # End: | |
975 | # | |
74cc5508 | 976 | |
46f3c7cd | 977 | # end of configure |