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