remove references to gdbm
[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=
4d714963 58next_host=
3a07a6ac 59next_prefix=
3509822c 60next_site=
4d714963 61next_srcdir=
3509822c
RP
62next_target=
63next_tmpdir=
46766962 64norecursion=
4d714963 65prefix=/usr/local
49b10446 66progname=
c1e4672c
RP
67program_prefix=
68program_prefix_option=
69silent=
0e693d0b
RP
70site=
71site_option=
3a07a6ac 72site_makefile_frag=
74cc5508 73srcdir=
ec342d7d 74srctrigger=
c1e4672c 75target_alias=
3a07a6ac 76target_makefile_frag=
4d714963 77undefinedargs=
0df06ca0 78verbose=
0c72405d 79version="$Revision$"
4d714963
RP
80x11=default
81
4d714963
RP
82NO_EDIT="This file was generated automatically by configure. Do not edit."
83
84## this is a little touchy and won't always work, but...
85##
c1e4672c
RP
86## if the argv[0] starts with a slash then it is an absolute name that can (and
87## must) be used as is.
4d714963
RP
88##
89## otherwise, if argv[0] has no slash in it, we can assume that it is on the
90## path. Since PATH might include "." we also add `pwd` to the end of PATH.
91##
4d714963
RP
92
93PWD=`pwd`
c1e4672c 94progname=$0
4d714963 95
c1e4672c
RP
96case "${progname}" in
97/*) ;;
98*/*) ;;
99*)
4d714963 100 PATH=$PATH:${PWD} ; export PATH
c1e4672c
RP
101 ;;
102esac
4d714963 103
eb02fd64
RP
104for arg in $*;
105do
3509822c 106 # handle things that might have args following as separate words
4d714963 107 if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
c1e4672c
RP
108 elif [ -n "${next_exec_prefix}" ] ; then
109 exec_prefix=${arg}
110 exec_prefixoption="-exec_prefix=${exec_prefix}"
111 next_exec_prefix=
0e693d0b 112 elif [ -n "${next_site}" ] ; then site=${arg} ; site_option=-site=${site} ; next_site=
c9b0df66
RP
113 # remove any possible trailing slash from srcdir. See note below.
114 elif [ -n "${next_srcdir}" ] ; then srcdir=`echo ${arg} | sed -e 's:/$::'` ; next_srcdir=
c1e4672c
RP
115 elif [ -n "${next_program_prefix}" ] ; then
116 program_prefix=${arg}
117 program_prefixoption="-program_prefix=${program_prefix}"
118 next_program_prefix=
3509822c
RP
119 elif [ -n "${next_target}" ] ; then
120 next_target=
c1e4672c 121 case "${target_alias}" in
a98bbe58 122 "")
c1e4672c 123 target_alias="${arg}"
a98bbe58
RP
124 ;;
125 *)
8fd24008 126 echo '***' Can only configure for one target at a time. 1>&2
4d714963 127 fatal=yes
a98bbe58
RP
128 ;;
129 esac
3509822c
RP
130 elif [ -n "${next_tmpdir}" ] ; then
131 next_tmpdir=
4d714963 132 tmpdiroption="--tmpdir=${arg}"
3509822c
RP
133 TMPDIR=${arg}
134
135 else
136 case ${arg} in
c1e4672c
RP
137 -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
138 exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
139 exec_prefixoption=${arg}
3509822c 140 ;;
c1e4672c
RP
141 -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
142 next_exec_prefix=yes
3509822c 143 ;;
4d714963 144 -gas | --g*)
3509822c
RP
145 gas=yes
146 ;;
4d714963 147 -help | --he*)
3509822c
RP
148 fatal=true
149 ;;
4d714963 150 -host=* | --host=* | --hos=* | --ho=*)
c1e4672c 151 case "${host_alias}" in
a98bbe58 152 "")
c1e4672c 153 host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`"
a98bbe58
RP
154 ;;
155 *)
8fd24008 156 echo '***' Can only configure for one host at a time. 1>&2
4d714963 157 fatal=yes
a98bbe58
RP
158 ;;
159 esac
3509822c 160 ;;
4d714963
RP
161 -nfp | --nf*)
162 floating_point=no
3509822c 163 ;;
4d714963 164 -norecursion | --no*)
3509822c
RP
165 norecursion=true
166 ;;
c1e4672c 167 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=*)
0e0643c7 168 prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963 169 prefixoption=${arg}
3509822c 170 ;;
c1e4672c 171 -prefix | --prefix | --prefi | --pref | --pre)
4d714963 172 next_prefix=yes
3509822c 173 ;;
c1e4672c
RP
174 -program_prefix=* | --program_prefix=* | --program_prefi=* | --program_pref=* | --program_pre=* | --program_pr=* | --program_p=* | --program_=* | --program=* | --progra=* | --progr=* | --prog=* | --pro=*)
175 program_prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
176 program_prefixoption=${arg}
177 ;;
178 -program_prefix | --program_prefix | --program_prefi | --program_pref | --program_pre | --program_pr | --program_p | --program_ | --program | --progra | --progr | --prog | --pro)
179 next_program_prefix=yes
3509822c 180 ;;
c1e4672c
RP
181 -s | -silent | --silent | --silen | --sile | --sil)
182 silent=true
183 arguments=`echo ${arguments} | sed "s:${arg}::"`
3509822c 184 ;;
4d714963 185 -site=* | --site=* | --sit=* | --si=*)
0e693d0b 186 site_option=${arg}
0e0643c7 187 site=`echo ${arg} | sed 's/^[-a-z]*=//'`
3509822c 188 ;;
c1e4672c 189 -site | --site | --sit)
3509822c
RP
190 next_site=yes
191 ;;
c9b0df66
RP
192 # remove trailing slashes. Otherwise, when the file name gets
193 # bolted into an object file as debug info, it has two slashes in
194 # it. Ordinarily this is ok, but emacs takes double slash to
195 # mean "forget the first part".
4d714963 196 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
c9b0df66 197 srcdir=`echo ${arg} | sed 's/^[-a-z]*=//' | sed -e 's:/$::'`
4d714963
RP
198 ;;
199 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
200 next_srcdir=yes
3509822c 201 ;;
4d714963 202 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
c1e4672c
RP
203 case "${target_alias}" in
204 "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
a98bbe58 205 *)
8fd24008 206 echo '***' Can only configure for one target at a time. 1>&2
4d714963 207 fatal=yes
a98bbe58
RP
208 ;;
209 esac
3509822c 210 ;;
4d714963 211 -target | --target | --targe | --targ | --tar | --ta)
3509822c
RP
212 next_target=yes
213 ;;
4d714963 214 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
3509822c 215 tmpdiroption=${arg}
0e0643c7 216 TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
3509822c 217 ;;
4d714963 218 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
3509822c
RP
219 next_tmpdir=yes
220 ;;
4d714963 221 -v | -verbose | --v)
3509822c
RP
222 verbose=${arg}
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/'`
7da1d334 323
c1e4672c 324if ${configsub} `echo ${host_alias} | sed -e 's/ .*//'` >/dev/null 2>&1 ; then
7da1d334
RP
325 true
326else
8fd24008 327 echo '***' cannot find config.sub. 1>&2
7da1d334
RP
328 exit 1
329fi
330
a98bbe58
RP
331case "${srcdir}" in
332"")
4d714963
RP
333 if [ -r configure.in ] ; then
334 srcdir=.
4d714963 335 else
c1e4672c
RP
336 if [ -r ${progname}.in ] ; then
337 srcdir=`echo ${progname} | sed 's:/configure$::'`
338 else
8fd24008 339 echo '***' "Can't find configure.in. Try using -srcdir=some_dir" 1>&2
c1e4672c
RP
340 exit 1
341 fi
eb02fd64 342 fi
a98bbe58
RP
343 ;;
344*) ;;
345esac
eb02fd64 346
8fd24008
RP
347### warn about some conflicting configurations.
348
349case "${srcdir}" in
350".") ;;
351*)
352 if [ -f ${srcdir}/config.status ] ; then
0e693d0b 353 echo '***' Cannot configure here in \"${PWD}\" when \"${srcdir}\" is currently configured. 1>&2
8fd24008
RP
354 exit 1
355 fi
356esac
bc58b41d 357
c1e4672c
RP
358# default exec_prefix
359case "${exec_prefix}" in
0e693d0b 360"") exec_prefix="$(prefix)" ;;
3a07a6ac
RP
361*) ;;
362esac
363
4d714963 364### break up ${srcdir}/configure.in.
a98bbe58
RP
365case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
366"")
4d714963
RP
367 echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
368 exit 1
a98bbe58
RP
369 ;;
370*) ;;
371esac
49b10446 372
a98bbe58
RP
373case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
374"")
4d714963
RP
375 echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
376 exit 1
a98bbe58
RP
377 ;;
378*) ;;
379esac
c5ae5678 380
a98bbe58
RP
381case "${TMPDIR}" in
382"") TMPDIR=/tmp ; export TMPDIR ;;
383*) ;;
384esac
eb02fd64 385
4d714963
RP
386# keep this filename short for &%*%$*# 14 char file names
387tmpfile=${TMPDIR}/cONf$$
388trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
389
390# split ${srcdir}/configure.in into common, per-host, per-target,
391# and post-target parts. Post-target is optional.
392sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
393sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
394if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
395 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
396 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
c297d71e 397else
4d714963
RP
398 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
399 echo >${tmpfile}.pos
c297d71e 400fi
eb02fd64 401
c297d71e 402### do common part of configure.in
eb02fd64 403
c5ae5678 404. ${tmpfile}.com
eb02fd64 405
ec342d7d 406# some sanity checks on configure.in
a98bbe58
RP
407case "${srctrigger}" in
408"")
8fd24008 409 echo '***' srctrigger not set in ${PWD}/configure.in. 1>&2
ec342d7d 410 exit 1
a98bbe58
RP
411 ;;
412*) ;;
413esac
ec342d7d 414
c1e4672c
RP
415result=`${configsub} ${host_alias}`
416host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
417host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
418host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
419host=${host_cpu}-${host_vendor}-${host_os}
6c18e393 420
c1e4672c 421. ${tmpfile}.hst
eb02fd64 422
c1e4672c
RP
423result=`${configsub} ${target_alias}`
424target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
425target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
426target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
427target=${target_cpu}-${target_vendor}-${target_os}
eb02fd64 428
c1e4672c 429. ${tmpfile}.tgt
49b10446 430
c1e4672c
RP
431# Find the source files, if location was not specified.
432case "${srcdir}" in
433"")
434 srcdirdefaulted=1
435 srcdir=.
436 if [ ! -r ${srctrigger} ] ; then
437 srcdir=..
438 fi
439 ;;
440*) ;;
441esac
eb02fd64 442
c1e4672c
RP
443if [ ! -r ${srcdir}/${srctrigger} ] ; then
444 case "${srcdirdefaulted}" in
445 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2 ;;
446 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2 ;;
447 esac
eb02fd64 448
c1e4672c
RP
449 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
450 exit 1
451fi
131a3881 452
c1e4672c
RP
453# Set up the list of links to be made.
454# ${links} is the list of link names, and ${files} is the list of names to link to.
eb02fd64 455
c1e4672c
RP
456# Make the links.
457configlinks="${links}"
458while [ -n "${files}" ] ; do
459 # set file to car of files, files to cdr of files
460 set ${files}; file=$1; shift; files=$*
461 set ${links}; link=$1; shift; links=$*
131a3881 462
c1e4672c
RP
463 if [ ! -r ${srcdir}/${file} ] ; then
464 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
465 echo '***' "since the file \"${file}\" does not exist." 1>&2
466 exit 1
467 fi
131a3881 468
c1e4672c
RP
469 ${remove} -f ${link}
470 rm -f config.status
471 # Make a symlink if possible, otherwise try a hard link
472 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
131a3881 473
c1e4672c
RP
474 if [ ! -r ${link} ] ; then
475 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
476 exit 1
477 fi
bc58b41d 478
c1e4672c
RP
479 case "${verbose}" in
480 "") ;;
481 *) echo "Linked \"${link}\" to \"${srcdir}/${file}\"." ;;
482 esac
483done
131a3881 484
c1e4672c
RP
485# Create a .gdbinit file which runs the one in srcdir
486# and tells GDB to look there for source files.
0df06ca0 487
c1e4672c
RP
488if [ -r ${srcdir}/.gdbinit ] ; then
489 case ${srcdir} in
490 .)
491 ;;
492 *) cat > .gdbinit <<EOF
3a07a6ac
RP
493# ${NO_EDIT} > .gdbinit
494dir .
495dir ${srcdir}
496source ${srcdir}/.gdbinit
497EOF
c1e4672c
RP
498 ;;
499 esac
500fi
0df06ca0 501
c1e4672c
RP
502# Install a makefile, and make it set VPATH
503# if necessary so that the sources are found.
504# Also change its value of srcdir.
505# NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
506# been somewhat optimized and is perhaps a bit twisty.
0df06ca0 507
c1e4672c 508# code is order so as to try to sed the smallest input files we know.
0df06ca0 509
c1e4672c
RP
510# the three makefile fragments MUST end up in the resulting Makefile in this order: target, host, and site.
511# so do these separately because I don't trust the order of sed -e expressions.
131a3881 512
c1e4672c
RP
513# Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
514case "${site}" in
515"") cp ${srcdir}/${Makefile_in} Makefile.tem ;;
516*)
517 site_makefile_frag=${srcdir}/config/ms-${site}
28f3b094 518
c1e4672c
RP
519 if [ -f ${site_makefile_frag} ] ; then
520 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${Makefile_in} \
521 > Makefile.tem
522 else
523 cp ${srcdir}/${Makefile_in} Makefile.tem
524 site_makefile_frag=
525 fi
526 ;;
527esac
528# working copy now in Makefile.tem
529
530# Conditionalize the makefile for this host.
531case "${host_makefile_frag}" in
532"") mv Makefile.tem ${Makefile} ;;
533*)
534 host_makefile_frag=${srcdir}/${host_makefile_frag}
535 if [ -f ${host_makefile_frag} ] ; then
536 sed -e "/^####/ r ${host_makefile_frag}" Makefile.tem > ${Makefile}
537 else
538 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
539 echo '***' is missing in ${PWD}. 1>&2
540 mv Makefile.tem ${Makefile}
541 fi
542esac
543# working copy now in ${Makefile}
544
545# Conditionalize the makefile for this target.
546case "${target_makefile_frag}" in
547"") mv ${Makefile} Makefile.tem ;;
548*)
549 target_makefile_frag=${srcdir}/${target_makefile_frag}
550 if [ -f ${target_makefile_frag} ] ; then
551 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > Makefile.tem
552 else
553 mv ${Makefile} Makefile.tem
554 target_makefile_frag=
555 fi
556 ;;
557esac
558# real copy now in Makefile.tem
3a07a6ac 559
c1e4672c
RP
560# prepend warning about editting, and a bunch of variables.
561cat > ${Makefile} <<EOF
3a07a6ac
RP
562# ${NO_EDIT}
563host_alias = ${host_alias}
564host_cpu = ${host_cpu}
565host_vendor = ${host_vendor}
566host_os = ${host_os}
567target_alias = ${target_alias}
568target_cpu = ${target_cpu}
569target_vendor = ${target_vendor}
570target_os = ${target_os}
571target_makefile_frag = ${target_makefile_frag}
572host_makefile_frag = ${host_makefile_frag}
573site_makefile_frag = ${site_makefile_frag}
c1e4672c 574links = ${configlinks}
3a07a6ac 575VPATH = ${srcdir}
3a07a6ac
RP
576EOF
577
c1e4672c
RP
578# fixme: this shouldn't be in configure.
579# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
580case "${host_alias}" in
581"${target_alias}")
582 tooldir="$(libdir)"
583 echo "ALL=all.internal" >> ${Makefile}
584 ;;
585*)
586 echo "CROSS=-DCROSS_COMPILE" >> ${Makefile}
587 echo "ALL=all.cross" >> ${Makefile}
588 case "${program_prefix}" in
589 "") program_prefix=${target_alias}- ;;
590 *) ;;
591 esac
592
593 tooldir="$(libdir)/${target_alias}"
594 ;;
595esac
7875b07f 596
c1e4672c
RP
597# reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS, remove any form
598# feeds.
599sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
600 -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
601 -e "s:^srcdir[ ]*=.*$:srcdir = ${srcdir}:" \
602 -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
603 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
604 -e "s/\f//" \
605 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
606 -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \
607 Makefile.tem >> ${Makefile}
608# final copy now in ${Makefile}
609
610rm Makefile.tem
611
612if [ -n "${verbose}" -o -z "${silent}" ] ; then
613 case "${host_makefile_frag}" in
614 "") using= ;;
615 *) using="and \"${host_makefile_frag}\"" ;;
616 esac
617
618 case "${target_makefile_frag}" in
619 "") ;;
620 *) using="${using} and \"${target_makefile_frag}\"" ;;
621 esac
622
623 case "${site_makefile_frag}" in
624 "") ;;
625 *) using="${using} and \"${site_makefile_frag}\"" ;;
626 esac
627
628 echo "Created \"${Makefile}\" in" ${PWD} `echo "${using}" | sed 's/and/using/'`
629fi
063efd10 630
c1e4672c 631. ${tmpfile}.pos
eb02fd64 632
c1e4672c
RP
633# describe the chosen configuration in config.status.
634# Make that file a shellscript which will reestablish
635# the same configuration. Used in Makefiles to rebuild
636# Makefiles.
b8f8fddc 637
c1e4672c
RP
638case "${norecursion}" in
639"") arguments="${arguments} -norecursion" ;;
640*) ;;
641esac
4d714963 642
c1e4672c 643echo "#!/bin/sh
4d714963
RP
644# ${NO_EDIT}
645# ${PWD} was configured as follows:
646${progname}" ${arguments} "
c5ae5678 647# ${using}" > config.status
c1e4672c
RP
648chmod a+x config.status
649
650# If there are subdirectories, then recur.
651if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
652 for configdir in ${configdirs} ; do
653 case "${verbose}" in
654 "") ;;
655 *) echo Configuring ${configdir}... ;;
a98bbe58 656 esac
bc58b41d 657
c1e4672c
RP
658 if [ -d ${srcdir}/${configdir} ] ; then
659 case "${srcdir}" in
660 ".") ;;
661 *)
662 if [ ! -d ./${configdir} ] ; then
663 mkdir ./${configdir}
664 fi
665 ;;
666 esac
bc58b41d 667
c1e4672c
RP
668 POPDIR=${PWD}
669 cd ${configdir}
670
671### figure out what to do with srcdir
672 case "${srcdir}" in
673 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
674 /*) # absolute path
675 newsrcdir=${srcdir}/${configdir}
676 srcdiroption="-srcdir=${newsrcdir}"
677 ;;
678 *) # otherwise relative
679 newsrcdir=../${srcdir}/${configdir}
680 srcdiroption="-srcdir=${newsrcdir}"
681 ;;
682 esac
683
684### check for guested configure, otherwise fix possibly relative progname
685 if [ -f ${newsrcdir}/configure ] ; then
686 recprog=${newsrcdir}/configure
687 else
688 case "${progname}" in
689 /*) recprog=${progname} ;;
690 *) recprog=../${progname} ;;
691 esac
692 fi
4d714963
RP
693
694### The recursion line is here.
c1e4672c
RP
695 if ${recprog} -s ${host_alias} -target=${target_alias} \
696 ${verbose} ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
0e693d0b 697 ${srcdiroption} ${program_prefixoption} ${site_option} ; then
c1e4672c
RP
698 true
699 else
700 exit 1
701 fi
702
703 cd ${POPDIR}
704 else
705 case "${verbose}" in
706 "") ;;
707 *) echo Warning: source directory \"${srcdir}/${configdir}\" is missing. ;;
708 esac
bc58b41d 709 fi
c1e4672c
RP
710 done
711fi
eb02fd64 712
c297d71e
RP
713### clean up.
714
4d714963
RP
715# trap cmd above handles this now:
716#rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
c297d71e 717
eb02fd64 718exit 0
74cc5508 719
0df06ca0
RP
720#
721# Local Variables:
722# fill-column: 131
723# End:
724#
74cc5508 725
46f3c7cd 726# end of configure
This page took 0.08106 seconds and 4 git commands to generate.