Initial revision
[deliverable/binutils-gdb.git] / readline / configure
1 #!/bin/sh
2 # Please do not edit this file. It is generated automatically from
3 # configure.in and a configure template.
4 configdirs=
5
6 #!/bin/sh
7
8 # Configuration script template
9 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
10
11 #This file is part of GNU.
12
13 #GNU CC is free software; you can redistribute it and/or modify
14 #it under the terms of the GNU General Public License as published by
15 #the Free Software Foundation; either version 1, or (at your option)
16 #any later version.
17
18 #GNU CC is distributed in the hope that it will be useful,
19 #but WITHOUT ANY WARRANTY; without even the implied warranty of
20 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 #GNU General Public License for more details.
22
23 #You should have received a copy of the GNU General Public License
24 #along with GNU CC; see the file COPYING. If not, write to
25 #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 # $Id$
28
29 #
30 # Shell script to create proper links to machine-dependent files in
31 # preparation for compilation.
32 #
33 # If configure succeeds, it leaves its status in config.status.
34 # If configure fails after disturbing the status quo,
35 # config.status is removed.
36 #
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 progname=$0
48
49 # clear some things potentially inherited from environment.
50 ansi=
51 defaulttargets=
52 destdir=
53 fatal=
54 hostsubdir=
55 norecurse=
56 removing=
57 srcdir=
58 srctrigger=
59 target=
60 targets=
61 targetsubdir=
62 template=
63 verbose=
64
65 for arg in $*;
66 do
67 case ${arg} in
68 -ansi | +ansi)
69 ansi=true
70 ;;
71 -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
72 destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
73 ;;
74 -forcesubdirs | +forcesubdirs | +forcesubdir | +forcesubdi | +forcesubd \
75 | +forcesub | +forcesu | +forces | +force | +forc | +for | +fo | +f)
76 forcesubdirs=${arg}
77 ;;
78 -languages=* | +languages=* | +language=* | +languag=* \
79 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
80 | +l=*)
81 languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
82 ;;
83 -gas | +gas | +ga | +g)
84 gas=yes
85 ;;
86 -help | +h | +help)
87 fatal=true
88 ;;
89 -nfp | +nfp | +nf | +n)
90 nfp=yes
91 ;;
92 -norecurse | +norecurse)
93 norecurse=true
94 ;;
95 -rm | +rm)
96 removing=${arg}
97 ;;
98 # -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
99 # srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
100 # ;;
101 -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=* | +t=*)
102 if [ -n "${targets}" ] ; then
103 forcesubdirs="+forcesubdirs"
104 fi
105
106 newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
107 targets="${newtargets}"
108 ;;
109 -template=* | +template=*)
110 template=`echo ${arg} | sed 's/[+-]template=//'`
111 ;;
112 +verbose | +verbos | +verbo | +verb | +ver | +ve | +v)
113 verbose=${arg}
114 ;;
115 -* | +*)
116 (echo ;
117 echo "Unrecognized option: \"${arg}\"". ;
118 echo) 1>&2
119 fatal=true
120 ;;
121 *)
122 if [ -n "${hosts}" ] ; then
123 forcesubdirs="+forcesubdirs"
124 fi
125
126 newhosts="${hosts} ${arg}"
127 hosts=${newhosts}
128 ;;
129 esac
130 done
131
132 if [ -n "${verbose}" ] ; then
133 echo `pwd`/configure $*
134 echo targets=\"${targets}\"
135 fi
136
137 # process host and target only if not rebuilding configure itself or removing.
138 if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
139 # Complain if an arg is missing
140 if [ -z "${hosts}" ] ; then
141 (echo ;
142 echo "configure: No HOST specified." ;
143 echo) 2>&1
144 fatal=true
145 fi
146 fi
147
148 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
149 (echo "Usage: configure HOST" ;
150 echo ;
151 echo "Options: [defaults in brackets]" ;
152 echo " +ansi configure w/ANSI library. [no ansi lib]" ;
153 echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ;
154 echo " +forcesubdirs configure in subdirectories. [in source directories]" ;
155 echo " +lang=LANG configure to build LANG. [gcc]" ;
156 echo " +help print this message. [normal config]" ;
157 echo " +gas configure the compilers for use with gas. [native as]" ;
158 echo " +nfp configure the compilers default to soft floating point. [hard float]" ;
159 echo " +norecurse configure this directory only. [recurse]" ;
160 echo " +rm remove this configuration. [build a configuration]" ;
161 echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
162 echo " +template=TEM rebuild configure using TEM. [normal config]" ;
163 echo ;
164 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
165 echo "Asking for more than one \"+target\" implies \"+forcesubdirs\". Any other" ;
166 echo "options given will apply to all targets.") 1>&2
167
168 if [ -r config.status ] ; then
169 cat config.status
170 fi
171
172 exit 1
173 fi
174
175 #### configure.in common parts come in here.
176 # This file is a shell script fragment that supplies the information
177 # necessary to tailor a template configure script into the configure
178 # script appropriate for this directory. For more information, check
179 # any existing configure script.
180
181 configdirs=
182 srctrigger=readline.c
183 srcname="the readline library"
184
185 ## end of common part.
186
187 # are we rebuilding config itself?
188 if [ -n "${template}" ] ; then
189 if [ ! -r ${template} ] ; then
190 echo "Can't find template ${template}."
191 exit 1
192 fi
193
194 # prep the template
195 sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
196 #### configure.in common parts come in here.\
197 ## end of common part.' \
198 -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
199 #### configure.in per-host parts come in here.\
200 ## end of per-host part.' \
201 -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
202 #### configure.in per-target parts come in here.\
203 ## end of per-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.
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.
214 exit 1
215 fi
216
217 # split configure.in into common, per-host, and per-target parts
218 sed -e '/^# per\-host:/,$d' configure.in > configure.com
219 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
220 sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
221
222 # and insert them
223 sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
224 -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
225 -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
226 template.new > configure.new
227
228 rm -f configure.com configure.tgt configure.hst
229 else
230 echo Warning: no configure.in in `pwd`
231 cat ${template} >> configure
232 fi
233
234 chmod a+x configure.new
235 rm template.new
236 # mv configure configure.old
237 mv configure.new configure
238 echo Rebuilt configure in `pwd`
239
240 if [ -z "${norecurse}" ] ; then
241 while [ -n "${configdirs}" ] ; do
242 # set configdir to car of configdirs, configdirs to cdr of configdirs
243 set ${configdirs}; configdir=$1; shift; configdirs=$*
244
245 if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
246 targetspecificdirs=${configdir}.*
247 else
248 targetspecificdirs=
249 fi
250
251 for i in ${configdir} ${targetspecificdirs} ; do
252 if [ -d $i ] ; then
253 if [ -r $i/configure ] ; then
254 (cd $i ;
255 ./configure +template=${template} ${verbose})
256 else
257 echo No configure script in `pwd`/$i
258 fi
259 else
260 echo Warning: directory $i is missing.
261 fi
262 done
263 done
264 fi
265
266 exit 0
267 fi
268
269 # some sanity checks on configure.in
270 if [ -z "${srctrigger}" ] ; then
271 echo srctrigger not set in configure.in. `pwd` not configured.
272 exit 1
273 fi
274
275 for host in ${hosts} ; do
276 # Default other arg
277 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
278 targets=${host}
279 defaulttargets=true
280 fi
281
282 #### configure.in per-host parts come in here.
283
284 ## end of per-host part.
285
286
287 for target in ${targets} ; do
288
289 if [ -n "${verbose}" ] ; then
290 echo " "target=\"${target}\"
291 fi
292
293 #### configure.in per-target parts come in here.
294
295 ## end of per-target part.
296
297 # Temporarily, we support only direct subdir builds.
298 hostsubdir=Host-${host}
299 targetsubdir=Target-${target}
300
301 if [ -n "${removing}" ] ; then
302 if [ -n "${forcesubdirs}" ] ; then
303 if [ -d "${hostsubdir}" ] ; then
304 rm -rf ${hostsubdir}/${targetsubdir}
305
306 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ] ; then
307 rm -rf ${hostsubdir}
308 fi
309 else
310 echo Warning: no `pwd`/${hostsubdir} to remove.
311 fi
312 else
313 rm -f Makefile config.status ${links}
314 fi
315 else
316 if [ -n "${forcesubdirs}" ] ; then
317 # check for existing status before allowing forced subdirs.
318 if [ -f Makefile ] ; then
319 echo "Makefile already exists in source directory. `pwd` not configured."
320 exit 1
321 fi
322
323 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
324 cd ${hostsubdir}
325
326 if [ ! -d ${targetsubdir} ] ; then mkdir ${targetsubdir} ; fi
327 cd ${targetsubdir}
328
329 srcdir=../..
330 else
331 # if not subdir builds, then make sure none exist.
332 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
333 echo "Configured subdirs exist. `pwd` not configured."
334 exit 1
335 fi
336 fi
337
338 # Find the source files, if location was not specified.
339 if [ -z "${srcdir}" ] ; then
340 srcdirdefaulted=1
341 srcdir=.
342 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
343 srcdir=..
344 fi
345 fi
346
347 if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
348 if [ -z "${srcdirdefaulted}" ] ; then
349 echo "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
350 else
351 echo "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
352 fi
353
354 echo \(At least ${srctrigger} is missing.\) 1>&2
355 exit 1
356 fi
357
358 # Set up the list of links to be made.
359 # ${links} is the list of link names, and ${files} is the list of names to link to.
360
361 # Make the links.
362 while [ -n "${files}" ] ; do
363 # set file to car of files, files to cdr of files
364 set ${files}; file=$1; shift; files=$*
365 set ${links}; link=$1; shift; links=$*
366
367 if [ ! -r ${srcdir}/${file} ] ; then
368 echo "${progname}: cannot create a link \"${link}\"," 1>&2
369 echo "since the file \"${file}\" does not exist." 1>&2
370 exit 1
371 fi
372
373 ${remove} -f ${link}
374 rm -f config.status
375 # Make a symlink if possible, otherwise try a hard link
376 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
377
378 if [ ! -r ${link} ] ; then
379 echo "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
380 exit 1
381 fi
382 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
383 done
384
385 # Create a .gdbinit file which runs the one in srcdir
386 # and tells GDB to look there for source files.
387
388 case ${srcdir} in
389 .)
390 ;;
391 *)
392 echo "dir ." > .gdbinit
393 echo "dir ${srcdir}" >> .gdbinit
394 echo "source ${srcdir}/.gdbinit" >> .gdbinit
395 ;;
396 esac
397
398 # Install a makefile, and make it set VPATH
399 # if necessary so that the sources are found.
400 # Also change its value of srcdir.
401
402 # FIXME-someday: This business of always writing to .tem and mv back
403 # is so that I don't screw things up while developing. Once this
404 # template is stable, these should be optimized. xoxorich.
405
406 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
407 if [ "${host}" != "${target}" ] ; then
408 echo "CROSS=-DCROSS_COMPILE" > Makefile
409 echo "ALL=start.encap" >> Makefile
410 else
411 echo "ALL=all.internal" > Makefile
412 fi
413
414 # set target, host, VPATH
415 echo "host = ${host}" >> Makefile
416 echo "target = ${target}" >> Makefile
417
418 if [ -n "${forcesubdirs}" ] ; then
419 echo "subdir = /${hostsubdir}/${targetsubdir}" >> Makefile
420 else
421 echo "subdir =" >> Makefile
422 fi
423
424 # echo "workdir = `pwd`" >> Makefile
425 echo "VPATH = ${srcdir}" >> Makefile
426
427 # add Makefile.in
428 cat ${srcdir}/Makefile.in >> Makefile
429
430 # and shake thoroughly.
431 if [ -z "${host_makefile_frag}" ] ; then
432 host_makefile_frag=config/hmake-${host}
433 fi
434
435 if [ -z "${target_makefile_frag}" ] ; then
436 target_makefile_frag=config/tmake-${target}
437 fi
438
439 # Conditionalize the makefile for this host.
440 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
441 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" Makefile > Makefile.tem
442 mv Makefile.tem Makefile
443 fi
444
445 # Conditionalize the makefile for this target.
446 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
447 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" Makefile > Makefile.tem
448 mv Makefile.tem Makefile
449 fi
450
451 # set srcdir
452 sed "s@^srcdir = \.@srcdir = ${srcdir}@" Makefile > Makefile.tem
453 mv Makefile.tem Makefile
454
455 # set destdir
456 if [ -n "${destdir}" ] ; then
457 sed "s:^destdir =.*$:destdir = ${destdir}:" Makefile > Makefile.tem
458 mv Makefile.tem Makefile
459 fi
460
461 # Remove all formfeeds, since some Makes get confused by them.
462 sed "s/\f//" Makefile >> Makefile.tem
463 mv Makefile.tem Makefile
464
465 # reset SUBDIRS
466 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile > Makefile.tem
467 mv Makefile.tem Makefile
468
469 # reset NONSUBDIRS
470 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile > Makefile.tem
471 mv Makefile.tem Makefile
472
473 using=
474 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
475 using=" using \"${host_makefile_frag}\""
476 fi
477
478 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
479 if [ -z "${using}" ] ; then
480 andusing=" using \"${target_makefile_frag}\""
481 else
482 andusing="${using} and \"${target_makefile_frag}\""
483 fi
484 else
485 andusing=${using}
486 fi
487
488 echo "Created \"Makefile\"" in `pwd`${andusing}.
489
490 if [ "${host}" = "${target}" ] ; then
491 echo "Links are now set up for use with a ${target}." \
492 > config.status
493 # | tee ${srcdir}/config.status
494 else
495 echo "Links are now set up for host ${host} and target ${target}." \
496 > config.status
497 # | tee ${srcdir}/config.status
498 fi
499
500 originaldir=`pwd`
501 cd ${srcdir}
502 fi
503 done # for each target
504
505 # # Now build a Makefile for this host.
506 # if [ -n "${forcesubdirs}" ] ; then
507 # cd ${hostsubdir}
508 # cat > GNUmakefile << E!O!F
509 ## Makefile generated by configure for host ${host}.
510 #
511 #%:
512 # for i in ${targets} ; do \
513 # $(MAKE) -C Target-\$i \$@
514 #
515 #all clean stage1 stage2 stage3 stage4etags tags TAGS
516 #E!O!F
517 # fi
518 done # for each host
519
520 # If there are subdirectories, then recurse.
521
522 if [ -n "${norecurse}" -o -z "${configdirs}" ] ; then exit 0 ; fi
523
524 # configdirs is not null
525 for configdir in ${configdirs} ; do
526 echo Configuring ${configdir}...
527 specifics=
528 commons=
529
530 if [ -n "${defaulttargets}" ] ; then
531 for host in ${hosts} ; do
532 if [ -d ${configdir}.${host} ] ; then
533 newspecifics="${specifics} ${host}"
534 specifics=${newspecifics}
535 else
536 newcommons="${commons} ${host}"
537 commons=${newcommons}
538 fi # if target specific
539 done # for each host
540
541 if [ -n "${commons}" ] ; then
542 if [ -d ${configdir} ] ; then
543 (cd ${configdir} ;
544 ./configure ${commons} ${verbose} ${forcesubdirs} ${removing}) \
545 | sed 's/^/ /'
546 else
547 echo Warning: directory \"${configdir}\" is missing.
548 fi
549 fi # if any common hosts
550
551 if [ -n "${specifics}" ] ; then
552 for host in ${specifics} ; do
553 echo Configuring target specific directory ${configdir}.${host}...
554 (cd ${configdir}.${host} ;
555 ./configure ${host} ${verbose} ${forcesubdirs} ${removing}) \
556 | sed 's/^/ /'
557 done # for host in specifics
558 fi # if there are any specifics
559 else
560
561 for target in ${targets} ; do
562 if [ -d ${configdir}.${target} ] ; then
563 newspecifics="${specifics} ${target}"
564 specifics=${newspecifics}
565 else
566 newcommons="${commons} +target=${target}"
567 commons=${newcommons}
568 fi
569
570 done # check for target specific dir override
571
572 if [ -n "${verbose}" ] ; then
573 echo " "commons=\"${commons}\"
574 echo " "specifics=\"${specifics}\"
575 fi # if verbose
576
577 if [ -n "${commons}" ] ; then
578 if [ -d ${configdir} ] ; then
579 (cd ${configdir} ;
580 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons}) \
581 | sed 's/^/ /'
582 else
583 echo Warning: directory \"${configdir}\" is missing.
584 fi
585 fi # if any commons
586
587 if [ -n "${specifics}" ] ; then
588 for target in ${specifics} ; do
589 echo Configuring target specific directory ${configdir}.${target}...
590 (cd ${configdir}.${target} ;
591 ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}") \
592 | sed 's/^/ /'
593 done
594 fi # if any specifics
595 fi # not default targets
596 done
597
598 exit 0
599
600 #
601 # $Log$
602 # Revision 1.1 1991/05/21 19:55:06 rich
603 # Initial revision
604 #
605 # Revision 1.12 1991/05/19 00:32:13 rich
606 # Changes to deal with missing subdirs gracefully, and changes dictated
607 # from dropping configure over gdb.
608 #
609 # Revision 1.4 1991/05/19 00:16:45 rich
610 # Configure for gdb.
611 #
612 # Revision 1.10 1991/05/04 00:58:38 rich
613 # Fix program name bug.
614 #
615 # Revision 1.9 1991/05/03 19:14:18 rich
616 # Changed getopt to libiberty, commented out an aborted attempt at host
617 # level Makefiles because it caused errors on +rm, add a warning for
618 # directories expected to be removed on +rm but that don't exist.
619 #
620 # Revision 1.8 1991/04/24 16:50:59 rich
621 # Three staging checkpoint.
622 #
623 # Revision 1.7 1991/04/17 01:34:47 rich
624 # Added getopt for binutils, fixed problem with host dependancies in
625 # configure.template.
626 #
627 # Revision 1.6 1991/04/16 00:18:44 rich
628 # Now handles multiple hosts and targets.
629 #
630 # Revision 1.5 1991/04/15 23:43:44 rich
631 # Now handles multiple hosts and targets.
632 #
633 # Revision 1.4 1991/04/13 02:11:03 rich
634 # Config cut 3. We now almost install a29k.
635 #
636 # Revision 1.3 1991/04/11 02:41:54 rich
637 # Cut 2 config. Subdirs.
638 #
639 #
640 #
641
642 #
643 # Local Variables:
644 # fill-column: 131
645 # End:
646 #
647
648 # end of configure.template
This page took 0.052187 seconds and 5 git commands to generate.