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