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