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