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