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