*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / configure
1 #!/bin/sh
2
3 # Configuration script
4 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
5
6 #This file is part of GNU.
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 # $Id$
23
24 #
25 # Shell script to create proper links to machine-dependent files in
26 # preparation for compilation.
27 #
28 # If configure succeeds, it leaves its status in config.status.
29 # If configure fails after disturbing the status quo,
30 # config.status is removed.
31 #
32
33 remove=rm
34 hard_link=ln
35 symbolic_link='ln -s'
36
37 #for Test
38 #remove="echo rm"
39 #hard_link="echo ln"
40 #symbolic_link="echo ln -s"
41
42 progname=$0
43
44 # clear some things potentially inherited from environment.
45 ansi=
46 arguments=$*
47 defaulttargets=
48 destdir=
49 fatal=
50 hostsubdir=
51 Makefile=Makefile
52 Makefile_in=Makefile.in
53 norecursion=
54 recurring=
55 removing=
56 srcdir=
57 srctrigger=
58 target=
59 targets=
60 commontargets=
61 configdirs=
62 targetsubdir=
63 template=
64 verbose=
65
66 for arg in $*;
67 do
68 case ${arg} in
69 -ansi | +a*)
70 ansi=true
71 clib=clib
72 ;;
73 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
74 destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
75 ;;
76 -languages=* | +languages=* | +language=* | +languag=* \
77 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
78 | +l=*)
79 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
80 ;;
81 -gas | +g*)
82 gas=yes
83 ;;
84 -help | +h*)
85 fatal=true
86 ;;
87 -nfp | +nf*)
88 nfp=yes
89 ;;
90 -norecursion | +no*)
91 norecursion=true
92 ;;
93 -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re)
94 recurring=true
95 ;;
96 -rm | +rm)
97 removing=${arg}
98 ;;
99 # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
100 # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
101 # ;;
102 -subdirs | +f* | +su*)
103 subdirs=${arg}
104 ;;
105 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
106 if [ -n "${targets}" ] ; then
107 subdirs="+subdirs"
108 fi
109
110 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
111 targets="${newtargets}"
112 ;;
113 -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
114 template=`echo ${arg} | sed 's/[+-]template=//'`
115 ;;
116 -v | -verbose | +v*)
117 verbose=${arg}
118 ;;
119 -* | +*)
120 (echo ;
121 echo "Unrecognized option: \"${arg}\"". ;
122 echo) 1>&2
123 fatal=true
124 ;;
125 *)
126 if [ -n "${hosts}" ] ; then
127 subdirs="+subdirs"
128 fi
129
130 newhosts="${hosts} ${arg}"
131 hosts=${newhosts}
132 ;;
133 esac
134 done
135
136 if [ -n "${verbose}" ] ; then
137 echo `pwd`/configure $*
138 fi
139
140 # process host and target only if not rebuilding configure itself or removing.
141 if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
142 # Complain if an arg is missing
143 if [ -z "${hosts}" ] ; then
144 (echo ;
145 echo "configure: No HOST specified." ;
146 echo) 1>&2
147 fatal=true
148 fi
149 fi
150
151 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
152 (echo "Usage: configure HOST" ;
153 echo ;
154 echo "Options: [defaults in brackets]" ;
155 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
156 echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
157 echo " +subdirs configure in subdirectories. [in source directories]" ;
158 echo " +lang=LANG configure to build LANG. [gcc]" ;
159 echo " +help print this message. [normal config]" ;
160 echo " +gas configure the compilers for use with gas. [native as]" ;
161 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
162 echo " +norecursion configure this directory only. [recurse]" ;
163 echo " +rm remove this configuration. [build a configuration]" ;
164 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
165 echo " +template=TEM rebuild configure using TEM. [normal config]" ;
166 echo ;
167 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
168 echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
169 echo "options given will apply to all targets.") 1>&2
170
171 if [ -r config.status ] ; then
172 cat config.status
173 fi
174
175 exit 1
176 fi
177
178 #### configure.in common parts come in here.
179 srcname="GDB"
180 srctrigger=main.c
181
182 ## end of common part.
183
184 # are we rebuilding config itself?
185 if [ -n "${template}" ] ; then
186 if [ ! -r ${template} ] ; then
187 echo '***' "Can't find template ${template}." 1>&2
188 exit 1
189 fi
190
191 # prep the template
192 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
193 #### configure.in common parts come in here.\
194 ## end of common part.' \
195 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
196 #### configure.in per-host parts come in here.\
197 ## end of per-host part.' \
198 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
199 #### configure.in per-target parts come in here.\
200 ## end of per-target part.' \
201 -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
202 #### configure.in post-target parts come in here.\
203 ## end of post-target part.' \
204 < ${template} > template.new
205
206 if [ -r configure.in ] ; then
207 if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
208 echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
209 exit 1
210 fi
211
212 if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
213 echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
214 exit 1
215 fi
216
217 # split configure.in into common, per-host, per-target,
218 # and post-target parts. Post-target is optional.
219 sed -e '/^# per\-host:/,$d' configure.in > configure.com
220 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
221 if grep -s '^# post-target:' configure.in ; then
222 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
223 sed -e '1,/^# post\-target:/d' configure.in > configure.pos
224 else
225 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
226 echo >configure.pos
227 fi
228
229 # and insert them
230 sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
231 -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
232 -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
233 -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
234 template.new > configure.new
235
236 rm -f configure.com configure.tgt configure.hst configure.pos
237 else
238 echo Warning: no configure.in in `pwd`
239 cat ${template} >> configure
240 fi
241
242 chmod a+x configure.new
243 rm template.new
244 # mv configure configure.old
245 mv configure.new configure
246
247 if [ -n "${verbose}" ] ; then
248 echo Rebuilt configure in `pwd`
249 fi
250
251 # Now update config.sub from the template directory.
252 if echo "$template" | grep -s 'configure$' ; then
253 cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
254 # mv config.sub config.sub.old
255 mv config.sub.new config.sub
256
257 if [ -n "${verbose}" ] ; then
258 echo Rebuilt config.sub in `pwd`
259 fi
260 fi
261
262 if [ -z "${norecursion}" ] ; then
263 # If template is relative path, make it absolute for recurring.
264 if echo "${template}" | grep -s '^/' ; then
265 true
266 else
267 template=`pwd`/${template}
268 fi
269
270 while [ -n "${configdirs}" ] ; do
271 # set configdir to car of configdirs, configdirs to cdr of configdirs
272 set ${configdirs}; configdir=$1; shift; configdirs=$*
273
274 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
275 targetspecificdirs=${configdir}.*
276 else
277 targetspecificdirs=
278 fi
279
280 for i in ${configdir} ${targetspecificdirs} ; do
281 if [ -d $i ] ; then
282 if [ -r $i/configure ] ; then
283 (cd $i ;
284 ./configure +template=${template} ${verbose})
285 else
286 echo Warning: No configure script in `pwd`/$i
287 fi
288 else
289 if [ -n "${verbose}" ] ; then
290 echo Warning: directory $i is missing.
291 fi
292 fi
293 done
294 done
295 fi
296
297 exit 0
298 fi
299
300 # some sanity checks on configure.in
301 if [ -z "${srctrigger}" ] ; then
302 echo Warning: srctrigger not set in configure.in. `pwd` not configured.
303 exit 1
304 fi
305
306 for host in ${hosts} ; do
307 # Default other arg
308 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
309 targets=${host}
310 defaulttargets=true
311 fi
312
313 host_alias=${host}
314
315 result=`/bin/sh ./config.sub ${host}`
316 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
317 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
318 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
319 host=${host_cpu}-${host_vendor}-${host_os}
320 host_makefile_frag=config/hmake-${host}
321
322 #### configure.in per-host parts come in here.
323
324 # map host info into gdb names.
325
326 case "${host_cpu}" in
327
328 m68k)
329 case "${host_vendor}" in
330 att) gdb_host=3b1 ;;
331 altos)
332 case "${host_os}" in
333 gas) gdb_host=altosgas ;;
334 *) gdb_host=altos ;;
335 esac
336 ;;
337 hp)
338 case ${host_os} in
339 hpux) gdb_host=hp300hpux ;;
340 bsd) gdb_host=hp300bsd ;;
341 esac
342 ;;
343
344 isi) gdb_host=isi ;;
345 sony) gdb_host=news ;;
346 sun)
347 case "${host_os}" in
348 sunos3) gdb_host=sun3os3 ;;
349 sunos4) gdb_host=sun3os4 ;;
350 *) gdb_host=sun3 ;;
351 esac
352 ;;
353 esac
354 ;;
355
356 m68000)
357 case "${host_vendor}" in
358 sun)
359 case "${host_os}" in
360 sunos3) gdb_host=sun2os3 ;;
361 sunos4) gdb_host=sun2os4 ;;
362 *) gdb_host=sun2 ;;
363 esac
364 esac
365 ;;
366
367 sparc)
368 case "${host_os}" in
369 sunos3) gdb_host=sun4os3 ;;
370 sunos4) gdb_host=sun4os4 ;;
371 *) gdb_host=sun4 ;;
372 esac
373 ;;
374
375 m68030)
376 case "${host_vendor}" in
377 sony) gdb_host=news1000 ;;
378 esac
379 ;;
380
381 mips)
382 case "${host_vendor}" in
383 sony) gdb_host=bigmips ;;
384 dec) gdb_host=dec3100 ;;
385 little) gdb_host=littlemips ;;
386 sgi) gdb_host=irix3 ;;
387 esac
388 ;;
389
390 i386)
391 case "${host_vendor}" in
392 sun) gdb_host=sun386 ;;
393 sco) gdb_host=i386sco ;;
394 sequent) gdb_host=symmetry ;;
395 *)
396 case "${host_os}" in
397 sysv) gdb_host=i386v ;;
398 sysv32) gdb_host=i386v32 ;;
399 esac
400 ;;
401 esac
402 ;;
403
404 c1 | c2) gdb_host=convex ;;
405
406 ns32k)
407 case "${host_vendor}" in
408 umax) gdb_host=umax ;;
409 esac
410 ;;
411
412 romp)
413 gdb_host=rtbsd
414 ;;
415
416 a29k)
417 gdb_host=ultra3
418 ;;
419
420 arm | vax | m88k | merlin | none | np1 | pn | pyramid | tahoe)
421 gdb_host=${host_cpu}
422 ;;
423
424 ### unhandled hosts
425 #altosgas
426 #i386v-g
427 #i386v32-g
428
429 esac
430
431 if [ ! -f xconfig/${gdb_host} ]; then
432 echo '***' "Gdb does not support host ${host}" 1>&2
433 exit 1
434 fi
435
436 # We really shouldn't depend on there being a space after XM_FILE= ...
437 hostfile=`awk '$1 == "XM_FILE=" { print $2 }' <xconfig/${gdb_host}`
438
439 ## end of per-host part.
440
441 for target in ${targets} ; do
442
443 target_alias=${target}
444 result=`/bin/sh ./config.sub ${target}`
445 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
446 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
447 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
448 target=${target_cpu}-${target_vendor}-${target_os}
449 target_makefile_frag=config/tmake-${target}
450
451 #### configure.in per-target parts come in here.
452
453 case "${target_cpu}" in
454
455 m68k)
456 case "${target_vendor}" in
457 att) gdb_target=3b1 ;;
458 altos) gdb_target=altos ;;
459 hp)
460 case "${target_os}" in
461 bsd) gdb_target=hp300bsd ;;
462 hpux) gdb_target=hp300hpux ;;
463 esac
464 ;;
465 sun)
466 case "${target_os}" in
467 sunos3) gdb_target=sun3os3 ;;
468 sunos4) gdb_target=sun3os4 ;;
469 *) gdb_target=sun3 ;;
470 esac
471 ;;
472 wrs) gdb_target=vxworks68 ;;
473 isi) gdb_target=isi ;;
474 sony) gdb_target=news ;;
475 esac
476 ;;
477
478 m68000)
479 case "${target_vendor}" in
480 sun)
481 case "${target_os}" in
482 sunos3) gdb_target=sun2os3 ;;
483 sunos4) gdb_target=sun2os4 ;;
484 *) gdb_target=sun2 ;;
485 esac
486 esac
487 ;;
488
489 m68030)
490 case "${target_vendor}" in
491 sony) gdb_target=news1000 ;;
492 esac
493 ;;
494
495 none | arm | tahoe | vax | np1 | pn | np1 | pn | pyramid | merlin | m88k)
496 gdb_target=${target_cpu} ;;
497
498 a29k)
499 case "${target_os}" in
500 none|aout|coff) gdb_target=a29k ;;
501 sym1) gdb_target=ultra3 ;;
502 kern) gdb_target=a29k-kern ;;
503 esac
504 ;;
505
506 mips)
507 case "${target_vendor}" in
508 sony) gdb_target=bigmips ;;
509 dec) gdb_target=dec3100 ;;
510 little) gdb_target=littlemips ;;
511 sgi) gdb_target=irix3 ;;
512 esac
513 ;;
514
515 c1 | c2) gdb_target=convex ;;
516
517 sparc)
518 case "${target_vendor}" in
519 sun)
520 case "${target_os}" in
521 sunos3) gdb_target=sun4os3 ;;
522 sunos4) gdb_target=sun4os4 ;;
523 *) gdb_target=sun4 ;;
524 esac
525 ;;
526 esac
527 ;;
528
529
530 i386)
531 case "${target_vendor}" in
532 sco) gdb_target=i386sco ;;
533 sun) gdb_target=sun386 ;;
534 sequent) gdb_target=symmetry ;;
535 coff) gdb_target=i386v ;;
536 aout) gdb_target=i386v ;;
537 *)
538 case "${target_os}" in
539 sysv) gdb_target=i386v ;;
540 sysv32) gdb_target=i386v32 ;;
541 esac
542 esac
543 ;;
544
545 i960)
546 case "${target_vendor}" in
547 bout | wrs) gdb_target=vxworks960 ;;
548 coff | intel) gdb_target=nindy960 ;;
549 esac
550 ;;
551
552 ns32k)
553 case "${target_vendor}" in
554 utek) gdb_target=umax ;;
555 esac
556 ;;
557
558 ### unhandled targets
559 # altosgas
560 # i386v-g
561 # i386v32-g
562
563 esac
564
565 if [ ! -f tconfig/${gdb_target} ]; then
566 echo '***' "Gdb does not support target ${target}" 1>&2
567 exit 1
568 fi
569
570 if [ -z "${removing}" ] ; then
571 cat xconfig/${gdb_host} tconfig/${gdb_target} | awk '$1 == "#msg" {
572 print substr($0,6)}'
573 fi
574
575 # We really shouldn't depend on there being a space after TM_FILE= ...
576 targetfile=`awk '$1 == "TM_FILE=" { print $2 }' <tconfig/${gdb_target}`
577
578 host_makefile_frag=xconfig/${gdb_host}
579 target_makefile_frag=tconfig/${gdb_target}
580
581 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) is not set in the
582 # ?config/* file, we don't make the corresponding links. But we have
583 # to remove the xm.h files and tm.h files anyway, e.g. when switching
584 # from "configure host" to "configure none".
585 files=
586 links=
587 rm -f xm.h
588 if [ "${hostfile}" != "" ]; then
589 files="${files} ${hostfile}"
590 links="${links} xm.h"
591 fi
592 rm -f tm.h
593 if [ "${targetfile}" != "" ]; then
594 files="${files} ${targetfile}"
595 links="${links} tm.h"
596 fi
597
598 ## end of per-target part.
599
600 # Temporarily, we support only direct subdir builds.
601 hostsubdir=H-${host_alias}
602 targetsubdir=T-${target_alias}
603
604 if [ -n "${removing}" ] ; then
605 if [ -n "${subdirs}" ] ; then
606 if [ -d "${hostsubdir}" ] ; then
607 rm -rf ${hostsubdir}/${targetsubdir}
608
609 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
610 rm -rf ${hostsubdir}
611 fi
612 else
613 echo Warning: no `pwd`/${hostsubdir} to remove.
614 fi
615 else
616 rm -f ${Makefile} config.status ${links}
617 fi
618 else
619 if [ -n "${subdirs}" ] ; then
620 # check for existing status before allowing forced subdirs.
621 if [ -f ${Makefile} ] ; then
622 echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2
623 exit 1
624 fi
625
626 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
627 cd ${hostsubdir}
628
629 if [ ! -d ${targetsubdir} ] ; then
630 if [ -z "${commontargets}" ] ; then
631 mkdir ${targetsubdir}
632 else
633 if [ ! -d Target-independent ] ; then
634 mkdir Target-independent
635 fi
636
637 ${symbolic_link} Target-independent ${targetsubdir}
638 fi # if target independent
639 fi # if no target dir yet
640
641 cd ${targetsubdir}
642
643 srcdir=../..
644 else
645 # if not subdir builds, then make sure none exist.
646 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
647 echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
648 exit 1
649 fi
650 fi
651
652 # Find the source files, if location was not specified.
653 if [ -z "${srcdir}" ] ; then
654 srcdirdefaulted=1
655 srcdir=.
656 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
657 srcdir=..
658 fi
659 fi
660
661 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
662 if [ -z "${srcdirdefaulted}" ] ; then
663 echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
664 else
665 echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
666 fi
667
668 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
669 exit 1
670 fi
671
672 # Set up the list of links to be made.
673 # ${links} is the list of link names, and ${files} is the list of names to link to.
674
675 # Make the links.
676 while [ -n "${files}" ] ; do
677 # set file to car of files, files to cdr of files
678 set ${files}; file=$1; shift; files=$*
679 set ${links}; link=$1; shift; links=$*
680
681 if [ ! -r ${srcdir}/${file} ] ; then
682 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
683 echo '***' "since the file \"${file}\" does not exist." 1>&2
684 exit 1
685 fi
686
687 ${remove} -f ${link}
688 rm -f config.status
689 # Make a symlink if possible, otherwise try a hard link
690 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
691
692 if [ ! -r ${link} ] ; then
693 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
694 exit 1
695 fi
696
697 if [ -n "${verbose}" ] ; then
698 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
699 fi
700 done
701
702 # Create a .gdbinit file which runs the one in srcdir
703 # and tells GDB to look there for source files.
704
705 case ${srcdir} in
706 .)
707 ;;
708 *)
709 echo "dir ." > .gdbinit
710 echo "dir ${srcdir}" >> .gdbinit
711 echo "source ${srcdir}/.gdbinit" >> .gdbinit
712 ;;
713 esac
714
715 # Install a makefile, and make it set VPATH
716 # if necessary so that the sources are found.
717 # Also change its value of srcdir.
718
719 # FIXME-someday: This business of always writing to .tem and mv back
720 # is so that I don't screw things up while developing. Once this
721 # template is stable, these should be optimized. xoxorich.
722
723 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
724 if [ "${host}" != "${target}" ] ; then
725 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
726 echo "ALL=start.encap" >> ${Makefile}
727 else
728 echo "ALL=all.internal" > ${Makefile}
729 fi
730
731 # set target, host, VPATH
732 echo "host_alias = ${host_alias}" >> ${Makefile}
733 echo "host_cpu = ${host_cpu}" >> ${Makefile}
734 echo "host_vendor = ${host_vendor}" >> ${Makefile}
735 echo "host_os = ${host_os}" >> ${Makefile}
736
737 echo "target_alias = ${target_alias}" >> ${Makefile}
738 echo "target_cpu = ${target_cpu}" >> ${Makefile}
739 echo "target_vendor = ${target_vendor}" >> ${Makefile}
740 echo "target_os = ${target_os}" >> ${Makefile}
741
742 if [ -n "${subdirs}" ] ; then
743 echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
744 else
745 echo "subdir =" >> ${Makefile}
746 fi
747
748 # echo "workdir = `pwd`" >> ${Makefile}
749 echo "VPATH = ${srcdir}" >> ${Makefile}
750
751 # add "Makefile.in" (or whatever it's called)
752 cat ${srcdir}/${Makefile_in} >> ${Makefile}
753
754 # Conditionalize the makefile for this host.
755 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
756 (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ;
757 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
758 mv Makefile.tem ${Makefile}
759 fi
760
761 # Conditionalize the makefile for this target.
762 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
763 (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ;
764 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
765 mv Makefile.tem ${Makefile}
766 fi
767
768 # set srcdir
769 sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
770 mv Makefile.tem ${Makefile}
771
772 # set destdir
773 if [ -n "${destdir}" ] ; then
774 sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
775 mv Makefile.tem ${Makefile}
776 fi
777
778 # reset SUBDIRS
779 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
780 mv Makefile.tem ${Makefile}
781
782 # reset NONSUBDIRS
783 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
784 mv Makefile.tem ${Makefile}
785
786 using=
787 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
788 using=" using \"${host_makefile_frag}\""
789 fi
790
791 # remove any form feeds.
792 sed -e "s/\f//" ${Makefile} > Makefile.tem
793 mv Makefile.tem ${Makefile}
794
795 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
796 if [ -z "${using}" ] ; then
797 andusing=" using \"${target_makefile_frag}\""
798 else
799 andusing="${using} and \"${target_makefile_frag}\""
800 fi
801 else
802 andusing=${using}
803 fi
804
805 if [ -n "${verbose}" -o -z "${recurring}" ] ; then
806 echo "Created \"${Makefile}\"" in `pwd`${andusing}.
807 fi
808
809 #### configure.in post-target parts come in here.
810
811 case ${srcdir} in
812 .)
813 ;;
814 *)
815 grep -s "source ${srcdir}/.gdbinit" .gdbinit 2>/dev/null || \
816 echo "source ${srcdir}/.gdbinit" >> .gdbinit
817 esac
818
819 cat ${srcdir}/alldeps.mak ${srcdir}/depend >>Makefile
820 ## end of post-target part.
821
822 # describe the chosen configuration in config.status.
823 # Make that file a shellscript which will reestablish
824 # the same configuration. Used in Makefiles to rebuild
825 # Makefiles.
826
827 echo "#!/bin/sh
828 # ${srcname} was configured as follows:
829 ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status
830 chmod a+x config.status
831
832 originaldir=`pwd`
833 cd ${srcdir}
834 fi
835
836 # If there are subdirectories, then recurse.
837 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
838 for configdir in ${configdirs} ; do
839 if [ -n "${verbose}" ] ; then
840 echo Configuring ${configdir}...
841 fi
842
843 if [ -d ${configdir} ] ; then
844 (cd ${configdir} ;
845 ./configure +recurring ${host_alias} +target=${target_alias} \
846 ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
847 | sed 's/^/ /'
848 else
849 if [ -n "${verbose}" ] ; then
850 echo Warning: directory \"${configdir}\" is missing.
851 fi
852 fi
853 done
854 fi
855 done # for each target
856
857 # Now build a Makefile for this host.
858 if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
859 cd ${hostsubdir}
860 cat > GNUmakefile << E!O!F
861 # Makefile generated by configure for host ${host_alias}.
862
863 ALL := $(shell ls -d Target-*)
864
865 %:
866 $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
867
868 all:
869 E!O!F
870 cd ..
871 fi
872 done # for each host
873
874 exit 0
875
876 #
877 # Local Variables:
878 # fill-column: 131
879 # End:
880 #
881
882 # end of configure
This page took 0.047555 seconds and 4 git commands to generate.