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